import type { ActionIntent } from '../types/policy.js'; /** * Intent shape accepted by computeActionRef. Identical to the ActionIntent * pick except that scopeRequired additionally admits a readonly string array, * the form draft-pidlisnyi-aps-03 §4.1 defines for the native preimage. * ActionIntent itself still types scopeRequired as a single string; widening * that type is outside this module (see types/policy.ts). */ export type ActionRefIntent = Omit, 'action'> & { action: Omit & { scopeRequired: ActionIntent['action']['scopeRequired'] | readonly string[]; }; }; /** Raised when scopeRequired carries two elements that are equal after NFC * normalization. draft-pidlisnyi-aps-03 §4.1 defines scope_required as a * duplicate-free array, so a duplicated array has no canonical form and is * rejected rather than deduplicated: an equality key must not map distinct * inputs onto one value silently. Subclasses the built-in Error so any * existing handler that catches Error (or `catch (e)`) still catches it and * fails closed. */ export declare class DuplicateScopeRequiredError extends Error { readonly code = "ERR_DUPLICATE_SCOPE_REQUIRED"; /** Stable machine-readable category, shared across the APS SDKs. */ readonly category = "invalid_scope_required"; /** Specific failure within the category. */ readonly reason = "duplicate_scope_required"; constructor(message: string); } /** * Compute the content-addressed request identity for an ActionIntent. * * Inputs hashed: agentId, action.type, action.scopeRequired, normalized timestamp. * Timestamp defaults to intent.createdAt; falls back to current time. * * scopeRequired is canonicalized per draft-pidlisnyi-aps-03 §4.1 before * hashing: each scope string is NFC-normalized and, when scopeRequired is an * array, the array is sorted by Unicode code point. No case folding; scopes * that differ only in case stay distinct. * * Throws DuplicateScopeRequiredError when an array scopeRequired holds two * elements equal after NFC normalization. The throw happens inside * canonicalization, before the digest is computed, so a duplicated array can * never present as an identity mismatch downstream: there is no action_ref to * compare in the first place. * * Canonicalization follows RFC 8785 JCS strictly, per draft-pidlisnyi-aps-01 * §4.1: null/undefined-valued keys are preserved (not stripped) so that two * APS engines independently hashing the same request produce the same * action_ref. This is the APS-native form. Cross-ecosystem byte-parity with * independent implementations (x402, AgentGraph CTEF, Nobulex) is provided by * a separate primitive, computeExternalActionRefV1 in external-action-ref.js, * which uses an intentionally different preimage; see that file and * docs/specs/action-ref-v1.md. * * Returns: lowercase hex SHA-256 digest. */ export declare function computeActionRef(intent: ActionRefIntent): string; /** * Two receipts with the same action_ref describe the same request. * Simple equality check — provided as a named predicate so the semantic * intent is explicit at the call site. */ export declare function actionRefsMatch(a: string, b: string): boolean; //# sourceMappingURL=action-ref.d.ts.map