@sideboard-ai/core 0.1.148 → 0.1.150

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 (60) hide show
  1. package/dist/{abletime-QEVAE67D.js → abletime-223A3LY6.js} +2 -2
  2. package/dist/{abletime-DI55AJX3.js → abletime-CLC5UJC2.js} +2 -2
  3. package/dist/agents/cursor-runner.cjs +85 -45
  4. package/dist/agents/cursor-runner.js +47 -12
  5. package/dist/{agents-DUF4Q2ZI.js → agents-KKXGTEV6.js} +10 -9
  6. package/dist/{agents-INCTFWKA.js → agents-YWBQXOA2.js} +10 -9
  7. package/dist/{app-settings-WJDCJFSY.js → app-settings-3CHCNIMD.js} +5 -1
  8. package/dist/{app-settings-ZCN632OJ.js → app-settings-J3JBCUOT.js} +5 -1
  9. package/dist/{chunk-I77RYPOH.js → chunk-4XNSGDXE.js} +12 -0
  10. package/dist/{chunk-KBWND62T.js → chunk-7F4XE6UG.js} +5 -5
  11. package/dist/{chunk-R4JP32P5.js → chunk-AF6O55PJ.js} +4 -4
  12. package/dist/{chunk-BOD5V52W.js → chunk-B7XK37WZ.js} +1 -1
  13. package/dist/{chunk-BGQBELGJ.js → chunk-CZD4NRDZ.js} +12 -0
  14. package/dist/{chunk-ZVYLEF72.js → chunk-DMRIZR6M.js} +6 -6
  15. package/dist/{chunk-5MS2XTNV.js → chunk-DXCNW2JF.js} +113 -52
  16. package/dist/{chunk-KPIYENTF.js → chunk-FNQNJOHY.js} +89 -5
  17. package/dist/{chunk-ED4UPEJX.js → chunk-G7SIQFBQ.js} +1 -1
  18. package/dist/{chunk-3QRGCKYL.js → chunk-HAS5EPBS.js} +2 -2
  19. package/dist/{chunk-WT5HSFOU.js → chunk-HEII7W3Q.js} +5 -2
  20. package/dist/{chunk-EGDRPA4B.js → chunk-NOTANBYC.js} +6 -6
  21. package/dist/{chunk-CTXQHSTY.js → chunk-NUPITVRF.js} +134 -73
  22. package/dist/{chunk-QTUESPAW.js → chunk-PTOSP4AH.js} +1 -1
  23. package/dist/{chunk-Q62SDB53.js → chunk-QGJHIJHV.js} +2 -2
  24. package/dist/{chunk-YQRBNOIW.js → chunk-SDN4ZYQH.js} +24 -13
  25. package/dist/{chunk-DVM4ID64.js → chunk-UFHNSFAS.js} +89 -5
  26. package/dist/{chunk-N3VNOFXQ.js → chunk-VO4SPEBS.js} +4 -4
  27. package/dist/chunk-VSFGPWCQ.js +62 -0
  28. package/dist/{chunk-N5PM7HGQ.js → chunk-W6N6GQME.js} +1 -1
  29. package/dist/{chunk-FKOIHGKV.js → chunk-WHU7YGWP.js} +1 -1
  30. package/dist/{chunk-VZJVKQHH.js → chunk-WLV7TRMR.js} +1 -1
  31. package/dist/chunk-Y4NAPW5I.js +60 -0
  32. package/dist/{chunk-B3SJXYIJ.js → chunk-Y7YBWWIG.js} +1 -1
  33. package/dist/{chunk-XOKHXFFX.js → chunk-YGGBJY5A.js} +22 -8
  34. package/dist/{chunk-JTPDWTWJ.js → chunk-Z2PVJKMN.js} +137 -114
  35. package/dist/{chunk-YP3CSOZ6.js → chunk-ZGFYFVJF.js} +142 -114
  36. package/dist/{connected-teams-IJUJQ7R6.js → connected-teams-I2WZZZFA.js} +2 -2
  37. package/dist/{connected-teams-4A2AXDNN.js → connected-teams-XO766HB4.js} +2 -2
  38. package/dist/{coordinator-prompt-ZWBMAIWA.js → coordinator-prompt-NYR5TPBD.js} +6 -5
  39. package/dist/{coordinator-prompt-5GXGBGEZ.js → coordinator-prompt-UCQJTFA7.js} +6 -5
  40. package/dist/{global-workspace-2SIPM4PW.js → global-workspace-4QHDAD2D.js} +7 -6
  41. package/dist/{global-workspace-OJRXWXEA.js → global-workspace-4SENNWBU.js} +7 -6
  42. package/dist/index.cjs +1002 -575
  43. package/dist/index.d.cts +91 -10
  44. package/dist/index.d.ts +91 -10
  45. package/dist/index.js +268 -93
  46. package/dist/mcp/run-stdio.cjs +980 -580
  47. package/dist/mcp/run-stdio.js +196 -43
  48. package/dist/{orchestrator-OVYITCO6.js → orchestrator-GZE4X3XV.js} +14 -11
  49. package/dist/{orchestrator-NWIU5TJP.js → orchestrator-QSBRWME5.js} +16 -13
  50. package/dist/{plan-file-6O7G4VPQ.js → plan-file-5S5TUNAW.js} +2 -2
  51. package/dist/{plan-file-PHVKUAEE.js → plan-file-IBSU2PVW.js} +2 -2
  52. package/dist/{run-XQKGHQZ2.js → run-CAGKZLHA.js} +1 -1
  53. package/dist/{run-USF6FRKV.js → run-EBWL2Q4N.js} +1 -1
  54. package/dist/{workspaces-UUJNOO4T.js → workspaces-7S7QKCUE.js} +8 -7
  55. package/dist/{workspaces-3NUUZTQK.js → workspaces-RDUSB6FD.js} +8 -7
  56. package/dist/{worktree-RZRJNHYL.js → worktree-63AGPPLO.js} +5 -4
  57. package/dist/{worktree-UCWWTVLS.js → worktree-JIZ3QMZX.js} +5 -4
  58. package/dist/worktree-exclude-6MQWGWV5.js +11 -0
  59. package/dist/worktree-exclude-TV6EV6BS.js +9 -0
  60. package/package.json +1 -1
