@kbediako/codex-orchestrator 0.1.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 (150) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +238 -0
  3. package/dist/bin/codex-orchestrator.js +507 -0
  4. package/dist/orchestrator/src/agents/builder.js +16 -0
  5. package/dist/orchestrator/src/agents/index.js +4 -0
  6. package/dist/orchestrator/src/agents/planner.js +17 -0
  7. package/dist/orchestrator/src/agents/reviewer.js +13 -0
  8. package/dist/orchestrator/src/agents/tester.js +13 -0
  9. package/dist/orchestrator/src/cli/adapters/CommandBuilder.js +20 -0
  10. package/dist/orchestrator/src/cli/adapters/CommandPlanner.js +164 -0
  11. package/dist/orchestrator/src/cli/adapters/CommandReviewer.js +32 -0
  12. package/dist/orchestrator/src/cli/adapters/CommandTester.js +33 -0
  13. package/dist/orchestrator/src/cli/adapters/index.js +4 -0
  14. package/dist/orchestrator/src/cli/config/userConfig.js +28 -0
  15. package/dist/orchestrator/src/cli/doctor.js +48 -0
  16. package/dist/orchestrator/src/cli/events/runEvents.js +84 -0
  17. package/dist/orchestrator/src/cli/exec/command.js +56 -0
  18. package/dist/orchestrator/src/cli/exec/context.js +108 -0
  19. package/dist/orchestrator/src/cli/exec/experience.js +77 -0
  20. package/dist/orchestrator/src/cli/exec/finalization.js +140 -0
  21. package/dist/orchestrator/src/cli/exec/learning.js +62 -0
  22. package/dist/orchestrator/src/cli/exec/stageRunner.js +71 -0
  23. package/dist/orchestrator/src/cli/exec/summary.js +109 -0
  24. package/dist/orchestrator/src/cli/exec/telemetry.js +18 -0
  25. package/dist/orchestrator/src/cli/exec/tfgrpo.js +200 -0
  26. package/dist/orchestrator/src/cli/exec/tfgrpoArtifacts.js +19 -0
  27. package/dist/orchestrator/src/cli/exec/types.js +1 -0
  28. package/dist/orchestrator/src/cli/init.js +64 -0
  29. package/dist/orchestrator/src/cli/mcp.js +124 -0
  30. package/dist/orchestrator/src/cli/metrics/metricsAggregator.js +404 -0
  31. package/dist/orchestrator/src/cli/metrics/metricsRecorder.js +138 -0
  32. package/dist/orchestrator/src/cli/orchestrator.js +554 -0
  33. package/dist/orchestrator/src/cli/pipelines/defaultDiagnostics.js +32 -0
  34. package/dist/orchestrator/src/cli/pipelines/designReference.js +72 -0
  35. package/dist/orchestrator/src/cli/pipelines/hiFiDesignToolkit.js +71 -0
  36. package/dist/orchestrator/src/cli/pipelines/index.js +34 -0
  37. package/dist/orchestrator/src/cli/run/environment.js +24 -0
  38. package/dist/orchestrator/src/cli/run/manifest.js +367 -0
  39. package/dist/orchestrator/src/cli/run/manifestPersister.js +88 -0
  40. package/dist/orchestrator/src/cli/run/runPaths.js +30 -0
  41. package/dist/orchestrator/src/cli/selfCheck.js +12 -0
  42. package/dist/orchestrator/src/cli/services/commandRunner.js +420 -0
  43. package/dist/orchestrator/src/cli/services/controlPlaneService.js +107 -0
  44. package/dist/orchestrator/src/cli/services/execRuntime.js +69 -0
  45. package/dist/orchestrator/src/cli/services/pipelineResolver.js +47 -0
  46. package/dist/orchestrator/src/cli/services/runPreparation.js +82 -0
  47. package/dist/orchestrator/src/cli/services/runSummaryWriter.js +35 -0
  48. package/dist/orchestrator/src/cli/services/schedulerService.js +42 -0
  49. package/dist/orchestrator/src/cli/tasks/taskMetadata.js +19 -0
  50. package/dist/orchestrator/src/cli/telemetry/schema.js +8 -0
  51. package/dist/orchestrator/src/cli/types.js +1 -0
  52. package/dist/orchestrator/src/cli/ui/HudApp.js +112 -0
  53. package/dist/orchestrator/src/cli/ui/controller.js +26 -0
  54. package/dist/orchestrator/src/cli/ui/store.js +240 -0
  55. package/dist/orchestrator/src/cli/utils/enforcementMode.js +12 -0
  56. package/dist/orchestrator/src/cli/utils/fs.js +8 -0
  57. package/dist/orchestrator/src/cli/utils/interactive.js +25 -0
  58. package/dist/orchestrator/src/cli/utils/jsonlWriter.js +10 -0
  59. package/dist/orchestrator/src/cli/utils/optionalDeps.js +30 -0
  60. package/dist/orchestrator/src/cli/utils/packageInfo.js +25 -0
  61. package/dist/orchestrator/src/cli/utils/planFormatter.js +49 -0
  62. package/dist/orchestrator/src/cli/utils/runId.js +7 -0
  63. package/dist/orchestrator/src/cli/utils/specGuardRunner.js +26 -0
  64. package/dist/orchestrator/src/cli/utils/strings.js +8 -0
  65. package/dist/orchestrator/src/cli/utils/time.js +6 -0
  66. package/dist/orchestrator/src/control-plane/drift-reporter.js +109 -0
  67. package/dist/orchestrator/src/control-plane/index.js +3 -0
  68. package/dist/orchestrator/src/control-plane/request-builder.js +217 -0
  69. package/dist/orchestrator/src/control-plane/types.js +1 -0
  70. package/dist/orchestrator/src/control-plane/validator.js +50 -0
  71. package/dist/orchestrator/src/credentials/CredentialBroker.js +1 -0
  72. package/dist/orchestrator/src/events/EventBus.js +25 -0
  73. package/dist/orchestrator/src/learning/crystalizer.js +108 -0
  74. package/dist/orchestrator/src/learning/harvester.js +146 -0
  75. package/dist/orchestrator/src/learning/manifest.js +56 -0
  76. package/dist/orchestrator/src/learning/runner.js +177 -0
  77. package/dist/orchestrator/src/learning/validator.js +164 -0
  78. package/dist/orchestrator/src/logger.js +20 -0
  79. package/dist/orchestrator/src/manager.js +388 -0
  80. package/dist/orchestrator/src/persistence/ArtifactStager.js +95 -0
  81. package/dist/orchestrator/src/persistence/ExperienceStore.js +210 -0
  82. package/dist/orchestrator/src/persistence/PersistenceCoordinator.js +65 -0
  83. package/dist/orchestrator/src/persistence/RunManifestWriter.js +23 -0
  84. package/dist/orchestrator/src/persistence/TaskStateStore.js +172 -0
  85. package/dist/orchestrator/src/persistence/identifierGuards.js +1 -0
  86. package/dist/orchestrator/src/persistence/lockFile.js +26 -0
  87. package/dist/orchestrator/src/persistence/sanitizeIdentifier.js +26 -0
  88. package/dist/orchestrator/src/persistence/sanitizeRunId.js +8 -0
  89. package/dist/orchestrator/src/persistence/sanitizeTaskId.js +8 -0
  90. package/dist/orchestrator/src/persistence/writeAtomicFile.js +4 -0
  91. package/dist/orchestrator/src/privacy/guard.js +111 -0
  92. package/dist/orchestrator/src/scheduler/index.js +1 -0
  93. package/dist/orchestrator/src/scheduler/plan.js +171 -0
  94. package/dist/orchestrator/src/scheduler/types.js +1 -0
  95. package/dist/orchestrator/src/sync/CloudRunsClient.js +1 -0
  96. package/dist/orchestrator/src/sync/CloudRunsHttpClient.js +82 -0
  97. package/dist/orchestrator/src/sync/CloudSyncWorker.js +206 -0
  98. package/dist/orchestrator/src/sync/createCloudSyncWorker.js +15 -0
  99. package/dist/orchestrator/src/types.js +1 -0
  100. package/dist/orchestrator/src/utils/atomicWrite.js +15 -0
  101. package/dist/orchestrator/src/utils/errorMessage.js +14 -0
  102. package/dist/orchestrator/src/utils/executionMode.js +69 -0
  103. package/dist/packages/control-plane-schemas/src/index.js +1 -0
  104. package/dist/packages/control-plane-schemas/src/run-request.js +548 -0
  105. package/dist/packages/orchestrator/src/exec/handle-service.js +203 -0
  106. package/dist/packages/orchestrator/src/exec/session-manager.js +147 -0
  107. package/dist/packages/orchestrator/src/exec/unified-exec.js +432 -0
  108. package/dist/packages/orchestrator/src/index.js +3 -0
  109. package/dist/packages/orchestrator/src/instructions/loader.js +101 -0
  110. package/dist/packages/orchestrator/src/instructions/promptPacks.js +151 -0
  111. package/dist/packages/orchestrator/src/notifications/index.js +74 -0
  112. package/dist/packages/orchestrator/src/telemetry/otel-exporter.js +142 -0
  113. package/dist/packages/orchestrator/src/tool-orchestrator.js +161 -0
  114. package/dist/packages/sdk-node/src/orchestrator.js +195 -0
  115. package/dist/packages/shared/config/designConfig.js +495 -0
  116. package/dist/packages/shared/config/env.js +37 -0
  117. package/dist/packages/shared/config/index.js +2 -0
  118. package/dist/packages/shared/design-artifacts/writer.js +221 -0
  119. package/dist/packages/shared/events/serializer.js +84 -0
  120. package/dist/packages/shared/events/types.js +1 -0
  121. package/dist/packages/shared/manifest/artifactUtils.js +36 -0
  122. package/dist/packages/shared/manifest/designArtifacts.js +665 -0
  123. package/dist/packages/shared/manifest/fileIO.js +29 -0
  124. package/dist/packages/shared/manifest/toolRuns.js +78 -0
  125. package/dist/packages/shared/manifest/toolkitArtifacts.js +223 -0
  126. package/dist/packages/shared/manifest/types.js +5 -0
  127. package/dist/packages/shared/manifest/validator.js +73 -0
  128. package/dist/packages/shared/manifest/writer.js +2 -0
  129. package/dist/packages/shared/streams/stdio.js +112 -0
  130. package/dist/scripts/design/pipeline/advanced-assets.js +466 -0
  131. package/dist/scripts/design/pipeline/componentize.js +74 -0
  132. package/dist/scripts/design/pipeline/context.js +34 -0
  133. package/dist/scripts/design/pipeline/extract.js +249 -0
  134. package/dist/scripts/design/pipeline/optionalDeps.js +107 -0
  135. package/dist/scripts/design/pipeline/prepare.js +46 -0
  136. package/dist/scripts/design/pipeline/reference.js +94 -0
  137. package/dist/scripts/design/pipeline/state.js +206 -0
  138. package/dist/scripts/design/pipeline/toolkit/common.js +94 -0
  139. package/dist/scripts/design/pipeline/toolkit/extract.js +258 -0
  140. package/dist/scripts/design/pipeline/toolkit/publish.js +202 -0
  141. package/dist/scripts/design/pipeline/toolkit/publishActions.js +12 -0
  142. package/dist/scripts/design/pipeline/toolkit/reference.js +846 -0
  143. package/dist/scripts/design/pipeline/toolkit/snapshot.js +882 -0
  144. package/dist/scripts/design/pipeline/toolkit/tokens.js +456 -0
  145. package/dist/scripts/design/pipeline/visual-regression.js +137 -0
  146. package/dist/scripts/design/pipeline/write-artifacts.js +61 -0
  147. package/package.json +97 -0
  148. package/schemas/manifest.json +1064 -0
  149. package/templates/README.md +12 -0
  150. package/templates/codex/mcp-client.json +8 -0
