@sideboard-ai/core 0.1.284 → 0.1.286

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 (54) hide show
  1. package/dist/{abletime-WLDBJJUI.js → abletime-4CH2IOX5.js} +4 -4
  2. package/dist/{abletime-X64E3GUJ.js → abletime-I4RODUKT.js} +4 -4
  3. package/dist/{abletime-oauth-AXR676W5.js → abletime-oauth-7OZZ3ABX.js} +3 -3
  4. package/dist/{abletime-oauth-UWOCEICP.js → abletime-oauth-C2HN2Q6F.js} +3 -3
  5. package/dist/{abletime-rest-S4XWEXV2.js → abletime-rest-E4LBRFLM.js} +3 -3
  6. package/dist/{abletime-rest-LPUDJUEP.js → abletime-rest-WFI2HWBU.js} +3 -3
  7. package/dist/agents/cursor-runner.cjs +48 -11
  8. package/dist/agents/cursor-runner.js +48 -11
  9. package/dist/{agents-6U2RQK7P.js → agents-BHUXZ7XO.js} +5 -5
  10. package/dist/{agents-PM5ICSO3.js → agents-QNIFTZPN.js} +5 -5
  11. package/dist/chunk-2GPQZZLY.js +59 -0
  12. package/dist/{chunk-ROPGQRPU.js → chunk-33KDPEK4.js} +1 -1
  13. package/dist/{chunk-BSN6DJ4L.js → chunk-3H5U4QLD.js} +5 -5
  14. package/dist/{chunk-I6HSGKMZ.js → chunk-5T4YWFLD.js} +2 -2
  15. package/dist/{chunk-U7HAVAGJ.js → chunk-6CVVNAIU.js} +2 -2
  16. package/dist/{chunk-TQRSVE7D.js → chunk-7IAMHN2N.js} +1 -1
  17. package/dist/{chunk-BMUVNTT4.js → chunk-ABOH7GBG.js} +2 -2
  18. package/dist/{chunk-OEJQK7CY.js → chunk-CBIUGGPI.js} +14 -13
  19. package/dist/{chunk-VA55JG2I.js → chunk-DEJALWKM.js} +5 -5
  20. package/dist/{chunk-LMWPVC5L.js → chunk-ETZPTOK7.js} +2 -2
  21. package/dist/{chunk-WQ4M2L44.js → chunk-HJNFK5SP.js} +16 -15
  22. package/dist/{chunk-XTPQEZZA.js → chunk-IJMUYHPT.js} +3 -3
  23. package/dist/chunk-JAT3JFOS.js +61 -0
  24. package/dist/{chunk-DGPROCE5.js → chunk-LS4FFCPL.js} +3 -3
  25. package/dist/{chunk-WY2IAB7J.js → chunk-MGJ7R7UX.js} +45 -1
  26. package/dist/{chunk-COQLZNKQ.js → chunk-PCNH74SF.js} +5 -5
  27. package/dist/{chunk-P2BSMNHB.js → chunk-PXMLMBMI.js} +1 -1
  28. package/dist/{chunk-BS3QLVPL.js → chunk-TMM4FEZ5.js} +3 -3
  29. package/dist/{chunk-2SJXQ4UX.js → chunk-ULSY2BJF.js} +45 -1
  30. package/dist/{chunk-GWFVCCJZ.js → chunk-VGNLMGBK.js} +6 -6
  31. package/dist/{chunk-PY4UCMRI.js → chunk-VQEARG5H.js} +5 -5
  32. package/dist/{conductor-MU3TYVCD.js → conductor-RBJYEF7L.js} +2 -2
  33. package/dist/{conductor-GBX6LSP2.js → conductor-WYOWFB7I.js} +2 -2
  34. package/dist/{connected-teams-JIUOSZ6C.js → connected-teams-AB7ZHJVO.js} +3 -3
  35. package/dist/{connected-teams-RU6VATCM.js → connected-teams-BJ6PMIST.js} +3 -3
  36. package/dist/{coordinator-prompt-SVVGU6AZ.js → coordinator-prompt-5DE3XBNT.js} +1 -1
  37. package/dist/{coordinator-prompt-4DJIHSE6.js → coordinator-prompt-R42WEL3T.js} +1 -1
  38. package/dist/{global-workspace-XON4YZXE.js → global-workspace-IPIEC6FM.js} +1 -1
  39. package/dist/{global-workspace-UPUDWIS6.js → global-workspace-NXMYLS34.js} +1 -1
  40. package/dist/index.cjs +300 -155
  41. package/dist/index.d.cts +16 -3
  42. package/dist/index.d.ts +16 -3
  43. package/dist/index.js +177 -98
  44. package/dist/mcp/run-stdio.cjs +121 -58
  45. package/dist/mcp/run-stdio.js +10 -10
  46. package/dist/{oauth-S3M7B475.js → oauth-DP4ZV2M2.js} +2 -2
  47. package/dist/{oauth-K6CWZEQO.js → oauth-WCUZ6Z5G.js} +2 -2
  48. package/dist/{orchestrator-6YVY6T5I.js → orchestrator-65QGA6BB.js} +7 -7
  49. package/dist/{orchestrator-CRBIW2RG.js → orchestrator-YEZV35G7.js} +7 -7
  50. package/dist/{workspaces-F76BWCSI.js → workspaces-5C5ESWPU.js} +5 -1
  51. package/dist/{workspaces-7AJ5RZ3P.js → workspaces-LIFFWK23.js} +5 -1
  52. package/package.json +1 -1
  53. package/dist/chunk-N7WZ6NIN.js +0 -41
  54. package/dist/chunk-VKQGAWHY.js +0 -40
