@sideboard-ai/core 0.1.348 → 0.1.349

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 (41) hide show
  1. package/dist/agents/cursor-runner.js +3 -3
  2. package/dist/{agents-5MFGVK7C.js → agents-AZ2PV6XP.js} +7 -7
  3. package/dist/{agents-T4XBZZDA.js → agents-DMPBFF3F.js} +5 -5
  4. package/dist/{chunk-UGUWFONI.js → chunk-2E2HMJDU.js} +1 -1
  5. package/dist/{chunk-NTY5WGRD.js → chunk-3DBL2C45.js} +1 -1
  6. package/dist/{chunk-MOUAM6ZC.js → chunk-6RIPZ73M.js} +132 -2
  7. package/dist/{chunk-6TV6L2DD.js → chunk-CATTIFSP.js} +6 -5
  8. package/dist/{chunk-WMD77UCY.js → chunk-IRFBD6GU.js} +223 -55
  9. package/dist/{chunk-ORO4ENZR.js → chunk-LESWJ7L4.js} +1 -0
  10. package/dist/{chunk-XNGW4OYD.js → chunk-MHSBF3SO.js} +6 -5
  11. package/dist/{chunk-ZJMYCDYQ.js → chunk-MVFFLU5V.js} +47 -9
  12. package/dist/{chunk-OPXEJJBM.js → chunk-PWOFUPYM.js} +1 -0
  13. package/dist/{chunk-OH3BAUMC.js → chunk-Q4I6KDOL.js} +227 -59
  14. package/dist/{chunk-2HPVGTHF.js → chunk-QHXZKHUL.js} +1 -1
  15. package/dist/{chunk-GAGTEI6B.js → chunk-ROXM6QZV.js} +48 -10
  16. package/dist/{chunk-ATS7SYHG.js → chunk-RPHH4FNK.js} +132 -2
  17. package/dist/{chunk-Y6VQX2LY.js → chunk-WHMLMCPU.js} +11 -5
  18. package/dist/{chunk-BIM24I3O.js → chunk-WWBPK7GB.js} +1 -1
  19. package/dist/{chunk-5YCKATG6.js → chunk-YVN7L4KG.js} +1 -1
  20. package/dist/{chunk-Q4TZA4MN.js → chunk-ZXI5DR5S.js} +12 -6
  21. package/dist/{conductor-EMGMDNHL.js → conductor-65VPUPOW.js} +6 -6
  22. package/dist/{conductor-LYQKONSA.js → conductor-NHC6X74J.js} +5 -5
  23. package/dist/{coordinator-prompt-DLY3FS2L.js → coordinator-prompt-5GZWIVSY.js} +3 -3
  24. package/dist/{coordinator-prompt-WALVMGKI.js → coordinator-prompt-R2PURZL3.js} +3 -3
  25. package/dist/{global-workspace-UG2A3CEM.js → global-workspace-64KC7PST.js} +3 -3
  26. package/dist/{global-workspace-7OQ5O6JT.js → global-workspace-UEECLWSX.js} +3 -3
  27. package/dist/index.cjs +1298 -849
  28. package/dist/index.d.cts +30 -8
  29. package/dist/index.d.ts +30 -8
  30. package/dist/index.js +445 -365
  31. package/dist/mcp/run-stdio.cjs +1033 -585
  32. package/dist/mcp/run-stdio.js +296 -216
  33. package/dist/{orchestrator-4SXTORD2.js → orchestrator-I5G5A5BV.js} +7 -7
  34. package/dist/{orchestrator-KNOMW5CZ.js → orchestrator-Y5PYSMR6.js} +9 -9
  35. package/dist/{thread-store-R3G5VBII.js → thread-store-HZ4U4OXB.js} +1 -1
  36. package/dist/{thread-store-MEUWZDVV.js → thread-store-QKNU5CHM.js} +1 -1
  37. package/dist/{workspaces-KWGTP7DI.js → workspaces-6TIM2TM2.js} +3 -3
  38. package/dist/{workspaces-35T6FW57.js → workspaces-I2EHNTFE.js} +3 -3
  39. package/dist/{worktree-ROJXGBWS.js → worktree-7JFYDNUX.js} +2 -2
  40. package/dist/{worktree-5P7SCST3.js → worktree-M2GJGK2P.js} +2 -2
  41. package/package.json +1 -1
