Skip to content

Commit 84ccba6

Browse files
committed
chore(deadcode): remove stale embedded-runner reexports
1 parent d17bb9c commit 84ccba6

4 files changed

Lines changed: 17 additions & 54 deletions

File tree

src/agents/embedded-agent-runner/run/attempt.test.ts

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ import {
2828
shouldWarnOnOrphanedUserRepair,
2929
} from "./attempt.prompt-helpers.js";
3030
import { 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";
3532
import {
3633
wrapStreamFnSanitizeMalformedToolCalls,
3734
wrapStreamFnTrimToolCallNames,
@@ -3231,44 +3228,6 @@ describe("wrapStreamFnRepairMalformedToolCallArguments", () => {
32313228
});
32323229
});
32333230

3234-
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 &amp;&amp; npm run build",
3245-
args: ["--flag=&quot;value&quot;", "&lt;input&gt;"],
3246-
nested: { deep: "a &amp; 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("&#39;hello&#39;")).toBe("'hello'");
3269-
expect(decodeHtmlEntitiesInObject("&#x27;world&#x27;")).toBe("'world'");
3270-
});
3271-
});
32723231
describe("prependSystemPromptAddition", () => {
32733232
it("prepends context-engine addition to the system prompt", () => {
32743233
const result = prependSystemPromptAddition({

src/agents/embedded-agent-runner/run/attempt.tool-call-argument-repair.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import { normalizeProviderId } from "../../model-selection.js";
66
import type { StreamFn } from "../../runtime/index.js";
77
import type { MutableAssistantMessageEventStream } from "../../stream-compat.js";
88
import { log } from "../logger.js";
9-
import {
10-
createHtmlEntityToolCallArgumentDecodingWrapper,
11-
decodeHtmlEntitiesInObject,
12-
} from "../tool-call-argument-decoding.js";
9+
import { createHtmlEntityToolCallArgumentDecodingWrapper } from "../tool-call-argument-decoding.js";
1310
import { isRunnerToolCallBlockType } from "./attempt.tool-call-block-type.js";
1411
import { wrapStreamObjectEvents } from "./stream-wrapper.js";
1512

@@ -796,5 +793,3 @@ export function shouldRepairMalformedToolCallArguments(params: {
796793
export function wrapStreamFnDecodeXaiToolCallArguments(baseFn: StreamFn): StreamFn {
797794
return createHtmlEntityToolCallArgumentDecodingWrapper(baseFn);
798795
}
799-
800-
export { decodeHtmlEntitiesInObject };

src/agents/embedded-agent-runner/run/attempt.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,7 @@ export {
528528
queueSessionsYieldInterruptMessage,
529529
stripSessionsYieldArtifacts,
530530
} from "./attempt.sessions-yield.js";
531-
export {
532-
decodeHtmlEntitiesInObject,
533-
wrapStreamFnRepairMalformedToolCallArguments,
534-
} from "./attempt.tool-call-argument-repair.js";
531+
export { wrapStreamFnRepairMalformedToolCallArguments } from "./attempt.tool-call-argument-repair.js";
535532
export {
536533
wrapStreamFnPromoteStandaloneTextToolCalls,
537534
wrapStreamFnSanitizeMalformedToolCalls,

src/agents/embedded-agent-runner/tool-call-argument-decoding.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,25 @@ describe("decodeHtmlEntitiesInObject", () => {
1010
it("decodes valid HTML entities in nested tool arguments", () => {
1111
expect(
1212
decodeHtmlEntitiesInObject({
13-
query: "Rock &amp; Roll &#65; &#39;ok&#39;",
13+
query: "Rock &amp; Roll &#65; &#39;ok&#39; &#x27;hex&#x27;",
14+
args: ["--flag=&quot;value&quot;", "&lt;input&gt;"],
15+
nested: { deep: "a &amp; b" },
1416
}),
1517
).toEqual({
16-
query: "Rock & Roll A 'ok'",
18+
query: "Rock & Roll A 'ok' 'hex'",
19+
args: ['--flag="value"', "<input>"],
20+
nested: { deep: "a & b" },
1721
});
1822
});
1923

24+
it("passes through primitives and strings without entities", () => {
25+
expect(decodeHtmlEntitiesInObject(42)).toBe(42);
26+
expect(decodeHtmlEntitiesInObject(null)).toBe(null);
27+
expect(decodeHtmlEntitiesInObject(true)).toBe(true);
28+
expect(decodeHtmlEntitiesInObject(undefined)).toBe(undefined);
29+
expect(decodeHtmlEntitiesInObject("plain string")).toBe("plain string");
30+
});
31+
2032
it("preserves invalid numeric HTML entities", () => {
2133
expect(
2234
decodeHtmlEntitiesInObject({

0 commit comments

Comments
 (0)