opensip-cli 0.1.7 → 0.1.9

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 (169) hide show
  1. package/dist/bootstrap/admit-tool-package.d.ts +51 -11
  2. package/dist/bootstrap/admit-tool-package.d.ts.map +1 -1
  3. package/dist/bootstrap/admit-tool-package.js +46 -12
  4. package/dist/bootstrap/admit-tool-package.js.map +1 -1
  5. package/dist/bootstrap/baseline-seams.js +1 -1
  6. package/dist/bootstrap/baseline-seams.js.map +1 -1
  7. package/dist/bootstrap/bind-external-dispatch.d.ts +36 -0
  8. package/dist/bootstrap/bind-external-dispatch.d.ts.map +1 -0
  9. package/dist/bootstrap/bind-external-dispatch.js +81 -0
  10. package/dist/bootstrap/bind-external-dispatch.js.map +1 -0
  11. package/dist/bootstrap/build-command-registration-input.d.ts +13 -2
  12. package/dist/bootstrap/build-command-registration-input.d.ts.map +1 -1
  13. package/dist/bootstrap/build-command-registration-input.js +29 -2
  14. package/dist/bootstrap/build-command-registration-input.js.map +1 -1
  15. package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -1
  16. package/dist/bootstrap/build-per-run-scope.js +27 -3
  17. package/dist/bootstrap/build-per-run-scope.js.map +1 -1
  18. package/dist/bootstrap/config-and-capabilities.d.ts +21 -6
  19. package/dist/bootstrap/config-and-capabilities.d.ts.map +1 -1
  20. package/dist/bootstrap/config-and-capabilities.js +79 -23
  21. package/dist/bootstrap/config-and-capabilities.js.map +1 -1
  22. package/dist/bootstrap/dispatch-external-tool-command.d.ts +67 -0
  23. package/dist/bootstrap/dispatch-external-tool-command.d.ts.map +1 -0
  24. package/dist/bootstrap/dispatch-external-tool-command.js +79 -0
  25. package/dist/bootstrap/dispatch-external-tool-command.js.map +1 -0
  26. package/dist/bootstrap/dispatch-external-tool-hook.d.ts +47 -0
  27. package/dist/bootstrap/dispatch-external-tool-hook.d.ts.map +1 -0
  28. package/dist/bootstrap/dispatch-external-tool-hook.js +49 -0
  29. package/dist/bootstrap/dispatch-external-tool-hook.js.map +1 -0
  30. package/dist/bootstrap/dispatch-fork-core.d.ts +48 -0
  31. package/dist/bootstrap/dispatch-fork-core.d.ts.map +1 -0
  32. package/dist/bootstrap/dispatch-fork-core.js +214 -0
  33. package/dist/bootstrap/dispatch-fork-core.js.map +1 -0
  34. package/dist/bootstrap/dispatch-host-rpc-handler.d.ts +27 -0
  35. package/dist/bootstrap/dispatch-host-rpc-handler.d.ts.map +1 -0
  36. package/dist/bootstrap/dispatch-host-rpc-handler.js +175 -0
  37. package/dist/bootstrap/dispatch-host-rpc-handler.js.map +1 -0
  38. package/dist/bootstrap/dispatch-replay-result.d.ts +51 -0
  39. package/dist/bootstrap/dispatch-replay-result.d.ts.map +1 -0
  40. package/dist/bootstrap/dispatch-replay-result.js +76 -0
  41. package/dist/bootstrap/dispatch-replay-result.js.map +1 -0
  42. package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts.map +1 -1
  43. package/dist/bootstrap/execute-post-bailout-bootstrap.js +3 -1
  44. package/dist/bootstrap/execute-post-bailout-bootstrap.js.map +1 -1
  45. package/dist/bootstrap/index.d.ts +6 -0
  46. package/dist/bootstrap/index.d.ts.map +1 -1
  47. package/dist/bootstrap/index.js +14 -2
  48. package/dist/bootstrap/index.js.map +1 -1
  49. package/dist/bootstrap/owning-tool-init.d.ts +8 -2
  50. package/dist/bootstrap/owning-tool-init.d.ts.map +1 -1
  51. package/dist/bootstrap/owning-tool-init.js +11 -1
  52. package/dist/bootstrap/owning-tool-init.js.map +1 -1
  53. package/dist/bootstrap/pre-action-hook.d.ts.map +1 -1
  54. package/dist/bootstrap/pre-action-hook.js +5 -0
  55. package/dist/bootstrap/pre-action-hook.js.map +1 -1
  56. package/dist/bootstrap/register-authored-tools.d.ts +49 -0
  57. package/dist/bootstrap/register-authored-tools.d.ts.map +1 -0
  58. package/dist/bootstrap/register-authored-tools.js +132 -0
  59. package/dist/bootstrap/register-authored-tools.js.map +1 -0
  60. package/dist/bootstrap/register-tools-discovery.d.ts +4 -52
  61. package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -1
  62. package/dist/bootstrap/register-tools-discovery.js +82 -117
  63. package/dist/bootstrap/register-tools-discovery.js.map +1 -1
  64. package/dist/bootstrap/register-tools-mount.d.ts.map +1 -1
  65. package/dist/bootstrap/register-tools-mount.js +20 -44
  66. package/dist/bootstrap/register-tools-mount.js.map +1 -1
  67. package/dist/bootstrap/register-tools.d.ts +2 -1
  68. package/dist/bootstrap/register-tools.d.ts.map +1 -1
  69. package/dist/bootstrap/register-tools.js +2 -1
  70. package/dist/bootstrap/register-tools.js.map +1 -1
  71. package/dist/bootstrap/run-plane.d.ts +11 -0
  72. package/dist/bootstrap/run-plane.d.ts.map +1 -1
  73. package/dist/bootstrap/run-plane.js.map +1 -1
  74. package/dist/bootstrap/scope-access.d.ts +15 -1
  75. package/dist/bootstrap/scope-access.d.ts.map +1 -1
  76. package/dist/bootstrap/scope-access.js +12 -1
  77. package/dist/bootstrap/scope-access.js.map +1 -1
  78. package/dist/bootstrap/skip-installed-plugins.d.ts +23 -0
  79. package/dist/bootstrap/skip-installed-plugins.d.ts.map +1 -0
  80. package/dist/bootstrap/skip-installed-plugins.js +30 -0
  81. package/dist/bootstrap/skip-installed-plugins.js.map +1 -0
  82. package/dist/bootstrap/synthesize-external-tool.d.ts +45 -0
  83. package/dist/bootstrap/synthesize-external-tool.d.ts.map +1 -0
  84. package/dist/bootstrap/synthesize-external-tool.js +112 -0
  85. package/dist/bootstrap/synthesize-external-tool.js.map +1 -0
  86. package/dist/bootstrap/tool-command-dispatch-types.d.ts +280 -0
  87. package/dist/bootstrap/tool-command-dispatch-types.d.ts.map +1 -0
  88. package/dist/bootstrap/tool-command-dispatch-types.js +34 -0
  89. package/dist/bootstrap/tool-command-dispatch-types.js.map +1 -0
  90. package/dist/bootstrap/tool-command-worker-config-pass.d.ts +24 -0
  91. package/dist/bootstrap/tool-command-worker-config-pass.d.ts.map +1 -0
  92. package/dist/bootstrap/tool-command-worker-config-pass.js +52 -0
  93. package/dist/bootstrap/tool-command-worker-config-pass.js.map +1 -0
  94. package/dist/bootstrap/tool-command-worker-context.d.ts +55 -0
  95. package/dist/bootstrap/tool-command-worker-context.d.ts.map +1 -0
  96. package/dist/bootstrap/tool-command-worker-context.js +163 -0
  97. package/dist/bootstrap/tool-command-worker-context.js.map +1 -0
  98. package/dist/bootstrap/tool-command-worker-entry.d.ts +66 -0
  99. package/dist/bootstrap/tool-command-worker-entry.d.ts.map +1 -0
  100. package/dist/bootstrap/tool-command-worker-entry.js +298 -0
  101. package/dist/bootstrap/tool-command-worker-entry.js.map +1 -0
  102. package/dist/bootstrap/tool-command-worker-rpc.d.ts +53 -0
  103. package/dist/bootstrap/tool-command-worker-rpc.d.ts.map +1 -0
  104. package/dist/bootstrap/tool-command-worker-rpc.js +78 -0
  105. package/dist/bootstrap/tool-command-worker-rpc.js.map +1 -0
  106. package/dist/bootstrap/tool-provenance.d.ts +85 -0
  107. package/dist/bootstrap/tool-provenance.d.ts.map +1 -0
  108. package/dist/bootstrap/tool-provenance.js +101 -0
  109. package/dist/bootstrap/tool-provenance.js.map +1 -0
  110. package/dist/bootstrap/tool-trust.d.ts +22 -2
  111. package/dist/bootstrap/tool-trust.d.ts.map +1 -1
  112. package/dist/bootstrap/tool-trust.js +25 -2
  113. package/dist/bootstrap/tool-trust.js.map +1 -1
  114. package/dist/cli-context.d.ts +17 -0
  115. package/dist/cli-context.d.ts.map +1 -1
  116. package/dist/cli-context.js +62 -1
  117. package/dist/cli-context.js.map +1 -1
  118. package/dist/commands/completion.d.ts.map +1 -1
  119. package/dist/commands/completion.js +3 -0
  120. package/dist/commands/completion.js.map +1 -1
  121. package/dist/commands/host-command-specs.d.ts +13 -15
  122. package/dist/commands/host-command-specs.d.ts.map +1 -1
  123. package/dist/commands/host-command-specs.js +27 -27
  124. package/dist/commands/host-command-specs.js.map +1 -1
  125. package/dist/commands/host-subcommand-groups.d.ts.map +1 -1
  126. package/dist/commands/host-subcommand-groups.js +63 -5
  127. package/dist/commands/host-subcommand-groups.js.map +1 -1
  128. package/dist/commands/internal-command-visibility.d.ts +13 -4
  129. package/dist/commands/internal-command-visibility.d.ts.map +1 -1
  130. package/dist/commands/internal-command-visibility.js +14 -5
  131. package/dist/commands/internal-command-visibility.js.map +1 -1
  132. package/dist/commands/mount-command-spec.d.ts.map +1 -1
  133. package/dist/commands/mount-command-spec.js +31 -0
  134. package/dist/commands/mount-command-spec.js.map +1 -1
  135. package/dist/commands/session-show.d.ts.map +1 -1
  136. package/dist/commands/session-show.js +4 -1
  137. package/dist/commands/session-show.js.map +1 -1
  138. package/dist/commands/tools/data-purge.js +2 -2
  139. package/dist/commands/tools/data-purge.js.map +1 -1
  140. package/dist/commands/tools/validate.js +1 -1
  141. package/dist/env/host-env-specs.d.ts.map +1 -1
  142. package/dist/env/host-env-specs.js +28 -0
  143. package/dist/env/host-env-specs.js.map +1 -1
  144. package/dist/index.d.ts.map +1 -1
  145. package/dist/index.js +15 -6
  146. package/dist/index.js.map +1 -1
  147. package/dist/report-compose.d.ts.map +1 -1
  148. package/dist/report-compose.js +85 -19
  149. package/dist/report-compose.js.map +1 -1
  150. package/dist/session-replay-registry.d.ts +33 -6
  151. package/dist/session-replay-registry.d.ts.map +1 -1
  152. package/dist/session-replay-registry.js +43 -6
  153. package/dist/session-replay-registry.js.map +1 -1
  154. package/dist/telemetry/command-label.d.ts +19 -0
  155. package/dist/telemetry/command-label.d.ts.map +1 -0
  156. package/dist/telemetry/command-label.js +26 -0
  157. package/dist/telemetry/command-label.js.map +1 -0
  158. package/dist/telemetry/profiling.d.ts +30 -0
  159. package/dist/telemetry/profiling.d.ts.map +1 -1
  160. package/dist/telemetry/profiling.js +16 -1
  161. package/dist/telemetry/profiling.js.map +1 -1
  162. package/dist/telemetry/sdk-init.d.ts +9 -0
  163. package/dist/telemetry/sdk-init.d.ts.map +1 -1
  164. package/dist/telemetry/sdk-init.js +32 -0
  165. package/dist/telemetry/sdk-init.js.map +1 -1
  166. package/dist/ui/views/tools-views.d.ts.map +1 -1
  167. package/dist/ui/views/tools-views.js +8 -0
  168. package/dist/ui/views/tools-views.js.map +1 -1
  169. package/package.json +32 -32
