svamp-cli 0.2.338 → 0.2.340
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/{adminCommands-BKGtamkH.mjs → adminCommands-K1oo5Zxr.mjs} +1 -1
- package/dist/{agentCommands-f5J1vh6G.mjs → agentCommands-ChVM6K3a.mjs} +5 -5
- package/dist/{auth-lJyH6SZI.mjs → auth-D3lxMSjT.mjs} +1 -1
- package/dist/{cli-BqCtL5Nf.mjs → cli-DS4Xb1_k.mjs} +77 -77
- package/dist/cli.mjs +2 -2
- package/dist/{commands-DkqOgCiK.mjs → commands-B--vQWTy.mjs} +3 -3
- package/dist/{commands-CZkeeXsr.mjs → commands-CENM3waA.mjs} +1 -1
- package/dist/{commands-C61n8oPq.mjs → commands-CIfNXKBb.mjs} +2 -2
- package/dist/{commands-RiTiB0yP.mjs → commands-CQ37lyCn.mjs} +2 -2
- package/dist/{commands-CRrmwZQh.mjs → commands-CTusBMbx.mjs} +3 -3
- package/dist/{commands-CBwYOKmf.mjs → commands-Daivh0OQ.mjs} +1 -1
- package/dist/{commands-CnjJSLfu.mjs → commands-i4sJJo_T.mjs} +3 -3
- package/dist/{commands-dB6sFeRR.mjs → commands-oblvzodh.mjs} +11 -11
- package/dist/{fleet-BehFx6MX.mjs → fleet-C4R6E2Hp.mjs} +2 -2
- package/dist/{headlessCli-BvYt6HPK.mjs → headlessCli-CTp95z2R.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{notifyCommands-Blna-Sqz.mjs → notifyCommands-CYQ80UQK.mjs} +1 -1
- package/dist/{package-Bp7_bE4c.mjs → package-4ZZ-NyHo.mjs} +1 -1
- package/dist/{pinnedClaudeCode-C43KnZ-Q.mjs → pinnedClaudeCode-LCVY4Otm.mjs} +1 -1
- package/dist/{rpc-CG6XWFXY.mjs → rpc-C_4D0N6G.mjs} +1 -1
- package/dist/{rpc-BQ75iSkj.mjs → rpc-Hzx79dRT.mjs} +1 -1
- package/dist/{run-9rEzf5ez.mjs → run-DQnBdAxD.mjs} +1 -1
- package/dist/{run--wM4gBLw.mjs → run-zvn6DVUS.mjs} +22 -236
- package/dist/{scheduler-QsXyNajm.mjs → scheduler-BiHJvgws.mjs} +1 -1
- package/dist/{serveCommands-C7jU4-zI.mjs → serveCommands-CQMkfTEw.mjs} +10 -10
- package/dist/{sideband-BBOHmvTf.mjs → sideband-BskNkJLx.mjs} +1 -1
- package/package.json +1 -1
|
@@ -8509,7 +8509,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
|
|
|
8509
8509
|
}
|
|
8510
8510
|
const deps = buildSessionDeps(rpc, { cwd, ownerEmail: owner });
|
|
8511
8511
|
const sender = { name: context?.user?.email || context?.user?.id || "user", kind: "user", verified: true };
|
|
8512
|
-
const { toolsForRole } = await import('./sideband-
|
|
8512
|
+
const { toolsForRole } = await import('./sideband-BskNkJLx.mjs');
|
|
8513
8513
|
const r2 = await runWiseAgent({ message: params.message, sender, config: { tools: toolsForRole(role2) }, deps, transport, model: resolved.model });
|
|
8514
8514
|
return fmt(r2);
|
|
8515
8515
|
}
|
|
@@ -8641,7 +8641,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
|
|
|
8641
8641
|
return { ok: false, call_id: callId, status: "busy", error: "channel is busy (too many concurrent requests) \u2014 retry shortly" };
|
|
8642
8642
|
}
|
|
8643
8643
|
const rendered = renderMessage(c, { sender: r.sender, body: { message: kwargs.message }, callId });
|
|
8644
|
-
const { queryCore } = await import('./commands-
|
|
8644
|
+
const { queryCore } = await import('./commands-Daivh0OQ.mjs');
|
|
8645
8645
|
const timeout = c.reply?.timeout_sec || 120;
|
|
8646
8646
|
let result;
|
|
8647
8647
|
let thrownSessionId;
|
|
@@ -18559,7 +18559,7 @@ You share this machine and project folder with other agent sessions (same user,
|
|
|
18559
18559
|
}
|
|
18560
18560
|
|
|
18561
18561
|
const STANDARD_WINDOWS = [2e5, 1e6];
|
|
18562
|
-
const DEFAULT_MAX_CONTEXT_WINDOW =
|
|
18562
|
+
const DEFAULT_MAX_CONTEXT_WINDOW = 0;
|
|
18563
18563
|
function resolveMaxContextWindow(env = process.env) {
|
|
18564
18564
|
const raw = (env.SVAMP_MAX_CONTEXT_WINDOW ?? "").trim().toLowerCase();
|
|
18565
18565
|
if (!raw) return DEFAULT_MAX_CONTEXT_WINDOW;
|
|
@@ -18652,49 +18652,11 @@ function resolveContextWindow(opts) {
|
|
|
18652
18652
|
return candidate;
|
|
18653
18653
|
}
|
|
18654
18654
|
|
|
18655
|
-
const DEFAULT_AUTO_COMPACT_RATIO = 0.85;
|
|
18656
|
-
const MIN_WINDOW_FOR_BACKSTOP = 5e4;
|
|
18657
|
-
const MIN_RATIO = 0.5;
|
|
18658
|
-
const MAX_RATIO = 0.97;
|
|
18659
18655
|
function resolveAutoCompactEnabled(env = process.env) {
|
|
18660
18656
|
const v = (env.SVAMP_AUTO_COMPACT ?? "").trim().toLowerCase();
|
|
18661
18657
|
if (v === "0" || v === "false" || v === "off" || v === "no") return false;
|
|
18662
18658
|
return true;
|
|
18663
18659
|
}
|
|
18664
|
-
function resolveAutoCompactRatio(env = process.env) {
|
|
18665
|
-
const raw = (env.SVAMP_AUTO_COMPACT_RATIO ?? "").trim();
|
|
18666
|
-
if (!raw) return DEFAULT_AUTO_COMPACT_RATIO;
|
|
18667
|
-
const n = Number(raw);
|
|
18668
|
-
if (!Number.isFinite(n)) return DEFAULT_AUTO_COMPACT_RATIO;
|
|
18669
|
-
if (n < MIN_RATIO) return MIN_RATIO;
|
|
18670
|
-
if (n > MAX_RATIO) return MAX_RATIO;
|
|
18671
|
-
return n;
|
|
18672
|
-
}
|
|
18673
|
-
function decideProactiveCompaction(opts) {
|
|
18674
|
-
const { observed, window, ratio, enabled } = opts;
|
|
18675
|
-
const pct = window > 0 ? observed / window : 0;
|
|
18676
|
-
if (!enabled) return { shouldCompact: false, window, pct, reason: "disabled" };
|
|
18677
|
-
if (!(window >= MIN_WINDOW_FOR_BACKSTOP)) return { shouldCompact: false, window, pct, reason: "window-too-small" };
|
|
18678
|
-
if (!(observed > 0)) return { shouldCompact: false, window, pct, reason: "no-observed" };
|
|
18679
|
-
if (pct >= ratio) return { shouldCompact: true, window, pct, reason: "threshold" };
|
|
18680
|
-
return { shouldCompact: false, window, pct, reason: "below-threshold" };
|
|
18681
|
-
}
|
|
18682
|
-
function shouldPreTurnCompact(input) {
|
|
18683
|
-
if (!input.enabled || input.disabled) return false;
|
|
18684
|
-
if (input.incomingIsCompact) return false;
|
|
18685
|
-
return decideProactiveCompaction({
|
|
18686
|
-
observed: input.observed,
|
|
18687
|
-
window: input.window,
|
|
18688
|
-
ratio: input.ratio,
|
|
18689
|
-
enabled: input.enabled
|
|
18690
|
-
}).shouldCompact;
|
|
18691
|
-
}
|
|
18692
|
-
function fmtK(n) {
|
|
18693
|
-
return `${Math.round((n || 0) / 1e3)}K`;
|
|
18694
|
-
}
|
|
18695
|
-
function describeAutoCompact(observed, window, pct) {
|
|
18696
|
-
return `Context at ${Math.round(pct * 100)}% of the ${fmtK(window)} window (${fmtK(observed)} tokens) \u2014 compacting automatically to stay under the model's limit.`;
|
|
18697
|
-
}
|
|
18698
18660
|
function isContextTooLongError(text) {
|
|
18699
18661
|
if (!text) return false;
|
|
18700
18662
|
const t = text.toLowerCase();
|
|
@@ -18712,67 +18674,11 @@ function isAutocompactThrashError(text) {
|
|
|
18712
18674
|
if (t.includes("reading in smaller chunks") && t.includes("context")) return true;
|
|
18713
18675
|
return false;
|
|
18714
18676
|
}
|
|
18715
|
-
function shouldEvaluateProactiveCompaction(state) {
|
|
18716
|
-
if (!state.enabled) return false;
|
|
18717
|
-
if (state.disabled) return false;
|
|
18718
|
-
if (state.turnErrored) return false;
|
|
18719
|
-
if (state.compactPending) return false;
|
|
18720
|
-
if (state.justCompacted) return false;
|
|
18721
|
-
return true;
|
|
18722
|
-
}
|
|
18723
|
-
function compactSupportedFromSlashCommands(slashCommands) {
|
|
18724
|
-
if (!Array.isArray(slashCommands) || slashCommands.length === 0) return void 0;
|
|
18725
|
-
return slashCommands.some(
|
|
18726
|
-
(c) => typeof c === "string" && c.trim().replace(/^\//, "").toLowerCase() === "compact"
|
|
18727
|
-
);
|
|
18728
|
-
}
|
|
18729
|
-
const DEFAULT_COMPACT_NO_BOUNDARY_STRIKES = 3;
|
|
18730
|
-
function decideCompactUnsupported(input) {
|
|
18731
|
-
const prior = Math.max(0, input.priorStrikes || 0);
|
|
18732
|
-
const limit = Math.max(1, input.maxStrikes);
|
|
18733
|
-
if (input.turnErrored) {
|
|
18734
|
-
return { disable: false, warnUnsupported: false, strikes: prior, reason: "errored-turn" };
|
|
18735
|
-
}
|
|
18736
|
-
if (!input.wasAutoInjected) {
|
|
18737
|
-
return {
|
|
18738
|
-
disable: false,
|
|
18739
|
-
warnUnsupported: input.compactSupported === false,
|
|
18740
|
-
strikes: prior,
|
|
18741
|
-
reason: "user-typed"
|
|
18742
|
-
};
|
|
18743
|
-
}
|
|
18744
|
-
if (input.compactSupported === false) {
|
|
18745
|
-
return { disable: true, warnUnsupported: true, strikes: prior + 1, reason: "unsupported" };
|
|
18746
|
-
}
|
|
18747
|
-
const strikes = prior + 1;
|
|
18748
|
-
if (strikes >= limit) {
|
|
18749
|
-
return { disable: true, warnUnsupported: false, strikes, reason: "strikes-exhausted" };
|
|
18750
|
-
}
|
|
18751
|
-
return { disable: false, warnUnsupported: false, strikes, reason: "strike" };
|
|
18752
|
-
}
|
|
18753
|
-
function describeNoBoundary(strikes, limit) {
|
|
18754
|
-
return `Automatic compaction ran but reported no compaction boundary (attempt ${strikes} of ${limit}) \u2014 usually because there was nothing left to compact. Keeping automatic compaction enabled.`;
|
|
18755
|
-
}
|
|
18756
18677
|
function shouldAccountLoopTurn(state) {
|
|
18757
18678
|
if (state.justCompacted) return false;
|
|
18758
18679
|
if (state.compactPending) return false;
|
|
18759
18680
|
return true;
|
|
18760
18681
|
}
|
|
18761
|
-
function shouldPersistObservedContext(state) {
|
|
18762
|
-
if (state.justCompacted) return false;
|
|
18763
|
-
if (state.compactPending) return false;
|
|
18764
|
-
if (state.turnErrored) return false;
|
|
18765
|
-
return true;
|
|
18766
|
-
}
|
|
18767
|
-
function postCompactionObservedContext(compactMetadata) {
|
|
18768
|
-
const md = compactMetadata;
|
|
18769
|
-
if (!md || typeof md !== "object") return 0;
|
|
18770
|
-
for (const key of ["post_tokens", "postTokens", "post_token_count", "tokens_after", "after_tokens"]) {
|
|
18771
|
-
const v = md[key];
|
|
18772
|
-
if (typeof v === "number" && Number.isFinite(v) && v > 0) return Math.floor(v);
|
|
18773
|
-
}
|
|
18774
|
-
return 0;
|
|
18775
|
-
}
|
|
18776
18682
|
|
|
18777
18683
|
function fmtTokens(n) {
|
|
18778
18684
|
return Math.max(0, Math.round(n)).toLocaleString("en-US");
|
|
@@ -18799,10 +18705,6 @@ function describeCompaction(meta) {
|
|
|
18799
18705
|
}
|
|
18800
18706
|
return `Context compacted (${trigger}).`;
|
|
18801
18707
|
}
|
|
18802
|
-
function compactUnsupportedWarning(version) {
|
|
18803
|
-
const v = "";
|
|
18804
|
-
return `\u26A0\uFE0F /compact did not run${v} \u2014 Claude Code forwarded it as a normal message, so nothing was compacted. In-session /compact needs a newer Claude Code (>= 2.1.205). Ask the machine owner to upgrade (e.g. \`svamp fleet upgrade-claude\`), then try again.`;
|
|
18805
|
-
}
|
|
18806
18708
|
|
|
18807
18709
|
function shouldRunZombieProbe(args) {
|
|
18808
18710
|
return args.hasActiveSessions && !args.inGrace && args.consecutiveHeartbeatFailures === 0 && args.inboundSilenceMs > args.thresholdMs;
|
|
@@ -20904,7 +20806,7 @@ async function startDaemon(options) {
|
|
|
20904
20806
|
try {
|
|
20905
20807
|
const dir = loadSessionIndex()[sessionId]?.directory;
|
|
20906
20808
|
if (!dir) return;
|
|
20907
|
-
const { reconcileServiceLinks } = await import('./agentCommands-
|
|
20809
|
+
const { reconcileServiceLinks } = await import('./agentCommands-ChVM6K3a.mjs');
|
|
20908
20810
|
const configPath = getSvampConfigPath(dir, sessionId);
|
|
20909
20811
|
const config = readSvampConfig(configPath);
|
|
20910
20812
|
const entries = Array.from(urls.entries());
|
|
@@ -20926,7 +20828,7 @@ async function startDaemon(options) {
|
|
|
20926
20828
|
try {
|
|
20927
20829
|
const dir = loadSessionIndex()[sessionId]?.directory;
|
|
20928
20830
|
if (!dir) return;
|
|
20929
|
-
const { reconcileServiceLinks } = await import('./agentCommands-
|
|
20831
|
+
const { reconcileServiceLinks } = await import('./agentCommands-ChVM6K3a.mjs');
|
|
20930
20832
|
const configPath = getSvampConfigPath(dir, sessionId);
|
|
20931
20833
|
const config = readSvampConfig(configPath);
|
|
20932
20834
|
const incoming = [{
|
|
@@ -20947,7 +20849,7 @@ async function startDaemon(options) {
|
|
|
20947
20849
|
try {
|
|
20948
20850
|
const dir = loadSessionIndex()[sessionId]?.directory;
|
|
20949
20851
|
if (!dir) return;
|
|
20950
|
-
const { dropServiceLinks } = await import('./agentCommands-
|
|
20852
|
+
const { dropServiceLinks } = await import('./agentCommands-ChVM6K3a.mjs');
|
|
20951
20853
|
const configPath = getSvampConfigPath(dir, sessionId);
|
|
20952
20854
|
const config = readSvampConfig(configPath);
|
|
20953
20855
|
if (dropServiceLinks(config, "serve", mountName)) {
|
|
@@ -20963,7 +20865,7 @@ async function startDaemon(options) {
|
|
|
20963
20865
|
try {
|
|
20964
20866
|
const dir = loadSessionIndex()[sessionId]?.directory;
|
|
20965
20867
|
if (!dir) return;
|
|
20966
|
-
const { dropServiceLinks } = await import('./agentCommands-
|
|
20868
|
+
const { dropServiceLinks } = await import('./agentCommands-ChVM6K3a.mjs');
|
|
20967
20869
|
const configPath = getSvampConfigPath(dir, sessionId);
|
|
20968
20870
|
const config = readSvampConfig(configPath);
|
|
20969
20871
|
if (dropServiceLinks(config, "tunnel", tunnelName)) {
|
|
@@ -20980,7 +20882,7 @@ async function startDaemon(options) {
|
|
|
20980
20882
|
let managedLinkSessionsSeeded = false;
|
|
20981
20883
|
async function reconcileAllServiceLinks() {
|
|
20982
20884
|
try {
|
|
20983
|
-
const { reconcileServiceLinksExact, hasManagedServiceLink } = await import('./agentCommands-
|
|
20885
|
+
const { reconcileServiceLinksExact, hasManagedServiceLink } = await import('./agentCommands-ChVM6K3a.mjs');
|
|
20984
20886
|
const desiredBySession = /* @__PURE__ */ new Map();
|
|
20985
20887
|
const push = (sessionId, entry) => {
|
|
20986
20888
|
if (!sessionId || !entry.url) return;
|
|
@@ -21085,7 +20987,7 @@ async function startDaemon(options) {
|
|
|
21085
20987
|
ensureAutoInstalledCommands(logger);
|
|
21086
20988
|
(async () => {
|
|
21087
20989
|
try {
|
|
21088
|
-
const { beginClaudeVersionReconcile, CLAUDE_VERSION_RECHECK_MS } = await import('./pinnedClaudeCode-
|
|
20990
|
+
const { beginClaudeVersionReconcile, CLAUDE_VERSION_RECHECK_MS } = await import('./pinnedClaudeCode-LCVY4Otm.mjs');
|
|
21089
20991
|
const onResult = (result) => {
|
|
21090
20992
|
if (result?.kind === "install-failed" || result?.kind === "skipped" || result?.kind === "not-installed") {
|
|
21091
20993
|
logger.log(`[claude-version] WARNING \u2014 machine is NOT on the pinned Claude Code (${result.kind}). Sessions are running an untested build.`);
|
|
@@ -22025,15 +21927,10 @@ ${parts.join("\n")}`);
|
|
|
22025
21927
|
let overloadBailedThisTurn = false;
|
|
22026
21928
|
let pendingCompactTurn = false;
|
|
22027
21929
|
const autoCompactEnabled = resolveAutoCompactEnabled();
|
|
22028
|
-
const autoCompactRatio = resolveAutoCompactRatio();
|
|
22029
21930
|
const maxContextWindow = resolveMaxContextWindow();
|
|
22030
|
-
let autoCompactWasAutoInjected = false;
|
|
22031
|
-
let autoCompactDisabled = false;
|
|
22032
21931
|
let autoCompactRecoveryTried = false;
|
|
22033
21932
|
let justCompactedTurn = false;
|
|
22034
21933
|
let compactTurnLatch = false;
|
|
22035
|
-
let compactNoBoundaryStrikes = 0;
|
|
22036
|
-
let compactSupported = void 0;
|
|
22037
21934
|
let turnRequestUsages = [];
|
|
22038
21935
|
let noIsolationWarned = false;
|
|
22039
21936
|
const RATELIMIT_CFG = getRateLimitRetryConfig();
|
|
@@ -22399,7 +22296,7 @@ ${parts.join("\n")}`);
|
|
|
22399
22296
|
} else if (isRetryableRateLimit(resultText, msg.api_error_status) && scheduleRateLimitRetry2()) {
|
|
22400
22297
|
rateLimitRetryScheduled = true;
|
|
22401
22298
|
lastErrorMessagePushed = true;
|
|
22402
|
-
} else if (isContextTooLongError(resultText) && autoCompactEnabled && !
|
|
22299
|
+
} else if (isContextTooLongError(resultText) && autoCompactEnabled && !autoCompactRecoveryTried) {
|
|
22403
22300
|
autoCompactRecoveryTried = true;
|
|
22404
22301
|
logger.log(`[Session ${sessionId}] Context-overflow 400 \u2014 injecting one automatic /compact recovery`);
|
|
22405
22302
|
sessionService.pushMessage(
|
|
@@ -22479,32 +22376,7 @@ ${parts.join("\n")}`);
|
|
|
22479
22376
|
}
|
|
22480
22377
|
if (pendingCompactTurn) {
|
|
22481
22378
|
pendingCompactTurn = false;
|
|
22482
|
-
|
|
22483
|
-
autoCompactWasAutoInjected = false;
|
|
22484
|
-
const d = decideCompactUnsupported({
|
|
22485
|
-
wasAutoInjected: wasAuto,
|
|
22486
|
-
turnErrored: !!msg.is_error,
|
|
22487
|
-
compactSupported,
|
|
22488
|
-
priorStrikes: compactNoBoundaryStrikes,
|
|
22489
|
-
maxStrikes: DEFAULT_COMPACT_NO_BOUNDARY_STRIKES
|
|
22490
|
-
});
|
|
22491
|
-
compactNoBoundaryStrikes = d.strikes;
|
|
22492
|
-
if (d.disable) {
|
|
22493
|
-
autoCompactDisabled = true;
|
|
22494
|
-
logger.log(`[Session ${sessionId}] Disabling the auto-compaction backstop for this session (${d.reason})`);
|
|
22495
|
-
}
|
|
22496
|
-
logger.log(`[Session ${sessionId}] /compact produced no compaction boundary (reason=${d.reason}, strikes=${d.strikes}, supported=${String(compactSupported)}, errored=${!!msg.is_error})`);
|
|
22497
|
-
if (d.warnUnsupported) {
|
|
22498
|
-
sessionService.pushMessage(
|
|
22499
|
-
{ type: "message", message: compactUnsupportedWarning(), level: "warning" },
|
|
22500
|
-
"event"
|
|
22501
|
-
);
|
|
22502
|
-
} else if (wasAuto && d.reason !== "errored-turn") {
|
|
22503
|
-
sessionService.pushMessage(
|
|
22504
|
-
{ type: "message", message: describeNoBoundary(d.strikes, DEFAULT_COMPACT_NO_BOUNDARY_STRIKES), level: "warning" },
|
|
22505
|
-
"event"
|
|
22506
|
-
);
|
|
22507
|
-
}
|
|
22379
|
+
logger.log(`[Session ${sessionId}] /compact produced no compaction boundary (errored=${!!msg.is_error})`);
|
|
22508
22380
|
}
|
|
22509
22381
|
if (!msg.is_error) {
|
|
22510
22382
|
resetRateLimitStreak();
|
|
@@ -22526,18 +22398,10 @@ ${parts.join("\n")}`);
|
|
|
22526
22398
|
mainModel: lastMainModel,
|
|
22527
22399
|
currentWindow: sessionMetadata.contextWindow
|
|
22528
22400
|
}), maxContextWindow);
|
|
22529
|
-
|
|
22530
|
-
const mayPersistObserved = shouldPersistObservedContext({
|
|
22531
|
-
justCompacted: justCompactedTurn,
|
|
22532
|
-
compactPending: compactTurnLatch,
|
|
22533
|
-
turnErrored: !!msg.is_error
|
|
22534
|
-
});
|
|
22535
|
-
const persistObserved = mayPersistObserved && observedThisTurn > 0 && observedThisTurn !== sessionMetadata.observedContext;
|
|
22536
|
-
if (resolvedWindow > 0 && resolvedWindow !== sessionMetadata.contextWindow || persistObserved) {
|
|
22401
|
+
if (resolvedWindow > 0 && resolvedWindow !== sessionMetadata.contextWindow) {
|
|
22537
22402
|
sessionMetadata = {
|
|
22538
22403
|
...sessionMetadata,
|
|
22539
|
-
|
|
22540
|
-
...persistObserved ? { observedContext: observedThisTurn } : {}
|
|
22404
|
+
contextWindow: resolvedWindow
|
|
22541
22405
|
};
|
|
22542
22406
|
sessionService.updateMetadata(sessionMetadata);
|
|
22543
22407
|
}
|
|
@@ -22611,44 +22475,8 @@ ${parts.join("\n")}`);
|
|
|
22611
22475
|
logger.log(`[Session ${sessionId}] ${taskInfo}`);
|
|
22612
22476
|
sessionService.pushMessage({ type: "session_event", message: taskInfo }, "session");
|
|
22613
22477
|
}
|
|
22614
|
-
const mayEvaluateLayer1 = shouldEvaluateProactiveCompaction({
|
|
22615
|
-
justCompacted: justCompactedTurn,
|
|
22616
|
-
compactPending: pendingCompactTurn,
|
|
22617
|
-
turnErrored: !!msg.is_error,
|
|
22618
|
-
disabled: autoCompactDisabled,
|
|
22619
|
-
enabled: autoCompactEnabled
|
|
22620
|
-
});
|
|
22621
22478
|
justCompactedTurn = false;
|
|
22622
22479
|
compactTurnLatch = false;
|
|
22623
|
-
if (mayEvaluateLayer1) {
|
|
22624
|
-
try {
|
|
22625
|
-
const observed = observedThisTurn;
|
|
22626
|
-
const decision = decideProactiveCompaction({
|
|
22627
|
-
observed,
|
|
22628
|
-
window: resolvedWindow > 0 ? resolvedWindow : sessionMetadata.contextWindow || 0,
|
|
22629
|
-
ratio: autoCompactRatio,
|
|
22630
|
-
enabled: autoCompactEnabled
|
|
22631
|
-
});
|
|
22632
|
-
if (decision.shouldCompact) {
|
|
22633
|
-
logger.log(`[Session ${sessionId}] Auto-compaction backstop firing at ${Math.round(decision.pct * 100)}% of ${decision.window} window (${observed} tokens) \u2014 injecting /compact`);
|
|
22634
|
-
sessionService.pushMessage(
|
|
22635
|
-
{ type: "message", message: describeAutoCompact(observed, decision.window, decision.pct), level: "warning" },
|
|
22636
|
-
"event"
|
|
22637
|
-
);
|
|
22638
|
-
const existingQueue = sessionMetadata.messageQueue || [];
|
|
22639
|
-
sessionMetadata = {
|
|
22640
|
-
...sessionMetadata,
|
|
22641
|
-
messageQueue: [
|
|
22642
|
-
{ id: randomUUID(), text: "/compact", displayText: "\u{1F5DC}\uFE0F Auto-compacting context", createdAt: Date.now(), alreadyStored: true, autoCompact: true },
|
|
22643
|
-
...existingQueue
|
|
22644
|
-
]
|
|
22645
|
-
};
|
|
22646
|
-
sessionService.updateMetadata(sessionMetadata);
|
|
22647
|
-
}
|
|
22648
|
-
} catch (e) {
|
|
22649
|
-
logger.log(`[Session ${sessionId}] Auto-compaction backstop check failed: ${e?.message}`);
|
|
22650
|
-
}
|
|
22651
|
-
}
|
|
22652
22480
|
const queueLen = sessionMetadata.messageQueue?.length ?? 0;
|
|
22653
22481
|
if (queueLen > 0 && claudeResumeId && !trackedSession.stopped) {
|
|
22654
22482
|
setTimeout(() => processMessageQueueRef?.(), 200);
|
|
@@ -22685,7 +22513,6 @@ ${parts.join("\n")}`);
|
|
|
22685
22513
|
userMessagePending = false;
|
|
22686
22514
|
if (msg.slash_commands && Array.isArray(msg.slash_commands)) {
|
|
22687
22515
|
sessionMetadata = { ...sessionMetadata, slashCommands: msg.slash_commands };
|
|
22688
|
-
compactSupported = compactSupportedFromSlashCommands(msg.slash_commands);
|
|
22689
22516
|
}
|
|
22690
22517
|
if (typeof msg.model === "string" && msg.model.length > 0) {
|
|
22691
22518
|
lastMainModel = msg.model;
|
|
@@ -22737,19 +22564,9 @@ ${parts.join("\n")}`);
|
|
|
22737
22564
|
sessionService.pushMessage(msg, "session");
|
|
22738
22565
|
} else if (msg.type === "system" && msg.subtype === "compact_boundary") {
|
|
22739
22566
|
pendingCompactTurn = false;
|
|
22740
|
-
autoCompactWasAutoInjected = false;
|
|
22741
22567
|
autoCompactRecoveryTried = false;
|
|
22742
22568
|
justCompactedTurn = true;
|
|
22743
22569
|
compactTurnLatch = true;
|
|
22744
|
-
compactNoBoundaryStrikes = 0;
|
|
22745
|
-
try {
|
|
22746
|
-
const postObserved = postCompactionObservedContext(msg.compact_metadata);
|
|
22747
|
-
if (sessionMetadata.observedContext !== postObserved) {
|
|
22748
|
-
sessionMetadata = { ...sessionMetadata, observedContext: postObserved };
|
|
22749
|
-
sessionService.updateMetadata(sessionMetadata);
|
|
22750
|
-
}
|
|
22751
|
-
} catch {
|
|
22752
|
-
}
|
|
22753
22570
|
const compactLine = describeCompaction(msg.compact_metadata);
|
|
22754
22571
|
logger.log(`[Session ${sessionId}] ${compactLine}`);
|
|
22755
22572
|
sessionService.pushMessage(
|
|
@@ -23180,39 +22997,9 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
|
|
|
23180
22997
|
pendingCompactTurn = isCompactCommand(text);
|
|
23181
22998
|
if (pendingCompactTurn) compactTurnLatch = true;
|
|
23182
22999
|
if (!claudeProcess || claudeProcess.exitCode !== null) {
|
|
23183
|
-
|
|
23184
|
-
|
|
23185
|
-
|
|
23186
|
-
observed: preTurnObserved,
|
|
23187
|
-
window: preTurnWindow,
|
|
23188
|
-
ratio: autoCompactRatio,
|
|
23189
|
-
enabled: autoCompactEnabled,
|
|
23190
|
-
disabled: autoCompactDisabled,
|
|
23191
|
-
incomingIsCompact: isCompactCommand(text)
|
|
23192
|
-
})) {
|
|
23193
|
-
const pct = preTurnWindow > 0 ? preTurnObserved / preTurnWindow : 0;
|
|
23194
|
-
logger.log(`[Session ${sessionId}] Pre-turn auto-compaction: persisted observed ${preTurnObserved} tokens at ${Math.round(pct * 100)}% of ${preTurnWindow} window \u2014 compacting before delivering message`);
|
|
23195
|
-
sessionService.pushMessage(
|
|
23196
|
-
{ type: "message", message: describeAutoCompact(preTurnObserved, preTurnWindow, pct), level: "warning" },
|
|
23197
|
-
"event"
|
|
23198
|
-
);
|
|
23199
|
-
const existingQueue = sessionMetadata.messageQueue || [];
|
|
23200
|
-
sessionMetadata = {
|
|
23201
|
-
...sessionMetadata,
|
|
23202
|
-
messageQueue: [...existingQueue, { id: randomUUID(), text, createdAt: Date.now(), alreadyStored: true }]
|
|
23203
|
-
};
|
|
23204
|
-
sessionService.updateMetadata(sessionMetadata);
|
|
23205
|
-
pendingCompactTurn = true;
|
|
23206
|
-
compactTurnLatch = true;
|
|
23207
|
-
autoCompactWasAutoInjected = true;
|
|
23208
|
-
spawnClaude("/compact", msgMeta);
|
|
23209
|
-
signalProcessing(true);
|
|
23210
|
-
sessionWasProcessing = true;
|
|
23211
|
-
} else {
|
|
23212
|
-
spawnClaude(text, msgMeta);
|
|
23213
|
-
signalProcessing(true);
|
|
23214
|
-
sessionWasProcessing = true;
|
|
23215
|
-
}
|
|
23000
|
+
spawnClaude(text, msgMeta);
|
|
23001
|
+
signalProcessing(true);
|
|
23002
|
+
sessionWasProcessing = true;
|
|
23216
23003
|
} else if (writeUserFrameToClaude(text)) {
|
|
23217
23004
|
signalProcessing(true);
|
|
23218
23005
|
sessionWasProcessing = true;
|
|
@@ -23597,11 +23384,11 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
|
|
|
23597
23384
|
});
|
|
23598
23385
|
},
|
|
23599
23386
|
onIssue: async (params) => {
|
|
23600
|
-
const { issueRpc } = await import('./rpc-
|
|
23387
|
+
const { issueRpc } = await import('./rpc-Hzx79dRT.mjs');
|
|
23601
23388
|
return issueRpc(params?.cwd || directory, params || {}, { notifySession: notifyIssueOwner, rekickLoopOwner });
|
|
23602
23389
|
},
|
|
23603
23390
|
onWorkflow: async (params) => {
|
|
23604
|
-
const { workflowRpc } = await import('./rpc-
|
|
23391
|
+
const { workflowRpc } = await import('./rpc-C_4D0N6G.mjs');
|
|
23605
23392
|
return workflowRpc(params?.cwd || directory, params || {});
|
|
23606
23393
|
},
|
|
23607
23394
|
onRipgrep: async (args, cwd) => {
|
|
@@ -23742,7 +23529,6 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
|
|
|
23742
23529
|
currentTurnMessage = next.text;
|
|
23743
23530
|
pendingCompactTurn = isCompactCommand(next.text);
|
|
23744
23531
|
if (pendingCompactTurn) compactTurnLatch = true;
|
|
23745
|
-
autoCompactWasAutoInjected = pendingCompactTurn && !!next.autoCompact;
|
|
23746
23532
|
resetRateLimitStreak();
|
|
23747
23533
|
if (rateLimitRetryTimer) {
|
|
23748
23534
|
clearTimeout(rateLimitRetryTimer);
|
|
@@ -24325,11 +24111,11 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
|
|
|
24325
24111
|
});
|
|
24326
24112
|
},
|
|
24327
24113
|
onIssue: async (params) => {
|
|
24328
|
-
const { issueRpc } = await import('./rpc-
|
|
24114
|
+
const { issueRpc } = await import('./rpc-Hzx79dRT.mjs');
|
|
24329
24115
|
return issueRpc(params?.cwd || directory, params || {}, { notifySession: notifyIssueOwner, rekickLoopOwner });
|
|
24330
24116
|
},
|
|
24331
24117
|
onWorkflow: async (params) => {
|
|
24332
|
-
const { workflowRpc } = await import('./rpc-
|
|
24118
|
+
const { workflowRpc } = await import('./rpc-C_4D0N6G.mjs');
|
|
24333
24119
|
return workflowRpc(params?.cwd || directory, params || {});
|
|
24334
24120
|
},
|
|
24335
24121
|
onRipgrep: async (args, cwd) => {
|
|
@@ -25418,7 +25204,7 @@ ${oracle.output.trim().slice(0, 500)}`, "\u{1F501} Continuing loop");
|
|
|
25418
25204
|
}
|
|
25419
25205
|
if (persistedSessions.length > 0) {
|
|
25420
25206
|
try {
|
|
25421
|
-
const { awaitClaudeVersionReady } = await import('./pinnedClaudeCode-
|
|
25207
|
+
const { awaitClaudeVersionReady } = await import('./pinnedClaudeCode-LCVY4Otm.mjs');
|
|
25422
25208
|
await awaitClaudeVersionReady();
|
|
25423
25209
|
} catch {
|
|
25424
25210
|
}
|
|
@@ -25684,7 +25470,7 @@ ${oracle.output.trim().slice(0, 500)}`, "\u{1F501} Continuing loop");
|
|
|
25684
25470
|
const PING_TIMEOUT_MS = 15e3;
|
|
25685
25471
|
const POST_RECONNECT_GRACE_MS = 2e4;
|
|
25686
25472
|
const RECONNECT_JITTER_MS = 2500;
|
|
25687
|
-
const { WorkflowScheduler } = await import('./scheduler-
|
|
25473
|
+
const { WorkflowScheduler } = await import('./scheduler-BiHJvgws.mjs');
|
|
25688
25474
|
const workflowProjectRoots = () => {
|
|
25689
25475
|
const dirs = /* @__PURE__ */ new Set();
|
|
25690
25476
|
for (const s of pidToTrackedSession.values()) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as resolveProjectRoot, E as listWorkflows, F as isWorkflowEnabled, G as workflowSchedules, H as inZone, x as runWorkflow, I as cronMatches } from './run
|
|
1
|
+
import { f as resolveProjectRoot, E as listWorkflows, F as isWorkflowEnabled, G as workflowSchedules, H as inZone, x as runWorkflow, I as cronMatches } from './run-zvn6DVUS.mjs';
|
|
2
2
|
import 'os';
|
|
3
3
|
import 'fs/promises';
|
|
4
4
|
import 'fs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
-
import { w as wantsHelp } from './cli-
|
|
3
|
-
import './run
|
|
2
|
+
import { w as wantsHelp } from './cli-DS4Xb1_k.mjs';
|
|
3
|
+
import './run-zvn6DVUS.mjs';
|
|
4
4
|
import 'os';
|
|
5
5
|
import 'fs/promises';
|
|
6
6
|
import 'fs';
|
|
@@ -77,7 +77,7 @@ async function handleServeCommand() {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
async function serveAdd(args, machineId) {
|
|
80
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
80
|
+
const { connectAndGetMachine } = await import('./commands-Daivh0OQ.mjs');
|
|
81
81
|
const pos = positionalArgs(args);
|
|
82
82
|
const name = pos[0];
|
|
83
83
|
if (!name) {
|
|
@@ -110,7 +110,7 @@ async function serveAdd(args, machineId) {
|
|
|
110
110
|
}
|
|
111
111
|
if (sessionId && result?.url) {
|
|
112
112
|
try {
|
|
113
|
-
const { autoAddSessionLink } = await import('./agentCommands-
|
|
113
|
+
const { autoAddSessionLink } = await import('./agentCommands-ChVM6K3a.mjs');
|
|
114
114
|
autoAddSessionLink(String(result.url), name, void 0, { kind: "serve", name });
|
|
115
115
|
} catch {
|
|
116
116
|
}
|
|
@@ -124,7 +124,7 @@ async function serveAdd(args, machineId) {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
async function serveApply(args, machineId) {
|
|
127
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
127
|
+
const { connectAndGetMachine } = await import('./commands-Daivh0OQ.mjs');
|
|
128
128
|
const fs = await import('fs');
|
|
129
129
|
const yaml = await import('yaml');
|
|
130
130
|
const file = positionalArgs(args)[0];
|
|
@@ -209,7 +209,7 @@ async function serveApply(args, machineId) {
|
|
|
209
209
|
console.log(`URL: ${result.url}`);
|
|
210
210
|
if (params.sessionId && result?.url) {
|
|
211
211
|
try {
|
|
212
|
-
const { autoAddSessionLink } = await import('./agentCommands-
|
|
212
|
+
const { autoAddSessionLink } = await import('./agentCommands-ChVM6K3a.mjs');
|
|
213
213
|
const prevSession = process.env.SVAMP_SESSION_ID;
|
|
214
214
|
process.env.SVAMP_SESSION_ID = String(params.sessionId);
|
|
215
215
|
try {
|
|
@@ -230,7 +230,7 @@ async function serveApply(args, machineId) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
async function serveRemove(args, machineId) {
|
|
233
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
233
|
+
const { connectAndGetMachine } = await import('./commands-Daivh0OQ.mjs');
|
|
234
234
|
const pos = positionalArgs(args);
|
|
235
235
|
const name = pos[0];
|
|
236
236
|
if (!name) {
|
|
@@ -240,7 +240,7 @@ async function serveRemove(args, machineId) {
|
|
|
240
240
|
const { machine, server } = await connectAndGetMachine(machineId);
|
|
241
241
|
try {
|
|
242
242
|
await machine.serveRemove({ name });
|
|
243
|
-
const { removeSessionLinkByService } = await import('./agentCommands-
|
|
243
|
+
const { removeSessionLinkByService } = await import('./agentCommands-ChVM6K3a.mjs');
|
|
244
244
|
removeSessionLinkByService("serve", name);
|
|
245
245
|
console.log(`Mount '${name}' removed.`);
|
|
246
246
|
} catch (err) {
|
|
@@ -252,7 +252,7 @@ async function serveRemove(args, machineId) {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
async function serveList(args, machineId) {
|
|
255
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
255
|
+
const { connectAndGetMachine } = await import('./commands-Daivh0OQ.mjs');
|
|
256
256
|
const all = hasFlag(args, "--all", "-a");
|
|
257
257
|
const json = hasFlag(args, "--json");
|
|
258
258
|
const sessionId = getFlag(args, "--session");
|
|
@@ -286,7 +286,7 @@ async function serveList(args, machineId) {
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
async function serveInfo(machineId) {
|
|
289
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
289
|
+
const { connectAndGetMachine } = await import('./commands-Daivh0OQ.mjs');
|
|
290
290
|
const { machine, server } = await connectAndGetMachine(machineId);
|
|
291
291
|
try {
|
|
292
292
|
const info = await machine.serveInfo();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as READ_ONLY_TOOLS, P as loadMachineContext, Q as buildMachineInstructions, T as machineToolsForRole, U as buildMachineTools } from './run
|
|
1
|
+
import { R as READ_ONLY_TOOLS, P as loadMachineContext, Q as buildMachineInstructions, T as machineToolsForRole, U as buildMachineTools } from './run-zvn6DVUS.mjs';
|
|
2
2
|
import 'node:child_process';
|
|
3
3
|
import 'os';
|
|
4
4
|
import 'fs/promises';
|