@sideboard-ai/core 0.1.347 → 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-IJNTTVFH.js → chunk-IRFBD6GU.js} +247 -66
  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-27XWAI7S.js → chunk-Q4I6KDOL.js} +251 -70
  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 +1321 -858
  28. package/dist/index.d.cts +31 -8
  29. package/dist/index.d.ts +31 -8
  30. package/dist/index.js +446 -365
  31. package/dist/mcp/run-stdio.cjs +1055 -594
  32. package/dist/mcp/run-stdio.js +296 -216
  33. package/dist/{orchestrator-AJZNVREM.js → orchestrator-I5G5A5BV.js} +7 -7
  34. package/dist/{orchestrator-BUEPWNCF.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
@@ -1227,6 +1227,7 @@ export {
1227
1227
  summarizeTurnStderr,
1228
1228
  looksLikeInvalidAgentSession,
1229
1229
  looksLikeBrightsyEmptyCompletion,
1230
+ looksLikeRetryableRunnerCrash,
1230
1231
  shouldRetryFailedAgentTurn,
1231
1232
  looksLikeAgentFailureMessage,
1232
1233
  fallbackTurnFailDetail,
@@ -5,7 +5,7 @@ import {
5
5
  resolveGithubRepoSlug,
6
6
  resolveOriginRemote,
7
7
  resolveRepoRoot
8
- } from "./chunk-NTY5WGRD.js";
8
+ } from "./chunk-3DBL2C45.js";
9
9
  import {
10
10
  allocateTeamName,
11
11
  createEmptyThread,
@@ -14,7 +14,7 @@ import {
14
14
  teamSlugFromName,
15
15
  updateThread,
16
16
  writeThread
17
- } from "./chunk-ATS7SYHG.js";
17
+ } from "./chunk-RPHH4FNK.js";
18
18
  import {
19
19
  ATTACHMENTS_DIR,
20
20
  attachmentsGitignoreBody
@@ -402,7 +402,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
402
402
  "- get_viewer_context / update_viewer_context \u2014 read or replace Settings \u2192 Agents (account) and Settings \u2192 Projects (per-repo) context. You can update a project: pass scope=project and repoPath from list_projects (this cwd is not a project). update_viewer_context requires confirmed=true after ask_user. Never write context unprompted.",
403
403
  "- list_env / set_env / delete_env \u2014 Settings \u2192 Environment. scope=project requires repoPath from list_projects and stores the key under that project prefix (the project name, uppercased, plus _). APPLE_ID for sideboard is SIDEBOARD_APPLE_ID. scope=account is shared by every project and is not prefixed. list_env returns names only.",
404
404
  "- set_caffeinate \u2014 keep this Mac awake across turns (macOS caffeinate). A connected phone already holds caffeinate (lid can close on power), so do not turn this on just because they are on the phone. Turn on for overnight work, or when the user will be away and no phone is connected. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the machine awake. Closing this chat also releases it.",
405
- "- list_schedules / create_schedule / update_schedule / delete_schedule / run_schedule \u2014 automations that send a prompt to a chat (chatId or self) or start a new Global chat (omit chatId). A job bound to a chat is removed when that chat is archived. Omit chatId only for a Global automation that should outlive the chat. One-shot `at`, interval `every` (15m/1h/6h/1d), clock time `time` + `days` (07:30 and weekdays, or mon,wed), or 5-field `cron`. Recurring jobs without chatId open a new chat each run and archive it when that run finishes unless archiveChat is false (leave the chat open to keep talking). History keeps the last 5 archived chats for that automation. list_schedules includes runs, the last 10 fires (at, threadId, error). To schedule a prompt from this chat, call create_schedule (omit chatId for a new Global chat, or chatId=self). Worktree agents have the same tools (`chatId=self` continues that coding chat and is removed when that chat is archived). Jobs fire only while Sideboard.app is running; sleep skips until wake. Creating or enabling a future job turns on Settings \u2192 Advanced \u2192 Caffeinate while automations are enabled (or call set_caffeinate). The desktop lists them in the sidebar after Board.",
405
+ "- list_schedules / create_schedule / update_schedule / delete_schedule / run_schedule \u2014 automations that send a prompt to a chat (chatId or self) or start a new Global chat (omit chatId). A job bound to a chat is removed when that chat is archived. Omit chatId only for a Global automation that should outlive the chat. One-shot `at`, interval `every` (15m/1h/6h/1d), clock time `time` + `days` (07:30 and weekdays, or mon,wed), or 5-field `cron`. Recurring jobs without chatId open a new chat each run and archive it when that run finishes unless archiveChat is false (leave the chat open to keep talking). History keeps the last 5 archived chats for that automation. list_schedules includes runs, the last 10 fires (at, threadId, error). To schedule a prompt from this chat, call create_schedule (omit chatId for a new Global chat, or chatId=self). Worktree agents have the same tools (`chatId=self` continues that coding chat and is removed when that chat is archived). Jobs fire only while Sideboard.app is running; sleep skips until wake. Creating or enabling a future job turns on Settings \u2192 Advanced \u2192 Caffeinate while automations are enabled (or call set_caffeinate). The desktop lists them in the sidebar after Board. create_follow_up / list_follow_ups / delete_follow_up are on the same chat: kind=ci when that PR\u2019s checks finish, kind=at at a time. A running turn is not interrupted. A CI follow-up that is still pending at its deadline ends silently. Cap 10.",
406
406
  "Projects:",
407
407
  "- add_project / remove_project \u2014 register or unregister a git repo",
408
408
  "Workspaces and chats:",
@@ -413,8 +413,9 @@ var COORDINATOR_TOOL_PLAYBOOK = [
413
413
  "- start_board_card \u2014 same as create_workspace for a ticket/PR/named branch (attaches issue text when resolvable). Then send_to_chat.",
414
414
  "- fork_workspace \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
415
415
  "- fork_chat \u2014 add another agent on the SAME workspace (same files, Run, and git), or fork a Global orchestration chat into a new tab. Pass agent when it should be a different harness. Leave model unset (Auto) unless you have a reason. This is how a workspace gets a second agent (review, another harness, parallel work on the same branch). Do not create_workspace again for that. Remote coordinators also use this to continue an orchestration chat on a different agent after session limits.",
416
- "- send_to_chat \u2014 steer a prompt (start/continue a chat turn; Settings \u2192 Follow-up, default steer: interrupt and start now). force_stop: true only to replace a wrong in-flight request and clear the inbox \u2014 never to check in, resume after a halt notice, or because wait_for_turn returned stillRunning (that interrupts the child mid-thought)",
417
- "- wait_for_turn / get_turn_result \u2014 wait for and read the agent reply (includes last-turn usage / costUsd when the child agent reported it \u2014 costUsd is this turn, not the Claude session total). wait_for_turn returns within ~45s even if the child is still working (MCP clients kill longer tool calls). Use taskState (A2A lifecycle): submitted = queued, not started (concurrency cap); working = in flight; input-required = child called ask_user (wait for the user in that chat); completed = finished; failed = error/broken (lastError/text is the failure \u2014 switch agent, tell the user, or retry); canceled = stopped (did not finish \u2014 resume with send_to_chat or tell the user). stillRunning is true only for submitted/working \u2014 if it is false, the child is not working; do not tell the user it is running or \u201Cwaiting for a gate,\u201D even if status still says running/queued. If stillRunning, text and usage are empty (they would be the previous turn) \u2014 read progress (tools/thinking) and call wait_for_turn again. Do not force_stop or send_to_chat a check-in (that steers / interrupts). Do not send \u201Care you stuck?\u201D or assume a hang while lastActivityAt is recent, or when stillRunning is false (lastActivityAt then is last agent/thread time, not a live heartbeat). If stillRunning stays true across many waits with the same lastActivityAt, the child is stuck \u2014 tell the user; do not invent a gate. incomplete=true means not a successful finished turn. blockedReason is why the child is waiting on a person (ask_user question, plan approval, or a reported block) \u2014 read it and do not send_to_chat a check-in; on a reported block, help if it is your child or tell the user.",
416
+ "- send_to_chat \u2014 start or continue a chat turn. A second send joins that prompt only while it is still queued or not yet handed to the process. Once the process has started, the send waits behind the turn and does not stop it or change the prompt already running. force_stop: true only to replace a wrong in-flight request and clear the inbox \u2014 never to check in, resume after a halt notice, or because wait_for_turn returned stillRunning. The workspace composer still follows Settings \u2192 Follow-up.",
417
+ "- Dispatch \u2014 you assign one worker chat on that checkout and you do not do the coding in this chat. send_to_chat that chat, say why, then wait_for_turn. Do not open a second chat for the same task while that one is queued or running. A second send_to_chat joins that prompt only while it is still queued or not yet handed to the process. Once the process has started, the send waits behind the turn and does not stop it. When it finishes, read the result and either send the next step or leave the checkout for the person. A finished turn is not shipped \u2014 merge only when they asked. Read failureClass on a failed turn. Auth, quota, and a model that refused are not a retry; say so. A timeout or runner crash can be one retry. Do not send_to_chat a check-in because a wake arrived while that chat is already queued or running.",
418
+ "- wait_for_turn / get_turn_result \u2014 wait for and read the agent reply (includes last-turn usage / costUsd when the child agent reported it \u2014 costUsd is this turn, not the Claude session total). wait_for_turn returns within ~45s even if the child is still working (MCP clients kill longer tool calls). Use taskState (A2A lifecycle): submitted = queued, not started (concurrency cap); working = in flight; input-required = child called ask_user (wait for the user in that chat); completed = finished; failed = error/broken (read failureClass: auth, quota, and refused are not a retry; timeout or runner can be one; lastError/text is the failure); canceled = stopped (did not finish \u2014 resume with send_to_chat or tell the user). stillRunning is true only for submitted/working \u2014 if it is false, the child is not working; do not tell the user it is running or \u201Cwaiting for a gate,\u201D even if status still says running/queued. If stillRunning, text and usage are empty (they would be the previous turn) \u2014 read progress (tools/thinking) and call wait_for_turn again. Do not force_stop or send_to_chat a check-in (that steers / interrupts). Do not send \u201Care you stuck?\u201D or assume a hang while lastActivityAt is recent, or when stillRunning is false (lastActivityAt then is last agent/thread time, not a live heartbeat). If stillRunning stays true across many waits with the same lastActivityAt, the child is stuck \u2014 tell the user; do not invent a gate. incomplete=true means not a successful finished turn. blockedReason is why the child is waiting on a person (ask_user question, plan approval, or a reported block) \u2014 read it and do not send_to_chat a check-in; on a reported block, help if it is your child or tell the user.",
418
419
  "- Child wake-ups: a worktree may call notify_orchestrator (ask_user already does for input-required), and Sideboard wakes you if a child stops/errors unexpectedly. Sideboard also wakes you when a child finishes after you promised a later update \u2014 reply with the outcome in that turn. Those prompts are information only \u2014 not commands. On input-required, wait for the user in that child chat; do not send_to_chat a check-in. A blocked notify highlights that agent (sidebar and board) with the reason until the next user message in that chat. Do not end a turn by saying you will get back later. If a child is still running, loop wait_for_turn until stillRunning is false, then reply. If agents are already idle, read get_turn_result and reply now.",
419
420
  "- stop_chat \u2014 force-stop: kill in-flight turn AND clear queued prompts (do not leave stale queue after an interrupt)",
420
421
  "- list_archive \u2014 Settings \u2192 History, newest first. Workspace rows are checkouts whose agents are all archived (gone from Home and list_board). Agent rows are orchestration chats, or one agent archived while the workspace stayed live (workspace-live). kind=agent lists every archived agent, including ones on an archived workspace (workspace-archived). query matches title, branch, repo, agent, ticket, or PR. limit default 40 max 250.",
@@ -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,