opensip-cli 0.1.6 → 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.
- package/dist/bootstrap/admit-tool-package.d.ts.map +1 -1
- package/dist/bootstrap/admit-tool-package.js +8 -3
- package/dist/bootstrap/admit-tool-package.js.map +1 -1
- package/dist/bootstrap/bind-tool-context.d.ts.map +1 -1
- package/dist/bootstrap/bind-tool-context.js +5 -3
- package/dist/bootstrap/bind-tool-context.js.map +1 -1
- package/dist/bootstrap/build-command-registration-input.d.ts +7 -0
- package/dist/bootstrap/build-command-registration-input.d.ts.map +1 -1
- package/dist/bootstrap/build-command-registration-input.js +11 -4
- package/dist/bootstrap/build-command-registration-input.js.map +1 -1
- package/dist/bootstrap/build-per-run-scope.d.ts +12 -0
- package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -1
- package/dist/bootstrap/build-per-run-scope.js +84 -9
- package/dist/bootstrap/build-per-run-scope.js.map +1 -1
- package/dist/bootstrap/bundled-manifest.d.ts +5 -0
- package/dist/bootstrap/bundled-manifest.d.ts.map +1 -0
- package/dist/bootstrap/bundled-manifest.js +13 -0
- package/dist/bootstrap/bundled-manifest.js.map +1 -0
- package/dist/bootstrap/bundled-tools.manifest.json +19 -1
- package/dist/bootstrap/config-and-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/config-and-capabilities.js +5 -4
- package/dist/bootstrap/config-and-capabilities.js.map +1 -1
- package/dist/bootstrap/constants.d.ts +3 -0
- package/dist/bootstrap/constants.d.ts.map +1 -0
- package/dist/bootstrap/constants.js +3 -0
- package/dist/bootstrap/constants.js.map +1 -0
- package/dist/bootstrap/decorate-tool-primary.d.ts +50 -0
- package/dist/bootstrap/decorate-tool-primary.d.ts.map +1 -0
- package/dist/bootstrap/decorate-tool-primary.js +111 -0
- package/dist/bootstrap/decorate-tool-primary.js.map +1 -0
- package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts.map +1 -1
- package/dist/bootstrap/execute-post-bailout-bootstrap.js +10 -0
- package/dist/bootstrap/execute-post-bailout-bootstrap.js.map +1 -1
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +1 -4
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/io-plane.d.ts +47 -0
- package/dist/bootstrap/io-plane.d.ts.map +1 -0
- package/dist/bootstrap/io-plane.js +73 -0
- package/dist/bootstrap/io-plane.js.map +1 -0
- package/dist/bootstrap/load-tool-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/load-tool-capabilities.js +18 -2
- package/dist/bootstrap/load-tool-capabilities.js.map +1 -1
- package/dist/bootstrap/owning-tool-init.d.ts.map +1 -1
- package/dist/bootstrap/owning-tool-init.js +7 -4
- package/dist/bootstrap/owning-tool-init.js.map +1 -1
- package/dist/bootstrap/phase-map.d.ts +20 -0
- package/dist/bootstrap/phase-map.d.ts.map +1 -0
- package/dist/bootstrap/phase-map.js +108 -0
- package/dist/bootstrap/phase-map.js.map +1 -0
- package/dist/bootstrap/pre-action-hook.d.ts.map +1 -1
- package/dist/bootstrap/pre-action-hook.js +19 -2
- package/dist/bootstrap/pre-action-hook.js.map +1 -1
- package/dist/bootstrap/register-tools-discovery.d.ts +38 -39
- package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-discovery.js +132 -83
- package/dist/bootstrap/register-tools-discovery.js.map +1 -1
- package/dist/bootstrap/register-tools-mount.d.ts +18 -1
- package/dist/bootstrap/register-tools-mount.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-mount.js +118 -18
- package/dist/bootstrap/register-tools-mount.js.map +1 -1
- package/dist/bootstrap/register-tools.d.ts +58 -14
- package/dist/bootstrap/register-tools.d.ts.map +1 -1
- package/dist/bootstrap/register-tools.js +185 -14
- package/dist/bootstrap/register-tools.js.map +1 -1
- package/dist/bootstrap/root-version.d.ts +26 -0
- package/dist/bootstrap/root-version.d.ts.map +1 -0
- package/dist/bootstrap/root-version.js +36 -0
- package/dist/bootstrap/root-version.js.map +1 -0
- package/dist/bootstrap/scope-access.d.ts +11 -0
- package/dist/bootstrap/scope-access.d.ts.map +1 -1
- package/dist/bootstrap/scope-access.js +26 -0
- package/dist/bootstrap/scope-access.js.map +1 -1
- package/dist/bootstrap/tool-lifecycle.d.ts +0 -22
- package/dist/bootstrap/tool-lifecycle.d.ts.map +1 -1
- package/dist/bootstrap/tool-lifecycle.js +0 -23
- package/dist/bootstrap/tool-lifecycle.js.map +1 -1
- package/dist/bootstrap/validate-tool.d.ts +10 -4
- package/dist/bootstrap/validate-tool.d.ts.map +1 -1
- package/dist/bootstrap/validate-tool.js +76 -22
- package/dist/bootstrap/validate-tool.js.map +1 -1
- package/dist/cli-context.d.ts +2 -2
- package/dist/cli-context.d.ts.map +1 -1
- package/dist/cli-context.js +20 -35
- package/dist/cli-context.js.map +1 -1
- package/dist/commands/agent-catalog.d.ts +29 -0
- package/dist/commands/agent-catalog.d.ts.map +1 -1
- package/dist/commands/agent-catalog.js +77 -36
- package/dist/commands/agent-catalog.js.map +1 -1
- package/dist/commands/clear.d.ts.map +1 -1
- package/dist/commands/clear.js +0 -1
- package/dist/commands/clear.js.map +1 -1
- package/dist/commands/command-scope-index.d.ts +15 -1
- package/dist/commands/command-scope-index.d.ts.map +1 -1
- package/dist/commands/command-scope-index.js +10 -1
- package/dist/commands/command-scope-index.js.map +1 -1
- package/dist/commands/completion.d.ts +67 -6
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +84 -12
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/configure.d.ts.map +1 -1
- package/dist/commands/configure.js +0 -1
- package/dist/commands/configure.js.map +1 -1
- package/dist/commands/host-command-specs.d.ts +16 -9
- package/dist/commands/host-command-specs.d.ts.map +1 -1
- package/dist/commands/host-command-specs.js +45 -19
- package/dist/commands/host-command-specs.js.map +1 -1
- package/dist/commands/host-config-flag.d.ts +21 -0
- package/dist/commands/host-config-flag.d.ts.map +1 -0
- package/dist/commands/host-config-flag.js +21 -0
- package/dist/commands/host-config-flag.js.map +1 -0
- package/dist/commands/host-subcommand-groups.d.ts +46 -5
- package/dist/commands/host-subcommand-groups.d.ts.map +1 -1
- package/dist/commands/host-subcommand-groups.js +97 -65
- package/dist/commands/host-subcommand-groups.js.map +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/internal-command-visibility.d.ts +42 -0
- package/dist/commands/internal-command-visibility.d.ts.map +1 -0
- package/dist/commands/internal-command-visibility.js +54 -0
- package/dist/commands/internal-command-visibility.js.map +1 -0
- package/dist/commands/mount-command-action.d.ts +5 -0
- package/dist/commands/mount-command-action.d.ts.map +1 -1
- package/dist/commands/mount-command-action.js +26 -2
- package/dist/commands/mount-command-action.js.map +1 -1
- package/dist/commands/mount-command-spec.d.ts +9 -2
- package/dist/commands/mount-command-spec.d.ts.map +1 -1
- package/dist/commands/mount-command-spec.js +9 -1
- package/dist/commands/mount-command-spec.js.map +1 -1
- package/dist/commands/plugin/domain-resolution.d.ts +12 -13
- package/dist/commands/plugin/domain-resolution.d.ts.map +1 -1
- package/dist/commands/plugin/domain-resolution.js +12 -58
- package/dist/commands/plugin/domain-resolution.js.map +1 -1
- package/dist/commands/plugin/host-dir.d.ts +0 -1
- package/dist/commands/plugin/host-dir.d.ts.map +1 -1
- package/dist/commands/plugin/host-dir.js +1 -1
- package/dist/commands/plugin/host-dir.js.map +1 -1
- package/dist/commands/plugin.d.ts +20 -14
- package/dist/commands/plugin.d.ts.map +1 -1
- package/dist/commands/plugin.js +39 -47
- package/dist/commands/plugin.js.map +1 -1
- package/dist/commands/render-outcome.d.ts.map +1 -1
- package/dist/commands/render-outcome.js.map +1 -1
- package/dist/commands/shared.d.ts +9 -0
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/tools/create.d.ts +11 -0
- package/dist/commands/tools/create.d.ts.map +1 -0
- package/dist/commands/tools/create.js +84 -0
- package/dist/commands/tools/create.js.map +1 -0
- package/dist/commands/tools/index.d.ts.map +1 -1
- package/dist/commands/tools/index.js +31 -0
- package/dist/commands/tools/index.js.map +1 -1
- package/dist/commands/tools/runtime-probe-entry.d.ts.map +1 -1
- package/dist/commands/tools/runtime-probe-entry.js +4 -2
- package/dist/commands/tools/runtime-probe-entry.js.map +1 -1
- package/dist/commands/tools/validate.d.ts.map +1 -1
- package/dist/commands/tools/validate.js +12 -5
- package/dist/commands/tools/validate.js.map +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +0 -1
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/env/host-env-specs.d.ts +18 -0
- package/dist/env/host-env-specs.d.ts.map +1 -1
- package/dist/env/host-env-specs.js +36 -2
- package/dist/env/host-env-specs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/dist/report-compose.d.ts.map +1 -1
- package/dist/report-compose.js +2 -2
- package/dist/report-compose.js.map +1 -1
- package/dist/session-replay-registry.d.ts +1 -1
- package/dist/session-replay-registry.d.ts.map +1 -1
- package/dist/session-replay-registry.js +3 -1
- package/dist/session-replay-registry.js.map +1 -1
- package/dist/ui/result-to-view.d.ts +27 -7
- package/dist/ui/result-to-view.d.ts.map +1 -1
- package/dist/ui/result-to-view.js +68 -75
- package/dist/ui/result-to-view.js.map +1 -1
- package/dist/ui/views/misc-views.d.ts.map +1 -1
- package/dist/ui/views/misc-views.js +3 -1
- package/dist/ui/views/misc-views.js.map +1 -1
- package/dist/ui/views/tools-views.d.ts +2 -1
- package/dist/ui/views/tools-views.d.ts.map +1 -1
- package/dist/ui/views/tools-views.js +21 -0
- package/dist/ui/views/tools-views.js.map +1 -1
- package/package.json +32 -32
- package/dist/bootstrap/authored-tool-admission.d.ts +0 -23
- package/dist/bootstrap/authored-tool-admission.d.ts.map +0 -1
- package/dist/bootstrap/authored-tool-admission.js +0 -54
- package/dist/bootstrap/authored-tool-admission.js.map +0 -1
- package/dist/bootstrap/egress-plane.d.ts +0 -22
- package/dist/bootstrap/egress-plane.d.ts.map +0 -1
- package/dist/bootstrap/egress-plane.js +0 -37
- package/dist/bootstrap/egress-plane.js.map +0 -1
- package/dist/bootstrap/installed-tool-admission.d.ts +0 -20
- package/dist/bootstrap/installed-tool-admission.d.ts.map +0 -1
- package/dist/bootstrap/installed-tool-admission.js +0 -60
- package/dist/bootstrap/installed-tool-admission.js.map +0 -1
- package/dist/bootstrap/live-plane.d.ts +0 -51
- package/dist/bootstrap/live-plane.d.ts.map +0 -1
- package/dist/bootstrap/live-plane.js +0 -72
- package/dist/bootstrap/live-plane.js.map +0 -1
- package/dist/bootstrap/register-tools-bundled.d.ts +0 -28
- package/dist/bootstrap/register-tools-bundled.d.ts.map +0 -1
- package/dist/bootstrap/register-tools-bundled.js +0 -107
- package/dist/bootstrap/register-tools-bundled.js.map +0 -1
- package/dist/bootstrap/register-tools-shared.d.ts +0 -40
- package/dist/bootstrap/register-tools-shared.d.ts.map +0 -1
- package/dist/bootstrap/register-tools-shared.js +0 -98
- package/dist/bootstrap/register-tools-shared.js.map +0 -1
|
@@ -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,CAAC;AAEpC,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,eAA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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;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MA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