cool-workflow 0.2.2 → 0.2.3

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 (136) 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 +11 -5
  10. package/dist/cli/entry.js +41 -1
  11. package/dist/cli/io.js +6 -2
  12. package/dist/cli/parseargv.js +1 -0
  13. package/dist/core/capability-data.js +1 -0
  14. package/dist/core/format/completion.js +68 -0
  15. package/dist/core/format/help.js +25 -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/numeric-flag.js +40 -0
  30. package/dist/core/version.js +1 -1
  31. package/dist/mcp/server.js +99 -11
  32. package/dist/shell/audit-cli.js +57 -25
  33. package/dist/shell/coordinator-io.js +73 -13
  34. package/dist/shell/dispatch.js +1 -1
  35. package/dist/shell/doctor.js +80 -1
  36. package/dist/shell/drive.js +243 -49
  37. package/dist/shell/eval-text.js +2 -2
  38. package/dist/shell/evidence-reasoning.js +4 -4
  39. package/dist/shell/execution-backend/agent.js +20 -1
  40. package/dist/shell/execution-backend/container.js +4 -1
  41. package/dist/shell/execution-backend/local.js +4 -1
  42. package/dist/shell/feedback-cli.js +6 -6
  43. package/dist/shell/fs-atomic.js +218 -29
  44. package/dist/shell/man-cli.js +6 -0
  45. package/dist/shell/metrics-cli.js +2 -1
  46. package/dist/shell/multi-agent-cli.js +367 -323
  47. package/dist/shell/multi-agent-host.js +9 -9
  48. package/dist/shell/multi-agent-operator-ux.js +80 -38
  49. package/dist/shell/node-store.js +10 -4
  50. package/dist/shell/observability.js +1 -1
  51. package/dist/shell/operator-ux-text.js +22 -22
  52. package/dist/shell/operator-ux.js +15 -14
  53. package/dist/shell/orchestrator.js +49 -38
  54. package/dist/shell/pipeline-cli.js +87 -40
  55. package/dist/shell/reclamation-io.js +14 -4
  56. package/dist/shell/registry-cli.js +19 -17
  57. package/dist/shell/remote-source.js +13 -8
  58. package/dist/shell/report-cli.js +45 -0
  59. package/dist/shell/report.js +2 -1
  60. package/dist/shell/run-registry-io.js +77 -19
  61. package/dist/shell/run-store.js +74 -2
  62. package/dist/shell/scheduling-io.js +12 -13
  63. package/dist/shell/state-cli.js +2 -7
  64. package/dist/shell/state-explosion-cli.js +17 -9
  65. package/dist/shell/topology-io.js +36 -5
  66. package/dist/shell/trust-audit.js +224 -22
  67. package/dist/shell/trust-policy-io.js +1 -1
  68. package/dist/shell/worker-cli.js +35 -31
  69. package/dist/wiring/capability-table/basics.js +33 -8
  70. package/dist/wiring/capability-table/exec-backend.js +20 -11
  71. package/dist/wiring/capability-table/multi-agent.js +172 -165
  72. package/dist/wiring/capability-table/parity.js +1 -0
  73. package/dist/wiring/capability-table/pipeline.js +54 -42
  74. package/dist/wiring/capability-table/registry-core.js +29 -10
  75. package/dist/wiring/capability-table/reporting.js +137 -96
  76. package/dist/wiring/capability-table/scheduling-registry.js +195 -161
  77. package/dist/wiring/capability-table/state.js +36 -28
  78. package/dist/wiring/capability-table/trust-ledger.js +46 -22
  79. package/dist/wiring/capability-table/workflow-apps.js +83 -68
  80. package/docs/agent-delegation-drive.7.md +2 -0
  81. package/docs/candidate-scoring.7.md +1 -1
  82. package/docs/canonical-workflow-apps.7.md +7 -7
  83. package/docs/cli-mcp-parity.7.md +8 -3
  84. package/docs/contract-migration-tooling.7.md +2 -0
  85. package/docs/control-plane-scheduling.7.md +2 -0
  86. package/docs/coordinator-blackboard.7.md +17 -17
  87. package/docs/dogfood-one-real-repo.7.md +11 -11
  88. package/docs/durable-state-and-locking.7.md +2 -0
  89. package/docs/end-to-end-golden-path.7.md +14 -14
  90. package/docs/evidence-adoption-reasoning-chain.7.md +2 -0
  91. package/docs/execution-backends.7.md +2 -0
  92. package/docs/getting-started.md +37 -37
  93. package/docs/multi-agent-cli-mcp-surface.7.md +19 -17
  94. package/docs/multi-agent-eval-replay-harness.7.md +15 -13
  95. package/docs/multi-agent-operator-ux.7.md +21 -19
  96. package/docs/multi-agent-runtime-core.7.md +22 -22
  97. package/docs/multi-agent-topologies.7.md +6 -6
  98. package/docs/multi-agent-trust-policy-audit.7.md +11 -11
  99. package/docs/node-snapshot-diff-replay.7.md +2 -0
  100. package/docs/observability-cost-accounting.7.md +2 -0
  101. package/docs/operator-ux.7.md +34 -34
  102. package/docs/pipeline-runner.7.md +4 -4
  103. package/docs/project-index.md +27 -4
  104. package/docs/real-execution-backends.7.md +2 -0
  105. package/docs/release-and-migration.7.md +3 -1
  106. package/docs/release-tooling.7.md +2 -0
  107. package/docs/routines.md +4 -4
  108. package/docs/run-registry-control-plane.7.md +21 -19
  109. package/docs/run-retention-reclamation.7.md +2 -0
  110. package/docs/scheduled-tasks.md +14 -14
  111. package/docs/security-trust-hardening.7.md +15 -15
  112. package/docs/state-explosion-management.7.md +12 -10
  113. package/docs/team-collaboration.7.md +2 -0
  114. package/docs/trust-audit-anchor.7.md +2 -0
  115. package/docs/unix-principles.md +3 -1
  116. package/docs/verifier-gated-commit.7.md +1 -1
  117. package/docs/web-desktop-workbench.7.md +2 -0
  118. package/docs/workflow-app-framework.7.md +13 -13
  119. package/manifest/plugin.manifest.json +1 -1
  120. package/package.json +2 -2
  121. package/scripts/agents/claude-p-agent.js +2 -2
  122. package/scripts/block-unapproved-tag.sh +23 -2
  123. package/scripts/canonical-apps.js +4 -4
  124. package/scripts/children/batch-delegate-child.js +52 -2
  125. package/scripts/dogfood-release.js +1 -1
  126. package/scripts/fake-date-for-reproduction.js +44 -0
  127. package/scripts/golden-path.js +4 -4
  128. package/scripts/purity-baseline.json +3 -0
  129. package/scripts/release-flow.js +57 -1
  130. package/scripts/verdict-keygen.js +83 -0
  131. package/scripts/verify-bump-reproduction.sh +148 -0
  132. package/scripts/verify-verdict-signature.js +61 -0
  133. package/skills/cool-workflow/SKILL.md +9 -9
  134. package/skills/cool-workflow/references/commands.md +89 -88
  135. package/ui/workbench/app.css +37 -1
  136. package/ui/workbench/app.js +124 -6
