/** * v2 Sub-Delegate Advisor — bounded-escalation delegation primitive. * * Implements the bounded-escalation delegation pattern used in multi-model * agent workflows: a lower-cost executor escalates to a higher-capability * advisor at decision points. The advisor is bounded in three dimensions: * * 1. Authority — narrower than parent (monotonic narrowing; empty scope * is the maximum narrowing — advisor holds no tool-execution rights). * 2. Count — max_uses expressed as spendLimit with unit 'invocations' * (reuses the existing spend_limit field; no new counter). * 3. Time — optional validityWindow clamped to parent expiry. * * Advisor consultation produces a DecisionLineageReceipt (Module 42) with * the advisor as a contributing source — reuses the existing right-to- * explanation primitive rather than minting a new receipt type. * * Gateway enforcement: delegations with spendLimitUnit = 'invocations' * are rejected at processToolCall with ADVISOR_SCOPE_VIOLATION, since the * advisor is authorized to be consulted, not to execute tools. */ import type { Delegation } from '../types/passport.js'; import type { DecisionLineageReceipt } from '../types/data-lifecycle.js'; export declare function getAdvisorUses(delegationId: string): number; export declare function clearAdvisorUseTracker(): void; export interface ValidityWindow { /** ISO timestamp. If omitted, inherits parent notBefore. */ notBefore?: string; /** ISO timestamp. Clamped to parent expiry if later than parent. */ notAfter?: string; } export interface SubDelegateAdvisorOptions { /** Parent delegation — the authority being narrowed. */ parentDelegation: Delegation; /** Advisor agent's DID or public key. */ advisorDid: string; /** Maximum number of consultations permitted. Enforced as * spendLimit with spendLimitUnit='invocations'. */ maxUses: number; /** Optional time bounds. notAfter is clamped to parent expiry. */ validityWindow?: ValidityWindow; /** Parent delegate's private key — signs the advisor delegation. */ privateKey: string; } /** * Create an advisor delegation: maximally narrowed authority, count-bounded, * chained to parent for cascade revocation. The resulting delegation authorizes * the advisor to be consulted (up to maxUses times), not to execute tools. */ export declare function subDelegateAdvisor(opts: SubDelegateAdvisorOptions): Delegation; export interface ConsultAdvisorOptions { advisorDelegation: Delegation; /** Short description of the decision the executor is making. */ decisionType: string; /** Identifier for the decision artifact produced by the executor. */ decisionArtifactId: string; /** Hash of the advice content (e.g. sha256 of advisor output). */ adviceHash: string; /** Optional: executor's private key for signing the lineage receipt. * If omitted, a stub key is not acceptable — this is required. */ privateKey: string; /** Optional: governing purpose and human-readable explanation. */ governingPurpose?: string; explanation?: string; } export interface ConsultAdvisorResult { receipt: DecisionLineageReceipt; usesRemaining: number; } /** * Consult the advisor: validates the advisor delegation, decrements the * invocation counter, and mints a DecisionLineageReceipt naming the advisor * as a contributing source. Throws when the delegation is invalid, revoked, * expired, or its max_uses is exhausted. */ export declare function consultAdvisor(opts: ConsultAdvisorOptions): ConsultAdvisorResult; //# sourceMappingURL=sub-delegate-advisor.d.ts.map