@sideboard-ai/core 0.1.100 → 0.1.103

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 (50) hide show
  1. package/dist/agents/cursor-runner.js +1 -1
  2. package/dist/{agents-CLP5BG4O.js → agents-UT5GCJH3.js} +8 -8
  3. package/dist/{agents-OXZDMPSE.js → agents-XZBAKBO2.js} +8 -8
  4. package/dist/{app-settings-BRF7VKTQ.js → app-settings-EKJM2344.js} +2 -2
  5. package/dist/{app-settings-ZXPAB3QN.js → app-settings-VDJK2BZ2.js} +2 -2
  6. package/dist/{caffeinate-hold-U3QJBV67.js → caffeinate-hold-NBRUWYXO.js} +2 -2
  7. package/dist/{caffeinate-hold-I7SG6UQR.js → caffeinate-hold-X3JNPR42.js} +2 -2
  8. package/dist/{chunk-MHJV4WS3.js → chunk-27MCESES.js} +3 -3
  9. package/dist/{chunk-QSLE4VEM.js → chunk-2GO3YKBA.js} +4 -4
  10. package/dist/{chunk-DKHGWYWR.js → chunk-7YKXHBIW.js} +1 -1
  11. package/dist/{chunk-JL4SJ6V7.js → chunk-BD2ICC4D.js} +4 -0
  12. package/dist/{chunk-NZPGMNFC.js → chunk-DCOZABNT.js} +1 -1
  13. package/dist/{chunk-CIRXAYWS.js → chunk-DHAGMJIK.js} +55 -28
  14. package/dist/{chunk-HYKZEP5A.js → chunk-ETMRBJKA.js} +11 -11
  15. package/dist/{chunk-OXC3MEFI.js → chunk-H6LP57EF.js} +6 -6
  16. package/dist/{chunk-GR4JKWR4.js → chunk-HHLZWO7U.js} +5 -5
  17. package/dist/{chunk-3WA37BRI.js → chunk-KGSVLZV6.js} +11 -4
  18. package/dist/{chunk-7KDBDMNC.js → chunk-KLBOWJ74.js} +1 -1
  19. package/dist/{chunk-EQPQTLW6.js → chunk-LANDJIAI.js} +6 -6
  20. package/dist/{chunk-MRBKGFTL.js → chunk-ND6AO7C5.js} +3 -3
  21. package/dist/{chunk-WQTTUC4N.js → chunk-OW34MVDN.js} +5 -5
  22. package/dist/{chunk-JOF3XIEM.js → chunk-P3BQ5DOL.js} +11 -4
  23. package/dist/{chunk-B4R2VB2A.js → chunk-QZQEXME2.js} +4 -0
  24. package/dist/{chunk-R7BQBSDT.js → chunk-WA3DVVWG.js} +55 -28
  25. package/dist/{chunk-6LFV4VFI.js → chunk-WSYCND2U.js} +1 -1
  26. package/dist/{chunk-FT2SQOL4.js → chunk-XHZJJWLI.js} +1 -1
  27. package/dist/{chunk-IFHKPZHA.js → chunk-YJADJH5U.js} +11 -11
  28. package/dist/{connected-teams-SWHJWK2A.js → connected-teams-J4I5AKMR.js} +2 -2
  29. package/dist/{connected-teams-TLVKZPJP.js → connected-teams-M5XNXRI5.js} +2 -2
  30. package/dist/{coordinator-prompt-OOBSQCWQ.js → coordinator-prompt-3DFZRMXE.js} +5 -5
  31. package/dist/{coordinator-prompt-HHRKQWCX.js → coordinator-prompt-UWHSD65V.js} +5 -5
  32. package/dist/{cursor-recover-S5ORPW34.js → cursor-recover-JBTIDARH.js} +1 -1
  33. package/dist/{cursor-recover-G34BYKL2.js → cursor-recover-ZUJG6XRQ.js} +1 -1
  34. package/dist/{global-workspace-YZWYHLQY.js → global-workspace-KJQS5S2C.js} +6 -6
  35. package/dist/{global-workspace-KYEBFWKB.js → global-workspace-UR4E3CCG.js} +6 -6
  36. package/dist/index.cjs +626 -153
  37. package/dist/index.d.cts +37 -5
  38. package/dist/index.d.ts +37 -5
  39. package/dist/index.js +545 -121
  40. package/dist/mcp/run-stdio.cjs +426 -177
  41. package/dist/mcp/run-stdio.js +330 -127
  42. package/dist/{paths-TZX4L5X7.js → paths-QCI3MTO5.js} +3 -1
  43. package/dist/{paths-JQM2XRAD.js → paths-UMEDHOS5.js} +3 -1
  44. package/dist/{thread-store-XAKWCV2E.js → thread-store-4OUEQ2DB.js} +2 -2
  45. package/dist/{thread-store-V7NOOXKE.js → thread-store-DQJGDKIJ.js} +2 -2
  46. package/dist/{workspaces-ENVUDK6C.js → workspaces-NTIVI6DI.js} +7 -7
  47. package/dist/{workspaces-NNPD7QVV.js → workspaces-TKJXPNV4.js} +7 -7
  48. package/dist/{worktree-EO5QAGJU.js → worktree-NKWN5ZTS.js} +4 -4
  49. package/dist/{worktree-DA4BOV7G.js → worktree-PEUPFAKL.js} +4 -4
  50. package/package.json +1 -1
