@the-open-engine/zeroshot 6.37.0 → 6.38.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/lib/setup-scanner-worker.js +2 -9
- package/lib/agent-cli-provider/adapters/claude-recovery.d.ts.map +1 -1
- package/lib/agent-cli-provider/adapters/claude-recovery.js +17 -3
- package/lib/agent-cli-provider/adapters/claude-recovery.js.map +1 -1
- package/lib/agent-cli-provider/adapters/index.d.ts.map +1 -1
- package/lib/agent-cli-provider/adapters/index.js +7 -0
- package/lib/agent-cli-provider/adapters/index.js.map +1 -1
- package/lib/agent-cli-provider/adapters/pi.d.ts.map +1 -1
- package/lib/agent-cli-provider/adapters/pi.js +86 -97
- package/lib/agent-cli-provider/adapters/pi.js.map +1 -1
- package/lib/agent-cli-provider/contract-parse.d.ts.map +1 -1
- package/lib/agent-cli-provider/contract-parse.js +5 -1
- package/lib/agent-cli-provider/contract-parse.js.map +1 -1
- package/lib/agent-cli-provider/invoke-evidence.d.ts.map +1 -1
- package/lib/agent-cli-provider/invoke-evidence.js +8 -1
- package/lib/agent-cli-provider/invoke-evidence.js.map +1 -1
- package/lib/agent-cli-provider/pi/credentials.d.ts +2 -0
- package/lib/agent-cli-provider/pi/credentials.d.ts.map +1 -0
- package/lib/agent-cli-provider/pi/credentials.js +51 -0
- package/lib/agent-cli-provider/pi/credentials.js.map +1 -0
- package/lib/agent-cli-provider/pi/events.d.ts +5 -0
- package/lib/agent-cli-provider/pi/events.d.ts.map +1 -0
- package/lib/agent-cli-provider/pi/events.js +124 -0
- package/lib/agent-cli-provider/pi/events.js.map +1 -0
- package/lib/agent-cli-provider/pi/protocol-state.d.ts +6 -0
- package/lib/agent-cli-provider/pi/protocol-state.d.ts.map +1 -0
- package/lib/agent-cli-provider/pi/protocol-state.js +138 -0
- package/lib/agent-cli-provider/pi/protocol-state.js.map +1 -0
- package/lib/agent-cli-provider/pi/release.d.ts +4 -0
- package/lib/agent-cli-provider/pi/release.d.ts.map +1 -0
- package/lib/agent-cli-provider/pi/release.js +7 -0
- package/lib/agent-cli-provider/pi/release.js.map +1 -0
- package/lib/agent-cli-provider/probe-availability.d.ts +5 -0
- package/lib/agent-cli-provider/probe-availability.d.ts.map +1 -0
- package/lib/agent-cli-provider/probe-availability.js +11 -0
- package/lib/agent-cli-provider/probe-availability.js.map +1 -0
- package/lib/agent-cli-provider/provider-registry.d.ts +13 -9
- package/lib/agent-cli-provider/provider-registry.d.ts.map +1 -1
- package/lib/agent-cli-provider/provider-registry.js +42 -8
- package/lib/agent-cli-provider/provider-registry.js.map +1 -1
- package/lib/agent-cli-provider/single-agent-runtime.d.ts.map +1 -1
- package/lib/agent-cli-provider/single-agent-runtime.js +15 -5
- package/lib/agent-cli-provider/single-agent-runtime.js.map +1 -1
- package/lib/agent-cli-provider/types.d.ts +3 -0
- package/lib/agent-cli-provider/types.d.ts.map +1 -1
- package/lib/agent-cli-provider/types.js.map +1 -1
- package/lib/cluster-worker/engine-adapter.js +9 -1
- package/lib/docker-config.js +6 -1
- package/lib/provider-credential-path.js +36 -0
- package/lib/start-cluster.js +8 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/agent/agent-task-executor.js +79 -20
- package/src/agent/output-extraction.js +115 -0
- package/src/agent/pi-terminal-lifecycle.js +242 -0
- package/src/agent/provider-control-plane.js +26 -0
- package/src/agent/provider-terminal-failure.js +49 -24
- package/src/agent-cli-provider/adapters/claude-recovery.ts +15 -2
- package/src/agent-cli-provider/adapters/index.ts +6 -0
- package/src/agent-cli-provider/adapters/pi.ts +105 -125
- package/src/agent-cli-provider/contract-parse.ts +8 -1
- package/src/agent-cli-provider/invoke-evidence.ts +11 -1
- package/src/agent-cli-provider/pi/credentials.ts +47 -0
- package/src/agent-cli-provider/pi/events.ts +148 -0
- package/src/agent-cli-provider/pi/protocol-state.ts +163 -0
- package/src/agent-cli-provider/pi/release.ts +4 -0
- package/src/agent-cli-provider/probe-availability.ts +19 -0
- package/src/agent-cli-provider/provider-registry.ts +48 -9
- package/src/agent-cli-provider/single-agent-runtime.ts +27 -6
- package/src/agent-cli-provider/types.ts +3 -0
- package/src/config-validator.js +1 -3
- package/src/isolation-manager.js +43 -29
- package/src/orchestrator.js +33 -1
- package/task-lib/watcher-output-runtime.js +16 -5
package/src/orchestrator.js
CHANGED
|
@@ -111,6 +111,35 @@ function applyModelOverride(agentConfig, modelOverride) {
|
|
|
111
111
|
*/
|
|
112
112
|
const VALID_OPERATIONS = ['add_agents', 'remove_agents', 'update_agent', 'publish', 'load_config'];
|
|
113
113
|
|
|
114
|
+
function isValidPreparedWorktreeDescriptor(prepared, cwd) {
|
|
115
|
+
if (!prepared) return false;
|
|
116
|
+
if (typeof prepared !== 'object') return false;
|
|
117
|
+
if (path.resolve(String(prepared.path)) !== cwd) return false;
|
|
118
|
+
if (path.resolve(String(prepared.repoRoot)) !== cwd) return false;
|
|
119
|
+
if (typeof prepared.branch !== 'string') return false;
|
|
120
|
+
if (prepared.branch.length === 0) return false;
|
|
121
|
+
if (prepared.branch.length > 255) return false;
|
|
122
|
+
return /^[0-9a-f]{40}$/.test(String(prepared.baseSha));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function resolvePreparedWorktree(options) {
|
|
126
|
+
const prepared = options.preparedWorktree;
|
|
127
|
+
if (!prepared) return null;
|
|
128
|
+
const cwd = path.resolve(options.cwd || process.cwd());
|
|
129
|
+
if (options.worktree !== true || options.isolation) {
|
|
130
|
+
throw new Error('Invalid prepared worktree authority');
|
|
131
|
+
}
|
|
132
|
+
if (!isValidPreparedWorktreeDescriptor(prepared, cwd)) {
|
|
133
|
+
throw new Error('Invalid prepared worktree authority');
|
|
134
|
+
}
|
|
135
|
+
return Object.freeze({
|
|
136
|
+
path: cwd,
|
|
137
|
+
repoRoot: cwd,
|
|
138
|
+
branch: prepared.branch,
|
|
139
|
+
baseSha: prepared.baseSha,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
114
143
|
/**
|
|
115
144
|
* Workflow-triggering topics that indicate cluster state progression
|
|
116
145
|
* These are the topics that MATTER for resume - not AGENT_OUTPUT noise
|
|
@@ -1854,7 +1883,10 @@ class Orchestrator {
|
|
|
1854
1883
|
let worktreeInfo = null;
|
|
1855
1884
|
let isolationImage = null;
|
|
1856
1885
|
|
|
1857
|
-
if (options.
|
|
1886
|
+
if (options.preparedWorktree) {
|
|
1887
|
+
worktreeInfo = resolvePreparedWorktree(options);
|
|
1888
|
+
this._log(`[Orchestrator] Using prepared worktree: ${worktreeInfo.path}`);
|
|
1889
|
+
} else if (options.isolation) {
|
|
1858
1890
|
// Resolve the provider first so the capability gate and the cluster's image variant (which
|
|
1859
1891
|
// installs the provider CLI as a Docker-cached layer) both see the same provider. Providers
|
|
1860
1892
|
// baked into the base image (e.g. Claude) resolve back to the base image unchanged.
|
|
@@ -103,7 +103,12 @@ function createCodexOutputPassthrough({ log, captureProviderSession }) {
|
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
function createBoundedLinePassthrough({
|
|
106
|
+
function createBoundedLinePassthrough({
|
|
107
|
+
log,
|
|
108
|
+
handleLine,
|
|
109
|
+
deferRawUntilOverflow = false,
|
|
110
|
+
linePrefix = '',
|
|
111
|
+
}) {
|
|
107
112
|
const decoder = new StringDecoder('utf8');
|
|
108
113
|
let atLineStart = true;
|
|
109
114
|
let lineTimestamp = null;
|
|
@@ -160,7 +165,7 @@ function createBoundedLinePassthrough({ log, handleLine, deferRawUntilOverflow =
|
|
|
160
165
|
while (offset < text.length) {
|
|
161
166
|
if (atLineStart) {
|
|
162
167
|
lineTimestamp = Date.now();
|
|
163
|
-
appendRaw(logged, `[${lineTimestamp}]`);
|
|
168
|
+
appendRaw(logged, `[${lineTimestamp}]${linePrefix}`);
|
|
164
169
|
atLineStart = false;
|
|
165
170
|
}
|
|
166
171
|
const newline = text.indexOf('\n', offset);
|
|
@@ -361,6 +366,10 @@ export function createWatcherOutputRuntime({
|
|
|
361
366
|
});
|
|
362
367
|
const stderrPassthrough = createBoundedLinePassthrough({
|
|
363
368
|
log,
|
|
369
|
+
// Pi reserves stdout for its JSON protocol and deliberately routes ordinary writes to
|
|
370
|
+
// stderr. Keep those diagnostics in the task log with explicit provenance so followers can
|
|
371
|
+
// exclude them from strict JSON validation.
|
|
372
|
+
linePrefix: providerName === 'pi' ? '[ZEROSHOT][PROVIDER_STDERR] ' : '',
|
|
364
373
|
handleLine: (line, timestamp) => maybeHandleFatalError(line, timestamp),
|
|
365
374
|
});
|
|
366
375
|
|
|
@@ -370,7 +379,7 @@ export function createWatcherOutputRuntime({
|
|
|
370
379
|
if (!detected) return false;
|
|
371
380
|
fatalError = detected;
|
|
372
381
|
if (silentJsonMode) log(`[${timestamp}]${line}\n`);
|
|
373
|
-
log(`[${timestamp}][FATAL] ${detected}\n`);
|
|
382
|
+
log(`[${timestamp}][ZEROSHOT][FATAL] ${detected}\n`);
|
|
374
383
|
stopProvider(timestamp);
|
|
375
384
|
return true;
|
|
376
385
|
}
|
|
@@ -396,13 +405,15 @@ export function createWatcherOutputRuntime({
|
|
|
396
405
|
fatalError =
|
|
397
406
|
`Provider structured output exceeded the ${MAX_WATCHER_CONTROL_RECORD_BYTES}-byte ` +
|
|
398
407
|
'watcher inspection limit; complete output remains in the task log';
|
|
399
|
-
log(`[${timestamp}][FATAL] ${fatalError}\n`);
|
|
408
|
+
log(`[${timestamp}][ZEROSHOT][FATAL] ${fatalError}\n`);
|
|
400
409
|
stopProvider(timestamp);
|
|
401
410
|
return;
|
|
402
411
|
}
|
|
403
412
|
captureProviderSession(line);
|
|
404
413
|
if (silentJsonMode && !line.trim()) return;
|
|
405
|
-
|
|
414
|
+
// Pi reserves stdout for JSON lifecycle events. Error text inside an assistant message may be
|
|
415
|
+
// followed by an automatic retry, so only Pi stderr can prove a pre-agent startup failure.
|
|
416
|
+
if (providerName !== 'pi') maybeHandleFatalError(line, timestamp);
|
|
406
417
|
if (captureStreamingError(line, timestamp)) return;
|
|
407
418
|
if (silentJsonMode) {
|
|
408
419
|
maybeCaptureStructuredOutput(line);
|