@sideboard-ai/core 0.1.209 → 0.1.211

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 (48) hide show
  1. package/dist/{abletime-G3MWSZVM.js → abletime-GDZLZRMY.js} +4 -4
  2. package/dist/{abletime-SQREWITG.js → abletime-QGGYL2G4.js} +4 -4
  3. package/dist/{abletime-oauth-SQD6K47H.js → abletime-oauth-3X3BAPTF.js} +3 -3
  4. package/dist/{abletime-oauth-7AOE4KJL.js → abletime-oauth-F335TWKY.js} +3 -3
  5. package/dist/{abletime-rest-QRTJH42S.js → abletime-rest-LAGTPAJL.js} +3 -3
  6. package/dist/{abletime-rest-BXL7QHCX.js → abletime-rest-PLJVY3H3.js} +3 -3
  7. package/dist/{agents-KA6HDNNP.js → agents-A2U3K7VK.js} +5 -5
  8. package/dist/{agents-U2NVCYGC.js → agents-GQANI7M5.js} +5 -5
  9. package/dist/{app-settings-VBQHGX5Z.js → app-settings-2TN3WLZV.js} +1 -1
  10. package/dist/{app-settings-6SZLZNA7.js → app-settings-XCRNCEEE.js} +1 -1
  11. package/dist/{chunk-B2RPIHNJ.js → chunk-2M5B7YNY.js} +2 -2
  12. package/dist/{chunk-TZCWNRMC.js → chunk-2PE6SZCM.js} +3 -3
  13. package/dist/{chunk-CQZCXRVG.js → chunk-42IULNIY.js} +3 -3
  14. package/dist/{chunk-FUC3XFE2.js → chunk-BTC2D6LS.js} +2 -0
  15. package/dist/{chunk-HBL7ILQA.js → chunk-ERNK7AWM.js} +107 -61
  16. package/dist/{chunk-5LFD3KCJ.js → chunk-G4TANQC3.js} +5 -5
  17. package/dist/{chunk-RPZFNKND.js → chunk-GHKFSBES.js} +10 -1
  18. package/dist/{chunk-MS2P5GXL.js → chunk-IA5IPGZI.js} +4 -4
  19. package/dist/{chunk-KJAHVQL6.js → chunk-IRCAWYTN.js} +4 -4
  20. package/dist/{chunk-OY7THBLG.js → chunk-JJ3ONQ4Q.js} +10 -1
  21. package/dist/{chunk-MZP2C4KE.js → chunk-KZUA4QG2.js} +114 -62
  22. package/dist/{chunk-VJQDUD24.js → chunk-L5CIEBLR.js} +2 -0
  23. package/dist/{chunk-XRIF6M5H.js → chunk-LS6TSOCE.js} +5 -5
  24. package/dist/{chunk-IOOL3T7Q.js → chunk-MN6YUD4O.js} +3 -3
  25. package/dist/{chunk-22A45QOI.js → chunk-NRKDRQM3.js} +2 -2
  26. package/dist/{chunk-QVVJO4GN.js → chunk-REZRGCKV.js} +3 -3
  27. package/dist/{chunk-42VGWRSE.js → chunk-VPQXJYIW.js} +2 -2
  28. package/dist/{chunk-PTOIWKDU.js → chunk-WNVQJZ7P.js} +3 -3
  29. package/dist/{chunk-IIENQFJ6.js → chunk-YVE4PXCJ.js} +2 -2
  30. package/dist/{coordinator-prompt-2YCOE5R4.js → coordinator-prompt-EHRDZ2ZU.js} +4 -4
  31. package/dist/{coordinator-prompt-EO2X2EYW.js → coordinator-prompt-LMTMWCPN.js} +4 -4
  32. package/dist/{global-workspace-JEKMVE42.js → global-workspace-NG2TBUI5.js} +4 -4
  33. package/dist/{global-workspace-H2ANUSGR.js → global-workspace-RHABXQWB.js} +4 -4
  34. package/dist/index.cjs +111 -41
  35. package/dist/index.d.cts +45 -11
  36. package/dist/index.d.ts +45 -11
  37. package/dist/index.js +25 -12
  38. package/dist/mcp/run-stdio.cjs +98 -41
  39. package/dist/mcp/run-stdio.js +11 -11
  40. package/dist/{orchestrator-RUQXDYM7.js → orchestrator-NZO4PVFH.js} +6 -6
  41. package/dist/{orchestrator-N7LLTK5O.js → orchestrator-QMGH4V4K.js} +6 -6
  42. package/dist/{thread-store-55X2JYDT.js → thread-store-4M6WETL6.js} +1 -1
  43. package/dist/{thread-store-CMZWM5NY.js → thread-store-MSMBQ3V4.js} +1 -1
  44. package/dist/{workspaces-SVDORZEI.js → workspaces-FRR6Y4BY.js} +4 -4
  45. package/dist/{workspaces-2YNYLSPV.js → workspaces-VIUUE4RT.js} +4 -4
  46. package/dist/{worktree-5CPGB4D2.js → worktree-3MEG62KB.js} +3 -3
  47. package/dist/{worktree-YQ6XUSR2.js → worktree-GKUOHXXB.js} +3 -3
  48. package/package.json +1 -1
