cohorte 2.10.1 → 3.0.0-dev.0

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 (211) hide show
  1. package/README.md +7 -0
  2. package/assets/manifest.json +193 -0
  3. package/assets/migrations/config/README.md +12 -0
  4. package/assets/migrations/state/0001_init.sql +154 -0
  5. package/assets/prompts/README.md +11 -0
  6. package/assets/prompts/agents/fixer.md +7 -0
  7. package/assets/prompts/agents/implementer.md +12 -0
  8. package/assets/prompts/agents/reviewer.md +8 -0
  9. package/assets/prompts/agents/security-reviewer.md +7 -0
  10. package/assets/prompts/phases/build.md +5 -0
  11. package/assets/prompts/phases/review.md +5 -0
  12. package/assets/prompts/phases/test.md +5 -0
  13. package/assets/prompts/system.md +11 -0
  14. package/assets/schemas/agent-output.schema.json +225 -0
  15. package/assets/schemas/auth-status.schema.json +87 -0
  16. package/assets/schemas/command-result.schema.json +192 -0
  17. package/assets/schemas/commands.schema.json +952 -0
  18. package/assets/schemas/config.schema.json +2259 -0
  19. package/assets/schemas/doctor-report.schema.json +104 -0
  20. package/assets/schemas/events.schema.json +8514 -0
  21. package/assets/schemas/fake-script.schema.json +549 -0
  22. package/assets/schemas/inspect.schema.json +3133 -0
  23. package/assets/schemas/manifest.schema.json +79 -0
  24. package/assets/schemas/ownership.schema.json +52 -0
  25. package/assets/schemas/policy-verdict.schema.json +282 -0
  26. package/assets/schemas/project-model.schema.json +783 -0
  27. package/assets/schemas/project-status.schema.json +217 -0
  28. package/assets/schemas/reconcile-plan.schema.json +155 -0
  29. package/assets/schemas/run-diff.schema.json +177 -0
  30. package/assets/schemas/run-snapshot-manifest.schema.json +2104 -0
  31. package/assets/schemas/run-state.schema.json +1755 -0
  32. package/assets/schemas/runtime-capabilities.schema.json +1545 -0
  33. package/assets/schemas/sandbox-capabilities.schema.json +116 -0
  34. package/assets/schemas/skill.schema.json +87 -0
  35. package/assets/schemas/spec.schema.json +202 -0
  36. package/assets/schemas/tool-catalogue.schema.json +655 -0
  37. package/assets/schemas/trust-record.schema.json +38 -0
  38. package/assets/skills/README.md +9 -0
  39. package/assets/skills/inspect-surface.md +4 -0
  40. package/dist/agent-host.mjs +50 -0
  41. package/dist/agent-host.mjs.map +1 -0
  42. package/dist/bundle-manifest.json +102 -0
  43. package/dist/chunks/__host-DgGPyco9.mjs +18 -0
  44. package/dist/chunks/__host-DgGPyco9.mjs.map +1 -0
  45. package/dist/chunks/approve-Cv135UqI.mjs +19 -0
  46. package/dist/chunks/approve-Cv135UqI.mjs.map +1 -0
  47. package/dist/chunks/auth-BT5oVp76.mjs +132 -0
  48. package/dist/chunks/auth-BT5oVp76.mjs.map +1 -0
  49. package/dist/chunks/auth-D8rCVY33.mjs +84 -0
  50. package/dist/chunks/auth-D8rCVY33.mjs.map +1 -0
  51. package/dist/chunks/brainstorm-CU10T1tm.mjs +7 -0
  52. package/dist/chunks/brainstorm-CU10T1tm.mjs.map +1 -0
  53. package/dist/chunks/cancel-KV_cpsqS.mjs +15 -0
  54. package/dist/chunks/cancel-KV_cpsqS.mjs.map +1 -0
  55. package/dist/chunks/canonical-C8UxeEmB.mjs +57 -0
  56. package/dist/chunks/canonical-C8UxeEmB.mjs.map +1 -0
  57. package/dist/chunks/catalogue-BvwSrM_j.mjs +1549 -0
  58. package/dist/chunks/catalogue-BvwSrM_j.mjs.map +1 -0
  59. package/dist/chunks/compose-Cr0hP0qm.mjs +7303 -0
  60. package/dist/chunks/compose-Cr0hP0qm.mjs.map +1 -0
  61. package/dist/chunks/config-DefHA2Lw.mjs +96 -0
  62. package/dist/chunks/config-DefHA2Lw.mjs.map +1 -0
  63. package/dist/chunks/contract-B0ra2-bm.mjs +295 -0
  64. package/dist/chunks/contract-B0ra2-bm.mjs.map +1 -0
  65. package/dist/chunks/contract-vYbwYr0Y.mjs +123 -0
  66. package/dist/chunks/contract-vYbwYr0Y.mjs.map +1 -0
  67. package/dist/chunks/deny-ClTxSvHJ.mjs +15 -0
  68. package/dist/chunks/deny-ClTxSvHJ.mjs.map +1 -0
  69. package/dist/chunks/diff-Qw0II0sj.mjs +101 -0
  70. package/dist/chunks/diff-Qw0II0sj.mjs.map +1 -0
  71. package/dist/chunks/discover-30Ciya_0.mjs +20 -0
  72. package/dist/chunks/discover-30Ciya_0.mjs.map +1 -0
  73. package/dist/chunks/doctor-DfCrKpfT.mjs +222 -0
  74. package/dist/chunks/doctor-DfCrKpfT.mjs.map +1 -0
  75. package/dist/chunks/fix-D4Tj8RVA.mjs +18 -0
  76. package/dist/chunks/fix-D4Tj8RVA.mjs.map +1 -0
  77. package/dist/chunks/gc-BBXlBF5w.mjs +161 -0
  78. package/dist/chunks/gc-BBXlBF5w.mjs.map +1 -0
  79. package/dist/chunks/init-Okz4mlhW.mjs +30 -0
  80. package/dist/chunks/init-Okz4mlhW.mjs.map +1 -0
  81. package/dist/chunks/inspect-Buby4cQD.mjs +22 -0
  82. package/dist/chunks/inspect-Buby4cQD.mjs.map +1 -0
  83. package/dist/chunks/logs-Giq5sUau.mjs +25 -0
  84. package/dist/chunks/logs-Giq5sUau.mjs.map +1 -0
  85. package/dist/chunks/migrate-DRoFUg53.mjs +19 -0
  86. package/dist/chunks/migrate-DRoFUg53.mjs.map +1 -0
  87. package/dist/chunks/models-Btp6X2YZ.mjs +24 -0
  88. package/dist/chunks/models-Btp6X2YZ.mjs.map +1 -0
  89. package/dist/chunks/pause-BASBfKLO.mjs +16 -0
  90. package/dist/chunks/pause-BASBfKLO.mjs.map +1 -0
  91. package/dist/chunks/policy-DUIgzF3W.mjs +139 -0
  92. package/dist/chunks/policy-DUIgzF3W.mjs.map +1 -0
  93. package/dist/chunks/providers-Dx78imKj.mjs +19 -0
  94. package/dist/chunks/providers-Dx78imKj.mjs.map +1 -0
  95. package/dist/chunks/reconcile-BfD785gd.mjs +26 -0
  96. package/dist/chunks/reconcile-BfD785gd.mjs.map +1 -0
  97. package/dist/chunks/render-DyZr5Lgi.mjs +53 -0
  98. package/dist/chunks/render-DyZr5Lgi.mjs.map +1 -0
  99. package/dist/chunks/resume-GJQRb2Eb.mjs +15 -0
  100. package/dist/chunks/resume-GJQRb2Eb.mjs.map +1 -0
  101. package/dist/chunks/retry-CLrUem1H.mjs +15 -0
  102. package/dist/chunks/retry-CLrUem1H.mjs.map +1 -0
  103. package/dist/chunks/review-BDdjb6kB.mjs +17 -0
  104. package/dist/chunks/review-BDdjb6kB.mjs.map +1 -0
  105. package/dist/chunks/run-CgTWYlcd.mjs +82 -0
  106. package/dist/chunks/run-CgTWYlcd.mjs.map +1 -0
  107. package/dist/chunks/run-tool-C3rAv4XF.mjs +26 -0
  108. package/dist/chunks/run-tool-C3rAv4XF.mjs.map +1 -0
  109. package/dist/chunks/schema-C9QbUW4H.mjs +578 -0
  110. package/dist/chunks/schema-C9QbUW4H.mjs.map +1 -0
  111. package/dist/chunks/send-BdnJ85Nz.mjs +19 -0
  112. package/dist/chunks/send-BdnJ85Nz.mjs.map +1 -0
  113. package/dist/chunks/ship-DTuLGoaJ.mjs +19 -0
  114. package/dist/chunks/ship-DTuLGoaJ.mjs.map +1 -0
  115. package/dist/chunks/shutdown-BM92Iyv2.mjs +15 -0
  116. package/dist/chunks/shutdown-BM92Iyv2.mjs.map +1 -0
  117. package/dist/chunks/skip-DZG5kpcH.mjs +18 -0
  118. package/dist/chunks/skip-DZG5kpcH.mjs.map +1 -0
  119. package/dist/chunks/spec-Bq0P3jVh.mjs +20 -0
  120. package/dist/chunks/spec-Bq0P3jVh.mjs.map +1 -0
  121. package/dist/chunks/src-CId6kMsY.mjs +1689 -0
  122. package/dist/chunks/src-CId6kMsY.mjs.map +1 -0
  123. package/dist/chunks/src-CfAOde7C.mjs +5403 -0
  124. package/dist/chunks/src-CfAOde7C.mjs.map +1 -0
  125. package/dist/chunks/src-Cu3TxNob.mjs +783 -0
  126. package/dist/chunks/src-Cu3TxNob.mjs.map +1 -0
  127. package/dist/chunks/src-DcU4IXMe.mjs +117 -0
  128. package/dist/chunks/src-DcU4IXMe.mjs.map +1 -0
  129. package/dist/chunks/src-JxawBQBn.mjs +446 -0
  130. package/dist/chunks/src-JxawBQBn.mjs.map +1 -0
  131. package/dist/chunks/src-s7YRvk0t.mjs +2116 -0
  132. package/dist/chunks/src-s7YRvk0t.mjs.map +1 -0
  133. package/dist/chunks/status-SMjiOMYy.mjs +29 -0
  134. package/dist/chunks/status-SMjiOMYy.mjs.map +1 -0
  135. package/dist/chunks/tail-BuhT-2PH.mjs +25 -0
  136. package/dist/chunks/tail-BuhT-2PH.mjs.map +1 -0
  137. package/dist/chunks/update-BXIppsbi.mjs +16 -0
  138. package/dist/chunks/update-BXIppsbi.mjs.map +1 -0
  139. package/dist/cli.mjs +175 -0
  140. package/dist/cli.mjs.map +1 -0
  141. package/package.json +17 -32
  142. package/CHANGELOG.md +0 -1461
  143. package/bin/cli.js +0 -817
  144. package/bin/report.js +0 -141
  145. package/core/adapter/render.js +0 -415
  146. package/core/agents/implementer.template.md +0 -142
  147. package/core/agents/profile-reader.md +0 -50
  148. package/core/agents/release.md +0 -58
  149. package/core/agents/review.md +0 -179
  150. package/core/commands/cohorte-align-ds.md +0 -33
  151. package/core/commands/cohorte-audit.md +0 -58
  152. package/core/commands/cohorte-brainstorm.md +0 -70
  153. package/core/commands/cohorte-build.md +0 -219
  154. package/core/commands/cohorte-doctor.md +0 -194
  155. package/core/commands/cohorte-fix.md +0 -80
  156. package/core/commands/cohorte-fleet.md +0 -103
  157. package/core/commands/cohorte-init-pipeline.md +0 -31
  158. package/core/commands/cohorte-intake.md +0 -92
  159. package/core/commands/cohorte-patch.md +0 -118
  160. package/core/commands/cohorte-refactor.md +0 -59
  161. package/core/commands/cohorte-retro.md +0 -85
  162. package/core/commands/cohorte-review.md +0 -270
  163. package/core/commands/cohorte-ship.md +0 -122
  164. package/core/commands/cohorte-spec.md +0 -101
  165. package/core/commands/cohorte-update-pipeline.md +0 -165
  166. package/core/hooks/gate.py +0 -588
  167. package/core/runtimes/claude.json +0 -74
  168. package/core/runtimes/codex.json +0 -85
  169. package/core/runtimes/cursor.json +0 -76
  170. package/core/runtimes/gemini.json +0 -76
  171. package/core/runtimes/opencode.json +0 -73
  172. package/core/templates/agent-handoff.md +0 -34
  173. package/core/templates/brainstorm-return.md +0 -36
  174. package/core/templates/decisions.template.md +0 -42
  175. package/core/templates/design-brief.md +0 -44
  176. package/core/templates/patch.template.md +0 -86
  177. package/core/templates/pr-body.md +0 -25
  178. package/core/templates/review-feedback.md +0 -38
  179. package/core/templates/spec.template.md +0 -87
  180. package/core/templates/steps/init-pipeline/01-detect-stack.md +0 -44
  181. package/core/templates/steps/init-pipeline/02-interview-gaps.md +0 -55
  182. package/core/templates/steps/init-pipeline/03-draft-profile.md +0 -10
  183. package/core/templates/steps/init-pipeline/04-write-render.md +0 -145
  184. package/core/templates/steps/init-pipeline/05-report.md +0 -12
  185. package/core/workflows/audit.js +0 -240
  186. package/core/workflows/loop.js +0 -641
  187. package/core/workflows/refactor.js +0 -276
  188. package/core/workflows/review.js +0 -456
  189. package/install.ps1 +0 -103
  190. package/install.sh +0 -114
  191. package/lib/doctor.js +0 -534
  192. package/lib/runtime.js +0 -139
  193. package/lib/versions.js +0 -149
  194. package/lib/yaml.js +0 -129
  195. package/profile/PIPELINE.template.md +0 -259
  196. package/profile/SCHEMA.md +0 -735
  197. package/profile/cohorte.config.template.yaml +0 -43
  198. package/scripts/assert-gate-hook.mjs +0 -75
  199. package/scripts/kanban-move.sh +0 -313
  200. package/scripts/metrics/collect.mjs +0 -531
  201. package/scripts/metrics/prices.json +0 -42
  202. package/scripts/new-feature.sh.template +0 -98
  203. package/scripts/preflight.sh +0 -124
  204. package/scripts/remove-feature.sh.template +0 -56
  205. package/scripts/test-adapter.mjs +0 -437
  206. package/scripts/test-gate.mjs +0 -443
  207. package/scripts/test-kanban.mjs +0 -304
  208. package/scripts/test-lib.mjs +0 -356
  209. package/scripts/test-metrics.mjs +0 -156
  210. package/scripts/test-workflows.mjs +0 -758
  211. package/scripts/validate-core.mjs +0 -325
