opensip-cli 0.1.5 → 0.1.7

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 (229) hide show
  1. package/dist/bootstrap/admit-tool-package.d.ts +15 -1
  2. package/dist/bootstrap/admit-tool-package.d.ts.map +1 -1
  3. package/dist/bootstrap/admit-tool-package.js +30 -5
  4. package/dist/bootstrap/admit-tool-package.js.map +1 -1
  5. package/dist/bootstrap/bind-tool-context.d.ts.map +1 -1
  6. package/dist/bootstrap/bind-tool-context.js +5 -3
  7. package/dist/bootstrap/bind-tool-context.js.map +1 -1
  8. package/dist/bootstrap/build-command-registration-input.d.ts +7 -0
  9. package/dist/bootstrap/build-command-registration-input.d.ts.map +1 -1
  10. package/dist/bootstrap/build-command-registration-input.js +11 -4
  11. package/dist/bootstrap/build-command-registration-input.js.map +1 -1
  12. package/dist/bootstrap/build-per-run-scope.d.ts +12 -0
  13. package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -1
  14. package/dist/bootstrap/build-per-run-scope.js +84 -9
  15. package/dist/bootstrap/build-per-run-scope.js.map +1 -1
  16. package/dist/bootstrap/bundled-manifest.d.ts +5 -0
  17. package/dist/bootstrap/bundled-manifest.d.ts.map +1 -0
  18. package/dist/bootstrap/bundled-manifest.js +13 -0
  19. package/dist/bootstrap/bundled-manifest.js.map +1 -0
  20. package/dist/bootstrap/bundled-tools.manifest.json +19 -1
  21. package/dist/bootstrap/config-and-capabilities.d.ts +5 -3
  22. package/dist/bootstrap/config-and-capabilities.d.ts.map +1 -1
  23. package/dist/bootstrap/config-and-capabilities.js +10 -7
  24. package/dist/bootstrap/config-and-capabilities.js.map +1 -1
  25. package/dist/bootstrap/constants.d.ts +3 -0
  26. package/dist/bootstrap/constants.d.ts.map +1 -0
  27. package/dist/bootstrap/constants.js +3 -0
  28. package/dist/bootstrap/constants.js.map +1 -0
  29. package/dist/bootstrap/decorate-tool-primary.d.ts +50 -0
  30. package/dist/bootstrap/decorate-tool-primary.d.ts.map +1 -0
  31. package/dist/bootstrap/decorate-tool-primary.js +111 -0
  32. package/dist/bootstrap/decorate-tool-primary.js.map +1 -0
  33. package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts +1 -0
  34. package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts.map +1 -1
  35. package/dist/bootstrap/execute-post-bailout-bootstrap.js +12 -1
  36. package/dist/bootstrap/execute-post-bailout-bootstrap.js.map +1 -1
  37. package/dist/bootstrap/index.d.ts +1 -1
  38. package/dist/bootstrap/index.d.ts.map +1 -1
  39. package/dist/bootstrap/index.js +1 -4
  40. package/dist/bootstrap/index.js.map +1 -1
  41. package/dist/bootstrap/io-plane.d.ts +47 -0
  42. package/dist/bootstrap/io-plane.d.ts.map +1 -0
  43. package/dist/bootstrap/io-plane.js +73 -0
  44. package/dist/bootstrap/io-plane.js.map +1 -0
  45. package/dist/bootstrap/load-tool-capabilities.d.ts.map +1 -1
  46. package/dist/bootstrap/load-tool-capabilities.js +18 -2
  47. package/dist/bootstrap/load-tool-capabilities.js.map +1 -1
  48. package/dist/bootstrap/owning-tool-init.d.ts.map +1 -1
  49. package/dist/bootstrap/owning-tool-init.js +7 -4
  50. package/dist/bootstrap/owning-tool-init.js.map +1 -1
  51. package/dist/bootstrap/phase-map.d.ts +20 -0
  52. package/dist/bootstrap/phase-map.d.ts.map +1 -0
  53. package/dist/bootstrap/phase-map.js +108 -0
  54. package/dist/bootstrap/phase-map.js.map +1 -0
  55. package/dist/bootstrap/plan-pre-action-bootstrap.d.ts +5 -5
  56. package/dist/bootstrap/plan-pre-action-bootstrap.d.ts.map +1 -1
  57. package/dist/bootstrap/plan-pre-action-bootstrap.js +3 -19
  58. package/dist/bootstrap/plan-pre-action-bootstrap.js.map +1 -1
  59. package/dist/bootstrap/pre-action-guards.d.ts +2 -1
  60. package/dist/bootstrap/pre-action-guards.d.ts.map +1 -1
  61. package/dist/bootstrap/pre-action-guards.js +3 -27
  62. package/dist/bootstrap/pre-action-guards.js.map +1 -1
  63. package/dist/bootstrap/pre-action-hook.d.ts +2 -1
  64. package/dist/bootstrap/pre-action-hook.d.ts.map +1 -1
  65. package/dist/bootstrap/pre-action-hook.js +23 -4
  66. package/dist/bootstrap/pre-action-hook.js.map +1 -1
  67. package/dist/bootstrap/register-tools-discovery.d.ts +38 -39
  68. package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -1
  69. package/dist/bootstrap/register-tools-discovery.js +134 -85
  70. package/dist/bootstrap/register-tools-discovery.js.map +1 -1
  71. package/dist/bootstrap/register-tools-mount.d.ts +18 -1
  72. package/dist/bootstrap/register-tools-mount.d.ts.map +1 -1
  73. package/dist/bootstrap/register-tools-mount.js +118 -18
  74. package/dist/bootstrap/register-tools-mount.js.map +1 -1
  75. package/dist/bootstrap/register-tools.d.ts +58 -14
  76. package/dist/bootstrap/register-tools.d.ts.map +1 -1
  77. package/dist/bootstrap/register-tools.js +185 -14
  78. package/dist/bootstrap/register-tools.js.map +1 -1
  79. package/dist/bootstrap/root-version.d.ts +26 -0
  80. package/dist/bootstrap/root-version.d.ts.map +1 -0
  81. package/dist/bootstrap/root-version.js +36 -0
  82. package/dist/bootstrap/root-version.js.map +1 -0
  83. package/dist/bootstrap/scope-access.d.ts +11 -0
  84. package/dist/bootstrap/scope-access.d.ts.map +1 -1
  85. package/dist/bootstrap/scope-access.js +26 -0
  86. package/dist/bootstrap/scope-access.js.map +1 -1
  87. package/dist/bootstrap/tool-lifecycle.d.ts +0 -22
  88. package/dist/bootstrap/tool-lifecycle.d.ts.map +1 -1
  89. package/dist/bootstrap/tool-lifecycle.js +0 -23
  90. package/dist/bootstrap/tool-lifecycle.js.map +1 -1
  91. package/dist/bootstrap/validate-tool.d.ts +10 -4
  92. package/dist/bootstrap/validate-tool.d.ts.map +1 -1
  93. package/dist/bootstrap/validate-tool.js +76 -22
  94. package/dist/bootstrap/validate-tool.js.map +1 -1
  95. package/dist/cli-context.d.ts +2 -2
  96. package/dist/cli-context.d.ts.map +1 -1
  97. package/dist/cli-context.js +20 -35
  98. package/dist/cli-context.js.map +1 -1
  99. package/dist/commands/agent-catalog.d.ts +29 -0
  100. package/dist/commands/agent-catalog.d.ts.map +1 -1
  101. package/dist/commands/agent-catalog.js +77 -36
  102. package/dist/commands/agent-catalog.js.map +1 -1
  103. package/dist/commands/clear.d.ts.map +1 -1
  104. package/dist/commands/clear.js +0 -1
  105. package/dist/commands/clear.js.map +1 -1
  106. package/dist/commands/command-scope-index.d.ts +45 -0
  107. package/dist/commands/command-scope-index.d.ts.map +1 -0
  108. package/dist/commands/command-scope-index.js +51 -0
  109. package/dist/commands/command-scope-index.js.map +1 -0
  110. package/dist/commands/completion.d.ts +67 -6
  111. package/dist/commands/completion.d.ts.map +1 -1
  112. package/dist/commands/completion.js +84 -12
  113. package/dist/commands/completion.js.map +1 -1
  114. package/dist/commands/configure.d.ts.map +1 -1
  115. package/dist/commands/configure.js +0 -1
  116. package/dist/commands/configure.js.map +1 -1
  117. package/dist/commands/host-command-specs.d.ts +16 -9
  118. package/dist/commands/host-command-specs.d.ts.map +1 -1
  119. package/dist/commands/host-command-specs.js +47 -21
  120. package/dist/commands/host-command-specs.js.map +1 -1
  121. package/dist/commands/host-config-flag.d.ts +21 -0
  122. package/dist/commands/host-config-flag.d.ts.map +1 -0
  123. package/dist/commands/host-config-flag.js +21 -0
  124. package/dist/commands/host-config-flag.js.map +1 -0
  125. package/dist/commands/host-subcommand-groups.d.ts +46 -5
  126. package/dist/commands/host-subcommand-groups.d.ts.map +1 -1
  127. package/dist/commands/host-subcommand-groups.js +97 -65
  128. package/dist/commands/host-subcommand-groups.js.map +1 -1
  129. package/dist/commands/index.d.ts +1 -1
  130. package/dist/commands/index.js +1 -1
  131. package/dist/commands/internal-command-visibility.d.ts +42 -0
  132. package/dist/commands/internal-command-visibility.d.ts.map +1 -0
  133. package/dist/commands/internal-command-visibility.js +54 -0
  134. package/dist/commands/internal-command-visibility.js.map +1 -0
  135. package/dist/commands/mount-command-action.d.ts +24 -0
  136. package/dist/commands/mount-command-action.d.ts.map +1 -0
  137. package/dist/commands/mount-command-action.js +78 -0
  138. package/dist/commands/mount-command-action.js.map +1 -0
  139. package/dist/commands/mount-command-spec-wiring.d.ts +24 -0
  140. package/dist/commands/mount-command-spec-wiring.d.ts.map +1 -0
  141. package/dist/commands/mount-command-spec-wiring.js +71 -0
  142. package/dist/commands/mount-command-spec-wiring.js.map +1 -0
  143. package/dist/commands/mount-command-spec.d.ts +9 -2
  144. package/dist/commands/mount-command-spec.d.ts.map +1 -1
  145. package/dist/commands/mount-command-spec.js +11 -135
  146. package/dist/commands/mount-command-spec.js.map +1 -1
  147. package/dist/commands/plugin/domain-resolution.d.ts +12 -13
  148. package/dist/commands/plugin/domain-resolution.d.ts.map +1 -1
  149. package/dist/commands/plugin/domain-resolution.js +12 -58
  150. package/dist/commands/plugin/domain-resolution.js.map +1 -1
  151. package/dist/commands/plugin/host-dir.d.ts +0 -1
  152. package/dist/commands/plugin/host-dir.d.ts.map +1 -1
  153. package/dist/commands/plugin/host-dir.js +1 -1
  154. package/dist/commands/plugin/host-dir.js.map +1 -1
  155. package/dist/commands/plugin.d.ts +20 -14
  156. package/dist/commands/plugin.d.ts.map +1 -1
  157. package/dist/commands/plugin.js +39 -47
  158. package/dist/commands/plugin.js.map +1 -1
  159. package/dist/commands/render-outcome.d.ts.map +1 -1
  160. package/dist/commands/render-outcome.js.map +1 -1
  161. package/dist/commands/shared.d.ts +9 -0
  162. package/dist/commands/shared.d.ts.map +1 -1
  163. package/dist/commands/tools/create.d.ts +11 -0
  164. package/dist/commands/tools/create.d.ts.map +1 -0
  165. package/dist/commands/tools/create.js +84 -0
  166. package/dist/commands/tools/create.js.map +1 -0
  167. package/dist/commands/tools/index.d.ts.map +1 -1
  168. package/dist/commands/tools/index.js +31 -0
  169. package/dist/commands/tools/index.js.map +1 -1
  170. package/dist/commands/tools/runtime-probe-entry.d.ts.map +1 -1
  171. package/dist/commands/tools/runtime-probe-entry.js +4 -2
  172. package/dist/commands/tools/runtime-probe-entry.js.map +1 -1
  173. package/dist/commands/tools/validate.d.ts.map +1 -1
  174. package/dist/commands/tools/validate.js +12 -5
  175. package/dist/commands/tools/validate.js.map +1 -1
  176. package/dist/commands/uninstall.d.ts.map +1 -1
  177. package/dist/commands/uninstall.js +0 -1
  178. package/dist/commands/uninstall.js.map +1 -1
  179. package/dist/env/host-env-specs.d.ts +18 -0
  180. package/dist/env/host-env-specs.d.ts.map +1 -1
  181. package/dist/env/host-env-specs.js +36 -2
  182. package/dist/env/host-env-specs.js.map +1 -1
  183. package/dist/index.d.ts +1 -1
  184. package/dist/index.d.ts.map +1 -1
  185. package/dist/index.js +46 -21
  186. package/dist/index.js.map +1 -1
  187. package/dist/report-compose.d.ts.map +1 -1
  188. package/dist/report-compose.js +2 -2
  189. package/dist/report-compose.js.map +1 -1
  190. package/dist/session-replay-registry.d.ts +1 -1
  191. package/dist/session-replay-registry.d.ts.map +1 -1
  192. package/dist/session-replay-registry.js +3 -1
  193. package/dist/session-replay-registry.js.map +1 -1
  194. package/dist/ui/result-to-view.d.ts +27 -7
  195. package/dist/ui/result-to-view.d.ts.map +1 -1
  196. package/dist/ui/result-to-view.js +68 -75
  197. package/dist/ui/result-to-view.js.map +1 -1
  198. package/dist/ui/views/misc-views.d.ts.map +1 -1
  199. package/dist/ui/views/misc-views.js +3 -1
  200. package/dist/ui/views/misc-views.js.map +1 -1
  201. package/dist/ui/views/tools-views.d.ts +2 -1
  202. package/dist/ui/views/tools-views.d.ts.map +1 -1
  203. package/dist/ui/views/tools-views.js +21 -0
  204. package/dist/ui/views/tools-views.js.map +1 -1
  205. package/package.json +32 -32
  206. package/dist/bootstrap/authored-tool-admission.d.ts +0 -23
  207. package/dist/bootstrap/authored-tool-admission.d.ts.map +0 -1
  208. package/dist/bootstrap/authored-tool-admission.js +0 -54
  209. package/dist/bootstrap/authored-tool-admission.js.map +0 -1
  210. package/dist/bootstrap/egress-plane.d.ts +0 -22
  211. package/dist/bootstrap/egress-plane.d.ts.map +0 -1
  212. package/dist/bootstrap/egress-plane.js +0 -37
  213. package/dist/bootstrap/egress-plane.js.map +0 -1
  214. package/dist/bootstrap/installed-tool-admission.d.ts +0 -20
  215. package/dist/bootstrap/installed-tool-admission.d.ts.map +0 -1
  216. package/dist/bootstrap/installed-tool-admission.js +0 -60
  217. package/dist/bootstrap/installed-tool-admission.js.map +0 -1
  218. package/dist/bootstrap/live-plane.d.ts +0 -51
  219. package/dist/bootstrap/live-plane.d.ts.map +0 -1
  220. package/dist/bootstrap/live-plane.js +0 -72
  221. package/dist/bootstrap/live-plane.js.map +0 -1
  222. package/dist/bootstrap/register-tools-bundled.d.ts +0 -28
  223. package/dist/bootstrap/register-tools-bundled.d.ts.map +0 -1
  224. package/dist/bootstrap/register-tools-bundled.js +0 -107
  225. package/dist/bootstrap/register-tools-bundled.js.map +0 -1
  226. package/dist/bootstrap/register-tools-shared.d.ts +0 -40
  227. package/dist/bootstrap/register-tools-shared.d.ts.map +0 -1
  228. package/dist/bootstrap/register-tools-shared.js +0 -98
  229. package/dist/bootstrap/register-tools-shared.js.map +0 -1
