refactor(server): remove unnecessary String() conversions from type-aware lint fixes (#695)
This commit is contained in:
@@ -398,7 +398,7 @@ export class MockLoadTestAgentClient implements AgentClient {
|
||||
const metadata = (handle.metadata ?? {}) as Partial<AgentSessionConfig>;
|
||||
return new MockLoadTestAgentSession({
|
||||
config: {
|
||||
cwd: String(metadata.cwd ?? overrides?.cwd ?? process.cwd()),
|
||||
cwd: metadata.cwd ?? overrides?.cwd ?? process.cwd(),
|
||||
...metadata,
|
||||
...overrides,
|
||||
provider: MOCK_LOAD_TEST_PROVIDER_ID,
|
||||
|
||||
@@ -17,7 +17,7 @@ type SessionMessage<T extends SessionOutboundMessage["type"]> = Extract<
|
||||
function makeTranscriptionHandler(resolve: (value: string) => void) {
|
||||
return (msg: SessionMessage<"transcription_result">) => {
|
||||
if (msg.type !== "transcription_result") return;
|
||||
const text = String(msg.payload.text ?? "").trim();
|
||||
const text = (msg.payload.text ?? "").trim();
|
||||
if (!text) return;
|
||||
resolve(text);
|
||||
};
|
||||
@@ -27,7 +27,7 @@ function makeErrorHandler(reject: (error: Error) => void) {
|
||||
return (msg: SessionMessage<"activity_log">) => {
|
||||
if (msg.type !== "activity_log") return;
|
||||
if (msg.payload.type !== "error") return;
|
||||
reject(new Error(String(msg.payload.content)));
|
||||
reject(new Error(msg.payload.content));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ function makeSpeakToolHandler(resolve: (value: string) => void) {
|
||||
if (msg.payload.event.type !== "timeline") return;
|
||||
const item = msg.payload.event.item;
|
||||
if (item.type !== "tool_call") return;
|
||||
const name = String(item.name ?? "");
|
||||
const name = item.name ?? "";
|
||||
if (!name.toLowerCase().includes("speak")) return;
|
||||
resolve(name);
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ function makeTranscriptionHandler(
|
||||
return;
|
||||
}
|
||||
resolve({
|
||||
text: String(message.payload.text ?? ""),
|
||||
text: message.payload.text ?? "",
|
||||
isLowConfidence: Boolean(message.payload.isLowConfidence),
|
||||
});
|
||||
};
|
||||
@@ -83,7 +83,7 @@ function makeActivityErrorHandler(reject: (error: Error) => void) {
|
||||
if (message.payload.type !== "error") {
|
||||
return;
|
||||
}
|
||||
reject(new Error(String(message.payload.content)));
|
||||
reject(new Error(message.payload.content));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ for (const targetProvider of [
|
||||
return;
|
||||
}
|
||||
timelineToolAgentIds.add(message.payload.agentId);
|
||||
timelineTools.push(String(item.name ?? ""));
|
||||
timelineTools.push(item.name ?? "");
|
||||
});
|
||||
const offErrors = ctx.client.on("activity_log", (message) => {
|
||||
if (message.type !== "activity_log") {
|
||||
@@ -246,7 +246,7 @@ for (const targetProvider of [
|
||||
if (message.payload.type !== "error") {
|
||||
return;
|
||||
}
|
||||
activityErrors.push(String(message.payload.content ?? ""));
|
||||
activityErrors.push(message.payload.content ?? "");
|
||||
});
|
||||
|
||||
const inputSpeech = await withTimeout(
|
||||
|
||||
@@ -259,14 +259,14 @@ export class WorkspaceDirectory {
|
||||
}
|
||||
|
||||
if (filter.idPrefix && filter.idPrefix.trim().length > 0) {
|
||||
if (!String(workspace.id).startsWith(filter.idPrefix.trim())) {
|
||||
if (!workspace.id.startsWith(filter.idPrefix.trim())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (filter.query && filter.query.trim().length > 0) {
|
||||
const query = filter.query.trim().toLocaleLowerCase();
|
||||
const haystacks = [workspace.name, String(workspace.projectId), String(workspace.id)];
|
||||
const haystacks = [workspace.name, workspace.projectId, workspace.id];
|
||||
if (!haystacks.some((value) => value.toLocaleLowerCase().includes(query))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user