chore(tsgo/lint): fix CI errors

This commit is contained in:
Gustavo Madeira Santana
2026-03-02 03:03:11 -05:00
parent 22be0c5801
commit 1443bb9a84
17 changed files with 132 additions and 103 deletions

View File

@@ -2,6 +2,7 @@ import fs from "node:fs/promises";
import path from "node:path";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import type { ModelProviderConfig } from "../config/types.models.js";
import { validateConfigObject } from "../config/validation.js";
import { resolveOpenClawAgentDir } from "./agent-paths.js";
import {
@@ -41,7 +42,7 @@ async function writeAgentModelsJson(content: unknown): Promise<void> {
}
function createMergeConfigProvider() {
return {
const provider: ModelProviderConfig = {
baseUrl: "https://config.example/v1",
apiKey: "CONFIG_KEY",
api: "openai-responses",
@@ -56,7 +57,8 @@ function createMergeConfigProvider() {
maxTokens: 2048,
},
],
} as const;
};
return provider;
}
async function runCustomProviderMergeTest(seedProvider: {

View File

@@ -11,7 +11,6 @@ function applyThinkingDefault(thinking: ThinkingLevel) {
harness.setSessionsSpawnConfigOverride({
session: { mainKey: "main", scope: "per-sender" },
agents: { defaults: { subagents: { thinking } } },
routing: { sessions: { mainKey: MAIN_SESSION_KEY } },
});
}

View File

@@ -15,7 +15,6 @@ function configureDefaultsWithoutTimeout() {
setSessionsSpawnConfigOverride({
session: { mainKey: "main", scope: "per-sender" },
agents: { defaults: { subagents: { maxConcurrent: 8 } } },
routing: { sessions: { mainKey: MAIN_SESSION_KEY } },
});
}

View File

@@ -9,7 +9,6 @@ function applySubagentTimeoutDefault(seconds: number) {
sessionsHarness.setSessionsSpawnConfigOverride({
session: { mainKey: "main", scope: "per-sender" },
agents: { defaults: { subagents: { runTimeoutSeconds: seconds } } },
routing: { sessions: { mainKey: MAIN_SESSION_KEY } },
});
}

View File

@@ -1,4 +1,4 @@
import { vi } from "vitest";
import { vi, type Mock } from "vitest";
type SessionsSpawnTestConfig = ReturnType<(typeof import("../config/config.js"))["loadConfig"]>;
type CreateSessionsSpawnTool =
@@ -16,10 +16,6 @@ type SessionsSpawnGatewayMockOptions = {
agentWaitResult?: { status: "ok" | "timeout"; startedAt: number; endedAt: number };
};
// Avoid exporting vitest mock types (TS2742 under pnpm + d.ts emit).
// oxlint-disable-next-line typescript/no-explicit-any
type AnyMock = any;
const hoisted = vi.hoisted(() => {
const callGatewayMock = vi.fn();
const defaultConfigOverride = {
@@ -32,12 +28,12 @@ const hoisted = vi.hoisted(() => {
return { callGatewayMock, defaultConfigOverride, state };
});
export function getCallGatewayMock(): AnyMock {
export function getCallGatewayMock(): Mock {
return hoisted.callGatewayMock;
}
export function getGatewayRequests(): Array<GatewayRequest> {
return getCallGatewayMock().mock.calls.map((call: [unknown]) => call[0] as GatewayRequest);
return getCallGatewayMock().mock.calls.map((call: unknown[]) => call[0] as GatewayRequest);
}
export function getGatewayMethods(): Array<string | undefined> {