@sideboard-ai/core 0.1.348 → 0.1.350

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.
Files changed (84) hide show
  1. package/dist/{abletime-CGFJZB7L.js → abletime-TX7BTTR2.js} +5 -5
  2. package/dist/{abletime-3HRWLQZJ.js → abletime-URSRZW7P.js} +4 -4
  3. package/dist/{abletime-oauth-QNJQLHR4.js → abletime-oauth-QS3WPSCC.js} +3 -3
  4. package/dist/{abletime-oauth-JQDSH5OL.js → abletime-oauth-SL3NMNEC.js} +4 -4
  5. package/dist/{abletime-rest-TANL5TMY.js → abletime-rest-GGQLUO55.js} +3 -3
  6. package/dist/{abletime-rest-UQA2CRZN.js → abletime-rest-JZU6JJCV.js} +4 -4
  7. package/dist/agents/acp-runner.cjs +491 -0
  8. package/dist/agents/acp-runner.d.cts +46 -0
  9. package/dist/agents/acp-runner.d.ts +46 -0
  10. package/dist/agents/acp-runner.js +323 -0
  11. package/dist/agents/cursor-runner.js +3 -3
  12. package/dist/{agents-T4XBZZDA.js → agents-P5QIV24I.js} +38 -8
  13. package/dist/{agents-5MFGVK7C.js → agents-RGAV5OHD.js} +44 -13
  14. package/dist/{app-settings-SNOPJ7P5.js → app-settings-IA7ZZKWQ.js} +2 -2
  15. package/dist/{app-settings-PPIMYJKS.js → app-settings-XILTSD6L.js} +1 -1
  16. package/dist/{chunk-UGUWFONI.js → chunk-2E2HMJDU.js} +1 -1
  17. package/dist/{chunk-OH3BAUMC.js → chunk-2MESZ5XR.js} +273 -84
  18. package/dist/{chunk-RUIHNWRV.js → chunk-37ZBEBP6.js} +6 -6
  19. package/dist/{chunk-Y6VQX2LY.js → chunk-5AHWUJRT.js} +1927 -1718
  20. package/dist/{chunk-7B2OUQON.js → chunk-5TCMXEYL.js} +48 -3
  21. package/dist/{chunk-FDYMVJFU.js → chunk-5WF54R3B.js} +5 -5
  22. package/dist/{chunk-PVCECFJK.js → chunk-7ZD4OK6G.js} +1 -1
  23. package/dist/{chunk-RYPD7XWV.js → chunk-B4EFQTMP.js} +5 -5
  24. package/dist/chunk-BF6INES4.js +144 -0
  25. package/dist/{chunk-IVRWRYTH.js → chunk-BZK62VPT.js} +2 -2
  26. package/dist/{chunk-AJMERXZP.js → chunk-CCWQ65VD.js} +2 -2
  27. package/dist/{chunk-62ALWH3T.js → chunk-DL4OHDBV.js} +3 -3
  28. package/dist/{chunk-6TV6L2DD.js → chunk-EZ2MUWNW.js} +7 -6
  29. package/dist/{chunk-4NXGVJA6.js → chunk-F4RFFE2H.js} +48 -3
  30. package/dist/{chunk-E77SRVVO.js → chunk-FCKTBE26.js} +1 -1
  31. package/dist/{chunk-NTY5WGRD.js → chunk-FQ3JYUKI.js} +2 -2
  32. package/dist/{chunk-CEQ4Z32M.js → chunk-J4EA5SHF.js} +3 -3
  33. package/dist/{chunk-ORO4ENZR.js → chunk-LESWJ7L4.js} +1 -0
  34. package/dist/{chunk-XNGW4OYD.js → chunk-LFSTOECH.js} +7 -6
  35. package/dist/{chunk-OHUAAX3O.js → chunk-M45WGODR.js} +2 -2
  36. package/dist/{chunk-ZJMYCDYQ.js → chunk-MANERA6F.js} +55 -10
  37. package/dist/{chunk-Q4TZA4MN.js → chunk-NDEVAA34.js} +1629 -1486
  38. package/dist/{chunk-OPXEJJBM.js → chunk-PWOFUPYM.js} +1 -0
  39. package/dist/{chunk-UJMCTGV7.js → chunk-PXSWVZIL.js} +2 -2
  40. package/dist/{chunk-MOUAM6ZC.js → chunk-SMSD6U3N.js} +135 -3
  41. package/dist/{chunk-ATS7SYHG.js → chunk-TCEUNSLX.js} +135 -3
  42. package/dist/chunk-TRMPDDVL.js +232 -0
  43. package/dist/{chunk-6WMNIX2U.js → chunk-UFUAIVNV.js} +9 -5
  44. package/dist/{chunk-2HPVGTHF.js → chunk-VHQ6OG3U.js} +2 -2
  45. package/dist/{chunk-WWU4SYZR.js → chunk-VL6F2KRE.js} +5 -1
  46. package/dist/{chunk-WMD77UCY.js → chunk-W5GHFT7E.js} +279 -87
  47. package/dist/{chunk-5FUAOU3G.js → chunk-WB3G2LQO.js} +1 -1
  48. package/dist/{chunk-JCYGQKER.js → chunk-WFX4ZVSZ.js} +1 -1
  49. package/dist/{chunk-F7WP2U5I.js → chunk-WJURGCBR.js} +1 -1
  50. package/dist/{chunk-BIM24I3O.js → chunk-WWBPK7GB.js} +1 -1
  51. package/dist/chunk-YE7Z5WH3.js +142 -0
  52. package/dist/{chunk-5YCKATG6.js → chunk-YVN7L4KG.js} +1 -1
  53. package/dist/{chunk-GAGTEI6B.js → chunk-ZBSEJIOV.js} +56 -11
  54. package/dist/{conductor-LYQKONSA.js → conductor-HVOGBK63.js} +7 -6
  55. package/dist/{conductor-EMGMDNHL.js → conductor-VGCXUUG6.js} +9 -8
  56. package/dist/connected-teams-2YDE2EZ2.js +1 -1
  57. package/dist/{coordinator-prompt-DLY3FS2L.js → coordinator-prompt-DPO7L2JO.js} +5 -5
  58. package/dist/{coordinator-prompt-WALVMGKI.js → coordinator-prompt-E736TJBS.js} +4 -4
  59. package/dist/{global-workspace-UG2A3CEM.js → global-workspace-4RDPAOTT.js} +5 -5
  60. package/dist/{global-workspace-7OQ5O6JT.js → global-workspace-TG2TVLUF.js} +4 -4
  61. package/dist/index.cjs +2881 -1761
  62. package/dist/index.d.cts +140 -877
  63. package/dist/index.d.ts +140 -877
  64. package/dist/index.js +865 -559
  65. package/dist/{linear-PKYJH4WK.js → linear-E3BX5PX5.js} +2 -2
  66. package/dist/{linear-MIJO6DCV.js → linear-WG23LBCX.js} +3 -3
  67. package/dist/{linear-list-JPQ27RXG.js → linear-list-OINZWVV5.js} +1 -1
  68. package/dist/{linear-list-N57PR6JM.js → linear-list-VU47BNUV.js} +1 -1
  69. package/dist/mcp/run-stdio.cjs +2112 -1287
  70. package/dist/mcp/run-stdio.js +318 -230
  71. package/dist/{optional-cli-4GTEDEYJ.js → optional-cli-K6HX2X5O.js} +4 -3
  72. package/dist/{optional-cli-RPJIQBDX.js → optional-cli-SA3EQYML.js} +6 -5
  73. package/dist/{orchestrator-KNOMW5CZ.js → orchestrator-3I2FLEZL.js} +20 -18
  74. package/dist/{orchestrator-4SXTORD2.js → orchestrator-QDHZ56LA.js} +12 -11
  75. package/dist/thread-CJRchYLj.d.cts +856 -0
  76. package/dist/thread-CJRchYLj.d.ts +856 -0
  77. package/dist/{thread-store-R3G5VBII.js → thread-store-4YTOV2HL.js} +3 -3
  78. package/dist/{thread-store-MEUWZDVV.js → thread-store-LME2ICZP.js} +2 -2
  79. package/dist/{workspaces-KWGTP7DI.js → workspaces-4PA24IX6.js} +4 -4
  80. package/dist/{workspaces-35T6FW57.js → workspaces-6TMYV4N2.js} +5 -5
  81. package/dist/{worktree-ROJXGBWS.js → worktree-4ATMCYIE.js} +3 -3
  82. package/dist/{worktree-5P7SCST3.js → worktree-DA6SKIU5.js} +4 -4
  83. package/package.json +3 -3
  84. /package/dist/{chunk-XOEKCE6L.js → chunk-OHXNGBC4.js} +0 -0
