mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 12:27:40 +00:00
chore: Enable typescript/no-explicit-any rule.
This commit is contained in:
@@ -132,6 +132,7 @@ export class GatewayClient {
|
||||
return new Error("gateway tls fingerprint mismatch");
|
||||
}
|
||||
return undefined;
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
}) as any;
|
||||
}
|
||||
this.ws = new WebSocket(url, wsOptions);
|
||||
|
||||
@@ -128,12 +128,14 @@ describe("timestampOptsFromConfig", () => {
|
||||
userTimezone: "America/Chicago",
|
||||
},
|
||||
},
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any);
|
||||
|
||||
expect(opts.timezone).toBe("America/Chicago");
|
||||
});
|
||||
|
||||
it("falls back gracefully with empty config", () => {
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const opts = timestampOptsFromConfig({} as any);
|
||||
|
||||
expect(opts.timezone).toBeDefined(); // resolveUserTimezone provides a default
|
||||
|
||||
@@ -310,6 +310,7 @@ describe("gateway server auth/connect", () => {
|
||||
gateway: {
|
||||
trustedProxies: ["127.0.0.1"],
|
||||
},
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any);
|
||||
const prevToken = process.env.OPENCLAW_GATEWAY_TOKEN;
|
||||
process.env.OPENCLAW_GATEWAY_TOKEN = "secret";
|
||||
|
||||
@@ -34,6 +34,7 @@ describe("POST /tools/invoke", () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
|
||||
const port = await getFreePort();
|
||||
@@ -60,12 +61,14 @@ describe("POST /tools/invoke", () => {
|
||||
// No explicit tool allowlist; rely on profile + alsoAllow.
|
||||
testState.agentsConfig = {
|
||||
list: [{ id: "main" }],
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
|
||||
// minimal profile does NOT include agents_list, but alsoAllow should.
|
||||
const { writeConfigFile } = await import("../config/config.js");
|
||||
await writeConfigFile({
|
||||
tools: { profile: "minimal", alsoAllow: ["agents_list"] },
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any);
|
||||
|
||||
const port = await getFreePort();
|
||||
@@ -88,6 +91,7 @@ describe("POST /tools/invoke", () => {
|
||||
it("supports tools.alsoAllow without allow/profile (implicit allow-all)", async () => {
|
||||
testState.agentsConfig = {
|
||||
list: [{ id: "main" }],
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
|
||||
const { CONFIG_PATH } = await import("../config/config.js");
|
||||
@@ -125,6 +129,7 @@ describe("POST /tools/invoke", () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
|
||||
const port = await getFreePort();
|
||||
@@ -175,6 +180,7 @@ describe("POST /tools/invoke", () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
|
||||
const port = await getFreePort();
|
||||
@@ -210,6 +216,7 @@ describe("POST /tools/invoke", () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
|
||||
const port = await getFreePort();
|
||||
@@ -239,6 +246,7 @@ describe("POST /tools/invoke", () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
|
||||
const port = await getFreePort();
|
||||
@@ -266,11 +274,13 @@ describe("POST /tools/invoke", () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
|
||||
const { writeConfigFile } = await import("../config/config.js");
|
||||
await writeConfigFile({
|
||||
tools: { profile: "minimal" },
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any);
|
||||
|
||||
const port = await getFreePort();
|
||||
@@ -305,6 +315,7 @@ describe("POST /tools/invoke", () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
testState.sessionConfig = { mainKey: "primary" };
|
||||
|
||||
|
||||
@@ -230,12 +230,14 @@ export async function handleToolsInvokeHttpRequest(
|
||||
|
||||
const coreToolNames = new Set(
|
||||
allTools
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
.filter((tool) => !getPluginToolMeta(tool as any))
|
||||
.map((tool) => normalizeToolName(tool.name))
|
||||
.filter(Boolean),
|
||||
);
|
||||
const pluginGroups = buildPluginToolGroups({
|
||||
tools: allTools,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: (tool) => getPluginToolMeta(tool as any),
|
||||
});
|
||||
const resolvePolicy = (policy: typeof profilePolicy, label: string) => {
|
||||
@@ -306,10 +308,12 @@ export async function handleToolsInvokeHttpRequest(
|
||||
|
||||
try {
|
||||
const toolArgs = mergeActionIntoArgsIfSupported({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolSchema: (tool as any).parameters,
|
||||
action,
|
||||
args,
|
||||
});
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const result = await (tool as any).execute?.(`http-${Date.now()}`, toolArgs);
|
||||
sendJson(res, 200, { ok: true, result });
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user