cool-workflow 0.2.2 → 0.2.4

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 (141) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/apps/architecture-review/app.json +1 -1
  4. package/apps/architecture-review-fast/app.json +1 -1
  5. package/apps/end-to-end-golden-path/app.json +1 -1
  6. package/apps/pr-review-fix-ci/app.json +1 -1
  7. package/apps/release-cut/app.json +1 -1
  8. package/apps/research-synthesis/app.json +1 -1
  9. package/dist/cli/dispatch.js +13 -6
  10. package/dist/cli/entry.js +41 -1
  11. package/dist/cli/io.js +12 -22
  12. package/dist/cli/parseargv.js +1 -0
  13. package/dist/core/capability-data.js +3 -2
  14. package/dist/core/format/completion.js +68 -0
  15. package/dist/core/format/help.js +31 -6
  16. package/dist/core/format/safe-json.js +73 -0
  17. package/dist/core/format/state-explosion-text.js +1 -1
  18. package/dist/core/multi-agent/candidate-scoring.js +5 -1
  19. package/dist/core/multi-agent/collaboration.js +3 -3
  20. package/dist/core/multi-agent/coordinator.js +5 -5
  21. package/dist/core/multi-agent/runtime.js +4 -4
  22. package/dist/core/multi-agent/topology.js +3 -3
  23. package/dist/core/pipeline/dispatch.js +18 -4
  24. package/dist/core/pipeline/drive-decide.js +2 -1
  25. package/dist/core/state/migrations.js +16 -1
  26. package/dist/core/state/state-explosion/digest.js +13 -13
  27. package/dist/core/state/state-explosion/graph.js +17 -11
  28. package/dist/core/state/state-explosion/report.js +6 -6
  29. package/dist/core/util/cli-args.js +33 -0
  30. package/dist/core/util/numeric-flag.js +40 -0
  31. package/dist/core/version.js +1 -1
  32. package/dist/mcp/server.js +99 -11
  33. package/dist/shell/audit-cli.js +57 -25
  34. package/dist/shell/coordinator-io.js +73 -13
  35. package/dist/shell/dispatch.js +1 -1
  36. package/dist/shell/doctor.js +80 -1
  37. package/dist/shell/drive.js +251 -49
  38. package/dist/shell/eval-text.js +2 -2
  39. package/dist/shell/evidence-reasoning.js +4 -4
  40. package/dist/shell/execution-backend/agent.js +30 -2
  41. package/dist/shell/execution-backend/container.js +4 -1
  42. package/dist/shell/execution-backend/local.js +19 -11
  43. package/dist/shell/feedback-cli.js +6 -6
  44. package/dist/shell/fs-atomic.js +218 -29
  45. package/dist/shell/man-cli.js +6 -0
  46. package/dist/shell/metrics-cli.js +2 -1
  47. package/dist/shell/multi-agent-cli.js +367 -323
  48. package/dist/shell/multi-agent-host.js +9 -9
  49. package/dist/shell/multi-agent-operator-ux.js +80 -38
  50. package/dist/shell/node-store.js +10 -4
  51. package/dist/shell/observability.js +1 -1
  52. package/dist/shell/operator-ux-text.js +22 -22
  53. package/dist/shell/operator-ux.js +15 -14
  54. package/dist/shell/orchestrator.js +49 -38
  55. package/dist/shell/pipeline-cli.js +107 -42
  56. package/dist/shell/reclamation-io.js +88 -10
  57. package/dist/shell/registry-cli.js +23 -17
  58. package/dist/shell/remote-source.js +13 -8
  59. package/dist/shell/report-cli.js +45 -0
  60. package/dist/shell/report.js +2 -1
  61. package/dist/shell/run-registry-io.js +78 -19
  62. package/dist/shell/run-store.js +74 -2
  63. package/dist/shell/scheduling-io.js +12 -13
  64. package/dist/shell/state-cli.js +2 -7
  65. package/dist/shell/state-explosion-cli.js +17 -9
  66. package/dist/shell/topology-io.js +36 -5
  67. package/dist/shell/trust-audit.js +224 -22
  68. package/dist/shell/trust-policy-io.js +1 -1
  69. package/dist/shell/worker-cli.js +35 -31
  70. package/dist/shell/workflow-app-loader.js +67 -1
  71. package/dist/wiring/capability-table/basics.js +33 -8
  72. package/dist/wiring/capability-table/exec-backend.js +28 -19
  73. package/dist/wiring/capability-table/multi-agent.js +187 -180
  74. package/dist/wiring/capability-table/parity.js +1 -0
  75. package/dist/wiring/capability-table/pipeline.js +64 -52
  76. package/dist/wiring/capability-table/registry-core.js +30 -11
  77. package/dist/wiring/capability-table/reporting.js +147 -106
  78. package/dist/wiring/capability-table/scheduling-registry.js +201 -167
  79. package/dist/wiring/capability-table/state.js +59 -51
  80. package/dist/wiring/capability-table/trust-ledger.js +52 -28
  81. package/dist/wiring/capability-table/workflow-apps.js +85 -70
  82. package/docs/agent-delegation-drive.7.md +4 -0
  83. package/docs/candidate-scoring.7.md +1 -1
  84. package/docs/canonical-workflow-apps.7.md +7 -7
  85. package/docs/cli-mcp-parity.7.md +26 -16
  86. package/docs/contract-migration-tooling.7.md +4 -0
  87. package/docs/control-plane-scheduling.7.md +4 -0
  88. package/docs/coordinator-blackboard.7.md +17 -17
  89. package/docs/dogfood-one-real-repo.7.md +11 -11
  90. package/docs/durable-state-and-locking.7.md +4 -0
  91. package/docs/end-to-end-golden-path.7.md +14 -14
  92. package/docs/evidence-adoption-reasoning-chain.7.md +4 -0
  93. package/docs/execution-backends.7.md +4 -0
  94. package/docs/getting-started.md +37 -37
  95. package/docs/multi-agent-cli-mcp-surface.7.md +21 -17
  96. package/docs/multi-agent-eval-replay-harness.7.md +17 -13
  97. package/docs/multi-agent-operator-ux.7.md +23 -19
  98. package/docs/multi-agent-runtime-core.7.md +22 -22
  99. package/docs/multi-agent-topologies.7.md +6 -6
  100. package/docs/multi-agent-trust-policy-audit.7.md +11 -11
  101. package/docs/node-snapshot-diff-replay.7.md +4 -0
  102. package/docs/observability-cost-accounting.7.md +4 -0
  103. package/docs/operator-ux.7.md +34 -34
  104. package/docs/pipeline-runner.7.md +4 -4
  105. package/docs/project-index.md +31 -4
  106. package/docs/real-execution-backends.7.md +4 -0
  107. package/docs/release-and-migration.7.md +5 -1
  108. package/docs/release-tooling.7.md +22 -0
  109. package/docs/routines.md +4 -4
  110. package/docs/run-registry-control-plane.7.md +23 -19
  111. package/docs/run-retention-reclamation.7.md +24 -3
  112. package/docs/scheduled-tasks.md +14 -14
  113. package/docs/security-trust-hardening.7.md +15 -15
  114. package/docs/state-explosion-management.7.md +14 -10
  115. package/docs/team-collaboration.7.md +4 -0
  116. package/docs/trust-audit-anchor.7.md +4 -0
  117. package/docs/unix-principles.md +3 -1
  118. package/docs/verifier-gated-commit.7.md +1 -1
  119. package/docs/web-desktop-workbench.7.md +4 -0
  120. package/docs/workflow-app-framework.7.md +13 -13
  121. package/manifest/plugin.manifest.json +1 -1
  122. package/package.json +3 -2
  123. package/scripts/agents/claude-p-agent.js +2 -2
  124. package/scripts/block-unapproved-tag.sh +42 -6
  125. package/scripts/bump-version.js +27 -10
  126. package/scripts/canonical-apps.js +4 -4
  127. package/scripts/children/batch-delegate-child.js +52 -2
  128. package/scripts/dogfood-release.js +1 -1
  129. package/scripts/fake-date-for-reproduction.js +44 -0
  130. package/scripts/golden-path.js +4 -4
  131. package/scripts/purity-baseline.json +0 -27
  132. package/scripts/release-flow.js +194 -13
  133. package/scripts/release-oneclick.js +407 -0
  134. package/scripts/verdict-keygen.js +83 -0
  135. package/scripts/verify-bump-reproduction.sh +148 -0
  136. package/scripts/verify-verdict-signature.js +61 -0
  137. package/scripts/version-sync-check.js +39 -22
  138. package/skills/cool-workflow/SKILL.md +9 -9
  139. package/skills/cool-workflow/references/commands.md +89 -88
  140. package/ui/workbench/app.css +37 -1
  141. package/ui/workbench/app.js +124 -6
