@sideboard-ai/core 0.1.250 → 0.1.252

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 (27) hide show
  1. package/dist/{agents-7IIUQLCC.js → agents-B66CNEPB.js} +3 -3
  2. package/dist/{agents-72QLUO4L.js → agents-C7T4US6D.js} +3 -3
  3. package/dist/{chunk-IJIMEK2K.js → chunk-4DGYMF7H.js} +24 -13
  4. package/dist/{chunk-W4BGLHA3.js → chunk-6IP4FWMK.js} +1 -1
  5. package/dist/{chunk-RLJHH6T7.js → chunk-AQQWP2TL.js} +23 -11
  6. package/dist/{chunk-DMT62X6L.js → chunk-BHPGORIY.js} +25 -13
  7. package/dist/{chunk-EV4QJNR7.js → chunk-FKGVQKRX.js} +25 -12
  8. package/dist/{chunk-566W54AN.js → chunk-NYXDZCMP.js} +50 -14
  9. package/dist/{chunk-WSOFNJPD.js → chunk-PV4KCI2S.js} +50 -14
  10. package/dist/{chunk-SJPK5Y5U.js → chunk-SJ3IUYG2.js} +1 -1
  11. package/dist/{coordinator-prompt-Q53MIP2G.js → coordinator-prompt-A2JJ5X7B.js} +2 -2
  12. package/dist/{coordinator-prompt-ON5YI463.js → coordinator-prompt-BX2R5EMW.js} +2 -2
  13. package/dist/{global-workspace-MTBVW6GW.js → global-workspace-JJRPZNTY.js} +2 -2
  14. package/dist/{global-workspace-VWF5AOYN.js → global-workspace-PUJEGSOB.js} +2 -2
  15. package/dist/index.cjs +88 -26
  16. package/dist/index.d.cts +25 -1
  17. package/dist/index.d.ts +25 -1
  18. package/dist/index.js +7 -5
  19. package/dist/mcp/run-stdio.cjs +85 -26
  20. package/dist/mcp/run-stdio.js +5 -5
  21. package/dist/{orchestrator-NKG4R6TX.js → orchestrator-O3TVI7SN.js} +4 -4
  22. package/dist/{orchestrator-HEFTR7RA.js → orchestrator-O3V4UH73.js} +4 -4
  23. package/dist/{workspaces-QWGSPLMF.js → workspaces-FUOZIR3V.js} +2 -2
  24. package/dist/{workspaces-24YJWKJQ.js → workspaces-V3PZRTY5.js} +2 -2
  25. package/dist/{worktree-RYZOFNY7.js → worktree-4DNK2CK6.js} +1 -1
  26. package/dist/{worktree-VED7K2UL.js → worktree-UK62JCYF.js} +1 -1
  27. package/package.json +1 -1
@@ -46,9 +46,9 @@ import {
46
46
  resolveLoginCommand,
47
47
  resolveQuotaFallbackAgent,
48
48
  whichOnPath
49
- } from "./chunk-DMT62X6L.js";
50
- import "./chunk-SJPK5Y5U.js";
51
- import "./chunk-566W54AN.js";
49
+ } from "./chunk-BHPGORIY.js";
50
+ import "./chunk-SJ3IUYG2.js";
51
+ import "./chunk-NYXDZCMP.js";
52
52
  import "./chunk-6K64FJDD.js";
53
53
  import "./chunk-2P4XKWV2.js";
54
54
  import "./chunk-5F4YFGHL.js";
@@ -55,12 +55,12 @@ import {
55
55
  resolveQuotaFallbackAgent,
56
56
  turnCostUsdFromCursorUsage,
57
57
  whichOnPath
58
- } from "./chunk-IJIMEK2K.js";
59
- import "./chunk-W4BGLHA3.js";
58
+ } from "./chunk-4DGYMF7H.js";
59
+ import "./chunk-6IP4FWMK.js";
60
60
  import "./chunk-XAISOBBG.js";
61
61
  import "./chunk-P2BSMNHB.js";
62
62
  import "./chunk-VKQGAWHY.js";
63
- import "./chunk-WSOFNJPD.js";
63
+ import "./chunk-PV4KCI2S.js";
64
64
  import "./chunk-D6JWYJ4P.js";
65
65
  import "./chunk-RJC2MKXN.js";
