@sideboard-ai/core 0.1.208 → 0.1.209
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.
- package/dist/{abletime-I4IYZBKU.js → abletime-G3MWSZVM.js} +4 -4
- package/dist/{abletime-UWSSLXH3.js → abletime-SQREWITG.js} +4 -4
- package/dist/{abletime-oauth-UZHPB3W2.js → abletime-oauth-7AOE4KJL.js} +3 -3
- package/dist/{abletime-oauth-C3BQXKW3.js → abletime-oauth-SQD6K47H.js} +3 -3
- package/dist/{abletime-rest-5YPPEOKK.js → abletime-rest-BXL7QHCX.js} +3 -3
- package/dist/{abletime-rest-HYNYDYK3.js → abletime-rest-QRTJH42S.js} +3 -3
- package/dist/agents/cursor-runner.js +3 -3
- package/dist/{agents-QHQXR55O.js → agents-KA6HDNNP.js} +6 -5
- package/dist/{agents-CCS5IEBV.js → agents-U2NVCYGC.js} +6 -5
- package/dist/{app-settings-R2KNCT37.js → app-settings-6SZLZNA7.js} +7 -1
- package/dist/{app-settings-GJ6KDYEF.js → app-settings-VBQHGX5Z.js} +7 -1
- package/dist/{chunk-OP6CFVTB.js → chunk-22A45QOI.js} +2 -2
- package/dist/{chunk-NJ2CCLV6.js → chunk-42VGWRSE.js} +2 -2
- package/dist/{chunk-X45BV4VX.js → chunk-5LFD3KCJ.js} +5 -5
- package/dist/{chunk-F4LZUEIO.js → chunk-B2RPIHNJ.js} +2 -2
- package/dist/{chunk-6YZLSZLK.js → chunk-CQZCXRVG.js} +3 -3
- package/dist/{chunk-4EGK47WV.js → chunk-FUC3XFE2.js} +215 -0
- package/dist/{chunk-C6ZNQV5W.js → chunk-HBL7ILQA.js} +117 -25
- package/dist/{chunk-TEDEVD4O.js → chunk-IIENQFJ6.js} +2 -2
- package/dist/{chunk-6J4OQ6TF.js → chunk-IOOL3T7Q.js} +3 -3
- package/dist/{chunk-A6SOSLUV.js → chunk-KJAHVQL6.js} +24 -94
- package/dist/{chunk-7PEIIN7P.js → chunk-MS2P5GXL.js} +24 -87
- package/dist/{chunk-C5MNMITQ.js → chunk-MZP2C4KE.js} +119 -25
- package/dist/{chunk-7DKX5JLT.js → chunk-OY7THBLG.js} +10 -2
- package/dist/{chunk-DNTPX6HV.js → chunk-PTOIWKDU.js} +3 -3
- package/dist/{chunk-W6X4GZJG.js → chunk-QVVJO4GN.js} +3 -3
- package/dist/{chunk-ZHCB4CKR.js → chunk-RPZFNKND.js} +10 -2
- package/dist/{chunk-HA4EZKFY.js → chunk-TZCWNRMC.js} +3 -3
- package/dist/{chunk-Y4CF7LHH.js → chunk-VJQDUD24.js} +230 -0
- package/dist/chunk-X5B3OS5I.js +34 -0
- package/dist/{chunk-WXWJ5MJ4.js → chunk-XRIF6M5H.js} +5 -5
- package/dist/{coordinator-prompt-TUHB6ZFA.js → coordinator-prompt-2YCOE5R4.js} +5 -4
- package/dist/{coordinator-prompt-WOTJQMD5.js → coordinator-prompt-EO2X2EYW.js} +5 -4
- package/dist/{cursor-recover-TXVTLAMA.js → cursor-recover-4PQAADAU.js} +3 -28
- package/dist/{global-workspace-V6G2KH2V.js → global-workspace-H2ANUSGR.js} +5 -4
- package/dist/{global-workspace-5UUUNA4A.js → global-workspace-JEKMVE42.js} +5 -4
- package/dist/index.cjs +671 -384
- package/dist/index.d.cts +93 -4
- package/dist/index.d.ts +93 -4
- package/dist/index.js +52 -19
- package/dist/mcp/run-stdio.cjs +637 -384
- package/dist/mcp/run-stdio.js +12 -11
- package/dist/{orchestrator-D4AQNF25.js → orchestrator-N7LLTK5O.js} +7 -6
- package/dist/{orchestrator-4IGHVRAF.js → orchestrator-RUQXDYM7.js} +7 -6
- package/dist/{thread-store-ESZYZSVC.js → thread-store-55X2JYDT.js} +2 -1
- package/dist/{thread-store-FMWDFAO5.js → thread-store-CMZWM5NY.js} +2 -1
- package/dist/{workspaces-CLNANACI.js → workspaces-2YNYLSPV.js} +5 -4
- package/dist/{workspaces-PZ36M7EQ.js → workspaces-SVDORZEI.js} +5 -4
- package/dist/{worktree-JKTM47K5.js → worktree-5CPGB4D2.js} +4 -3
- package/dist/{worktree-NC4XQNQI.js → worktree-YQ6XUSR2.js} +4 -3
- package/package.json +1 -1
|
@@ -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-
|
|
45
|
+
} from "./chunk-MS2P5GXL.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-
|
|
68
|
+
} from "./chunk-PTOIWKDU.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-
|
|
118
|
+
} from "./chunk-42VGWRSE.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-
|
|
136
|
+
} from "./chunk-RPZFNKND.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-
|
|
182
|
+
} from "./chunk-FUC3XFE2.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-
|
|
420
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-RUQXDYM7.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-
|
|
813
|
+
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-H2ANUSGR.js");
|
|
807
814
|
if (isGlobalThread2(thread)) {
|
|
808
|
-
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-
|
|
815
|
+
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-2YCOE5R4.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-
|
|
3722
|
+
const { cowboyModeEnabled } = await import("./app-settings-6SZLZNA7.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-
|
|
3780
|
+
const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-SQREWITG.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-
|
|
4316
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-2YNYLSPV.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-
|
|
6716
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-RUQXDYM7.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-
|
|
6986
|
+
const { autoCleanupOrphansEnabled } = await import("./app-settings-6SZLZNA7.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-
|
|
7284
|
+
const { autoRunAfterSetupEnabled } = await import("./app-settings-6SZLZNA7.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-
|
|
7614
|
+
const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-6SZLZNA7.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-
|
|
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-
|
|
8646
|
+
const { autoArchiveOnMergeEnabled } = await import("./app-settings-6SZLZNA7.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-
|
|
8925
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-2YNYLSPV.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-
|
|
8952
|
+
const { deleteBranchOnPurgeEnabled } = await import("./app-settings-6SZLZNA7.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-
|
|
8979
|
+
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-5CPGB4D2.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-
|
|
9089
|
+
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-5CPGB4D2.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-
|
|
9099
|
+
const { updateThread: upd } = await import("./thread-store-CMZWM5NY.js");
|
|
9008
9100
|
const updated = upd(thread.id, {
|
|
9009
9101
|
sourceType: "orchestration",
|
|
9010
9102
|
sourceRef: goal
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
normalizeAbleTimeCredential,
|
|
7
7
|
normalizeAbleTimeHost,
|
|
8
8
|
rewriteAbleTimeError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XRIF6M5H.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-
|
|
16
|
+
} from "./chunk-FUC3XFE2.js";
|
|
17
17
|
|
|
18
18
|
// src/integrations/abletime-rest.ts
|
|
19
19
|
var ABLETIME_REST_PREFIX = "/api/public/v2";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_ABLETIME_HOST,
|
|
3
3
|
normalizeAbleTimeHost
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5LFD3KCJ.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-
|
|
13
|
+
} from "./chunk-VJQDUD24.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-
|
|
283
|
+
const { getAbleTimeOrientation } = await import("./abletime-G3MWSZVM.js");
|
|
284
284
|
const orientation = await getAbleTimeOrientation({ token, host });
|
|
285
285
|
return saveAbleTimeConnection({
|
|
286
286
|
accessToken: token,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isOrchestratorThread
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TZCWNRMC.js";
|
|
4
4
|
import {
|
|
5
5
|
codexUnattendedGitConfigArgs,
|
|
6
6
|
mergeAgentGitAuthEnv,
|
|
7
7
|
resolveAgentGitAuthEnv,
|
|
8
8
|
resolveCodexGitWritableRoots
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-22A45QOI.js";
|
|
10
10
|
import {
|
|
11
11
|
applyConnectedTeamToCli,
|
|
12
12
|
brightsyMcpServerName,
|
|
@@ -36,12 +36,13 @@ import {
|
|
|
36
36
|
} from "./chunk-JZHRZ3DR.js";
|
|
37
37
|
import {
|
|
38
38
|
claudeChromeEnabled,
|
|
39
|
+
fromInclusiveInputUsage,
|
|
39
40
|
isAbleTimeConnected,
|
|
40
41
|
isLinearConnected,
|
|
41
42
|
loadAppSettings,
|
|
42
43
|
resolveAgentExecutable,
|
|
43
44
|
resolveClaudeExecutable
|
|
44
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-VJQDUD24.js";
|
|
45
46
|
import {
|
|
46
47
|
isElectronLikeCommand,
|
|
47
48
|
unwrapStrippedElectronLaunch
|
|
@@ -60,88 +61,6 @@ import {
|
|
|
60
61
|
// src/agents/brightsy.ts
|
|
61
62
|
import { existsSync } from "fs";
|
|
62
63
|
|
|
63
|
-
// src/agents/usage.ts
|
|
64
|
-
function sumOptional(a, b) {
|
|
65
|
-
if (a == null && b == null) return void 0;
|
|
66
|
-
return (a ?? 0) + (b ?? 0);
|
|
67
|
-
}
|
|
68
|
-
function fromInclusiveInputUsage(opts) {
|
|
69
|
-
const totalInput = Number(opts.inputTokens) || 0;
|
|
70
|
-
const outputTokens = Number(opts.outputTokens) || 0;
|
|
71
|
-
const cached = Number(opts.cachedInputTokens) || 0;
|
|
72
|
-
if (!totalInput && !outputTokens) return null;
|
|
73
|
-
const cacheReadTokens = cached > 0 ? Math.min(cached, totalInput) : 0;
|
|
74
|
-
return {
|
|
75
|
-
inputTokens: Math.max(0, totalInput - cacheReadTokens),
|
|
76
|
-
outputTokens,
|
|
77
|
-
cacheReadTokens: cacheReadTokens || void 0
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function requestOccupancy(u) {
|
|
81
|
-
return u.inputTokens + (u.cacheReadTokens ?? 0) + (u.cacheWriteTokens ?? 0);
|
|
82
|
-
}
|
|
83
|
-
function mergeUsage(a, b) {
|
|
84
|
-
return {
|
|
85
|
-
inputTokens: (a?.inputTokens ?? 0) + b.inputTokens,
|
|
86
|
-
outputTokens: (a?.outputTokens ?? 0) + b.outputTokens,
|
|
87
|
-
cacheReadTokens: sumOptional(a?.cacheReadTokens, b.cacheReadTokens),
|
|
88
|
-
cacheWriteTokens: sumOptional(a?.cacheWriteTokens, b.cacheWriteTokens),
|
|
89
|
-
costUsd: sumOptional(a?.costUsd, b.costUsd),
|
|
90
|
-
lastRequestTokens: b.lastRequestTokens ?? a?.lastRequestTokens
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function sumUsageList(list) {
|
|
94
|
-
let acc = null;
|
|
95
|
-
for (const u of list) {
|
|
96
|
-
if (!u) continue;
|
|
97
|
-
acc = mergeUsage(acc, {
|
|
98
|
-
inputTokens: u.inputTokens,
|
|
99
|
-
outputTokens: u.outputTokens,
|
|
100
|
-
cacheReadTokens: u.cacheReadTokens,
|
|
101
|
-
cacheWriteTokens: u.cacheWriteTokens,
|
|
102
|
-
costUsd: u.costUsd
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
if (!acc) return null;
|
|
106
|
-
return {
|
|
107
|
-
inputTokens: acc.inputTokens,
|
|
108
|
-
outputTokens: acc.outputTokens,
|
|
109
|
-
...acc.cacheReadTokens != null ? { cacheReadTokens: acc.cacheReadTokens } : {},
|
|
110
|
-
...acc.cacheWriteTokens != null ? { cacheWriteTokens: acc.cacheWriteTokens } : {},
|
|
111
|
-
...acc.costUsd != null ? { costUsd: acc.costUsd } : {}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function hasBilledTokens(u) {
|
|
115
|
-
return Boolean(
|
|
116
|
-
u.inputTokens || u.outputTokens || u.cacheReadTokens || u.cacheWriteTokens
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
function applyTurnUsage(current, incoming, scope = "request") {
|
|
120
|
-
if (scope === "turn") {
|
|
121
|
-
if (!hasBilledTokens(incoming) && current && incoming.costUsd != null) {
|
|
122
|
-
return { ...current, costUsd: incoming.costUsd };
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
...incoming,
|
|
126
|
-
costUsd: incoming.costUsd ?? current?.costUsd,
|
|
127
|
-
lastRequestTokens: current?.lastRequestTokens ?? requestOccupancy(incoming)
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
const merged = mergeUsage(current, incoming);
|
|
131
|
-
const occ = incoming.lastRequestTokens != null && incoming.lastRequestTokens > 0 ? incoming.lastRequestTokens : requestOccupancy(incoming);
|
|
132
|
-
return {
|
|
133
|
-
...merged,
|
|
134
|
-
lastRequestTokens: occ > 0 ? occ : current?.lastRequestTokens ?? occ
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function totalTokens(u) {
|
|
138
|
-
return u.inputTokens + u.outputTokens + (u.cacheReadTokens ?? 0) + (u.cacheWriteTokens ?? 0);
|
|
139
|
-
}
|
|
140
|
-
function contextTokens(u) {
|
|
141
|
-
if (u.lastRequestTokens != null && u.lastRequestTokens > 0) return u.lastRequestTokens;
|
|
142
|
-
return requestOccupancy(u);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
64
|
// src/agents/brightsy-targets.ts
|
|
146
65
|
function encodeBrightsyTarget(type, id, accountId) {
|
|
147
66
|
if (accountId) return `team:${accountId}:${type}:${id}`;
|
|
@@ -1791,13 +1710,31 @@ function mcpStatusThinkingFromClaudeInit(obj) {
|
|
|
1791
1710
|
}
|
|
1792
1711
|
}
|
|
1793
1712
|
}
|
|
1794
|
-
const notable = servers.filter(
|
|
1713
|
+
const notable = servers.filter(isNotableMcpInitStatus);
|
|
1795
1714
|
if (notable.length === 0) return null;
|
|
1796
1715
|
return `MCP: ${notable.map((s) => `${s.name} ${s.status}`).join(", ")}`;
|
|
1797
1716
|
}
|
|
1798
1717
|
function isCleanMcpConnect(status) {
|
|
1799
1718
|
return /^(connected|ok|ready|success)$/i.test(status.trim());
|
|
1800
1719
|
}
|
|
1720
|
+
function isMcpAuthStatus(status) {
|
|
1721
|
+
return /needs[_-]?auth|needs authentication|unauthorized|not authenticated|authrequired/i.test(
|
|
1722
|
+
status
|
|
1723
|
+
);
|
|
1724
|
+
}
|
|
1725
|
+
function isSideboardMcpName(name) {
|
|
1726
|
+
return /^sideboard$/i.test(name.trim()) || /^mcp__sideboard$/i.test(name.trim());
|
|
1727
|
+
}
|
|
1728
|
+
function isVendorClaudeAiMcpName(name) {
|
|
1729
|
+
return /^claude\.ai\b/i.test(name.trim()) || /^mcp__claude_ai_/i.test(name.trim());
|
|
1730
|
+
}
|
|
1731
|
+
function isNotableMcpInitStatus(server) {
|
|
1732
|
+
if (isCleanMcpConnect(server.status)) return false;
|
|
1733
|
+
if (isSideboardMcpName(server.name)) return true;
|
|
1734
|
+
if (isVendorClaudeAiMcpName(server.name)) return false;
|
|
1735
|
+
if (isMcpAuthStatus(server.status)) return false;
|
|
1736
|
+
return true;
|
|
1737
|
+
}
|
|
1801
1738
|
function eventsFromClaudeSystem(obj) {
|
|
1802
1739
|
const subtype = claudeString(obj, "subtype") ?? "";
|
|
1803
1740
|
const parentId = claudeParentToolUseId(obj);
|
|
@@ -1966,7 +1903,7 @@ var claudeAdapter = {
|
|
|
1966
1903
|
);
|
|
1967
1904
|
}
|
|
1968
1905
|
const mode = permissionMode(thread);
|
|
1969
|
-
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-
|
|
1906
|
+
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-JEKMVE42.js");
|
|
1970
1907
|
const isOrchestrator = isOrchestratorThread2(thread);
|
|
1971
1908
|
const injectedServers = await buildInjectedMcpServers({
|
|
1972
1909
|
includeSideboard: true,
|
|
@@ -4101,13 +4038,6 @@ export {
|
|
|
4101
4038
|
isBrightsyNdjsonLine,
|
|
4102
4039
|
finalizeParts,
|
|
4103
4040
|
normalizeParseResult,
|
|
4104
|
-
fromInclusiveInputUsage,
|
|
4105
|
-
requestOccupancy,
|
|
4106
|
-
mergeUsage,
|
|
4107
|
-
sumUsageList,
|
|
4108
|
-
applyTurnUsage,
|
|
4109
|
-
totalTokens,
|
|
4110
|
-
contextTokens,
|
|
4111
4041
|
encodeBrightsyTarget,
|
|
4112
4042
|
decodeBrightsyTarget,
|
|
4113
4043
|
normalizeTurnInput,
|