@deksden-com/dd-flow-cli 0.9.0-beta.123 → 0.9.0-beta.127

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 (122) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +33 -1
  3. package/dist/build-info.json +7 -7
  4. package/dist/cli/argument-values.js +38 -0
  5. package/dist/cli/command-inputs.js +4 -3
  6. package/dist/cli/help.js +1 -0
  7. package/dist/cli/hook-ingress.js +1 -1
  8. package/dist/cli/run-cli.js +126 -193
  9. package/dist/cli/runtime-maintenance-diagnostics.js +46 -0
  10. package/dist/cli/runtime-maintenance-ingress.js +51 -0
  11. package/dist/cli/runtime-process.js +128 -0
  12. package/dist/cli.js +8 -5
  13. package/dist/domain/stage-catalog.js +1 -1
  14. package/dist/harness-runtime/bin/dd-agy.mjs +3 -2
  15. package/dist/harness-runtime/bin/dd-codex.mjs +3 -2
  16. package/dist/harness-runtime/bin/dd-droid.mjs +3 -2
  17. package/dist/harness-runtime/bin/dd-grok.mjs +16 -6
  18. package/dist/harness-runtime/bin/dd-opencode.mjs +3 -2
  19. package/dist/harness-runtime/bin/dd-zcode.mjs +20 -16
  20. package/dist/harness-runtime/lib/adapter-timeouts.d.mts +5 -0
  21. package/dist/harness-runtime/lib/adapter-timeouts.mjs +34 -0
  22. package/dist/harness-runtime/lib/codex-capacity-policy.d.mts +10 -0
  23. package/dist/harness-runtime/lib/codex-capacity-policy.mjs +89 -0
  24. package/dist/harness-runtime/lib/daemon-observation.d.mts +2 -0
  25. package/dist/harness-runtime/lib/daemon-observation.mjs +163 -0
  26. package/dist/harness-runtime/lib/daemon-operations.mjs +159 -15
  27. package/dist/harness-runtime/lib/dd-agy-daemon.mjs +215 -86
  28. package/dist/harness-runtime/lib/dd-agy.mjs +11 -13
  29. package/dist/harness-runtime/lib/dd-codex-daemon.mjs +47 -23
  30. package/dist/harness-runtime/lib/dd-codex.mjs +257 -99
  31. package/dist/harness-runtime/lib/dd-droid-daemon.mjs +32 -30
  32. package/dist/harness-runtime/lib/dd-droid.mjs +117 -31
  33. package/dist/harness-runtime/lib/dd-grok-daemon.mjs +96 -38
  34. package/dist/harness-runtime/lib/dd-grok.mjs +15 -13
  35. package/dist/harness-runtime/lib/dd-opencode-daemon.mjs +54 -20
  36. package/dist/harness-runtime/lib/dd-opencode.mjs +44 -14
  37. package/dist/harness-runtime/lib/dd-zcode-daemon.mjs +81 -76
  38. package/dist/harness-runtime/lib/dd-zcode.mjs +204 -116
  39. package/dist/harness-runtime/lib/driver-recovery.mjs +12 -2
  40. package/dist/harness-runtime/lib/lease-renewal.d.mts +8 -0
  41. package/dist/harness-runtime/lib/lease-renewal.mjs +23 -0
  42. package/dist/harness-runtime/lib/lifecycle-command.d.mts +3 -3
  43. package/dist/harness-runtime/lib/lifecycle-command.mjs +74 -20
  44. package/dist/harness-runtime/lib/managed-daemon.d.mts +11 -0
  45. package/dist/harness-runtime/lib/managed-daemon.mjs +321 -65
  46. package/dist/harness-runtime/lib/native-children.d.mts +13 -0
  47. package/dist/harness-runtime/lib/native-children.mjs +78 -0
  48. package/dist/harness-runtime/lib/native-hook-command.d.mts +4 -0
  49. package/dist/harness-runtime/lib/native-hook-command.mjs +115 -11
  50. package/dist/harness-runtime/lib/native-streams.mjs +45 -0
  51. package/dist/harness-runtime/lib/observation-clock.d.mts +18 -0
  52. package/dist/harness-runtime/lib/observation-clock.mjs +73 -17
  53. package/dist/harness-runtime/lib/operation-errors.d.mts +14 -0
  54. package/dist/harness-runtime/lib/operation-errors.mjs +105 -8
  55. package/dist/harness-runtime/lib/operation-progress.d.mts +7 -0
  56. package/dist/harness-runtime/lib/operation-progress.mjs +112 -0
  57. package/dist/harness-runtime/lib/process-json.mjs +136 -38
  58. package/dist/harness-runtime/lib/tool-observations.d.mts +1 -0
  59. package/dist/harness-runtime/lib/tool-observations.mjs +5 -2
  60. package/dist/harness-runtime/lib/zcode-usage.mjs +3 -2
  61. package/dist/runtime/context.js +8 -4
  62. package/dist/schemas/flow-run.schema.json +1 -0
  63. package/dist/schemas/plan-review-decision.schema.json +3 -3
  64. package/dist/schemas/run-control-receipt.schema.json +19 -0
  65. package/dist/services/code-checks.js +93 -27
  66. package/dist/services/codex-capacity.js +251 -74
  67. package/dist/services/codex-hook-delivery.js +2 -2
  68. package/dist/services/compatibility-preflight.js +4 -1
  69. package/dist/services/controller-fanout.js +9 -75
  70. package/dist/services/engines.js +70 -20
  71. package/dist/services/eval-snapshots.js +179 -40
  72. package/dist/services/external-work-launch.js +21 -9
  73. package/dist/services/harness-adapter.js +195 -25
  74. package/dist/services/hooks.js +65 -21
  75. package/dist/services/lifecycle-invocations.js +404 -32
  76. package/dist/services/managed-lease-monitor.js +128 -0
  77. package/dist/services/managed-processes.js +117 -53
  78. package/dist/services/merge-server.js +66 -23
  79. package/dist/services/recovery-observation-budget.js +67 -7
  80. package/dist/services/recovery-snapshot-database.js +7 -4
  81. package/dist/services/review-deferral.js +23 -0
  82. package/dist/services/run-control-receipt.js +1 -1
  83. package/dist/services/run-control-worker.js +177 -118
  84. package/dist/services/run-control.js +99 -8
  85. package/dist/services/run-controller-adapter.js +177 -51
  86. package/dist/services/run-controller-capture.js +14 -2
  87. package/dist/services/run-controller-process.js +11 -4
  88. package/dist/services/run-controller-recovery.js +17 -0
  89. package/dist/services/run-controller-state.js +68 -7
  90. package/dist/services/run-controller.js +207 -107
  91. package/dist/services/run-fork.js +8 -3
  92. package/dist/services/run-recovery-guard.js +75 -0
  93. package/dist/services/run-recovery-runtime.js +21 -30
  94. package/dist/services/run-recovery.js +17 -13
  95. package/dist/services/runs.js +40 -7
  96. package/dist/services/runtime-budget.js +32 -15
  97. package/dist/services/runtime-scope-control.js +8 -0
  98. package/dist/services/runtime-scope-resume.js +30 -8
  99. package/dist/services/runtime-scope-worker.js +118 -73
  100. package/dist/services/runtime-service.js +6 -7
  101. package/dist/services/scope-writer-cleanup.js +3 -2
  102. package/dist/services/stage-context.js +135 -0
  103. package/dist/services/stage-lifecycle.js +3 -15
  104. package/dist/services/stage-pause.js +3 -2
  105. package/dist/services/usage.js +14 -3
  106. package/dist/services/verification-matrix.js +30 -1
  107. package/dist/services/vnext-code-review.js +26 -13
  108. package/dist/services/vnext-code.js +10 -8
  109. package/dist/services/vnext-contracts.js +10 -1
  110. package/dist/services/vnext-execution-profile.js +75 -2
  111. package/dist/services/vnext-fanout.js +5 -0
  112. package/dist/services/vnext-merge.js +30 -11
  113. package/dist/services/vnext-plan-review.js +102 -35
  114. package/dist/services/vnext-plan.js +9 -7
  115. package/dist/services/vnext-protocolize.js +15 -9
  116. package/dist/services/vnext-specify.js +6 -6
  117. package/dist/services/work-registry.js +43 -6
  118. package/dist/services/workspace-bootstrap.js +14 -3
  119. package/dist/shared/errors.js +11 -6
  120. package/dist/storage/agent-output.js +26 -0
  121. package/dist/storage/database.js +80 -21
  122. package/package.json +7 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @deksden-com/dd-flow-cli
