@aiwg/cli 2026.11.5 → 2026.11.6
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/agentic/code/providers/model-capabilities.v1.json +9 -9
- package/bin/aiwg.mjs +6 -4
- package/dist/src/activity-log/cli.js +1 -1
- package/dist/src/agents/agent-deployer.js +1 -1
- package/dist/src/artifacts/audit/types.js +1 -1
- package/dist/src/artifacts/discover-facets.js +1 -1
- package/dist/src/artifacts/enrichment/prompt.js +1 -1
- package/dist/src/artifacts/enrichment/types.js +1 -1
- package/dist/src/artifacts/views/definition.js +1 -1
- package/dist/src/artifacts/views/types.js +1 -1
- package/dist/src/catalog/cli.js +1 -1
- package/dist/src/catalog/cli.mjs +1 -1
- package/dist/src/catalog/loader.js +1 -1
- package/dist/src/catalog/loader.mjs +1 -1
- package/dist/src/catalog/types.js +1 -1
- package/dist/src/cli/cli-extension-loader.js +19 -5
- package/dist/src/cli/cli-extension-paths.js +65 -0
- package/dist/src/cli/handlers/best-practices-audit.js +1 -1
- package/dist/src/cli/handlers/help.js +3 -4
- package/dist/src/cli/handlers/index.js +1 -1
- package/dist/src/cli/handlers/marketplace-plugin-search.js +37 -0
- package/dist/src/cli/handlers/marketplace.js +3 -1
- package/dist/src/cli/handlers/models.js +1 -1
- package/dist/src/cli/handlers/ralph-launcher.js +8 -2
- package/dist/src/cli/handlers/ralph.js +1 -1
- package/dist/src/cli/handlers/runtime-info.js +1 -1
- package/dist/src/cli/handlers/scaffolding.js +2 -2
- package/dist/src/cli/handlers/script-runner.js +1 -1
- package/dist/src/cli/handlers/sdlc-accelerate.js +1 -1
- package/dist/src/cli/handlers/subcommands-bundles.js +1 -1
- package/dist/src/cli/handlers/subcommands-list-format.js +19 -1
- package/dist/src/cli/handlers/types.js +1 -1
- package/dist/src/cli/handlers/use.js +2 -2
- package/dist/src/cli/handlers/utilities.js +1 -1
- package/dist/src/cli/handlers/version.js +1 -1
- package/dist/src/cli/handlers/workspace.js +1 -1
- package/dist/src/cli/help-generator.js +9 -11
- package/dist/src/cli/hooks/builtin/activity-log-hook.js +1 -1
- package/dist/src/cli/router.js +1 -1
- package/dist/src/cli/workflow-orchestrator.js +1 -1
- package/dist/src/config/worker-context.js +37 -7
- package/dist/src/config/worker-parallelism.js +11 -0
- package/dist/src/contributors/detect.js +1 -1
- package/dist/src/contributors/discover.js +1 -1
- package/dist/src/contributors/heuristic.js +1 -1
- package/dist/src/contributors/index.js +1 -1
- package/dist/src/contributors/types.js +1 -1
- package/dist/src/contributors/validation.js +1 -1
- package/dist/src/effects/worker-delivery.js +83 -0
- package/dist/src/extensions/capability-index.js +1 -1
- package/dist/src/extensions/commands/definitions.js +2 -2
- package/dist/src/extensions/deployment-registration.js +1 -1
- package/dist/src/extensions/index.js +1 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/manifest.js +4 -2
- package/dist/src/extensions/project-local-activity.js +1 -1
- package/dist/src/extensions/project-local-discovery.js +2 -2
- package/dist/src/extensions/project-local-doctor.js +7 -3
- package/dist/src/extensions/project-local-promote.js +3 -3
- package/dist/src/extensions/project-local-remove.js +3 -3
- package/dist/src/extensions/project-local-scaffold.js +1 -1
- package/dist/src/extensions/registry.js +1 -1
- package/dist/src/extensions/shadow-resolver.js +1 -1
- package/dist/src/extensions/types.js +1 -1
- package/dist/src/extensions/upstream-registry.js +1 -1
- package/dist/src/extensions/validation.js +1 -1
- package/dist/src/intake/git-history-analyzer.js +1 -1
- package/dist/src/kb/cli.js +1 -1
- package/dist/src/marketplace/plugin-directory.js +36 -0
- package/dist/src/marketplace/plugin-search.js +180 -0
- package/dist/src/mcp/cli.mjs +2 -2
- package/dist/src/mcp/helpers.mjs +1 -1
- package/dist/src/mcp/http-tools.mjs +8 -6
- package/dist/src/mcp/http-transport.mjs +3 -1
- package/dist/src/mcp/server.mjs +1 -1
- package/dist/src/mcp/tools/command-run.mjs +1 -1
- package/dist/src/mcp/tools/discovery.mjs +1 -1
- package/dist/src/mcp/tools/subsystems.mjs +1 -1
- package/dist/src/mcp/tools/worker-invoke.mjs +68 -22
- package/dist/src/mcp/tools/worker-local-only-preflight.mjs +79 -0
- package/dist/src/mcp/tools/worker-recorded-launch.mjs +26 -0
- package/dist/src/mcp/tools/worker-stdin-runtime.mjs +33 -6
- package/dist/src/mcp/tools/worker-verify-deliver-schema.mjs +33 -0
- package/dist/src/mcp/tools/worker-verify-deliver.mjs +27 -0
- package/dist/src/models/catalog-policy.js +2 -2
- package/dist/src/models/conductor-data-policy.mjs +83 -14
- package/dist/src/models/config-loader.js +2 -2
- package/dist/src/models/index.js +2 -2
- package/dist/src/models/local-endpoint-models.js +155 -0
- package/dist/src/models/model-capabilities.v1.json +9 -9
- package/dist/src/models/model-discovery.js +9 -5
- package/dist/src/models/opencode-worker-model.mjs +16 -0
- package/dist/src/models/resolver.js +2 -2
- package/dist/src/models/worker-installation.mjs +5 -3
- package/dist/src/models/worker-plan.js +1 -1
- package/dist/src/plugin/plugin-installer.js +2 -2
- package/dist/src/plugin/registry-validator.js +2 -2
- package/dist/src/plugin/skill-command-translator.js +1 -1
- package/dist/src/rlm/cache/hash.js +1 -1
- package/dist/src/rlm/cache/store.js +1 -1
- package/dist/src/rlm/cache/types.js +1 -1
- package/dist/src/serve/worker-invocation-preparation.js +13 -0
- package/dist/src/serve/worker-invocation.js +21 -6
- package/dist/src/skills/run.js +0 -11
- package/dist/src/smiths/agentsmith/generator.js +1 -1
- package/dist/src/smiths/context-pipeline/index.js +1 -1
- package/dist/src/smiths/context-pipeline/provider-policy.js +1 -1
- package/dist/src/smiths/context-pipeline/types.js +1 -1
- package/dist/src/smiths/mcpsmith/analyzers/cli-analyzer.js +2 -2
- package/dist/src/smiths/mcpsmith/generator.js +2 -2
- package/dist/src/smiths/mcpsmith/index.js +2 -2
- package/dist/src/smiths/mcpsmith/types.js +2 -2
- package/dist/src/smiths/skillsmith/collision-detector.js +1 -1
- package/dist/src/smiths/skillsmith/namespace-adapter.js +1 -1
- package/dist/src/smiths/toolsmith/runtime-discovery.mjs +2 -2
- package/dist/src/smiths/toolsmith/types.js +2 -2
- package/dist/src/storage/backends/fortemi.js +1 -1
- package/dist/src/storage/backends/fs.js +1 -1
- package/dist/src/storage/backends/logseq.js +1 -1
- package/dist/src/storage/backends/obsidian.js +1 -1
- package/dist/src/storage/cli.js +2 -2
- package/dist/src/storage/config.js +1 -1
- package/dist/src/storage/index.js +1 -1
- package/dist/src/storage/subsystem-cli.js +1 -1
- package/dist/src/storage/types.js +1 -1
- package/dist/src/testing/generators/test-case-generator.js +1 -1
- package/dist/src/writing/validation-engine.js +1 -1
- package/package.json +11 -1
- package/schemas/models/model-catalog.v1.schema.json +6 -3
- package/tools/agents/providers/conductor-data-guard.mjs +1 -1
- package/tools/ralph-external/lib/mcp-worker-launch.mjs +67 -0
- package/tools/ralph-external/lib/opencode-adapter.mjs +9 -7
- package/tools/ralph-external/lib/trusted-verification.mjs +1021 -0
- package/tools/ralph-external/lib/typed-stop-delivery.mjs +46 -0
- package/tools/ralph-external/lib/verification-isolation.mjs +509 -0
- package/tools/ralph-external/lib/worker-context.mjs +3 -3
- package/tools/ralph-external/lib/worker-delivery-guards.mjs +95 -0
- package/tools/ralph-external/lib/worker-delivery-record.mjs +15 -0
- package/tools/ralph-external/lib/worker-final.mjs +4 -1
- package/tools/ralph-external/lib/worker-isolation-status.mjs +3 -0
- package/tools/ralph-external/lib/worker-launch-cli.mjs +8 -0
- package/tools/ralph-external/lib/worker-local-only-paths.mjs +45 -0
- package/tools/ralph-external/lib/worker-prompt.mjs +4 -1
- package/tools/ralph-external/lib/worker-retry-evidence.mjs +2 -1
- package/tools/ralph-external/lib/worker-run-directory.mjs +45 -0
- package/tools/ralph-external/lib/worker-unit-cleanup.mjs +10 -2
- package/tools/ralph-external/lib/worker-verification-cli.mjs +164 -0
- package/tools/ralph-external/lib/worktree-preparation.mjs +417 -0
- package/tools/ralph-external/session-launcher.mjs +8 -15
- package/vscode-extension/schemas/aiwg.config.v1.json +27 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module src/testing/generators/test-case-generator
|
|
8
8
|
* @implements @.aiwg/requirements/use-cases/UC-009-generate-test-artifacts.md
|
|
9
|
-
* @architecture
|
|
9
|
+
* @architecture @docs/architecture/cli/index.md
|
|
10
10
|
* @nfr @.aiwg/requirements/nfr-modules/performance.md - NFR-TEST-01 (<10min for 100 reqs)
|
|
11
11
|
* @tests @test/unit/testing/test-case-generator.test.ts
|
|
12
12
|
* @depends @src/testing/generators/use-case-parser.ts
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Pattern matches and legacy scores do not establish human or machine authorship.
|
|
6
6
|
*
|
|
7
7
|
* @implements @.aiwg/requirements/use-cases/UC-001-validate-ai-generated-content.md
|
|
8
|
-
* @architecture
|
|
8
|
+
* @architecture @docs/architecture/cli/index.md
|
|
9
9
|
* @nfr @.aiwg/requirements/nfr-modules/performance.md - NFR-PERF-001 (<60s validation)
|
|
10
10
|
* @nfr @.aiwg/requirements/nfr-modules/accuracy.md - NFR-ACC-001 (<5% false positives)
|
|
11
11
|
* @tests @test/unit/writing/validation-engine.test.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwg/cli",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.6",
|
|
4
4
|
"description": "Lightweight AIWG CLI for signed, versioned web-backed resources.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,9 +67,17 @@
|
|
|
67
67
|
"tools/ralph-external/lib/worker-inputs.mjs",
|
|
68
68
|
"tools/ralph-external/lib/worker-final.mjs",
|
|
69
69
|
"tools/ralph-external/lib/worker-prompt.mjs",
|
|
70
|
+
"tools/ralph-external/lib/worker-verification-cli.mjs",
|
|
71
|
+
"tools/ralph-external/lib/worker-delivery-guards.mjs",
|
|
72
|
+
"tools/ralph-external/lib/typed-stop-delivery.mjs",
|
|
73
|
+
"tools/ralph-external/lib/trusted-verification.mjs",
|
|
74
|
+
"tools/ralph-external/lib/verification-isolation.mjs",
|
|
75
|
+
"tools/ralph-external/lib/worker-delivery-record.mjs",
|
|
76
|
+
"tools/ralph-external/lib/mcp-worker-launch.mjs",
|
|
70
77
|
"tools/ralph-external/lib/worker-capture.mjs",
|
|
71
78
|
"tools/ralph-external/lib/worker-launch-cli.mjs",
|
|
72
79
|
"tools/ralph-external/lib/worker-run-directory-refusal.mjs",
|
|
80
|
+
"tools/ralph-external/lib/worker-run-directory.mjs",
|
|
73
81
|
"tools/ralph-external/lib/worker-isolation.mjs",
|
|
74
82
|
"tools/ralph-external/lib/worker-isolation-args.mjs",
|
|
75
83
|
"tools/ralph-external/lib/worker-unit-cleanup.mjs",
|
|
@@ -81,6 +89,8 @@
|
|
|
81
89
|
"tools/ralph-external/lib/worker-invocation-processes.mjs",
|
|
82
90
|
"tools/ralph-external/lib/worker-invocation-ancestry.mjs",
|
|
83
91
|
"tools/ralph-external/lib/worker-context.mjs",
|
|
92
|
+
"tools/ralph-external/lib/worktree-preparation.mjs",
|
|
93
|
+
"tools/ralph-external/lib/worker-local-only-paths.mjs",
|
|
84
94
|
"tools/ralph-external/lib/systemd-client.mjs",
|
|
85
95
|
"tools/ralph-external/lib/consecutive-failure-circuit-breaker.mjs",
|
|
86
96
|
"tools/ralph-external/lib/launcher-recovery-evidence.mjs",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"additionalProperties": false,
|
|
52
52
|
"required": ["source", "fetchedAt", "providers"],
|
|
53
53
|
"properties": {
|
|
54
|
-
"source": { "enum": ["native", "cache", "remote", "static"] },
|
|
55
|
-
"upstreamSource": { "enum": ["native", "remote", "static"] },
|
|
54
|
+
"source": { "enum": ["native", "cache", "remote", "static", "local-endpoint"] },
|
|
55
|
+
"upstreamSource": { "enum": ["native", "remote", "static", "local-endpoint"] },
|
|
56
56
|
"fetchedAt": { "type": "string", "format": "date-time" },
|
|
57
57
|
"remoteUrl": { "type": "string", "format": "uri" },
|
|
58
58
|
"remoteError": { "type": "string" },
|
|
@@ -92,6 +92,9 @@
|
|
|
92
92
|
"family": { "type": "string", "minLength": 1 },
|
|
93
93
|
"runtimeVersion": { "type": "string", "minLength": 1 },
|
|
94
94
|
"accountScope": { "type": "string", "minLength": 1 },
|
|
95
|
+
"endpoint": { "type": "string", "format": "uri" },
|
|
96
|
+
"checkpoint": { "type": "string", "minLength": 1 },
|
|
97
|
+
"unavailableReason": { "enum": ["endpoint-down", "timeout", "unauthorized", "model-missing", "invalid-response", "host-denied", "auth-env-missing"] },
|
|
95
98
|
"endpointFingerprint": { "type": "string", "minLength": 1 },
|
|
96
99
|
"observedAt": { "type": "string", "minLength": 1, "format": "date-time" },
|
|
97
100
|
"verifiedAt": { "type": "string", "minLength": 1, "format": "date-time" },
|
|
@@ -301,7 +304,7 @@
|
|
|
301
304
|
"required": ["provider", "source", "observedAt", "accountScope", "models"],
|
|
302
305
|
"properties": {
|
|
303
306
|
"provider": { "type": "string" },
|
|
304
|
-
"source": { "enum": ["native", "cache", "remote", "static"] },
|
|
307
|
+
"source": { "enum": ["native", "cache", "remote", "static", "local-endpoint"] },
|
|
305
308
|
"observedAt": { "type": "string", "format": "date-time" },
|
|
306
309
|
"runtimeVersion": { "type": "string" },
|
|
307
310
|
"accountScope": { "enum": ["local-account", "local-runtime", "public-feed", "static"] },
|
|
@@ -80,6 +80,6 @@ export async function deployConductorDataGuard(targetDir, provider, opts = {}) {
|
|
|
80
80
|
fs.mkdirSync(path.dirname(rulesPath), { recursive: true });
|
|
81
81
|
fs.writeFileSync(rulesPath, lines.join('\n') + '\n');
|
|
82
82
|
}
|
|
83
|
-
console.log(`Conductor guard (${provider}): ${paths.join(', ')}${executionGuard ? '; worker execution checks enabled' : ''}; shell coverage is limited.`);
|
|
83
|
+
console.log(`Conductor guard (${provider}): ${paths.join(', ')}${executionGuard ? '; worker execution/integration checks enabled' : ''}; shell coverage is limited.`);
|
|
84
84
|
return paths;
|
|
85
85
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Adapt MCP shell dispatch to the same one-shot launch and capture owner as --launch-worker.
|
|
2
|
+
import { mkdtemp, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { SessionLauncher, planDirectWorkerLaunch } from '../session-launcher.mjs';
|
|
5
|
+
import { checkWorkerDispatch, launchIsolatedWorker } from './worker-isolation.mjs';
|
|
6
|
+
|
|
7
|
+
// The capture owner's attached launch connects stdio itself, so the planner must not default capture
|
|
8
|
+
// paths from the invocation; systemd-run refuses attached mode with redirects (#4157).
|
|
9
|
+
function attachedInvocation(invocation) {
|
|
10
|
+
return { ...invocation, stdoutPath: undefined, stderrPath: undefined, briefPath: undefined };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function launchMcpShellWorker(invocation, { plan, invocationId, releaseOutput, runDir, servedRoot,
|
|
14
|
+
loadInputs, now, onRunDir, memoryMaxGb = 2, allowDegraded, admission, dispatchGuard,
|
|
15
|
+
live, readers, thresholdOverlay, isolation, spawn, spawnAsync }) {
|
|
16
|
+
if (!Number.isFinite(memoryMaxGb) || memoryMaxGb <= 0) throw new Error('Worker isolation requires a positive memoryMaxGb ceiling');
|
|
17
|
+
const parent = await mkdtemp(join(servedRoot, '.worker-run-'));
|
|
18
|
+
runDir ??= join(parent, 'run');
|
|
19
|
+
const invocationPath = join(parent, 'plan.json');
|
|
20
|
+
await writeFile(invocationPath, JSON.stringify(plan), { flag: 'wx', mode: 0o600 });
|
|
21
|
+
onRunDir(runDir);
|
|
22
|
+
await releaseOutput(); // The launcher exclusively reserves every output before spawning.
|
|
23
|
+
const owner = new SessionLauncher();
|
|
24
|
+
let launch;
|
|
25
|
+
let attempt;
|
|
26
|
+
let resolveStarted;
|
|
27
|
+
const started = new Promise(resolve => { resolveStarted = resolve; });
|
|
28
|
+
owner.once('launched', () => resolveStarted(launch));
|
|
29
|
+
const completion = owner.launchWorker({ invocationPath, invocationId, runDir, loadInputs, now: () => now().toISOString(),
|
|
30
|
+
projectRoot: servedRoot, memoryMaxGb, allowDegraded, scopedBreaker: null, isolation,
|
|
31
|
+
checkDispatch: options => checkWorkerDispatch({ ...options, live, readers, thresholdOverlay }),
|
|
32
|
+
launchIsolated: async options => {
|
|
33
|
+
const onSpawnAttempt = value => { attempt = value; };
|
|
34
|
+
// The MCP bridge retains its single recovery admission and leaf dispatch guard.
|
|
35
|
+
launch = await (admission === undefined
|
|
36
|
+
? launchIsolatedWorker({ ...options, spawn, spawnAsync, onSpawnAttempt })
|
|
37
|
+
: planDirectWorkerLaunch({ ...options, invocation: options.attached ? attachedInvocation(invocation) : invocation, invocationId, admission, dispatchGuard,
|
|
38
|
+
live, readers, thresholdOverlay, spawn, spawnAsync, onSpawnAttempt }));
|
|
39
|
+
launch.child?.once('close', (exitCode, signalCode) => {
|
|
40
|
+
launch.spawnObservation = { closed: true, exitCode, signalCode };
|
|
41
|
+
});
|
|
42
|
+
return launch;
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
// Observe rejection immediately; preparation failures must never strand MCP admission.
|
|
46
|
+
const settled = completion.then(() => launch, error => {
|
|
47
|
+
error.launchAttempted = !!(launch?.child?.pid || launch?.unit || attempt?.child?.pid || attempt?.unit);
|
|
48
|
+
throw error;
|
|
49
|
+
});
|
|
50
|
+
const result = await Promise.race([started, settled]);
|
|
51
|
+
// A transport's close cannot override the capture owner's descendant proof.
|
|
52
|
+
const stop = () => { if (!owner.workerStop) return false; owner.workerStop(); return true; };
|
|
53
|
+
const outcome = async () => { const value = await completion; return { ...value, stopped: !!value.cancelled }; };
|
|
54
|
+
const control = {
|
|
55
|
+
stop: async () => stop(),
|
|
56
|
+
stopAndConfirm: async () => { stop(); return outcome(); },
|
|
57
|
+
wait: async (deadlineMs, { deadlineAtMs, nowMs = () => performance.now() } = {}) => {
|
|
58
|
+
const remaining = Math.max(0, Math.min(deadlineMs, (deadlineAtMs ?? Infinity) - nowMs()));
|
|
59
|
+
const timer = setTimeout(() => owner.workerStop?.('HARD_DEADLINE'), remaining);
|
|
60
|
+
try { return await outcome(); } finally { clearTimeout(timer); }
|
|
61
|
+
},
|
|
62
|
+
dispose() {},
|
|
63
|
+
};
|
|
64
|
+
return { ...result, runDir, launchAttempted: !!(result?.child?.pid || result?.unit),
|
|
65
|
+
ownedGroup: result?.ownedGroup ?? (['native-sandbox', 'degraded'].includes(result?.mode) && !!result?.pid),
|
|
66
|
+
control, cleanup: () => settled };
|
|
67
|
+
}
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Version-bound direct-worker surface (roctinam/aiwg#2904, B-OG-39).
|
|
31
|
+
* npm 1.x uses separate --variant (1.19.0 help, titan, 2026-11-15);
|
|
32
|
+
* installer 2.x uses #variant. Other flags and qualification stay unchanged.
|
|
31
33
|
*
|
|
32
34
|
* Qualified against OpenCode CLI 2.0.26 `opencode --help` / `opencode run
|
|
33
35
|
* --help` (help/version syntax captured on host 'noodle' 2026-10-10; see
|
|
@@ -91,7 +93,9 @@
|
|
|
91
93
|
import { ProviderAdapter, registerProvider } from './provider-adapter.mjs';
|
|
92
94
|
import { classifyWorkerHealthFailure, healthEventMatchesBinding } from './worker-health.mjs';
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
import { importImpl } from '../../_resolve-impl.mjs';
|
|
97
|
+
const { opencodeWorkerModelArgs, OPENCODE_SUPPORTED_VERSIONS } = await importImpl(import.meta.url, 'models/opencode-worker-model.mjs');
|
|
98
|
+
export { OPENCODE_SUPPORTED_VERSIONS };
|
|
95
99
|
/** Stdin is confirmed unsupported by the compiled v2.0.26 `run` chunk (see
|
|
96
100
|
* module doc); the brief travels via `-f`/`--file` instead. */
|
|
97
101
|
export const OPENCODE_DIRECT_STDIN = 'closed';
|
|
@@ -186,7 +190,7 @@ export class OpenCodeAdapter extends ProviderAdapter {
|
|
|
186
190
|
/**
|
|
187
191
|
* Driver-owned argv after the binary for the version-bound direct-shell
|
|
188
192
|
* profile. Every control is explicit: exact observed model via `-m`
|
|
189
|
-
* (with
|
|
193
|
+
* (with effort as `--variant` on 1.x or `#<variant>` on 2.x),
|
|
190
194
|
* `--format json` for the evidenced JSONL stream, and the brief as an
|
|
191
195
|
* attached file via `-f` (no stdin transport is evidenced; see the
|
|
192
196
|
* module doc comment) — the positional argument is always the fixed,
|
|
@@ -194,7 +198,7 @@ export class OpenCodeAdapter extends ProviderAdapter {
|
|
|
194
198
|
* externally-enforced is refused rather than guessed, since it has no
|
|
195
199
|
* evidenced CLI mapping.
|
|
196
200
|
*
|
|
197
|
-
* @param {{ selected?: { model?: unknown, effort?: { value?: unknown } }, cwd?: unknown, briefPath?: unknown }} invocation
|
|
201
|
+
* @param {{ cliVersion?: string, selected?: { model?: unknown, effort?: { value?: unknown } }, cwd?: unknown, briefPath?: unknown }} invocation
|
|
198
202
|
* @param {unknown} _profile
|
|
199
203
|
* @param {{ sandbox?: unknown }} [permissions]
|
|
200
204
|
* @returns {string[]}
|
|
@@ -207,18 +211,16 @@ export class OpenCodeAdapter extends ProviderAdapter {
|
|
|
207
211
|
if (OPENCODE_GENERIC_ALIASES.includes(model.toLowerCase())) {
|
|
208
212
|
throw new Error(`OpenCode worker requires an exact observed model, not the generic alias '${model}'`);
|
|
209
213
|
}
|
|
210
|
-
// #variant
|
|
214
|
+
// #variant (2.x) / --variant (1.x) selects reasoning effort (see module
|
|
211
215
|
// doc), but the valid id set is model-specific and not enumerated here,
|
|
212
216
|
// so a syntactically valid id is appended. Whether the real CLI refuses
|
|
213
217
|
// an undeclared id or silently falls back is unverified (effort stays
|
|
214
218
|
// unqualified).
|
|
215
219
|
const effort = invocation?.selected?.effort?.value ?? null;
|
|
216
|
-
let modelToken = model;
|
|
217
220
|
if (effort !== null) {
|
|
218
221
|
if (typeof effort !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(effort)) {
|
|
219
222
|
throw new Error('OpenCode worker effort must be a plain variant id (no "#", "/", whitespace or control characters)');
|
|
220
223
|
}
|
|
221
|
-
modelToken = `${model}#${effort}`;
|
|
222
224
|
}
|
|
223
225
|
const sandbox = permissions?.sandbox ?? 'external';
|
|
224
226
|
if (!OPENCODE_DIRECT_SANDBOX_MODES.includes(sandbox)) {
|
|
@@ -234,7 +236,7 @@ export class OpenCodeAdapter extends ProviderAdapter {
|
|
|
234
236
|
if (typeof briefPath !== 'string' || !briefPath.startsWith('/') || briefPath.includes('\0')) {
|
|
235
237
|
throw new Error('OpenCode worker requires an absolute brief-file path');
|
|
236
238
|
}
|
|
237
|
-
return ['run', '--format', 'json',
|
|
239
|
+
return ['run', '--format', 'json', ...opencodeWorkerModelArgs(model, effort, invocation.cliVersion), '-f', briefPath, OPENCODE_FIXED_MESSAGE];
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
/** No evidenced stdin abort channel for `opencode run`. */
|