import type { FastifyInstance } from 'fastify'; import { PlanSchema } from './plan-schema.js'; import type { RecordedStallFrame } from './stall-frame-index.js'; import { z } from 'zod'; import { CoreAdapter } from '../core/adapter.js'; import type { CodeGraphData, CoreEvent, RepoFinding } from '../core/types.js'; import { type GateCache } from './gate-cache.js'; import type { ElicitationCache } from './elicitation-cache.js'; import type { LaunchRunInput, SessionView } from '../core/types.js'; import { SeatHealthTracker } from './seat-health.js'; import { type RosterWithStanding } from './roster-standing.js'; import { type ExecLike } from './seat-container-login.js'; import { ChatTurnIndex } from './chat-turns.js'; import type { ChatTranscriptStore } from './chat-transcripts.js'; import { ChatScopeIndex } from './chat-scope.js'; import { AskPathIndex } from './ask-paths.js'; import { DocRunIndex } from '../interactive/doc-run-index.js'; import { SearchService } from './search-routes.js'; import type { FreshenCheckout } from './chat-freshness.js'; import { TestSetIndex } from '../qe/test-sets.js'; import { parseEstateTotals } from '../projects/graph.js'; import { type ProjectRoutesDeps } from '../projects/routes.js'; import type { DefaultEvalStore } from '../evals/store.js'; import type { AskServer } from '../mcp/ask-server.js'; import type { McpBroker } from '../mcp/broker.js'; import type { McpCallRecordSource } from '../mcp/call-records.js'; import type { McpRegistry } from '../mcp/registry.js'; import { type SkillsRuntime } from '../skills/runtime.js'; import { type RunSkillGapIndex } from '../skills/phase-skill-gaps.js'; import { type StateHomeWatch } from '../projects/state-home-preflight.js'; import type { EvalRunStore } from './eval-store.js'; import type { WatchRegistry } from '../watch/registry.js'; import { InteractiveBridgePool } from '../interactive/bridge-pool.js'; import { type PullRequestResolution } from '../core/deliver.js'; import { type CodebaseArchiveStore } from './codebase-archive.js'; import type { DocGroundingStore } from '../interactive/doc-grounding.js'; import type { DocLedgerSweep } from '../interactive/doc-ledger-sweep.js'; import { type LinkedIssuesResult } from '../core/linked-issues.js'; import { AuditLog } from './audit.js'; import { type ErrorRing } from './diagnostics.js'; import { ChatAttachmentStore } from './chat-attachments.js'; import { ChatHistoryStore } from './chat-history.js'; import { RetryIndex } from './retry-index.js'; import { DeliveryFreeze } from './delivery-freeze.js'; import { GroupIndex } from './group-index.js'; import { RunTimingIndex } from './run-timing-index.js'; import { GuidanceIndex } from './guidance-index.js'; import { DeliveryIndex, type DeliveryResolver } from './delivery-index.js'; import { DeliveryDerivationCache } from './delivery-cache.js'; import { type DeliverExec, type WorktreeReprovisioner } from './post-hoc-deliver.js'; import { type AuthMode } from './auth.js'; export { API_PREFIX } from './api-prefix.js'; import { DecisionLedger } from '../decisions/ledger.js'; import { DecisionService } from '../decisions/land.js'; import { ChatDecisionRecorder } from '../decisions/chat-recorder.js'; import { ConsiderationService } from '../decisions/consider.js'; import { type ConformanceRunner, type PackCheckRunner } from '../editors/pack-install.js'; import type { DecisionBusEmit } from '../decisions/events.js'; import { type DecisionsMode } from '../decisions/types.js'; /** How long `GET /health` waits on the engine's actor before answering `ping: "busy"` (crew#471). */ export declare const HEALTH_PING_WAIT_MS = 1000; /** `HealthResponse.ping` while the engine's actor is occupied: the daemon serves, the engine is busy. */ export declare const ENGINE_BUSY_PING = "busy"; /** * `codeGraphDb(repo)` for a repo surface, or `null` after answering **503** — a CURRENT engine that * resolved no repo-graph root (`code_graph_root_unresolvable`, wicked-core#406) is a daemon- * environment fault, not a bad request and not Fastify's generic 500. The mapping is the shared * `codeGraphErrorStatus`; anything it does not classify rethrows unchanged (the stale-addon error * keeps its pre-existing shape here). */ /** * What `GET /repos/:id/graph` answers with 200 (F-2R2-005) — the daemon-side shape the drift guard * pins both ways against `wicked-crew-api-types` `RepoGraphResponse` (#533 review, F-5). `graph` * present = the estate slice; `graph: null` = not built, with `reason` (and the engine's `finding` * when it has one) saying why. */ export interface RepoGraphReply { graph: CodeGraphData | null; reason?: string; finding?: RepoFinding; } export { parseEstateTotals }; /** * Turns a failed parse into a 400 body, naming any field the schema does not know. * * Every schema here is `.strict()`, because zod's default is to STRIP unknown keys — which made a * misspelled optional field a silent behaviour change (FINDING-031). `POST /runs {"clis":[...], * "workflowId":"feature"}` — core's field names, not the HTTP layer's — answered `201` and ran the * full roster with no workflow. Rejecting is only half the fix: a bare "Invalid request body" leaves * the caller comparing their JSON against the source, so the unknown keys are named in `error` * itself, where a human and a `curl | jq .error` both see it without reading `details`. */ export declare function invalidBody(err: z.ZodError, what: string): { error: string; details: z.ZodIssue[]; }; export { policyProposalToRule } from './policy-landing.js'; /** * The launch body. Every field but `problem` is optional, which is what made stripping dangerous: * omitting one is a legitimate request that gets an engine default, so a MISSPELLED one was * indistinguishable from an omitted one and the run went ahead on a configuration the caller never * asked for (FINDING-031). * * The names differ from core's on purpose and this is the trap worth knowing about: core's * `LaunchSpec` takes `clis` (an array) and `workflow`, this takes `clisJson` (a JSON *string*) and * `workflow`, and the `/ws` `sessionStarted` frame reports the chosen workflow as `workflowId`. A * caller who reads the event stream to learn the field names arrives at `workflowId`, which this * schema does not accept — so `.strict()` is what turns that trip into a 400 instead of an * unworkflowed run reported as `201`. */ export { PlanSchema }; /** * The default launch roster ({@link defaultLaunchRoster}: no opt-in seats) — plus the opt-in seat a * launch NAMES as its lead (`primary`): naming it is the opt-in. */ export declare function launchRosterNaming(roster: readonly T[], primary: string | undefined): T[]; /** * Why `primary` cannot lead a launch on `clisJson`'s roster, or `null` when it can (DES-TEAMING-002 * §8.1). The roster is a JSON array of seats keyed by `key`. Leading is WORK (wicked-core#572: the * lead pick follows `seat_eligible_for_work`, not the ballot flag — crew#916), so a seat crew's * standing marks `work_eligible: false` (signed out, benched, or reviewer-only) cannot lead, nor can a * seat the launch would bench (its translated engine `health`). A roster that does not parse is * left to the engine's own parse error (the `engineRosterJson` rule). */ export declare function primaryRefusal(primary: string, clisJson: string): string | null; export declare const LaunchSchema: z.ZodEffects; clisJson: z.ZodOptional; /** (api-types 0.128.0; DES-TEAMING-002 §8.1) The seat that leads the run (the PA): a key in the * launch roster. Omitted ⇒ the engine picks at random (`path.started.selection`). */ primary: z.ZodOptional; entityMode: z.ZodOptional>; humanConfirm: z.ZodOptional; repoRef: z.ZodOptional; workflow: z.ZodOptional; /** DES-TEAMING-002 T3 — a user-composed plan (`LaunchRunBody.plan`), forwarded to the engine, * which publishes `plan.proposed{by:"human"}` and holds it at a `plan_approval` gate when the * approval matrix says so. Mutually exclusive with `workflow` (refine below). */ plan: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>, "many">; touch: z.ZodOptional>; override: z.ZodOptional; reason: z.ZodString; }, "strict", z.ZodTypeAny, { reason: string; remove: string[]; }, { reason: string; remove: string[]; }>>; monitors: z.ZodOptional>; }, "strict", z.ZodTypeAny, { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; }, { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; }>>; /** DES-PROJECT-001 §2.2 — file the run into a project; membership attaches atomically with * the launch record. Unknown/archived ⇒ the launch fails (never a silent unfiled run). */ projectId: z.ZodOptional; /** crew#293 — `"pr"` appends the hardened deliver Tool phase (push run branch + `gh pr create`) * to a PER-RUN copy of the selected workflow; requires `workflow` (enforced by the refine * below, so the 400 happens at parse time, not after the adapter is consulted). crew#393 — * `"none"` explicitly declines delivery (legal with or without a workflow); OMITTED means the * daemon decides: repo-scoped + a CODE-WORK workflow (a def with an `executes_code` phase) * defaults to `"pr"` (flippable via the `deliverDefault` setting), everything else to * `"none"` — see the resolution below. */ deliver: z.ZodOptional>; /** F-E2E-030 — who confirms the deliver phase. `'human'` (the default when omitted): the engine * pauses before the composed `deliver` Tool unit pushes and opens the PR, whatever * `humanConfirm` says. `'auto'`: the caller's EXPLICIT opt-out — the push and PR follow verify * unattended, under the daemon's active gh account; a UI sending it must name the posture * "auto-deliver" to its operator. Additive; an older daemon's schema rejects it with a 400. */ deliverGate: z.ZodOptional>; /** DES-UX-001 §8.3 (CREW-UX-3) — the run this launch retries. Must name an EXISTING run id * (the route checks the store and 400s with a named error otherwise); persisted via the * `run.launched` audit entry + retry index and echoed as `AgentSession.retry_of`. */ retryOf: z.ZodOptional; /** wicked-studio#27 (api-types 0.19.0) — attach this AD-HOC run to an EXISTING campaign's * surface. Validated against the campaign store before anything launches (unknown ⇒ 404, * engine without campaign bindings ⇒ 501 — never a silently dropped attach); persisted via * the `run.launched` audit entry + group index, echoed as `AgentSession.campaign_id`, and * served under `Campaign.attached_runs`. Provenance only: the run is NOT a DAG node. */ campaignId: z.ZodOptional; /** wicked-studio#27 (api-types 0.19.0) — ad-hoc label group, created on first use: runs * sharing a label form one `RunGroup` on `GET /campaigns`. Persisted/echoed like * `campaignId` (as `AgentSession.group_label`). */ groupLabel: z.ZodOptional; /** DES-L9 / crew#550 (api-types 0.38.0) — REVISE an OPEN same-repository pull request: its head * branch becomes the run's base and the deliver phase pushes the run's commits onto it (no * second PR), commenting the run record. Needs `repoRef` + `workflow` and `deliver: "pr"` * (explicit `"none"` is a 400; a daemon that resolves the omitted field to `none` is a 409). * Resolved via `gh pr view` at launch — not OPEN / a fork / gh failure ⇒ 409, nothing launched. * Send it only when `GET /health.capabilities.revisesPr === true` (engine ≥ 0.7.27). */ revisesPr: z.ZodOptional; /** crew#619 — the chat this run was promoted from; the daemon retains that chat's transcript * on disk until this run reaches a terminal state so the Continue-in-Build prefill is * always reproducible. Optional; omit when the launch is not promoted from a chat. */ chatId: z.ZodOptional; /** crew#632 — the surface that triggered this launch: `studio` (the web UI), `cli` (the * wicked-crew CLI), or `api` (a programmatic caller). Persisted on the `run.launched` audit * entry (`detail.channel`) and served on the run DTO; absent = origin unknown. */ channel: z.ZodOptional>; /** crew#632 — an opaque caller-supplied identifier for the user or system that triggered the * launch (e.g. a CI job name or a studio tab id). Persisted on the `run.launched` audit entry * (`detail.actor`) and served on the run DTO; absent = caller omitted it. */ actor: z.ZodOptional; /** crew#825 (api-types additive) — issue refs the intent names that the daemon must NOT read and * append (`541`, `#541`, `repo#541`, `owner/repo#541`): a reference in passing is not a request to inline * the issue. They are answered as `linkedIssues[].excluded`. Send only when * `GET /health.capabilities.linkedIssuesExclude === true`. */ excludeLinkedIssues: z.ZodOptional>; /** wicked-core#850 (api-types 0.102.0) — the EXPLICIT reduced-assurance opt-in: the creator's seat * may evaluate and a judge-less gate may pass, disclosed on every receipt. `false` is an explicit * "full assurance", the same as omitting it: the launcher never chooses for the caller, and a * full-assurance launch on a one-CLI roster is answered with `assuranceNotice` (`core/assurance.ts`). */ reducedAssurance: z.ZodOptional; /** QE-IN-APP-WORKFLOWS (api-types 0.106.0) — the operator's EXPLICIT skip of a required QE * acceptance, with a reason (labelled on the run, every gate and the delivery), or its explicit * force (no score waiver). Forwarded only when sent; crew never decides either for the caller, * and the engine refuses either on a run whose workflow does not require QE acceptance. */ skipQeAcceptance: z.ZodOptional>; forceQeAcceptance: z.ZodOptional; }, "strict", z.ZodTypeAny, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }>, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }>, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }>, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }>, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }>, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }>, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }>, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }, { problem: string; deliver?: "pr" | "none" | undefined; revisesPr?: number | undefined; workflow?: string | undefined; projectId?: string | undefined; sessionId?: string | undefined; clisJson?: string | undefined; primary?: string | undefined; entityMode?: "shared" | "isolated" | undefined; humanConfirm?: string | undefined; repoRef?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; reducedAssurance?: boolean | undefined; chatId?: string | undefined; actor?: string | undefined; channel?: "cli" | "studio" | "api" | undefined; campaignId?: string | undefined; groupLabel?: string | undefined; retryOf?: string | undefined; deliverGate?: "auto" | "human" | undefined; excludeLinkedIssues?: string[] | undefined; skipQeAcceptance?: { reason: string; } | undefined; forceQeAcceptance?: boolean | undefined; }>; /** The escalation arms (wicked-core#469 / #467): approve-shaped, no `amend` / `amendScope`. * `extend` | `targeted` | `accept_partial` answer the gate of a repo-checks floor that did not * finish (`repo_checks_timeout`) — the engine re-runs the floor on the tree as it stands with 2× * bounds, the targeted test set, or the unfinished checks waived; `accept_suggestion` adopts the * evaluator's discarded, pinned edit as the creator's amendment; `rejudge` (api-types 0.134.0) * re-runs the judge of a `judge_unavailable` gate on the same work, the step's seat not run again. * The ENGINE refuses each at any other gate (a 409 naming the gate it answers) — and `rejudge` * while no judge seat is eligible ({@link GateInfo.rejudge} says beforehand). */ export declare const ESCALATION_ACTIONS: readonly ["extend", "targeted", "accept_partial", "accept_suggestion", "rejudge"]; /** (core#820) A consent gate's answer token: `consent:` approves that row of the dry-run * plan (the engine refuses an id its plan does not offer); `reject` stays the decline. */ export declare const CONSENT_CHOICE_ACTION: RegExp; /** `POST /runs/:id/gate` (api-types 0.38.0 `GateDecision`; DES-L1 PR-2). Additive arms: `action` * names the arm (`approve` | `request_changes` | `reject`; absent = today's two-arm mapping of * `approve`), `amendScope` says where an approve's `amend` lands (`cursor` = the gated unit, today's * behaviour | `creator` = the first creator phase at/after the cursor — an intake steer reaches the * phase that implements). `request_changes` sends a NOT-PASS review back to the creator with the * findings in context (`amend` = the operator's note). A disagreement between `action` and * `approve` is a 400 that names both. The escalation arms ({@link ESCALATION_ACTIONS}) require * `approve: true` and take no `amend` / `amendScope` / `plan`. * * `amend_intent` (wicked-core#555) approves the gate AND AMENDS THE RUN'S INTENT: `amend` is * what the acceptance list now says (required, non-empty), `approve: true`, and no `amendScope` * — an intent amendment reaches every unit at or after the cursor, which is what makes it reach * the LATER EVALUATOR. It is the only arm that can descope a run mid-flight. * * `operator_judgment` (api-types 0.135.0, operator ruling 2026-10-21) is "approve as your own * judgment" at a FAILED REPO-CHECKS FLOOR's escalation gate: `approve: true`, the written rationale * in `amend` (required, non-empty), no `amendScope` or `plan`. The engine records it on the gate * receipt as an operator judgment overriding the floor ("floor overridden by operator", on the * run and the delivery too) and refuses it (409, gate left open) at any other gate and while any * other layer of the gate also denied. QE acceptance is never waived by it. */ export declare const OPERATOR_JUDGMENT_ACTION: "operator_judgment"; /** (j4-gates, api-types 0.139.0) SKIP QE ACCEPTANCE at a gate — the launch's `skipQeAcceptance`, * given later: `approve: true`, the written reason in `amend` (required, non-empty), no * `amendScope` or `plan`. The engine (wicked-core `HumanDecision::SkipQe`) records the run's QE * decision as `skipped` by the operator ("QE acceptance skipped by operator: "), labelled on * the run, every later gate and the delivery, and answers: the gate before the deliver step (this * route lets the delivery go without a QE PASS, saying so), the escalation gate of a unit only QE * denied (it counts), or a failed floor's gate with QE behind it (it re-opens on the floor alone). * Refused (409, gate left open) everywhere else and on a run that does not require QE. */ export declare const SKIP_QE_ACTION: "skip_qe"; /** (studio#923) The label an operator's QE skip carries on the run, every later gate and the * delivery — the engine's words ("QE acceptance skipped by operator: "). */ export declare const QE_SKIPPED_BY_OPERATOR_LABEL: "QE acceptance skipped by operator"; export declare const GateSchema: z.ZodEffects; action: z.ZodOptional, z.ZodString]>>; amendScope: z.ZodOptional>; /** DES-TEAMING-002 T3 — approve a `plan_approval` gate WITH AN EDIT (`GateDecision.plan`). */ plan: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>, "many">; touch: z.ZodOptional>; override: z.ZodOptional; reason: z.ZodString; }, "strict", z.ZodTypeAny, { reason: string; remove: string[]; }, { reason: string; remove: string[]; }>>; monitors: z.ZodOptional>; }, "strict", z.ZodTypeAny, { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; }, { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; }>>; /** api-types 0.44.0 — the gate this decision answers (its unit `ord`). A mismatch with the run's * open gate is a 409 `gate_changed`: the decision was made on a gate that is no longer open. */ ord: z.ZodOptional; }, "strict", z.ZodTypeAny, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectOutputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }, { approve: boolean; ord?: number | undefined; action?: string | undefined; plan?: { steps: z.objectInputType<{ catalog: z.ZodString; id: z.ZodOptional; }, z.ZodTypeAny, "passthrough">[]; override?: { reason: string; remove: string[]; } | undefined; touch?: string[] | undefined; monitors?: { asked: number; } | undefined; } | undefined; amend?: string | undefined; amendScope?: "creator" | "cursor" | undefined; }>; /** `PUT /runs/:id/guidance` (DES-UX-002 §7.2, CREW-UX-7) — the durable pre-gate note body. * The empty string is a legal body: it CLEARS the note. The byte cap is checked in the route * (not zod's char-counting `max`) so the 400 names the actual limit. */ export declare const GuidanceSchema: z.ZodObject<{ text: z.ZodString; }, "strict", z.ZodTypeAny, { text: string; }, { text: string; }>; export declare const OpenTerminalSchema: z.ZodObject<{ cwd: z.ZodString; cmd: z.ZodOptional>; cols: z.ZodNumber; rows: z.ZodNumber; governed: z.ZodOptional; }, "strict", z.ZodTypeAny, { cwd: string; rows: number; cols: number; cmd?: string[] | undefined; governed?: boolean | undefined; }, { cwd: string; rows: number; cols: number; cmd?: string[] | undefined; governed?: boolean | undefined; }>; /** `POST /seats/:cli/login|logout` body (crew#615): the PTY size, both optional. */ export declare const SeatSessionSchema: z.ZodObject<{ cols: z.ZodOptional; rows: z.ZodOptional; }, "strict", z.ZodTypeAny, { rows?: number | undefined; cols?: number | undefined; }, { rows?: number | undefined; cols?: number | undefined; }>; /** `POST /open` (crew#273) — the studio Files tab's "open with the OS default app" body. */ export declare const OpenPathSchema: z.ZodObject<{ path: z.ZodString; runId: z.ZodOptional; }, "strict", z.ZodTypeAny, { path: string; runId?: string | undefined; }, { path: string; runId?: string | undefined; }>; /** `POST /memory/retire` body (DES-MEM-FACETED-001). `scope_prefix` is REQUIRED and, after trim, * non-empty (enforced in the route so the 400 names the total-wipe guard): estate `memory.erase` * is subtree-scoped and refuses an empty prefix. `.strict()` for the FINDING-031 posture — an * unknown field is a 400, never silently ignored into a broader erase than the caller sent. */ export declare const RetireMemorySchema: z.ZodObject<{ scope_prefix: z.ZodString; }, "strict", z.ZodTypeAny, { scope_prefix: string; }, { scope_prefix: string; }>; /** `POST /memory/retire-item` body (studio#206): ONE memory, by its `memory_id` from `GET /memory`. * `.strict()`: a stray `scope_prefix` is a 400, never read as a wider erase than one row. */ export declare const RetireMemoryItemSchema: z.ZodObject<{ memory_id: z.ZodString; }, "strict", z.ZodTypeAny, { memory_id: string; }, { memory_id: string; }>; /** `POST /memory/edit` body (wicked-studio's Memory page): ONE memory's new words. `.strict()`: an * unknown field is a 400, never read as something wider than one memory. */ export declare const EditMemorySchema: z.ZodObject<{ memory_id: z.ZodString; content: z.ZodString; }, "strict", z.ZodTypeAny, { content: string; memory_id: string; }, { content: string; memory_id: string; }>; /** The actor/audit deps (task #88) — threaded from `createServer`. */ export interface SecurityDeps { audit: AuditLog; authMode: AuthMode; } /** What `registerRoutes` hands back to the server assembly: the ONE gate decision path, for the * daemon-side actors that answer gates (standing orders, behaviour 10). */ export interface RegisteredRoutes { decideGate: (id: string, decision: unknown, actor: import('../core/types.js').Actor, extraDetail?: Record) => Promise<{ code: number; body: unknown; }>; /** DC-S4a: the decision service (null when capture is not wired) — the boot re-drive uses it. */ decisions: DecisionService | null; /** DC-S4b: the studio chat recorder (null when capture, the transcript store or the fan-out is not wired). */ chatRecorder: ChatDecisionRecorder | null; /** DC-S7: considered · set aside · cited, and the rules the seats were told about. */ considerations: ConsiderationService; /** `GET /search`'s index: the daemon's frame fan-in feeds it (`ingest`). */ search: SearchService; /** A run as `GET /runs` serves it: launch time, delivery and project joined from the daemon's own records * (DES-RUNS-REVIEW-001: the run review folds these, never the engine's bare record). */ decorateRun: (view: SessionView) => SessionView; /** DES-DEFAULT-EVALS-001 §7: prepare a `run-evals` launch (run the evals in-process, write the report copy). */ runEvalsPrepare: (input: LaunchRunInput) => Promise; } export interface RuntimeDeps { /** DES-RUNS-REVIEW-001: prepare a `review-recent-work` launch (snapshot, write root, one seat); absent = launched as-is. * Its coverage is the review schedule's projects, wherever it was launched from (the run is still filed under the * caller's project). */ reviewLaunch?: (input: LaunchRunInput) => Promise; /** The engine refused a prepared review launch: the review is recorded as never run. */ reviewLaunchRefused?: (runId: string, reason: string) => void; /** DC-S4a decision capture: the ledger (`/decisions`), absent = capture off. */ decisionLedger?: DecisionLedger; /** `WICKED_DECISIONS` (off | ledger | on); defaults to `resolveDecisionsMode()`. */ decisionsMode?: DecisionsMode; /** The bus emit for `wicked.crew.decision.*` facts (ids only, never words); absent = no bus. */ decisionsEmit?: DecisionBusEmit | null; /** The watch registry (TR-W5a), for the `watch.*` settings guard; absent or `null` = no registry. */ watchRegistry?: () => WatchRegistry | null; /** Freeze deliveries (studio idea 15) — `createServer` hydrates one from the audit trail so a * restart keeps the freeze; a directly-driven route set gets a fresh (thawed) switch. */ deliveryFreeze?: DeliveryFreeze; /** DES-L9: how `revisesPr` is resolved to a PR head branch (`gh pr view`, 5 s). Injectable so * route tests answer without gh; production uses `core/deliver.ts::resolvePullRequest`. */ resolvePullRequest?: (repoRoot: string, number: number) => Promise; /** crew#627: how the issues a launch's intent links are read (`gh issue view`, 5 s each). * Injectable so route tests answer without gh; production uses `core/linked-issues.ts`. */ resolveLinkedIssues?: (problem: string, repoRoot: string | undefined, repoRef: string | undefined, exclude?: readonly string[]) => Promise; seatHealth?: SeatHealthTracker; /** wicked-studio#284: the stall watchdog's remembered frames for a run — merged into * `GET /runs/:id/events` at serve time so a reloaded page sees the `workerStalled` / * `workerStallEscalated` facts the live socket carried. Absent ⇒ engine events only. */ stallFrames?: (runId: string) => readonly RecordedStallFrame[]; /** DES-SYSTEM-VIEW: the stall watchdog's newest evidence of life for a run (a relay frame or a * busy child process), read by `GET /system`. Absent ⇒ the durable event log alone. */ runEvidence?: (runId: string) => { at: number; source: 'relay' | 'process'; } | undefined; /** DES-SYSTEM-VIEW: the system snapshot's command runner (the gateway inspect, estate stats, the * vault version). Injectable for tests; production uses `execCapped`. */ systemExec?: (file: string, args: string[], opts: { timeout: number; }) => Promise<{ stdout: string; stderr: string; }>; /** Run→retry-lineage index (CREW-UX-3) — `createServer` hydrates one from the audit trail so * a restarted daemon still echoes `retry_of`; a directly-driven route set gets a fresh one. */ retryIndex?: RetryIndex; /** Run→ad-hoc-group index (wicked-studio#27) — `createServer` hydrates one from the audit * trail (the SAME `run.launched` scan as `retryIndex`) so attaches survive a restart; a * directly-driven route set gets a fresh one. */ groupIndex?: GroupIndex; /** Run→launch-time index (home command-center run metrics) — `createServer` hydrates one from * the audit trail (the SAME `run.launched` scan as `retryIndex`) so a restarted daemon still * echoes `AgentSession.created_at`; a directly-driven route set gets a fresh one. */ runTimingIndex?: RunTimingIndex; /** Run→operator-guidance index (CREW-UX-7) — `createServer` hydrates one from the audit trail * so a restarted daemon still echoes `guidance`; a directly-driven route set gets a fresh one. */ guidanceIndex?: GuidanceIndex; /** Chat→scope index (crew#502) — `createServer` supplies the one it also reaps on the engine's * `chatClosed` frames (so a reclaimed chat's scratch root goes with it); a directly-driven * route set gets a fresh one. */ chatScopes?: ChatScopeIndex; /** Per-chat turn index (F-RECON-017) — `createServer` feeds one from the CoreEvent fold so * `POST /chats/:id/messages` refuses a send to a seat still mid-turn; a directly-driven route * set gets a fresh one (tests fold frames into it themselves). */ chatTurns?: ChatTurnIndex; /** (ASK-C1) The daemon's record of each chat's ask path; tests inject one to read it back. */ askPaths?: AskPathIndex; /** (ASK-C1) Close a chat the engine holds no row for: the server feeds the synthetic * `chatClosed` frame through its own event fold (and /ws), so DELETE closes exactly the way an * engine close did. `runId` is the path's run, cancelled by this close: its retention hold on * the transcript (crew#619) is released first, so a chat that reuses the id does not inherit * the ended conversation (codex on #808 r3, 1). Absent (tests): the route closes the scope * slot and broadcasts. */ closeChat?: (frame: CoreEvent, runId: string | undefined, ticket: number) => void | Promise; /** DES-L5 (D-13): the chat transcript at rest — `GET /chats/:id.messages`. Absent ⇒ nothing is * persisted and the field is omitted (a directly-driven route in tests). */ chatTranscripts?: ChatTranscriptStore; /** DES-SYSTEM-CHAT: the chat history (kept after a chat ends) and the chat attachments. * Absent ⇒ built here over the transcripts (a directly-driven route set). */ chatHistory?: ChatHistoryStore; chatAttachments?: ChatAttachmentStore; /** Run→delivered-PR index (CREW-UX-8, crew#321) — `createServer` hydrates one from the audit * trail so a restarted daemon still echoes `delivery`; a directly-driven route set gets a * fresh one. */ deliveryIndex?: DeliveryIndex; /** The worktree-presence probe behind the `'stranded'` derivation (crew#393) — one stat per * served repo-scoped completed run. Injectable so route tests pin the derivation without * staging directories; defaults to `fs.existsSync`. */ worktreeExists?: (path: string) => boolean; /** The worktree-cleanliness probe behind the `'vacuous'` split of `'stranded'` (crew#311) — * runs only on runs that would otherwise read stranded. Injectable so route tests pin the * derivation without staging real repos; defaults to the TTL-memoized `gitWorktreeIsClean`. */ worktreeIsClean?: (path: string) => Promise; /** The run-branch-emptiness probe behind the reaped-worktree half of `'vacuous'` (crew#311) — * runs only on completed repo-scoped runs that would otherwise read `'none'`. Injectable for * the same reason; defaults to the TTL-memoized `gitRunBranchIsEmpty` over the adapter's * repo registry. */ runBranchIsEmpty?: (repoRef: string, runId: string) => Promise; /** The background delivery-derivation cache (GET /runs p99): the run DTOs READ this instead * of running the two git probes above at assembly — `createServer` builds one over the * production probes, arms its sweep, and warms it at each run's terminal frame. A * directly-driven route set gets a COLD, unstarted one over the same injectable probes: * reads then answer the stat-only tri-state until a test sweeps or warms it explicitly. */ deliveryCache?: DeliveryDerivationCache; /** The shared one-read-per-run delivery resolution (crew#851). For a served view inside the * completion window — terminal, deliver unit `done`, nothing on record yet — the run routes * AWAIT it before deriving `delivery`, so `status` and `delivery` come from one consistent * read and a run that pushed and opened its PR is never served `'stranded'`. Optional: a * directly-driven route set without one derives as before. */ deliveryResolver?: DeliveryResolver; /** (crew#720) The final-codebase zips (`AgentSession.codebase_archive`, `GET /runs/:id/artifacts/ * codebase.zip`, taken again by a post-hoc deliver). Optional: a directly-driven route set without * one serves no archive. */ codebaseArchives?: CodebaseArchiveStore; /** The read-path bound for that await (default `READ_PATH_SETTLE_MS`); tests shorten it. */ deliverySettleMs?: number; /** Def-awareness for the delivery derivation (crew#481 / D-14) — `createServer` injects the * `runCanDeliver(view, runWorkflowDef(view, adapter.listWorkflows()))` closure it also hands * its cache, so the campaigns rollup and the run DTOs classify from ONE predicate. A * directly-driven route set derives the same closure over the adapter's registry when it has * one, else every completed repo-scoped run stays a candidate (today's read). */ canDeliver?: (view: SessionView) => boolean; /** The post-hoc deliver exec (crew#393, `POST /runs/:id/deliver`) — spawns the hardened * deliver script in a run's worktree. Injectable so route tests aim the spawn's HOME/PATH at * a fixture (stub `gh`, local bare origin); defaults to the real `bash -lc` spawn. */ deliverExec?: DeliverExec; /** Stand a lift-conflict-stranded run's worktree back up from its `wicked/` branch when the * engine has reaped it (crew#418) — the post-hoc deliver path uses it before the exec above. * Injectable so route tests never shell out to git; defaults to {@link gitReprovisionWorktree}. */ reprovisionWorktree?: WorktreeReprovisioner; openWithOs?: (target: string) => Promise; /** The estate-MCP client behind `/proposals*` AND `/memory*` (DES-MEM-FACETED-001) — one seam for * every operator-facing estate tool (`proposal.*` + `memory.recall`/`memory.coverage`/ * `memory.erase`). Injectable so route tests never spawn `wicked-estate-mcp`; defaults to the * real spawn-per-call client (NON-`--readonly`, `WICKED_MEMORY_DB` pinned to the operator global * store — memory.erase is a WRITE). */ callEstateTool?: (tool: string, args: Record) => Promise; /** Seat sign-in presence probe (seat sign-in) — injectable so route tests never read the * developer's real dotfiles. Defaults to the file/env heuristic in seat-signin.ts. */ signedIn?: (seatKey: string, workerConfigRoot?: string) => boolean | null; /** The roster WITH crew's standing (`api/roster-standing.ts`) — `createServer` injects its single * instance so the routes, the interactive seams and the adapter's own launches all bench the * same seats (F-RECON-002/003); a directly-driven route set builds one over `seatHealth` + * `signedIn` above. */ rosterWithStanding?: RosterWithStanding; /** Injectable so container-login route tests never spawn the engine or a login container. */ seatLoginExec?: ExecLike; /** The `/ws` fan-out, for the few routes that say something to a thread themselves (a refused * chat seat, F-2R2-007). Absent (unit tests, library use) = nothing is broadcast. */ broadcast?: (frame: CoreEvent) => void; /** The wicked-interactive bridge pool behind `/projects/:id/interactive/*` (DES-MERGE-001 * slice 1). Injectable so the integration suite proxies to a FAKE bridge instead of * spawning a real `npx wicked-interactive serve`. */ interactiveBridges?: InteractiveBridgePool; /** F-043 — the directory of the bus db this daemon's interactive seams read, exported to a * bridge the pool spawns as `WICKED_BUS_DATA_DIR`. `null`/absent = not exported. Ignored when * `interactiveBridges` is injected (the injected pool carries its own io). */ interactiveBridgeBusDataDir?: string | null; /** F-046 — the create-time doc → subject-repo binding store the proxy records into and the * draft/demo seams read. Absent = the create stays pure transport (a directly-driven route set). */ docGrounding?: DocGroundingStore; /** crew#899: refresh (or report the staleness of) each checkout a chat opens on. `createServer` * wires {@link freshenCheckout}; absent = checkouts are read as they are (route tests). */ freshenCheckout?: FreshenCheckout; /** The governed doc-delete's handoff-ledger sweep (crew#338) — `createServer` wires the real * four-ledger sweep (live seam instances first, ledger files as fallback); a directly-driven * route set gets an INERT one so unit tests never touch ~/.wicked-crew. */ dropDocLedgerRows?: (documentId: string, projectId?: string) => DocLedgerSweep; /** EP-C2 — where the interactive-review seam records documents' reviews (`/_reviews`). * Absent = the default handoff root under the daemon's state home (read-only here). */ docReviewsDir?: () => string; /** The daemon's in-process error-level log ring (diagnostics) — `createServer` tees the pino * stream into one; a directly-driven route set (tests) gets an honestly-empty tail. */ errorRing?: ErrorRing; /** The pre-fix HOME dead-letter outbox `/diagnostics.governance` points at when it exists * (crew#495): `undefined` = the engine's own default under HOME; `null` = report none — a * directly-driven route set (tests) never has to `stat` the developer's real home. */ governanceLegacyOutboxPath?: string | null; /** The studio asset root `createServer` resolved (bundled or overridden) — diagnostics reads * the bundle's shipped version manifest from it. Absent = headless = `studioBundle: null`. */ studioRoot?: string; /** EP-C1 (tests): the `pack check` runner `POST /editors` uses; default = garden's script as a child. */ packCheck?: PackCheckRunner; /** (tests) the install-time conformance run `POST /editors` uses; default = garden's runner as a child. */ editorConformance?: ConformanceRunner; /** EP-C1 (tests): where `daemon-editors.json` lives; default = the crew state home. */ editorsStateHome?: string; /** The eval RUN history store behind `/testing/evals[/:id]` — `createServer` builds one over the * daemon state home so every `POST /testing/evals/run` is recorded; a directly-driven route set * (tests) gets one only when it injects it, so a test that never touches the eval routes writes * nothing under `~/.wicked-crew`. */ evalStore?: EvalRunStore; /** The default-evals history (DES-DEFAULT-EVALS-001) — `createServer` builds one beside the eval store; a * directly-driven route set computes and answers runs but stores none unless a test injects one. */ defaultEvalStore?: DefaultEvalStore; /** (tests) where `run-evals` launches write their report copy; default `~/.wicked/evals` (`defaultEvalRunsDir`). */ evalRunsDir?: string; /** The skills seam (skills keystone) — `createServer` builds one over the daemon state home * (seeded from the installed plugin, published); a directly-driven route set gets none and * `/skills*` answers 503 unless a test injects one over a fixture root. */ skills?: SkillsRuntime; /** The MCP tools registry (DES-MCP-TOOLS-001 S2) — `createServer` builds one over * `/mcp`; a directly-driven route set gets none and `/mcp/*` answers 503 unless a * test injects one over a scratch dir. */ mcp?: McpRegistry; /** The MCP broker's call path (DES-MCP-TOOLS-001 S3) over that registry; absent → `POST /mcp/call` 503. */ mcpBroker?: McpBroker; askServer?: AskServer; /** The broker's call records (DES-MCP-TOOLS-001 S7), the ones `GET /mcp/usage` folds; absent → 503. */ mcpCalls?: McpCallRecordSource; /** crew#661 — the runs that launched with a skill gap before crew#935 (`AgentSession.skill_gaps`), * hydrated from the trail. Absent = no run carries the field. */ runSkillGaps?: RunSkillGapIndex; /** The live state-home classification (wicked-core#411 / crew#497) — `createServer` surveys the * daemon state home at boot and hands the watch here; the routes re-survey on demand, report it * on `/diagnostics.stateHome` + `/health.warnings`, and answer `POST /runs` 409 while a handed * snapshot derives a state home with an entry the fence cannot classify. A directly-driven route * set (tests) gets none: no survey, no warning, no gate — never a fabricated clean answer. */ stateHome?: StateHomeWatch; /** The document ↔ run binding (wave 6, F-4R2-006) read off the interactive seams' handoff ledgers — * `createServer` builds one over the four ledger sources; a directly-driven route set gets an * EMPTY one (`document_id: null` on every run). */ docRuns?: DocRunIndex; /** The registered test sets (wave 6, F-7R2-014) — `createServer` hydrates one from the trail and * registers into it at each `qe-author-tests` run's terminal frame; a directly-driven route set * gets a fresh, empty one. */ testSets?: TestSetIndex; /** crew#619 — called when a run is launched with a `chatId`, to retain that chat's transcript * until the run terminates. Absent in directly-driven route sets (tests). */ linkChatRun?: (chatId: string, runId: string) => void; /** crew#642 — entity-count probe for the chat scope's `ownGraph` liveness check. Injectable so * route tests never shell `wicked-estate` against mkdtemp fixtures. Absent = the dep carries * its own default (shells `estate stats --db`). */ entityCount?: (dbPath: string) => Promise; } /** * The daemon REST surface. Every endpoint is a thin wrapper over one adapter / * core-ts call (DES-STUDIO-001 §2). `session`/`phase` nouns are now `run`/`unit`. */ /** * `POST /chats` body (crew#165; `projectId` DES-PROJECT-001 §2.2; `repoRefs` + scope semantics * crew#502). Exported for the wire-contract drift guard (`tests/wire-contract.test.ts`). */ export declare const ChatOpenSchema: z.ZodObject<{ chatId: z.ZodOptional; clis: z.ZodOptional>; /** One repo in scope — the legacy spelling, merged into `repoRefs` (crew#502). */ repoRef: z.ZodOptional; /** The repos in scope, by registry id or name (crew#502). */ repoRefs: z.ZodOptional>; /** File the chat into a project (`crew.chat` membership) — and, with no `repoRefs`, scope it to * every registered `crew.repo` member of that project (crew#502). */ projectId: z.ZodOptional; /** The scope the caller NAMES (studio#323 R4) — omitted ⇒ the legacy inference. Shape rules * (which kinds need / refuse `projectId` / `repoRefs`) are the resolver's (`chat-scope.ts`). */ scopeKind: z.ZodOptional>; /** (ASK-C1) The seat the operator chose as the primary agent; omitted ⇒ the engine picks at random. */ primary: z.ZodOptional; /** (api-types 0.137.0, DES-SYSTEM-CHAT) The page the chat was started on, for the history list. */ startedOn: z.ZodOptional>; /** (api-types 0.141.0, crew#1157) The read-only workflow every turn runs (`analyze`); see * `chat-workflow.ts`. Omitted ⇒ a plain chat. */ workflow: z.ZodOptional; }, "strict", z.ZodTypeAny, { workflow?: string | undefined; projectId?: string | undefined; primary?: string | undefined; repoRef?: string | undefined; chatId?: string | undefined; clis?: string[] | undefined; repoRefs?: string[] | undefined; scopeKind?: "project" | "repo" | "none" | "system" | "repos" | "everything" | undefined; startedOn?: { label: string; route: string; } | undefined; }, { workflow?: string | undefined; projectId?: string | undefined; primary?: string | undefined; repoRef?: string | undefined; chatId?: string | undefined; clis?: string[] | undefined; repoRefs?: string[] | undefined; scopeKind?: "project" | "repo" | "none" | "system" | "repos" | "everything" | undefined; startedOn?: { label: string; route: string; } | undefined; }>; export declare function registerRoutes(app: FastifyInstance, adapter: CoreAdapter, gateCache: GateCache, elicitationCache: ElicitationCache, projects?: ProjectRoutesDeps, security?: SecurityDeps, runtime?: RuntimeDeps): RegisteredRoutes; //# sourceMappingURL=routes.d.ts.map