2
2
 
3
+ ## 0.9.0-beta.127
4
+
5
+ ### Patch Changes
6
+
7
+ - Scope boundary consistency to productive RUN authority and retain accepted Work results across snapshot relocation without requiring unchanged provider service files.
8
+ - Reject conflicting retained native operation inputs before transport dispatch, preserving the same conflict classification across all harness observers.
9
+ - Distinguish recoverable pre-shutdown refusal from durable unclean shutdown in full-cycle fixtures. Verify clean settlement or retained blocker custody before teardown, with native operation-inspection and cancel-tree parameter parity.
10
+
11
+ ## 0.9.0-beta.126
12
+
13
+ ### Patch Changes
14
+
15
+ - Separate existing controller renewal from productive launch admission, allowing terminal RUNs to finish sealed boundary capture and native settlement.
16
+ - Make terminal stop retain durable cleanup without changing subject outcomes or reopening productive recovery; expose scoped read-only finalization diagnostics.
17
+ - Verify final snapshot identity and physical retirement before full-cycle fixture teardown.
18
+
19
+ ## 0.9.0-beta.124
20
+
21
+ ### Patch Changes
22
+
23
+ - Stop only two confirmed continuation overload refusals within the inclusive two-minute window, preserving native refusal times and exact owner admission across recovery.
24
+
25
+ Retain final PLAN check obligations, completion markers and native output bytes in verification evidence; require canonical fixes for duplicated CODE P0/P1 findings.
26
+
27
+ Join native daemon cleanup before durable stop acknowledgement and reconcile already-closed provider bridges without replay.
28
+
3
29
  ## 0.9.0-beta.123
