Skip to content

Commit 66d3af2

Browse files
committed
Clear lint warnings in CLI and browser helpers
1 parent a32c361 commit 66d3af2

4 files changed

Lines changed: 25 additions & 22 deletions

File tree

apps/cli/src/commands/chat-gateway-session.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -876,12 +876,12 @@ export async function createGatewayBackedInteractiveSession(
876876
}
877877
if (gatewayState.isStreaming) {
878878
const behavior = promptOptions?.streamingBehavior;
879-
const queuedBehavior =
880-
behavior === "steer" || behavior === "followUp"
881-
? behavior
882-
: behavior == null
883-
? "followUp"
884-
: undefined;
879+
const queuedBehavior =
880+
behavior === "steer" || behavior === "followUp"
881+
? behavior
882+
: behavior === null || behavior === undefined
883+
? "followUp"
884+
: undefined;
885885
if (!queuedBehavior) {
886886
throw new Error("Invalid streamingBehavior. Expected 'steer' or 'followUp'.");
887887
}

apps/cli/src/commands/gateway-session-store.test.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,20 @@ describe("gateway session store", () => {
128128
activeSessionBindings: new Map(),
129129
});
130130

131-
const raw = JSON.parse(await readFile(storePath, "utf8")) as {
132-
runs?: Array<Record<string, unknown>>;
133-
};
134-
const run = raw.runs?.[0];
135-
expect(run).toBeDefined();
136-
expect((run?.response as string).length).toBeLessThan(17_000);
137-
expect(run?.images).toEqual([
138-
{
139-
type: "image",
140-
mimeType: "image/png",
141-
data: "[image payload omitted]",
131+
const raw = JSON.parse(await readFile(storePath, "utf8")) as {
132+
runs?: Array<Record<string, unknown>>;
133+
};
134+
const run = raw.runs?.[0];
135+
expect(run).toBeDefined();
136+
if (!run) {
137+
throw new Error("Expected a persisted run");
138+
}
139+
expect((run.response as string).length).toBeLessThan(17_000);
140+
expect(run.images).toEqual([
141+
{
142+
type: "image",
143+
mimeType: "image/png",
144+
data: "[image payload omitted]",
142145
},
143146
]);
144147
expect(run?.meta).toMatchObject({
@@ -152,9 +155,9 @@ describe("gateway session store", () => {
152155
],
153156
nested: {
154157
imageData: "[image payload omitted]",
158+
},
155159
},
156-
},
160+
});
161+
expect(((run.meta as any).latestToolResult.nested.text as string).length).toBeLessThan(17_000);
157162
});
158-
expect(((run?.meta as any).latestToolResult.nested.text as string).length).toBeLessThan(17_000);
159163
});
160-
});

apps/cli/src/commands/gateway-session-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function truncatePersistedString(value: string): string {
170170
}
171171

172172
function sanitizePersistedValue(value: unknown, depth = 0): unknown {
173-
if (value == null || typeof value === "number" || typeof value === "boolean") {
173+
if ((value === null || value === undefined) || typeof value === "number" || typeof value === "boolean") {
174174
return value;
175175
}
176176
if (typeof value === "string") {

packages/tools/src/browser/browser-tool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ export function createBrowserTool(
593593
const truncateText = (value: string | undefined | null, maxChars: number | undefined): string => {
594594
const text = typeof value === "string"
595595
? value
596-
: value == null
596+
: value === null || value === undefined
597597
? ""
598598
: String(value);
599599
if (!Number.isFinite(maxChars) || !maxChars || text.length <= maxChars) {

0 commit comments

Comments
 (0)