/** * APS Adapter — Agent Permission Service interop adapter. * * Maps APS delegation chains to AuthGuardian trust levels. * This is the interop PoC proposed in crewAIInc/crewAI#4560: * APS chain → MCP verify → trust mapping → registerAgentTrust(). * * APS (Agent Permission Service) is a delegation-chain permission model * proposed by aeoess et al. This adapter consumes APS delegation tokens, * verifies them (locally or via MCP server), and translates the verified * scope + depth into Network-AI's AgentTrustConfig. * * Usage: * * import { APSAdapter } from 'network-ai'; * * const aps = new APSAdapter(); * await aps.initialize({ * // Required in local mode (the default) — supply a real cryptographic * // verifier. There is no fail-open default (GHSA-3jf7-33vc-hgf4). * verifySignature: async (delegation) => verifyEd25519(delegation), * }); * * // Register an APS-verified agent by providing its delegation chain * const trust = aps.apsDelegationToTrust({ * delegator: 'root-orchestrator', * delegatee: 'sub-agent-7', * scope: ['file:read', 'net:fetch'], * currentDepth: 1, * maxDepth: 3, * signature: '', * }); * * // Wire into AuthGuardian * guardian.registerAgentTrust(trust); * * Verification modes: * - 'local' — requires a caller-supplied verifySignature callback (default) * - 'mcp' — calls an APS MCP server to verify the full chain * * @module APSAdapter * @version 1.0.0 */ import { BaseAdapter } from './base-adapter'; import type { AdapterConfig, AdapterCapabilities, AgentPayload, AgentContext, AgentResult } from '../types/agent-adapter'; /** A single link in an APS delegation chain. */ export interface APSDelegation { /** Agent that grants authority */ delegator: string; /** Agent that receives authority */ delegatee: string; /** Scopes granted — monotonically narrowing down the chain */ scope: string[]; /** Current depth in the delegation chain (0 = root) */ currentDepth: number; /** Maximum allowed depth */ maxDepth: number; /** Cryptographic signature or token from the delegator */ signature: string; } /** Result of APS verification — input to AuthGuardian. */ export interface APSTrustMapping { agentId: string; trustLevel: number; allowedResources: string[]; allowedNamespaces: string[]; /** Raw APS chain metadata for audit purposes */ apsMetadata: { delegator: string; depth: number; maxDepth: number; scope: string[]; verified: boolean; verificationMode: 'local' | 'mcp'; }; } /** Configuration for the APS adapter. */ export interface APSAdapterConfig extends AdapterConfig { /** Base trust level for a fully verified root delegation (default: 0.8) */ baseTrust?: number; /** Depth decay factor — trust decays as delegation gets deeper (default: 0.4) */ depthDecay?: number; /** Verification mode: 'local' or 'mcp' (default: 'local') */ verificationMode?: 'local' | 'mcp'; /** MCP server URL for remote verification (required when mode is 'mcp') */ mcpServerUrl?: string; /** Function to verify APS signatures — BYOC (bring your own crypto) */ verifySignature?: (delegation: APSDelegation) => Promise; } /** * APSAdapter translates APS delegation chains into AuthGuardian trust configs. * * This is not a traditional execution adapter — it's a trust-bridging adapter. * Its primary method is `apsDelegationToTrust()`, which verifies an APS * delegation and returns an `AgentTrustConfig`-compatible object. */ export declare class APSAdapter extends BaseAdapter { readonly name = "aps"; readonly version = "1.0.0"; private baseTrust; private depthDecay; private verificationMode; private mcpServerUrl?; private verifySignatureFn?; get capabilities(): AdapterCapabilities; initialize(config: APSAdapterConfig): Promise; /** * Core method: convert an APS delegation into an AuthGuardian trust mapping. * * Trust formula: baseTrust × (1 - (currentDepth / maxDepth × depthDecay)) * At depth 0 (root): full baseTrust. * At maxDepth: baseTrust × (1 - depthDecay). * * Scopes are monotonically narrowing — a child delegation can only have * a subset of the parent's scopes. */ apsDelegationToTrust(delegation: APSDelegation): Promise; /** * Verify an APS delegation — either locally or via MCP. */ private verifyDelegation; /** * Verify delegation via an APS MCP server. * Calls the server's `verifyDelegation` tool. */ private verifyViaMCP; /** * Execute is a pass-through — APS adapter is a trust bridge, not an executor. * When called, it verifies the delegation from the payload and returns the trust mapping. */ executeAgent(agentName: string, payload: AgentPayload, context: AgentContext): Promise; } //# sourceMappingURL=aps-adapter.d.ts.map