@deksden-com/dd-flow-cli 0.9.0-beta.152 → 0.9.0-beta.156

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 (227) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/build-info.json +8 -8
  3. package/dist/cli/command-inputs.js +33 -3
  4. package/dist/cli/command-metadata.js +73 -2
  5. package/dist/cli/delivery.js +108 -0
  6. package/dist/cli/diagnostic-invocation.js +23 -7
  7. package/dist/cli/diagnostic.js +14 -3
  8. package/dist/cli/help.js +117 -1
  9. package/dist/cli/hook-ingress.js +36 -49
  10. package/dist/cli/interactive-invocation.js +33 -0
  11. package/dist/cli/interactive.js +114 -0
  12. package/dist/cli/memory-fix-invocation.js +52 -0
  13. package/dist/cli/memory-fix.js +100 -0
  14. package/dist/cli/memory-flow-admission.js +7 -3
  15. package/dist/cli/memory-init.js +5 -4
  16. package/dist/cli/native-hook-ingress.js +5 -1
  17. package/dist/cli/native-hook-preparation.js +31 -4
  18. package/dist/cli/run-cli.js +274 -19
  19. package/dist/cli.js +17 -3
  20. package/dist/domain/delivery-flows.js +8 -0
  21. package/dist/domain/distill-flow.js +20 -0
  22. package/dist/domain/interactive-flow.js +1 -0
  23. package/dist/domain/memory-fix-flow.js +2 -0
  24. package/dist/domain/review-fix-flow.js +2 -0
  25. package/dist/domain/source-snapshot-flows.js +4 -0
  26. package/dist/harness-runtime/bin/dd-agy.mjs +18 -3
  27. package/dist/harness-runtime/bin/dd-grok.mjs +15 -5
  28. package/dist/harness-runtime/bin/dd-zcode.mjs +15 -7
  29. package/dist/harness-runtime/lib/agy-error-boundary.mjs +18 -10
  30. package/dist/harness-runtime/lib/agy-native-inspection.mjs +12 -3
  31. package/dist/harness-runtime/lib/agy-native-inventory.mjs +19 -0
  32. package/dist/harness-runtime/lib/agy-terminal-envelope.mjs +13 -6
  33. package/dist/harness-runtime/lib/agy-transcript-stream.mjs +54 -0
  34. package/dist/harness-runtime/lib/daemon-observation.d.mts +1 -0
  35. package/dist/harness-runtime/lib/daemon-observation.mjs +12 -4
  36. package/dist/harness-runtime/lib/daemon-operations.mjs +20 -5
  37. package/dist/harness-runtime/lib/dd-agy-daemon.d.mts +1 -0
  38. package/dist/harness-runtime/lib/dd-agy-daemon.mjs +371 -114
  39. package/dist/harness-runtime/lib/dd-codex-daemon.mjs +43 -3
  40. package/dist/harness-runtime/lib/dd-codex.mjs +36 -4
  41. package/dist/harness-runtime/lib/dd-droid-daemon.mjs +25 -11
  42. package/dist/harness-runtime/lib/dd-droid.mjs +124 -11
  43. package/dist/harness-runtime/lib/dd-grok-daemon.d.mts +1 -0
  44. package/dist/harness-runtime/lib/dd-grok-daemon.mjs +137 -25
  45. package/dist/harness-runtime/lib/dd-grok.mjs +4 -2
  46. package/dist/harness-runtime/lib/dd-opencode-daemon.mjs +115 -17
  47. package/dist/harness-runtime/lib/dd-opencode.mjs +10 -7
  48. package/dist/harness-runtime/lib/dd-zcode-daemon.d.mts +1 -0
  49. package/dist/harness-runtime/lib/dd-zcode-daemon.mjs +115 -22
  50. package/dist/harness-runtime/lib/dd-zcode.mjs +75 -36
  51. package/dist/harness-runtime/lib/delegation-instructions.d.mts +2 -1
  52. package/dist/harness-runtime/lib/delegation-instructions.mjs +15 -5
  53. package/dist/harness-runtime/lib/delivery-command.mjs +84 -0
  54. package/dist/harness-runtime/lib/driver-recovery.mjs +0 -19
  55. package/dist/harness-runtime/lib/droid-observation.mjs +9 -5
  56. package/dist/harness-runtime/lib/lifecycle-contract.d.mts +1 -0
  57. package/dist/harness-runtime/lib/lifecycle-contract.mjs +2 -1
  58. package/dist/harness-runtime/lib/native-hook-command.d.mts +3 -2
  59. package/dist/harness-runtime/lib/native-hook-command.mjs +63 -8
  60. package/dist/harness-runtime/lib/native-streams.mjs +3 -10
  61. package/dist/harness-runtime/lib/opencode-plugin.mjs +36 -9
  62. package/dist/harness-runtime/lib/operation-errors.mjs +13 -0
  63. package/dist/harness-runtime/lib/operation-progress.mjs +6 -2
  64. package/dist/harness-runtime/lib/process-json.mjs +4 -5
  65. package/dist/harness-runtime/lib/tool-observations.mjs +20 -10
  66. package/dist/harness-runtime/lib/zcode-native-hook-ownership.mjs +109 -0
  67. package/dist/schemas/code-work-result.schema.json +2 -1
  68. package/dist/schemas/delivery-stage-result.schema.json +286 -0
  69. package/dist/schemas/distill-stage-result.schema.json +667 -0
  70. package/dist/schemas/distill-work-result.schema.json +428 -0
  71. package/dist/schemas/execution-bundle.schema.json +6 -2
  72. package/dist/schemas/interactive-stage-result.schema.json +47 -0
  73. package/dist/schemas/interactive-work-result.schema.json +63 -0
  74. package/dist/schemas/mb-fix-stage-result.schema.json +93 -0
  75. package/dist/schemas/project-flow-pack-manifest.schema.json +2 -2
  76. package/dist/schemas/review-fix-stage-result.schema.json +210 -0
  77. package/dist/schemas/run-control-receipt.schema.json +1 -0
  78. package/dist/services/assigned-lifecycle.js +382 -0
  79. package/dist/services/check-runner-evidence.js +45 -8
  80. package/dist/services/cli-operation-classifier.js +6 -1
  81. package/dist/services/code-checks.js +46 -29
  82. package/dist/services/codex-hook-delivery.js +11 -2
  83. package/dist/services/controller-child-repair.js +95 -0
  84. package/dist/services/controller-execution.js +4 -1
  85. package/dist/services/controller-fanout.js +19 -9
  86. package/dist/services/controller-memory-worker.js +6 -4
  87. package/dist/services/controller-result-authority.js +122 -0
  88. package/dist/services/dashboard.js +4 -2
  89. package/dist/services/delivery-access.js +123 -0
  90. package/dist/services/delivery-approval.js +68 -0
  91. package/dist/services/delivery-artifact.js +86 -0
  92. package/dist/services/delivery-checks.js +178 -0
  93. package/dist/services/delivery-execution.js +181 -0
  94. package/dist/services/delivery-intents.js +212 -0
  95. package/dist/services/delivery-operation.js +81 -0
  96. package/dist/services/delivery-policy.js +91 -0
  97. package/dist/services/delivery-procedures.js +43 -0
  98. package/dist/services/delivery-request.js +99 -0
  99. package/dist/services/delivery-result.js +144 -0
  100. package/dist/services/delivery-stage-commands.js +26 -0
  101. package/dist/services/delivery-stage-entry.js +56 -0
  102. package/dist/services/delivery-stage-handlers.js +135 -0
  103. package/dist/services/delivery-stage-results.js +94 -0
  104. package/dist/services/descriptor-coordinator-session.js +3 -1
  105. package/dist/services/descriptor-run-start.js +24 -4
  106. package/dist/services/descriptor-stage-coordinator.js +78 -10
  107. package/dist/services/descriptor-stage-settlement.js +59 -14
  108. package/dist/services/diagnostic-repair-intake.js +123 -0
  109. package/dist/services/diagnostic-repair-source-intake.js +102 -0
  110. package/dist/services/diagnostic-report.js +30 -0
  111. package/dist/services/diagnostic-run-bundle.js +48 -9
  112. package/dist/services/diagnostic-snapshot.js +2 -2
  113. package/dist/services/diagnostic-stage-handlers.js +3 -2
  114. package/dist/services/diagnostic-stage-results.js +26 -0
  115. package/dist/services/diagnostic-start.js +56 -6
  116. package/dist/services/diagnostic-work-collection.js +3 -3
  117. package/dist/services/distill-document-publication.js +280 -0
  118. package/dist/services/distill-promotion.js +197 -0
  119. package/dist/services/distill-publication-custody.js +162 -0
  120. package/dist/services/distill-stage-handlers.js +249 -0
  121. package/dist/services/distill-stage-results.js +105 -0
  122. package/dist/services/distill-user-inputs.js +4 -0
  123. package/dist/services/distill-work-batch.js +42 -0
  124. package/dist/services/distill-work-collection.js +74 -0
  125. package/dist/services/distill-work-registration.js +93 -0
  126. package/dist/services/distill-work-results.js +98 -0
  127. package/dist/services/eval-snapshots.js +17 -7
  128. package/dist/services/external-work-launch.js +8 -2
  129. package/dist/services/flow-catalog.js +24 -0
  130. package/dist/services/frozen-engine.js +19 -2
  131. package/dist/services/generic-execution.js +4 -3
  132. package/dist/services/harness-adapter.js +2 -14
  133. package/dist/services/hook-memory-routing.js +1 -1
  134. package/dist/services/hooks.js +31 -6
  135. package/dist/services/hybrid-contracts.js +6 -1
  136. package/dist/services/installed-flow-source.js +37 -2
  137. package/dist/services/interactive-attached-session.js +215 -0
  138. package/dist/services/interactive-baseline-custody.js +54 -0
  139. package/dist/services/interactive-before-versions.js +148 -0
  140. package/dist/services/interactive-bundle-data.js +85 -0
  141. package/dist/services/interactive-checks.js +179 -0
  142. package/dist/services/interactive-execution.js +33 -0
  143. package/dist/services/interactive-finish-integration.js +236 -0
  144. package/dist/services/interactive-git-baseline.js +230 -0
  145. package/dist/services/interactive-git-dispatch.js +278 -0
  146. package/dist/services/interactive-input-delivery.js +82 -0
  147. package/dist/services/interactive-mutation-scope.js +231 -0
  148. package/dist/services/interactive-request.js +287 -0
  149. package/dist/services/interactive-run-bundle.js +109 -0
  150. package/dist/services/interactive-stage-entry.js +41 -0
  151. package/dist/services/interactive-stage-handlers.js +289 -0
  152. package/dist/services/interactive-stage-observation.js +136 -0
  153. package/dist/services/interactive-stage-results.js +111 -0
  154. package/dist/services/interactive-user-inputs.js +142 -0
  155. package/dist/services/interactive-work-batch.js +43 -0
  156. package/dist/services/interactive-work-collection.js +119 -0
  157. package/dist/services/interactive-work-completion.js +180 -0
  158. package/dist/services/interactive-work-context.js +249 -0
  159. package/dist/services/interactive-work-history.js +112 -0
  160. package/dist/services/interactive-work-registration.js +124 -0
  161. package/dist/services/interactive-work-results.js +115 -0
  162. package/dist/services/interactive-work-start.js +155 -0
  163. package/dist/services/lifecycle-invocations.js +250 -33
  164. package/dist/services/managed-daemon-binding.js +52 -1
  165. package/dist/services/memory-compose-handler.js +2 -22
  166. package/dist/services/memory-finish-integration.js +58 -17
  167. package/dist/services/memory-fix-finish-integration.js +129 -0
  168. package/dist/services/memory-fix-git-dispatch.js +139 -0
  169. package/dist/services/memory-fix-intake-custody.js +11 -0
  170. package/dist/services/memory-fix-intake-settlement.js +127 -0
  171. package/dist/services/memory-fix-publication.js +196 -0
  172. package/dist/services/memory-fix-repair-admission.js +116 -0
  173. package/dist/services/memory-fix-request.js +141 -0
  174. package/dist/services/memory-fix-run-bundle.js +83 -0
  175. package/dist/services/memory-fix-scope.js +78 -0
  176. package/dist/services/memory-fix-sources.js +85 -0
  177. package/dist/services/memory-fix-stage-entry.js +24 -0
  178. package/dist/services/memory-fix-stage-handlers.js +282 -0
  179. package/dist/services/memory-fix-stage-results.js +106 -0
  180. package/dist/services/memory-fix-workspace.js +127 -0
  181. package/dist/services/memory-flow-user-inputs.js +88 -0
  182. package/dist/services/memory-init-contexts.js +55 -5
  183. package/dist/services/memory-init-controller-start.js +20 -4
  184. package/dist/services/memory-layer.js +7 -3
  185. package/dist/services/memory-native-review-copy.js +27 -3
  186. package/dist/services/memory-repair-document-delta.js +1 -0
  187. package/dist/services/project-flow-source.js +195 -0
  188. package/dist/services/project-git-integration.js +92 -0
  189. package/dist/services/repair-intents.js +2 -7
  190. package/dist/services/retained-native-hook.js +274 -0
  191. package/dist/services/review-fix-handoff.js +82 -0
  192. package/dist/services/review-fix-intake-custody.js +17 -0
  193. package/dist/services/review-fix-stage-entry.js +43 -0
  194. package/dist/services/review-fix-stage-handlers.js +176 -0
  195. package/dist/services/review-fix-stage-results.js +86 -0
  196. package/dist/services/run-control-worker.js +42 -1
  197. package/dist/services/run-control.js +40 -5
  198. package/dist/services/run-controller-adapter.js +37 -3
  199. package/dist/services/run-controller-process.js +25 -4
  200. package/dist/services/run-controller-recovery.js +46 -6
  201. package/dist/services/run-controller-state.js +3 -2
  202. package/dist/services/run-controller.js +257 -44
  203. package/dist/services/run-recovery.js +31 -2
  204. package/dist/services/run-timeline.js +59 -0
  205. package/dist/services/runs.js +18 -31
  206. package/dist/services/sessions.js +2 -1
  207. package/dist/services/stage-handlers.js +55 -3
  208. package/dist/services/stage-lifecycle.js +4 -3
  209. package/dist/services/stage-pause.js +26 -9
  210. package/dist/services/stage-report-renderer.js +2 -6
  211. package/dist/services/technical-notes.js +31 -0
  212. package/dist/services/verification-matrix.js +1 -1
  213. package/dist/services/version-status.js +1 -1
  214. package/dist/services/vnext-code-review.js +74 -5
  215. package/dist/services/vnext-code.js +8 -32
  216. package/dist/services/vnext-fanout.js +53 -8
  217. package/dist/services/vnext-merge.js +10 -5
  218. package/dist/services/vnext-plan-review.js +1 -1
  219. package/dist/services/vnext-plan.js +1 -1
  220. package/dist/services/vnext-protocolize.js +1 -1
  221. package/dist/services/vnext-specify.js +10 -5
  222. package/dist/services/work-registry.js +255 -69
  223. package/dist/services/worktrees.js +7 -4
  224. package/dist/storage/database.js +2 -1
  225. package/dist/verification-components.json +82 -0
  226. package/package.json +3 -2
  227. package/tools/verification-jobs.mjs +35 -10
