@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
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_ABLETIME_HOST,
3
3
  normalizeAbleTimeHost
4
- } from "./chunk-5LFD3KCJ.js";
4
+ } from "./chunk-G4TANQC3.js";
5
5
  import {
6
6
  httpFetch
7
7
  } from "./chunk-N7WZ6NIN.js";
@@ -10,7 +10,7 @@ import {
10
10
  getAbleTimeHost,
11
11
  loadAppSettings,
12
12
  saveAbleTimeConnection
13
- } from "./chunk-VJQDUD24.js";
13
+ } from "./chunk-L5CIEBLR.js";
14
14
 
15
15
  // src/integrations/abletime-oauth.ts
16
16
  import { createHash, randomBytes } from "crypto";
@@ -280,7 +280,7 @@ async function startAbleTimeOAuth(opts) {
280
280
  persistAbleTimeTokens(data, { host });
281
281
  const token = data.access_token.trim();
282
282
  try {
283
- const { getAbleTimeOrientation } = await import("./abletime-G3MWSZVM.js");
283
+ const { getAbleTimeOrientation } = await import("./abletime-GDZLZRMY.js");
284
284
  const orientation = await getAbleTimeOrientation({ token, host });
285
285
  return saveAbleTimeConnection({
286
286
  accessToken: token,
@@ -7,10 +7,10 @@ import {
7
7
  import {
8
8
  getGithubGitAuthMode,
9
9
  getGithubPat
10
- } from "./chunk-VJQDUD24.js";
10
+ } from "./chunk-L5CIEBLR.js";
11
11
  import {
12
12
  listThreads
13
- } from "./chunk-OY7THBLG.js";
13
+ } from "./chunk-JJ3ONQ4Q.js";
14
14
  import {
15
15
  worktreesRoot
16
16
  } from "./chunk-WFUDY6PC.js";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  textFromAbleTimeDoc
3
- } from "./chunk-B2RPIHNJ.js";
3
+ } from "./chunk-2M5B7YNY.js";
4
4
  import {
5
5
  assertAbleTimeCredential,
6
6
  callAbleTimeTool,
7
7
  normalizeAbleTimeHost,
8
8
  rewriteAbleTimeError
9
- } from "./chunk-5LFD3KCJ.js";
9
+ } from "./chunk-G4TANQC3.js";
10
10
  import {
11
11
  isAbleTimeConnected,
12
12
  saveAbleTimeConnection
13
- } from "./chunk-VJQDUD24.js";
13
+ } from "./chunk-L5CIEBLR.js";
14
14
 
15
15
  // src/integrations/abletime.ts
16
16
  var CLOSED_STATES = /* @__PURE__ */ new Set([
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-D6JWYJ4P.js";
6
6
  import {
7
7
  listThreads
8
- } from "./chunk-RPZFNKND.js";
8
+ } from "./chunk-GHKFSBES.js";
9
9
  import {
10
10
  ensureWorktreeSideboardIgnored
11
11
  } from "./chunk-SYFVUF2C.js";
@@ -22,7 +22,7 @@ import {
22
22
  import {
23
23
  getGithubGitAuthMode,
24
24
  getGithubPat
25
- } from "./chunk-FUC3XFE2.js";
25
+ } from "./chunk-BTC2D6LS.js";
26
26
  import {
27
27
  worktreesRoot
28
28
  } from "./chunk-EQNRWDLN.js";
@@ -7,7 +7,7 @@ import {
7
7
  resolveRepoRoot,
8
8
  takenSlugsFromThread,
9
9
  teamSlugFromName
10
- } from "./chunk-42VGWRSE.js";
10
+ } from "./chunk-VPQXJYIW.js";
11
11
  import {
12
12
  ATTACHMENTS_DIR,
13
13
  attachmentsGitignoreBody
@@ -17,7 +17,7 @@ import {
17
17
  listThreads,
18
18
  updateThread,
19
19
  writeThread
20
- } from "./chunk-RPZFNKND.js";
20
+ } from "./chunk-GHKFSBES.js";
21
21
  import {
22
22
  assertOrchestratorCapableAgent,
23
23
  formatAccountProfilePlaybookLine,
@@ -30,7 +30,7 @@ import {
30
30
  resolveThreadDefaults,
31
31
  resolveViewerProfile,
32
32
  resolveViewerProfileForRepo
33
- } from "./chunk-FUC3XFE2.js";
33
+ } from "./chunk-BTC2D6LS.js";
34
34
  import {
35
35
  appDataDir,
36
36
  globalAgentCwd,
@@ -6,14 +6,14 @@ import {
6
6
  normalizeAbleTimeCredential,
7
7
  normalizeAbleTimeHost,
8
8
  rewriteAbleTimeError
9
- } from "./chunk-XRIF6M5H.js";
9
+ } from "./chunk-LS6TSOCE.js";
10
10
  import {
11
11
  httpFetch
12
12
  } from "./chunk-VKQGAWHY.js";
