refactor(gateway): type inline tool auth helpers

This commit is contained in:
Vincent Koc
2026-04-06 16:42:02 +01:00
parent 9e41b2ffd6
commit 6775611c5d
2 changed files with 8 additions and 10 deletions

View File

@@ -79,8 +79,7 @@ export type InlineActionResult =
abortedLastRun: boolean;
};
// oxlint-disable-next-line typescript/no-explicit-any
function extractTextFromToolResult(result: any): string | null {
function extractTextFromToolResult(result: unknown): string | null {
if (!result || typeof result !== "object") {
return null;
}
@@ -246,12 +245,12 @@ export async function handleInlineActions(params: {
const toolCallId = `cmd_${generateSecureToken(8)}`;
try {
const result = await tool.execute(toolCallId, {
const toolArgs: Parameters<NonNullable<typeof tool.execute>>[1] = {
command: rawArgs,
commandName: skillInvocation.command.name,
skillName: skillInvocation.command.skillName,
// oxlint-disable-next-line typescript/no-explicit-any
} as any);
};
const result = await tool.execute(toolCallId, toolArgs);
const text = extractTextFromToolResult(result) ?? "✅ Done.";
typing.cleanup();
return { kind: "reply", reply: { text } };

View File

@@ -244,7 +244,7 @@ async function configureTrustedProxyControlUiAuth() {
async function writeTrustedProxyControlUiConfig(params?: { allowInsecureAuth?: boolean }) {
const { writeConfigFile } = await import("../config/config.js");
await writeConfigFile({
const nextConfig: Parameters<typeof writeConfigFile>[0] = {
gateway: {
trustedProxies: ["127.0.0.1"],
controlUi: {
@@ -252,8 +252,8 @@ async function writeTrustedProxyControlUiConfig(params?: { allowInsecureAuth?: b
...(params?.allowInsecureAuth ? { allowInsecureAuth: true } : {}),
},
},
// oxlint-disable-next-line typescript/no-explicit-any
} as any);
};
await writeConfigFile(nextConfig);
}
function isConnectResMessage(id: string) {
@@ -325,8 +325,7 @@ async function startRateLimitedTokenServerWithPairedDeviceToken() {
mode: "token",
token: "secret",
rateLimit: { maxAttempts: 1, windowMs: 60_000, lockoutMs: 60_000, exemptLoopback: false },
// oxlint-disable-next-line typescript/no-explicit-any
} as any;
} satisfies Record<string, unknown>;
const { server, ws, port, prevToken } = await startServerWithClient(undefined, {
controlUiEnabled: true,