godcrm/backend/services/agent-tools/passport-tools.js
GOD CRM Release f89e074dd1
Some checks failed
CI / Lint / Typecheck / Test / Build (push) Has been cancelled
CI / PostgreSQL Integration Tests (push) Has been cancelled
GOD CRM — public scrubbed snapshot
Governed substrate for autonomous agents: scoped identity (passports),
audited actions, MCP workspace. Infra IPs and secrets redacted for public release.
2026-08-10 04:01:45 +03:00

24 lines
1.1 KiB
JavaScript

/**
* Passport lifecycle tool handlers — ADR-164 Phase 2.
*
* Thin wrappers over the canonical agent-users service (issuePassport /
* revokePassport). No resolution logic lives here — the service reuses the
* canonical resolveAgentUser() so there is a single resolve path. The calling
* user id (`userId`) is recorded as the actor performing the act.
*
* ponytail: authorization gating (owner-only naturalization) is intentionally
* not enforced here — passport issue/revoke should become owner-gated like the
* Secrets tab (ADR-0040 pattern) in a follow-up; today any agent with tool
* access can call these. Flagged for the debt ledger, not implemented in P2.
*/
import { issuePassport, revokePassport } from '../agent-users.js';
export const passportToolHandlers = {
async issue_passport({ handle, row_id, user_id, table_id }, userId) {
return issuePassport({ handle, row_id, user_id, table_id, actor: userId ?? null });
},
async revoke_passport({ handle, user_id }, userId) {
return revokePassport({ handle, user_id, actor: userId ?? null });
},
};