@@ -12,9 +12,9 @@ import {
12
12
  taskUrl,
13
13
  toAbleTimeIssueInfo,
14
14
  verifyAbleTimeConnection
15
- } from "./chunk-VZJVKQHH.js";
15
+ } from "./chunk-WLV7TRMR.js";
16
16
  import "./chunk-ELBYOGVA.js";
17
- import "./chunk-I77RYPOH.js";
17
+ import "./chunk-4XNSGDXE.js";
18
18
  import "./chunk-4TR3HZFT.js";
19
19
  import "./chunk-JT7R45JB.js";
20
20
  import "./chunk-77WWLBCI.js";
@@ -14,9 +14,9 @@ import {
14
14
  taskUrl,
15
15
  toAbleTimeIssueInfo,
16
16
  verifyAbleTimeConnection
17
- } from "./chunk-BOD5V52W.js";
17
+ } from "./chunk-B7XK37WZ.js";
18
18
  import "./chunk-6GN5WPYZ.js";
19
- import "./chunk-BGQBELGJ.js";
19
+ import "./chunk-CZD4NRDZ.js";
20
20
  import "./chunk-NSTQ6QKD.js";
21
21
  import "./chunk-KGZBYWZ3.js";
22
22
  import "./chunk-BD2ICC4D.js";
@@ -3,7 +3,7 @@
3
3
 
4
4
  // src/agents/cursor-runner.ts
5
5
  var import_sdk = require("@cursor/sdk");
6
- var import_node_fs10 = require("fs");
6
+ var import_node_fs11 = require("fs");
7
7
  var import_node_readline2 = require("readline");
8
8
 
9
9
  // src/hook/nested-electron-env.ts
@@ -24,14 +24,14 @@ var STRIP_NESTED_ELECTRON_THEN_EXEC = [
24
24
  ].join("; ");
25
25
 
26
26
  // src/agents/cursor-ripgrep.ts
27
- var import_node_fs5 = require("fs");
27
+ var import_node_fs6 = require("fs");
28
28
  var import_node_module = require("module");
29
- var import_node_path5 = require("path");
29
+ var import_node_path6 = require("path");
30
30
 
31
31
  // src/agents/node-launch.ts
32
- var import_node_fs4 = require("fs");
33
- var import_node_os2 = require("os");
34
- var import_node_path4 = require("path");
32
+ var import_node_fs5 = require("fs");
33
+ var import_node_os3 = require("os");
34
+ var import_node_path5 = require("path");
35
35
 
36
36
  // src/git/run.ts
37
37
  var import_execa = require("execa");
@@ -42,13 +42,18 @@ var import_node_child_process = require("child_process");
42
42
  var import_node_os = require("os");
43
43
  var import_node_path = require("path");
44
44
 
45
- // src/git/stale-lock.ts
45
+ // src/git/github-agent-auth.ts
46
46
  var import_node_fs2 = require("fs");
47
+ var import_node_os2 = require("os");
47
48
  var import_node_path2 = require("path");
48
49
 
49
- // src/agents/packaged-runtime.ts
50
+ // src/git/stale-lock.ts
50
51
  var import_node_fs3 = require("fs");
51
52
  var import_node_path3 = require("path");
