/** * ADR-406 §19.3 — versioned mission schemas. * * `MissionRecord` is the §19.3 logical schema field for field (strict). The * plan body, budget ledger, evidence index and executor observations are kept * in a `MissionView` beside it, so the record itself stays exactly the ADR's. * * Every client input (CLI and MCP alike) is parsed here: strict objects, * bounded strings and arrays, integer monetary units. Principal, tenant and * workspace are never accepted from input; the service derives them. */ import { z } from 'zod'; export declare const MISSION_SCHEMA_VERSION: 1; export declare const MISSION_EVENT_CONTRACT: "ruflo.mission-event/1"; export declare const MISSION_LIMITS: Readonly<{ objective: 2000; title: 200; text: 500; id: 64; tasks: 100; criteria: 50; deps: 32; capabilities: 32; maxMinor: 1000000000000; requestId: 128; eventsPage: 500; }>; export declare const missionStateSchema: z.ZodEnum<["draft", "planned", "awaitingAuthorization", "queued", "running", "pauseRequested", "paused", "blocked", "verifying", "completed", "failed", "cancelRequested", "cancelled"]>; export type MissionState = z.infer; export declare const TERMINAL_STATES: ReadonlySet; export declare const executionModeSchema: z.ZodEnum<["durable-executor", "session-bound"]>; export type ExecutionMode = z.infer; export declare const MISSION_ID: RegExp; /** §19.3, exactly. */ export declare const missionRecordSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; missionId: z.ZodString; tenantId: z.ZodString; workspaceId: z.ZodString; ownerPrincipalId: z.ZodString; revision: z.ZodNumber; objective: z.ZodString; plan: z.ZodObject<{ revision: z.ZodNumber; digest: z.ZodString; taskGraphRef: z.ZodString; }, "strict", z.ZodTypeAny, { revision: number; digest: string; taskGraphRef: string; }, { revision: number; digest: string; taskGraphRef: string; }>; policyRef: z.ZodString; authorizationRef: z.ZodOptional; budgetRef: z.ZodString; executionMode: z.ZodEnum<["durable-executor", "session-bound"]>; state: z.ZodEnum<["draft", "planned", "awaitingAuthorization", "queued", "running", "pauseRequested", "paused", "blocked", "verifying", "completed", "failed", "cancelRequested", "cancelled"]>; evidenceRefs: z.ZodArray; acceptance: z.ZodObject<{ revision: z.ZodNumber; criteriaDigest: z.ZodString; }, "strict", z.ZodTypeAny, { revision: number; criteriaDigest: string; }, { revision: number; criteriaDigest: string; }>; lastEventSequence: z.ZodNumber; createdAt: z.ZodString; updatedAt: z.ZodString; }, "strict", z.ZodTypeAny, { createdAt: string; state: "paused" | "queued" | "running" | "completed" | "failed" | "cancelled" | "blocked" | "planned" | "draft" | "awaitingAuthorization" | "pauseRequested" | "verifying" | "cancelRequested"; schemaVersion: 1; revision: number; objective: string; plan: { revision: number; digest: string; taskGraphRef: string; }; missionId: string; updatedAt: string; tenantId: string; workspaceId: string; ownerPrincipalId: string; policyRef: string; budgetRef: string; executionMode: "durable-executor" | "session-bound"; evidenceRefs: string[]; acceptance: { revision: number; criteriaDigest: string; }; lastEventSequence: number; authorizationRef?: string | undefined; }, { createdAt: string; state: "paused" | "queued" | "running" | "completed" | "failed" | "cancelled" | "blocked" | "planned" | "draft" | "awaitingAuthorization" | "pauseRequested" | "verifying" | "cancelRequested"; schemaVersion: 1; revision: number; objective: string; plan: { revision: number; digest: string; taskGraphRef: string; }; missionId: string; updatedAt: string; tenantId: string; workspaceId: string; ownerPrincipalId: string; policyRef: string; budgetRef: string; executionMode: "durable-executor" | "session-bound"; evidenceRefs: string[]; acceptance: { revision: number; criteriaDigest: string; }; lastEventSequence: number; authorizationRef?: string | undefined; }>; export type MissionRecord = z.infer; export declare const taskSpecSchema: z.ZodObject<{ id: z.ZodString; title: z.ZodString; dependsOn: z.ZodDefault>; executor: z.ZodObject<{ mode: z.ZodEnum<["durable-executor", "session-bound"]>; requirement: z.ZodString; }, "strict", z.ZodTypeAny, { mode: "durable-executor" | "session-bound"; requirement: string; }, { mode: "durable-executor" | "session-bound"; requirement: string; }>; capabilityCeiling: z.ZodDefault>; estimatedCostMinor: z.ZodDefault; checkpoint: z.ZodOptional; acceptanceEvidence: z.ZodDefault>; }, "strict", z.ZodTypeAny, { id: string; title: string; dependsOn: string[]; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; capabilityCeiling: string[]; estimatedCostMinor: number; acceptanceEvidence: string[]; checkpoint?: string | undefined; }, { id: string; title: string; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; checkpoint?: string | undefined; dependsOn?: string[] | undefined; capabilityCeiling?: string[] | undefined; estimatedCostMinor?: number | undefined; acceptanceEvidence?: string[] | undefined; }>; export declare const acceptanceCriterionSchema: z.ZodObject<{ id: z.ZodString; check: z.ZodString; inputs: z.ZodDefault>; baseline: z.ZodOptional; threshold: z.ZodOptional; producer: z.ZodString; independent: z.ZodDefault; mandatory: z.ZodDefault; }, "strict", z.ZodTypeAny, { id: string; check: string; inputs: string[]; producer: string; independent: boolean; mandatory: boolean; threshold?: string | undefined; baseline?: string | undefined; }, { id: string; check: string; producer: string; threshold?: string | undefined; baseline?: string | undefined; inputs?: string[] | undefined; independent?: boolean | undefined; mandatory?: boolean | undefined; }>; export declare const budgetSpecSchema: z.ZodObject<{ currency: z.ZodString; ceilingMinor: z.ZodEffects; tokens: z.ZodOptional; wallTimeSeconds: z.ZodOptional; concurrency: z.ZodOptional; retries: z.ZodOptional; }, "strict", z.ZodTypeAny, { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }, { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }>; export declare const planBodySchema: z.ZodObject<{ tasks: z.ZodArray>; executor: z.ZodObject<{ mode: z.ZodEnum<["durable-executor", "session-bound"]>; requirement: z.ZodString; }, "strict", z.ZodTypeAny, { mode: "durable-executor" | "session-bound"; requirement: string; }, { mode: "durable-executor" | "session-bound"; requirement: string; }>; capabilityCeiling: z.ZodDefault>; estimatedCostMinor: z.ZodDefault; checkpoint: z.ZodOptional; acceptanceEvidence: z.ZodDefault>; }, "strict", z.ZodTypeAny, { id: string; title: string; dependsOn: string[]; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; capabilityCeiling: string[]; estimatedCostMinor: number; acceptanceEvidence: string[]; checkpoint?: string | undefined; }, { id: string; title: string; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; checkpoint?: string | undefined; dependsOn?: string[] | undefined; capabilityCeiling?: string[] | undefined; estimatedCostMinor?: number | undefined; acceptanceEvidence?: string[] | undefined; }>, "many">; acceptance: z.ZodArray>; baseline: z.ZodOptional; threshold: z.ZodOptional; producer: z.ZodString; independent: z.ZodDefault; mandatory: z.ZodDefault; }, "strict", z.ZodTypeAny, { id: string; check: string; inputs: string[]; producer: string; independent: boolean; mandatory: boolean; threshold?: string | undefined; baseline?: string | undefined; }, { id: string; check: string; producer: string; threshold?: string | undefined; baseline?: string | undefined; inputs?: string[] | undefined; independent?: boolean | undefined; mandatory?: boolean | undefined; }>, "many">; budget: z.ZodObject<{ currency: z.ZodString; ceilingMinor: z.ZodEffects; tokens: z.ZodOptional; wallTimeSeconds: z.ZodOptional; concurrency: z.ZodOptional; retries: z.ZodOptional; }, "strict", z.ZodTypeAny, { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }, { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }>; scope: z.ZodDefault>; }, "strict", z.ZodTypeAny, { capabilities: string[]; }, { capabilities?: string[] | undefined; }>>; }, "strict", z.ZodTypeAny, { tasks: { id: string; title: string; dependsOn: string[]; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; capabilityCeiling: string[]; estimatedCostMinor: number; acceptanceEvidence: string[]; checkpoint?: string | undefined; }[]; scope: { capabilities: string[]; }; budget: { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }; acceptance: { id: string; check: string; inputs: string[]; producer: string; independent: boolean; mandatory: boolean; threshold?: string | undefined; baseline?: string | undefined; }[]; }, { tasks: { id: string; title: string; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; checkpoint?: string | undefined; dependsOn?: string[] | undefined; capabilityCeiling?: string[] | undefined; estimatedCostMinor?: number | undefined; acceptanceEvidence?: string[] | undefined; }[]; budget: { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }; acceptance: { id: string; check: string; producer: string; threshold?: string | undefined; baseline?: string | undefined; inputs?: string[] | undefined; independent?: boolean | undefined; mandatory?: boolean | undefined; }[]; scope?: { capabilities?: string[] | undefined; } | undefined; }>; export type PlanBody = z.infer; export type TaskSpec = z.infer; export declare const createInputSchema: z.ZodObject<{ requestId: z.ZodString; objective: z.ZodString; }, "strict", z.ZodTypeAny, { objective: string; requestId: string; }, { objective: string; requestId: string; }>; export declare const planInputSchema: z.ZodObject<{ requestId: z.ZodString; missionId: z.ZodString; expectedRevision: z.ZodNumber; plan: z.ZodObject<{ tasks: z.ZodArray>; executor: z.ZodObject<{ mode: z.ZodEnum<["durable-executor", "session-bound"]>; requirement: z.ZodString; }, "strict", z.ZodTypeAny, { mode: "durable-executor" | "session-bound"; requirement: string; }, { mode: "durable-executor" | "session-bound"; requirement: string; }>; capabilityCeiling: z.ZodDefault>; estimatedCostMinor: z.ZodDefault; checkpoint: z.ZodOptional; acceptanceEvidence: z.ZodDefault>; }, "strict", z.ZodTypeAny, { id: string; title: string; dependsOn: string[]; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; capabilityCeiling: string[]; estimatedCostMinor: number; acceptanceEvidence: string[]; checkpoint?: string | undefined; }, { id: string; title: string; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; checkpoint?: string | undefined; dependsOn?: string[] | undefined; capabilityCeiling?: string[] | undefined; estimatedCostMinor?: number | undefined; acceptanceEvidence?: string[] | undefined; }>, "many">; acceptance: z.ZodArray>; baseline: z.ZodOptional; threshold: z.ZodOptional; producer: z.ZodString; independent: z.ZodDefault; mandatory: z.ZodDefault; }, "strict", z.ZodTypeAny, { id: string; check: string; inputs: string[]; producer: string; independent: boolean; mandatory: boolean; threshold?: string | undefined; baseline?: string | undefined; }, { id: string; check: string; producer: string; threshold?: string | undefined; baseline?: string | undefined; inputs?: string[] | undefined; independent?: boolean | undefined; mandatory?: boolean | undefined; }>, "many">; budget: z.ZodObject<{ currency: z.ZodString; ceilingMinor: z.ZodEffects; tokens: z.ZodOptional; wallTimeSeconds: z.ZodOptional; concurrency: z.ZodOptional; retries: z.ZodOptional; }, "strict", z.ZodTypeAny, { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }, { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }>; scope: z.ZodDefault>; }, "strict", z.ZodTypeAny, { capabilities: string[]; }, { capabilities?: string[] | undefined; }>>; }, "strict", z.ZodTypeAny, { tasks: { id: string; title: string; dependsOn: string[]; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; capabilityCeiling: string[]; estimatedCostMinor: number; acceptanceEvidence: string[]; checkpoint?: string | undefined; }[]; scope: { capabilities: string[]; }; budget: { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }; acceptance: { id: string; check: string; inputs: string[]; producer: string; independent: boolean; mandatory: boolean; threshold?: string | undefined; baseline?: string | undefined; }[]; }, { tasks: { id: string; title: string; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; checkpoint?: string | undefined; dependsOn?: string[] | undefined; capabilityCeiling?: string[] | undefined; estimatedCostMinor?: number | undefined; acceptanceEvidence?: string[] | undefined; }[]; budget: { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }; acceptance: { id: string; check: string; producer: string; threshold?: string | undefined; baseline?: string | undefined; inputs?: string[] | undefined; independent?: boolean | undefined; mandatory?: boolean | undefined; }[]; scope?: { capabilities?: string[] | undefined; } | undefined; }>; }, "strict", z.ZodTypeAny, { requestId: string; plan: { tasks: { id: string; title: string; dependsOn: string[]; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; capabilityCeiling: string[]; estimatedCostMinor: number; acceptanceEvidence: string[]; checkpoint?: string | undefined; }[]; scope: { capabilities: string[]; }; budget: { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }; acceptance: { id: string; check: string; inputs: string[]; producer: string; independent: boolean; mandatory: boolean; threshold?: string | undefined; baseline?: string | undefined; }[]; }; missionId: string; expectedRevision: number; }, { requestId: string; plan: { tasks: { id: string; title: string; executor: { mode: "durable-executor" | "session-bound"; requirement: string; }; checkpoint?: string | undefined; dependsOn?: string[] | undefined; capabilityCeiling?: string[] | undefined; estimatedCostMinor?: number | undefined; acceptanceEvidence?: string[] | undefined; }[]; budget: { currency: string; ceilingMinor: number; tokens?: number | undefined; concurrency?: number | undefined; wallTimeSeconds?: number | undefined; retries?: number | undefined; }; acceptance: { id: string; check: string; producer: string; threshold?: string | undefined; baseline?: string | undefined; inputs?: string[] | undefined; independent?: boolean | undefined; mandatory?: boolean | undefined; }[]; scope?: { capabilities?: string[] | undefined; } | undefined; }; missionId: string; expectedRevision: number; }>; export declare const getInputSchema: z.ZodObject<{ missionId: z.ZodOptional; }, "strict", z.ZodTypeAny, { missionId?: string | undefined; }, { missionId?: string | undefined; }>; export declare const eventsInputSchema: z.ZodObject<{ missionId: z.ZodString; afterSequence: z.ZodDefault; limit: z.ZodDefault; }, "strict", z.ZodTypeAny, { limit: number; missionId: string; afterSequence: number; }, { missionId: string; limit?: number | undefined; afterSequence?: number | undefined; }>; export declare const requestActionInputSchema: z.ZodObject<{ requestId: z.ZodString; missionId: z.ZodString; expectedRevision: z.ZodNumber; action: z.ZodEnum<["pause", "resume", "cancel", "requestAuthorization", "admit"]>; reason: z.ZodOptional; }, "strict", z.ZodTypeAny, { action: "pause" | "resume" | "cancel" | "admit" | "requestAuthorization"; requestId: string; missionId: string; expectedRevision: number; reason?: string | undefined; }, { action: "pause" | "resume" | "cancel" | "admit" | "requestAuthorization"; requestId: string; missionId: string; expectedRevision: number; reason?: string | undefined; }>; export type CreateInput = z.infer; export type PlanInput = z.infer; export type GetInput = z.infer; export type EventsInput = z.infer; export type RequestActionInput = z.infer; /** Control events change mission state or authority and bump `revision`. */ export declare const CONTROL_EVENTS: readonly ["mission.created", "plan.validated", "plan.revised", "authorization.missing", "admission.accepted", "executor.acknowledged", "pause.accepted", "quiescence.confirmed", "blocked", "resume.admitted", "tasks.settled", "acceptance.passed", "acceptance.failed", "cancel.admitted", "cancel.settled", "failure.verified"]; /** Observations record what was seen; they never change state or revision. */ export declare const OBSERVATION_EVENTS: readonly ["executor.observed", "evidence.recorded", "task.observed"]; export type ControlEventType = typeof CONTROL_EVENTS[number]; export type ObservationEventType = typeof OBSERVATION_EVENTS[number]; export type MissionEventType = ControlEventType | ObservationEventType; export interface MissionEvent { readonly contract: typeof MISSION_EVENT_CONTRACT; readonly seq: number; readonly missionId: string; readonly type: MissionEventType; /** Revision the requester expected; `null` for observations. */ readonly expectedRevision: number | null; /** Mission revision after this event. */ readonly revision: number; readonly principalId: string; readonly channel: 'cli' | 'mcp' | 'executor' | 'internal'; readonly requestId: string | null; readonly requestDigest: string | null; readonly policyDecisionRef: string | null; readonly at: string; readonly payload: Record; readonly prevHash: string; readonly hash: string; } export declare const executorConnectionSchema: z.ZodEnum<["healthy", "stale", "disconnected", "unknown"]>; export type ExecutorConnection = z.infer; //# sourceMappingURL=schemas.d.ts.map