@@ -6,40 +6,49 @@
6
6
  // (extracted with sed, not retyped).
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  const registry_core_1 = require("./registry-core");
9
- const io_1 = require("../../cli/io");
10
- const report_view_cli_1 = require("../../shell/report-view-cli");
9
+ const cli_args_1 = require("../../core/util/cli-args");
10
+ // This slice is required unconditionally at startup for every command;
11
+ // load these shell modules only when a handler that actually needs them runs.
12
+ function loadReportViewCli() {
13
+ return require("../../shell/report-view-cli");
14
+ }
15
+ function loadStateCli() {
16
+ return require("../../shell/state-cli");
17
+ }
18
+ function loadStateExplosionCli() {
19
+ return require("../../shell/state-explosion-cli");
20
+ }
11
21
  // MILESTONE 3 (state kernel) CLI bindings: state.check, migration.list|
12
22
  // check|prove, node.list|show|graph|snapshot|diff|replay|replay.verify.
13
23
  // Handler BODIES live in shell/state-cli.ts (impure — they read/write
14
24
  // run state on disk); this table only wires argv shape -> handler call
15
25
  // and the row's own exit-code rule, per cli/dispatch.ts's generic
16
- // executor contract. `required`/`optionalArg` are cli/io.ts's shared
17
- // coercion helpers, imported here so the wiring stays a thin adapter
26
+ // executor contract. `required`/`optionalArg` are core/util/cli-args.ts's
27
+ // shared coercion helpers, imported here so the wiring stays a thin adapter
18
28
  // (Usage-error strings copied byte-for-byte from the old build's
