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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bootstrap/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAe3B,OAAO,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAI1F,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB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AAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAkFnF;AAED,oEAAoE;AACpE,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,CAAC;IAC/C;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACnD"}
@@ -12,11 +12,13 @@
12
12
  *
13
13
  * See tool-lifecycle.ts for the ordered steps and phase split.
14
14
  */
15
- import { resolveProjectContext, resolveProjectPaths, resolveUserPaths, } from '@opensip-cli/core';
15
+ import { logger, resolveProjectContext, resolveProjectPaths, resolveUserPaths, } from '@opensip-cli/core';
16
16
  import { hostEnv } from '../env/host-env-specs.js';
17
17
  import { initTelemetry } from '../telemetry/sdk-init.js';
18
+ import { BOOTSTRAP_MODULE } from './constants.js';
18
19
  import { registerLanguageAdapters } from './register-language-adapters.js';
19
20
  import { BUNDLED_TOOL_PACKAGES, registerFirstPartyTools, discoverAndRegisterToolPackages, discoverAndRegisterAuthoredTools, buildToolDiscoverySources, } from './register-tools.js';
21
+ import { shouldSkipInstalledToolDiscovery } from './skip-installed-plugins.js';
20
22
  // Re-export only the symbols the CLI composition root (`index.ts`) consumes.
21
23
  export { mountAllToolCommands, EXPECTED_SCAFFOLDING_TOOL_IDS } from './register-tools.js';
22
24
  // The shared admission callable (ADR-0041: one validator, four consumers) —