@@ -18,10 +18,10 @@ import {
18
18
  toAbleTimeIssueInfo,
19
19
  updateAbleTimeTask,
20
20
  verifyAbleTimeConnection
21
- } from "./chunk-BS3QLVPL.js";
22
- import "./chunk-I6HSGKMZ.js";
23
- import "./chunk-PY4UCMRI.js";
24
- import "./chunk-VKQGAWHY.js";
21
+ } from "./chunk-TMM4FEZ5.js";
22
+ import "./chunk-5T4YWFLD.js";
23
+ import "./chunk-VQEARG5H.js";
24
+ import "./chunk-2GPQZZLY.js";
25
25
  import "./chunk-N2WW62LF.js";
26
26
  import "./chunk-WRIMAEF2.js";
27
27
  import "./chunk-NSTQ6QKD.js";
@@ -16,10 +16,10 @@ import {
16
16
  toAbleTimeIssueInfo,
17
17
  updateAbleTimeTask,
18
18
  verifyAbleTimeConnection
19
- } from "./chunk-DGPROCE5.js";
20
- import "./chunk-U7HAVAGJ.js";
21
- import "./chunk-VA55JG2I.js";
22
- import "./chunk-N7WZ6NIN.js";
19
+ } from "./chunk-LS4FFCPL.js";
20
+ import "./chunk-6CVVNAIU.js";
21
+ import "./chunk-DEJALWKM.js";
22
+ import "./chunk-JAT3JFOS.js";
23
23
  import "./chunk-6K64FJDD.js";
24
24
  import "./chunk-YNTXWFXT.js";
25
25
  import "./chunk-77WWLBCI.js";
