@cleocode/adapters 2026.11.3-canary.1 → 2026.11.3-canary.2

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.
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "schema": 2,
3
- "sourceHash": "8034596e7abb416a12355374e9702f02699183c838b57f32299168624f61c5ef"
3
+ "sourceHash": "e1f97297a2acfe976f0157621b8e42f200ccb848ab44cd1a280ac7bfbf119226"
4
4
  }
package/dist/index.js CHANGED
@@ -1127,7 +1127,7 @@ var init_code_symbol = __esm({
1127
1127
 
1128
1128
  // packages/contracts/src/orca-execution.ts
1129
1129
  import { z as z4 } from "zod";
1130
- var identifier, orcaAgentSchema, DEFAULT_ORCA_AGENTS, orchestrateOrcaConfigSchema, orcaContextSchema, orcaRoutingRunSchema, orcaLaunchSchema, orcaStartBindingSchema, orcaAttemptSchema, orcaWorkerDoneSchema, orcaWorkerReportSchema, orcaReportDeliverySchema, orcaWorkerSettlementSchema, orcaReportMessageSchema, orcaReportSourceSchema, orcaWorkerDonePayloadSchema, orcaWorkerRequestSchema, effectSchema, selectionSchema, orcaReplySchema, orcaCommandRegistrySchema, accountProviderSchema, orcaAccountReplySchema;
1130
+ var identifier, orcaAgentSchema, DEFAULT_ORCA_AGENTS, orchestrateOrcaConfigSchema, orcaContextSchema, orcaRoutingRunSchema, orcaLaunchSchema, orcaStartBindingSchema, orcaAttemptSchema, orcaWorkerDoneSchema, orcaWorkerReportSchema, orcaReportDeliverySchema, orcaWorkerSettlementSchema, orcaReportMessageSchema, orcaReportSourceSchema, orcaWorkerDonePayloadSchema, orcaWorkerRequestSchema, orcaLeadTerminalSchema, effectSchema, selectionSchema, orcaReplySchema, orcaCommandRegistrySchema, accountProviderSchema, orcaAccountReplySchema;
1131
1131
  var init_orca_execution = __esm({
1132
1132
  "packages/contracts/src/orca-execution.ts"() {
1133
1133
  "use strict";
@@ -1310,6 +1310,14 @@ var init_orca_execution = __esm({
1310
1310
  message: "ingest-report requires an exact message id; other actions do not accept one.",
1311
1311
  path: ["messageId"]
1312
1312
  });
1313
+ orcaLeadTerminalSchema = z4.object({
1314
+ /** Runtime that issued the terminal handle. */
1315
+ runtimeId: identifier,
1316
+ /** Handle for Orca terminal read/show/interrupt supervision. */
1317
+ terminalHandle: identifier,
1318
+ /** Shell PID, preserved by exec into the guarded provider. */
1319
+ pid: z4.number().int().positive()
1320
+ });
1313
1321
  effectSchema = z4.object({
1314
1322
  kind: z4.string(),
1315
1323
  role: z4.string().optional(),
@@ -47090,6 +47098,8 @@ import {
47090
47098
  orcaReportSourceSchema as orcaReportSourceSchema2,
47091
47099
  orcaWorkerDonePayloadSchema as orcaWorkerDonePayloadSchema2
47092
47100
  } from "@cleocode/contracts/orca-execution.js";
47101
+ import { PS_STABLE_ENV as PS_STABLE_ENV2 } from "@cleocode/contracts/process-probe.js";
47102
+ import { findOnPath, pathDelimiterFor, splitPathEnv } from "@cleocode/paths";
47093
47103
  var MAX_DIAGNOSTIC_LENGTH, MAX_RECEIPT_LENGTH, OrcaExecutionError;
47094
47104
  var init_orca_execution2 = __esm({
47095
47105
  "packages/adapters/src/orca-execution.ts"() {
@@ -47105,12 +47115,15 @@ var init_orca_execution2 = __esm({
47105
47115
  fix;
47106
47116
  /** Bounded original receipt, when available; oversized receipts are diagnostic only. */
47107
47117
  receipt;
47118
+ /** Nonsecret terminal/PID evidence for a guarded lead refusal. */
47119
+ details;
47108
47120
  /** Construct a refusal before any unsupported operation runs. */
47109
- constructor(code, message, fix, receipt = null) {
47121
+ constructor(code, message, fix, receipt = null, details) {
47110
47122
  super(message.slice(0, MAX_DIAGNOSTIC_LENGTH));
47111
47123
  this.name = "OrcaExecutionError";
47112
47124
  this.code = code;
47113
47125
  this.fix = fix;
47126
+ this.details = details;
47114
47127
  const truncated = "[truncated]\n";
47115
47128
  this.receipt = receipt !== null && receipt.length > MAX_RECEIPT_LENGTH ? truncated + receipt.slice(0, MAX_RECEIPT_LENGTH - truncated.length) : receipt;
47116
47129
  }
@@ -47355,7 +47368,7 @@ import {
47355
47368
  E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL3,
47356
47369
  LEAD_ASK_TOOL as LEAD_ASK_TOOL2
47357
47370
  } from "@cleocode/contracts/operations/orchestrate.js";
47358
- import { findOnPath, pathDelimiterFor, pathEnvKey, splitPathEnv } from "@cleocode/paths";
47371
+ import { findOnPath as findOnPath2, pathDelimiterFor as pathDelimiterFor2, pathEnvKey, splitPathEnv as splitPathEnv2 } from "@cleocode/paths";
47359
47372
  function leadSessionId(options) {
47360
47373
  const id = options?.leadSessionId;
47361
47374
  return typeof id === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id) ? id : void 0;
@@ -47365,8 +47378,8 @@ function leadModeOf(options) {
47365
47378
  }
47366
47379
  function resolveAbsoluteBinary(name15, env = process.env) {
47367
47380
  const key = pathEnvKey(env);
47368
- const absolute = splitPathEnv(env[key]).filter((dir) => isAbsolute4(dir));
47369
- return findOnPath(name15, { env: { ...env, [key]: absolute.join(pathDelimiterFor()) } });
47381
+ const absolute = splitPathEnv2(env[key]).filter((dir) => isAbsolute4(dir));
47382
+ return findOnPath2(name15, { env: { ...env, [key]: absolute.join(pathDelimiterFor2()) } });
47370
47383
  }
47371
47384
  function shellQuote(value) {
47372
47385
  if (value.includes("'")) throw new Error(`refusing a hook argument with a quote: ${value}`);
@@ -47548,7 +47561,7 @@ import { spawn as nodeSpawn2 } from "node:child_process";
47548
47561
  import { writeFile as writeFile3 } from "node:fs/promises";
47549
47562
  import { dirname as dirname7, join as join11 } from "node:path";
47550
47563
  import { E_LEAD_NO_OWNER_CHANNEL as E_LEAD_NO_OWNER_CHANNEL4 } from "@cleocode/contracts/operations/orchestrate.js";
47551
- import { findOnPath as findOnPath2 } from "@cleocode/paths";
47564
+ import { findOnPath as findOnPath3 } from "@cleocode/paths";
47552
47565
  function trackedWorkerInstanceId(options) {
47553
47566
  const id = options?.workerInstanceId;
47554
47567
  return typeof id === "string" && /^[A-Za-z0-9-]+$/.test(id) ? id : void 0;
@@ -47609,7 +47622,7 @@ var init_spawn2 = __esm({
47609
47622
  * @returns true if `claude` is found on PATH (PATHEXT-aware on Windows)
47610
47623
  */
47611
47624
  async canSpawn() {
47612
- return findOnPath2("claude") !== null;
47625
+ return findOnPath3("claude") !== null;
47613
47626
  }
47614
47627
  /**
47615
47628
  * Spawn a subagent via Claude CLI.
@@ -47789,7 +47802,8 @@ var init_spawn2 = __esm({
47789
47802
  await removeSpawnPromptFile(tmpFile);
47790
47803
  }
47791
47804
  if (context.leadTerminalLauncher) {
47792
- if (error48 instanceof OrcaExecutionError) throw error48;
47805
+ if (typeof error48 === "object" && error48 !== null && "code" in error48 && typeof error48.code === "string" && "fix" in error48 && typeof error48.fix === "string")
47806
+ throw error48;
47793
47807
  throw new OrcaExecutionError(
47794
47808
  "E_LEAD_TOOLS_UNSTRIPPED",
47795
47809
  getErrorMessage(error48),
@@ -47975,7 +47989,7 @@ var init_transport = __esm({
47975
47989
  import { existsSync as existsSync9 } from "node:fs";
47976
47990
  import { homedir as homedir6 } from "node:os";
47977
47991
  import { join as join13 } from "node:path";
47978
- import { findOnPath as findOnPath3 } from "@cleocode/paths";
47992
+ import { findOnPath as findOnPath4 } from "@cleocode/paths";
47979
47993
  var ClaudeCodeAdapter;
47980
47994
  var init_adapter = __esm({
47981
47995
  "packages/adapters/src/providers/claude-code/adapter.ts"() {
@@ -48123,7 +48137,7 @@ var init_adapter = __esm({
48123
48137
  };
48124
48138
  }
48125
48139
  let cliAvailable = false;
48126
- const resolvedCli = findOnPath3("claude");
48140
+ const resolvedCli = findOnPath4("claude");
48127
48141
  cliAvailable = resolvedCli !== null;
48128
48142
  if (resolvedCli) details.cliPath = resolvedCli;
48129
48143
  else details.cliAvailable = false;
@@ -49143,7 +49157,7 @@ var init_install3 = __esm({
49143
49157
  // packages/adapters/src/providers/opencode/spawn.ts
49144
49158
  import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile4 } from "node:fs/promises";
49145
49159
  import { join as join28 } from "node:path";
49146
- import { findOnPath as findOnPath10 } from "@cleocode/paths";
49160
+ import { findOnPath as findOnPath11 } from "@cleocode/paths";
49147
49161
  function buildOpenCodeAgentMarkdown(description, instructions) {
49148
49162
  const normalizedDesc = description.replace(/\s+/g, " ").trim();
49149
49163
  return [
@@ -49202,7 +49216,7 @@ var init_spawn3 = __esm({
49202
49216
  * @returns true if `opencode` is found on PATH (PATHEXT-aware on Windows)
49203
49217
  */
49204
49218
  async canSpawn() {
49205
- return findOnPath10("opencode") !== null;
49219
+ return findOnPath11("opencode") !== null;
49206
49220
  }
49207
49221
  /**
49208
49222
  * Spawn a subagent via OpenCode CLI.
@@ -49329,7 +49343,7 @@ var init_spawn3 = __esm({
49329
49343
  // packages/adapters/src/providers/opencode/adapter.ts
49330
49344
  import { existsSync as existsSync20 } from "node:fs";
49331
49345
  import { join as join29 } from "node:path";
49332
- import { findOnPath as findOnPath11 } from "@cleocode/paths";
49346
+ import { findOnPath as findOnPath12 } from "@cleocode/paths";
49333
49347
  var OpenCodeAdapter;
49334
49348
  var init_adapter3 = __esm({
49335
49349
  "packages/adapters/src/providers/opencode/adapter.ts"() {
@@ -49431,7 +49445,7 @@ var init_adapter3 = __esm({
49431
49445
  };
49432
49446
  }
49433
49447
  let cliAvailable = false;
49434
- const resolvedCli = findOnPath11("opencode");
49448
+ const resolvedCli = findOnPath12("opencode");
49435
49449
  cliAvailable = resolvedCli !== null;
49436
49450
  if (resolvedCli) details.cliPath = resolvedCli;
49437
49451
  else details.cliAvailable = false;
@@ -49722,7 +49736,7 @@ var init_install4 = __esm({
49722
49736
  });
49723
49737
 
49724
49738
  // packages/adapters/src/providers/pi/spawn.ts
49725
- import { findOnPath as findOnPath13 } from "@cleocode/paths";
49739
+ import { findOnPath as findOnPath14 } from "@cleocode/paths";
49726
49740
  function getPiCliPath() {
49727
49741
  return process.env["PI_CLI_PATH"] ?? "pi";
49728
49742
  }
@@ -49748,7 +49762,7 @@ var init_spawn4 = __esm({
49748
49762
  */
49749
49763
  async canSpawn() {
49750
49764
  const cliPath = getPiCliPath();
49751
- return findOnPath13(cliPath) !== null;
49765
+ return findOnPath14(cliPath) !== null;
49752
49766
  }
49753
49767
  /**
49754
49768
  * Spawn a subagent via Pi CLI.
@@ -49863,7 +49877,7 @@ var init_spawn4 = __esm({
49863
49877
  import { existsSync as existsSync23 } from "node:fs";
49864
49878
  import { homedir as homedir14 } from "node:os";
49865
49879
  import { join as join33 } from "node:path";
49866
- import { findOnPath as findOnPath14 } from "@cleocode/paths";
49880
+ import { findOnPath as findOnPath15 } from "@cleocode/paths";
49867
49881
  function getPiAgentDir() {
49868
49882
  const env = process.env["PI_CODING_AGENT_DIR"];
49869
49883
  if (env !== void 0 && env.length > 0) {
@@ -49978,7 +49992,7 @@ var init_adapter4 = __esm({
49978
49992
  }
49979
49993
  let cliAvailable = false;
49980
49994
  const cliPath = process.env["PI_CLI_PATH"] ?? "pi";
49981
- const resolvedCli = findOnPath14(cliPath);
49995
+ const resolvedCli = findOnPath15(cliPath);
49982
49996
  cliAvailable = resolvedCli !== null;
49983
49997
  if (resolvedCli) details.cliPath = cliPath === "pi" ? resolvedCli : cliPath;
49984
49998
  else details.cliAvailable = false;
@@ -50202,7 +50216,7 @@ function createAdapter2() {
50202
50216
  import { existsSync as existsSync12 } from "node:fs";
50203
50217
  import { homedir as homedir9 } from "node:os";
50204
50218
  import { join as join19 } from "node:path";
50205
- import { findOnPath as findOnPath4 } from "@cleocode/paths";
50219
+ import { findOnPath as findOnPath5 } from "@cleocode/paths";
50206
50220
 
50207
50221
  // packages/adapters/src/providers/codex/hooks.ts
50208
50222
  import { homedir as homedir8 } from "node:os";
@@ -50495,7 +50509,7 @@ var CodexAdapter = class {
50495
50509
  };
50496
50510
  }
50497
50511
  let cliAvailable = false;
50498
- const resolvedCli = findOnPath4("codex");
50512
+ const resolvedCli = findOnPath5("codex");
50499
50513
  cliAvailable = resolvedCli !== null;
50500
50514
  if (resolvedCli) details.cliPath = resolvedCli;
50501
50515
  else details.cliAvailable = false;
@@ -50531,7 +50545,7 @@ init_src();
50531
50545
  init_cli_spawn();
50532
50546
  init_lead_tool_strip();
50533
50547
  init_prompt_file();
50534
- import { findOnPath as findOnPath5 } from "@cleocode/paths";
50548
+ import { findOnPath as findOnPath6 } from "@cleocode/paths";
50535
50549
 
50536
50550
  // packages/adapters/src/providers/codex/index.ts
50537
50551
  function createAdapter3() {
@@ -50545,7 +50559,7 @@ init_cursor();
50545
50559
  import { existsSync as existsSync16 } from "node:fs";
50546
50560
  import { homedir as homedir11 } from "node:os";
50547
50561
  import { join as join24 } from "node:path";
50548
- import { findOnPath as findOnPath6 } from "@cleocode/paths";
50562
+ import { findOnPath as findOnPath7 } from "@cleocode/paths";
50549
50563
 
50550
50564
  // packages/adapters/src/providers/gemini-cli/hooks.ts
50551
50565
  import { homedir as homedir10 } from "node:os";
@@ -50787,7 +50801,7 @@ var GeminiCliAdapter = class {
50787
50801
  };
50788
50802
  }
50789
50803
  let cliAvailable = false;
50790
- const resolvedCli = findOnPath6("gemini");
50804
+ const resolvedCli = findOnPath7("gemini");
50791
50805
  cliAvailable = resolvedCli !== null;
50792
50806
  if (resolvedCli) details.cliPath = resolvedCli;
50793
50807
  else details.cliAvailable = false;
@@ -50822,7 +50836,7 @@ var GeminiCliAdapter = class {
50822
50836
  init_src();
50823
50837
  init_cli_spawn();
50824
50838
  init_lead_tool_strip();
50825
- import { findOnPath as findOnPath7 } from "@cleocode/paths";
50839
+ import { findOnPath as findOnPath8 } from "@cleocode/paths";
50826
50840
 
50827
50841
  // packages/adapters/src/providers/gemini-cli/index.ts
50828
50842
  function createAdapter5() {
@@ -50833,7 +50847,7 @@ function createAdapter5() {
50833
50847
  import { existsSync as existsSync18 } from "node:fs";
50834
50848
  import { homedir as homedir12 } from "node:os";
50835
50849
  import { join as join26 } from "node:path";
50836
- import { findOnPath as findOnPath8 } from "@cleocode/paths";
50850
+ import { findOnPath as findOnPath9 } from "@cleocode/paths";
50837
50851
 
50838
50852
  // packages/adapters/src/providers/kimi/hooks.ts
50839
50853
  var KimiHookProvider = class {
@@ -51043,7 +51057,7 @@ var KimiAdapter = class {
51043
51057
  };
51044
51058
  }
51045
51059
  let cliAvailable = false;
51046
- const resolvedCli = findOnPath8("kimi");
51060
+ const resolvedCli = findOnPath9("kimi");
51047
51061
  cliAvailable = resolvedCli !== null;
51048
51062
  if (resolvedCli) details.cliPath = resolvedCli;
51049
51063
  else details.cliAvailable = false;
@@ -51077,7 +51091,7 @@ var KimiAdapter = class {
51077
51091
  // packages/adapters/src/providers/kimi/spawn.ts
51078
51092
  init_src();
51079
51093
  init_lead_tool_strip();
51080
- import { findOnPath as findOnPath9 } from "@cleocode/paths";
51094
+ import { findOnPath as findOnPath10 } from "@cleocode/paths";
51081
51095
 
51082
51096
  // packages/adapters/src/providers/kimi/index.ts
51083
51097
  function createAdapter6() {
@@ -51096,7 +51110,7 @@ import { existsSync as existsSync21, lstatSync, readFileSync as readFileSync13,
51096
51110
  import { homedir as homedir13 } from "node:os";
51097
51111
  import { dirname as dirname8, join as join30 } from "node:path";
51098
51112
  import { JsonConfigParseError } from "@cleocode/caamp";
51099
- import { findOnPath as findOnPath12 } from "@cleocode/paths";
51113
+ import { findOnPath as findOnPath13 } from "@cleocode/paths";
51100
51114
  var HEAVY_HOOK_DELIVERY_PROVIDERS = Object.freeze([
51101
51115
  "claude-code",
51102
51116
  "codex",
@@ -51130,11 +51144,11 @@ function detectHeavyHookProvider(provider, projectDir, env = process.env) {
51130
51144
  "running inside Claude Code"
51131
51145
  ],
51132
51146
  [() => existsSync21(join30(projectDir, ".claude")), "the project has .claude/"],
51133
- [() => findOnPath12("claude", { env }) !== null, "`claude` is on PATH"],
51147
+ [() => findOnPath13("claude", { env }) !== null, "`claude` is on PATH"],
51134
51148
  [() => existsSync21(env.CLAUDE_CONFIG_DIR || join30(home, ".claude")), "~/.claude exists"]
51135
51149
  ] : provider === "codex" ? [
51136
51150
  [() => existsSync21(join30(projectDir, ".codex")), "the project has .codex"],
51137
- [() => findOnPath12("codex", { env }) !== null, "`codex` is on PATH"],
51151
+ [() => findOnPath13("codex", { env }) !== null, "`codex` is on PATH"],
51138
51152
  [() => existsSync21(env.CODEX_HOME || join30(home, ".codex")), "~/.codex exists"]
51139
51153
  ] : provider === "opencode" ? [
51140
51154
  [() => existsSync21(join30(projectDir, ".opencode")), "the project has .opencode/"],
@@ -51142,13 +51156,13 @@ function detectHeavyHookProvider(provider, projectDir, env = process.env) {
51142
51156
  () => existsSync21(join30(projectDir, "opencode.json")) || existsSync21(join30(projectDir, "opencode.jsonc")),
51143
51157
  "the project has opencode.json"
51144
51158
  ],
51145
- [() => findOnPath12("opencode", { env }) !== null, "`opencode` is on PATH"],
51159
+ [() => findOnPath13("opencode", { env }) !== null, "`opencode` is on PATH"],
51146
51160
  [
51147
51161
  () => existsSync21(join30(env.XDG_CONFIG_HOME || join30(home, ".config"), "opencode")),
51148
51162
  "~/.config/opencode exists"
51149
51163
  ]
51150
51164
  ] : [
51151
- [() => findOnPath12("kimi", { env }) !== null, "`kimi` is on PATH"],
51165
+ [() => findOnPath13("kimi", { env }) !== null, "`kimi` is on PATH"],
51152
51166
  [() => existsSync21(join30(home, ".kimi")), "~/.kimi exists"]
51153
51167
  ];
51154
51168
  for (const [test, why] of signals) {
@@ -51522,7 +51536,7 @@ function hasOlderCleoMarker(cleoPath, dir, env) {
51522
51536
  }
51523
51537
  function probeHeavyHookCli(projectDir, options = {}) {
51524
51538
  const env = options.env ?? process.env;
51525
- const path = findOnPath12("cleo", { env });
51539
+ const path = findOnPath13("cleo", { env });
51526
51540
  if (path === null) {
51527
51541
  return {
51528
51542
  state: "missing",