Skip to content

Commit 18b78d8

Browse files
committed
Fix linting and formatting issues
1 parent e10e1c8 commit 18b78d8

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/utils/messages/sanitizeToolInput.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe("sanitizeToolInput", () => {
1818
// This is the malformed input from the actual chat - a string instead of object
1919
input: '{"script" timeout_secs="10": "ls"}',
2020
output: {
21-
error: 'Invalid input for tool bash: JSON parsing failed',
21+
error: "Invalid input for tool bash: JSON parsing failed",
2222
},
2323
},
2424
],
@@ -132,7 +132,7 @@ describe("sanitizeToolInput", () => {
132132

133133
const sanitized = sanitizeToolInputs([problematicMessage]);
134134
const sanitizedTool = sanitized[0].parts[1];
135-
135+
136136
if (sanitizedTool.type === "dynamic-tool") {
137137
// Should be converted to empty object
138138
expect(sanitizedTool.input).toEqual({});
@@ -247,6 +247,7 @@ describe("sanitizeToolInput", () => {
247247
toolCallId: "toolu_null",
248248
toolName: "bash",
249249
state: "output-available",
250+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
250251
input: null as any,
251252
output: { error: "Invalid" },
252253
},
@@ -273,6 +274,7 @@ describe("sanitizeToolInput", () => {
273274
toolCallId: "toolu_array",
274275
toolName: "bash",
275276
state: "output-available",
277+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
276278
input: ["not", "valid"] as any,
277279
output: { error: "Invalid" },
278280
},
@@ -289,4 +291,3 @@ describe("sanitizeToolInput", () => {
289291
});
290292
});
291293
});
292-

src/utils/messages/sanitizeToolInput.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,16 @@ export function sanitizeToolInputs(messages: CmuxMessage[]): CmuxMessage[] {
4242
}
4343

4444
// Sanitize the input if it's not a valid object
45-
if (
46-
typeof part.input !== "object" ||
47-
part.input === null ||
48-
Array.isArray(part.input)
49-
) {
50-
return {
45+
if (typeof part.input !== "object" || part.input === null || Array.isArray(part.input)) {
46+
const sanitized: CmuxToolPart = {
5147
...part,
5248
input: {}, // Replace with empty object
53-
} as CmuxToolPart;
49+
};
50+
return sanitized;
5451
}
5552

5653
return part;
5754
}),
5855
};
5956
});
6057
}
61-

0 commit comments

Comments
 (0)