import { z } from 'zod'; import type { TenantId } from '../../types/ids/index.js'; export declare const residentDecisionSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{ kind: z.ZodLiteral<"wait">; summary: z.ZodString; wakeAt: z.ZodNullable; }, "strip", z.ZodTypeAny, { kind: "wait"; summary: string; wakeAt: number | null; }, { kind: "wait"; summary: string; wakeAt: number | null; }>, z.ZodObject<{ kind: z.ZodLiteral<"complete">; summary: z.ZodString; }, "strip", z.ZodTypeAny, { kind: "complete"; summary: string; }, { kind: "complete"; summary: string; }>, z.ZodObject<{ kind: z.ZodLiteral<"blocked">; summary: z.ZodString; }, "strip", z.ZodTypeAny, { kind: "blocked"; summary: string; }, { kind: "blocked"; summary: string; }>]>; /** @experimental One bounded step's durable disposition; silence is not completion. */ export type ResidentDecision = z.infer; export declare const residentStateSchema: z.ZodEffects; identity: z.ZodString; objective: z.ZodString; revision: z.ZodNumber; stepsAdmitted: z.ZodNumber; phase: z.ZodEnum<["waiting", "running", "complete", "blocked"]>; wakeAt: z.ZodNullable; reason: z.ZodString; /** Accepted wake inputs, in commit order, retained until this step settles. */ wakeEvidence: z.ZodOptional>, "many">, Readonly<{ reason: string; receivedAt: number; }>[], Readonly<{ reason: string; receivedAt: number; }>[]>>>; summary: z.ZodNullable; claimId: z.ZodNullable; }, "strip", z.ZodTypeAny, { summary: string | null; reason: string; phase: "running" | "complete" | "blocked" | "waiting"; tenantId: string; identity: string; revision: number; objective: string; wakeAt: number | null; agentKey: string; stepsAdmitted: number; claimId: string | null; pursuitId?: string | undefined; wakeEvidence?: readonly Readonly<{ reason: string; receivedAt: number; }>[] | undefined; }, { summary: string | null; reason: string; phase: "running" | "complete" | "blocked" | "waiting"; tenantId: string; identity: string; revision: number; objective: string; wakeAt: number | null; agentKey: string; stepsAdmitted: number; claimId: string | null; pursuitId?: string | undefined; wakeEvidence?: readonly Readonly<{ reason: string; receivedAt: number; }>[] | undefined; }>, { summary: string | null; reason: string; phase: "running" | "complete" | "blocked" | "waiting"; tenantId: string; identity: string; revision: number; objective: string; wakeAt: number | null; agentKey: string; stepsAdmitted: number; claimId: string | null; pursuitId?: string | undefined; wakeEvidence?: readonly Readonly<{ reason: string; receivedAt: number; }>[] | undefined; }, { summary: string | null; reason: string; phase: "running" | "complete" | "blocked" | "waiting"; tenantId: string; identity: string; revision: number; objective: string; wakeAt: number | null; agentKey: string; stepsAdmitted: number; claimId: string | null; pursuitId?: string | undefined; wakeEvidence?: readonly Readonly<{ reason: string; receivedAt: number; }>[] | undefined; }>; /** @experimental Persisted identity and one pursuit, independent of a conversation. */ export type ResidentState = Readonly>; /** Bounded addressing for local resident state. Stored scope is still validated. */ export declare function residentKeySegment(key: string): string; /** @experimental Minimal atomic contract needed to execute an existing pursuit. */ export type ResidentExecutionStore = Pick; /** @experimental Backends must atomically compare revisions and publish admission before work. */ export interface ResidentStore { read(): Promise; create(identity: string, objective: string): Promise; claim(expected: ResidentState, now: number): Promise; settle(expected: ResidentState, decision: ResidentDecision, now: number): Promise; wake(expected: ResidentState, reason: string, now: number): Promise; } /** A competing owner advanced this resident's immutable revision. */ export declare class ResidentConflictError extends Error { constructor(); } /** * @experimental Local-filesystem state for one tenant/agent key and one pursuit. * A running claim never expires automatically: a crashed step may have effects. * Uses exclusive immutable revision publication, not a read/rename lock. */ export declare class DiskResidentStore implements ResidentStore { private readonly records; private readonly location; private readonly tenantId; private readonly agentKey; constructor(root: string, scope: { tenantId: TenantId; agentKey: string; }); private checked; read(): Promise; create(identity: string, objective: string): Promise; private change; /** Persist admission before invoking a model, tool or developer callback. */ claim(expected: ResidentState, now: number): Promise; /** Only the exact admitted revision may settle; late owners cannot overwrite recovery. */ settle(expected: ResidentState, decision: ResidentDecision, now: number): Promise; /** Host-supplied new evidence can wake a waiting pursuit; terminal work stays terminal. */ wake(expected: ResidentState, reason: string, now: number): Promise; } /** Internal transitions shared by single-pursuit and whole-agent admission. */ export declare function claimResidentState(state: ResidentState, now: number): ResidentState; export declare function settleResidentState(state: ResidentState, decision: ResidentDecision, now: number): ResidentState; export declare function wakeResidentState(state: ResidentState, reason: string, now: number): ResidentState; //# sourceMappingURL=store.d.ts.map