19
29
  // handlers/*.ts).
20
30
  // ---------------------------------------------------------------------
21
- const io_2 = require("../../cli/io");
22
- const state_cli_1 = require("../../shell/state-cli");
31
+ const cli_args_2 = require("../../core/util/cli-args");
23
32
  (0, registry_core_1.attachCliBinding)("state.check", {
24
33
  path: ["state", "check"],
25
34
  jsonMode: "default",
26
35
  handler: (args) => {
27
- const runId = (0, io_2.required)(args.positionals[0], "run id");
28
- const report = (0, state_cli_1.checkState)(runId, args.options);
36
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
37
+ const report = loadStateCli().checkState(runId, args.options);
29
38
  return { json: report, exitCode: report.status === "unsupported" ? 1 : undefined };
30
39
  },
31
40
  });
32
41
  (0, registry_core_1.attachCliBinding)("migration.list", {
33
42
  path: ["migration", "list"],
34
43
  jsonMode: "default",
35
- handler: () => ({ json: (0, state_cli_1.migrationList)() }),
44
+ handler: () => ({ json: loadStateCli().migrationList() }),
36
45
  });
37
46
  (0, registry_core_1.attachCliBinding)("migration.check", {
38
47
  path: ["migration", "check"],
39
48
  jsonMode: "default",
40
49
  handler: (args) => {
41
- const target = (0, io_2.required)(args.positionals[0], "target (run-id or state/app file)");
42
- const report = (0, state_cli_1.migrationCheck)(target, args.options);
50
+ const target = (0, cli_args_2.required)(args.positionals[0], "target (run-id or state/app file)");
51
+ const report = loadStateCli().migrationCheck(target, args.options);
43
52
  return { json: report, exitCode: report.status === "unsupported" ? 1 : undefined };
44
53
  },
45
54
  });
@@ -47,23 +56,23 @@ const state_cli_1 = require("../../shell/state-cli");
47
56
  path: ["migration", "prove"],
48
57
  jsonMode: "default",