@@ -76,7 +78,17 @@ export async function bootstrapCli(opts) {
76
78
  // the manifests just loaded (not from an imported tool runtime — the host
77
79
  // holds none in the launch contract).
78
80
  const builtInIds = new Set(manifests.map((m) => m.id));
79
- await discoverAndRegisterToolPackages(opts.toolRegistry, { sources: buildToolDiscoverySources(opts.cwd, opts.projectDir) }, builtInIds, provenance, manifests);
81
+ const argv = opts.argv ?? [];
82
+ if (shouldSkipInstalledToolDiscovery(argv)) {
83
+ logger.info({
84
+ evt: 'cli.tool.installed_discovery_skipped',
85
+ module: BOOTSTRAP_MODULE,
86
+ reason: argv.includes('--no-plugins') ? 'argv-no-plugins' : 'env-skip-installed',
87
+ });
88
+ }
89
+ else {
90
+ await discoverAndRegisterToolPackages(opts.toolRegistry, { sources: buildToolDiscoverySources(opts.cwd, opts.projectDir) }, builtInIds, provenance, manifests);
91
+ }
80
92
  // Authored Tool sidecars (ADR-0027 realization): global trusted-by-default +
81
93
  // project deny-by-default. Resolve the two authored roots — the global root
82
94
  // is always present; the project root is best-effort (an unresolvable
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bootstrap/index.ts"],"names":[],"mappings":"AAAA,wOAAwO;AACxO;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GAKjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,+BAA+B,EAC/B,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,6EAA6E;AAC7E,OAAO,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAC1F,4EAA4E;AAC5E,iEAAiE;AACjE,gDAAgD;AAChD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,GAKlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE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A+B,CACnC,IAAI,CAAC,YAAY,EACjB,EAAE,OAAO,EAAE,yBAAyB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,EACjE,UAAU,EACV,UAAU,EACV,SAAS,CACV,CAAC;IACJ,CAAC;IACD,6EAA6E;IAC7E,4EAA4E;IAC5E,sEAAsE;IACtE,yDAAyD;IACzD,2EAA2E;IAC3E,6EAA6E;IAC7E,qEAAqE;IACrE,MAAM,iBAAiB,GAAG,gBAAgB,EAAE,CAAC,gBAAgB,CAAC;IAC9D,IAAI,kBAAsC,CAAC;IAC3C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,qBAAqB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7E,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAChC,kBAAkB,GAAG,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,gBAAgB,CAAC;QACjF,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;QACtE,6DAA6D;IAC/D,CAAC;IACD,MAAM,gCAAgC,CACpC,IAAI,CAAC,YAAY,EACjB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAC3D,UAAU,EACV,UAAU,EACV,SAAS,CACV,CAAC;IACF,2EAA2E;IAC3E,4EAA4E;IAC5E,uEAAuE;IACvE,wDAAwD;IACxD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AACnC,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * per-invocation SEQUENCER; the owning-tool resolution + fail-fast init
7
7
  * semantics live here as a cohesive unit (see also `tool-lifecycle.ts`).
8
8
  */
9
- import { type Tool, type ToolRegistry } from '@opensip-cli/core';
9
+ import { type Tool, type ToolProvenance, type ToolRegistry } from '@opensip-cli/core';
10
10
  /**
11
11
  * Find the registered tool that owns the invoked subcommand, matching the
12
12
  * descriptor's canonical name or any alias. Returns undefined for
@@ -25,8 +25,14 @@ export declare function resolveOwningTool(tools: ToolRegistry, cmdName: string):
25
25
  * id is recorded only on success, so a transient failure can retry in a
26
26
  * long-lived host.
27
27
  *
28
+ * ADR-0054 M4-F: the host does NOT run an EXTERNAL owning tool's `initialize()`
29
+ * (executing untrusted runtime in the kernel is the load-time hole the ADR
30
+ * rejects). An external command dispatches to the worker (`maybeDispatchExternal`),
31
+ * and the worker entry runs the dispatched tool's `initialize()` there (the
32
+ * isolation boundary). Bundled owning tools initialize in-host exactly as before.
33
+ *
28
34
  * @throws {BootstrapError} (exit 1) when the owning tool's initialize() throws —
29
35
  * the top-level boundary renders it (human stderr / structured `--json`).
30
36
  */
31
- export declare function maybeInitializeOwningTool(tools: ToolRegistry, cmdName: string, runId: string): Promise<void>;
37
+ export declare function maybeInitializeOwningTool(tools: ToolRegistry, cmdName: string, runId: string, provenance?: readonly ToolProvenance[]): Promise<void>;
32
38
  //# sourceMappingURL=owning-tool-init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"owning-tool-init.d.ts","sourceRoot":"","sources":["../../src/bootstrap/owning-tool-init.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIL,KAAK,IAAI,EACT,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAO3B;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAQxF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CA6Bf"}
1
+ {"version":3,"file":"owning-tool-init.d.ts","sourceRoot":"","sources":["../../src/bootstrap/owning-tool-init.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIL,KAAK,IAAI,EACT,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAQ3B;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAQxF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,SAAS,cAAc,EAAO,GACzC,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
@@ -9,6 +9,7 @@
9
9
  import { logger, resolveToolCommands, resolveToolHooks, } from '@opensip-cli/core';
10
10
  import { BootstrapError } from './bootstrap-error.js';
11
11
  import { initializedToolIds } from './process-idempotency.js';
12
+ import { shouldRunHookInHost } from './tool-provenance.js';
12
13
  const MODULE_TAG = 'cli:bootstrap';
13
14
  /**
14
15
  * Find the registered tool that owns the invoked subcommand, matching the
@@ -32,13 +33,22 @@ export function resolveOwningTool(tools, cmdName) {
32
33
  * id is recorded only on success, so a transient failure can retry in a
33
34
  * long-lived host.
34
35
  *
36
+ * ADR-0054 M4-F: the host does NOT run an EXTERNAL owning tool's `initialize()`
37
+ * (executing untrusted runtime in the kernel is the load-time hole the ADR
38
+ * rejects). An external command dispatches to the worker (`maybeDispatchExternal`),
39
+ * and the worker entry runs the dispatched tool's `initialize()` there (the
40
+ * isolation boundary). Bundled owning tools initialize in-host exactly as before.
41
+ *
35
42
  * @throws {BootstrapError} (exit 1) when the owning tool's initialize() throws —
36
43
  * the top-level boundary renders it (human stderr / structured `--json`).
37
44
  */
38
- export async function maybeInitializeOwningTool(tools, cmdName, runId) {
45
+ export async function maybeInitializeOwningTool(tools, cmdName, runId, provenance = []) {
39
46
  const owningTool = resolveOwningTool(tools, cmdName);
40
47
  if (!owningTool)
41
48
  return;
49
+ // M4-F: skip an external owning tool host-side — its initialize runs worker-side.
50
+ if (!shouldRunHookInHost(owningTool, provenance))
51
+ return;
42
52
  const hooks = resolveToolHooks(owningTool);
43
53
  if (!hooks.initialize)
44
54
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"owning-tool-init.js","sourceRoot":"","sources":["../../src/bootstrap/owning-tool-init.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,UAAU,GAAG,eAAe,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAmB,EAAE,OAAe;IACpE,OAAO,KAAK;SACT,IAAI,EAAE;SACN,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CACb,mBAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,CAC5B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CACrE,CACF,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,KAAmB,EACnB,OAAe,EACf,KAAa;IAEb,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACrD,IAAI,CAAC,UAAU;QAAE,OAAO;IACxB,MAAM,KAAK,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,CAAC,UAAU;QAAE,OAAO;IAC9B,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,IAAI,UAAU,CAAC,QAAQ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ACX,GAAG,EAAE,4BAA4B;YACjC,MAAM,EAAE,UAAU;YAClB,KAAK;YACL,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,6BAA6B;YAC7D,QAAQ,EAAE,WAAW;YACrB,KAAK,EAAE,GAAG;SACX,CAAC,CAAC;QACH,wEAAwE;QACxE,wEAAwE;QACxE,MAAM,IAAI,cAAc,CAAC;YACvB,OAAO,EAAE,SAAS,WAAW,2BAA2B,GAAG,EAAE;YAC7D,YAAY,EAAE,WAAW,WAAW,2BAA2B,GAAG,EAAE;YACpE,UAAU,EAAE,SAAS;YACrB,QAAQ,EAAE,CAAC;SACZ,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"pre-action-hook.d.ts","sourceRoot":"","sources":["../../src/bootstrap/pre-action-hook.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAUH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,EACzB,aAAa,EAAE,iBAAiB,GAC/B,IAAI,CAyCN;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAiB1C"}
1
+ {"version":3,"file":"pre-action-hook.d.ts","sourceRoot":"","sources":["../../src/bootstrap/pre-action-hook.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAWH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,EACzB,aAAa,EAAE,iBAAiB,GAC/B,IAAI,CA6CN;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAiB1C"}
@@ -9,11 +9,16 @@
9
9
  import { currentScope, exitScope, generatePrefixedId } from '@opensip-cli/core';
10
10
  import { commandPath } from '../commands/command-scope-index.js';
11
11
  import { hostEnv } from '../env/host-env-specs.js';
12
+ import { setResolvedCommandLabel } from '../telemetry/command-label.js';
12
13
  import { executePostBailoutBootstrap } from './execute-post-bailout-bootstrap.js';
13
14
  import { planPreActionBootstrap } from './plan-pre-action-bootstrap.js';
14
15
  export { resolveOwningTool } from './owning-tool-init.js';
15
16
  export function installPreActionHook(program, version, runtime, commandScopes) {
16
17
  program.hook('preAction', async (_thisCommand, actionCommand) => {
18
+ // M12: stamp the RESOLVED command name for the duration metric's label
19
+ // (bounded cardinality) before any bootstrap that might throw — set as early
20
+ // as the matched command is known.
21
+ setResolvedCommandLabel(actionCommand.name());
17
22
  // B1 ("Child runId behavior"): resolve `runId` env-FIRST. A forked/spawned
18
23
  // child re-enters this hook and inherits its parent's run via `OPENSIP_RUN_ID`
19
24
  // (set in the child env by `correlationToEnv`); a top-level invocation, with
@@ -1 +1 @@
1
- {"version":3,"file":"pre-action-hook.js","sourceRoot":"","sources":["../../src/bootstrap/pre-action-hook.ts"],"names":[],"mappings":"AAAA,qOAAqO;AACrO;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EAAE,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EAAE,CAAC,KAAK,KAAK,KAAK;YACxD,MAAM,EAAE,IAAI,CAAC,MAA4B;SAC1C,CAAC,CAAC;QACH,KAAK,CAAC,WAAW,CAAC,KAAK,CACrB,MAAM,EACN,OAAO,EACP,sCAAsC,aAAa,CAAC,IAAI,EAAE,GAAG,CAC9D,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,YAAY,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YACzC,CAAC,CAAC,OAAO,EAAE,CAAC;QACd,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,oFAAoF;IACtF,CAAC;YAAS,CAAC;QACT,sEAAsE;QACtE,oEAAoE;QACpE,wEAAwE;QACxE,2EAA2E;QAC3E,yEAAyE;QACzE,oDAAoD;QACpD,SAAS,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * register-authored-tools — admission + discovery for AUTHORED Tool sidecars
3
+ * (project-local + user-global), extracted from register-tools-discovery.ts so
4
+ * the installed-package discovery path stays a focused module under the
5
+ * file-length soft limit.
6
+ *
7
+ * Authored tools are authored CONTENT (a JSON sidecar, not an installed npm
8
+ * package): project-local is deny-by-default (allowlisted via
9
+ * `OPENSIP_CLI_ALLOW_PROJECT_TOOLS`), user-global is trusted-by-default. Both are
10
+ * EXTERNAL provenance, so ADR-0054 M4-G applies: in the HOST the registration
11
+ * registers a manifest-derived synthetic `Tool` (no runtime import); the dispatch
12
+ * WORKER (`OPENSIP_CLI_IN_TOOL_WORKER=1`) imports the real runtime.
13
+ */
14
+ import { type ToolPluginManifest, type ToolProvenance, type ToolRegistry } from '@opensip-cli/core';
15
+ import type { ToolAdmission } from './tool-admission-types.js';
16
+ export type AuthoredAdmission = ToolAdmission;
17
+ /**
18
+ * Admit or reject a PROJECT-LOCAL authored tool under the deny-by-default trust
19
+ * policy. The trust decision always precedes module import; a non-allowlisted
20
+ * tool fails closed before any authored code can run.
21
+ *
22
+ * @throws {PluginIncompatibleError} When the sidecar manifest is missing,
23
+ * malformed, incompatible, or not trusted by the project-tool allowlist.
24
+ */
25
+ export declare function admitProjectLocalTool(args: {
26
+ readonly dir: string;
27
+ readonly env?: NodeJS.ProcessEnv;
28
+ }): AuthoredAdmission;
29
+ /**
30
+ * Admit a USER-GLOBAL authored tool — trusted-by-default because the user placed
31
+ * it in their own home-dir tool host, but still fail-closed on a missing or
32
+ * incompatible manifest.
33
+ */
34
+ export declare function admitUserGlobalTool(args: {
35
+ readonly dir: string;
36
+ }): AuthoredAdmission;
37
+ /**
38
+ * Discover + admit + register AUTHORED Tool sidecars from the two authored
39
+ * roots. ADR-0054 M4-G: authored tools are always EXTERNAL provenance, so the
40
+ * HOST registers a manifest-derived synthetic Tool (no runtime import); the
41
+ * dispatch WORKER (`OPENSIP_CLI_IN_TOOL_WORKER=1`) imports the real runtime via
42
+ * the shared `importToolRuntime` seam.
43
+ */
44
+ export declare function discoverAndRegisterAuthoredTools(registry: ToolRegistry, opts: {
45
+ readonly projectAuthoredDir?: string;
46
+ readonly globalAuthoredDir: string;
47
+ readonly env?: NodeJS.ProcessEnv;
48
+ }, builtInIds: ReadonlySet<string>, provenance?: ToolProvenance[], manifests?: ToolPluginManifest[]): Promise<void>;
49
+ //# sourceMappingURL=register-authored-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-authored-tools.d.ts","sourceRoot":"","sources":["../../src/bootstrap/register-authored-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAOL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EAElB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAsC9C;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CAClC,GAAG,iBAAiB,CAgBpB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CAErF;AAED;;;;;;GAMG;AACH,wBAAsB,gCAAgC,CACpD,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE;IACJ,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CAClC,EACD,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,EAC/B,UAAU,GAAE,cAAc,EAAO,EACjC,SAAS,GAAE,kBAAkB,EAAO,GACnC,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * register-authored-tools — admission + discovery for AUTHORED Tool sidecars
3
+ * (project-local + user-global), extracted from register-tools-discovery.ts so
4
+ * the installed-package discovery path stays a focused module under the
5
+ * file-length soft limit.
6
+ *
7
+ * Authored tools are authored CONTENT (a JSON sidecar, not an installed npm
8
+ * package): project-local is deny-by-default (allowlisted via
9
+ * `OPENSIP_CLI_ALLOW_PROJECT_TOOLS`), user-global is trusted-by-default. Both are
10
+ * EXTERNAL provenance, so ADR-0054 M4-G applies: in the HOST the registration
11
+ * registers a manifest-derived synthetic `Tool` (no runtime import); the dispatch
12
+ * WORKER (`OPENSIP_CLI_IN_TOOL_WORKER=1`) imports the real runtime.
13
+ */
14
+ import { admitTool, assertManifestMatchesTool, discoverAuthoredToolSidecars, loadToolManifest, PluginIncompatibleError, PROJECT_LOCAL_MANIFEST_FILE, } from '@opensip-cli/core';
15
+ import { importToolRuntime, workerRuntimeImportPolicyFor } from './admit-tool-package.js';
16
+ import { synthesizeExternalTool } from './synthesize-external-tool.js';
17
+ import { isHostRuntimeImportForbidden } from './tool-provenance.js';
18
+ import { isProjectLocalToolTrusted } from './tool-trust.js';
19
+ /**
20
+ * The shared admission tail for both authored sources. When `preloadedManifest`
21
+ * is supplied we use that snapshot so the trust decision and compatibility gate
22
+ * see the identical declaration.
23
+ *
24
+ * @throws {PluginIncompatibleError} When the sidecar manifest is missing,
25
+ * malformed, or rejected by the compatibility gate.
26
+ */
27
+ function admitAuthoredTool(source, dir, preloadedManifest) {
28
+ const rawManifest = preloadedManifest ?? loadToolManifest(source, dir);
29
+ if (rawManifest === undefined) {
30
+ throw new PluginIncompatibleError(`${source} tool at '${dir}' has no conformant ${PROJECT_LOCAL_MANIFEST_FILE} sidecar`, { diagnostic: 'manifest missing or malformed' });
31
+ }
32
+ const result = admitTool({
33
+ manifest: rawManifest,
34
+ source,
35
+ dir,
36
+ explicitlyRequested: true,
37
+ });
38
+ if (result.decision !== 'admit') {
39
+ throw new PluginIncompatibleError(`${source} tool '${rawManifest.id}' is incompatible: ${result.diagnostic ?? 'compatibility gate rejected it'}`, { diagnostic: result.diagnostic });
40
+ }
41
+ return { provenance: result.provenance, manifest: result.manifest };
42
+ }
43
+ /**
44
+ * Admit or reject a PROJECT-LOCAL authored tool under the deny-by-default trust
45
+ * policy. The trust decision always precedes module import; a non-allowlisted
46
+ * tool fails closed before any authored code can run.
47
+ *
48
+ * @throws {PluginIncompatibleError} When the sidecar manifest is missing,
49
+ * malformed, incompatible, or not trusted by the project-tool allowlist.
50
+ */
51
+ export function admitProjectLocalTool(args) {
52
+ const manifest = loadToolManifest('project-local', args.dir);
53
+ if (manifest === undefined) {
54
+ throw new PluginIncompatibleError(`project-local tool at '${args.dir}' has no conformant ${PROJECT_LOCAL_MANIFEST_FILE} sidecar`, { diagnostic: 'manifest missing or malformed' });
55
+ }
56
+ if (!isProjectLocalToolTrusted(manifest.id, args.env)) {
57
+ throw new PluginIncompatibleError(`project-local tool '${manifest.id}' is not trusted to load (deny-by-default). ` +
58
+ `Allowlist it via OPENSIP_CLI_ALLOW_PROJECT_TOOLS='${manifest.id}' to admit it.`, { diagnostic: 'project-local tool not allowlisted (deny-by-default)' });
59
+ }
60
+ return admitAuthoredTool('project-local', args.dir, manifest);
61
+ }
62
+ /**
63
+ * Admit a USER-GLOBAL authored tool — trusted-by-default because the user placed
64
+ * it in their own home-dir tool host, but still fail-closed on a missing or
65
+ * incompatible manifest.
66
+ */
67
+ export function admitUserGlobalTool(args) {
68
+ return admitAuthoredTool('user-global', args.dir);
69
+ }
70
+ /**
71
+ * Discover + admit + register AUTHORED Tool sidecars from the two authored
72
+ * roots. ADR-0054 M4-G: authored tools are always EXTERNAL provenance, so the
73
+ * HOST registers a manifest-derived synthetic Tool (no runtime import); the
74
+ * dispatch WORKER (`OPENSIP_CLI_IN_TOOL_WORKER=1`) imports the real runtime via
75
+ * the shared `importToolRuntime` seam.
76
+ */
77
+ export async function discoverAndRegisterAuthoredTools(registry, opts, builtInIds, provenance = [], manifests = []) {
78
+ const env = opts.env ?? process.env;
79
+ for (const candidate of discoverAuthoredToolSidecars(opts.globalAuthoredDir)) {
80
+ await admitAndRegisterAuthored({
81
+ registry,
82
+ admission: admitUserGlobalTool({ dir: candidate.dir }),
83
+ dir: candidate.dir,
84
+ builtInIds,
85
+ provenance,
86
+ manifests,
87
+ env,
88
+ });
89
+ }
90
+ if (opts.projectAuthoredDir !== undefined) {
91
+ for (const candidate of discoverAuthoredToolSidecars(opts.projectAuthoredDir)) {
92
+ await admitAndRegisterAuthored({
93
+ registry,
94
+ admission: admitProjectLocalTool({ dir: candidate.dir, env: opts.env }),
95
+ dir: candidate.dir,
96
+ builtInIds,
97
+ provenance,
98
+ manifests,
99
+ env,
100
+ });
101
+ }
102
+ }
103
+ }
104
+ /** @throws {PluginIncompatibleError} When the authored tool runtime fails to load. */
105
+ async function admitAndRegisterAuthored(args) {
106
+ const { registry, admission, dir, builtInIds, provenance, manifests, env } = args;
107
+ const { provenance: prov, manifest } = admission;
108
+ if (builtInIds.has(prov.id))
109
+ return;
110
+ // ADR-0054 M4-G (capstone): authored tools are EXTERNAL. In the HOST, register
111
+ // a manifest-derived synthetic Tool — never import the untrusted runtime. The
112
+ // dispatch WORKER imports the real runtime (the isolation boundary). The trust
113
+ // gate already ran in `admitProjectLocalTool` (deny-by-default), so a
114
+ // non-allowlisted tool never reaches here.
115
+ if (isHostRuntimeImportForbidden(env)) {
116
+ const tool = synthesizeExternalTool(manifest);
117
+ registry.register(tool);
118
+ provenance.push(prov);
119
+ manifests.push(manifest);
120
+ return;
121
+ }
122
+ const load = await importToolRuntime(dir, workerRuntimeImportPolicyFor(prov.source));
123
+ if (!load.ok) {
124
+ const detailSuffix = load.detail ? `: ${load.detail}` : '';
125
+ throw new PluginIncompatibleError(`${prov.source} tool '${prov.id}' failed to load via the plugin path (${load.reason}${detailSuffix})`, { diagnostic: `authored tool runtime load failed: ${load.reason}` });
126
+ }
127
+ assertManifestMatchesTool(manifest, load.tool);
128
+ registry.register(load.tool);
129
+ provenance.push(prov);
130
+ manifests.push(manifest);
131
+ }
132
+ //# sourceMappingURL=register-authored-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-authored-tools.js","sourceRoot":"","sources":["../../src/bootstrap/register-authored-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,SAAS,EACT,yBAAyB,EACzB,4BAA4B,EAC5B,gBAAgB,EAChB,uBAAuB,EACvB,2BAA2B,GAK5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAA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AE,CAAC;QAC3D,MAAM,IAAI,uBAAuB,CAC/B,GAAG,IAAI,CAAC,MAAM,UAAU,IAAI,CAAC,EAAE,yCAAyC,IAAI,CAAC,MAAM,GAAG,YAAY,GAAG,EACrG,EAAE,UAAU,EAAE,sCAAsC,IAAI,CAAC,MAAM,EAAE,EAAE,CACpE,CAAC;IACJ,CAAC;IAED,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/C,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC"}
@@ -6,33 +6,13 @@
6
6
  */
7
7
  import { type ToolPluginManifest, type ToolProvenance, type ToolRegistry, type ToolDiscoverySource } from '@opensip-cli/core';
8
8
  import { type ToolRuntimeLoad } from './admit-tool-package.js';
9
- import type { ToolAdmission } from './tool-admission-types.js';
10
- export type AuthoredAdmission = ToolAdmission;
11
- /**
12
- * Admit or reject a PROJECT-LOCAL authored tool under the deny-by-default trust
13
- * policy. The trust decision always precedes module import; a non-allowlisted
14
- * tool fails closed before any authored code can run.
15
- *
16
- * @throws {PluginIncompatibleError} When the sidecar manifest is missing,
17
- * malformed, incompatible, or not trusted by the project-tool allowlist.
18
- */
19
- export declare function admitProjectLocalTool(args: {
20
- readonly dir: string;
21
- readonly env?: NodeJS.ProcessEnv;
22
- }): AuthoredAdmission;
23
- /**
24
- * Admit a USER-GLOBAL authored tool — trusted-by-default because the user placed
25
- * it in their own home-dir tool host, but still fail-closed on a missing or
26
- * incompatible manifest.
27
- */
28
- export declare function admitUserGlobalTool(args: {
29
- readonly dir: string;
30
- }): AuthoredAdmission;
31
9
  /**
32
10
  * Emit the best-effort stderr line + structured warning for a discovered
33
11
  * INSTALLED tool whose runtime failed to load. Each failure reason maps to its
34
12
  * own diagnostic while preserving the installed leg's skip-not-crash posture.
35
13
  */
14
+ /** Stderr + structured log when an installed tool is skipped by the trust gate. */
15
+ export declare function emitInstalledTrustDenied(toolId: string, packageName: string, packageDir: string): void;
36
16
  export declare function emitInstalledLoadFailure(name: string, load: Extract<ToolRuntimeLoad, {
37
17
  ok: false;
38
18
  }>): void;
@@ -44,6 +24,8 @@ export interface DiscoveryOptions {
44
24
  * and stays unit-testable with explicit anchors.
45
25
  */
46
26
  readonly sources: readonly ToolDiscoverySource[];
27
+ /** Injectable env for installed-tool trust (bootstrap-time; defaults to `process.env`). */
28
+ readonly env?: NodeJS.ProcessEnv;
47
29
  }
48
30
  /**
49
31
  * Build the ordered tool-discovery sources. Order is precedence
@@ -60,35 +42,5 @@ export interface DiscoveryOptions {
60
42
  * source.
61
43
  */
62
44
  export declare function buildToolDiscoverySources(cwd: string, cliInstallDir: string): ToolDiscoverySource[];
63
- /**
64
- * Discover and register third-party tool packages from npm — any
65
- * `package.json` declaring `opensipTools.kind === 'tool'`. Built-in
66
- * ids are skipped to avoid double-registration warnings. Discovery spans
67
- * the supplied sources (the user-global tool host dir, the project tree +
68
- * its `.runtime` tool host dir, and the CLI install dir — see
69
- * {@link buildToolDiscoverySources}).
70
- *
71
- * Each discovered package runs through the SAME `admitTool` gate the
72
- * bundled path uses (launch, Phase 3) BEFORE its module is imported:
73
- * the static `package.json#opensipTools` manifest is read with source
74
- * `'installed'`, the compatibility gate runs, and only an `admit` verdict
75
- * proceeds to import + register. An installed tool is best-effort
76
- * `explicitlyRequested: false`, so an incompatible one `skip`s (logged)
77
- * rather than failing the whole CLI — a stray incompatible plugin must not
78
- * take fit/graph/sim down. Admitted tools' `ToolProvenance` is pushed onto
79
- * the optional `provenance` collector for Phase 4's `plugin list`.
80
- *
81
- * @param provenance Optional sink for admitted tools' provenance records.
82
- */
83
45
  export declare function discoverAndRegisterToolPackages(registry: ToolRegistry, opts: DiscoveryOptions, builtInIds: ReadonlySet<string>, provenance?: ToolProvenance[], manifests?: ToolPluginManifest[]): Promise<void>;
84
- /**
85
- * Discover + admit + register AUTHORED Tool sidecars from the two authored
86
- * roots, then dynamic-import each admitted runtime through the shared
87
- * `importToolRuntime` seam.
88
- */
89
- export declare function discoverAndRegisterAuthoredTools(registry: ToolRegistry, opts: {
90
- readonly projectAuthoredDir?: string;
91
- readonly globalAuthoredDir: string;
92
- readonly env?: NodeJS.ProcessEnv;
93
- }, builtInIds: ReadonlySet<string>, provenance?: ToolProvenance[], manifests?: ToolPluginManifest[]): Promise<void>;
94
46
  //# sourceMappingURL=register-tools-discovery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-tools-discovery.d.ts","sourceRoot":"","sources":["../../src/bootstrap/register-tools-discovery.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,EAYL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAsC9C;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CAClC,GAAG,iBAAiB,CAgBpB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CAErF;AAoCD;;;;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;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAClD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,GACpB,mBAAmB,EAAE,CAqBvB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,+BAA+B,CACnD,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,EAC/B,UAAU,GAAE,cAAc,EAAO,EACjC,SAAS,GAAE,kBAAkB,EAAO,GACnC,OAAO,CAAC,IAAI,CAAC,CA2Cf;AAED;;;;GAIG;AACH,wBAAsB,gCAAgC,CACpD,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE;IACJ,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CAClC,EACD,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,EAC/B,UAAU,GAAE,cAAc,EAAO,EACjC,SAAS,GAAE,kBAAkB,EAAO,GACnC,OAAO,CAAC,IAAI,CAAC,CAuBf"}
1
+ {"version":3,"file":"register-tools-discovery.d.ts","sourceRoot":"","sources":["../../src/bootstrap/register-tools-discovery.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,EASL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AA0CjC;;;;GAIG;AACH,mFAAmF;AACnF,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,IAAI,CAaN;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,CAAC,eAAe,EAAE;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC,GAC5C,IAAI,CA0BN;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACjD,2FAA2F;IAC3F,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CAClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,GACpB,mBAAmB,EAAE,CAqBvB;AAmGD,wBAAsB,+BAA+B,CACnD,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,EAC/B,UAAU,GAAE,cAAc,EAAO,EACjC,SAAS,GAAE,kBAAkB,EAAO,GACnC,OAAO,CAAC,IAAI,CAAC,CAmCf"}