opencode-acp 1.18.1-pr.432.182 → 1.18.1-pr.433.184
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 +6 -51
- package/dist/index.js.map +1 -1
- package/dist/lib/hooks.d.ts +1 -1
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/messages/index.d.ts +1 -1
- package/dist/lib/messages/index.d.ts.map +1 -1
- package/dist/lib/messages/utils.d.ts +0 -4
- package/dist/lib/messages/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6822,31 +6822,6 @@ function buildToolIdList(state, messages) {
|
|
|
6822
6822
|
var stripHallucinationsFromString = (text) => {
|
|
6823
6823
|
return text.replace(DCP_PAIRED_TAG_REGEX, "").replace(DCP_UNPAIRED_TAG_REGEX, "");
|
|
6824
6824
|
};
|
|
6825
|
-
var LEAKED_TRAILING_REF_REGEX = /(?:^|\n)[ \t]*(?:m(\d{4,5})|b([1-9]\d*))\b/g;
|
|
6826
|
-
var stripLeakedTrailingRefs = (text, bounds) => {
|
|
6827
|
-
if (typeof text !== "string" || text.length === 0) {
|
|
6828
|
-
return text;
|
|
6829
|
-
}
|
|
6830
|
-
const hasMessageBound = typeof bounds.nextMessageRef === "number" && Number.isInteger(bounds.nextMessageRef);
|
|
6831
|
-
const hasBlockBound = typeof bounds.nextBlockRef === "number" && Number.isInteger(bounds.nextBlockRef);
|
|
6832
|
-
if (!hasMessageBound && !hasBlockBound) {
|
|
6833
|
-
return text;
|
|
6834
|
-
}
|
|
6835
|
-
const pattern = new RegExp(LEAKED_TRAILING_REF_REGEX.source, "g");
|
|
6836
|
-
let match;
|
|
6837
|
-
while ((match = pattern.exec(text)) !== null) {
|
|
6838
|
-
if (match[1] !== void 0) {
|
|
6839
|
-
if (hasMessageBound && Number(match[1]) >= bounds.nextMessageRef) {
|
|
6840
|
-
return text.slice(0, match.index).replace(/[ \t\r\n]*$/, "");
|
|
6841
|
-
}
|
|
6842
|
-
} else if (match[2] !== void 0) {
|
|
6843
|
-
if (hasBlockBound && Number(match[2]) >= bounds.nextBlockRef) {
|
|
6844
|
-
return text.slice(0, match.index).replace(/[ \t\r\n]*$/, "");
|
|
6845
|
-
}
|
|
6846
|
-
}
|
|
6847
|
-
}
|
|
6848
|
-
return text;
|
|
6849
|
-
};
|
|
6850
6825
|
var stripHallucinations = (messages) => {
|
|
6851
6826
|
for (const message of messages) {
|
|
6852
6827
|
for (const part of message.parts) {
|
|
@@ -10569,7 +10544,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
|
10569
10544
|
import { join as join4 } from "path";
|
|
10570
10545
|
import { existsSync as existsSync4 } from "fs";
|
|
10571
10546
|
import { homedir as homedir3 } from "os";
|
|
10572
|
-
var LOG_VERSION = true ? "1.18.1-pr.
|
|
10547
|
+
var LOG_VERSION = true ? "1.18.1-pr.433.184" : "dev";
|
|
10573
10548
|
var LEVEL_RANK = {
|
|
10574
10549
|
debug: 10,
|
|
10575
10550
|
info: 20,
|
|
@@ -12909,29 +12884,9 @@ function createCommandExecuteHandler(client, registry4, logger, config, workingD
|
|
|
12909
12884
|
}
|
|
12910
12885
|
};
|
|
12911
12886
|
}
|
|
12912
|
-
function createTextCompleteHandler(
|
|
12913
|
-
return async (
|
|
12914
|
-
|
|
12915
|
-
return;
|
|
12916
|
-
}
|
|
12917
|
-
let text = stripHallucinationsFromString(output.text);
|
|
12918
|
-
const state = typeof input.sessionID === "string" ? registry4.get(input.sessionID) : void 0;
|
|
12919
|
-
if (state) {
|
|
12920
|
-
const stripped = stripLeakedTrailingRefs(text, {
|
|
12921
|
-
nextMessageRef: Number.isInteger(state.messageIds.nextRef) ? state.messageIds.nextRef : null,
|
|
12922
|
-
nextBlockRef: Number.isInteger(state.prune?.messages?.nextBlockId) ? state.prune.messages.nextBlockId : null
|
|
12923
|
-
});
|
|
12924
|
-
if (stripped !== text) {
|
|
12925
|
-
logger.warn("Stripped leaked trailing ACP ref from assistant output", {
|
|
12926
|
-
sessionID: input.sessionID,
|
|
12927
|
-
messageID: input.messageID,
|
|
12928
|
-
removedChars: text.length - stripped.length,
|
|
12929
|
-
removedTailPreview: text.slice(stripped.length, stripped.length + 200)
|
|
12930
|
-
});
|
|
12931
|
-
text = stripped;
|
|
12932
|
-
}
|
|
12933
|
-
}
|
|
12934
|
-
output.text = text;
|
|
12887
|
+
function createTextCompleteHandler() {
|
|
12888
|
+
return async (_input, output) => {
|
|
12889
|
+
output.text = stripHallucinationsFromString(output.text);
|
|
12935
12890
|
};
|
|
12936
12891
|
}
|
|
12937
12892
|
function createEventHandler(registry4, logger) {
|
|
@@ -13273,7 +13228,7 @@ var server = (async (ctx) => {
|
|
|
13273
13228
|
}
|
|
13274
13229
|
const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
|
|
13275
13230
|
logger.info("ACP plugin initialized", {
|
|
13276
|
-
version: true ? "1.18.1-pr.
|
|
13231
|
+
version: true ? "1.18.1-pr.433.184" : "dev",
|
|
13277
13232
|
workspace: ctx.directory,
|
|
13278
13233
|
logLevel: logger.level,
|
|
13279
13234
|
debug: config.debug,
|
|
@@ -13338,7 +13293,7 @@ var server = (async (ctx) => {
|
|
|
13338
13293
|
hostPermissions
|
|
13339
13294
|
)
|
|
13340
13295
|
),
|
|
13341
|
-
"experimental.text.complete": guard(createTextCompleteHandler(
|
|
13296
|
+
"experimental.text.complete": guard(createTextCompleteHandler()),
|
|
13342
13297
|
"command.execute.before": guard(
|
|
13343
13298
|
createCommandExecuteHandler(
|
|
13344
13299
|
ctx.client,
|