Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions .gcp.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
SENTRIUS_VERSION=1.0.48
SENTRIUS_SSH_VERSION=1.0.7
SENTRIUS_KEYCLOAK_VERSION=1.0.10
SENTRIUS_AGENT_VERSION=1.0.19
SENTRIUS_AI_AGENT_VERSION=1.0.0
LLMPROXY_VERSION=1.0.0
LAUNCHER_VERSION=1.0.0
AGENTPROXY_VERSION=1.0.0
SSHPROXY_VERSION=1.0.0
RDPPROXY_VERSION=1.0.0
GITHUB_MCP_VERSION=1.0.0
SENTRIUS_VERSION=1.1.51
SENTRIUS_SSH_VERSION=1.1.10
SENTRIUS_KEYCLOAK_VERSION=1.1.13
SENTRIUS_AGENT_VERSION=1.1.22
SENTRIUS_AI_AGENT_VERSION=1.1.3
LLMPROXY_VERSION=1.1.3
LAUNCHER_VERSION=1.1.3
AGENTPROXY_VERSION=1.1.3
SSHPROXY_VERSION=1.1.3
RDPPROXY_VERSION=1.1.3
GITHUB_MCP_VERSION=1.1.3
PROMPT_ADVISOR_VERSION=1.1.6
MONITORING_AGENT_VERSION=1.1.21
17 changes: 13 additions & 4 deletions .gcp.env.bak
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
SENTRIUS_VERSION=1.0.47
SENTRIUS_SSH_VERSION=1.0.6
SENTRIUS_KEYCLOAK_VERSION=1.0.9
SENTRIUS_AGENT_VERSION=1.0.18
SENTRIUS_VERSION=1.1.50
SENTRIUS_SSH_VERSION=1.1.9
SENTRIUS_KEYCLOAK_VERSION=1.1.12
SENTRIUS_AGENT_VERSION=1.1.21
SENTRIUS_AI_AGENT_VERSION=1.1.2
LLMPROXY_VERSION=1.1.2
LAUNCHER_VERSION=1.1.2
AGENTPROXY_VERSION=1.1.2
SSHPROXY_VERSION=1.1.2
RDPPROXY_VERSION=1.1.2
GITHUB_MCP_VERSION=1.1.2
PROMPT_ADVISOR_VERSION=1.1.5
MONITORING_AGENT_VERSION=1.1.20
1 change: 1 addition & 0 deletions TunerPro
Submodule TunerPro added at af0edb
5 changes: 5 additions & 0 deletions agent-proxy/src/main/resources/java-agents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ description: >
trust_score:
minimum: 80
marginal_threshold: 50
weightings:
identity: 0.3
provenance: 0.2
runtime: 0.3
behavior: 0.2

