opencode-acp 1.18.4-pr.480.215 → 1.18.4-pr.483.216
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 +68 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/messages/index.d.ts +1 -0
- package/dist/lib/messages/index.d.ts.map +1 -1
- package/dist/lib/messages/reasoning-canonicalize.d.ts +37 -0
- package/dist/lib/messages/reasoning-canonicalize.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9953,6 +9953,66 @@ function dropCompressReasoning(messages, threshold) {
|
|
|
9953
9953
|
return removed;
|
|
9954
9954
|
}
|
|
9955
9955
|
|
|
9956
|
+
// lib/messages/reasoning-canonicalize.ts
|
|
9957
|
+
var CANONICAL_OPEN = "<thinking>\n";
|
|
9958
|
+
var CANONICAL_CLOSE = "\n</thinking>";
|
|
9959
|
+
function canonicalizeReasoningShape(messages) {
|
|
9960
|
+
let normalized = 0;
|
|
9961
|
+
for (const message of messages) {
|
|
9962
|
+
if (!message || message.info.role !== "assistant") {
|
|
9963
|
+
continue;
|
|
9964
|
+
}
|
|
9965
|
+
const parts = Array.isArray(message.parts) ? message.parts : [];
|
|
9966
|
+
let allReasoning = "";
|
|
9967
|
+
for (const part of parts) {
|
|
9968
|
+
if (part.type === "reasoning") {
|
|
9969
|
+
allReasoning += part.text;
|
|
9970
|
+
}
|
|
9971
|
+
}
|
|
9972
|
+
if (allReasoning.length === 0) {
|
|
9973
|
+
continue;
|
|
9974
|
+
}
|
|
9975
|
+
let allText = "";
|
|
9976
|
+
for (const part of parts) {
|
|
9977
|
+
if (part.type === "text") {
|
|
9978
|
+
allText += part.text;
|
|
9979
|
+
}
|
|
9980
|
+
}
|
|
9981
|
+
const merged = allText.length > 0 ? `${CANONICAL_OPEN}${allReasoning}${CANONICAL_CLOSE}
|
|
9982
|
+
${allText}` : `${CANONICAL_OPEN}${allReasoning}${CANONICAL_CLOSE}`;
|
|
9983
|
+
const rebuilt = [];
|
|
9984
|
+
let placed = false;
|
|
9985
|
+
const placeMerged = (carrier) => {
|
|
9986
|
+
if (placed) {
|
|
9987
|
+
return;
|
|
9988
|
+
}
|
|
9989
|
+
placed = true;
|
|
9990
|
+
const part = {
|
|
9991
|
+
id: carrier.id,
|
|
9992
|
+
sessionID: message.info.sessionID,
|
|
9993
|
+
messageID: message.info.id,
|
|
9994
|
+
type: "text",
|
|
9995
|
+
text: merged
|
|
9996
|
+
};
|
|
9997
|
+
rebuilt.push(part);
|
|
9998
|
+
};
|
|
9999
|
+
for (const part of parts) {
|
|
10000
|
+
if (part.type === "reasoning") {
|
|
10001
|
+
placeMerged(part);
|
|
10002
|
+
continue;
|
|
10003
|
+
}
|
|
10004
|
+
if (part.type === "text") {
|
|
10005
|
+
placeMerged(part);
|
|
10006
|
+
continue;
|
|
10007
|
+
}
|
|
10008
|
+
rebuilt.push(part);
|
|
10009
|
+
}
|
|
10010
|
+
message.parts = rebuilt;
|
|
10011
|
+
normalized++;
|
|
10012
|
+
}
|
|
10013
|
+
return normalized;
|
|
10014
|
+
}
|
|
10015
|
+
|
|
9956
10016
|
// lib/messages/priority.ts
|
|
9957
10017
|
function buildPriorityMap(_config, _state, _messages) {
|
|
9958
10018
|
return /* @__PURE__ */ new Map();
|
|
@@ -11329,7 +11389,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
|
11329
11389
|
import { join as join5 } from "path";
|
|
11330
11390
|
import { existsSync as existsSync5 } from "fs";
|
|
11331
11391
|
import { homedir as homedir3 } from "os";
|
|
11332
|
-
var LOG_VERSION = true ? "1.18.4-pr.
|
|
11392
|
+
var LOG_VERSION = true ? "1.18.4-pr.483.216" : "dev";
|
|
11333
11393
|
var LEVEL_RANK = {
|
|
11334
11394
|
debug: 10,
|
|
11335
11395
|
info: 20,
|
|
@@ -13528,6 +13588,12 @@ function createChatMessageTransformHandler(client, registry4, logger, config, pr
|
|
|
13528
13588
|
});
|
|
13529
13589
|
}
|
|
13530
13590
|
}
|
|
13591
|
+
const canonicalizedReasoning = canonicalizeReasoningShape(output.messages);
|
|
13592
|
+
if (canonicalizedReasoning > 0) {
|
|
13593
|
+
logger.debug("reasoning-canonicalize: pinned historical thinking shape", {
|
|
13594
|
+
messages: canonicalizedReasoning
|
|
13595
|
+
});
|
|
13596
|
+
}
|
|
13531
13597
|
ensureBuiltinFiltersRegistered();
|
|
13532
13598
|
const effectiveLimit = resolveEffectiveContextLimit(state, config);
|
|
13533
13599
|
applyMessageFilters(output.messages, config.messageFilters, logger, {
|
|
@@ -14039,7 +14105,7 @@ var server = (async (ctx) => {
|
|
|
14039
14105
|
}
|
|
14040
14106
|
const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
|
|
14041
14107
|
logger.info("ACP plugin initialized", {
|
|
14042
|
-
version: true ? "1.18.4-pr.
|
|
14108
|
+
version: true ? "1.18.4-pr.483.216" : "dev",
|
|
14043
14109
|
workspace: ctx.directory,
|
|
14044
14110
|
logLevel: logger.level,
|
|
14045
14111
|
debug: config.debug,
|