@@ -4,18 +4,21 @@ import {
4
4
  clipToolResultForStore,
5
5
  compactSummaryPart,
6
6
  isInternalAgentStatusText,
7
- lastAssistantMessageText
8
- } from "./chunk-ORO4ENZR.js";
7
+ lastAssistantMessageText,
8
+ looksLikeInvalidAgentSession,
9
+ looksLikeRetryableRunnerCrash,
10
+ looksLikeV8Oom
11
+ } from "./chunk-LESWJ7L4.js";
9
12
  import {
10
13
  isCloudCoordinatorThread,
11
14
  isGlobalThread,
12
15
  isOrchestratorThread,
13
16
  isSlackCoordinatorThread
14
- } from "./chunk-6TV6L2DD.js";
17
+ } from "./chunk-CATTIFSP.js";
15
18
  import {
16
19
  mergeAgentGitAuthEnv,
17
20
  resolveAgentGitAuthEnv
18
- } from "./chunk-2HPVGTHF.js";
21
+ } from "./chunk-QHXZKHUL.js";
19
22
  import {
20
23
  ATTACHMENTS_DIR,
21
24
  DETACHED_JOBS_DIR,
@@ -40,7 +43,7 @@ import {
40
43
  updateThread,
41
44
  worktreeNameFromPath,
42
45
  writeThread
43
- } from "./chunk-MOUAM6ZC.js";
46
+ } from "./chunk-6RIPZ73M.js";
44
47
  import {
45
48
  assertOrchestratorCapableAgent,
46
49
  contextTokens
@@ -1161,6 +1164,29 @@ function jobTreeAlive(pid) {
1161
1164
  return jobAlive(pid) || processGroupAlive(pid);
1162
1165
  }
1163
1166
 
1167
+ // src/agents/turn-failure-class.ts
1168
+ function classifyTurnFailure(detail) {
1169
+ const text = detail?.trim() ?? "";
1170
+ if (!text) return null;
1171
+ const lower = text.toLowerCase();
1172
+ 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)) {
1173
+ return "quota";
1174
+ }
1175
+ if (/invalid user api key|invalid api key|not logged in|not authenticated|please run.*login|codex login|claude auth/.test(
1176
+ lower
1177
+ )) {
1178
+ return "auth";
1179
+ }
1180
+ 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)) {
1181
+ return "refused";
1182
+ }
1183
+ if (/connection stalled|\btimed out\b|inactivity timeout|\bETIMEDOUT\b/.test(lower)) return "timeout";
1184
+ if (looksLikeRetryableRunnerCrash(text) || looksLikeV8Oom(text) || looksLikeInvalidAgentSession(text)) {
1185
+ return "runner";
1186
+ }
1187
+ return "other";
1188
+ }
1189
+
1164
1190
  // src/plan/ask-user.ts
