@the-open-engine/zeroshot 6.29.1 → 6.30.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/CHANGELOG.md +4 -0
- package/lib/agent-cli-provider/contract-actions.d.ts +1 -1
- package/lib/agent-cli-provider/contract-actions.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-actions.js +5 -5
- package/lib/agent-cli-provider/contract-actions.js.map +1 -1
- package/lib/agent-cli-provider/contract-invoke.d.ts +1 -1
- package/lib/agent-cli-provider/contract-invoke.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-invoke.js +2 -2
- package/lib/agent-cli-provider/contract-invoke.js.map +1 -1
- package/lib/agent-cli-provider/contract-support.d.ts +1 -1
- package/lib/agent-cli-provider/contract-support.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-support.js +2 -2
- package/lib/agent-cli-provider/contract-support.js.map +1 -1
- package/lib/agent-cli-provider/contract.d.ts +1 -0
- package/lib/agent-cli-provider/contract.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract.js +1 -1
- package/lib/agent-cli-provider/contract.js.map +1 -1
- package/lib/agent-cli-provider/index.d.ts +1 -1
- package/lib/agent-cli-provider/index.d.ts.map +1 -1
- package/lib/agent-cli-provider/index.js +2 -1
- package/lib/agent-cli-provider/index.js.map +1 -1
- package/lib/agent-cli-provider/provider-registry.d.ts +1 -0
- package/lib/agent-cli-provider/provider-registry.d.ts.map +1 -1
- package/lib/agent-cli-provider/provider-registry.js +4 -0
- package/lib/agent-cli-provider/provider-registry.js.map +1 -1
- package/lib/agent-cli-provider/single-agent-runtime.d.ts +3 -3
- package/lib/agent-cli-provider/single-agent-runtime.d.ts.map +1 -1
- package/lib/agent-cli-provider/single-agent-runtime.js +22 -48
- package/lib/agent-cli-provider/single-agent-runtime.js.map +1 -1
- package/lib/cluster-worker/engine-adapter-common.js +37 -0
- package/lib/cluster-worker/engine-adapter.js +20 -20
- package/lib/cluster-worker/engine-start.js +59 -0
- package/lib/cluster-worker/index.js +49 -67
- package/lib/cluster-worker/runtime-dependencies.js +49 -0
- package/lib/cluster-worker/runtime-support.js +2 -34
- package/lib/cluster-worker/terminal-normalizer.js +9 -10
- package/package.json +11 -1
- package/protocol/openengine-cluster/v1/worker.schema.json +171 -9
- package/src/agent-cli-provider/contract-actions.ts +9 -5
- package/src/agent-cli-provider/contract-invoke.ts +3 -2
- package/src/agent-cli-provider/contract-support.ts +12 -6
- package/src/agent-cli-provider/contract.ts +6 -1
- package/src/agent-cli-provider/index.ts +1 -0
- package/src/agent-cli-provider/provider-registry.ts +4 -0
- package/src/agent-cli-provider/single-agent-runtime.ts +32 -45
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { randomUUID } = require('crypto');
|
|
4
3
|
const { validateArtifactRef, validateWorkerOutcome } = require('./contracts');
|
|
5
|
-
const { createCurrentEngineAdapter } = require('./engine-adapter');
|
|
6
4
|
const { cloneJson, deepFreeze } = require('./object-utils');
|
|
7
|
-
const { createDeploymentProfileRegistry } = require('./profiles');
|
|
8
5
|
const { resolveRunPlan } = require('../run-plan');
|
|
6
|
+
const { resolveRuntimeDependencies: resolveDependencies } = require('./runtime-dependencies');
|
|
9
7
|
|
|
10
8
|
const CANCELLED = Symbol('cancelled');
|
|
11
9
|
|
|
12
|
-
const DEPENDENCY_KEYS = new Set([
|
|
13
|
-
'profileRegistry',
|
|
14
|
-
'artifactResolver',
|
|
15
|
-
'artifactReceiptSink',
|
|
16
|
-
'engineAdapter',
|
|
17
|
-
'clock',
|
|
18
|
-
'timers',
|
|
19
|
-
'idFactory',
|
|
20
|
-
'cleanupFailureReporter',
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
10
|
async function stageArtifacts(resolver, artifacts, context) {
|
|
24
11
|
if (artifacts.length === 0) return deepFreeze({ artifacts: [] });
|
|
25
12
|
if (context.signal?.aborted) return CANCELLED;
|
|
@@ -200,26 +187,7 @@ async function stopEngineWithinBound({ engineAdapter, timers, shutdownMs }) {
|
|
|
200
187
|
}
|
|
201
188
|
|
|
202
189
|
function resolveRuntimeDependencies(dependencies) {
|
|
203
|
-
|
|
204
|
-
if (unknownDependencies.length > 0) {
|
|
205
|
-
throw new Error(`Unsupported worker dependencies: ${unknownDependencies.join(', ')}`);
|
|
206
|
-
}
|
|
207
|
-
if (
|
|
208
|
-
dependencies.cleanupFailureReporter !== undefined &&
|
|
209
|
-
typeof dependencies.cleanupFailureReporter !== 'function'
|
|
210
|
-
) {
|
|
211
|
-
throw new Error('cleanupFailureReporter must be a function');
|
|
212
|
-
}
|
|
213
|
-
return {
|
|
214
|
-
profileRegistry: dependencies.profileRegistry || createDeploymentProfileRegistry(),
|
|
215
|
-
artifactResolver: dependencies.artifactResolver || null,
|
|
216
|
-
artifactReceiptSink: dependencies.artifactReceiptSink || null,
|
|
217
|
-
engineAdapter: dependencies.engineAdapter || createCurrentEngineAdapter(),
|
|
218
|
-
clock: dependencies.clock || (() => Date.now()),
|
|
219
|
-
timers: dependencies.timers || { setTimeout, clearTimeout },
|
|
220
|
-
idFactory: dependencies.idFactory || (() => `legacy-worker-${randomUUID()}`),
|
|
221
|
-
cleanupFailureReporter: dependencies.cleanupFailureReporter || defaultCleanupFailureReporter,
|
|
222
|
-
};
|
|
190
|
+
return resolveDependencies(dependencies, defaultCleanupFailureReporter);
|
|
223
191
|
}
|
|
224
192
|
|
|
225
193
|
function assertProfilePlan(profile) {
|
|
@@ -5,17 +5,16 @@ const { cloneJson, deepFreeze } = require('./object-utils');
|
|
|
5
5
|
const { collectReceipts } = require('./runtime-support');
|
|
6
6
|
|
|
7
7
|
async function resultFromEvent(event, options) {
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let declaredArtifacts = event.artifacts;
|
|
8
|
+
let result;
|
|
9
|
+
let declaredArtifacts;
|
|
11
10
|
if (Object.prototype.hasOwnProperty.call(event, 'result')) {
|
|
12
11
|
validateLegacyShipResult(event.result);
|
|
13
|
-
|
|
14
|
-
status = event.result.status;
|
|
12
|
+
result = event.result;
|
|
15
13
|
declaredArtifacts = event.result.artifacts;
|
|
16
14
|
} else {
|
|
17
|
-
|
|
18
|
-
validateLegacyShipResult(
|
|
15
|
+
result = { summary: event.summary, status: 'succeeded', artifacts: [] };
|
|
16
|
+
validateLegacyShipResult(result);
|
|
17
|
+
declaredArtifacts = [];
|
|
19
18
|
}
|
|
20
19
|
const artifacts = await collectReceipts(options.artifactReceiptSink, declaredArtifacts, {
|
|
21
20
|
clusterId: options.machine.clusterId,
|
|
@@ -24,9 +23,9 @@ async function resultFromEvent(event, options) {
|
|
|
24
23
|
reportCleanupFailure: options.cleanupFailureReporter,
|
|
25
24
|
});
|
|
26
25
|
if (artifacts === options.cancelled) return options.cancelled;
|
|
27
|
-
const
|
|
28
|
-
validateLegacyShipResult(
|
|
29
|
-
return
|
|
26
|
+
const normalized = { ...result, artifacts };
|
|
27
|
+
validateLegacyShipResult(normalized);
|
|
28
|
+
return normalized;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
function createTerminalNormalizer(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@the-open-engine/zeroshot",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.30.0",
|
|
4
4
|
"description": "Multi-agent orchestration engine for Claude, Codex, and Gemini",
|
|
5
5
|
"main": "src/orchestrator.js",
|
|
6
6
|
"bin": {
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"protocol:generate": "node scripts/generate-cluster-types.js",
|
|
78
78
|
"protocol:check": "cargo run -p openengine-cluster-testkit --bin generate-cluster-protocol -- --check && node scripts/generate-cluster-types.js --check",
|
|
79
79
|
"rust:distribution:check": "node scripts/rust-distribution.js check-repository",
|
|
80
|
+
"hosted-oecp:image:check": "node scripts/hosted-oecp-image.js check",
|
|
80
81
|
"rust:check": "cargo fmt --all -- --check && cargo clippy --workspace --all-targets -- -D warnings && cargo test --workspace",
|
|
81
82
|
"deadcode": "ts-prune --skip node_modules",
|
|
82
83
|
"deadcode:files": "unimported",
|
|
@@ -163,7 +164,16 @@
|
|
|
163
164
|
"cluster-templates/",
|
|
164
165
|
"cluster-hooks/",
|
|
165
166
|
"docker/",
|
|
167
|
+
"!docker/zeroshot-oecp/",
|
|
166
168
|
"scripts/",
|
|
169
|
+
"!scripts/hosted-oecp-image.js",
|
|
170
|
+
"!scripts/hosted-oecp-image-commands.js",
|
|
171
|
+
"!scripts/hosted-oecp-image-smoke.js",
|
|
172
|
+
"!scripts/hosted-oecp-manifest.js",
|
|
173
|
+
"!scripts/hosted-oecp-smoke-capability.js",
|
|
174
|
+
"!scripts/hosted-oecp-smoke-client.js",
|
|
175
|
+
"!scripts/hosted-oecp-smoke-codex.mjs",
|
|
176
|
+
"!scripts/hosted-oecp-smoke-fixture.js",
|
|
167
177
|
"protocol/openengine-cluster/v1/worker.schema.json",
|
|
168
178
|
"docs/openengine-cluster-protocol/v1/legacy-worker.md",
|
|
169
179
|
"README.md",
|
|
@@ -246,15 +246,32 @@
|
|
|
246
246
|
"null"
|
|
247
247
|
]
|
|
248
248
|
},
|
|
249
|
+
"modelLevel": {
|
|
250
|
+
"enum": [
|
|
251
|
+
"level1",
|
|
252
|
+
"level2",
|
|
253
|
+
"level3"
|
|
254
|
+
]
|
|
255
|
+
},
|
|
249
256
|
"prompt": {
|
|
250
257
|
"type": [
|
|
251
258
|
"string",
|
|
252
259
|
"null"
|
|
253
260
|
]
|
|
254
261
|
},
|
|
262
|
+
"provider": {
|
|
263
|
+
"minLength": 1,
|
|
264
|
+
"pattern": "\\S",
|
|
265
|
+
"type": "string"
|
|
266
|
+
},
|
|
255
267
|
"providerProfile": {
|
|
256
268
|
"$ref": "#/$defs/CredentialHandle"
|
|
257
269
|
},
|
|
270
|
+
"repository": {
|
|
271
|
+
"minLength": 1,
|
|
272
|
+
"pattern": "\\S",
|
|
273
|
+
"type": "string"
|
|
274
|
+
},
|
|
258
275
|
"source": {
|
|
259
276
|
"enum": [
|
|
260
277
|
"issue",
|
|
@@ -267,13 +284,89 @@
|
|
|
267
284
|
"source",
|
|
268
285
|
"artifacts",
|
|
269
286
|
"isolationProfile",
|
|
270
|
-
"providerProfile"
|
|
287
|
+
"providerProfile",
|
|
288
|
+
"repository",
|
|
289
|
+
"provider",
|
|
290
|
+
"modelLevel"
|
|
271
291
|
],
|
|
272
292
|
"title": "LegacyShipRequest",
|
|
273
293
|
"type": "object"
|
|
274
294
|
},
|
|
275
295
|
"LegacyShipResult": {
|
|
276
296
|
"additionalProperties": false,
|
|
297
|
+
"oneOf": [
|
|
298
|
+
{
|
|
299
|
+
"properties": {
|
|
300
|
+
"branch": {
|
|
301
|
+
"minLength": 1,
|
|
302
|
+
"pattern": "\\S",
|
|
303
|
+
"type": "string"
|
|
304
|
+
},
|
|
305
|
+
"headRevision": {
|
|
306
|
+
"minLength": 1,
|
|
307
|
+
"pattern": "\\S",
|
|
308
|
+
"type": "string"
|
|
309
|
+
},
|
|
310
|
+
"pullRequestUrl": {
|
|
311
|
+
"minLength": 1,
|
|
312
|
+
"pattern": "\\S",
|
|
313
|
+
"type": "string"
|
|
314
|
+
},
|
|
315
|
+
"repository": {
|
|
316
|
+
"minLength": 1,
|
|
317
|
+
"pattern": "\\S",
|
|
318
|
+
"type": "string"
|
|
319
|
+
},
|
|
320
|
+
"status": {
|
|
321
|
+
"const": "succeeded"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"required": [
|
|
325
|
+
"repository",
|
|
326
|
+
"branch",
|
|
327
|
+
"headRevision",
|
|
328
|
+
"pullRequestUrl"
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"properties": {
|
|
333
|
+
"branch": {
|
|
334
|
+
"type": "null"
|
|
335
|
+
},
|
|
336
|
+
"headRevision": {
|
|
337
|
+
"type": "null"
|
|
338
|
+
},
|
|
339
|
+
"pullRequestUrl": {
|
|
340
|
+
"type": "null"
|
|
341
|
+
},
|
|
342
|
+
"repository": {
|
|
343
|
+
"type": "null"
|
|
344
|
+
},
|
|
345
|
+
"status": {
|
|
346
|
+
"const": "succeeded"
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"properties": {
|
|
352
|
+
"branch": {
|
|
353
|
+
"type": "null"
|
|
354
|
+
},
|
|
355
|
+
"headRevision": {
|
|
356
|
+
"type": "null"
|
|
357
|
+
},
|
|
358
|
+
"pullRequestUrl": {
|
|
359
|
+
"type": "null"
|
|
360
|
+
},
|
|
361
|
+
"repository": {
|
|
362
|
+
"type": "null"
|
|
363
|
+
},
|
|
364
|
+
"status": {
|
|
365
|
+
"const": "failed"
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
],
|
|
277
370
|
"properties": {
|
|
278
371
|
"artifacts": {
|
|
279
372
|
"items": {
|
|
@@ -281,10 +374,39 @@
|
|
|
281
374
|
},
|
|
282
375
|
"type": "array"
|
|
283
376
|
},
|
|
377
|
+
"branch": {
|
|
378
|
+
"type": [
|
|
379
|
+
"string",
|
|
380
|
+
"null"
|
|
381
|
+
]
|
|
382
|
+
},
|
|
383
|
+
"headRevision": {
|
|
384
|
+
"type": [
|
|
385
|
+
"string",
|
|
386
|
+
"null"
|
|
387
|
+
]
|
|
388
|
+
},
|
|
389
|
+
"pullRequestUrl": {
|
|
390
|
+
"type": [
|
|
391
|
+
"string",
|
|
392
|
+
"null"
|
|
393
|
+
]
|
|
394
|
+
},
|
|
395
|
+
"repository": {
|
|
396
|
+
"type": [
|
|
397
|
+
"string",
|
|
398
|
+
"null"
|
|
399
|
+
]
|
|
400
|
+
},
|
|
284
401
|
"status": {
|
|
285
|
-
"
|
|
402
|
+
"enum": [
|
|
403
|
+
"succeeded",
|
|
404
|
+
"failed"
|
|
405
|
+
]
|
|
286
406
|
},
|
|
287
407
|
"summary": {
|
|
408
|
+
"minLength": 1,
|
|
409
|
+
"pattern": "\\S",
|
|
288
410
|
"type": "string"
|
|
289
411
|
}
|
|
290
412
|
},
|
|
@@ -296,13 +418,6 @@
|
|
|
296
418
|
"title": "LegacyShipResult",
|
|
297
419
|
"type": "object"
|
|
298
420
|
},
|
|
299
|
-
"LegacyShipStatus": {
|
|
300
|
-
"enum": [
|
|
301
|
-
"succeeded",
|
|
302
|
-
"failed"
|
|
303
|
-
],
|
|
304
|
-
"type": "string"
|
|
305
|
-
},
|
|
306
421
|
"PayloadType": {
|
|
307
422
|
"oneOf": [
|
|
308
423
|
{
|
|
@@ -985,18 +1100,41 @@
|
|
|
985
1100
|
"kind": "string"
|
|
986
1101
|
}
|
|
987
1102
|
},
|
|
1103
|
+
"modelLevel": {
|
|
1104
|
+
"required": true,
|
|
1105
|
+
"type": {
|
|
1106
|
+
"kind": "enum",
|
|
1107
|
+
"values": [
|
|
1108
|
+
"level1",
|
|
1109
|
+
"level2",
|
|
1110
|
+
"level3"
|
|
1111
|
+
]
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
988
1114
|
"prompt": {
|
|
989
1115
|
"required": false,
|
|
990
1116
|
"type": {
|
|
991
1117
|
"kind": "string"
|
|
992
1118
|
}
|
|
993
1119
|
},
|
|
1120
|
+
"provider": {
|
|
1121
|
+
"required": true,
|
|
1122
|
+
"type": {
|
|
1123
|
+
"kind": "string"
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
994
1126
|
"providerProfile": {
|
|
995
1127
|
"required": true,
|
|
996
1128
|
"type": {
|
|
997
1129
|
"kind": "string"
|
|
998
1130
|
}
|
|
999
1131
|
},
|
|
1132
|
+
"repository": {
|
|
1133
|
+
"required": true,
|
|
1134
|
+
"type": {
|
|
1135
|
+
"kind": "string"
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1000
1138
|
"source": {
|
|
1001
1139
|
"required": true,
|
|
1002
1140
|
"type": {
|
|
@@ -1114,6 +1252,30 @@
|
|
|
1114
1252
|
"kind": "array"
|
|
1115
1253
|
}
|
|
1116
1254
|
},
|
|
1255
|
+
"branch": {
|
|
1256
|
+
"required": false,
|
|
1257
|
+
"type": {
|
|
1258
|
+
"kind": "string"
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
"headRevision": {
|
|
1262
|
+
"required": false,
|
|
1263
|
+
"type": {
|
|
1264
|
+
"kind": "string"
|
|
1265
|
+
}
|
|
1266
|
+
},
|
|
1267
|
+
"pullRequestUrl": {
|
|
1268
|
+
"required": false,
|
|
1269
|
+
"type": {
|
|
1270
|
+
"kind": "string"
|
|
1271
|
+
}
|
|
1272
|
+
},
|
|
1273
|
+
"repository": {
|
|
1274
|
+
"required": false,
|
|
1275
|
+
"type": {
|
|
1276
|
+
"kind": "string"
|
|
1277
|
+
}
|
|
1278
|
+
},
|
|
1117
1279
|
"status": {
|
|
1118
1280
|
"required": true,
|
|
1119
1281
|
"type": {
|
|
@@ -21,8 +21,11 @@ import { getString, isRecord, unknownToMessage } from './json';
|
|
|
21
21
|
import type { ErrorClassification } from './types';
|
|
22
22
|
import type { ProcessRunner } from './process-runner';
|
|
23
23
|
|
|
24
|
-
function runBuildCommand(
|
|
25
|
-
|
|
24
|
+
function runBuildCommand(
|
|
25
|
+
request: RequestData,
|
|
26
|
+
runtimeSettings?: Record<string, unknown>
|
|
27
|
+
): ContractEnvelope {
|
|
28
|
+
const { adapter, commandSpec, options } = buildCommandSpec(request, runtimeSettings);
|
|
26
29
|
const webSearch = {
|
|
27
30
|
requested: options.webSearch === true,
|
|
28
31
|
effective: options.webSearch === true && options.cliFeatures?.supportsWebSearch === true,
|
|
@@ -134,19 +137,20 @@ function runClassifyError(request: RequestData): ContractEnvelope {
|
|
|
134
137
|
|
|
135
138
|
export function dispatchRequest(
|
|
136
139
|
request: RequestData,
|
|
137
|
-
runner: ProcessRunner
|
|
140
|
+
runner: ProcessRunner,
|
|
141
|
+
runtimeSettings?: Record<string, unknown>
|
|
138
142
|
): ContractEnvelope | Promise<ContractEnvelope> {
|
|
139
143
|
switch (request.command) {
|
|
140
144
|
case 'probe':
|
|
141
145
|
return runProbe(request);
|
|
142
146
|
case 'build-command':
|
|
143
|
-
return runBuildCommand(request);
|
|
147
|
+
return runBuildCommand(request, runtimeSettings);
|
|
144
148
|
case 'parse-output':
|
|
145
149
|
return runParseOutput(request);
|
|
146
150
|
case 'classify-error':
|
|
147
151
|
return runClassifyError(request);
|
|
148
152
|
case 'invoke':
|
|
149
|
-
return runInvoke(request, runner);
|
|
153
|
+
return runInvoke(request, runner, runtimeSettings);
|
|
150
154
|
default:
|
|
151
155
|
throw contractError({
|
|
152
156
|
code: 'unknown-command',
|
|
@@ -120,9 +120,10 @@ async function runOmpRpcContractPrompt(
|
|
|
120
120
|
|
|
121
121
|
export async function runInvoke(
|
|
122
122
|
request: RequestData,
|
|
123
|
-
runner: ProcessRunner
|
|
123
|
+
runner: ProcessRunner,
|
|
124
|
+
runtimeSettings?: Record<string, unknown>
|
|
124
125
|
): Promise<ContractEnvelope> {
|
|
125
|
-
const { adapter, commandSpec, context, options } = buildCommandSpec(request);
|
|
126
|
+
const { adapter, commandSpec, context, options } = buildCommandSpec(request, runtimeSettings);
|
|
126
127
|
const timeoutMs = optionalNumber(request.raw, 'timeoutMs');
|
|
127
128
|
const runnerOptions = timeoutMs === undefined ? {} : { timeoutMs };
|
|
128
129
|
const invokeSpec = getProviderRegistryEntry(adapter.id).invoke;
|
|
@@ -94,7 +94,10 @@ function buildOptions(request: RequestData): BuildProviderCommandOptions {
|
|
|
94
94
|
return { ...options, cwd };
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
export function buildCommandSpec(
|
|
97
|
+
export function buildCommandSpec(
|
|
98
|
+
request: RequestData,
|
|
99
|
+
runtimeSettings?: Record<string, unknown>
|
|
100
|
+
): {
|
|
98
101
|
readonly adapter: ProviderAdapter;
|
|
99
102
|
readonly commandSpec: CommandSpec;
|
|
100
103
|
readonly options: BuildProviderCommandOptions;
|
|
@@ -103,11 +106,14 @@ export function buildCommandSpec(request: RequestData): {
|
|
|
103
106
|
const adapter = adapterForProvider(request.provider);
|
|
104
107
|
const context = requiredString(request.raw, 'context');
|
|
105
108
|
const options = buildOptions(request);
|
|
106
|
-
const prepared = prepareSingleAgentProviderCommand(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
const prepared = prepareSingleAgentProviderCommand(
|
|
110
|
+
{
|
|
111
|
+
provider: adapter.id,
|
|
112
|
+
context,
|
|
113
|
+
options,
|
|
114
|
+
},
|
|
115
|
+
runtimeSettings
|
|
116
|
+
);
|
|
111
117
|
return {
|
|
112
118
|
adapter: prepared.adapter,
|
|
113
119
|
context,
|
|
@@ -32,6 +32,7 @@ export interface ProviderExecutableResponse {
|
|
|
32
32
|
|
|
33
33
|
export interface ProviderExecutableOptions {
|
|
34
34
|
readonly runner?: ProcessRunner;
|
|
35
|
+
readonly runtimeSettings?: Record<string, unknown>;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export async function runProviderExecutable(
|
|
@@ -41,7 +42,11 @@ export async function runProviderExecutable(
|
|
|
41
42
|
const fallback = requestEnvelopeData(input);
|
|
42
43
|
try {
|
|
43
44
|
const request = validateRequest(input, providerExecutableSchemaVersion);
|
|
44
|
-
const envelope = await dispatchRequest(
|
|
45
|
+
const envelope = await dispatchRequest(
|
|
46
|
+
request,
|
|
47
|
+
options.runner ?? spawnProcessRunner(),
|
|
48
|
+
options.runtimeSettings
|
|
49
|
+
);
|
|
45
50
|
return {
|
|
46
51
|
envelope: finalizeEnvelope(envelope, request.env),
|
|
47
52
|
exitCode: 0,
|
|
@@ -715,6 +715,10 @@ export function getProviderRegistryEntry(name: string): ProviderRegistryEntry {
|
|
|
715
715
|
throw new Error(`Unknown provider: ${name}. Valid: ${providerIds.join(', ')}`);
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
+
export function credentialEnvKeysForProvider(providerId: string): readonly string[] {
|
|
719
|
+
return getProviderRegistryEntry(providerId).credentialEnvKeys;
|
|
720
|
+
}
|
|
721
|
+
|
|
718
722
|
export function resolveProviderCommand(name: string): {
|
|
719
723
|
readonly command: string;
|
|
720
724
|
readonly args: readonly string[];
|