4
30
 
5
31
  ### Patch Changes
package/README.md CHANGED
@@ -3,6 +3,29 @@
3
3
  See [dd-zcode integration](src/harness-runtime/DD-ZCODE.md) for native transport,
4
4
  adapter ownership and the versioned bridge contract.
5
5
 
6
+ ## Native daemon shutdown
7
+
8
+ `daemon.stop` fences productive dispatch before awaiting settlement. A successful
9
+ durable stop receipt follows native tree settlement, physical provider exit,
10
+ journal drain and required resource/auth finalization. The endpoint then retires
11
+ before ACK; clients also verify the retained daemon PID has exited. A missing
12
+ socket alone is not physical shutdown proof.
13
+
14
+ Partial cleanup preserves the same incarnation's completed phases in
15
+ `daemon.json` (`dd-flow/daemon-shutdown@1`). A fresh control operation can finish
16
+ remaining cleanup without replaying agent work or inspecting a closed pipe.
17
+ Failed operation IDs remain immutable. Unknown ownership and persistent EPERM
18
+ remain failures; never remove sockets or repair runtime databases manually to
19
+ make an outcome look clean.
20
+
21
+ Shutdown proof records `required_phases`; every recorded phase must be complete,
22
+ including native tree and daemon resource settlement. A `clean` label without
23
+ this proof cannot authorize retained restart. `stopping`, `cleanup_failed` and
24
+ `unclean` cannot start a replacement native bridge. Forced AGY termination
25
+ without a current native terminal receipt is unclean, even after a previous
26
+ successful Turn. Mandatory stream-journal failures remain failures after
27
+ physical cleanup. Listener retirement must not unlink a replacement endpoint.
28
+
6
29
  ## Managed temporary HTTP services
7
30
 
8
31
  For an interactive scenario, `runtime process start --run <RUN-ID>
@@ -448,12 +471,21 @@ remain invalid and receive a standalone retry.
448
471
  Local verification for this repository:
449
472
 
450
473
  ```bash
451
- pnpm test
452
474
  pnpm typecheck
453
475
  pnpm lint
454
476
  pnpm build