@@ -71,6 +71,34 @@ export const CLI_INFRA_ENV_SPECS = [
71
71
  'A skipped tool can instead be loaded from an installed/project-local package of the same id ' +
72
72
  '— the install-source-independence escape hatch. Unset = load all bundled tools.',
73
73
  },
74
+ {
75
+ canonical: 'OPENSIP_CLI_SKIP_INSTALLED',
76
+ coerce: (raw) => raw.length > 0,
77
+ default: false,
78
+ docs: 'Set to any non-empty value to skip discovery and loading of installed npm tool packages ' +
79
+ '(opensipTools.kind === tool in ancestor node_modules). Bundled and authored tools are ' +
80
+ 'unaffected. Equivalent to passing --no-plugins. Use for incident response when ambient ' +
81
+ 'plugins must not execute in the host process.',
82
+ },
83
+ {
84
+ canonical: 'OPENSIP_CLI_ALLOW_INSTALLED_TOOLS',
85
+ coerce: (raw) => raw
86
+ .split(/[\s,]+/)
87
+ .map((s) => s.trim())
88
+ .filter((s) => s.length > 0),
89
+ default: [],
90
+ docs: 'Comma/whitespace-separated installed npm Tool ids to admit (deny-by-default). ' +
91
+ "Use '*' to admit all ambient opensipTools.kind === tool packages discovered in " +
92
+ 'ancestor node_modules. Unset = skip installed tools unless explicitly allowlisted. ' +
93
+ 'Does not affect bundled or authored tools. Pair with OPENSIP_CLI_SKIP_INSTALLED for ' +
94
+ 'incident response (kill switch wins).',
95
+ },
96
+ // ADR-0054 M4-E: `OPENSIP_CLI_EXTERNAL_WORKER` (the opt-in gate for the
97
+ // out-of-process dispatch plane) was RETIRED. External (installed /
98
+ // project-local / user-global) tools now fork the worker BY DEFAULT — the gate
99
+ // is gone, not a no-op. `OPENSIP_CLI_NO_WORKER` is bundled-only (documented on
100
+ // its core spec in subprocess-transport.ts): it never lets an external tool run
101
+ // in-host; an external tool that cannot fork is a hard error.
74
102
  {
75
103
  canonical: 'OPENSIP_CLI_ALLOW_PROJECT_TOOLS',
76
104
  // Mirror parseAllowlist's split (whitespace AND comma) so the registry value
@@ -1 +1 @@
1
- {"version":3,"file":"host-env-specs.js","sourceRoot":"","sources":["../../src/env/host-env-specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAmB,MAAM,mBAAmB,CAAC;AAExF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAmC;IACjE;QACE,SAAS,EAAE,6BAA6B;QACxC,IAAI,EAAE,6FAA6F;KACpG;IACD;QACE,SAAS,EAAE,mBAAmB;QAC9B,IAAI,EAAE,iRAAiR;KACxR;IACD;QACE,SAAS,EAAE,aAAa;QACxB,IAAI,EAAE,8FAA8F;KACrG;IACD;QACE,SAAS,EAAE,mBAAmB;QAC9B,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC;QAC/B,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,0DAA0D;KACjE;IACD;QACE,SAAS,EAAE,oBAAoB;QAC/B,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC;QAC/B,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,yFAAyF;KAChG;IACD;QACE,SAAS,EAAE,2BAA2B;QACtC,2EAA2E;QAC3E,4EAA4E;QAC5E,uEAAuE;QACvE,gEAAgE;QAChE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG;QAC5B,OAAO,EAAE,KAAK;QACd,IAAI,EACF,6EAA6E;YAC7E,gFAAgF;YAChF,oFAAoF;YACpF,8EAA8E;KACjF;IACD;QACE,SAAS,EAAE,0BAA0B;QACrC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CACd,GAAG;aACA,KAAK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,EAAE,IAAI,EAAE,8CAA8C,EAAE;IAC3E;QACE,SAAS,EAAE,cAAc;QACzB,IAAI,EAAE,kEAAkE;KACzE;IACD;QACE,SAAS,EAAE,cAAc;QACzB,IAAI,EAAE,uFAAuF;KAC9F;IACD;QACE,SAAS,EAAE,uBAAuB;QAClC,IAAI,EAAE,2GAA2G;KAClH;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,GAAG,gBAAgB,EAAE,GAAG,sBAAsB,EAAE,GAAG,aAAa,EAAE,GAAG,mBAAmB,CAAC,CAAC;AACpG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;GAiBG;AAmCH,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;GAiBG;AAoCH,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ import { buildTopLevelHostSpecs } from './commands/host-command-specs.js';
29
29
  import { buildHostSubcommandGroups, buildToolPluginGroups, } from './commands/host-subcommand-groups.js';
30
30
  import { registerCliCommands } from './commands/index.js';
31
31
  import { handleFatalBootstrapError, handleParseError } from './error-handler.js';
32
+ import { resolvedCommandLabel } from './telemetry/command-label.js';
32
33
  import { runWithTelemetryContext, shutdownTelemetry } from './telemetry/sdk-init.js';
33
34
  import { printWelcome } from './welcome.js';
34
35
  export * from './api.js';
@@ -38,6 +39,7 @@ const program = new Command('opensip')
38
39
  // ADR-0008: per-run opt-out of OpenSIP Cloud signal sync. `--no-cloud` sets
39
40
  // `cloud` to false; the pre-action hook reads it via optsWithGlobals().
40
41
  .option('--no-cloud', 'Disable OpenSIP Cloud signal sync for this run')
42
+ .option('--no-plugins', 'Skip loading installed npm tool packages (incident response; does not affect bundled or authored tools)')
41
43
  // NOTE: the root program does NOT register a Commander `.version()` option.
42
44
  // A Commander version option on the root is a GLOBAL option that intercepts
43
45
  // `--version` even after a known subcommand, so `opensip fit --version` would
@@ -73,12 +75,14 @@ async function main() {
73
75
  // Persistence: datastore is opened LAZILY in cli-context.ts on
74
76
  // first access via getOrOpenDatastore. bootstrapCli just registers
75
77
  // tools and adapters; no SQLite file is created here.
78
+ const userArgv = process.argv.slice(2);
76
79
  const { provenance, manifests } = await bootstrapCli({
77
80
  langRegistry,
78
81
  toolRegistry,
79
82
  projectDir: dirname(dirname(fileURLToPath(import.meta.url))),
80
83
  cwd: process.cwd(),
81
84
  cliEntryUrl: import.meta.url,
85
+ argv: userArgv,
82
86
  });
83
87
  const { ctx } = buildToolCliContext({
84
88
  render: renderResult,
@@ -89,7 +93,12 @@ async function main() {
89
93
  // Extracted into a thin dedicated builder (roadmap item 2) to keep the
90
94
  // top-level composition root focused on sequencing. The builder returns the
91
95
  // exact shape consumed by `registerCliCommands`.
92
- const registrationInput = buildCommandRegistrationInput(toolRegistry);
96
+ const registrationInput = buildCommandRegistrationInput(toolRegistry, {
97
+ // ADR-0054 M4-F: an EXTERNAL tool's session replay runs in a forked worker
98
+ // (its runtime never runs in-host); bundled replays in-host.
99
+ provenance,
100
+ cwd: process.cwd(),
101
+ });
93
102
  const commandCtx = {
94
103
  setExitCode: ctx.setExitCode,
95
104
  render: renderResult,
@@ -147,12 +156,12 @@ async function main() {
147
156
  render: renderResult,
148
157
  jsonRequested,
149
158
  })));
150
- // Phase 2: command duration histogram (low cardinality labels)
159
+ // Phase 2: command duration histogram. The label is the RESOLVED command name
160
+ // (stamped by the pre-action hook), not raw `process.argv[2]` — a typo, flag,
161
+ // or path as argv[2] would otherwise blow up the metric's label cardinality.
151
162
  const durationMs = Date.now() - commandStart;
152
- getMeter('opensip-cli')
153
- .createHistogram('opensip_cli.command.duration_ms')
154
- .record(durationMs, {
155
- command: process.argv[2] || 'welcome', // rough; real commands go through pre-action
163
+ getMeter('opensip-cli').createHistogram('opensip_cli.command.duration_ms').record(durationMs, {
164
+ command: resolvedCommandLabel(),
156
165
  });
157
166
  }
158
167
  // Top-level fatal handler. Errors that escape `main` predate Commander's
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,qNAAqN;AACrN;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,kBAAkB,EAClB,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,cAAc,UAAU,CAAC;AAEzB,MAAM,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,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zE,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,qEAAqE;AACrE,kDAAkD;AAClD,IAAI,CAAC;IACH,MAAM,IAAI,EAAE,CAAC;AACf,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC;QAAS,CAAC;IACT,uEAAuE;IACvE,wEAAwE;IACxE,wEAAwE;IACxE,uEAAuE;IACvE,kDAAkD;IAClD,MAAM,iBAAiB,EAAE,CAAC;AAC5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"report-compose.d.ts","sourceRoot":"","sources":["../src/report-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAqBH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAkE3D;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAY1F"}
1
+ {"version":3,"file":"report-compose.d.ts","sourceRoot":"","sources":["../src/report-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA8BH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA6I3D;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAY1F"}
@@ -25,7 +25,9 @@ import { join } from 'node:path';
25
25
  import { currentScope, resolveProjectPaths, resolveToolHooks, SystemError, logger as defaultLogger, } from '@opensip-cli/core';
26
26
  import { generateDashboardHtml, } from '@opensip-cli/dashboard';
27
27
  import { SessionRepo } from '@opensip-cli/session-store';
28
- import { getCurrentProjectRoot } from './cli-context.js';
28
+ import { dispatchExternalToolHook } from './bootstrap/dispatch-external-tool-hook.js';
29
+ import { isExternalToolProvenance, provenanceRecordFor, shouldRunHookInHost, } from './bootstrap/tool-provenance.js';
30
+ import { buildHostDispatchCtx, getCurrentProjectRoot } from './cli-context.js';
29
31
  import { launchReport } from './open-report.js';
30
32
  /**
31
33
  * Host-reserved top-level dashboard-input key a tool's `collectReportData` must
@@ -59,29 +61,93 @@ async function composeReportInput() {
59
61
  const repo = datastore ? new SessionRepo(datastore) : undefined;
60
62
  const sessions = repo ? [...repo.list({ limit: 20 })] : [];
61
63
  const input = { sessions };
64
+ const provenance = scope.toolProvenance;
65
+ // Built lazily ONLY when an external tool is encountered (so a bundled-only run
66
+ // never constructs the dispatch ctx). Shared across all external tools this run.
67
+ let hostCtx;
62
68
  for (const tool of scope.tools.list()) {
63
- const contribution = await resolveToolHooks(tool).collectReportData?.(scope);
64
- if (contribution) {
65
- // Guardrail (spec §8): tools must never clobber the host-owned `sessions`
66
- // run history. Ignore with a warning (best-effort, like other contribution
67
- // faults) — the host owns the cross-tool history.
68
- const reserved = Object.keys(contribution).filter((k) => RESERVED_DASHBOARD_KEYS.has(k));
69
- if (reserved.length > 0) {
70
- void log.warn({
71
- evt: 'cli.report.compose.reserved_key_ignored',
72
- module: 'cli:report',
73
- tool: tool.metadata.id,
74
- keys: reserved,
75
- msg: 'Tool collectReportData returned a reserved host key; it was ignored.',
76
- });
77
- for (const k of reserved)
78
- delete contribution[k];
79
- }
80
- Object.assign(input, contribution);
69
+ // ADR-0054 M4-F: a BUNDLED tool's collectReportData runs in-host (trusted
70
+ // computing base); an EXTERNAL tool's runs in a forked HOOK worker so its
71
+ // untrusted runtime never executes in the host process.
72
+ let contribution;
73
+ if (shouldRunHookInHost(tool, provenance)) {
74
+ contribution = await resolveToolHooks(tool).collectReportData?.(scope);
81
75
  }
76
+ else {
77
+ hostCtx ??= buildHostDispatchCtx(log);
78
+ contribution = await collectExternalReportData(tool, provenance, hostCtx, log);
79
+ }
80
+ // @fitness-ignore-next-line detached-promises -- mergeContribution returns void (a synchronous Object.assign + warn); the name-based heuristic misfires on a bare call statement.
81
+ mergeContribution(input, contribution, tool, log);
82
82
  }
83
83
  return input;
84
84
  }
85
+ /**
86
+ * Gather an EXTERNAL tool's `collectReportData` over a forked hook worker
87
+ * (ADR-0054 M4-F). The worker imports the untrusted runtime, runs the hook
88
+ * against its own re-bootstrapped scope, and returns the plain-data contribution.
89
+ * A fork failure is best-effort: logged + the tool contributes nothing (parity
90
+ * with a tool that omits the hook), NEVER an in-host fallback. Returns `undefined`
91
+ * when there is no host ctx to fork with (the worker needs one to serve any
92
+ * host-RPC upcall the hook makes; without it we skip rather than run in-host).
93
+ */
94
+ async function collectExternalReportData(tool, provenance, hostCtx, log) {
95
+ const record = provenanceRecordFor(tool, provenance);
96
+ if (record === undefined ||
97
+ !isExternalToolProvenance(tool, provenance) ||
98
+ hostCtx === undefined) {
99
+ if (hostCtx === undefined) {
100
+ void log.warn({
101
+ evt: 'cli.report.compose.external_hook_skipped',
102
+ module: 'cli:report',
103
+ tool: tool.metadata.id,
104
+ msg: 'No host context to fork the report-data worker for an external tool; skipping its contribution.',
105
+ });
106
+ }
107
+ return undefined;
108
+ }
109
+ try {
110
+ const cwd = getCurrentProjectRoot();
111
+ const result = await dispatchExternalToolHook({
112
+ provenance: record,
113
+ hook: 'collectReportData',
114
+ cwd,
115
+ ctx: hostCtx,
116
+ });
117
+ return (result ?? undefined);
118
+ }
119
+ catch (error) {
120
+ void log.warn({
121
+ evt: 'cli.report.compose.external_hook_failed',
122
+ module: 'cli:report',
123
+ tool: tool.metadata.id,
124
+ error: error instanceof Error ? error.message : String(error),
125
+ msg: 'External tool report-data worker failed; its contribution is omitted (the report still renders).',
126
+ });
127
+ // @fitness-ignore-next-line error-handling-quality -- the failure IS logged via log.warn just above; an external report-data worker fault is best-effort by contract (parity with a tool that omits collectReportData): the report still renders for every other tool. NEVER an in-host fallback (that would run untrusted code).
128
+ return undefined;
129
+ }
130
+ }
131
+ /** Merge one tool's report contribution into the input, guarding reserved host keys. */
132
+ function mergeContribution(input, contribution, tool, log) {
133
+ if (!contribution)
134
+ return;
135
+ // Guardrail (spec §8): tools must never clobber the host-owned `sessions` run
136
+ // history. Ignore with a warning (best-effort) — the host owns the history.
137
+ const reserved = Object.keys(contribution).filter((k) => RESERVED_DASHBOARD_KEYS.has(k));
138
+ if (reserved.length > 0) {
139
+ void log.warn({
140
+ evt: 'cli.report.compose.reserved_key_ignored',
141
+ module: 'cli:report',
142
+ tool: tool.metadata.id,
143
+ keys: reserved,
144
+ msg: 'Tool collectReportData returned a reserved host key; it was ignored.',
145
+ });
146
+ for (const k of reserved)
147
+ delete contribution[k];
148
+ }
149
+ Object.assign(input, contribution);
150
+ }
85
151
  /**
86
152
  * Compose the cross-tool report, write it to
87
153
  * `<reportsDir>/latest.html`, and (optionally) open it in the browser.
@@ -1 +1 @@
1
- {"version":3,"file":"report-compose.js","sourceRoot":"","sources":["../src/report-compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,MAAM,IAAI,aAAa,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,GAEtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAKhD;;;;GAIG;AACH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,kBAAkB;IAC/B,MAAM,KAAK,GAAG,YAAY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AsE;SAC5E,CAAC,CAAC;QACH,KAAK,MAAM,CAAC,IAAI,QAAQ;YAAE,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,IAAuB;IACjE,MAAM,KAAK,GAAG,MAAM,kBAAkB,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,KAAK,GAAG,mBAAmB,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAC3D,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACzD,aAAa,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAExC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAElE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;AACtD,CAAC"}
@@ -1,20 +1,47 @@
1
- import { type ToolRegistry, type ToolSessionRecord, type ToolShortId } from '@opensip-cli/core';
1
+ import { type ToolProvenance, type ToolRegistry, type ToolSessionRecord, type ToolShortId } from '@opensip-cli/core';
2
2
  import type { CommandResult, ToolSessionReplay } from '@opensip-cli/contracts';
3
+ /**
4
+ * One tool's session-replay capability as the host consumes it. `replaySession`
5
+ * may be ASYNC (ADR-0054 M4-F): for a BUNDLED tool it runs the tool's in-host
6
+ * `replaySession` closure and resolves synchronously; for an EXTERNAL tool it
7
+ * forks a HOOK worker that imports the untrusted runtime and runs the replay
8
+ * there (its code never executes in the host process).
9
+ */
3
10
  export interface CliSessionReplayContribution {
4
11
  readonly tool: ToolShortId;
5
- readonly replaySession: (stored: ToolSessionRecord) => ToolSessionReplay<CommandResult>;
12
+ readonly replaySession: (stored: ToolSessionRecord) => ToolSessionReplay<CommandResult> | Promise<ToolSessionReplay<CommandResult>>;
13
+ }
14
+ /**
15
+ * The injected capability that runs an EXTERNAL tool's session replay
16
+ * out-of-process (ADR-0054 M4-F). It is INJECTED (not statically imported) so
17
+ * `session-replay-registry.ts` does not depend on the dispatch chain — which
18
+ * would form a module cycle, because this module is a TYPE dependency of
19
+ * `commands/shared.ts` that the dispatch chain transitively imports. The
20
+ * composition root (`build-command-registration-input.ts`, a bootstrap module the
21
+ * dispatch chain never imports) supplies the real implementation.
22
+ */
23
+ export type ExternalReplayDispatcher = (provenance: ToolProvenance, stored: ToolSessionRecord) => Promise<unknown>;
24
+ /** Options for {@link SessionReplayRegistry.fromTools}. */
25
+ export interface SessionReplayRegistryOptions {
26
+ /** The per-run provenance (drives the M4-F host/external gate). */
27
+ readonly provenance?: readonly ToolProvenance[];
28
+ /** Injected external-replay dispatcher (forks the replay HOOK worker). */
29
+ readonly dispatchExternalReplay?: ExternalReplayDispatcher;
6
30
  }
7
31
  export declare class SessionReplayRegistry {
8
32
  private readonly byTool;
9
33
  private constructor();
10
34
  static empty(): SessionReplayRegistry;
11
35
  /**
12
- * Build the registry from the tools' `sessionReplay` contributions.
36
+ * Build the registry from the tools' `sessionReplay` contributions, honoring the
37
+ * ADR-0054 M4-F host/external split: a BUNDLED tool keeps its in-host replay
38
+ * closure; an EXTERNAL tool gets a worker-backed replay (the host never runs the
39
+ * external `replaySession` in-process) via the injected
40
+ * {@link ExternalReplayDispatcher}.
13
41
  *
14
- * @throws {Error} when two registered tools claim the same `tool` short id
15
- * (a duplicate session-replay contribution).
42
+ * @throws {Error} when two registered tools claim the same `tool` short id.
16
43
  */
17
- static fromTools(registry: ToolRegistry): SessionReplayRegistry;
44
+ static fromTools(registry: ToolRegistry, opts?: SessionReplayRegistryOptions): SessionReplayRegistry;
18
45
  get(tool: ToolShortId): CliSessionReplayContribution | undefined;
19
46
  }
20
47
  //# sourceMappingURL=session-replay-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay-registry.d.ts","sourceRoot":"","sources":["../src/session-replay-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,iBAAiB,CAAC,aAAa,CAAC,CAAC;CACzF;AAED,qBAAa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IADzB,OAAO;IAIP,MAAM,CAAC,KAAK,IAAI,qBAAqB;IAIrC;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,YAAY,GAAG,qBAAqB;IAa/D,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,4BAA4B,GAAG,SAAS;CAGjE"}
1
+ {"version":3,"file":"session-replay-registry.d.ts","sourceRoot":"","sources":["../src/session-replay-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,CACtB,MAAM,EAAE,iBAAiB,KACtB,iBAAiB,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAAC;CACnF;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,wBAAwB,GAAG,CACrC,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,iBAAiB,KACtB,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,2DAA2D;AAC3D,MAAM,WAAW,4BAA4B;IAC3C,mEAAmE;IACnE,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,0EAA0E;IAC1E,QAAQ,CAAC,sBAAsB,CAAC,EAAE,wBAAwB,CAAC;CAC5D;AAED,qBAAa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IADzB,OAAO;IAIP,MAAM,CAAC,KAAK,IAAI,qBAAqB;IAIrC;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,CACd,QAAQ,EAAE,YAAY,EACtB,IAAI,GAAE,4BAAiC,GACtC,qBAAqB;IAmBxB,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,4BAA4B,GAAG,SAAS;CAGjE"}
@@ -1,5 +1,6 @@
1
1
  // @fitness-ignore-file batch-operation-limits -- fromTools iterates the bounded, in-process tool registry (a handful of first-party + plugin tools registered for the run), not an unbounded external collection.
2
2
  import { resolveToolHooks, } from '@opensip-cli/core';
3
+ import { isExternalToolProvenance, provenanceRecordFor } from './bootstrap/tool-provenance.js';
3
4
  export class SessionReplayRegistry {
4
5
  byTool;
5
6
  constructor(byTool) {
@@ -9,12 +10,16 @@ export class SessionReplayRegistry {
9
10
  return new SessionReplayRegistry(new Map());
10
11
  }
11
12
  /**
12
- * Build the registry from the tools' `sessionReplay` contributions.
13
+ * Build the registry from the tools' `sessionReplay` contributions, honoring the
14
+ * ADR-0054 M4-F host/external split: a BUNDLED tool keeps its in-host replay
15
+ * closure; an EXTERNAL tool gets a worker-backed replay (the host never runs the
16
+ * external `replaySession` in-process) via the injected
17
+ * {@link ExternalReplayDispatcher}.
13
18
  *
14
- * @throws {Error} when two registered tools claim the same `tool` short id
15
- * (a duplicate session-replay contribution).
19
+ * @throws {Error} when two registered tools claim the same `tool` short id.
16
20
  */
17
- static fromTools(registry) {
21
+ static fromTools(registry, opts = {}) {
22
+ const provenance = opts.provenance ?? [];
18
23
  const byTool = new Map();
19
24
  for (const tool of registry.list()) {
20
25
  const contribution = resolveToolHooks(tool).sessionReplay;
@@ -23,7 +28,9 @@ export class SessionReplayRegistry {
23
28
  if (byTool.has(contribution.tool)) {
24
29
  throw new Error(`Duplicate session replay contribution for tool '${contribution.tool}'`);
25
30
  }
26
- byTool.set(contribution.tool, normalizeContribution(contribution));
31
+ byTool.set(contribution.tool, isExternalToolProvenance(tool, provenance)
32
+ ? externalContribution(tool, contribution, provenance, opts.dispatchExternalReplay)
33
+ : bundledContribution(contribution));
27
34
  }
28
35
  return new SessionReplayRegistry(byTool);
29
36
  }
@@ -31,10 +38,40 @@ export class SessionReplayRegistry {
31
38
  return this.byTool.get(tool);
32
39
  }
33
40
  }
34
- function normalizeContribution(contribution) {
41
+ /** A BUNDLED tool replays in-host (trusted computing base) — the closure as-is. */
42
+ function bundledContribution(contribution) {
35
43
  return {
36
44
  tool: contribution.tool,
37
45
  replaySession: (stored) => contribution.replaySession(stored),
38
46
  };
39
47
  }
48
+ /**
49
+ * An EXTERNAL tool replays via the injected dispatcher, which forks a HOOK worker
50
+ * that imports the untrusted runtime and runs `sessionReplay.replaySession(stored)`
51
+ * there, returning the `ToolSessionReplay` (plain data) over IPC. A fork failure
52
+ * surfaces as a structured error to `sessions show` (fail loud — a replay the user
53
+ * explicitly asked for must not silently return empty, and external code never
54
+ * runs in-host).
55
+ *
56
+ * The returned `replaySession` closure @throws {Error} when the external tool
57
+ * cannot be isolated (no provenance record, or no injected dispatcher), and
58
+ * propagates a structured dispatch error when the replay worker fork fails — both
59
+ * are surfaced to `sessions show` as a `decode-error` outcome, never a silent
60
+ * empty replay or an in-host run.
61
+ */
62
+ function externalContribution(tool, contribution, provenance, dispatchExternalReplay) {
63
+ return {
64
+ tool: contribution.tool,
65
+ // @fitness-ignore-next-line throws-documentation -- the throws are documented on the enclosing externalContribution factory's JSDoc above (fail-loud when the external tool cannot be isolated, or on a replay-worker fork failure).
66
+ replaySession: async (stored) => {
67
+ const record = provenanceRecordFor(tool, provenance);
68
+ if (record === undefined || dispatchExternalReplay === undefined) {
69
+ throw new Error(`external tool '${tool.metadata.name ?? tool.metadata.id}' session replay ` +
70
+ 'cannot be isolated (no provenance/dispatcher to fork the replay worker); refusing to run it in-process');
71
+ }
72
+ const result = await dispatchExternalReplay(record, stored);
73
+ return result;
74
+ },
75
+ };
76
+ }
40
77
  //# sourceMappingURL=session-replay-registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay-registry.js","sourceRoot":"","sources":["../src/session-replay-registry.ts"],"names":[],"mappings":"AAAA,kNAAkN;AAClN,OAAO,EACL,gBAAgB,GAKjB,MAAM,mBAAmB,CAAC;AAS3B,MAAM,OAAO,qBAAqB;IAEb;IADnB,YACmB,MAA8D;QAA9D,WAAM,GAAN,MAAM,CAAwD;IAC9E,CAAC;IAEJ,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,qBAAqB,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,QAAsB;QACrC,MAAM,MAAM,GAAG,IAAI,GAAG,EAA6C,CAAC;QACpE,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;YACnC,MAAM,YAAY,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC;YAC1D,IAAI,YAAY,KAAK,SAAS;gBAAE,SAAS;YACzC,IAAI,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;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AAE,CAAC;gBACjE,MAAM,IAAI,KAAK,CACb,kBAAkB,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,mBAAmB;oBACzE,wGAAwG,CAC3G,CAAC;YACJ,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC5D,OAAO,MAA0C,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Resolved top-level command name for the command-duration metric label (M12).
3
+ *
4
+ * Set by the pre-action hook once Commander has MATCHED the command, read by the
5
+ * duration histogram at process end. This bounds metric cardinality to the
6
+ * registered command set + `'unknown'` — vs the raw `process.argv[2]`, where a
7
+ * typo, a flag (`--help`), or a file path would each become a distinct label
8
+ * value and blow the time-series cardinality up.
9
+ */
10
+ /** Record the matched command name (called from the pre-action hook). */
11
+ export declare function setResolvedCommandLabel(name: string): void;
12
+ /**
13
+ * The matched command name, or `'unknown'` when no command resolved — a bare
14
+ * invocation, `--help`/`--version`, or an error before Commander matched.
15
+ */
16
+ export declare function resolvedCommandLabel(): string;
17
+ /** Test-only reset of the module-level label. */
18
+ export declare function resetResolvedCommandLabel(): void;
19
+ //# sourceMappingURL=command-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-label.d.ts","sourceRoot":"","sources":["../../src/telemetry/command-label.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,yEAAyE;AACzE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,iDAAiD;AACjD,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Resolved top-level command name for the command-duration metric label (M12).
3
+ *
4
+ * Set by the pre-action hook once Commander has MATCHED the command, read by the
5
+ * duration histogram at process end. This bounds metric cardinality to the
6
+ * registered command set + `'unknown'` — vs the raw `process.argv[2]`, where a
7
+ * typo, a flag (`--help`), or a file path would each become a distinct label
8
+ * value and blow the time-series cardinality up.
9
+ */
10
+ let resolvedCommand;
11
+ /** Record the matched command name (called from the pre-action hook). */
12
+ export function setResolvedCommandLabel(name) {
13
+ resolvedCommand = name;
14
+ }
15
+ /**
16
+ * The matched command name, or `'unknown'` when no command resolved — a bare
17
+ * invocation, `--help`/`--version`, or an error before Commander matched.
18
+ */
19
+ export function resolvedCommandLabel() {
20
+ return resolvedCommand ?? 'unknown';
21
+ }
22
+ /** Test-only reset of the module-level label. */
23
+ export function resetResolvedCommandLabel() {
24
+ resolvedCommand = undefined;
25
+ }
26
+ //# sourceMappingURL=command-label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-label.js","sourceRoot":"","sources":["../../src/telemetry/command-label.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,IAAI,eAAmC,CAAC;AAExC,yEAAyE;AACzE,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,eAAe,GAAG,IAAI,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,eAAe,IAAI,SAAS,CAAC;AACtC,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,yBAAyB;IACvC,eAAe,GAAG,SAAS,CAAC;AAC9B,CAAC"}
@@ -19,6 +19,28 @@
19
19
  * SDK bits stay in the CLI root.
20
20
  */
21
21
  import { type RunScope } from '@opensip-cli/core';
22
+ /**
23
+ * The slice of `node:inspector`'s {@link Session} this module actually drives:
24
+ * `connect`/`disconnect` plus the two `post` overloads we issue
25
+ * (`Profiler.enable`/`Profiler.start` and `Profiler.stop`). Narrowing to this
26
+ * interface lets {@link __setInspectorSessionFactoryForTests} inject a fake
27
+ * whose `post` invokes the callback SYNCHRONOUSLY — so the inner
28
+ * `Profiler.start`/`Profiler.stop` callback arms (label-sidecar write, profile
29
+ * write, and their error branches) are exercised deterministically, independent
30
+ * of the real V8 profiler's async callback timing. That timing is non-
31
+ * deterministic under the coverage lane (the `@vitest/coverage-v8` provider
32
+ * holds its own inspector session), which previously made this file's branch
33
+ * coverage flaky. Production keeps the real `new Session()` factory verbatim.
34
+ */
35
+ export interface InspectorSession {
36
+ connect(): void;
37
+ disconnect(): void;
38
+ post(method: 'Profiler.enable' | 'Profiler.start', callback?: (err: Error | null, params?: unknown) => void): void;
39
+ post(method: 'Profiler.stop', callback?: (err: Error | null, params: {
40
+ profile?: unknown;
41
+ }) => void): void;
42
+ }
43
+ type InspectorSessionFactory = () => InspectorSession;
22
44
  export interface ProfilingLabels {
23
45
  readonly runId?: string;
24
46
  readonly command?: string;
@@ -39,4 +61,12 @@ export declare function startProfiling(scope?: RunScope, command?: string): void
39
61
  export declare function stopProfiling(scope?: RunScope): void;
40
62
  /** Exposed for tests / shutdown. */
41
63
  export declare function resetProfilingForTests(): void;
64
+ /**
65
+ * Test-only: swap the inspector-session factory so the start/stop callback
66
+ * bodies can be driven deterministically (see {@link InspectorSession}). Pass
67
+ * `undefined` to restore the real `new Session()` factory. Always restore in an
68
+ * `afterEach` — {@link resetProfilingForTests} also restores it as a backstop.
69
+ */
70
+ export declare function __setInspectorSessionFactoryForTests(factory: InspectorSessionFactory | undefined): void;
71
+ export {};
42
72
  //# sourceMappingURL=profiling.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/telemetry/profiling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAU,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAkD1D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG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AAChF,wBAAgB,kBAAkB,IAAI,OAAO,CAY5C;AAgBD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CA8DvE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,CA2CpD;AAiBD,oCAAoC;AACpC,wBAAgB,sBAAsB,IAAI,IAAI,CAK7C;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,uBAAuB,GAAG,SAAS,GAC3C,IAAI,CAEN"}
@@ -23,6 +23,9 @@ import { Session } from 'node:inspector';
23
23
  import { join } from 'node:path';
24
24
  import { logger } from '@opensip-cli/core';
25
25
  import { hostEnv } from '../env/host-env-specs.js';
26
+ /** Production factory: a real Node inspector session (structurally an InspectorSession). */
27
+ const realInspectorSessionFactory = () => new Session();
28
+ let inspectorSessionFactory = realInspectorSessionFactory;
26
29
  function createProfilingState() {
27
30
  return {
28
31
  session: null,
@@ -100,14 +103,16 @@ export function startProfiling(scope, command) {
100
103
  if (!isProfilingEnabled())
101
104
  return;
102
105
  warnIfOtelOnlyProfilingMode();
103
- state.session = new Session();
106
+ state.session = inspectorSessionFactory();
104
107
  state.session.connect();
105
108
  state.isProfiling = true;
106
109
  activeProfilingState = state;
107
110
  state.session.post('Profiler.enable', (_err, _res) => {
111
+ /* v8 ignore next -- defensive: `state.session` is non-null when this callback runs (it was just assigned + connected above); the guard only fires if a concurrent `cleanup` nulled it between the async wire `post` and the REAL profiler's callback — unreachable with the synchronous fake-session used for coverage, and exercised only by the real async profiler proven out-of-process. */
108
112
  if (!state.session)
109
113
  return;
110
114
  state.session.post('Profiler.start', (_err2, _res2) => {
115
+ /* v8 ignore next -- defensive: same concurrent-cleanup race as the enable guard above; `state.session` is non-null in the synchronous fake path, only nullable by the real async profiler's interleaving (proven out-of-process). */
111
116
  if (!state.session)
112
117
  return;
113
118
  const runId = scope?.runId ?? 'unknown';
@@ -214,5 +219,15 @@ export function resetProfilingForTests() {
214
219
  cleanup(activeProfilingState);
215
220
  cleanup(fallbackProfilingState);
216
221
  warnedOtelOnlyProfiling = false;
222
+ inspectorSessionFactory = realInspectorSessionFactory;
223
+ }
224
+ /**
225
+ * Test-only: swap the inspector-session factory so the start/stop callback
226
+ * bodies can be driven deterministically (see {@link InspectorSession}). Pass
227
+ * `undefined` to restore the real `new Session()` factory. Always restore in an
228
+ * `afterEach` — {@link resetProfilingForTests} also restores it as a backstop.
229
+ */
230
+ export function __setInspectorSessionFactoryForTests(factory) {
231
+ inspectorSessionFactory = factory ?? realInspectorSessionFactory;
217
232
  }
218
233
  //# sourceMappingURL=profiling.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"profiling.js","sourceRoot":"","sources":["../../src/telemetry/profiling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAiB,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AASnD,SAAS,oBAAoB;IAC3B,OAAO;QACL,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,IAAI;KACjB,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,aAAa,IAAI,KAAK;QACtB,aAAa,IAAI,KAAK;QACtB,YAAY,IAAI,KAAK,CACtB,CAAC;AACJ,CAAC;AAED,SAAS,iBA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