/** * ACP session lifecycle evidence mapping (DD-188). * * Maps ACP session states to PEAC evidence WITHOUT synthesizing * payment finality from session states. An ACP session "completed" * does NOT prove payment settlement. Payment evidence is only * produced when an explicit payment-bearing artifact with a known * observed payment state is provided by the caller. * * Two separate functions enforce this boundary: * - fromACPSessionLifecycleEvent(): session/access evidence only * - fromACPPaymentObservation(): commerce evidence only with explicit payment artifact */ import type { PaymentEvidence } from '@peac/schema'; import { type StrictnessMode } from '@peac/adapter-core'; /** * PEAC Receipt Input (for issue()). * Locally defined to avoid circular import with index.ts. * Structurally identical to PEACReceiptInput in index.ts. */ export interface SessionReceiptInput { subject_uri: string; amt: number; cur: string; payment: PaymentEvidence; } /** ACP session states per ACP spec 2026-01-30 */ export type ACPSessionState = 'created' | 'updated' | 'ready_for_payment' | 'in_progress' | 'completed' | 'canceled' | 'not_ready_for_payment'; /** ACP session lifecycle event */ export interface ACPSessionEvent { session_id: string; state: ACPSessionState; resource_uri: string; capabilities?: Record; intervention_requirements?: Record; delegated_payment_ref?: string; created_at?: string; updated_at?: string; } /** Observed payment state from an explicit payment-bearing artifact */ export type ObservedPaymentState = 'attempted' | 'authorized' | 'captured' | 'settled' | 'failed' | 'refunded'; /** Payment artifact with observed state */ export interface ACPPaymentArtifact { rail: string; reference: string; amount: number; currency: string; observed_payment_state: ObservedPaymentState; } /** ACP capability negotiation snapshot */ export interface ACPCapabilityNegotiation { session_id: string; seller_capabilities?: Record; buyer_capabilities?: Record; negotiated?: Record; extensions?: Record; } /** ACP intervention requirement */ export interface ACPIntervention { session_id: string; resource_uri: string; type: string; reason?: string; metadata?: Record; } /** * Map an ACP session lifecycle event to PEAC evidence. * * Produces session/access evidence ONLY. Never produces commerce evidence. * "completed" means "checkout session completed", NOT "payment settled". * "canceled" means "session canceled", NOT "payment voided". */ export declare function fromACPSessionLifecycleEvent(event: ACPSessionEvent): SessionReceiptInput; /** * Map an ACP session event with explicit payment artifact to PEAC commerce evidence. * * Only called when an explicit payment-bearing artifact with a known * observed payment state is present alongside the session event. * Commerce extension event is derived from observed_payment_state, * NOT from the ACP session state. * * 'attempted' and 'failed' produce access evidence only (no commerce event). */ export declare function fromACPPaymentObservation(event: ACPSessionEvent, paymentArtifact: ACPPaymentArtifact): SessionReceiptInput; /** * Create an audit-friendly snapshot of ACP capability negotiation. */ export declare function fromACPCapabilitySnapshot(negotiation: ACPCapabilityNegotiation): Record; /** * Map an ACP intervention requirement to PEAC challenge-kind evidence. */ export declare function fromACPInterventionRequired(intervention: ACPIntervention): SessionReceiptInput; /** * Closed enum of observed delegated-payment states at the ACP mapper boundary. * Mirrors upstream ACP delegated-payment lifecycle states. Documented but not * wire-frozen. */ export type DelegatedPaymentState = 'authorized' | 'settled' | 'pending' | 'failed' | 'revoked'; /** * ACP delegated-payment observation input. * * The observation captures what an upstream ACP-aware payment surface * attested. It does NOT enforce ACP lifecycle, checkout policy, or token * verification. Token material (the actual delegated-payment token) is * NEVER carried; only an opaque reference is. */ export interface ACPDelegatedPaymentObservation { /** Delegation identifier from upstream. */ delegation_id: string; /** Resource URI the delegation grants action on; MUST be https://. */ resource_uri: string; /** Principal who authorized the delegation. */ principal: string; /** Delegate that may act on the principal's behalf. */ delegate: string; /** * Opaque reference to the payment-method token. NEVER the token material * itself. */ payment_method_token_ref: string; /** * Authorized amount as a base-10 integer string (RFC 8785 compatible). * Smallest currency unit. Required. */ authorized_amount_minor: string; /** Currency code as supplied by upstream. Required in strict mode. */ currency: string; /** Environment as supplied by upstream. Required in strict mode. */ env: 'live' | 'test'; /** Observed delegated-payment state from the upstream artifact. */ observed_payment_state: DelegatedPaymentState; /** * Discriminator naming what the upstream artifact attests. Required when * the observed_payment_state is a finality-bearing state * (`authorized` or `settled`); MUST match that state. Required to prevent * a generic upstream artifact from being treated as a settlement proof. * * For non-finality states (`pending`, `failed`, `revoked`) this field is * not consulted and may be omitted. */ artifact_kind?: 'authorization' | 'settlement'; /** * Raw upstream artifact, preserved verbatim under * `proofs.acp.delegated_payment.upstream_artifact`. Opaque to PEAC. * For finality states, this MUST be the artifact whose `artifact_kind` * matches `observed_payment_state`. */ upstream_artifact: unknown; /** Optional session correlation. */ session_id?: string; } export interface ACPDelegatedPaymentOptions { mode?: StrictnessMode; warn?: (message: string) => void; } /** * Map an ACP delegated-payment observation to PEAC evidence. * * Observational mapping only. Does NOT enforce ACP lifecycle, checkout * policy, or payment-method-token verification. Routes through the shared * mapper-boundary finality-synthesis guard so that: * * - `pending`, `failed`, `revoked` produce evidence with NO commerce event. * - `authorized` and `settled` produce a commerce event only when the * upstream artifact is present (which it always is for this function; * the guard rejects otherwise). * - Strict mode rejects missing or upstream-unknown currency and any * env value outside the closed `live` | `test` enum. * * The raw upstream artifact is preserved verbatim under * `proofs.acp.delegated_payment.upstream_artifact`. */ export declare function fromACPDelegatedPaymentObservation(observation: ACPDelegatedPaymentObservation, options?: ACPDelegatedPaymentOptions): SessionReceiptInput; //# sourceMappingURL=session.d.ts.map