@schoolai/shipyard 3.25.0 → 3.26.0-nightly.20260814.0
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/{chunk-IRS6HYMU.js → chunk-ALNGADQY.js} +2 -2
- package/dist/{chunk-XNH6FVIX.js → chunk-FU6IF6C2.js} +3 -3
- package/dist/electron-utility.js +2 -2
- package/dist/index.js +2 -2
- package/dist/{serve-HTQMCHRP.js → serve-ITJIQJQM.js} +148 -54
- package/dist/{serve-HTQMCHRP.js.map → serve-ITJIQJQM.js.map} +1 -1
- package/dist/{start-HOICUTYV.js → start-ISA4ALVS.js} +4 -4
- package/package.json +1 -1
- /package/dist/{chunk-IRS6HYMU.js.map → chunk-ALNGADQY.js.map} +0 -0
- /package/dist/{chunk-XNH6FVIX.js.map → chunk-FU6IF6C2.js.map} +0 -0
- /package/dist/{start-HOICUTYV.js.map → start-ISA4ALVS.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
getDaemonVersion
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FU6IF6C2.js";
|
|
5
5
|
import {
|
|
6
6
|
WorkerCommandCodec,
|
|
7
7
|
WorkerReplyCodec
|
|
@@ -1116,4 +1116,4 @@ export {
|
|
|
1116
1116
|
shutdownFileWatcherGuard,
|
|
1117
1117
|
guardedSubscribe
|
|
1118
1118
|
};
|
|
1119
|
-
//# sourceMappingURL=chunk-
|
|
1119
|
+
//# sourceMappingURL=chunk-ALNGADQY.js.map
|
|
@@ -18,8 +18,8 @@ function getDaemonVersion() {
|
|
|
18
18
|
return cached;
|
|
19
19
|
}
|
|
20
20
|
function readDaemonVersion() {
|
|
21
|
-
if ("3.
|
|
22
|
-
return "3.
|
|
21
|
+
if ("3.26.0".length > 0) {
|
|
22
|
+
return "3.26.0";
|
|
23
23
|
}
|
|
24
24
|
try {
|
|
25
25
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
@@ -48,4 +48,4 @@ function readDaemonVersion() {
|
|
|
48
48
|
export {
|
|
49
49
|
getDaemonVersion
|
|
50
50
|
};
|
|
51
|
-
//# sourceMappingURL=chunk-
|
|
51
|
+
//# sourceMappingURL=chunk-FU6IF6C2.js.map
|
package/dist/electron-utility.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
getDaemonVersion
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FU6IF6C2.js";
|
|
5
5
|
import {
|
|
6
6
|
enableNativeCrashReports
|
|
7
7
|
} from "./chunk-JD4WV327.js";
|
|
@@ -71,7 +71,7 @@ async function main() {
|
|
|
71
71
|
await loadAuthFromConfig(env);
|
|
72
72
|
crumb("post-auth-load");
|
|
73
73
|
crumb("pre-serve-import");
|
|
74
|
-
const { serve } = await import("./serve-
|
|
74
|
+
const { serve } = await import("./serve-ITJIQJQM.js");
|
|
75
75
|
crumb("post-serve-import");
|
|
76
76
|
const portQueue = [];
|
|
77
77
|
let acceptor = null;
|
package/dist/index.js
CHANGED
|
@@ -137,7 +137,7 @@ async function handleSubcommand() {
|
|
|
137
137
|
return true;
|
|
138
138
|
}
|
|
139
139
|
if (subcommand === "start") {
|
|
140
|
-
const { startCommand } = await import("./start-
|
|
140
|
+
const { startCommand } = await import("./start-ISA4ALVS.js");
|
|
141
141
|
await startCommand();
|
|
142
142
|
return true;
|
|
143
143
|
}
|
|
@@ -159,7 +159,7 @@ async function main() {
|
|
|
159
159
|
const args = parseCliArgs();
|
|
160
160
|
if (args.serve) {
|
|
161
161
|
await loadAuthFromConfig(env);
|
|
162
|
-
const { serve } = await import("./serve-
|
|
162
|
+
const { serve } = await import("./serve-ITJIQJQM.js");
|
|
163
163
|
return serve({ isDev: env.SHIPYARD_DEV });
|
|
164
164
|
}
|
|
165
165
|
logger.error("Use `shipyard start` to run the daemon. Use --help for usage.");
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
guardedSubscribe,
|
|
13
13
|
makeInitialAttemptState,
|
|
14
14
|
shutdownFileWatcherGuard
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ALNGADQY.js";
|
|
16
16
|
import {
|
|
17
17
|
TRAILER_SCHEMA_VERSION,
|
|
18
18
|
appendTrailerToMessage,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
} from "./chunk-2UE3TNY7.js";
|
|
46
46
|
import {
|
|
47
47
|
getDaemonVersion
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-FU6IF6C2.js";
|
|
49
49
|
import {
|
|
50
50
|
collectPriorCrashDetail,
|
|
51
51
|
getRecentWasmPanicMessages
|
|
@@ -6022,7 +6022,7 @@ function nanoid(size = 21) {
|
|
|
6022
6022
|
}
|
|
6023
6023
|
|
|
6024
6024
|
// src/services/bootstrap/signaling.ts
|
|
6025
|
-
var DAEMON_NPM_VERSION = true ? "3.
|
|
6025
|
+
var DAEMON_NPM_VERSION = true ? "3.26.0" : "unknown";
|
|
6026
6026
|
function createDaemonSignaling(config) {
|
|
6027
6027
|
const agentId = config.agentId ?? nanoid();
|
|
6028
6028
|
function send(msg) {
|
|
@@ -21281,11 +21281,11 @@ function freshOccupancyOrNull(raw) {
|
|
|
21281
21281
|
}
|
|
21282
21282
|
function resolveCompactionThreshold(params) {
|
|
21283
21283
|
const { taskPrefs, runtimePrefs, runtimeDefaultFraction, maxTokens } = params;
|
|
21284
|
-
const
|
|
21285
|
-
if (
|
|
21284
|
+
const fromTask = prefsToFraction(taskPrefs, maxTokens);
|
|
21285
|
+
if (fromTask !== void 0) return { tier: "task", fraction: fromTask };
|
|
21286
21286
|
const fromRuntime = prefsToFraction(runtimePrefs, maxTokens);
|
|
21287
|
-
if (fromRuntime !== void 0) return fromRuntime;
|
|
21288
|
-
return runtimeDefaultFraction;
|
|
21287
|
+
if (fromRuntime !== void 0) return { tier: "runtime", fraction: fromRuntime };
|
|
21288
|
+
return runtimeDefaultFraction !== null ? { tier: "default", fraction: runtimeDefaultFraction } : { tier: "none", fraction: null };
|
|
21289
21289
|
}
|
|
21290
21290
|
function resolveActiveCompactionPrefs(params) {
|
|
21291
21291
|
return params.taskPrefs ?? params.runtimePrefs ?? null;
|
|
@@ -34388,6 +34388,10 @@ function applyPersistedComposerSettings(orchestrator, settings) {
|
|
|
34388
34388
|
patch.disabledMcpServers = normalizedSettings.disabledMcpServers;
|
|
34389
34389
|
if (normalizedSettings.mcpServerSnapshot != null)
|
|
34390
34390
|
patch.mcpServerSnapshot = normalizedSettings.mcpServerSnapshot;
|
|
34391
|
+
if (normalizedSettings.compactionPrefs != null)
|
|
34392
|
+
patch.compactionPrefs = normalizedSettings.compactionPrefs;
|
|
34393
|
+
if (normalizedSettings.mutedResources != null)
|
|
34394
|
+
patch.mutedResources = normalizedSettings.mutedResources;
|
|
34391
34395
|
if (Object.keys(patch).length > 0) orchestrator.applySettings(patch);
|
|
34392
34396
|
}
|
|
34393
34397
|
function persistMessageBorneComposerSettings(deps, settings) {
|
|
@@ -78817,7 +78821,13 @@ function handleSpawning(snapshot, event) {
|
|
|
78817
78821
|
}
|
|
78818
78822
|
return noop(snapshot);
|
|
78819
78823
|
}
|
|
78820
|
-
function buildStallGiveUpMessage(recoveryAttempts) {
|
|
78824
|
+
function buildStallGiveUpMessage(recoveryAttempts, stallPhase) {
|
|
78825
|
+
if (stallPhase === "first_step") {
|
|
78826
|
+
if (recoveryAttempts <= 0) {
|
|
78827
|
+
return "The agent never started running. Send a message to try again.";
|
|
78828
|
+
}
|
|
78829
|
+
return "The agent never started running \u2014 no progress at all, across every automatic retry. Resuming this session will keep failing the same way; start a fresh task instead.";
|
|
78830
|
+
}
|
|
78821
78831
|
if (recoveryAttempts <= 0) {
|
|
78822
78832
|
return "The agent stopped responding mid-run. Send a message to try again.";
|
|
78823
78833
|
}
|
|
@@ -78831,7 +78841,11 @@ function runningStallTimeout(sessionId, event) {
|
|
|
78831
78841
|
b2.effects.push({ type: "clear_queue" });
|
|
78832
78842
|
if (!event.recoveryArmed) {
|
|
78833
78843
|
b2.taskStatus("input_required");
|
|
78834
|
-
b2.emitError(
|
|
78844
|
+
b2.emitError(
|
|
78845
|
+
buildStallGiveUpMessage(event.recoveryAttempts, event.stallPhase),
|
|
78846
|
+
"sdk_error",
|
|
78847
|
+
"run_stall_timeout"
|
|
78848
|
+
);
|
|
78835
78849
|
}
|
|
78836
78850
|
b2.effects.push({ type: "kill_runner" });
|
|
78837
78851
|
return {
|
|
@@ -79654,11 +79668,19 @@ var AgentSessionManager = class {
|
|
|
79654
79668
|
let recoveryArmed = false;
|
|
79655
79669
|
let recoveryAttempts = 0;
|
|
79656
79670
|
try {
|
|
79657
|
-
const outcome = this.#config.onStallTimeout?.() ?? {
|
|
79671
|
+
const outcome = this.#config.onStallTimeout?.(decision.phase) ?? {
|
|
79672
|
+
armed: false,
|
|
79673
|
+
recoveryAttempts: 0
|
|
79674
|
+
};
|
|
79658
79675
|
recoveryArmed = outcome.armed;
|
|
79659
79676
|
recoveryAttempts = outcome.recoveryAttempts;
|
|
79660
79677
|
} finally {
|
|
79661
|
-
this.#dispatch({
|
|
79678
|
+
this.#dispatch({
|
|
79679
|
+
type: "run_stall_timeout",
|
|
79680
|
+
recoveryArmed,
|
|
79681
|
+
recoveryAttempts,
|
|
79682
|
+
stallPhase: decision.phase
|
|
79683
|
+
});
|
|
79662
79684
|
}
|
|
79663
79685
|
}, timeoutMs);
|
|
79664
79686
|
}
|
|
@@ -79687,17 +79709,34 @@ var AgentSessionManager = class {
|
|
|
79687
79709
|
// src/services/conversation/cursor-recovery-controller.ts
|
|
79688
79710
|
var MAX_SIGNAL_DEATH_RETRIES = 1;
|
|
79689
79711
|
var MAX_STALL_RESUME_RETRIES = 3;
|
|
79712
|
+
var MAX_COLD_START_RESUME_RETRIES = 1;
|
|
79690
79713
|
var STALL_RESUME_BASE_DELAY_MS = 3e3;
|
|
79691
79714
|
var STALL_RESUME_BACKOFF_MULTIPLIER = 3;
|
|
79692
79715
|
function stallResumeDelayMs(attempt) {
|
|
79693
79716
|
return STALL_RESUME_BASE_DELAY_MS * STALL_RESUME_BACKOFF_MULTIPLIER ** (attempt - 1);
|
|
79694
79717
|
}
|
|
79695
79718
|
var MAX_CRASH_DEATH_RETRIES = 1;
|
|
79719
|
+
function decideStallResume(input) {
|
|
79720
|
+
if (input.state !== "running") return { kind: "decline" };
|
|
79721
|
+
if (input.agentSystem !== AGENT_SYSTEM_CURSOR) return { kind: "decline" };
|
|
79722
|
+
const isColdStart = input.phase === "first_step";
|
|
79723
|
+
const next = (isColdStart ? input.coldStartRetries : input.midRunRetries) + 1;
|
|
79724
|
+
const max = isColdStart ? MAX_COLD_START_RESUME_RETRIES : MAX_STALL_RESUME_RETRIES;
|
|
79725
|
+
return next > max ? { kind: "give_up", recoveryAttempts: next - 1 } : { kind: "arm", retries: next };
|
|
79726
|
+
}
|
|
79696
79727
|
var CursorRecoveryController = class {
|
|
79697
79728
|
#signalDeathRetries = 0;
|
|
79698
79729
|
#stallResumeRetries = 0;
|
|
79699
79730
|
#stallResumeArmed = false;
|
|
79700
79731
|
#crashDeathRetries = 0;
|
|
79732
|
+
/**
|
|
79733
|
+
* Consecutive silent resumes attempted for stalls in which the run never
|
|
79734
|
+
* produced a first step. Deliberately NOT cleared by `reset()` — see
|
|
79735
|
+
* `decideStallResume`. `noteFirstStep()` is its only reset.
|
|
79736
|
+
*/
|
|
79737
|
+
#coldStartResumeRetries = 0;
|
|
79738
|
+
/** Which budget armed the pending resume, so the backoff reads the right counter. */
|
|
79739
|
+
#armedPhase = null;
|
|
79701
79740
|
/**
|
|
79702
79741
|
* Pending timer for the settle-delay before an armed stall resume fires.
|
|
79703
79742
|
* Cleared at every call site that supersedes the in-flight resume (new
|
|
@@ -79723,14 +79762,37 @@ var CursorRecoveryController = class {
|
|
|
79723
79762
|
this.#stallResumeTimer = null;
|
|
79724
79763
|
}
|
|
79725
79764
|
}
|
|
79726
|
-
/**
|
|
79765
|
+
/**
|
|
79766
|
+
* Reset every turn-scoped budget. Call on each new user turn and on
|
|
79767
|
+
* turn_complete.
|
|
79768
|
+
*
|
|
79769
|
+
* `#coldStartResumeRetries` is deliberately excluded: it is scoped to "has
|
|
79770
|
+
* this session ever started a run", not to the current turn, and only
|
|
79771
|
+
* `noteFirstStep()` clears it. Adding it here would restore the #5298
|
|
79772
|
+
* livelock, where each human nudge bought another full futile round.
|
|
79773
|
+
*/
|
|
79727
79774
|
reset() {
|
|
79728
79775
|
this.cancelPendingResume();
|
|
79729
79776
|
this.#signalDeathRetries = 0;
|
|
79730
79777
|
this.#stallResumeRetries = 0;
|
|
79731
79778
|
this.#stallResumeArmed = false;
|
|
79779
|
+
this.#armedPhase = null;
|
|
79732
79780
|
this.#crashDeathRetries = 0;
|
|
79733
79781
|
}
|
|
79782
|
+
/**
|
|
79783
|
+
* Call on every `step_progress`. A completed step is the only evidence that
|
|
79784
|
+
* this session can actually run, so it is the only thing that may forgive
|
|
79785
|
+
* the cold-start budget. Cheap and idempotent — fires on every step.
|
|
79786
|
+
*/
|
|
79787
|
+
noteFirstStep() {
|
|
79788
|
+
if (this.#coldStartResumeRetries === 0) return;
|
|
79789
|
+
this.#deps.log({
|
|
79790
|
+
event: "thread_cursor_cold_start_budget_cleared",
|
|
79791
|
+
threadId: this.#deps.threadId,
|
|
79792
|
+
clearedRetries: this.#coldStartResumeRetries
|
|
79793
|
+
});
|
|
79794
|
+
this.#coldStartResumeRetries = 0;
|
|
79795
|
+
}
|
|
79734
79796
|
/**
|
|
79735
79797
|
* Call on `turn_complete` instead of `reset()`. A successful auto-recovery
|
|
79736
79798
|
* otherwise leaves no trace that the daemon self-healed rather than the
|
|
@@ -79762,30 +79824,43 @@ var CursorRecoveryController = class {
|
|
|
79762
79824
|
* (see `StallTimeoutOutcome`), letting the FSM distinguish "never
|
|
79763
79825
|
* attempted" from "tried N times".
|
|
79764
79826
|
*/
|
|
79765
|
-
onStallTimeout() {
|
|
79766
|
-
|
|
79767
|
-
|
|
79768
|
-
|
|
79769
|
-
|
|
79770
|
-
|
|
79771
|
-
|
|
79772
|
-
const recoveryAttempts = this.#stallResumeRetries - 1;
|
|
79773
|
-
this.#deps.log({
|
|
79774
|
-
event: "thread_cursor_stall_resume_cap_exceeded",
|
|
79775
|
-
threadId: this.#deps.threadId,
|
|
79776
|
-
retries: this.#stallResumeRetries,
|
|
79777
|
-
maxRetries: MAX_STALL_RESUME_RETRIES
|
|
79778
|
-
});
|
|
79779
|
-
this.#stallResumeRetries = 0;
|
|
79780
|
-
return { armed: false, recoveryAttempts };
|
|
79781
|
-
}
|
|
79782
|
-
this.#deps.log({
|
|
79783
|
-
event: "thread_cursor_stall_resume_armed",
|
|
79784
|
-
threadId: this.#deps.threadId,
|
|
79785
|
-
retries: this.#stallResumeRetries
|
|
79827
|
+
onStallTimeout(phase) {
|
|
79828
|
+
const decision = decideStallResume({
|
|
79829
|
+
state: this.#deps.getState(),
|
|
79830
|
+
agentSystem: this.#deps.getAgentSystem(),
|
|
79831
|
+
phase,
|
|
79832
|
+
midRunRetries: this.#stallResumeRetries,
|
|
79833
|
+
coldStartRetries: this.#coldStartResumeRetries
|
|
79786
79834
|
});
|
|
79787
|
-
|
|
79788
|
-
|
|
79835
|
+
const isColdStart = phase === "first_step";
|
|
79836
|
+
switch (decision.kind) {
|
|
79837
|
+
case "decline":
|
|
79838
|
+
return { armed: false, recoveryAttempts: 0, phase };
|
|
79839
|
+
case "give_up":
|
|
79840
|
+
this.#deps.log({
|
|
79841
|
+
event: "thread_cursor_stall_resume_cap_exceeded",
|
|
79842
|
+
threadId: this.#deps.threadId,
|
|
79843
|
+
phase,
|
|
79844
|
+
retries: decision.recoveryAttempts + 1,
|
|
79845
|
+
maxRetries: isColdStart ? MAX_COLD_START_RESUME_RETRIES : MAX_STALL_RESUME_RETRIES
|
|
79846
|
+
});
|
|
79847
|
+
this.#stallResumeRetries = 0;
|
|
79848
|
+
return { armed: false, recoveryAttempts: decision.recoveryAttempts, phase };
|
|
79849
|
+
case "arm":
|
|
79850
|
+
if (isColdStart) this.#coldStartResumeRetries = decision.retries;
|
|
79851
|
+
else this.#stallResumeRetries = decision.retries;
|
|
79852
|
+
this.#deps.log({
|
|
79853
|
+
event: "thread_cursor_stall_resume_armed",
|
|
79854
|
+
threadId: this.#deps.threadId,
|
|
79855
|
+
phase,
|
|
79856
|
+
retries: decision.retries
|
|
79857
|
+
});
|
|
79858
|
+
this.#stallResumeArmed = true;
|
|
79859
|
+
this.#armedPhase = phase;
|
|
79860
|
+
return { armed: true, recoveryAttempts: 0, phase };
|
|
79861
|
+
default:
|
|
79862
|
+
return assertNever(decision);
|
|
79863
|
+
}
|
|
79789
79864
|
}
|
|
79790
79865
|
/**
|
|
79791
79866
|
* Consume an armed stall resume on the `kill_runner` death. By now the FSM
|
|
@@ -79801,7 +79876,8 @@ var CursorRecoveryController = class {
|
|
|
79801
79876
|
if (!this.#stallResumeArmed) return false;
|
|
79802
79877
|
this.#stallResumeArmed = false;
|
|
79803
79878
|
this.cancelPendingResume();
|
|
79804
|
-
const attempt = this.#stallResumeRetries;
|
|
79879
|
+
const attempt = this.#armedPhase === "first_step" ? this.#coldStartResumeRetries : this.#stallResumeRetries;
|
|
79880
|
+
this.#armedPhase = null;
|
|
79805
79881
|
const delayMs = stallResumeDelayMs(attempt);
|
|
79806
79882
|
this.#deps.log({
|
|
79807
79883
|
event: "thread_cursor_stall_auto_resume_scheduled",
|
|
@@ -80917,7 +80993,7 @@ var Thread = class {
|
|
|
80917
80993
|
onClose: () => this.#handleClose(),
|
|
80918
80994
|
onForceKill: () => this.#handleForceKill(),
|
|
80919
80995
|
onKillRunner: () => this.#handleForceKill(),
|
|
80920
|
-
onStallTimeout: () => this.#cursorRecovery.onStallTimeout(),
|
|
80996
|
+
onStallTimeout: (phase) => this.#cursorRecovery.onStallTimeout(phase),
|
|
80921
80997
|
log: config.log,
|
|
80922
80998
|
onSessionStateChange: (newState, prevState) => this.#notifyStateChange(newState, prevState),
|
|
80923
80999
|
stallTimeoutMs: config.stallTimeoutMs ?? null,
|
|
@@ -82068,6 +82144,7 @@ var Thread = class {
|
|
|
82068
82144
|
break;
|
|
82069
82145
|
case "step_progress":
|
|
82070
82146
|
this.#manager.notifyStepProgress();
|
|
82147
|
+
this.#cursorRecovery.noteFirstStep();
|
|
82071
82148
|
break;
|
|
82072
82149
|
/** Handled in #enqueueSubprocessEvent (off-queue heartbeat); unreachable here. */
|
|
82073
82150
|
case "stream_activity":
|
|
@@ -87723,7 +87800,7 @@ function computeTelemetryTokenContext(params) {
|
|
|
87723
87800
|
const usedTokens = params.lastWindowOccupancyEvent ? resolveLiveContextTokens(params.lastWindowOccupancyEvent).liveContextTokens : void 0;
|
|
87724
87801
|
const window = resolveContextWindow(params.currentModel, 0);
|
|
87725
87802
|
const windowTokens = window > 0 ? window : void 0;
|
|
87726
|
-
const fraction = resolveCompactionThreshold({
|
|
87803
|
+
const { fraction } = resolveCompactionThreshold({
|
|
87727
87804
|
taskPrefs: params.taskPrefs,
|
|
87728
87805
|
runtimePrefs: params.runtimePrefs,
|
|
87729
87806
|
runtimeDefaultFraction: params.compactionThreshold,
|
|
@@ -87861,7 +87938,7 @@ function decideByRatio(params) {
|
|
|
87861
87938
|
}
|
|
87862
87939
|
if (params.isCompacting || params.hasPendingTimer) return { kind: "noop" };
|
|
87863
87940
|
if (params.threshold !== null && usageRatio >= params.threshold) {
|
|
87864
|
-
return { kind: "schedule", delayMs: AUTO_COMPACTION_CANCEL_DELAY_MS };
|
|
87941
|
+
return { kind: "schedule", delayMs: AUTO_COMPACTION_CANCEL_DELAY_MS, decisionPath: "ratio" };
|
|
87865
87942
|
}
|
|
87866
87943
|
return { kind: "noop" };
|
|
87867
87944
|
}
|
|
@@ -87871,7 +87948,11 @@ function decideByMessageCount(params) {
|
|
|
87871
87948
|
if (params.liveMessageCount === void 0) return { kind: "noop" };
|
|
87872
87949
|
const baseline = params.backstopBaselineSeq ?? 0;
|
|
87873
87950
|
if (params.liveMessageCount - baseline >= AUTO_COMPACTION_MESSAGE_CEILING) {
|
|
87874
|
-
return {
|
|
87951
|
+
return {
|
|
87952
|
+
kind: "schedule",
|
|
87953
|
+
delayMs: AUTO_COMPACTION_CANCEL_DELAY_MS,
|
|
87954
|
+
decisionPath: "message_count"
|
|
87955
|
+
};
|
|
87875
87956
|
}
|
|
87876
87957
|
return { kind: "noop" };
|
|
87877
87958
|
}
|
|
@@ -88435,8 +88516,14 @@ function priorOccupancyFromTurnStats(prior) {
|
|
|
88435
88516
|
}
|
|
88436
88517
|
function handleAutoCompactionSnapshot(ctx, event, contextWindow, occupancyStale = false) {
|
|
88437
88518
|
const { liveContextTokens } = resolveLiveContextTokens(event);
|
|
88519
|
+
const resolution = resolveCompactionThreshold({
|
|
88520
|
+
taskPrefs: ctx.getTaskPrefs(),
|
|
88521
|
+
runtimePrefs: ctx.getCompactionByRuntimePrefs(),
|
|
88522
|
+
runtimeDefaultFraction: ctx.getCompactionThreshold(),
|
|
88523
|
+
maxTokens: contextWindow
|
|
88524
|
+
});
|
|
88438
88525
|
const decision = decideAutoCompaction({
|
|
88439
|
-
threshold:
|
|
88526
|
+
threshold: resolution.fraction,
|
|
88440
88527
|
liveContextTokens,
|
|
88441
88528
|
contextWindow,
|
|
88442
88529
|
isCompacting: ctx.isCompactionActive(),
|
|
@@ -88461,7 +88548,13 @@ function handleAutoCompactionSnapshot(ctx, event, contextWindow, occupancyStale
|
|
|
88461
88548
|
case "schedule":
|
|
88462
88549
|
ctx.setBackstopBaselineSeq(ctx.getLiveMessageCount());
|
|
88463
88550
|
ctx.dispatchCompactionEvent({ kind: "threshold_reached", now: Date.now() });
|
|
88464
|
-
ctx.scheduleAutoCompaction(decision.delayMs, liveContextTokens, contextWindow
|
|
88551
|
+
ctx.scheduleAutoCompaction(decision.delayMs, liveContextTokens, contextWindow, {
|
|
88552
|
+
effectiveThreshold: resolution.fraction,
|
|
88553
|
+
thresholdTier: resolution.tier,
|
|
88554
|
+
runtimeDefaultFraction: ctx.getCompactionThreshold(),
|
|
88555
|
+
decisionPath: decision.decisionPath,
|
|
88556
|
+
occupancyStale
|
|
88557
|
+
});
|
|
88465
88558
|
return;
|
|
88466
88559
|
default:
|
|
88467
88560
|
assertNever(decision);
|
|
@@ -88491,14 +88584,6 @@ function logCumulativeFallback(ctx, liveContextTokens) {
|
|
|
88491
88584
|
});
|
|
88492
88585
|
}
|
|
88493
88586
|
}
|
|
88494
|
-
function resolveEffectiveThresholdFraction(ctx, contextWindow) {
|
|
88495
|
-
return resolveCompactionThreshold({
|
|
88496
|
-
taskPrefs: ctx.getTaskPrefs(),
|
|
88497
|
-
runtimePrefs: ctx.getCompactionByRuntimePrefs(),
|
|
88498
|
-
runtimeDefaultFraction: ctx.getCompactionThreshold(),
|
|
88499
|
-
maxTokens: contextWindow
|
|
88500
|
-
});
|
|
88501
|
-
}
|
|
88502
88587
|
|
|
88503
88588
|
// src/services/task/orchestrator/compaction-controller.ts
|
|
88504
88589
|
var CompactionController = class {
|
|
@@ -88963,7 +89048,7 @@ var CompactionController = class {
|
|
|
88963
89048
|
* Schedule the auto-compaction timer (called by the auto-compaction
|
|
88964
89049
|
* decision from task-event-dispatch via the eventCtx).
|
|
88965
89050
|
*/
|
|
88966
|
-
scheduleAutoCompaction(delayMs, liveContextTokens, contextWindow) {
|
|
89051
|
+
scheduleAutoCompaction(delayMs, liveContextTokens, contextWindow, decisionContext) {
|
|
88967
89052
|
if (this.#pendingAutoCompactionTimer !== null) return;
|
|
88968
89053
|
const cancelDeadline = Date.now() + delayMs;
|
|
88969
89054
|
this.#pendingAutoCompactionTimer = setTimeout(() => {
|
|
@@ -88980,7 +89065,11 @@ var CompactionController = class {
|
|
|
88980
89065
|
this.#deps.log({
|
|
88981
89066
|
event: "auto_compaction_pending",
|
|
88982
89067
|
taskId: this.#deps.taskId,
|
|
88983
|
-
|
|
89068
|
+
effectiveThreshold: decisionContext.effectiveThreshold,
|
|
89069
|
+
thresholdTier: decisionContext.thresholdTier,
|
|
89070
|
+
runtimeDefaultFraction: decisionContext.runtimeDefaultFraction,
|
|
89071
|
+
decisionPath: decisionContext.decisionPath,
|
|
89072
|
+
occupancyStale: decisionContext.occupancyStale,
|
|
88984
89073
|
liveContextTokens,
|
|
88985
89074
|
contextWindow,
|
|
88986
89075
|
cancelDeadline
|
|
@@ -94523,7 +94612,12 @@ var Task = class {
|
|
|
94523
94612
|
setAutoCompactionSuppressedUntilBelow: (value) => {
|
|
94524
94613
|
this.#compaction.setAutoCompactionSuppressedUntilBelow(value);
|
|
94525
94614
|
},
|
|
94526
|
-
scheduleAutoCompaction: (delayMs, liveContextTokens, contextWindow) => this.#compaction.scheduleAutoCompaction(
|
|
94615
|
+
scheduleAutoCompaction: (delayMs, liveContextTokens, contextWindow, decisionContext) => this.#compaction.scheduleAutoCompaction(
|
|
94616
|
+
delayMs,
|
|
94617
|
+
liveContextTokens,
|
|
94618
|
+
contextWindow,
|
|
94619
|
+
decisionContext
|
|
94620
|
+
),
|
|
94527
94621
|
getCompactionThreshold: () => this.#compaction.getCompactionThreshold(),
|
|
94528
94622
|
getCompactionByRuntimePrefs: () => this.#compaction.getCompactionByRuntimePrefs(),
|
|
94529
94623
|
getTaskPrefs: () => this.#deps.taskStateStore.getTaskSync(this.#taskIdRef.current)?.composerSettings?.compactionPrefs ?? null,
|
|
@@ -103626,4 +103720,4 @@ export {
|
|
|
103626
103720
|
decideWorkspaceScope,
|
|
103627
103721
|
serve
|
|
103628
103722
|
};
|
|
103629
|
-
//# sourceMappingURL=serve-
|
|
103723
|
+
//# sourceMappingURL=serve-ITJIQJQM.js.map
|