66
66
  import "./chunk-H547WSSZ.js";
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  isOrchestratorThread
5
- } from "./chunk-W4BGLHA3.js";
5
+ } from "./chunk-6IP4FWMK.js";
6
6
  import {
7
7
  applyConnectedTeamToCli,
8
8
  brightsyMcpServerName,
@@ -20,7 +20,7 @@ import {
20
20
  mergeAgentGitAuthEnv,
21
21
  resolveAgentGitAuthEnv,
22
22
  resolveCodexGitWritableRoots
23
- } from "./chunk-WSOFNJPD.js";
23
+ } from "./chunk-PV4KCI2S.js";
24
24
  import {
25
25
  enrichPathWithNpmGlobalBin,
26
26
  isConductorBundledCli,
@@ -1744,6 +1744,15 @@ function isContextCompactInProgress(text) {
1744
1744
  if (isContextCompactDone(t)) return false;
1745
1745
  return /^Compressing context/i.test(t);
1746
1746
  }
1747
+ function isSystemStatusThinking(event) {
1748
+ if (event.replace) return true;
1749
+ const t = (event.data ?? "").trim();
1750
+ if (!t) return true;
1751
+ if (/^API retry\b/i.test(t)) return true;
1752
+ if (/^MCP:/i.test(t)) return true;
1753
+ if (isContextCompactInProgress(t) || isContextCompactDone(t)) return true;
1754
+ return false;
1755
+ }
1747
1756
  function looksLikeConversationSummary(text) {
1748
1757
  const t = text.trim();
1749
1758
  if (t.length < 80) return false;
@@ -2198,15 +2207,6 @@ function applyAgentEvent(parts, event) {
2198
2207
  );
2199
2208
  return next2;
2200
2209
  }
2201
- if (contextCompactInProgress(parts, event.parentId)) {
2202
- return [
2203
- ...parts,
2204
- compactToolPart(data, `compact-${parts.length}`, {
2205
- parentId: event.parentId,
2206
- status: "running"
2207
- })
2208
- ];
2209
- }
2210
2210
  const runningSkillIdx = lastRunningSkillIndex(parts, event.parentId);
2211
2211
  if (runningSkillIdx >= 0) {
2212
2212
  const prev = parts[runningSkillIdx];
@@ -2225,6 +2225,15 @@ function applyAgentEvent(parts, event) {
2225
2225
  );
2226
2226
  return next2;
2227
2227
  }
2228
+ if (contextCompactInProgress(parts, event.parentId)) {
2229
+ return [
2230
+ ...parts,
2231
+ compactToolPart(data, `compact-${parts.length}`, {
2232
+ parentId: event.parentId,
2233
+ status: "running"
2234
+ })
2235
+ ];
2236
+ }
2228
2237
  const next = [...parts];
2229
2238
  const last = next[next.length - 1];
2230
2239
  if (last?.type === "text" && sameParentId(last.parentId, event.parentId)) {
@@ -2261,7 +2270,9 @@ function applyAgentEvent(parts, event) {
2261
2270
  if (event.type === "thinking") {
2262
2271
  const data = event.data;
2263
2272
  if (!data) return parts;
2264
- parts = markRunningSkillsDone(parts, event.parentId);
2273
+ if (!isSystemStatusThinking(event)) {
2274
+ parts = markRunningSkillsDone(parts, event.parentId);
2275
+ }
2265
2276
  const next = [...parts];
2266
2277
  if (event.replace) {
2267
2278
  for (let i = next.length - 1; i >= 0; i--) {
@@ -2947,7 +2958,7 @@ var claudeAdapter = {
2947
2958
  );
2948
2959
  }
2949
2960
  const mode = permissionMode(thread);
2950
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-MTBVW6GW.js");
2961
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-JJRPZNTY.js");
2951
2962
  const isOrchestrator = isOrchestratorThread2(thread);
2952
2963
  const injectedServers = await buildInjectedMcpServers({
2953
2964
  includeSideboard: true,
@@ -8,7 +8,7 @@ import {
8
8
  resolveRepoRoot,
9
9
  takenSlugsFromThread,
10
10
  teamSlugFromName
11
- } from "./chunk-WSOFNJPD.js";
11
+ } from "./chunk-PV4KCI2S.js";
12
12
  import {
13
13
  ATTACHMENTS_DIR,
14
14
  attachmentsGitignoreBody
@@ -44,7 +44,7 @@ import {
44
44
  summarizeTurnStderr,
45
45
  toolDescription,
46
46
  turnFailChatText
47
- } from "./chunk-IJIMEK2K.js";
47
+ } from "./chunk-4DGYMF7H.js";
48
48
  import {
49
49
  SLACK_REPLY_FORMATTING,
50
50
  addWorkspace,
@@ -67,7 +67,7 @@ import {
67
67
  stageAbsolutePathsAsAttachments,
68
68
  stageBuffersAsAttachments,
69
69
  syncWorkspacesFromThreads
70
- } from "./chunk-W4BGLHA3.js";
70
+ } from "./chunk-6IP4FWMK.js";
71
71
  import {
72
72
  addPrStackLayer,
73
73
  allocateTeamName,
@@ -117,7 +117,7 @@ import {
117
117
  worktreeDisplayLabelForGroup,
118
118
  worktreeNameFromPath,
119
119
  worktreeSlugForTicket
120
- } from "./chunk-WSOFNJPD.js";
120
+ } from "./chunk-PV4KCI2S.js";
121
121
  import {
122
122
  ATTACHMENTS_DIR,
123
123
  DETACHED_JOBS_DIR,
@@ -491,9 +491,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
491
491
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
492
492
  );
493
493
  }
494
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-MTBVW6GW.js");
494
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-JJRPZNTY.js");
495
495
  if (isGlobalThread2(thread)) {
496
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-Q53MIP2G.js");
496
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-A2JJ5X7B.js");
497
497
  ensureGlobalCoordinatorCwd2(
498
498
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
499
499
  );
@@ -4050,6 +4050,7 @@ async function createThread(input, _onSetupLine) {
4050
4050
  let prTitle = null;
4051
4051
  let prAuthorLogin2 = null;
4052
4052
  let prLabels = [];
4053
+ let prIsDraft = false;
4053
4054
  if (sourceType === "pr") {
4054
4055
  const num = Number(input.sourceRef.replace(/^#/, ""));
4055
4056
  if (!Number.isFinite(num)) throw new Error(`Invalid PR number: ${input.sourceRef}`);
@@ -4067,6 +4068,7 @@ async function createThread(input, _onSetupLine) {
4067
4068
  prUrl = pr.url;
4068
4069
  prAuthorLogin2 = pr.author?.login?.trim() || null;
4069
4070
  prLabels = pr.labels ?? [];
4071
+ prIsDraft = Boolean(pr.isDraft);
4070
4072
  const localFetchBranch = `sideboard-pr-${pr.number}`;
4071
4073
  await fetchPrHead(repoPath, pr.number, localFetchBranch);
4072
4074
  sourceRef = localFetchBranch;
@@ -4091,6 +4093,7 @@ async function createThread(input, _onSetupLine) {
4091
4093
  prTitle = existing.title;
4092
4094
  prAuthorLogin2 = existing.author?.login?.trim() || null;
4093
4095
  prLabels = existing.labels ?? [];
4096
+ prIsDraft = Boolean(existing.isDraft);
4094
4097
  }
4095
4098
  }
4096
4099
  }
@@ -4127,7 +4130,8 @@ async function createThread(input, _onSetupLine) {
4127
4130
  prUrl,
4128
4131
  prTitle,
4129
4132
  prAuthorLogin: prAuthorLogin2,
4130
- prLabels
4133
+ prLabels,
4134
+ prIsDraft
4131
4135
  });
4132
4136
  writeThread(thread);
4133
4137
  await ensureWorkspace(repoPath);
@@ -4595,7 +4599,7 @@ async function adoptThread(input) {
4595
4599
  messages: input.messages ?? []
4596
4600
  });
4597
4601
  writeThread(thread);
4598
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-24YJWKJQ.js");
4602
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-V3PZRTY5.js");
4599
4603
  await ensureWorkspace2(repoPath);
4600
4604
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-5N2KTYIT.js");
4601
4605
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -7101,7 +7105,7 @@ function formatScheduledPrompt(name, prompt) {
7101
7105
  ${prompt}`;
7102
7106
  }
7103
7107
  async function defaultDeps() {
7104
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-NKG4R6TX.js");
7108
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-O3TVI7SN.js");
7105
7109
  const orch = getOrchestrator2();
7106
7110
  return {
7107
7111
  findThread: (id) => findThreadByRef(id),
@@ -9298,6 +9302,14 @@ var Orchestrator = class {
9298
9302
  const thread = this.requireThread(threadRef);
9299
9303
  return discoverSkills(thread.worktreePath);
9300
9304
  }
9305
+ /** Skills for a project folder before a worktree exists (create modal). */
9306
+ listSkillsForRepo(repoPath) {
9307
+ const root = repoPath.trim();
9308
+ if (!root || root === "/" || root === ".") {
9309
+ return discoverSkills("/__sideboard_no_workspace__");
9310
+ }
9311
+ return discoverSkills(root);
9312
+ }
9301
9313
  async previewLand(threadRef) {
9302
9314
  const thread = this.requireThread(threadRef);
9303
9315
  this.assertNotGlobal(thread, "Land");
@@ -9726,7 +9738,7 @@ var Orchestrator = class {
9726
9738
  this.enforceHistoryRetention();
9727
9739
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
9728
9740
  try {
9729
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-24YJWKJQ.js");
9741
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-V3PZRTY5.js");
9730
9742
  await ensureWorkspace2(thread.repoPath);
9731
9743
  } catch {
9732
9744
  }
@@ -9780,7 +9792,7 @@ var Orchestrator = class {
9780
9792
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
9781
9793
  );
9782
9794
  }
9783
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-VED7K2UL.js");
9795
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-UK62JCYF.js");
9784
9796
  const slug = thread.worktreePath.split("/").pop();
9785
9797
  const dest = thread.worktreePath;
9786
9798
  await withRepoGitLock(thread.repoPath, async () => {
@@ -9890,7 +9902,7 @@ async function startOrchestration(opts) {
9890
9902
  sourceRef: "default",
9891
9903
  ...createOpts
9892
9904
  }).catch(async () => {
9893
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-VED7K2UL.js");
9905
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-UK62JCYF.js");
9894
9906
  const repo = await resolveRepoRoot2(repoPath);
9895
9907
  const def = await resolveDefaultBranch2(repo);
9896
9908
  return orch.createThread({
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  isOrchestratorThread
3
- } from "./chunk-SJPK5Y5U.js";
3
+ } from "./chunk-SJ3IUYG2.js";
4
4
  import {
5
5
  codexUnattendedGitConfigArgs,
6
6
  mergeAgentGitAuthEnv,
7
7
  resolveAgentGitAuthEnv,
8
8
  resolveCodexGitWritableRoots
9
- } from "./chunk-566W54AN.js";
9
+ } from "./chunk-NYXDZCMP.js";
10
10
  import {
11
11
  applyConnectedTeamToCli,
12
12
  brightsyMcpServerName,
@@ -1234,6 +1234,15 @@ function isContextCompactInProgress(text) {
1234
1234
  if (isContextCompactDone(t)) return false;
1235
1235
  return /^Compressing context/i.test(t);
1236
1236
  }
1237
+ function isSystemStatusThinking(event) {
1238
+ if (event.replace) return true;
1239
+ const t = (event.data ?? "").trim();
1240
+ if (!t) return true;
1241
+ if (/^API retry\b/i.test(t)) return true;
1242
+ if (/^MCP:/i.test(t)) return true;
1243
+ if (isContextCompactInProgress(t) || isContextCompactDone(t)) return true;
1244
+ return false;
1245
+ }
1237
1246
  function looksLikeConversationSummary(text) {
1238
1247
  const t = text.trim();
1239
1248
  if (t.length < 80) return false;
@@ -1778,15 +1787,6 @@ function applyAgentEvent(parts, event) {
1778
1787
  );
1779
1788
  return next2;
1780
1789
  }
1781
- if (contextCompactInProgress(parts, event.parentId)) {
1782
- return [
1783
- ...parts,
1784
- compactToolPart(data, `compact-${parts.length}`, {
1785
- parentId: event.parentId,
1786
- status: "running"
1787
- })
1788
- ];
1789
- }
1790
1790
  const runningSkillIdx = lastRunningSkillIndex(parts, event.parentId);
1791
1791
  if (runningSkillIdx >= 0) {
1792
1792
  const prev = parts[runningSkillIdx];
@@ -1805,6 +1805,15 @@ function applyAgentEvent(parts, event) {
1805
1805
  );
1806
1806
  return next2;
1807
1807
  }
1808
+ if (contextCompactInProgress(parts, event.parentId)) {
1809
+ return [
1810
+ ...parts,
1811
+ compactToolPart(data, `compact-${parts.length}`, {
1812
+ parentId: event.parentId,
1813
+ status: "running"
1814
+ })
1815
+ ];
1816
+ }
1808
1817
  const next = [...parts];
1809
1818
  const last = next[next.length - 1];
1810
1819
  if (last?.type === "text" && sameParentId(last.parentId, event.parentId)) {
@@ -1841,7 +1850,9 @@ function applyAgentEvent(parts, event) {
1841
1850
  if (event.type === "thinking") {
1842
1851
  const data = event.data;
1843
1852
  if (!data) return parts;
1844
- parts = markRunningSkillsDone(parts, event.parentId);
1853
+ if (!isSystemStatusThinking(event)) {
1854
+ parts = markRunningSkillsDone(parts, event.parentId);
1855
+ }
1845
1856
  const next = [...parts];
1846
1857
  if (event.replace) {
1847
1858
  for (let i = next.length - 1; i >= 0; i--) {
@@ -2533,7 +2544,7 @@ var claudeAdapter = {
2533
2544
  );
2534
2545
  }
2535
2546
  const mode = permissionMode(thread);
2536
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-VWF5AOYN.js");
2547
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-PUJEGSOB.js");
2537
2548
  const isOrchestrator = isOrchestratorThread2(thread);
2538
2549
  const injectedServers = await buildInjectedMcpServers({
2539
2550
  includeSideboard: true,
@@ -4529,6 +4540,7 @@ export {
4529
4540
  isCompactToolName,
4530
4541
  isContextCompactDone,
4531
4542
  isContextCompactInProgress,
4543
+ isSystemStatusThinking,
4532
4544
  looksLikeConversationSummary,
4533
4545
  toolDetail,
4534
4546
  toolDescription,
@@ -25,7 +25,7 @@ import {
25
25
  resolveQuotaFallbackAgent,
26
26
  stripBrightsyNdjsonNoise,
27
27
  toolDescription
28
- } from "./chunk-DMT62X6L.js";
28
+ } from "./chunk-BHPGORIY.js";
29
29
  import {
30
30
  SLACK_REPLY_FORMATTING,
31
31
  addWorkspace,
@@ -48,7 +48,7 @@ import {
48
48
  stageAbsolutePathsAsAttachments,
49
49
  stageBuffersAsAttachments,
50
50
  syncWorkspacesFromThreads
51
- } from "./chunk-SJPK5Y5U.js";
51
+ } from "./chunk-SJ3IUYG2.js";
52
52
  import {
53
53
  addPrStackLayer,
54
54
  allocateTeamName,
@@ -98,7 +98,7 @@ import {
98
98
  worktreeDisplayLabelForGroup,
99
99
  worktreeNameFromPath,
100
100
  worktreeSlugForTicket
101
- } from "./chunk-566W54AN.js";
101
+ } from "./chunk-NYXDZCMP.js";
102
102
  import {
103
103
  ATTACHMENTS_DIR,
104
104
  DETACHED_JOBS_DIR,
@@ -443,9 +443,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
443
443
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
444
444
  );
445
445
  }
446
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-VWF5AOYN.js");
446
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-PUJEGSOB.js");
447
447
  if (isGlobalThread2(thread)) {
448
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-ON5YI463.js");
448
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-BX2R5EMW.js");
449
449
  ensureGlobalCoordinatorCwd2(
450
450
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
451
451
  );
@@ -3662,6 +3662,7 @@ function classifyWorktreeListBadges(group, viewerLogin = "", reviewLabel = "") {
3662
3662
  }
3663
3663
  ];
3664
3664
  }
3665
+ if (!normalizeViewerLogin(viewerLogin)) return [];
3665
3666
  const draft = open.some((t) => t.prIsDraft);
3666
3667
  const readyLabel = reviewLabel.trim();
3667
3668
  const inReview = readyLabel ? labelsInclude(groupPrLabels(group), readyLabel) : !draft;
@@ -4246,6 +4247,7 @@ async function createThread(input, _onSetupLine) {
4246
4247
  let prTitle = null;
4247
4248
  let prAuthorLogin2 = null;
4248
4249
  let prLabels = [];
4250
+ let prIsDraft = false;
4249
4251
  if (sourceType === "pr") {
4250
4252
  const num = Number(input.sourceRef.replace(/^#/, ""));
4251
4253
  if (!Number.isFinite(num)) throw new Error(`Invalid PR number: ${input.sourceRef}`);
@@ -4263,6 +4265,7 @@ async function createThread(input, _onSetupLine) {
4263
4265
  prUrl = pr.url;
4264
4266
  prAuthorLogin2 = pr.author?.login?.trim() || null;
4265
4267
  prLabels = pr.labels ?? [];
4268
+ prIsDraft = Boolean(pr.isDraft);
4266
4269
  const localFetchBranch = `sideboard-pr-${pr.number}`;
4267
4270
  await fetchPrHead(repoPath, pr.number, localFetchBranch);
4268
4271
  sourceRef = localFetchBranch;
@@ -4287,6 +4290,7 @@ async function createThread(input, _onSetupLine) {
4287
4290
  prTitle = existing.title;
4288
4291
  prAuthorLogin2 = existing.author?.login?.trim() || null;
4289
4292
  prLabels = existing.labels ?? [];
4293
+ prIsDraft = Boolean(existing.isDraft);
4290
4294
  }
4291
4295
  }
4292
4296
  }
@@ -4323,14 +4327,15 @@ async function createThread(input, _onSetupLine) {
4323
4327
  prUrl,
4324
4328
  prTitle,
4325
4329
  prAuthorLogin: prAuthorLogin2,
4326
- prLabels
4330
+ prLabels,
4331
+ prIsDraft
4327
4332
  });
4328
4333
  writeThread(thread);
4329
4334
  await ensureWorkspace(repoPath);
4330
4335
  return readThread(thread.id) ?? thread;
4331
4336
  }
4332
4337
  async function listLinearIssues(agent, repoPath) {
4333
- const { getAdapter: getAdapter2 } = await import("./agents-7IIUQLCC.js");
4338
+ const { getAdapter: getAdapter2 } = await import("./agents-B66CNEPB.js");
4334
4339
  await requireAgent(agent, { requireLinear: true });
4335
4340
  const adapter = getAdapter2(agent);
4336
4341
  if (!adapter.listLinearIssues) {
@@ -4803,7 +4808,7 @@ async function adoptThread(input) {
4803
4808
  messages: input.messages ?? []
4804
4809
  });
4805
4810
  writeThread(thread);
4806
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-QWGSPLMF.js");
4811
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-FUOZIR3V.js");
4807
4812
  await ensureWorkspace2(repoPath);
4808
4813
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-RXZPTCNH.js");
4809
4814
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -7515,7 +7520,7 @@ function formatScheduledPrompt(name, prompt) {
7515
7520
  ${prompt}`;
7516
7521
  }
7517
7522
  async function defaultDeps() {
7518
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-HEFTR7RA.js");
7523
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-O3V4UH73.js");
7519
7524
  const orch = getOrchestrator2();
7520
7525
  return {
7521
7526
  findThread: (id) => findThreadByRef(id),
@@ -9712,6 +9717,14 @@ var Orchestrator = class {
9712
9717
  const thread = this.requireThread(threadRef);
9713
9718
  return discoverSkills(thread.worktreePath);
9714
9719
  }
9720
+ /** Skills for a project folder before a worktree exists (create modal). */
9721
+ listSkillsForRepo(repoPath) {
9722
+ const root = repoPath.trim();
9723
+ if (!root || root === "/" || root === ".") {
9724
+ return discoverSkills("/__sideboard_no_workspace__");
9725
+ }
9726
+ return discoverSkills(root);
9727
+ }
9715
9728
  async previewLand(threadRef) {
9716
9729
  const thread = this.requireThread(threadRef);
9717
9730
  this.assertNotGlobal(thread, "Land");
@@ -10140,7 +10153,7 @@ var Orchestrator = class {
10140
10153
  this.enforceHistoryRetention();
10141
10154
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
10142
10155
  try {
10143
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-QWGSPLMF.js");
10156
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-FUOZIR3V.js");
10144
10157
  await ensureWorkspace2(thread.repoPath);
10145
10158
  } catch {
10146
10159
  }
@@ -10194,7 +10207,7 @@ var Orchestrator = class {
10194
10207
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
10195
10208
  );
10196
10209
  }
10197
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-RYZOFNY7.js");
10210
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-4DNK2CK6.js");
10198
10211
  const slug = thread.worktreePath.split("/").pop();
10199
10212
  const dest = thread.worktreePath;
10200
10213
  await withRepoGitLock(thread.repoPath, async () => {
@@ -10304,7 +10317,7 @@ async function startOrchestration(opts) {
10304
10317
  sourceRef: "default",
10305
10318
  ...createOpts
10306
10319
  }).catch(async () => {
10307
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-RYZOFNY7.js");
10320
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-4DNK2CK6.js");
10308
10321
  const repo = await resolveRepoRoot2(repoPath);
10309
10322
  const def = await resolveDefaultBranch2(repo);
10310
10323
  return orch.createThread({
@@ -1578,6 +1578,23 @@ function prIsInMergeQueue(gate) {
1578
1578
  if (gate.isInMergeQueue) return true;
1579
1579
  return (gate.mergeStateStatus ?? "").toUpperCase() === "QUEUED";
1580
1580
  }
1581
+ function applyCleanLocalMergeTree(gate) {
1582
+ const mergeable = (gate.mergeable ?? "").toUpperCase();
1583
+ const mergeState = (gate.mergeStateStatus ?? "").toUpperCase();
1584
+ const githubConflicting = mergeable === "CONFLICTING" || mergeState === "DIRTY";
1585
+ if (githubConflicting) {
1586
+ return {
1587
+ ...gate,
1588
+ mergeable: "MERGEABLE",
1589
+ mergeStateStatus: mergeState === "BEHIND" ? "BEHIND" : "CLEAN"
1590
+ };
1591
+ }
1592
+ return {
1593
+ ...gate,
1594
+ mergeable: mergeable === "UNKNOWN" || !mergeable ? "MERGEABLE" : gate.mergeable,
1595
+ mergeStateStatus: mergeState === "BEHIND" ? "BEHIND" : mergeState === "UNKNOWN" || !mergeState ? "CLEAN" : gate.mergeStateStatus
1596
+ };
1597
+ }
1581
1598
  function ciChecksFailed(checks) {
1582
1599
  if (!checks?.length) return false;
1583
1600
  return checks.some(
@@ -2130,6 +2147,22 @@ async function listPrs(repoPath, opts) {
2130
2147
  if (exitCode !== 0 || !stdout.trim()) return [];
2131
2148
  return applyPrListResponse(stdout, { ...resolved, limit, viewerTeams });
2132
2149
  }
2150
+ var PR_INFO_JSON_FIELDS = "number,title,headRefName,url,isCrossRepository,author,isDraft,labels";
2151
+ function prInfoFromGhView(view) {
2152
+ const author = view.author;
2153
+ const login = author?.login?.trim();
2154
+ return {
2155
+ number: Number(view.number),
2156
+ title: String(view.title ?? ""),
2157
+ headRefName: String(view.headRefName ?? ""),
2158
+ url: String(view.url ?? ""),
2159
+ isCrossRepository: Boolean(view.isCrossRepository),
2160
+ author: login ? { login } : null,
2161
+ isDraft: Boolean(view.isDraft),
2162
+ state: typeof view.state === "string" ? view.state : void 0,
2163
+ labels: labelNames(view.labels)
2164
+ };
2165
+ }
2133
2166
  async function getPr(repoPath, number) {
2134
2167
  const slug = await resolveGithubRepoSlug(repoPath);
2135
2168
  const args = [
@@ -2137,12 +2170,16 @@ async function getPr(repoPath, number) {
2137
2170
  "view",
2138
2171
  String(number),
2139
2172
  "--json",
2140
- "number,title,headRefName,url,isCrossRepository,author"
2173
+ PR_INFO_JSON_FIELDS
2141
2174
  ];
2142
2175
  if (slug) args.push("--repo", slug);
2143
2176
  const { stdout, exitCode } = await gh(args, repoPath, { reject: false });
2144
2177
  if (exitCode !== 0 || !stdout.trim()) return null;
2145
- return JSON.parse(stdout);
2178
+ try {
2179
+ return prInfoFromGhView(JSON.parse(stdout));
2180
+ } catch {
2181
+ return null;
2182
+ }
2146
2183
  }
2147
2184
  function normalizeGitBranchName(ref) {
2148
2185
  return ref.trim().replace(/^refs\/heads\//, "").replace(/^origin\//, "");
@@ -2196,7 +2233,7 @@ async function getPrForHeadBranch(repoPath, branch) {
2196
2233
  "--head",
2197
2234
  listHead,
2198
2235
  "--json",
2199
- "number,title,headRefName,url,isCrossRepository,author",
2236
+ PR_INFO_JSON_FIELDS,
2200
2237
  "--limit",
2201
2238
  "1",
2202
2239
  "--state",
@@ -2207,7 +2244,7 @@ async function getPrForHeadBranch(repoPath, branch) {
2207
2244
  if (listed.exitCode === 0 && listed.stdout.trim()) {
2208
2245
  try {
2209
2246
  const rows = JSON.parse(listed.stdout);
2210
- if (rows[0]) return rows[0];
2247
+ if (rows[0]) return prInfoFromGhView(rows[0]);
2211
2248
  } catch {
2212
2249
  }
2213
2250
  }
@@ -2216,13 +2253,13 @@ async function getPrForHeadBranch(repoPath, branch) {
2216
2253
  "view",
2217
2254
  head,
2218
2255
  "--json",
2219
- "number,title,headRefName,url,isCrossRepository,author,state"
2256
+ `${PR_INFO_JSON_FIELDS},state`
2220
2257
  ];
2221
2258
  if (slug) viewArgs.push("--repo", slug);
2222
2259
  const viewed = await gh(viewArgs, repoPath, { reject: false });
2223
2260
  if (viewed.exitCode !== 0 || !viewed.stdout.trim()) return null;
2224
2261
  try {
2225
- const info = JSON.parse(viewed.stdout);
2262
+ const info = prInfoFromGhView(JSON.parse(viewed.stdout));
2226
2263
  const state = (info.state ?? "OPEN").trim().toUpperCase();
2227
2264
  if (state !== "OPEN") return null;
2228
2265
  return info;
@@ -2322,9 +2359,10 @@ ${result.stderr}`;
2322
2359
  async function probeLocalMergeGate(cwd, gate) {
2323
2360
  const mergeable = (gate?.mergeable ?? "").toUpperCase();
2324
2361
  const mergeState = (gate?.mergeStateStatus ?? "").toUpperCase();
2325
- const alreadyConflicting = mergeable === "CONFLICTING" || mergeState === "DIRTY";
2362
+ const githubConflicting = mergeable === "CONFLICTING" || mergeState === "DIRTY";
2363
+ const githubUnknown = mergeable === "UNKNOWN" || mergeState === "UNKNOWN";
2326
2364
  const inQueue = gate ? prIsInMergeQueue(gate) : false;
2327
- if (alreadyConflicting || inQueue) return { gate, files: [] };
2365
+ if (inQueue) return { gate, files: [] };
2328
2366
  try {
2329
2367
  const local = await detectLocalMergeConflicts(cwd, gate?.baseRefName ?? null);
2330
2368
  if (local.conflicting) {
@@ -2340,13 +2378,9 @@ async function probeLocalMergeGate(cwd, gate) {
2340
2378
  files: local.files
2341
2379
  };
2342
2380
  }
2343
- if (gate && (mergeable === "UNKNOWN" || mergeState === "UNKNOWN")) {
2381
+ if (gate && (githubConflicting || githubUnknown)) {
2344
2382
  return {
2345
- gate: {
2346
- ...gate,
2347
- mergeable: gate.mergeable === "UNKNOWN" ? "MERGEABLE" : gate.mergeable,
2348
- mergeStateStatus: gate.mergeStateStatus === "UNKNOWN" ? "CLEAN" : gate.mergeStateStatus
2349
- },
2383
+ gate: applyCleanLocalMergeTree(gate),
2350
2384
  files: []
2351
2385
  };
2352
2386
  }
@@ -2477,6 +2511,7 @@ var PR_DETAILS_JSON_FIELDS = [
2477
2511
  "isDraft",
2478
2512
  "reviewDecision",
2479
2513
  "author",
2514
+ "createdAt",
2480
2515
  "baseRefName",
2481
2516
  "headRefName",
2482
2517
  "additions",
@@ -2506,6 +2541,7 @@ function parsePrDetailsView(view) {
2506
2541
  isDraft: Boolean(view.isDraft),
2507
2542
  reviewDecision: typeof view.reviewDecision === "string" && view.reviewDecision ? view.reviewDecision : null,
2508
2543
  author: { login: author.login ?? "unknown", name: author.name ?? null },
2544
+ createdAt: typeof view.createdAt === "string" && view.createdAt ? view.createdAt : null,
2509
2545
  baseRefName: String(view.baseRefName ?? ""),
2510
2546
  headRefName: String(view.headRefName ?? ""),
2511
2547
  additions: Number(view.additions ?? 0),