@@ -0,0 +1,109 @@
1
+ // This map is optional evidence, not a replacement for the ordinary hook.
2
+ // A turn becomes authoritative only after the bridge has matched the native
3
+ // inputId it supplied on session/send and echoed by native turn.started.
4
+ export class ZcodeNativeHookOwnership {
5
+ constructor() { this.turns = new Map(); this.invalidTurns = new Set(); this.requests = new Map(); this.observers = new Map(); this.managedSessions = new Set(); this.buffer = new Map(); this.hooks = new Map(); this.waiters = new Map(); }
6
+ key(...values) { return JSON.stringify(values); }
7
+ signature(message) { const update = message.params.update; return this.key(update.toolCallId, update.rawInput, update._meta?.zcodeRuntime); }
8
+ register(operationId, observer, sessionId) { if (operationId && observer) { this.observers.set(operationId, observer); if (typeof sessionId === 'string' && sessionId) this.managedSessions.add(sessionId); } }
9
+ isManaged(sessionId, pending) { return this.managedSessions.has(sessionId) || [...pending.values()].some(request => request.method === 'session/prompt' && request.sessionId === sessionId && request.nativeHookOwner); }
10
+ bind(params, pending) {
11
+ const { sessionId, requestId, nativeTurnId } = params ?? {};
12
+ const owner = pending?.nativeHookOwner;
13
+ if (!owner || pending.method !== 'session/prompt' || pending.id !== requestId || pending.sessionId !== sessionId
14
+ || typeof nativeTurnId !== 'string' || !nativeTurnId || !owner.operationId || !owner.rootProviderSessionId || !owner.valid()) return [];
15
+ const turnKey = this.key(sessionId, nativeTurnId), requestKey = this.key(sessionId, requestId);
16
+ if (this.invalidTurns.has(turnKey)) return [];
17
+ const priorTurn = this.turns.get(turnKey), priorRequest = this.requests.get(requestKey);
18
+ if (priorTurn && priorTurn.requestKey !== requestKey || priorRequest && priorRequest !== turnKey) {
19
+ this.invalidTurns.add(turnKey);
20
+ if (priorRequest && priorRequest !== 'conflict') this.invalidTurns.add(priorRequest);
21
+ if (priorTurn) priorTurn.invalid = true;
22
+ if (priorRequest && this.turns.has(priorRequest)) this.turns.get(priorRequest).invalid = true;
23
+ this.requests.set(requestKey, 'conflict'); this.buffer.delete(turnKey); return [];
24
+ }
25
+ if (!priorTurn) this.turns.set(turnKey, { requestKey, owner, tools: new Map(), waiting: [], seen: new Set(), invalid: false });
26
+ this.requests.set(requestKey, turnKey); this.managedSessions.add(sessionId); owner.retainNativeHooks = true;
27
+ const buffered = this.buffer.get(turnKey) ?? new Map(); this.buffer.delete(turnKey);
28
+ return [...buffered.values()].flatMap(message => this.observeBound(message, this.turns.get(turnKey)));
29
+ }
30
+ observe(message, mayBuffer, managed) {
31
+ const native = message?.params?.update?._meta?.zcodeRuntime;
32
+ if (message?.method !== 'session/update' || message.params.update?.sessionUpdate !== 'tool_call') return null;
33
+ if (!Object.hasOwn(native ?? {}, 'nativeTurnId')) return managed && (native?.source === 'subagent' || native?.childSessionId) ? [] : null;
34
+ const { sessionId } = message.params, { nativeTurnId } = native;
35
+ if (typeof sessionId !== 'string' || typeof nativeTurnId !== 'string' || !nativeTurnId) return managed ? [] : null;
36
+ const key = this.key(sessionId, nativeTurnId), turn = this.turns.get(key);
37
+ if (this.invalidTurns.has(key)) return [];
38
+ if (turn) return this.observeBound(message, turn);
39
+ if (!managed) return null;
40
+ if (mayBuffer) { const buffer = this.buffer.get(key) ?? new Map(); buffer.set(this.signature(message), message); this.buffer.set(key, buffer); }
41
+ return [];
42
+ }
43
+ discardUnbound(sessionId) {
44
+ for (const key of this.buffer.keys()) if (JSON.parse(key)[0] === sessionId) this.buffer.delete(key);
45
+ }
46
+ isCurrent(message, pending) {
47
+ const native = message?.params?.update?._meta?.zcodeRuntime;
48
+ if (!Object.hasOwn(native ?? {}, 'nativeTurnId')) return !(native?.source === 'subagent' || native?.childSessionId) || !this.isManaged(message.params.sessionId, pending);
49
+ const turn = this.turns.get(this.key(message.params.sessionId, native.nativeTurnId));
50
+ if (!turn) return !this.isManaged(message.params.sessionId, pending);
51
+ return Boolean(turn && !turn.invalid && turn.owner.valid() && [...pending.values()].some(request =>
52
+ request.method === 'session/prompt' && request.sessionId === message.params.sessionId && request.nativeHookOwner === turn.owner));
53
+ }
54
+ observeBound(message, turn) {
55
+ if (turn.invalid || !turn.owner.valid()) return [];
56
+ const signature = this.signature(message); if (turn.seen.has(signature)) return [];
57
+ turn.seen.add(signature);
58
+ // An unresolved native parent may arrive after the root turn returned;
59
+ // keep these exact, deduplicated facts only for this daemon lifetime.
60
+ turn.waiting.push(message);
61
+ const routed = [];
62
+ let progress = true;
63
+ while (progress) {
64
+ progress = false;
65
+ for (let i = 0; i < turn.waiting.length; i++) {
66
+ const event = turn.waiting[i], update = event.params.update, native = update._meta?.zcodeRuntime ?? {};
67
+ const tool = update.toolCallId, child = native.childSessionId;
68
+ if (typeof tool !== 'string' || !tool) { turn.waiting.splice(i--, 1); continue; }
69
+ if (native.source === 'subagent' && !child) { turn.waiting.splice(i--, 1); continue; }
70
+ const parent = child ? turn.tools.get(native.parentToolCallId) : null;
71
+ if (child && !parent) continue;
72
+ const session = child || turn.owner.rootProviderSessionId;
73
+ if (typeof session !== 'string' || !session || child && session === parent) { turn.waiting.splice(i--, 1); continue; }
74
+ const existing = turn.tools.get(tool);
75
+ if (existing && existing !== session) { turn.invalid = true; return []; }
76
+ turn.tools.set(tool, session); turn.waiting.splice(i--, 1); progress = true;
77
+ const command = update.rawInput?.command ?? update.rawInput?.cmd;
78
+ if (child && typeof native.childToolCallId === 'string' && native.childToolCallId && typeof command === 'string') {
79
+ const key = this.key(session, native.childToolCallId), fact = { owner: turn.owner, root: turn.owner.rootProviderSessionId, parent, session, tool: native.childToolCallId, command, message: event, turn };
80
+ const prior = this.hooks.get(key);
81
+ if (prior && (prior.owner !== fact.owner || prior.parent !== parent || prior.command !== command)) { this.hooks.set(key, null); turn.invalid = true; turn.waiting.length = 0; return []; }
82
+ else if (prior === undefined) this.hooks.set(key, fact);
83
+ for (const wake of this.waiters.get(key) ?? []) wake();
84
+ }
85
+ const observer = this.observers.get(turn.owner.operationId);
86
+ if (observer) routed.push({ message: event, observer, owner: turn.owner });
87
+ }
88
+ }
89
+ return routed;
90
+ }
91
+ fact(session, tool, command) {
92
+ const value = this.hooks.get(this.key(session, tool));
93
+ return value && !value.turn.invalid && value.owner.valid() && value.command === command ? value : null;
94
+ }
95
+ async wait(session, tool, command, deadlineAt) {
96
+ if (this.fact(session, tool, command)) return;
97
+ const remaining = deadlineAt - Date.now();
98
+ if (!Number.isSafeInteger(deadlineAt) || remaining <= 0 || remaining > 30_000) return;
99
+ const waitMs = Math.floor(remaining / 3); if (!waitMs) return;
100
+ const key = this.key(session, tool);
101
+ await new Promise(resolve => {
102
+ const waiters = this.waiters.get(key) ?? new Set();
103
+ const wake = () => { if (!this.fact(session, tool, command) && Date.now() < until) return; clearTimeout(timer); waiters.delete(wake); if (!waiters.size) this.waiters.delete(key); resolve(); };
104
+ const until = Date.now() + waitMs, timer = setTimeout(() => { waiters.delete(wake); if (!waiters.size) this.waiters.delete(key); resolve(); }, waitMs);
105
+ waiters.add(wake); this.waiters.set(key, waiters);
106
+ wake();
107
+ });
108
+ }
109
+ }
@@ -11,6 +11,7 @@
11
11
  "evidence": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["obligation_ref", "refs"], "properties": {"obligation_ref": {"type": "string", "minLength": 1}, "refs": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}}},
