@cat-factory/executor-harness 1.50.0 → 1.50.4
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/agent-runner.js +35 -28
- package/dist/coding-agent.js +380 -321
- package/package.json +3 -3
- package/src/agent-runner.ts +35 -31
- package/src/coding-agent.ts +449 -336
package/dist/agent-runner.js
CHANGED
|
@@ -39,7 +39,8 @@ function attributeCumulativeUsage(calls, usage) {
|
|
|
39
39
|
* system-prompt flag — the caller prepends the composed system prompt to it so
|
|
40
40
|
* the role + best-practice context is not lost.
|
|
41
41
|
*/
|
|
42
|
-
function streamCli(
|
|
42
|
+
function streamCli(cli, prompt, opts, env, secrets, onEvent) {
|
|
43
|
+
const { command, args } = cli;
|
|
43
44
|
return new Promise((resolve, reject) => {
|
|
44
45
|
if (opts.signal?.aborted) {
|
|
45
46
|
reject(new Error(`${command} aborted before start`));
|
|
@@ -271,22 +272,25 @@ export async function runClaudeCode(opts) {
|
|
|
271
272
|
: { CLAUDE_CODE_OAUTH_TOKEN: opts.subscriptionToken }),
|
|
272
273
|
};
|
|
273
274
|
try {
|
|
274
|
-
const { stderrTail } = await streamCli(
|
|
275
|
-
'
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
275
|
+
const { stderrTail } = await streamCli({
|
|
276
|
+
command: 'claude',
|
|
277
|
+
args: [
|
|
278
|
+
'-p',
|
|
279
|
+
'--output-format',
|
|
280
|
+
'stream-json',
|
|
281
|
+
'--verbose',
|
|
282
|
+
// The per-run container IS the sandbox, and the run is fully headless (no one
|
|
283
|
+
// to approve a tool call) — so bypass permissions entirely. `acceptEdits`
|
|
284
|
+
// would auto-accept file edits but still gate Bash, which in `-p` mode is then
|
|
285
|
+
// denied, leaving the agent unable to run builds/tests/git to verify its work.
|
|
286
|
+
'--permission-mode',
|
|
287
|
+
'bypassPermissions',
|
|
288
|
+
'--model',
|
|
289
|
+
opts.model,
|
|
290
|
+
'--append-system-prompt',
|
|
291
|
+
opts.systemPrompt,
|
|
292
|
+
],
|
|
293
|
+
}, opts.userPrompt, opts, env, opts.subscriptionToken ? secretsToRedact(opts.subscriptionToken) : [], onEvent);
|
|
290
294
|
attributeCumulativeUsage(calls, usage);
|
|
291
295
|
return {
|
|
292
296
|
summary,
|
|
@@ -472,17 +476,20 @@ export async function runCodex(opts) {
|
|
|
472
476
|
}
|
|
473
477
|
};
|
|
474
478
|
try {
|
|
475
|
-
const { stderrTail } = await streamCli(
|
|
476
|
-
'
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
479
|
+
const { stderrTail } = await streamCli({
|
|
480
|
+
command: 'codex',
|
|
481
|
+
args: [
|
|
482
|
+
'exec',
|
|
483
|
+
'--json',
|
|
484
|
+
'--skip-git-repo-check',
|
|
485
|
+
// The per-run container IS the sandbox; let Codex write files and reach the
|
|
486
|
+
// vendor unrestricted, with no approval prompts (the run is headless).
|
|
487
|
+
'--dangerously-bypass-approvals-and-sandbox',
|
|
488
|
+
'--model',
|
|
489
|
+
opts.model,
|
|
490
|
+
'-',
|
|
491
|
+
],
|
|
492
|
+
}, prompt, opts, codexHome ? { CODEX_HOME: codexHome } : {}, opts.subscriptionToken ? secretsToRedact(opts.subscriptionToken) : [], onEvent);
|
|
486
493
|
// Fallback for a CLI/version that never emits per-turn `last_token_usage`: record a
|
|
487
494
|
// single call from the cumulative total + final text so the run is still observable.
|
|
488
495
|
if (calls.length === 0 && (usage || summary)) {
|