@deksden-com/dd-flow-cli 0.9.0-beta.144 → 0.9.0-beta.145
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.
- package/CHANGELOG.md +59 -0
- package/README.md +13 -8
- package/dist/build-info.json +7 -7
- package/dist/cli/command-inputs.js +9 -3
- package/dist/cli/command-metadata.js +33 -14
- package/dist/cli/help.js +32 -1
- package/dist/cli/hook-ingress.js +27 -3
- package/dist/cli/memory-flow-admission.js +7 -3
- package/dist/cli/memory-init-invocation.js +10 -3
- package/dist/cli/memory-init.js +74 -68
- package/dist/cli/memory-storage-admission.js +3 -2
- package/dist/cli/memory-storage-qualification.js +105 -0
- package/dist/cli/memory-storage-transition.js +123 -0
- package/dist/cli/memory-upgrade.js +189 -0
- package/dist/cli/native-hook-ingress.js +14 -4
- package/dist/cli/native-hook-preparation.js +55 -0
- package/dist/cli/response-file.js +2 -1
- package/dist/cli/run-cli.js +70 -32
- package/dist/cli/setup.js +2 -1
- package/dist/cli.js +12 -0
- package/dist/domain/stage-handler-identities.js +8 -0
- package/dist/harness-runtime/bin/dd-agy.mjs +3 -3
- package/dist/harness-runtime/bin/dd-grok.mjs +3 -3
- package/dist/harness-runtime/bin/dd-zcode.mjs +5 -5
- package/dist/harness-runtime/lib/agy-error-boundary.mjs +58 -0
- package/dist/harness-runtime/lib/dd-agy-daemon.mjs +62 -20
- package/dist/harness-runtime/lib/dd-agy.mjs +17 -3
- package/dist/harness-runtime/lib/dd-droid.mjs +1 -1
- package/dist/harness-runtime/lib/dd-grok-daemon.mjs +70 -13
- package/dist/harness-runtime/lib/dd-grok.mjs +6 -3
- package/dist/harness-runtime/lib/dd-zcode.mjs +44 -14
- package/dist/harness-runtime/lib/delegation-instructions.mjs +1 -1
- package/dist/harness-runtime/lib/entity-references.d.mts +2 -0
- package/dist/harness-runtime/lib/entity-references.mjs +9 -0
- package/dist/harness-runtime/lib/managed-daemon.mjs +13 -6
- package/dist/harness-runtime/lib/native-hook-command.mjs +4 -4
- package/dist/harness-runtime/lib/opencode-plugin.mjs +3 -3
- package/dist/harness-runtime/lib/operation-errors.mjs +1 -1
- package/dist/harness-runtime/lib/provider-overload-policy.d.mts +4 -2
- package/dist/harness-runtime/lib/provider-overload-policy.mjs +19 -6
- package/dist/harness-runtime/lib/runner-events.mjs +3 -1
- package/dist/harness-runtime/lib/setup-progress.mjs +8 -6
- package/dist/schemas/mb-upgrade-stage-result.schema.json +863 -0
- package/dist/schemas/memory-repair-work-result.schema.json +9 -2
- package/dist/schemas/release-impact.schema.json +3 -3
- package/dist/schemas/stage-start-response.schema.json +4 -0
- package/dist/services/accepted-intent.js +13 -1
- package/dist/services/canon.js +43 -7
- package/dist/services/cli-operation-classifier.js +1 -1
- package/dist/services/cli-upgrade-allowlist.js +1 -1
- package/dist/services/code-checks.js +11 -4
- package/dist/services/compatibility-preflight.js +5 -2
- package/dist/services/controller-fanout.js +21 -4
- package/dist/services/controller-memory-task.js +45 -0
- package/dist/services/controller-memory-worker.js +48 -0
- package/dist/services/dashboard.js +2 -2
- package/dist/services/descriptor-run-start.js +26 -19
- package/dist/services/descriptor-stage-coordinator.js +30 -10
- package/dist/services/descriptor-stage-start.js +40 -4
- package/dist/services/engines.js +64 -14
- package/dist/services/eval-snapshots.js +104 -93
- package/dist/services/external-work-launch.js +5 -3
- package/dist/services/flow-catalog.js +8 -4
- package/dist/services/frozen-engine.js +113 -11
- package/dist/services/hook-memory-routing.js +188 -0
- package/dist/services/hook-recovery-guard.js +14 -0
- package/dist/services/hook-session-observation.js +24 -0
- package/dist/services/hooks.js +27 -8
- package/dist/services/hybrid-contracts.js +2 -13
- package/dist/services/hybrid-digest.js +14 -0
- package/dist/services/installed-flow-source.js +25 -4
- package/dist/services/lifecycle-invocations.js +33 -5
- package/dist/services/memory-accepted-composition.js +5 -4
- package/dist/services/memory-completed-correction-wave.js +23 -15
- package/dist/services/memory-compose-handler.js +163 -21
- package/dist/services/memory-composition-acceptance.js +186 -10
- package/dist/services/memory-composition-graph.js +42 -11
- package/dist/services/memory-composition-registration.js +23 -8
- package/dist/services/memory-composition-work-custody.js +14 -9
- package/dist/services/memory-composition-work-results.js +15 -3
- package/dist/services/memory-corrected-review-batch.js +10 -3
- package/dist/services/memory-corrected-review-findings.js +4 -2
- package/dist/services/memory-corrected-review-inputs.js +10 -5
- package/dist/services/memory-corrected-review-receipt.js +17 -9
- package/dist/services/memory-corrected-review-registration.js +3 -2
- package/dist/services/memory-correction-check-receipt.js +20 -4
- package/dist/services/memory-custody-snapshot.js +36 -0
- package/dist/services/memory-finish-evidence.js +44 -22
- package/dist/services/memory-finish-handler.js +37 -23
- package/dist/services/memory-finish-integration.js +218 -48
- package/dist/services/memory-finish-readiness.js +66 -19
- package/dist/services/memory-git-integration.js +87 -18
- package/dist/services/memory-historical-corrected-review.js +21 -15
- package/dist/services/memory-historical-original-review.js +22 -9
- package/dist/services/memory-historical-repair-registration.js +14 -8
- package/dist/services/memory-historical-second-review.js +30 -11
- package/dist/services/memory-init-contexts.js +28 -2
- package/dist/services/memory-init-controller-start.js +19 -8
- package/dist/services/memory-init-git-policy.js +50 -21
- package/dist/services/memory-init-lint-capability.js +21 -3
- package/dist/services/memory-init-native-capacity.js +13 -0
- package/dist/services/memory-init-preflight.js +11 -1
- package/dist/services/memory-init-request-candidate.js +73 -17
- package/dist/services/memory-init-request-input.js +23 -7
- package/dist/services/memory-init-run-bundle.js +49 -12
- package/dist/services/memory-init-storage.js +17 -7
- package/dist/services/memory-layer.js +68 -4
- package/dist/services/memory-lint-config.js +111 -2
- package/dist/services/memory-native-review-copy.js +5 -67
- package/dist/services/memory-normal-flow-entry.js +12 -0
- package/dist/services/memory-ordinary-defaults.js +22 -5
- package/dist/services/memory-preflight-handler.js +15 -0
- package/dist/services/memory-repair-current-view.js +1 -1
- package/dist/services/memory-repair-document-delta.js +70 -33
- package/dist/services/memory-repair-history.js +12 -7
- package/dist/services/memory-repair-physical-binding.js +1 -119
- package/dist/services/memory-repair-publication-plan.js +5 -3
- package/dist/services/memory-repair-publication-source.js +1 -1
- package/dist/services/memory-repair-publication.js +3 -2
- package/dist/services/memory-repair-registration.js +2 -1
- package/dist/services/memory-repair-work-baseline.js +4 -2
- package/dist/services/memory-repair-work-completion.js +32 -12
- package/dist/services/memory-repair-work-results.js +21 -2
- package/dist/services/memory-repair-workspace.js +11 -2
- package/dist/services/memory-repair-writer-copy.js +2 -1
- package/dist/services/memory-result-binding.js +78 -12
- package/dist/services/memory-retained-review-authority.js +17 -8
- package/dist/services/memory-retained-second-baseline.js +1 -1
- package/dist/services/memory-retained-second-repairs.js +12 -6
- package/dist/services/memory-review-correction-plan.js +47 -12
- package/dist/services/memory-review-handler.js +17 -17
- package/dist/services/memory-review-inputs.js +55 -9
- package/dist/services/memory-review-limits.js +10 -0
- package/dist/services/memory-review-receipt.js +2 -2
- package/dist/services/memory-review-registration.js +13 -4
- package/dist/services/memory-review-work-custody.js +3 -1
- package/dist/services/memory-review-work-input.js +26 -7
- package/dist/services/memory-review-work-results.js +26 -4
- package/dist/services/memory-second-corrected-review-inputs.js +5 -3
- package/dist/services/memory-second-correction-plan.js +2 -1
- package/dist/services/memory-second-repair-launch.js +4 -4
- package/dist/services/memory-second-repair-source.js +1 -1
- package/dist/services/memory-stage-dispatch.js +38 -1
- package/dist/services/memory-stage-results.js +113 -22
- package/dist/services/memory-upgrade-analysis-handler.js +243 -0
- package/dist/services/memory-upgrade-bootstrap-readiness.js +251 -0
- package/dist/services/memory-upgrade-evidence.js +100 -0
- package/dist/services/memory-upgrade-inventory.js +442 -0
- package/dist/services/memory-upgrade-publication-custody.js +73 -0
- package/dist/services/memory-upgrade-publication.js +413 -0
- package/dist/services/memory-upgrade-selection.js +430 -0
- package/dist/services/memory-upgrade-start.js +60 -0
- package/dist/services/memory-upgrade-storage-readiness.js +340 -0
- package/dist/services/memory-verification-acceptance.js +38 -17
- package/dist/services/memory-verification-checks.js +77 -23
- package/dist/services/memory-verification-receipt.js +6 -5
- package/dist/services/memory-verify-handler.js +15 -13
- package/dist/services/memory-work-result-json.js +12 -0
- package/dist/services/memory-work-result-preparation.js +5 -4
- package/dist/services/merge-server.js +4 -2
- package/dist/services/migrations.js +127 -98
- package/dist/services/physical-startup.js +45 -0
- package/dist/services/project-registry.js +97 -0
- package/dist/services/project-summary.js +1 -1
- package/dist/services/projects.js +3 -93
- package/dist/services/prompt-delivery.js +71 -0
- package/dist/services/provider-capacity.js +69 -8
- package/dist/services/recovery-snapshot-database.js +32 -4
- package/dist/services/repair-intents.js +1 -12
- package/dist/services/repair-receipt.js +13 -0
- package/dist/services/run-control-worker.js +35 -18
- package/dist/services/run-controller-process.js +2 -6
- package/dist/services/run-controller-recovery.js +6 -1
- package/dist/services/run-controller.js +131 -80
- package/dist/services/run-recovery-guard.js +30 -0
- package/dist/services/run-recovery.js +11 -44
- package/dist/services/run-start-custody.js +17 -5
- package/dist/services/runtime-scope-worker.js +46 -19
- package/dist/services/sessions.js +3 -24
- package/dist/services/setup.js +63 -13
- package/dist/services/stage-handlers.js +9 -7
- package/dist/services/stage-pause.js +108 -44
- package/dist/services/version-status.js +1 -1
- package/dist/services/vnext-fanout.js +21 -9
- package/dist/services/vnext-plan-review.js +3 -5
- package/dist/services/work-registry.js +80 -33
- package/dist/services/workspace-files.js +1 -1
- package/dist/shared/entity-references.js +1 -8
- package/dist/storage/data-preservation.js +65 -0
- package/dist/storage/database.js +53 -19
- package/dist/storage/import-guard.js +84 -27
- package/dist/storage/memory-upgrade-schema-bootstrap.js +38 -0
- package/dist/storage/paired-writer-migration.js +424 -0
- package/dist/storage/writer-contract.js +11 -4
- package/dist/storage/writer-migration.js +313 -52
- package/dist/storage/writer-restore.js +217 -0
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
# @deksden-com/dd-flow-cli
|
|
2
2
|
|
|
3
|
+
## 0.9.0-beta.145
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Normalize Git diagnostics for gitless workspace inventories without masking damaged repositories; keep integration fixture tools on an explicitly selected PATH and scope simulated journal stalls to failure persistence.
|
|
8
|
+
|
|
9
|
+
- Select Gemini's encoded reasoning level without an unsupported AGY `--effort` override; reject conflicting requested levels before native launch, while retaining explicit effort for other model families.
|
|
10
|
+
|
|
11
|
+
- Preserve the effective environment across pinned engine dispatch. Isolate package-consumer routing and own executable test discovery; reduce duplicate gate preparation without removing release guarantees.
|
|
12
|
+
|
|
13
|
+
- ea4e88e: Add hybrid mb-upgrade with retained current/target selection, scoped migration
|
|
14
|
+
bootstrap, preserved old-bank evidence, independent Work review and marker-free
|
|
15
|
+
ordinary flow readiness. Keep existing RUN engine bindings and reconcile partial
|
|
16
|
+
startup and publication through their original requests.
|
|
17
|
+
|
|
18
|
+
Retain bounded Codex admission phase diagnostics and separate native-host startup
|
|
19
|
+
headroom from the shared admission deadline. Refuse writer migration while a
|
|
20
|
+
MERGE request remains unresolved, including same-session integration without a
|
|
21
|
+
live process; terminal historical requests do not block migration.
|
|
22
|
+
|
|
23
|
+
Preserve project lint exclusions while independently checking affected active
|
|
24
|
+
Markdown through a separate mb-lint configuration when needed (`--config`
|
|
25
|
+
support required). Retain both reports and the effective configuration as check
|
|
26
|
+
evidence. Allow malformed terminal proposal JSON to be corrected through the
|
|
27
|
+
existing no-effect lifecycle successor without repeating Git integration.
|
|
28
|
+
Align generated FINISH guidance with the minimal proposal and CLI-owned sealed
|
|
29
|
+
coverage, findings and evidence for both initialization and upgrade.
|
|
30
|
+
Keep exact source-canon spec/protocol provenance relations distinct from
|
|
31
|
+
consumer-owned link targets when checking customized guidance. Derive scoped
|
|
32
|
+
exceptions from retained target bytes; new project/body links and Git-aware
|
|
33
|
+
ignored-target checks remain active, and project configuration stays unchanged.
|
|
34
|
+
Reject malformed bounded JSON at the shared Memory finish ingress as a
|
|
35
|
+
correctable proposal before stage-specific projections can misclassify it as
|
|
36
|
+
retained-custody corruption. Reuse the existing issued lifecycle successor;
|
|
37
|
+
empty/oversized input, unknown stages and downstream identity/effect checks
|
|
38
|
+
remain strict. Never repair proposal bytes or rerun settled work implicitly.
|
|
39
|
+
|
|
40
|
+
Keep the native hook's per-call deadline out of project-check input identity so
|
|
41
|
+
VERIFY can accept unchanged passed checks across ordinary CLI and hook calls.
|
|
42
|
+
Continue to invalidate evidence when application environment, files, policy or
|
|
43
|
+
physical receipts change.
|
|
44
|
+
|
|
45
|
+
Check retained process birth after a permission-denied existence probe, so a
|
|
46
|
+
reused macOS system PID cannot keep an already closed agent scope unresolved.
|
|
47
|
+
Unknown identity remains conservative and foreign processes are never signaled.
|
|
48
|
+
|
|
49
|
+
Validate a current completed correction wave as one synchronous SQL snapshot,
|
|
50
|
+
sharing private successful proofs across its registration and settled histories.
|
|
51
|
+
Fresh traversals, failures, allocation fences and physical file checks remain
|
|
52
|
+
independent; no proof is reused across commands or asynchronous boundaries.
|
|
53
|
+
|
|
54
|
+
- 481702b: Keep native hook admission within its qualified shared deadline without loading execution/recovery graphs. Retain matched late native terminal outcomes before shutdown, support AGY ordered stream request evidence and recovered lifecycle boundaries, and publish exact current instruction packets as readable Markdown without replaying committed lifecycle operations.
|
|
55
|
+
|
|
56
|
+
Distinguish repeated real checksum scans from duplicate progress notifications. Retry only effect-free physical self-start observations within the existing owner-bound startup horizon, without relaunching processes or renewing unconfirmed leases.
|
|
57
|
+
|
|
58
|
+
Allow an initially bound maintenance cancellation signal to drain its owned heartbeat transport during daemon shutdown.
|
|
59
|
+
|
|
60
|
+
Retain startup failures only for the exact physical owner, preventing duplicate workers from overwriting or cleaning up a winner. Keep setup progress distinct across owned CLI producers without admitting stale or duplicate notifications.
|
|
61
|
+
|
|
3
62
|
## 0.9.0-beta.144
|
|
4
63
|
|
|
5
64
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -161,6 +161,8 @@ dd-flow canon status --json
|
|
|
161
161
|
|
|
162
162
|
`canon resolve` checks explicit `--root`, then `DD_MEMORYBANK`, then the globally registered value in `DD_FLOW_HOME`, then known nearby `dd-memorybank` checkouts from the current working directory. If two different valid canonical roots are discovered, it fails closed with structured blockers and bootstrap hints. Use `DD_MEMORYBANK` for the local canonical `dd-memorybank` checkout.
|
|
163
163
|
|
|
164
|
+
With no explicit, environment or registered source, the release installed by `setup` in `DD_FLOW_HOME` takes precedence over nearby checkouts. Archive provenance comes from its retained release manifest. A degraded installation does not silently fall back to a local checkout. Discovery remains read-only and does not open SQLite before runtime context admission.
|
|
165
|
+
|
|
164
166
|
Register a project:
|
|
165
167
|
|
|
166
168
|
```bash
|
|
@@ -508,22 +510,25 @@ remain invalid and receive a standalone retry.
|
|
|
508
510
|
|
|
509
511
|
## Verification
|
|
510
512
|
|
|
511
|
-
|
|
513
|
+
For a code merge, start with the cheap common contracts, then select affected
|
|
514
|
+
storage/process/flow checks explicitly and record the selection reason:
|
|
512
515
|
|
|
513
516
|
```bash
|
|
514
|
-
pnpm
|
|
515
|
-
pnpm lint
|
|
516
|
-
pnpm build
|
|
517
|
-
pnpm test
|
|
517
|
+
pnpm gate:merge
|
|
518
518
|
```
|
|
519
519
|
|
|
520
|
-
|
|
521
|
-
|
|
520
|
+
For release acceptance, freeze source/canon, build once, then use
|
|
521
|
+
`DD_FLOW_GATE_REPORT_ROOT=/absolute/external/report pnpm gate:release`.
|
|
522
|
+
Node family selection lives in `package.json`, Vitest membership in
|
|
523
|
+
`vitest.config.ts`, and required release receipts in `scripts/release-candidate.mjs`.
|
|
524
|
+
The local and CI profiles cover the same required guarantees; qualification-only
|
|
525
|
+
cases report their prerequisites/skips separately. Tests invoking compiled CLI
|
|
526
|
+
must use the current frozen build, even for a partial merge check.
|
|
522
527
|
For development use `pnpm test:fast`, `pnpm test:core` or `pnpm test:flow` plus
|
|
523
528
|
the affected native contracts; these subsets are not full acceptance.
|
|
524
529
|
New files default to serial core execution. A forced serial fallback is
|
|
525
530
|
`pnpm test:integration --no-file-parallelism --maxWorkers=1`.
|
|
526
|
-
The [test-suite verification runbook](https://github.com/deksden-com/dd-eval/blob/
|
|
531
|
+
The [test-suite verification runbook](https://github.com/deksden-com/dd-eval/blob/main/runbooks/flow-test-suite-verification.md)
|
|
527
532
|
owns group qualification, complete reports and cross-repository commands.
|
|
528
533
|
|
|
529
534
|
Manual smoke checks should use a temporary `DD_FLOW_HOME` when they do not intentionally inspect the operator's real local state.
|
package/dist/build-info.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"cli_package": "@deksden-com/dd-flow-cli",
|
|
3
|
-
"cli_version": "0.9.0-beta.
|
|
4
|
-
"cli_commit": "
|
|
5
|
-
"built_at": "2026-10-
|
|
3
|
+
"cli_version": "0.9.0-beta.145",
|
|
4
|
+
"cli_commit": "52851c6a5c8419e93b543fd6a53e71f9aa359d9f",
|
|
5
|
+
"built_at": "2026-10-21T17:32:05.034Z",
|
|
6
6
|
"built_with_canon": {
|
|
7
7
|
"version": "4.1.2",
|
|
8
|
-
"commit": "
|
|
8
|
+
"commit": "51f7d7155f578e877e4db5c3d022772084ecea5a",
|
|
9
9
|
"flow_contract": "dd-flow-canonical-2026-08",
|
|
10
|
-
"repo_root": "/Users/deksden/Documents/_Projects/_worktrees/dd-canon-
|
|
11
|
-
"memorybank_root": "/Users/deksden/Documents/_Projects/_worktrees/dd-canon-
|
|
12
|
-
"flow_root": "/Users/deksden/Documents/_Projects/_worktrees/dd-canon-
|
|
10
|
+
"repo_root": "/Users/deksden/Documents/_Projects/_worktrees/dd-canon-release-145",
|
|
11
|
+
"memorybank_root": "/Users/deksden/Documents/_Projects/_worktrees/dd-canon-release-145/.memory-bank",
|
|
12
|
+
"flow_root": "/Users/deksden/Documents/_Projects/_worktrees/dd-canon-release-145/.memory-bank/dd-flow",
|
|
13
13
|
"layout": "dot_memory_bank"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -15,7 +15,7 @@ const control = "project-root run";
|
|
|
15
15
|
const protocolTransitionInput = route(1, "to", `${scoped} payload-file json-file reason`, "force");
|
|
16
16
|
const setupInput = route(0, "request-id trust-file", "canon-source canon-version release-registry channel profile profile-file save-profile-intent", "non-interactive skip-agent-setup", "", { channel: ["stable", "preview", "development"] });
|
|
17
17
|
const memoryInitInput = route(0, "project-root workspace-root request-id", "intake-file intake-sha256 profile profile-file stage-profile work-profile max-parallel delegation native-config-home git-route integration-branch", "detach non-interactive prepare-only allow-live-probe", "stage-profile work-profile", { "git-route": ["integration_branch_direct", "feature_worktree"], delegation: ["external", "native"] });
|
|
18
|
-
export const commandAliases = { transition: "protocol transition", init: "flow mb-init" };
|
|
18
|
+
export const commandAliases = { transition: "protocol transition", init: "flow mb-init", upgrade: "flow mb-upgrade" };
|
|
19
19
|
/** Path-shaped arguments default to physical paths unless the route explicitly
|
|
20
20
|
* opts into contextualPaths. This inventory does not expand arbitrary strings. */
|
|
21
21
|
export const physicalPathOptions = new Set(words("canon-source trust-file root project-root workspace-root workspace-path 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"));
|
|
@@ -33,8 +33,12 @@ export const commandInputs = {
|
|
|
33
33
|
"flow show": route(1),
|
|
34
34
|
"flow mb-init": memoryInitInput,
|
|
35
35
|
"init": memoryInitInput,
|
|
36
|
-
"
|
|
37
|
-
"
|
|
36
|
+
"flow mb-upgrade": memoryInitInput,
|
|
37
|
+
"upgrade": memoryInitInput,
|
|
38
|
+
"runtime storage admit": route(0, "operation", "", "", "", { operation: ["memory-init", "memory-upgrade"] }),
|
|
39
|
+
"runtime storage qualify": route(0, "operation", "", "", "", { operation: ["memory-upgrade"] }),
|
|
40
|
+
"runtime storage transition": route(0, "action project-root workspace-root request-id selection-sha256", "expected-sha256 recovery-id", "offline", "", { action: ["plan", "apply", "status", "recovery-plan", "recover", "recovery-status"] }),
|
|
41
|
+
"runtime flow admit": route(0, "operation", "", "", "", { operation: ["memory-init", "memory-upgrade"] }),
|
|
38
42
|
"completion bash": route(0),
|
|
39
43
|
"completion zsh": route(0),
|
|
40
44
|
"completion fish": route(0),
|
|
@@ -218,6 +222,7 @@ export const commandInputs = {
|
|
|
218
222
|
"canon status": route(0, "", "root"),
|
|
219
223
|
"canon resolve": route(0, "", "root"),
|
|
220
224
|
"migration impact": route(0, project, "target-version mode"),
|
|
225
|
+
"migration readiness": route(0, `${project} workspace-root request-id`),
|
|
221
226
|
"migration plan": route(0, project, "source-version target-version run backup-path backup-created-at"),
|
|
222
227
|
"migration report": route(0, project, "source-version target-version run backup-path backup-created-at"),
|
|
223
228
|
"migration verify": route(0, "file"),
|
|
@@ -265,6 +270,7 @@ export const commandInputs = {
|
|
|
265
270
|
"schema validate": { ...route(0, "schema file", "schema-dir project-root run"), contextualPaths: words("project-root file") },
|
|
266
271
|
"memory permissions preflight": route(0, "root memory-bank flow mode", "tasks"),
|
|
267
272
|
"memory compose register": route(0, "project-root run request-key result-file"),
|
|
273
|
+
"memory upgrade publish": route(0, "project-root run"),
|
|
268
274
|
"memory verify checks": route(0, "project-root run"),
|
|
269
275
|
"memory review register": route(0, "project-root run"),
|
|
270
276
|
"memory review collect": route(0, "project-root run"),
|
|
@@ -63,8 +63,11 @@ const memoryInitOptions = {
|
|
|
63
63
|
const commandOptionDescriptions = {
|
|
64
64
|
"flow mb-init": memoryInitOptions,
|
|
65
65
|
init: memoryInitOptions,
|
|
66
|
-
"
|
|
67
|
-
|
|
66
|
+
"flow mb-upgrade": { ...memoryInitOptions, "stage-profile": "Repeatable stage=profile assignment for preflight, diff-analysis, upgrade, verify, review or finish. The original selection is frozen before dispatch.", "prepare-only": "Prepare or replay the upgrade RUN and accepted storage/bootstrap selection without launching its controller or a productive Session. This is not a dry run; it does not publish the upgraded canonical layer or accept semantic preservation." },
|
|
67
|
+
upgrade: { ...memoryInitOptions, "stage-profile": "Repeatable stage=profile assignment for preflight, diff-analysis, upgrade, verify, review or finish. The original selection is frozen before dispatch.", "prepare-only": "Prepare or replay the upgrade RUN and accepted storage/bootstrap selection without launching its controller or a productive Session. This is not a dry run; it does not publish the upgraded canonical layer or accept semantic preservation." },
|
|
68
|
+
"runtime storage admit": { operation: "Operation-specific writable-connection admission: memory-init or memory-upgrade. Upgrade also checks retained request storage. Requires explicit canonical DD_FLOW_HOME and an existing compatible resource registry. Never initializes, migrates, repairs or starts agents." },
|
|
69
|
+
"runtime storage qualify": { operation: "memory-upgrade only. Qualify the selected engine before a native probe. Incompatible drained stores are copied privately with committed WAL; the actual transition and operation admission run on those copies. Requires both explicit canonical Homes. Never migrates real stores, grants productive admission, creates a RUN or starts agents." },
|
|
70
|
+
"runtime flow admit": { operation: "Handler admission for memory-init or memory-upgrade in the executing engine. Reads bounded UTF-8 JSON stdin with source and source_sha256; memory-init additionally accepts startup_input_schema to require its startup reader. Validates the matching six-stage descriptor using actual registered handlers. Does not establish release trust, storage/provider readiness or semantic completion, and never creates Home, RUN or agents." },
|
|
68
71
|
"profiles create": { file: "Regular UTF-8 JSON file containing one complete validated agent profile. The ID must be unused. Credentials and unknown fields are refused; creation uses --expected-revision and never starts a model Turn." },
|
|
69
72
|
"profiles edit": { file: "Regular UTF-8 JSON file containing the complete replacement agent profile, not a patch. Its ID must already exist. Revision conflicts refuse the edit; retained RUN snapshots are unchanged." },
|
|
70
73
|
"profiles alias": {
|
|
@@ -79,6 +82,11 @@ const commandOptionDescriptions = {
|
|
|
79
82
|
},
|
|
80
83
|
"schema validate": { file: "JSON document to validate against --schema in the selected schema directory. Validation does not execute a flow or accept semantic completion." },
|
|
81
84
|
"migration verify": { file: "Existing dd-flow/mb-upgrade-migration-report@1 JSON report to verify against migration evidence; verification does not apply a storage migration." },
|
|
85
|
+
"migration readiness": {
|
|
86
|
+
"request-id": "Stable upgrade request ID. Retains a physically verified content-only storage proof; identical replay reuses it and changed inputs refuse. Does not create a RUN, sync content or migrate stores.",
|
|
87
|
+
"workspace-root": "Existing canonical absolute assigned workspace. Recorded with the project and request; this storage-only operation does not establish Git/workspace eligibility for the full upgrade.",
|
|
88
|
+
"project-root": "Registered active project requiring a complete release-impact chain and valid current provenance. Existing compatible run/resource stores are mandatory; this command never initializes or repairs them. Explicit mb-upgrade mode is required."
|
|
89
|
+
},
|
|
82
90
|
"migration apply": { file: "Explicit migration report JSON file used for admission to the requested apply operation; backup and ownership gates remain mandatory." },
|
|
83
91
|
"prompt render": { profile: "Prompt profile name required by the assigned Work execution context; not an operator executor profile ID or a Codex home profile." },
|
|
84
92
|
"runtime process register": { harness: "Harness family associated with the registered process/budget; registration is not a discovery or doctor probe.", "state-dir": "Adapter runtime state directory retained with the physical process for later ownership/admission checks." },
|
|
@@ -105,17 +113,28 @@ const commandOptionDescriptions = {
|
|
|
105
113
|
"run control resume": { from: "Exact retained pause/stop control ID whose captured state authorizes this resume request; not a snapshot path." },
|
|
106
114
|
"stage block": { kind: "Blocker category: engine, harness or environment; code and summary identify the actionable cause." },
|
|
107
115
|
"migration impact": { mode: "Optional full_migration request forces the strict full-migration assessment; otherwise impact evidence determines patch, targeted_minor or full_migration." },
|
|
116
|
+
"runtime storage transition": {
|
|
117
|
+
"selection-sha256": "Exact independently retained full upgrade selection; checked before any storage effect. Commands issued by the selected engine include this value.",
|
|
118
|
+
action: "Selected frozen engine transport: plan retains the pair; apply performs its explicit cutover; status observes it. recovery-plan selects and fences separate recovery; recover executes it; recovery-status observes recovery. No command starts a model or RUN.",
|
|
119
|
+
"expected-sha256": "Exact retained migration request SHA for apply/status/recovery-plan, or retained recovery request SHA for recover/recovery-status. Not a fresh selector or permission to replace a request.",
|
|
120
|
+
"recovery-id": "Explicit recovery identity (1..86 safe ASCII characters); required only for recovery-plan. Recovery aborts the original apply.",
|
|
121
|
+
offline: "Required for apply, recovery-plan and recover after all local/external writers are drained. The engine independently checks registered logical and physical owners; it never kills them.",
|
|
122
|
+
"project-root": "Original retained upgrade project identity. No project or database is initialized by this transport.",
|
|
123
|
+
"workspace-root": "Original assigned upgrade workspace; must match the frozen request.",
|
|
124
|
+
"request-id": "Original upgrade request identity; the engine and migration files come only from that request."
|
|
125
|
+
},
|
|
108
126
|
"memory permissions preflight": { mode: "Permission contour to check: read, write, repair or report_only; write checks may create temporary permission probes.", flow: "Workflow permission contour: mb-init, mb-upgrade, mb-audit, mb-fix, mb-upgrade-review or custom. Not a filesystem path." },
|
|
109
|
-
"memory compose register": { "run": "Active
|
|
110
|
-
"memory
|
|
111
|
-
"memory
|
|
112
|
-
"memory review
|
|
113
|
-
"memory
|
|
114
|
-
"memory finish
|
|
115
|
-
"memory
|
|
116
|
-
"memory corrections
|
|
117
|
-
"memory
|
|
118
|
-
"memory review selective-
|
|
127
|
+
"memory compose register": { "run": "Active mb-init or mb-upgrade RUN whose accepted discovery/diff-analysis and immutable execution bind the composition graph.", "request-key": "Stable composition registration identity; exact replay retains the original Work graph.", "result-file": "Bounded proposed composition JSON. Bytes are prepared before registration; agent fields do not grant Work or write authority." },
|
|
128
|
+
"memory upgrade publish": { run: "Active mb-upgrade authoring Stage with a registered blueprint and settled Work. Apply only its retained canonical publication plan and recovery archive; this does not accept the Stage or complete the RUN." },
|
|
129
|
+
"memory verify checks": { "run": "Active mb-init or mb-upgrade RUN. Execute only its independently selected declared verification checks." },
|
|
130
|
+
"memory review register": { "run": "Active mb-init or mb-upgrade RUN with accepted verification. Register initial independent reviewers; this does not launch providers." },
|
|
131
|
+
"memory review collect": { "run": "Active mb-init or mb-upgrade RUN. Collect genuine registered initial-wave results without accepting the Stage or granting correction authority." },
|
|
132
|
+
"memory finish evidence": { "run": "Active mb-init or mb-upgrade finish RUN. Publish independently prepared coverage, integration and readiness evidence; publication does not complete Stage or RUN." },
|
|
133
|
+
"memory finish integrate": { "run": "Active mb-init or mb-upgrade finish RUN. Commit only accepted Memory Bank and owned lint files under retained Git policy, then integrate the admitted workspace locally. Preserve unrelated staged/dirty files; never push. Lost-response replay observes the original effects without another commit." },
|
|
134
|
+
"memory corrections register": { run: "Active mb-init or mb-upgrade review RUN. Register only the correction plan bound to the independently retained preceding review.", wave: "Correction wave 1 follows initial review; wave 2 requires settled first selective review. A third wave is unsupported.", "result-file": "Bounded correction-plan JSON prepared before graph registration; exact retained replay cannot substitute another plan." },
|
|
135
|
+
"memory corrections checks": { run: "Active mb-init or mb-upgrade review RUN with a genuinely settled correction view.", wave: "Run only the independently selected finite check profile for correction wave 1 or 2; this does not accept semantic quality." },
|
|
136
|
+
"memory review selective-register": { run: "Active mb-init or mb-upgrade review RUN. Allocate selective reviewers only after their wave's committed checks.", wave: "Select correction wave 1 or 2. Unaffected accepted units remain retained; registration does not launch providers." },
|
|
137
|
+
"memory review selective-collect": { run: "Active mb-init or mb-upgrade review RUN. Return genuine selective reviewer references, not Stage or RUN acceptance.", wave: "Select independently registered review of correction wave 1 or 2; missing wave custody never falls back to initial review." },
|
|
119
138
|
"memory repair baseline": { ...memoryRepairOptions, work: "Register the immutable prelaunch baseline for this repair Work; dependent/peer changes require explicit current-view registration first. Does not launch providers." },
|
|
120
139
|
"memory repair copy-reserve": { ...memoryRepairOptions, work: "Reserve the owned private copy for this repair Work after its committed baseline; reservation does not create the copy or launch providers." },
|
|
121
140
|
"memory repair copy-materialize": { ...memoryRepairOptions, work: "Materialize the reserved private copy for this repair Work with retained build/ready receipts; no provider launch or shared document publication." },
|
|
@@ -162,8 +181,8 @@ export function optionsForCommandTree(command) {
|
|
|
162
181
|
/** One exact native routing classification shared by router and compatibility admission. */
|
|
163
182
|
export function routerNativeRoute(key) {
|
|
164
183
|
return key === "version" || key.startsWith("engine ") || key === "schema validate"
|
|
165
|
-
|| key === "flow list" || key === "flow show" || key === "flow mb-init" || key === "init"
|
|
166
|
-
|| key === "run reconcile" || key === "runtime storage admit"
|
|
184
|
+
|| key === "flow list" || key === "flow show" || key === "flow mb-init" || key === "init" || key === "flow mb-upgrade" || key === "upgrade"
|
|
185
|
+
|| key === "run reconcile" || key === "runtime storage admit" || key === "runtime storage qualify" || key === "runtime storage transition"
|
|
167
186
|
|| key === "runtime flow admit"
|
|
168
187
|
|| key.startsWith("profiles ") || key.startsWith("models ") || key.startsWith("harnesses ") || key.startsWith("completion ") || key === "setup" || key.startsWith("setup ")
|
|
169
188
|
|| key === "storage migrate-writer" || key === "codex hook handle"
|
package/dist/cli/help.js
CHANGED
|
@@ -2,6 +2,35 @@ import { AppError } from "../shared/errors.js";
|
|
|
2
2
|
import { commandInputs, commandAliases } from "./command-inputs.js";
|
|
3
3
|
import { commandKeyForPositions, globalOptionDocumentation, optionsForCommandTree, routerNativeRoute } from "./command-metadata.js";
|
|
4
4
|
const helpPages = new Map([
|
|
5
|
+
["runtime storage qualify", `dd-flow runtime storage qualify - pre-probe selected-engine capability
|
|
6
|
+
|
|
7
|
+
--operation memory-upgrade checks existing storage with the executing engine.
|
|
8
|
+
Compatible stores use ordinary operation admission. Otherwise, drained source
|
|
9
|
+
stores are copied with committed WAL to a private temporary directory; actual
|
|
10
|
+
migration and target operation admission run only on those copies.
|
|
11
|
+
|
|
12
|
+
Requires explicit canonical DD_FLOW_HOME and DD_FLOW_RESOURCE_HOME. The result
|
|
13
|
+
is capability only: it does not authorize writes, create a RUN, publish migration
|
|
14
|
+
evidence for real stores or start a model. Original storage is never migrated.
|
|
15
|
+
Public upgrade still requires a separately retained plan and explicit apply.`],
|
|
16
|
+
["runtime storage transition", `dd-flow runtime storage transition - selected-engine pre-context storage transport
|
|
17
|
+
|
|
18
|
+
Normal project entry remains dd-flow upgrade. This transport executes only in
|
|
19
|
+
the immutable entrypoint selected by the original retained upgrade request.
|
|
20
|
+
It requires explicit DD_FLOW_HOME and DD_FLOW_RESOURCE_HOME and never initializes
|
|
21
|
+
storage, chooses another engine, starts a model or allocates a RUN.
|
|
22
|
+
|
|
23
|
+
--action plan retains both store snapshots and returns exact apply/status commands.
|
|
24
|
+
apply requires the retained --expected-sha256 and --offline; both backups are
|
|
25
|
+
verified before the first schema change. Unknown effects require exact-request
|
|
26
|
+
status/reconciliation, not a new selector or replacement plan.
|
|
27
|
+
|
|
28
|
+
recovery-plan requires the migration SHA, --recovery-id and --offline. Selecting
|
|
29
|
+
recovery fences both stores and aborts the old apply; recover and recovery-status
|
|
30
|
+
use the returned recovery SHA. Restoration is never automatic.
|
|
31
|
+
|
|
32
|
+
The offline switch acknowledges external drain; logical and physical registered
|
|
33
|
+
owners are checked independently. No owner is terminated by this transport.`],
|
|
5
34
|
["flow mb-init", `dd-flow init / flow mb-init - managed project Memory Bank initialization
|
|
6
35
|
|
|
7
36
|
Usage:
|
|
@@ -332,7 +361,7 @@ Examples:
|
|
|
332
361
|
],
|
|
333
362
|
[
|
|
334
363
|
"canon",
|
|
335
|
-
`dd-flow canon - register and resolve the canonical Memory Bank
|
|
364
|
+
`dd-flow canon - register and resolve the canonical Memory Bank source
|
|
336
365
|
|
|
337
366
|
Usage:
|
|
338
367
|
dd-flow canon register --root <canonical-dd-memorybank-root> --json
|
|
@@ -341,6 +370,8 @@ Usage:
|
|
|
341
370
|
|
|
342
371
|
Discovery order is explicit --root, then DD_MEMORYBANK, then the globally registered runtime value in DD_FLOW_HOME, then known nearby dd-memorybank checkouts from the current working directory. Explicit --root is the only source considered for that command. If multiple different valid canonical checkouts are found, resolve fails closed with blockers so the caller chooses intentionally.
|
|
343
372
|
|
|
373
|
+
Without an explicit, environment or registered source, the release installed by setup in DD_FLOW_HOME takes precedence over nearby checkouts. Its commit comes from the retained release manifest, not ancestor Git history. A degraded installation is reported; it never silently falls back to a nearby checkout.
|
|
374
|
+
|
|
344
375
|
A valid canonical root contains dd-flow/README.md, mbb/index.md, protocol/index.md, and canonical-only entrypoints such as dd-flow/mb-init.md, dd-flow/mb-upgrade.md, and dd-flow/mb-distill.md. Current canon runs mb-upgrade review as the 05-review stage inside mb-upgrade, not as a top-level mb-upgrade-review.md entrypoint.
|
|
345
376
|
|
|
346
377
|
Examples:
|
package/dist/cli/hook-ingress.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
import { performance } from "node:perf_hooks";
|
|
3
|
+
import { channel } from "node:diagnostics_channel";
|
|
3
4
|
import { parseCommandArgs, parseLifecycleCommand, lifecycleCommandFromPayload, continuationCommand } from "../services/lifecycle-command.js";
|
|
4
5
|
import { errorRecord, AppError } from "../shared/errors.js";
|
|
5
6
|
import { parseJsonObject } from "../shared/json.js";
|
|
6
7
|
const workerFile = fileURLToPath(import.meta.url);
|
|
7
|
-
const ingressBudgetMs = 20_000; //
|
|
8
|
+
const ingressBudgetMs = 20_000; // Shared admission budget; host separately allows cold CLI startup/cleanup.
|
|
8
9
|
const { hookBudget, readNativeHookInput } = await import("../harness-runtime/lib/native-hook-command.mjs");
|
|
9
10
|
/** Lightweight entry: unrelated hooks never load the router or open storage. */
|
|
10
11
|
export async function runHookIngress(args) {
|
|
@@ -46,15 +47,32 @@ export async function runHookIngress(args) {
|
|
|
46
47
|
}
|
|
47
48
|
// A bounded CLI subprocess, not a detached writer: its successful reply follows COMMIT.
|
|
48
49
|
if (process.argv[1] === workerFile) {
|
|
50
|
+
const started = performance.now();
|
|
51
|
+
const timing = channel("dd-flow.sqlite.ingress");
|
|
52
|
+
let previousPhase;
|
|
53
|
+
const trace = (value) => {
|
|
54
|
+
const record = value;
|
|
55
|
+
if (record.phase === previousPhase)
|
|
56
|
+
return;
|
|
57
|
+
previousPhase = record.phase;
|
|
58
|
+
process.stderr.write(`${JSON.stringify({ kind: "native_hook_phase", phase: record.phase, elapsed_ms: Math.round(performance.now() - started), ...(record.remaining_ms !== undefined ? { remaining_ms: record.remaining_ms } : {}) })}\n`);
|
|
59
|
+
};
|
|
60
|
+
timing.subscribe(trace);
|
|
49
61
|
try {
|
|
50
|
-
const
|
|
62
|
+
const budget = hookBudget(ingressBudgetMs, process.env.DD_FLOW_HOOK_DEADLINE_AT ? Number(process.env.DD_FLOW_HOOK_DEADLINE_AT) : null);
|
|
63
|
+
const phase = (name) => trace({ phase: name, remaining_ms: budget.remaining(name) });
|
|
64
|
+
phase("input");
|
|
65
|
+
const stdin = await readNativeHookInput(process.stdin, budget);
|
|
51
66
|
const payload = parseJsonObject(stdin, "native hook stdin");
|
|
52
|
-
|
|
67
|
+
phase("verification");
|
|
53
68
|
const { verifyCodexHookDelivery } = await import("../services/codex-hook-delivery.js");
|
|
54
69
|
const proof = await verifyCodexHookDelivery(process.env, payload);
|
|
55
70
|
const verified = performance.now();
|
|
71
|
+
phase("import");
|
|
56
72
|
const [{ createContext }, { handleCodexHook }] = await Promise.all([import("../runtime/context.js"), import("../services/hooks.js")]);
|
|
73
|
+
phase("imported");
|
|
57
74
|
const loaded = performance.now();
|
|
75
|
+
phase("store_open");
|
|
58
76
|
const context = createContext(process.env, "hook");
|
|
59
77
|
const opened = performance.now();
|
|
60
78
|
try {
|
|
@@ -62,7 +80,10 @@ if (process.argv[1] === workerFile) {
|
|
|
62
80
|
context.codexHookProof = proof;
|
|
63
81
|
const parsed = parseCommandArgs(process.argv.slice(5));
|
|
64
82
|
const projectRoot = parsed.options.get("project-root")?.[0];
|
|
83
|
+
phase("receipt");
|
|
65
84
|
const result = handleCodexHook(context, { event: "PreToolUse", ...(projectRoot ? { projectRoot } : {}), stdin });
|
|
85
|
+
phase("committed");
|
|
86
|
+
phase("ack");
|
|
66
87
|
process.stdout.write(`${JSON.stringify({ ...(result.hookSpecificOutput ? { hookSpecificOutput: result.hookSpecificOutput } : {}), timing: {
|
|
67
88
|
verify_ms: Math.round(verified - started), load_ms: Math.round(loaded - verified), open_ms: Math.round(opened - loaded), receipt_ms: Math.round(performance.now() - opened)
|
|
68
89
|
} })}\n`);
|
|
@@ -75,4 +96,7 @@ if (process.argv[1] === workerFile) {
|
|
|
75
96
|
process.stderr.write(`${JSON.stringify({ ok: false, error: errorRecord(error) })}\n`);
|
|
76
97
|
process.exitCode = 1;
|
|
77
98
|
}
|
|
99
|
+
finally {
|
|
100
|
+
timing.unsubscribe(trace);
|
|
101
|
+
}
|
|
78
102
|
}
|
|
@@ -20,8 +20,9 @@ export async function runMemoryFlowAdmissionCli(args, io = process) {
|
|
|
20
20
|
throw new AppError("usage", "Flow admission requires an exact source snapshot and independent digest", 2, { effect: "no_effect" });
|
|
21
21
|
}
|
|
22
22
|
const selected = input;
|
|
23
|
+
const flowId = route.parsed.options.get("operation")?.[0] === "memory-upgrade" ? "mb-upgrade" : "mb-init";
|
|
23
24
|
const startupSchema = memoryInitStartupInputSchemas.find(schema => schema === selected.startup_input_schema);
|
|
24
|
-
if (Object.hasOwn(selected, "startup_input_schema") && startupSchema === undefined) {
|
|
25
|
+
if (Object.hasOwn(selected, "startup_input_schema") && (startupSchema === undefined || flowId !== "mb-init")) {
|
|
25
26
|
throw new AppError("usage", "Executing engine does not support the requested startup input schema", 2, { effect: "no_effect" });
|
|
26
27
|
}
|
|
27
28
|
if (typeof selected.source_sha256 !== "string" || !/^[a-f0-9]{64}$/.test(selected.source_sha256)) {
|
|
@@ -29,9 +30,12 @@ export async function runMemoryFlowAdmissionCli(args, io = process) {
|
|
|
29
30
|
}
|
|
30
31
|
const source = PreparedInstalledFlowSource.restoreRetained(selected.source, selected.source_sha256);
|
|
31
32
|
const flow = source.resolveRegisteredFlow();
|
|
32
|
-
|
|
33
|
+
if (flow.descriptor.id !== flowId)
|
|
34
|
+
throw new AppError("usage", "Flow source does not match the requested engine admission operation", 2, { effect: "no_effect" });
|
|
35
|
+
const facts = { schema_id: flowId === "mb-upgrade" ? "dd-flow/memory-upgrade-engine-flow@1"
|
|
36
|
+
: startupSchema === undefined ? "dd-flow/memory-init-engine-flow@1" : "dd-flow/memory-init-engine-flow@2",
|
|
33
37
|
...(startupSchema === undefined ? {} : { startup_input_schema: startupSchema }),
|
|
34
|
-
flow_id:
|
|
38
|
+
flow_id: flowId, source_sha256: source.sha256,
|
|
35
39
|
descriptor_sha256: source.descriptorReference().sha256, stages: flow.descriptor.stages.map(stage => stage.id) };
|
|
36
40
|
io.stdout.write(`${JSON.stringify({ ok: true, action: "runtime_flow_admit", facts, sha256: hybridDigest(facts) }, null, output.json ? undefined : 2)}\n`);
|
|
37
41
|
return 0;
|
|
@@ -3,15 +3,22 @@ import { AppError } from "../shared/errors.js";
|
|
|
3
3
|
import { hybridDigest } from "../services/hybrid-contracts.js";
|
|
4
4
|
import { prepareCommandRoute } from "./command-inputs.js";
|
|
5
5
|
const stages = new Set(["preflight", "discover", "compose", "verify", "review", "finish"]);
|
|
6
|
+
const upgradeStages = new Set(["preflight", "diff-analysis", "upgrade", "verify", "review", "finish"]);
|
|
6
7
|
function refuse(message) {
|
|
7
8
|
throw new AppError("usage", message, 2, { phase: "prepare", effect: "no_effect" });
|
|
8
9
|
}
|
|
9
10
|
/** Pure invocation preparation. File bytes, stored replay and productive
|
|
10
11
|
* authority remain with their existing owners; no ambient defaults here. */
|
|
11
12
|
export function prepareMemoryInitInvocation(args) {
|
|
13
|
+
return prepareMemoryInvocation(args, "mb-init");
|
|
14
|
+
}
|
|
15
|
+
export function prepareMemoryUpgradeInvocation(args) {
|
|
16
|
+
return prepareMemoryInvocation(args, "mb-upgrade");
|
|
17
|
+
}
|
|
18
|
+
function prepareMemoryInvocation(args, flowId) {
|
|
12
19
|
const route = prepareCommandRoute(args);
|
|
13
|
-
if (!["init", "flow mb-init"].includes(route.key))
|
|
14
|
-
refuse(
|
|
20
|
+
if (!(flowId === "mb-init" ? ["init", "flow mb-init"] : ["upgrade", "flow mb-upgrade"]).includes(route.key))
|
|
21
|
+
refuse(`Use ${flowId === "mb-init" ? "init" : "upgrade"} or flow ${flowId}`);
|
|
15
22
|
const options = route.parsed.options;
|
|
16
23
|
const value = (name) => options.get(name)?.[0];
|
|
17
24
|
const scope = { projectRoot: value("project-root"), workspaceRoot: value("workspace-root"), requestId: value("request-id") };
|
|
@@ -38,7 +45,7 @@ export function prepareMemoryInitInvocation(args) {
|
|
|
38
45
|
execution.rootProfile = profile;
|
|
39
46
|
for (const assignment of options.get("stage-profile") ?? []) {
|
|
40
47
|
const at = assignment.indexOf("="), stage = assignment.slice(0, at), profile = assignment.slice(at + 1);
|
|
41
|
-
if (at < 1 || !stages.has(stage) || !profile.trim() || execution.stageProfiles?.[stage] !== undefined)
|
|
48
|
+
if (at < 1 || !(flowId === "mb-init" ? stages : upgradeStages).has(stage) || !profile.trim() || execution.stageProfiles?.[stage] !== undefined)
|
|
42
49
|
refuse("--stage-profile requires a unique stage=profile assignment");
|
|
43
50
|
(execution.stageProfiles ??= {})[stage] = profile;
|
|
44
51
|
}
|