@@ -12,7 +12,7 @@ import {
12
12
  } from "../chunk-TLPJHLLM.js";
13
13
  import {
14
14
  appDataDir
15
- } from "../chunk-B4R2VB2A.js";
15
+ } from "../chunk-QZQEXME2.js";
16
16
  import "../chunk-LGXBYZZA.js";
17
17
 
18
18
  // src/agents/cursor-runner.ts
@@ -32,22 +32,22 @@ import {
32
32
  resolveCursorModelId,
33
33
  resolveLoginCommand,
34
34
  resolveQuotaFallbackAgent
35
- } from "./chunk-EQPQTLW6.js";
36
- import "./chunk-DKHGWYWR.js";
35
+ } from "./chunk-LANDJIAI.js";
36
+ import "./chunk-7YKXHBIW.js";
37
37
  import {
38
38
  ORCHESTRATOR_AGENT_KINDS,
39
39
  assertOrchestratorCapableAgent,
40
40
  coerceOrchestratorAgent,
41
41
  isOrchestratorCapableAgent
42
- } from "./chunk-WQTTUC4N.js";
43
- import "./chunk-IFHKPZHA.js";
44
- import "./chunk-R7BQBSDT.js";
42
+ } from "./chunk-OW34MVDN.js";
43
+ import "./chunk-YJADJH5U.js";
44
+ import "./chunk-WA3DVVWG.js";
45
45
  import "./chunk-B3SJXYIJ.js";
46
- import "./chunk-JOF3XIEM.js";
47
- import "./chunk-6LFV4VFI.js";
46
+ import "./chunk-P3BQ5DOL.js";
47
+ import "./chunk-WSYCND2U.js";
48
48
  import "./chunk-NSTQ6QKD.js";
49
49
  import "./chunk-KGZBYWZ3.js";
50
- import "./chunk-JL4SJ6V7.js";
50
+ import "./chunk-BD2ICC4D.js";
51
51
  import {
52
52
  conductorBundledBinDir,
53
53
  enrichPathWithNpmGlobalBin,
@@ -28,27 +28,27 @@ import {
28
28
  resolveCursorModelId,
29
29
  resolveLoginCommand,
30
30
  resolveQuotaFallbackAgent
31
- } from "./chunk-OXC3MEFI.js";
31
+ } from "./chunk-H6LP57EF.js";
32
32
  import {
33
33
  ORCHESTRATOR_AGENT_KINDS,
34
34
  assertOrchestratorCapableAgent,
35
35
  coerceOrchestratorAgent,
36
36
  isOrchestratorCapableAgent
37
- } from "./chunk-GR4JKWR4.js";
38
- import "./chunk-HYKZEP5A.js";
39
- import "./chunk-QSLE4VEM.js";
37
+ } from "./chunk-HHLZWO7U.js";
38
+ import "./chunk-ETMRBJKA.js";
39
+ import "./chunk-2GO3YKBA.js";
40
40
  import {
41
41
  cursorSdkMessageToEvents,
42
42
  parseCursorRunnerLine
43
43
  } from "./chunk-HUKCGRAT.js";
44
- import "./chunk-CIRXAYWS.js";
44
+ import "./chunk-DHAGMJIK.js";
45
45
  import "./chunk-FKOIHGKV.js";
46
- import "./chunk-FT2SQOL4.js";
46
+ import "./chunk-XHZJJWLI.js";
47
47
  import "./chunk-TLPJHLLM.js";
48
48
  import "./chunk-JT7R45JB.js";
49
- import "./chunk-3WA37BRI.js";
49
+ import "./chunk-KGSVLZV6.js";
50
50
  import "./chunk-77WWLBCI.js";
51
- import "./chunk-B4R2VB2A.js";
51
+ import "./chunk-QZQEXME2.js";
52
52
  import {
53
53
  conductorBundledBinDir,
54
54
  enrichPathWithNpmGlobalBin,
@@ -52,11 +52,11 @@ import {
52
52
  updateDefaultsSettings,
53
53
  updateIntegrationsSettings,
54
54
  updateOpencodeSettings
55
- } from "./chunk-FT2SQOL4.js";
55
+ } from "./chunk-XHZJJWLI.js";
56
56
  import "./chunk-TLPJHLLM.js";
57
57
  import "./chunk-JT7R45JB.js";
58
58
  import "./chunk-77WWLBCI.js";
