@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.
@@ -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(command, args, prompt, opts, env, secrets, onEvent) {
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('claude', [
275
- '-p',
276
- '--output-format',
277
- 'stream-json',
278
- '--verbose',
279
- // The per-run container IS the sandbox, and the run is fully headless (no one
280
- // to approve a tool call) — so bypass permissions entirely. `acceptEdits`
281
- // would auto-accept file edits but still gate Bash, which in `-p` mode is then
282
- // denied, leaving the agent unable to run builds/tests/git to verify its work.
283
- '--permission-mode',
284
- 'bypassPermissions',
285
- '--model',
286
- opts.model,
287
- '--append-system-prompt',
288
- opts.systemPrompt,
289
- ], opts.userPrompt, opts, env, opts.subscriptionToken ? secretsToRedact(opts.subscriptionToken) : [], onEvent);
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('codex', [
476
- 'exec',
477
- '--json',
478
- '--skip-git-repo-check',
479
- // The per-run container IS the sandbox; let Codex write files and reach the
480
- // vendor unrestricted, with no approval prompts (the run is headless).
481
- '--dangerously-bypass-approvals-and-sandbox',
482
- '--model',
483
- opts.model,
484
- '-',
485
- ], prompt, opts, codexHome ? { CODEX_HOME: codexHome } : {}, opts.subscriptionToken ? secretsToRedact(opts.subscriptionToken) : [], onEvent);
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)) {