49
58
  handler: (args) => {
50
- const target = (0, io_2.required)(args.positionals[0], "target (run-id or state/app file)");
51
- const proof = (0, state_cli_1.migrationProve)(target, args.options);
59
+ const target = (0, cli_args_2.required)(args.positionals[0], "target (run-id or state/app file)");
60
+ const proof = loadStateCli().migrationProve(target, args.options);
52
61
  return { json: proof, exitCode: proof.pass ? undefined : 1 };
53
62
  },
54
63
  });
55
64
  (0, registry_core_1.attachCliBinding)("node.list", {
56
65
  path: ["node", "list"],
57
66
  jsonMode: "default",
58
- handler: (args) => ({ json: (0, state_cli_1.listNodes)((0, io_2.required)(args.positionals[0], "run id"), args.options) }),
67
+ handler: (args) => ({ json: loadStateCli().listNodes((0, cli_args_2.required)(args.positionals[0], "run id"), args.options) }),
59
68
  });
60
69
  (0, registry_core_1.attachCliBinding)("node.show", {
61
70
  path: ["node", "show"],
62
71
  jsonMode: "default",
63
72
  handler: (args) => {
64
- const runId = (0, io_2.required)(args.positionals[0], "run id");
65
- const nodeId = (0, io_2.required)(args.positionals[1], "node id");
66
- return { json: (0, state_cli_1.showNode)(runId, nodeId, args.options) };
73
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
74
+ const nodeId = (0, cli_args_2.required)(args.positionals[1], "node id");
75
+ return { json: loadStateCli().showNode(runId, nodeId, args.options) };
67
76
  },
68
77
  });
69
78
  // jsonMode "flag": `--json` prints the node array (graphNodes); the bare
@@ -73,62 +82,62 @@ const state_cli_1 = require("../../shell/state-cli");
73
82
  path: ["node", "graph"],
74
83
  jsonMode: "flag",
75
84
  handler: (args) => {
76
- const runId = (0, io_2.required)(args.positionals[0], "run id");
77
- return { json: (0, state_cli_1.graphNodes)(runId, args.options), text: `${(0, report_view_cli_1.graphText)(runId, args.options)}\n` };
85
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
86
+ return { json: loadStateCli().graphNodes(runId, args.options), text: `${loadReportViewCli().graphText(runId, args.options)}\n` };
78
87
  },
79
88
  });
80
89
  (0, registry_core_1.attachCliBinding)("node.snapshot", {
81
90
  path: ["node", "snapshot"],
82
91
  jsonMode: "default",
83
92
  handler: (args) => {
84
- const runId = (0, io_2.required)(args.positionals[0], "run id");
85
- const nodeId = (0, io_2.required)(args.positionals[1], "node id");
86
- return { json: (0, state_cli_1.nodeSnapshotCli)(runId, nodeId, args.options) };
93
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
94
+ const nodeId = (0, cli_args_2.required)(args.positionals[1], "node id");
95
+ return { json: loadStateCli().nodeSnapshotCli(runId, nodeId, args.options) };
87
96
  },
88
97
  });
89
98
  (0, registry_core_1.attachCliBinding)("node.diff", {
90
99
  path: ["node", "diff"],
91
100
  jsonMode: "default",
92
101
  handler: (args) => {
93
- const runId = (0, io_2.required)(args.positionals[0], "run id");
94
- const baselineSnapshotId = (0, io_2.required)(args.positionals[1], "baseline snapshot id");
95
- const candidateSnapshotId = (0, io_2.required)(args.positionals[2], "candidate snapshot id");
96
- return { json: (0, state_cli_1.nodeDiffCli)(runId, baselineSnapshotId, candidateSnapshotId, args.options) };
102
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
103
+ const baselineSnapshotId = (0, cli_args_2.required)(args.positionals[1], "baseline snapshot id");
104
+ const candidateSnapshotId = (0, cli_args_2.required)(args.positionals[2], "candidate snapshot id");
105
+ return { json: loadStateCli().nodeDiffCli(runId, baselineSnapshotId, candidateSnapshotId, args.options) };
97
106
  },
98
107
  });
