opencode-acp 1.18.4-pr.486.219 → 1.18.4-pr.488.221
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/index.js +32 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/messages/sticky-truncation.d.ts +24 -4
- package/dist/lib/messages/sticky-truncation.d.ts.map +1 -1
- package/dist/lib/messages/truncate-tools.d.ts.map +1 -1
- package/dist/lib/state/state.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5212,6 +5212,13 @@ async function ensureSessionInitialized(client, state, sessionId, logger, messag
|
|
|
5212
5212
|
if (parentSessionId) {
|
|
5213
5213
|
try {
|
|
5214
5214
|
const parent = await loadSessionState(parentSessionId, logger);
|
|
5215
|
+
if (parent?.stickyTruncations) {
|
|
5216
|
+
for (const [callID, output] of Object.entries(parent.stickyTruncations)) {
|
|
5217
|
+
if (typeof output === "string") {
|
|
5218
|
+
state.stickyTruncations[callID] = output;
|
|
5219
|
+
}
|
|
5220
|
+
}
|
|
5221
|
+
}
|
|
5215
5222
|
const response = parent ? await client.session.messages({ path: { id: parentSessionId } }) : void 0;
|
|
5216
5223
|
const parentMessages = Array.isArray(response?.data) ? response.data : Array.isArray(response) ? response : [];
|
|
5217
5224
|
if (parent && parentMessages.length > 0) {
|
|
@@ -11351,7 +11358,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
|
11351
11358
|
import { join as join5 } from "path";
|
|
11352
11359
|
import { existsSync as existsSync5 } from "fs";
|
|
11353
11360
|
import { homedir as homedir3 } from "os";
|
|
11354
|
-
var LOG_VERSION = true ? "1.18.4-pr.
|
|
11361
|
+
var LOG_VERSION = true ? "1.18.4-pr.488.221" : "dev";
|
|
11355
11362
|
var LEVEL_RANK = {
|
|
11356
11363
|
debug: 10,
|
|
11357
11364
|
info: 20,
|
|
@@ -12206,6 +12213,7 @@ function truncateLargeToolOutputs(state, config, logger, messages) {
|
|
|
12206
12213
|
const part = parts[pi];
|
|
12207
12214
|
if (part?.type !== "tool") continue;
|
|
12208
12215
|
if (part.state?.status !== "completed") continue;
|
|
12216
|
+
if (part.tool === "compress") continue;
|
|
12209
12217
|
const content = extractCompletedToolOutput(part);
|
|
12210
12218
|
if (content === void 0) continue;
|
|
12211
12219
|
if (content === "[Old tool result content cleared]") continue;
|
|
@@ -12270,7 +12278,8 @@ function applyStickyTruncations(state, messages, logger) {
|
|
|
12270
12278
|
seen.add(callID);
|
|
12271
12279
|
const recorded = frozen[callID];
|
|
12272
12280
|
if (recorded === void 0) continue;
|
|
12273
|
-
if (
|
|
12281
|
+
if (!part.state) continue;
|
|
12282
|
+
if (part.state.output === recorded) continue;
|
|
12274
12283
|
part.state.output = recorded;
|
|
12275
12284
|
replayed++;
|
|
12276
12285
|
}
|
|
@@ -12289,8 +12298,9 @@ function snapshotToolOutputs(messages) {
|
|
|
12289
12298
|
for (const part of collectToolParts(messages)) {
|
|
12290
12299
|
const callID = typeof part.callID === "string" ? part.callID : void 0;
|
|
12291
12300
|
if (!callID) continue;
|
|
12292
|
-
|
|
12293
|
-
|
|
12301
|
+
const content = extractCompletedToolOutput(part);
|
|
12302
|
+
if (content === void 0) continue;
|
|
12303
|
+
snapshot.set(callID, content);
|
|
12294
12304
|
}
|
|
12295
12305
|
return snapshot;
|
|
12296
12306
|
}
|
|
@@ -12309,6 +12319,7 @@ function recordStickyTruncations(state, messages, before, logger) {
|
|
|
12309
12319
|
if (recorded > 0) {
|
|
12310
12320
|
logger.info("Sticky truncation: froze truncated tool outputs", { recorded });
|
|
12311
12321
|
}
|
|
12322
|
+
return recorded;
|
|
12312
12323
|
}
|
|
12313
12324
|
|
|
12314
12325
|
// lib/messages/enforce-budget.ts
|
|
@@ -13681,7 +13692,12 @@ ${text}`);
|
|
|
13681
13692
|
prePruneTokens,
|
|
13682
13693
|
candidateMessages
|
|
13683
13694
|
);
|
|
13684
|
-
|
|
13695
|
+
const emergencyTruncationEnabled = applyCompressOverrides(
|
|
13696
|
+
config,
|
|
13697
|
+
dropReasoningModel?.providerID ?? state.modelProviderID,
|
|
13698
|
+
dropReasoningModel?.modelID ?? state.modelID
|
|
13699
|
+
).compress.emergencyTruncation;
|
|
13700
|
+
if (emergencyTruncationEnabled === true) {
|
|
13685
13701
|
applyStickyTruncations(state, output.messages, logger);
|
|
13686
13702
|
const toolOutputsBefore = snapshotToolOutputs(output.messages);
|
|
13687
13703
|
truncateLargeToolOutputs(
|
|
@@ -13691,7 +13707,16 @@ ${text}`);
|
|
|
13691
13707
|
output.messages.filter((message) => !isSyntheticMessage(message))
|
|
13692
13708
|
);
|
|
13693
13709
|
enforceContextBudget(state, config, logger, output.messages);
|
|
13694
|
-
|
|
13710
|
+
const frozenCount = recordStickyTruncations(
|
|
13711
|
+
state,
|
|
13712
|
+
output.messages,
|
|
13713
|
+
toolOutputsBefore,
|
|
13714
|
+
logger
|
|
13715
|
+
);
|
|
13716
|
+
if (frozenCount > 0) {
|
|
13717
|
+
saveSessionState(state, logger).catch(() => {
|
|
13718
|
+
});
|
|
13719
|
+
}
|
|
13695
13720
|
}
|
|
13696
13721
|
injectMessageIds(state, config, output.messages, compressionPriorities);
|
|
13697
13722
|
hideFailedCompressCalls(output.messages);
|
|
@@ -14131,7 +14156,7 @@ var server = (async (ctx) => {
|
|
|
14131
14156
|
}
|
|
14132
14157
|
const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
|
|
14133
14158
|
logger.info("ACP plugin initialized", {
|
|
14134
|
-
version: true ? "1.18.4-pr.
|
|
14159
|
+
version: true ? "1.18.4-pr.488.221" : "dev",
|
|
14135
14160
|
workspace: ctx.directory,
|
|
14136
14161
|
logLevel: logger.level,
|
|
14137
14162
|
debug: config.debug,
|