1165
1191
  function planQuestionsSignature(questions) {
1166
1192
  return questions.map((q) => {
@@ -1317,8 +1343,17 @@ var MCP_WAIT_QUEUED_HINT = "Child is queued waiting for a concurrency slot \u201
1317
1343
  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.";
1318
1344
  var MCP_WAIT_BROKEN_HINT = "Child worktree is broken (missing on disk). Tell the user \u2014 do not treat this as success.";
1319
1345
  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.";
1346
+ function mcpWaitFailureHint(failureClass) {
1347
+ if (failureClass === "auth" || failureClass === "quota" || failureClass === "refused") {
1348
+ return `Child turn failed (${failureClass}). Do not retry the same request. Tell the user or switch agent.`;
1349
+ }
1350
+ if (failureClass === "timeout" || failureClass === "runner") {
1351
+ return `Child turn failed (${failureClass}). One retry is reasonable. Do not treat empty text as success.`;
1352
+ }
1353
+ return MCP_WAIT_ERROR_HINT;
1354
+ }
1320
1355
  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.";
1321
- function mcpWaitTaskHint(taskState, status, blockedReason) {
1356
+ function mcpWaitTaskHint(taskState, status, blockedReason, failureClass) {
1322
1357
  const why = blockedReason?.trim();
1323
1358
  if (why && taskState !== "failed" && taskState !== "canceled") {
1324
1359
  if (taskState === "submitted" || taskState === "working") {
@@ -1339,7 +1374,7 @@ function mcpWaitTaskHint(taskState, status, blockedReason) {
1339
1374
  case "canceled":
1340
1375
  return MCP_WAIT_STOPPED_HINT;
1341
1376
  case "failed":
1342
- return status === "broken" ? MCP_WAIT_BROKEN_HINT : MCP_WAIT_ERROR_HINT;
1377
+ return status === "broken" ? MCP_WAIT_BROKEN_HINT : mcpWaitFailureHint(failureClass ?? null);
1343
1378
  default:
1344
1379
  return void 0;
1345
1380
  }
@@ -1359,12 +1394,14 @@ function lastActivityAtForWait(stillRunning, liveUpdatedAt, fallbacks) {
1359
1394
  function waitForTurnToolResult(input) {
1360
1395
  const blockedReason = input.blockedReason?.trim() ? input.blockedReason.trim() : null;
1361
1396
  const waiting = Boolean(blockedReason) && !input.stillRunning && input.taskState !== "failed" && input.taskState !== "canceled";
1397
+ const failureClass = input.taskState === "failed" && input.status !== "broken" ? classifyTurnFailure(input.lastError || input.text) : null;
1362
1398
  return {
1363
1399
  ...input,
1364
1400
  usage: input.usage ?? null,
1365
1401
  blockedReason,
1366
1402
  blockedSource: blockedReason ? input.blockedSource ?? null : null,
1367
- hint: mcpWaitTaskHint(input.taskState, input.status, blockedReason),
1403
+ failureClass,
1404
+ hint: mcpWaitTaskHint(input.taskState, input.status, blockedReason, failureClass),
1368
1405
  incomplete: needsCoordinatorAction(input.taskState) || waiting
1369
1406
  };
1370
1407
  }
@@ -1737,7 +1774,7 @@ var PORT_RANGE_SIZE = 10;
1737
1774
  var RECLAIM_RETRY_DELAY_MS = 40;
1738
1775
  var RECLAIM_TRIES = 8;
1739
1776
  async function killReclaimable(ports, worktreePath, signal) {
1740
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-LYQKONSA.js");
1777
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-NHC6X74J.js");
1741
1778
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1742
1779
  else killListenersOnPorts2(ports);
1743
1780
  }
@@ -2426,6 +2463,7 @@ export {
2426
2463
  needsCoordinatorAction,
2427
2464
  userRepliedAfterAgent,
2428
2465
  deriveTaskState,
2466
+ classifyTurnFailure,
2429
2467
  mcpWaitForTurnTimeoutMs,
2430
2468
  mcpWaitTaskHint,
2431
2469
  lastActivityAtForWait,
@@ -436,6 +436,7 @@ export {
436
436
  summarizeTurnStderr,
437
437
  looksLikeInvalidAgentSession,
438
438
  looksLikeBrightsyEmptyCompletion,
439
+ looksLikeRetryableRunnerCrash,
439
440
  shouldRetryFailedAgentTurn,
440
441
  looksLikeAgentFailureMessage,
441
442
  fallbackTurnFailDetail,