import { z } from 'zod'; import type { ResidentAgendaState } from './agenda.js'; export declare const residentMessageInputSchema: z.ZodObject<{ id: z.ZodString; pursuitId: z.ZodString; destination: z.ZodString; body: z.ZodEffects; notBefore: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; body: string; pursuitId: string; destination: string; notBefore: number; }, { id: string; body: string; pursuitId: string; destination: string; notBefore: number; }>; /** @experimental Host-approved content and an opaque destination route, never credentials. */ export type ResidentMessageInput = Readonly>; export declare const residentOutboxMessageSchema: z.ZodEffects; notBefore: z.ZodNumber; } & { tenantId: z.ZodString; agentKey: z.ZodString; sourceClaimId: z.ZodNullable; revision: z.ZodNumber; attempts: z.ZodNumber; phase: z.ZodEnum<["pending", "sending", "acknowledged", "cancelled"]>; claimId: z.ZodNullable; nextAttemptAt: z.ZodNullable; receiptId: z.ZodNullable; acknowledgedAt: z.ZodNullable; lastReason: z.ZodNullable; }, "strip", z.ZodTypeAny, { id: string; phase: "pending" | "cancelled" | "sending" | "acknowledged"; tenantId: string; revision: number; attempts: number; body: string; agentKey: string; pursuitId: string; claimId: string | null; destination: string; notBefore: number; sourceClaimId: string | null; nextAttemptAt: number | null; receiptId: string | null; acknowledgedAt: number | null; lastReason: string | null; }, { id: string; phase: "pending" | "cancelled" | "sending" | "acknowledged"; tenantId: string; revision: number; attempts: number; body: string; agentKey: string; pursuitId: string; claimId: string | null; destination: string; notBefore: number; sourceClaimId: string | null; nextAttemptAt: number | null; receiptId: string | null; acknowledgedAt: number | null; lastReason: string | null; }>, { id: string; phase: "pending" | "cancelled" | "sending" | "acknowledged"; tenantId: string; revision: number; attempts: number; body: string; agentKey: string; pursuitId: string; claimId: string | null; destination: string; notBefore: number; sourceClaimId: string | null; nextAttemptAt: number | null; receiptId: string | null; acknowledgedAt: number | null; lastReason: string | null; }, { id: string; phase: "pending" | "cancelled" | "sending" | "acknowledged"; tenantId: string; revision: number; attempts: number; body: string; agentKey: string; pursuitId: string; claimId: string | null; destination: string; notBefore: number; sourceClaimId: string | null; nextAttemptAt: number | null; receiptId: string | null; acknowledgedAt: number | null; lastReason: string | null; }>; /** @experimental Acknowledgment proves transport acceptance, not human reading. */ export type ResidentOutboxMessage = Readonly>; export declare const residentDeliveryOutcomeSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{ kind: z.ZodLiteral<"acknowledged">; receiptId: z.ZodString; }, "strip", z.ZodTypeAny, { kind: "acknowledged"; receiptId: string; }, { kind: "acknowledged"; receiptId: string; }>, z.ZodObject<{ kind: z.ZodLiteral<"not-accepted">; retryAt: z.ZodNullable; reason: z.ZodString; }, "strip", z.ZodTypeAny, { kind: "not-accepted"; reason: string; retryAt: number | null; }, { kind: "not-accepted"; reason: string; retryAt: number | null; }>]>; /** @experimental Retry only with evidence of non-acceptance; null retryAt ends delivery. */ export type ResidentDeliveryOutcome = Readonly>; /** @experimental Atomic admission and exact-claim settlement, without automatic claim expiry. */ export interface ResidentOutboxStore { read(): Promise; claimMessage(expected: ResidentAgendaState, id: string, now: number): Promise; settleMessage(expected: ResidentOutboxMessage, outcome: ResidentDeliveryOutcome, now: number): Promise; } /** @experimental A synchronous host policy, evaluated before claiming and again before sending. */ export type ResidentDeliveryGate = (message: ResidentOutboxMessage, now: number) => { readonly allow: true; } | { readonly allow: false; readonly nextCheckAt: number | null; readonly reason: string; }; /** @experimental Bind an authorized route; forward message.id as the stable idempotency key. */ export type ResidentMessageTransport = (message: ResidentOutboxMessage, signal: AbortSignal) => Promise; /** @experimental One dispatch admission, with no model invocation, polling or implicit retries. */ export interface ResidentDeliveryOptions { readonly signal: AbortSignal; readonly gate: ResidentDeliveryGate; readonly now?: () => number; } /** @experimental An idle result never asserts a message reached its destination. */ export type ResidentDeliveryResult = { readonly status: 'settled'; readonly message: ResidentOutboxMessage; } | { readonly status: 'idle'; readonly reason: 'paused' | 'unresolved' | 'empty' | 'not-due' | 'window' | 'contended'; readonly nextCheckAt: number | null; }; /** Internal pure enqueue used in the same revision transaction as pursuit settlement. */ export declare function appendResidentMessage(state: ResidentAgendaState, input: ResidentMessageInput, sourceClaimId?: string | null): readonly ResidentOutboxMessage[]; /** Internal exact-message transition; agenda storage owns exclusive admission. */ export declare function claimResidentOutboxMessage(message: ResidentOutboxMessage, now: number): ResidentOutboxMessage; /** Internal settlement; unknown failures deliberately have no transition. */ export declare function settleResidentOutboxMessage(message: ResidentOutboxMessage, outcome: ResidentDeliveryOutcome, now: number): ResidentOutboxMessage; /** * @experimental Persist one send claim before calling a host-owned transport. * Throws, malformed outcomes and cancellation keep the claim unresolved. Stop * old executors and inspect effects before explicit settleMessage reconciliation. */ export declare function deliverResidentMessage(store: ResidentOutboxStore, transport: ResidentMessageTransport, options: ResidentDeliveryOptions): Promise; //# sourceMappingURL=outbox.d.ts.map