






















@@ -28,10 +28,7 @@ import {
2828shouldWarnOnOrphanedUserRepair,
2929} from "./attempt.prompt-helpers.js";
3030import { composeSystemPromptWithHookContext } from "./attempt.thread-helpers.js";
31-import {
32-decodeHtmlEntitiesInObject,
33-wrapStreamFnRepairMalformedToolCallArguments,
34-} from "./attempt.tool-call-argument-repair.js";
31+import { wrapStreamFnRepairMalformedToolCallArguments } from "./attempt.tool-call-argument-repair.js";
3532import {
3633wrapStreamFnSanitizeMalformedToolCalls,
3734wrapStreamFnTrimToolCallNames,
@@ -3231,44 +3228,6 @@ describe("wrapStreamFnRepairMalformedToolCallArguments", () => {
32313228});
32323229});
323332303234-describe("decodeHtmlEntitiesInObject", () => {
3235-it("decodes HTML entities in string values", () => {
3236-const result = decodeHtmlEntitiesInObject(
3237-"source .env && psql "$DB" -c <query>",
3238-);
3239-expect(result).toBe('source .env && psql "$DB" -c <query>');
3240-});
3241-3242-it("recursively decodes nested objects", () => {
3243-const input = {
3244-command: "cd ~/dev && npm run build",
3245-args: ["--flag="value"", "<input>"],
3246-nested: { deep: "a & b" },
3247-};
3248-const result = decodeHtmlEntitiesInObject(input) as Record<string, unknown>;
3249-expect(result.command).toBe("cd ~/dev && npm run build");
3250-expect((result.args as string[])[0]).toBe('--flag="value"');
3251-expect((result.args as string[])[1]).toBe("<input>");
3252-expect((result.nested as Record<string, string>).deep).toBe("a & b");
3253-});
3254-3255-it("passes through non-string primitives unchanged", () => {
3256-expect(decodeHtmlEntitiesInObject(42)).toBe(42);
3257-expect(decodeHtmlEntitiesInObject(null)).toBe(null);
3258-expect(decodeHtmlEntitiesInObject(true)).toBe(true);
3259-expect(decodeHtmlEntitiesInObject(undefined)).toBe(undefined);
3260-});
3261-3262-it("returns strings without entities unchanged", () => {
3263-const input = "plain string with no entities";
3264-expect(decodeHtmlEntitiesInObject(input)).toBe(input);
3265-});
3266-3267-it("decodes numeric character references", () => {
3268-expect(decodeHtmlEntitiesInObject("'hello'")).toBe("'hello'");
3269-expect(decodeHtmlEntitiesInObject("'world'")).toBe("'world'");
3270-});
3271-});
32723231describe("prependSystemPromptAddition", () => {
32733232it("prepends context-engine addition to the system prompt", () => {
32743233const result = prependSystemPromptAddition({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。