opensip-cli 0.1.12 → 0.1.14
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/artifact-seams.d.ts +7 -0
- package/dist/bootstrap/artifact-seams.d.ts.map +1 -0
- package/dist/bootstrap/artifact-seams.js +53 -0
- package/dist/bootstrap/artifact-seams.js.map +1 -0
- package/dist/bootstrap/atomic-artifact-write.d.ts +19 -0
- package/dist/bootstrap/atomic-artifact-write.d.ts.map +1 -0
- package/dist/bootstrap/atomic-artifact-write.js +68 -0
- package/dist/bootstrap/atomic-artifact-write.js.map +1 -0
- package/dist/bootstrap/baseline-seams.d.ts.map +1 -1
- package/dist/bootstrap/baseline-seams.js +79 -27
- package/dist/bootstrap/baseline-seams.js.map +1 -1
- package/dist/bootstrap/build-command-registration-input.d.ts.map +1 -1
- package/dist/bootstrap/build-command-registration-input.js.map +1 -1
- package/dist/bootstrap/build-external-worker-child-env.d.ts +25 -0
- package/dist/bootstrap/build-external-worker-child-env.d.ts.map +1 -0
- package/dist/bootstrap/build-external-worker-child-env.js +71 -0
- package/dist/bootstrap/build-external-worker-child-env.js.map +1 -0
- package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -1
- package/dist/bootstrap/build-per-run-scope.js +4 -1
- package/dist/bootstrap/build-per-run-scope.js.map +1 -1
- package/dist/bootstrap/config-and-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/config-and-capabilities.js +12 -94
- package/dist/bootstrap/config-and-capabilities.js.map +1 -1
- package/dist/bootstrap/config-declarations.d.ts +23 -0
- package/dist/bootstrap/config-declarations.d.ts.map +1 -0
- package/dist/bootstrap/config-declarations.js +73 -0
- package/dist/bootstrap/config-declarations.js.map +1 -0
- package/dist/bootstrap/decorate-tool-primary.d.ts.map +1 -1
- package/dist/bootstrap/decorate-tool-primary.js.map +1 -1
- package/dist/bootstrap/deliver-envelope.d.ts +4 -1
- package/dist/bootstrap/deliver-envelope.d.ts.map +1 -1
- package/dist/bootstrap/deliver-envelope.js +38 -10
- package/dist/bootstrap/deliver-envelope.js.map +1 -1
- package/dist/bootstrap/dispatch-fork-core.d.ts +1 -1
- package/dist/bootstrap/dispatch-fork-core.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-fork-core.js +73 -75
- package/dist/bootstrap/dispatch-fork-core.js.map +1 -1
- package/dist/bootstrap/dispatch-host-rpc-handler.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-host-rpc-handler.js +4 -0
- package/dist/bootstrap/dispatch-host-rpc-handler.js.map +1 -1
- package/dist/bootstrap/dispatch-replay-result.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-replay-result.js +3 -0
- package/dist/bootstrap/dispatch-replay-result.js.map +1 -1
- package/dist/bootstrap/io-plane.d.ts.map +1 -1
- package/dist/bootstrap/io-plane.js +4 -1
- package/dist/bootstrap/io-plane.js.map +1 -1
- package/dist/bootstrap/load-tool-capabilities.d.ts.map +1 -1
- package/dist/bootstrap/load-tool-capabilities.js +34 -3
- package/dist/bootstrap/load-tool-capabilities.js.map +1 -1
- package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -1
- package/dist/bootstrap/register-tools-discovery.js +2 -0
- package/dist/bootstrap/register-tools-discovery.js.map +1 -1
- package/dist/bootstrap/report-failure.d.ts +28 -0
- package/dist/bootstrap/report-failure.d.ts.map +1 -0
- package/dist/bootstrap/report-failure.js +135 -0
- package/dist/bootstrap/report-failure.js.map +1 -0
- package/dist/bootstrap/scope-access.d.ts +1 -1
- package/dist/bootstrap/scope-access.d.ts.map +1 -1
- package/dist/bootstrap/scope-access.js +10 -2
- package/dist/bootstrap/scope-access.js.map +1 -1
- package/dist/bootstrap/state-lock-policy.d.ts +19 -0
- package/dist/bootstrap/state-lock-policy.d.ts.map +1 -0
- package/dist/bootstrap/state-lock-policy.js +86 -0
- package/dist/bootstrap/state-lock-policy.js.map +1 -0
- package/dist/bootstrap/synthesize-external-tool.d.ts.map +1 -1
- package/dist/bootstrap/synthesize-external-tool.js +11 -1
- package/dist/bootstrap/synthesize-external-tool.js.map +1 -1
- package/dist/bootstrap/tool-command-dispatch-types.d.ts +23 -2
- package/dist/bootstrap/tool-command-dispatch-types.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-config-pass.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-config-pass.js.map +1 -1
- package/dist/bootstrap/tool-command-worker-context.d.ts +4 -3
- package/dist/bootstrap/tool-command-worker-context.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-context.js +28 -4
- package/dist/bootstrap/tool-command-worker-context.js.map +1 -1
- package/dist/bootstrap/tool-command-worker-entry.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-entry.js +38 -31
- package/dist/bootstrap/tool-command-worker-entry.js.map +1 -1
- package/dist/bootstrap/tool-command-worker-result.d.ts +25 -0
- package/dist/bootstrap/tool-command-worker-result.d.ts.map +1 -0
- package/dist/bootstrap/tool-command-worker-result.js +60 -0
- package/dist/bootstrap/tool-command-worker-result.js.map +1 -0
- package/dist/bootstrap/tool-trust.d.ts +12 -0
- package/dist/bootstrap/tool-trust.d.ts.map +1 -1
- package/dist/bootstrap/tool-trust.js +29 -5
- package/dist/bootstrap/tool-trust.js.map +1 -1
- package/dist/bootstrap/validate-tool.d.ts.map +1 -1
- package/dist/bootstrap/validate-tool.js +4 -1
- package/dist/bootstrap/validate-tool.js.map +1 -1
- package/dist/cli-context.d.ts.map +1 -1
- package/dist/cli-context.js +42 -8
- package/dist/cli-context.js.map +1 -1
- package/dist/commands/agent-catalog.d.ts +8 -7
- package/dist/commands/agent-catalog.d.ts.map +1 -1
- package/dist/commands/agent-catalog.js +129 -60
- package/dist/commands/agent-catalog.js.map +1 -1
- package/dist/commands/clear.d.ts.map +1 -1
- package/dist/commands/clear.js +12 -2
- package/dist/commands/clear.js.map +1 -1
- package/dist/commands/config.d.ts +22 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +135 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/configure.d.ts.map +1 -1
- package/dist/commands/configure.js +5 -1
- package/dist/commands/configure.js.map +1 -1
- package/dist/commands/host-command-specs.d.ts.map +1 -1
- package/dist/commands/host-command-specs.js +13 -5
- package/dist/commands/host-command-specs.js.map +1 -1
- package/dist/commands/host-subcommand-config.d.ts +7 -0
- package/dist/commands/host-subcommand-config.d.ts.map +1 -0
- package/dist/commands/host-subcommand-config.js +75 -0
- package/dist/commands/host-subcommand-config.js.map +1 -0
- package/dist/commands/host-subcommand-groups.d.ts.map +1 -1
- package/dist/commands/host-subcommand-groups.js +7 -1
- package/dist/commands/host-subcommand-groups.js.map +1 -1
- package/dist/commands/host-subcommand-sessions.d.ts.map +1 -1
- package/dist/commands/host-subcommand-sessions.js +8 -4
- package/dist/commands/host-subcommand-sessions.js.map +1 -1
- package/dist/commands/init/agents-md.d.ts +6 -0
- package/dist/commands/init/agents-md.d.ts.map +1 -0
- package/dist/commands/init/agents-md.js +52 -0
- package/dist/commands/init/agents-md.js.map +1 -0
- package/dist/commands/init/language-detection.d.ts.map +1 -1
- package/dist/commands/init/language-detection.js +8 -3
- package/dist/commands/init/language-detection.js.map +1 -1
- package/dist/commands/init/scaffold-writer.d.ts.map +1 -1
- package/dist/commands/init/scaffold-writer.js +6 -1
- package/dist/commands/init/scaffold-writer.js.map +1 -1
- package/dist/commands/init.d.ts +5 -4
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +10 -5
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mount-command-spec.d.ts +3 -1
- package/dist/commands/mount-command-spec.d.ts.map +1 -1
- package/dist/commands/mount-command-spec.js +27 -4
- package/dist/commands/mount-command-spec.js.map +1 -1
- package/dist/commands/plugin-host-ops.d.ts.map +1 -1
- package/dist/commands/plugin-host-ops.js +11 -2
- package/dist/commands/plugin-host-ops.js.map +1 -1
- package/dist/commands/plugin.d.ts.map +1 -1
- package/dist/commands/plugin.js +11 -2
- package/dist/commands/plugin.js.map +1 -1
- package/dist/commands/session-show.js +5 -46
- package/dist/commands/session-show.js.map +1 -1
- package/dist/commands/shared.d.ts +5 -1
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/tools/create-template-writer.d.ts +16 -0
- package/dist/commands/tools/create-template-writer.d.ts.map +1 -0
- package/dist/commands/tools/create-template-writer.js +39 -0
- package/dist/commands/tools/create-template-writer.js.map +1 -0
- package/dist/commands/tools/create-templates.d.ts +19 -0
- package/dist/commands/tools/create-templates.d.ts.map +1 -0
- package/dist/commands/tools/create-templates.js +228 -0
- package/dist/commands/tools/create-templates.js.map +1 -0
- package/dist/commands/tools/create.d.ts +4 -1
- package/dist/commands/tools/create.d.ts.map +1 -1
- package/dist/commands/tools/create.js +35 -50
- package/dist/commands/tools/create.js.map +1 -1
- package/dist/commands/tools/index.d.ts.map +1 -1
- package/dist/commands/tools/index.js +8 -0
- package/dist/commands/tools/index.js.map +1 -1
- package/dist/commands/tools/install.d.ts.map +1 -1
- package/dist/commands/tools/install.js +21 -2
- package/dist/commands/tools/install.js.map +1 -1
- package/dist/commands/tools/storage-contract-checks.d.ts.map +1 -1
- package/dist/commands/tools/storage-contract-checks.js.map +1 -1
- package/dist/commands/tools/uninstall.d.ts.map +1 -1
- package/dist/commands/tools/uninstall.js +14 -3
- package/dist/commands/tools/uninstall.js.map +1 -1
- package/dist/commands/tools/validate.d.ts.map +1 -1
- package/dist/commands/tools/validate.js +51 -6
- package/dist/commands/tools/validate.js.map +1 -1
- package/dist/commands/uninstall/targets.d.ts.map +1 -1
- package/dist/commands/uninstall/targets.js +8 -1
- package/dist/commands/uninstall/targets.js.map +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +12 -2
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/env/host-env-specs.d.ts.map +1 -1
- package/dist/env/host-env-specs.js +57 -4
- package/dist/env/host-env-specs.js.map +1 -1
- package/dist/error-handler.d.ts.map +1 -1
- package/dist/error-handler.js +28 -6
- package/dist/error-handler.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/report-compose.d.ts.map +1 -1
- package/dist/report-compose.js +21 -3
- package/dist/report-compose.js.map +1 -1
- package/dist/telemetry/sdk-init.d.ts.map +1 -1
- package/dist/telemetry/sdk-init.js +3 -1
- package/dist/telemetry/sdk-init.js.map +1 -1
- package/dist/ui/result-to-view.d.ts.map +1 -1
- package/dist/ui/result-to-view.js +21 -1
- package/dist/ui/result-to-view.js.map +1 -1
- package/dist/ui/views/init-view.d.ts.map +1 -1
- package/dist/ui/views/init-view.js +14 -2
- package/dist/ui/views/init-view.js.map +1 -1
- package/dist/ui/views/misc-views.d.ts +13 -0
- package/dist/ui/views/misc-views.d.ts.map +1 -1
- package/dist/ui/views/misc-views.js +77 -5
- package/dist/ui/views/misc-views.js.map +1 -1
- package/dist/ui/views/plugin-view.d.ts.map +1 -1
- package/dist/ui/views/plugin-view.js +4 -1
- package/dist/ui/views/plugin-view.js.map +1 -1
- package/dist/ui/views/tools-views.d.ts.map +1 -1
- package/dist/ui/views/tools-views.js +8 -7
- package/dist/ui/views/tools-views.js.map +1 -1
- package/dist/update-notifier.d.ts +3 -0
- package/dist/update-notifier.d.ts.map +1 -1
- package/dist/update-notifier.js +3 -0
- package/dist/update-notifier.js.map +1 -1
- package/package.json +33 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-command-worker-entry.d.ts","sourceRoot":"","sources":["../../src/bootstrap/tool-command-worker-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"tool-command-worker-entry.d.ts","sourceRoot":"","sources":["../../src/bootstrap/tool-command-worker-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,OAAO,EASL,KAAK,WAAW,EAIhB,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAehE,OAAO,KAAK,EACV,cAAc,EAEd,iBAAiB,EAElB,MAAM,kCAAkC,CAAC;AAE1C;;;GAGG;AACH,KAAK,qBAAqB,GAAG,aAAa,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAoP9E;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAY3F;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9E;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAuBhF,CAAC"}
|
|
@@ -30,13 +30,27 @@
|
|
|
30
30
|
* process survives.
|
|
31
31
|
*/
|
|
32
32
|
import { readFileSync } from 'node:fs';
|
|
33
|
-
import { createRunTimer, currentScope, defineCommand, resolveToolHooks, } from '@opensip-cli/core';
|
|
33
|
+
import { CapturedOutputTooLargeError, createRunTimer, currentScope, defineCommand, IpcPayloadTooLargeError, resolveToolHooks, sendWorkerIpcMessage, startWorkerHeartbeat, } from '@opensip-cli/core';
|
|
34
34
|
import { runDeepConfigPass } from './tool-command-worker-config-pass.js';
|
|
35
35
|
import { buildWorkerContext, UnsupportedSeamError, } from './tool-command-worker-context.js';
|
|
36
|
+
import { assertReturnValuedHandlerResult, toResult, } from './tool-command-worker-result.js';
|
|
36
37
|
import { createWorkerRpcClient } from './tool-command-worker-rpc.js';
|
|
37
38
|
/** Post one IPC message to the parent (no-op when not forked — e.g. a unit call). */
|
|
38
39
|
function send(msg) {
|
|
39
|
-
|
|
40
|
+
try {
|
|
41
|
+
sendWorkerIpcMessage(msg);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (error instanceof IpcPayloadTooLargeError) {
|
|
45
|
+
process.send?.({
|
|
46
|
+
kind: 'error',
|
|
47
|
+
message: error.message,
|
|
48
|
+
failureClass: 'payload_too_large',
|
|
49
|
+
});
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
40
54
|
}
|
|
41
55
|
/**
|
|
42
56
|
* Resolve the dispatched tool from the re-bootstrapped registry. The bootstrap
|
|
@@ -105,36 +119,14 @@ function readSpec(specPath) {
|
|
|
105
119
|
return errorMessage(`tool command worker: unreadable spec at '${specPath}': ${error instanceof Error ? error.message : String(error)}`, 'bad-spec');
|
|
106
120
|
}
|
|
107
121
|
}
|
|
108
|
-
/**
|
|
109
|
-
* The output modes whose PAYLOAD is the handler's RETURN value (routed by the
|
|
110
|
-
* in-process `dispatchOutput`): `command-result` (a `CommandResult`) and
|
|
111
|
-
* `signal-envelope` (a `SignalEnvelope`). For these, the worker must carry the
|
|
112
|
-
* return back UNROUTED in `returned` so the supervisor replays it through the SAME
|
|
113
|
-
* `dispatchOutput`. `raw-stream` / `live-view` produce no routable return payload.
|
|
114
|
-
*/
|
|
115
|
-
function isReturnValuedOutput(output) {
|
|
116
|
-
return output === 'command-result' || output === 'signal-envelope';
|
|
117
|
-
}
|
|
118
|
-
/** Drain the accumulator + the handler's return into a serializable result. */
|
|
119
|
-
function toResult(output, acc, session, returned) {
|
|
120
|
-
return {
|
|
121
|
-
output,
|
|
122
|
-
...(acc.render === undefined ? {} : { render: acc.render }),
|
|
123
|
-
...(acc.envelope === undefined ? {} : { envelope: acc.envelope }),
|
|
124
|
-
...(acc.json === undefined ? {} : { json: acc.json }),
|
|
125
|
-
...(acc.raw === undefined ? {} : { raw: acc.raw }),
|
|
126
|
-
...(acc.error === undefined ? {} : { error: acc.error }),
|
|
127
|
-
...(acc.exitCode === undefined ? {} : { exitCode: acc.exitCode }),
|
|
128
|
-
...(session === undefined ? {} : { session }),
|
|
129
|
-
// Carry the handler's return for the return-valued modes so the supervisor
|
|
130
|
-
// routes it via the same `dispatchOutput` the in-process path uses (parity).
|
|
131
|
-
...(returned === undefined || !isReturnValuedOutput(output) ? {} : { returned }),
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
122
|
/** Map a thrown error to its structured failure class for the IPC `error` message. */
|
|
135
123
|
function classifyThrow(error) {
|
|
136
124
|
if (error instanceof UnsupportedSeamError)
|
|
137
125
|
return error.failureClass;
|
|
126
|
+
if (error instanceof CapturedOutputTooLargeError)
|
|
127
|
+
return error.failureClass;
|
|
128
|
+
if (error instanceof IpcPayloadTooLargeError)
|
|
129
|
+
return error.failureClass;
|
|
138
130
|
return error.failureClass ?? 'tool-handler-throw';
|
|
139
131
|
}
|
|
140
132
|
/**
|
|
@@ -197,6 +189,7 @@ async function runLoadedCommand(spec) {
|
|
|
197
189
|
// host-side); (2) it may carry a `session` leg (ToolRunCompletion) the host
|
|
198
190
|
// persists after the worker resolves (host-owned-run-timing). Capture it once.
|
|
199
191
|
const returned = (await commandSpec.handler({ ...spec.opts, _args: spec.positionals }, ctx));
|
|
192
|
+
assertReturnValuedHandlerResult(commandSpec, acc, returned);
|
|
200
193
|
return {
|
|
201
194
|
kind: 'result',
|
|
202
195
|
value: toResult(commandSpec.output, acc, returned?.session, returned),
|
|
@@ -239,7 +232,10 @@ async function runLoadedHook(tool, spec) {
|
|
|
239
232
|
kind: 'result',
|
|
240
233
|
// `output` is required on the result; the host never replays output for a
|
|
241
234
|
// hook-mode dispatch (it reads `hookResult`), so a benign default suffices.
|
|
242
|
-
value: {
|
|
235
|
+
value: {
|
|
236
|
+
output: 'command-result',
|
|
237
|
+
...(hookResult === undefined ? {} : { hookResult }),
|
|
238
|
+
},
|
|
243
239
|
};
|
|
244
240
|
}
|
|
245
241
|
/**
|
|
@@ -267,7 +263,13 @@ export async function runToolCommandWorker(specPath) {
|
|
|
267
263
|
* rejects cleanly. This is the host CommandSpec handler's body.
|
|
268
264
|
*/
|
|
269
265
|
export async function executeToolCommandWorker(specPath) {
|
|
270
|
-
|
|
266
|
+
const stopHeartbeat = startWorkerHeartbeat();
|
|
267
|
+
try {
|
|
268
|
+
send(await runToolCommandWorker(specPath));
|
|
269
|
+
}
|
|
270
|
+
finally {
|
|
271
|
+
stopHeartbeat();
|
|
272
|
+
}
|
|
271
273
|
}
|
|
272
274
|
/**
|
|
273
275
|
* `__tool-command-worker <specPath>` — the [internal] host subcommand the
|
|
@@ -284,7 +286,12 @@ export const toolCommandWorkerCommandSpec = defineCommand({
|
|
|
284
286
|
description: '[internal] Run one external tool command headless in a forked worker and stream the result over IPC (forked by the ADR-0054 dispatch supervisor)',
|
|
285
287
|
// The supervisor passes `--cwd`; bootstrap uses it to resolve the project.
|
|
286
288
|
commonFlags: ['cwd'],
|
|
287
|
-
args: [
|
|
289
|
+
args: [
|
|
290
|
+
{
|
|
291
|
+
name: 'specPath',
|
|
292
|
+
description: 'Path to the JSON tool-command worker spec file',
|
|
293
|
+
},
|
|
294
|
+
],
|
|
288
295
|
scope: 'project',
|
|
289
296
|
output: 'raw-stream',
|
|
290
297
|
rawStreamReason: 'worker-ipc',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-command-worker-entry.js","sourceRoot":"","sources":["../../src/bootstrap/tool-command-worker-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,gBAAgB,
|
|
1
|
+
{"version":3,"file":"tool-command-worker-entry.js","sourceRoot":"","sources":["../../src/bootstrap/tool-command-worker-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EACL,2BAA2B,EAC3B,cAAc,EACd,YAAY,EACZ,aAAa,EACb,uBAAuB,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,CAAC,KAAK,CAAC,EACtD,aAAa,CAAC,KAAK,CAAC,EACpB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CACjD,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,QAAgB;IAC7D,MAAM,aAAa,GAAG,oBAAoB,EAAE,CAAC;IAC7C,IAAI,CAAC;QACH,IAAI,CAAC,MAAM,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;YAAS,CAAC;QACT,aAAa,EAAE,CAAC;IAClB,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAA6C,aAAa,CAGjG;IACA,IAAI,EAAE,uBAAuB;IAC7B,UAAU,EAAE,UAAU;IACtB,WAAW,EACT,kJAAkJ;IACpJ,2EAA2E;IAC3E,WAAW,EAAE,CAAC,KAAK,CAAC;IACpB,IAAI,EAAE;QACJ;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,gDAAgD;SAC9D;KACF;IACD,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,YAAY;IACpB,eAAe,EAAE,YAAY;IAC7B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAiB,EAAE;QACxC,MAAM,QAAQ,GAAI,OAAyC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7E,MAAM,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tool-command-worker-result — pure result-assembly helpers for the external
|
|
3
|
+
* tool command dispatch WORKER (ADR-0054). These translate the worker-side
|
|
4
|
+
* {@link ResultAccumulator} plus the handler's return value into the
|
|
5
|
+
* serializable {@link ToolCommandResult} the supervisor replays through the
|
|
6
|
+
* host's `dispatchOutput`. They hold no effect and never touch `process` — the
|
|
7
|
+
* orchestration/IPC concerns stay in `tool-command-worker-entry.ts`.
|
|
8
|
+
*/
|
|
9
|
+
import { type CommandSpec, type ToolCliContext, type ToolSessionContribution } from '@opensip-cli/core';
|
|
10
|
+
import { type ResultAccumulator } from './tool-command-worker-context.js';
|
|
11
|
+
import type { ToolCommandResult } from './tool-command-dispatch-types.js';
|
|
12
|
+
/** The completion shape a run-producing handler returns (the session leg the host persists). */
|
|
13
|
+
export interface MaybeCompletion {
|
|
14
|
+
readonly session?: ToolSessionContribution;
|
|
15
|
+
}
|
|
16
|
+
/** Drain the accumulator + the handler's return into a serializable result. */
|
|
17
|
+
export declare function toResult(output: ToolCommandResult['output'], acc: ResultAccumulator, session: ToolSessionContribution | undefined, returned: unknown): ToolCommandResult;
|
|
18
|
+
/**
|
|
19
|
+
* Fail loud when a return-valued handler (`command-result` / `signal-envelope`)
|
|
20
|
+
* neither returned a value nor recorded an explicit final result — a silent
|
|
21
|
+
* `undefined` would otherwise replay as an empty output. Tagged
|
|
22
|
+
* `tool-handler-throw` so the supervisor surfaces a structured failure.
|
|
23
|
+
*/
|
|
24
|
+
export declare function assertReturnValuedHandlerResult(commandSpec: CommandSpec<unknown, ToolCliContext>, acc: ResultAccumulator, returned: unknown): void;
|
|
25
|
+
//# sourceMappingURL=tool-command-worker-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-command-worker-result.d.ts","sourceRoot":"","sources":["../../src/bootstrap/tool-command-worker-result.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC7B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAEnG,gGAAgG;AAChG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,uBAAuB,CAAC;CAC5C;AAaD,+EAA+E;AAC/E,wBAAgB,QAAQ,CACtB,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,EACnC,GAAG,EAAE,iBAAiB,EACtB,OAAO,EAAE,uBAAuB,GAAG,SAAS,EAC5C,QAAQ,EAAE,OAAO,GAChB,iBAAiB,CAenB;AAcD;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC,EACjD,GAAG,EAAE,iBAAiB,EACtB,QAAQ,EAAE,OAAO,GAChB,IAAI,CAQN"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tool-command-worker-result — pure result-assembly helpers for the external
|
|
3
|
+
* tool command dispatch WORKER (ADR-0054). These translate the worker-side
|
|
4
|
+
* {@link ResultAccumulator} plus the handler's return value into the
|
|
5
|
+
* serializable {@link ToolCommandResult} the supervisor replays through the
|
|
6
|
+
* host's `dispatchOutput`. They hold no effect and never touch `process` — the
|
|
7
|
+
* orchestration/IPC concerns stay in `tool-command-worker-entry.ts`.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The output modes whose PAYLOAD is the handler's RETURN value (routed by the
|
|
11
|
+
* in-process `dispatchOutput`): `command-result` (a `CommandResult`) and
|
|
12
|
+
* `signal-envelope` (a `SignalEnvelope`). For these, the worker must carry the
|
|
13
|
+
* return back UNROUTED in `returned` so the supervisor replays it through the SAME
|
|
14
|
+
* `dispatchOutput`. `raw-stream` / `live-view` produce no routable return payload.
|
|
15
|
+
*/
|
|
16
|
+
function isReturnValuedOutput(output) {
|
|
17
|
+
return output === 'command-result' || output === 'signal-envelope';
|
|
18
|
+
}
|
|
19
|
+
/** Drain the accumulator + the handler's return into a serializable result. */
|
|
20
|
+
export function toResult(output, acc, session, returned) {
|
|
21
|
+
return {
|
|
22
|
+
output,
|
|
23
|
+
...(acc.render === undefined ? {} : { render: acc.render }),
|
|
24
|
+
...(acc.envelope === undefined ? {} : { envelope: acc.envelope }),
|
|
25
|
+
...(acc.json === undefined ? {} : { json: acc.json }),
|
|
26
|
+
...(acc.raw === undefined ? {} : { raw: acc.raw }),
|
|
27
|
+
...(acc.error === undefined ? {} : { error: acc.error }),
|
|
28
|
+
...(acc.reportedFailure === undefined ? {} : { reportedFailure: acc.reportedFailure }),
|
|
29
|
+
...(acc.exitCode === undefined ? {} : { exitCode: acc.exitCode }),
|
|
30
|
+
...(session === undefined ? {} : { session }),
|
|
31
|
+
// Carry the handler's return for the return-valued modes so the supervisor
|
|
32
|
+
// routes it via the same `dispatchOutput` the in-process path uses (parity).
|
|
33
|
+
...(returned === undefined || !isReturnValuedOutput(output) ? {} : { returned }),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function hasExplicitFinalResult(acc) {
|
|
37
|
+
return (acc.render !== undefined ||
|
|
38
|
+
acc.envelope !== undefined ||
|
|
39
|
+
acc.json !== undefined ||
|
|
40
|
+
acc.raw !== undefined ||
|
|
41
|
+
acc.error !== undefined ||
|
|
42
|
+
acc.reportedFailure !== undefined ||
|
|
43
|
+
acc.exitCode !== undefined);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Fail loud when a return-valued handler (`command-result` / `signal-envelope`)
|
|
47
|
+
* neither returned a value nor recorded an explicit final result — a silent
|
|
48
|
+
* `undefined` would otherwise replay as an empty output. Tagged
|
|
49
|
+
* `tool-handler-throw` so the supervisor surfaces a structured failure.
|
|
50
|
+
*/
|
|
51
|
+
export function assertReturnValuedHandlerResult(commandSpec, acc, returned) {
|
|
52
|
+
if (!isReturnValuedOutput(commandSpec.output) || returned !== undefined)
|
|
53
|
+
return;
|
|
54
|
+
if (hasExplicitFinalResult(acc))
|
|
55
|
+
return;
|
|
56
|
+
const err = new Error(`tool command worker: command '${commandSpec.name}' declares output '${commandSpec.output}' but its handler returned undefined. Return a value, throw, or call reportFailure.`);
|
|
57
|
+
err.failureClass = 'tool-handler-throw';
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=tool-command-worker-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-command-worker-result.js","sourceRoot":"","sources":["../../src/bootstrap/tool-command-worker-result.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,MAAmC;IAC/D,OAAO,MAAM,KAAK,gBAAgB,IAAI,MAAM,KAAK,iBAAiB,CAAC;AACrE,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,QAAQ,CACtB,MAAmC,EACnC,GAAsB,EACtB,OAA4C,EAC5C,QAAiB;IAEjB,OAAO;QACL,MAAM;QACN,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;QAC3D,GAAG,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;QACjE,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;QACrD,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;QAClD,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;QACxD,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CAC/K,CAAC;IACD,GAAyD,CAAC,YAAY,GAAG,oBAAoB,CAAC;IAC/F,MAAM,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -31,6 +31,12 @@ export declare const PROJECT_TOOL_ALLOWLIST_ENV = "OPENSIP_CLI_ALLOW_PROJECT_TOO
|
|
|
31
31
|
* {@link isInstalledToolTrusted}).
|
|
32
32
|
*/
|
|
33
33
|
export declare const INSTALLED_TOOL_ALLOWLIST_ENV = "OPENSIP_CLI_ALLOW_INSTALLED_TOOLS";
|
|
34
|
+
/**
|
|
35
|
+
* Environment variable carrying the capability-pack allowlist. Unlike the older
|
|
36
|
+
* tool allowlists, this launch surface is exact-name only: wildcard `*` is not
|
|
37
|
+
* honored.
|
|
38
|
+
*/
|
|
39
|
+
export declare const CAPABILITY_PACK_ALLOWLIST_ENV = "OPENSIP_CLI_ALLOW_CAPABILITY_PACKS";
|
|
34
40
|
/**
|
|
35
41
|
* Decide whether a project-local executable tool with the given `id` is
|
|
36
42
|
* trusted to load, under the deny-by-default + allowlist-opt-in policy.
|
|
@@ -66,4 +72,10 @@ export declare function isProjectLocalToolTrusted(id: string, env?: NodeJS.Proce
|
|
|
66
72
|
* @returns `true` iff the allowlist contains `id` or the wildcard `'*'`.
|
|
67
73
|
*/
|
|
68
74
|
export declare function isInstalledToolTrusted(id: string, env?: NodeJS.ProcessEnv): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Decide whether a third-party capability pack may be imported into the host
|
|
77
|
+
* process. First-party bundled packs are handled by the caller; this predicate
|
|
78
|
+
* is exact-name allowlist only and intentionally does not honor `*`.
|
|
79
|
+
*/
|
|
80
|
+
export declare function isCapabilityPackTrusted(packageName: string, env?: NodeJS.ProcessEnv): boolean;
|
|
69
81
|
//# sourceMappingURL=tool-trust.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-trust.d.ts","sourceRoot":"","sources":["../../src/bootstrap/tool-trust.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,oCAAoC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-trust.d.ts","sourceRoot":"","sources":["../../src/bootstrap/tool-trust.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,oCAAoC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,sCAAsC,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,uCAAuC,CAAC;AAuClF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,MAAM,EACV,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAIT;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAIhG;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAIT"}
|
|
@@ -32,8 +32,12 @@ export const PROJECT_TOOL_ALLOWLIST_ENV = 'OPENSIP_CLI_ALLOW_PROJECT_TOOLS';
|
|
|
32
32
|
* {@link isInstalledToolTrusted}).
|
|
33
33
|
*/
|
|
34
34
|
export const INSTALLED_TOOL_ALLOWLIST_ENV = 'OPENSIP_CLI_ALLOW_INSTALLED_TOOLS';
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Environment variable carrying the capability-pack allowlist. Unlike the older
|
|
37
|
+
* tool allowlists, this launch surface is exact-name only: wildcard `*` is not
|
|
38
|
+
* honored.
|
|
39
|
+
*/
|
|
40
|
+
export const CAPABILITY_PACK_ALLOWLIST_ENV = 'OPENSIP_CLI_ALLOW_CAPABILITY_PACKS';
|
|
37
41
|
/**
|
|
38
42
|
* Parse the allowlist env var into a set of permitted tool ids. Empty/
|
|
39
43
|
* unset ⇒ empty set (deny-by-default). The wildcard `'*'` admits all
|
|
@@ -48,13 +52,23 @@ function parseAllowlist(raw) {
|
|
|
48
52
|
.filter((s) => s.length > 0));
|
|
49
53
|
}
|
|
50
54
|
function warnWildcardAllowlist(envVar, allow) {
|
|
51
|
-
if (
|
|
55
|
+
if (!allow.has('*'))
|
|
52
56
|
return;
|
|
53
|
-
wildcardAllowlistWarned = true;
|
|
54
57
|
logger.warn({
|
|
55
58
|
evt: 'cli.trust.wildcard_allowlist',
|
|
56
59
|
envVar,
|
|
57
|
-
|
|
60
|
+
deprecated: true,
|
|
61
|
+
detail: 'DEPRECATED: trust allowlist contains wildcard * — every matching tool runs at full user privilege; ' +
|
|
62
|
+
'this is fault-isolation only, not a sandbox',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function warnIgnoredCapabilityWildcard(allow) {
|
|
66
|
+
if (!allow.has('*'))
|
|
67
|
+
return;
|
|
68
|
+
logger.warn({
|
|
69
|
+
evt: 'cli.trust.capability_wildcard_ignored',
|
|
70
|
+
envVar: CAPABILITY_PACK_ALLOWLIST_ENV,
|
|
71
|
+
detail: 'OPENSIP_CLI_ALLOW_CAPABILITY_PACKS requires exact package names; wildcard * is ignored',
|
|
58
72
|
});
|
|
59
73
|
}
|
|
60
74
|
/**
|
|
@@ -100,4 +114,14 @@ export function isInstalledToolTrusted(id, env = process.env) {
|
|
|
100
114
|
warnWildcardAllowlist(INSTALLED_TOOL_ALLOWLIST_ENV, allow);
|
|
101
115
|
return allow.has('*') || allow.has(id);
|
|
102
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Decide whether a third-party capability pack may be imported into the host
|
|
119
|
+
* process. First-party bundled packs are handled by the caller; this predicate
|
|
120
|
+
* is exact-name allowlist only and intentionally does not honor `*`.
|
|
121
|
+
*/
|
|
122
|
+
export function isCapabilityPackTrusted(packageName, env = process.env) {
|
|
123
|
+
const allow = parseAllowlist(env[CAPABILITY_PACK_ALLOWLIST_ENV]);
|
|
124
|
+
warnIgnoredCapabilityWildcard(allow);
|
|
125
|
+
return allow.has(packageName);
|
|
126
|
+
}
|
|
103
127
|
//# sourceMappingURL=tool-trust.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-trust.js","sourceRoot":"","sources":["../../src/bootstrap/tool-trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,mCAAmC,CAAC;AAEhF
|
|
1
|
+
{"version":3,"file":"tool-trust.js","sourceRoot":"","sources":["../../src/bootstrap/tool-trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,mCAAmC,CAAC;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,oCAAoC,CAAC;AAElF;;;;GAIG;AACH,SAAS,cAAc,CAAC,GAAuB;IAC7C,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,GAAG,EAAE,CAAC;IAC3B,OAAO,IAAI,GAAG,CACZ,GAAG;SACA,KAAK,CAAC,QAAQ,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM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CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAmB,EACnB,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC;IACjE,6BAA6B,CAAC,KAAK,CAAC,CAAC;IACrC,OAAO,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-tool.d.ts","sourceRoot":"","sources":["../../src/bootstrap/validate-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAA6C,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-tool.d.ts","sourceRoot":"","sources":["../../src/bootstrap/validate-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAA6C,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AA8HzF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CA6BxE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEzD"}
|
|
@@ -68,7 +68,10 @@ function aliasesMatchIdentity(commandAliases, identity) {
|
|
|
68
68
|
}
|
|
69
69
|
function commandSpecEntryValidation(spec, identity) {
|
|
70
70
|
if (!validateCommandSpec(spec)) {
|
|
71
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
failure: 'tool.commandSpecs contains an invalid CommandSpec',
|
|
73
|
+
primary: false,
|
|
74
|
+
};
|
|
72
75
|
}
|
|
73
76
|
const command = spec;
|
|
74
77
|
if (command.parent !== undefined && command.parent !== identity.name) {
|
|
@@ -1 +1 @@
|
|
|
1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IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtE,OAAO,uBAAuB,MAAM,CAAE,SAAS,CAAC,QAA+B,CAAC,IAAI,CAAC,oCAAoC,QAAQ,CAAC,IAAI,GAAG,CAAC;IAC5I,CAAC;IAED,MAAM,MAAM,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,CACL,6CAA6C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;YACnE,mEAAmE,CACpE,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,6BAA6B,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IACrF,IAAI,YAAY,KAAK,SAAS;QAAE,OAAO,YAAY,CAAC;IAEpD,OAAO,iCAAiC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,qBAAqB,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;AACpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-context.d.ts","sourceRoot":"","sources":["../src/cli-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"cli-context.d.ts","sourceRoot":"","sources":["../src/cli-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAKL,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAY/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAmB5D,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAExF,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,eAAe,EAAE,CAAC,IAAI,EAAE;QAC/B,aAAa,EAAE,OAAO,CAAC;QACvB,UAAU,EAAE,OAAO,CAAC;KACrB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CAChD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,oBAAoB,CAmG1F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CA4CpE"}
|
package/dist/cli-context.js
CHANGED
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
* lands on `RunScope.datastore`; paths that never touch it never materialise
|
|
17
17
|
* `.runtime/datastore.sqlite`.
|
|
18
18
|
*/
|
|
19
|
-
import { createRunTimer, logger as defaultLogger, } from '@opensip-cli/core';
|
|
19
|
+
import { createRunTimer, currentScope, logger as defaultLogger, } from '@opensip-cli/core';
|
|
20
|
+
import { createWriteArtifactSeam } from './bootstrap/artifact-seams.js';
|
|
20
21
|
import { buildBaselineSeams } from './bootstrap/baseline-seams.js';
|
|
21
22
|
import { buildHostPlanes } from './bootstrap/host-planes.js';
|
|
22
23
|
import { createIoPlane } from './bootstrap/io-plane.js';
|
|
23
24
|
import { createOutputPlane } from './bootstrap/output-plane.js';
|
|
25
|
+
import { createReportFailure } from './bootstrap/report-failure.js';
|
|
24
26
|
import { createRunActionHooks, createRunPlaneFactory, createRunSessionSeam, } from './bootstrap/run-plane.js';
|
|
25
27
|
import { createDatastoreResolver, readScope } from './bootstrap/scope-access.js';
|
|
26
28
|
import { buildStateSeams } from './bootstrap/state-seams.js';
|
|
@@ -54,9 +56,16 @@ export function buildToolCliContext(opts) {
|
|
|
54
56
|
// - governance / entitlements / audit (H1-H3);
|
|
55
57
|
// - effectful egress (cloud sync + `--report-to` + SARIF file sink).
|
|
56
58
|
const projectDatastore = createDatastoreResolver('project-seam', log);
|
|
57
|
-
const baselineSeams = buildBaselineSeams({
|
|
59
|
+
const baselineSeams = buildBaselineSeams({
|
|
60
|
+
getDatastore: projectDatastore,
|
|
61
|
+
logger: log,
|
|
62
|
+
});
|
|
63
|
+
const writeArtifact = createWriteArtifactSeam(log);
|
|
58
64
|
const stateSeams = buildStateSeams({ getDatastore: projectDatastore });
|
|
59
|
-
const hostPlanes = buildHostPlanes({
|
|
65
|
+
const hostPlanes = buildHostPlanes({
|
|
66
|
+
getDatastore: projectDatastore,
|
|
67
|
+
logger: log,
|
|
68
|
+
});
|
|
60
69
|
// Host run-lifecycle plane (host-owned-run-timing Phase 1). The FACTORY holds
|
|
61
70
|
// stable deps only — it must NOT start a lifecycle here. The lifecycle is
|
|
62
71
|
// created inside the command action (mount-command-spec calls `beginRun()`
|
|
@@ -81,6 +90,13 @@ export function buildToolCliContext(opts) {
|
|
|
81
90
|
runPlane,
|
|
82
91
|
runSession,
|
|
83
92
|
});
|
|
93
|
+
const reportFailure = createReportFailure({
|
|
94
|
+
getLogger: () => currentScope()?.logger ?? log,
|
|
95
|
+
setExitCode: outputPlane.setExitCode,
|
|
96
|
+
render: (result) => opts.render(result),
|
|
97
|
+
emitError: outputPlane.emits.emitError,
|
|
98
|
+
getDiagnostics: () => currentScope()?.diagnostics,
|
|
99
|
+
});
|
|
84
100
|
const ctx = {
|
|
85
101
|
get scope() {
|
|
86
102
|
// The pre-action-hook (or explicit runWithScope in tests) enters the
|
|
@@ -93,11 +109,15 @@ export function buildToolCliContext(opts) {
|
|
|
93
109
|
registerLiveView: ioPlane.register,
|
|
94
110
|
renderLive: ioPlane.renderLive,
|
|
95
111
|
maybeOpenReport: opts.maybeOpenReport,
|
|
96
|
-
logger
|
|
112
|
+
get logger() {
|
|
113
|
+
return currentScope()?.logger ?? log;
|
|
114
|
+
},
|
|
115
|
+
reportFailure,
|
|
97
116
|
setExitCode: outputPlane.setExitCode,
|
|
98
117
|
...outputPlane.emits, // emitJson / emitEnvelope / emitError / emitRaw
|
|
99
118
|
deliverSignals: ioPlane.deliverSignals,
|
|
100
119
|
writeSarif: ioPlane.writeSarif,
|
|
120
|
+
writeArtifact,
|
|
101
121
|
// Host baseline/ratchet plane seams (ADR-0036) — persistence + diff + exports.
|
|
102
122
|
saveBaseline: baselineSeams.saveBaseline,
|
|
103
123
|
compareBaseline: baselineSeams.compareBaseline,
|
|
@@ -135,10 +155,20 @@ export function buildToolCliContext(opts) {
|
|
|
135
155
|
export function buildHostDispatchCtx(logger) {
|
|
136
156
|
const log = logger ?? defaultLogger;
|
|
137
157
|
const projectDatastore = createDatastoreResolver('project-seam', log);
|
|
138
|
-
const baselineSeams = buildBaselineSeams({
|
|
158
|
+
const baselineSeams = buildBaselineSeams({
|
|
159
|
+
getDatastore: projectDatastore,
|
|
160
|
+
logger: log,
|
|
161
|
+
});
|
|
162
|
+
const writeArtifact = createWriteArtifactSeam(log);
|
|
139
163
|
const stateSeams = buildStateSeams({ getDatastore: projectDatastore });
|
|
140
|
-
const hostPlanes = buildHostPlanes({
|
|
141
|
-
|
|
164
|
+
const hostPlanes = buildHostPlanes({
|
|
165
|
+
getDatastore: projectDatastore,
|
|
166
|
+
logger: log,
|
|
167
|
+
});
|
|
168
|
+
const outputPlane = createOutputPlane({
|
|
169
|
+
render: deniedHookSeam('render'),
|
|
170
|
+
logger: log,
|
|
171
|
+
});
|
|
142
172
|
const ctx = {
|
|
143
173
|
get scope() {
|
|
144
174
|
return readScope();
|
|
@@ -147,13 +177,17 @@ export function buildHostDispatchCtx(logger) {
|
|
|
147
177
|
registerLiveView: deniedHookSeam('registerLiveView'),
|
|
148
178
|
renderLive: deniedHookSeam('renderLive'),
|
|
149
179
|
maybeOpenReport: deniedHookSeam('maybeOpenReport'),
|
|
150
|
-
logger
|
|
180
|
+
get logger() {
|
|
181
|
+
return currentScope()?.logger ?? log;
|
|
182
|
+
},
|
|
183
|
+
reportFailure: deniedHookSeam('reportFailure'),
|
|
151
184
|
setExitCode: outputPlane.setExitCode,
|
|
152
185
|
...outputPlane.emits,
|
|
153
186
|
// Display-only timing seam (host-owned-run-timing); a hook never records a run.
|
|
154
187
|
runSession: { timing: createRunTimer() },
|
|
155
188
|
deliverSignals: deniedHookSeam('deliverSignals'),
|
|
156
189
|
writeSarif: deniedHookSeam('writeSarif'),
|
|
190
|
+
writeArtifact,
|
|
157
191
|
saveBaseline: baselineSeams.saveBaseline,
|
|
158
192
|
compareBaseline: baselineSeams.compareBaseline,
|
|
159
193
|
exportBaselineSarif: baselineSeams.exportBaselineSarif,
|
package/dist/cli-context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-context.js","sourceRoot":"","sources":["../src/cli-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"cli-context.js","sourceRoot":"","sources":["../src/cli-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,cAAc,EACd,YAAY,EAEZ,MAAM,IAAI,aAAa,GAGxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,4BA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AU;QACrB,UAAU;KACX,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,GAAG,EAAE;QACV,MAAM,IAAI,KAAK,CACb,4BAA4B,IAAI,oDAAoD,CACrF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
* This is intentionally a small, self-contained surface so agents can
|
|
6
6
|
* bootstrap their usage without parsing --help text or source.
|
|
7
7
|
*
|
|
8
|
-
* Future: can be made more dynamic by introspecting live CommandSpecs
|
|
9
|
-
* (see completion.ts for precedent).
|
|
10
|
-
*
|
|
11
8
|
* Command taxonomy (tool-command-surface-taxonomy):
|
|
12
9
|
* - Entry points are keyed by the PUBLIC command path. A `parent`-nested tool
|
|
13
10
|
* verb (the `<tool> <verb>` grammar enabled by `CommandSpec.parent` — e.g.
|
|
@@ -17,9 +14,8 @@
|
|
|
17
14
|
* `*-equivalence-check`) are NEVER catalogued here — the agent-catalog
|
|
18
15
|
* primary surface excludes internal workers (the host-owned tiering pass
|
|
19
16
|
* formalized in Phase 1 filters them when this surface becomes spec-derived).
|
|
20
|
-
* In Phase 0 no tool declares `parent`/`visibility`, so the static catalog below
|
|
21
|
-
* already satisfies both rules (no nested verb, no internal worker is listed).
|
|
22
17
|
*/
|
|
18
|
+
import type { ToolRegistry } from '@opensip-cli/core';
|
|
23
19
|
/**
|
|
24
20
|
* The command-taxonomy tier an entry point belongs to
|
|
25
21
|
* (tool-command-surface-taxonomy). `'platform'` = host-owned Tier-1 commands
|
|
@@ -57,9 +53,14 @@ export interface AgentCatalog {
|
|
|
57
53
|
};
|
|
58
54
|
readonly notes: readonly string[];
|
|
59
55
|
}
|
|
60
|
-
export declare function buildAgentCatalog(
|
|
56
|
+
export declare function buildAgentCatalog(input?: {
|
|
57
|
+
readonly tools?: ToolRegistry;
|
|
58
|
+
readonly internalCommands?: ReadonlySet<string>;
|
|
59
|
+
}): AgentCatalog;
|
|
61
60
|
export declare function executeAgentCatalog(opts?: {
|
|
62
|
-
json?: boolean;
|
|
61
|
+
readonly json?: boolean;
|
|
62
|
+
readonly tools?: ToolRegistry;
|
|
63
|
+
readonly internalCommands?: ReadonlySet<string>;
|
|
63
64
|
}): {
|
|
64
65
|
type: string;
|
|
65
66
|
catalog: AgentCatalog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-catalog.d.ts","sourceRoot":"","sources":["../../src/commands/agent-catalog.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-catalog.d.ts","sourceRoot":"","sources":["../../src/commands/agent-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAqB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACzE;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,SAAS;QAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;QACrC;;;;;;WAMG;QACH,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;KAC7B,EAAE,CAAC;IACJ,QAAQ,CAAC,cAAc,EAAE,SAAS;QAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KAC1B,EAAE,CAAC;IACJ,QAAQ,CAAC,YAAY,EAAE;QACrB,QAAQ,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