/** * LangChain Adapter — primitive mappings between LangChain tool calls and APS delegations. * * Pure mapping + receipt-builder layer. Stateful runtime (pending-intent tracking, * audit trail, gateway reporting) lives in the gateway — callers that need those * behaviours supply them via the `onReceipt` / `onDenied` hooks. */ import { type RevocationCheckOptions } from '../core/delegation.js'; import type { Delegation, ActionReceipt, SignedPassport } from '../types/passport.js'; export interface LangChainToolCall { name: string; args: Record; id?: string; } export interface GovernedToolResult { output: unknown; receipt: ActionReceipt; } export interface DeniedToolResult { denied: true; reason: string; receipt: ActionReceipt; } export interface LangChainGovernanceConfig { passport: SignedPassport; delegation: Delegation; privateKey: string; scopeMapping?: Record; onReceipt?: (r: ActionReceipt) => void; onDenied?: (info: { tool: string; reason: string; }) => void; /** Trust anchors for this gate: issuer public keys whose countersignature * is accepted. A NON-EMPTY list requires a valid countersignature from one * of them. An empty list, or omitting it, means this gate holds no * anchors; it does not mean "trust anyone". */ trustedIssuers?: string[]; /** Explicit wildcard trust: admit a passport whose only authority is its * own signature. Required to admit a self-signed credential, because a * signature that verifies under a key the passport itself supplied is not * an authorization by a trusted issuer. Default false. */ allowSelfSigned?: boolean; /** Revocation posture applied to the delegation check before every * governed call. This adapter is an execution gate: it verifies the * delegation immediately before the tool runs, which is exactly where a * caller who will not act on unknown revocation state says so. Pass * { revocationCheckPolicy: 'fail_closed', cachedRevocationState } to * refuse when revocation evidence is absent or stale. Omitted leaves the * previous behaviour, signature and expiry only. */ revocation?: RevocationCheckOptions; } /** Map LangChain tool name to APS scope */ export declare function langchainToolToScope(toolName: string, scopeMapping?: Record): string; /** Govern a single LangChain tool call */ export declare function governLangChainTool(call: LangChainToolCall, execute: (args: Record) => Promise, config: LangChainGovernanceConfig): Promise; /** Create a governance middleware for LangGraph */ export declare function createLangGraphGovernance(config: LangChainGovernanceConfig): (call: LangChainToolCall, execute: (args: Record) => Promise) => Promise; //# sourceMappingURL=langchain.d.ts.map