@sideboard-ai/core 0.1.100 → 0.1.107

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/agents/cursor-runner.js +1 -1
  2. package/dist/{agents-OXZDMPSE.js → agents-4XQANGFO.js} +8 -8
  3. package/dist/{agents-CLP5BG4O.js → agents-T4RHL5UX.js} +8 -8
  4. package/dist/{app-settings-ZXPAB3QN.js → app-settings-2WH6DVOW.js} +4 -2
  5. package/dist/{app-settings-BRF7VKTQ.js → app-settings-6AXBWM3K.js} +4 -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-QSLE4VEM.js → chunk-2GO3YKBA.js} +4 -4
  9. package/dist/chunk-3SIFRHJ3.js +7309 -0
  10. package/dist/{chunk-IFHKPZHA.js → chunk-5XUKY2JY.js} +14 -13
  11. package/dist/{chunk-OXC3MEFI.js → chunk-6HRR4T4P.js} +8 -8
  12. package/dist/{chunk-R7BQBSDT.js → chunk-6JJTMI7G.js} +55 -28
  13. package/dist/{chunk-DKHGWYWR.js → chunk-7YKXHBIW.js} +1 -1
  14. package/dist/{chunk-FT2SQOL4.js → chunk-7ZTQHC2Q.js} +11 -1
  15. package/dist/{chunk-JL4SJ6V7.js → chunk-BD2ICC4D.js} +4 -0
  16. package/dist/{chunk-NZPGMNFC.js → chunk-DCOZABNT.js} +1 -1
  17. package/dist/{chunk-6LFV4VFI.js → chunk-EX4NZN3O.js} +11 -1
  18. package/dist/{chunk-HYKZEP5A.js → chunk-GYFNFU62.js} +14 -13
  19. package/dist/{chunk-3WA37BRI.js → chunk-KGSVLZV6.js} +11 -4
  20. package/dist/{chunk-7KDBDMNC.js → chunk-KLBOWJ74.js} +1 -1
  21. package/dist/{chunk-MRBKGFTL.js → chunk-LRO7YVLJ.js} +3 -3
  22. package/dist/{chunk-JOF3XIEM.js → chunk-P3BQ5DOL.js} +11 -4
  23. package/dist/{chunk-CIRXAYWS.js → chunk-PZVA2VDF.js} +55 -28
  24. package/dist/{chunk-B4R2VB2A.js → chunk-QZQEXME2.js} +4 -0
  25. package/dist/{chunk-GR4JKWR4.js → chunk-SMWVSSE5.js} +9 -9
  26. package/dist/{chunk-WQTTUC4N.js → chunk-THXSFETX.js} +5 -5
  27. package/dist/{chunk-MHJV4WS3.js → chunk-VTTTV2LM.js} +3 -3
  28. package/dist/chunk-XEFHG6VG.js +6946 -0
  29. package/dist/{chunk-EQPQTLW6.js → chunk-XOYH3OMI.js} +6 -6
  30. package/dist/{connected-teams-SWHJWK2A.js → connected-teams-J4I5AKMR.js} +2 -2
  31. package/dist/{connected-teams-TLVKZPJP.js → connected-teams-M5XNXRI5.js} +2 -2
  32. package/dist/{coordinator-prompt-HHRKQWCX.js → coordinator-prompt-4TUQUEHY.js} +5 -5
  33. package/dist/{coordinator-prompt-OOBSQCWQ.js → coordinator-prompt-YQWRXCPX.js} +5 -5
  34. package/dist/{cursor-recover-S5ORPW34.js → cursor-recover-JBTIDARH.js} +1 -1
  35. package/dist/{cursor-recover-G34BYKL2.js → cursor-recover-ZUJG6XRQ.js} +1 -1
  36. package/dist/{global-workspace-YZWYHLQY.js → global-workspace-H37LFFXI.js} +6 -6
  37. package/dist/{global-workspace-KYEBFWKB.js → global-workspace-V6TMECDU.js} +6 -6
  38. package/dist/index.cjs +12180 -10835
  39. package/dist/index.d.cts +134 -16
  40. package/dist/index.d.ts +134 -16
  41. package/dist/index.js +899 -6769
  42. package/dist/mcp/run-stdio.cjs +7658 -6525
  43. package/dist/mcp/run-stdio.js +373 -6479
  44. package/dist/orchestrator-2P7DX44Q.js +31 -0
  45. package/dist/orchestrator-DEHSKERK.js +32 -0
  46. package/dist/{paths-TZX4L5X7.js → paths-QCI3MTO5.js} +3 -1
  47. package/dist/{paths-JQM2XRAD.js → paths-UMEDHOS5.js} +3 -1
  48. package/dist/{thread-store-XAKWCV2E.js → thread-store-4OUEQ2DB.js} +2 -2
  49. package/dist/{thread-store-V7NOOXKE.js → thread-store-DQJGDKIJ.js} +2 -2
  50. package/dist/{workspaces-ENVUDK6C.js → workspaces-JU3P6FHB.js} +7 -7
  51. package/dist/{workspaces-NNPD7QVV.js → workspaces-UPEVANU4.js} +7 -7
  52. package/dist/{worktree-EO5QAGJU.js → worktree-6MFKE465.js} +4 -4
  53. package/dist/{worktree-DA4BOV7G.js → worktree-NR5YJG2E.js} +4 -4
  54. package/package.json +2 -1
