@sideboard-ai/core 0.1.208 → 0.1.210

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 (51) hide show
  1. package/dist/{abletime-I4IYZBKU.js → abletime-GDZLZRMY.js} +4 -4
  2. package/dist/{abletime-UWSSLXH3.js → abletime-QGGYL2G4.js} +4 -4
  3. package/dist/{abletime-oauth-C3BQXKW3.js → abletime-oauth-3X3BAPTF.js} +3 -3
  4. package/dist/{abletime-oauth-UZHPB3W2.js → abletime-oauth-F335TWKY.js} +3 -3
  5. package/dist/{abletime-rest-HYNYDYK3.js → abletime-rest-LAGTPAJL.js} +3 -3
  6. package/dist/{abletime-rest-5YPPEOKK.js → abletime-rest-PLJVY3H3.js} +3 -3
  7. package/dist/agents/cursor-runner.js +3 -3
  8. package/dist/{agents-QHQXR55O.js → agents-G3TFVFBQ.js} +6 -5
  9. package/dist/{agents-CCS5IEBV.js → agents-IQZUN47D.js} +6 -5
  10. package/dist/{app-settings-GJ6KDYEF.js → app-settings-2TN3WLZV.js} +7 -1
  11. package/dist/{app-settings-R2KNCT37.js → app-settings-XCRNCEEE.js} +7 -1
  12. package/dist/{chunk-F4LZUEIO.js → chunk-2M5B7YNY.js} +2 -2
  13. package/dist/{chunk-C6ZNQV5W.js → chunk-2R6BZRRB.js} +117 -25
  14. package/dist/{chunk-HA4EZKFY.js → chunk-3S2LDD2F.js} +3 -3
  15. package/dist/{chunk-6YZLSZLK.js → chunk-42IULNIY.js} +3 -3
  16. package/dist/{chunk-C5MNMITQ.js → chunk-AOQZZA3M.js} +119 -25
  17. package/dist/{chunk-4EGK47WV.js → chunk-BTC2D6LS.js} +217 -0
  18. package/dist/{chunk-7DKX5JLT.js → chunk-FGTPRMPS.js} +18 -3
  19. package/dist/{chunk-X45BV4VX.js → chunk-G4TANQC3.js} +5 -5
  20. package/dist/{chunk-Y4CF7LHH.js → chunk-L5CIEBLR.js} +232 -0
  21. package/dist/{chunk-WXWJ5MJ4.js → chunk-LS6TSOCE.js} +5 -5
  22. package/dist/{chunk-6J4OQ6TF.js → chunk-MN6YUD4O.js} +3 -3
  23. package/dist/{chunk-7PEIIN7P.js → chunk-NDE5RKZP.js} +24 -87
  24. package/dist/{chunk-W6X4GZJG.js → chunk-REZRGCKV.js} +3 -3
  25. package/dist/{chunk-NJ2CCLV6.js → chunk-WX4S775K.js} +2 -2
  26. package/dist/chunk-X5B3OS5I.js +34 -0
  27. package/dist/{chunk-ZHCB4CKR.js → chunk-X5PUFYDJ.js} +18 -3
  28. package/dist/{chunk-TEDEVD4O.js → chunk-YVE4PXCJ.js} +2 -2
  29. package/dist/{chunk-A6SOSLUV.js → chunk-YYELAUKP.js} +24 -94
  30. package/dist/{chunk-DNTPX6HV.js → chunk-ZC664YBJ.js} +3 -3
  31. package/dist/{chunk-OP6CFVTB.js → chunk-ZZNZX2QW.js} +2 -2
  32. package/dist/{coordinator-prompt-WOTJQMD5.js → coordinator-prompt-GCITY3Q5.js} +5 -4
  33. package/dist/{coordinator-prompt-TUHB6ZFA.js → coordinator-prompt-PONGPWIP.js} +5 -4
  34. package/dist/{cursor-recover-TXVTLAMA.js → cursor-recover-4PQAADAU.js} +3 -28
  35. package/dist/{global-workspace-V6G2KH2V.js → global-workspace-LIZHU4GM.js} +5 -4
  36. package/dist/{global-workspace-5UUUNA4A.js → global-workspace-LQZLTGFL.js} +5 -4
  37. package/dist/index.cjs +681 -385
  38. package/dist/index.d.cts +96 -5
  39. package/dist/index.d.ts +96 -5
  40. package/dist/index.js +52 -19
  41. package/dist/mcp/run-stdio.cjs +647 -385
  42. package/dist/mcp/run-stdio.js +12 -11
  43. package/dist/{orchestrator-4IGHVRAF.js → orchestrator-G5HELCVT.js} +7 -6
  44. package/dist/{orchestrator-D4AQNF25.js → orchestrator-ZBUXJCII.js} +7 -6
  45. package/dist/{thread-store-FMWDFAO5.js → thread-store-FCWU7Y3X.js} +2 -1
  46. package/dist/{thread-store-ESZYZSVC.js → thread-store-KMZRQEPY.js} +2 -1
  47. package/dist/{workspaces-PZ36M7EQ.js → workspaces-2XW2DMRG.js} +5 -4
  48. package/dist/{workspaces-CLNANACI.js → workspaces-T6PMQZYQ.js} +5 -4
  49. package/dist/{worktree-JKTM47K5.js → worktree-2OEMMFRT.js} +4 -3
  50. package/dist/{worktree-NC4XQNQI.js → worktree-5ZGWKKZ6.js} +4 -3
  51. package/package.json +1 -1