@@ -15,11 +15,11 @@ import {
15
15
  toAbleTimeIssueInfo,
16
16
  updateAbleTimeTask,
17
17
  verifyAbleTimeConnection
18
- } from "./chunk-QVVJO4GN.js";
19
- import "./chunk-B2RPIHNJ.js";
20
- import "./chunk-5LFD3KCJ.js";
18
+ } from "./chunk-REZRGCKV.js";
19
+ import "./chunk-2M5B7YNY.js";
20
+ import "./chunk-G4TANQC3.js";
21
21
  import "./chunk-N7WZ6NIN.js";
22
- import "./chunk-VJQDUD24.js";
22
+ import "./chunk-L5CIEBLR.js";
23
23
  import "./chunk-4TR3HZFT.js";
24
24
  import "./chunk-WDRMZKVB.js";
25
25
  import "./chunk-JT7R45JB.js";
@@ -17,11 +17,11 @@ import {
17
17
  toAbleTimeIssueInfo,
18
18
  updateAbleTimeTask,
19
19
  verifyAbleTimeConnection
20
- } from "./chunk-CQZCXRVG.js";
21
- import "./chunk-IIENQFJ6.js";
22
- import "./chunk-XRIF6M5H.js";
20
+ } from "./chunk-42IULNIY.js";
21
+ import "./chunk-YVE4PXCJ.js";
22
+ import "./chunk-LS6TSOCE.js";
23
23
  import "./chunk-VKQGAWHY.js";
24
- import "./chunk-FUC3XFE2.js";
24
+ import "./chunk-BTC2D6LS.js";
25
25
  import "./chunk-NSTQ6QKD.js";
26
26
  import "./chunk-KGZBYWZ3.js";
27
27
  import "./chunk-EQNRWDLN.js";
@@ -20,10 +20,10 @@ import {
20
20
  parseAbleTimeOAuthCallbackUrl,
21
21
  resolveAbleTimeOAuthHost,
22
22
  startAbleTimeOAuth
23
- } from "./chunk-IOOL3T7Q.js";
24
- import "./chunk-5LFD3KCJ.js";
23
+ } from "./chunk-MN6YUD4O.js";
24
+ import "./chunk-G4TANQC3.js";
25
25
  import "./chunk-N7WZ6NIN.js";
26
- import "./chunk-VJQDUD24.js";
26
+ import "./chunk-L5CIEBLR.js";
27
27
  import "./chunk-4TR3HZFT.js";
28
28
  import "./chunk-WDRMZKVB.js";
29
29
  import "./chunk-JT7R45JB.js";
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  DEFAULT_ABLETIME_HOST,
5
5
  normalizeAbleTimeHost
6
- } from "./chunk-XRIF6M5H.js";
6
+ } from "./chunk-LS6TSOCE.js";
7
7
  import {
8
8
  httpFetch
9
9
  } from "./chunk-VKQGAWHY.js";
@@ -12,7 +12,7 @@ import {
12
12
  getAbleTimeHost,
13
13
  loadAppSettings,
14
14
  saveAbleTimeConnection
15
- } from "./chunk-FUC3XFE2.js";
15
+ } from "./chunk-BTC2D6LS.js";
16
16
  import "./chunk-NSTQ6QKD.js";
17
17
  import "./chunk-KGZBYWZ3.js";
18
18
  import "./chunk-EQNRWDLN.js";
