@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
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  getAbleTimeHost,
6
6
  isAbleTimeConnected
7
- } from "./chunk-VJQDUD24.js";
7
+ } from "./chunk-L5CIEBLR.js";
8
8
 
9
9
  // src/integrations/abletime-mcp.ts
10
10
  var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";
@@ -153,7 +153,7 @@ function textsFromUnknown(value) {
153
153
  return "";
154
154
  }
155
155
  async function abletimeMcpRequest(method, params, opts) {
156
- const rawToken = opts?.token ?? await import("./abletime-oauth-SQD6K47H.js").then((m) => m.ensureAbleTimeAccessToken());
156
+ const rawToken = opts?.token ?? await import("./abletime-oauth-3X3BAPTF.js").then((m) => m.ensureAbleTimeAccessToken());
157
157
  if (!rawToken?.trim()) {
158
158
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
159
159
  }
@@ -224,9 +224,9 @@ async function callAbleTimeTool(name, args = {}, opts) {
224
224
  if (!opts?.token && !isAbleTimeConnected()) {
225
225
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
226
226
  }
227
- const rawToken = opts?.token ?? await import("./abletime-oauth-SQD6K47H.js").then((m) => m.ensureAbleTimeAccessToken());
227
+ const rawToken = opts?.token ?? await import("./abletime-oauth-3X3BAPTF.js").then((m) => m.ensureAbleTimeAccessToken());
228
228
  if (rawToken && ableTimeUsesRest(rawToken)) {
229
- const { callAbleTimeRestTool } = await import("./abletime-rest-BXL7QHCX.js");
229
+ const { callAbleTimeRestTool } = await import("./abletime-rest-PLJVY3H3.js");
230
230
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
231
231
  }
232
232
  const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
@@ -242,7 +242,7 @@ async function callAbleTimeTool(name, args = {}, opts) {
242
242
  return await call();
243
243
  }
244
244
  if (rawToken && ableTimeUsesRest(rawToken) && isAbleTimeRejectedCredential(message)) {
245
- const { callAbleTimeRestTool } = await import("./abletime-rest-BXL7QHCX.js");
245
+ const { callAbleTimeRestTool } = await import("./abletime-rest-PLJVY3H3.js");
246
246
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
247
247
  }
248
248
  throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;
@@ -48,6 +48,7 @@ function normalizeThread(raw) {
48
48
  agentPid: raw.agentPid ?? null,
49
49
  attachments: Array.isArray(raw.attachments) ? raw.attachments : [],
50
50
  pendingTurnAttachments: Array.isArray(raw.pendingTurnAttachments) ? raw.pendingTurnAttachments : [],
51
+ queueAttachments: Array.isArray(raw.queueAttachments) ? raw.queueAttachments : [],
51
52
  prTitle: raw.prTitle ?? null,
52
53
  prState: raw.prState ?? null,
53
54
  prIsDraft: Boolean(raw.prIsDraft),
@@ -58,7 +59,8 @@ function normalizeThread(raw) {
58
59
  userSetTitle: Boolean(raw.userSetTitle),
59
60
  activeRuns: Array.isArray(raw.activeRuns) ? raw.activeRuns : [],
60
61
  quotaResumeAt: raw.quotaResumeAt ?? null,
61
- quotaContinuedFromId: raw.quotaContinuedFromId ?? null
62
+ quotaContinuedFromId: raw.quotaContinuedFromId ?? null,
63
+ archivedAt: typeof raw.archivedAt === "string" && raw.archivedAt.trim() ? raw.archivedAt.trim() : void 0
62
64
  };
63
65
  }
64
66
  function createEmptyThread(partial) {
@@ -91,8 +93,10 @@ function createEmptyThread(partial) {
91
93
  messages: partial.messages ?? [],
92
94
  attachments: partial.attachments ?? [],
93
95
  pendingTurnAttachments: partial.pendingTurnAttachments ?? [],
96
+ queueAttachments: partial.queueAttachments ?? [],
94
97
  createdAt: ts,
95
98
  updatedAt: ts,
99
+ archivedAt: typeof partial.archivedAt === "string" && partial.archivedAt.trim() ? partial.archivedAt.trim() : void 0,
96
100
  title: partial.title,
97
101
  sourceType: partial.sourceType,
98
102
  sourceRef: partial.sourceRef,
@@ -222,6 +226,11 @@ function updateThread(id, patch) {
222
226
  const current = readThread(id);
223
227
  if (!current) throw new Error(`Thread not found: ${id}`);
224
228
  const next = { ...current, ...patch, id: current.id, updatedAt: nowIso() };
229
+ if (next.status === "archived") {
230
+ next.archivedAt = typeof next.archivedAt === "string" && next.archivedAt.trim() || current.archivedAt || nowIso();
231
+ } else {
232
+ delete next.archivedAt;
233
+ }
225
234
  writeThread(next);
226
235
  return next;
227
236
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  isOrchestratorThread
5
- } from "./chunk-PTOIWKDU.js";
5
+ } from "./chunk-WNVQJZ7P.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-42VGWRSE.js";
23
+ } from "./chunk-VPQXJYIW.js";
24
24
  import {
25
25
  enrichPathWithNpmGlobalBin,
26
26
  isConductorBundledCli,
@@ -39,7 +39,7 @@ import {
39
39
  resolveClaudeExecutable,
40
40
  unwrapStrippedElectronLaunch,
41
41
  wrapElectronAsNodeLaunch
42
- } from "./chunk-FUC3XFE2.js";
42
+ } from "./chunk-BTC2D6LS.js";
43
43
  import {
44
44
  appDataDir
45
45
  } from "./chunk-EQNRWDLN.js";
@@ -2414,7 +2414,7 @@ var claudeAdapter = {
2414
2414
  );
2415
2415
  }
2416
2416
  const mode = permissionMode(thread);
2417
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-H2ANUSGR.js");
2417
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-RHABXQWB.js");
2418
2418
  const isOrchestrator = isOrchestratorThread2(thread);
2419
2419
  const injectedServers = await buildInjectedMcpServers({
2420
2420
  includeSideboard: true,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  isOrchestratorThread
3
- } from "./chunk-TZCWNRMC.js";
3
+ } from "./chunk-2PE6SZCM.js";
4
4
  import {
5
5
  codexUnattendedGitConfigArgs,
6
6
  mergeAgentGitAuthEnv,
7
7
  resolveAgentGitAuthEnv,
8
8
  resolveCodexGitWritableRoots
9
- } from "./chunk-22A45QOI.js";
9
+ } from "./chunk-NRKDRQM3.js";
10
10
  import {
11
11
  applyConnectedTeamToCli,
12
12
  brightsyMcpServerName,
@@ -42,7 +42,7 @@ import {
42
42
  loadAppSettings,
43
43
  resolveAgentExecutable,
44
44
  resolveClaudeExecutable
45
- } from "./chunk-VJQDUD24.js";
45
+ } from "./chunk-L5CIEBLR.js";
46
46
  import {
47
47
  isElectronLikeCommand,
48
48
  unwrapStrippedElectronLaunch
@@ -1903,7 +1903,7 @@ var claudeAdapter = {
1903
1903
  );
1904
1904
  }
