toolroll 0.9.41 → 0.9.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cli.js +3 -1
  3. package/dist/coding-types.d.ts +2 -24
  4. package/dist/coding-workspace.js +12 -11
  5. package/dist/contracts/cli.d.ts +736 -0
  6. package/dist/contracts/cli.js +223 -0
  7. package/dist/contracts/coding-activity.d.ts +64 -0
  8. package/dist/contracts/coding-activity.js +58 -0
  9. package/dist/contracts/console-api.d.ts +483 -0
  10. package/dist/contracts/console-api.js +273 -0
  11. package/dist/contracts/diff-stat.d.ts +58 -0
  12. package/dist/contracts/diff-stat.js +59 -0
  13. package/dist/contracts/integration-metadata.d.ts +99 -0
  14. package/dist/contracts/integration-metadata.js +101 -0
  15. package/dist/contracts/model-catalog.d.ts +21 -0
  16. package/dist/contracts/model-catalog.js +14 -0
  17. package/dist/contracts/native-census.d.ts +42 -0
  18. package/dist/contracts/native-census.js +36 -0
  19. package/dist/contracts/observation-request.d.ts +37 -0
  20. package/dist/contracts/observation-request.js +25 -0
  21. package/dist/contracts/provider.d.ts +30 -0
  22. package/dist/contracts/provider.js +15 -0
  23. package/dist/contracts/recipes.d.ts +166 -0
  24. package/dist/contracts/recipes.js +52 -0
  25. package/dist/contracts/retention.d.ts +42 -0
  26. package/dist/contracts/retention.js +24 -0
  27. package/dist/contracts/storage.d.ts +23 -0
  28. package/dist/contracts/storage.js +10 -0
  29. package/dist/contracts/store-json.d.ts +315 -0
  30. package/dist/contracts/store-json.js +196 -0
  31. package/dist/contracts/trigger-payloads.d.ts +369 -0
  32. package/dist/contracts/trigger-payloads.js +144 -0
  33. package/dist/contracts/update-journal.d.ts +254 -0
  34. package/dist/contracts/update-journal.js +155 -0
  35. package/dist/contracts/verification-view.d.ts +93 -0
  36. package/dist/contracts/verification-view.js +43 -0
  37. package/dist/control-setup.d.ts +1 -1
  38. package/dist/desktop-update.d.ts +7 -40
  39. package/dist/desktop-update.js +36 -8
  40. package/dist/evidence.d.ts +3 -19
  41. package/dist/flow-triggers.js +61 -60
  42. package/dist/mcp-connect.js +37 -22
  43. package/dist/model-catalog.js +8 -6
  44. package/dist/observations.d.ts +2 -6
  45. package/dist/observations.js +13 -9
  46. package/dist/operate.js +2 -1
  47. package/dist/process-recovery-native.d.ts +2 -13
  48. package/dist/process-recovery-native.js +8 -5
  49. package/dist/project-tools.d.ts +6 -24
  50. package/dist/project-tools.js +22 -18
  51. package/dist/provider.d.ts +3 -8
  52. package/dist/provider.js +15 -11
  53. package/dist/recipes.d.ts +3 -28
  54. package/dist/recipes.js +79 -52
  55. package/dist/retention.d.ts +4 -5
  56. package/dist/retention.js +5 -4
  57. package/dist/serve.js +142 -28
  58. package/dist/storage.d.ts +2 -1
  59. package/dist/storage.js +12 -9
  60. package/dist/store.d.ts +3 -15
  61. package/dist/store.js +80 -158
  62. package/dist/surface.d.ts +6 -54
  63. package/dist/surface.js +6 -1
  64. package/dist/toolroll-update.d.ts +8 -99
  65. package/dist/toolroll-update.js +28 -18
  66. package/dist/verification-evidence.js +27 -12
  67. package/package.json +1 -1
