import { StateDatabase } from "../state/database.js"; import { type JsonValue } from "../state/json.js"; import type { HumanDecisionChannelRequest } from "../workflows/types.js"; export type ChannelEffectPurpose = "delivery" | "settlement"; export type ChannelEffectStatus = "pending" | "applying" | "applied" | "rejected" | "ambiguous" | "cancelled"; export type ChannelEffectPayload = { schema: "pi-workflows.channel-effect.v1"; channelId: string; profile: string; decisionId: string; purpose: ChannelEffectPurpose; request: HumanDecisionChannelRequest; }; export type ChannelEffectRecord = { effectId: string; resourceId: string; sourceResourceId: string; status: ChannelEffectStatus; attemptNumber: number; attemptStartedAt: number; settledAt?: number; payload: ChannelEffectPayload; result?: JsonValue; }; export declare class ChannelEffectStore { private readonly state; private readonly mutations; constructor(state: StateDatabase); ensureApplying(options: { channelResourceId: string; channelId: string; profile: string; decisionId: string; purpose: ChannelEffectPurpose; request: HumanDecisionChannelRequest; ownerId: string; leaseGeneration: number; maxAutomaticAttempts: number; }): ChannelEffectRecord; settle(options: { effectId: string; attemptNumber: number; outcome: "applied" | "rejected" | "ambiguous"; result?: JsonValue; error?: string; actorType: "channel" | "human"; actorId: string; }): ChannelEffectRecord; markApplyingAmbiguous(options: { sourceResourceId?: string; stableMessageIds?: readonly string[]; error: string; actorId: string; }): ChannelEffectRecord[]; recover(options: { stableMessageId: string; action: "confirm" | "retry"; actorId: string; ownerId: string; leaseGeneration: number; }): ChannelEffectRecord; read(effectId: string): ChannelEffectRecord | undefined; listAmbiguous(): ChannelEffectRecord[]; private confirmAmbiguous; private beginAttempt; private insertAttempt; private require; private materialize; private resourceRevision; } export declare function channelEffectId(channelId: string, decisionId: string, requestDigest: string, purpose: ChannelEffectPurpose): string; export declare function channelEffectAttemptId(effectId: string, attemptNumber: number): string;