@@ -286,7 +286,7 @@ async function startAbleTimeOAuth(opts) {
286
286
  persistAbleTimeTokens(data, { host });
287
287
  const token = data.access_token.trim();
288
288
  try {
289
- const { getAbleTimeOrientation } = await import("./abletime-SQREWITG.js");
289
+ const { getAbleTimeOrientation } = await import("./abletime-QGGYL2G4.js");
290
290
  const orientation = await getAbleTimeOrientation({ token, host });
291
291
  return saveAbleTimeConnection({
292
292
  accessToken: token,
@@ -7,10 +7,10 @@ import {
7
7
  callAbleTimeRestTool,
8
8
  looksLikeAbleTimeUlid,
9
9
  textFromAbleTimeDoc
10
- } from "./chunk-IIENQFJ6.js";
11
- import "./chunk-XRIF6M5H.js";
10
+ } from "./chunk-YVE4PXCJ.js";
11
+ import "./chunk-LS6TSOCE.js";
12
12
  import "./chunk-VKQGAWHY.js";
13
- import "./chunk-FUC3XFE2.js";
13
+ import "./chunk-BTC2D6LS.js";
14
14
  import "./chunk-NSTQ6QKD.js";
15
15
  import "./chunk-KGZBYWZ3.js";
16
16
  import "./chunk-EQNRWDLN.js";
@@ -5,10 +5,10 @@ import {
5
5
  callAbleTimeRestTool,
6
6
  looksLikeAbleTimeUlid,
7
7
  textFromAbleTimeDoc
8
- } from "./chunk-B2RPIHNJ.js";
9
- import "./chunk-5LFD3KCJ.js";
8
+ } from "./chunk-2M5B7YNY.js";
9
+ import "./chunk-G4TANQC3.js";
10
10
  import "./chunk-N7WZ6NIN.js";
11
- import "./chunk-VJQDUD24.js";
11
+ import "./chunk-L5CIEBLR.js";
12
12
  import "./chunk-4TR3HZFT.js";
13
13
  import "./chunk-WDRMZKVB.js";
14
14
  import "./chunk-JT7R45JB.js";
@@ -50,14 +50,14 @@ import {
50
50
  resolveQuotaFallbackAgent,
51
51
  turnCostUsdFromCursorUsage,
52
52
  whichOnPath
53
- } from "./chunk-MS2P5GXL.js";
54
- import "./chunk-PTOIWKDU.js";
53
+ } from "./chunk-IA5IPGZI.js";
54
+ import "./chunk-WNVQJZ7P.js";
55
55
  import "./chunk-3OHR73VK.js";
56
56
  import "./chunk-Y4MIXGPA.js";
57
57
  import "./chunk-VKQGAWHY.js";
58
- import "./chunk-42VGWRSE.js";
58
+ import "./chunk-VPQXJYIW.js";
59
59
  import "./chunk-D6JWYJ4P.js";
60
- import "./chunk-RPZFNKND.js";
60
+ import "./chunk-GHKFSBES.js";
61
61
  import "./chunk-X5B3OS5I.js";
62
62
  import "./chunk-SYFVUF2C.js";
63
63
  import {
@@ -74,7 +74,7 @@ import {
74
74
  assertOrchestratorCapableAgent,
75
75
  coerceOrchestratorAgent,
76
76
  isOrchestratorCapableAgent
77
- } from "./chunk-FUC3XFE2.js";
77
+ } from "./chunk-BTC2D6LS.js";
78
78
  import "./chunk-NSTQ6QKD.js";
79
79
  import "./chunk-KGZBYWZ3.js";
80
80
  import "./chunk-EQNRWDLN.js";
@@ -44,9 +44,9 @@ import {
44
44
  resolveLoginCommand,
45
45
  resolveQuotaFallbackAgent,
46
46
  whichOnPath
47
- } from "./chunk-KJAHVQL6.js";
48
- import "./chunk-TZCWNRMC.js";
49
- import "./chunk-22A45QOI.js";
47
+ } from "./chunk-IRCAWYTN.js";
48
+ import "./chunk-2PE6SZCM.js";
49
+ import "./chunk-NRKDRQM3.js";
50
50
  import "./chunk-6K64FJDD.js";
51
51
  import "./chunk-QQKDGPUI.js";
52
52
  import "./chunk-SALM35KD.js";
@@ -63,11 +63,11 @@ import {
63
63
  assertOrchestratorCapableAgent,
64
64
  coerceOrchestratorAgent,
65
65
  isOrchestratorCapableAgent
66
- } from "./chunk-VJQDUD24.js";
66
+ } from "./chunk-L5CIEBLR.js";
67
67
  import "./chunk-4TR3HZFT.js";
68
68
  import "./chunk-WDRMZKVB.js";
69
69
  import "./chunk-JT7R45JB.js";
70
- import "./chunk-OY7THBLG.js";
70
+ import "./chunk-JJ3ONQ4Q.js";
71
71
  import "./chunk-7J72QJOM.js";
72
72
  import "./chunk-77WWLBCI.js";
73
73
  import "./chunk-WFUDY6PC.js";
@@ -92,7 +92,7 @@ import {
92
92
  updateProjectProfileSettings,
93
93
  usageOnLimit,
94
94
  writeViewerContext
95
- } from "./chunk-VJQDUD24.js";
95
+ } from "./chunk-L5CIEBLR.js";
96
96
  import "./chunk-4TR3HZFT.js";
97
97
  import "./chunk-WDRMZKVB.js";
98
98
  import "./chunk-JT7R45JB.js";
@@ -94,7 +94,7 @@ import {
94
94
  updateProjectProfileSettings,
95
95
  usageOnLimit,
96
96
  writeViewerContext
97
- } from "./chunk-FUC3XFE2.js";
97
+ } from "./chunk-BTC2D6LS.js";
98
98
  import "./chunk-NSTQ6QKD.js";
99
99
  import "./chunk-KGZBYWZ3.js";
100
100
  import "./chunk-EQNRWDLN.js";
