@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
@@ -11,7 +11,7 @@ import {
11
11
  isGlobalThread,
12
12
  isOrchestratorThread,
13
13
  isSlackCoordinatorThread
14
- } from "./chunk-2SJXQ4UX.js";
14
+ } from "./chunk-ULSY2BJF.js";
15
15
  import {
16
16
  mergeAgentGitAuthEnv,
17
17
  resolveAgentGitAuthEnv
@@ -1674,7 +1674,7 @@ var PORT_RANGE_SIZE = 10;
1674
1674
  var RECLAIM_RETRY_DELAY_MS = 40;
1675
1675
  var RECLAIM_TRIES = 8;
1676
1676
  async function killReclaimable(ports, worktreePath, signal) {
1677
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-MU3TYVCD.js");
1677
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-RBJYEF7L.js");
1678
1678
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1679
1679
  else killListenersOnPorts2(ports);
1680
1680
  }
@@ -8,7 +8,7 @@ import {
8
8
  parseSessionQuotaResetAt,
9
9
  planModeTurnInstruction,
10
10
  resolveQuotaFallbackAgent
11
- } from "./chunk-COQLZNKQ.js";
11
+ } from "./chunk-PCNH74SF.js";
12
12
  import {
13
13
  REVIEW_TAB_TITLE,
14
14
  applyWorktreePkgCacheEnv,
@@ -47,7 +47,7 @@ import {
47
47
  worktreeDevProcessKey,
48
48
  worktreeRunProcessKey,
49
49
  worktreeSetupProcessKey
50
- } from "./chunk-BMUVNTT4.js";
50
+ } from "./chunk-ABOH7GBG.js";
51
51
  import {
52
52
  applyAgentEvent,
53
53
  clipAgentEventForPaint,
@@ -75,6 +75,8 @@ import {
75
75
  import {
76
76
  SLACK_REPLY_FORMATTING,
77
77
  addWorkspace,
78
+ archiveRemovedWorkspaceChats,
79
+ archivesWithRemovedWorkspace,
78
80
  attachmentsFromWorktreePaths,
79
81
  coordinatorSystemPrompt,
80
82
  coordinatorTurnReminder,
@@ -91,11 +93,10 @@ import {
91
93
  orchestratorSessionPoisonedByBuiltins,
92
94
  persistPendingFileAttachments,
93
95
  removeWorkspace,
94
- sameWorkspacePath,
95
96
  stageAbsolutePathsAsAttachments,
96
97
  stageBuffersAsAttachments,
97
98
  syncWorkspacesFromThreads
98
- } from "./chunk-WY2IAB7J.js";
99
+ } from "./chunk-MGJ7R7UX.js";
99
100
  import {
100
101
  addPrStackLayer,
101
102
  allocateTeamSlug,
@@ -164,7 +165,7 @@ import {
164
165
  } from "./chunk-N5UGX3JL.js";
165
166
  import {
166
167
  httpFetch
167
- } from "./chunk-N7WZ6NIN.js";
168
+ } from "./chunk-JAT3JFOS.js";
168
169
  import {
169
170
  createAgentStreamCoalescer
170
171
  } from "./chunk-AXQ4ZWHK.js";
@@ -450,9 +451,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
450
451
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
451
452
  );
452
453
  }