@@ -1,37 +0,0 @@
1
- /**
2
- * egress-plane — the host's effectful-egress plane
3
- * (host-owned-run-timing Phase 6 §6.1).
4
- *
5
- * The composition root owns all outbound delivery (ADR-0011 / ADR-0008): cloud
6
- * sync via the run's signal sink + `--report-to` SARIF upload, and the
7
- * SARIF-file sink. Tools never import `@opensip-cli/output`; they call these two
8
- * `ToolCliContext` seams, which delegate to the existing `deliver-envelope`
9
- * implementation. Extracted from `buildToolCliContext` so the egress concern has
10
- * its own narrow, testable home.
11
- */
12
- import { logger as defaultLogger } from '@opensip-cli/core';
13
- import { deliverEnvelope, writeEnvelopeSarif } from './deliver-envelope.js';
14
- export function createEgressPlane(deps) {
15
- const log = deps.logger ?? defaultLogger;
16
- return {
17
- // The root owns all effectful egress (ADR-0011 / ADR-0008): cloud sync via
18
- // the run's signal sink + `--report-to` SARIF upload. Tools call this once
19
- // per run; `setExitCode` is threaded so a `--report-to` failure on an
20
- // otherwise-passing run can claim exit 4. The delivery result (what actually
21
- // shipped / why a leg was skipped) flows back to the caller — the root has
22
- // already printed any user-facing notice, so callers may ignore it.
23
- deliverSignals: (envelope, deliverOpts) => deliverEnvelope(envelope, {
24
- cwd: deliverOpts.cwd,
25
- reportTo: deliverOpts.reportTo,
26
- apiKey: deliverOpts.apiKey,
27
- runFailed: deliverOpts.runFailed,
28
- setExitCode: deps.setExitCode,
29
- logger: log,
30
- }),
31
- // Root-owned SARIF-file sink (ADR-0011): the one place that formats an
32
- // envelope to SARIF and writes it to disk, so tools that export SARIF to a
33
- // file (e.g. `graph sarif-export`) never import `@opensip-cli/output`.
34
- writeSarif: (envelope, path) => writeEnvelopeSarif(envelope, path),
35
- };
36
- }
37
- //# sourceMappingURL=egress-plane.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"egress-plane.js","sourceRoot":"","sources":["../../src/bootstrap/egress-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,IAAI,aAAa,EAAoC,MAAM,mBAAmB,CAAC;AAE9F,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAc5E,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,IAAI,aAAa,CAAC;IACzC,OAAO;QACL,2EAA2E;QAC3E,2EAA2E;QAC3E,sEAAsE;QACtE,6EAA6E;QAC7E,2EAA2E;QAC3E,oEAAoE;QACpE,cAAc,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,CACxC,eAAe,CAAC,QAA0B,EAAE;YAC1C,GAAG,EAAE,WAAW,CAAC,GAAG;YACpB,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,SAAS,EAAE,WAAW,CAAC,SAAS;YAChC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,MAAM,EAAE,GAAG;SACZ,CAAC;QACJ,uEAAuE;QACvE,2EAA2E;QAC3E,uEAAuE;QACvE,UAAU,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,QAA0B,EAAE,IAAI,CAAC;KACrF,CAAC;AACJ,CAAC"}
@@ -1,20 +0,0 @@
1
- import type { ToolRuntimeLoad } from './admit-tool-package.js';
2
- import type { ToolAdmission } from './tool-admission-types.js';
3
- /**
4
- * Run the admission gate over a discovered INSTALLED tool package before its
5
- * module is imported. Installed tools are best-effort: incompatible or malformed
6
- * ambient packages skip with diagnostics rather than crashing unrelated commands.
7
- */
8
- export declare function admitInstalledTool(pkg: {
9
- readonly name: string;
10
- readonly packageDir: string;
11
- }, builtInIds: ReadonlySet<string>): ToolAdmission | undefined;
12
- /**
13
- * Emit the best-effort stderr line + structured warning for a discovered
14
- * INSTALLED tool whose runtime failed to load. Each failure reason maps to its
15
- * own diagnostic while preserving the installed leg's skip-not-crash posture.
16
- */
17
- export declare function emitInstalledLoadFailure(name: string, load: Extract<ToolRuntimeLoad, {
18
- ok: false;
19
- }>): void;
20
- //# sourceMappingURL=installed-tool-admission.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"installed-tool-admission.d.ts","sourceRoot":"","sources":["../../src/bootstrap/installed-tool-admission.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAC3D,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAC9B,aAAa,GAAG,SAAS,CAwB3B;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,CAAC,eAAe,EAAE;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC,GAC5C,IAAI,CA0BN"}
@@ -1,60 +0,0 @@
1
- import { admitTool, loadToolManifest, logger } from '@opensip-cli/core';
2
- import { BOOTSTRAP_MODULE } from './register-tools-shared.js';
3
- /**
4
- * Run the admission gate over a discovered INSTALLED tool package before its
5
- * module is imported. Installed tools are best-effort: incompatible or malformed
6
- * ambient packages skip with diagnostics rather than crashing unrelated commands.
7
- */
8
- export function admitInstalledTool(pkg, builtInIds) {
9
- const manifest = loadToolManifest('installed', pkg.packageDir);
10
- if (manifest === undefined) {
11
- process.stderr.write(`opensip: tool package ${pkg.name} has no conformant package.json#opensipTools manifest — skipping\n`);
12
- logger.warn({
13
- evt: 'cli.tool.manifest_invalid',
14
- module: BOOTSTRAP_MODULE,
15
- name: pkg.name,
16
- });
17
- return undefined;
18
- }
19
- if (builtInIds.has(manifest.id))
20
- return undefined;
21
- const result = admitTool({
22
- manifest,
23
- source: 'installed',
24
- dir: pkg.packageDir,
25
- packageName: pkg.name,
26
- explicitlyRequested: false,
27
- });
28
- if (result.decision !== 'admit')
29
- return undefined;
30
- return { provenance: result.provenance, manifest: result.manifest };
31
- }
32
- /**
33
- * Emit the best-effort stderr line + structured warning for a discovered
34
- * INSTALLED tool whose runtime failed to load. Each failure reason maps to its
35
- * own diagnostic while preserving the installed leg's skip-not-crash posture.
36
- */
37
- export function emitInstalledLoadFailure(name, load) {
38
- if (load.reason === 'no-entry') {
39
- process.stderr.write(`opensip: tool package ${name} has no resolvable entry point — skipping\n`);
40
- logger.warn({ evt: 'cli.tool.no_entry', module: BOOTSTRAP_MODULE, name });
41
- return;
42
- }
43
- if (load.reason === 'invalid-shape') {
44
- process.stderr.write(`opensip: tool package ${name} does not export a valid \`tool\` — skipping\n`);
45
- logger.warn({
46
- evt: 'cli.tool.invalid_shape',
47
- module: BOOTSTRAP_MODULE,
48
- name,
49
- });
50
- return;
51
- }
52
- process.stderr.write(`opensip: failed to load tool ${name}: ${load.detail ?? 'import failed'}\n`);
53
- logger.warn({
54
- evt: 'cli.tool.load_failed',
55
- module: BOOTSTRAP_MODULE,
56
- name,
57
- error: load.detail,
58
- });
59
- }
60
- //# sourceMappingURL=installed-tool-admission.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"installed-tool-admission.js","sourceRoot":"","sources":["../../src/bootstrap/installed-tool-admission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAK9D;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,GAA2D,EAC3D,UAA+B;IAE/B,MAAM,QAAQ,GAAG,gBAAgB,CAAC,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;IAC/D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,yBAAyB,GAAG,CAAC,IAAI,oEAAoE,CACtG,CAAC;QACF,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,EAAE,2BAA2B;YAChC,MAAM,EAAE,gBAAgB;YACxB,IAAI,EAAE,GAAG,CAAC,IAAI;SACf,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC;IAElD,MAAM,MAAM,GAAG,SAAS,CAAC;QACvB,QAAQ;QACR,MAAM,EAAE,WAAW;QACnB,GAAG,EAAE,GAAG,CAAC,UAAU;QACnB,WAAW,EAAE,GAAG,CAAC,IAAI;QACrB,mBAAmB,EAAE,KAAK;KAC3B,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IAClD,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;AACtE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAY,EACZ,IAA6C;IAE7C,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,yBAAyB,IAAI,6CAA6C,CAC3E,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1E,OAAO;IACT,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,eAAe,EAAE,CAAC;QACpC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,yBAAyB,IAAI,gDAAgD,CAC9E,CAAC;QACF,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,EAAE,wBAAwB;YAC7B,MAAM,EAAE,gBAAgB;YACxB,IAAI;SACL,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,IAAI,KAAK,IAAI,CAAC,MAAM,IAAI,eAAe,IAAI,CAAC,CAAC;IAClG,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,sBAAsB;QAC3B,MAAM,EAAE,gBAAgB;QACxB,IAAI;QACJ,KAAK,EAAE,IAAI,CAAC,MAAM;KACnB,CAAC,CAAC;AACL,CAAC"}
@@ -1,51 +0,0 @@
1
- /**
2
- * live-plane — the host's interactive live-view plane
3
- * (host-owned-run-timing Phase 6 §6.1).
4
- *
5
- * Two pieces:
6
- * 1. {@link createLiveViewRegistry} — the pure key→renderer registry backing
7
- * `cli.registerLiveView`. First-writer-wins on duplicate keys; an
8
- * unregistered key throws {@link UnknownLiveViewError} rather than masking a
9
- * mistyped key with a static render. The host builds ONE registry per
10
- * invocation (in `main()`) and hands it to the context assembler.
11
- * 2. {@link createLivePlane} — binds that registry to the run plane so the
12
- * `cli.renderLive` seam owns the live run lifecycle (Phase 2): it times the
13
- * TTY occupancy and persists the renderer's returned `session` contribution
14
- * after `await render()`. The renderer no longer writes the session itself.
15
- *
16
- * The host ALWAYS supplies the {@link LiveViewContext} (carrying the run seam +
17
- * timer) as the renderer's second argument, so tools that call `renderLive`
18
- * directly (fit/sim/graph `runLiveMode`) get it without threading it themselves;
19
- * a renderer that declares only one parameter simply ignores the extra arg.
20
- */
21
- import { type LiveViewContext, type LiveViewRenderer, type Logger, type ToolRunCompletion, type ToolRunSessions } from '@opensip-cli/core';
22
- import type { RunPlaneFactory } from './run-plane.js';
23
- export interface LiveViewRegistry {
24
- readonly register: (key: string, renderer: LiveViewRenderer) => void;
25
- /**
26
- * Render the live view. The optional third parameter is the LiveViewContext
27
- * (carrying runSession) to forward as the *second* argument to the renderer
28
- * function itself. This lets the host dispatch site (mount) supply the
29
- * shared run timer without changing the public ToolCliContext.renderLive
30
- * (tools still call renderLive(key, args)).
31
- */
32
- readonly render: (key: string, args: unknown, liveContext?: LiveViewContext) => Promise<ToolRunCompletion | void>;
33
- readonly has: (key: string) => boolean;
34
- }
35
- export declare function createLiveViewRegistry(log?: Logger): LiveViewRegistry;
36
- /** Stable dependencies the live plane binds together. */
37
- export interface LivePlaneDeps {
38
- /** The per-invocation registry built in `main()` and passed to the assembler. */
39
- readonly liveViews: LiveViewRegistry;
40
- /** The run plane — `renderLive` runs the render through its `completeLiveRender`. */
41
- readonly runPlane: RunPlaneFactory;
42
- /** The host run seam, used to build the default {@link LiveViewContext}. */
43
- readonly runSession: ToolRunSessions;
44
- }
45
- /** The live plane's public surface (the two `ToolCliContext` live-view seams). */
46
- export interface LivePlane {
47
- readonly register: LiveViewRegistry['register'];
48
- readonly renderLive: (key: string, args: unknown, liveContext?: LiveViewContext) => Promise<ToolRunCompletion | void>;
49
- }
50
- export declare function createLivePlane(deps: LivePlaneDeps): LivePlane;
51
- //# sourceMappingURL=live-plane.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"live-plane.d.ts","sourceRoot":"","sources":["../../src/bootstrap/live-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACrE;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,CACf,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACb,WAAW,CAAC,EAAE,eAAe,KAC1B,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IACvC,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CACxC;AAED,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAsB,GAAG,gBAAgB,CAmCpF;AAED,yDAAyD;AACzD,MAAM,WAAW,aAAa;IAC5B,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;CACtC;AAED,kFAAkF;AAClF,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAChD,QAAQ,CAAC,UAAU,EAAE,CACnB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACb,WAAW,CAAC,EAAE,eAAe,KAC1B,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CACxC;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,CAgB9D"}
@@ -1,72 +0,0 @@
1
- /**
2
- * live-plane — the host's interactive live-view plane
3
- * (host-owned-run-timing Phase 6 §6.1).
4
- *
5
- * Two pieces:
6
- * 1. {@link createLiveViewRegistry} — the pure key→renderer registry backing
7
- * `cli.registerLiveView`. First-writer-wins on duplicate keys; an
8
- * unregistered key throws {@link UnknownLiveViewError} rather than masking a
9
- * mistyped key with a static render. The host builds ONE registry per
10
- * invocation (in `main()`) and hands it to the context assembler.
11
- * 2. {@link createLivePlane} — binds that registry to the run plane so the
12
- * `cli.renderLive` seam owns the live run lifecycle (Phase 2): it times the
13
- * TTY occupancy and persists the renderer's returned `session` contribution
14
- * after `await render()`. The renderer no longer writes the session itself.
15
- *
16
- * The host ALWAYS supplies the {@link LiveViewContext} (carrying the run seam +
17
- * timer) as the renderer's second argument, so tools that call `renderLive`
18
- * directly (fit/sim/graph `runLiveMode`) get it without threading it themselves;
19
- * a renderer that declares only one parameter simply ignores the extra arg.
20
- */
21
- import { UnknownLiveViewError, logger as defaultLogger, } from '@opensip-cli/core';
22
- export function createLiveViewRegistry(log = defaultLogger) {
23
- const renderers = new Map();
24
- return {
25
- register(key, renderer) {
26
- if (renderers.has(key)) {
27
- log.warn({
28
- evt: 'cli.live_view.duplicate',
29
- module: 'cli:bootstrap',
30
- key,
31
- msg: `Duplicate live-view registration for key '${key}' — first registration wins.`,
32
- });
33
- return;
34
- }
35
- renderers.set(key, renderer);
36
- },
37
- /**
38
- * @throws {UnknownLiveViewError} When `key` has no registered live-view renderer.
39
- */
40
- async render(key, args, liveContext) {
41
- const renderer = renderers.get(key);
42
- if (!renderer) {
43
- // async so the throw surfaces as a rejected promise (the contract
44
- // callers `await` / assert `.rejects` against).
45
- throw new UnknownLiveViewError(key);
46
- }
47
- // Always pass the host-supplied LiveViewContext (host-owned-run-timing
48
- // Phase 2): live tool commands receive it; JS safely ignores the extra arg
49
- // for any renderer that declares only one parameter. Return the renderer's
50
- // ToolRunCompletion so the host can complete the lifecycle + persist.
51
- return renderer(args, liveContext);
52
- },
53
- has(key) {
54
- return renderers.has(key);
55
- },
56
- };
57
- }
58
- export function createLivePlane(deps) {
59
- return {
60
- register: deps.liveViews.register,
61
- // Host owns the live run lifecycle (host-owned-run-timing Phase 2): time
62
- // the TTY occupancy, then complete the lifecycle + persist the renderer's
63
- // returned `session` contribution. The host always supplies the
64
- // LiveViewContext (carrying the run seam + timer) so tools that call
65
- // renderLive directly (fit/sim/graph runLiveMode) get it without passing
66
- // it themselves. The renderer no longer writes the session itself.
67
- renderLive: (key, args, liveContext) => deps.runPlane
68
- .current()
69
- .completeLiveRender(() => deps.liveViews.render(key, args, liveContext ?? { runSession: deps.runSession })),
70
- };
71
- }
72
- //# sourceMappingURL=live-plane.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"live-plane.js","sourceRoot":"","sources":["../../src/bootstrap/live-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,oBAAoB,EACpB,MAAM,IAAI,aAAa,GAMxB,MAAM,mBAAmB,CAAC;AAqB3B,MAAM,UAAU,sBAAsB,CAAC,MAAc,aAAa;IAChE,MAAM,SAAS,GAAG,IAAI,GAAG,EAA4B,CAAC;IACtD,OAAO;QACL,QAAQ,CAAC,GAAG,EAAE,QAAQ;YACpB,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,GAAG,CAAC,IAAI,CAAC;oBACP,GAAG,EAAE,yBAAyB;oBAC9B,MAAM,EAAE,eAAe;oBACvB,GAAG;oBACH,GAAG,EAAE,6CAA6C,GAAG,8BAA8B;iBACpF,CAAC,CAAC;gBACH,OAAO;YACT,CAAC;YACD,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC/B,CAAC;QACD;;WAEG;QACH,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW;YACjC,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,kEAAkE;gBAClE,gDAAgD;gBAChD,MAAM,IAAI,oBAAoB,CAAC,GAAG,CAAC,CAAC;YACtC,CAAC;YACD,uEAAuE;YACvE,2EAA2E;YAC3E,2EAA2E;YAC3E,sEAAsE;YACtE,OAAO,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACrC,CAAC;QACD,GAAG,CAAC,GAAG;YACL,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;KACF,CAAC;AACJ,CAAC;AAsBD,MAAM,UAAU,eAAe,CAAC,IAAmB;IACjD,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ;QACjC,yEAAyE;QACzE,0EAA0E;QAC1E,gEAAgE;QAChE,qEAAqE;QACrE,yEAAyE;QACzE,mEAAmE;QACnE,UAAU,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,CACrC,IAAI,CAAC,QAAQ;aACV,OAAO,EAAE;aACT,kBAAkB,CAAC,GAAG,EAAE,CACvB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CACjF;KACN,CAAC;AACJ,CAAC"}
@@ -1,28 +0,0 @@
1
- import { type ToolPluginManifest, type ToolProvenance, type ToolRegistry } from '@opensip-cli/core';
2
- /**
3
- * Register the bundled first-party tools into the supplied registry, each one
4
- * flowing through the SAME admit → dynamic-import → register path the external
5
- * path uses (launch cutover — replaces the static-import + gate path).
6
- *
7
- * Per package name: `resolveBundledPackageDir` → `loadToolManifest('bundled')`
8
- * → `admitTool({ source: 'bundled', explicitlyRequested: true })` →
9
- * `importToolRuntime` (dynamic import + shape validation) → drift guard →
10
- * `registry.register`. A bundled tool ships with the CLI, so it is always
11
- * explicitly present: a missing/incompatible manifest or a runtime that fails
12
- * to load is FAIL-CLOSED (never a silent skip). The recorded `ToolProvenance`
13
- * (source `'bundled'`, trusted-by-shipping) and manifest are pushed onto the
14
- * optional collectors so the composition root can surface provenance
15
- * (`plugin list`) and seed the per-run capability registry (§5.3).
16
- *
17
- * @param registry The per-invocation tool registry to populate.
18
- * @param provenance Optional sink for the admitted tools' provenance records.
19
- * @param manifests Optional sink for the admitted tools' manifests (§5.3).
20
- * @param packages The bundled package names to load (defaults to
21
- * {@link BUNDLED_TOOL_PACKAGES}; injectable so the fail-closed paths are
22
- * testable with fixture packages).
23
- * @throws {PluginIncompatibleError} when a bundled tool cannot be resolved,
24
- * has no conformant manifest, is out of range, or its runtime fails to load
25
- * — mapped to `EXIT_CODES.PLUGIN_INCOMPATIBLE` (exit 5) by the CLI boundary.
26
- */
27
- export declare function registerFirstPartyTools(registry: ToolRegistry, provenance?: ToolProvenance[], manifests?: ToolPluginManifest[], packages?: readonly string[]): Promise<void>;
28
- //# sourceMappingURL=register-tools-bundled.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-tools-bundled.d.ts","sourceRoot":"","sources":["../../src/bootstrap/register-tools-bundled.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAc3B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,YAAY,EACtB,UAAU,GAAE,cAAc,EAAO,EACjC,SAAS,GAAE,kBAAkB,EAAO,EACpC,QAAQ,GAAE,SAAS,MAAM,EAA0B,GAClD,OAAO,CAAC,IAAI,CAAC,CAwCf"}
@@ -1,107 +0,0 @@
1
- import { PluginIncompatibleError, } from '@opensip-cli/core';
2
- import { admitToolPackage } from './admit-tool-package.js';
3
- import { BUNDLED_TOOL_PACKAGES, resolveRequiredBundledPackageDir, } from './register-tools-shared.js';
4
- // The runtime-load primitive (`importToolRuntime` + `ToolRuntimeLoad`) and the
5
- // full admission SEQUENCE (`admitToolPackage`) live in `admit-tool-package.ts`
6
- // (ADR-0041: one validator, four consumers). This file keeps the per-source
7
- // POLICY: bundled fails closed below; the installed/authored legs skip with
8
- // diagnostics.
9
- /**
10
- * Register the bundled first-party tools into the supplied registry, each one
11
- * flowing through the SAME admit → dynamic-import → register path the external
12
- * path uses (launch cutover — replaces the static-import + gate path).
13
- *
14
- * Per package name: `resolveBundledPackageDir` → `loadToolManifest('bundled')`
15
- * → `admitTool({ source: 'bundled', explicitlyRequested: true })` →
16
- * `importToolRuntime` (dynamic import + shape validation) → drift guard →
17
- * `registry.register`. A bundled tool ships with the CLI, so it is always
18
- * explicitly present: a missing/incompatible manifest or a runtime that fails
19
- * to load is FAIL-CLOSED (never a silent skip). The recorded `ToolProvenance`
20
- * (source `'bundled'`, trusted-by-shipping) and manifest are pushed onto the
21
- * optional collectors so the composition root can surface provenance
22
- * (`plugin list`) and seed the per-run capability registry (§5.3).
23
- *
24
- * @param registry The per-invocation tool registry to populate.
25
- * @param provenance Optional sink for the admitted tools' provenance records.
26
- * @param manifests Optional sink for the admitted tools' manifests (§5.3).
27
- * @param packages The bundled package names to load (defaults to
28
- * {@link BUNDLED_TOOL_PACKAGES}; injectable so the fail-closed paths are
29
- * testable with fixture packages).
30
- * @throws {PluginIncompatibleError} when a bundled tool cannot be resolved,
31
- * has no conformant manifest, is out of range, or its runtime fails to load
32
- * — mapped to `EXIT_CODES.PLUGIN_INCOMPATIBLE` (exit 5) by the CLI boundary.
33
- */
34
- export async function registerFirstPartyTools(registry, provenance = [], manifests = [], packages = BUNDLED_TOOL_PACKAGES) {
35
- for (const packageName of packages) {
36
- const dir = resolveRequiredBundledPackageDir(packageName);
37
- // The shared admission SEQUENCE (ADR-0041). The bundled POLICY below maps
38
- // each failed section to the exact fail-closed error this path always
39
- // threw — a bundled tool ships with the CLI, so every failure is a
40
- // packaging fault, never a silent skip.
41
- const report = await admitToolPackage({
42
- dir,
43
- source: 'bundled',
44
- packageName,
45
- // A bundled tool ships with the CLI; it is always explicitly present,
46
- // so an incompatible manifest fails the run rather than skipping.
47
- explicitlyRequested: true,
48
- });
49
- if (!report.ok) {
50
- // @fitness-ignore-next-line detached-promises -- synchronous never-returning thrower; the heuristic mistakes the bare call for an unawaited promise
51
- throwBundledAdmissionFailure(packageName, report);
52
- }
53
- /* v8 ignore next 3 -- throwBundledAdmissionFailure never returns on a failed report; this guard narrows types */
54
- if (report.tool === undefined ||
55
- report.provenance === undefined ||
56
- report.manifest === undefined) {
57
- throw new PluginIncompatibleError(`bundled tool '${packageName}' produced an incomplete admission report`, { diagnostic: 'incomplete admission report' });
58
- }
59
- registry.register(report.tool);
60
- provenance.push(report.provenance);
61
- // Record the manifest so the pre-action-hook can register this tool's
62
- // declared capability domains into the per-run capability registry
63
- // (launch, §5.3).
64
- manifests.push(report.manifest);
65
- }
66
- }
67
- /**
68
- * The bundled FAIL-CLOSED policy: convert a failed {@link AdmissionReport}
69
- * into the same `PluginIncompatibleError` (message + diagnostic) the inline
70
- * pipeline threw before the ADR-0041 factoring. Never returns.
71
- *
72
- * @throws {PluginIncompatibleError} always (or rethrows the original
73
- * coherence error from `assertManifestMatchesTool`, preserving its type).
74
- */
75
- function throwBundledAdmissionFailure(packageName, report) {
76
- const failed = report.sections.find((s) => !s.ok);
77
- const failedSection = failed?.section;
78
- if (failedSection === 'manifest') {
79
- throw new PluginIncompatibleError(`bundled tool '${packageName}' has no conformant package.json#opensipTools manifest`, { diagnostic: 'manifest missing or malformed' });
80
- }
81
- const id = report.manifest?.id ?? packageName;
82
- if (failedSection === 'compatibility') {
83
- if (report.compatibilityDecision === 'fail-closed') {
84
- throw new PluginIncompatibleError(`bundled tool '${id}' is incompatible: ${failed?.diagnostic ?? 'compatibility gate rejected it'}`, { diagnostic: failed?.diagnostic });
85
- }
86
- if (report.compatibilityDecision === 'skip') {
87
- // Should not happen for an in-range bundled tool, but never silently
88
- // drop a bundled tool — surface it loudly.
89
- throw new PluginIncompatibleError(`bundled tool '${id}' was skipped by the compatibility gate: ${failed?.diagnostic ?? 'unknown reason'}`, { diagnostic: failed?.diagnostic });
90
- }
91
- throw new PluginIncompatibleError(`bundled tool '${id}' reached an unknown admission decision`, { diagnostic: 'unknown admission decision' });
92
- }
93
- if (failedSection === 'runtime-load' || failedSection === 'tool-shape') {
94
- const reason = report.runtimeLoadReason ?? 'import-failed';
95
- const detailSuffix = report.runtimeLoadDetail ? `: ${report.runtimeLoadDetail}` : '';
96
- throw new PluginIncompatibleError(`bundled tool '${id}' failed to load via the plugin path (${reason}${detailSuffix})`, { diagnostic: `bundled tool runtime load failed: ${reason}` });
97
- }
98
- if (failedSection === 'manifest-runtime-coherence' && report.coherenceError instanceof Error) {
99
- // Preserve the original drift-guard error type + message untouched.
100
- // (assertManifestMatchesTool always throws Error subclasses; the
101
- // instanceof narrowing satisfies only-throw-error without a cast.)
102
- throw report.coherenceError;
103
- }
104
- /* v8 ignore next 4 -- defensive: a failed report always carries a failed section */
105
- throw new PluginIncompatibleError(`bundled tool '${packageName}' failed admission for an unknown reason`, { diagnostic: 'unknown admission failure' });
106
- }
107
- //# sourceMappingURL=register-tools-bundled.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-tools-bundled.js","sourceRoot":"","sources":["../../src/bootstrap/register-tools-bundled.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,GAIxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,gCAAgC,GACjC,MAAM,4BAA4B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AY,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,MAAM,IAAI,uBAAuB,CAC/B,iBAAiB,EAAE,yCAAyC,MAAM,GAAG,YAAY,GAAG,EACpF,EAAE,UAAU,EAAE,qCAAqC,MAAM,EAAE,EAAE,CAC9D,CAAC;IACJ,CAAC;IACD,IAAI,aAAa,KAAK,4BAA4B,IAAI,MAAM,CAAC,cAAc,YAAY,KAAK,EAAE,CAAC;QAC7F,oEAAoE;QACpE,iEAAiE;QACjE,mEAAmE;QACnE,MAAM,MAAM,CAAC,cAAc,CAAC;IAC9B,CAAC;IACD,oFAAoF;IACpF,MAAM,IAAI,uBAAuB,CAC/B,iBAAiB,WAAW,0CAA0C,EACtE,EAAE,UAAU,EAAE,2BAA2B,EAAE,CAC5C,CAAC;AACJ,CAAC"}
@@ -1,40 +0,0 @@
1
- /** `module` field on every structured log event emitted from this file. */
2
- export declare const BOOTSTRAP_MODULE = "cli:bootstrap";
3
- export declare const BUNDLED_TOOL_PACKAGES: readonly string[];
4
- /**
5
- * The ADR-0038 back-compat pin: the tool IDS whose `init` scaffold dirs the
6
- * pre-registry-driven CLI ALWAYS created (fit/sim). The composition root warns
7
- * (`cli.tool.expected_bundled_absent`) when one of these is missing from the
8
- * populated registry, so a build whose {@link BUNDLED_TOOL_PACKAGES} drifted
9
- * (a tool removed, a packaging variant) under-scaffolds LOUDLY instead of
10
- * silently.
11
- *
12
- * Now derived from the same manifest as BUNDLED_TOOL_PACKAGES (Workstream A)
13
- * so a single edit keeps them in sync. `graph` is correctly absent: it never
14
- * scaffolded (`pluginLayout` undefined).
15
- */
16
- export declare const EXPECTED_SCAFFOLDING_TOOL_IDS: readonly string[];
17
- /**
18
- * Resolve a bundled tool's PACKAGE DIR — the directory whose `package.json`
19
- * carries the `opensipTools` manifest.
20
- *
21
- * The `./package.json` subpath is not declared in each engine's `exports`,
22
- * so `require.resolve('<pkg>/package.json')` throws. Instead we resolve the
23
- * package's MAIN entry (a bare-name resolve, always permitted by `exports`)
24
- * and walk up to the nearest ancestor directory that has a `package.json`
25
- * whose `name` matches `packageName`. That ancestor IS the tool's own
26
- * package dir under both the source layout and pnpm's workspace-injected
27
- * `node_modules` layout (verified against fitness/simulation/graph here).
28
- *
29
- * @returns the resolved package directory, or `undefined` when the package
30
- * cannot be resolved (should never happen for a bundled direct dep).
31
- */
32
- export declare function resolveBundledPackageDir(packageName: string): string | undefined;
33
- /**
34
- * Resolve a bundled tool package's on-disk directory, requiring success.
35
- *
36
- * @throws {PluginIncompatibleError} when the package directory cannot be
37
- * resolved on disk (its manifest is unreadable).
38
- */
39
- export declare function resolveRequiredBundledPackageDir(packageName: string): string;
40
- //# sourceMappingURL=register-tools-shared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-tools-shared.d.ts","sourceRoot":"","sources":["../../src/bootstrap/register-tools-shared.ts"],"names":[],"mappings":"AAOA,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAmBhD,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAAoC,CAAC;AAExF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,MAAM,EAAuC,CAAC;AAEnG;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAkChF;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAO5E"}
@@ -1,98 +0,0 @@
1
- import { existsSync, readFileSync } from 'node:fs';
2
- import { createRequire } from 'node:module';
3
- import { dirname, join } from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
- import { logger, PluginIncompatibleError } from '@opensip-cli/core';
6
- /** `module` field on every structured log event emitted from this file. */
7
- export const BOOTSTRAP_MODULE = 'cli:bootstrap';
8
- /** Used to resolve the bundled engine package dirs from the CLI's own module graph. */
9
- const requireFromHere = createRequire(import.meta.url);
10
- /**
11
- * Bundled first-party tools are now data-driven (platform-ergonomics Workstream A).
12
- * The source of truth is the co-located JSON manifest (single edit site when
13
- * adding a first-party tool). Loaded via fs + import.meta.url (works in both
14
- * src dev and dist/ after tsc; the json is committed under src/ and must be
15
- * present next to the .js in dist at runtime — ensured by package "files": ["dist"]
16
- * + manual cp in build or future asset plugin; no resolveJsonModule dep).
17
- */
18
- const manifestUrl = new URL('bundled-tools.manifest.json', import.meta.url);
19
- const bundledManifest = JSON.parse(readFileSync(fileURLToPath(manifestUrl), 'utf8'));
20
- export const BUNDLED_TOOL_PACKAGES = bundledManifest.bundledPackages;
21
- /**
22
- * The ADR-0038 back-compat pin: the tool IDS whose `init` scaffold dirs the
23
- * pre-registry-driven CLI ALWAYS created (fit/sim). The composition root warns
24
- * (`cli.tool.expected_bundled_absent`) when one of these is missing from the
25
- * populated registry, so a build whose {@link BUNDLED_TOOL_PACKAGES} drifted
26
- * (a tool removed, a packaging variant) under-scaffolds LOUDLY instead of
27
- * silently.
28
- *
29
- * Now derived from the same manifest as BUNDLED_TOOL_PACKAGES (Workstream A)
30
- * so a single edit keeps them in sync. `graph` is correctly absent: it never
31
- * scaffolded (`pluginLayout` undefined).
32
- */
33
- export const EXPECTED_SCAFFOLDING_TOOL_IDS = bundledManifest.scaffoldingToolIds;
34
- /**
35
- * Resolve a bundled tool's PACKAGE DIR — the directory whose `package.json`
36
- * carries the `opensipTools` manifest.
37
- *
38
- * The `./package.json` subpath is not declared in each engine's `exports`,
39
- * so `require.resolve('<pkg>/package.json')` throws. Instead we resolve the
40
- * package's MAIN entry (a bare-name resolve, always permitted by `exports`)
41
- * and walk up to the nearest ancestor directory that has a `package.json`
42
- * whose `name` matches `packageName`. That ancestor IS the tool's own
43
- * package dir under both the source layout and pnpm's workspace-injected
44
- * `node_modules` layout (verified against fitness/simulation/graph here).
45
- *
46
- * @returns the resolved package directory, or `undefined` when the package
47
- * cannot be resolved (should never happen for a bundled direct dep).
48
- */
49
- export function resolveBundledPackageDir(packageName) {
50
- let resolvedEntry;
51
- try {
52
- resolvedEntry = requireFromHere.resolve(packageName);
53
- }
54
- catch (error) {
55
- // A bundled direct dep failing to resolve is a packaging fault — log it
56
- // so the subsequent fail-closed throw is diagnosable, then signal the
57
- // unresolved state to the caller (which raises PluginIncompatibleError).
58
- logger.debug({
59
- evt: 'cli.tool.bundled_unresolved',
60
- module: BOOTSTRAP_MODULE,
61
- packageName,
62
- error: error instanceof Error ? error.message : String(error),
63
- });
64
- return undefined;
65
- }
66
- let dir = dirname(resolvedEntry);
67
- for (let i = 0; i < 50; i++) {
68
- const pkgPath = join(dir, 'package.json');
69
- if (existsSync(pkgPath)) {
70
- try {
71
- const json = JSON.parse(readFileSync(pkgPath, 'utf8'));
72
- if (json.name === packageName)
73
- return dir;
74
- }
75
- catch {
76
- // @swallow-ok unreadable package.json on the walk-up — keep climbing.
77
- }
78
- }
79
- const parent = dirname(dir);
80
- if (parent === dir)
81
- break;
82
- dir = parent;
83
- }
84
- return undefined;
85
- }
86
- /**
87
- * Resolve a bundled tool package's on-disk directory, requiring success.
88
- *
89
- * @throws {PluginIncompatibleError} when the package directory cannot be
90
- * resolved on disk (its manifest is unreadable).
91
- */
92
- export function resolveRequiredBundledPackageDir(packageName) {
93
- const dir = resolveBundledPackageDir(packageName);
94
- if (dir !== undefined)
95
- return dir;
96
- throw new PluginIncompatibleError(`bundled tool '${packageName}' could not be resolved on disk; its manifest is unreadable`, { diagnostic: 'package directory not resolvable' });
97
- }
98
- //# sourceMappingURL=register-tools-shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-tools-shared.js","sourceRoot":"","sources":["../../src/bootstrap/register-tools-shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC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