@deksden-com/dd-flow-cli 0.9.0-beta.7 → 0.9.0-beta.74

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 (121) hide show
  1. package/CHANGELOG.md +396 -0
  2. package/README.md +65 -0
  3. package/dist/build-info.json +10 -10
  4. package/dist/cli/help.js +81 -9
  5. package/dist/cli/run-cli.js +442 -46
  6. package/dist/harness-runtime/bin/dd-agy.mjs +37 -0
  7. package/dist/harness-runtime/bin/dd-codex.mjs +25 -0
  8. package/dist/harness-runtime/bin/dd-droid.mjs +33 -0
  9. package/dist/harness-runtime/bin/dd-grok.mjs +30 -0
  10. package/dist/harness-runtime/bin/dd-opencode.mjs +21 -0
  11. package/dist/harness-runtime/bin/dd-zcode.mjs +83 -0
  12. package/dist/harness-runtime/lib/daemon-operations.mjs +215 -0
  13. package/dist/harness-runtime/lib/dd-agy-daemon.mjs +423 -0
  14. package/dist/harness-runtime/lib/dd-agy.mjs +59 -0
  15. package/dist/harness-runtime/lib/dd-codex-daemon.mjs +141 -0
  16. package/dist/harness-runtime/lib/dd-codex.mjs +438 -0
  17. package/dist/harness-runtime/lib/dd-droid-daemon.mjs +125 -0
  18. package/dist/harness-runtime/lib/dd-droid.mjs +470 -0
  19. package/dist/harness-runtime/lib/dd-grok-daemon.mjs +274 -0
  20. package/dist/harness-runtime/lib/dd-grok.mjs +174 -0
  21. package/dist/harness-runtime/lib/dd-opencode-daemon.mjs +198 -0
  22. package/dist/harness-runtime/lib/dd-opencode.mjs +98 -0
  23. package/dist/harness-runtime/lib/dd-zcode-daemon.mjs +644 -0
  24. package/dist/harness-runtime/lib/dd-zcode.mjs +910 -0
  25. package/dist/harness-runtime/lib/dispatch-fence.mjs +14 -0
  26. package/dist/harness-runtime/lib/driver-recovery.mjs +129 -0
  27. package/dist/harness-runtime/lib/droid-observation.mjs +66 -0
  28. package/dist/harness-runtime/lib/managed-daemon.mjs +260 -0
  29. package/dist/harness-runtime/lib/model-observations.mjs +77 -0
  30. package/dist/harness-runtime/lib/native-hook-command.mjs +34 -0
  31. package/dist/harness-runtime/lib/observation-clock.mjs +36 -0
  32. package/dist/harness-runtime/lib/operation-context.mjs +5 -0
  33. package/dist/harness-runtime/lib/operation-errors.mjs +19 -0
  34. package/dist/harness-runtime/lib/process-json.mjs +70 -0
  35. package/dist/harness-runtime/lib/process-snapshot.mjs +10 -0
  36. package/dist/harness-runtime/lib/runner-events.mjs +200 -0
  37. package/dist/harness-runtime/lib/runner-lock.mjs +42 -0
  38. package/dist/harness-runtime/lib/session-settlement.mjs +30 -0
  39. package/dist/harness-runtime/lib/tool-observations.d.mts +17 -0
  40. package/dist/harness-runtime/lib/tool-observations.mjs +153 -0
  41. package/dist/runtime/context.js +3 -1
  42. package/dist/schemas/agent-profile.schema.json +1 -1
  43. package/dist/schemas/code-review-result.schema.json +2 -2
  44. package/dist/schemas/code-work-batch.schema.json +4 -3
  45. package/dist/schemas/code-work-result.schema.json +4 -4
  46. package/dist/schemas/harness-config.schema.json +23 -0
  47. package/dist/schemas/plan-review-result.schema.json +2 -2
  48. package/dist/schemas/run-control-receipt.schema.json +99 -0
  49. package/dist/schemas/run-control-request.schema.json +36 -0
  50. package/dist/schemas/vnext-protocol-plan.schema.json +2 -2
  51. package/dist/services/cleanup.js +8 -5
  52. package/dist/services/cli-operation-classifier.js +11 -1
  53. package/dist/services/code-checks.js +543 -96
  54. package/dist/services/controller-fanout.js +120 -0
  55. package/dist/services/dashboard.js +9 -0
  56. package/dist/services/engines.js +50 -19
  57. package/dist/services/eval-snapshots.js +639 -60
  58. package/dist/services/execution-policy.js +177 -0
  59. package/dist/services/external-work-launch.js +110 -0
  60. package/dist/services/harness-adapter.js +147 -24
  61. package/dist/services/harness-config.js +68 -0
  62. package/dist/services/hooks.js +413 -168
  63. package/dist/services/lanes.js +1 -1
  64. package/dist/services/lifecycle-command.js +74 -6
  65. package/dist/services/lifecycle-invocations.js +637 -0
  66. package/dist/services/managed-daemon-binding.js +38 -0
  67. package/dist/services/managed-processes.js +138 -22
  68. package/dist/services/merge-queue.js +6 -6
  69. package/dist/services/merge-server.js +75 -29
  70. package/dist/services/migrations.js +1 -1
  71. package/dist/services/native-daemon-history.js +49 -0
  72. package/dist/services/native-session-control.js +39 -0
  73. package/dist/services/projects.js +7 -3
  74. package/dist/services/prompts.js +4 -2
  75. package/dist/services/protocols.js +11 -2
  76. package/dist/services/recovery-observation-budget.js +61 -0
  77. package/dist/services/recovery-snapshot-database.js +107 -0
  78. package/dist/services/run-control-receipt.js +56 -0
  79. package/dist/services/run-control-worker.js +363 -0
  80. package/dist/services/run-control.js +876 -0
  81. package/dist/services/run-controller-adapter.js +211 -0
  82. package/dist/services/run-controller-capture.js +134 -0
  83. package/dist/services/run-controller-process.js +189 -0
  84. package/dist/services/run-controller-recovery.js +222 -0
  85. package/dist/services/run-controller-state.js +31 -0
  86. package/dist/services/run-controller.js +733 -0
  87. package/dist/services/run-engine-bindings.js +20 -62
  88. package/dist/services/run-fork.js +124 -0
  89. package/dist/services/run-observations.js +112 -0
  90. package/dist/services/run-recovery-runtime.js +69 -0
  91. package/dist/services/run-recovery.js +327 -0
  92. package/dist/services/runs.js +280 -40
  93. package/dist/services/runtime-budget.js +362 -0
  94. package/dist/services/runtime-scope-capture.js +50 -0
  95. package/dist/services/runtime-scope-control.js +450 -0
  96. package/dist/services/runtime-scope-resume.js +543 -0
  97. package/dist/services/runtime-scope-stop.js +99 -0
  98. package/dist/services/runtime-scope-worker.js +210 -0
  99. package/dist/services/runtime-service.js +96 -0
  100. package/dist/services/schema-validation.js +12 -12
  101. package/dist/services/stage-context.js +2 -2
  102. package/dist/services/stage-lifecycle.js +32 -10
  103. package/dist/services/stage-pause.js +25 -13
  104. package/dist/services/usage.js +37 -93
  105. package/dist/services/vnext-code-review.js +149 -89
  106. package/dist/services/vnext-code.js +223 -215
  107. package/dist/services/vnext-execution-profile.js +5 -3
  108. package/dist/services/vnext-fanout.js +135 -21
  109. package/dist/services/vnext-merge.js +258 -89
  110. package/dist/services/vnext-plan-review.js +75 -64
  111. package/dist/services/vnext-plan.js +77 -29
  112. package/dist/services/vnext-protocolize.js +21 -14
  113. package/dist/services/vnext-specify.js +26 -16
  114. package/dist/services/work-registry.js +592 -154
  115. package/dist/services/workspace-bootstrap.js +76 -0
  116. package/dist/shared/errors.js +12 -0
  117. package/dist/storage/database.js +341 -31
  118. package/dist/storage/writer-contract.js +77 -0
  119. package/dist/storage/writer-migration.js +102 -0
  120. package/package.json +20 -13
  121. package/tools/repair-paused-run-status.mjs +59 -0