99
108
  (0, registry_core_1.attachCliBinding)("node.replay", {
100
109
  path: ["node", "replay"],
101
110
  jsonMode: "default",
102
111
  handler: (args) => {
103
- const runId = (0, io_2.required)(args.positionals[0], "run id");
104
- const snapshotId = (0, io_2.required)(args.positionals[1], "snapshot id");
105
- return { json: (0, state_cli_1.nodeReplayCli)(runId, snapshotId, args.options) };
112
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
113
+ const snapshotId = (0, cli_args_2.required)(args.positionals[1], "snapshot id");
114
+ return { json: loadStateCli().nodeReplayCli(runId, snapshotId, args.options) };
106
115
  },
107
116
  });
108
117
  (0, registry_core_1.attachCliBinding)("node.replay.verify", {
109
118
  path: ["node", "verify"],
110
119
  jsonMode: "default",
111
120
  handler: (args) => {
112
- const runId = (0, io_2.required)(args.positionals[0], "run id");
113
- const replayId = (0, io_2.required)(args.positionals[1], "replay id");
114
- const verdict = (0, state_cli_1.nodeReplayVerifyCli)(runId, replayId, args.options);
121
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
122
+ const replayId = (0, cli_args_2.required)(args.positionals[1], "replay id");
123
+ const verdict = loadStateCli().nodeReplayVerifyCli(runId, replayId, args.options);
115
124
  return { json: verdict, exitCode: verdict.pass ? undefined : 1 };
116
125
  },
117
126
  });
118
127
  // GAP #24: mirror the state-kernel CLI shell fns as MCP handlers (they were
119
128
  // declared MCP tool rows but left on notYetImplemented). Arg-name reads copied
120
129
  // byte-for-byte from the old build's mcp/tool-call.ts switch arms.
121
- registry_core_1.REGISTRY_BY_CAPABILITY.get("state.check").mcp.handler = (args) => (0, state_cli_1.checkState)((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
122
- registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.list").mcp.handler = () => (0, state_cli_1.migrationList)();
123
- registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.check").mcp.handler = (args) => (0, state_cli_1.migrationCheck)((0, io_2.required)((0, io_1.optionalArg)(args.target ?? args.runId), "target (run-id or state/app file)"), args);
124
- registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.prove").mcp.handler = (args) => (0, state_cli_1.migrationProve)((0, io_2.required)((0, io_1.optionalArg)(args.target ?? args.runId), "target (run-id or state/app file)"), args);
125
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.list").mcp.handler = (args) => (0, state_cli_1.listNodes)((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
126
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.show").mcp.handler = (args) => (0, state_cli_1.showNode)((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_2.required)((0, io_1.optionalArg)(args.nodeId), "node id"), args);
127
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.graph").mcp.handler = (args) => (0, state_cli_1.graphNodes)((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
128
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.snapshot").mcp.handler = (args) => (0, state_cli_1.nodeSnapshotCli)((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_2.required)((0, io_1.optionalArg)(args.nodeId), "node id"), args);
129
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.diff").mcp.handler = (args) => (0, state_cli_1.nodeDiffCli)((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_2.required)((0, io_1.optionalArg)(args.baselineSnapshotId ?? args.baseline), "baseline snapshot id"), (0, io_2.required)((0, io_1.optionalArg)(args.candidateSnapshotId ?? args.candidate), "candidate snapshot id"), args);
130
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay").mcp.handler = (args) => (0, state_cli_1.nodeReplayCli)((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_2.required)((0, io_1.optionalArg)(args.snapshotId), "snapshot id"), args);
131
- registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay.verify").mcp.handler = (args) => (0, state_cli_1.nodeReplayVerifyCli)((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), (0, io_2.required)((0, io_1.optionalArg)(args.replayId), "replay id"), args);
130
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("state.check").mcp.handler = (args) => loadStateCli().checkState((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
131
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.list").mcp.handler = () => loadStateCli().migrationList();
132
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.check").mcp.handler = (args) => loadStateCli().migrationCheck((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.target ?? args.runId), "target (run-id or state/app file)"), args);
133
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("migration.prove").mcp.handler = (args) => loadStateCli().migrationProve((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.target ?? args.runId), "target (run-id or state/app file)"), args);
134
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.list").mcp.handler = (args) => loadStateCli().listNodes((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
135
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.show").mcp.handler = (args) => loadStateCli().showNode((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.nodeId), "node id"), args);
136
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.graph").mcp.handler = (args) => loadStateCli().graphNodes((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
137
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.snapshot").mcp.handler = (args) => loadStateCli().nodeSnapshotCli((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.nodeId), "node id"), args);
138
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.diff").mcp.handler = (args) => loadStateCli().nodeDiffCli((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.baselineSnapshotId ?? args.baseline), "baseline snapshot id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.candidateSnapshotId ?? args.candidate), "candidate snapshot id"), args);
139
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay").mcp.handler = (args) => loadStateCli().nodeReplayCli((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.snapshotId), "snapshot id"), args);
140
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay.verify").mcp.handler = (args) => loadStateCli().nodeReplayVerifyCli((0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), (0, cli_args_2.required)((0, cli_args_1.optionalArg)(args.replayId), "replay id"), args);
132
141
  // `contract.show` is not yet a declared MCP_TOOL_DATA row with a CLI peer