453
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-XON4YZXE.js");
454
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-IPIEC6FM.js");
454
455
  if (isGlobalThread2(thread)) {
455
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-4DJIHSE6.js");
456
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-R42WEL3T.js");
456
457
  ensureGlobalCoordinatorCwd2(
457
458
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
458
459
  );
@@ -2628,7 +2629,7 @@ async function createThread(input, _onSetupLine) {
2628
2629
  let sourceIsFork = false;
2629
2630
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
2630
2631
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
2631
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-X64E3GUJ.js");
2632
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-I4RODUKT.js");
2632
2633
  const task = await ensureAbleTimeTask({
2633
2634
  title: title?.trim() || "Untitled work",
2634
2635
  description: input.prompt?.trim() || void 0
@@ -2739,7 +2740,7 @@ async function createThread(input, _onSetupLine) {
2739
2740
  return readThread(thread.id) ?? thread;
2740
2741
  }
2741
2742
  async function listLinearIssues(agent, repoPath) {
2742
- const { getAdapter: getAdapter2 } = await import("./agents-6U2RQK7P.js");
2743
+ const { getAdapter: getAdapter2 } = await import("./agents-BHUXZ7XO.js");
2743
2744
  await requireAgent(agent, { requireLinear: true });
2744
2745
  const adapter = getAdapter2(agent);
2745
2746
  if (!adapter.listLinearIssues) {
@@ -3250,7 +3251,7 @@ async function adoptThread(input) {
3250
3251
  messages: input.messages ?? []
3251
3252
  });
3252
3253
  writeThread(thread);
3253
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-7AJ5RZ3P.js");
3254
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-LIFFWK23.js");
3254
3255
  await addWorkspace2(repoPath);
3255
3256
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-RXZPTCNH.js");
3256
3257
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -6436,7 +6437,7 @@ function formatScheduledPrompt(name, prompt) {
6436
6437
  ${prompt}`;
6437
6438
  }
6438
6439
  async function defaultDeps() {
6439
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-6YVY6T5I.js");
6440
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-65QGA6BB.js");
6440
6441
  const orch = getOrchestrator2();
6441
6442
  return {
6442
6443
  findThread: (id) => findThreadByRef(id),
@@ -7175,10 +7176,10 @@ var Orchestrator = class {
7175
7176
  }
7176
7177
  async removeWorkspace(repoPath) {
7177
7178
  removeWorkspace(repoPath);
7178
- for (const thread of listThreads()) {
7179
- if (!sameWorkspacePath(thread.repoPath, repoPath)) continue;
7180
- await this.archive(thread.id).catch(() => void 0);
7181
- }
7179
+ await archiveRemovedWorkspaceChats(
7180
+ listThreads().filter((thread) => archivesWithRemovedWorkspace(thread.repoPath, repoPath)),
7181
+ (id) => this.archive(id)
7182
+ );
7182
7183
  }
7183
7184
  async adopt(input) {
7184
7185
  const thread = await adoptThread(input);
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DEFAULT_ABLETIME_HOST,
3
3
  normalizeAbleTimeHost
4
- } from "./chunk-VA55JG2I.js";
4
+ } from "./chunk-DEJALWKM.js";
5
5
  import {
6
6
  httpFetch
7
- } from "./chunk-N7WZ6NIN.js";
7
+ } from "./chunk-JAT3JFOS.js";
8
8
  import {
9
9
  disconnectAbleTimeConnection,
10
10
  getAbleTimeHost,
@@ -280,7 +280,7 @@ async function startAbleTimeOAuth(opts) {
280
280
  persistAbleTimeTokens(data, { host });
281
281
  const token = data.access_token.trim();
282
282
  try {
283
- const { getAbleTimeOrientation } = await import("./abletime-X64E3GUJ.js");
283
+ const { getAbleTimeOrientation } = await import("./abletime-I4RODUKT.js");
284
284
  const orientation = await getAbleTimeOrientation({ token, host });
285
285
  return saveAbleTimeConnection({
286
286
  accessToken: token,
@@ -0,0 +1,61 @@
1
+ // src/http/fetch.ts
2
+ var injected = null;
3
+ function setHttpFetchImpl(fetchImpl) {
4
+ injected = fetchImpl;
5
+ }
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
+ setHttpFetchImpl,
58
+ formatFetchError,
59
+ currentHttpFetch,
60
+ httpFetch
61
+ };
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  abletimeRestUrl,
3
3
  textFromAbleTimeDoc
4
- } from "./chunk-U7HAVAGJ.js";
4
+ } from "./chunk-6CVVNAIU.js";
5
5
  import {
6
6
  assertAbleTimeCredential,
7
7
  callAbleTimeTool,
8
8
  normalizeAbleTimeHost,
9
9
  rewriteAbleTimeError
10
- } from "./chunk-VA55JG2I.js";
10
+ } from "./chunk-DEJALWKM.js";
11
11
  import {
12
12
  httpFetch
13
- } from "./chunk-N7WZ6NIN.js";
13
+ } from "./chunk-JAT3JFOS.js";
14
14
  import {
15
15
  ATTACHMENTS_DIR,
16
16
  attachmentsGitignoreBody
@@ -33,11 +33,13 @@ import {
33
33
  import {
34
34
  appDataDir,
35
35
  globalAgentCwd,
36
+ loadRepoSettings,
36
37
  sideboardReposDir
37
38
  } from "./chunk-EHT2DRT4.js";
38
39
 
39
40
  // src/store/workspaces.ts
40
41
  import { existsSync as existsSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync3, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
42
+ import { homedir } from "os";
41
43
  import { basename as basename2, join as join3 } from "path";
42
44
 
43
45
  // src/brightsy/cloud-connect-constants.ts
@@ -874,10 +876,33 @@ function sameWorkspacePath(a, b) {
874
876
  if (primaryB && primaryB === left) return true;
875
877
  return false;
876
878
  }
879
+ function pathIsInside(parent, child) {
880
+ const root = parent.replace(/\/+$/, "");
881
+ const path = child.replace(/\/+$/, "");
882
+ if (!root || !path) return false;
883
+ return path === root || path.startsWith(`${root}/`);
884
+ }
885
+ function defaultWorktreesRoot(repoPath) {
886
+ const slug = basename2(repoPath.replace(/\/+$/, "")) || "repo";
887
+ return join3(homedir(), "sideboard", "workspaces", slug);
888
+ }
889
+ function removedWorktreeCoversRepo(saved, repoPath) {
890
+ if (!saved || !repoPath) return false;
891
+ if (pathIsInside(defaultWorktreesRoot(repoPath), saved)) return true;
892
+ try {
893
+ const custom = loadRepoSettings(repoPath)?.worktreesRoot;
894
+ if (custom && pathIsInside(custom, saved)) return true;
895
+ } catch {
896
+ }
897
+ return false;
898
+ }
877
899
  function removedMatches(saved, repoPath) {
878
900
  if (saved === repoPath || sameWorkspacePath(saved, repoPath)) return true;
879
901
  const primary = primaryCheckoutFromLinkedWorktree(repoPath);
880
- return Boolean(primary && sameWorkspacePath(saved, primary));
902
+ if (primary && (sameWorkspacePath(saved, primary) || removedWorktreeCoversRepo(saved, primary))) {
903
+ return true;
904
+ }
905
+ return removedWorktreeCoversRepo(saved, repoPath);
881
906
  }
882
907
  function isRemovedWorkspace(repoPath) {
883
908
  if (!repoPath) return false;
@@ -886,6 +911,10 @@ function isRemovedWorkspace(repoPath) {
886
911
  }
887
912
  return false;
888
913
  }
914
+ function archivesWithRemovedWorkspace(threadRepoPath, removedPath) {
915
+ if (!threadRepoPath || isGlobalRepoPath(threadRepoPath)) return false;
916
+ return isRemovedWorkspace(threadRepoPath) || sameWorkspacePath(threadRepoPath, removedPath);
917
+ }
889
918
  function rememberRemoved(repoPath) {
890
919
  const next = readRemoved();
891
920
  const before = next.size;
@@ -893,6 +922,8 @@ function rememberRemoved(repoPath) {
893
922
  next.add(canon);
894
923
  const raw = repoPath.replace(/\/+$/, "");
895
924
  if (raw && raw !== canon) next.add(raw);
925
+ const primary = primaryCheckoutFromLinkedWorktree(repoPath) ?? (canon !== repoPath ? primaryCheckoutFromLinkedWorktree(canon) : null);
926
+ if (primary) next.add(primary);
896
927
  if (next.size !== before) writeRemoved(next);
897
928
  }
898
929
  function forgetRemoved(repoPath) {
@@ -1025,6 +1056,17 @@ function syncWorkspacesFromThreads(repoPaths) {
1025
1056
  if (dirty) writeAll(next);
1026
1057
  return next.sort((a, b) => a.name.localeCompare(b.name));
1027
1058
  }
1059
+ async function archiveRemovedWorkspaceChats(threads, archive) {
1060
+ const failures = [];
1061
+ for (const thread of threads) {
1062
+ try {
1063
+ await archive(thread.id);
1064
+ } catch (err) {
1065
+ failures.push(err instanceof Error ? err.message : String(err));
1066
+ }
1067
+ }
1068
+ if (failures.length > 0) throw new Error(failures.join("\n"));
1069
+ }
1028
1070
 
1029
1071
  export {
1030
1072
  CLOUD_ORCHESTRATOR_GOAL,
@@ -1044,12 +1086,14 @@ export {
1044
1086
  attachmentsFromWorktreePaths,
1045
1087
  sameWorkspacePath,
1046
1088
  isRemovedWorkspace,
1089
+ archivesWithRemovedWorkspace,
1047
1090
  listWorkspaces,
1048
1091
  primaryCheckoutFromLinkedWorktree,
1049
1092
  addWorkspace,
1050
1093
  removeWorkspace,
1051
1094
  ensureWorkspace,
1052
1095
  syncWorkspacesFromThreads,
1096
+ archiveRemovedWorkspaceChats,
1053
1097
  formatWorkspaceInventory,
1054
1098
  enrichWorkspacesWithGithub,
1055
1099
  coordinatorGreenfieldPlaybook,
@@ -3,7 +3,7 @@ import {
3
3
  brightsyMcpServerName,
4
4
  ensureCliTeamTracked,
5
5
  ensureConnectedBrightsyTeamTokens
6
- } from "./chunk-GWFVCCJZ.js";
6
+ } from "./chunk-VGNLMGBK.js";
7
7
  import {
8
8
  looksLikeConversationSummary,
9
9
  looksLikeSkillBody,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-XSDCLM3F.js";
13
13
  import {
14
14
  isOrchestratorThread
15
- } from "./chunk-WY2IAB7J.js";
15
+ } from "./chunk-MGJ7R7UX.js";
16
16
  import {
17
17
  codexUnattendedGitConfigArgs,
18
18
  mergeAgentGitAuthEnv,
@@ -21,10 +21,10 @@ import {
21
21
  } from "./chunk-K5XSTHHP.js";
22
22
  import {
23
23
  loadBrightsyConfig
24
- } from "./chunk-ROPGQRPU.js";
24
+ } from "./chunk-33KDPEK4.js";
25
25
  import {
26
26
  httpFetch
27
- } from "./chunk-N7WZ6NIN.js";
27
+ } from "./chunk-JAT3JFOS.js";
28
28
  import {
29
29
  CURSOR_SDK_INSTALL_HINT,
30
30
  applyAgentRunnerHeapEnv,
@@ -1755,7 +1755,7 @@ var claudeAdapter = {
1755
1755
  );
1756
1756
  }
1757
1757
  const mode = permissionMode(thread);
1758
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-XON4YZXE.js");
1758
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-IPIEC6FM.js");
1759
1759
  const isOrchestrator = isOrchestratorThread2(thread);
1760
1760
  const rpc = worktreeAgentRpc(isOrchestrator);
1761
1761
  const injectedServers = await buildInjectedMcpServers({
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  formatFetchError
5
- } from "./chunk-VKQGAWHY.js";
5
+ } from "./chunk-2GPQZZLY.js";
6
6
 
7
7
  // src/brightsy/config.ts
8
8
  import { existsSync, readFileSync, writeFileSync } from "fs";
@@ -3,16 +3,16 @@
3
3
  import {
4
4
  abletimeRestUrl,
5
5
  textFromAbleTimeDoc
6
- } from "./chunk-I6HSGKMZ.js";
6
+ } from "./chunk-5T4YWFLD.js";
7
7
  import {
8
8
  assertAbleTimeCredential,
9
9
  callAbleTimeTool,
10
10
  normalizeAbleTimeHost,
11
11
  rewriteAbleTimeError
12
- } from "./chunk-PY4UCMRI.js";
12
+ } from "./chunk-VQEARG5H.js";
13
13
  import {
14
14
  httpFetch
15
- } from "./chunk-VKQGAWHY.js";
15
+ } from "./chunk-2GPQZZLY.js";
16
16
  import {
17
17
  ATTACHMENTS_DIR,
18
18
  attachmentsGitignoreBody
@@ -35,11 +35,13 @@ import {
35
35
  import {
36
36
  appDataDir,
37
37
  globalAgentCwd,
38
+ loadRepoSettings,
38
39
  sideboardReposDir
39
40
  } from "./chunk-H5XL4KUS.js";
40
41
 
41
42
  // src/store/workspaces.ts
42
43
  import { existsSync as existsSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync3, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
44
+ import { homedir } from "os";
43
45
  import { basename as basename2, join as join3 } from "path";
44
46
 
45
47
  // src/brightsy/cloud-connect-constants.ts
@@ -829,10 +831,33 @@ function sameWorkspacePath(a, b) {
829
831
  if (primaryB && primaryB === left) return true;
830
832
  return false;
831
833
  }
834
+ function pathIsInside(parent, child) {
835
+ const root = parent.replace(/\/+$/, "");
836
+ const path = child.replace(/\/+$/, "");
837
+ if (!root || !path) return false;
838
+ return path === root || path.startsWith(`${root}/`);
839
+ }
840
+ function defaultWorktreesRoot(repoPath) {
841
+ const slug = basename2(repoPath.replace(/\/+$/, "")) || "repo";
842
+ return join3(homedir(), "sideboard", "workspaces", slug);
843
+ }
844
+ function removedWorktreeCoversRepo(saved, repoPath) {
845
+ if (!saved || !repoPath) return false;
846
+ if (pathIsInside(defaultWorktreesRoot(repoPath), saved)) return true;
847
+ try {
848
+ const custom = loadRepoSettings(repoPath)?.worktreesRoot;
849
+ if (custom && pathIsInside(custom, saved)) return true;
850
+ } catch {
851
+ }
852
+ return false;
853
+ }
832
854
  function removedMatches(saved, repoPath) {
833
855
  if (saved === repoPath || sameWorkspacePath(saved, repoPath)) return true;
834
856
  const primary = primaryCheckoutFromLinkedWorktree(repoPath);
835
- return Boolean(primary && sameWorkspacePath(saved, primary));
857
+ if (primary && (sameWorkspacePath(saved, primary) || removedWorktreeCoversRepo(saved, primary))) {
858
+ return true;
859
+ }
860
+ return removedWorktreeCoversRepo(saved, repoPath);
836
861
  }
837
862
  function isRemovedWorkspace(repoPath) {
838
863
  if (!repoPath) return false;
@@ -841,6 +866,10 @@ function isRemovedWorkspace(repoPath) {
841
866
  }
842
867
  return false;
843
868
  }
869
+ function archivesWithRemovedWorkspace(threadRepoPath, removedPath) {
870
+ if (!threadRepoPath || isGlobalRepoPath(threadRepoPath)) return false;
871
+ return isRemovedWorkspace(threadRepoPath) || sameWorkspacePath(threadRepoPath, removedPath);
872
+ }
844
873
  function rememberRemoved(repoPath) {
845
874
  const next = readRemoved();
846
875
  const before = next.size;
@@ -848,6 +877,8 @@ function rememberRemoved(repoPath) {
848
877
  next.add(canon);
849
878
  const raw = repoPath.replace(/\/+$/, "");
850
879
  if (raw && raw !== canon) next.add(raw);
880
+ const primary = primaryCheckoutFromLinkedWorktree(repoPath) ?? (canon !== repoPath ? primaryCheckoutFromLinkedWorktree(canon) : null);
881
+ if (primary) next.add(primary);
851
882
  if (next.size !== before) writeRemoved(next);
852
883
  }
853
884
  function forgetRemoved(repoPath) {
@@ -980,6 +1011,17 @@ function syncWorkspacesFromThreads(repoPaths) {
980
1011
  if (dirty) writeAll(next);
981
1012
  return next.sort((a, b) => a.name.localeCompare(b.name));
982
1013
  }
1014
+ async function archiveRemovedWorkspaceChats(threads, archive) {
1015
+ const failures = [];
1016
+ for (const thread of threads) {
1017
+ try {
1018
+ await archive(thread.id);
1019
+ } catch (err) {
1020
+ failures.push(err instanceof Error ? err.message : String(err));
1021
+ }
1022
+ }
1023
+ if (failures.length > 0) throw new Error(failures.join("\n"));
1024
+ }
983
1025
 
984
1026
  export {
985
1027
  stageAbsolutePathsAsAttachments,
@@ -988,12 +1030,14 @@ export {
988
1030
  attachmentsFromWorktreePaths,
989
1031
  sameWorkspacePath,
990
1032
  isRemovedWorkspace,
1033
+ archivesWithRemovedWorkspace,
991
1034
  listWorkspaces,
992
1035
  primaryCheckoutFromLinkedWorktree,
993
1036
  addWorkspace,
994
1037
  removeWorkspace,
995
1038
  ensureWorkspace,
996
1039
  syncWorkspacesFromThreads,
1040
+ archiveRemovedWorkspaceChats,
997
1041
  formatWorkspaceInventory,
998
1042
  enrichWorkspacesWithGithub,
999
1043
  coordinatorGreenfieldPlaybook,
@@ -5,7 +5,7 @@ import {
5
5
  loadBrightsyConfig,
6
6
  refreshBrightsyAccessToken,
7
7
  saveBrightsyConfig
8
- } from "./chunk-ROPGQRPU.js";
8
+ } from "./chunk-33KDPEK4.js";
9
9
  import {
10
10
  run
11
11
  } from "./chunk-QVN2WOKJ.js";
@@ -19,7 +19,7 @@ import { join } from "path";
19
19
 
20
20
  // src/brightsy/accounts.ts
21
21
  async function loadConnectedTeams() {
22
- const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-RU6VATCM.js");
22
+ const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-BJ6PMIST.js");
23
23
  return listConnectedBrightsyTeams2();
24
24
  }
25
25
  async function runBrightsyTeamsJson(args) {
@@ -47,15 +47,15 @@ async function listBrightsyAccounts() {
47
47
  }
48
48
  async function getBrightsySession() {
49
49
  try {
50
- const { ensureBrightsyLocalConfigFresh: ensureBrightsyLocalConfigFresh2 } = await import("./oauth-S3M7B475.js");
51
- const { ensureConnectedBrightsyTeamTokens: ensureConnectedBrightsyTeamTokens2 } = await import("./connected-teams-RU6VATCM.js");
50
+ const { ensureBrightsyLocalConfigFresh: ensureBrightsyLocalConfigFresh2 } = await import("./oauth-DP4ZV2M2.js");
51
+ const { ensureConnectedBrightsyTeamTokens: ensureConnectedBrightsyTeamTokens2 } = await import("./connected-teams-BJ6PMIST.js");
52
52
  await ensureBrightsyLocalConfigFresh2();
53
53
  await ensureConnectedBrightsyTeamTokens2();
54
54
  loadBrightsyConfig();
55
55
  const data = await runBrightsyTeamsJson([]);
56
56
  const accounts = Array.isArray(data.teams) ? data.teams : [];
57
57
  const active = data.active ?? accounts.find((a) => a.active) ?? null;
58
- const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-RU6VATCM.js");
58
+ const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-BJ6PMIST.js");
59
59
  const connectedTeams = ensureCliTeamTracked2(
60
60
  active ? { id: active.id, slug: active.slug, name: active.name } : void 0
61
61
  );
@@ -95,7 +95,7 @@ async function performBrightsyAccountSwitch(accountIdOrSlug) {
95
95
  return { cfg, target: data.active };
96
96
  }
97
97
  async function switchBrightsyAccount(accountIdOrSlug) {
98
- const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-RU6VATCM.js");
98
+ const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-BJ6PMIST.js");
99
99
  await connectBrightsyTeam2(accountIdOrSlug);
100
100
  return getBrightsySession();
101
101
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  httpFetch
5
- } from "./chunk-VKQGAWHY.js";
5
+ } from "./chunk-2GPQZZLY.js";
6
6
  import {
7
7
  getAbleTimeHost,
8
8
  isAbleTimeConnected
@@ -155,7 +155,7 @@ function textsFromUnknown(value) {
155
155
  return "";
156
156
  }
157
157
  async function abletimeMcpRequest(method, params, opts) {
158
- const rawToken = opts?.token ?? await import("./abletime-oauth-AXR676W5.js").then((m) => m.ensureAbleTimeAccessToken());
158
+ const rawToken = opts?.token ?? await import("./abletime-oauth-7OZZ3ABX.js").then((m) => m.ensureAbleTimeAccessToken());
159
159
  if (!rawToken?.trim()) {
160
160
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
161
161
  }
@@ -226,9 +226,9 @@ async function callAbleTimeTool(name, args = {}, opts) {
226
226
  if (!opts?.token && !isAbleTimeConnected()) {
227
227
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
228
228
  }
229
- const rawToken = opts?.token ?? await import("./abletime-oauth-AXR676W5.js").then((m) => m.ensureAbleTimeAccessToken());
229
+ const rawToken = opts?.token ?? await import("./abletime-oauth-7OZZ3ABX.js").then((m) => m.ensureAbleTimeAccessToken());
230
230
  if (rawToken && ableTimeUsesRest(rawToken)) {
231
- const { callAbleTimeRestTool } = await import("./abletime-rest-LPUDJUEP.js");
231
+ const { callAbleTimeRestTool } = await import("./abletime-rest-WFI2HWBU.js");
232
232
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
233
233
  }
234
234
  const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
@@ -244,7 +244,7 @@ async function callAbleTimeTool(name, args = {}, opts) {
244
244
  return await call();
245
245
  }
246
246
  if (rawToken && ableTimeUsesRest(rawToken) && isAbleTimeRejectedCredential(message)) {
247
- const { callAbleTimeRestTool } = await import("./abletime-rest-LPUDJUEP.js");
247
+ const { callAbleTimeRestTool } = await import("./abletime-rest-WFI2HWBU.js");
248
248
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
249
249
  }
250
250
  throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;
@@ -33,9 +33,9 @@ import {
33
33
  tryReservePort,
34
34
  tryReservePorts,
35
35
  worktreeRunPortsPath
36
- } from "./chunk-LMWPVC5L.js";
36
+ } from "./chunk-ETZPTOK7.js";
37
37
  import "./chunk-5QOLFOAX.js";
38
- import "./chunk-2SJXQ4UX.js";
38
+ import "./chunk-ULSY2BJF.js";
39
39
  import "./chunk-5MGLNVNK.js";
40
40
  import "./chunk-N2WW62LF.js";
41
41
  import "./chunk-DD67JWTN.js";
@@ -31,9 +31,9 @@ import {
31
31
  tryReservePort,
32
32
  tryReservePorts,
33
33
  worktreeRunPortsPath
34
- } from "./chunk-BMUVNTT4.js";
34
+ } from "./chunk-ABOH7GBG.js";
35
35
  import "./chunk-XSDCLM3F.js";
36
- import "./chunk-WY2IAB7J.js";
36
+ import "./chunk-MGJ7R7UX.js";
37
37
  import "./chunk-K5XSTHHP.js";
38
38
  import "./chunk-N5UGX3JL.js";
39
39
  import "./chunk-2P4XKWV2.js";
@@ -9,9 +9,9 @@ import {
9
9
  ensureConnectedBrightsyTeamTokens,
10
10
  getConnectedBrightsyTeamsRaw,
11
11
  listConnectedBrightsyTeams
12
- } from "./chunk-TQRSVE7D.js";
13
- import "./chunk-P2BSMNHB.js";
14
- import "./chunk-VKQGAWHY.js";
12
+ } from "./chunk-7IAMHN2N.js";
13
+ import "./chunk-PXMLMBMI.js";
14
+ import "./chunk-2GPQZZLY.js";
15
15
  import "./chunk-2UG25RMK.js";
16
16
  import "./chunk-WWUABK6B.js";
17
17
  import "./chunk-H5XL4KUS.js";
@@ -7,9 +7,9 @@ import {
7
7
  ensureConnectedBrightsyTeamTokens,
8
8
  getConnectedBrightsyTeamsRaw,
9
9
  listConnectedBrightsyTeams
10
- } from "./chunk-GWFVCCJZ.js";
11
- import "./chunk-ROPGQRPU.js";
12
- import "./chunk-N7WZ6NIN.js";
10
+ } from "./chunk-VGNLMGBK.js";
11
+ import "./chunk-33KDPEK4.js";
12
+ import "./chunk-JAT3JFOS.js";
13
13
  import "./chunk-QVN2WOKJ.js";
14
14
  import "./chunk-4TR3HZFT.js";
15
15
  import "./chunk-EHT2DRT4.js";
@@ -9,7 +9,7 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-2SJXQ4UX.js";
12
+ } from "./chunk-ULSY2BJF.js";
13
13
  import "./chunk-5MGLNVNK.js";
14
14
  import "./chunk-N2WW62LF.js";
15
15
  import "./chunk-DD67JWTN.js";
@@ -7,7 +7,7 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-WY2IAB7J.js";
10
+ } from "./chunk-MGJ7R7UX.js";
11
11
  import "./chunk-K5XSTHHP.js";
12
12
  import "./chunk-N5UGX3JL.js";
13
13
  import "./chunk-2P4XKWV2.js";