53
+
54
+ // src/agents/packaged-runtime.ts
55
+ var import_node_fs4 = require("fs");
56
+ var import_node_path4 = require("path");
52
57
  function electronResourcesPath() {
53
58
  const resources = process.resourcesPath;
54
59
  if (typeof resources !== "string" || !resources) return null;
@@ -57,14 +62,14 @@ function electronResourcesPath() {
57
62
  function packagedCursorRuntimeDir() {
58
63
  const resources = electronResourcesPath();
59
64
  if (!resources) return null;
60
- const dir = (0, import_node_path3.join)(resources, "cursor-runtime");
61
- if (!(0, import_node_fs3.existsSync)((0, import_node_path3.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
65
+ const dir = (0, import_node_path4.join)(resources, "cursor-runtime");
66
+ if (!(0, import_node_fs4.existsSync)((0, import_node_path4.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
62
67
  return dir;
63
68
  }
64
69
  function packagedCursorRipgrepCandidate(platformPkg, binName) {
65
70
  const dir = packagedCursorRuntimeDir();
66
71
  if (!dir) return null;
67
- return (0, import_node_path3.join)(dir, "node_modules", platformPkg, "bin", binName);
72
+ return (0, import_node_path4.join)(dir, "node_modules", platformPkg, "bin", binName);
68
73
  }
69
74
 
70
75
  // src/agents/node-launch.ts
@@ -76,7 +81,7 @@ function unpackedAsarPath(filePath) {
76
81
  if (!isAsarPath(filePath)) return null;
77
82
  const unpacked = filePath.replace(/\.asar(?=[/\\])/, ".asar.unpacked");
78
83
  if (unpacked === filePath) return null;
79
- return (0, import_node_fs4.existsSync)(unpacked) ? unpacked : null;
84
+ return (0, import_node_fs5.existsSync)(unpacked) ? unpacked : null;
80
85
  }
81
86
  function nodeReadableScriptPath(scriptPath) {
82
87
  return unpackedAsarPath(scriptPath) ?? scriptPath;
@@ -92,21 +97,21 @@ function platformRipgrepPackage() {
92
97
  }
93
98
  function usableRipgrepPath(candidate) {
94
99
  const raw = candidate?.trim();
95
- if (!raw || !(0, import_node_path5.isAbsolute)(raw)) return null;
100
+ if (!raw || !(0, import_node_path6.isAbsolute)(raw)) return null;
96
101
  const readable = nodeReadableScriptPath(raw);
97
- if (!(0, import_node_fs5.existsSync)(readable) || isAsarPath(readable)) return null;
102
+ if (!(0, import_node_fs6.existsSync)(readable) || isAsarPath(readable)) return null;
98
103
  return readable;
99
104
  }
100
105
  function walkForBundledRipgrep(startFile) {
101
106
  if (!startFile) return null;
102
107
  const pkg = platformRipgrepPackage();
103
108
  const name = rgBinaryName();
104
- let dir = (0, import_node_path5.dirname)((0, import_node_path5.resolve)(startFile));
105
- const root = (0, import_node_path5.parse)(dir).root;
109
+ let dir = (0, import_node_path6.dirname)((0, import_node_path6.resolve)(startFile));
110
+ const root = (0, import_node_path6.parse)(dir).root;
106
111
  while (dir !== root) {
107
- const hit = usableRipgrepPath((0, import_node_path5.join)(dir, "node_modules", pkg, "bin", name));
112
+ const hit = usableRipgrepPath((0, import_node_path6.join)(dir, "node_modules", pkg, "bin", name));
108
113
  if (hit) return hit;
109
- const next = (0, import_node_path5.dirname)(dir);
114
+ const next = (0, import_node_path6.dirname)(dir);
110
115
  if (next === dir) break;
111
116
  dir = next;
112
117
  }
@@ -116,7 +121,7 @@ function requireResolveBundledRipgrep(fromFile) {
116
121
  try {
117
122
  const req = (0, import_node_module.createRequire)(fromFile);
118
123
  const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
119
- return usableRipgrepPath((0, import_node_path5.join)((0, import_node_path5.dirname)(pkgJson), "bin", rgBinaryName()));
124
+ return usableRipgrepPath((0, import_node_path6.join)((0, import_node_path6.dirname)(pkgJson), "bin", rgBinaryName()));
120
125
  } catch {
121
126
  return null;
122
127
  }
@@ -142,45 +147,45 @@ function ensureCursorRipgrepPath(opts) {
142
147
  }
143
148
 
144
149
  // src/agents/cursor-store.ts
145
- var import_node_path11 = require("path");
150
+ var import_node_path12 = require("path");
146
151
 
147
152
  // src/store/paths.ts
148
- var import_node_path9 = require("path");
149
- var import_node_os4 = require("os");
150
153
  var import_node_path10 = require("path");
151
- var import_node_fs9 = require("fs");
154
+ var import_node_os5 = require("os");
155
+ var import_node_path11 = require("path");
156
+ var import_node_fs10 = require("fs");
152
157
 
153
158
  // src/hook/settings.ts
154
- var import_node_fs8 = require("fs");
155
- var import_node_os3 = require("os");
156
- var import_node_path8 = require("path");
159
+ var import_node_fs9 = require("fs");
160
+ var import_node_os4 = require("os");
161
+ var import_node_path9 = require("path");
157
162
  var import_smol_toml = require("smol-toml");
158
163
 
159
164
  // src/hook/convention-setup.ts
160
- var import_node_fs6 = require("fs");
161
- var import_node_path6 = require("path");
162
-
163
- // src/hook/cursor-worktrees.ts
164
165
  var import_node_fs7 = require("fs");
165
166
  var import_node_path7 = require("path");
167
+
168
+ // src/hook/cursor-worktrees.ts
169
+ var import_node_fs8 = require("fs");
170
+ var import_node_path8 = require("path");
166
171
  var import_execa2 = require("execa");
167
172
  var import_node_readline = require("readline");
168
173
 
169
174
  // src/store/paths.ts
170
175
  function appDataDir() {
171
176
  const override = process.env.SIDEBOARD_APP_DATA?.trim();
172
- const base = override ? override : process.platform === "darwin" ? (0, import_node_path10.join)((0, import_node_os4.homedir)(), "Library", "Application Support", "sideboard") : process.platform === "win32" ? (0, import_node_path10.join)(process.env.APPDATA ?? (0, import_node_path10.join)((0, import_node_os4.homedir)(), "AppData", "Roaming"), "sideboard") : (0, import_node_path10.join)((0, import_node_os4.homedir)(), ".local", "share", "sideboard");
173
- (0, import_node_fs9.mkdirSync)(base, { recursive: true });
177
+ const base = override ? override : process.platform === "darwin" ? (0, import_node_path11.join)((0, import_node_os5.homedir)(), "Library", "Application Support", "sideboard") : process.platform === "win32" ? (0, import_node_path11.join)(process.env.APPDATA ?? (0, import_node_path11.join)((0, import_node_os5.homedir)(), "AppData", "Roaming"), "sideboard") : (0, import_node_path11.join)((0, import_node_os5.homedir)(), ".local", "share", "sideboard");
178
+ (0, import_node_fs10.mkdirSync)(base, { recursive: true });
174
179
  return base;
175
180
  }
176
181
 
177
182
  // src/agents/cursor-store.ts
178
183
  var CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
179
184
  function cursorSdkStoreDir(threadId) {
180
- const root = (0, import_node_path11.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
185
+ const root = (0, import_node_path12.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
181
186
  const id = sanitizeCursorStoreSegment(threadId);
182
187
  if (!id) return root;
183
- return (0, import_node_path11.join)(root, "threads", id);
188
+ return (0, import_node_path12.join)(root, "threads", id);
184
189
  }
185
190
  function sanitizeCursorStoreSegment(threadId) {
186
191
  return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
@@ -212,6 +217,36 @@ function cursorSessionRecoveryMessage(err, agentId) {
212
217
  }
213
218
  return `Cursor session is unresumable (${detail}) \u2014 starting a new session`;
214
219
  }
220
+ function isRetryableCursorTransportError(err) {
221
+ if (looksLikeNonRetryableCursorFailure(cursorErrorMessage(err))) return false;
222
+ if (err && typeof err === "object" && "isRetryable" in err && err.isRetryable === true) {
223
+ return true;
224
+ }
225
+ return /network request failed/i.test(cursorErrorMessage(err));
226
+ }
227
+ function looksLikeNonRetryableCursorFailure(message) {
228
+ const lower = message.toLowerCase();
229
+ return /invalid (?:user )?api key|not logged in|not authenticated|unauthorized|credit balance|out of credits|insufficient.?quota/.test(
230
+ lower
231
+ );
232
+ }
233
+ function cursorRetryableTransportMessage(err) {
234
+ const detail = cursorErrorMessage(err) || "network error";
235
+ return `Cursor hit a retryable error (${detail}) \u2014 retrying once`;
236
+ }
237
+ var CURSOR_RETRYABLE_TRANSPORT_DELAY_MS = 1500;
238
+ async function retryOnceOnRetryableCursorError(fn, onRetry, delayMs = CURSOR_RETRYABLE_TRANSPORT_DELAY_MS) {
239
+ try {
240
+ return await fn();
241
+ } catch (err) {
242
+ if (!isRetryableCursorTransportError(err)) throw err;
243
+ onRetry?.(err);
244
+ if (delayMs > 0) {
245
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
246
+ }
247
+ return fn();
248
+ }
249
+ }
215
250
  function cursorSendOptions(mcpServers) {
216
251
  const opts = { local: { force: true } };
217
252
  if (mcpServers && typeof mcpServers === "object" && Object.keys(mcpServers).length > 0) {
@@ -677,7 +712,7 @@ function modelSelection(model, opts) {
677
712
  }
678
713
  function localAgentStore(threadId) {
679
714
  const root = cursorSdkStoreDir(threadId);
680
- (0, import_node_fs10.mkdirSync)(root, { recursive: true });
715
+ (0, import_node_fs11.mkdirSync)(root, { recursive: true });
681
716
  return new import_sdk.JsonlLocalAgentStore(root);
682
717
  }
683
718
  async function cancelStaleLocalRuns(agentId, opts) {
@@ -746,18 +781,23 @@ async function main() {
746
781
  name: "Sideboard",
747
782
  ...mcpServers ? { mcpServers } : {}
748
783
  };
784
+ const retryTransport = (fn) => retryOnceOnRetryableCursorError(fn, (err) => {
785
+ emit({ type: "stderr", data: cursorRetryableTransportMessage(err) });
786
+ });
749
787
  async function createAgent() {
750
- return import_sdk.Agent.create(createOpts);
788
+ return retryTransport(() => import_sdk.Agent.create(createOpts));
751
789
  }
752
790
  async function openAgent() {
753
791
  try {
754
- return req.agentId ? await import_sdk.Agent.resume(req.agentId, {
755
- apiKey,
756
- model,
757
- mode,
758
- local,
759
- ...mcpServers ? { mcpServers } : {}
760
- }) : await createAgent();
792
+ return req.agentId ? await retryTransport(
793
+ () => import_sdk.Agent.resume(req.agentId, {
794
+ apiKey,
795
+ model,
796
+ mode,
797
+ local,
798
+ ...mcpServers ? { mcpServers } : {}
799
+ })
800
+ ) : await createAgent();
761
801
  } catch (err) {
762
802
  if (!isUnresumableCursorSession(err)) throw err;
763
803
  emit({
@@ -773,7 +813,7 @@ async function main() {
773
813
  ...extra
774
814
  };
775
815
  try {
776
- return await agent.send(req.prompt, sendOpts);
816
+ return await retryTransport(() => agent.send(req.prompt, sendOpts));
777
817
  } catch (err) {
778
818
  if (!isAgentBusyError(err)) throw err;
779
819
  const n = await cancelStaleLocalRuns(agent.agentId, {
@@ -784,7 +824,7 @@ async function main() {
784
824
  type: "stderr",
785
825
  data: n > 0 ? `Cursor agent had ${n} stale active run(s) \u2014 cancelled and retrying` : "Cursor agent busy \u2014 retrying send"
786
826
  });
787
- return agent.send(req.prompt, sendOpts);
827
+ return retryTransport(() => agent.send(req.prompt, sendOpts));
788
828
  }
789
829
  }
790
830
  let liveRun = null;
@@ -12,12 +12,12 @@ import {
12
12
  ensureCursorRipgrepPath,
13
13
  fetchCursorTurnCostUsd,
14
14
  formatUnknownDetail
15
- } from "../chunk-WT5HSFOU.js";
15
+ } from "../chunk-HEII7W3Q.js";
16
16
  import {
17
17
  dropNestedElectronEnvFromProcess
18
18
  } from "../chunk-4TR3HZFT.js";
19
19
  import "../chunk-QZQEXME2.js";
20
- import "../chunk-DVM4ID64.js";
20
+ import "../chunk-UFHNSFAS.js";
21
21
 
22
22
  // src/agents/cursor-runner.ts
23
23
  import { Agent, CursorAgentError, JsonlLocalAgentStore } from "@cursor/sdk";
@@ -50,6 +50,36 @@ function cursorSessionRecoveryMessage(err, agentId) {
50
50
  }
51
51
  return `Cursor session is unresumable (${detail}) \u2014 starting a new session`;
52
52
  }
53
+ function isRetryableCursorTransportError(err) {
54
+ if (looksLikeNonRetryableCursorFailure(cursorErrorMessage(err))) return false;
55
+ if (err && typeof err === "object" && "isRetryable" in err && err.isRetryable === true) {
56
+ return true;
57
+ }
58
+ return /network request failed/i.test(cursorErrorMessage(err));
59
+ }
60
+ function looksLikeNonRetryableCursorFailure(message) {
61
+ const lower = message.toLowerCase();
62
+ return /invalid (?:user )?api key|not logged in|not authenticated|unauthorized|credit balance|out of credits|insufficient.?quota/.test(
63
+ lower
64
+ );
65
+ }
66
+ function cursorRetryableTransportMessage(err) {
67
+ const detail = cursorErrorMessage(err) || "network error";
68
+ return `Cursor hit a retryable error (${detail}) \u2014 retrying once`;
69
+ }
70
+ var CURSOR_RETRYABLE_TRANSPORT_DELAY_MS = 1500;
71
+ async function retryOnceOnRetryableCursorError(fn, onRetry, delayMs = CURSOR_RETRYABLE_TRANSPORT_DELAY_MS) {
72
+ try {
73
+ return await fn();
74
+ } catch (err) {
75
+ if (!isRetryableCursorTransportError(err)) throw err;
76
+ onRetry?.(err);
77
+ if (delayMs > 0) {
78
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
79
+ }
80
+ return fn();
81
+ }
82
+ }
53
83
  function cursorSendOptions(mcpServers) {
54
84
  const opts = { local: { force: true } };
55
85
  if (mcpServers && typeof mcpServers === "object" && Object.keys(mcpServers).length > 0) {
@@ -190,18 +220,23 @@ async function main() {
190
220
  name: "Sideboard",
191
221
  ...mcpServers ? { mcpServers } : {}
192
222
  };
223
+ const retryTransport = (fn) => retryOnceOnRetryableCursorError(fn, (err) => {
224
+ emit({ type: "stderr", data: cursorRetryableTransportMessage(err) });
225
+ });
193
226
  async function createAgent() {
194
- return Agent.create(createOpts);
227
+ return retryTransport(() => Agent.create(createOpts));
195
228
  }
196
229
  async function openAgent() {
197
230
  try {
198
- return req.agentId ? await Agent.resume(req.agentId, {
199
- apiKey,
200
- model,
201
- mode,
202
- local,
203
- ...mcpServers ? { mcpServers } : {}
204
- }) : await createAgent();
231
+ return req.agentId ? await retryTransport(
232
+ () => Agent.resume(req.agentId, {
233
+ apiKey,
234
+ model,
235
+ mode,
236
+ local,
237
+ ...mcpServers ? { mcpServers } : {}
238
+ })
239
+ ) : await createAgent();
205
240
  } catch (err) {
206
241
  if (!isUnresumableCursorSession(err)) throw err;
207
242
  emit({
@@ -217,7 +252,7 @@ async function main() {
217
252
  ...extra
218
253
  };
219
254
  try {
220
- return await agent.send(req.prompt, sendOpts);
255
+ return await retryTransport(() => agent.send(req.prompt, sendOpts));
221
256
  } catch (err) {
222
257
  if (!isAgentBusyError(err)) throw err;
223
258
  const n = await cancelStaleLocalRuns(agent.agentId, {
@@ -228,7 +263,7 @@ async function main() {
228
263
  type: "stderr",
229
264
  data: n > 0 ? `Cursor agent had ${n} stale active run(s) \u2014 cancelled and retrying` : "Cursor agent busy \u2014 retrying send"
230
265
  });
231
- return agent.send(req.prompt, sendOpts);
266
+ return retryTransport(() => agent.send(req.prompt, sendOpts));
232
267
  }
233
268
  }
234
269
  let liveRun = null;
@@ -30,31 +30,32 @@ import {
30
30
  resolveLoginCommand,
31
31
  resolveQuotaFallbackAgent,
32
32
  whichOnPath
33
- } from "./chunk-YQRBNOIW.js";
34
- import "./chunk-KBWND62T.js";
33
+ } from "./chunk-SDN4ZYQH.js";
34
+ import "./chunk-7F4XE6UG.js";
35
35
  import "./chunk-M267JPEA.js";
36
36
  import {
37
37
  ORCHESTRATOR_AGENT_KINDS,
38
38
  assertOrchestratorCapableAgent,
39
39
  coerceOrchestratorAgent,
40
40
  isOrchestratorCapableAgent
41
- } from "./chunk-R4JP32P5.js";
42
- import "./chunk-EGDRPA4B.js";
41
+ } from "./chunk-AF6O55PJ.js";
42
+ import "./chunk-NOTANBYC.js";
43
+ import "./chunk-ZGFYFVJF.js";
44
+ import "./chunk-WHU7YGWP.js";
43
45
  import "./chunk-ELBYOGVA.js";
44
46
  import {
45
47
  cursorSdkMessageToEvents,
46
48
  parseCursorRunnerLine,
47
49
  preferredCursorCostCents,
48
50
  turnCostUsdFromCursorUsage
49
- } from "./chunk-WT5HSFOU.js";
50
- import "./chunk-YP3CSOZ6.js";
51
- import "./chunk-FKOIHGKV.js";
52
- import "./chunk-I77RYPOH.js";
51
+ } from "./chunk-HEII7W3Q.js";
52
+ import "./chunk-4XNSGDXE.js";
53
53
  import "./chunk-4TR3HZFT.js";
54
54
  import "./chunk-JT7R45JB.js";
55
55
  import "./chunk-TUGKX5BD.js";
56
56
  import "./chunk-77WWLBCI.js";
57
57
  import "./chunk-QZQEXME2.js";
58
+ import "./chunk-Y4NAPW5I.js";
58
59
  import {
59
60
  conductorBundledBinDir,
60
61
  enrichPathWithNpmGlobalBin,
@@ -63,7 +64,7 @@ import {
63
64
  posixShellSingleQuote,
64
65
  resolveCommandBinarySync,
65
66
  withExportedPath
66
- } from "./chunk-DVM4ID64.js";
67
+ } from "./chunk-UFHNSFAS.js";
67
68
  export {
68
69
  CLAUDE_MODEL_CATALOG,
69
70
  ORCHESTRATOR_AGENT_KINDS,
@@ -36,20 +36,21 @@ import {
36
36
  resolveQuotaFallbackAgent,
37
37
  turnCostUsdFromCursorUsage,
38
38
  whichOnPath
39
- } from "./chunk-XOKHXFFX.js";
40
- import "./chunk-ED4UPEJX.js";
39
+ } from "./chunk-YGGBJY5A.js";
40
+ import "./chunk-G7SIQFBQ.js";
41
41
  import "./chunk-S42XV45P.js";
42
- import "./chunk-6GN5WPYZ.js";
43
42
  import {
44
43
  ORCHESTRATOR_AGENT_KINDS,
45
44
  assertOrchestratorCapableAgent,
46
45
  coerceOrchestratorAgent,
47
46
  isOrchestratorCapableAgent
48
- } from "./chunk-N3VNOFXQ.js";
49
- import "./chunk-ZVYLEF72.js";
50
- import "./chunk-JTPDWTWJ.js";
51
- import "./chunk-B3SJXYIJ.js";
47
+ } from "./chunk-VO4SPEBS.js";
48
+ import "./chunk-6GN5WPYZ.js";
49
+ import "./chunk-DMRIZR6M.js";
50
+ import "./chunk-Z2PVJKMN.js";
51
+ import "./chunk-Y7YBWWIG.js";
52
52
  import "./chunk-EUXOHTUK.js";
53
+ import "./chunk-VSFGPWCQ.js";
53
54
  import {
54
55
  conductorBundledBinDir,
55
56
  enrichPathWithNpmGlobalBin,
@@ -58,8 +59,8 @@ import {
58
59
  posixShellSingleQuote,
59
60
  resolveCommandBinarySync,
60
61
  withExportedPath
61
- } from "./chunk-KPIYENTF.js";
62
- import "./chunk-BGQBELGJ.js";
62
+ } from "./chunk-FNQNJOHY.js";
63
+ import "./chunk-CZD4NRDZ.js";
63
64
  import "./chunk-NSTQ6QKD.js";
64
65
  import "./chunk-KGZBYWZ3.js";
65
66
  import "./chunk-BD2ICC4D.js";
@@ -1,4 +1,5 @@
1
1
  import {
2
+ FOLLOW_UP_BEHAVIORS,
2
3
  GITHUB_GIT_AUTH_MODES,
3
4
  HARNESS_ENV_KEYS,
4
5
  ISSUE_SOURCE_LABELS,
@@ -24,6 +25,7 @@ import {
24
25
  disconnectLinearConnection,
25
26
  emptyPublicIntegrations,
26
27
  ensureSlackDeviceIdentity,
28
+ followUpBehavior,
27
29
  getAbleTimeAccessToken,
28
30
  getAbleTimeHost,
29
31
  getDefaultAgent,
@@ -64,12 +66,13 @@ import {
64
66
  updateDefaultsSettings,
65
67
  updateIntegrationsSettings,
66
68
  updateOpencodeSettings
67
- } from "./chunk-I77RYPOH.js";
69
+ } from "./chunk-4XNSGDXE.js";
68
70
  import "./chunk-4TR3HZFT.js";
69
71
  import "./chunk-JT7R45JB.js";
70
72
  import "./chunk-77WWLBCI.js";
71
73
  import "./chunk-QZQEXME2.js";
72
74
  export {
75
+ FOLLOW_UP_BEHAVIORS,
73
76
  GITHUB_GIT_AUTH_MODES,
74
77
  HARNESS_ENV_KEYS,
75
78
  ISSUE_SOURCE_LABELS,
@@ -95,6 +98,7 @@ export {
95
98
  disconnectLinearConnection,
96
99
  emptyPublicIntegrations,
97
100
  ensureSlackDeviceIdentity,
101
+ followUpBehavior,
98
102
  getAbleTimeAccessToken,
99
103
  getAbleTimeHost,
100
104
  getDefaultAgent,
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import {
4
+ FOLLOW_UP_BEHAVIORS,
4
5
  GITHUB_GIT_AUTH_MODES,
5
6
  HARNESS_ENV_KEYS,
6
7
  ISSUE_SOURCE_LABELS,
@@ -26,6 +27,7 @@ import {
26
27
  disconnectLinearConnection,
27
28
  emptyPublicIntegrations,
28
29
  ensureSlackDeviceIdentity,
30
+ followUpBehavior,
29
31
  getAbleTimeAccessToken,
30
32
  getAbleTimeHost,
31
33
  getDefaultAgent,
@@ -66,11 +68,12 @@ import {
66
68
  updateDefaultsSettings,
67
69
  updateIntegrationsSettings,
68
70
  updateOpencodeSettings
69
- } from "./chunk-BGQBELGJ.js";
71
+ } from "./chunk-CZD4NRDZ.js";
70
72
  import "./chunk-NSTQ6QKD.js";
71
73
  import "./chunk-KGZBYWZ3.js";
72
74
  import "./chunk-BD2ICC4D.js";
73
75
  export {
76
+ FOLLOW_UP_BEHAVIORS,
74
77
  GITHUB_GIT_AUTH_MODES,
75
78
  HARNESS_ENV_KEYS,
76
79
  ISSUE_SOURCE_LABELS,
@@ -96,6 +99,7 @@ export {
96
99
  disconnectLinearConnection,
97
100
  emptyPublicIntegrations,
98
101
  ensureSlackDeviceIdentity,
102
+ followUpBehavior,
99
103
  getAbleTimeAccessToken,
100
104
  getAbleTimeHost,
101
105
  getDefaultAgent,
@@ -250,6 +250,7 @@ var DEFAULT_AGENTS = /* @__PURE__ */ new Set([
250
250
  "cursor"
251
251
  ]);
252
252
  var GITHUB_GIT_AUTH_MODES = ["auto", "gh", "ssh", "token"];
253
+ var FOLLOW_UP_BEHAVIORS = ["steer", "queue"];
253
254
  function emptyPublicIntegrations() {
254
255
  return {
255
256
  hasLinearApiKey: false,
@@ -573,6 +574,9 @@ function normalizeAdvanced(raw) {
573
574
  if (typeof source.orchestrationQuotaFallbackAgent === "string" && DEFAULT_AGENTS.has(source.orchestrationQuotaFallbackAgent) && source.orchestrationQuotaFallbackAgent !== "brightsy") {
574
575
  out.orchestrationQuotaFallbackAgent = source.orchestrationQuotaFallbackAgent;
575
576
  }
577
+ if (source.followUpBehavior === "queue" || source.followUpBehavior === "steer") {
578
+ out.followUpBehavior = source.followUpBehavior;
579
+ }
576
580
  return out;
577
581
  }
578
582
  function normalizeSettings(raw) {
@@ -1274,6 +1278,9 @@ function updateAdvancedSettings(patch) {
1274
1278
  if (typeof patch.orchestrationQuotaFallbackAgent === "string" && DEFAULT_AGENTS.has(patch.orchestrationQuotaFallbackAgent) && patch.orchestrationQuotaFallbackAgent !== "brightsy") {
1275
1279
  advanced.orchestrationQuotaFallbackAgent = patch.orchestrationQuotaFallbackAgent;
1276
1280
  }
1281
+ if (patch.followUpBehavior === "queue" || patch.followUpBehavior === "steer") {
1282
+ advanced.followUpBehavior = patch.followUpBehavior;
1283
+ }
1277
1284
  return saveAppSettings({ ...current, advanced });
1278
1285
  }
1279
1286
  function autoRenameBranchEnabled(settings = loadAppSettings()) {
@@ -1319,6 +1326,9 @@ function orchestrationQuotaFallbackAgent(settings = loadAppSettings()) {
1319
1326
  }
1320
1327
  return "cursor";
1321
1328
  }
1329
+ function followUpBehavior(settings = loadAppSettings()) {
1330
+ return settings.advanced.followUpBehavior === "queue" ? "queue" : "steer";
1331
+ }
1322
1332
  function maxConcurrentAgents(settings = loadAppSettings()) {
1323
1333
  const n = settings.advanced.maxConcurrent;
1324
1334
  if (typeof n === "number" && Number.isFinite(n)) {
@@ -1426,6 +1436,7 @@ export {
1426
1436
  issueSourceLabel,
1427
1437
  HARNESS_ENV_KEYS,
1428
1438
  GITHUB_GIT_AUTH_MODES,
1439
+ FOLLOW_UP_BEHAVIORS,
1429
1440
  emptyPublicIntegrations,
1430
1441
  toPublicAppSettings,
1431
1442
  appSettingsPath,
@@ -1479,6 +1490,7 @@ export {
1479
1490
  autoCleanupOrphansEnabled,
1480
1491
  orchestrationQuotaOnLimit,
1481
1492
  orchestrationQuotaFallbackAgent,
1493
+ followUpBehavior,
1482
1494
  maxConcurrentAgents,
1483
1495
  resolveClaudeExecutable,
1484
1496
  resolveAgentExecutable,
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-QZQEXME2.js";
11
11
  import {
12
12
  run
13
- } from "./chunk-DVM4ID64.js";
13
+ } from "./chunk-UFHNSFAS.js";
14
14
 
15
15
  // src/brightsy/connected-teams.ts
16
16
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -18,7 +18,7 @@ import { join } from "path";
18
18
 
19
19
  // src/brightsy/accounts.ts
20
20
  async function loadConnectedTeams() {
21
- const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-4A2AXDNN.js");
21
+ const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-XO766HB4.js");
22
22
  return listConnectedBrightsyTeams2();
23
23
  }
24
24
  async function runBrightsyTeamsJson(args) {
@@ -47,14 +47,14 @@ async function listBrightsyAccounts() {
47
47
  async function getBrightsySession() {
48
48
  try {
49
49
  const { ensureBrightsyLocalConfigFresh: ensureBrightsyLocalConfigFresh2 } = await import("./oauth-A7XXI2TM.js");
50
- const { ensureConnectedBrightsyTeamTokens: ensureConnectedBrightsyTeamTokens2 } = await import("./connected-teams-4A2AXDNN.js");
50
+ const { ensureConnectedBrightsyTeamTokens: ensureConnectedBrightsyTeamTokens2 } = await import("./connected-teams-XO766HB4.js");
51
51
  await ensureBrightsyLocalConfigFresh2();
52
52
  await ensureConnectedBrightsyTeamTokens2();
53
53
  loadBrightsyConfig();
54
54
  const data = await runBrightsyTeamsJson([]);
55
55
  const accounts = Array.isArray(data.teams) ? data.teams : [];
56
56
  const active = data.active ?? accounts.find((a) => a.active) ?? null;
57
- const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-4A2AXDNN.js");
57
+ const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-XO766HB4.js");
58
58
  const connectedTeams = ensureCliTeamTracked2(
59
59
  active ? { id: active.id, slug: active.slug, name: active.name } : void 0
60
60
  );
@@ -94,7 +94,7 @@ async function performBrightsyAccountSwitch(accountIdOrSlug) {
94
94
  return { cfg, target: data.active };
95
95
  }
96
96
  async function switchBrightsyAccount(accountIdOrSlug) {
97
- const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-4A2AXDNN.js");
97
+ const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-XO766HB4.js");
98
98
  await connectBrightsyTeam2(accountIdOrSlug);
99
99
  return getBrightsySession();
100
100
  }