133
142
  // wired here (it IS in MCP_TOOL_DATA already); no milestone-3 conformance
134
143
  // case reaches it, so it is intentionally left on its placeholder handler
@@ -143,30 +152,29 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay.verify").mcp.handler = (
143
152
  // "flag" — text by default, JSON under --json/--format json).
144
153
  // ---------------------------------------------------------------------
145
154
  const state_explosion_text_1 = require("../../core/format/state-explosion-text");
146
- const state_explosion_cli_1 = require("../../shell/state-explosion-cli");
147
- const io_3 = require("../../cli/io");
155
+ const cli_args_3 = require("../../core/util/cli-args");
148
156
  (0, registry_core_1.attachCliBinding)("summary.refresh", {
149
157
  path: ["summary", "refresh"],
150
158
  jsonMode: "flag",
151
159
  handler: (args) => {
152
- const runId = (0, io_2.required)(args.positionals[0], "run id");
153
- const index = (0, state_explosion_cli_1.summaryRefreshCli)(runId, args.options);
160
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
161
+ const index = loadStateExplosionCli().summaryRefreshCli(runId, args.options);
154
162
  // Byte-exact port of the old build's handleSummary "refresh": the
155
163
  // human-text branch re-reads via a fresh summaryShow call rather than
156
164
  // formatting the refresh's own index record (src/cli/handlers/
157
165
  // operator.ts:118-127); only computed when actually needed, so a
158
166
  // --json call does exactly the one read the old build's if/else did.
159
- if ((0, io_3.wantsJson)(args.options))
167
+ if ((0, cli_args_3.wantsJson)(args.options))
160
168
  return { json: index };
161
- return { json: index, text: (0, state_explosion_text_1.formatStateExplosionReport)((0, state_explosion_cli_1.summaryShowCli)(runId, args.options)) };
169
+ return { json: index, text: (0, state_explosion_text_1.formatStateExplosionReport)(loadStateExplosionCli().summaryShowCli(runId, args.options)) };
162
170
  },
163
171
  });
164
172
  (0, registry_core_1.attachCliBinding)("summary.show", {
165
173
  path: ["summary", "show"],
166
174
  jsonMode: "flag",
167
175
  handler: (args) => {
168
- const runId = (0, io_2.required)(args.positionals[0], "run id");
169
- const report = (0, state_explosion_cli_1.summaryShowCli)(runId, args.options);
176
+ const runId = (0, cli_args_2.required)(args.positionals[0], "run id");
177
+ const report = loadStateExplosionCli().summaryShowCli(runId, args.options);
170
178
  return { json: report, text: (0, state_explosion_text_1.formatStateExplosionReport)(report) };
171
179
  },
172
180
  });
@@ -6,7 +6,7 @@
6
6
  // retyped).
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  const registry_core_1 = require("./registry-core");
9
- const io_1 = require("../../cli/io");
9
+ const cli_args_1 = require("../../core/util/cli-args");
10
10
  // MILESTONE 8 (ledger, telemetry, trust-audit, tamper/bundle demos) CLI
11
11
  // bindings: ledger propose|review|verify|apply|list, telemetry verify,
12
12
  // audit verify, demo tamper|bundle, report bundle|verify-bundle. Handler
@@ -19,11 +19,24 @@ const io_1 = require("../../cli/io");
19
19
  // row — a known, preserved wart.
20
20
  // ---------------------------------------------------------------------
21
21
  const ledger_cli_1 = require("../../shell/ledger-cli");
