feat: Phase 3 — MCP header fallback, LIKE-based consent window, and auth token fix for dsh integration
- X-Oikos-Session-Id header → context fallback for _session_id - sessionIDFromArgsOrContext() reads from args, then header - AssentWindowActive falls back to session-ID-only LIKE lookup - windowActiveLike() for LIKE-pattern autonomy_settings queries - mcpBearerToken: package-level resolved token replaces os.Getenv() in decide_approval - Bump 0.36.0 → 0.37.0
This commit is contained in:
@@ -40,7 +40,7 @@ func OpsTools(pool *db.Pool, agentID uuid.UUID, sec ports.Secrets, execSvc *app.
|
||||
command, _ := args["command"].(string)
|
||||
purpose, _ := args["purpose"].(string)
|
||||
declaredRisk, _ := args["declared_risk"].(string)
|
||||
sessionID, _ := args["_session_id"].(string)
|
||||
sessionID := sessionIDFromArgsOrContext(ctx, args)
|
||||
if targetSlug == "" || command == "" {
|
||||
return textResult("error: target and command are required"), nil
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func OpsTools(pool *db.Pool, agentID uuid.UUID, sec ports.Secrets, execSvc *app.
|
||||
command, _ := args["command"].(string)
|
||||
purpose, _ := args["purpose"].(string)
|
||||
declaredRisk, _ := args["declared_risk"].(string)
|
||||
sessionID, _ := args["_session_id"].(string)
|
||||
sessionID := sessionIDFromArgsOrContext(ctx, args)
|
||||
|
||||
if lxcSlug == "" || container == "" || command == "" {
|
||||
return textResult("error: lxc_slug, container, and command are required"), nil
|
||||
@@ -662,7 +662,7 @@ func OpsTools(pool *db.Pool, agentID uuid.UUID, sec ports.Secrets, execSvc *app.
|
||||
if targetSlug == "" || service == "" {
|
||||
return textResult("error: target and service are required"), nil
|
||||
}
|
||||
sessionID, _ := args["_session_id"].(string)
|
||||
sessionID := sessionIDFromArgsOrContext(ctx, args)
|
||||
var targetID uuid.UUID
|
||||
if err := pool.QueryRow(ctx, "SELECT id FROM entities WHERE slug = $1", targetSlug).Scan(&targetID); err != nil {
|
||||
return textResult(fmt.Sprintf("target not found: %s", targetSlug)), nil
|
||||
@@ -717,7 +717,7 @@ func OpsTools(pool *db.Pool, agentID uuid.UUID, sec ports.Secrets, execSvc *app.
|
||||
if backup {
|
||||
cmd = fmt.Sprintf("pct exec %s -- cp -n %s %s.bak 2>/dev/null || true; %s", pveID, destPath, destPath, cmd)
|
||||
}
|
||||
sessionID, _ := args["_session_id"].(string)
|
||||
sessionID := sessionIDFromArgsOrContext(ctx, args)
|
||||
var hostEntityID uuid.UUID
|
||||
if err := pool.QueryRow(ctx, "SELECT id FROM entities WHERE slug = $1", "host:"+hostSlug).Scan(&hostEntityID); err != nil {
|
||||
// hostSlug may already carry the host: prefix
|
||||
@@ -800,8 +800,8 @@ func OpsTools(pool *db.Pool, agentID uuid.UUID, sec ports.Secrets, execSvc *app.
|
||||
return textResult(fmt.Sprintf("error: %v", hreqErr)), nil
|
||||
}
|
||||
hreq.Header.Set("Content-Type", "application/json")
|
||||
if token := os.Getenv("OIKOS_MCP_BEARER_TOKEN"); token != "" {
|
||||
hreq.Header.Set("Authorization", "Bearer "+token)
|
||||
if mcpBearerToken != "" {
|
||||
hreq.Header.Set("Authorization", "Bearer "+mcpBearerToken)
|
||||
}
|
||||
resp, reqErr := client.Do(hreq)
|
||||
if reqErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user