@@ -15,11 +15,11 @@ import {
15
15
  toAbleTimeIssueInfo,
16
16
  updateAbleTimeTask,
17
17
  verifyAbleTimeConnection
18
- } from "./chunk-W6X4GZJG.js";
19
- import "./chunk-F4LZUEIO.js";
20
- import "./chunk-X45BV4VX.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-Y4CF7LHH.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-6YZLSZLK.js";
21
- import "./chunk-TEDEVD4O.js";
22
- import "./chunk-WXWJ5MJ4.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-4EGK47WV.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-6J4OQ6TF.js";
24
- import "./chunk-X45BV4VX.js";
23
+ } from "./chunk-MN6YUD4O.js";
24
+ import "./chunk-G4TANQC3.js";
25
25
  import "./chunk-N7WZ6NIN.js";
26
- import "./chunk-Y4CF7LHH.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-WXWJ5MJ4.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-4EGK47WV.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-UWSSLXH3.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-TEDEVD4O.js";
11
- import "./chunk-WXWJ5MJ4.js";
10
+ } from "./chunk-YVE4PXCJ.js";
11
+ import "./chunk-LS6TSOCE.js";
12
12
  import "./chunk-VKQGAWHY.js";
13
- import "./chunk-4EGK47WV.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-F4LZUEIO.js";
9
- import "./chunk-X45BV4VX.js";
8
+ } from "./chunk-2M5B7YNY.js";
9
+ import "./chunk-G4TANQC3.js";
10
10
  import "./chunk-N7WZ6NIN.js";
11
- import "./chunk-Y4CF7LHH.js";
11
+ import "./chunk-L5CIEBLR.js";
12
12
  import "./chunk-4TR3HZFT.js";
13
13
  import "./chunk-WDRMZKVB.js";
14
14
  import "./chunk-JT7R45JB.js";
@@ -1,7 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- cursorSdkStoreDir
4
- } from "../chunk-7J72QJOM.js";
5
2
  import {
6
3
  createAgentStreamCoalescer
7
4
  } from "../chunk-AXQ4ZWHK.js";
@@ -17,6 +14,9 @@ import {
17
14
  import {
18
15
  dropNestedElectronEnvFromProcess
19
16
  } from "../chunk-4TR3HZFT.js";
17
+ import {
18
+ cursorSdkStoreDir
19
+ } from "../chunk-7J72QJOM.js";
20
20
  import "../chunk-WFUDY6PC.js";
21
21
  import "../chunk-UFHNSFAS.js";
22
22
 
@@ -50,14 +50,15 @@ import {
50
50
  resolveQuotaFallbackAgent,
51
51
  turnCostUsdFromCursorUsage,
52
52
  whichOnPath
53
- } from "./chunk-7PEIIN7P.js";
54
- import "./chunk-DNTPX6HV.js";
53
+ } from "./chunk-NDE5RKZP.js";
54
+ import "./chunk-ZC664YBJ.js";
55
55
  import "./chunk-3OHR73VK.js";