22
- const telemetry_cli_1 = require("../../shell/telemetry-cli");
23
- const audit_cli_1 = require("../../shell/audit-cli");
24
- const demo_cli_1 = require("../../shell/demo-cli");
25
- const telemetry_demo_1 = require("../../shell/telemetry-demo");
26
- const report_cli_1 = require("../../shell/report-cli");
22
+ // This file is required at startup for every command. Loading these shell
23
+ // modules only when their handler runs, not at import time, keeps that
24
+ // load cost out of commands that never touch telemetry/audit/demo/report.
25
+ function loadTelemetryCli() {
26
+ return require("../../shell/telemetry-cli");
27
+ }
28
+ function loadAuditCli() {
29
+ return require("../../shell/audit-cli");
30
+ }
31
+ function loadDemoCli() {
32
+ return require("../../shell/demo-cli");
33
+ }
34
+ function loadTelemetryDemo() {
35
+ return require("../../shell/telemetry-demo");
36
+ }
37
+ function loadReportCli() {
38
+ return require("../../shell/report-cli");
39
+ }
27
40
  (0, registry_core_1.attachCliBinding)("ledger.propose", {
28
41
  path: ["ledger", "propose"],
29
42
  jsonMode: "default",
@@ -67,68 +80,79 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("ledger.list").mcp.handler = (args) =
67
80
  path: ["telemetry", "verify"],
68
81
  jsonMode: "flag",
69
82
  handler: (args) => {
70
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]) || (0, io_1.optionalArg)(args.options.runId) || (0, io_1.optionalArg)(args.options.run), "run id");
71
- const result = (0, telemetry_cli_1.telemetryVerifyCli)(runId, args.options);
72
- return { json: result, text: (0, telemetry_demo_1.formatTelemetryVerify)(result), exitCode: result.verified ? undefined : 1 };
83
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]) || (0, cli_args_1.optionalArg)(args.options.runId) || (0, cli_args_1.optionalArg)(args.options.run), "run id");
84
+ const result = loadTelemetryCli().telemetryVerifyCli(runId, args.options);
85
+ return { json: result, text: loadTelemetryDemo().formatTelemetryVerify(result), exitCode: result.verified ? undefined : 1 };
73
86
  },
74
87
  });
75
- registry_core_1.REGISTRY_BY_CAPABILITY.get("telemetry.verify").mcp.handler = (args) => (0, telemetry_cli_1.telemetryVerifyCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
88
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("telemetry.verify").mcp.handler = (args) => loadTelemetryCli().telemetryVerifyCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
76
89
  (0, registry_core_1.attachCliBinding)("audit.verify", {
77
90
  path: ["audit", "verify"],
78
91
  jsonMode: "default",
79
92
  handler: (args) => {
80
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
81
- const result = (0, audit_cli_1.auditVerifyCli)(runId, args.options);
93
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "run id");
94
+ const result = loadAuditCli().auditVerifyCli(runId, args.options);
82
95
  return { json: result, exitCode: result.verified ? undefined : 1 };
83
96
  },
84
97
  });
85
- registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.verify").mcp.handler = (args) => (0, audit_cli_1.auditVerifyCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
98
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.verify").mcp.handler = (args) => loadAuditCli().auditVerifyCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
86
99
  (0, registry_core_1.attachCliBinding)("audit.head", {
87
100
  path: ["audit", "head"],
88
101
  jsonMode: "default",
89
102
  handler: (args) => {
90
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
91
- return { json: (0, audit_cli_1.auditHeadCli)(runId, args.options) };
103
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "run id");
104
+ return { json: loadAuditCli().auditHeadCli(runId, args.options) };
92
105
  },
93
106
  });