@@ -0,0 +1,483 @@
1
+ /**
2
+ * The console's form bodies and JSON API (docs/plans/zod-revamp.md, item 13): one schema for every URL-encoded body a
3
+ * console route reads, and one for each `?format=json` response.
4
+ *
5
+ * A form is read exactly as before. Each field is what `URLSearchParams` holds for it — every value in the order
6
+ * sent, so `get()` is the first and `getAll()` the list — and every field may be left out, because each handler
7
+ * already supplies its own default, trimming, clipping, number conversion and refusal after reading. Unknown fields
8
+ * are ignored (browsers send `csrf`, buttons send their own names, and older pages send fields no longer read). What a
9
+ * handler may read is the schema's field list: `readForm` hands it a view typed by that list, so reading a field the
10
+ * contract doesn't name fails the typecheck instead of drifting. Nothing a person or script sent before is refused
11
+ * now; the CSRF, nonce, digest, password and duplicate-field checks stay in the handlers, in their order.
12
+ *
13
+ * The JSON responses are checked as they are sent (unversioned, unknown keys allowed, their bytes unchanged — an
14
+ * evidence pack carries sealed ledger entries); a response that disagrees is logged and sent anyway.
15
+ *
16
+ * Not here: Telegram's pushed updates (item 11), flow webhooks and public flow forms (item 15).
17
+ */
18
+ import { z } from "zod";
19
+ import { type ContractIssue } from "./contract.js";
20
+ /** A form contract: the route it serves, the fields its handler reads, and the schema those make. */
21
+ export type FormContract<K extends string> = {
22
+ readonly route: string;
23
+ readonly fields: readonly string[];
24
+ /** Field-name prefixes read with a computed suffix (`question:<id>`, `param.<id>`). */
25
+ readonly prefixes: readonly string[];
26
+ /** The handler reads names it computes from saved data (a template's questions); any name is typed as readable. */
27
+ readonly dynamic: boolean;
28
+ readonly schema: z.ZodType<Readonly<Record<string, readonly string[]>>>;
29
+ /** Phantom: the names a handler may read. */
30
+ readonly names?: K;
31
+ };
32
+ type Names<F extends readonly string[], P extends readonly string[], D extends boolean> = D extends true ? string : F[number] | `${P[number]}${string}`;
33
+ /** A form's contract: a loose object of optional text fields (unknown fields ignored, as the handlers always did). */
34
+ export declare function formContract<const F extends readonly string[], const P extends readonly string[] = readonly [], const D extends boolean = false>(route: string, fields: F, more?: {
35
+ prefixes?: P;
36
+ dynamic?: D;
37
+ }): FormContract<Names<F, P, D>>;
38
+ /**
39
+ * A body as its schema sees it: each field name once, in first-sent order, with all its values in sent order. Built
40
+ * with `Object.fromEntries`, so a field named `__proto__` is an ordinary field.
41
+ */
42
+ export declare function formFields(body: URLSearchParams): Record<string, string[]>;
43
+ /** What a handler reads a form through: `URLSearchParams`' own reads, limited to the names its contract declares. */
44
+ export type FormView<K extends string> = {
45
+ get(name: K): string | null;
46
+ getAll(name: K): string[];
47
+ has(name: K): boolean;
48
+ /** Every name sent, for the handlers' "one value for each field" checks. */
49
+ keys(): ReturnType<URLSearchParams["keys"]>;
50
+ /** The body as sent, for re-showing a form with what was typed and for helpers that take the whole form. */
51
+ readonly sent: URLSearchParams;
52
+ };
53
+ /** Where a disagreement is reported. The default writes one line to stderr, including under Vitest. */
54
+ export type ContractReport = (what: string, issues: readonly ContractIssue[]) => void;
55
+ /**
56
+ * Read a form through its contract. It never refuses: every value is text and every field optional, so a body that
57
+ * somehow disagrees is reported and read as it was sent (the handler's own checks decide, as before).
58
+ */
59
+ export declare function readForm<K extends string>(body: URLSearchParams, contract: FormContract<K>, report?: ContractReport): FormView<K>;
60
+ export declare const CONSOLE_FORMS: {
61
+ readonly signup: FormContract<"code" | "name" | "password">;
62
+ readonly login: FormContract<"name" | "return" | "token">;
63
+ readonly join: FormContract<"name" | "password">;
64
+ readonly mutationGuard: FormContract<"confirm" | "csrf" | "digest" | "nonce" | "token">;
65
+ readonly ledgerTarget: FormContract<"repo">;
66
+ readonly projectCeiling: FormContract<"repo">;
67
+ readonly demo: FormContract<"message" | "note">;
68
+ readonly updatesDismiss: FormContract<"quiet" | "return" | "version">;
69
+ readonly updatesChecks: FormContract<"check">;
70
+ readonly code: FormContract<"acceptance" | "answers" | "base" | "candidate" | "decision" | "goal" | "model" | "password" | "prompt" | "repo" | "requestId" | "title" | "visual" | `question:${string}`>;
71
+ readonly skillsRevise: FormContract<"feedback" | "nonce" | "repo" | "run">;
72
+ readonly skillsChange: FormContract<"action" | "content" | "files" | "identity" | "method" | "nonce" | "repo" | "restore" | "revision" | "sample" | "sha" | "url">;
73
+ readonly kit: FormContract<"repo">;
74
+ readonly teammates: FormContract<"choice" | "dailyTurns" | "id" | "manager" | "model" | "name" | "note" | "op" | "repo" | "schedule" | "soul" | "state" | "template" | "text" | "tool" | `field.${string}` | `over.${string}` | `undo.${string}` | `use.${string}`>;
75
+ readonly galleryUse: FormContract<string>;
76
+ readonly flows: FormContract<"about" | "address" | "answers" | "approve" | "body" | "choice" | "confirm" | "decision" | "definition" | "description" | "document" | "draft" | "entry" | "file" | "key" | "label" | "language" | "name" | "note" | "owner" | "password" | "previewed" | "remove" | "repo" | "revision" | "secret" | "stage" | "template" | "timeoutMinutes" | "title" | "trigger" | "url" | "value" | "watching" | `param.${string}`>;
77
+ readonly spendBudget: FormContract<"action" | "password" | "stop" | "target" | "usd">;
78
+ readonly projectConcurrency: FormContract<"concurrency" | "repo">;
79
+ readonly projectDelete: FormContract<"name" | "password" | "repo" | "step">;
80
+ readonly policy: FormContract<"ceiling" | "models" | "password" | "provider" | "tools">;
81
+ readonly approval: FormContract<"not_requester" | "password" | "paths" | "protect" | "repo">;
82
+ readonly sessions: FormContract<"access" | "action" | "days" | "everyone" | "name" | "password" | "session" | "token">;
83
+ readonly signIn: FormContract<"action" | "client-id" | "client-secret" | "groups-claim" | "issuer" | "label" | "password" | "passwords" | "scopes" | `group-${string}` | `projects-${string}` | `role-${string}`>;
84
+ readonly updates: FormContract<"password" | "version" | "when">;
85
+ readonly retention: FormContract<"chat" | "checkouts" | "evidence" | "notifications" | "password">;
86
+ readonly storage: FormContract<"cleanup" | "password" | "path" | "preview">;
87
+ readonly pullRequests: FormContract<"act" | "base" | "github" | "method" | "password" | "repo" | "when-green">;
88
+ readonly checks: FormContract<"act" | "command" | "level" | "on" | "password" | "repo" | "timeout">;
89
+ readonly backups: FormContract<"every" | "folder" | "keep" | "password">;
90
+ readonly data: FormContract<"password">;
91
+ readonly flowsOn: FormContract<"repo" | "starter">;
92
+ readonly integrationsTest: FormContract<"key">;
93
+ readonly monitoring: FormContract<"folder" | "header-name" | "header-value" | "password" | "rotate" | "traces" | "webhook">;
94
+ readonly toolsConnect: FormContract<"access" | "also" | "kit" | "password" | "repo" | "service" | "shown" | "template">;
95
+ readonly toolsChange: FormContract<"action" | "catalog" | "import" | "name" | "password" | "repo" | "secret" | "secrets" | "shown" | "target" | "transport" | "value">;
96
+ readonly appearance: FormContract<"accent" | "quiet" | "return" | "theme">;
97
+ readonly models: FormContract<"agent" | "enabled" | "phase" | "tool">;
98
+ readonly knowledgeRefresh: FormContract<"repo">;
99
+ readonly knowledgeProposal: FormContract<"decision" | "proposal" | "repo">;
100
+ readonly knowledgeDecision: FormContract<"action" | "claim" | "decision" | "reason" | "repo" | "why">;
101
+ readonly knowledgeChange: FormContract<"action" | "content" | "id" | "identity" | "instructions" | "path" | "repo" | "restore" | "revision" | "title">;
102
+ readonly learningChange: FormContract<"action" | "identity" | "lesson" | "repo" | "revision" | "sha" | "version">;
103
+ readonly projectSetup: FormContract<"command" | "fingerprint" | "model" | "nonce" | "provider" | "repo" | "seconds" | "token">;
104
+ readonly slack: FormContract<"app-token" | "bot-token" | "password">;
105
+ readonly telegramPair: FormContract<"password">;
106
+ readonly teams: FormContract<"app-id" | "password" | "secret" | "tenant">;
107
+ readonly discord: FormContract<"bot-token" | "password">;
108
+ readonly messaging: FormContract<"primary">;
109
+ readonly permissionDefault: FormContract<"permission-mode">;
110
+ readonly qualityDefault: FormContract<"quality-mode">;
111
+ readonly notifications: FormContract<"digest" | "mode" | "screenshots">;
112
+ readonly notificationsMute: FormContract<"pings" | "repo">;
113
+ readonly telegramDigest: FormContract<"every">;
114
+ readonly providerKey: FormContract<"auth-mode" | "provider" | "value">;
115
+ readonly telegramToken: FormContract<"token">;
116
+ readonly email: FormContract<"from" | "host" | "imapHost" | "imapPort" | "password" | "port" | "secure" | "user">;
117
+ readonly google: FormContract<"clientId" | "clientSecret">;
118
+ readonly projectsSelect: FormContract<"path" | "return">;
119
+ readonly projectsRemove: FormContract<"repo">;
120
+ readonly projectsOpen: FormContract<"path" | "return">;
121
+ readonly tasksAdd: FormContract<"acceptance" | "after" | "goal" | "id" | "not" | "permission-mode" | "plan-first" | "planning-policy" | "projectRevision" | "quality-mode" | "repo" | "scout" | "title" | "touches">;
122
+ readonly queue: FormContract<"before" | "column" | "from" | "note" | "projectRevision" | "queueRevision" | "respond" | "runner" | "task">;
123
+ readonly runnerRegister: FormContract<"capacity" | "name" | "token">;
124
+ readonly mode: FormContract<"allow-paid-fallback" | "auto-approve" | "chat-approve" | "days" | "digest" | "expiry" | "name" | "nonce" | "plan-auto" | "publication" | "repair-auto" | "review-auto" | "review-retry-auto" | "token">;
125
+ readonly peopleProjects: FormContract<"access" | "name" | "projects" | "token">;
126
+ readonly peopleInvite: FormContract<"access" | "projects" | "role" | "token">;
127
+ readonly peopleInviteRevoke: FormContract<"id" | "token">;
128
+ readonly peopleRevoke: FormContract<"name" | "token">;
129
+ readonly runnerRetire: FormContract<"name" | "token">;
130
+ readonly decisionAnswer: FormContract<"choice" | "confirm" | "note" | "return">;
131
+ readonly contest: FormContract<"act" | "choice" | "nonce" | "token">;
132
+ readonly attend: FormContract<"budget" | "digest" | "expiry" | "followup" | "minutes" | "model" | "nonce" | "parent" | "posture" | "token" | "turns">;
133
+ readonly confirmStopped: FormContract<"checked" | "return" | "run" | "token">;
134
+ readonly merge: FormContract<"anyway" | "run" | "token">;
135
+ readonly onboard: FormContract<"big-ok" | "nonce" | "repo" | "root" | "token">;
136
+ readonly pushSubscribe: FormContract<"auth" | "endpoint" | "p256dh" | "token">;
137
+ readonly pushRemove: FormContract<"id">;
138
+ readonly phoneDismiss: FormContract<"quiet">;
139
+ readonly leadIdentity: FormContract<"name" | "persona">;
140
+ readonly leadAbout: FormContract<"about">;
141
+ readonly leadPromiseCancel: FormContract<"promise">;
142
+ readonly chatConfig: FormContract<"daily-turns" | "forget-key" | "key" | "model" | "off" | "provider" | "return" | "token" | "weekly-usd">;
143
+ readonly mateMint: FormContract<"ceiling-usd" | "follow" | "return" | "token">;
144
+ readonly mateFollow: FormContract<"enabled" | "return">;
145
+ readonly mateEnd: FormContract<"return">;
146
+ readonly mateStop: FormContract<"return" | "turn">;
147
+ readonly mateProposal: FormContract<"confirm" | "nonce" | "return" | "token">;
148
+ readonly coordinatorProposal: FormContract<"confirm" | "return">;
149
+ readonly chat: FormContract<"message" | "mode" | "project" | "request" | "request-session" | "result" | "task" | "token">;
150
+ readonly chatFile: FormContract<"token">;
151
+ readonly chatAck: FormContract<"nonce" | "token">;
152
+ readonly recipes: FormContract<"document" | "next" | "preview" | "projectRevision" | "purpose" | "recipe" | "recipeRevision" | "repo" | "source" | "sourceRevision">;
153
+ readonly routinesAdd: FormContract<"acceptance" | "ceiling" | "goal" | "interval" | "interval-unit" | "name" | "not" | "projectRevision" | "repeat" | "schedule" | "time" | "timezone" | "touches" | "weekday">;
154
+ readonly routine: FormContract<"digest" | "nonce" | "token">;
155
+ readonly runNote: FormContract<"note">;
156
+ readonly diffComment: FormContract<"batch" | "intent" | "line" | "note" | "path" | "request" | "return" | "source" | "tab">;
157
+ readonly editorLinks: FormContract<"on" | "return">;
158
+ readonly turn: FormContract<"text">;
159
+ readonly revise: FormContract<"batch" | "return" | "source">;
160
+ readonly followUp: FormContract<"level" | "return">;
161
+ readonly resolveIncident: FormContract<"return">;
162
+ readonly taskSteer: FormContract<"note">;
163
+ readonly taskHold: FormContract<"reason">;
164
+ readonly taskBlock: FormContract<"on">;
165
+ readonly taskRepairDependency: FormContract<"blocker" | "operation" | "replacement">;
166
+ readonly taskNext: FormContract<"undo">;
167
+ readonly taskReopen: FormContract<"token">;
168
+ readonly taskRequeue: FormContract<"note" | "return">;
169
+ readonly taskFollowUp: FormContract<"index">;
170
+ readonly taskPlanEdit: FormContract<"plan-document" | "saw-plan">;
171
+ readonly taskRevision: FormContract<"revision-id" | "token">;
172
+ readonly taskCancel: FormContract<"reason">;
173
+ readonly taskRoute: FormContract<"agent" | "clear-phase" | "model" | "phase" | "provider" | "return" | "risk" | "risky" | "sawDigest" | "size">;
174
+ readonly taskScope: FormContract<"acceptance" | "budget-microusd" | "budget-usd" | "goal" | "goal-brief" | "not" | "permission-mode" | "quality-mode" | "race-count" | "race-model" | "race-per-usd" | "race-total-usd" | "requirement" | "requirement-new" | "sawDigest" | "touches" | `compare-model-${string}` | `compare-provider-${string}`>;
175
+ readonly taskApprove: FormContract<"digest" | "nonce" | "return" | "token">;
176
+ readonly taskAcceptProof: FormContract<"note" | "return" | "run">;
177
+ readonly taskComplete: FormContract<"accept" | "note" | "publish" | "receipt" | "return" | "run">;
178
+ readonly taskStop: FormContract<"return" | "run">;
179
+ readonly taskResume: FormContract<"nonce" | "return" | "run" | "token">;
180
+ };
181
+ export type ConsoleFormName = keyof typeof CONSOLE_FORMS;
182
+ /** The console POSTs whose handlers read no field (sign-out and the attended beat not even the shared guard): their contract is the empty form. */
183
+ export declare const BODILESS_POSTS: readonly ["POST /settings/lead/on", "POST /r/<run>/draft-repair", "POST /ledger/checkpoint", "POST /settings/backups/now", "POST /mode/revoke", "POST /settings/telegram/retry", "POST /providers/<provider>/resume", "POST /session/attended-beats", "POST /logout", "POST /t/<task>/unhold", "POST /t/<task>/plan", "POST /t/<task>/retry-review"];
184
+ /** The field names a console form's handler may read. */
185
+ export type FormFieldOf<N extends ConsoleFormName> = (typeof CONSOLE_FORMS)[N] extends FormContract<infer K> ? K : never;
186
+ /** `GET /ledger?format=json`: the chain's state, a page of entries (newest first) and the cursor for the next. */
187
+ export declare const ledgerPageSchema: z.ZodObject<{
188
+ chain: z.ZodObject<{
189
+ ok: z.ZodBoolean;
190
+ entries: z.ZodNumber;
191
+ through: z.ZodNullable<z.ZodNumber>;
192
+ head: z.ZodString;
193
+ problem: z.ZodNullable<z.ZodObject<{
194
+ id: z.ZodNullable<z.ZodNumber>;
195
+ what: z.ZodString;
196
+ }, z.core.$loose>>;
197
+ }, z.core.$loose>;
198
+ entries: z.ZodArray<z.ZodObject<{
199
+ id: z.ZodNumber;
200
+ at: z.ZodString;
201
+ actor: z.ZodString;
202
+ repo: z.ZodNullable<z.ZodString>;
203
+ taskId: z.ZodNullable<z.ZodString>;
204
+ runId: z.ZodNullable<z.ZodNumber>;
205
+ action: z.ZodString;
206
+ outcome: z.ZodString;
207
+ source: z.ZodString;
208
+ detail: z.ZodNullable<z.ZodString>;
209
+ }, z.core.$loose>>;
210
+ nextBefore: z.ZodNullable<z.ZodNumber>;
211
+ }, z.core.$loose>;
212
+ /** `GET /t/<task>/evidence?format=json`: a task's evidence pack, as `evidence-pack.ts` builds and digests it. */
213
+ export declare const evidencePackSchema: z.ZodObject<{
214
+ format: z.ZodString;
215
+ generatedAt: z.ZodString;
216
+ generatedBy: z.ZodString;
217
+ task: z.ZodObject<{
218
+ id: z.ZodString;
219
+ title: z.ZodString;
220
+ state: z.ZodString;
221
+ repo: z.ZodNullable<z.ZodString>;
222
+ project: z.ZodNullable<z.ZodString>;
223
+ filedAt: z.ZodString;
224
+ }, z.core.$loose>;
225
+ rules: z.ZodNullable<z.ZodObject<{
226
+ now: z.ZodString;
227
+ changes: z.ZodArray<z.ZodObject<{
228
+ id: z.ZodNumber;
229
+ at: z.ZodString;
230
+ by: z.ZodString;
231
+ change: z.ZodNullable<z.ZodString>;
232
+ }, z.core.$loose>>;
233
+ }, z.core.$loose>>;
234
+ versions: z.ZodArray<z.ZodObject<{
235
+ id: z.ZodString;
236
+ title: z.ZodString;
237
+ state: z.ZodString;
238
+ filedAt: z.ZodString;
239
+ scope: z.ZodNullable<z.ZodObject<{
240
+ digest: z.ZodString;
241
+ }, z.core.$loose>>;
242
+ runs: z.ZodArray<z.ZodObject<{
243
+ id: z.ZodNumber;
244
+ }, z.core.$loose>>;
245
+ }, z.core.$loose>>;
246
+ result: z.ZodNullable<z.ZodObject<{
247
+ runId: z.ZodNumber;
248
+ }, z.core.$loose>>;
249
+ totals: z.ZodObject<{
250
+ runs: z.ZodNumber;
251
+ costUsd: z.ZodNumber;
252
+ tokensIn: z.ZodNumber;
253
+ tokensOut: z.ZodNumber;
254
+ }, z.core.$loose>;
255
+ ledger: z.ZodObject<{
256
+ entries: z.ZodArray<z.ZodObject<{
257
+ id: z.ZodNumber;
258
+ at: z.ZodString;
259
+ actor: z.ZodString;
260
+ repo: z.ZodNullable<z.ZodString>;
261
+ taskId: z.ZodNullable<z.ZodString>;
262
+ runId: z.ZodNullable<z.ZodNumber>;
263
+ action: z.ZodString;
264
+ outcome: z.ZodString;
265
+ source: z.ZodString;
266
+ detail: z.ZodNullable<z.ZodString>;
267
+ }, z.core.$loose>>;
268
+ truncated: z.ZodBoolean;
269
+ chain: z.ZodObject<{
270
+ ok: z.ZodBoolean;
271
+ entries: z.ZodNumber;
272
+ through: z.ZodNullable<z.ZodNumber>;
273
+ head: z.ZodString;
274
+ problem: z.ZodNullable<z.ZodString>;
275
+ checkedAt: z.ZodNullable<z.ZodString>;
276
+ }, z.core.$loose>;
277
+ checkpoint: z.ZodNullable<z.ZodObject<{
278
+ through: z.ZodNumber;
279
+ hash: z.ZodString;
280
+ at: z.ZodString;
281
+ }, z.core.$loose>>;
282
+ recipe: z.ZodString;
283
+ }, z.core.$loose>;
284
+ digest: z.ZodString;
285
+ }, z.core.$loose>;
286
+ /** `GET /flows/<id>?format=json`: the flow page's view (the same one the workspace renders). */
287
+ export declare const flowViewSchema: z.ZodObject<{
288
+ kind: z.ZodLiteral<"flow">;
289
+ flow: z.ZodObject<{
290
+ id: z.ZodNumber;
291
+ name: z.ZodString;
292
+ project: z.ZodString;
293
+ revision: z.ZodNumber;
294
+ href: z.ZodString;
295
+ owner: z.ZodString;
296
+ }, z.core.$loose>;
297
+ chatHref: z.ZodString;
298
+ triggers: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
299
+ triggerSetup: z.ZodObject<{}, z.core.$loose>;
300
+ startTrigger: z.ZodNullable<z.ZodNumber>;
301
+ me: z.ZodString;
302
+ sortReady: z.ZodBoolean;
303
+ emailReady: z.ZodBoolean;
304
+ requestSecrets: z.ZodArray<z.ZodString>;
305
+ tools: z.ZodArray<z.ZodObject<{
306
+ name: z.ZodString;
307
+ }, z.core.$loose>>;
308
+ scripts: z.ZodArray<z.ZodObject<{
309
+ name: z.ZodString;
310
+ }, z.core.$loose>>;
311
+ start: z.ZodString;
312
+ stages: z.ZodArray<z.ZodObject<{
313
+ id: z.ZodString;
314
+ kind: z.ZodString;
315
+ }, z.core.$loose>>;
316
+ cards: z.ZodArray<z.ZodObject<{
317
+ id: z.ZodNumber;
318
+ }, z.core.$loose>>;
319
+ selectedCard: z.ZodNullable<z.ZodNumber>;
320
+ live: z.ZodNullable<z.ZodString>;
321
+ canEdit: z.ZodBoolean;
322
+ approvers: z.ZodArray<z.ZodString>;
323
+ kinds: z.ZodArray<z.ZodObject<{
324
+ kind: z.ZodString;
325
+ label: z.ZodString;
326
+ }, z.core.$loose>>;
327
+ colors: z.ZodArray<z.ZodString>;
328
+ }, z.core.$loose>;
329
+ export declare const CONSOLE_RESPONSES: {
330
+ readonly ledgerPage: {
331
+ readonly route: "GET /ledger?format=json";
332
+ readonly schema: z.ZodObject<{
333
+ chain: z.ZodObject<{
334
+ ok: z.ZodBoolean;
335
+ entries: z.ZodNumber;
336
+ through: z.ZodNullable<z.ZodNumber>;
337
+ head: z.ZodString;
338
+ problem: z.ZodNullable<z.ZodObject<{
339
+ id: z.ZodNullable<z.ZodNumber>;
340
+ what: z.ZodString;
341
+ }, z.core.$loose>>;
342
+ }, z.core.$loose>;
343
+ entries: z.ZodArray<z.ZodObject<{
344
+ id: z.ZodNumber;
345
+ at: z.ZodString;
346
+ actor: z.ZodString;
347
+ repo: z.ZodNullable<z.ZodString>;
348
+ taskId: z.ZodNullable<z.ZodString>;
349
+ runId: z.ZodNullable<z.ZodNumber>;
350
+ action: z.ZodString;
351
+ outcome: z.ZodString;
352
+ source: z.ZodString;
353
+ detail: z.ZodNullable<z.ZodString>;
354
+ }, z.core.$loose>>;
355
+ nextBefore: z.ZodNullable<z.ZodNumber>;
356
+ }, z.core.$loose>;
357
+ };
358
+ readonly evidencePack: {
359
+ readonly route: "GET /t/<task>/evidence?format=json";
360
+ readonly schema: z.ZodObject<{
361
+ format: z.ZodString;
362
+ generatedAt: z.ZodString;
363
+ generatedBy: z.ZodString;
364
+ task: z.ZodObject<{
365
+ id: z.ZodString;
366
+ title: z.ZodString;
367
+ state: z.ZodString;
368
+ repo: z.ZodNullable<z.ZodString>;
369
+ project: z.ZodNullable<z.ZodString>;
370
+ filedAt: z.ZodString;
371
+ }, z.core.$loose>;
372
+ rules: z.ZodNullable<z.ZodObject<{
373
+ now: z.ZodString;
374
+ changes: z.ZodArray<z.ZodObject<{
375
+ id: z.ZodNumber;
376
+ at: z.ZodString;
377
+ by: z.ZodString;
378
+ change: z.ZodNullable<z.ZodString>;
379
+ }, z.core.$loose>>;
380
+ }, z.core.$loose>>;
381
+ versions: z.ZodArray<z.ZodObject<{
382
+ id: z.ZodString;
383
+ title: z.ZodString;
384
+ state: z.ZodString;
385
+ filedAt: z.ZodString;
386
+ scope: z.ZodNullable<z.ZodObject<{
387
+ digest: z.ZodString;
388
+ }, z.core.$loose>>;
389
+ runs: z.ZodArray<z.ZodObject<{
390
+ id: z.ZodNumber;
391
+ }, z.core.$loose>>;
392
+ }, z.core.$loose>>;
393
+ result: z.ZodNullable<z.ZodObject<{
394
+ runId: z.ZodNumber;
395
+ }, z.core.$loose>>;
396
+ totals: z.ZodObject<{
397
+ runs: z.ZodNumber;
398
+ costUsd: z.ZodNumber;
399
+ tokensIn: z.ZodNumber;
400
+ tokensOut: z.ZodNumber;
401
+ }, z.core.$loose>;
402
+ ledger: z.ZodObject<{
403
+ entries: z.ZodArray<z.ZodObject<{
404
+ id: z.ZodNumber;
405
+ at: z.ZodString;
406
+ actor: z.ZodString;
407
+ repo: z.ZodNullable<z.ZodString>;
408
+ taskId: z.ZodNullable<z.ZodString>;
409
+ runId: z.ZodNullable<z.ZodNumber>;
410
+ action: z.ZodString;
411
+ outcome: z.ZodString;
412
+ source: z.ZodString;
413
+ detail: z.ZodNullable<z.ZodString>;
414
+ }, z.core.$loose>>;
415
+ truncated: z.ZodBoolean;
416
+ chain: z.ZodObject<{
417
+ ok: z.ZodBoolean;
418
+ entries: z.ZodNumber;
419
+ through: z.ZodNullable<z.ZodNumber>;
420
+ head: z.ZodString;
421
+ problem: z.ZodNullable<z.ZodString>;
422
+ checkedAt: z.ZodNullable<z.ZodString>;
423
+ }, z.core.$loose>;
424
+ checkpoint: z.ZodNullable<z.ZodObject<{
425
+ through: z.ZodNumber;
426
+ hash: z.ZodString;
427
+ at: z.ZodString;
428
+ }, z.core.$loose>>;
429
+ recipe: z.ZodString;
430
+ }, z.core.$loose>;
431
+ digest: z.ZodString;
432
+ }, z.core.$loose>;
433
+ };
434
+ readonly flowView: {
435
+ readonly route: "GET /flows/<id>?format=json";
436
+ readonly schema: z.ZodObject<{
437
+ kind: z.ZodLiteral<"flow">;
438
+ flow: z.ZodObject<{
439
+ id: z.ZodNumber;
440
+ name: z.ZodString;
441
+ project: z.ZodString;
442
+ revision: z.ZodNumber;
443
+ href: z.ZodString;
444
+ owner: z.ZodString;
445
+ }, z.core.$loose>;
446
+ chatHref: z.ZodString;
447
+ triggers: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
448
+ triggerSetup: z.ZodObject<{}, z.core.$loose>;
449
+ startTrigger: z.ZodNullable<z.ZodNumber>;
450
+ me: z.ZodString;
451
+ sortReady: z.ZodBoolean;
452
+ emailReady: z.ZodBoolean;
453
+ requestSecrets: z.ZodArray<z.ZodString>;
454
+ tools: z.ZodArray<z.ZodObject<{
455
+ name: z.ZodString;
456
+ }, z.core.$loose>>;
457
+ scripts: z.ZodArray<z.ZodObject<{
458
+ name: z.ZodString;
459
+ }, z.core.$loose>>;
460
+ start: z.ZodString;
461
+ stages: z.ZodArray<z.ZodObject<{
462
+ id: z.ZodString;
463
+ kind: z.ZodString;
464
+ }, z.core.$loose>>;
465
+ cards: z.ZodArray<z.ZodObject<{
466
+ id: z.ZodNumber;
467
+ }, z.core.$loose>>;
468
+ selectedCard: z.ZodNullable<z.ZodNumber>;
469
+ live: z.ZodNullable<z.ZodString>;
470
+ canEdit: z.ZodBoolean;
471
+ approvers: z.ZodArray<z.ZodString>;
472
+ kinds: z.ZodArray<z.ZodObject<{
473
+ kind: z.ZodString;
474
+ label: z.ZodString;
475
+ }, z.core.$loose>>;
476
+ colors: z.ZodArray<z.ZodString>;
477
+ }, z.core.$loose>;
478
+ };
479
+ };
480
+ export type ConsoleResponseName = keyof typeof CONSOLE_RESPONSES;
481
+ /** Check a JSON response just before it is sent; a disagreement is reported, and the payload is returned unchanged. */
482
+ export declare function checkResponse<T>(name: ConsoleResponseName, payload: T, report?: ContractReport): T;
483
+ export {};