Enable more biome lints and fix things

This commit is contained in:
Mario Zechner 2025-12-21 22:56:20 +01:00
parent 9c18439c4d
commit d5fd685901
57 changed files with 151 additions and 199 deletions

View file

@ -177,6 +177,7 @@ async function streamAssistantResponse(
systemPrompt: context.systemPrompt,
messages: [...processedMessages].map((m) => {
if (m.role === "toolResult") {
// biome-ignore lint/correctness/noUnusedVariables: fine here
const { details, ...rest } = m;
return rest;
} else {

View file

@ -8,7 +8,7 @@ export interface CalculateResult extends AgentToolResult<undefined> {
export function calculate(expression: string): CalculateResult {
try {
const result = new Function("return " + expression)();
const result = new Function(`return ${expression}`)();
return { content: [{ type: "text", text: `${expression} = ${result}` }], details: undefined };
} catch (e: any) {
throw new Error(e.message || String(e));

View file

@ -17,7 +17,7 @@ export async function getCurrentTime(timezone?: string): Promise<GetCurrentTimeR
content: [{ type: "text", text: timeStr }],
details: { utcTimestamp: date.getTime() },
};
} catch (e) {
} catch (_e) {
throw new Error(`Invalid timezone: ${timezone}. Current UTC time: ${date.toISOString()}`);
}
}

View file

@ -110,7 +110,7 @@ export const streamOpenAIResponses: StreamFunction<"openai-responses"> = (
currentItem = item;
currentBlock = {
type: "toolCall",
id: item.call_id + "|" + item.id,
id: `${item.call_id}|${item.id}`,
name: item.name,
arguments: {},
partialJson: item.arguments || "",
@ -251,7 +251,7 @@ export const streamOpenAIResponses: StreamFunction<"openai-responses"> = (
} else if (item.type === "function_call") {
const toolCall: ToolCall = {
type: "toolCall",
id: item.call_id + "|" + item.id,
id: `${item.call_id}|${item.id}`,
name: item.name,
arguments: JSON.parse(item.arguments),
};
@ -462,9 +462,9 @@ function convertMessages(model: Model<"openai-responses">, context: Context): Re
// OpenAI requires id to be max 64 characters
let msgId = textBlock.textSignature;
if (!msgId) {
msgId = "msg_" + msgIndex;
msgId = `msg_${msgIndex}`;
} else if (msgId.length > 64) {
msgId = "msg_" + shortHash(msgId);
msgId = `msg_${shortHash(msgId)}`;
}
output.push({
type: "message",

View file

@ -27,9 +27,6 @@ const SCOPES = [
const AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
const TOKEN_URL = "https://oauth2.googleapis.com/token";
// Antigravity uses sandbox endpoint
const CODE_ASSIST_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
// Fallback project ID when discovery fails
const DEFAULT_PROJECT_ID = "rising-fact-p41fc";
@ -115,13 +112,6 @@ interface LoadCodeAssistPayload {
allowedTiers?: Array<{ id?: string; isDefault?: boolean }>;
}
/**
* Wait helper for onboarding retries
*/
function wait(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
/**
* Discover or provision a project for the user
*/

View file

@ -21,7 +21,7 @@ if (!isBrowserExtension) {
strict: false,
});
addFormats(ajv);
} catch (e) {
} catch (_e) {
// AJV initialization failed (likely CSP restriction)
console.warn("AJV validation disabled due to CSP restrictions");
}