59
- import "./chunk-B4R2VB2A.js";
59
+ import "./chunk-QZQEXME2.js";
60
60
  export {
61
61
  GITHUB_GIT_AUTH_MODES,
62
62
  HARNESS_ENV_KEYS,
@@ -54,10 +54,10 @@ import {
54
54
  updateDefaultsSettings,
55
55
  updateIntegrationsSettings,
56
56
  updateOpencodeSettings
57
- } from "./chunk-6LFV4VFI.js";
57
+ } from "./chunk-WSYCND2U.js";
58
58
  import "./chunk-NSTQ6QKD.js";
59
59
  import "./chunk-KGZBYWZ3.js";
60
- import "./chunk-JL4SJ6V7.js";
60
+ import "./chunk-BD2ICC4D.js";
61
61
  export {
62
62
  GITHUB_GIT_AUTH_MODES,
63
63
  HARNESS_ENV_KEYS,
@@ -7,9 +7,9 @@ import {
7
7
  releaseCaffeinateHoldForThread,
8
8
  setCaffeinateHold,
9
9
  setCaffeinateHoldHooks
10
- } from "./chunk-7KDBDMNC.js";
10
+ } from "./chunk-KLBOWJ74.js";
11
11
  import "./chunk-NSTQ6QKD.js";
12
- import "./chunk-JL4SJ6V7.js";
12
+ import "./chunk-BD2ICC4D.js";
13
13
  export {
14
14
  caffeinateHoldPath,
15
15
  getCaffeinateHold,
@@ -5,9 +5,9 @@ import {
5
5
  releaseCaffeinateHoldForThread,
6
6
  setCaffeinateHold,
7
7
  setCaffeinateHoldHooks
8
- } from "./chunk-NZPGMNFC.js";
8
+ } from "./chunk-DCOZABNT.js";
9
9
  import "./chunk-JT7R45JB.js";
10
- import "./chunk-B4R2VB2A.js";
10
+ import "./chunk-QZQEXME2.js";
11
11
  export {
12
12
  caffeinateHoldPath,
13
13
  getCaffeinateHold,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  isGlobalRepoPath
3
- } from "./chunk-GR4JKWR4.js";
3
+ } from "./chunk-HHLZWO7U.js";
4
4
  import {
5
5
  ensureGhPreferOrigin,
6
6
  resolveRepoRoot
7
- } from "./chunk-CIRXAYWS.js";
7
+ } from "./chunk-DHAGMJIK.js";
8
8
  import {
9
9
  appDataDir
10
- } from "./chunk-B4R2VB2A.js";
10
+ } from "./chunk-QZQEXME2.js";
11
11
 
12
12
  // src/store/workspaces.ts
13
13
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  appDataDir
3
- } from "./chunk-B4R2VB2A.js";
3
+ } from "./chunk-QZQEXME2.js";
4
4
  import {
5
5
  run
6
6
  } from "./chunk-LGXBYZZA.js";