@@ -7,7 +7,17 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  const registry_core_1 = require("./registry-core");
9
9
  const io_1 = require("../../cli/io");
10
- const report_view_cli_1 = require("../../shell/report-view-cli");
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
@@ -19,27 +29,26 @@ const report_view_cli_1 = require("../../shell/report-view-cli");
19
29
  // handlers/*.ts).
20
30
  // ---------------------------------------------------------------------
21
31
  const io_2 = require("../../cli/io");
22
- const state_cli_1 = require("../../shell/state-cli");
23
32
  (0, registry_core_1.attachCliBinding)("state.check", {
24
33
  path: ["state", "check"],
25
34
  jsonMode: "default",
26
35
  handler: (args) => {
27
36
  const runId = (0, io_2.required)(args.positionals[0], "run id");
28
- const report = (0, state_cli_1.checkState)(runId, args.options);
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
50
  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);
51
+ const report = loadStateCli().migrationCheck(target, args.options);
43
52
  return { json: report, exitCode: report.status === "unsupported" ? 1 : undefined };
44
53
  },
45
54
  });
@@ -48,14 +57,14 @@ const state_cli_1 = require("../../shell/state-cli");
48
57
  jsonMode: "default",
49
58
  handler: (args) => {
50
59
  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);
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, io_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"],
@@ -63,7 +72,7 @@ const state_cli_1 = require("../../shell/state-cli");
63
72
  handler: (args) => {
64
73
  const runId = (0, io_2.required)(args.positionals[0], "run id");
65
74
  const nodeId = (0, io_2.required)(args.positionals[1], "node id");
66
- return { json: (0, state_cli_1.showNode)(runId, nodeId, args.options) };
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
@@ -74,7 +83,7 @@ const state_cli_1 = require("../../shell/state-cli");
74
83
  jsonMode: "flag",
75
84
  handler: (args) => {
76
85
  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` };
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", {
@@ -83,7 +92,7 @@ const state_cli_1 = require("../../shell/state-cli");
83
92
  handler: (args) => {
84
93
  const runId = (0, io_2.required)(args.positionals[0], "run id");
85
94
  const nodeId = (0, io_2.required)(args.positionals[1], "node id");
86
- return { json: (0, state_cli_1.nodeSnapshotCli)(runId, nodeId, args.options) };
95
+ return { json: loadStateCli().nodeSnapshotCli(runId, nodeId, args.options) };
87
96
  },
88
97
  });
89
98
  (0, registry_core_1.attachCliBinding)("node.diff", {
@@ -93,7 +102,7 @@ const state_cli_1 = require("../../shell/state-cli");
93
102
  const runId = (0, io_2.required)(args.positionals[0], "run id");
94
103
  const baselineSnapshotId = (0, io_2.required)(args.positionals[1], "baseline snapshot id");
95
104
  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) };
105
+ return { json: loadStateCli().nodeDiffCli(runId, baselineSnapshotId, candidateSnapshotId, args.options) };
97
106
  },
98
107
  });
99
108
  (0, registry_core_1.attachCliBinding)("node.replay", {
@@ -102,7 +111,7 @@ const state_cli_1 = require("../../shell/state-cli");
102
111
  handler: (args) => {
103
112
  const runId = (0, io_2.required)(args.positionals[0], "run id");
104
113
  const snapshotId = (0, io_2.required)(args.positionals[1], "snapshot id");
105
- return { json: (0, state_cli_1.nodeReplayCli)(runId, snapshotId, args.options) };
114
+ return { json: loadStateCli().nodeReplayCli(runId, snapshotId, args.options) };
106
115
  },
107
116
  });
108
117
  (0, registry_core_1.attachCliBinding)("node.replay.verify", {
@@ -111,24 +120,24 @@ const state_cli_1 = require("../../shell/state-cli");
111
120
  handler: (args) => {
112
121
  const runId = (0, io_2.required)(args.positionals[0], "run id");
113
122
  const replayId = (0, io_2.required)(args.positionals[1], "replay id");
114
- const verdict = (0, state_cli_1.nodeReplayVerifyCli)(runId, replayId, args.options);
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, io_2.required)((0, io_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, io_2.required)((0, io_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, io_2.required)((0, io_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, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
135
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.show").mcp.handler = (args) => loadStateCli().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);
136
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.graph").mcp.handler = (args) => loadStateCli().graphNodes((0, io_2.required)((0, io_1.optionalArg)(args.runId), "run id"), args);
137
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.snapshot").mcp.handler = (args) => loadStateCli().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);
138
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.diff").mcp.handler = (args) => loadStateCli().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);
139
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay").mcp.handler = (args) => loadStateCli().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);
140
+ registry_core_1.REGISTRY_BY_CAPABILITY.get("node.replay.verify").mcp.handler = (args) => loadStateCli().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);
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,14 +152,13 @@ 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
155
  const io_3 = require("../../cli/io");
148
156
  (0, registry_core_1.attachCliBinding)("summary.refresh", {
149
157
  path: ["summary", "refresh"],
150
158
  jsonMode: "flag",
151
159
  handler: (args) => {
152
160
  const runId = (0, io_2.required)(args.positionals[0], "run id");
153
- const index = (0, state_explosion_cli_1.summaryRefreshCli)(runId, args.options);
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/
@@ -158,7 +166,7 @@ const io_3 = require("../../cli/io");
158
166
  // --json call does exactly the one read the old build's if/else did.
159
167
  if ((0, io_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", {
@@ -166,7 +174,7 @@ const io_3 = require("../../cli/io");
166
174
  jsonMode: "flag",
167
175
  handler: (args) => {
168
176
  const runId = (0, io_2.required)(args.positionals[0], "run id");
169
- const report = (0, state_explosion_cli_1.summaryShowCli)(runId, args.options);
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
  });
@@ -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",
@@ -68,44 +81,54 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("ledger.list").mcp.handler = (args) =
68
81
  jsonMode: "flag",
69
82
  handler: (args) => {
70
83
  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 };
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, io_1.required)((0, io_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
93
  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);
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, io_1.required)((0, io_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
103
  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) };
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, io_1.required)((0, io_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, io_1.required)((0, io_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, io_1.required)((0, io_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", {
@@ -113,22 +136,23 @@ registry_core_1.REGISTRY_BY_CAPABILITY.get("audit.head").mcp.handler = (args) =>
113
136
  jsonMode: "default",
114
137
  handler: (args) => {
115
138
  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);
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, io_1.required)((0, io_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
148
  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 };
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
  // ---------------------------------------------------------------------