Major additions: - Community Next.js app (port 18187) for browsing claims with API docs - stemedb-chaos crate: Fault injection, chaos testing, CRDT properties - Latent ingestion system: Reddit/FDA ingesters with ADK-Go agents - Disputed claims handling: Manual review workflows and validation - Aphoria security scanner: New extractors (SQL injection, command injection, weak crypto, TLS version), policy-based ignores, UAT reports - Docker infrastructure: Dockerfile, docker-compose.yml for full stack - VulnBank demo: Intentionally vulnerable multi-language test corpus SDK & API enhancements: - Source registry handlers for tracking data provenance - Metrics endpoint - Skeptic filtering improvements Code quality: - Split 14 large files (>500 lines) into focused modules - All files now under 500-line limit per project guidelines Documentation: - Chaos testing guide, circuit breakers, observability docs - Phase 7 UAT documentation updates - Martin Kleppmann technical writer agent Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
66 lines
1.6 KiB
Go
66 lines
1.6 KiB
Go
package adk
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/orchard9/stemedb-go/steme"
|
|
)
|
|
|
|
// TraceTool provides audit trail queries for incident investigation.
|
|
//
|
|
// Used by On-Call SRE and Human Supervisor to trace agent decisions.
|
|
type TraceTool struct {
|
|
client EpistemeClient
|
|
}
|
|
|
|
// NewTraceTool creates a new Trace tool.
|
|
func NewTraceTool(client EpistemeClient) *TraceTool {
|
|
return &TraceTool{client: client}
|
|
}
|
|
|
|
// Name returns the tool name.
|
|
func (t *TraceTool) Name() string {
|
|
return "episteme_trace"
|
|
}
|
|
|
|
// Description returns the tool description.
|
|
func (t *TraceTool) Description() string {
|
|
return "Trace agent queries for incident investigation. " +
|
|
"Shows what an agent queried, when, and what values were returned. " +
|
|
"CRITICAL for debugging production incidents."
|
|
}
|
|
|
|
// Execute performs the trace operation.
|
|
func (t *TraceTool) Execute(ctx context.Context, input []byte) ([]byte, error) {
|
|
var params TraceInput
|
|
if err := json.Unmarshal(input, ¶ms); err != nil {
|
|
return nil, fmt.Errorf("invalid trace input: %w", err)
|
|
}
|
|
|
|
// Build StemeDB trace params
|
|
traceParams := steme.TraceParams{
|
|
AgentID: params.AgentID,
|
|
From: params.From,
|
|
To: params.To,
|
|
Subject: params.Subject,
|
|
Limit: 100, // Default limit
|
|
}
|
|
|
|
// Execute trace
|
|
result, err := t.client.Trace(ctx, traceParams)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("trace query failed: %w", err)
|
|
}
|
|
|
|
// Convert to TraceOutput format
|
|
output := convertTraceResult(result)
|
|
|
|
outputBytes, err := json.Marshal(output)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("failed to marshal trace output: %w", err)
|
|
}
|
|
return outputBytes, nil
|
|
}
|