import type { FinalityState } from './finality.js'; /** Escrow lifecycle states. * Extended per review: includes partial fulfillment, orphaned, force states. */ export type EscrowStatus = 'held' | 'partially_fulfilled' | 'verification_pending' | 'fulfilled' | 'disputed' | 'expired' | 'released' | 'refunded' | 'force_released' | 'orphaned'; export interface EscrowMilestone { id: string; description: string; /** Amount released when this milestone is fulfilled */ amount: number; fulfilled: boolean; fulfilledAt?: string; } export interface EscrowFulfillmentCondition { type: 'receipt_generated' | 'deliverable_accepted' | 'manual_release' | 'milestone'; /** For receipt_generated: which receipt unlocks the escrow */ receiptId?: string; /** For deliverable_accepted: which deliverable triggers release */ deliverableId?: string; /** For milestone: structured milestone payouts */ milestones?: EscrowMilestone[]; } export interface EscrowHold { escrowId: string; initiatorAgentId: string; counterpartyAgentId: string; delegationId: string; amount: { value: number; currency: string; }; fulfillmentCondition: EscrowFulfillmentCondition; createdAt: string; expiresAt: string; status: EscrowStatus; finality: FinalityState; fulfillmentReceiptId?: string; disputeId?: string; gatewayId: string; initiatorSignature: string; gatewaySignature: string; } export type DangerType = 'escrow_ttl_approaching' | 'spend_velocity_anomaly' | 'fulfillment_abandoned' | 'repeated_disputes' | 'witness_refusal_pattern'; export interface DangerSignal { signalId: string; type: DangerType; agentId: string; /** The artifact that triggered the signal (escrowId, receiptId, etc.) */ relatedArtifactId: string; severity: 'low' | 'medium' | 'high'; detectedAt: string; /** Should this auto-escalate to a dispute if unaddressed? */ autoEscalate: boolean; message: string; } /** Escrow-aware revocation status. */ export type EscrowRevocationStatus = 'pending_escrow_clearance' | 'executed' | 'failed'; /** Escrow-aware revocation record. When a principal revokes a delegation * that has active escrows, the revocation enters a holding state. * New actions are immediately blocked. Existing escrows continue to resolution. */ export interface EscrowAwareRevocation { /** Unique revocation identifier */ revocationId: string; /** Delegation being revoked */ targetDelegationId: string; /** Ed25519 signature by the principal authorizing revocation */ principalSignature: string; /** Current revocation status */ status: EscrowRevocationStatus; /** Escrow IDs that must resolve before revocation completes */ blockingEscrowIds: string[]; /** ISO datetime — max time to wait before force-canceling escrows */ gracePeriodExpiresAt: string; /** Authority state during grace period: * delegation authority = 0 for NEW actions. * delegation remains valid ONLY for resolution of existing escrows. */ newActionsBlocked: boolean; /** Existing escrows are protected during the grace period */ existingEscrowsProtected: boolean; /** ISO datetime — when this revocation was initiated */ createdAt: string; /** Gateway signature enforcing the revocation state */ gatewaySignature: string; } //# sourceMappingURL=escrow.d.ts.map