13
13
  import {
14
14
  getAbleTimeAccessToken,
15
15
  getAbleTimeHost
16
- } from "./chunk-FUC3XFE2.js";
16
+ } from "./chunk-BTC2D6LS.js";
17
17
 
18
18
  // src/integrations/abletime-rest.ts
19
19
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -9,14 +9,14 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-PTOIWKDU.js";
13
- import "./chunk-42VGWRSE.js";
12
+ } from "./chunk-WNVQJZ7P.js";
13
+ import "./chunk-VPQXJYIW.js";
14
14
  import "./chunk-D6JWYJ4P.js";
15
- import "./chunk-RPZFNKND.js";
15
+ import "./chunk-GHKFSBES.js";
16
16
  import "./chunk-X5B3OS5I.js";
17
17
  import "./chunk-SYFVUF2C.js";
18
18
  import "./chunk-FNQNJOHY.js";
19
- import "./chunk-FUC3XFE2.js";
19
+ import "./chunk-BTC2D6LS.js";
20
20
  import "./chunk-NSTQ6QKD.js";
21
21
  import "./chunk-KGZBYWZ3.js";
22
22
  import "./chunk-EQNRWDLN.js";
@@ -7,15 +7,15 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-TZCWNRMC.js";
11
- import "./chunk-22A45QOI.js";
10
+ } from "./chunk-2PE6SZCM.js";
11
+ import "./chunk-NRKDRQM3.js";
12
12
  import "./chunk-6K64FJDD.js";
13
13
  import "./chunk-QQKDGPUI.js";
14
- import "./chunk-VJQDUD24.js";
14
+ import "./chunk-L5CIEBLR.js";
15
15
  import "./chunk-4TR3HZFT.js";
16
16
  import "./chunk-WDRMZKVB.js";
17
17
  import "./chunk-JT7R45JB.js";
18
- import "./chunk-OY7THBLG.js";
18
+ import "./chunk-JJ3ONQ4Q.js";
19
19
  import "./chunk-7J72QJOM.js";
20
20
  import "./chunk-77WWLBCI.js";
21
21
  import "./chunk-WFUDY6PC.js";
@@ -15,15 +15,15 @@ import {
15
15
  orchestratorSessionPoisonedByBuiltins,
16
16
  slackCoordinatorSourceRef,
17
17
  takenTeamSlugsForOrchestration
18
- } from "./chunk-TZCWNRMC.js";
19
- import "./chunk-22A45QOI.js";
18
+ } from "./chunk-2PE6SZCM.js";
19
+ import "./chunk-NRKDRQM3.js";
20
20
  import "./chunk-6K64FJDD.js";
21
21
  import "./chunk-QQKDGPUI.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";
26
- import "./chunk-OY7THBLG.js";
26
+ import "./chunk-JJ3ONQ4Q.js";
27
27
  import "./chunk-7J72QJOM.js";
28
28
  import "./chunk-77WWLBCI.js";