@@ -2,7 +2,7 @@
2
2
  var LIST_TIMEOUT_MS = 15e3;
3
3
  async function listAssignedLinearIssues(opts) {
4
4
  try {
5
- const { listLinearIssuesDirect } = await import("./linear-MIJO6DCV.js");
5
+ const { listLinearIssuesDirect } = await import("./linear-WG23LBCX.js");
6
6
  const listed = listLinearIssuesDirect({ limit: 50 }).catch(() => []);
7
7
  let timer;
8
8
  try {
@@ -5,7 +5,7 @@
5
5
  var LIST_TIMEOUT_MS = 15e3;
6
6
  async function listAssignedLinearIssues(opts) {
7
7
  try {
8
- const { listLinearIssuesDirect } = await import("./linear-PKYJH4WK.js");
8
+ const { listLinearIssuesDirect } = await import("./linear-E3BX5PX5.js");
9
9
  const listed = listLinearIssuesDirect({ limit: 50 }).catch(() => []);
10
10
  let timer;
11
11
  try {
@@ -128,7 +128,7 @@ async function connectedCliPresence(integrations) {
128
128
  const ids = connectedOptionalServices(integrations).filter((spec) => spec.cli).map((spec) => spec.id);
129
129
  if (ids.length === 0) return void 0;
130
130
  try {
131
- const { optionalCliPresence } = await import("./optional-cli-4GTEDEYJ.js");
131
+ const { optionalCliPresence } = await import("./optional-cli-K6HX2X5O.js");
132
132
  return await optionalCliPresence(ids);
133
133
  } catch {
134
134
  return void 0;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clipToolResultForStore
3
- } from "./chunk-OPXEJJBM.js";
3
+ } from "./chunk-PWOFUPYM.js";
4
4
 
5
5
  // src/agents/message-parts.ts
6
6
  function asRecord(input) {
@@ -0,0 +1,142 @@
1
+ import {
2
+ run
3
+ } from "./chunk-R4W4VQJZ.js";
4
+ import {
5
+ loadAppSettings
6
+ } from "./chunk-UFUAIVNV.js";
7
+
8
+ // src/agents/acp-harness.ts
9
+ import { existsSync, readFileSync } from "fs";
10
+ import { homedir } from "os";
11
+ import { join } from "path";
12
+ var ACP_HARNESSES = {
13
+ gemini: {
14
+ id: "gemini",
15
+ label: "Gemini CLI",
16
+ bin: "gemini",
17
+ args: ["--acp"],
18
+ npmPackage: "@google/gemini-cli",
19
+ installCommand: "npm install -g @google/gemini-cli",
20
+ loginCommand: "gemini",
21
+ docsUrl: "https://geminicli.com/docs/cli/acp-mode/",
22
+ authHint: "Gemini CLI is on PATH but no API key or ~/.gemini login was found. Set GEMINI_API_KEY or run `gemini` once to sign in."
23
+ },
24
+ copilot: {
25
+ id: "copilot",
26
+ label: "Copilot CLI",
27
+ bin: "copilot",
28
+ args: ["--acp", "--stdio"],
29
+ npmPackage: "@github/copilot",
30
+ installCommand: "npm install -g @github/copilot",
31
+ loginCommand: "copilot",
32
+ docsUrl: "https://docs.github.com/en/copilot/reference/copilot-cli-reference/acp-server",
33
+ authHint: "Copilot CLI is on PATH but no GitHub login was found. Run `gh auth login` or `copilot`, or set GH_TOKEN."
34
+ }
35
+ };
36
+ var ACP_HARNESS_IDS = Object.keys(ACP_HARNESSES);
37
+ function isAcpHarnessId(value) {
38
+ return value === "gemini" || value === "copilot";
39
+ }
40
+ function acpHarnessLabel(id) {
41
+ if (isAcpHarnessId(id)) return ACP_HARNESSES[id].label;
42
+ return "ACP";
43
+ }
44
+ function defaultAcpHarness() {
45
+ const stored = loadAppSettings().defaults?.acpHarness;
46
+ return isAcpHarnessId(stored) ? stored : "gemini";
47
+ }
48
+ function agentSupportsAttach(agent) {
49
+ return agent !== "acp";
50
+ }
51
+ var AUTH_READ_MAX = 64e3;
52
+ function envSet(env, ...keys) {
53
+ return keys.some((key) => Boolean(env[key]?.trim()));
54
+ }
55
+ function fileMentionsCredential(path) {
56
+ try {
57
+ if (!existsSync(path)) return false;
58
+ const text = readFileSync(path, "utf8").slice(0, AUTH_READ_MAX);
59
+ return /"(access_token|refresh_token|oauth_token|api_key|apiKey)"\s*:/i.test(text) || /oauth_token\s*:/i.test(text);
60
+ } catch {
61
+ return false;
62
+ }
63
+ }
64
+ function acpHarnessLooksAuthenticated(id, env = process.env, home = homedir(), opts) {
65
+ if (id === "gemini") {
66
+ if (envSet(env, "GEMINI_API_KEY", "GOOGLE_API_KEY", "GOOGLE_GENAI_API_KEY")) return true;
67
+ return fileMentionsCredential(join(home, ".gemini", "oauth_creds.json")) || fileMentionsCredential(join(home, ".gemini", "google_accounts.json"));
68
+ }
69
+ if (envSet(env, "COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN")) return true;
70
+ if (fileMentionsCredential(join(home, ".copilot", "config.json")) || fileMentionsCredential(join(home, ".config", "gh", "hosts.yml"))) {
71
+ return true;
72
+ }
73
+ return opts?.ghLoggedIn === true;
74
+ }
75
+ async function copilotGhLoggedIn() {
76
+ const status = await run("gh", ["auth", "status"], { reject: false, timeoutMs: 5e3 });
77
+ return status.exitCode === 0;
78
+ }
79
+ function acpHarnessStatus(input) {
80
+ const spec = ACP_HARNESSES[input.id];
81
+ if (!input.binPath) {
82
+ return {
83
+ agent: "acp",
84
+ acpHarness: input.id,
85
+ label: spec.label,
86
+ installed: false,
87
+ authenticated: false,
88
+ linearMcp: false,
89
+ warnings: [],
90
+ reason: `${spec.label} is not on PATH (\`${spec.bin}\`). ${spec.installCommand}`
91
+ };
92
+ }
93
+ const authenticated = acpHarnessLooksAuthenticated(
94
+ input.id,
95
+ input.env ?? process.env,
96
+ input.home ?? homedir(),
97
+ { ghLoggedIn: input.ghLoggedIn }
98
+ );
99
+ return {
100
+ agent: "acp",
101
+ acpHarness: input.id,
102
+ label: spec.label,
103
+ installed: true,
104
+ authenticated,
105
+ linearMcp: false,
106
+ warnings: [],
107
+ ...authenticated ? {} : { reason: spec.authHint }
108
+ };
109
+ }
110
+ async function resolveAcpHarnessCommand(id) {
111
+ const spec = ACP_HARNESSES[id];
112
+ const which = await run("which", [spec.bin], { reject: false, timeoutMs: 3e3 });
113
+ const file = which.exitCode === 0 ? which.stdout.trim().split("\n")[0]?.trim() ?? "" : "";
114
+ if (!file) {
115
+ throw new Error(`${spec.label} is not on PATH. ${spec.installCommand}`);
116
+ }
117
+ return { file, args: [...spec.args] };
118
+ }
119
+ async function detectAcpHarness(id) {
120
+ const spec = ACP_HARNESSES[id];
121
+ const which = await run("which", [spec.bin], { reject: false, timeoutMs: 3e3 });
122
+ const file = which.exitCode === 0 ? which.stdout.trim().split("\n")[0]?.trim() ?? "" : "";
123
+ const ghLoggedIn = id === "copilot" && file && !acpHarnessLooksAuthenticated(id) ? await copilotGhLoggedIn() : false;
124
+ return acpHarnessStatus({ id, binPath: file || null, ghLoggedIn });
125
+ }
126
+ async function detectAcpHarnesses() {
127
+ return Promise.all(ACP_HARNESS_IDS.map((id) => detectAcpHarness(id)));
128
+ }
129
+
130
+ export {
131
+ ACP_HARNESSES,
132
+ ACP_HARNESS_IDS,
133
+ isAcpHarnessId,
134
+ acpHarnessLabel,
135
+ defaultAcpHarness,
136
+ agentSupportsAttach,
137
+ acpHarnessLooksAuthenticated,
138
+ acpHarnessStatus,
139
+ resolveAcpHarnessCommand,
140
+ detectAcpHarness,
141
+ detectAcpHarnesses
142
+ };
@@ -4,7 +4,7 @@ import {
4
4
  formatUnknownDetail,
5
5
  looksLikeCursorStreamCutOff,
6
6
  looksLikeHugeToolResultDump
7
- } from "./chunk-OPXEJJBM.js";
7
+ } from "./chunk-PWOFUPYM.js";
8
8
  import {
9
9
  CLI_DIR
10
10
  } from "./chunk-6K64FJDD.js";
@@ -2,17 +2,20 @@ import {
2
2
  compactSummaryPart,
3
3
  isInternalAgentStatusText,
4
4
  lastAssistantMessageText
5
- } from "./chunk-BIM24I3O.js";
5
+ } from "./chunk-WWBPK7GB.js";
6
+ import {
7
+ defaultAcpHarness
8
+ } from "./chunk-YE7Z5WH3.js";
6
9
  import {
7
10
  isCloudCoordinatorThread,
8
11
  isGlobalThread,
9
12
  isOrchestratorThread,
10
13
  isSlackCoordinatorThread
11
- } from "./chunk-XNGW4OYD.js";
14
+ } from "./chunk-LFSTOECH.js";
12
15
  import {
13
16
  mergeAgentGitAuthEnv,
14
17
  resolveAgentGitAuthEnv
15
- } from "./chunk-NTY5WGRD.js";
18
+ } from "./chunk-FQ3JYUKI.js";
16
19
  import {
17
20
  REVIEW_TAB_TITLE,
18
21
  allocateTeamName,
@@ -24,7 +27,7 @@ import {
24
27
  updateThread,
25
28
  worktreeNameFromPath,
26
29
  writeThread
27
- } from "./chunk-ATS7SYHG.js";
30
+ } from "./chunk-TCEUNSLX.js";
28
31
  import {
29
32
  ensureWorktreeSideboardIgnored
30
33
  } from "./chunk-BMRJNRQK.js";
@@ -34,8 +37,11 @@ import {
34
37
  lastTopLevelToolIsAskUser
35
38
  } from "./chunk-NJV5YEKI.js";
36
39
  import {
37
- clipToolResultForStore
38
- } from "./chunk-OPXEJJBM.js";
40
+ clipToolResultForStore,
41
+ looksLikeInvalidAgentSession,
42
+ looksLikeRetryableRunnerCrash,
43
+ looksLikeV8Oom
44
+ } from "./chunk-PWOFUPYM.js";
39
45
  import {
40
46
  ATTACHMENTS_DIR,
41
47
  DETACHED_JOBS_DIR,
@@ -49,7 +55,7 @@ import {
49
55
  import {
50
56
  assertOrchestratorCapableAgent,
51
57
  contextTokens
52
- } from "./chunk-6WMNIX2U.js";
58
+ } from "./chunk-UFUAIVNV.js";
53
59
  import {
54
60
  stripNestedElectronEnv
55
61
  } from "./chunk-4TR3HZFT.js";
@@ -721,6 +727,7 @@ function workspaceAgentChatSummaries(worktreePath) {
721
727
  id: t.id,
722
728
  title: t.title,
723
729
  agent: t.agent,
730
+ ...t.acpHarness ? { acpHarness: t.acpHarness } : {},
724
731
  status: t.status,
725
732
  link: `sideboard://chat/${t.id}`,
726
733
  ...t.agentBlock?.reason ? { blockedReason: t.agentBlock.reason, blockedSource: t.agentBlock.source } : {}
@@ -749,6 +756,7 @@ function createChatTab(input) {
749
756
  const explicitTitle = input.title?.trim();
750
757
  const title = explicitTitle || allocateTeamName(takenTeamSlugsForChatTab(binding.worktreePath)).name;
751
758
  const nextAgent = input.agent ?? from.agent;
759
+ const nextHarness = nextAgent === "acp" ? input.acpHarness === "gemini" || input.acpHarness === "copilot" ? input.acpHarness : from.agent === "acp" && (from.acpHarness === "gemini" || from.acpHarness === "copilot") ? from.acpHarness : defaultAcpHarness() : void 0;
752
760
  if (isOrchestratorThread(from) || binding.sourceType === "orchestration") {
753
761
  assertOrchestratorCapableAgent(nextAgent);
754
762
  }
@@ -765,6 +773,7 @@ function createChatTab(input) {
765
773
  // the connected chat.
766
774
  sourceRef: singletonInbox ? title : binding.sourceRef,
767
775
  agent: nextAgent,
776
+ ...nextHarness ? { acpHarness: nextHarness } : {},
768
777
  model: input.model !== void 0 ? input.model : input.agent && input.agent !== from.agent ? null : from.model,
769
778
  effort: input.effort !== void 0 ? input.effort : from.effort,
770
779
  fast: input.fast !== void 0 ? Boolean(input.fast) : from.fast,
@@ -785,6 +794,7 @@ function forkChatTab(input) {
785
794
  const tab = createChatTab({
786
795
  fromThreadId: input.threadId,
787
796
  agent: input.agent ?? from.agent,
797
+ acpHarness: input.acpHarness,
788
798
  model: input.model,
789
799
  title: input.title?.trim() || void 0,
790
800
  attachments: [attachment]
@@ -1218,6 +1228,29 @@ function jobTreeAlive(pid) {
1218
1228
  return jobAlive(pid) || processGroupAlive(pid);
1219
1229
  }
1220
1230
 
1231
+ // src/agents/turn-failure-class.ts
1232
+ function classifyTurnFailure(detail) {
1233
+ const text = detail?.trim() ?? "";
1234
+ if (!text) return null;
1235
+ const lower = text.toLowerCase();
1236
+ if (/you've hit your|hit your (session|weekly|opus) limit|usage limit/.test(lower) || /credit balance is too low|out of credits|insufficient.?quota|quota.?exceeded/.test(lower) || /\b429\b|too many requests|rate.?limit/.test(lower) || /\[resource_exhausted\]|resource_exhausted/.test(lower)) {
1237
+ return "quota";
1238
+ }
1239
+ if (/invalid user api key|invalid api key|not logged in|not authenticated|please run.*login|codex login|claude auth/.test(
1240
+ lower
1241
+ )) {
1242
+ return "auth";
1243
+ }
1244
+ if (/prompt is too long|context.*(too long|exceed)|conversation too long/.test(lower) || /model .{0,80}(not found|unavailable|unknown|invalid)/.test(lower) || /\brefus(ed|al)\b|content policy/.test(lower)) {
1245
+ return "refused";
1246
+ }
1247
+ if (/connection stalled|\btimed out\b|inactivity timeout|\bETIMEDOUT\b/.test(lower)) return "timeout";
1248
+ if (looksLikeRetryableRunnerCrash(text) || looksLikeV8Oom(text) || looksLikeInvalidAgentSession(text)) {
1249
+ return "runner";
1250
+ }
1251
+ return "other";
1252
+ }
1253
+
1221
1254
  // src/orchestrator/task-state.ts
1222
1255
  function isTerminalTaskState(state) {
1223
1256
  return state !== "submitted" && state !== "working";
@@ -1285,8 +1318,17 @@ var MCP_WAIT_QUEUED_HINT = "Child is queued waiting for a concurrency slot \u201
1285
1318
  var MCP_WAIT_STOPPED_HINT = "Child was stopped before the turn finished. Do not treat this as success. send_to_chat to resume, or tell the user.";
1286
1319
  var MCP_WAIT_BROKEN_HINT = "Child worktree is broken (missing on disk). Tell the user \u2014 do not treat this as success.";
1287
1320
  var MCP_WAIT_ERROR_HINT = "Child turn failed. lastError/text is the failure \u2014 switch agent, tell the user, or retry. Do not treat empty text as success.";
1321
+ function mcpWaitFailureHint(failureClass) {
1322
+ if (failureClass === "auth" || failureClass === "quota" || failureClass === "refused") {
1323
+ return `Child turn failed (${failureClass}). Do not retry the same request. Tell the user or switch agent.`;
1324
+ }
1325
+ if (failureClass === "timeout" || failureClass === "runner") {
1326
+ return `Child turn failed (${failureClass}). One retry is reasonable. Do not treat empty text as success.`;
1327
+ }
1328
+ return MCP_WAIT_ERROR_HINT;
1329
+ }
1288
1330
  var MCP_WAIT_INPUT_REQUIRED_HINT = "Child asked the user a question (ask_user). taskState is input-required. Wait for the user to answer in that chat \u2014 do not send_to_chat a check-in.";
1289
- function mcpWaitTaskHint(taskState, status, blockedReason) {
1331
+ function mcpWaitTaskHint(taskState, status, blockedReason, failureClass) {
1290
1332
  const why = blockedReason?.trim();
1291
1333
  if (why && taskState !== "failed" && taskState !== "canceled") {
1292
1334
  if (taskState === "submitted" || taskState === "working") {
@@ -1307,7 +1349,7 @@ function mcpWaitTaskHint(taskState, status, blockedReason) {
1307
1349
  case "canceled":
1308
1350
  return MCP_WAIT_STOPPED_HINT;
1309
1351
  case "failed":
1310
- return status === "broken" ? MCP_WAIT_BROKEN_HINT : MCP_WAIT_ERROR_HINT;
1352
+ return status === "broken" ? MCP_WAIT_BROKEN_HINT : mcpWaitFailureHint(failureClass ?? null);
1311
1353
  default:
1312
1354
  return void 0;
1313
1355
  }
@@ -1327,12 +1369,14 @@ function lastActivityAtForWait(stillRunning, liveUpdatedAt, fallbacks) {
1327
1369
  function waitForTurnToolResult(input) {
1328
1370
  const blockedReason = input.blockedReason?.trim() ? input.blockedReason.trim() : null;
1329
1371
  const waiting = Boolean(blockedReason) && !input.stillRunning && input.taskState !== "failed" && input.taskState !== "canceled";
1372
+ const failureClass = input.taskState === "failed" && input.status !== "broken" ? classifyTurnFailure(input.lastError || input.text) : null;
1330
1373
  return {
1331
1374
  ...input,
1332
1375
  usage: input.usage ?? null,
1333
1376
  blockedReason,
1334
1377
  blockedSource: blockedReason ? input.blockedSource ?? null : null,
1335
- hint: mcpWaitTaskHint(input.taskState, input.status, blockedReason),
1378
+ failureClass,
1379
+ hint: mcpWaitTaskHint(input.taskState, input.status, blockedReason, failureClass),
1336
1380
  incomplete: needsCoordinatorAction(input.taskState) || waiting
1337
1381
  };
1338
1382
  }
@@ -1705,7 +1749,7 @@ var PORT_RANGE_SIZE = 10;
1705
1749
  var RECLAIM_RETRY_DELAY_MS = 40;
1706
1750
  var RECLAIM_TRIES = 8;
1707
1751
  async function killReclaimable(ports, worktreePath, signal) {
1708
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-EMGMDNHL.js");
1752
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-VGCXUUG6.js");
1709
1753
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1710
1754
  else killListenersOnPorts2(ports);
1711
1755
  }
@@ -2392,6 +2436,7 @@ export {
2392
2436
  endedOnAskUser,
2393
2437
  userRepliedAfterAgent,
2394
2438
  deriveTaskState,
2439
+ classifyTurnFailure,
2395
2440
  mcpWaitForTurnTimeoutMs,
2396
2441
  mcpWaitTaskHint,
2397
2442
  lastActivityAtForWait,
@@ -34,16 +34,17 @@ import {
34
34
  tryReservePort,
35
35
  tryReservePorts,
36
36
  worktreeRunPortsPath
37
- } from "./chunk-ZJMYCDYQ.js";
38
- import "./chunk-ORO4ENZR.js";
39
- import "./chunk-6TV6L2DD.js";
40
- import "./chunk-2HPVGTHF.js";
37
+ } from "./chunk-MANERA6F.js";
38
+ import "./chunk-LESWJ7L4.js";
39
+ import "./chunk-BF6INES4.js";
40
+ import "./chunk-EZ2MUWNW.js";
41
+ import "./chunk-VHQ6OG3U.js";
41
42
  import "./chunk-N2WW62LF.js";
42
43
  import "./chunk-GK7H3SY7.js";
43
44
  import "./chunk-TL2HK6LZ.js";
44
- import "./chunk-MOUAM6ZC.js";
45
+ import "./chunk-SMSD6U3N.js";
45
46
  import "./chunk-WMZIANPV.js";
46
- import "./chunk-WWU4SYZR.js";
47
+ import "./chunk-VL6F2KRE.js";
47
48
  import "./chunk-NSTQ6QKD.js";
48
49
  import {
49
50
  stripNestedElectronEnv
@@ -32,25 +32,26 @@ import {
32
32
  tryReservePort,
33
33
  tryReservePorts,
34
34
  worktreeRunPortsPath
35
- } from "./chunk-GAGTEI6B.js";
36
- import "./chunk-BIM24I3O.js";
37
- import "./chunk-XNGW4OYD.js";
38
- import "./chunk-NTY5WGRD.js";
39
- import "./chunk-ATS7SYHG.js";
35
+ } from "./chunk-ZBSEJIOV.js";
36
+ import "./chunk-WWBPK7GB.js";
37
+ import "./chunk-YE7Z5WH3.js";
38
+ import "./chunk-LFSTOECH.js";
39
+ import "./chunk-FQ3JYUKI.js";
40
+ import "./chunk-TCEUNSLX.js";
40
41
  import "./chunk-BMRJNRQK.js";
41
42
  import "./chunk-NJV5YEKI.js";
42
43
  import "./chunk-N6ZF3XRP.js";
43
- import "./chunk-OPXEJJBM.js";
44
+ import "./chunk-PWOFUPYM.js";
44
45
  import "./chunk-6K64FJDD.js";
45
46
  import "./chunk-LG6RJBIY.js";
46
47
  import "./chunk-R4W4VQJZ.js";
47
- import "./chunk-6WMNIX2U.js";
48
+ import "./chunk-UFUAIVNV.js";
49
+ import "./chunk-JT7R45JB.js";
48
50
  import {
49
51
  stripNestedElectronEnv
50
52
  } from "./chunk-4TR3HZFT.js";
51
53
  import "./chunk-WDRMZKVB.js";
52
54
  import "./chunk-KI45T4DI.js";
53
- import "./chunk-JT7R45JB.js";
54
55
  import {
55
56
  hasConductorHook,
56
57
  hasRepoHook,
@@ -8,7 +8,7 @@ import {
8
8
  ensureConnectedBrightsyTeamTokens,
9
9
  getConnectedBrightsyTeamsRaw,
10
10
  listConnectedBrightsyTeams
11
- } from "./chunk-XOEKCE6L.js";
11
+ } from "./chunk-OHXNGBC4.js";
12
12
  import "./chunk-RSA47QYR.js";
13
13
  import "./chunk-JAT3JFOS.js";
14
14
  import "./chunk-R4W4VQJZ.js";
@@ -7,19 +7,19 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-XNGW4OYD.js";
11
- import "./chunk-NTY5WGRD.js";
12
- import "./chunk-ATS7SYHG.js";
10
+ } from "./chunk-LFSTOECH.js";
11
+ import "./chunk-FQ3JYUKI.js";
12
+ import "./chunk-TCEUNSLX.js";
13
13
  import "./chunk-BMRJNRQK.js";
14
14
  import "./chunk-N6ZF3XRP.js";
15
15
  import "./chunk-6K64FJDD.js";
16
16
  import "./chunk-LG6RJBIY.js";
17
17
  import "./chunk-R4W4VQJZ.js";
18
- import "./chunk-6WMNIX2U.js";
18
+ import "./chunk-UFUAIVNV.js";
19
+ import "./chunk-JT7R45JB.js";
19
20
  import "./chunk-4TR3HZFT.js";
20
21
  import "./chunk-WDRMZKVB.js";
21
22
  import "./chunk-KI45T4DI.js";
22
- import "./chunk-JT7R45JB.js";
23
23
  import "./chunk-H4UEFJRI.js";
24
24
  export {
25
25
  COORDINATOR_TOOL_PLAYBOOK,
@@ -9,14 +9,14 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-6TV6L2DD.js";
13
- import "./chunk-2HPVGTHF.js";
12
+ } from "./chunk-EZ2MUWNW.js";
13
+ import "./chunk-VHQ6OG3U.js";
14
14
  import "./chunk-N2WW62LF.js";
15
15
  import "./chunk-GK7H3SY7.js";
16
16
  import "./chunk-TL2HK6LZ.js";
17
- import "./chunk-MOUAM6ZC.js";
17
+ import "./chunk-SMSD6U3N.js";
18
18
  import "./chunk-WMZIANPV.js";
19
- import "./chunk-WWU4SYZR.js";
19
+ import "./chunk-VL6F2KRE.js";
20
20
  import "./chunk-NSTQ6QKD.js";
21
21
  import "./chunk-WWUABK6B.js";
22
22
  import "./chunk-FJZWM2ON.js";
@@ -18,19 +18,19 @@ import {
18
18
  remoteCoordinatorSourceRef,
19
19
  slackCoordinatorSourceRef,
20
20
  takenTeamSlugsForOrchestration
21
- } from "./chunk-XNGW4OYD.js";
22
- import "./chunk-NTY5WGRD.js";
23
- import "./chunk-ATS7SYHG.js";
21
+ } from "./chunk-LFSTOECH.js";
22
+ import "./chunk-FQ3JYUKI.js";
23
+ import "./chunk-TCEUNSLX.js";
24
24
  import "./chunk-BMRJNRQK.js";
25
25
  import "./chunk-N6ZF3XRP.js";
26
26
  import "./chunk-6K64FJDD.js";
27
27
  import "./chunk-LG6RJBIY.js";
28
28
  import "./chunk-R4W4VQJZ.js";
29
- import "./chunk-6WMNIX2U.js";
29
+ import "./chunk-UFUAIVNV.js";
30
+ import "./chunk-JT7R45JB.js";
30
31
  import "./chunk-4TR3HZFT.js";
31
32
  import "./chunk-WDRMZKVB.js";
32
33
  import "./chunk-KI45T4DI.js";
33
- import "./chunk-JT7R45JB.js";
34
34
  import {
35
35
  globalAgentCwd
36
36
  } from "./chunk-H4UEFJRI.js";
@@ -20,14 +20,14 @@ import {
20
20
  remoteCoordinatorSourceRef,
21
21
  slackCoordinatorSourceRef,
22
22
  takenTeamSlugsForOrchestration
23
- } from "./chunk-6TV6L2DD.js";
24
- import "./chunk-2HPVGTHF.js";
23
+ } from "./chunk-EZ2MUWNW.js";
24
+ import "./chunk-VHQ6OG3U.js";
25
25
  import "./chunk-N2WW62LF.js";
26
26
  import "./chunk-GK7H3SY7.js";
27
27
  import "./chunk-TL2HK6LZ.js";
28
- import "./chunk-MOUAM6ZC.js";
28
+ import "./chunk-SMSD6U3N.js";
29
29
  import "./chunk-WMZIANPV.js";
30
- import "./chunk-WWU4SYZR.js";
30
+ import "./chunk-VL6F2KRE.js";
31
31
  import "./chunk-NSTQ6QKD.js";
32
32
  import "./chunk-WWUABK6B.js";
33
33
  import "./chunk-FJZWM2ON.js";