56
56
  import "./chunk-Y4MIXGPA.js";
57
57
  import "./chunk-VKQGAWHY.js";
58
- import "./chunk-NJ2CCLV6.js";
58
+ import "./chunk-WX4S775K.js";
59
59
  import "./chunk-D6JWYJ4P.js";
60
- import "./chunk-ZHCB4CKR.js";
60
+ import "./chunk-X5PUFYDJ.js";
61
+ import "./chunk-X5B3OS5I.js";
61
62
  import "./chunk-SYFVUF2C.js";
62
63
  import {
63
64
  conductorBundledBinDir,
@@ -73,7 +74,7 @@ import {
73
74
  assertOrchestratorCapableAgent,
74
75
  coerceOrchestratorAgent,
75
76
  isOrchestratorCapableAgent
76
- } from "./chunk-4EGK47WV.js";
77
+ } from "./chunk-BTC2D6LS.js";
77
78
  import "./chunk-NSTQ6QKD.js";
78
79
  import "./chunk-KGZBYWZ3.js";
79
80
  import "./chunk-EQNRWDLN.js";
@@ -44,9 +44,9 @@ import {
44
44
  resolveLoginCommand,
45
45
  resolveQuotaFallbackAgent,
46
46
  whichOnPath
47
- } from "./chunk-A6SOSLUV.js";
48
- import "./chunk-HA4EZKFY.js";
49
- import "./chunk-OP6CFVTB.js";
47
+ } from "./chunk-YYELAUKP.js";
48
+ import "./chunk-3S2LDD2F.js";
49
+ import "./chunk-ZZNZX2QW.js";
50
50
  import "./chunk-6K64FJDD.js";
51
51
  import "./chunk-QQKDGPUI.js";
52
52
  import "./chunk-SALM35KD.js";
@@ -63,11 +63,12 @@ import {
63
63
  assertOrchestratorCapableAgent,
64
64
  coerceOrchestratorAgent,
65
65
  isOrchestratorCapableAgent
66
- } from "./chunk-Y4CF7LHH.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-7DKX5JLT.js";
70
+ import "./chunk-FGTPRMPS.js";
71
+ import "./chunk-7J72QJOM.js";
71
72
  import "./chunk-77WWLBCI.js";
72
73
  import "./chunk-WFUDY6PC.js";