94
- registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.head").mcp.handler = (args) => (0, audit_cli_1.auditHeadCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
107
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.head").mcp.handler = (args) => loadAuditCli().auditHeadCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
108
+ (0, registry_core_1.attachCliBinding)("audit.repair", {
109
+ path: ["audit", "repair"],
110
+ jsonMode: "default",
111
+ handler: (args) => {
112
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "run id");
113
+ const result = loadAuditCli().auditRepairCli(runId, args.options);
114
+ return { json: result, exitCode: result.outcome === "refused" ? 1 : undefined };
115
+ },
116
+ });
117
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.repair").mcp.handler = (args) => loadAuditCli().auditRepairCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
95
118
  (0, registry_core_1.addCliOnlyCapability)("demo.tamper", "Prove tamper-evidence: build a signed telemetry ledger, forge it, watch verification fail offline.", {
96
119
  path: ["demo", "tamper"],
97
120
  jsonMode: "flag",
98
121
  handler: (args) => {
99
- const result = (0, demo_cli_1.demoTamperCli)();
100
- return { json: result, text: (0, telemetry_demo_1.formatTamperDemo)(result), exitCode: result.proven ? undefined : 1 };
122
+ const result = loadDemoCli().demoTamperCli();
123
+ return { json: result, text: loadTelemetryDemo().formatTamperDemo(result), exitCode: result.proven ? undefined : 1 };
101
124
  },
102
125
  }, "Human-facing demonstration (operator/newcomer onboarding); the underlying integrity check is exposed programmatically as the both-surface telemetry.verify. No agent or MCP client needs to invoke a demo.");
103
126
  (0, registry_core_1.addCliOnlyCapability)("demo.bundle", "Prove portable-bundle verification: export a sealed report bundle, forge it two ways, watch report verify-bundle catch both offline with only the embedded public key.", {
104
127
  path: ["demo", "bundle"],
105
128
  jsonMode: "flag",
106
129
  handler: (args) => {
107
- const result = (0, demo_cli_1.demoBundleCli)();
108
- return { json: result, text: (0, telemetry_demo_1.formatBundleDemo)(result), exitCode: result.proven ? undefined : 1 };
130
+ const result = loadDemoCli().demoBundleCli();
131
+ return { json: result, text: loadTelemetryDemo().formatBundleDemo(result), exitCode: result.proven ? undefined : 1 };
109
132
  },
110
133
  }, "Human-facing demonstration (operator/newcomer onboarding); the underlying integrity check is exposed programmatically as the both-surface report.verify-bundle. No agent or MCP client needs to invoke a demo.");
111
134
  (0, registry_core_1.attachCliBinding)("report.bundle", {
112
135
  path: ["report", "bundle"],
113
136
  jsonMode: "default",
114
137
  handler: (args) => {
115
- const runId = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "run id");
116
- const result = (0, report_cli_1.reportBundleCli)(runId, args.options);
138
+ const runId = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "run id");
139
+ const result = loadReportCli().reportBundleCli(runId, args.options);
117
140
  return { json: result, exitCode: result.ok ? undefined : 1 };
118
141
  },
119
142
  });
120
- registry_core_1.REGISTRY_BY_CAPABILITY.get("report.bundle").mcp.handler = (args) => (0, report_cli_1.reportBundleCli)((0, io_1.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
143
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("report.bundle").mcp.handler = (args) => loadReportCli().reportBundleCli((0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.runId), "run id"), args);
121
144
  (0, registry_core_1.attachCliBinding)("report.verify-bundle", {
122
145
  path: ["report", "verify-bundle"],
123
- jsonMode: "default",
146
+ jsonMode: "flag",
124
147
  handler: (args) => {
125
- const archivePath = (0, io_1.required)((0, io_1.optionalArg)(args.positionals[0]), "bundle path");
126
- const result = (0, report_cli_1.reportVerifyBundleCli)({ ...args.options, archive: archivePath });
127
- return { json: result, exitCode: result.ok ? undefined : 1 };
148
+ const archivePath = (0, cli_args_1.required)((0, cli_args_1.optionalArg)(args.positionals[0]), "bundle path");
149
+ const reportCli = loadReportCli();
150
+ const result = reportCli.reportVerifyBundleCli({ ...args.options, archive: archivePath });
151
+ return { json: result, text: reportCli.formatReportVerifyBundle(result), exitCode: result.ok ? undefined : 1 };
128
152
  },
129
153
  });
130
154
  registry_core_1.REGISTRY_BY_CAPABILITY.get("report.verify-bundle").mcp.handler = (args) => {
131
- const result = (0, report_cli_1.reportVerifyBundleCli)(args);
155
+ const result = loadReportCli().reportVerifyBundleCli(args);
132
156
  return result;
133
157
  };
134
158
  // ---------------------------------------------------------------------