@cleocode/adapters 2026.11.2 → 2026.11.3-canary.1

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.
@@ -26,6 +26,7 @@ import type {
26
26
  import { getErrorMessage } from '@cleocode/contracts';
27
27
  import { E_LEAD_NO_OWNER_CHANNEL } from '@cleocode/contracts/operations/orchestrate.js';
28
28
  import { findOnPath } from '@cleocode/paths';
29
+ import { OrcaExecutionError } from '../../orca-execution.js';
29
30
  import { buildAgentSpawnArgs } from '../shared/agent-spawn-wrapper.js';
30
31
  import { leadDeniedTools } from '../shared/lead-tool-strip.js';
31
32
  import { removeSpawnPromptFile, writeSpawnPromptFile } from '../shared/prompt-file.js';
@@ -247,6 +248,34 @@ export class ClaudeCodeSpawnProvider implements AdapterSpawnProvider {
247
248
  leadMcp: leadMcp.report,
248
249
  };
249
250
  }
251
+ if (context.leadTerminalLauncher) {
252
+ const command = resolveAbsoluteBinary('claude');
253
+ if (!command || !context.onLeadStarted) {
254
+ throw new Error(
255
+ 'The guarded Orca lead needs an absolute claude binary and a lifecycle recorder.',
256
+ );
257
+ }
258
+ const terminal = await context.leadTerminalLauncher(
259
+ {
260
+ command,
261
+ args: buildClaudeArgs(context, tmpFile, settingsArgs, leadMcp),
262
+ cwd: context.workingDirectory ?? process.cwd(),
263
+ tempDir: dir,
264
+ env: envStrings(context.options),
265
+ },
266
+ context.onLeadStarted,
267
+ );
268
+ return {
269
+ instanceId,
270
+ taskId: context.taskId,
271
+ providerId: 'claude-code',
272
+ status: 'running',
273
+ startTime,
274
+ leadMcp: leadMcp.report,
275
+ leadTempDir: dir,
276
+ leadTerminal: terminal,
277
+ };
278
+ }
250
279
  if (leadModeOf(context.options) === 'interactive') {
251
280
  // T14363: the owner's terminal — stdio inherited, awaited, not detached.
252
281
  const env = envStrings(context.options);
@@ -354,12 +383,19 @@ export class ClaudeCodeSpawnProvider implements AdapterSpawnProvider {
354
383
  ...(leadMcp ? { leadMcp: leadMcp.report, leadTempDir: dirname(tmpFile) } : {}),
355
384
  };
356
385
  } catch (error) {
357
- // Log spawn failure for debugging
358
- console.error(`[ClaudeCodeSpawnProvider] Failed to spawn: ${getErrorMessage(error)}`);
359
-
360
386
  if (tmpFile) {
361
387
  await removeSpawnPromptFile(tmpFile);
362
388
  }
389
+ if (context.leadTerminalLauncher) {
390
+ if (error instanceof OrcaExecutionError) throw error;
391
+ throw new OrcaExecutionError(
392
+ 'E_LEAD_TOOLS_UNSTRIPPED',
393
+ getErrorMessage(error),
394
+ 'Inspect the guarded Orca terminal setup and use --adapter claude-code; keep orchestrate.leadWorker.v1 enabled.',
395
+ );
396
+ }
397
+ // Log spawn failure for debugging
398
+ console.error(`[ClaudeCodeSpawnProvider] Failed to spawn: ${getErrorMessage(error)}`);
363
399
 
364
400
  return {
365
401
  instanceId,