1905
1905
  const mode = permissionMode(thread);
1906
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-JEKMVE42.js");
1906
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-NG2TBUI5.js");
1907
1907
  const isOrchestrator = isOrchestratorThread2(thread);
1908
1908
  const injectedServers = await buildInjectedMcpServers({
1909
1909
  includeSideboard: true,
@@ -46,6 +46,7 @@ function normalizeThread(raw) {
46
46
  agentPid: raw.agentPid ?? null,
47
47
  attachments: Array.isArray(raw.attachments) ? raw.attachments : [],
48
48
  pendingTurnAttachments: Array.isArray(raw.pendingTurnAttachments) ? raw.pendingTurnAttachments : [],
49
+ queueAttachments: Array.isArray(raw.queueAttachments) ? raw.queueAttachments : [],
49
50
  prTitle: raw.prTitle ?? null,
50
51
  prState: raw.prState ?? null,
51
52
  prIsDraft: Boolean(raw.prIsDraft),
@@ -56,7 +57,8 @@ function normalizeThread(raw) {
56
57
  userSetTitle: Boolean(raw.userSetTitle),
57
58
  activeRuns: Array.isArray(raw.activeRuns) ? raw.activeRuns : [],
58
59
  quotaResumeAt: raw.quotaResumeAt ?? null,
59
- quotaContinuedFromId: raw.quotaContinuedFromId ?? null
60
+ quotaContinuedFromId: raw.quotaContinuedFromId ?? null,
61
+ archivedAt: typeof raw.archivedAt === "string" && raw.archivedAt.trim() ? raw.archivedAt.trim() : void 0
60
62
  };
61
63
  }
62
64
  function createEmptyThread(partial) {
@@ -89,8 +91,10 @@ function createEmptyThread(partial) {
89
91
  messages: partial.messages ?? [],
90
92
  attachments: partial.attachments ?? [],
91
93
  pendingTurnAttachments: partial.pendingTurnAttachments ?? [],
94
+ queueAttachments: partial.queueAttachments ?? [],
92
95
  createdAt: ts,
93
96
  updatedAt: ts,
97
+ archivedAt: typeof partial.archivedAt === "string" && partial.archivedAt.trim() ? partial.archivedAt.trim() : void 0,
94
98
  title: partial.title,
95
99
  sourceType: partial.sourceType,
96
100
  sourceRef: partial.sourceRef,
@@ -220,6 +224,11 @@ function updateThread(id, patch) {
220
224
  const current = readThread(id);
221
225
  if (!current) throw new Error(`Thread not found: ${id}`);
222
226
  const next = { ...current, ...patch, id: current.id, updatedAt: nowIso() };
227
+ if (next.status === "archived") {
228
+ next.archivedAt = typeof next.archivedAt === "string" && next.archivedAt.trim() || current.archivedAt || nowIso();
229
+ } else {
230
+ delete next.archivedAt;
231
+ }
223
232
  writeThread(next);
224
233
  return next;
225
234
  }
@@ -24,7 +24,7 @@ import {
24
24
  resolveQuotaFallbackAgent,
25
25
  stripBrightsyNdjsonNoise,
26
26
  toolDescription
27
- } from "./chunk-KJAHVQL6.js";
27
+ } from "./chunk-IRCAWYTN.js";
28
28
  import {
29
29
  SLACK_REPLY_FORMATTING,
30
30
  addWorkspace,
@@ -47,7 +47,7 @@ import {
47
47
  stageAbsolutePathsAsAttachments,
48
48
  stageBuffersAsAttachments,
49
49
  syncWorkspacesFromThreads
50
- } from "./chunk-TZCWNRMC.js";
50
+ } from "./chunk-2PE6SZCM.js";
51
51
  import {
52
52
  addPrStackLayer,
53
53
  allocateTeamName,
@@ -97,7 +97,7 @@ import {
97
97
  worktreeDisplayLabelForGroup,
98
98
  worktreeNameFromPath,
99
99
  worktreeSlugForTicket
100
- } from "./chunk-22A45QOI.js";
100
+ } from "./chunk-NRKDRQM3.js";
101
101
  import {
102
102
  ATTACHMENTS_DIR,
103
103
  DETACHED_JOBS_DIR,
@@ -164,7 +164,7 @@ import {
164
164
  updateAdvancedSettings,
165
165
  usageOnLimit,
166
166
  writeSecureJson
167
- } from "./chunk-VJQDUD24.js";
167
+ } from "./chunk-L5CIEBLR.js";
168
168
  import {
169
169
  stripNestedElectronEnv
170
170
  } from "./chunk-4TR3HZFT.js";
@@ -189,7 +189,7 @@ import {
189
189
  updateThread,
190
190
  withThreadLock,
191
191
  writeThread
192
- } from "./chunk-OY7THBLG.js";
192
+ } from "./chunk-JJ3ONQ4Q.js";
193
193
  import {
194
194
  appDataDir,
195
195
  findConventionSetup,
@@ -483,7 +483,7 @@ async function continueSourceThread(threadId, prompt) {
483
483
  await continueOnReply(threadId, prompt);
484
484
  return;
485
485
  }
486
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-N7LLTK5O.js");
486
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-QMGH4V4K.js");
487
487
  await getOrchestrator2().send(threadId, prompt);
488
488
  } catch {
489
489
  }
@@ -817,9 +817,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
817
817
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
818
818
  );
819
819
  }