@@ -3,10 +3,10 @@
3
3
  import {
4
4
  DEFAULT_ABLETIME_HOST,
5
5
  normalizeAbleTimeHost
6
- } from "./chunk-PY4UCMRI.js";
6
+ } from "./chunk-VQEARG5H.js";
7
7
  import {
8
8
  httpFetch
9
- } from "./chunk-VKQGAWHY.js";
9
+ } from "./chunk-2GPQZZLY.js";
10
10
  import {
11
11
  disconnectAbleTimeConnection,
12
12
  getAbleTimeHost,
@@ -288,7 +288,7 @@ async function startAbleTimeOAuth(opts) {
288
288
  persistAbleTimeTokens(data, { host });
289
289
  const token = data.access_token.trim();
290
290
  try {
291
- const { getAbleTimeOrientation } = await import("./abletime-WLDBJJUI.js");
291
+ const { getAbleTimeOrientation } = await import("./abletime-4CH2IOX5.js");
292
292
  const orientation = await getAbleTimeOrientation({ token, host });
293
293
  return saveAbleTimeConnection({
294
294
  accessToken: token,
@@ -20,9 +20,9 @@ import {
20
20
  parseAbleTimeOAuthCallbackUrl,
21
21
  resolveAbleTimeOAuthHost,
22
22
  startAbleTimeOAuth
23
- } from "./chunk-XTPQEZZA.js";
24
- import "./chunk-VA55JG2I.js";
25
- import "./chunk-N7WZ6NIN.js";
23
+ } from "./chunk-IJMUYHPT.js";
24
+ import "./chunk-DEJALWKM.js";
25
+ import "./chunk-JAT3JFOS.js";
26
26
  import "./chunk-YNTXWFXT.js";
27
27
  import "./chunk-77WWLBCI.js";
28
28
  import "./chunk-4TR3HZFT.js";
@@ -5,9 +5,9 @@ import {
5
5
  callAbleTimeRestTool,
6
6
  looksLikeAbleTimeUlid,
7
7
  textFromAbleTimeDoc
8
- } from "./chunk-U7HAVAGJ.js";
9
- import "./chunk-VA55JG2I.js";
10
- import "./chunk-N7WZ6NIN.js";
8
+ } from "./chunk-6CVVNAIU.js";
9
+ import "./chunk-DEJALWKM.js";
10
+ import "./chunk-JAT3JFOS.js";
11
11
  import "./chunk-YNTXWFXT.js";
12
12
  import "./chunk-77WWLBCI.js";
13
13
  import "./chunk-4TR3HZFT.js";
@@ -7,9 +7,9 @@ import {
7
7
  callAbleTimeRestTool,
8
8
  looksLikeAbleTimeUlid,
9
9
  textFromAbleTimeDoc
10
- } from "./chunk-I6HSGKMZ.js";
11
- import "./chunk-PY4UCMRI.js";
12
- import "./chunk-VKQGAWHY.js";
10
+ } from "./chunk-5T4YWFLD.js";
11
+ import "./chunk-VQEARG5H.js";
12
+ import "./chunk-2GPQZZLY.js";
13
13
  import "./chunk-WRIMAEF2.js";
14
14
  import "./chunk-NSTQ6QKD.js";
15
15
  import "./chunk-WWUABK6B.js";
@@ -490,8 +490,10 @@ function cursorErrorMessage(err) {
490
490
  function isAgentBusyError(err) {
491
491
  const name = err instanceof Error ? err.name : "";
492
492
  if (name === "AgentBusyError") return true;
493
- return /already has active run/i.test(cursorErrorMessage(err));
493
+ const message = cursorErrorMessage(err);
494
+ return /already has active run/i.test(message) || /agent still running/i.test(message) || /\[agent_busy\]/i.test(message);
494
495
  }
496
+ var CURSOR_BUSY_RETRY_DELAY_MS = 400;
495
497
  function isUnresumableCursorSession(err) {
496
498
  const name = err instanceof Error ? err.name : "";
497
499
  if (name === "AgentNotFoundError") return true;
@@ -1508,14 +1510,14 @@ function localAgentStore(Store, threadId) {
1508
1510
  (0, import_node_fs17.mkdirSync)(root, { recursive: true });
1509
1511
  return new Store(root);
1510
1512
  }
1511
- async function cancelStaleLocalRuns(Agent, agentId, opts) {
1513
+ async function cancelStaleRuns(Agent, agentId, opts) {
1514
+ let cancelled = 0;
1512
1515
  const listed = await Agent.listRuns(agentId, {
1513
1516
  runtime: "local",
1514
1517
  cwd: opts.cwd,
1515
1518
  store: opts.store,
1516
1519
  limit: 20
1517
1520
  });
1518
- let cancelled = 0;
1519
1521
  for (const run2 of listed.items) {
1520
1522
  if (run2.status !== "running") continue;
1521
1523
  try {
@@ -1528,6 +1530,27 @@ async function cancelStaleLocalRuns(Agent, agentId, opts) {
1528
1530
  } catch {
1529
1531
  }
1530
1532
  }
1533
+ if (cancelled > 0 || !opts.apiKey) return cancelled;
1534
+ try {
1535
+ const cloud = await Agent.listRuns(agentId, {
1536
+ runtime: "cloud",
1537
+ apiKey: opts.apiKey,
1538
+ limit: 20
1539
+ });
1540
+ for (const run2 of cloud.items) {
1541
+ if (run2.status !== "running") continue;
1542
+ try {
1543
+ await Agent.cancelRun(run2.id, {
1544
+ runtime: "cloud",
1545
+ agentId,
1546
+ apiKey: opts.apiKey
1547
+ });
1548
+ cancelled += 1;
1549
+ } catch {
1550
+ }
1551
+ }
1552
+ } catch {
1553
+ }
1531
1554
  return cancelled;
1532
1555
  }
1533
1556
  async function readStdinJson() {
@@ -1643,6 +1666,20 @@ async function main() {
1643
1666
  return createAgent();
1644
1667
  }
1645
1668
  }
1669
+ async function retryAfterBusy(agent) {
1670
+ const n = await cancelStaleRuns(Agent, agent.agentId, {
1671
+ cwd: req.cwd,
1672
+ store,
1673
+ ...apiKey ? { apiKey } : {}
1674
+ });
1675
+ emit({
1676
+ type: "stderr",
1677
+ data: n > 0 ? `Cursor agent had ${n} stale active run(s) \u2014 cancelled and retrying` : "Cursor agent busy \u2014 retrying send"
1678
+ });
1679
+ if (CURSOR_BUSY_RETRY_DELAY_MS > 0) {
1680
+ await new Promise((resolve2) => setTimeout(resolve2, CURSOR_BUSY_RETRY_DELAY_MS));
1681
+ }
1682
+ }
1646
1683
  async function sendPrompt(agent, extra) {
1647
1684
  const sendOpts = {
1648
1685
  ...cursorSendOptions(mcpServers),
@@ -1652,14 +1689,7 @@ async function main() {
1652
1689
  return await retryTransport(() => agent.send(req.prompt, sendOpts));
1653
1690
  } catch (err) {
1654
1691
  if (!isAgentBusyError(err)) throw err;
1655
- const n = await cancelStaleLocalRuns(Agent, agent.agentId, {
1656
- cwd: req.cwd,
1657
- store
1658
- });
1659
- emit({
1660
- type: "stderr",
1661
- data: n > 0 ? `Cursor agent had ${n} stale active run(s) \u2014 cancelled and retrying` : "Cursor agent busy \u2014 retrying send"
1662
- });
1692
+ await retryAfterBusy(agent);
1663
1693
  return retryTransport(() => agent.send(req.prompt, sendOpts));
1664
1694
  }
1665
1695
  }
@@ -1742,6 +1772,9 @@ async function main() {
1742
1772
  ]) : await run2.wait();
1743
1773
  if (result.status === "error") {
1744
1774
  const detail = formatUnknownDetail(result.error);
1775
+ if (isAgentBusyError(detail)) {
1776
+ throw Object.assign(new Error(detail || "agent still running"), { name: "AgentBusyError" });
1777
+ }
1745
1778
  emit({
1746
1779
  type: "stderr",
1747
1780
  data: detail ? `Cursor run failed (${result.id}): ${detail}` : `Cursor run failed (${result.id})`
@@ -1772,6 +1805,10 @@ async function main() {
1772
1805
  try {
1773
1806
  return await runTurn(agent);
1774
1807
  } catch (err) {
1808
+ if (isAgentBusyError(err)) {
1809
+ await retryAfterBusy(agent);
1810
+ return await runTurn(agent);
1811
+ }
1775
1812
  if (!isUnresumableCursorSession(err)) throw err;
1776
1813
  emit({
1777
1814
  type: "stderr",
@@ -46,8 +46,10 @@ function cursorErrorMessage(err) {
46
46
  function isAgentBusyError(err) {
47
47
  const name = err instanceof Error ? err.name : "";
48
48
  if (name === "AgentBusyError") return true;
49
- return /already has active run/i.test(cursorErrorMessage(err));
49
+ const message = cursorErrorMessage(err);
50
+ return /already has active run/i.test(message) || /agent still running/i.test(message) || /\[agent_busy\]/i.test(message);
50
51
  }
52
+ var CURSOR_BUSY_RETRY_DELAY_MS = 400;
51
53
  function isUnresumableCursorSession(err) {
52
54
  const name = err instanceof Error ? err.name : "";
53
55
  if (name === "AgentNotFoundError") return true;
@@ -307,14 +309,14 @@ function localAgentStore(Store, threadId) {
307
309
  mkdirSync(root, { recursive: true });
308
310
  return new Store(root);
309
311
  }
310
- async function cancelStaleLocalRuns(Agent, agentId, opts) {
312
+ async function cancelStaleRuns(Agent, agentId, opts) {
313
+ let cancelled = 0;
311
314
  const listed = await Agent.listRuns(agentId, {
312
315
  runtime: "local",
313
316
  cwd: opts.cwd,
314
317
  store: opts.store,
315
318
  limit: 20
316
319
  });
317
- let cancelled = 0;
318
320
  for (const run of listed.items) {
319
321
  if (run.status !== "running") continue;
320
322
  try {
@@ -327,6 +329,27 @@ async function cancelStaleLocalRuns(Agent, agentId, opts) {
327
329
  } catch {
328
330
  }
329
331
  }
332
+ if (cancelled > 0 || !opts.apiKey) return cancelled;
333
+ try {
334
+ const cloud = await Agent.listRuns(agentId, {
335
+ runtime: "cloud",
336
+ apiKey: opts.apiKey,
337
+ limit: 20
338
+ });
339
+ for (const run of cloud.items) {
340
+ if (run.status !== "running") continue;
341
+ try {
342
+ await Agent.cancelRun(run.id, {
343
+ runtime: "cloud",
344
+ agentId,
345
+ apiKey: opts.apiKey
346
+ });
347
+ cancelled += 1;
348
+ } catch {
349
+ }
350
+ }
351
+ } catch {
352
+ }
330
353
  return cancelled;
331
354
  }
332
355
  async function readStdinJson() {
@@ -442,6 +465,20 @@ async function main() {
442
465
  return createAgent();
443
466
  }
444
467
  }
468
+ async function retryAfterBusy(agent) {
469
+ const n = await cancelStaleRuns(Agent, agent.agentId, {
470
+ cwd: req.cwd,
471
+ store,
472
+ ...apiKey ? { apiKey } : {}
473
+ });
474
+ emit({
475
+ type: "stderr",
476
+ data: n > 0 ? `Cursor agent had ${n} stale active run(s) \u2014 cancelled and retrying` : "Cursor agent busy \u2014 retrying send"
477
+ });
478
+ if (CURSOR_BUSY_RETRY_DELAY_MS > 0) {
479
+ await new Promise((resolve2) => setTimeout(resolve2, CURSOR_BUSY_RETRY_DELAY_MS));
480
+ }
481
+ }
445
482
  async function sendPrompt(agent, extra) {
446
483
  const sendOpts = {
447
484
  ...cursorSendOptions(mcpServers),
@@ -451,14 +488,7 @@ async function main() {
451
488
  return await retryTransport(() => agent.send(req.prompt, sendOpts));
452
489
  } catch (err) {
453
490
  if (!isAgentBusyError(err)) throw err;
454
- const n = await cancelStaleLocalRuns(Agent, agent.agentId, {
455
- cwd: req.cwd,
456
- store
457
- });
458
- emit({
459
- type: "stderr",
460
- data: n > 0 ? `Cursor agent had ${n} stale active run(s) \u2014 cancelled and retrying` : "Cursor agent busy \u2014 retrying send"
461
- });
491
+ await retryAfterBusy(agent);
462
492
  return retryTransport(() => agent.send(req.prompt, sendOpts));
463
493
  }
464
494
  }
@@ -541,6 +571,9 @@ async function main() {
541
571
  ]) : await run.wait();
542
572
  if (result.status === "error") {
543
573
  const detail = formatUnknownDetail(result.error);
574
+ if (isAgentBusyError(detail)) {
575
+ throw Object.assign(new Error(detail || "agent still running"), { name: "AgentBusyError" });
576
+ }
544
577
  emit({
545
578
  type: "stderr",
546
579
  data: detail ? `Cursor run failed (${result.id}): ${detail}` : `Cursor run failed (${result.id})`
@@ -571,6 +604,10 @@ async function main() {
571
604
  try {
572
605
  return await runTurn(agent);
573
606
  } catch (err) {
607
+ if (isAgentBusyError(err)) {
608
+ await retryAfterBusy(agent);
609
+ return await runTurn(agent);
610
+ }
574
611
  if (!isUnresumableCursorSession(err)) throw err;
575
612
  emit({
576
613
  type: "stderr",
@@ -47,15 +47,15 @@ import {
47
47
  resolveLoginCommand,
48
48
  resolveQuotaFallbackAgent,
49
49
  whichOnPath
50
- } from "./chunk-COQLZNKQ.js";
51
- import "./chunk-GWFVCCJZ.js";
50
+ } from "./chunk-PCNH74SF.js";
51
+ import "./chunk-VGNLMGBK.js";
52
52
  import "./chunk-XSDCLM3F.js";
53
- import "./chunk-WY2IAB7J.js";
53
+ import "./chunk-MGJ7R7UX.js";
54
54
  import "./chunk-K5XSTHHP.js";
55
55
  import "./chunk-N5UGX3JL.js";
56
56
  import "./chunk-2P4XKWV2.js";
57
- import "./chunk-ROPGQRPU.js";
58
- import "./chunk-N7WZ6NIN.js";
57
+ import "./chunk-33KDPEK4.js";
58
+ import "./chunk-JAT3JFOS.js";
59
59
  import {
60
60
  CURSOR_SDK_INSTALL_HINT,
61
61
  cursorSdkMessageToEvents,
@@ -56,12 +56,12 @@ import {
56
56
  resolveQuotaFallbackAgent,
57
57
  turnCostUsdFromCursorUsage,
58
58
  whichOnPath
59
- } from "./chunk-BSN6DJ4L.js";
60
- import "./chunk-TQRSVE7D.js";
61
- import "./chunk-P2BSMNHB.js";
62
- import "./chunk-VKQGAWHY.js";
59
+ } from "./chunk-3H5U4QLD.js";
60
+ import "./chunk-7IAMHN2N.js";
61
+ import "./chunk-PXMLMBMI.js";
62
+ import "./chunk-2GPQZZLY.js";
63
63
  import "./chunk-5QOLFOAX.js";
64
- import "./chunk-2SJXQ4UX.js";
64
+ import "./chunk-ULSY2BJF.js";
65
65
  import "./chunk-5MGLNVNK.js";
66
66
  import "./chunk-N2WW62LF.js";
67
67
  import "./chunk-DD67JWTN.js";
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+
3
+
4
+ // src/http/fetch.ts
5
+ var injected = null;
6
+ var TLS_ISSUER_RE = /UNABLE_TO_GET_ISSUER_CERT|UNABLE_TO_VERIFY_LEAF_SIGNATURE|SELF_SIGNED_CERT_IN_CHAIN/i;
7
+ var TLS_ISSUER_HINT = " \u2014 Node rejected the TLS certificate (corporate VPN/proxy CA). Desktop Linear can still work; reconnecting the API key will not fix this.";
8
+ function isTlsIssuerFailure(code, message) {
9
+ return TLS_ISSUER_RE.test(`${code ?? ""} ${message}`);
10
+ }
11
+ function describeCause(cause, depth = 0) {
12
+ if (depth > 5 || cause == null) return null;
13
+ if (cause instanceof AggregateError) {
14
+ for (const item of cause.errors) {
15
+ const found = describeCause(item, depth + 1);
16
+ if (found && (found.code || found.message)) return found;
17
+ }
18
+ return cause.message ? { message: cause.message } : null;
19
+ }
20
+ if (cause instanceof Error) {
21
+ const code = typeof cause.code === "string" ? cause.code : void 0;
22
+ const nested = describeCause(cause.cause, depth + 1);
23
+ if ((!cause.message || cause.message === "fetch failed") && nested) return nested;
24
+ if (cause.message || code) return { code, message: cause.message };
25
+ return nested;
26
+ }
27
+ return { message: String(cause) };
28
+ }
29
+ function causeSuffix(detail) {
30
+ if (!detail) return "";
31
+ if (detail.code && detail.message) return ` [${detail.code}: ${detail.message}]`;
32
+ if (detail.code) return ` [${detail.code}]`;
33
+ if (detail.message) return ` [${detail.message}]`;
34
+ return "";
35
+ }
36
+ function formatFetchError(err, url, opts) {
37
+ if (!(err instanceof Error)) return `${String(err)} (${url})`;
38
+ const detail = describeCause(err.cause);
39
+ const hintSource = `${err.message} ${detail?.code ?? ""} ${detail?.message ?? ""}`;
40
+ const tls = isTlsIssuerFailure(detail?.code, hintSource);
41
+ const hint = tls ? opts?.tlsHint ?? TLS_ISSUER_HINT : "";
42
+ return `${err.message}${causeSuffix(detail)} (${url})${hint}`;
43
+ }
44
+ function currentHttpFetch() {
45
+ return injected ?? globalThis.fetch.bind(globalThis);
46
+ }
47
+ async function httpFetch(input, init) {
48
+ const url = typeof input === "string" ? input : input.href;
49
+ try {
50
+ return await currentHttpFetch()(url, init);
51
+ } catch (err) {
52
+ throw new Error(formatFetchError(err, url));
53
+ }
54
+ }
55
+
56
+ export {
57
+ formatFetchError,
58
+ httpFetch
59
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  formatFetchError
3
- } from "./chunk-N7WZ6NIN.js";
3
+ } from "./chunk-JAT3JFOS.js";
4
4
 
5
5
  // src/brightsy/config.ts
6
6
  import { existsSync, readFileSync, writeFileSync } from "fs";
@@ -5,13 +5,13 @@ import {
5
5
  brightsyMcpServerName,
6
6
  ensureCliTeamTracked,
7
7
  ensureConnectedBrightsyTeamTokens
8
- } from "./chunk-TQRSVE7D.js";
8
+ } from "./chunk-7IAMHN2N.js";
9
9
  import {
10
10
  loadBrightsyConfig
11
- } from "./chunk-P2BSMNHB.js";
11
+ } from "./chunk-PXMLMBMI.js";
12
12
  import {
13
13
  httpFetch
14
- } from "./chunk-VKQGAWHY.js";
14
+ } from "./chunk-2GPQZZLY.js";
15
15
  import {
16
16
  extractJsonErrorMessage,
17
17
  formatUnknownDetail,
@@ -24,7 +24,7 @@ import {
24
24
  } from "./chunk-5QOLFOAX.js";
25
25
  import {
26
26
  isOrchestratorThread
27
- } from "./chunk-2SJXQ4UX.js";
27
+ } from "./chunk-ULSY2BJF.js";
28
28
  import {
29
29
  codexUnattendedGitConfigArgs,
30
30
  mergeAgentGitAuthEnv,
@@ -2018,7 +2018,7 @@ var claudeAdapter = {
2018
2018
  );
2019
2019
  }
2020
2020
  const mode = permissionMode(thread);
2021
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-UPUDWIS6.js");
2021
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-NXMYLS34.js");
2022
2022
  const isOrchestrator = isOrchestratorThread2(thread);
2023
2023
  const rpc = worktreeAgentRpc(isOrchestrator);
2024
2024
  const injectedServers = await buildInjectedMcpServers({
@@ -6,10 +6,10 @@ import {
6
6
  normalizeAbleTimeCredential,
7
7
  normalizeAbleTimeHost,
8
8
  rewriteAbleTimeError
9
- } from "./chunk-PY4UCMRI.js";
9
+ } from "./chunk-VQEARG5H.js";
10
10
  import {
11
11
  httpFetch
12
- } from "./chunk-VKQGAWHY.js";
12
+ } from "./chunk-2GPQZZLY.js";
13
13
  import {
14
14
  getAbleTimeAccessToken,
15
15
  getAbleTimeHost
@@ -4,10 +4,10 @@ import {
4
4
  normalizeAbleTimeCredential,
5
5
  normalizeAbleTimeHost,
6
6
  rewriteAbleTimeError
7
- } from "./chunk-VA55JG2I.js";
7
+ } from "./chunk-DEJALWKM.js";
8
8
  import {
9
9
  httpFetch
10
- } from "./chunk-N7WZ6NIN.js";
10
+ } from "./chunk-JAT3JFOS.js";
11
11
  import {
12
12
  getAbleTimeAccessToken,
13
13
  getAbleTimeHost
@@ -7,7 +7,7 @@ import {
7
7
  loadBrightsyConfig,
8
8
  refreshBrightsyAccessToken,
9
9
  saveBrightsyConfig
10
- } from "./chunk-P2BSMNHB.js";
10
+ } from "./chunk-PXMLMBMI.js";
11
11
  import {
12
12
  run
13
13
  } from "./chunk-2UG25RMK.js";
@@ -8,7 +8,7 @@ import {
8
8
  isGlobalThread,
9
9
  isOrchestratorThread,
10
10
  isSlackCoordinatorThread
11
- } from "./chunk-WY2IAB7J.js";
11
+ } from "./chunk-MGJ7R7UX.js";
12
12
  import {
13
13
  mergeAgentGitAuthEnv,
14
14
  resolveAgentGitAuthEnv
@@ -1776,7 +1776,7 @@ var PORT_RANGE_SIZE = 10;
1776
1776
  var RECLAIM_RETRY_DELAY_MS = 40;
1777
1777
  var RECLAIM_TRIES = 8;
1778
1778
  async function killReclaimable(ports, worktreePath, signal) {
1779
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-GBX6LSP2.js");
1779
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-WYOWFB7I.js");
1780
1780
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1781
1781
  else killListenersOnPorts2(ports);
1782
1782
  }
@@ -23,7 +23,7 @@ import {
23
23
  parseSessionQuotaResetAt,
24
24
  planModeTurnInstruction,
25
25
  resolveQuotaFallbackAgent
26
- } from "./chunk-BSN6DJ4L.js";
26
+ } from "./chunk-3H5U4QLD.js";
27
27
  import {
28
28
  REVIEW_TAB_TITLE,
29
29
  applyWorktreePkgCacheEnv,
@@ -62,7 +62,7 @@ import {
62
62
  worktreeDevProcessKey,
63
63
  worktreeRunProcessKey,
64
64
  worktreeSetupProcessKey
65
- } from "./chunk-LMWPVC5L.js";
65
+ } from "./chunk-ETZPTOK7.js";
66
66
  import {
67
67
  applyAgentEvent,
68
68
  clipAgentEventForPaint,
@@ -93,6 +93,8 @@ import {
93
93
  import {
94
94
  SLACK_REPLY_FORMATTING,
95
95
  addWorkspace,
96
+ archiveRemovedWorkspaceChats,
97
+ archivesWithRemovedWorkspace,
96
98
  attachmentsFromWorktreePaths,
97
99
  coordinatorSystemPrompt,
98
100
  coordinatorTurnReminder,
@@ -109,11 +111,10 @@ import {
109
111
  orchestratorSessionPoisonedByBuiltins,
110
112
  persistPendingFileAttachments,
111
113
  removeWorkspace,
112
- sameWorkspacePath,
113
114
  stageAbsolutePathsAsAttachments,
114
115
  stageBuffersAsAttachments,
115
116
  syncWorkspacesFromThreads
116
- } from "./chunk-2SJXQ4UX.js";
117
+ } from "./chunk-ULSY2BJF.js";
117
118
  import {
118
119
  addPrStackLayer,
119
120
  allocateTeamSlug,
@@ -498,9 +499,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
498
499
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
499
500
  );
500
501
  }
501
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-UPUDWIS6.js");
502
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-NXMYLS34.js");
502
503
  if (isGlobalThread2(thread)) {
503
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-SVVGU6AZ.js");
504
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-5DE3XBNT.js");
504
505
  ensureGlobalCoordinatorCwd2(
505
506
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
506
507
  );
@@ -2507,7 +2508,7 @@ async function createThread(input, _onSetupLine) {
2507
2508
  let sourceIsFork = false;
2508
2509
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
2509
2510
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
2510
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-WLDBJJUI.js");
2511
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-4CH2IOX5.js");
2511
2512
  const task = await ensureAbleTimeTask({
2512
2513
  title: title?.trim() || "Untitled work",
2513
2514
  description: input.prompt?.trim() || void 0
@@ -3114,7 +3115,7 @@ async function adoptThread(input) {
3114
3115
  messages: input.messages ?? []
3115
3116
  });
3116
3117
  writeThread(thread);
3117
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-F76BWCSI.js");
3118
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-5C5ESWPU.js");
3118
3119
  await addWorkspace2(repoPath);
3119
3120
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-5N2KTYIT.js");
3120
3121
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -6094,7 +6095,7 @@ function formatScheduledPrompt(name, prompt) {
6094
6095
  ${prompt}`;
6095
6096
  }
6096
6097
  async function defaultDeps() {
6097
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-CRBIW2RG.js");
6098
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-YEZV35G7.js");
6098
6099
  const orch = getOrchestrator2();
6099
6100
  return {
6100
6101
  findThread: (id) => findThreadByRef(id),
@@ -6833,10 +6834,10 @@ var Orchestrator = class {
6833
6834
  }
6834
6835
  async removeWorkspace(repoPath) {
6835
6836
  removeWorkspace(repoPath);
6836
- for (const thread of listThreads()) {
6837
- if (!sameWorkspacePath(thread.repoPath, repoPath)) continue;
6838
- await this.archive(thread.id).catch(() => void 0);
6839
- }
6837
+ await archiveRemovedWorkspaceChats(
6838
+ listThreads().filter((thread) => archivesWithRemovedWorkspace(thread.repoPath, repoPath)),
6839
+ (id) => this.archive(id)
6840
+ );
6840
6841
  }
6841
6842
  async adopt(input) {
6842
6843
  const thread = await adoptThread(input);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  httpFetch
3
- } from "./chunk-N7WZ6NIN.js";
3
+ } from "./chunk-JAT3JFOS.js";
4
4
  import {
5
5
  getAbleTimeHost,
6
6
  isAbleTimeConnected
@@ -153,7 +153,7 @@ function textsFromUnknown(value) {
153
153
  return "";
154
154
  }
155
155
  async function abletimeMcpRequest(method, params, opts) {
156
- const rawToken = opts?.token ?? await import("./abletime-oauth-UWOCEICP.js").then((m) => m.ensureAbleTimeAccessToken());
156
+ const rawToken = opts?.token ?? await import("./abletime-oauth-C2HN2Q6F.js").then((m) => m.ensureAbleTimeAccessToken());
157
157
  if (!rawToken?.trim()) {
158
158
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
159
159
  }
@@ -224,9 +224,9 @@ async function callAbleTimeTool(name, args = {}, opts) {
224
224
  if (!opts?.token && !isAbleTimeConnected()) {
225
225
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
226
226
  }
227
- const rawToken = opts?.token ?? await import("./abletime-oauth-UWOCEICP.js").then((m) => m.ensureAbleTimeAccessToken());
227
+ const rawToken = opts?.token ?? await import("./abletime-oauth-C2HN2Q6F.js").then((m) => m.ensureAbleTimeAccessToken());
228
228
  if (rawToken && ableTimeUsesRest(rawToken)) {
229
- const { callAbleTimeRestTool } = await import("./abletime-rest-S4XWEXV2.js");
229
+ const { callAbleTimeRestTool } = await import("./abletime-rest-E4LBRFLM.js");
230
230
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
231
231
  }
232
232
  const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
@@ -242,7 +242,7 @@ async function callAbleTimeTool(name, args = {}, opts) {
242
242
  return await call();
243
243
  }
244
244
  if (rawToken && ableTimeUsesRest(rawToken) && isAbleTimeRejectedCredential(message)) {
245
- const { callAbleTimeRestTool } = await import("./abletime-rest-S4XWEXV2.js");
245
+ const { callAbleTimeRestTool } = await import("./abletime-rest-E4LBRFLM.js");
246
246
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
247
247
  }
248
248
  throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;