Skip to content

Commit cf58911

Browse files
committed
update
1 parent d5c4e79 commit cf58911

File tree

58 files changed

+13834
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+13834
-11
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ llm-proxy/target/
4747
llm-dataplane/target/**
4848
sentrius-llm-dataplane/target/**
4949
sentrius-llm-core/target/**
50+
provenance-core/target/**
51+
provenance-ingestor/target/**
5052
llm-dataplane/target/
5153
sentrius-llm-dataplane/target/
5254
sentrius-llm-core/target/

ai-agent/src/main/resources/assessor.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,7 @@ otel.metrics.exporter=none
7373
otel.logs.exporter=none
7474
otel.resource.attributes.service.name=ai-agent
7575
otel.traces.sampler=always_on
76-
otel.exporter.otlp.timeout=10s
76+
otel.exporter.otlp.timeout=10s
77+
78+
provenance.kafka.topic=sentrius-provenance
79+
spring.kafka.bootstrap-servers=home.guard.local:9092

ai-agent/src/main/resources/challenger.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,6 @@ otel.metrics.exporter=none
6868
otel.logs.exporter=none
6969
otel.resource.attributes.service.name=challenger-agent
7070
otel.traces.sampler=always_on
71-
otel.exporter.otlp.timeout=10s
71+
otel.exporter.otlp.timeout=10s
72+
73+
provenance.kafka.topic=sentrius-provenance

ai-agent/src/main/resources/chat-helper.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,6 @@ otel.resource.attributes.service.name=chat-helper
8080
otel.traces.sampler=always_on
8181
otel.exporter.otlp.timeout=10s
8282
agent.type="chat-helper"
83-
agent.listen.websocket=true
83+
agent.listen.websocket=true
84+
85+
provenance.kafka.topic=sentrius-provenance

ai-agent/src/main/resources/terminal-helper.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,6 @@ otel.metrics.exporter=none
7474
otel.logs.exporter=none
7575
otel.resource.attributes.service.name=terminal-helper
7676
otel.traces.sampler=always_on
77-
otel.exporter.otlp.timeout=10s
77+
otel.exporter.otlp.timeout=10s
78+
79+
provenance.kafka.topic=sentrius-provenance

api/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
<version>1.0.0-SNAPSHOT</version>
3232
</dependency>
3333

34+
35+
<dependency>
36+
<groupId>io.sentrius</groupId>
37+
<artifactId>provenance-core</artifactId>
38+
<version>1.0.0-SNAPSHOT</version>
39+
</dependency>
3440
<dependency>
3541
<groupId>io.sentrius</groupId>
3642
<artifactId>sentrius-llm-core</artifactId>

api/src/main/java/io/sentrius/sso/controllers/api/AgentApiController.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import io.sentrius.sso.core.services.security.ZeroTrustRequestService;
3939
import io.sentrius.sso.core.services.terminal.SessionTrackingService;
4040
import io.sentrius.sso.protobuf.Session;
41+
import io.sentrius.sso.provenance.ProvenanceEvent;
42+
import io.sentrius.sso.provenance.kafka.ProvenanceKafkaProducer;
4143
import jakarta.servlet.http.HttpServletRequest;
4244
import jakarta.servlet.http.HttpServletResponse;
4345
import lombok.extern.slf4j.Slf4j;
@@ -69,6 +71,7 @@ public class AgentApiController extends BaseController {
6971
final ZeroTrustAccessTokenService ztatService;
7072
final ZeroTrustRequestService ztrService;
7173
final AgentService agentService;
74+
final ProvenanceKafkaProducer provenanceKafkaProducer;
7275

7376
public AgentApiController(
7477
UserService userService,
@@ -77,7 +80,8 @@ public AgentApiController(
7780
AuditService auditService,
7881
CryptoService cryptoService, SessionTrackingService sessionTrackingService, KeycloakService keycloakService,
7982
ATPLPolicyService atplPolicyService,
80-
ZeroTrustAccessTokenService ztatService, ZeroTrustRequestService ztrService, AgentService agentService
83+
ZeroTrustAccessTokenService ztatService, ZeroTrustRequestService ztrService, AgentService agentService,
84+
ProvenanceKafkaProducer provenanceKafkaProducer
8185
) {
8286
super(userService, systemOptions, errorOutputService);
8387
this.auditService = auditService;
@@ -88,6 +92,7 @@ public AgentApiController(
8892
this.ztatService = ztatService;
8993
this.ztrService = ztrService;
9094
this.agentService = agentService;
95+
this.provenanceKafkaProducer = provenanceKafkaProducer;
9196
}
9297

9398
public SessionLog createSession(@RequestParam String username, @RequestParam String ipAddress) {
@@ -129,6 +134,16 @@ public ResponseEntity<?> heartbeat(
129134
}
130135
agentService.recordHeartbeat(operatingUser.getUserId(),status.getName(), status);
131136
log.info("Heartbeat status recorded for agent: {} {}", agentId, status);
137+
ProvenanceEvent event = ProvenanceEvent.builder()
138+
.eventId(UUID.randomUUID().toString())
139+
.sessionId(status.getAgentId())
140+
.actor(operatingUser.getUsername())
141+
.triggeringUser(operatingUser.getUsername())
142+
.eventType(ProvenanceEvent.EventType.AGENT_RESPONSE)
143+
.outputSummary("Heartbeat received from agent: " + status.getName() + " with status: " + status.getStatus())
144+
.timestamp(LocalDateTime.now().toInstant(java.time.ZoneOffset.UTC))
145+
.build();
146+
provenanceKafkaProducer.send(event);
132147
return ResponseEntity.ok(Map.of("status", "success"));
133148
}
134149

@@ -452,7 +467,16 @@ public ResponseEntity<?> sendMessage(
452467
return ResponseEntity.status(HttpStatus.SC_FORBIDDEN).body("User is not allowed to send message to agent");
453468
}
454469

455-
470+
ProvenanceEvent event = ProvenanceEvent.builder()
471+
.eventId(requestId)
472+
.sessionId(communicationId)
473+
.actor(operatingUser.getUsername())
474+
.triggeringUser(comm.getTargetAgent())
475+
.eventType(ProvenanceEvent.EventType.KNOWLEDGE_GENERATED)
476+
.outputSummary("Ask agent " + comm.getPayload())
477+
.timestamp(LocalDateTime.now().toInstant(java.time.ZoneOffset.UTC))
478+
.build();
479+
provenanceKafkaProducer.send(event);
456480

457481

458482
var newAgentComm = agentService.saveCommunication(comm);

api/src/main/resources/application.properties

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,12 @@ otel.traces.sampler=always_on
9090
otel.exporter.otlp.timeout=10s
9191

9292
sentrius.agent.register.bootstrap.allow=true
93-
sentrius.agent.bootstrap.policy=default-policy.yaml
93+
sentrius.agent.bootstrap.policy=default-policy.yaml
94+
95+
provenance.kafka.topic=sentrius-provenance
96+
spring.kafka.bootstrap-servers=home.guard.local:9092
97+
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
98+
spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
99+
100+
# Optional: trust package to avoid class cast issues with JSON
101+
spring.kafka.producer.properties.spring.json.trusted.packages=io.sentrius.*

core/src/main/java/io/sentrius/sso/core/services/agents/AgentClientService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ public Set<String> getCommunicationIds(AgentExecution execution, ZtatRequestDTO
8080
}
8181
);
8282
}
83+
84+
85+
8386
return Set.of();
8487
}
8588

@@ -154,6 +157,7 @@ public AgentCommunicationDTO askAgent(AgentExecution execution, AtatRequest atat
154157
.targetAgent(atatRequest.getUserName())
155158
.build();
156159
log.info("My question is {}",myQuestion);
160+
157161
var acommResponse = zeroTrustClientService.callPostOnApi(execution, ask, myQuestion,
158162
Maps.immutableEntry("requestId", List.of(atatRequest.getRequestId())));
159163
return JsonUtil.MAPPER.readValue(acommResponse, AgentCommunicationDTO.class);

dataplane/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
<artifactId>sentrius-core</artifactId>
2626
<version>1.0.0-SNAPSHOT</version>
2727
</dependency>
28+
<dependency>
29+
<groupId>io.sentrius</groupId>
30+
<artifactId>provenance-core</artifactId>
31+
<version>1.0.0-SNAPSHOT</version>
32+
</dependency>
2833
<dependency>
2934
<groupId>org.apache.commons</groupId>
3035
<artifactId>commons-lang3</artifactId>

0 commit comments

Comments
 (0)