capabilities:
- id: terminal-log-access
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class AutomationSuggestionAnalyzer {
private final AutomationSuggestionRepository suggestionRepository;
private final IntegrationSecurityTokenService integrationSecurityTokenService;
private final LLMService llmService;
private final io.sentrius.sso.core.config.SystemOptions systemOptions;

private static final int MIN_PATTERN_FREQUENCY = 3;
private static final int MIN_COMMAND_SEQUENCE_LENGTH = 2;
Expand Down Expand Up @@ -186,8 +187,8 @@ private void generateAutomationSuggestion(
int frequency
) throws JsonProcessingException, ZtatException {
var token = integrationSecurityTokenService
.findByConnectionType("openai")
.stream().findFirst().orElse(null);
.selectToken(systemOptions.getDefaultLlmProvider())
.orElse(null);

if (token == null) return;

Expand Down Expand Up @@ -218,8 +219,8 @@ private void generateRdpAutomationSuggestion(
int frequency
) throws JsonProcessingException, ZtatException {
var token = integrationSecurityTokenService
.findByConnectionType("openai")
.stream().findFirst().orElse(null);
.selectToken(systemOptions.getDefaultLlmProvider())
.orElse(null);

if (token == null) return;

Expand Down Expand Up @@ -448,7 +449,7 @@ private String decodeCommand(String encoded) {

private boolean isLLMAvailable() {
return integrationSecurityTokenService
.findByConnectionType("openai")
.stream().findFirst().isPresent();
.selectToken(systemOptions.getDefaultLlmProvider())
.isPresent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ private String analyzeScreenshots(String sessionId, List<RdpSessionScreenshot> s
private String getLLMAnalysis(List<RdpSessionScreenshot> screenshots) {
try {
// Get a token for LLM service
var token = integrationSecurityTokenService.findByConnectionType("openai")
.stream().findFirst().orElse(null);
var token = integrationSecurityTokenService.selectToken("openai")
.orElse(null);
if (token == null) {
log.debug("No OpenAI token available for vision analysis");
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,8 @@ private void createBasicSummary(SessionLog sessionLog, List<TerminalLogs> termin
*/
private boolean isLLMAvailable() {
try {
var token = integrationSecurityTokenService.findByConnectionType("openai")
.stream().findFirst().orElse(null);
return token != null;
return integrationSecurityTokenService.selectToken("openai")
.isPresent();
} catch (Exception e) {
log.debug("Error checking LLM availability", e);
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package io.sentrius.sso.controllers.api;

import io.sentrius.sso.core.annotations.LimitAccess;
import io.sentrius.sso.core.config.SystemOptions;
import io.sentrius.sso.core.config.ThreadSafeDynamicPropertiesService;
import io.sentrius.sso.core.controllers.BaseController;
import io.sentrius.sso.core.model.security.enums.ApplicationAccessEnum;
import io.sentrius.sso.core.services.ErrorOutputService;
import io.sentrius.sso.core.services.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/api/v1/ai")
public class AIServicesApiController extends BaseController {

private final ThreadSafeDynamicPropertiesService dynamicPropertiesService;

public AIServicesApiController(
UserService userService,
SystemOptions systemOptions,
ErrorOutputService errorOutputService,
ThreadSafeDynamicPropertiesService dynamicPropertiesService
) {
super(userService, systemOptions, errorOutputService);
this.dynamicPropertiesService = dynamicPropertiesService;
}

@PostMapping("/llm-provider")
@LimitAccess(applicationAccess = {ApplicationAccessEnum.CAN_MANAGE_APPLICATION})
public ResponseEntity<?> updateLlmProvider(@RequestBody Map<String, String> request) {
try {
String provider = request.get("provider");
if (provider == null || provider.trim().isEmpty()) {
return ResponseEntity.badRequest().body(Map.of("error", "Provider is required"));
}

// Validate provider (openai or claude)
if (!provider.equals("openai") && !provider.equals("claude")) {
return ResponseEntity.badRequest().body(Map.of("error", "Invalid provider. Must be 'openai' or 'claude'"));
}

// Update the system option dynamically
dynamicPropertiesService.updateProperty("defaultLlmProvider", provider);

log.info("Updated default LLM provider to: {}", provider);

return ResponseEntity.ok(Map.of(
"success", true,
"provider", provider,
"message", "LLM provider updated successfully"
));
} catch (Exception e) {
log.error("Error updating LLM provider", e);
return ResponseEntity.internalServerError().body(Map.of("error", e.getMessage()));
}
}

@GetMapping("/llm-provider")
@LimitAccess(applicationAccess = {ApplicationAccessEnum.CAN_MANAGE_APPLICATION})
public ResponseEntity<?> getLlmProvider() {
return ResponseEntity.ok(Map.of(
"provider", systemOptions.getDefaultLlmProvider()
));
}

@PostMapping("/preferred-integration")
@LimitAccess(applicationAccess = {ApplicationAccessEnum.CAN_MANAGE_APPLICATION})
public ResponseEntity<?> updatePreferredIntegration(@RequestBody Map<String, Object> request) {
try {
String provider = (String) request.get("provider");
Object integrationIdObj = request.get("integrationId");

if (provider == null || provider.trim().isEmpty()) {
return ResponseEntity.badRequest().body(Map.of("error", "Provider is required"));
}

// Validate provider (openai or claude)
if (!provider.equals("openai") && !provider.equals("claude")) {
return ResponseEntity.badRequest().body(Map.of("error", "Invalid provider. Must be 'openai' or 'claude'"));
}

// Handle null or empty integrationId - clear the preference
String integrationId = null;
if (integrationIdObj != null) {
String idStr = integrationIdObj.toString().trim();
if (!idStr.isEmpty() && !idStr.equals("null")) {
integrationId = idStr;
}
}

// Store the preferred integration ID for this provider, or delete if null
String propertyKey = "preferredIntegration." + provider;
if (integrationId != null) {
dynamicPropertiesService.updateProperty(propertyKey, integrationId);
log.info("Updated preferred {} integration to ID: {}", provider, integrationId);
} else {
dynamicPropertiesService.updateProperty(propertyKey, "");
log.info("Cleared preferred {} integration, will auto-select", provider);
}

return ResponseEntity.ok(Map.of(
"success", true,
"provider", provider,
"integrationId", integrationId != null ? integrationId : "",
"message", "Preferred integration updated successfully"
));
} catch (Exception e) {
log.error("Error updating preferred integration", e);
return ResponseEntity.internalServerError().body(Map.of("error", e.getMessage()));
}
}
}
Loading
Loading