@@ -4,13 +4,13 @@ import {
4
4
  import {
5
5
  getGithubGitAuthMode,
6
6
  getGithubPat
7
- } from "./chunk-FT2SQOL4.js";
7
+ } from "./chunk-7ZTQHC2Q.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,
@@ -400,6 +400,9 @@ function worktreesRoot(repoPath) {
400
400
  function threadFilePath(id) {
401
401
  return join4(threadsDir(), `${id}.json`);
402
402
  }
403
+ function threadLivePath(id) {
404
+ return join4(threadsDir(), `${id}.live.json`);
405
+ }
403
406
  function threadLockPath(id) {
404
407
  return join4(locksDir(), `${id}.lock`);
405
408
  }
@@ -433,6 +436,7 @@ export {
433
436
  repoSlug,
434
437
  worktreesRoot,
435
438
  threadFilePath,
439
+ threadLivePath,
436
440
  threadLockPath,
437
441
  globalAgentCwd
438
442
  };
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  ensureGlobalCoordinatorCwd
3
- } from "./chunk-HYKZEP5A.js";
3
+ } from "./chunk-GYFNFU62.js";
4
4
  import {
5
5
  allocateTeamName,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-CIRXAYWS.js";
8
+ } from "./chunk-PZVA2VDF.js";
9
9
  import {
10
10
  resolveNewThreadOptions,
11
11
  resolveThreadDefaults
12
- } from "./chunk-FT2SQOL4.js";
12
+ } from "./chunk-7ZTQHC2Q.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";
@@ -282,16 +282,16 @@ function ensureCloudCoordinator(agent) {
282
282
  }
283
283
 
284
284
  export {
285
+ ORCHESTRATOR_AGENT_KINDS,
286
+ isOrchestratorCapableAgent,
287
+ assertOrchestratorCapableAgent,
288
+ coerceOrchestratorAgent,
285
289
  CLOUD_ORCHESTRATOR_GOAL,
286
290
  SIDEBOARD_FORCE_STOP,
287
291
  CLOUD_COORDINATOR_BUSY_REPLY,
288
292
  CLOUD_COORDINATOR_STOPPED_REPLY,
289
293
  CLOUD_COORDINATOR_TIMEOUT_REPLY,
290
294
  parseForceStopMessage,
291
- ORCHESTRATOR_AGENT_KINDS,
292
- isOrchestratorCapableAgent,
293
- assertOrchestratorCapableAgent,
294
- coerceOrchestratorAgent,
295
295
  GLOBAL_WORKSPACE_ID,
296
296
  isGlobalThread,
297
297
  isGlobalRepoPath,
@@ -2,25 +2,25 @@
2
2
 
3
3
  import {
4
4
  ensureGlobalCoordinatorCwd
5
- } from "./chunk-IFHKPZHA.js";
5
+ } from "./chunk-5XUKY2JY.js";
6
6
  import {
7
7
  allocateTeamName,
8
8
  takenSlugsFromThread,
9
9
  teamSlugFromName
10
- } from "./chunk-R7BQBSDT.js";
10
+ } from "./chunk-6JJTMI7G.js";
11
11
  import {
12
12
  createEmptyThread,
13
13
  listThreads,
14
14
  updateThread,
15
15
  writeThread
16
- } from "./chunk-JOF3XIEM.js";
16
+ } from "./chunk-P3BQ5DOL.js";
17
17
  import {
18
18
  resolveNewThreadOptions,
19
19
  resolveThreadDefaults
20
- } from "./chunk-6LFV4VFI.js";
20
+ } from "./chunk-EX4NZN3O.js";
21
21
  import {
22
22
  globalAgentCwd
23
- } from "./chunk-JL4SJ6V7.js";
23
+ } from "./chunk-BD2ICC4D.js";
24
24
 
25
25
  // src/brightsy/cloud-connect-constants.ts
26
26
  var CLOUD_ORCHESTRATOR_GOAL = "Cloud-connected Sideboard orchestrator";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  isGlobalRepoPath
3
- } from "./chunk-GR4JKWR4.js";
3
+ } from "./chunk-SMWVSSE5.js";
4
4
  import {
5
5
  ensureGhPreferOrigin,
6
6
  resolveRepoRoot
7
- } from "./chunk-CIRXAYWS.js";
7
+ } from "./chunk-PZVA2VDF.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";