@the-open-engine/zeroshot 6.3.0 → 6.5.0
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/cli/commands/providers.js +11 -5
- package/cli/index.js +83 -17
- package/cli/lib/first-run.js +14 -3
- package/docker/zeroshot-cluster/Dockerfile +11 -1
- package/lib/agent-cli-provider/acp-stdio-runner.d.ts +4 -0
- package/lib/agent-cli-provider/acp-stdio-runner.d.ts.map +1 -0
- package/lib/agent-cli-provider/acp-stdio-runner.js +259 -0
- package/lib/agent-cli-provider/acp-stdio-runner.js.map +1 -0
- package/lib/agent-cli-provider/adapters/acp.d.ts +23 -0
- package/lib/agent-cli-provider/adapters/acp.d.ts.map +1 -0
- package/lib/agent-cli-provider/adapters/acp.js +373 -0
- package/lib/agent-cli-provider/adapters/acp.js.map +1 -0
- package/lib/agent-cli-provider/adapters/claude.d.ts.map +1 -1
- package/lib/agent-cli-provider/adapters/claude.js +2 -29
- package/lib/agent-cli-provider/adapters/claude.js.map +1 -1
- package/lib/agent-cli-provider/adapters/copilot-parser.d.ts +3 -0
- package/lib/agent-cli-provider/adapters/copilot-parser.d.ts.map +1 -0
- package/lib/agent-cli-provider/adapters/copilot-parser.js +154 -0
- package/lib/agent-cli-provider/adapters/copilot-parser.js.map +1 -0
- package/lib/agent-cli-provider/adapters/copilot.d.ts +3 -0
- package/lib/agent-cli-provider/adapters/copilot.d.ts.map +1 -0
- package/lib/agent-cli-provider/adapters/copilot.js +176 -0
- package/lib/agent-cli-provider/adapters/copilot.js.map +1 -0
- package/lib/agent-cli-provider/adapters/gateway.d.ts +6 -0
- package/lib/agent-cli-provider/adapters/gateway.d.ts.map +1 -0
- package/lib/agent-cli-provider/adapters/gateway.js +161 -0
- package/lib/agent-cli-provider/adapters/gateway.js.map +1 -0
- package/lib/agent-cli-provider/adapters/gemini.d.ts.map +1 -1
- package/lib/agent-cli-provider/adapters/gemini.js +9 -2
- package/lib/agent-cli-provider/adapters/gemini.js.map +1 -1
- package/lib/agent-cli-provider/adapters/index.d.ts.map +1 -1
- package/lib/agent-cli-provider/adapters/index.js +6 -34
- package/lib/agent-cli-provider/adapters/index.js.map +1 -1
- package/lib/agent-cli-provider/adapters/opencode.d.ts.map +1 -1
- package/lib/agent-cli-provider/adapters/opencode.js +5 -1
- package/lib/agent-cli-provider/adapters/opencode.js.map +1 -1
- package/lib/agent-cli-provider/adapters/pi.d.ts +3 -0
- package/lib/agent-cli-provider/adapters/pi.d.ts.map +1 -0
- package/lib/agent-cli-provider/adapters/pi.js +331 -0
- package/lib/agent-cli-provider/adapters/pi.js.map +1 -0
- package/lib/agent-cli-provider/claude-command.d.ts +6 -0
- package/lib/agent-cli-provider/claude-command.d.ts.map +1 -0
- package/lib/agent-cli-provider/claude-command.js +43 -0
- package/lib/agent-cli-provider/claude-command.js.map +1 -0
- package/lib/agent-cli-provider/contract-actions.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-actions.js +13 -17
- package/lib/agent-cli-provider/contract-actions.js.map +1 -1
- package/lib/agent-cli-provider/contract-invoke.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-invoke.js +10 -3
- package/lib/agent-cli-provider/contract-invoke.js.map +1 -1
- package/lib/agent-cli-provider/contract-options.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-options.js +57 -2
- package/lib/agent-cli-provider/contract-options.js.map +1 -1
- package/lib/agent-cli-provider/contract-support.d.ts +1 -0
- package/lib/agent-cli-provider/contract-support.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-support.js +25 -3
- package/lib/agent-cli-provider/contract-support.js.map +1 -1
- package/lib/agent-cli-provider/errors.d.ts +1 -0
- package/lib/agent-cli-provider/errors.d.ts.map +1 -1
- package/lib/agent-cli-provider/errors.js +14 -5
- package/lib/agent-cli-provider/errors.js.map +1 -1
- package/lib/agent-cli-provider/gateway-client.d.ts +32 -0
- package/lib/agent-cli-provider/gateway-client.d.ts.map +1 -0
- package/lib/agent-cli-provider/gateway-client.js +135 -0
- package/lib/agent-cli-provider/gateway-client.js.map +1 -0
- package/lib/agent-cli-provider/gateway-runner.d.ts +9 -0
- package/lib/agent-cli-provider/gateway-runner.d.ts.map +1 -0
- package/lib/agent-cli-provider/gateway-runner.js +294 -0
- package/lib/agent-cli-provider/gateway-runner.js.map +1 -0
- package/lib/agent-cli-provider/gateway-tools.d.ts +14 -0
- package/lib/agent-cli-provider/gateway-tools.d.ts.map +1 -0
- package/lib/agent-cli-provider/gateway-tools.js +495 -0
- package/lib/agent-cli-provider/gateway-tools.js.map +1 -0
- package/lib/agent-cli-provider/index.d.ts +3 -2
- package/lib/agent-cli-provider/index.d.ts.map +1 -1
- package/lib/agent-cli-provider/index.js +14 -1
- package/lib/agent-cli-provider/index.js.map +1 -1
- package/lib/agent-cli-provider/invoke-evidence.d.ts +2 -2
- package/lib/agent-cli-provider/invoke-evidence.d.ts.map +1 -1
- package/lib/agent-cli-provider/invoke-evidence.js +17 -3
- package/lib/agent-cli-provider/invoke-evidence.js.map +1 -1
- package/lib/agent-cli-provider/provider-registry.d.ts +437 -0
- package/lib/agent-cli-provider/provider-registry.d.ts.map +1 -0
- package/lib/agent-cli-provider/provider-registry.js +411 -0
- package/lib/agent-cli-provider/provider-registry.js.map +1 -0
- package/lib/agent-cli-provider/single-agent-runtime.d.ts +7 -0
- package/lib/agent-cli-provider/single-agent-runtime.d.ts.map +1 -1
- package/lib/agent-cli-provider/single-agent-runtime.js +139 -19
- package/lib/agent-cli-provider/single-agent-runtime.js.map +1 -1
- package/lib/agent-cli-provider/types.d.ts +106 -4
- package/lib/agent-cli-provider/types.d.ts.map +1 -1
- package/lib/agent-cli-provider/types.js.map +1 -1
- package/lib/detached-startup.js +4 -2
- package/lib/docker-config.js +24 -13
- package/lib/provider-defaults.js +15 -4
- package/lib/provider-detection.js +2 -0
- package/lib/provider-names.js +32 -12
- package/lib/repo-settings.js +15 -1
- package/lib/run-mode.js +18 -6
- package/lib/run-plan.js +32 -0
- package/lib/settings/claude-auth.js +3 -6
- package/lib/settings.js +17 -2
- package/lib/setup-apply.js +300 -0
- package/lib/setup-journal.js +109 -0
- package/lib/setup-plan.js +406 -0
- package/lib/setup-undo.js +88 -0
- package/lib/start-cluster.js +34 -9
- package/lib/stream-json-parser.js +7 -5
- package/package.json +33 -3
- package/scripts/live-provider-smoke.js +221 -0
- package/src/agent/agent-lifecycle.js +7 -4
- package/src/agent/agent-quality-gate-schema.js +2 -2
- package/src/agent/agent-task-executor.js +41 -2
- package/src/agent-cli-provider/acp-stdio-runner.ts +314 -0
- package/src/agent-cli-provider/adapters/acp.ts +493 -0
- package/src/agent-cli-provider/adapters/claude.ts +2 -32
- package/src/agent-cli-provider/adapters/copilot-parser.ts +166 -0
- package/src/agent-cli-provider/adapters/copilot.ts +231 -0
- package/src/agent-cli-provider/adapters/gateway.ts +186 -0
- package/src/agent-cli-provider/adapters/gemini.ts +9 -2
- package/src/agent-cli-provider/adapters/index.ts +5 -36
- package/src/agent-cli-provider/adapters/opencode.ts +4 -1
- package/src/agent-cli-provider/adapters/pi.ts +410 -0
- package/src/agent-cli-provider/claude-command.ts +47 -0
- package/src/agent-cli-provider/contract-actions.ts +14 -17
- package/src/agent-cli-provider/contract-invoke.ts +12 -3
- package/src/agent-cli-provider/contract-options.ts +72 -3
- package/src/agent-cli-provider/contract-support.ts +30 -3
- package/src/agent-cli-provider/errors.ts +14 -4
- package/src/agent-cli-provider/gateway-client.ts +170 -0
- package/src/agent-cli-provider/gateway-runner.ts +353 -0
- package/src/agent-cli-provider/gateway-tools.ts +616 -0
- package/src/agent-cli-provider/index.ts +28 -0
- package/src/agent-cli-provider/invoke-evidence.ts +24 -3
- package/src/agent-cli-provider/provider-registry.ts +515 -0
- package/src/agent-cli-provider/single-agent-runtime.ts +192 -18
- package/src/agent-cli-provider/types.ts +145 -4
- package/src/config-validator.js +33 -15
- package/src/isolation-manager.js +124 -19
- package/src/ledger.js +3 -0
- package/src/message-bus.js +12 -2
- package/src/orchestrator.js +37 -17
- package/src/preflight.js +83 -30
- package/src/providers/capabilities.js +15 -42
- package/src/providers/index.js +52 -72
- package/src/worktree-claude-config.js +17 -0
- package/task-lib/commands/run.js +1 -0
- package/task-lib/provider-helper-runtime.js +11 -0
- package/task-lib/runner.js +7 -0
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
const readline = require('readline');
|
|
2
2
|
const { loadSettings, saveSettings } = require('../../lib/settings');
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
VALID_PROVIDERS,
|
|
5
|
+
normalizeProviderName,
|
|
6
|
+
providerSupportsCapability,
|
|
7
|
+
} = require('../../lib/provider-names');
|
|
4
8
|
const { detectProviders, getProvider } = require('../../src/providers');
|
|
5
9
|
|
|
10
|
+
const PROVIDER_CHOICES = VALID_PROVIDERS.join(', ');
|
|
11
|
+
|
|
6
12
|
function question(rl, prompt) {
|
|
7
13
|
return new Promise((resolve) => {
|
|
8
14
|
rl.question(prompt, (answer) => resolve(answer.trim()));
|
|
@@ -45,7 +51,7 @@ async function providersCommand() {
|
|
|
45
51
|
function setDefaultCommand(args) {
|
|
46
52
|
const provider = normalizeProviderName(args[0]);
|
|
47
53
|
if (!VALID_PROVIDERS.includes(provider)) {
|
|
48
|
-
console.error(`Invalid provider: ${args[0]}`);
|
|
54
|
+
console.error(`Invalid provider: ${args[0]}. Valid: ${PROVIDER_CHOICES}`);
|
|
49
55
|
process.exit(1);
|
|
50
56
|
}
|
|
51
57
|
|
|
@@ -58,8 +64,8 @@ function setDefaultCommand(args) {
|
|
|
58
64
|
|
|
59
65
|
async function setupCommand(args) {
|
|
60
66
|
const provider = normalizeProviderName(args[0]);
|
|
61
|
-
if (!provider) {
|
|
62
|
-
console.error(
|
|
67
|
+
if (!provider || !VALID_PROVIDERS.includes(provider)) {
|
|
68
|
+
console.error(`Provider is required (${PROVIDER_CHOICES})`);
|
|
63
69
|
process.exit(1);
|
|
64
70
|
}
|
|
65
71
|
|
|
@@ -115,7 +121,7 @@ async function setupCommand(args) {
|
|
|
115
121
|
for (const level of levelKeys) {
|
|
116
122
|
const modelChoice = await question(rl, `Model for ${level} (${catalog.join(', ')}): `);
|
|
117
123
|
if (modelChoice) levelOverrides[level] = { model: modelChoice };
|
|
118
|
-
if (provider
|
|
124
|
+
if (!providerSupportsCapability(provider, 'reasoningEffort')) continue;
|
|
119
125
|
const reasoning = await question(rl, `Reasoning for ${level} (low|medium|high|xhigh): `);
|
|
120
126
|
if (reasoning) {
|
|
121
127
|
levelOverrides[level] = {
|
package/cli/index.js
CHANGED
|
@@ -46,8 +46,9 @@ const {
|
|
|
46
46
|
validateSetting,
|
|
47
47
|
coerceValue,
|
|
48
48
|
DEFAULT_SETTINGS,
|
|
49
|
+
settingsFileExists,
|
|
49
50
|
} = require('../lib/settings');
|
|
50
|
-
const { normalizeProviderName } = require('../lib/provider-names');
|
|
51
|
+
const { VALID_PROVIDERS, normalizeProviderName } = require('../lib/provider-names');
|
|
51
52
|
const { getProvider, parseProviderChunk } = require('../src/providers');
|
|
52
53
|
const { readClustersFileSync } = require('../lib/clusters-registry');
|
|
53
54
|
const { MOUNT_PRESETS, resolveEnvs } = require('../lib/docker-config');
|
|
@@ -89,6 +90,7 @@ const { EVENT_COPY, formatMergeStatus } = require('./event-copy');
|
|
|
89
90
|
let activeClusterId = null;
|
|
90
91
|
/** @type {import('../src/orchestrator') | null} */
|
|
91
92
|
let orchestratorInstance = null;
|
|
93
|
+
const PROVIDER_CHOICES = VALID_PROVIDERS.join(', ');
|
|
92
94
|
|
|
93
95
|
// Track active status footer for safe output routing
|
|
94
96
|
// When set, all output routes through statusFooter.print() to prevent garbling
|
|
@@ -189,7 +191,9 @@ function normalizeRunOptions(options) {
|
|
|
189
191
|
if (options.docker) {
|
|
190
192
|
options.worktree = false;
|
|
191
193
|
}
|
|
192
|
-
|
|
194
|
+
// autoMerge is NOT stored here — it is derived from the run plan (delivery ===
|
|
195
|
+
// 'ship') at every consumer. Writing it here unconditionally would clobber an
|
|
196
|
+
// explicit autoMerge intent (e.g. a future `--auto-merge` flag) back to false.
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
async function runClusterPreflight({ input, options, providerOverride, settings, forceProvider }) {
|
|
@@ -2411,10 +2415,7 @@ program
|
|
|
2411
2415
|
'When to close issue after merge: auto|always|never (default: from .zeroshot/settings.json or never)'
|
|
2412
2416
|
)
|
|
2413
2417
|
.option('--workers <n>', 'Max sub-agents for worker to spawn in parallel', parseInt)
|
|
2414
|
-
.option(
|
|
2415
|
-
'--provider <provider>',
|
|
2416
|
-
'Override all agents to use a provider (claude, codex, gemini, opencode)'
|
|
2417
|
-
)
|
|
2418
|
+
.option('--provider <provider>', `Override all agents to use a provider (${PROVIDER_CHOICES})`)
|
|
2418
2419
|
.option('--model <model>', 'Override all agent models (provider-specific model id)')
|
|
2419
2420
|
.option(
|
|
2420
2421
|
'--sim <mode>',
|
|
@@ -2610,6 +2611,7 @@ Force provider flags: -G (GitHub), -L (GitLab), -J (Jira), -D (DevOps), -N (Line
|
|
|
2610
2611
|
|
|
2611
2612
|
if (!process.env.ZEROSHOT_DAEMON) {
|
|
2612
2613
|
await streamClusterInForeground(cluster, orchestrator, clusterId, options);
|
|
2614
|
+
orchestrator.close();
|
|
2613
2615
|
}
|
|
2614
2616
|
|
|
2615
2617
|
setupDaemonCleanup(orchestrator, clusterId);
|
|
@@ -2679,7 +2681,7 @@ taskCmd
|
|
|
2679
2681
|
.command('run <prompt>')
|
|
2680
2682
|
.description('Run a single-agent background task')
|
|
2681
2683
|
.option('-C, --cwd <path>', 'Working directory for task')
|
|
2682
|
-
.option('--provider <provider>',
|
|
2684
|
+
.option('--provider <provider>', `Provider to use (${PROVIDER_CHOICES})`)
|
|
2683
2685
|
.option('--model <model>', 'Model id override for the provider')
|
|
2684
2686
|
.option('--model-level <level>', 'Model level override (level1, level2, level3)')
|
|
2685
2687
|
.option('--reasoning-effort <effort>', 'Reasoning effort (low, medium, high, xhigh)')
|
|
@@ -2691,6 +2693,12 @@ taskCmd
|
|
|
2691
2693
|
'stream-json'
|
|
2692
2694
|
)
|
|
2693
2695
|
.option('--json-schema <schema>', 'JSON schema for structured output')
|
|
2696
|
+
.option(
|
|
2697
|
+
'--mcp-config <config>',
|
|
2698
|
+
'MCP server config for providers that accept an MCP config flag (e.g. Copilot). ' +
|
|
2699
|
+
'Inline JSON string ({"mcpServers":{...}}) or @<path>. Repeatable.',
|
|
2700
|
+
(value, previous) => (previous || []).concat([value])
|
|
2701
|
+
)
|
|
2694
2702
|
.option('--silent-json-output', 'Log ONLY final structured output')
|
|
2695
2703
|
.action(async (prompt, options) => {
|
|
2696
2704
|
try {
|
|
@@ -3602,15 +3610,15 @@ function registerTuiEntrypoint(commandName, providerName) {
|
|
|
3602
3610
|
.action(failTuiUnavailable);
|
|
3603
3611
|
}
|
|
3604
3612
|
|
|
3605
|
-
|
|
3606
|
-
registerTuiEntrypoint(
|
|
3607
|
-
|
|
3608
|
-
registerTuiEntrypoint('opencode', 'opencode');
|
|
3613
|
+
for (const providerName of VALID_PROVIDERS) {
|
|
3614
|
+
registerTuiEntrypoint(providerName, providerName);
|
|
3615
|
+
}
|
|
3609
3616
|
|
|
3610
3617
|
// Settings management
|
|
3611
3618
|
const settingsCmd = program.command('settings').description('Manage zeroshot settings');
|
|
3612
3619
|
|
|
3613
3620
|
function printSettingsUsage() {
|
|
3621
|
+
const mountPresetList = Object.keys(MOUNT_PRESETS).join(', ');
|
|
3614
3622
|
console.log(chalk.dim('Usage:'));
|
|
3615
3623
|
console.log(chalk.dim(' zeroshot settings set <key> <value>'));
|
|
3616
3624
|
console.log(chalk.dim(' zeroshot settings get <key>'));
|
|
@@ -3621,11 +3629,7 @@ function printSettingsUsage() {
|
|
|
3621
3629
|
console.log(chalk.dim(' zeroshot settings set dockerMounts \'["gh","git","ssh","aws"]\''));
|
|
3622
3630
|
console.log(chalk.dim(' zeroshot settings set dockerEnvPassthrough \'["AWS_*","TF_VAR_*"]\''));
|
|
3623
3631
|
console.log('');
|
|
3624
|
-
console.log(
|
|
3625
|
-
chalk.dim(
|
|
3626
|
-
'Available mount presets: gh, git, ssh, aws, azure, kube, terraform, gcloud, claude, codex, gemini'
|
|
3627
|
-
)
|
|
3628
|
-
);
|
|
3632
|
+
console.log(chalk.dim(`Available mount presets: ${mountPresetList}`));
|
|
3629
3633
|
console.log('');
|
|
3630
3634
|
}
|
|
3631
3635
|
|
|
@@ -4126,7 +4130,7 @@ providersCmd.action(async () => {
|
|
|
4126
4130
|
|
|
4127
4131
|
providersCmd
|
|
4128
4132
|
.command('set-default <provider>')
|
|
4129
|
-
.description(
|
|
4133
|
+
.description(`Set default provider (${PROVIDER_CHOICES})`)
|
|
4130
4134
|
.action(async (provider) => {
|
|
4131
4135
|
await setDefaultCommand([provider]);
|
|
4132
4136
|
});
|
|
@@ -4138,6 +4142,68 @@ providersCmd
|
|
|
4138
4142
|
await setupCommand([provider]);
|
|
4139
4143
|
});
|
|
4140
4144
|
|
|
4145
|
+
// Setup wizard (read-only facts + setup contract; apply/undo/TTY wizard land separately)
|
|
4146
|
+
const setupCmd = program.command('setup').description('Setup and configuration wizard');
|
|
4147
|
+
setupCmd
|
|
4148
|
+
.command('plan')
|
|
4149
|
+
.description('Show read-only setup facts and proposed contract (no writes)')
|
|
4150
|
+
.option('--json', 'Output as JSON')
|
|
4151
|
+
.action(() => {
|
|
4152
|
+
const { buildSetupPlan } = require('../lib/setup-plan');
|
|
4153
|
+
const { readRepoSettings } = require('../lib/repo-settings');
|
|
4154
|
+
|
|
4155
|
+
const cwd = process.cwd();
|
|
4156
|
+
const settings = loadSettings();
|
|
4157
|
+
settings.__meta = { fileExists: settingsFileExists() };
|
|
4158
|
+
const { settings: repoSettings } = readRepoSettings(cwd);
|
|
4159
|
+
const plan = buildSetupPlan({
|
|
4160
|
+
cwd,
|
|
4161
|
+
settings,
|
|
4162
|
+
repoSettings,
|
|
4163
|
+
env: { ...process.env, __isTTY: !!process.stdout.isTTY },
|
|
4164
|
+
});
|
|
4165
|
+
console.log(JSON.stringify(plan, null, 2));
|
|
4166
|
+
});
|
|
4167
|
+
|
|
4168
|
+
setupCmd
|
|
4169
|
+
.command('apply')
|
|
4170
|
+
.description('Apply a decisions file to global/repo settings (writes)')
|
|
4171
|
+
.requiredOption('--decisions <file>', 'Path to decisions JSON file')
|
|
4172
|
+
.option('--json', 'Output as JSON')
|
|
4173
|
+
.option(
|
|
4174
|
+
'--allow-risky-defaults',
|
|
4175
|
+
'Allow storing defaultDelivery=ship as a global default (auto-merge by default)'
|
|
4176
|
+
)
|
|
4177
|
+
.action((opts) => {
|
|
4178
|
+
const { applyDecisions } = require('../lib/setup-apply');
|
|
4179
|
+
try {
|
|
4180
|
+
const results = applyDecisions({
|
|
4181
|
+
decisionsPath: opts.decisions,
|
|
4182
|
+
cwd: process.cwd(),
|
|
4183
|
+
allowRiskyDefaults: !!opts.allowRiskyDefaults,
|
|
4184
|
+
});
|
|
4185
|
+
console.log(JSON.stringify({ results }, null, 2));
|
|
4186
|
+
} catch (err) {
|
|
4187
|
+
console.error(JSON.stringify({ error: err.message }, null, 2));
|
|
4188
|
+
process.exitCode = 1;
|
|
4189
|
+
}
|
|
4190
|
+
});
|
|
4191
|
+
|
|
4192
|
+
setupCmd
|
|
4193
|
+
.command('undo')
|
|
4194
|
+
.description('Undo writes made by the most recent `zeroshot setup apply` runs')
|
|
4195
|
+
.option('--json', 'Output as JSON')
|
|
4196
|
+
.action(() => {
|
|
4197
|
+
const { undo } = require('../lib/setup-undo');
|
|
4198
|
+
try {
|
|
4199
|
+
const results = undo({});
|
|
4200
|
+
console.log(JSON.stringify({ results }, null, 2));
|
|
4201
|
+
} catch (err) {
|
|
4202
|
+
console.error(JSON.stringify({ error: err.message }, null, 2));
|
|
4203
|
+
process.exitCode = 1;
|
|
4204
|
+
}
|
|
4205
|
+
});
|
|
4206
|
+
|
|
4141
4207
|
// Update command
|
|
4142
4208
|
program
|
|
4143
4209
|
.command('update')
|
package/cli/lib/first-run.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
const readline = require('readline');
|
|
12
12
|
const { loadSettings, saveSettings } = require('../../lib/settings');
|
|
13
|
+
const { listProviderMetadata } = require('../../lib/provider-names');
|
|
13
14
|
const { detectProviders } = require('../../src/providers');
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -39,6 +40,16 @@ function createReadline() {
|
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
function printProviderInstallChoices() {
|
|
44
|
+
for (const provider of listProviderMetadata()) {
|
|
45
|
+
const [firstLine, ...remainingLines] = provider.installInstructions.split('\n');
|
|
46
|
+
console.log(` - ${provider.displayName}: ${firstLine}`);
|
|
47
|
+
for (const line of remainingLines) {
|
|
48
|
+
console.log(` ${line}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
42
53
|
/**
|
|
43
54
|
* Prompt for provider selection
|
|
44
55
|
* @param {readline.Interface} rl
|
|
@@ -52,9 +63,7 @@ function promptProvider(rl, detected) {
|
|
|
52
63
|
|
|
53
64
|
if (available.length === 0) {
|
|
54
65
|
console.log('No AI CLI tools detected. Please install one of:');
|
|
55
|
-
|
|
56
|
-
console.log(' - Codex CLI: npm install -g @openai/codex');
|
|
57
|
-
console.log(' - Gemini CLI: npm install -g @google/gemini-cli');
|
|
66
|
+
printProviderInstallChoices();
|
|
58
67
|
process.exit(1);
|
|
59
68
|
}
|
|
60
69
|
|
|
@@ -208,4 +217,6 @@ module.exports = {
|
|
|
208
217
|
detectFirstRun,
|
|
209
218
|
printWelcome,
|
|
210
219
|
printComplete,
|
|
220
|
+
promptProvider,
|
|
221
|
+
printProviderInstallChoices,
|
|
211
222
|
};
|
|
@@ -8,7 +8,9 @@ FROM node:20-slim
|
|
|
8
8
|
|
|
9
9
|
# Upgrade npm to fix Arborist isDescendantOf bug (npm 10.x crash on complex peer deps)
|
|
10
10
|
# See: https://github.com/npm/cli/issues/7682
|
|
11
|
-
|
|
11
|
+
# Pinned to npm@11 (the latest line that still supports the node:20-slim base); npm@latest (12.x)
|
|
12
|
+
# now requires node >=22 and breaks the build with EBADENGINE.
|
|
13
|
+
RUN npm install -g npm@11
|
|
12
14
|
|
|
13
15
|
# Version pinning for infrastructure tools
|
|
14
16
|
ARG AWS_CLI_VERSION=2.15.10
|
|
@@ -146,6 +148,14 @@ RUN mkdir -p /home/node/.claude /home/node/.config/gh \
|
|
|
146
148
|
RUN mkdir -p /workspace && chown node:node /workspace
|
|
147
149
|
WORKDIR /workspace
|
|
148
150
|
|
|
151
|
+
# Install the running provider's CLI as a docker-cached layer (per-provider image variant).
|
|
152
|
+
# Claude is baked in above, so its variant passes an empty PROVIDER_INSTALL and skips this step.
|
|
153
|
+
# Kept last in the root phase so every heavy layer above is shared across all provider images;
|
|
154
|
+
# Docker caches this layer keyed on the install command, so it builds once per provider and is
|
|
155
|
+
# then reused. The command comes from the provider registry (docker.install), never hardcoded.
|
|
156
|
+
ARG PROVIDER_INSTALL=""
|
|
157
|
+
RUN if [ -n "$PROVIDER_INSTALL" ]; then sh -c "$PROVIDER_INSTALL"; fi
|
|
158
|
+
|
|
149
159
|
# Switch to non-root user (required for --dangerously-skip-permissions)
|
|
150
160
|
USER node
|
|
151
161
|
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CommandSpec, ProviderId } from './types';
|
|
2
|
+
import type { ProcessResult, ProcessRunnerOptions } from './process-runner';
|
|
3
|
+
export declare function runAcpStdioPrompt(provider: ProviderId, commandSpec: CommandSpec, prompt: string, options?: ProcessRunnerOptions): Promise<ProcessResult>;
|
|
4
|
+
//# sourceMappingURL=acp-stdio-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acp-stdio-runner.d.ts","sourceRoot":"","sources":["../../src/agent-cli-provider/acp-stdio-runner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AA2F5E,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,aAAa,CAAC,CAqNxB"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runAcpStdioPrompt = runAcpStdioPrompt;
|
|
4
|
+
/* eslint-disable max-lines-per-function */
|
|
5
|
+
const node_child_process_1 = require("node:child_process");
|
|
6
|
+
const env_safety_1 = require("./env-safety");
|
|
7
|
+
const DEFAULT_TIMEOUT_KILL_GRACE_MS = 100;
|
|
8
|
+
function spawnOptions(commandSpec) {
|
|
9
|
+
const options = {
|
|
10
|
+
shell: false,
|
|
11
|
+
env: { ...(0, env_safety_1.omitProcessControlEnv)(process.env), ...(0, env_safety_1.omitUnsafeProviderEnv)(commandSpec.env) },
|
|
12
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
13
|
+
};
|
|
14
|
+
if (commandSpec.cwd !== undefined)
|
|
15
|
+
options.cwd = commandSpec.cwd;
|
|
16
|
+
return options;
|
|
17
|
+
}
|
|
18
|
+
function processResult(input) {
|
|
19
|
+
return {
|
|
20
|
+
stdout: Buffer.concat(input.stdout).toString('utf8'),
|
|
21
|
+
stderr: Buffer.concat(input.stderr).toString('utf8'),
|
|
22
|
+
exitCode: input.exitCode,
|
|
23
|
+
signal: input.signal,
|
|
24
|
+
durationMs: Date.now() - input.startedAt,
|
|
25
|
+
timedOut: input.timedOut,
|
|
26
|
+
...(input.timedOut && input.timeoutMs !== undefined ? { timeoutMs: input.timeoutMs } : {}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function isRecord(value) {
|
|
30
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
31
|
+
}
|
|
32
|
+
function parseProtocolLine(line) {
|
|
33
|
+
let parsed;
|
|
34
|
+
try {
|
|
35
|
+
parsed = JSON.parse(line);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
const reason = error instanceof Error ? error.message : 'Unknown JSON parse error.';
|
|
39
|
+
throw new Error(`malformed ACP stdout JSON: ${reason}`);
|
|
40
|
+
}
|
|
41
|
+
if (!isRecord(parsed))
|
|
42
|
+
throw new Error('malformed ACP stdout JSON: expected a JSON object.');
|
|
43
|
+
return parsed;
|
|
44
|
+
}
|
|
45
|
+
function createPromptParams(sessionId, prompt) {
|
|
46
|
+
return {
|
|
47
|
+
sessionId,
|
|
48
|
+
prompt: [
|
|
49
|
+
{
|
|
50
|
+
role: 'user',
|
|
51
|
+
content: [{ type: 'text', text: prompt }],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function runAcpStdioPrompt(provider, commandSpec, prompt, options = {}) {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
const startedAt = Date.now();
|
|
59
|
+
const stdout = [];
|
|
60
|
+
const stderr = [];
|
|
61
|
+
const child = (0, node_child_process_1.spawn)(commandSpec.binary, [...commandSpec.args], spawnOptions(commandSpec));
|
|
62
|
+
const pending = new Map();
|
|
63
|
+
let stdoutBuffer = '';
|
|
64
|
+
let nextId = 1;
|
|
65
|
+
let timedOut = false;
|
|
66
|
+
let protocolFailure = null;
|
|
67
|
+
let sessionId = null;
|
|
68
|
+
let closeResolved = false;
|
|
69
|
+
let timeout;
|
|
70
|
+
let timeoutKill;
|
|
71
|
+
function cleanupTimers() {
|
|
72
|
+
if (timeout !== undefined)
|
|
73
|
+
clearTimeout(timeout);
|
|
74
|
+
if (timeoutKill !== undefined)
|
|
75
|
+
clearTimeout(timeoutKill);
|
|
76
|
+
}
|
|
77
|
+
function finalize(exitCode, signal) {
|
|
78
|
+
if (closeResolved)
|
|
79
|
+
return;
|
|
80
|
+
closeResolved = true;
|
|
81
|
+
cleanupTimers();
|
|
82
|
+
if (protocolFailure) {
|
|
83
|
+
const failureMessage = protocolFailure.message;
|
|
84
|
+
if (!stderr.some((chunk) => chunk.toString('utf8').includes(failureMessage))) {
|
|
85
|
+
stderr.push(Buffer.from(`${failureMessage}\n`, 'utf8'));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const effectiveExitCode = protocolFailure && exitCode === 0 && signal === null ? 1 : exitCode;
|
|
89
|
+
resolve(processResult({
|
|
90
|
+
stdout,
|
|
91
|
+
stderr,
|
|
92
|
+
exitCode: effectiveExitCode,
|
|
93
|
+
signal,
|
|
94
|
+
startedAt,
|
|
95
|
+
timedOut,
|
|
96
|
+
...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
function failClosed(message) {
|
|
100
|
+
if (protocolFailure)
|
|
101
|
+
return;
|
|
102
|
+
protocolFailure = new Error(`${provider} ACP stdio fail-closed: ${message}`);
|
|
103
|
+
for (const request of pending.values()) {
|
|
104
|
+
request.reject(protocolFailure);
|
|
105
|
+
}
|
|
106
|
+
pending.clear();
|
|
107
|
+
if (sessionId && child.stdin && !child.stdin.destroyed) {
|
|
108
|
+
child.stdin.write(`${JSON.stringify({
|
|
109
|
+
jsonrpc: '2.0',
|
|
110
|
+
method: 'session/cancel',
|
|
111
|
+
params: { sessionId },
|
|
112
|
+
})}\n`);
|
|
113
|
+
}
|
|
114
|
+
child.stdin?.end();
|
|
115
|
+
child.kill('SIGTERM');
|
|
116
|
+
}
|
|
117
|
+
function handleProtocolMessage(message) {
|
|
118
|
+
const responseId = typeof message.id === 'number' ? message.id : null;
|
|
119
|
+
if (responseId !== null && (message.result !== undefined || message.error !== undefined)) {
|
|
120
|
+
const request = pending.get(responseId);
|
|
121
|
+
if (request) {
|
|
122
|
+
pending.delete(responseId);
|
|
123
|
+
request.resolve(message);
|
|
124
|
+
}
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const method = typeof message.method === 'string' ? message.method : null;
|
|
128
|
+
if (!method)
|
|
129
|
+
return;
|
|
130
|
+
if (method === 'session/update')
|
|
131
|
+
return;
|
|
132
|
+
if (method.startsWith('_'))
|
|
133
|
+
return;
|
|
134
|
+
if (method === 'session/request_permission') {
|
|
135
|
+
failClosed('unsupported session/request_permission callback.');
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (method.startsWith('fs/')) {
|
|
139
|
+
failClosed(`unsupported ${method} callback.`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (method.startsWith('terminal/')) {
|
|
143
|
+
failClosed(`unsupported ${method} callback.`);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (method.startsWith('session/')) {
|
|
147
|
+
failClosed(`unsupported ${method} session-control callback.`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function consumeStdoutLine(line) {
|
|
151
|
+
try {
|
|
152
|
+
handleProtocolMessage(parseProtocolLine(line));
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
failClosed(error instanceof Error ? error.message : 'malformed ACP stdout JSON.');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function flushStdoutRemainder() {
|
|
159
|
+
const line = stdoutBuffer.trim();
|
|
160
|
+
stdoutBuffer = '';
|
|
161
|
+
if (line)
|
|
162
|
+
consumeStdoutLine(line);
|
|
163
|
+
}
|
|
164
|
+
function flushStdout(data) {
|
|
165
|
+
stdout.push(data);
|
|
166
|
+
stdoutBuffer += data.toString('utf8');
|
|
167
|
+
let newline = stdoutBuffer.indexOf('\n');
|
|
168
|
+
while (newline !== -1) {
|
|
169
|
+
const line = stdoutBuffer.slice(0, newline).trim();
|
|
170
|
+
stdoutBuffer = stdoutBuffer.slice(newline + 1);
|
|
171
|
+
if (line)
|
|
172
|
+
consumeStdoutLine(line);
|
|
173
|
+
newline = stdoutBuffer.indexOf('\n');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function sendRequest(method, params) {
|
|
177
|
+
const id = nextId;
|
|
178
|
+
nextId += 1;
|
|
179
|
+
const request = {
|
|
180
|
+
jsonrpc: '2.0',
|
|
181
|
+
id,
|
|
182
|
+
method,
|
|
183
|
+
params,
|
|
184
|
+
};
|
|
185
|
+
return new Promise((requestResolve, requestReject) => {
|
|
186
|
+
pending.set(id, { resolve: requestResolve, reject: requestReject });
|
|
187
|
+
child.stdin?.write(`${JSON.stringify(request)}\n`);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
async function driveProtocol() {
|
|
191
|
+
const initialize = await sendRequest('initialize', {
|
|
192
|
+
protocolVersion: 1,
|
|
193
|
+
clientInfo: {
|
|
194
|
+
name: '@the-open-engine/zeroshot',
|
|
195
|
+
version: '1',
|
|
196
|
+
},
|
|
197
|
+
clientCapabilities: {
|
|
198
|
+
fs: false,
|
|
199
|
+
terminal: false,
|
|
200
|
+
promptCapabilities: {
|
|
201
|
+
image: false,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
if (initialize.error !== undefined) {
|
|
206
|
+
child.stdin?.end();
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const session = await sendRequest('session/new', {
|
|
210
|
+
cwd: commandSpec.cwd ?? process.cwd(),
|
|
211
|
+
mcpServers: [],
|
|
212
|
+
});
|
|
213
|
+
if (session.error !== undefined) {
|
|
214
|
+
child.stdin?.end();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const sessionResult = isRecord(session.result) ? session.result : {};
|
|
218
|
+
const nextSessionId = typeof sessionResult.sessionId === 'string' ? sessionResult.sessionId : null;
|
|
219
|
+
if (!nextSessionId) {
|
|
220
|
+
failClosed('session/new response omitted sessionId.');
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
sessionId = nextSessionId;
|
|
224
|
+
await sendRequest('session/prompt', createPromptParams(sessionId, prompt));
|
|
225
|
+
child.stdin?.end();
|
|
226
|
+
}
|
|
227
|
+
if (options.timeoutMs !== undefined) {
|
|
228
|
+
timeout = setTimeout(() => {
|
|
229
|
+
timedOut = true;
|
|
230
|
+
if (sessionId && child.stdin && !child.stdin.destroyed) {
|
|
231
|
+
child.stdin.write(`${JSON.stringify({
|
|
232
|
+
jsonrpc: '2.0',
|
|
233
|
+
method: 'session/cancel',
|
|
234
|
+
params: { sessionId },
|
|
235
|
+
})}\n`);
|
|
236
|
+
}
|
|
237
|
+
child.kill('SIGTERM');
|
|
238
|
+
timeoutKill = setTimeout(() => {
|
|
239
|
+
if (!closeResolved)
|
|
240
|
+
child.kill('SIGKILL');
|
|
241
|
+
}, options.timeoutKillGraceMs ?? DEFAULT_TIMEOUT_KILL_GRACE_MS);
|
|
242
|
+
}, options.timeoutMs);
|
|
243
|
+
}
|
|
244
|
+
child.stdout?.on('data', flushStdout);
|
|
245
|
+
child.stdout?.once('end', flushStdoutRemainder);
|
|
246
|
+
child.stderr?.on('data', (data) => stderr.push(data));
|
|
247
|
+
child.once('error', (error) => {
|
|
248
|
+
cleanupTimers();
|
|
249
|
+
reject(error);
|
|
250
|
+
});
|
|
251
|
+
child.once('close', (exitCode, signal) => {
|
|
252
|
+
finalize(exitCode, signal);
|
|
253
|
+
});
|
|
254
|
+
driveProtocol().catch((error) => {
|
|
255
|
+
failClosed(error instanceof Error ? error.message : 'ACP protocol failed.');
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=acp-stdio-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acp-stdio-runner.js","sourceRoot":"","sources":["../../src/agent-cli-provider/acp-stdio-runner.ts"],"names":[],"mappings":";;AA+FA,8CA0NC;AAzTD,2CAA2C;AAC3C,2DAA2C;AAC3C,6CAA4E;AAI5E,MAAM,6BAA6B,GAAG,GAAG,CAAC;A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Q,EAAE,MAAM,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACvC,UAAU,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type BuildProviderCommandOptions, type LevelModelSpec, type ModelCatalogEntry, type ModelLevel, type ProviderAdapter, type ProviderId } from '../types';
|
|
2
|
+
export interface AcpAdapterMetadata {
|
|
3
|
+
readonly provider: ProviderId;
|
|
4
|
+
readonly displayName: string;
|
|
5
|
+
readonly binary: string;
|
|
6
|
+
readonly commandArgs: readonly string[];
|
|
7
|
+
readonly credentialEnvKeys: readonly string[];
|
|
8
|
+
readonly modelCatalog?: Readonly<Record<string, ModelCatalogEntry>>;
|
|
9
|
+
readonly levelMapping?: Readonly<Record<ModelLevel, LevelModelSpec>>;
|
|
10
|
+
readonly defaultLevel?: ModelLevel;
|
|
11
|
+
readonly defaultMaxLevel?: ModelLevel;
|
|
12
|
+
readonly defaultMinLevel?: ModelLevel;
|
|
13
|
+
readonly supportsPromptImages: boolean;
|
|
14
|
+
readonly supportsLoadSession: boolean;
|
|
15
|
+
readonly supportsSessionCancel: boolean;
|
|
16
|
+
readonly supportsSessionSetModel: boolean;
|
|
17
|
+
readonly supportsSessionSetMode: boolean;
|
|
18
|
+
readonly retryableErrorPatterns?: readonly RegExp[];
|
|
19
|
+
readonly permanentErrorPatterns?: readonly RegExp[];
|
|
20
|
+
}
|
|
21
|
+
export declare function buildAcpPrompt(context: string, options?: BuildProviderCommandOptions): string;
|
|
22
|
+
export declare function createAcpAdapter(meta: AcpAdapterMetadata): ProviderAdapter;
|
|
23
|
+
//# sourceMappingURL=acp.d.ts.map
|
|
@@ -0,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