/** * Standing orders (Studio OS behaviour 10) — the routes. * * GET /standing-orders the away flag, the orders, the queued outbox * PUT /standing-orders/away `{ away }` — turning it on re-sweeps the open gates * POST /standing-orders/parse `{ text }` → `{ rule, seat }`: ONE seat reads the words (a * one-turn chat, closed after); the studio shows the rule back * POST /standing-orders `{ text, rule }` — the CONFIRMED rule; the invariant refuses * an approve of the deliver gate, a plan approval or a finding * DELETE /standing-orders/:id retire an order */ import type { FastifyInstance } from 'fastify'; import { z } from 'zod'; import type { StandingOrderEvaluator } from './evaluator.js'; import { type StandingOrderRule, type StandingOrderStore } from './store.js'; export declare const CreateStandingOrderSchema: z.ZodObject<{ text: z.ZodString; rule: z.ZodObject<{ scope: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{ kind: z.ZodLiteral<"all">; }, "strict", z.ZodTypeAny, { kind: "all"; }, { kind: "all"; }>, z.ZodObject<{ kind: z.ZodLiteral<"project">; projectId: z.ZodString; }, "strict", z.ZodTypeAny, { kind: "project"; projectId: string; }, { kind: "project"; projectId: string; }>]>; trigger: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{ kind: z.ZodLiteral<"gate">; phase: z.ZodString; band: z.ZodOptional; preset: z.ZodOptional; }, "strict", z.ZodTypeAny, { kind: "gate"; phase: string; preset?: string | undefined; band?: string | undefined; }, { kind: "gate"; phase: string; preset?: string | undefined; band?: string | undefined; }>, z.ZodObject<{ kind: z.ZodLiteral<"finding">; severity: z.ZodEnum<["high", "medium", "*"]>; }, "strict", z.ZodTypeAny, { kind: "finding"; severity: "*" | "high" | "medium"; }, { kind: "finding"; severity: "*" | "high" | "medium"; }>]>; action: z.ZodEnum<["approve", "hold", "notify"]>; activeWhen: z.ZodEnum<["away", "always"]>; }, "strict", z.ZodTypeAny, { scope: { kind: "all"; } | { kind: "project"; projectId: string; }; action: "notify" | "approve" | "hold"; trigger: { kind: "gate"; phase: string; preset?: string | undefined; band?: string | undefined; } | { kind: "finding"; severity: "*" | "high" | "medium"; }; activeWhen: "always" | "away"; }, { scope: { kind: "all"; } | { kind: "project"; projectId: string; }; action: "notify" | "approve" | "hold"; trigger: { kind: "gate"; phase: string; preset?: string | undefined; band?: string | undefined; } | { kind: "finding"; severity: "*" | "high" | "medium"; }; activeWhen: "always" | "away"; }>; }, "strict", z.ZodTypeAny, { text: string; rule: { scope: { kind: "all"; } | { kind: "project"; projectId: string; }; action: "notify" | "approve" | "hold"; trigger: { kind: "gate"; phase: string; preset?: string | undefined; band?: string | undefined; } | { kind: "finding"; severity: "*" | "high" | "medium"; }; activeWhen: "always" | "away"; }; }, { text: string; rule: { scope: { kind: "all"; } | { kind: "project"; projectId: string; }; action: "notify" | "approve" | "hold"; trigger: { kind: "gate"; phase: string; preset?: string | undefined; band?: string | undefined; } | { kind: "finding"; severity: "*" | "high" | "medium"; }; activeWhen: "always" | "away"; }; }>; export declare const ParseStandingOrderSchema: z.ZodObject<{ text: z.ZodString; }, "strict", z.ZodTypeAny, { text: string; }, { text: string; }>; export declare const StandingAwaySchema: z.ZodObject<{ away: z.ZodBoolean; }, "strict", z.ZodTypeAny, { away: boolean; }, { away: boolean; }>; /** The seat's parse: a rule it produced, or why it could not (its own answer, for the person). */ export type ParseOutcome = { ok: true; rule: StandingOrderRule; seat: string; } | { ok: false; code: 409 | 422 | 502; error: string; answer?: string; }; export interface StandingOrderRouteDeps { store: StandingOrderStore; evaluator: StandingOrderEvaluator; parse: (text: string) => Promise; } /** The seat's instructions: the rule schema in words, the projects it may scope to, the words. */ export declare function parsePrompt(text: string, projects: Array<{ id: string; name: string; }>): string; /** The first JSON object in a seat's answer that is a valid rule, or undefined. */ export declare function ruleFromAnswer(answer: string): StandingOrderRule | undefined; export declare function registerStandingOrderRoutes(app: FastifyInstance, deps: StandingOrderRouteDeps): void; //# sourceMappingURL=routes.d.ts.map