820
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-JEKMVE42.js");
820
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-NG2TBUI5.js");
821
821
  if (isGlobalThread2(thread)) {
822
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-EO2X2EYW.js");
822
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-LMTMWCPN.js");
823
823
  ensureGlobalCoordinatorCwd2(
824
824
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
825
825
  );
@@ -2606,6 +2606,7 @@ function stripArchivedTranscript(thread) {
2606
2606
  ...thread,
2607
2607
  attachments: [],
2608
2608
  pendingTurnAttachments: [],
2609
+ queueAttachments: [],
2609
2610
  messages: [historyRetentionStubMessage(thread)]
2610
2611
  },
2611
2612
  { touch: false }
@@ -3878,7 +3879,7 @@ async function createThread(input, _onSetupLine) {
3878
3879
  });
3879
3880
  await requireAgent(resolved.agent);
3880
3881
  if (input.cowboy) {
3881
- const { cowboyModeEnabled } = await import("./app-settings-VBQHGX5Z.js");
3882
+ const { cowboyModeEnabled } = await import("./app-settings-2TN3WLZV.js");
3882
3883
  if (!cowboyModeEnabled()) {
3883
3884
  throw new Error(
3884
3885
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3936,7 +3937,7 @@ async function createThread(input, _onSetupLine) {
3936
3937
  let sourceIsFork = false;
3937
3938
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3938
3939
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3939
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-G3MWSZVM.js");
3940
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-GDZLZRMY.js");
3940
3941
  const task = await ensureAbleTimeTask({
3941
3942
  title: title?.trim() || "Untitled work",
3942
3943
  description: input.prompt?.trim() || void 0
@@ -4038,7 +4039,7 @@ async function createThread(input, _onSetupLine) {
4038
4039
  return readThread(thread.id) ?? thread;
4039
4040
  }
4040
4041
  async function listLinearIssues(agent, repoPath) {
4041
- const { getAdapter: getAdapter2 } = await import("./agents-U2NVCYGC.js");
4042
+ const { getAdapter: getAdapter2 } = await import("./agents-GQANI7M5.js");
4042
4043
  await requireAgent(agent, { requireLinear: true });
4043
4044
  const adapter = getAdapter2(agent);
4044
4045
  if (!adapter.listLinearIssues) {
@@ -4484,7 +4485,7 @@ async function adoptThread(input) {
4484
4485
  messages: input.messages ?? []
4485
4486
  });
4486
4487
  writeThread(thread);
4487
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-SVDORZEI.js");
4488
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-FRR6Y4BY.js");
4488
4489
  await ensureWorkspace2(repoPath);
4489
4490
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-X54WSOXM.js");
4490
4491
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -6244,24 +6245,56 @@ function expandComposerPrompt(worktreePath, prompt, opts) {
6244
6245
 
6245
6246
  // src/composer/consume-attachments.ts
6246
6247
  function consumeComposerAttachments(thread) {
6247
- if (thread.attachments.length === 0) {
6248
- return {
6249
- attachments: [],
6250
- pendingTurnAttachments: thread.pendingTurnAttachments ?? []
6251
- };
6252
- }
6253
6248
  return {
6254
6249
  attachments: [],
6255
- pendingTurnAttachments: [
6256
- ...thread.pendingTurnAttachments ?? [],
6257
- ...thread.attachments
6258
- ]
6250
+ consumed: [...thread.attachments]
6259
6251
  };
6260
6252
  }
6261
6253
  function takePendingTurnAttachments(thread) {
6262
6254
  const pending = thread.pendingTurnAttachments ?? [];
6263
- if (pending.length === 0 && thread.attachments.length === 0) return [];
6264
- return [...pending, ...thread.attachments];
6255
+ if (pending.length > 0) return [...pending];
6256
+ return thread.attachments.length > 0 ? [...thread.attachments] : [];
6257
+ }
6258
+ function alignQueueAttachments(queueLength, existing) {
6259
+ const next = (existing ?? []).slice(0, queueLength).map((slot) => [...slot ?? []]);
6260
+ while (next.length < queueLength) next.push([]);
6261
+ return next;
6262
+ }
6263
+ function appendQueuedItem(queue, queueAttachments, prompt, attachments = []) {
6264
+ return {
6265
+ queue: [...queue, prompt],
6266
+ queueAttachments: [...alignQueueAttachments(queue.length, queueAttachments), [...attachments]]
6267
+ };
6268
+ }
6269
+ function prependQueuedItem(queue, queueAttachments, prompt, attachments = []) {
6270
+ return {
6271
+ queue: [prompt, ...queue],
6272
+ queueAttachments: [[...attachments], ...alignQueueAttachments(queue.length, queueAttachments)]
6273
+ };
6274
+ }
6275
+ function removeQueuedItem(queue, queueAttachments, index) {
6276
+ const aligned = alignQueueAttachments(queue.length, queueAttachments);
6277
+ return {
6278
+ queue: queue.filter((_, i) => i !== index),
6279
+ queueAttachments: aligned.filter((_, i) => i !== index)
6280
+ };
6281
+ }
6282
+ function moveQueuedItemToFront(queue, queueAttachments, index) {
6283
+ const aligned = alignQueueAttachments(queue.length, queueAttachments);
6284
+ return {
6285
+ queue: [queue[index], ...queue.filter((_, i) => i !== index)],
6286
+ queueAttachments: [aligned[index] ?? [], ...aligned.filter((_, i) => i !== index)]
6287
+ };
6288
+ }
6289
+ function shiftQueuedItem(queue, queueAttachments) {
6290
+ if (queue.length === 0) return null;
6291
+ const aligned = alignQueueAttachments(queue.length, queueAttachments);
6292
+ return {
6293
+ prompt: queue[0],
6294
+ attachments: aligned[0] ?? [],
6295
+ queue: queue.slice(1),
6296
+ queueAttachments: aligned.slice(1)
6297
+ };
6265
6298
  }
6266
6299
 
6267
6300
  // src/agents/instructions.ts
@@ -7090,7 +7123,7 @@ function formatScheduledPrompt(name, prompt) {
7090
7123
  ${prompt}`;
7091
7124
  }
7092
7125
  async function defaultDeps() {
7093
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-N7LLTK5O.js");
7126
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-QMGH4V4K.js");
7094
7127
  const orch = getOrchestrator2();
7095
7128
  return {
7096
7129
  findThread: (id) => findThreadByRef(id),
@@ -7360,7 +7393,7 @@ var Orchestrator = class {
7360
7393
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
7361
7394
  });
7362
7395
  }
7363
- const { autoCleanupOrphansEnabled } = await import("./app-settings-VBQHGX5Z.js");
7396
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-2TN3WLZV.js");
7364
7397
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
7365
7398
  await cleanupOrphanWorktrees({ repoPaths });
7366
7399
  }
@@ -7570,9 +7603,9 @@ var Orchestrator = class {
7570
7603
  if (!thread || thread.status === "archived") return;
7571
7604
  this.crashContinued.add(threadId);
7572
7605
  const prompt = formatAgentErrorContinuePrompt(opts.detail);
7573
- const queue = [prompt, ...thread.queue];
7574
- updateThread(threadId, { queue });
7575
- this.emit({ type: "queue_changed", threadId, queue });
7606
+ const next = prependQueuedItem(thread.queue, thread.queueAttachments, prompt);
7607
+ updateThread(threadId, next);
7608
+ this.emit({ type: "queue_changed", threadId, queue: next.queue });
7576
7609
  this.haltDrain.delete(threadId);
7577
7610
  }
7578
7611
  /**
@@ -7601,9 +7634,9 @@ var Orchestrator = class {
7601
7634
  }
7602
7635
  if (decision.action === "nudge") this.jobContinueNudged.add(threadId);
7603
7636
  else this.jobContinueCount.set(threadId, (this.jobContinueCount.get(threadId) ?? 0) + 1);
7604
- const queue = [decision.prompt, ...thread.queue];
7605
- updateThread(threadId, { queue });
7606
- this.emit({ type: "queue_changed", threadId, queue });
7637
+ const next = prependQueuedItem(thread.queue, thread.queueAttachments, decision.prompt);
7638
+ updateThread(threadId, next);
7639
+ this.emit({ type: "queue_changed", threadId, queue: next.queue });
7607
7640
  this.haltDrain.delete(threadId);
7608
7641
  }
7609
7642
  getThreads(includeArchived = false) {
@@ -7658,7 +7691,7 @@ var Orchestrator = class {
7658
7691
  }
7659
7692
  await setup;
7660
7693
  if (skipSetup) return;
7661
- const { autoRunAfterSetupEnabled } = await import("./app-settings-VBQHGX5Z.js");
7694
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-2TN3WLZV.js");
7662
7695
  if (autoRunAfterSetupEnabled()) {
7663
7696
  try {
7664
7697
  await this.startDev(threadId);
@@ -7711,18 +7744,22 @@ var Orchestrator = class {
7711
7744
  throw new Error(`Thread is archived: ${thread.id}`);
7712
7745
  }
7713
7746
  const followUp = resolveSendFollowUp(current, opts?.followUp);
7714
- const queue = [...current.queue, prompt];
7747
+ const consumed = consumeComposerAttachments(current);
7748
+ const queued = appendQueuedItem(
7749
+ current.queue,
7750
+ current.queueAttachments,
7751
+ prompt,
7752
+ consumed.consumed
7753
+ );
7715
7754
  this.crashContinued.delete(thread.id);
7716
7755
  this.jobContinueCount.delete(thread.id);
7717
7756
  this.jobContinueNudged.delete(thread.id);
7718
7757
  this.haltDrain.delete(thread.id);
7719
7758
  const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id) || current.status === "running";
7720
7759
  shouldSteer = followUp === "steer" && (inFlight || current.queue.length > 0);
7721
- const patch = { queue };
7722
- if (current.attachments.length > 0) {
7723
- const consumed = consumeComposerAttachments(current);
7760
+ const patch = queued;
7761
+ if (consumed.consumed.length > 0) {
7724
7762
  patch.attachments = consumed.attachments;
7725
- patch.pendingTurnAttachments = consumed.pendingTurnAttachments;
7726
7763
  }
7727
7764
  if (!inFlight) patch.status = "queued";
7728
7765
  const pid = current.agentPid;
@@ -7730,7 +7767,7 @@ var Orchestrator = class {
7730
7767
  patch.agentPid = null;
7731
7768
  }
7732
7769
  updateThread(thread.id, patch);
7733
- this.emit({ type: "queue_changed", threadId: thread.id, queue });
7770
+ this.emit({ type: "queue_changed", threadId: thread.id, queue: queued.queue });
7734
7771
  if (!inFlight) {
7735
7772
  this.emit({ type: "status_changed", threadId: thread.id, status: "queued" });
7736
7773
  }
@@ -7772,14 +7809,17 @@ var Orchestrator = class {
7772
7809
  return withThreadLock(thread.id, async () => {
7773
7810
  const current = this.requireThread(thread.id);
7774
7811
  if (index < 0 || index >= current.queue.length) return current;
7775
- const queue = current.queue.filter((_, i) => i !== index);
7776
- const stillQueued = queue.length > 0;
7812
+ const removed = removeQueuedItem(current.queue, current.queueAttachments, index);
7813
+ const stillQueued = removed.queue.length > 0;
7777
7814
  const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id);
7778
7815
  updateThread(thread.id, {
7779
- queue,
7816
+ ...removed,
7817
+ // Old sends parked on pendingTurnAttachments; drop that bag when the
7818
+ // follow-up that owned it is gone so a later turn cannot inherit it.
7819
+ ...stillQueued ? {} : { pendingTurnAttachments: [] },
7780
7820
  status: !stillQueued && !inFlight && current.status === "queued" ? "idle" : current.status
7781
7821
  });
7782
- this.emit({ type: "queue_changed", threadId: thread.id, queue });
7822
+ this.emit({ type: "queue_changed", threadId: thread.id, queue: removed.queue });
7783
7823
  const next = this.requireThread(thread.id);
7784
7824
  this.emit({ type: "status_changed", threadId: thread.id, status: next.status });
7785
7825
  return next;
@@ -7795,12 +7835,10 @@ var Orchestrator = class {
7795
7835
  const promoted = await withThreadLock(thread.id, async () => {
7796
7836
  const current2 = this.requireThread(thread.id);
7797
7837
  if (index < 0 || index >= current2.queue.length) return false;
7798
- const item = current2.queue[index];
7799
- const rest = current2.queue.filter((_, i) => i !== index);
7800
- const queue = [item, ...rest];
7838
+ const next = moveQueuedItemToFront(current2.queue, current2.queueAttachments, index);
7801
7839
  this.haltDrain.delete(thread.id);
7802
- updateThread(thread.id, { queue });
7803
- this.emit({ type: "queue_changed", threadId: thread.id, queue });
7840
+ updateThread(thread.id, next);
7841
+ this.emit({ type: "queue_changed", threadId: thread.id, queue: next.queue });
7804
7842
  return true;
7805
7843
  });
7806
7844
  if (!promoted) return this.requireThread(thread.id);
@@ -7855,11 +7893,15 @@ var Orchestrator = class {
7855
7893
  }
7856
7894
  continue;
7857
7895
  }
7858
- const prompt = thread.queue[0];
7859
- const remaining = thread.queue.slice(1);
7860
- updateThread(threadId, { queue: remaining });
7861
- this.emit({ type: "queue_changed", threadId, queue: remaining });
7862
- await this.runTurn(threadId, prompt);
7896
+ const shifted = shiftQueuedItem(thread.queue, thread.queueAttachments);
7897
+ if (!shifted) break;
7898
+ updateThread(threadId, {
7899
+ queue: shifted.queue,
7900
+ queueAttachments: shifted.queueAttachments,
7901
+ ...shifted.attachments.length > 0 ? { pendingTurnAttachments: shifted.attachments } : {}
7902
+ });
7903
+ this.emit({ type: "queue_changed", threadId, queue: shifted.queue });
7904
+ await this.runTurn(threadId, shifted.prompt);
7863
7905
  }
7864
7906
  } finally {
7865
7907
  this.draining.delete(threadId);
@@ -7904,6 +7946,7 @@ var Orchestrator = class {
7904
7946
  thread = this.requireThread(threadId);
7905
7947
  }
7906
7948
  const autoContinue = isJobContinuePrompt(prompt) || prompt.trim().startsWith("The previous agent process ended before it finished.");
7949
+ const parkedSnapshot = thread.pendingTurnAttachments ?? [];
7907
7950
  const parked = takePendingTurnAttachments(thread);
7908
7951
  const sentAttachments = !autoContinue && parked.length > 0 ? parked : void 0;
7909
7952
  appendMessage(threadId, {
@@ -7973,7 +8016,10 @@ var Orchestrator = class {
7973
8016
  expandedPrompt
7974
8017
  ].filter(Boolean).join("\n\n");
7975
8018
  if (!autoContinue && sentAttachments) {
7976
- updateThread(threadId, { attachments: [], pendingTurnAttachments: [] });
8019
+ updateThread(
8020
+ threadId,
8021
+ parkedSnapshot.length > 0 ? { pendingTurnAttachments: [] } : { attachments: [], pendingTurnAttachments: [] }
8022
+ );
7977
8023
  }
7978
8024
  const adapter = getAdapter(thread.agent);
7979
8025
  const resolved = await adapter.resolveSessionId(thread.worktreePath, thread.sessionId);
@@ -7988,7 +8034,7 @@ var Orchestrator = class {
7988
8034
  }
7989
8035
  const isBrightsy = fresh.agent === "brightsy";
7990
8036
  const isOrchestration = isOrchestratorThread(fresh);
7991
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-VBQHGX5Z.js");
8037
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-2TN3WLZV.js");
7992
8038
  const gitAuthMode = getGithubGitAuthMode();
7993
8039
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
7994
8040
  githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
@@ -8389,7 +8435,7 @@ var Orchestrator = class {
8389
8435
  }
8390
8436
  if (clearQueue && thread.queue.length > 0) {
8391
8437
  this.haltDrain.delete(thread.id);
8392
- updateThread(thread.id, { queue: [] });
8438
+ updateThread(thread.id, { queue: [], queueAttachments: [] });
8393
8439
  this.emit({ type: "queue_changed", threadId: thread.id, queue: [] });
8394
8440
  } else if (!clearQueue && !continueQueue) {
8395
8441
  this.haltDrain.add(thread.id);
@@ -9020,7 +9066,7 @@ var Orchestrator = class {
9020
9066
  if (!titled.userSetTitle && meta.title && titled.title !== meta.title) {
9021
9067
  updateThread(thread.id, { title: meta.title });
9022
9068
  }
9023
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-VBQHGX5Z.js");
9069
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-2TN3WLZV.js");
9024
9070
  const latest = this.requireThread(thread.id);
9025
9071
  if (!shouldAutoArchiveOnPrMerge({
9026
9072
  previousPrState: prevState || null,
@@ -9299,7 +9345,7 @@ var Orchestrator = class {
9299
9345
  this.enforceHistoryRetention();
9300
9346
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
9301
9347
  try {
9302
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-SVDORZEI.js");
9348
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-FRR6Y4BY.js");
9303
9349
  await ensureWorkspace2(thread.repoPath);
9304
9350
  } catch {
9305
9351
  }
@@ -9326,7 +9372,7 @@ var Orchestrator = class {
9326
9372
  await runArchiveScript(thread.repoPath, thread.worktreePath);
9327
9373
  } catch {
9328
9374
  }
9329
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-VBQHGX5Z.js");
9375
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-2TN3WLZV.js");
9330
9376
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
9331
9377
  await removeWorktree(thread.repoPath, thread.worktreePath, {
9332
9378
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -9353,7 +9399,7 @@ var Orchestrator = class {
9353
9399
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
9354
9400
  );
9355
9401
  }
9356
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-YQ6XUSR2.js");
9402
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-GKUOHXXB.js");
9357
9403
  const slug = thread.worktreePath.split("/").pop();
9358
9404
  const dest = thread.worktreePath;
9359
9405
  await withRepoGitLock(thread.repoPath, async () => {
@@ -9463,7 +9509,7 @@ async function startOrchestration(opts) {
9463
9509
  sourceRef: "default",
9464
9510
  ...createOpts
9465
9511
  }).catch(async () => {
9466
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-YQ6XUSR2.js");
9512
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-GKUOHXXB.js");
9467
9513
  const repo = await resolveRepoRoot2(repoPath);
9468
9514
  const def = await resolveDefaultBranch2(repo);
9469
9515
  return orch.createThread({
@@ -9473,7 +9519,7 @@ async function startOrchestration(opts) {
9473
9519
  repoPath: repo
9474
9520
  });
9475
9521
  });
9476
- const { updateThread: upd } = await import("./thread-store-55X2JYDT.js");
9522
+ const { updateThread: upd } = await import("./thread-store-4M6WETL6.js");
9477
9523
  const updated = upd(thread.id, {
9478
9524
  sourceType: "orchestration",
9479
9525
  sourceRef: goal
@@ -9690,6 +9736,12 @@ export {
9690
9736
  expandComposerPrompt,
9691
9737
  consumeComposerAttachments,
9692
9738
  takePendingTurnAttachments,
9739
+ alignQueueAttachments,
9740
+ appendQueuedItem,
9741
+ prependQueuedItem,
9742
+ removeQueuedItem,
9743
+ moveQueuedItemToFront,
9744
+ shiftQueuedItem,
9693
9745
  packagedDetachedJobPath,
9694
9746
  resolveDetachedJobScript,
9695
9747
  formatDetachedJobInvoke,
@@ -453,6 +453,8 @@ function clampHistoryMaxDays(value) {
453
453
  return Math.min(HISTORY_MAX_DAYS_MAX, Math.floor(value));
454
454
  }
455
455
  function archivedUpdatedMs(thread) {
456
+ const stamped = thread.archivedAt ? Date.parse(thread.archivedAt) : NaN;
457
+ if (Number.isFinite(stamped)) return stamped;
456
458
  const updated = Date.parse(thread.updatedAt);
457
459
  if (Number.isFinite(updated)) return updated;
458
460
  const created = Date.parse(thread.createdAt);
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  getAbleTimeHost,
8
8
  isAbleTimeConnected
9
- } from "./chunk-FUC3XFE2.js";
9
+ } from "./chunk-BTC2D6LS.js";
10
10
 
11
11
  // src/integrations/abletime-mcp.ts
12
12
  var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";
@@ -155,7 +155,7 @@ function textsFromUnknown(value) {
155
155
  return "";
156
156
  }
157
157
  async function abletimeMcpRequest(method, params, opts) {
158
- const rawToken = opts?.token ?? await import("./abletime-oauth-7AOE4KJL.js").then((m) => m.ensureAbleTimeAccessToken());
158
+ const rawToken = opts?.token ?? await import("./abletime-oauth-F335TWKY.js").then((m) => m.ensureAbleTimeAccessToken());
159
159
  if (!rawToken?.trim()) {
160
160
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
161
161
  }
@@ -226,9 +226,9 @@ async function callAbleTimeTool(name, args = {}, opts) {
226
226
  if (!opts?.token && !isAbleTimeConnected()) {
227
227
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
228
228
  }
229
- const rawToken = opts?.token ?? await import("./abletime-oauth-7AOE4KJL.js").then((m) => m.ensureAbleTimeAccessToken());
229
+ const rawToken = opts?.token ?? await import("./abletime-oauth-F335TWKY.js").then((m) => m.ensureAbleTimeAccessToken());
230
230
  if (rawToken && ableTimeUsesRest(rawToken)) {
231
- const { callAbleTimeRestTool } = await import("./abletime-rest-QRTJH42S.js");
231
+ const { callAbleTimeRestTool } = await import("./abletime-rest-LAGTPAJL.js");
232
232
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
233
233
  }
234
234
  const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
@@ -244,7 +244,7 @@ async function callAbleTimeTool(name, args = {}, opts) {
244
244
  return await call();
245
245
  }
246
246
  if (rawToken && ableTimeUsesRest(rawToken) && isAbleTimeRejectedCredential(message)) {
247
- const { callAbleTimeRestTool } = await import("./abletime-rest-QRTJH42S.js");
247
+ const { callAbleTimeRestTool } = await import("./abletime-rest-LAGTPAJL.js");
248
248
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
249
249
  }
250
250
  throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;