29
29
  import {
@@ -17,14 +17,14 @@ import {
17
17
  orchestratorSessionPoisonedByBuiltins,
18
18
  slackCoordinatorSourceRef,
19
19
  takenTeamSlugsForOrchestration
20
- } from "./chunk-PTOIWKDU.js";
21
- import "./chunk-42VGWRSE.js";
20
+ } from "./chunk-WNVQJZ7P.js";
21
+ import "./chunk-VPQXJYIW.js";
22
22
  import "./chunk-D6JWYJ4P.js";
23
- import "./chunk-RPZFNKND.js";
23
+ import "./chunk-GHKFSBES.js";
24
24
  import "./chunk-X5B3OS5I.js";
25
25
  import "./chunk-SYFVUF2C.js";
26
26
  import "./chunk-FNQNJOHY.js";
27
- import "./chunk-FUC3XFE2.js";
27
+ import "./chunk-BTC2D6LS.js";
28
28
  import "./chunk-NSTQ6QKD.js";
29
29
  import "./chunk-KGZBYWZ3.js";
30
30
  import {
package/dist/index.cjs CHANGED
@@ -1087,6 +1087,8 @@ function clampHistoryMaxDays(value) {
1087
1087
  return Math.min(HISTORY_MAX_DAYS_MAX, Math.floor(value));
1088
1088
  }
1089
1089
  function archivedUpdatedMs(thread) {
1090
+ const stamped = thread.archivedAt ? Date.parse(thread.archivedAt) : NaN;
1091
+ if (Number.isFinite(stamped)) return stamped;
1090
1092
  const updated = Date.parse(thread.updatedAt);
1091
1093
  if (Number.isFinite(updated)) return updated;
1092
1094
  const created = Date.parse(thread.createdAt);
@@ -3109,6 +3111,7 @@ function normalizeThread(raw) {
3109
3111
  agentPid: raw.agentPid ?? null,
3110
3112
  attachments: Array.isArray(raw.attachments) ? raw.attachments : [],
3111
3113
  pendingTurnAttachments: Array.isArray(raw.pendingTurnAttachments) ? raw.pendingTurnAttachments : [],
3114
+ queueAttachments: Array.isArray(raw.queueAttachments) ? raw.queueAttachments : [],
3112
3115
  prTitle: raw.prTitle ?? null,
3113
3116
  prState: raw.prState ?? null,
3114
3117
  prIsDraft: Boolean(raw.prIsDraft),
@@ -3119,7 +3122,8 @@ function normalizeThread(raw) {
3119
3122
  userSetTitle: Boolean(raw.userSetTitle),
3120
3123
  activeRuns: Array.isArray(raw.activeRuns) ? raw.activeRuns : [],
3121
3124
  quotaResumeAt: raw.quotaResumeAt ?? null,
3122
- quotaContinuedFromId: raw.quotaContinuedFromId ?? null
3125
+ quotaContinuedFromId: raw.quotaContinuedFromId ?? null,
3126
+ archivedAt: typeof raw.archivedAt === "string" && raw.archivedAt.trim() ? raw.archivedAt.trim() : void 0
3123
3127
  };
3124
3128
  }
3125
3129
  function createEmptyThread(partial) {
@@ -3152,8 +3156,10 @@ function createEmptyThread(partial) {
3152
3156
  messages: partial.messages ?? [],
3153
3157
  attachments: partial.attachments ?? [],
3154
3158
  pendingTurnAttachments: partial.pendingTurnAttachments ?? [],
3159
+ queueAttachments: partial.queueAttachments ?? [],
3155
3160
  createdAt: ts,
3156
3161
  updatedAt: ts,
3162
+ archivedAt: typeof partial.archivedAt === "string" && partial.archivedAt.trim() ? partial.archivedAt.trim() : void 0,
3157
3163
  title: partial.title,
3158
3164
  sourceType: partial.sourceType,
3159
3165
  sourceRef: partial.sourceRef,
@@ -3282,6 +3288,11 @@ function updateThread(id, patch) {
3282
3288
  const current = readThread(id);
3283
3289
  if (!current) throw new Error(`Thread not found: ${id}`);
3284
3290
  const next = { ...current, ...patch, id: current.id, updatedAt: nowIso() };
3291
+ if (next.status === "archived") {
3292
+ next.archivedAt = typeof next.archivedAt === "string" && next.archivedAt.trim() || current.archivedAt || nowIso();
3293
+ } else {
3294
+ delete next.archivedAt;
3295
+ }
3285
3296
  writeThread(next);
3286
3297
  return next;
3287
3298
  }
@@ -17230,6 +17241,7 @@ function stripArchivedTranscript(thread) {
17230
17241
  ...thread,
17231
17242
  attachments: [],
17232
17243
  pendingTurnAttachments: [],
17244
+ queueAttachments: [],
17233
17245
  messages: [historyRetentionStubMessage(thread)]
17234
17246
  },
17235
17247
  { touch: false }
@@ -21883,24 +21895,56 @@ var init_expand = __esm({
21883
21895
 
21884
21896
  // src/composer/consume-attachments.ts
21885
21897
  function consumeComposerAttachments(thread) {
21886
- if (thread.attachments.length === 0) {
21887
- return {
21888
- attachments: [],
21889
- pendingTurnAttachments: thread.pendingTurnAttachments ?? []
21890
- };
21891
- }
21892
21898
  return {
21893
21899
  attachments: [],
21894
- pendingTurnAttachments: [
21895
- ...thread.pendingTurnAttachments ?? [],
21896
- ...thread.attachments
21897
- ]
21900
+ consumed: [...thread.attachments]
21898
21901
  };
21899
21902
  }
21900
21903
  function takePendingTurnAttachments(thread) {
21901
21904
  const pending = thread.pendingTurnAttachments ?? [];
21902
- if (pending.length === 0 && thread.attachments.length === 0) return [];
21903
- return [...pending, ...thread.attachments];
21905
+ if (pending.length > 0) return [...pending];
21906
+ return thread.attachments.length > 0 ? [...thread.attachments] : [];
21907
+ }
21908
+ function alignQueueAttachments(queueLength, existing) {
21909
+ const next = (existing ?? []).slice(0, queueLength).map((slot) => [...slot ?? []]);
21910
+ while (next.length < queueLength) next.push([]);
21911
+ return next;
21912
+ }
21913
+ function appendQueuedItem(queue, queueAttachments, prompt, attachments = []) {
21914
+ return {
21915
+ queue: [...queue, prompt],
21916
+ queueAttachments: [...alignQueueAttachments(queue.length, queueAttachments), [...attachments]]
21917
+ };
21918
+ }
21919
+ function prependQueuedItem(queue, queueAttachments, prompt, attachments = []) {
21920
+ return {
21921
+ queue: [prompt, ...queue],
21922
+ queueAttachments: [[...attachments], ...alignQueueAttachments(queue.length, queueAttachments)]
21923
+ };
21924
+ }
21925
+ function removeQueuedItem(queue, queueAttachments, index) {
21926
+ const aligned = alignQueueAttachments(queue.length, queueAttachments);
21927
+ return {
21928
+ queue: queue.filter((_, i) => i !== index),
21929
+ queueAttachments: aligned.filter((_, i) => i !== index)
21930
+ };
21931
+ }
21932
+ function moveQueuedItemToFront(queue, queueAttachments, index) {
21933
+ const aligned = alignQueueAttachments(queue.length, queueAttachments);
21934
+ return {
21935
+ queue: [queue[index], ...queue.filter((_, i) => i !== index)],
21936
+ queueAttachments: [aligned[index] ?? [], ...aligned.filter((_, i) => i !== index)]
21937
+ };
21938
+ }
21939
+ function shiftQueuedItem(queue, queueAttachments) {
21940
+ if (queue.length === 0) return null;
21941
+ const aligned = alignQueueAttachments(queue.length, queueAttachments);
21942
+ return {
21943
+ prompt: queue[0],
21944
+ attachments: aligned[0] ?? [],
21945
+ queue: queue.slice(1),
21946
+ queueAttachments: aligned.slice(1)
21947
+ };
21904
21948
  }
21905
21949
  var init_consume_attachments = __esm({
21906
21950
  "src/composer/consume-attachments.ts"() {
@@ -23237,9 +23281,9 @@ var init_orchestrator = __esm({
23237
23281
  if (!thread || thread.status === "archived") return;
23238
23282
  this.crashContinued.add(threadId);
23239
23283
  const prompt = formatAgentErrorContinuePrompt(opts.detail);
23240
- const queue = [prompt, ...thread.queue];
23241
- updateThread(threadId, { queue });
23242
- this.emit({ type: "queue_changed", threadId, queue });
23284
+ const next = prependQueuedItem(thread.queue, thread.queueAttachments, prompt);
23285
+ updateThread(threadId, next);
23286
+ this.emit({ type: "queue_changed", threadId, queue: next.queue });
23243
23287
  this.haltDrain.delete(threadId);
23244
23288
  }
23245
23289
  /**
@@ -23268,9 +23312,9 @@ var init_orchestrator = __esm({
23268
23312
  }
23269
23313
  if (decision.action === "nudge") this.jobContinueNudged.add(threadId);
23270
23314
  else this.jobContinueCount.set(threadId, (this.jobContinueCount.get(threadId) ?? 0) + 1);
23271
- const queue = [decision.prompt, ...thread.queue];
23272
- updateThread(threadId, { queue });
23273
- this.emit({ type: "queue_changed", threadId, queue });
23315
+ const next = prependQueuedItem(thread.queue, thread.queueAttachments, decision.prompt);
23316
+ updateThread(threadId, next);
23317
+ this.emit({ type: "queue_changed", threadId, queue: next.queue });
23274
23318
  this.haltDrain.delete(threadId);
23275
23319
  }
23276
23320
  getThreads(includeArchived = false) {
@@ -23378,18 +23422,22 @@ var init_orchestrator = __esm({
23378
23422
  throw new Error(`Thread is archived: ${thread.id}`);
23379
23423
  }
23380
23424
  const followUp = resolveSendFollowUp(current, opts?.followUp);
23381
- const queue = [...current.queue, prompt];
23425
+ const consumed = consumeComposerAttachments(current);
23426
+ const queued = appendQueuedItem(
23427
+ current.queue,
23428
+ current.queueAttachments,
23429
+ prompt,
23430
+ consumed.consumed
23431
+ );
23382
23432
  this.crashContinued.delete(thread.id);
23383
23433
  this.jobContinueCount.delete(thread.id);
23384
23434
  this.jobContinueNudged.delete(thread.id);
23385
23435
  this.haltDrain.delete(thread.id);
23386
23436
  const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id) || current.status === "running";
23387
23437
  shouldSteer = followUp === "steer" && (inFlight || current.queue.length > 0);
23388
- const patch = { queue };
23389
- if (current.attachments.length > 0) {
23390
- const consumed = consumeComposerAttachments(current);
23438
+ const patch = queued;
23439
+ if (consumed.consumed.length > 0) {
23391
23440
  patch.attachments = consumed.attachments;
23392
- patch.pendingTurnAttachments = consumed.pendingTurnAttachments;
23393
23441
  }
23394
23442
  if (!inFlight) patch.status = "queued";
23395
23443
  const pid = current.agentPid;
@@ -23397,7 +23445,7 @@ var init_orchestrator = __esm({
23397
23445
  patch.agentPid = null;
23398
23446
  }
23399
23447
  updateThread(thread.id, patch);
23400
- this.emit({ type: "queue_changed", threadId: thread.id, queue });
23448
+ this.emit({ type: "queue_changed", threadId: thread.id, queue: queued.queue });
23401
23449
  if (!inFlight) {
23402
23450
  this.emit({ type: "status_changed", threadId: thread.id, status: "queued" });
23403
23451
  }
@@ -23439,14 +23487,17 @@ var init_orchestrator = __esm({
23439
23487
  return withThreadLock(thread.id, async () => {
23440
23488
  const current = this.requireThread(thread.id);
23441
23489
  if (index < 0 || index >= current.queue.length) return current;
23442
- const queue = current.queue.filter((_, i) => i !== index);
23443
- const stillQueued = queue.length > 0;
23490
+ const removed = removeQueuedItem(current.queue, current.queueAttachments, index);
23491
+ const stillQueued = removed.queue.length > 0;
23444
23492
  const inFlight = this.activeTurns.has(thread.id) || this.startingTurns.has(thread.id);
23445
23493
  updateThread(thread.id, {
23446
- queue,
23494
+ ...removed,
23495
+ // Old sends parked on pendingTurnAttachments; drop that bag when the
23496
+ // follow-up that owned it is gone so a later turn cannot inherit it.
23497
+ ...stillQueued ? {} : { pendingTurnAttachments: [] },
23447
23498
  status: !stillQueued && !inFlight && current.status === "queued" ? "idle" : current.status
23448
23499
  });
23449
- this.emit({ type: "queue_changed", threadId: thread.id, queue });
23500
+ this.emit({ type: "queue_changed", threadId: thread.id, queue: removed.queue });
23450
23501
  const next = this.requireThread(thread.id);
23451
23502
  this.emit({ type: "status_changed", threadId: thread.id, status: next.status });
23452
23503
  return next;
@@ -23462,12 +23513,10 @@ var init_orchestrator = __esm({
23462
23513
  const promoted = await withThreadLock(thread.id, async () => {
23463
23514
  const current2 = this.requireThread(thread.id);
23464
23515
  if (index < 0 || index >= current2.queue.length) return false;
23465
- const item = current2.queue[index];
23466
- const rest = current2.queue.filter((_, i) => i !== index);
23467
- const queue = [item, ...rest];
23516
+ const next = moveQueuedItemToFront(current2.queue, current2.queueAttachments, index);
23468
23517
  this.haltDrain.delete(thread.id);
23469
- updateThread(thread.id, { queue });
23470
- this.emit({ type: "queue_changed", threadId: thread.id, queue });
23518
+ updateThread(thread.id, next);
23519
+ this.emit({ type: "queue_changed", threadId: thread.id, queue: next.queue });
23471
23520
  return true;
23472
23521
  });
23473
23522
  if (!promoted) return this.requireThread(thread.id);
@@ -23522,11 +23571,15 @@ var init_orchestrator = __esm({
23522
23571
  }
23523
23572
  continue;
23524
23573
  }
23525
- const prompt = thread.queue[0];
23526
- const remaining = thread.queue.slice(1);
23527
- updateThread(threadId, { queue: remaining });
23528
- this.emit({ type: "queue_changed", threadId, queue: remaining });
23529
- await this.runTurn(threadId, prompt);
23574
+ const shifted = shiftQueuedItem(thread.queue, thread.queueAttachments);
23575
+ if (!shifted) break;
23576
+ updateThread(threadId, {
23577
+ queue: shifted.queue,
23578
+ queueAttachments: shifted.queueAttachments,
23579
+ ...shifted.attachments.length > 0 ? { pendingTurnAttachments: shifted.attachments } : {}
23580
+ });
23581
+ this.emit({ type: "queue_changed", threadId, queue: shifted.queue });
23582
+ await this.runTurn(threadId, shifted.prompt);
23530
23583
  }
23531
23584
  } finally {
23532
23585
  this.draining.delete(threadId);
@@ -23571,6 +23624,7 @@ var init_orchestrator = __esm({
23571
23624
  thread = this.requireThread(threadId);
23572
23625
  }
23573
23626
  const autoContinue = isJobContinuePrompt(prompt) || prompt.trim().startsWith("The previous agent process ended before it finished.");
23627
+ const parkedSnapshot = thread.pendingTurnAttachments ?? [];
23574
23628
  const parked = takePendingTurnAttachments(thread);
23575
23629
  const sentAttachments = !autoContinue && parked.length > 0 ? parked : void 0;
23576
23630
  appendMessage(threadId, {
@@ -23640,7 +23694,10 @@ var init_orchestrator = __esm({
23640
23694
  expandedPrompt
23641
23695
  ].filter(Boolean).join("\n\n");
23642
23696
  if (!autoContinue && sentAttachments) {
23643
- updateThread(threadId, { attachments: [], pendingTurnAttachments: [] });
23697
+ updateThread(
23698
+ threadId,
23699
+ parkedSnapshot.length > 0 ? { pendingTurnAttachments: [] } : { attachments: [], pendingTurnAttachments: [] }
23700
+ );
23644
23701
  }
23645
23702
  const adapter = getAdapter(thread.agent);
23646
23703
  const resolved = await adapter.resolveSessionId(thread.worktreePath, thread.sessionId);
@@ -24056,7 +24113,7 @@ var init_orchestrator = __esm({
24056
24113
  }
24057
24114
  if (clearQueue && thread.queue.length > 0) {
24058
24115
  this.haltDrain.delete(thread.id);
24059
- updateThread(thread.id, { queue: [] });
24116
+ updateThread(thread.id, { queue: [], queueAttachments: [] });
24060
24117
  this.emit({ type: "queue_changed", threadId: thread.id, queue: [] });
24061
24118
  } else if (!clearQueue && !continueQueue) {
24062
24119
  this.haltDrain.add(thread.id);
@@ -25349,6 +25406,7 @@ __export(index_exports, {
25349
25406
  addWorkspace: () => addWorkspace,
25350
25407
  adoptThread: () => adoptThread,
25351
25408
  agentGitPrompt: () => agentGitPrompt,
25409
+ alignQueueAttachments: () => alignQueueAttachments,
25352
25410
  allAdapters: () => allAdapters,
25353
25411
  allocatePort: () => allocatePort,
25354
25412
  allocatePortRange: () => allocatePortRange,
@@ -25358,6 +25416,7 @@ __export(index_exports, {
25358
25416
  appSettingsPath: () => appSettingsPath,
25359
25417
  appendIndexedGitConfig: () => appendIndexedGitConfig,
25360
25418
  appendMessage: () => appendMessage,
25419
+ appendQueuedItem: () => appendQueuedItem,
25361
25420
  applyAgentEvent: () => applyAgentEvent,
25362
25421
  applyAgentRunnerHeapEnv: () => applyAgentRunnerHeapEnv,
25363
25422
  applyAppEnvironment: () => applyAppEnvironment,
@@ -25800,6 +25859,7 @@ __export(index_exports, {
25800
25859
  mergeUsage: () => mergeUsage,
25801
25860
  messagePartParentId: () => messagePartParentId,
25802
25861
  messagesSinceLastBrightsyContextSummary: () => messagesSinceLastBrightsyContextSummary,
25862
+ moveQueuedItemToFront: () => moveQueuedItemToFront,
25803
25863
  nextPastedTextName: () => nextPastedTextName,
25804
25864
  nextThinkingEffort: () => nextThinkingEffort,
25805
25865
  nonInteractiveGitProcessEnv: () => nonInteractiveGitProcessEnv,
@@ -25854,6 +25914,7 @@ __export(index_exports, {
25854
25914
  posixShellSingleQuote: () => posixShellSingleQuote,
25855
25915
  preferredCursorCostCents: () => preferredCursorCostCents,
25856
25916
  prepareTerminalCommand: () => prepareTerminalCommand,
25917
+ prependQueuedItem: () => prependQueuedItem,
25857
25918
  previewLand: () => previewLand,
25858
25919
  promptMentionsBrightsy: () => promptMentionsBrightsy,
25859
25920
  pushBranch: () => pushBranch,
@@ -25875,6 +25936,7 @@ __export(index_exports, {
25875
25936
  releaseCaffeinateHoldForThread: () => releaseCaffeinateHoldForThread,
25876
25937
  releaseDesktopHost: () => releaseDesktopHost,
25877
25938
  removeBoardPin: () => removeBoardPin,
25939
+ removeQueuedItem: () => removeQueuedItem,
25878
25940
  removeWorkspace: () => removeWorkspace,
25879
25941
  removeWorktree: () => removeWorktree,
25880
25942
  repoSlug: () => repoSlug,
@@ -25958,6 +26020,7 @@ __export(index_exports, {
25958
26020
  setStatus: () => setStatus,
25959
26021
  setVaultMasterKey: () => setVaultMasterKey,
25960
26022
  settingsSourceLabel: () => settingsSourceLabel,
26023
+ shiftQueuedItem: () => shiftQueuedItem,
25961
26024
  shouldAttachPastedText: () => shouldAttachPastedText,
25962
26025
  shouldCompactContext: () => shouldCompactContext,
25963
26026
  shouldInjectBrightsyMcp: () => shouldInjectBrightsyMcp,
@@ -26097,6 +26160,7 @@ function slimThreadForUiList(thread) {
26097
26160
  ...thread,
26098
26161
  attachments: [],
26099
26162
  pendingTurnAttachments: [],
26163
+ queueAttachments: [],
26100
26164
  messages: slimMessagesForUiList(messages, thread.updatedAt)
26101
26165
  };
26102
26166
  }
@@ -34128,6 +34192,7 @@ init_outbound_watch();
34128
34192
  addWorkspace,
34129
34193
  adoptThread,
34130
34194
  agentGitPrompt,
34195
+ alignQueueAttachments,
34131
34196
  allAdapters,
34132
34197
  allocatePort,
34133
34198
  allocatePortRange,
@@ -34137,6 +34202,7 @@ init_outbound_watch();
34137
34202
  appSettingsPath,
34138
34203
  appendIndexedGitConfig,
34139
34204
  appendMessage,
34205
+ appendQueuedItem,
34140
34206
  applyAgentEvent,
34141
34207
  applyAgentRunnerHeapEnv,
34142
34208
  applyAppEnvironment,
@@ -34579,6 +34645,7 @@ init_outbound_watch();
34579
34645
  mergeUsage,
34580
34646
  messagePartParentId,
34581
34647
  messagesSinceLastBrightsyContextSummary,
34648
+ moveQueuedItemToFront,
34582
34649
  nextPastedTextName,
34583
34650
  nextThinkingEffort,
34584
34651
  nonInteractiveGitProcessEnv,
@@ -34633,6 +34700,7 @@ init_outbound_watch();
34633
34700
  posixShellSingleQuote,
34634
34701
  preferredCursorCostCents,
34635
34702
  prepareTerminalCommand,
34703
+ prependQueuedItem,
34636
34704
  previewLand,
34637
34705
  promptMentionsBrightsy,
34638
34706
  pushBranch,
@@ -34654,6 +34722,7 @@ init_outbound_watch();
34654
34722
  releaseCaffeinateHoldForThread,
34655
34723
  releaseDesktopHost,
34656
34724
  removeBoardPin,
34725
+ removeQueuedItem,
34657
34726
  removeWorkspace,
34658
34727
  removeWorktree,
34659
34728
  repoSlug,
@@ -34737,6 +34806,7 @@ init_outbound_watch();
34737
34806
  setStatus,
34738
34807
  setVaultMasterKey,
34739
34808
  settingsSourceLabel,
34809
+ shiftQueuedItem,
34740
34810
  shouldAttachPastedText,
34741
34811
  shouldCompactContext,
34742
34812
  shouldInjectBrightsyMcp,