477
+ pnpm test
455
478
  ```
456
479
 
480
+ Build once before testing: release contracts and native fixtures verify the
481
+ copied `dist` bytes. `pnpm test` remains release → integration → runtime-sensitive.
482
+ For development use `pnpm test:fast`, `pnpm test:core` or `pnpm test:flow` plus
483
+ the affected native contracts; these subsets are not full acceptance.
484
+ New files default to serial core execution. A forced serial fallback is
485
+ `pnpm test:integration --no-file-parallelism --maxWorkers=1`.
486
+ The [test-suite verification runbook](https://github.com/deksden-com/dd-eval/blob/docs/066-test-suite-optimization/runbooks/flow-test-suite-verification.md)
487
+ owns group qualification, complete reports and cross-repository commands.
488
+
457
489
  Manual smoke checks should use a temporary `DD_FLOW_HOME` when they do not intentionally inspect the operator's real local state.
458
490
 
459
491
  ### RUN status during recovery
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "cli_package": "@deksden-com/dd-flow-cli",
3
- "cli_version": "0.9.0-beta.123",
4
- "cli_commit": "0d75e9e7e18868fbe9eee8d51e4c4d06ab03a8cd",
5
- "built_at": "2026-09-30T12:08:03.924Z",
3
+ "cli_version": "0.9.0-beta.127",
4
+ "cli_commit": "8c98b4fa9e0f69be85ef616d7c7c3dac884fc0f5",
5
+ "built_at": "2026-10-11T11:57:17.805Z",
6
6
  "built_with_canon": {
7
7
  "version": "4.1.2",
8
- "commit": "bbb3845083d7c1984bb61d813dd6700fe695180a",
8
+ "commit": "2ba0b9ceedf8e4544ad9566c240ef37ea5e8d099",
9
9
  "flow_contract": "dd-flow-canonical-2026-08",
10
- "repo_root": "/home/runner/work/dd-flow-cli/dd-flow-cli/dd-memorybank",
11
- "memorybank_root": "/home/runner/work/dd-flow-cli/dd-flow-cli/dd-memorybank/.memory-bank",
12
- "flow_root": "/home/runner/work/dd-flow-cli/dd-flow-cli/dd-memorybank/.memory-bank/dd-flow",
10
+ "repo_root": "/Users/deksden/.dd-eval/qualification/cp-214-release-canon",
11
+ "memorybank_root": "/Users/deksden/.dd-eval/qualification/cp-214-release-canon/.memory-bank",
12
+ "flow_root": "/Users/deksden/.dd-eval/qualification/cp-214-release-canon/.memory-bank/dd-flow",
13
13
  "layout": "dot_memory_bank"
14
14
  }
15
15
  }
@@ -0,0 +1,38 @@
1
+ import { AppError } from "../shared/errors.js";
2
+ const flagValue = "__dd_flow_flag__";
3
+ export function optionalOption(parsed, key) {
4
+ const values = parsed.options.get(key);
5
+ const value = values?.[values.length - 1];
6
+ if (value === flagValue)
7
+ throw new AppError("usage", `--${key} requires a value`, 2);
8
+ if (value !== undefined && !value.trim())
9
+ throw new AppError("usage", `--${key} requires a non-empty value`, 2);
10
+ return value;
11
+ }
12
+ export function requiredOption(parsed, key) {
13
+ const value = optionalOption(parsed, key);
14
+ if (!value) {
15
+ throw new AppError("usage", `Missing required option: --${key}`, 2);
16
+ }
17
+ return value;
18
+ }
19
+ export function optionalNumber(parsed, key) {
20
+ const value = optionalOption(parsed, key);
21
+ if (typeof value === "undefined") {
22
+ return undefined;
23
+ }
24
+ const parsedNumber = Number(value);
25
+ if (!Number.isFinite(parsedNumber)) {
26
+ throw new AppError("validation", `--${key} must be a number`, 2);
27
+ }
28
+ return parsedNumber;
29
+ }
30
+ export function optionalPositiveNumber(parsed, key, integer = false) {
31
+ const value = optionalNumber(parsed, key);
32
+ if (typeof value === "undefined")
33
+ return undefined;
34
+ if (value <= 0 || (integer && !Number.isInteger(value))) {
35
+ throw new AppError("validation", `--${key} must be a positive${integer ? " integer" : ""} number`, 2);
36
+ }
37
+ return value;
38
+ }
@@ -15,6 +15,7 @@ const control = "project-root run";
15
15
  /** Path-shaped arguments default to physical paths unless the route explicitly
16
16
  * opts into contextualPaths. This inventory does not expand arbitrary strings. */
17
17
  export const physicalPathOptions = new Set(words("root project-root workspace-root workspace-path path dir file schema-dir output result-file semantic-file data decision-file verification-file reason-file task-file intake-file context-file observations-file observation-file summary-file question-file answer-file payload-file json-file task-profile-file execution-routing-file protocol-override-file manifest-file routing-file config-file input-file report-file snapshot-file output-dir state-dir capture-root capture-path destination source archive snapshot plan-file backup-path database backup source-home target-home stdout stderr adapter-executable memory-bank flow stage-report dashboard report"));
18
+ physicalPathOptions.add("operational-decision-file");
18
19
  export const commandInputs = {
19
20
  "version": route(0),
20
21
  "status": route(0, "", "root project-root", "check-registry"),
@@ -102,8 +103,8 @@ export const commandInputs = {
102
103
  "run snapshot bootstrap create": route(0, `${project} output`),
103
104
  "run snapshot bootstrap restore": route(0, `${project} snapshot`),
104
105
  "run snapshot create": route(1, `${project} output`, "recovery-id stage-entry", "candidate incomplete"),
105
- "run snapshot restore": route(0, `${project} snapshot`, "execution-routing-file recovery-id"),
106
- "run fork": route(0, "from output engine-version request-id", "integrity-checksum"),
106
+ "run snapshot restore": route(0, `${project} snapshot`, "execution-routing-file operational-decision-file recovery-id"),
107
+ "run fork": route(0, "from output engine-version request-id", "integrity-checksum operational-decision-file"),
107
108
  "run drive status": route(0, control, "after"),
108
109
  "run drive launch": route(0, `${control} request-id context-file context-sha256`, "stop-after capture-root"),
109
110
  "run drive serve": route(0, `${control} controller-id`),
@@ -125,7 +126,7 @@ export const commandInputs = {
125
126
  "runtime process check-admission": route(0, "id lease-token"),
126
127
  "runtime process start": route(0, `${control} command ports ready-port`, "ready-path ready-timeout-ms"),
127
128
  "runtime process stop": route(0, "id lease-token", "grace-ms"),
128
- "runtime process register": route(0, "kind owner", "lease-ms budget-json project-id run pid process-group-id owner-pid work check operation stdout stderr harness dispatch-barrier role state-dir adapter-executable"),
129
+ "runtime process register": route(0, "kind owner", "id lease-ms budget-json project-id run pid process-group-id owner-pid work check operation stdout stderr harness dispatch-barrier role state-dir adapter-executable"),
129
130
  "runtime process confirm": route(0, "id lease-token pid", "owner-pid lease-ms process-group-id"),
130
131
  "runtime process heartbeat": route(0, "id lease-token", "lease-ms"),
131
132
  "runtime process admission": route(0, "id lease-token owner state-dir", "daemon-id operation-id operation native-session-id prompt-sha256"),
package/dist/cli/help.js CHANGED
@@ -213,6 +213,7 @@ RUN-* is the execution envelope for one concrete flow launch. Semantic truth rem
213
213
 
214
214
  run start and prepare-vnext-specify accept --execution-routing-file for vNext RUNs: dd-flow/execution-routing@1 with an execution object selects the complete routing policy from existing agent-profiles. RUN creation freezes the input and selected profiles without changing project settings.
215
215
  run snapshot restore also accepts --execution-routing-file for a new stage-entry experiment. Its fresh DD_FLOW_HOME may contain only agent-profiles and the empty database; selected profiles are read before import, previous RUN policy is archived, and existing Work overrides must resolve against the selected frozen profiles. Recovery imports reject this option.
216
+ run snapshot restore and run fork accept --operational-decision-file for an explicitly accepted decision bound to the new stage-entry experiment. Store the input outside fork output; its bytes are bound to the idempotent request. A snapshot with a scoped decision cannot grant it to another execution implicitly. Recovery retains the original decision and rejects replacement.
216
217
  run fork restores one sealed stage-entry snapshot to an isolated project and DD_FLOW_HOME, archives source authority, then binds an exact engine only in that copy. It is idempotent by request ID and output receipt; it never resumes a provider session or changes its source RUN.
217
218
  run prepare-vnext-specify allocates an otherwise unstarted vNext RUN for the canonical SPECIFY entry checkpoint. run recovery makes an interrupted RUN read-only, requires an explicit settled-tree receipt, captures immutable recovery evidence, then explicitly returns delegated Work to the ready graph. run snapshot is the eval-only checkpoint boundary: it snapshots one quiescent RUN, its dedicated DD_FLOW_HOME, and the exact project tree including its Git repository, then restores them into a fresh dedicated runtime. It is not a general runtime backup command and fails closed for a shared runtime.
218
219
 
@@ -26,7 +26,7 @@ export async function runHookIngress(args) {
26
26
  const payload = parseJsonObject(stdin || "{}", "native hook stdin");
27
27
  const command = lifecycleCommandFromPayload(payload);
28
28
  const analysis = command ? parseLifecycleCommand(command) : { kind: "none", unresolved: false };
29
- if (event !== "PreToolUse" || !command || (analysis.kind === "none" && !analysis.unresolved && !continuationCommand(command))) {
29
+ if (event !== "PreToolUse" || !command || (analysis.kind === "none" && (!("participation" in analysis) || !["lifecycle", "auxiliary"].includes(analysis.participation)) && !continuationCommand(command))) {
30
30
  process.stdout.write("{}\n");
31
31
  return 0;
32
32
  }