@@ -0,0 +1,1064 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://schemas.codex.openai.com/orchestrator/cli-manifest.json",
4
+ "title": "Codex Orchestrator CLI Manifest",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "version",
9
+ "task_id",
10
+ "task_slug",
11
+ "run_id",
12
+ "parent_run_id",
13
+ "pipeline_id",
14
+ "pipeline_title",
15
+ "runner",
16
+ "approval_policy",
17
+ "status",
18
+ "status_detail",
19
+ "started_at",
20
+ "completed_at",
21
+ "updated_at",
22
+ "heartbeat_at",
23
+ "heartbeat_interval_seconds",
24
+ "heartbeat_stale_after_seconds",
25
+ "artifact_root",
26
+ "compat_path",
27
+ "log_path",
28
+ "summary",
29
+ "metrics_recorded",
30
+ "resume_token",
31
+ "resume_events",
32
+ "approvals",
33
+ "commands",
34
+ "child_runs",
35
+ "run_summary_path",
36
+ "plan_target_id",
37
+ "instructions_hash",
38
+ "instructions_sources"
39
+ ],
40
+ "properties": {
41
+ "version": { "type": "integer", "minimum": 1 },
42
+ "task_id": { "type": "string", "minLength": 1 },
43
+ "task_slug": { "type": ["string", "null"] },
44
+ "run_id": { "type": "string", "minLength": 1 },
45
+ "parent_run_id": { "type": ["string", "null"] },
46
+ "pipeline_id": { "type": "string", "minLength": 1 },
47
+ "pipeline_title": { "type": "string", "minLength": 1 },
48
+ "runner": { "type": "string", "const": "codex-cli" },
49
+ "approval_policy": { "type": ["string", "null"] },
50
+ "status": { "type": "string", "enum": ["queued", "in_progress", "succeeded", "failed", "cancelled"] },
51
+ "status_detail": { "type": ["string", "null"] },
52
+ "started_at": { "type": "string", "minLength": 1 },
53
+ "completed_at": { "type": ["string", "null"] },
54
+ "updated_at": { "type": "string", "minLength": 1 },
55
+ "heartbeat_at": { "type": ["string", "null"] },
56
+ "heartbeat_interval_seconds": { "type": "integer", "minimum": 1 },
57
+ "heartbeat_stale_after_seconds": { "type": "integer", "minimum": 1 },
58
+ "artifact_root": { "type": "string", "minLength": 1 },
59
+ "compat_path": { "type": "string", "minLength": 1 },
60
+ "log_path": { "type": "string", "minLength": 1 },
61
+ "summary": { "type": ["string", "null"] },
62
+ "metrics_recorded": { "type": "boolean" },
63
+ "resume_token": { "type": "string", "minLength": 1 },
64
+ "resume_events": {
65
+ "type": "array",
66
+ "items": {
67
+ "type": "object",
68
+ "required": ["timestamp", "actor", "reason", "outcome"],
69
+ "additionalProperties": false,
70
+ "properties": {
71
+ "timestamp": { "type": "string", "minLength": 1 },
72
+ "actor": { "type": "string", "minLength": 1 },
73
+ "reason": { "type": "string", "minLength": 1 },
74
+ "outcome": { "type": "string", "enum": ["accepted", "blocked"] },
75
+ "detail": { "type": ["string", "null"] }
76
+ }
77
+ }
78
+ },
79
+ "approvals": {
80
+ "type": "array",
81
+ "items": {
82
+ "type": "object",
83
+ "required": ["actor", "timestamp"],
84
+ "additionalProperties": false,
85
+ "properties": {
86
+ "actor": { "type": "string", "minLength": 1 },
87
+ "timestamp": { "type": "string", "minLength": 1 },
88
+ "reason": { "type": ["string", "null"] }
89
+ }
90
+ }
91
+ },
92
+ "handles": {
93
+ "type": ["array", "null"],
94
+ "items": {
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "required": [
98
+ "handle_id",
99
+ "correlation_id",
100
+ "stage_id",
101
+ "pipeline_id",
102
+ "status",
103
+ "frame_count",
104
+ "latest_sequence",
105
+ "created_at"
106
+ ],
107
+ "properties": {
108
+ "handle_id": { "type": "string", "minLength": 1 },
109
+ "correlation_id": { "type": "string", "minLength": 1 },
110
+ "stage_id": { "type": ["string", "null"] },
111
+ "pipeline_id": { "type": "string", "minLength": 1 },
112
+ "status": { "type": "string", "enum": ["open", "closed"] },
113
+ "frame_count": { "type": "integer", "minimum": 0 },
114
+ "latest_sequence": { "type": "integer", "minimum": 0 },
115
+ "created_at": { "type": "string", "minLength": 1 },
116
+ "metadata": { "type": ["object", "null"] }
117
+ }
118
+ }
119
+ },
120
+ "commands": {
121
+ "type": "array",
122
+ "items": {
123
+ "type": "object",
124
+ "required": [
125
+ "index",
126
+ "id",
127
+ "title",
128
+ "command",
129
+ "kind",
130
+ "status",
131
+ "started_at",
132
+ "completed_at",
133
+ "exit_code",
134
+ "summary",
135
+ "log_path",
136
+ "error_file",
137
+ "sub_run_id"
138
+ ],
139
+ "additionalProperties": false,
140
+ "properties": {
141
+ "index": { "type": "integer", "minimum": 1 },
142
+ "id": { "type": "string", "minLength": 1 },
143
+ "title": { "type": "string", "minLength": 1 },
144
+ "command": { "type": ["string", "null"] },
145
+ "kind": { "type": "string", "enum": ["command", "subpipeline"] },
146
+ "status": { "type": "string", "enum": ["pending", "running", "succeeded", "failed", "skipped"] },
147
+ "started_at": { "type": ["string", "null"] },
148
+ "completed_at": { "type": ["string", "null"] },
149
+ "exit_code": { "type": ["integer", "null"] },
150
+ "summary": { "type": ["string", "null"] },
151
+ "log_path": { "type": ["string", "null"] },
152
+ "error_file": { "type": ["string", "null"] },
153
+ "sub_run_id": { "type": ["string", "null"] }
154
+ }
155
+ }
156
+ },
157
+ "child_runs": {
158
+ "type": "array",
159
+ "items": {
160
+ "type": "object",
161
+ "required": ["run_id", "pipeline_id", "status", "manifest"],
162
+ "additionalProperties": false,
163
+ "properties": {
164
+ "run_id": { "type": "string", "minLength": 1 },
165
+ "pipeline_id": { "type": "string", "minLength": 1 },
166
+ "status": { "type": "string", "enum": ["queued", "in_progress", "succeeded", "failed", "cancelled"] },
167
+ "manifest": { "type": "string", "minLength": 1 }
168
+ }
169
+ }
170
+ },
171
+ "run_summary_path": { "type": ["string", "null"] },
172
+ "plan_target_id": { "type": ["string", "null"] },
173
+ "control_plane": {
174
+ "type": ["object", "null"],
175
+ "additionalProperties": false,
176
+ "required": ["schema_id", "schema_version", "request_id", "validation"],
177
+ "properties": {
178
+ "schema_id": { "type": "string", "minLength": 1 },
179
+ "schema_version": { "type": "string", "minLength": 1 },
180
+ "request_id": { "type": "string", "minLength": 1 },
181
+ "validation": {
182
+ "type": "object",
183
+ "additionalProperties": false,
184
+ "required": ["mode", "status", "timestamp", "errors"],
185
+ "properties": {
186
+ "mode": { "type": "string", "enum": ["shadow", "enforce"] },
187
+ "status": { "type": "string", "enum": ["passed", "failed"] },
188
+ "timestamp": { "type": "string", "minLength": 1 },
189
+ "errors": {
190
+ "type": "array",
191
+ "items": {
192
+ "type": "object",
193
+ "additionalProperties": false,
194
+ "required": ["path", "message"],
195
+ "properties": {
196
+ "path": { "type": "string", "minLength": 1 },
197
+ "message": { "type": "string", "minLength": 1 },
198
+ "value": {},
199
+ "expected": { "type": ["string", "null"] }
200
+ }
201
+ }
202
+ }
203
+ }
204
+ },
205
+ "drift": {
206
+ "type": ["object", "null"],
207
+ "additionalProperties": false,
208
+ "required": ["report_path", "total_samples", "invalid_samples", "invalid_rate", "last_sampled_at", "mode"],
209
+ "properties": {
210
+ "report_path": { "type": ["string", "null"] },
211
+ "total_samples": { "type": "integer", "minimum": 0 },
212
+ "invalid_samples": { "type": "integer", "minimum": 0 },
213
+ "invalid_rate": { "type": "number", "minimum": 0 },
214
+ "last_sampled_at": { "type": ["string", "null"] },
215
+ "mode": { "type": "string", "enum": ["shadow", "enforce"] }
216
+ }
217
+ },
218
+ "enforcement": {
219
+ "type": ["object", "null"],
220
+ "additionalProperties": false,
221
+ "required": ["enabled", "activated_at"],
222
+ "properties": {
223
+ "enabled": { "type": "boolean" },
224
+ "activated_at": { "type": ["string", "null"] }
225
+ }
226
+ }
227
+ }
228
+ },
229
+ "guardrails_required": { "type": ["boolean", "null"] },
230
+ "scheduler": {
231
+ "type": ["object", "null"],
232
+ "additionalProperties": false,
233
+ "required": ["mode", "requested_at", "min_instances", "max_instances", "recovery", "assignments"],
234
+ "properties": {
235
+ "mode": { "type": "string", "const": "multi-instance" },
236
+ "requested_at": { "type": "string", "minLength": 1 },
237
+ "min_instances": { "type": "integer", "minimum": 1 },
238
+ "max_instances": { "type": "integer", "minimum": 1 },
239
+ "recovery": {
240
+ "type": "object",
241
+ "additionalProperties": false,
242
+ "required": ["heartbeat_interval_seconds", "missing_heartbeat_timeout_seconds", "max_retries"],
243
+ "properties": {
244
+ "heartbeat_interval_seconds": { "type": "integer", "minimum": 1 },
245
+ "missing_heartbeat_timeout_seconds": { "type": "integer", "minimum": 1 },
246
+ "max_retries": { "type": "integer", "minimum": 0 }
247
+ }
248
+ },
249
+ "assignments": {
250
+ "type": "array",
251
+ "items": {
252
+ "type": "object",
253
+ "additionalProperties": false,
254
+ "required": ["instance_id", "capability", "status", "assigned_at", "completed_at", "metadata", "attempts"],
255
+ "properties": {
256
+ "instance_id": { "type": "string", "minLength": 1 },
257
+ "capability": { "type": "string", "minLength": 1 },
258
+ "status": {
259
+ "type": "string",
260
+ "enum": ["assigned", "running", "succeeded", "failed", "recovered"]
261
+ },
262
+ "assigned_at": { "type": "string", "minLength": 1 },
263
+ "completed_at": { "type": ["string", "null"] },
264
+ "metadata": {
265
+ "type": "object",
266
+ "additionalProperties": false,
267
+ "required": ["weight", "maxConcurrency"],
268
+ "properties": {
269
+ "weight": { "type": "number", "minimum": 0 },
270
+ "maxConcurrency": { "type": "integer", "minimum": 1 }
271
+ }
272
+ },
273
+ "attempts": {
274
+ "type": "array",
275
+ "items": {
276
+ "type": "object",
277
+ "additionalProperties": false,
278
+ "required": ["number", "assigned_at", "started_at", "completed_at", "status", "recovery_checkpoints"],
279
+ "properties": {
280
+ "number": { "type": "integer", "minimum": 1 },
281
+ "assigned_at": { "type": "string", "minLength": 1 },
282
+ "started_at": { "type": ["string", "null"] },
283
+ "completed_at": { "type": ["string", "null"] },
284
+ "status": {
285
+ "type": "string",
286
+ "enum": ["pending", "running", "completed", "failed", "requeued"]
287
+ },
288
+ "recovery_checkpoints": {
289
+ "type": "array",
290
+ "items": {
291
+ "type": "object",
292
+ "additionalProperties": false,
293
+ "required": ["timestamp", "reason", "action"],
294
+ "properties": {
295
+ "timestamp": { "type": "string", "minLength": 1 },
296
+ "reason": {
297
+ "type": "string",
298
+ "enum": ["missed-heartbeat", "manual", "auto"]
299
+ },
300
+ "action": {
301
+ "type": "string",
302
+ "enum": ["requeue", "escalate", "ack"]
303
+ },
304
+ "detail": { "type": ["string", "null"] }
305
+ }
306
+ }
307
+ }
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }
313
+ }
314
+ }
315
+ },
316
+ "privacy": {
317
+ "type": ["object", "null"],
318
+ "additionalProperties": false,
319
+ "required": ["mode", "decisions", "totals"],
320
+ "properties": {
321
+ "mode": { "type": "string", "enum": ["shadow", "enforce"] },
322
+ "decisions": {
323
+ "type": "array",
324
+ "items": {
325
+ "type": "object",
326
+ "additionalProperties": false,
327
+ "required": ["handle_id", "sequence", "action", "timestamp", "stage_id"],
328
+ "properties": {
329
+ "handle_id": { "type": "string", "minLength": 1 },
330
+ "sequence": { "type": "integer", "minimum": 0 },
331
+ "action": { "type": "string", "enum": ["allow", "redact", "block"] },
332
+ "rule": { "type": ["string", "null"] },
333
+ "reason": { "type": ["string", "null"] },
334
+ "timestamp": { "type": "string", "minLength": 1 },
335
+ "stage_id": { "type": ["string", "null"] }
336
+ }
337
+ }
338
+ },
339
+ "totals": {
340
+ "type": "object",
341
+ "additionalProperties": false,
342
+ "required": ["total_frames", "redacted_frames", "blocked_frames", "allowed_frames"],
343
+ "properties": {
344
+ "total_frames": { "type": "integer", "minimum": 0 },
345
+ "redacted_frames": { "type": "integer", "minimum": 0 },
346
+ "blocked_frames": { "type": "integer", "minimum": 0 },
347
+ "allowed_frames": { "type": "integer", "minimum": 0 }
348
+ }
349
+ },
350
+ "log_path": { "type": ["string", "null"] }
351
+ }
352
+ },
353
+ "instructions_hash": { "type": ["string", "null"] },
354
+ "instructions_sources": {
355
+ "type": "array",
356
+ "items": { "type": "string", "minLength": 1 }
357
+ },
358
+ "prompt_packs": {
359
+ "type": ["array", "null"],
360
+ "items": {
361
+ "type": "object",
362
+ "required": ["id", "domain", "stamp", "experience_slots", "sources"],
363
+ "additionalProperties": false,
364
+ "properties": {
365
+ "id": { "type": "string", "minLength": 1 },
366
+ "domain": { "type": "string", "minLength": 1 },
367
+ "stamp": { "type": "string", "minLength": 1 },
368
+ "experience_slots": { "type": "integer", "minimum": 0 },
369
+ "sources": {
370
+ "type": "array",
371
+ "items": { "type": "string", "minLength": 1 }
372
+ },
373
+ "experiences": {
374
+ "type": ["array", "null"],
375
+ "items": { "type": "string", "minLength": 1 }
376
+ }
377
+ }
378
+ }
379
+ },
380
+ "tfgrpo": {
381
+ "type": ["object", "null"],
382
+ "additionalProperties": false,
383
+ "properties": {
384
+ "epoch": { "type": ["integer", "null"] },
385
+ "group_id": { "type": ["string", "null"] },
386
+ "group_size": { "type": ["integer", "null"], "minimum": 0 },
387
+ "tool_metrics": {
388
+ "type": ["object", "null"],
389
+ "additionalProperties": false,
390
+ "required": ["tool_calls", "token_total", "cost_usd", "latency_ms", "per_tool"],
391
+ "properties": {
392
+ "tool_calls": { "type": "integer", "minimum": 0 },
393
+ "token_total": { "type": "number", "minimum": 0 },
394
+ "cost_usd": { "type": "number", "minimum": 0 },
395
+ "latency_ms": { "type": "number", "minimum": 0 },
396
+ "per_tool": {
397
+ "type": "array",
398
+ "items": {
399
+ "type": "object",
400
+ "required": [
401
+ "tool",
402
+ "tokens",
403
+ "cost_usd",
404
+ "latency_ms",
405
+ "attempts",
406
+ "status",
407
+ "sandbox_state"
408
+ ],
409
+ "additionalProperties": false,
410
+ "properties": {
411
+ "tool": { "type": "string", "minLength": 1 },
412
+ "tokens": { "type": "number", "minimum": 0 },
413
+ "cost_usd": { "type": "number", "minimum": 0 },
414
+ "latency_ms": { "type": "number", "minimum": 0 },
415
+ "attempts": { "type": "integer", "minimum": 1 },
416
+ "status": { "type": "string", "enum": ["succeeded", "failed"] },
417
+ "sandbox_state": { "type": "string", "enum": ["sandboxed", "escalated", "failed"] }
418
+ }
419
+ }
420
+ }
421
+ }
422
+ },
423
+ "experiences": {
424
+ "type": ["object", "null"],
425
+ "additionalProperties": false,
426
+ "required": ["ids", "written", "manifest_path"],
427
+ "properties": {
428
+ "ids": {
429
+ "type": "array",
430
+ "items": { "type": "string", "minLength": 1 }
431
+ },
432
+ "written": { "type": "integer", "minimum": 0 },
433
+ "manifest_path": { "type": ["string", "null"] }
434
+ }
435
+ }
436
+ }
437
+ },
438
+ "learning": {
439
+ "type": ["object", "null"],
440
+ "additionalProperties": false,
441
+ "properties": {
442
+ "snapshot": {
443
+ "type": ["object", "null"],
444
+ "additionalProperties": false,
445
+ "required": [
446
+ "tag",
447
+ "commit_sha",
448
+ "tarball_path",
449
+ "tarball_digest",
450
+ "storage_path",
451
+ "retention_days",
452
+ "status",
453
+ "attempts",
454
+ "created_at"
455
+ ],
456
+ "properties": {
457
+ "tag": { "type": "string", "minLength": 1 },
458
+ "commit_sha": { "type": "string", "minLength": 1 },
459
+ "tarball_path": { "type": "string", "minLength": 1 },
460
+ "tarball_digest": { "type": "string", "minLength": 1 },
461
+ "storage_path": { "type": "string", "minLength": 1 },
462
+ "retention_days": { "type": "integer", "minimum": 1 },
463
+ "status": { "type": "string", "enum": ["pending", "captured", "snapshot_failed", "stalled_snapshot"] },
464
+ "attempts": { "type": "integer", "minimum": 0 },
465
+ "created_at": { "type": "string", "minLength": 1 },
466
+ "last_error": { "type": ["string", "null"] },
467
+ "git_status_path": { "type": ["string", "null"] },
468
+ "git_log_path": { "type": ["string", "null"] }
469
+ }
470
+ },
471
+ "queue": {
472
+ "type": ["object", "null"],
473
+ "additionalProperties": false,
474
+ "required": ["snapshot_id", "manifest_path", "enqueued_at", "payload_path", "status"],
475
+ "properties": {
476
+ "snapshot_id": { "type": "string", "minLength": 1 },
477
+ "diff_path": { "type": ["string", "null"] },
478
+ "prompt_path": { "type": ["string", "null"] },
479
+ "execution_history_path": { "type": ["string", "null"] },
480
+ "manifest_path": { "type": "string", "minLength": 1 },
481
+ "enqueued_at": { "type": "string", "minLength": 1 },
482
+ "payload_path": { "type": "string", "minLength": 1 },
483
+ "status": { "type": "string", "enum": ["queued", "failed"] }
484
+ }
485
+ },
486
+ "scenario": {
487
+ "type": ["object", "null"],
488
+ "additionalProperties": false,
489
+ "required": ["path", "generated_at", "source", "status", "attempts"],
490
+ "properties": {
491
+ "path": { "type": ["string", "null"] },
492
+ "generated_at": { "type": ["string", "null"] },
493
+ "source": { "type": "string", "enum": ["execution_history", "prompt", "diff", "template", "manual"] },
494
+ "status": { "type": "string", "enum": ["pending", "synthesized", "needs_manual_scenario"] },
495
+ "attempts": { "type": "integer", "minimum": 0 },
496
+ "partial_path": { "type": ["string", "null"] },
497
+ "manual_template": { "type": ["string", "null"] },
498
+ "approver": { "type": ["string", "null"] },
499
+ "reason": { "type": ["string", "null"] }
500
+ }
501
+ },
502
+ "validation": {
503
+ "type": ["object", "null"],
504
+ "additionalProperties": false,
505
+ "properties": {
506
+ "mode": { "type": "string", "enum": ["per-task", "grouped"] },
507
+ "grouping": {
508
+ "type": ["object", "null"],
509
+ "additionalProperties": false,
510
+ "required": ["id", "members"],
511
+ "properties": {
512
+ "id": { "type": "string", "minLength": 1 },
513
+ "members": { "type": "array", "items": { "type": "string", "minLength": 1 } },
514
+ "window_hours": { "type": ["number", "null"] }
515
+ }
516
+ },
517
+ "status": {
518
+ "type": "string",
519
+ "enum": ["pending", "validated", "snapshot_failed", "stalled_snapshot", "needs_manual_scenario"]
520
+ },
521
+ "reason": { "type": ["string", "null"] },
522
+ "log_path": { "type": ["string", "null"] },
523
+ "last_error": { "type": ["string", "null"] },
524
+ "git_status_path": { "type": ["string", "null"] },
525
+ "git_log_path": { "type": ["string", "null"] }
526
+ }
527
+ },
528
+ "crystalizer": {
529
+ "type": ["object", "null"],
530
+ "additionalProperties": false,
531
+ "required": ["candidate_path", "model", "prompt_pack", "prompt_pack_stamp", "budget_usd", "cost_usd", "status", "created_at"],
532
+ "properties": {
533
+ "candidate_path": { "type": ["string", "null"] },
534
+ "model": { "type": "string", "minLength": 1 },
535
+ "prompt_pack": { "type": "string", "minLength": 1 },
536
+ "prompt_pack_stamp": { "type": ["string", "null"] },
537
+ "budget_usd": { "type": "number", "minimum": 0 },
538
+ "cost_usd": { "type": ["number", "null"] },
539
+ "status": { "type": "string", "enum": ["pending", "succeeded", "skipped", "failed"] },
540
+ "error": { "type": ["string", "null"] },
541
+ "created_at": { "type": "string", "minLength": 1 }
542
+ }
543
+ },
544
+ "alerts": {
545
+ "type": "array",
546
+ "items": {
547
+ "type": "object",
548
+ "additionalProperties": false,
549
+ "required": ["type", "channel", "target", "message", "created_at"],
550
+ "properties": {
551
+ "type": { "type": "string", "enum": ["snapshot_failed", "stalled_snapshot", "needs_manual_scenario", "budget_exceeded"] },
552
+ "channel": { "type": "string", "enum": ["slack", "pagerduty"] },
553
+ "target": { "type": "string", "minLength": 1 },
554
+ "message": { "type": "string", "minLength": 1 },
555
+ "created_at": { "type": "string", "minLength": 1 },
556
+ "severity": { "type": ["string", "null"] }
557
+ }
558
+ }
559
+ },
560
+ "approvals": {
561
+ "type": "array",
562
+ "items": {
563
+ "type": "object",
564
+ "additionalProperties": false,
565
+ "required": ["actor", "timestamp", "state"],
566
+ "properties": {
567
+ "actor": { "type": "string", "minLength": 1 },
568
+ "timestamp": { "type": "string", "minLength": 1 },
569
+ "reason": { "type": ["string", "null"] },
570
+ "state": { "type": "string", "enum": ["stalled_snapshot", "needs_manual_scenario", "requeue"] }
571
+ }
572
+ }
573
+ },
574
+ "review": {
575
+ "type": ["object", "null"],
576
+ "additionalProperties": false,
577
+ "required": ["rejections", "latency_ms", "updated_at"],
578
+ "properties": {
579
+ "rejections": { "type": "integer", "minimum": 0 },
580
+ "latency_ms": { "type": ["number", "null"] },
581
+ "last_reviewer": { "type": ["string", "null"] },
582
+ "updated_at": { "type": "string", "minLength": 1 }
583
+ }
584
+ },
585
+ "regressions": {
586
+ "type": ["object", "null"],
587
+ "additionalProperties": false,
588
+ "required": ["detected"],
589
+ "properties": {
590
+ "detected": { "type": "integer", "minimum": 0 },
591
+ "detail_path": { "type": ["string", "null"] }
592
+ }
593
+ },
594
+ "pattern_hygiene": {
595
+ "type": ["object", "null"],
596
+ "additionalProperties": false,
597
+ "required": ["promoted", "deprecated", "updated_at"],
598
+ "properties": {
599
+ "promoted": { "type": "integer", "minimum": 0 },
600
+ "deprecated": { "type": "integer", "minimum": 0 },
601
+ "notes": { "type": ["array", "null"], "items": { "type": "string" } },
602
+ "updated_at": { "type": "string", "minLength": 1 }
603
+ }
604
+ },
605
+ "throughput": {
606
+ "type": ["object", "null"],
607
+ "additionalProperties": false,
608
+ "required": ["candidates", "active", "deprecated", "updated_at"],
609
+ "properties": {
610
+ "candidates": { "type": "integer", "minimum": 0 },
611
+ "active": { "type": "integer", "minimum": 0 },
612
+ "deprecated": { "type": "integer", "minimum": 0 },
613
+ "updated_at": { "type": "string", "minLength": 1 }
614
+ }
615
+ }
616
+ }
617
+ },
618
+ "guardrail_status": {
619
+ "type": "object",
620
+ "additionalProperties": false,
621
+ "required": ["present", "recommendation", "summary", "computed_at", "counts"],
622
+ "properties": {
623
+ "present": { "type": "boolean" },
624
+ "recommendation": { "type": ["string", "null"] },
625
+ "summary": { "type": "string", "minLength": 1 },
626
+ "computed_at": { "type": "string", "minLength": 1 },
627
+ "counts": {
628
+ "type": "object",
629
+ "additionalProperties": false,
630
+ "required": ["total", "succeeded", "failed", "skipped", "other"],
631
+ "properties": {
632
+ "total": { "type": "integer", "minimum": 0 },
633
+ "succeeded": { "type": "integer", "minimum": 0 },
634
+ "failed": { "type": "integer", "minimum": 0 },
635
+ "skipped": { "type": "integer", "minimum": 0 },
636
+ "other": { "type": "integer", "minimum": 0 }
637
+ }
638
+ }
639
+ }
640
+ },
641
+ "toolRuns": {
642
+ "type": ["array", "null"],
643
+ "items": { "$ref": "#/definitions/toolRun" }
644
+ },
645
+ "design_artifacts": {
646
+ "type": ["array", "null"],
647
+ "items": { "$ref": "#/definitions/designArtifact" }
648
+ },
649
+ "design_artifacts_summary": {
650
+ "anyOf": [
651
+ { "type": "null" },
652
+ { "$ref": "#/definitions/designArtifactsSummary" }
653
+ ]
654
+ },
655
+ "design_config_snapshot": { "type": ["object", "null"] },
656
+ "design_toolkit_artifacts": {
657
+ "type": ["array", "null"],
658
+ "items": { "$ref": "#/definitions/designToolkitArtifact" }
659
+ },
660
+ "design_toolkit_summary": {
661
+ "anyOf": [
662
+ { "type": "null" },
663
+ { "$ref": "#/definitions/designToolkitSummary" }
664
+ ]
665
+ },
666
+ "design_plan": {
667
+ "anyOf": [
668
+ { "type": "null" },
669
+ { "$ref": "#/definitions/designPlan" }
670
+ ]
671
+ },
672
+ "design_guardrail": {
673
+ "anyOf": [
674
+ { "type": "null" },
675
+ { "$ref": "#/definitions/designGuardrail" }
676
+ ]
677
+ },
678
+ "design_history": {
679
+ "anyOf": [
680
+ { "type": "null" },
681
+ { "$ref": "#/definitions/designHistory" }
682
+ ]
683
+ },
684
+ "design_style_profile": {
685
+ "anyOf": [
686
+ { "type": "null" },
687
+ { "$ref": "#/definitions/designStyleProfile" }
688
+ ]
689
+ },
690
+ "design_metrics": {
691
+ "anyOf": [
692
+ { "type": "null" },
693
+ { "$ref": "#/definitions/designMetrics" }
694
+ ]
695
+ }
696
+ },
697
+ "definitions": {
698
+ "toolRun": {
699
+ "type": "object",
700
+ "required": [
701
+ "id",
702
+ "tool",
703
+ "approvalSource",
704
+ "retryCount",
705
+ "sandboxState",
706
+ "status",
707
+ "startedAt",
708
+ "completedAt",
709
+ "attemptCount"
710
+ ],
711
+ "additionalProperties": false,
712
+ "properties": {
713
+ "id": { "type": "string", "minLength": 1 },
714
+ "tool": { "type": "string", "minLength": 1 },
715
+ "approvalSource": { "type": "string", "enum": ["not-required", "cache", "prompt"] },
716
+ "retryCount": { "type": "integer", "minimum": 0 },
717
+ "sandboxState": { "type": "string", "enum": ["sandboxed", "escalated", "failed"] },
718
+ "status": { "type": "string", "enum": ["succeeded", "failed"] },
719
+ "startedAt": { "type": "string", "minLength": 1 },
720
+ "completedAt": { "type": "string", "minLength": 1 },
721
+ "attemptCount": { "type": "integer", "minimum": 1 },
722
+ "metadata": { "type": ["object", "null"] },
723
+ "events": {
724
+ "type": ["array", "null"],
725
+ "items": { "$ref": "#/definitions/toolRunEvent" }
726
+ }
727
+ }
728
+ },
729
+ "toolRunEvent": {
730
+ "type": "object",
731
+ "required": ["type", "correlationId", "timestamp", "attempt"],
732
+ "properties": {
733
+ "type": {
734
+ "type": "string",
735
+ "enum": ["exec:begin", "exec:chunk", "exec:end", "exec:retry"]
736
+ },
737
+ "correlationId": { "type": "string", "minLength": 1 },
738
+ "timestamp": { "type": "string", "minLength": 1 },
739
+ "attempt": { "type": "integer", "minimum": 1 },
740
+ "command": { "type": ["string", "null"] },
741
+ "args": { "type": ["array", "null"], "items": { "type": "string" } },
742
+ "cwd": { "type": ["string", "null"] },
743
+ "sessionId": { "type": ["string", "null"] },
744
+ "sandboxState": { "type": ["string", "null"] },
745
+ "stream": { "type": ["string", "null"] },
746
+ "sequence": { "type": ["integer", "null"] },
747
+ "bytes": { "type": ["integer", "null"] },
748
+ "data": { "type": ["string", "null"] },
749
+ "exitCode": { "type": ["integer", "null"] },
750
+ "signal": { "type": ["string", "null"] },
751
+ "durationMs": { "type": ["integer", "null"] },
752
+ "stdout": { "type": ["string", "null"] },
753
+ "stderr": { "type": ["string", "null"] },
754
+ "delayMs": { "type": ["integer", "null"] },
755
+ "errorMessage": { "type": ["string", "null"] }
756
+ },
757
+ "additionalProperties": true
758
+ },
759
+ "designArtifact": {
760
+ "type": "object",
761
+ "required": ["stage", "status", "relative_path"],
762
+ "additionalProperties": false,
763
+ "properties": {
764
+ "stage": {
765
+ "type": "string",
766
+ "enum": [
767
+ "extract",
768
+ "reference",
769
+ "components",
770
+ "motion",
771
+ "video",
772
+ "visual-regression",
773
+ "style-ingestion",
774
+ "design-brief",
775
+ "aesthetic-plan",
776
+ "implementation",
777
+ "guardrail",
778
+ "design-history"
779
+ ]
780
+ },
781
+ "status": { "type": "string", "enum": ["succeeded", "skipped", "failed"] },
782
+ "relative_path": { "type": "string", "minLength": 1 },
783
+ "type": { "type": ["string", "null"] },
784
+ "description": { "type": ["string", "null"] },
785
+ "approvals": {
786
+ "type": "array",
787
+ "items": { "$ref": "#/definitions/designArtifactApproval" }
788
+ },
789
+ "quota": { "$ref": "#/definitions/designArtifactQuota" },
790
+ "expiry": { "$ref": "#/definitions/designArtifactExpiry" },
791
+ "privacy_notes": { "type": "array", "items": { "type": "string" } },
792
+ "config_hash": { "type": ["string", "null"] },
793
+ "metadata": { "type": ["object", "null"] }
794
+ }
795
+ },
796
+ "designArtifactApproval": {
797
+ "type": "object",
798
+ "required": ["id", "actor", "timestamp"],
799
+ "additionalProperties": false,
800
+ "properties": {
801
+ "id": { "type": "string", "minLength": 1 },
802
+ "actor": { "type": "string", "minLength": 1 },
803
+ "reason": { "type": ["string", "null"] },
804
+ "timestamp": { "type": "string", "minLength": 1 }
805
+ }
806
+ },
807
+ "designArtifactQuota": {
808
+ "type": "object",
809
+ "required": ["type", "limit", "unit"],
810
+ "additionalProperties": false,
811
+ "properties": {
812
+ "type": { "type": "string", "enum": ["storage", "runtime"] },
813
+ "limit": { "type": "number", "minimum": 0 },
814
+ "unit": { "type": "string", "enum": ["MB", "seconds"] },
815
+ "consumed": { "type": ["number", "null"], "minimum": 0 }
816
+ }
817
+ },
818
+ "designArtifactExpiry": {
819
+ "type": "object",
820
+ "required": ["date", "policy"],
821
+ "additionalProperties": false,
822
+ "properties": {
823
+ "date": { "type": "string", "minLength": 1 },
824
+ "policy": { "type": "string", "minLength": 1 }
825
+ }
826
+ },
827
+ "designArtifactsSummary": {
828
+ "type": "object",
829
+ "required": ["total_artifacts", "generated_at", "stages"],
830
+ "additionalProperties": false,
831
+ "properties": {
832
+ "total_artifacts": { "type": "integer", "minimum": 0 },
833
+ "generated_at": { "type": "string", "minLength": 1 },
834
+ "storage_bytes": { "type": ["integer", "null"], "minimum": 0 },
835
+ "stages": {
836
+ "type": "array",
837
+ "items": { "$ref": "#/definitions/designArtifactsSummaryStage" }
838
+ },
839
+ "errors": { "type": "array", "items": { "type": "string" } }
840
+ }
841
+ },
842
+ "designArtifactsSummaryStage": {
843
+ "type": "object",
844
+ "required": ["stage", "succeeded", "failed", "skipped"],
845
+ "additionalProperties": false,
846
+ "properties": {
847
+ "stage": {
848
+ "type": "string",
849
+ "enum": [
850
+ "extract",
851
+ "reference",
852
+ "components",
853
+ "motion",
854
+ "video",
855
+ "visual-regression",
856
+ "style-ingestion",
857
+ "design-brief",
858
+ "aesthetic-plan",
859
+ "implementation",
860
+ "guardrail",
861
+ "design-history"
862
+ ]
863
+ },
864
+ "succeeded": { "type": "integer", "minimum": 0 },
865
+ "failed": { "type": "integer", "minimum": 0 },
866
+ "skipped": { "type": "integer", "minimum": 0 },
867
+ "artifacts": { "type": ["integer", "null"], "minimum": 0 },
868
+ "notes": { "type": "array", "items": { "type": "string" } }
869
+ }
870
+ },
871
+ "designToolkitArtifact": {
872
+ "type": "object",
873
+ "required": ["id", "stage", "status", "relative_path"],
874
+ "additionalProperties": false,
875
+ "properties": {
876
+ "id": { "type": "string", "minLength": 1 },
877
+ "stage": {
878
+ "type": "string",
879
+ "enum": ["extract", "tokens", "styleguide", "reference", "self-correct", "publish"]
880
+ },
881
+ "status": { "type": "string", "enum": ["succeeded", "skipped", "failed"] },
882
+ "relative_path": { "type": "string", "minLength": 1 },
883
+ "description": { "type": ["string", "null"] },
884
+ "approvals": {
885
+ "type": "array",
886
+ "items": { "$ref": "#/definitions/designArtifactApproval" }
887
+ },
888
+ "retention": {
889
+ "type": "object",
890
+ "required": ["days", "autoPurge", "expiry"],
891
+ "additionalProperties": false,
892
+ "properties": {
893
+ "days": { "type": "integer", "minimum": 1 },
894
+ "autoPurge": { "type": "boolean" },
895
+ "auto_purge": { "type": "boolean" },
896
+ "expiry": { "type": "string", "minLength": 1 },
897
+ "policy": { "type": ["string", "null"] }
898
+ }
899
+ },
900
+ "metrics": { "type": ["object", "null"] },
901
+ "privacy_notes": { "type": "array", "items": { "type": "string" } }
902
+ }
903
+ },
904
+ "designToolkitSummary": {
905
+ "type": "object",
906
+ "required": ["generated_at", "stages"],
907
+ "additionalProperties": false,
908
+ "properties": {
909
+ "generated_at": { "type": "string", "minLength": 1 },
910
+ "stages": {
911
+ "type": "array",
912
+ "items": {
913
+ "type": "object",
914
+ "required": ["stage", "artifacts"],
915
+ "additionalProperties": false,
916
+ "properties": {
917
+ "stage": {
918
+ "type": "string",
919
+ "enum": ["extract", "tokens", "styleguide", "reference", "self-correct", "publish"]
920
+ },
921
+ "artifacts": { "type": "integer", "minimum": 0 },
922
+ "metrics": { "type": ["object", "null"] },
923
+ "notes": { "type": "array", "items": { "type": "string" } }
924
+ }
925
+ }
926
+ },
927
+ "totals": { "type": ["object", "null"] },
928
+ "approvals": { "type": ["array", "null"], "items": { "type": "string" } }
929
+ }
930
+ },
931
+ "designPlan": {
932
+ "type": "object",
933
+ "required": ["mode", "brief"],
934
+ "additionalProperties": false,
935
+ "properties": {
936
+ "mode": { "type": "string", "enum": ["fresh", "clone-informed"] },
937
+ "brief": {
938
+ "type": "object",
939
+ "required": ["path"],
940
+ "additionalProperties": false,
941
+ "properties": {
942
+ "path": { "type": "string", "minLength": 1 },
943
+ "hash": { "type": ["string", "null"] },
944
+ "id": { "type": ["string", "null"] }
945
+ }
946
+ },
947
+ "aesthetic_plan": {
948
+ "type": "object",
949
+ "required": ["path"],
950
+ "additionalProperties": false,
951
+ "properties": {
952
+ "path": { "type": "string", "minLength": 1 },
953
+ "snippet_version": { "type": ["string", "null"] },
954
+ "id": { "type": ["string", "null"] }
955
+ }
956
+ },
957
+ "implementation": {
958
+ "type": "object",
959
+ "required": ["path"],
960
+ "additionalProperties": false,
961
+ "properties": {
962
+ "path": { "type": "string", "minLength": 1 },
963
+ "complexity": { "type": ["string", "null"] }
964
+ }
965
+ },
966
+ "reference_style_id": { "type": ["string", "null"] },
967
+ "style_profile_id": { "type": ["string", "null"] },
968
+ "generated_at": { "type": ["string", "null"] }
969
+ }
970
+ },
971
+ "designStyleOverlap": {
972
+ "type": "object",
973
+ "required": ["overall"],
974
+ "additionalProperties": false,
975
+ "properties": {
976
+ "palette": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
977
+ "typography": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
978
+ "motion": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
979
+ "spacing": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
980
+ "overall": { "type": "number", "minimum": 0, "maximum": 1 },
981
+ "gate": { "type": ["string", "null"], "enum": ["pass", "fail", null] },
982
+ "threshold": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
983
+ "comparison_window": { "type": ["array", "null"], "items": { "type": "string" } },
984
+ "reference_style_id": { "type": ["string", "null"] }
985
+ }
986
+ },
987
+ "designGuardrail": {
988
+ "type": "object",
989
+ "required": ["report_path", "status"],
990
+ "additionalProperties": false,
991
+ "properties": {
992
+ "report_path": { "type": "string", "minLength": 1 },
993
+ "status": { "type": "string", "enum": ["pass", "fail"] },
994
+ "snippet_version": { "type": ["string", "null"] },
995
+ "strictness": { "type": ["string", "null"], "enum": ["low", "medium", "high", null] },
996
+ "slop_threshold": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
997
+ "mode": { "type": ["string", "null"], "enum": ["fresh", "clone-informed", null] },
998
+ "scores": { "type": ["object", "null"], "additionalProperties": { "type": "number" } },
999
+ "recommendations": { "type": "array", "items": { "type": "string" } },
1000
+ "notes": { "type": "array", "items": { "type": "string" } },
1001
+ "style_overlap": { "anyOf": [{ "type": "null" }, { "$ref": "#/definitions/designStyleOverlap" }] }
1002
+ }
1003
+ },
1004
+ "designHistory": {
1005
+ "type": "object",
1006
+ "required": ["path"],
1007
+ "additionalProperties": false,
1008
+ "properties": {
1009
+ "path": { "type": "string", "minLength": 1 },
1010
+ "mirror_path": { "type": ["string", "null"] },
1011
+ "entries": { "type": ["integer", "null"], "minimum": 0 },
1012
+ "max_entries": { "type": ["integer", "null"], "minimum": 1 },
1013
+ "updated_at": { "type": ["string", "null"] },
1014
+ "mode": { "type": ["string", "null"], "enum": ["fresh", "clone-informed", null] }
1015
+ }
1016
+ },
1017
+ "designStyleProfile": {
1018
+ "type": "object",
1019
+ "required": ["id", "relative_path"],
1020
+ "additionalProperties": false,
1021
+ "properties": {
1022
+ "id": { "type": "string", "minLength": 1 },
1023
+ "relative_path": { "type": "string", "minLength": 1 },
1024
+ "source_url": { "type": ["string", "null"] },
1025
+ "ingestion_run": { "type": ["string", "null"] },
1026
+ "similarity_level": { "type": ["string", "null"], "enum": ["low", "medium", "high", null] },
1027
+ "do_not_copy": {
1028
+ "type": ["object", "null"],
1029
+ "additionalProperties": false,
1030
+ "properties": {
1031
+ "logos": { "type": "array", "items": { "type": "string" } },
1032
+ "wordmarks": { "type": "array", "items": { "type": "string" } },
1033
+ "unique_shapes": { "type": "array", "items": { "type": "string" } },
1034
+ "unique_illustrations": { "type": "array", "items": { "type": "string" } },
1035
+ "other": { "type": "array", "items": { "type": "string" } }
1036
+ }
1037
+ },
1038
+ "retention_days": { "type": ["integer", "null"], "minimum": 0 },
1039
+ "expiry": { "anyOf": [{ "type": "null" }, { "$ref": "#/definitions/designArtifactExpiry" }] },
1040
+ "approvals": {
1041
+ "type": "array",
1042
+ "items": { "$ref": "#/definitions/designArtifactApproval" }
1043
+ },
1044
+ "notes": { "type": "array", "items": { "type": "string" } }
1045
+ }
1046
+ },
1047
+ "designMetrics": {
1048
+ "type": "object",
1049
+ "additionalProperties": false,
1050
+ "properties": {
1051
+ "aesthetic_axes_completeness": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
1052
+ "originality_score": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
1053
+ "accessibility_score": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
1054
+ "brief_alignment_score": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
1055
+ "slop_risk": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
1056
+ "diversity_penalty": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
1057
+ "similarity_to_reference": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
1058
+ "style_overlap": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
1059
+ "style_overlap_gate": { "type": ["string", "null"], "enum": ["pass", "fail", null] },
1060
+ "snippet_version": { "type": ["string", "null"] }
1061
+ }
1062
+ }
1063
+ }
1064
+ }