@@ -36,7 +36,7 @@ function saveBrightsyConfig(cfg) {
36
36
 
37
37
  // src/brightsy/accounts.ts
38
38
  async function loadConnectedTeams() {
39
- const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-SWHJWK2A.js");
39
+ const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-J4I5AKMR.js");
40
40
  return listConnectedBrightsyTeams2();
41
41
  }
42
42
  async function runBrightsyTeamsJson(args) {
@@ -68,7 +68,7 @@ async function getBrightsySession() {
68
68
  const data = await runBrightsyTeamsJson([]);
69
69
  const accounts = Array.isArray(data.teams) ? data.teams : [];
70
70
  const active = data.active ?? accounts.find((a) => a.active) ?? null;
71
- const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-SWHJWK2A.js");
71
+ const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-J4I5AKMR.js");
72
72
  const connectedTeams = ensureCliTeamTracked2(
73
73
  active ? { id: active.id, slug: active.slug, name: active.name } : void 0
74
74
  );
@@ -108,7 +108,7 @@ async function performBrightsyAccountSwitch(accountIdOrSlug) {
108
108
  return { cfg, target: data.active };
109
109
  }
110
110
  async function switchBrightsyAccount(accountIdOrSlug) {
111
- const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-SWHJWK2A.js");
111
+ const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-J4I5AKMR.js");
112
112
  await connectBrightsyTeam2(accountIdOrSlug);
113
113
  return getBrightsySession();
114
114
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  appDataDir
5
- } from "./chunk-JL4SJ6V7.js";
5
+ } from "./chunk-BD2ICC4D.js";
6
6
  import {
7
7
  run
8
8
  } from "./chunk-3KETJKYA.js";
@@ -359,6 +359,9 @@ function worktreesRoot(repoPath) {
359
359
  function threadFilePath(id) {
360
360
  return join4(threadsDir(), `${id}.json`);
361
361
  }
362
+ function threadLivePath(id) {
363
+ return join4(threadsDir(), `${id}.live.json`);
364
+ }
362
365
  function threadLockPath(id) {
363
366
  return join4(locksDir(), `${id}.lock`);
364
367
  }
@@ -383,6 +386,7 @@ export {
383
386
  repoSlug,
384
387
  worktreesRoot,
385
388
  threadFilePath,
389
+ threadLivePath,
386
390
  threadLockPath,
387
391
  globalAgentCwd
388
392
  };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JT7R45JB.js";
4
4
  import {
5
5
  appDataDir
6
- } from "./chunk-B4R2VB2A.js";
6
+ } from "./chunk-QZQEXME2.js";
7
7
 
8
8
  // src/store/caffeinate-hold.ts
9
9
  import { spawn } from "child_process";
@@ -4,13 +4,13 @@ import {
4
4
  import {
5
5
  getGithubGitAuthMode,
6
6
  getGithubPat
7
- } from "./chunk-FT2SQOL4.js";
7
+ } from "./chunk-XHZJJWLI.js";
8
8
  import {
9
9
  listThreads
10
- } from "./chunk-3WA37BRI.js";
10
+ } from "./chunk-KGSVLZV6.js";
11
11
  import {
12
12
  worktreesRoot
13
- } from "./chunk-B4R2VB2A.js";
13
+ } from "./chunk-QZQEXME2.js";
14
14
  import {
15
15
  gh,
16
16
  git,
@@ -785,7 +785,7 @@ function allocateTeamName(taken, random = Math.random) {
785
785
 
786
786
  // src/git/worktree-labels.ts
787
787
  function normalizeWorktreePath(worktreePath) {
788
- const trimmed = worktreePath.replace(/\/+$/, "") || "/";
788
+ const trimmed = (worktreePath ?? "").replace(/\/+$/, "") || "/";
789
789
  const absolute = trimmed.startsWith("/");
790
790
  const parts = trimmed.split("/").filter((p) => p && p !== ".");
791
791
  const out = [];
@@ -1163,6 +1163,30 @@ function formatGitAuthModeDirective(mode) {
1163
1163
  }
1164
1164
  }
1165
1165
 
1166
+ // src/util/enqueue-by-key.ts
1167
+ var tails = /* @__PURE__ */ new Map();
1168
+ function enqueueByKey(key, fn) {
1169
+ const prev = tails.get(key) ?? Promise.resolve();
1170
+ const next = prev.then(fn, fn);
1171
+ tails.set(
1172
+ key,
1173
+ next.then(
1174
+ () => void 0,
1175
+ () => void 0
1176
+ )
1177
+ );
1178
+ return next;
1179
+ }
1180
+
1181
+ // src/git/repo-git-lock.ts
1182
+ function repoLockKey(repoPath) {
1183
+ const trimmed = repoPath.replace(/\/+$/, "");
1184
+ return `git-worktree:${trimmed || "/"}`;
1185
+ }
1186
+ function withRepoGitLock(repoPath, fn) {
1187
+ return enqueueByKey(repoLockKey(repoPath), fn);
1188
+ }
1189
+
1166
1190
  // src/git/pr-gates.ts
1167
1191
  function prIsInMergeQueue(gate) {
1168
1192
  if (gate.isInMergeQueue) return true;
@@ -2260,12 +2284,13 @@ async function createThreadWorktree(opts) {
2260
2284
  `Invalid git reference: ${opts.sourceRef} (and fetch did not resolve it)`
2261
2285
  );
2262
2286
  }
2263
- const add = await git(
2264
- ["worktree", "add", "-b", branchName, worktreePath, startPoint],
2265
- opts.repoPath,
2266
- { reject: false, timeoutMs: 6e4 }
2267
- );
2268
- if (add.exitCode !== 0) {
2287
+ const added = await withRepoGitLock(opts.repoPath, async () => {
2288
+ const add = await git(
2289
+ ["worktree", "add", "-b", branchName, worktreePath, startPoint],
2290
+ opts.repoPath,
2291
+ { reject: false, timeoutMs: 6e4 }
2292
+ );
2293
+ if (add.exitCode === 0) return branchName;
2269
2294
  const err = `${add.stderr}
2270
2295
  ${add.stdout}`;
2271
2296
  if (/already used by worktree|already exists|checked out/i.test(err)) {
@@ -2276,17 +2301,14 @@ ${add.stdout}`;
2276
2301
  opts.repoPath,
2277
2302
  { reject: false, timeoutMs: 6e4 }
2278
2303
  );
2279
- if (retry.exitCode === 0) {
2280
- branchName = alt;
2281
- await ensureGhPreferOrigin(worktreePath);
2282
- return { branchName, worktreePath };
2283
- }
2304
+ if (retry.exitCode === 0) return alt;
2284
2305
  }
2285
2306
  }
2286
2307
  throw new Error(
2287
2308
  `Failed to create worktree: ${add.stderr.trim() || add.stdout.trim() || `exit ${add.exitCode}`}`
2288
2309
  );
2289
- }
2310
+ });
2311
+ branchName = added;
2290
2312
  await ensureGhPreferOrigin(worktreePath);
2291
2313
  return { branchName, worktreePath };
2292
2314
  }
@@ -2310,12 +2332,13 @@ async function createExistingBranchWorktree(opts) {
2310
2332
  );
2311
2333
  }
2312
2334
  const startPoint = await resolveWorktreeStartPoint(opts.repoPath, branchName);
2313
- const add = await git(
2314
- ["worktree", "add", worktreePath, startPoint],
2315
- opts.repoPath,
2316
- { reject: false }
2317
- );
2318
- if (add.exitCode !== 0) {
2335
+ await withRepoGitLock(opts.repoPath, async () => {
2336
+ const add = await git(
2337
+ ["worktree", "add", worktreePath, startPoint],
2338
+ opts.repoPath,
2339
+ { reject: false }
2340
+ );
2341
+ if (add.exitCode === 0) return;
2319
2342
  const retry = await git(
2320
2343
  ["worktree", "add", worktreePath, branchName],
2321
2344
  opts.repoPath,
@@ -2326,7 +2349,7 @@ async function createExistingBranchWorktree(opts) {
2326
2349
  `Failed to create worktree for ${branchName}: ${retry.stderr.trim() || add.stderr.trim() || retry.stdout.trim() || add.stdout.trim() || `exit ${add.exitCode}`}`
2327
2350
  );
2328
2351
  }
2329
- }
2352
+ });
2330
2353
  const head = await git(["rev-parse", "--abbrev-ref", "HEAD"], worktreePath, {
2331
2354
  reject: false
2332
2355
  });
@@ -2337,12 +2360,14 @@ async function createExistingBranchWorktree(opts) {
2337
2360
  return { branchName, worktreePath };
2338
2361
  }
2339
2362
  async function removeWorktree(repoPath, worktreePath, opts) {
2340
- await git(["worktree", "remove", "--force", worktreePath], repoPath, {
2341
- reject: false
2363
+ await withRepoGitLock(repoPath, async () => {
2364
+ await git(["worktree", "remove", "--force", worktreePath], repoPath, {
2365
+ reject: false
2366
+ });
2367
+ if (opts?.deleteBranch) {
2368
+ await git(["branch", "-D", opts.deleteBranch], repoPath, { reject: false });
2369
+ }
2342
2370
  });
2343
- if (opts?.deleteBranch) {
2344
- await git(["branch", "-D", opts.deleteBranch], repoPath, { reject: false });
2345
- }
2346
2371
  }
2347
2372
  async function listWorktrees(repoPath) {
2348
2373
  const { stdout } = await git(
@@ -2656,6 +2681,8 @@ export {
2656
2681
  codexSandboxWritableRootsArgs,
2657
2682
  codexUnattendedGitConfigArgs,
2658
2683
  formatGitAuthModeDirective,
2684
+ enqueueByKey,
2685
+ withRepoGitLock,
2659
2686
  detectGhStack,
2660
2687
  resetGhStackDetectCache,
2661
2688
  parseGhStackViewJson,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  resolveGithubRepoSlug
3
- } from "./chunk-CIRXAYWS.js";
3
+ } from "./chunk-DHAGMJIK.js";
4
4
  import {
5
5
  resolveThreadDefaults
6
- } from "./chunk-FT2SQOL4.js";
6
+ } from "./chunk-XHZJJWLI.js";
7
7
  import {
8
8
  globalAgentCwd,
9
9
  sideboardReposDir
10
- } from "./chunk-B4R2VB2A.js";
10
+ } from "./chunk-QZQEXME2.js";
11
11
 
12
12
  // src/orchestrator/coordinator-prompt.ts
13
13
  import { mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -34,7 +34,7 @@ function coordinatorGreenfieldPlaybook(reposDir) {
34
34
  "- Examples:",
35
35
  ` - Clone: \`git clone <url> ${reposDir}/<name>\``,
36
36
  ` - New GitHub repo: \`gh repo create <owner>/<name> --private --clone -- ${reposDir}/<name>\` (or mkdir + git init + gh repo create + remote add + push)`,
37
- "- Then: add_workspace with that absolute path \u2192 create_thread (repoPath + parentThreadId) \u2192 send_to_thread (build) \u2192 wait_for_turn \u2192 ask_git create-draft (or send_to_thread `gh pr create --draft -R <origin-owner/name>`).",
37
+ "- Then: add_workspace with that absolute path \u2192 create_thread (repoPath + parentThreadId) \u2192 send_to_thread (build) \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft (or send_to_thread `gh pr create --draft -R <origin-owner/name>`).",
38
38
  "- Always target the child worktree's **origin** (`github:` slug from list_workspaces / `git remote get-url origin` in that worktree). Never open PRs against `upstream`.",
39
39
  "- Do coding work in the child worktree thread, not by editing files in this home cwd."
40
40
  ].join("\n");
@@ -60,7 +60,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
60
60
  "- fork_worktree \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
61
61
  "- fork_chat \u2014 fork a worktree chat (same worktree tab) OR a Global orchestration chat (new orchestration tab); optional agent; leave model unset (Auto) unless you have a reason. Remote coordinators: use this to continue another orchestration chat on a different agent after session limits.",
62
62
  "- send_to_thread \u2014 queue a prompt (start/continue a chat turn); pass force_stop: true to interrupt mid-turn / clear stale queued prompts before replacing with a new request",
63
- "- wait_for_turn / get_turn_result \u2014 wait for and read the agent reply. On status error, lastError (and text) is the failure \u2014 switch agent, tell the user, or retry; do not treat empty text as success.",
63
+ "- wait_for_turn / get_turn_result \u2014 wait for and read the agent reply. wait_for_turn returns within ~45s even if the child is still working (MCP clients kill longer tool calls). If stillRunning is true, progress is a live snapshot of tools/thinking \u2014 call wait_for_turn again. Do not send \u201Care you stuck?\u201D or assume a hang while lastActivityAt is recent. On status error, lastError (and text) is the failure \u2014 switch agent, tell the user, or retry; do not treat empty text as success.",
64
64
  "- stop_thread \u2014 force-stop: kill in-flight turn AND clear queued prompts (do not leave stale queue after an interrupt)",
65
65
  "- archive_thread / restore_thread \u2014 archive (tears down worktree when last tab) or restore",
66
66
  "Setup / run:",
@@ -68,8 +68,8 @@ var COORDINATOR_TOOL_PLAYBOOK = [
68
68
  "- list_run_scripts / run_dev_script / stop_dev_script \u2014 start/stop named run scripts",
69
69
  "Inspect / review / PRs:",
70
70
  "- get_diff \u2014 compact diff summary",
71
- '- request_review \u2014 open a Review chat tab on a worktree thread (attaches .sideboard/review.md when present, else local guidelines; sends "Review changes in this workspace."); then wait_for_turn / get_turn_result on the returned id',
72
- "- ask_git \u2014 commit & push, open a draft PR, resolve conflicts, or merge. When the worktree is clean, Sideboard pushes / opens the PR itself. When dirty, it queues the worktree agent \u2014 then wait_for_turn. Prefer this over paraphrasing.",
71
+ '- request_review \u2014 open a Review chat tab on a worktree thread (attaches .sideboard/review.md when present, else local guidelines; sends "Review changes in this workspace."); then wait_for_turn (loop while stillRunning) / get_turn_result on the returned id',
72
+ "- ask_git \u2014 commit & push, open a draft PR, resolve conflicts, or merge. When the worktree is clean, Sideboard pushes / opens the PR itself. When dirty, it queues the worktree agent \u2014 then wait_for_turn (loop while stillRunning). Prefer this over paraphrasing.",
73
73
  '- Merge (`ask_git` action=merge / send_to_thread "Merge PR.") only when the user explicitly asked to merge that PR. Do not merge because the work looks done, CI is green, or a typical flow includes it.',
74
74
  '- Or send_to_thread with those exact phrases: "Commit and push.", "Commit, push, and open a draft PR.", "Merge the remote branch (main) into your branch and resolve conflicts. Then, commit and push your changes.", "Merge PR." (draft PRs: `gh pr create --draft -R <origin-owner/name>` using the workspace `github:` slug \u2014 never upstream). Never run git/gh from this orchestration cwd, and never merge the PR yourself.',
75
75
  "Process guides:",
@@ -105,8 +105,8 @@ function coordinatorTurnReminder(opts) {
105
105
  goal ? `- Goal / title: ${goal}` : null,
106
106
  accountDefaultsPlaybookLine(),
107
107
  `- For "what's going on": call list_threads (and list_workspaces if needed). Summarize fleet status \u2014 do not ls/git-status this synthetic home.`,
108
- "- Existing repo: create_thread on a repoPath \u2192 send_to_thread \u2192 wait_for_turn. If status is error, lastError/text is the failure \u2014 adapt (switch agent, tell the user). Commit/push/draft PR with ask_git on the child, then wait_for_turn \u2014 never git/gh from this cwd. Call ask_git merge only if the user explicitly asked to merge.",
109
- "- New repo: Bash (clone or gh repo create under ~/sideboard/repos/<name>) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 ask_git create-draft.",
108
+ "- Existing repo: create_thread on a repoPath \u2192 send_to_thread \u2192 wait_for_turn. If stillRunning, the child is working (progress is tools/thinking) \u2014 wait_for_turn again; do not ping it. If status is error, lastError/text is the failure \u2014 adapt (switch agent, tell the user). Commit/push/draft PR with ask_git on the child, then wait_for_turn \u2014 never git/gh from this cwd. Call ask_git merge only if the user explicitly asked to merge.",
109
+ "- New repo: Bash (clone or gh repo create under ~/sideboard/repos/<name>) \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
110
110
  "- When naming threads for the user, link them as `[Title](sideboard://thread/<id>)`.",
111
111
  "- If they will wait on Slack or leave the Mac, call set_caffeinate enabled=true. When they say they are done / wrapping up / going to sleep, call set_caffeinate enabled=false. Closing this chat also turns it off."
112
112
  ].filter(Boolean).join("\n");
@@ -159,8 +159,8 @@ function ensureGlobalCoordinatorCwd(opts) {
159
159
  orchId ? `Pass parentThreadId="${orchId}" (or omit it). Never invent another parentThreadId.` : "Pass `parentThreadId` for children (this chat's id from the turn reminder).",
160
160
  "Omit `agent` / `model` on `create_thread` unless you have a reason to override Account defaults.",
161
161
  "Never pass `agent=codex` when you yourself are Codex \u2014 nested Codex deadlocks on shared ~/.codex locks. Omit agent (Account default) or use cursor/claude.",
162
- "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn \u2192 ask_git create-draft \u2192 wait_for_turn. Merge only if the user explicitly asked (`ask_git` merge).",
163
- "Typical flow (new app): Bash create/clone under repos dir \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn \u2192 ask_git create-draft.",
162
+ "Typical flow (existing): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft \u2192 wait_for_turn. Merge only if the user explicitly asked (`ask_git` merge).",
163
+ "Typical flow (new app): Bash create/clone under repos dir \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
164
164
  "Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_thread`). Tell them to merge only when the user explicitly asked. The worktree agent runs git/gh; never merge from this orchestration cwd."
165
165
  ].join("\n");
166
166
  try {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  isOrchestratorThread
3
- } from "./chunk-GR4JKWR4.js";
3
+ } from "./chunk-HHLZWO7U.js";
4
4
  import {
5
5
  applyConnectedTeamToCli,
6
6
  brightsyMcpServerName,
7
7
  ensureCliTeamTracked,
8
8
  ensureConnectedBrightsyTeamTokens,
9
9
  loadBrightsyConfig
10
- } from "./chunk-QSLE4VEM.js";
10
+ } from "./chunk-2GO3YKBA.js";
11
11
  import {
12
12
  applyNodeLaunch,
13
13
  cursorRipgrepEnv,
@@ -25,20 +25,20 @@ import {
25
25
  mergeAgentGitAuthEnv,
26
26
  resolveAgentGitAuthEnv,
27
27
  resolveCodexGitWritableRoots
28
- } from "./chunk-CIRXAYWS.js";
28
+ } from "./chunk-DHAGMJIK.js";
29
29
  import {
30
30
  claudeChromeEnabled,
31
31
  loadAppSettings,
32
32
  resolveAgentExecutable,
33
33
  resolveClaudeExecutable
34
- } from "./chunk-FT2SQOL4.js";
34
+ } from "./chunk-XHZJJWLI.js";
35
35
  import {
36
36
  isElectronLikeCommand,
37
37
  unwrapStrippedElectronLaunch
38
38
  } from "./chunk-TLPJHLLM.js";
39
39
  import {
40
40
  appDataDir
41
- } from "./chunk-B4R2VB2A.js";
41
+ } from "./chunk-QZQEXME2.js";
42
42
  import {
43
43
  enrichPathWithNpmGlobalBin,
44
44
  isConductorBundledCli,
@@ -1019,7 +1019,7 @@ var claudeAdapter = {
1019
1019
  );
1020
1020
  }
1021
1021
  const mode = permissionMode(thread);
1022
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-KYEBFWKB.js");
1022
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-UR4E3CCG.js");
1023
1023
  const isOrchestrator = isOrchestratorThread2(thread);
1024
1024
  const injectedServers = await buildInjectedMcpServers({
1025
1025
  includeSideboard: true,
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  ensureGlobalCoordinatorCwd
3
- } from "./chunk-HYKZEP5A.js";
3
+ } from "./chunk-ETMRBJKA.js";
4
4
  import {
5
5
  allocateTeamName,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-CIRXAYWS.js";
8
+ } from "./chunk-DHAGMJIK.js";
9
9
  import {
10
10
  resolveNewThreadOptions,
11
11
  resolveThreadDefaults
12
- } from "./chunk-FT2SQOL4.js";
12
+ } from "./chunk-XHZJJWLI.js";
13
13
  import {
14
14
  createEmptyThread,
15
15
  listThreads,
16
16
  updateThread,
17
17
  writeThread
18
- } from "./chunk-3WA37BRI.js";
18
+ } from "./chunk-KGSVLZV6.js";
19
19
  import {
20
20
  globalAgentCwd
21
- } from "./chunk-B4R2VB2A.js";
21
+ } from "./chunk-QZQEXME2.js";
22
22
 