12
12
  "deviations": {"type": "array", "items": {"type": "string", "minLength": 1}},
13
13
  "blockers": {"type": "array", "items": {"type": "string", "minLength": 1}},
14
- "resolutions": {"type": "array", "uniqueItems": true, "items": {"type": "object", "additionalProperties": false, "required": ["finding_ref", "summary", "evidence_refs"], "properties": {"finding_ref": {"type": "string", "minLength": 1}, "summary": {"type": "string", "minLength": 1}, "evidence_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}}}
14
+ "resolutions": {"type": "array", "uniqueItems": true, "items": {"type": "object", "additionalProperties": false, "required": ["finding_ref", "summary", "evidence_refs"], "properties": {"finding_ref": {"type": "string", "minLength": 1}, "disposition": {"enum": ["fixed", "already_satisfied", "disputed"]}, "summary": {"type": "string", "minLength": 1}, "evidence_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}}},
15
+ "document_resolutions": {"type": "array", "uniqueItems": true, "items": {"type": "object", "additionalProperties": false, "required": ["path", "disposition", "summary", "evidence_refs"], "properties": {"path": {"type": "string", "minLength": 1}, "disposition": {"const": "already_satisfied"}, "summary": {"type": "string", "minLength": 1}, "evidence_refs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}}}}
15
16
  }
16
17
  }
@@ -0,0 +1,286 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "dd-flow/delivery-stage-result@1",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": [
7
+ "schema_id",
8
+ "flow_id",
9
+ "run_id",
10
+ "stage",
11
+ "input_sha256",
12
+ "user_inputs_sha256",
13
+ "summary",
14
+ "predecessors",
15
+ "details"
16
+ ],
17
+ "properties": {
18
+ "schema_id": {
19
+ "const": "dd-flow/delivery-stage-result@1"
20
+ },
21
+ "flow_id": {
22
+ "enum": [
23
+ "release",
24
+ "deploy",
25
+ "publish"
26
+ ]
27
+ },
28
+ "run_id": {
29
+ "type": "string",
30
+ "minLength": 1,
31
+ "maxLength": 16384,
32
+ "pattern": "^[^\\u0000]+$"
33
+ },
34
+ "stage": {
35
+ "enum": [
36
+ "preflight",
37
+ "version-decision",
38
+ "target-decision",
39
+ "prepare",
40
+ "verify",
41
+ "publish",
42
+ "deploy",
43
+ "finish"
44
+ ]
45
+ },
46
+ "input_sha256": {
47
+ "type": "string",
48
+ "pattern": "^[a-f0-9]{64}$"
49
+ },
50
+ "user_inputs_sha256": {
51
+ "type": "string",
52
+ "pattern": "^[a-f0-9]{64}$"
53
+ },
54
+ "summary": {
55
+ "type": "string",
56
+ "minLength": 1,
57
+ "maxLength": 16384,
58
+ "pattern": "^[^\\u0000]+$"
59
+ },
60
+ "predecessors": {
61
+ "type": "array",
62
+ "maxItems": 1,
63
+ "items": {
64
+ "type": "object",
65
+ "additionalProperties": false,
66
+ "required": [
67
+ "stage",
68
+ "path",
69
+ "sha256"
70
+ ],
71
+ "properties": {
72
+ "stage": {
73
+ "type": "string",
74
+ "minLength": 1,
75
+ "maxLength": 16384,
76
+ "pattern": "^[^\\u0000]+$"
77
+ },
78
+ "path": {
79
+ "type": "string",
80
+ "minLength": 1,
81
+ "maxLength": 4096,
82
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
83
+ },
84
+ "sha256": {
85
+ "type": "string",
86
+ "pattern": "^[a-f0-9]{64}$"
87
+ }
88
+ }
89
+ }
90
+ },
91
+ "details": {
92
+ "type": "object",
93
+ "additionalProperties": false,
94
+ "required": [
95
+ "decision",
96
+ "artifact",
97
+ "delivery_scope_sha256",
98
+ "intent_sha256",
99
+ "readback_sha256",
100
+ "verification_sha256",
101
+ "limitations",
102
+ "rollback"
103
+ ],
104
+ "properties": {
105
+ "decision": {
106
+ "anyOf": [
107
+ {
108
+ "type": "null"
109
+ },
110
+ {
111
+ "type": "object",
112
+ "additionalProperties": false,
113
+ "required": [
114
+ "operation_id",
115
+ "version",
116
+ "binding",
117
+ "policy"
118
+ ],
119
+ "properties": {
120
+ "operation_id": {
121
+ "type": "string",
122
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
123
+ },
124
+ "version": {
125
+ "type": "string",
126
+ "minLength": 1,
127
+ "maxLength": 16384,
128
+ "pattern": "^[^\\u0000]+$"
129
+ },
130
+ "binding": {
131
+ "type": "object"
132
+ },
133
+ "policy": {
134
+ "type": "object",
135
+ "additionalProperties": false,
136
+ "required": ["path", "sha256"],
137
+ "properties": {
138
+ "path": {"type": "string", "minLength": 1, "maxLength": 4096},
139
+ "sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"}
140
+ }
141
+ },
142
+ "rollback": {
143
+ "type": "object",
144
+ "additionalProperties": false,
145
+ "required": ["strategy", "procedure_ref", "reason"],
146
+ "properties": {
147
+ "strategy": {"enum": ["rollback", "roll_forward", "operator_handoff"]},
148
+ "procedure_ref": {"anyOf": [{"type": "null"}, {"type": "string", "minLength": 1, "maxLength": 4096, "pattern": "^[^\\u0000]+$"}]},
149
+ "reason": {"type": "string", "minLength": 1, "maxLength": 4096, "pattern": "^[^\\u0000]+$"}
150
+ },
151
+ "allOf": [{
152
+ "if": {"properties": {"strategy": {"enum": ["rollback", "roll_forward"]}}},
153
+ "then": {"properties": {"procedure_ref": {"type": "string", "minLength": 1}}}
154
+ }]
155
+ }
156
+ }
157
+ }
158
+ ]
159
+ },
160
+ "artifact": {
161
+ "anyOf": [
162
+ {
163
+ "type": "null"
164
+ },
165
+ {
166
+ "type": "object",
167
+ "additionalProperties": false,
168
+ "required": [
169
+ "path",
170
+ "subject_ref",
171
+ "version",
172
+ "sha256"
173
+ ],
174
+ "properties": {
175
+ "path": {
176
+ "type": "string",
177
+ "minLength": 1,
178
+ "maxLength": 4096,
179
+ "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
180
+ },
181
+ "subject_ref": {
182
+ "type": "string",
183
+ "minLength": 1,
184
+ "maxLength": 16384,
185
+ "pattern": "^[^\\u0000]+$"
186
+ },
187
+ "version": {
188
+ "type": "string",
189
+ "minLength": 1,
190
+ "maxLength": 16384,
191
+ "pattern": "^[^\\u0000]+$"
192
+ },
193
+ "sha256": {
194
+ "type": "string",
195
+ "pattern": "^[a-f0-9]{64}$"
196
+ }
197
+ }
198
+ }
199
+ ]
200
+ },
201
+ "delivery_scope_sha256": {
202
+ "anyOf": [
203
+ {
204
+ "type": "string",
205
+ "pattern": "^[a-f0-9]{64}$"
206
+ },
207
+ {
208
+ "type": "null"
209
+ }
210
+ ]
211
+ },
212
+ "intent_sha256": {
213
+ "anyOf": [
214
+ {
215
+ "type": "string",
216
+ "pattern": "^[a-f0-9]{64}$"
217
+ },
218
+ {
219
+ "type": "null"
220
+ }
221
+ ]
222
+ },
223
+ "readback_sha256": {
224
+ "anyOf": [
225
+ {
226
+ "type": "string",
227
+ "pattern": "^[a-f0-9]{64}$"
228
+ },
229
+ {
230
+ "type": "null"
231
+ }
232
+ ]
233
+ },
234
+ "verification_sha256": {
235
+ "anyOf": [
236
+ {
237
+ "type": "string",
238
+ "pattern": "^[a-f0-9]{64}$"
239
+ },
240
+ {
241
+ "type": "null"
242
+ }
243
+ ]
244
+ },
245
+ "rollback": {
246
+ "anyOf": [
247
+ {"type": "null"},
248
+ {
249
+ "type": "object",
250
+ "additionalProperties": false,
251
+ "required": ["strategy", "status", "reason", "reference"],
252
+ "properties": {
253
+ "strategy": {"enum": ["rollback", "roll_forward", "operator_handoff"]},
254
+ "status": {"enum": ["not_needed", "required", "completed", "failed", "unknown"]},
255
+ "reason": {"type": "string", "minLength": 1, "maxLength": 4096, "pattern": "^[^\\u0000]+$"},
256
+ "reference": {
257
+ "anyOf": [
258
+ {"type": "null"},
259
+ {
260
+ "type": "object", "additionalProperties": false, "required": ["kind", "id"],
261
+ "properties": {
262
+ "kind": {"type": "string", "minLength": 1, "maxLength": 4096, "pattern": "^[^\\u0000]+$"},
263
+ "id": {"type": "string", "minLength": 1, "maxLength": 4096, "pattern": "^[^\\u0000]+$"}
264
+ }
265
+ }
266
+ ]
267
+ }
268
+ }
269
+ }
270
+ ]
271
+ },
272
+ "limitations": {
273
+ "type": "array",
274
+ "maxItems": 4096,
275
+ "uniqueItems": true,
276
+ "items": {
277
+ "type": "string",
278
+ "minLength": 1,
279
+ "maxLength": 16384,
280
+ "pattern": "^[^\\u0000]+$"
281
+ }
282
+ }
283
+ }
284
+ }
285
+ }
286
+ }