@@ -0,0 +1,3133 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cohorte.dev/schemas/3/inspect.schema.json",
4
+ "title": "Cohorte inspect document (inspect --json)",
5
+ "anyOf": [
6
+ {
7
+ "type": "object",
8
+ "required": [
9
+ "documentVersion",
10
+ "protocolVersion",
11
+ "runId",
12
+ "lastSequence",
13
+ "kind",
14
+ "agent",
15
+ "grantsDigest",
16
+ "tools",
17
+ "incarnations"
18
+ ],
19
+ "properties": {
20
+ "documentVersion": {
21
+ "type": "number",
22
+ "const": 1
23
+ },
24
+ "protocolVersion": {
25
+ "type": "string",
26
+ "const": "1.0"
27
+ },
28
+ "runId": {
29
+ "type": "string",
30
+ "pattern": "^run_[0-9a-f]{32}$"
31
+ },
32
+ "lastSequence": {
33
+ "type": "integer",
34
+ "minimum": 0
35
+ },
36
+ "kind": {
37
+ "type": "string",
38
+ "const": "agent"
39
+ },
40
+ "agent": {
41
+ "type": "object",
42
+ "required": [
43
+ "agentId",
44
+ "role",
45
+ "label",
46
+ "status",
47
+ "lifecycle",
48
+ "attempt",
49
+ "incarnation",
50
+ "model",
51
+ "usage"
52
+ ],
53
+ "properties": {
54
+ "agentId": {
55
+ "type": "string",
56
+ "maxLength": 128,
57
+ "pattern": "^agt_[A-Za-z0-9.-]+_[A-Za-z0-9_.-]+$"
58
+ },
59
+ "role": {
60
+ "type": "string"
61
+ },
62
+ "surface": {
63
+ "type": "string",
64
+ "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
65
+ },
66
+ "label": {
67
+ "type": "string"
68
+ },
69
+ "status": {
70
+ "type": "string",
71
+ "enum": [
72
+ "pending",
73
+ "running",
74
+ "completed",
75
+ "failed",
76
+ "paused",
77
+ "waiting-approval",
78
+ "cancelled",
79
+ "skipped",
80
+ "blocked"
81
+ ]
82
+ },
83
+ "lifecycle": {
84
+ "type": "string",
85
+ "enum": [
86
+ "declared",
87
+ "planned",
88
+ "spawning",
89
+ "running",
90
+ "waiting",
91
+ "paused",
92
+ "completed",
93
+ "failed",
94
+ "retrying",
95
+ "escalated",
96
+ "cancelled"
97
+ ]
98
+ },
99
+ "attempt": {
100
+ "type": "integer",
101
+ "minimum": 0
102
+ },
103
+ "incarnation": {
104
+ "type": "integer",
105
+ "minimum": 0
106
+ },
107
+ "model": {
108
+ "type": "object",
109
+ "required": [
110
+ "requested"
111
+ ],
112
+ "properties": {
113
+ "requested": {
114
+ "type": "object",
115
+ "required": [
116
+ "provider",
117
+ "model"
118
+ ],
119
+ "properties": {
120
+ "provider": {
121
+ "type": "string"
122
+ },
123
+ "model": {
124
+ "type": "string"
125
+ },
126
+ "capability": {
127
+ "anyOf": [
128
+ {
129
+ "type": "string",
130
+ "const": "fast"
131
+ },
132
+ {
133
+ "type": "string",
134
+ "const": "coding"
135
+ },
136
+ {
137
+ "type": "string",
138
+ "const": "reasoning"
139
+ },
140
+ {
141
+ "type": "string",
142
+ "const": "vision"
143
+ },
144
+ {
145
+ "type": "string",
146
+ "const": "cheap"
147
+ }
148
+ ]
149
+ }
150
+ }
151
+ },
152
+ "effective": {
153
+ "type": "object",
154
+ "required": [
155
+ "provider",
156
+ "model"
157
+ ],
158
+ "properties": {
159
+ "provider": {
160
+ "type": "string"
161
+ },
162
+ "model": {
163
+ "type": "string"
164
+ }
165
+ }
166
+ }
167
+ }
168
+ },
169
+ "authMode": {
170
+ "anyOf": [
171
+ {
172
+ "type": "string",
173
+ "const": "subscription"
174
+ },
175
+ {
176
+ "type": "string",
177
+ "const": "api"
178
+ }
179
+ ]
180
+ },
181
+ "worktree": {
182
+ "type": "string"
183
+ },
184
+ "usage": {
185
+ "type": "object",
186
+ "properties": {
187
+ "tokens": {
188
+ "type": "integer",
189
+ "minimum": 0
190
+ },
191
+ "modelRequests": {
192
+ "type": "integer",
193
+ "minimum": 0
194
+ },
195
+ "toolCalls": {
196
+ "type": "integer",
197
+ "minimum": 0
198
+ },
199
+ "wallClockMs": {
200
+ "type": "number",
201
+ "minimum": 0
202
+ },
203
+ "retries": {
204
+ "type": "integer",
205
+ "minimum": 0
206
+ },
207
+ "fixRounds": {
208
+ "type": "integer",
209
+ "minimum": 0
210
+ },
211
+ "contextTokens": {
212
+ "type": "integer",
213
+ "minimum": 0
214
+ },
215
+ "concurrentAgents": {
216
+ "type": "integer",
217
+ "minimum": 0
218
+ },
219
+ "estimatedQuotaPercent": {
220
+ "type": "number",
221
+ "minimum": 0
222
+ }
223
+ }
224
+ },
225
+ "summary": {
226
+ "type": "string"
227
+ },
228
+ "lastError": {
229
+ "$ref": "#/$defs/ErrorInfo"
230
+ },
231
+ "pendingApproval": {
232
+ "type": "string",
233
+ "pattern": "^apr_[0-9a-f]{32}$"
234
+ },
235
+ "runtimeRef": {
236
+ "type": "object",
237
+ "required": [
238
+ "runtime",
239
+ "version",
240
+ "sessionId",
241
+ "transcriptRef"
242
+ ],
243
+ "properties": {
244
+ "runtime": {
245
+ "type": "string"
246
+ },
247
+ "version": {
248
+ "type": "string"
249
+ },
250
+ "sessionId": {
251
+ "type": "string"
252
+ },
253
+ "transcriptRef": {
254
+ "type": "string"
255
+ }
256
+ }
257
+ }
258
+ }
259
+ },
260
+ "grantsDigest": {
261
+ "type": "string",
262
+ "pattern": "^[0-9a-f]{64}$"
263
+ },
264
+ "tools": {
265
+ "type": "array",
266
+ "items": {
267
+ "type": "string"
268
+ }
269
+ },
270
+ "incarnations": {
271
+ "type": "array",
272
+ "items": {
273
+ "type": "object",
274
+ "required": [
275
+ "n",
276
+ "state"
277
+ ],
278
+ "properties": {
279
+ "n": {
280
+ "type": "integer",
281
+ "minimum": 0
282
+ },
283
+ "state": {
284
+ "type": "string"
285
+ },
286
+ "startedAt": {
287
+ "type": "string",
288
+ "format": "date-time",
289
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
290
+ },
291
+ "endedAt": {
292
+ "type": "string",
293
+ "format": "date-time",
294
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
295
+ },
296
+ "stop": {
297
+ "type": "string"
298
+ },
299
+ "reason": {
300
+ "type": "string"
301
+ }
302
+ }
303
+ }
304
+ }
305
+ }
306
+ },
307
+ {
308
+ "type": "object",
309
+ "required": [
310
+ "documentVersion",
311
+ "protocolVersion",
312
+ "runId",
313
+ "lastSequence",
314
+ "kind",
315
+ "agentId",
316
+ "incarnation",
317
+ "context"
318
+ ],
319
+ "properties": {
320
+ "documentVersion": {
321
+ "type": "number",
322
+ "const": 1
323
+ },
324
+ "protocolVersion": {
325
+ "type": "string",
326
+ "const": "1.0"
327
+ },
328
+ "runId": {
329
+ "type": "string",
330
+ "pattern": "^run_[0-9a-f]{32}$"
331
+ },
332
+ "lastSequence": {
333
+ "type": "integer",
334
+ "minimum": 0
335
+ },
336
+ "kind": {
337
+ "type": "string",
338
+ "const": "context"
339
+ },
340
+ "agentId": {
341
+ "type": "string",
342
+ "maxLength": 128,
343
+ "pattern": "^agt_[A-Za-z0-9.-]+_[A-Za-z0-9_.-]+$"
344
+ },
345
+ "incarnation": {
346
+ "type": "integer",
347
+ "minimum": 0
348
+ },
349
+ "context": {
350
+ "type": "object",
351
+ "required": [
352
+ "agent",
353
+ "manifestSha256",
354
+ "tokenEstimate",
355
+ "tokenLimit",
356
+ "entries",
357
+ "reductions",
358
+ "exclusions",
359
+ "manifest"
360
+ ],
361
+ "properties": {
362
+ "agent": {
363
+ "type": "object",
364
+ "required": [
365
+ "agentId",
366
+ "role",
367
+ "incarnation",
368
+ "attempt"
369
+ ],
370
+ "properties": {
371
+ "agentId": {
372
+ "type": "string",
373
+ "maxLength": 128,
374
+ "pattern": "^agt_[A-Za-z0-9.-]+_[A-Za-z0-9_.-]+$"
375
+ },
376
+ "role": {
377
+ "type": "string"
378
+ },
379
+ "surface": {
380
+ "type": "string",
381
+ "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
382
+ },
383
+ "incarnation": {
384
+ "type": "integer",
385
+ "minimum": 0
386
+ },
387
+ "attempt": {
388
+ "type": "integer",
389
+ "minimum": 0
390
+ }
391
+ }
392
+ },
393
+ "manifestSha256": {
394
+ "type": "string",
395
+ "pattern": "^[0-9a-f]{64}$"
396
+ },
397
+ "tokenEstimate": {
398
+ "type": "integer",
399
+ "minimum": 0
400
+ },
401
+ "tokenLimit": {
402
+ "type": "integer",
403
+ "minimum": 0
404
+ },
405
+ "entries": {
406
+ "type": "array",
407
+ "items": {
408
+ "type": "object",
409
+ "required": [
410
+ "id",
411
+ "tier",
412
+ "trust",
413
+ "source",
414
+ "sha256",
415
+ "bytes",
416
+ "tokenEstimate"
417
+ ],
418
+ "properties": {
419
+ "id": {
420
+ "type": "string"
421
+ },
422
+ "tier": {
423
+ "type": "string",
424
+ "enum": [
425
+ "system",
426
+ "doctrine",
427
+ "data",
428
+ "task",
429
+ "prior-results"
430
+ ]
431
+ },
432
+ "trust": {
433
+ "type": "string",
434
+ "enum": [
435
+ "cohorte",
436
+ "human",
437
+ "untrusted-repository",
438
+ "agent-output"
439
+ ]
440
+ },
441
+ "source": {
442
+ "type": "object",
443
+ "required": [
444
+ "kind",
445
+ "ref"
446
+ ],
447
+ "properties": {
448
+ "kind": {
449
+ "type": "string",
450
+ "enum": [
451
+ "asset",
452
+ "project-file",
453
+ "artifact",
454
+ "event-summary",
455
+ "inline"
456
+ ]
457
+ },
458
+ "ref": {
459
+ "type": "string"
460
+ }
461
+ }
462
+ },
463
+ "sha256": {
464
+ "type": "string",
465
+ "pattern": "^[0-9a-f]{64}$"
466
+ },
467
+ "bytes": {
468
+ "type": "integer",
469
+ "minimum": 0
470
+ },
471
+ "tokenEstimate": {
472
+ "type": "integer",
473
+ "minimum": 0
474
+ }
475
+ }
476
+ }
477
+ },
478
+ "reductions": {
479
+ "type": "array",
480
+ "items": {
481
+ "type": "object",
482
+ "required": [
483
+ "entryId",
484
+ "strategy",
485
+ "fromBytes",
486
+ "toBytes"
487
+ ],
488
+ "properties": {
489
+ "entryId": {
490
+ "type": "string"
491
+ },
492
+ "strategy": {
493
+ "type": "string",
494
+ "enum": [
495
+ "excerpt",
496
+ "outline",
497
+ "summary-with-refs",
498
+ "dropped"
499
+ ]
500
+ },
501
+ "fromBytes": {
502
+ "type": "integer",
503
+ "minimum": 0
504
+ },
505
+ "toBytes": {
506
+ "type": "integer",
507
+ "minimum": 0
508
+ }
509
+ }
510
+ }
511
+ },
512
+ "exclusions": {
513
+ "type": "array",
514
+ "items": {
515
+ "type": "object",
516
+ "required": [
517
+ "pattern",
518
+ "reason"
519
+ ],
520
+ "properties": {
521
+ "pattern": {
522
+ "type": "string"
523
+ },
524
+ "reason": {
525
+ "type": "string",
526
+ "enum": [
527
+ "secret",
528
+ "outside-scope",
529
+ "size",
530
+ "binary"
531
+ ]
532
+ }
533
+ }
534
+ }
535
+ },
536
+ "manifest": {
537
+ "type": "object",
538
+ "required": [
539
+ "artifactId",
540
+ "kind",
541
+ "path",
542
+ "sha256",
543
+ "bytes"
544
+ ],
545
+ "properties": {
546
+ "artifactId": {
547
+ "type": "string",
548
+ "pattern": "^art_[0-9a-f]{32}$"
549
+ },
550
+ "kind": {
551
+ "type": "string",
552
+ "x-cohorte-known": [
553
+ "diff",
554
+ "file",
555
+ "log",
556
+ "report",
557
+ "agent-output",
558
+ "transcript",
559
+ "context",
560
+ "prompt",
561
+ "patch"
562
+ ]
563
+ },
564
+ "path": {
565
+ "type": "string"
566
+ },
567
+ "sha256": {
568
+ "type": "string",
569
+ "pattern": "^[0-9a-f]{64}$"
570
+ },
571
+ "bytes": {
572
+ "type": "integer",
573
+ "minimum": 0
574
+ }
575
+ }
576
+ }
577
+ }
578
+ }
579
+ }
580
+ },
581
+ {
582
+ "type": "object",
583
+ "required": [
584
+ "documentVersion",
585
+ "protocolVersion",
586
+ "runId",
587
+ "lastSequence",
588
+ "kind",
589
+ "request",
590
+ "status"
591
+ ],
592
+ "properties": {
593
+ "documentVersion": {
594
+ "type": "number",
595
+ "const": 1
596
+ },
597
+ "protocolVersion": {
598
+ "type": "string",
599
+ "const": "1.0"
600
+ },
601
+ "runId": {
602
+ "type": "string",
603
+ "pattern": "^run_[0-9a-f]{32}$"
604
+ },
605
+ "lastSequence": {
606
+ "type": "integer",
607
+ "minimum": 0
608
+ },
609
+ "kind": {
610
+ "type": "string",
611
+ "const": "approval"
612
+ },
613
+ "request": {
614
+ "type": "object",
615
+ "required": [
616
+ "approvalId",
617
+ "kind",
618
+ "affectedPaths",
619
+ "preview",
620
+ "ruleId",
621
+ "reason",
622
+ "asks",
623
+ "allowedDecisions",
624
+ "unattended",
625
+ "cli"
626
+ ],
627
+ "properties": {
628
+ "approvalId": {
629
+ "type": "string",
630
+ "pattern": "^apr_[0-9a-f]{32}$"
631
+ },
632
+ "kind": {
633
+ "type": "string",
634
+ "x-cohorte-known": [
635
+ "tool",
636
+ "shared-path",
637
+ "ship",
638
+ "budget",
639
+ "loop-stalled",
640
+ "contract-change",
641
+ "spec-not-ready",
642
+ "review-leftovers",
643
+ "unowned-path",
644
+ "api-billing",
645
+ "blocked-ack",
646
+ "provision-network"
647
+ ]
648
+ },
649
+ "agent": {
650
+ "type": "object",
651
+ "required": [
652
+ "agentId",
653
+ "role",
654
+ "incarnation",
655
+ "attempt"
656
+ ],
657
+ "properties": {
658
+ "agentId": {
659
+ "type": "string",
660
+ "maxLength": 128,
661
+ "pattern": "^agt_[A-Za-z0-9.-]+_[A-Za-z0-9_.-]+$"
662
+ },
663
+ "role": {
664
+ "type": "string"
665
+ },
666
+ "surface": {
667
+ "type": "string",
668
+ "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
669
+ },
670
+ "incarnation": {
671
+ "type": "integer",
672
+ "minimum": 0
673
+ },
674
+ "attempt": {
675
+ "type": "integer",
676
+ "minimum": 0
677
+ }
678
+ }
679
+ },
680
+ "phase": {
681
+ "type": "object",
682
+ "required": [
683
+ "phaseRunId",
684
+ "state",
685
+ "iteration"
686
+ ],
687
+ "properties": {
688
+ "phaseRunId": {
689
+ "type": "string",
690
+ "maxLength": 128,
691
+ "pattern": "^phs_[A-Z][A-Z_]*_[0-9]+$"
692
+ },
693
+ "state": {
694
+ "type": "string",
695
+ "enum": [
696
+ "BRAINSTORM",
697
+ "SPEC",
698
+ "PREFLIGHT",
699
+ "BUILD",
700
+ "TEST",
701
+ "REVIEW",
702
+ "FIX",
703
+ "SHIP"
704
+ ]
705
+ },
706
+ "iteration": {
707
+ "type": "integer",
708
+ "minimum": 0
709
+ }
710
+ }
711
+ },
712
+ "tool": {
713
+ "type": "string"
714
+ },
715
+ "args": {
716
+ "$ref": "#/$defs/JsonValue"
717
+ },
718
+ "affectedPaths": {
719
+ "type": "array",
720
+ "items": {
721
+ "type": "string"
722
+ }
723
+ },
724
+ "preview": {
725
+ "type": "object",
726
+ "required": [
727
+ "kind",
728
+ "text"
729
+ ],
730
+ "properties": {
731
+ "kind": {
732
+ "type": "string",
733
+ "enum": [
734
+ "diff",
735
+ "command",
736
+ "text"
737
+ ]
738
+ },
739
+ "text": {
740
+ "type": "string"
741
+ }
742
+ }
743
+ },
744
+ "options": {
745
+ "type": "array",
746
+ "items": {
747
+ "type": "string"
748
+ }
749
+ },
750
+ "ruleId": {
751
+ "type": "string"
752
+ },
753
+ "reason": {
754
+ "type": "string"
755
+ },
756
+ "asks": {
757
+ "type": "array",
758
+ "items": {
759
+ "type": "object",
760
+ "required": [
761
+ "stage",
762
+ "ruleId",
763
+ "reason"
764
+ ],
765
+ "properties": {
766
+ "stage": {
767
+ "type": "string"
768
+ },
769
+ "ruleId": {
770
+ "type": "string"
771
+ },
772
+ "reason": {
773
+ "type": "string"
774
+ }
775
+ }
776
+ }
777
+ },
778
+ "allowedDecisions": {
779
+ "type": "array",
780
+ "items": {
781
+ "type": "string",
782
+ "enum": [
783
+ "allow-once",
784
+ "allow-for-run",
785
+ "deny"
786
+ ]
787
+ }
788
+ },
789
+ "preStateSha256": {
790
+ "type": "string",
791
+ "pattern": "^[0-9a-f]{64}$"
792
+ },
793
+ "expiresAt": {
794
+ "type": "string",
795
+ "format": "date-time",
796
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
797
+ },
798
+ "unattended": {
799
+ "type": "string",
800
+ "enum": [
801
+ "deny",
802
+ "wait"
803
+ ]
804
+ },
805
+ "cli": {
806
+ "type": "string"
807
+ }
808
+ }
809
+ },
810
+ "status": {
811
+ "type": "string"
812
+ },
813
+ "decision": {
814
+ "type": "object",
815
+ "required": [
816
+ "approvalId",
817
+ "decision",
818
+ "actor"
819
+ ],
820
+ "properties": {
821
+ "approvalId": {
822
+ "type": "string",
823
+ "pattern": "^apr_[0-9a-f]{32}$"
824
+ },
825
+ "decision": {
826
+ "type": "string",
827
+ "enum": [
828
+ "allow-once",
829
+ "allow-for-run",
830
+ "deny",
831
+ "expired",
832
+ "superseded"
833
+ ]
834
+ },
835
+ "actor": {
836
+ "type": "object",
837
+ "required": [
838
+ "kind",
839
+ "id",
840
+ "transport"
841
+ ],
842
+ "properties": {
843
+ "kind": {
844
+ "type": "string",
845
+ "enum": [
846
+ "human",
847
+ "client",
848
+ "system"
849
+ ]
850
+ },
851
+ "id": {
852
+ "type": "string"
853
+ },
854
+ "transport": {
855
+ "type": "string",
856
+ "x-cohorte-known": [
857
+ "cli"
858
+ ]
859
+ }
860
+ }
861
+ },
862
+ "commandId": {
863
+ "type": "string",
864
+ "pattern": "^cmd_[0-9a-f]{32}$"
865
+ },
866
+ "commandAuth": {
867
+ "type": "object",
868
+ "required": [
869
+ "scheme",
870
+ "value"
871
+ ],
872
+ "properties": {
873
+ "scheme": {
874
+ "type": "string",
875
+ "x-cohorte-known": [
876
+ "hmac-sha256"
877
+ ]
878
+ },
879
+ "value": {
880
+ "type": "string",
881
+ "minLength": 1
882
+ }
883
+ }
884
+ },
885
+ "grantId": {
886
+ "type": "string"
887
+ },
888
+ "answer": {
889
+ "type": "string"
890
+ },
891
+ "note": {
892
+ "type": "string"
893
+ }
894
+ }
895
+ }
896
+ }
897
+ },
898
+ {
899
+ "type": "object",
900
+ "required": [
901
+ "documentVersion",
902
+ "protocolVersion",
903
+ "runId",
904
+ "lastSequence",
905
+ "kind",
906
+ "effect"
907
+ ],
908
+ "properties": {
909
+ "documentVersion": {
910
+ "type": "number",
911
+ "const": 1
912
+ },
913
+ "protocolVersion": {
914
+ "type": "string",
915
+ "const": "1.0"
916
+ },
917
+ "runId": {
918
+ "type": "string",
919
+ "pattern": "^run_[0-9a-f]{32}$"
920
+ },
921
+ "lastSequence": {
922
+ "type": "integer",
923
+ "minimum": 0
924
+ },
925
+ "kind": {
926
+ "type": "string",
927
+ "const": "effect"
928
+ },
929
+ "effect": {
930
+ "type": "object",
931
+ "required": [
932
+ "effectId",
933
+ "kind",
934
+ "replayClass",
935
+ "state",
936
+ "request"
937
+ ],
938
+ "properties": {
939
+ "effectId": {
940
+ "type": "string",
941
+ "pattern": "^eff_[0-9a-f]{32}$"
942
+ },
943
+ "kind": {
944
+ "type": "string"
945
+ },
946
+ "replayClass": {
947
+ "type": "string"
948
+ },
949
+ "state": {
950
+ "type": "string"
951
+ },
952
+ "toolCallId": {
953
+ "type": "string",
954
+ "maxLength": 128,
955
+ "pattern": "^tc_[0-9]+_[0-9]+$"
956
+ },
957
+ "slot": {
958
+ "type": "string"
959
+ },
960
+ "request": {
961
+ "$ref": "#/$defs/JsonValue"
962
+ },
963
+ "result": {
964
+ "$ref": "#/$defs/JsonValue"
965
+ },
966
+ "error": {
967
+ "$ref": "#/$defs/ErrorInfo"
968
+ }
969
+ }
970
+ }
971
+ }
972
+ },
973
+ {
974
+ "type": "object",
975
+ "required": [
976
+ "documentVersion",
977
+ "protocolVersion",
978
+ "runId",
979
+ "lastSequence",
980
+ "kind",
981
+ "document"
982
+ ],
983
+ "properties": {
984
+ "documentVersion": {
985
+ "type": "number",
986
+ "const": 1
987
+ },
988
+ "protocolVersion": {
989
+ "type": "string",
990
+ "const": "1.0"
991
+ },
992
+ "runId": {
993
+ "type": "string",
994
+ "pattern": "^run_[0-9a-f]{32}$"
995
+ },
996
+ "lastSequence": {
997
+ "type": "integer",
998
+ "minimum": 0
999
+ },
1000
+ "kind": {
1001
+ "type": "string",
1002
+ "const": "snapshot"
1003
+ },
1004
+ "document": {
1005
+ "type": "object",
1006
+ "required": [
1007
+ "documentVersion",
1008
+ "protocolVersion",
1009
+ "cohorteVersion",
1010
+ "generatedAt",
1011
+ "lastSequence",
1012
+ "run",
1013
+ "phases",
1014
+ "approvals",
1015
+ "budgets",
1016
+ "usage",
1017
+ "locks",
1018
+ "inDoubtEffects"
1019
+ ],
1020
+ "properties": {
1021
+ "documentVersion": {
1022
+ "type": "number",
1023
+ "const": 1
1024
+ },
1025
+ "protocolVersion": {
1026
+ "type": "string",
1027
+ "const": "1.0"
1028
+ },
1029
+ "cohorteVersion": {
1030
+ "type": "string"
1031
+ },
1032
+ "generatedAt": {
1033
+ "type": "string",
1034
+ "format": "date-time",
1035
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
1036
+ },
1037
+ "lastSequence": {
1038
+ "type": "integer",
1039
+ "minimum": 0
1040
+ },
1041
+ "run": {
1042
+ "type": "object",
1043
+ "required": [
1044
+ "runId",
1045
+ "profile",
1046
+ "title",
1047
+ "spec",
1048
+ "state",
1049
+ "status",
1050
+ "since",
1051
+ "iteration",
1052
+ "host",
1053
+ "git",
1054
+ "plan",
1055
+ "snapshotDigest",
1056
+ "startedAt"
1057
+ ],
1058
+ "properties": {
1059
+ "runId": {
1060
+ "type": "string",
1061
+ "pattern": "^run_[0-9a-f]{32}$"
1062
+ },
1063
+ "profile": {
1064
+ "type": "string",
1065
+ "x-cohorte-known": [
1066
+ "feature",
1067
+ "bugfix",
1068
+ "review"
1069
+ ]
1070
+ },
1071
+ "title": {
1072
+ "type": "string"
1073
+ },
1074
+ "spec": {
1075
+ "type": "object",
1076
+ "required": [
1077
+ "id",
1078
+ "kind",
1079
+ "sha256"
1080
+ ],
1081
+ "properties": {
1082
+ "id": {
1083
+ "type": "string",
1084
+ "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
1085
+ },
1086
+ "kind": {
1087
+ "type": "string"
1088
+ },
1089
+ "sha256": {
1090
+ "type": "string",
1091
+ "pattern": "^[0-9a-f]{64}$"
1092
+ }
1093
+ }
1094
+ },
1095
+ "state": {
1096
+ "type": "string",
1097
+ "enum": [
1098
+ "IDLE",
1099
+ "BRAINSTORM",
1100
+ "SPEC",
1101
+ "PREFLIGHT",
1102
+ "BUILD",
1103
+ "TEST",
1104
+ "REVIEW",
1105
+ "FIX",
1106
+ "SHIP",
1107
+ "PAUSED",
1108
+ "WAITING_APPROVAL",
1109
+ "AUTH_REQUIRED",
1110
+ "QUOTA_EXCEEDED",
1111
+ "FAILED",
1112
+ "BLOCKED",
1113
+ "COMPLETED",
1114
+ "CANCELLED"
1115
+ ]
1116
+ },
1117
+ "status": {
1118
+ "type": "string",
1119
+ "enum": [
1120
+ "pending",
1121
+ "running",
1122
+ "completed",
1123
+ "failed",
1124
+ "paused",
1125
+ "waiting-approval",
1126
+ "cancelled",
1127
+ "skipped",
1128
+ "blocked"
1129
+ ]
1130
+ },
1131
+ "since": {
1132
+ "type": "string",
1133
+ "format": "date-time",
1134
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
1135
+ },
1136
+ "resumeTo": {
1137
+ "type": "string",
1138
+ "enum": [
1139
+ "BRAINSTORM",
1140
+ "SPEC",
1141
+ "PREFLIGHT",
1142
+ "BUILD",
1143
+ "TEST",
1144
+ "REVIEW",
1145
+ "FIX",
1146
+ "SHIP"
1147
+ ]
1148
+ },
1149
+ "stop": {
1150
+ "type": "object",
1151
+ "required": [
1152
+ "reason",
1153
+ "detail",
1154
+ "resumable"
1155
+ ],
1156
+ "properties": {
1157
+ "reason": {
1158
+ "type": "string",
1159
+ "enum": [
1160
+ "review-clean",
1161
+ "iteration-limit",
1162
+ "budget-exhausted",
1163
+ "timeout",
1164
+ "identical-failure",
1165
+ "no-progress",
1166
+ "policy-violation",
1167
+ "approval-required",
1168
+ "unexpected-repo-change",
1169
+ "runtime-incompatible",
1170
+ "auth-required",
1171
+ "quota-exceeded",
1172
+ "paused",
1173
+ "cancelled",
1174
+ "agent-dead",
1175
+ "unreviewed",
1176
+ "internal-error",
1177
+ "check-environment"
1178
+ ]
1179
+ },
1180
+ "detail": {
1181
+ "type": "string"
1182
+ },
1183
+ "resumable": {
1184
+ "type": "boolean"
1185
+ },
1186
+ "resumeRequires": {
1187
+ "type": "string",
1188
+ "x-cohorte-known": [
1189
+ "approval",
1190
+ "auth-login",
1191
+ "quota-reset",
1192
+ "budget-raise",
1193
+ "human-ack",
1194
+ "repo-repair",
1195
+ "reinstall-pinned-version",
1196
+ "environment-repair"
1197
+ ]
1198
+ }
1199
+ }
1200
+ },
1201
+ "lastError": {
1202
+ "$ref": "#/$defs/ErrorInfo"
1203
+ },
1204
+ "iteration": {
1205
+ "type": "object",
1206
+ "required": [
1207
+ "fixRounds",
1208
+ "maxFixRounds",
1209
+ "reviewRounds"
1210
+ ],
1211
+ "properties": {
1212
+ "fixRounds": {
1213
+ "type": "integer",
1214
+ "minimum": 0
1215
+ },
1216
+ "maxFixRounds": {
1217
+ "type": "integer",
1218
+ "minimum": 0
1219
+ },
1220
+ "reviewRounds": {
1221
+ "type": "integer",
1222
+ "minimum": 0
1223
+ }
1224
+ }
1225
+ },
1226
+ "host": {
1227
+ "type": "object",
1228
+ "required": [
1229
+ "alive"
1230
+ ],
1231
+ "properties": {
1232
+ "hostId": {
1233
+ "type": "string"
1234
+ },
1235
+ "alive": {
1236
+ "type": "boolean"
1237
+ },
1238
+ "heartbeatAt": {
1239
+ "type": "string",
1240
+ "format": "date-time",
1241
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
1242
+ },
1243
+ "pid": {
1244
+ "type": "integer",
1245
+ "minimum": 0
1246
+ }
1247
+ }
1248
+ },
1249
+ "git": {
1250
+ "type": "object",
1251
+ "required": [
1252
+ "base",
1253
+ "integrationBranch"
1254
+ ],
1255
+ "properties": {
1256
+ "base": {
1257
+ "type": "object",
1258
+ "required": [
1259
+ "branch",
1260
+ "sha"
1261
+ ],
1262
+ "properties": {
1263
+ "branch": {
1264
+ "type": "string"
1265
+ },
1266
+ "sha": {
1267
+ "type": "string"
1268
+ }
1269
+ }
1270
+ },
1271
+ "integrationBranch": {
1272
+ "type": "string"
1273
+ },
1274
+ "integrationHead": {
1275
+ "type": "string"
1276
+ },
1277
+ "approvedTreeDigest": {
1278
+ "type": "string"
1279
+ }
1280
+ }
1281
+ },
1282
+ "plan": {
1283
+ "type": "object",
1284
+ "required": [
1285
+ "profile",
1286
+ "runtime",
1287
+ "trust",
1288
+ "models",
1289
+ "apiBillingEnabled",
1290
+ "meteredProviders",
1291
+ "sandbox",
1292
+ "sandboxRequire",
1293
+ "brainIsolation",
1294
+ "budgets",
1295
+ "network",
1296
+ "promptOverrides",
1297
+ "unattended"
1298
+ ],
1299
+ "properties": {
1300
+ "profile": {
1301
+ "type": "string",
1302
+ "x-cohorte-known": [
1303
+ "feature",
1304
+ "bugfix",
1305
+ "review"
1306
+ ]
1307
+ },
1308
+ "runtime": {
1309
+ "type": "object",
1310
+ "required": [
1311
+ "id",
1312
+ "version"
1313
+ ],
1314
+ "properties": {
1315
+ "id": {
1316
+ "type": "string"
1317
+ },
1318
+ "version": {
1319
+ "type": "string"
1320
+ }
1321
+ }
1322
+ },
1323
+ "trust": {
1324
+ "type": "object",
1325
+ "required": [
1326
+ "policySha256",
1327
+ "loosenedKeys",
1328
+ "grantedBy"
1329
+ ],
1330
+ "properties": {
1331
+ "policySha256": {
1332
+ "type": "string",
1333
+ "pattern": "^[0-9a-f]{64}$"
1334
+ },
1335
+ "loosenedKeys": {
1336
+ "type": "array",
1337
+ "items": {
1338
+ "type": "string"
1339
+ }
1340
+ },
1341
+ "grantedBy": {
1342
+ "type": "string",
1343
+ "x-cohorte-known": [
1344
+ "none-needed",
1345
+ "user-config",
1346
+ "cli-flag",
1347
+ "trust-record"
1348
+ ]
1349
+ }
1350
+ }
1351
+ },
1352
+ "models": {
1353
+ "type": "array",
1354
+ "items": {
1355
+ "type": "object",
1356
+ "required": [
1357
+ "role",
1358
+ "requested",
1359
+ "thinking",
1360
+ "authMode",
1361
+ "billing",
1362
+ "reason"
1363
+ ],
1364
+ "properties": {
1365
+ "role": {
1366
+ "type": "string"
1367
+ },
1368
+ "requested": {
1369
+ "type": "object",
1370
+ "required": [
1371
+ "provider",
1372
+ "model"
1373
+ ],
1374
+ "properties": {
1375
+ "provider": {
1376
+ "type": "string"
1377
+ },
1378
+ "model": {
1379
+ "type": "string"
1380
+ },
1381
+ "capability": {
1382
+ "anyOf": [
1383
+ {
1384
+ "type": "string",
1385
+ "const": "fast"
1386
+ },
1387
+ {
1388
+ "type": "string",
1389
+ "const": "coding"
1390
+ },
1391
+ {
1392
+ "type": "string",
1393
+ "const": "reasoning"
1394
+ },
1395
+ {
1396
+ "type": "string",
1397
+ "const": "vision"
1398
+ },
1399
+ {
1400
+ "type": "string",
1401
+ "const": "cheap"
1402
+ }
1403
+ ]
1404
+ }
1405
+ }
1406
+ },
1407
+ "thinking": {
1408
+ "anyOf": [
1409
+ {
1410
+ "type": "string",
1411
+ "const": "off"
1412
+ },
1413
+ {
1414
+ "type": "string",
1415
+ "const": "minimal"
1416
+ },
1417
+ {
1418
+ "type": "string",
1419
+ "const": "low"
1420
+ },
1421
+ {
1422
+ "type": "string",
1423
+ "const": "medium"
1424
+ },
1425
+ {
1426
+ "type": "string",
1427
+ "const": "high"
1428
+ },
1429
+ {
1430
+ "type": "string",
1431
+ "const": "xhigh"
1432
+ }
1433
+ ]
1434
+ },
1435
+ "authMode": {
1436
+ "anyOf": [
1437
+ {
1438
+ "type": "string",
1439
+ "const": "subscription"
1440
+ },
1441
+ {
1442
+ "type": "string",
1443
+ "const": "api"
1444
+ }
1445
+ ]
1446
+ },
1447
+ "billing": {
1448
+ "type": "string",
1449
+ "enum": [
1450
+ "plan-limits",
1451
+ "metered"
1452
+ ]
1453
+ },
1454
+ "reason": {
1455
+ "type": "string"
1456
+ }
1457
+ }
1458
+ }
1459
+ },
1460
+ "apiBillingEnabled": {
1461
+ "type": "boolean"
1462
+ },
1463
+ "meteredProviders": {
1464
+ "type": "array",
1465
+ "items": {
1466
+ "type": "string"
1467
+ }
1468
+ },
1469
+ "sandbox": {
1470
+ "type": "object",
1471
+ "required": [
1472
+ "level",
1473
+ "backend",
1474
+ "filesystem",
1475
+ "network"
1476
+ ],
1477
+ "properties": {
1478
+ "level": {
1479
+ "type": "string",
1480
+ "x-cohorte-known": [
1481
+ "L0-process",
1482
+ "L1-os"
1483
+ ]
1484
+ },
1485
+ "backend": {
1486
+ "type": "string",
1487
+ "x-cohorte-known": [
1488
+ "none",
1489
+ "seatbelt",
1490
+ "bubblewrap"
1491
+ ]
1492
+ },
1493
+ "filesystem": {
1494
+ "type": "string",
1495
+ "x-cohorte-known": [
1496
+ "enforced",
1497
+ "partial",
1498
+ "advisory"
1499
+ ]
1500
+ },
1501
+ "network": {
1502
+ "type": "string",
1503
+ "x-cohorte-known": [
1504
+ "enforced-off",
1505
+ "partial",
1506
+ "unenforced"
1507
+ ]
1508
+ }
1509
+ }
1510
+ },
1511
+ "sandboxRequire": {
1512
+ "type": "string",
1513
+ "enum": [
1514
+ "native",
1515
+ "best-effort"
1516
+ ]
1517
+ },
1518
+ "brainIsolation": {
1519
+ "type": "string",
1520
+ "enum": [
1521
+ "os",
1522
+ "process"
1523
+ ]
1524
+ },
1525
+ "budgets": {
1526
+ "type": "object",
1527
+ "required": [
1528
+ "run",
1529
+ "perPhase",
1530
+ "perAgent",
1531
+ "perProvider",
1532
+ "perTool"
1533
+ ],
1534
+ "properties": {
1535
+ "run": {
1536
+ "type": "object",
1537
+ "properties": {
1538
+ "tokens": {
1539
+ "type": "integer",
1540
+ "minimum": 0
1541
+ },
1542
+ "modelRequests": {
1543
+ "type": "integer",
1544
+ "minimum": 0
1545
+ },
1546
+ "toolCalls": {
1547
+ "type": "integer",
1548
+ "minimum": 0
1549
+ },
1550
+ "wallClockMs": {
1551
+ "type": "number",
1552
+ "minimum": 0
1553
+ },
1554
+ "retries": {
1555
+ "type": "integer",
1556
+ "minimum": 0
1557
+ },
1558
+ "fixRounds": {
1559
+ "type": "integer",
1560
+ "minimum": 0
1561
+ },
1562
+ "contextTokens": {
1563
+ "type": "integer",
1564
+ "minimum": 0
1565
+ },
1566
+ "concurrentAgents": {
1567
+ "type": "integer",
1568
+ "minimum": 0
1569
+ },
1570
+ "estimatedQuotaPercent": {
1571
+ "type": "number",
1572
+ "minimum": 0
1573
+ }
1574
+ }
1575
+ },
1576
+ "perPhase": {
1577
+ "type": "object",
1578
+ "properties": {
1579
+ "tokens": {
1580
+ "type": "integer",
1581
+ "minimum": 0
1582
+ },
1583
+ "modelRequests": {
1584
+ "type": "integer",
1585
+ "minimum": 0
1586
+ },
1587
+ "toolCalls": {
1588
+ "type": "integer",
1589
+ "minimum": 0
1590
+ },
1591
+ "wallClockMs": {
1592
+ "type": "number",
1593
+ "minimum": 0
1594
+ },
1595
+ "retries": {
1596
+ "type": "integer",
1597
+ "minimum": 0
1598
+ },
1599
+ "fixRounds": {
1600
+ "type": "integer",
1601
+ "minimum": 0
1602
+ },
1603
+ "contextTokens": {
1604
+ "type": "integer",
1605
+ "minimum": 0
1606
+ },
1607
+ "concurrentAgents": {
1608
+ "type": "integer",
1609
+ "minimum": 0
1610
+ },
1611
+ "estimatedQuotaPercent": {
1612
+ "type": "number",
1613
+ "minimum": 0
1614
+ }
1615
+ }
1616
+ },
1617
+ "perAgent": {
1618
+ "type": "object",
1619
+ "properties": {
1620
+ "tokens": {
1621
+ "type": "integer",
1622
+ "minimum": 0
1623
+ },
1624
+ "modelRequests": {
1625
+ "type": "integer",
1626
+ "minimum": 0
1627
+ },
1628
+ "toolCalls": {
1629
+ "type": "integer",
1630
+ "minimum": 0
1631
+ },
1632
+ "wallClockMs": {
1633
+ "type": "number",
1634
+ "minimum": 0
1635
+ },
1636
+ "retries": {
1637
+ "type": "integer",
1638
+ "minimum": 0
1639
+ },
1640
+ "fixRounds": {
1641
+ "type": "integer",
1642
+ "minimum": 0
1643
+ },
1644
+ "contextTokens": {
1645
+ "type": "integer",
1646
+ "minimum": 0
1647
+ },
1648
+ "concurrentAgents": {
1649
+ "type": "integer",
1650
+ "minimum": 0
1651
+ },
1652
+ "estimatedQuotaPercent": {
1653
+ "type": "number",
1654
+ "minimum": 0
1655
+ }
1656
+ }
1657
+ },
1658
+ "perProvider": {
1659
+ "type": "object",
1660
+ "patternProperties": {
1661
+ "^.*$": {
1662
+ "type": "object",
1663
+ "properties": {
1664
+ "tokens": {
1665
+ "type": "integer",
1666
+ "minimum": 0
1667
+ },
1668
+ "modelRequests": {
1669
+ "type": "integer",
1670
+ "minimum": 0
1671
+ },
1672
+ "toolCalls": {
1673
+ "type": "integer",
1674
+ "minimum": 0
1675
+ },
1676
+ "wallClockMs": {
1677
+ "type": "number",
1678
+ "minimum": 0
1679
+ },
1680
+ "retries": {
1681
+ "type": "integer",
1682
+ "minimum": 0
1683
+ },
1684
+ "fixRounds": {
1685
+ "type": "integer",
1686
+ "minimum": 0
1687
+ },
1688
+ "contextTokens": {
1689
+ "type": "integer",
1690
+ "minimum": 0
1691
+ },
1692
+ "concurrentAgents": {
1693
+ "type": "integer",
1694
+ "minimum": 0
1695
+ },
1696
+ "estimatedQuotaPercent": {
1697
+ "type": "number",
1698
+ "minimum": 0
1699
+ }
1700
+ }
1701
+ }
1702
+ }
1703
+ },
1704
+ "perTool": {
1705
+ "type": "object",
1706
+ "patternProperties": {
1707
+ "^.*$": {
1708
+ "type": "object",
1709
+ "properties": {
1710
+ "tokens": {
1711
+ "type": "integer",
1712
+ "minimum": 0
1713
+ },
1714
+ "modelRequests": {
1715
+ "type": "integer",
1716
+ "minimum": 0
1717
+ },
1718
+ "toolCalls": {
1719
+ "type": "integer",
1720
+ "minimum": 0
1721
+ },
1722
+ "wallClockMs": {
1723
+ "type": "number",
1724
+ "minimum": 0
1725
+ },
1726
+ "retries": {
1727
+ "type": "integer",
1728
+ "minimum": 0
1729
+ },
1730
+ "fixRounds": {
1731
+ "type": "integer",
1732
+ "minimum": 0
1733
+ },
1734
+ "contextTokens": {
1735
+ "type": "integer",
1736
+ "minimum": 0
1737
+ },
1738
+ "concurrentAgents": {
1739
+ "type": "integer",
1740
+ "minimum": 0
1741
+ },
1742
+ "estimatedQuotaPercent": {
1743
+ "type": "number",
1744
+ "minimum": 0
1745
+ }
1746
+ }
1747
+ }
1748
+ }
1749
+ }
1750
+ }
1751
+ },
1752
+ "network": {
1753
+ "type": "object",
1754
+ "required": [
1755
+ "provisioning"
1756
+ ],
1757
+ "properties": {
1758
+ "provisioning": {
1759
+ "type": "boolean"
1760
+ }
1761
+ }
1762
+ },
1763
+ "promptOverrides": {
1764
+ "type": "array",
1765
+ "items": {
1766
+ "type": "string"
1767
+ }
1768
+ },
1769
+ "unattended": {
1770
+ "type": "boolean"
1771
+ }
1772
+ }
1773
+ },
1774
+ "snapshotDigest": {
1775
+ "type": "string",
1776
+ "pattern": "^[0-9a-f]{64}$"
1777
+ },
1778
+ "startedAt": {
1779
+ "type": "string",
1780
+ "format": "date-time",
1781
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
1782
+ },
1783
+ "endedAt": {
1784
+ "type": "string",
1785
+ "format": "date-time",
1786
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
1787
+ }
1788
+ }
1789
+ },
1790
+ "phases": {
1791
+ "type": "array",
1792
+ "items": {
1793
+ "type": "object",
1794
+ "required": [
1795
+ "state",
1796
+ "label",
1797
+ "status",
1798
+ "runs"
1799
+ ],
1800
+ "properties": {
1801
+ "state": {
1802
+ "type": "string",
1803
+ "enum": [
1804
+ "BRAINSTORM",
1805
+ "SPEC",
1806
+ "PREFLIGHT",
1807
+ "BUILD",
1808
+ "TEST",
1809
+ "REVIEW",
1810
+ "FIX",
1811
+ "SHIP"
1812
+ ]
1813
+ },
1814
+ "label": {
1815
+ "type": "string"
1816
+ },
1817
+ "status": {
1818
+ "type": "string",
1819
+ "enum": [
1820
+ "pending",
1821
+ "running",
1822
+ "completed",
1823
+ "failed",
1824
+ "paused",
1825
+ "waiting-approval",
1826
+ "cancelled",
1827
+ "skipped",
1828
+ "blocked"
1829
+ ]
1830
+ },
1831
+ "runs": {
1832
+ "type": "array",
1833
+ "items": {
1834
+ "type": "object",
1835
+ "required": [
1836
+ "phaseRunId",
1837
+ "iteration",
1838
+ "status",
1839
+ "agents",
1840
+ "checks"
1841
+ ],
1842
+ "properties": {
1843
+ "phaseRunId": {
1844
+ "type": "string",
1845
+ "maxLength": 128,
1846
+ "pattern": "^phs_[A-Z][A-Z_]*_[0-9]+$"
1847
+ },
1848
+ "iteration": {
1849
+ "type": "integer",
1850
+ "minimum": 0
1851
+ },
1852
+ "status": {
1853
+ "type": "string",
1854
+ "enum": [
1855
+ "pending",
1856
+ "running",
1857
+ "completed",
1858
+ "failed",
1859
+ "paused",
1860
+ "waiting-approval",
1861
+ "cancelled",
1862
+ "skipped",
1863
+ "blocked"
1864
+ ]
1865
+ },
1866
+ "startedAt": {
1867
+ "type": "string",
1868
+ "format": "date-time",
1869
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
1870
+ },
1871
+ "endedAt": {
1872
+ "type": "string",
1873
+ "format": "date-time",
1874
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
1875
+ },
1876
+ "outcome": {
1877
+ "type": "string"
1878
+ },
1879
+ "agents": {
1880
+ "type": "array",
1881
+ "items": {
1882
+ "type": "object",
1883
+ "required": [
1884
+ "agentId",
1885
+ "role",
1886
+ "label",
1887
+ "status",
1888
+ "lifecycle",
1889
+ "attempt",
1890
+ "incarnation",
1891
+ "model",
1892
+ "usage"
1893
+ ],
1894
+ "properties": {
1895
+ "agentId": {
1896
+ "type": "string",
1897
+ "maxLength": 128,
1898
+ "pattern": "^agt_[A-Za-z0-9.-]+_[A-Za-z0-9_.-]+$"
1899
+ },
1900
+ "role": {
1901
+ "type": "string"
1902
+ },
1903
+ "surface": {
1904
+ "type": "string",
1905
+ "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
1906
+ },
1907
+ "label": {
1908
+ "type": "string"
1909
+ },
1910
+ "status": {
1911
+ "type": "string",
1912
+ "enum": [
1913
+ "pending",
1914
+ "running",
1915
+ "completed",
1916
+ "failed",
1917
+ "paused",
1918
+ "waiting-approval",
1919
+ "cancelled",
1920
+ "skipped",
1921
+ "blocked"
1922
+ ]
1923
+ },
1924
+ "lifecycle": {
1925
+ "type": "string",
1926
+ "enum": [
1927
+ "declared",
1928
+ "planned",
1929
+ "spawning",
1930
+ "running",
1931
+ "waiting",
1932
+ "paused",
1933
+ "completed",
1934
+ "failed",
1935
+ "retrying",
1936
+ "escalated",
1937
+ "cancelled"
1938
+ ]
1939
+ },
1940
+ "attempt": {
1941
+ "type": "integer",
1942
+ "minimum": 0
1943
+ },
1944
+ "incarnation": {
1945
+ "type": "integer",
1946
+ "minimum": 0
1947
+ },
1948
+ "model": {
1949
+ "type": "object",
1950
+ "required": [
1951
+ "requested"
1952
+ ],
1953
+ "properties": {
1954
+ "requested": {
1955
+ "type": "object",
1956
+ "required": [
1957
+ "provider",
1958
+ "model"
1959
+ ],
1960
+ "properties": {
1961
+ "provider": {
1962
+ "type": "string"
1963
+ },
1964
+ "model": {
1965
+ "type": "string"
1966
+ },
1967
+ "capability": {
1968
+ "anyOf": [
1969
+ {
1970
+ "type": "string",
1971
+ "const": "fast"
1972
+ },
1973
+ {
1974
+ "type": "string",
1975
+ "const": "coding"
1976
+ },
1977
+ {
1978
+ "type": "string",
1979
+ "const": "reasoning"
1980
+ },
1981
+ {
1982
+ "type": "string",
1983
+ "const": "vision"
1984
+ },
1985
+ {
1986
+ "type": "string",
1987
+ "const": "cheap"
1988
+ }
1989
+ ]
1990
+ }
1991
+ }
1992
+ },
1993
+ "effective": {
1994
+ "type": "object",
1995
+ "required": [
1996
+ "provider",
1997
+ "model"
1998
+ ],
1999
+ "properties": {
2000
+ "provider": {
2001
+ "type": "string"
2002
+ },
2003
+ "model": {
2004
+ "type": "string"
2005
+ }
2006
+ }
2007
+ }
2008
+ }
2009
+ },
2010
+ "authMode": {
2011
+ "anyOf": [
2012
+ {
2013
+ "type": "string",
2014
+ "const": "subscription"
2015
+ },
2016
+ {
2017
+ "type": "string",
2018
+ "const": "api"
2019
+ }
2020
+ ]
2021
+ },
2022
+ "worktree": {
2023
+ "type": "string"
2024
+ },
2025
+ "usage": {
2026
+ "type": "object",
2027
+ "properties": {
2028
+ "tokens": {
2029
+ "type": "integer",
2030
+ "minimum": 0
2031
+ },
2032
+ "modelRequests": {
2033
+ "type": "integer",
2034
+ "minimum": 0
2035
+ },
2036
+ "toolCalls": {
2037
+ "type": "integer",
2038
+ "minimum": 0
2039
+ },
2040
+ "wallClockMs": {
2041
+ "type": "number",
2042
+ "minimum": 0
2043
+ },
2044
+ "retries": {
2045
+ "type": "integer",
2046
+ "minimum": 0
2047
+ },
2048
+ "fixRounds": {
2049
+ "type": "integer",
2050
+ "minimum": 0
2051
+ },
2052
+ "contextTokens": {
2053
+ "type": "integer",
2054
+ "minimum": 0
2055
+ },
2056
+ "concurrentAgents": {
2057
+ "type": "integer",
2058
+ "minimum": 0
2059
+ },
2060
+ "estimatedQuotaPercent": {
2061
+ "type": "number",
2062
+ "minimum": 0
2063
+ }
2064
+ }
2065
+ },
2066
+ "summary": {
2067
+ "type": "string"
2068
+ },
2069
+ "lastError": {
2070
+ "$ref": "#/$defs/ErrorInfo"
2071
+ },
2072
+ "pendingApproval": {
2073
+ "type": "string",
2074
+ "pattern": "^apr_[0-9a-f]{32}$"
2075
+ },
2076
+ "runtimeRef": {
2077
+ "type": "object",
2078
+ "required": [
2079
+ "runtime",
2080
+ "version",
2081
+ "sessionId",
2082
+ "transcriptRef"
2083
+ ],
2084
+ "properties": {
2085
+ "runtime": {
2086
+ "type": "string"
2087
+ },
2088
+ "version": {
2089
+ "type": "string"
2090
+ },
2091
+ "sessionId": {
2092
+ "type": "string"
2093
+ },
2094
+ "transcriptRef": {
2095
+ "type": "string"
2096
+ }
2097
+ }
2098
+ }
2099
+ }
2100
+ }
2101
+ },
2102
+ "checks": {
2103
+ "type": "array",
2104
+ "items": {
2105
+ "type": "object",
2106
+ "required": [
2107
+ "name",
2108
+ "status",
2109
+ "argv",
2110
+ "durationMs",
2111
+ "treeDigest"
2112
+ ],
2113
+ "properties": {
2114
+ "name": {
2115
+ "type": "string"
2116
+ },
2117
+ "status": {
2118
+ "type": "string",
2119
+ "enum": [
2120
+ "passed",
2121
+ "failed",
2122
+ "errored",
2123
+ "skipped"
2124
+ ]
2125
+ },
2126
+ "argv": {
2127
+ "type": "array",
2128
+ "items": {
2129
+ "type": "string"
2130
+ }
2131
+ },
2132
+ "exitCode": {
2133
+ "type": "integer"
2134
+ },
2135
+ "durationMs": {
2136
+ "type": "number",
2137
+ "minimum": 0
2138
+ },
2139
+ "treeDigest": {
2140
+ "type": "string"
2141
+ },
2142
+ "output": {
2143
+ "type": "object",
2144
+ "required": [
2145
+ "artifactId",
2146
+ "kind",
2147
+ "path",
2148
+ "sha256",
2149
+ "bytes"
2150
+ ],
2151
+ "properties": {
2152
+ "artifactId": {
2153
+ "type": "string",
2154
+ "pattern": "^art_[0-9a-f]{32}$"
2155
+ },
2156
+ "kind": {
2157
+ "type": "string",
2158
+ "x-cohorte-known": [
2159
+ "diff",
2160
+ "file",
2161
+ "log",
2162
+ "report",
2163
+ "agent-output",
2164
+ "transcript",
2165
+ "context",
2166
+ "prompt",
2167
+ "patch"
2168
+ ]
2169
+ },
2170
+ "path": {
2171
+ "type": "string"
2172
+ },
2173
+ "sha256": {
2174
+ "type": "string",
2175
+ "pattern": "^[0-9a-f]{64}$"
2176
+ },
2177
+ "bytes": {
2178
+ "type": "integer",
2179
+ "minimum": 0
2180
+ }
2181
+ }
2182
+ }
2183
+ }
2184
+ }
2185
+ }
2186
+ }
2187
+ }
2188
+ }
2189
+ }
2190
+ }
2191
+ },
2192
+ "approvals": {
2193
+ "type": "object",
2194
+ "required": [
2195
+ "pending",
2196
+ "resolved"
2197
+ ],
2198
+ "properties": {
2199
+ "pending": {
2200
+ "type": "array",
2201
+ "items": {
2202
+ "type": "object",
2203
+ "required": [
2204
+ "approvalId",
2205
+ "kind",
2206
+ "what",
2207
+ "since",
2208
+ "cli"
2209
+ ],
2210
+ "properties": {
2211
+ "approvalId": {
2212
+ "type": "string",
2213
+ "pattern": "^apr_[0-9a-f]{32}$"
2214
+ },
2215
+ "kind": {
2216
+ "type": "string"
2217
+ },
2218
+ "agentId": {
2219
+ "type": "string",
2220
+ "maxLength": 128,
2221
+ "pattern": "^agt_[A-Za-z0-9.-]+_[A-Za-z0-9_.-]+$"
2222
+ },
2223
+ "what": {
2224
+ "type": "string",
2225
+ "maxLength": 512
2226
+ },
2227
+ "since": {
2228
+ "type": "string",
2229
+ "format": "date-time",
2230
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
2231
+ },
2232
+ "expiresAt": {
2233
+ "type": "string",
2234
+ "format": "date-time",
2235
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
2236
+ },
2237
+ "cli": {
2238
+ "type": "string"
2239
+ }
2240
+ }
2241
+ }
2242
+ },
2243
+ "resolved": {
2244
+ "type": "integer",
2245
+ "minimum": 0
2246
+ }
2247
+ }
2248
+ },
2249
+ "budgets": {
2250
+ "type": "array",
2251
+ "items": {
2252
+ "type": "object",
2253
+ "required": [
2254
+ "scope",
2255
+ "consumed",
2256
+ "limit"
2257
+ ],
2258
+ "properties": {
2259
+ "scope": {
2260
+ "type": "object",
2261
+ "required": [
2262
+ "level",
2263
+ "id"
2264
+ ],
2265
+ "properties": {
2266
+ "level": {
2267
+ "type": "string"
2268
+ },
2269
+ "id": {
2270
+ "type": "string"
2271
+ }
2272
+ }
2273
+ },
2274
+ "consumed": {
2275
+ "type": "object",
2276
+ "properties": {
2277
+ "tokens": {
2278
+ "type": "integer",
2279
+ "minimum": 0
2280
+ },
2281
+ "modelRequests": {
2282
+ "type": "integer",
2283
+ "minimum": 0
2284
+ },
2285
+ "toolCalls": {
2286
+ "type": "integer",
2287
+ "minimum": 0
2288
+ },
2289
+ "wallClockMs": {
2290
+ "type": "number",
2291
+ "minimum": 0
2292
+ },
2293
+ "retries": {
2294
+ "type": "integer",
2295
+ "minimum": 0
2296
+ },
2297
+ "fixRounds": {
2298
+ "type": "integer",
2299
+ "minimum": 0
2300
+ },
2301
+ "contextTokens": {
2302
+ "type": "integer",
2303
+ "minimum": 0
2304
+ },
2305
+ "concurrentAgents": {
2306
+ "type": "integer",
2307
+ "minimum": 0
2308
+ },
2309
+ "estimatedQuotaPercent": {
2310
+ "type": "number",
2311
+ "minimum": 0
2312
+ }
2313
+ }
2314
+ },
2315
+ "limit": {
2316
+ "type": "object",
2317
+ "properties": {
2318
+ "tokens": {
2319
+ "type": "integer",
2320
+ "minimum": 0
2321
+ },
2322
+ "modelRequests": {
2323
+ "type": "integer",
2324
+ "minimum": 0
2325
+ },
2326
+ "toolCalls": {
2327
+ "type": "integer",
2328
+ "minimum": 0
2329
+ },
2330
+ "wallClockMs": {
2331
+ "type": "number",
2332
+ "minimum": 0
2333
+ },
2334
+ "retries": {
2335
+ "type": "integer",
2336
+ "minimum": 0
2337
+ },
2338
+ "fixRounds": {
2339
+ "type": "integer",
2340
+ "minimum": 0
2341
+ },
2342
+ "contextTokens": {
2343
+ "type": "integer",
2344
+ "minimum": 0
2345
+ },
2346
+ "concurrentAgents": {
2347
+ "type": "integer",
2348
+ "minimum": 0
2349
+ },
2350
+ "estimatedQuotaPercent": {
2351
+ "type": "number",
2352
+ "minimum": 0
2353
+ }
2354
+ }
2355
+ }
2356
+ }
2357
+ }
2358
+ },
2359
+ "usage": {
2360
+ "type": "object",
2361
+ "required": [
2362
+ "tokens",
2363
+ "monetaryCost",
2364
+ "byProvider"
2365
+ ],
2366
+ "properties": {
2367
+ "tokens": {
2368
+ "type": "object",
2369
+ "required": [
2370
+ "input",
2371
+ "output",
2372
+ "cacheRead",
2373
+ "cacheWrite",
2374
+ "total"
2375
+ ],
2376
+ "properties": {
2377
+ "input": {
2378
+ "type": "integer",
2379
+ "minimum": 0
2380
+ },
2381
+ "output": {
2382
+ "type": "integer",
2383
+ "minimum": 0
2384
+ },
2385
+ "cacheRead": {
2386
+ "type": "integer",
2387
+ "minimum": 0
2388
+ },
2389
+ "cacheWrite": {
2390
+ "type": "integer",
2391
+ "minimum": 0
2392
+ },
2393
+ "total": {
2394
+ "type": "integer",
2395
+ "minimum": 0
2396
+ }
2397
+ }
2398
+ },
2399
+ "monetaryCost": {
2400
+ "anyOf": [
2401
+ {
2402
+ "type": "string",
2403
+ "const": "not_applicable"
2404
+ },
2405
+ {
2406
+ "type": "object",
2407
+ "required": [
2408
+ "currency",
2409
+ "amount",
2410
+ "basis",
2411
+ "priceCatalogVersion"
2412
+ ],
2413
+ "properties": {
2414
+ "currency": {
2415
+ "type": "string",
2416
+ "const": "USD"
2417
+ },
2418
+ "amount": {
2419
+ "type": "number",
2420
+ "minimum": 0
2421
+ },
2422
+ "basis": {
2423
+ "anyOf": [
2424
+ {
2425
+ "type": "string",
2426
+ "const": "catalogue"
2427
+ },
2428
+ {
2429
+ "type": "string",
2430
+ "const": "estimate"
2431
+ }
2432
+ ]
2433
+ },
2434
+ "priceCatalogVersion": {
2435
+ "type": "string"
2436
+ }
2437
+ }
2438
+ }
2439
+ ]
2440
+ },
2441
+ "byProvider": {
2442
+ "type": "array",
2443
+ "items": {
2444
+ "type": "object",
2445
+ "required": [
2446
+ "provider",
2447
+ "authMode",
2448
+ "billing",
2449
+ "tokens",
2450
+ "quota"
2451
+ ],
2452
+ "properties": {
2453
+ "provider": {
2454
+ "type": "string"
2455
+ },
2456
+ "authMode": {
2457
+ "anyOf": [
2458
+ {
2459
+ "type": "string",
2460
+ "const": "subscription"
2461
+ },
2462
+ {
2463
+ "type": "string",
2464
+ "const": "api"
2465
+ }
2466
+ ]
2467
+ },
2468
+ "billing": {
2469
+ "type": "string",
2470
+ "enum": [
2471
+ "plan-limits",
2472
+ "metered"
2473
+ ]
2474
+ },
2475
+ "tokens": {
2476
+ "type": "object",
2477
+ "required": [
2478
+ "input",
2479
+ "output",
2480
+ "cacheRead",
2481
+ "cacheWrite",
2482
+ "total"
2483
+ ],
2484
+ "properties": {
2485
+ "input": {
2486
+ "type": "integer",
2487
+ "minimum": 0
2488
+ },
2489
+ "output": {
2490
+ "type": "integer",
2491
+ "minimum": 0
2492
+ },
2493
+ "cacheRead": {
2494
+ "type": "integer",
2495
+ "minimum": 0
2496
+ },
2497
+ "cacheWrite": {
2498
+ "type": "integer",
2499
+ "minimum": 0
2500
+ },
2501
+ "total": {
2502
+ "type": "integer",
2503
+ "minimum": 0
2504
+ }
2505
+ }
2506
+ },
2507
+ "quota": {
2508
+ "anyOf": [
2509
+ {
2510
+ "type": "object",
2511
+ "required": [
2512
+ "known"
2513
+ ],
2514
+ "properties": {
2515
+ "known": {
2516
+ "type": "boolean",
2517
+ "const": false
2518
+ }
2519
+ }
2520
+ },
2521
+ {
2522
+ "type": "object",
2523
+ "required": [
2524
+ "known",
2525
+ "source",
2526
+ "provider",
2527
+ "windows",
2528
+ "observedAt"
2529
+ ],
2530
+ "properties": {
2531
+ "known": {
2532
+ "type": "boolean",
2533
+ "const": true
2534
+ },
2535
+ "source": {
2536
+ "anyOf": [
2537
+ {
2538
+ "type": "string",
2539
+ "const": "response-headers"
2540
+ },
2541
+ {
2542
+ "type": "string",
2543
+ "const": "error"
2544
+ }
2545
+ ]
2546
+ },
2547
+ "provider": {
2548
+ "type": "string"
2549
+ },
2550
+ "windows": {
2551
+ "type": "array",
2552
+ "items": {
2553
+ "type": "object",
2554
+ "required": [
2555
+ "name"
2556
+ ],
2557
+ "properties": {
2558
+ "name": {
2559
+ "type": "string"
2560
+ },
2561
+ "usedPercent": {
2562
+ "type": "number",
2563
+ "minimum": 0
2564
+ },
2565
+ "resetsAt": {
2566
+ "type": "string",
2567
+ "format": "date-time",
2568
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
2569
+ },
2570
+ "limitLabel": {
2571
+ "type": "string"
2572
+ }
2573
+ }
2574
+ }
2575
+ },
2576
+ "observedAt": {
2577
+ "type": "string",
2578
+ "format": "date-time",
2579
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
2580
+ }
2581
+ }
2582
+ }
2583
+ ]
2584
+ },
2585
+ "accountLabel": {
2586
+ "type": "string"
2587
+ }
2588
+ }
2589
+ }
2590
+ }
2591
+ }
2592
+ },
2593
+ "locks": {
2594
+ "type": "array",
2595
+ "items": {
2596
+ "type": "object",
2597
+ "required": [
2598
+ "scope",
2599
+ "key",
2600
+ "mode"
2601
+ ],
2602
+ "properties": {
2603
+ "scope": {
2604
+ "type": "string"
2605
+ },
2606
+ "key": {
2607
+ "type": "string"
2608
+ },
2609
+ "mode": {
2610
+ "type": "string"
2611
+ }
2612
+ }
2613
+ }
2614
+ },
2615
+ "inDoubtEffects": {
2616
+ "type": "array",
2617
+ "items": {
2618
+ "type": "string",
2619
+ "pattern": "^eff_[0-9a-f]{32}$"
2620
+ }
2621
+ }
2622
+ }
2623
+ }
2624
+ }
2625
+ },
2626
+ {
2627
+ "type": "object",
2628
+ "required": [
2629
+ "documentVersion",
2630
+ "protocolVersion",
2631
+ "runId",
2632
+ "lastSequence",
2633
+ "kind",
2634
+ "locks"
2635
+ ],
2636
+ "properties": {
2637
+ "documentVersion": {
2638
+ "type": "number",
2639
+ "const": 1
2640
+ },
2641
+ "protocolVersion": {
2642
+ "type": "string",
2643
+ "const": "1.0"
2644
+ },
2645
+ "runId": {
2646
+ "type": "string",
2647
+ "pattern": "^run_[0-9a-f]{32}$"
2648
+ },
2649
+ "lastSequence": {
2650
+ "type": "integer",
2651
+ "minimum": 0
2652
+ },
2653
+ "kind": {
2654
+ "type": "string",
2655
+ "const": "locks"
2656
+ },
2657
+ "locks": {
2658
+ "type": "array",
2659
+ "items": {
2660
+ "type": "object",
2661
+ "required": [
2662
+ "scope",
2663
+ "key",
2664
+ "mode",
2665
+ "owner",
2666
+ "leaseExpiresAt"
2667
+ ],
2668
+ "properties": {
2669
+ "scope": {
2670
+ "type": "string"
2671
+ },
2672
+ "key": {
2673
+ "type": "string"
2674
+ },
2675
+ "mode": {
2676
+ "type": "string"
2677
+ },
2678
+ "owner": {
2679
+ "type": "string"
2680
+ },
2681
+ "leaseExpiresAt": {
2682
+ "type": "string",
2683
+ "format": "date-time",
2684
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"
2685
+ }
2686
+ }
2687
+ }
2688
+ }
2689
+ }
2690
+ },
2691
+ {
2692
+ "type": "object",
2693
+ "required": [
2694
+ "documentVersion",
2695
+ "protocolVersion",
2696
+ "runId",
2697
+ "lastSequence",
2698
+ "kind",
2699
+ "diff"
2700
+ ],
2701
+ "properties": {
2702
+ "documentVersion": {
2703
+ "type": "number",
2704
+ "const": 1
2705
+ },
2706
+ "protocolVersion": {
2707
+ "type": "string",
2708
+ "const": "1.0"
2709
+ },
2710
+ "runId": {
2711
+ "type": "string",
2712
+ "pattern": "^run_[0-9a-f]{32}$"
2713
+ },
2714
+ "lastSequence": {
2715
+ "type": "integer",
2716
+ "minimum": 0
2717
+ },
2718
+ "kind": {
2719
+ "type": "string",
2720
+ "const": "diff"
2721
+ },
2722
+ "diff": {
2723
+ "type": "object",
2724
+ "required": [
2725
+ "documentVersion",
2726
+ "runId",
2727
+ "base",
2728
+ "head",
2729
+ "surfaces"
2730
+ ],
2731
+ "properties": {
2732
+ "documentVersion": {
2733
+ "type": "number",
2734
+ "const": 1
2735
+ },
2736
+ "runId": {
2737
+ "type": "string",
2738
+ "pattern": "^run_[0-9a-f]{32}$"
2739
+ },
2740
+ "base": {
2741
+ "type": "object",
2742
+ "required": [
2743
+ "branch",
2744
+ "sha"
2745
+ ],
2746
+ "properties": {
2747
+ "branch": {
2748
+ "type": "string"
2749
+ },
2750
+ "sha": {
2751
+ "type": "string"
2752
+ }
2753
+ }
2754
+ },
2755
+ "head": {
2756
+ "type": "object",
2757
+ "required": [
2758
+ "branch",
2759
+ "sha",
2760
+ "treeDigest"
2761
+ ],
2762
+ "properties": {
2763
+ "branch": {
2764
+ "type": "string"
2765
+ },
2766
+ "sha": {
2767
+ "type": "string"
2768
+ },
2769
+ "treeDigest": {
2770
+ "type": "string"
2771
+ }
2772
+ }
2773
+ },
2774
+ "surfaces": {
2775
+ "type": "array",
2776
+ "items": {
2777
+ "type": "object",
2778
+ "required": [
2779
+ "surface",
2780
+ "files",
2781
+ "stat",
2782
+ "patch"
2783
+ ],
2784
+ "properties": {
2785
+ "surface": {
2786
+ "anyOf": [
2787
+ {
2788
+ "type": "string",
2789
+ "const": "shared"
2790
+ },
2791
+ {
2792
+ "type": "string",
2793
+ "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
2794
+ }
2795
+ ]
2796
+ },
2797
+ "files": {
2798
+ "type": "array",
2799
+ "items": {
2800
+ "type": "object",
2801
+ "required": [
2802
+ "path",
2803
+ "op"
2804
+ ],
2805
+ "properties": {
2806
+ "path": {
2807
+ "type": "string"
2808
+ },
2809
+ "op": {
2810
+ "type": "string",
2811
+ "enum": [
2812
+ "read",
2813
+ "create",
2814
+ "modify",
2815
+ "delete"
2816
+ ]
2817
+ },
2818
+ "beforeSha256": {
2819
+ "type": "string",
2820
+ "pattern": "^[0-9a-f]{64}$"
2821
+ },
2822
+ "afterSha256": {
2823
+ "type": "string",
2824
+ "pattern": "^[0-9a-f]{64}$"
2825
+ },
2826
+ "bytes": {
2827
+ "type": "integer",
2828
+ "minimum": 0
2829
+ }
2830
+ }
2831
+ }
2832
+ },
2833
+ "stat": {
2834
+ "type": "object",
2835
+ "required": [
2836
+ "added",
2837
+ "removed"
2838
+ ],
2839
+ "properties": {
2840
+ "added": {
2841
+ "type": "integer",
2842
+ "minimum": 0
2843
+ },
2844
+ "removed": {
2845
+ "type": "integer",
2846
+ "minimum": 0
2847
+ }
2848
+ }
2849
+ },
2850
+ "patch": {
2851
+ "type": "object",
2852
+ "required": [
2853
+ "artifactId",
2854
+ "kind",
2855
+ "path",
2856
+ "sha256",
2857
+ "bytes"
2858
+ ],
2859
+ "properties": {
2860
+ "artifactId": {
2861
+ "type": "string",
2862
+ "pattern": "^art_[0-9a-f]{32}$"
2863
+ },
2864
+ "kind": {
2865
+ "type": "string",
2866
+ "x-cohorte-known": [
2867
+ "diff",
2868
+ "file",
2869
+ "log",
2870
+ "report",
2871
+ "agent-output",
2872
+ "transcript",
2873
+ "context",
2874
+ "prompt",
2875
+ "patch"
2876
+ ]
2877
+ },
2878
+ "path": {
2879
+ "type": "string"
2880
+ },
2881
+ "sha256": {
2882
+ "type": "string",
2883
+ "pattern": "^[0-9a-f]{64}$"
2884
+ },
2885
+ "bytes": {
2886
+ "type": "integer",
2887
+ "minimum": 0
2888
+ }
2889
+ }
2890
+ }
2891
+ }
2892
+ }
2893
+ }
2894
+ }
2895
+ }
2896
+ }
2897
+ },
2898
+ {
2899
+ "type": "object",
2900
+ "required": [
2901
+ "documentVersion",
2902
+ "protocolVersion",
2903
+ "runId",
2904
+ "lastSequence",
2905
+ "kind",
2906
+ "artifact",
2907
+ "offset",
2908
+ "bytes",
2909
+ "truncated",
2910
+ "encoding",
2911
+ "content"
2912
+ ],
2913
+ "properties": {
2914
+ "documentVersion": {
2915
+ "type": "number",
2916
+ "const": 1
2917
+ },
2918
+ "protocolVersion": {
2919
+ "type": "string",
2920
+ "const": "1.0"
2921
+ },
2922
+ "runId": {
2923
+ "type": "string",
2924
+ "pattern": "^run_[0-9a-f]{32}$"
2925
+ },
2926
+ "lastSequence": {
2927
+ "type": "integer",
2928
+ "minimum": 0
2929
+ },
2930
+ "kind": {
2931
+ "type": "string",
2932
+ "const": "artifact"
2933
+ },
2934
+ "artifact": {
2935
+ "type": "object",
2936
+ "required": [
2937
+ "artifactId",
2938
+ "kind",
2939
+ "path",
2940
+ "sha256",
2941
+ "bytes"
2942
+ ],
2943
+ "properties": {
2944
+ "artifactId": {
2945
+ "type": "string",
2946
+ "pattern": "^art_[0-9a-f]{32}$"
2947
+ },
2948
+ "kind": {
2949
+ "type": "string",
2950
+ "x-cohorte-known": [
2951
+ "diff",
2952
+ "file",
2953
+ "log",
2954
+ "report",
2955
+ "agent-output",
2956
+ "transcript",
2957
+ "context",
2958
+ "prompt",
2959
+ "patch"
2960
+ ]
2961
+ },
2962
+ "path": {
2963
+ "type": "string"
2964
+ },
2965
+ "sha256": {
2966
+ "type": "string",
2967
+ "pattern": "^[0-9a-f]{64}$"
2968
+ },
2969
+ "bytes": {
2970
+ "type": "integer",
2971
+ "minimum": 0
2972
+ }
2973
+ }
2974
+ },
2975
+ "offset": {
2976
+ "type": "integer",
2977
+ "minimum": 0
2978
+ },
2979
+ "bytes": {
2980
+ "type": "integer",
2981
+ "minimum": 0,
2982
+ "maximum": 3145728
2983
+ },
2984
+ "truncated": {
2985
+ "type": "boolean"
2986
+ },
2987
+ "encoding": {
2988
+ "type": "string",
2989
+ "enum": [
2990
+ "utf8",
2991
+ "base64"
2992
+ ]
2993
+ },
2994
+ "content": {
2995
+ "type": "string",
2996
+ "maxLength": 4194304
2997
+ }
2998
+ }
2999
+ }
3000
+ ],
3001
+ "$defs": {
3002
+ "JsonValue": {
3003
+ "anyOf": [
3004
+ {
3005
+ "type": "null"
3006
+ },
3007
+ {
3008
+ "type": "boolean"
3009
+ },
3010
+ {
3011
+ "type": "number"
3012
+ },
3013
+ {
3014
+ "type": "string"
3015
+ },
3016
+ {
3017
+ "type": "array",
3018
+ "items": {
3019
+ "$ref": "#/$defs/JsonValue"
3020
+ }
3021
+ },
3022
+ {
3023
+ "type": "object",
3024
+ "patternProperties": {
3025
+ "^.*$": {
3026
+ "$ref": "#/$defs/JsonValue"
3027
+ }
3028
+ }
3029
+ }
3030
+ ]
3031
+ },
3032
+ "ErrorInfo": {
3033
+ "type": "object",
3034
+ "required": [
3035
+ "code",
3036
+ "class",
3037
+ "message",
3038
+ "impact",
3039
+ "retryable",
3040
+ "remediation"
3041
+ ],
3042
+ "properties": {
3043
+ "code": {
3044
+ "type": "string",
3045
+ "pattern": "^[a-z]+(?:-[a-z]+)*/[a-z0-9]+(?:-[a-z0-9]+)*$"
3046
+ },
3047
+ "class": {
3048
+ "anyOf": [
3049
+ {
3050
+ "type": "string",
3051
+ "const": "configuration"
3052
+ },
3053
+ {
3054
+ "type": "string",
3055
+ "const": "validation"
3056
+ },
3057
+ {
3058
+ "type": "string",
3059
+ "const": "permission"
3060
+ },
3061
+ {
3062
+ "type": "string",
3063
+ "const": "security"
3064
+ },
3065
+ {
3066
+ "type": "string",
3067
+ "const": "provider-transient"
3068
+ },
3069
+ {
3070
+ "type": "string",
3071
+ "const": "provider-terminal"
3072
+ },
3073
+ {
3074
+ "type": "string",
3075
+ "const": "tool-transient"
3076
+ },
3077
+ {
3078
+ "type": "string",
3079
+ "const": "tool-terminal"
3080
+ },
3081
+ {
3082
+ "type": "string",
3083
+ "const": "conflict"
3084
+ },
3085
+ {
3086
+ "type": "string",
3087
+ "const": "budget"
3088
+ },
3089
+ {
3090
+ "type": "string",
3091
+ "const": "timeout"
3092
+ },
3093
+ {
3094
+ "type": "string",
3095
+ "const": "corruption"
3096
+ },
3097
+ {
3098
+ "type": "string",
3099
+ "const": "human-required"
3100
+ }
3101
+ ]
3102
+ },
3103
+ "message": {
3104
+ "type": "string"
3105
+ },
3106
+ "impact": {
3107
+ "type": "string"
3108
+ },
3109
+ "retryable": {
3110
+ "type": "boolean"
3111
+ },
3112
+ "retryAfterMs": {
3113
+ "type": "number",
3114
+ "minimum": 0
3115
+ },
3116
+ "remediation": {
3117
+ "type": "string"
3118
+ },
3119
+ "cause": {
3120
+ "$ref": "#/$defs/ErrorInfo"
3121
+ },
3122
+ "details": {
3123
+ "type": "object",
3124
+ "patternProperties": {
3125
+ "^.*$": {
3126
+ "$ref": "#/$defs/JsonValue"
3127
+ }
3128
+ }
3129
+ }
3130
+ }
3131
+ }
3132
+ }
3133
+ }