23
23
  // src/brightsy/cloud-connect-constants.ts
24
24
  var CLOUD_ORCHESTRATOR_GOAL = "Cloud-connected Sideboard orchestrator";
@@ -5,7 +5,7 @@ import {
5
5
  threadFilePath,
6
6
  threadLockPath,
7
7
  threadsDir
8
- } from "./chunk-B4R2VB2A.js";
8
+ } from "./chunk-QZQEXME2.js";
9
9
 
10
10
  // src/store/thread-store.ts
11
11
  import { randomUUID } from "crypto";
@@ -117,8 +117,11 @@ function writeThread(thread) {
117
117
  function idPath(id) {
118
118
  return id;
119
119
  }
120
+ function isThreadRecordFile(name) {
121
+ return name.endsWith(".json") && !name.endsWith(".live.json");
122
+ }
120
123
  function listThreads(opts) {
121
- const files = readdirSync(threadsDir()).filter((f) => f.endsWith(".json"));
124
+ const files = readdirSync(threadsDir()).filter(isThreadRecordFile);
122
125
  const threads = files.map((f) => {
123
126
  try {
124
127
  return normalizeThread(
@@ -127,7 +130,9 @@ function listThreads(opts) {
127
130
  } catch {
128
131
  return null;
129
132
  }
130
- }).filter((t) => t !== null).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
133
+ }).filter(
134
+ (t) => t !== null && typeof t.id === "string" && t.id.length > 0
135
+ ).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
131
136
  if (opts?.includeArchived) return threads;
132
137
  return threads.filter((t) => t.status !== "archived");
133
138
  }
@@ -159,7 +164,9 @@ function setStatus(id, status, lastError) {
159
164
  }
160
165
  function findThreadByRef(ref) {
161
166
  const all = listThreads({ includeArchived: true });
162
- return all.find((t) => t.id === ref || t.id.startsWith(ref) || t.branchName === ref || t.title === ref) ?? null;
167
+ return all.find(
168
+ (t) => t.id === ref || t.id.startsWith(ref) || t.branchName === ref || t.title === ref
169
+ ) ?? null;
163
170
  }
164
171
 
165
172
  export {
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-NSTQ6QKD.js";
6
6
  import {
7
7
  appDataDir
8
- } from "./chunk-JL4SJ6V7.js";
8
+ } from "./chunk-BD2ICC4D.js";
9
9
 
10
10
  // src/store/caffeinate-hold.ts
11
11
  import { spawn } from "child_process";
@@ -6,16 +6,16 @@ import {
6
6
  ensureCliTeamTracked,
7
7
  ensureConnectedBrightsyTeamTokens,
8
8
  loadBrightsyConfig
9
- } from "./chunk-DKHGWYWR.js";
9
+ } from "./chunk-7YKXHBIW.js";
10
10
  import {
11
11
  isOrchestratorThread
12
- } from "./chunk-WQTTUC4N.js";
12
+ } from "./chunk-OW34MVDN.js";
13
13
  import {
14
14
  codexUnattendedGitConfigArgs,
15
15
  mergeAgentGitAuthEnv,
16
16
  resolveAgentGitAuthEnv,
17
17
  resolveCodexGitWritableRoots
18
- } from "./chunk-R7BQBSDT.js";
18
+ } from "./chunk-WA3DVVWG.js";
19
19
  import {
20
20
  claudeChromeEnabled,
21
21
  isElectronLikeCommand,
@@ -24,10 +24,10 @@ import {
24
24
  resolveClaudeExecutable,
25
25
  unwrapStrippedElectronLaunch,
26
26
  wrapElectronAsNodeLaunch
27
- } from "./chunk-6LFV4VFI.js";
27
+ } from "./chunk-WSYCND2U.js";
28
28
  import {
29
29
  appDataDir
30
- } from "./chunk-JL4SJ6V7.js";
30
+ } from "./chunk-BD2ICC4D.js";
31
31
  import {
32
32
  enrichPathWithNpmGlobalBin,
33
33
  isConductorBundledCli,
@@ -1357,7 +1357,7 @@ var claudeAdapter = {
1357
1357
  );
1358
1358
  }
1359
1359
  const mode = permissionMode(thread);
1360
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-YZWYHLQY.js");
1360
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-KJQS5S2C.js");
1361
1361
  const isOrchestrator = isOrchestratorThread2(thread);
1362
1362
  const injectedServers = await buildInjectedMcpServers({
1363
1363
  includeSideboard: true,
@@ -2,14 +2,14 @@
2
2
 
3
3
  import {
4
4
  isGlobalRepoPath
5
- } from "./chunk-WQTTUC4N.js";
5
+ } from "./chunk-OW34MVDN.js";
6
6
  import {
7
7
  ensureGhPreferOrigin,
8
8
  resolveRepoRoot
9
- } from "./chunk-R7BQBSDT.js";
9
+ } from "./chunk-WA3DVVWG.js";
10
10
  import {
11
11
  appDataDir
12
- } from "./chunk-JL4SJ6V7.js";
12
+ } from "./chunk-BD2ICC4D.js";
13
13
 
14
14
  // src/store/workspaces.ts
15
15
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";