package/dist/cli/help.js CHANGED
@@ -1,4 +1,37 @@
1
1
  const helpPages = new Map([
2
+ ["runtime scope", `Usage:
3
+ dd-flow runtime scope fence --scope-id EVAL_ID --request-id ID --json
4
+ dd-flow runtime scope status --scope-id EVAL_ID --json
5
+ dd-flow runtime scope stop --scope-id EVAL_ID --request-id ID --json
6
+ dd-flow runtime scope control --scope-id EVAL_ID --request-id ID --mode pause|stop [--manifest-json JSON] --json
7
+ dd-flow runtime scope resume --scope-id EVAL_ID --request-id ID --generation N --capture-key SHA256 --json
8
+ dd-flow runtime scope reconcile --scope-id EVAL_ID --generation N --request-id ID --json
9
+
10
+ Use the EVAL manifest's retained DD_FLOW_RESOURCE_HOME. Commands select exactly
11
+ one scope across its registered runtime homes; neighboring scopes are untouched.
12
+ fence durably blocks new provider turns and owned baseline checks. It does not
13
+ stop existing work. status reports retained ownership, not proof of settlement.
14
+ stop fences first and requests owned daemon-tree and baseline-process cleanup.
15
+ Inspect settled and each node's evidence: ok alone does not prove cleanup.
16
+ Unproven ownership or cleanup remains pending; repeat stop to observe settlement.
17
+ The fence/stop route is terminal cancellation and has no resume command.
18
+ control records recoverable scope intent and starts a detached drain owner.
19
+ The EVAL resolver supplies a runtime-scope-manifest@1 declaration with the source
20
+ manifest path, SHA-256 and execution IDs, including queued executions. Declaration
21
+ changes are rejected. resume accepts the exact captured generation and starts
22
+ detached recovery preparation. It does not yet release scope admission: inspect
23
+ dispatch_blocked and pending reasons; accepted preparation is not resumed work.
24
+ RUN pause/stop/resume uses dd-flow run control.`],
25
+ ["storage", `Usage:
26
+ dd-flow storage migrate-writer --database ABSOLUTE_DB --backup NEW_ABSOLUTE_FILE --offline --json
27
+
28
+ Drain all local and external runtime owners before using --offline. This command
29
+ migrates one existing database, not a whole runtime or retained provider Session.
30
+ It refuses unresolved ownership rows, preserves a verified WAL-safe backup, and
31
+ fences unaware old writers. It does not initialize the default DD_FLOW_HOME.
32
+ The backup path must be new; existing backups are never overwritten. An exact
33
+ retry of a committed migration returns its receipt after verifying the backup.
34
+ If no committed receipt exists, retain the failed backup and choose a new path.`],
2
35
  [
3
36
  "",
4
37
  `dd-flow - mechanical control layer for dd-flow workflows
@@ -33,11 +66,14 @@ Core commands:
33
66
  session register/status/stop Register flow sessions and stop workers.
34
67
  dashboard data/render/open/refresh Render, refresh, open, and inspect project/global dashboards.
35
68
  schema validate Validate canonical dd-flow JSON data contracts.
69
+ storage migrate-writer Explicitly back up and fence a drained SQLite store.
70
+ runtime scope fence/status/stop Fence, inspect, or cancel one retained EVAL scope.
36
71
  memory permissions preflight Check Memory Bank write/read permissions.
37
72
  integration cmux status Inspect optional cmux integration.
38
73
  codex home/hooks/hook Manage Codex homes, hooks, and hook events.
39
74
  zcode event/usage Ingest trusted zcode-acp lifecycle and usage evidence.
40
75
  grok event/usage Ingest trusted Grok Build lifecycle and usage evidence.
76
+ droid event/usage Ingest trusted Factory Droid lifecycle and physical usage evidence.
41
77
  opencode event/usage Ingest trusted OpenCode lifecycle and usage evidence.
42
78
  agy event/usage Ingest trusted Antigravity CLI lifecycle and usage evidence.
43
79
  worktree plan/create/status Record Worktrunk-backed feature worktrees.
@@ -152,12 +188,18 @@ Usage:
152
188
  dd-flow run start --project-root <root> [--workspace-root <checkout>] --flow-kind <kind> --subject-type <type> --subject-id <id> --slug <slug> [--preset compact|normal|full] [--task-profile-file <file>] [--protocol-override-file <file>] [--flag key=value] [--next-action <text>] --json
153
189
  dd-flow id next --type protocol|run --project-root <root> --slug <slug> --json
154
190
  dd-flow run status <RUN-ID|RUN-short-id> --project-root <root> --json
191
+ dd-flow run control status --run <RUN-ID> --project-root <root> --json
192
+ dd-flow run control reconcile --run <RUN-ID> --project-root <root> --control-id <ID> --request-id <ID> --json
193
+ dd-flow run drive launch --run <RUN-ID> --project-root <root> --request-id <id> --context-file <file> --context-sha256 <sha256> [--stop-after <stage>] [--capture-root <directory>] --json
194
+ dd-flow run drive status --run <RUN-ID> --project-root <root> [--after <sequence>] --json
155
195
  dd-flow run list --project-root <root> --json
156
- dd-flow run prepare-vnext-specify --project-root <root> --slug <slug> --json
157
- dd-flow run snapshot create <RUN-ID|RUN-short-id> (--stage-entry <stage>|--candidate) --project-root <root> --output <directory> --json
158
- dd-flow run snapshot restore --snapshot <directory> --project-root <prepared-root> --json
196
+ dd-flow run prepare-vnext-specify --project-root <root> --slug <slug> [--execution-routing-file <file>] --json
197
+ dd-flow run recovery inspect|begin|seal|capture|resume <RUN-ID|RUN-short-id> --project-root <root> --json
198
+ dd-flow run snapshot create <RUN-ID|RUN-short-id> (--stage-entry <stage>|--candidate|--incomplete|--recovery-id <RCV-ID>) --project-root <root> --output <directory> --json
199
+ dd-flow run snapshot restore --snapshot <directory> --project-root <prepared-root> [--recovery-id <RCV-ID>] --json
159
200
  dd-flow run snapshot bootstrap create --project-root <root> --output <directory> --json
160
201
  dd-flow run snapshot bootstrap restore --snapshot <directory> --project-root <prepared-root> --json
202
+ dd-flow run fork --from <sealed-stage-entry-snapshot> --output <empty-directory> --engine-version <exact-version> --request-id <id> [--integrity-checksum <sha256>] --json
161
203
  dd-flow run timeline <RUN-ID|RUN-short-id> --project-root <root> --json
162
204
  dd-flow stat usage --run <RUN-ID|RUN-short-id> --project-root <root> [--stage <stage[,stage...]>] [--session <session-id>] --json
163
205
  dd-flow stat run sessions ls --run <RUN-ID|RUN-short-id> --project-root <root> --json
@@ -169,7 +211,12 @@ Usage:
169
211
 
170
212
  RUN-* is the execution envelope for one concrete flow launch. Semantic truth remains in protocol, experiment, DEF, scenario, evidence, and Memory Bank documents. New run artifacts are stored under DD_FLOW_HOME/projects/<PRJ-ID-slug>/runs/<RUN-ID-slug>/ with one run.json projection and an append-only timeline.jsonl. Timeline is the compact full run report: summary is always present, while --hide may suppress bulky sections. Use \`dd-flow stat usage --run …\` to reread registered local Codex transcript counters and tool-call facts and refresh the current usage projection; unavailable data is explicit rather than zero.
171
213
 
172
- run prepare-vnext-specify allocates an otherwise unstarted vNext RUN for the canonical SPECIFY entry checkpoint. 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.
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
+ 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 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
+ 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
+ Managed drive is not yet native-provider qualified. With --capture-root, its detached controller fences RUN writers and captures each completed Stage before dispatching its successor. The capture root must be outside the runtime, project and workspace. Status events expose boundary_captured receipts; capturing means writers are still fenced, and capture_failed retains the fence for operator reconciliation. External snapshot creation is rejected while a managed controller owns a live RUN.
173
220
 
174
221
  Examples:
175
222
  dd-flow run start --project-root "$PWD" --flow-kind mb_sdlc --subject-type protocol --subject-id PRT-001-demo --slug demo --json
@@ -190,6 +237,8 @@ Usage:
190
237
  dd-flow stage unblock <RUN-ID|RUN-short-id> --project-root <root> --stage <name> --work <WORK-ID> --json
191
238
  dd-flow stage fanout status <RUN-ID|RUN-short-id> --project-root <root> --stage <name> --json
192
239
  dd-flow stage fanout dispatch <RUN-ID|RUN-short-id> --project-root <root> --stage <name> --json
240
+ dd-flow stage fanout reconcile <RUN-ID> --project-root <root> --stage <name> --observations-file <native-observations.json> --json
241
+ dd-flow stage native observe <RUN-ID> --project-root <root> --stage <name> --observations-file <native-observations.json> --json
193
242
  dd-flow stage finish <RUN-ID|RUN-short-id> --project-root <root> --stage <name> [--semantic-file <RUN-local-json>] --json
194
243
  dd-flow stage finish <RUN-ID|RUN-short-id> --project-root <root> --stage specify (--result-file <RUN-local-specify.json>|--result-stdin) --outcome <specified|failed|cancelled> --json
195
244
 
@@ -203,6 +252,7 @@ Usage:
203
252
  dd-flow work ls (--run <RUN-ID>|--parent <WORK-ID>) [--ready] --json
204
253
  dd-flow work show <WORK-ID> --json
205
254
  dd-flow work start <WORK-ID> --project-root <root> --json
255
+ dd-flow work launch <WORK-ID> [--stage <name>] --json
206
256
  dd-flow work finish <WORK-ID> (--result-file <path>|--result-stdin) --project-root <root> --json
207
257
  dd-flow work repair add --run <RUN-ID> (--from-check <CHECK-ID>|--from-unresolved <gap> --verification-file <file>) --origin-work <WORK-ID>... --task-stdin --project-root <root> --json
208
258
 
@@ -369,11 +419,12 @@ Usage:
369
419
  dd-flow merge request status <MRG-ID> --project-root <root> --json
370
420
  dd-flow merge request route <MRG-ID> --mode same_session|server --reason <text> --project-root <root> --json
371
421
  dd-flow merge apply <MRG-ID> --work <WRK-ID> --project-root <root> --json --progress-jsonl
422
+ dd-flow merge repair <MRG-ID> --project-root <root> --json
372
423
  dd-flow merge serve --agent-profile <id> [--once] [--poll-seconds <n>] [--max-parallel-projects <n>] --progress-jsonl
373
424
  dd-flow merge server status --json
374
425
  dd-flow merge server stop <MSV-ID> --json
375
426
 
376
- CODE or CODE-REVIEW creates one MRG request and child MERGE Work. stage start waits in the shared project FIFO, reports progress, locks the execution target baseline and returns the exact apply/finish commands. merge apply is the only supported initial Git mutation. merge serve is a deterministic dispatcher: it launches a fresh Session through the configured harness adapter but does not perform agent work itself. It preserves FIFO inside each project and may serve different projects concurrently up to the explicit bound.`
427
+ CODE or CODE-REVIEW creates one MRG request and child MERGE Work. stage start waits in the shared project FIFO, reports progress, locks the execution target baseline and returns the exact apply/finish commands. merge apply is the only supported initial Git mutation. If its integration gate fails, merge repair restores the target baseline and creates a source CODE → independent CODE-REVIEW → replacement-MRG cycle; it never patches product code in the integration workspace. merge serve is a deterministic dispatcher: it launches a fresh Session through the configured harness adapter but does not perform agent work itself. It preserves FIFO inside each project and may serve different projects concurrently up to the explicit bound.`
377
428
  ],
378
429
  [
379
430
  "cleanup",
@@ -477,7 +528,7 @@ Dashboards are rendered views of dd-flow state. Markdown remains the compatibili
477
528
  `dd-flow schema - validate canonical dd-flow data contracts
478
529
 
479
530
  Usage:
480
- dd-flow schema validate --schema <name> --file <json-file> [--project-root <root>] [--schema-dir <dir>] --json
531
+ dd-flow schema validate --schema <name> --file <json-file> [--project-root <root>] [--run <RUN>] [--schema-dir <dir>] --json
481
532
 
482
533
  Schema names resolve to <name>.schema.json. Lookup order is --schema-dir, then <project-root>/.memory-bank/dd-flow/schemas/, then <project-root>/dd-flow/schemas/ for canonical checkouts, then bundled CLI schemas. Flow-contract validation runs structural checks first and the runtime's shared semantic normalizer second. If --project-root is omitted, the current working directory is used. JSON mode writes valid results to stdout and structured validation/usage errors to stderr.`
483
534
  ],
@@ -536,17 +587,38 @@ handler resolves the registered project from cwd. The option is only a manual
536
587
  override.
537
588
 
538
589
  Managed homes isolate dd-flow hooks while sharing selected Codex state from the source home.`
590
+ ],
591
+ [
592
+ "zcode hook",
593
+ `dd-flow zcode hook - handle a synchronous native ZCode PreToolUse callback
594
+
595
+ Usage:
596
+ dd-flow zcode hook handle --project-root <root> --json
597
+
598
+ The managed ZCode native hook supplies the callback on stdin. It records the
599
+ receipt before returning a rewritten tool input with --hook-event-id.`
539
600
  ],
540
601
  [
541
602
  "zcode event",
542
- `dd-flow zcode event - ingest a zcode-acp session/update notification
603
+ `dd-flow zcode event - ingest a zcode-acp session/update notification as evidence
543
604
 
544
605
  Usage:
545
606
  dd-flow zcode event handle --project-root <root> --json
546
607
  dd-flow zcode usage ingest --project-root <root> --json
547
608
 
548
- Both payloads are read from stdin. The event adapter retains lifecycle identity;
549
- the usage adapter retains cumulative provider counters for RUN accounting.`
609
+ Both payloads are read from stdin. Native hooks own lifecycle admission; ACP
610
+ events and usage retain secondary evidence for RUN accounting.`
611
+ ],
612
+ [
613
+ "droid event",
614
+ `dd-flow droid event - ingest a controlled Factory Droid Execute hook
615
+
616
+ Usage:
617
+ dd-flow droid event handle --project-root <root> --json
618
+ dd-flow droid usage ingest --project-root <root> --json
619
+
620
+ Reads trusted adapter JSON from stdin. Usage requires physical_session scope and explicit completeness.
621
+ `
550
622
  ],
551
623
  [
552
624
  "opencode event",