73
74
  import {
@@ -8,6 +8,7 @@ import {
8
8
  appSettingsPath,
9
9
  applyAppEnvironment,
10
10
  autoArchiveOnMergeEnabled,
11
+ autoCleanupHistoryEnabled,
11
12
  autoCleanupOrphansEnabled,
12
13
  autoRenameBranchEnabled,
13
14
  autoRunAfterSetupEnabled,
@@ -48,6 +49,8 @@ import {
48
49
  getLinearApiKey,
49
50
  gitBranchPrefixSetting,
50
51
  harnessEnvKey,
52
+ historyMaxCount,
53
+ historyMaxDays,
51
54
  isAbleTimeConnected,
52
55
  isIssueSourceConnected,
53
56
  isLinearConnected,
@@ -89,7 +92,7 @@ import {
89
92
  updateProjectProfileSettings,
90
93
  usageOnLimit,
91
94
  writeViewerContext
92
- } from "./chunk-Y4CF7LHH.js";
95
+ } from "./chunk-L5CIEBLR.js";
93
96
  import "./chunk-4TR3HZFT.js";
94
97
  import "./chunk-WDRMZKVB.js";
95
98
  import "./chunk-JT7R45JB.js";
@@ -105,6 +108,7 @@ export {
105
108
  appSettingsPath,
106
109
  applyAppEnvironment,
107
110
  autoArchiveOnMergeEnabled,
111
+ autoCleanupHistoryEnabled,
108
112
  autoCleanupOrphansEnabled,
109
113
  autoRenameBranchEnabled,
110
114
  autoRunAfterSetupEnabled,
@@ -145,6 +149,8 @@ export {
145
149
  getLinearApiKey,
146
150
  gitBranchPrefixSetting,
147
151
  harnessEnvKey,
152
+ historyMaxCount,
153
+ historyMaxDays,
148
154
  isAbleTimeConnected,
149
155
  isIssueSourceConnected,
150
156
  isLinearConnected,
@@ -10,6 +10,7 @@ import {
10
10
  appSettingsPath,
11
11
  applyAppEnvironment,
12
12
  autoArchiveOnMergeEnabled,
13
+ autoCleanupHistoryEnabled,
13
14
  autoCleanupOrphansEnabled,
14
15
  autoRenameBranchEnabled,
15
16
  autoRunAfterSetupEnabled,
@@ -50,6 +51,8 @@ import {
50
51
  getLinearApiKey,
51
52
  gitBranchPrefixSetting,
52
53
  harnessEnvKey,
54
+ historyMaxCount,
55
+ historyMaxDays,
53
56
  isAbleTimeConnected,
54
57
  isIssueSourceConnected,
55
58
  isLinearConnected,
@@ -91,7 +94,7 @@ import {
91
94
  updateProjectProfileSettings,
92
95
  usageOnLimit,
93
96
  writeViewerContext
94
- } from "./chunk-4EGK47WV.js";
97
+ } from "./chunk-BTC2D6LS.js";
95
98
  import "./chunk-NSTQ6QKD.js";
96
99
  import "./chunk-KGZBYWZ3.js";
97
100
  import "./chunk-EQNRWDLN.js";
@@ -106,6 +109,7 @@ export {
106
109
  appSettingsPath,
107
110
  applyAppEnvironment,
108
111
  autoArchiveOnMergeEnabled,
112
+ autoCleanupHistoryEnabled,
109
113
  autoCleanupOrphansEnabled,
110
114
  autoRenameBranchEnabled,
111
115
  autoRunAfterSetupEnabled,
@@ -146,6 +150,8 @@ export {
146
150
  getLinearApiKey,
147
151
  gitBranchPrefixSetting,
148
152
  harnessEnvKey,
153
+ historyMaxCount,
154
+ historyMaxDays,
149
155
  isAbleTimeConnected,
150
156
  isIssueSourceConnected,
151
157
  isLinearConnected,
@@ -4,14 +4,14 @@ import {
4
4
  normalizeAbleTimeCredential,
5
5
  normalizeAbleTimeHost,
6
6
  rewriteAbleTimeError
7
- } from "./chunk-X45BV4VX.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-Y4CF7LHH.js";
14
+ } from "./chunk-L5CIEBLR.js";
15
15
 
16
16
  // src/integrations/abletime-rest.ts
17
17
  var ABLETIME_REST_PREFIX = "/api/public/v2";
@@ -13,10 +13,8 @@ import {
13
13
  adjustBrightsyTurnExit,
14
14
  applyAgentEvent,
15
15
  applyAgentRunnerHeapEnv,
16
- applyTurnUsage,
17
16
  clipAgentEventForPaint,
18
17
  clipToolResultForStore,
19
- contextTokens,
20
18
  fallbackTurnFailDetail,
21
19
  finalizeParts,
22
20
  formatAgentErrorContinuePrompt,
@@ -41,11 +39,10 @@ import {
41
39
  shouldRetryCodexPluginIsolate,
42
40
  shouldRetryFailedAgentTurn,
43
41
  stripBrightsyNdjsonNoise,
44
- sumUsageList,
45
42
  summarizeTurnStderr,
46
43
  toolDescription,
47
44
  turnFailChatText
48
- } from "./chunk-7PEIIN7P.js";
45
+ } from "./chunk-NDE5RKZP.js";
49
46
  import {
50
47
  SLACK_REPLY_FORMATTING,
51
48
  addWorkspace,
@@ -68,7 +65,7 @@ import {
68
65
  stageAbsolutePathsAsAttachments,
69
66
  stageBuffersAsAttachments,
70
67
  syncWorkspacesFromThreads
71
- } from "./chunk-DNTPX6HV.js";
68
+ } from "./chunk-ZC664YBJ.js";
72
69
  import {
73
70
  addPrStackLayer,
74
71
  allocateTeamName,
@@ -118,7 +115,7 @@ import {
118
115
  worktreeDisplayLabelForGroup,
119
116
  worktreeNameFromPath,
120
117
  worktreeSlugForTicket
121
- } from "./chunk-NJ2CCLV6.js";
118
+ } from "./chunk-WX4S775K.js";
122
119
  import {
123
120
  ATTACHMENTS_DIR,
124
121
  DETACHED_JOBS_DIR,
@@ -136,7 +133,7 @@ import {
136
133
  updateThread,
137
134
  withThreadLock,
138
135
  writeThread
139
- } from "./chunk-ZHCB4CKR.js";
136
+ } from "./chunk-X5PUFYDJ.js";
140
137
  import {
141
138
  ensureWorktreeSideboardIgnored
142
139
  } from "./chunk-SYFVUF2C.js";
@@ -149,19 +146,28 @@ import {
149
146
  run
150
147
  } from "./chunk-FNQNJOHY.js";
151
148
  import {
149
+ HISTORY_CLEANUP_INTERVAL_HOURS_DEFAULT,
150
+ applyTurnUsage,
152
151
  assertOrchestratorCapableAgent,
152
+ autoCleanupHistoryEnabled,
153
153
  childEnvWithAppSettings,
154
154
  coerceOrchestratorAgent,
155
+ contextTokens,
155
156
  followUpBehavior,
156
157
  formatViewerContextDirective,
157
158
  formatViewerContextReminder,
158
159
  getIssueSource,
160
+ historyMaxCount,
161
+ historyMaxDays,
162
+ historyRetentionStubMessage,
159
163
  isAbleTimeConnected,
160
164
  isLinearConnected,
161
165
  isOrchestratorCapableAgent,
162
166
  isSecureFileEncrypted,
163
167
  loadAppSettings,
164
168
  orchestrationQuotaFallbackAgent,
169
+ planHistoryAgePurge,
170
+ planHistoryRetention,
165
171
  readSecureJson,
166
172
  resolveEffectiveIssueSource,
167
173
  resolveNewThreadOptions,
@@ -169,10 +175,11 @@ import {
169
175
  resolveVaultKey,
170
176
  resolveViewerProfileForRepo,
171
177
  stripNestedElectronEnv,
178
+ sumUsageList,
172
179
  updateAdvancedSettings,
173
180
  usageOnLimit,
174
181
  writeSecureJson
175
- } from "./chunk-4EGK47WV.js";
182
+ } from "./chunk-BTC2D6LS.js";
176
183
  import {
177
184
  writePrivateFile
178
185
  } from "./chunk-NSTQ6QKD.js";
@@ -410,7 +417,7 @@ async function continueSourceThread(threadId, prompt) {
410
417
  await continueOnReply(threadId, prompt);
411
418
  return;
412
419
  }
413
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-4IGHVRAF.js");
420
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-G5HELCVT.js");
414
421
  await getOrchestrator2().send(threadId, prompt);
415
422
  } catch {
416
423
  }
@@ -803,9 +810,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
803
810
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
804
811
  );
805
812
  }
806
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-V6G2KH2V.js");
813
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-LIZHU4GM.js");
807
814
  if (isGlobalThread2(thread)) {
808
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-TUHB6ZFA.js");
815
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-PONGPWIP.js");
809
816
  ensureGlobalCoordinatorCwd2(
810
817
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
811
818
  );
@@ -2515,6 +2522,69 @@ function shouldRunWorktreeCleanup(settings = loadAppSettings()) {
2515
2522
  return elapsed >= intervalHours * 36e5;
2516
2523
  }
2517
2524
 
2525
+ // src/store/history-cleanup.ts
2526
+ function stripArchivedTranscript(thread) {
2527
+ writeThread(
2528
+ {
2529
+ ...thread,
2530
+ attachments: [],
2531
+ pendingTurnAttachments: [],
2532
+ messages: [historyRetentionStubMessage(thread)]
2533
+ },
2534
+ { touch: false }
2535
+ );
2536
+ }
2537
+ function cleanupArchivedHistory(opts = {}) {
2538
+ const settings = loadAppSettings();
2539
+ if (!opts.force && opts.purgeOlderThanDays == null && !autoCleanupHistoryEnabled(settings)) {
2540
+ return { stripped: [], purged: [] };
2541
+ }
2542
+ const archived = listThreads({ includeArchived: true }).filter((t) => t.status === "archived");
2543
+ const nowMs = opts.nowMs ?? Date.now();
2544
+ const plan = opts.purgeOlderThanDays != null ? { stripIds: [], purgeIds: planHistoryAgePurge(archived, opts.purgeOlderThanDays, nowMs) } : planHistoryRetention(archived, {
2545
+ maxCount: opts.maxCount ?? historyMaxCount(settings),
2546
+ maxDays: opts.maxDays ?? historyMaxDays(settings),
2547
+ nowMs
2548
+ });
2549
+ const stripped = [];
2550
+ const purged = [];
2551
+ if (opts.dryRun) {
2552
+ return { stripped: plan.stripIds, purged: plan.purgeIds };
2553
+ }
2554
+ for (const id of plan.stripIds) {
2555
+ const thread = readThread(id);
2556
+ if (!thread || thread.status !== "archived") continue;
2557
+ try {
2558
+ stripArchivedTranscript(thread);
2559
+ stripped.push(id);
2560
+ } catch {
2561
+ }
2562
+ }
2563
+ for (const id of plan.purgeIds) {
2564
+ const thread = readThread(id);
2565
+ if (!thread || thread.status !== "archived") continue;
2566
+ try {
2567
+ deleteThreadRecord(id);
2568
+ purged.push(id);
2569
+ } catch {
2570
+ }
2571
+ }
2572
+ if (stripped.length > 0 || purged.length > 0) {
2573
+ updateAdvancedSettings({
2574
+ historyLastCleanupAt: new Date(nowMs).toISOString()
2575
+ });
2576
+ }
2577
+ return { stripped, purged };
2578
+ }
2579
+ function shouldRunHistoryCleanup(settings = loadAppSettings()) {
2580
+ if (!autoCleanupHistoryEnabled(settings)) return false;
2581
+ const intervalHours = settings.advanced.historyCleanupIntervalHours ?? HISTORY_CLEANUP_INTERVAL_HOURS_DEFAULT;
2582
+ const last = settings.advanced.historyLastCleanupAt;
2583
+ if (!last) return true;
2584
+ const elapsed = Date.now() - Date.parse(last);
2585
+ return Number.isFinite(elapsed) && elapsed >= intervalHours * 36e5;
2586
+ }
2587
+
2518
2588
  // src/git/apply-into-main.ts
2519
2589
  import { execa as execa3 } from "execa";
2520
2590
  async function applyThreadIntoMain(thread, opts) {
@@ -3649,7 +3719,7 @@ async function createThread(input, _onSetupLine) {
3649
3719
  });
3650
3720
  await requireAgent(resolved.agent);
3651
3721
  if (input.cowboy) {
3652
- const { cowboyModeEnabled } = await import("./app-settings-R2KNCT37.js");
3722
+ const { cowboyModeEnabled } = await import("./app-settings-XCRNCEEE.js");
3653
3723
  if (!cowboyModeEnabled()) {
3654
3724
  throw new Error(
3655
3725
  "Cowboy mode is off. Enable it in Settings \u2192 Advanced."
@@ -3707,7 +3777,7 @@ async function createThread(input, _onSetupLine) {
3707
3777
  let sourceIsFork = false;
3708
3778
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3709
3779
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3710
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-UWSSLXH3.js");
3780
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-QGGYL2G4.js");
3711
3781
  const task = await ensureAbleTimeTask({
3712
3782
  title: title?.trim() || "Untitled work",
3713
3783
  description: input.prompt?.trim() || void 0
@@ -4243,7 +4313,7 @@ async function adoptThread(input) {
4243
4313
  messages: input.messages ?? []
4244
4314
  });
4245
4315
  writeThread(thread);
4246
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-CLNANACI.js");
4316
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-T6PMQZYQ.js");
4247
4317
  await ensureWorkspace2(repoPath);
4248
4318
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-N5X5I422.js");
4249
4319
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -6643,7 +6713,7 @@ function formatScheduledPrompt(name, prompt) {
6643
6713
  ${prompt}`;
6644
6714
  }
6645
6715
  async function defaultDeps() {
6646
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-4IGHVRAF.js");
6716
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-G5HELCVT.js");
6647
6717
  const orch = getOrchestrator2();
6648
6718
  return {
6649
6719
  findThread: (id) => findThreadByRef(id),
@@ -6913,12 +6983,18 @@ var Orchestrator = class {
6913
6983
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
6914
6984
  });
6915
6985
  }
6916
- const { autoCleanupOrphansEnabled } = await import("./app-settings-R2KNCT37.js");
6986
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-XCRNCEEE.js");
6917
6987
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
6918
6988
  await cleanupOrphanWorktrees({ repoPaths });
6919
6989
  }
6920
6990
  } catch {
6921
6991
  }
6992
+ try {
6993
+ if (shouldRunHistoryCleanup()) {
6994
+ cleanupArchivedHistory();
6995
+ }
6996
+ } catch {
6997
+ }
6922
6998
  if (drainQueues) {
6923
6999
  this.adoptPersistedQueues();
6924
7000
  }
@@ -7205,7 +7281,7 @@ var Orchestrator = class {
7205
7281
  }
7206
7282
  await setup;
7207
7283
  if (skipSetup) return;
7208
- const { autoRunAfterSetupEnabled } = await import("./app-settings-R2KNCT37.js");
7284
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-XCRNCEEE.js");
7209
7285
  if (autoRunAfterSetupEnabled()) {
7210
7286
  try {
7211
7287
  await this.startDev(threadId);
@@ -7535,7 +7611,7 @@ var Orchestrator = class {
7535
7611
  }
7536
7612
  const isBrightsy = fresh.agent === "brightsy";
7537
7613
  const isOrchestration = isOrchestratorThread(fresh);
7538
- const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-R2KNCT37.js");
7614
+ const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-XCRNCEEE.js");
7539
7615
  const gitAuthMode = getGithubGitAuthMode();
7540
7616
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
7541
7617
  githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
@@ -7681,7 +7757,7 @@ var Orchestrator = class {
7681
7757
  if (!this.stoppedTurns.has(threadId) && this.requireThread(threadId).agent === "cursor" && exitCode !== 0 && !assistantText && parts.length === 0) {
7682
7758
  const sessionId = result.sessionId || this.requireThread(threadId).sessionId || "";
7683
7759
  if (sessionId) {
7684
- const { recoverFinishedCursorRun } = await import("./cursor-recover-TXVTLAMA.js");
7760
+ const { recoverFinishedCursorRun } = await import("./cursor-recover-4PQAADAU.js");
7685
7761
  for (let i = 0; i < 8; i++) {
7686
7762
  const recovered = recoverFinishedCursorRun({
7687
7763
  agentId: sessionId,
@@ -8247,6 +8323,20 @@ var Orchestrator = class {
8247
8323
  repoPaths
8248
8324
  });
8249
8325
  }
8326
+ /** Bound Settings → History. After archive always; reconcile is interval-gated. */
8327
+ enforceHistoryRetention() {
8328
+ try {
8329
+ cleanupArchivedHistory();
8330
+ } catch {
8331
+ }
8332
+ }
8333
+ cleanupHistory(opts) {
8334
+ return cleanupArchivedHistory({
8335
+ dryRun: opts?.dryRun,
8336
+ purgeOlderThanDays: opts?.purgeOlderThanDays,
8337
+ force: opts?.force
8338
+ });
8339
+ }
8250
8340
  /**
8251
8341
  * Best-of-n / fanout: create N threads (one per agent) with the same prompt.
8252
8342
  */
@@ -8553,7 +8643,7 @@ var Orchestrator = class {
8553
8643
  if (!titled.userSetTitle && meta.title && titled.title !== meta.title) {
8554
8644
  updateThread(thread.id, { title: meta.title });
8555
8645
  }
8556
- const { autoArchiveOnMergeEnabled } = await import("./app-settings-R2KNCT37.js");
8646
+ const { autoArchiveOnMergeEnabled } = await import("./app-settings-XCRNCEEE.js");
8557
8647
  const latest = this.requireThread(thread.id);
8558
8648
  if (!shouldAutoArchiveOnPrMerge({
8559
8649
  previousPrState: prevState || null,
@@ -8807,6 +8897,7 @@ var Orchestrator = class {
8807
8897
  if (isGlobalThread(thread)) {
8808
8898
  const archived2 = setStatus(thread.id, "archived");
8809
8899
  this.emit({ type: "status_changed", threadId: archived2.id, status: "archived" });
8900
+ this.enforceHistoryRetention();
8810
8901
  return archived2;
8811
8902
  }
8812
8903
  const siblings = threadsSharingWorktree(thread.worktreePath).filter((t) => t.id !== thread.id);
@@ -8828,9 +8919,10 @@ var Orchestrator = class {
8828
8919
  }
8829
8920
  const archived = setStatus(thread.id, "archived");
8830
8921
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
8922
+ this.enforceHistoryRetention();
8831
8923
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
8832
8924
  try {
8833
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-CLNANACI.js");
8925
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-T6PMQZYQ.js");
8834
8926
  await ensureWorkspace2(thread.repoPath);
8835
8927
  } catch {
8836
8928
  }
@@ -8857,7 +8949,7 @@ var Orchestrator = class {
8857
8949
  await runArchiveScript(thread.repoPath, thread.worktreePath);
8858
8950
  } catch {
8859
8951
  }
8860
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-R2KNCT37.js");
8952
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-XCRNCEEE.js");
8861
8953
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
8862
8954
  await removeWorktree(thread.repoPath, thread.worktreePath, {
8863
8955
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -8884,7 +8976,7 @@ var Orchestrator = class {
8884
8976
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
8885
8977
  );
8886
8978
  }
8887
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-JKTM47K5.js");
8979
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-2OEMMFRT.js");
8888
8980
  const slug = thread.worktreePath.split("/").pop();
8889
8981
  const dest = thread.worktreePath;
8890
8982
  await withRepoGitLock(thread.repoPath, async () => {
@@ -8994,7 +9086,7 @@ async function startOrchestration(opts) {
8994
9086
  sourceRef: "default",
8995
9087
  ...createOpts
8996
9088
  }).catch(async () => {
8997
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-JKTM47K5.js");
9089
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-2OEMMFRT.js");
8998
9090
  const repo = await resolveRepoRoot2(repoPath);
8999
9091
  const def = await resolveDefaultBranch2(repo);
9000
9092
  return orch.createThread({
@@ -9004,7 +9096,7 @@ async function startOrchestration(opts) {
9004
9096
  repoPath: repo
9005
9097
  });
9006
9098
  });
9007
- const { updateThread: upd } = await import("./thread-store-FMWDFAO5.js");
9099
+ const { updateThread: upd } = await import("./thread-store-FCWU7Y3X.js");
9008
9100
  const updated = upd(thread.id, {
9009
9101
  sourceType: "orchestration",
9010
9102
  sourceRef: goal
@@ -5,7 +5,7 @@ import {
5
5
  resolveRepoRoot,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-OP6CFVTB.js";
8
+ } from "./chunk-ZZNZX2QW.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-Y4CF7LHH.js";
25
+ } from "./chunk-L5CIEBLR.js";
26
26
  import {
27
27
  createEmptyThread,
28
28
  listThreads,
29
29
  updateThread,
30
30
  writeThread
31
- } from "./chunk-7DKX5JLT.js";
31
+ } from "./chunk-FGTPRMPS.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-TEDEVD4O.js";
5
+ } from "./chunk-YVE4PXCJ.js";
6
6
  import {
7
7
  assertAbleTimeCredential,
8
8
  callAbleTimeTool,
9
9
  normalizeAbleTimeHost,
10
10
  rewriteAbleTimeError
11
- } from "./chunk-WXWJ5MJ4.js";
11
+ } from "./chunk-LS6TSOCE.js";
12
12
  import {
13
13
  isAbleTimeConnected,
14
14
  saveAbleTimeConnection
15
- } from "./chunk-4EGK47WV.js";
15
+ } from "./chunk-BTC2D6LS.js";
16
16
 
17
17
  // src/integrations/abletime.ts
18
18
  var CLOSED_STATES = /* @__PURE__ */ new Set([