Skip to content

Commit 9ae4aff

Browse files
committed
commit
1 parent 5343065 commit 9ae4aff

18 files changed

Lines changed: 484 additions & 108 deletions

File tree

.gcp.env

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
SENTRIUS_VERSION=1.1.72
1+
SENTRIUS_VERSION=1.1.80
22
SENTRIUS_SSH_VERSION=1.1.12
33
SENTRIUS_KEYCLOAK_VERSION=1.1.15
44
SENTRIUS_AGENT_VERSION=1.1.27
5-
SENTRIUS_AI_AGENT_VERSION=1.1.11
5+
SENTRIUS_AI_AGENT_VERSION=1.1.29
66
LLMPROXY_VERSION=1.1.14
7-
LAUNCHER_VERSION=1.1.6
8-
AGENTPROXY_VERSION=1.1.10
7+
LAUNCHER_VERSION=1.1.11
8+
AGENTPROXY_VERSION=1.1.13
99
SSHPROXY_VERSION=1.1.6
1010
RDPPROXY_VERSION=1.1.5
1111
GITHUB_MCP_VERSION=1.1.5

agent-launcher/src/main/java/io/sentrius/agent/launcher/service/PodLauncherService.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,10 @@ public class PodLauncherService {
3333
private final CoreV1Api coreV1Api;
3434
private final AgentImageResolver imageResolver;
3535

36-
@Value("${sentrius.agent.registry}")
37-
private String agentRegistry;
3836

3937
@Value("${sentrius.agent.namespace}")
4038
private String agentNamespace;
4139

42-
@Value("${sentrius.agent.registry.version}")
43-
private String agentVersion;
44-
4540
@Value("${sentrius.agent.callback.format.url:http://sentrius-agent-%s.%s.svc.cluster.local:8090}")
4641
private String callbackFormatUrl;
4742

@@ -183,6 +178,7 @@ public V1Pod launchAgentPod(AgentRegistrationDTO agent) throws Exception {
183178
argList.add("--agent.type=" + agentType);
184179
argList.add("--agent.clientId=" + agent.getClientId());
185180
argList.add("--agent.listen.websocket=true");
181+
argList.add("--agent.idleSleepMs=" + agent.getIdleSleepMs());
186182
argList.add("--agent.callback.url=" + constructedCallbackUrl);
187183
if (agent.getAgentPolicyId() != null && !agent.getAgentPolicyId().isEmpty()) {
188184
argList.add("--agent.ai.policy.id=" + agent.getAgentPolicyId());

agent-launcher/src/main/java/io/sentrius/agent/launcher/service/PodMonitor.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ public class PodMonitor {
3939

4040
private final CoreV1Api coreV1Api;
4141

42-
@Value("${sentrius.agent.registry}")
43-
private String agentRegistry;
44-
4542
@Value("${sentrius.agent.namespace}")
4643
private String agentNamespace;
4744

api/src/main/java/io/sentrius/sso/controllers/api/agents/AgentBootstrapController.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import io.sentrius.sso.core.config.SystemOptions;
1616
import io.sentrius.sso.core.controllers.BaseController;
1717
import io.sentrius.sso.core.dto.AgentRegistrationDTO;
18+
import io.sentrius.sso.core.dto.podman.ImageIntent;
19+
import io.sentrius.sso.core.dto.podman.LaunchConfiguration;
1820
import io.sentrius.sso.core.exceptions.ZtatException;
1921
import io.sentrius.sso.core.model.ATPLPolicyEntity;
2022
import io.sentrius.sso.core.model.security.enums.ApplicationAccessEnum;
@@ -36,6 +38,7 @@
3638
import io.sentrius.sso.core.services.security.ZeroTrustRequestService;
3739
import io.sentrius.sso.core.services.terminal.SessionTrackingService;
3840
import io.sentrius.sso.core.trust.ATPLPolicy;
41+
import io.sentrius.sso.core.utils.JsonUtil;
3942
import jakarta.servlet.http.HttpServletRequest;
4043
import jakarta.servlet.http.HttpServletResponse;
4144
import jakarta.transaction.Transactional;
@@ -206,9 +209,19 @@ public ResponseEntity<AgentRegistrationDTO> bootstrap(
206209
@PostMapping("/launcher/create")
207210
@LimitAccess(applicationAccess = {ApplicationAccessEnum.CAN_MANAGE_APPLICATION})
208211
public ResponseEntity<String> launchPod(
209-
@RequestBody AgentRegistrationDTO registrationDTO, HttpServletRequest request, HttpServletResponse response
212+
@RequestBody AgentRegistrationDTO registrationDTOPre, HttpServletRequest request, HttpServletResponse response
210213
) throws GeneralSecurityException, IOException, ZtatException {
211214

215+
// supplement the registration DTO with image information.
216+
217+
var image =
218+
ImageIntent.builder().tag(systemOptions.getAgentImageTag()).repo(systemOptions.getAgentRegistry()).build();
219+
220+
LaunchConfiguration launchConfig = LaunchConfiguration.builder().imageIntent(image).build();
221+
log.info("Using agent image intent: {}", JsonUtil.MAPPER.writeValueAsString(launchConfig));
222+
AgentRegistrationDTO registrationDTO =
223+
registrationDTOPre.toBuilder().idleSleepMs(systemOptions.getAgentSleepInterval()).templateLaunchConfiguration(
224+
JsonUtil.MAPPER.writeValueAsString(launchConfig)).build();
212225
try{
213226
log.info("Launching agent pod with ID: {}", registrationDTO.getAgentName());
214227

core/src/main/java/io/sentrius/sso/core/annotations/Updatable.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111

1212
String description() default "";
1313
String group() default "General";
14+
boolean isSecure() default false;
1415
}

core/src/main/java/io/sentrius/sso/core/dto/AgentRegistrationDTO.java

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import lombok.Builder;
55
import lombok.Getter;
66
import lombok.NoArgsConstructor;
7-
import lombok.Setter;
87
import lombok.ToString;
98

109
@Getter
@@ -25,6 +24,9 @@ public class AgentRegistrationDTO {
2524
private final String agentContextId = "";
2625
@Builder.Default
2726
private final String agentPolicyId = "";
27+
28+
@Builder.Default
29+
private final Long idleSleepMs = 30000L; // Default to 30 seconds
2830

2931
// Template-based configuration fields
3032
/**
@@ -69,4 +71,33 @@ public class AgentRegistrationDTO {
6971
* Structure: {"resources": {...}, "environmentVariables": {...}, "restartPolicy": "..."}
7072
*/
7173
private final String templateLaunchConfiguration;
74+
75+
/**
76+
* Creates a new builder with all fields deep-copied from this instance.
77+
* Note: Strings are immutable in Java, so copying references is safe.
78+
*
79+
* @return a new builder with all fields populated from this instance
80+
*/
81+
public AgentRegistrationDTOBuilder toBuilder() {
82+
return AgentRegistrationDTO.builder()
83+
.agentName(this.agentName)
84+
.agentPublicKey(this.agentPublicKey)
85+
.agentPublicKeyAlgo(this.agentPublicKeyAlgo)
86+
.clientSecret(this.clientSecret)
87+
.clientId(this.clientId)
88+
.agentType(this.agentType)
89+
.agentCallbackUrl(this.agentCallbackUrl)
90+
.agentContextId(this.agentContextId)
91+
.agentPolicyId(this.agentPolicyId)
92+
.idleSleepMs(this.idleSleepMs)
93+
.agentTemplateId(this.agentTemplateId)
94+
.templateConfiguration(this.templateConfiguration)
95+
.templateIdentity(this.templateIdentity)
96+
.templatePurpose(this.templatePurpose)
97+
.templateGoals(this.templateGoals)
98+
.templateGuardrails(this.templateGuardrails)
99+
.templateTrustPolicyId(this.templateTrustPolicyId)
100+
.templateLaunchConfiguration(this.templateLaunchConfiguration);
101+
}
102+
72103
}

core/src/main/java/io/sentrius/sso/core/dto/SystemOption.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class SystemOption {
1919
Boolean requiresRestart = false;
2020
String closestType = "";
2121
String closestPrimitive = "";
22+
boolean isSecureVariable = false;
2223
@Builder.Default
2324
String group = "General";
2425

@@ -27,4 +28,11 @@ public SystemOption(String name, String value, String description) {
2728
this.value = value;
2829
this.description = description;
2930
}
31+
32+
public SystemOption(String name, String value, String description, boolean isSecureVariable) {
33+
this.name = name;
34+
this.value = value;
35+
this.description = description;
36+
this.isSecureVariable = isSecureVariable;
37+
}
3038
}

core/src/main/java/io/sentrius/sso/core/dto/podman/ImageIntent.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public static ImageIntent from(AgentRegistrationDTO agent) {
5353
}
5454

5555
String launchConfig = agent.getTemplateLaunchConfiguration();
56+
log.info("Launch configuration: {}", launchConfig);
5657
if (launchConfig == null || launchConfig.trim().isEmpty()) {
5758
log.debug("No templateLaunchConfiguration found for agent: {}", agent.getAgentName());
5859
return ImageIntent.builder().build();
@@ -83,14 +84,5 @@ public boolean hasExplicitConfig() {
8384
return repo != null || tag != null || selection != null;
8485
}
8586

86-
/**
87-
* Wrapper class for parsing launch configuration JSON
88-
*/
89-
@Data
90-
@JsonIgnoreProperties(ignoreUnknown = true)
91-
private static class LaunchConfiguration {
92-
private ImageIntent imageIntent;
93-
private ResourcesConfig resources;
94-
private String restartPolicy;
95-
}
87+
9688
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.sentrius.sso.core.dto.podman;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import lombok.AllArgsConstructor;
5+
import lombok.Builder;
6+
import lombok.Data;
7+
import lombok.NoArgsConstructor;
8+
9+
/**
10+
* Wrapper class for parsing launch configuration JSON
11+
*/
12+
@Data
13+
@Builder
14+
@NoArgsConstructor
15+
@AllArgsConstructor
16+
@JsonIgnoreProperties(ignoreUnknown = true)
17+
public class LaunchConfiguration {
18+
private ImageIntent imageIntent;
19+
private ResourcesConfig resources;
20+
private String restartPolicy;
21+
}

dataplane/src/main/java/io/sentrius/sso/core/config/SystemOptions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ public class SystemOptions {
201201
@Builder.Default
202202
public Boolean agentSupportEnabled = false;
203203

204+
@Updatable(description = "Agent Sleep time between autonomous interactions", group = "Agent")
205+
@Builder.Default
206+
public Long agentSleepInterval = 30000L;
207+
204208
@Updatable(description = "GitHub integration token name for agent operations. This token is used for GitHub MCP operations.", group = "Agent")
205209
@Builder.Default
206210
public String githubAgentTokenName = "";
@@ -316,6 +320,7 @@ public Map<String, SystemOption> getOptions() throws IllegalAccessException {
316320
var sysOpt = SystemOption.builder()
317321
.name(fieldName)
318322
.value(fieldValue == null ? "" : String.valueOf(fieldValue))
323+
.isSecureVariable(updatableAnnotation.isSecure())
319324
.requiresRestart(requiresRestart);
320325

321326
// Set the description if available in the annotation

0 commit comments

Comments
 (0)