@@ -4,14 +4,14 @@ import {
4
4
  normalizeAbleTimeCredential,
5
5
  normalizeAbleTimeHost,
6
6
  rewriteAbleTimeError
7
- } from "./chunk-5LFD3KCJ.js";
7
+ } from "./chunk-G4TANQC3.js";
8
8
  import {
9
9
  httpFetch
10
10
  } from "./chunk-N7WZ6NIN.js";
11
11
  import {
12
12
  getAbleTimeAccessToken,
13
13
  getAbleTimeHost
14
- } from "./chunk-VJQDUD24.js";
14
+ } from "./chunk-L5CIEBLR.js";
15
15
 
16
16
  // src/integrations/abletime-rest.ts
17
17
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -5,7 +5,7 @@ import {
5
5
  resolveRepoRoot,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-22A45QOI.js";
8
+ } from "./chunk-NRKDRQM3.js";
9
9
  import {
10
10
  ATTACHMENTS_DIR,
11
11
  attachmentsGitignoreBody
@@ -22,13 +22,13 @@ import {
22
22
  resolveThreadDefaults,
23
23
  resolveViewerProfile,
24
24
  resolveViewerProfileForRepo
25
- } from "./chunk-VJQDUD24.js";
25
+ } from "./chunk-L5CIEBLR.js";
26
26
  import {
27
27
  createEmptyThread,
28
28
  listThreads,
29
29
  updateThread,
30
30
  writeThread
31
- } from "./chunk-OY7THBLG.js";
31
+ } from "./chunk-JJ3ONQ4Q.js";
32
32
  import {
33
33
  appDataDir,
34
34
  globalAgentCwd,
@@ -2,17 +2,17 @@
2
2
 
3
3
  import {
4
4
  textFromAbleTimeDoc
5
- } from "./chunk-IIENQFJ6.js";
5
+ } from "./chunk-YVE4PXCJ.js";
6
6
  import {
7
7
  assertAbleTimeCredential,
8
8
  callAbleTimeTool,
9
9
  normalizeAbleTimeHost,
10
10
  rewriteAbleTimeError
11
- } from "./chunk-XRIF6M5H.js";
11
+ } from "./chunk-LS6TSOCE.js";
12
12
  import {
13
13
  isAbleTimeConnected,
14
14
  saveAbleTimeConnection
15
- } from "./chunk-FUC3XFE2.js";
15
+ } from "./chunk-BTC2D6LS.js";
16
16
 
17
17
  // src/integrations/abletime.ts
18
18
  var CLOSED_STATES = /* @__PURE__ */ new Set([
@@ -478,6 +478,8 @@ function clampHistoryMaxDays(value) {
478
478
  return Math.min(HISTORY_MAX_DAYS_MAX, Math.floor(value));
479
479
  }
480
480
  function archivedUpdatedMs(thread) {
481
+ const stamped = thread.archivedAt ? Date.parse(thread.archivedAt) : NaN;
482
+ if (Number.isFinite(stamped)) return stamped;
481
483
  const updated = Date.parse(thread.updatedAt);
482
484
  if (Number.isFinite(updated)) return updated;
483
485
  const created = Date.parse(thread.createdAt);
@@ -42,7 +42,7 @@ import {
42
42
  summarizeTurnStderr,
43
43
  toolDescription,
44
44
  turnFailChatText
45
- } from "./chunk-MS2P5GXL.js";
45
+ } from "./chunk-IA5IPGZI.js";
46
46
  import {
47
47
  SLACK_REPLY_FORMATTING,
48
48
  addWorkspace,
@@ -65,7 +65,7 @@ import {
65
65
  stageAbsolutePathsAsAttachments,
66
66
  stageBuffersAsAttachments,
67
67
  syncWorkspacesFromThreads
68
- } from "./chunk-PTOIWKDU.js";
68
+ } from "./chunk-WNVQJZ7P.js";
69
69
  import {
70
70
  addPrStackLayer,
71
71
  allocateTeamName,
@@ -115,7 +115,7 @@ import {
115
115
  worktreeDisplayLabelForGroup,
116
116
  worktreeNameFromPath,
117
117
  worktreeSlugForTicket
118
- } from "./chunk-42VGWRSE.js";
118
+ } from "./chunk-VPQXJYIW.js";
119
119
  import {
120
120
  ATTACHMENTS_DIR,
121
121
  DETACHED_JOBS_DIR,
@@ -133,7 +133,7 @@ import {
133
133
  updateThread,
134
134
  withThreadLock,
135
135
  writeThread
136
- } from "./chunk-RPZFNKND.js";
136
+ } from "./chunk-GHKFSBES.js";
137
137
  import {
138
138
  ensureWorktreeSideboardIgnored
139
139
  } from "./chunk-SYFVUF2C.js";
@@ -179,7 +179,7 @@ import {
179
179
  updateAdvancedSettings,
180
180
  usageOnLimit,
181
181
  writeSecureJson
182
- } from "./chunk-FUC3XFE2.js";
182
+ } from "./chunk-BTC2D6LS.js";
183
183
  import {
184
184
  writePrivateFile
185
185
  } from "./chunk-NSTQ6QKD.js";
@@ -417,7 +417,7 @@ async function continueSourceThread(threadId, prompt) {
417
417
  await continueOnReply(threadId, prompt);
418
418
  return;
419
419
  }
420
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-RUQXDYM7.js");
420
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-NZO4PVFH.js");
421
421
  await getOrchestrator2().send(threadId, prompt);
422
422
  } catch {
423
423
  }
@@ -810,9 +810,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
810
810
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
811
811
  );
812
812
  }
813
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-H2ANUSGR.js");
813
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-RHABXQWB.js");
814
814
  if (isGlobalThread2(thread)) {
815
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-2YCOE5R4.js");
815
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-EHRDZ2ZU.js");
816
816
  ensureGlobalCoordinatorCwd2(
817
817
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
818
818
  );
@@ -2529,6 +2529,7 @@ function stripArchivedTranscript(thread) {
2529
2529
  ...thread,
2530
2530
  attachments: [],
2531
2531
  pendingTurnAttachments: [],
2532
+ queueAttachments: [],
2532
2533
  messages: [historyRetentionStubMessage(thread)]
2533
2534
  },
2534
2535
  { touch: false }
@@ -3719,7 +3720,7 @@ async function createThread(input, _onSetupLine) {
3719
3720
  });
3720
3721
  await requireAgent(resolved.agent);
3721
3722
  if (input.cowboy) {
3722
- const { cowboyModeEnabled } = await import("./app-settings-6SZLZNA7.js");
3723
+ const { cowboyModeEnabled } = await import("./app-settings-XCRNCEEE.js");
3723
3724
  if (!cowboyModeEnabled()) {
3724
3725
  throw new Error(
3725
3726
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3777,7 +3778,7 @@ async function createThread(input, _onSetupLine) {
3777
3778
  let sourceIsFork = false;
3778
3779
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3779
3780
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3780
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-SQREWITG.js");
3781
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-QGGYL2G4.js");
3781
3782
  const task = await ensureAbleTimeTask({
3782
3783
  title: title?.trim() || "Untitled work",
3783
3784
  description: input.prompt?.trim() || void 0
@@ -4313,7 +4314,7 @@ async function adoptThread(input) {
4313
4314
  messages: input.messages ?? []
4314
4315
  });
4315
4316
  writeThread(thread);
4316
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-2YNYLSPV.js");
4317
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-VIUUE4RT.js");
4317
4318
  await ensureWorkspace2(repoPath);
4318
4319
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-N5X5I422.js");
4319
4320
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -6060,24 +6061,56 @@ function expandComposerPrompt(worktreePath, prompt, opts) {
6060
6061
 
6061
6062
  // src/composer/consume-attachments.ts
6062
6063
  function consumeComposerAttachments(thread) {
6063
- if (thread.attachments.length === 0) {
6064
- return {
6065
- attachments: [],
6066
- pendingTurnAttachments: thread.pendingTurnAttachments ?? []
6067
- };
6068
- }
6069
6064
  return {
6070
6065
  attachments: [],
6071
- pendingTurnAttachments: [
6072
- ...thread.pendingTurnAttachments ?? [],
6073
- ...thread.attachments
6074
- ]
6066
+ consumed: [...thread.attachments]
6075
6067
  };
6076
6068
  }
6077
6069
  function takePendingTurnAttachments(thread) {
6078
6070
  const pending = thread.pendingTurnAttachments ?? [];
6079
- if (pending.length === 0 && thread.attachments.length === 0) return [];
6080
- return [...pending, ...thread.attachments];
6071
+ if (pending.length > 0) return [...pending];
6072
+ return thread.attachments.length > 0 ? [...thread.attachments] : [];
6073
+ }
6074
+ function alignQueueAttachments(queueLength, existing) {
6075
+ const next = (existing ?? []).slice(0, queueLength).map((slot) => [...slot ?? []]);
6076
+ while (next.length < queueLength) next.push([]);
6077
+ return next;
6078
+ }
6079
+ function appendQueuedItem(queue, queueAttachments, prompt, attachments = []) {
6080
+ return {
6081
+ queue: [...queue, prompt],
6082
+ queueAttachments: [...alignQueueAttachments(queue.length, queueAttachments), [...attachments]]
6083
+ };
6084
+ }
6085
+ function prependQueuedItem(queue, queueAttachments, prompt, attachments = []) {
6086
+ return {
6087
+ queue: [prompt, ...queue],
6088
+ queueAttachments: [[...attachments], ...alignQueueAttachments(queue.length, queueAttachments)]
6089
+ };
6090
+ }
6091
+ function removeQueuedItem(queue, queueAttachments, index) {
6092
+ const aligned = alignQueueAttachments(queue.length, queueAttachments);
6093
+ return {
6094
+ queue: queue.filter((_, i) => i !== index),
6095
+ queueAttachments: aligned.filter((_, i) => i !== index)
6096
+ };
6097
+ }
6098
+ function moveQueuedItemToFront(queue, queueAttachments, index) {
6099
+ const aligned = alignQueueAttachments(queue.length, queueAttachments);
6100
+ return {
6101
+ queue: [queue[index], ...queue.filter((_, i) => i !== index)],
6102
+ queueAttachments: [aligned[index] ?? [], ...aligned.filter((_, i) => i !== index)]
6103
+ };
6104
+ }
6105
+ function shiftQueuedItem(queue, queueAttachments) {
6106
+ if (queue.length === 0) return null;
6107
+ const aligned = alignQueueAttachments(queue.length, queueAttachments);
6108
+ return {
6109
+ prompt: queue[0],
6110
+ attachments: aligned[0] ?? [],
6111
+ queue: queue.slice(1),
6112
+ queueAttachments: aligned.slice(1)
6113
+ };
6081
6114
  }
6082
6115
 
6083
6116
  // src/agents/instructions.ts
@@ -6713,7 +6746,7 @@ function formatScheduledPrompt(name, prompt) {
6713
6746
  ${prompt}`;
6714
6747
  }
6715
6748
  async function defaultDeps() {
6716
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-RUQXDYM7.js");
6749
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-NZO4PVFH.js");
6717
6750
  const orch = getOrchestrator2();
6718
6751
  return {
6719
6752
  findThread: (id) => findThreadByRef(id),
@@ -6983,7 +7016,7 @@ var Orchestrator = class {
6983
7016
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
6984
7017
  });
6985
7018
  }
6986
- const { autoCleanupOrphansEnabled } = await import("./app-settings-6SZLZNA7.js");
7019
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-XCRNCEEE.js");
6987
7020
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
6988
7021
  await cleanupOrphanWorktrees({ repoPaths });
6989
7022
  }
@@ -7193,9 +7226,9 @@ var Orchestrator = class {
7193
7226
  if (!thread || thread.status === "archived") return;
7194
7227
  this.crashContinued.add(threadId);
7195
7228
  const prompt = formatAgentErrorContinuePrompt(opts.detail);
7196
- const queue = [prompt, ...thread.queue];
7197
- updateThread(threadId, { queue });
7198
- this.emit({ type: "queue_changed", threadId, queue });
7229
+ const next = prependQueuedItem(thread.queue, thread.queueAttachments, prompt);
7230
+ updateThread(threadId, next);
7231
+ this.emit({ type: "queue_changed", threadId, queue: next.queue });
7199
7232
  this.haltDrain.delete(threadId);
7200
7233
  }
7201
7234
  /**
@@ -7224,9 +7257,9 @@ var Orchestrator = class {
7224
7257
  }
7225
7258
  if (decision.action === "nudge") this.jobContinueNudged.add(threadId);
7226
7259
  else this.jobContinueCount.set(threadId, (this.jobContinueCount.get(threadId) ?? 0) + 1);
7227
- const queue = [decision.prompt, ...thread.queue];
7228
- updateThread(threadId, { queue });
7229
- this.emit({ type: "queue_changed", threadId, queue });
7260
+ const next = prependQueuedItem(thread.queue, thread.queueAttachments, decision.prompt);
7261
+ updateThread(threadId, next);
7262
+ this.emit({ type: "queue_changed", threadId, queue: next.queue });
7230
7263
  this.haltDrain.delete(threadId);
7231
7264
  }
7232
7265
  getThreads(includeArchived = false) {
@@ -7281,7 +7314,7 @@ var Orchestrator = class {
7281
7314
  }
7282
7315
  await setup;
7283
7316
  if (skipSetup) return;
7284
- const { autoRunAfterSetupEnabled } = await import("./app-settings-6SZLZNA7.js");
7317
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-XCRNCEEE.js");
7285
7318
  if (autoRunAfterSetupEnabled()) {
7286
7319
  try {
7287
7320
  await this.startDev(threadId);
@@ -7334,18 +7367,22 @@ var Orchestrator = class {
7334
7367
  throw new Error(`Thread is archived: ${thread.id}`);
7335
7368
  }
7336
7369
  const followUp = resolveSendFollowUp(current, opts?.followUp);
7337
- const queue = [...current.queue, prompt];
7370
+ const consumed = consumeComposerAttachments(current);
7371
+ const queued = appendQueuedItem(
7372
+ current.queue,
7373
+ current.queueAttachments,
7374
+ prompt,
7375
+ consumed.consumed
7376
+ );
7338
7377
  this.crashContinued.delete(thread.id);
7339
7378
  this.jobContinueCount.delete(thread.id);
7340
7379
  this.jobContinueNudged.delete(thread.id);
7341
7380
  this.haltDrain.delete(thread.id);
7342
7381
  const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id) || current.status === "running";
7343
7382
  shouldSteer = followUp === "steer" && (inFlight || current.queue.length > 0);
7344
- const patch = { queue };
7345
- if (current.attachments.length > 0) {
7346
- const consumed = consumeComposerAttachments(current);
7383
+ const patch = queued;
7384
+ if (consumed.consumed.length > 0) {
7347
7385
  patch.attachments = consumed.attachments;
7348
- patch.pendingTurnAttachments = consumed.pendingTurnAttachments;
7349
7386
  }
7350
7387
  if (!inFlight) patch.status = "queued";
7351
7388
  const pid = current.agentPid;
@@ -7353,7 +7390,7 @@ var Orchestrator = class {
7353
7390
  patch.agentPid = null;
7354
7391
  }
7355
7392
  updateThread(thread.id, patch);
7356
- this.emit({ type: "queue_changed", threadId: thread.id, queue });
7393
+ this.emit({ type: "queue_changed", threadId: thread.id, queue: queued.queue });
7357
7394
  if (!inFlight) {
7358
7395
  this.emit({ type: "status_changed", threadId: thread.id, status: "queued" });
7359
7396
  }
@@ -7395,14 +7432,17 @@ var Orchestrator = class {
7395
7432
  return withThreadLock(thread.id, async () => {
7396
7433
  const current = this.requireThread(thread.id);
7397
7434
  if (index < 0 || index >= current.queue.length) return current;
7398
- const queue = current.queue.filter((_, i) => i !== index);
7399
- const stillQueued = queue.length > 0;
7435
+ const removed = removeQueuedItem(current.queue, current.queueAttachments, index);
7436
+ const stillQueued = removed.queue.length > 0;
7400
7437
  const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id);
7401
7438
  updateThread(thread.id, {
7402
- queue,
7439
+ ...removed,
7440
+ // Old sends parked on pendingTurnAttachments; drop that bag when the
7441
+ // follow-up that owned it is gone so a later turn cannot inherit it.
7442
+ ...stillQueued ? {} : { pendingTurnAttachments: [] },
7403
7443
  status: !stillQueued && !inFlight && current.status === "queued" ? "idle" : current.status
7404
7444
  });
7405
- this.emit({ type: "queue_changed", threadId: thread.id, queue });
7445
+ this.emit({ type: "queue_changed", threadId: thread.id, queue: removed.queue });
7406
7446
  const next = this.requireThread(thread.id);
7407
7447
  this.emit({ type: "status_changed", threadId: thread.id, status: next.status });
7408
7448
  return next;
@@ -7418,12 +7458,10 @@ var Orchestrator = class {
7418
7458
  const promoted = await withThreadLock(thread.id, async () => {
7419
7459
  const current2 = this.requireThread(thread.id);
7420
7460
  if (index < 0 || index >= current2.queue.length) return false;
7421
- const item = current2.queue[index];
7422
- const rest = current2.queue.filter((_, i) => i !== index);
7423
- const queue = [item, ...rest];
7461
+ const next = moveQueuedItemToFront(current2.queue, current2.queueAttachments, index);
7424
7462
  this.haltDrain.delete(thread.id);
7425
- updateThread(thread.id, { queue });
7426
- this.emit({ type: "queue_changed", threadId: thread.id, queue });
7463
+ updateThread(thread.id, next);
7464
+ this.emit({ type: "queue_changed", threadId: thread.id, queue: next.queue });
7427
7465
  return true;
7428
7466
  });
7429
7467
  if (!promoted) return this.requireThread(thread.id);
@@ -7478,11 +7516,15 @@ var Orchestrator = class {
7478
7516
  }
7479
7517
  continue;
7480
7518
  }
7481
- const prompt = thread.queue[0];
7482
- const remaining = thread.queue.slice(1);
7483
- updateThread(threadId, { queue: remaining });
7484
- this.emit({ type: "queue_changed", threadId, queue: remaining });
7485
- await this.runTurn(threadId, prompt);
7519
+ const shifted = shiftQueuedItem(thread.queue, thread.queueAttachments);
7520
+ if (!shifted) break;
7521
+ updateThread(threadId, {
7522
+ queue: shifted.queue,
7523
+ queueAttachments: shifted.queueAttachments,
7524
+ ...shifted.attachments.length > 0 ? { pendingTurnAttachments: shifted.attachments } : {}
7525
+ });
7526
+ this.emit({ type: "queue_changed", threadId, queue: shifted.queue });
7527
+ await this.runTurn(threadId, shifted.prompt);
7486
7528
  }
7487
7529
  } finally {
7488
7530
  this.draining.delete(threadId);
@@ -7527,6 +7569,7 @@ var Orchestrator = class {
7527
7569
  thread = this.requireThread(threadId);
7528
7570
  }
7529
7571
  const autoContinue = isJobContinuePrompt(prompt) || prompt.trim().startsWith("The previous agent process ended before it finished.");
7572
+ const parkedSnapshot = thread.pendingTurnAttachments ?? [];
7530
7573
  const parked = takePendingTurnAttachments(thread);
7531
7574
  const sentAttachments = !autoContinue && parked.length > 0 ? parked : void 0;
7532
7575
  appendMessage(threadId, {
@@ -7596,7 +7639,10 @@ var Orchestrator = class {
7596
7639
  expandedPrompt
7597
7640
  ].filter(Boolean).join("\n\n");
7598
7641
  if (!autoContinue && sentAttachments) {
7599
- updateThread(threadId, { attachments: [], pendingTurnAttachments: [] });
7642
+ updateThread(
7643
+ threadId,
7644
+ parkedSnapshot.length > 0 ? { pendingTurnAttachments: [] } : { attachments: [], pendingTurnAttachments: [] }
7645
+ );
7600
7646
  }
7601
7647
  const adapter = getAdapter(thread.agent);
7602
7648
  const resolved = await adapter.resolveSessionId(thread.worktreePath, thread.sessionId);
@@ -7611,7 +7657,7 @@ var Orchestrator = class {
7611
7657
  }
7612
7658
  const isBrightsy = fresh.agent === "brightsy";
7613
7659
  const isOrchestration = isOrchestratorThread(fresh);
7614
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-6SZLZNA7.js");
7660
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-XCRNCEEE.js");
7615
7661
  const gitAuthMode = getGithubGitAuthMode();
7616
7662
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
7617
7663
  githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
@@ -8012,7 +8058,7 @@ var Orchestrator = class {
8012
8058
  }
8013
8059
  if (clearQueue && thread.queue.length > 0) {
8014
8060
  this.haltDrain.delete(thread.id);
8015
- updateThread(thread.id, { queue: [] });
8061
+ updateThread(thread.id, { queue: [], queueAttachments: [] });
8016
8062
  this.emit({ type: "queue_changed", threadId: thread.id, queue: [] });
8017
8063
  } else if (!clearQueue && !continueQueue) {
8018
8064
  this.haltDrain.add(thread.id);
@@ -8643,7 +8689,7 @@ var Orchestrator = class {
8643
8689
  if (!titled.userSetTitle && meta.title && titled.title !== meta.title) {
8644
8690
  updateThread(thread.id, { title: meta.title });
8645
8691
  }
8646
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-6SZLZNA7.js");
8692
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-XCRNCEEE.js");
8647
8693
  const latest = this.requireThread(thread.id);
8648
8694
  if (!shouldAutoArchiveOnPrMerge({
8649
8695
  previousPrState: prevState || null,
@@ -8922,7 +8968,7 @@ var Orchestrator = class {
8922
8968
  this.enforceHistoryRetention();
8923
8969
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
8924
8970
  try {
8925
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-2YNYLSPV.js");
8971
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-VIUUE4RT.js");
8926
8972
  await ensureWorkspace2(thread.repoPath);
8927
8973
  } catch {
8928
8974
  }
@@ -8949,7 +8995,7 @@ var Orchestrator = class {
8949
8995
  await runArchiveScript(thread.repoPath, thread.worktreePath);
8950
8996
  } catch {
8951
8997
  }
8952
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-6SZLZNA7.js");
8998
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-XCRNCEEE.js");
8953
8999
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
8954
9000
  await removeWorktree(thread.repoPath, thread.worktreePath, {
8955
9001
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -8976,7 +9022,7 @@ var Orchestrator = class {
8976
9022
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
8977
9023
  );
8978
9024
  }
8979
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-5CPGB4D2.js");
9025
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-3MEG62KB.js");
8980
9026
  const slug = thread.worktreePath.split("/").pop();
8981
9027
  const dest = thread.worktreePath;
8982
9028
  await withRepoGitLock(thread.repoPath, async () => {
@@ -9086,7 +9132,7 @@ async function startOrchestration(opts) {
9086
9132
  sourceRef: "default",
9087
9133
  ...createOpts
9088
9134
  }).catch(async () => {
9089
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-5CPGB4D2.js");
9135
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-3MEG62KB.js");
9090
9136
  const repo = await resolveRepoRoot2(repoPath);
9091
9137
  const def = await resolveDefaultBranch2(repo);
9092
9138
  return orch.createThread({
@@ -9096,7 +9142,7 @@ async function startOrchestration(opts) {
9096
9142
  repoPath: repo
9097
9143
  });
9098
9144
  });
9099
- const { updateThread: upd } = await import("./thread-store-CMZWM5NY.js");
9145
+ const { updateThread: upd } = await import("./thread-store-MSMBQ3V4.js");
9100
9146
  const updated = upd(thread.id, {
9101
9147
  sourceType: "orchestration",
9102
9148
  sourceRef: goal