mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
chore(agents): drop stale lint comments
This commit is contained in:
@@ -30,7 +30,6 @@ describe("compaction token accounting sanitization", () => {
|
||||
content: [{ type: "text", text: "ok" }],
|
||||
details: { raw: "x".repeat(50_000) },
|
||||
timestamp: 1,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any,
|
||||
{
|
||||
role: "user",
|
||||
|
||||
@@ -31,7 +31,6 @@ import { SYSTEM_PROMPT_CACHE_BOUNDARY } from "./system-prompt-cache-boundary.js"
|
||||
|
||||
// We mock the entire openai-ws-connection module so no real WebSocket is opened.
|
||||
const { MockManager } = vi.hoisted(() => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const { EventEmitter } = require("node:events") as typeof import("node:events");
|
||||
type AnyFn = (...args: unknown[]) => void;
|
||||
|
||||
|
||||
@@ -439,7 +439,6 @@ describe("downgradeOpenAIReasoningBlocks", () => {
|
||||
},
|
||||
];
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect(downgradeOpenAIReasoningBlocks(input as any)).toEqual(input);
|
||||
});
|
||||
|
||||
@@ -457,7 +456,6 @@ describe("downgradeOpenAIReasoningBlocks", () => {
|
||||
{ role: "user", content: "next" },
|
||||
];
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect(downgradeOpenAIReasoningBlocks(input as any)).toEqual([
|
||||
{ role: "user", content: "next" },
|
||||
]);
|
||||
@@ -476,7 +474,6 @@ describe("downgradeOpenAIReasoningBlocks", () => {
|
||||
},
|
||||
];
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect(downgradeOpenAIReasoningBlocks(input as any)).toEqual([]);
|
||||
});
|
||||
|
||||
@@ -494,7 +491,6 @@ describe("downgradeOpenAIReasoningBlocks", () => {
|
||||
},
|
||||
];
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect(downgradeOpenAIReasoningBlocks(input as any)).toEqual(input);
|
||||
});
|
||||
|
||||
@@ -512,9 +508,7 @@ describe("downgradeOpenAIReasoningBlocks", () => {
|
||||
{ role: "user", content: "next" },
|
||||
];
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const once = downgradeOpenAIReasoningBlocks(input as any);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const twice = downgradeOpenAIReasoningBlocks(once as any);
|
||||
expect(twice).toEqual(once);
|
||||
});
|
||||
@@ -559,7 +553,6 @@ describe("downgradeOpenAIFunctionCallReasoningPairs", () => {
|
||||
makeToolResult(callIdWithReasoning, "ok"),
|
||||
];
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect(downgradeOpenAIFunctionCallReasoningPairs(input as any)).toEqual([
|
||||
makePlainAssistantTurn(callIdWithoutReasoning),
|
||||
makeToolResult(callIdWithoutReasoning, "ok"),
|
||||
@@ -572,7 +565,6 @@ describe("downgradeOpenAIFunctionCallReasoningPairs", () => {
|
||||
makeToolResult(callIdWithReasoning, "ok"),
|
||||
];
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect(downgradeOpenAIFunctionCallReasoningPairs(input as any)).toEqual(input);
|
||||
});
|
||||
|
||||
@@ -584,7 +576,6 @@ describe("downgradeOpenAIFunctionCallReasoningPairs", () => {
|
||||
makeToolResult(callIdWithReasoning, "turn2"),
|
||||
];
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect(downgradeOpenAIFunctionCallReasoningPairs(input as any)).toEqual([
|
||||
makePlainAssistantTurn(callIdWithoutReasoning),
|
||||
makeToolResult(callIdWithoutReasoning, "turn1"),
|
||||
|
||||
@@ -53,7 +53,6 @@ describe("before_tool_call loop detection behavior", () => {
|
||||
hasHooks: vi.fn(),
|
||||
runBeforeToolCall: vi.fn(),
|
||||
};
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
mockGetGlobalHookRunner.mockReturnValue(hookRunner as any);
|
||||
hookRunner.hasHooks.mockReturnValue(false);
|
||||
});
|
||||
@@ -180,7 +179,6 @@ describe("before_tool_call loop detection behavior", () => {
|
||||
content: [{ type: "text", text: "(no new output)\n\nProcess still running." }],
|
||||
details: { status: "running", aggregated: "steady" },
|
||||
});
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const tool = wrapToolWithBeforeToolCallHook({ name: "process", execute } as any, {
|
||||
...disabledLoopDetectionContext,
|
||||
});
|
||||
@@ -349,7 +347,6 @@ describe("before_tool_call requireApproval handling", () => {
|
||||
hasHooks: vi.fn().mockReturnValue(true),
|
||||
runBeforeToolCall: vi.fn(),
|
||||
};
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
mockGetGlobalHookRunner.mockReturnValue(hookRunner as any);
|
||||
// Keep the global singleton aligned as a fallback in case another setup path
|
||||
// preloads hook-runner-global before this test's module reset/mocks take effect.
|
||||
|
||||
@@ -90,7 +90,6 @@ describe("before_tool_call hook integration", () => {
|
||||
it("executes tool normally when no hook is registered", async () => {
|
||||
beforeToolCallHook = installBeforeToolCallHook({ enabled: false });
|
||||
const execute = vi.fn().mockResolvedValue({ content: [], details: { ok: true } });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const tool = wrapToolWithBeforeToolCallHook({ name: "Read", execute } as any, {
|
||||
agentId: "main",
|
||||
sessionKey: "main",
|
||||
@@ -113,7 +112,6 @@ describe("before_tool_call hook integration", () => {
|
||||
runBeforeToolCallImpl: async () => ({ params: { mode: "safe" } }),
|
||||
});
|
||||
const execute = vi.fn().mockResolvedValue({ content: [], details: { ok: true } });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const tool = wrapToolWithBeforeToolCallHook({ name: "exec", execute } as any);
|
||||
const extensionContext = {} as Parameters<typeof tool.execute>[3];
|
||||
|
||||
@@ -135,7 +133,6 @@ describe("before_tool_call hook integration", () => {
|
||||
}),
|
||||
});
|
||||
const execute = vi.fn().mockResolvedValue({ content: [], details: { ok: true } });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const tool = wrapToolWithBeforeToolCallHook({ name: "exec", execute } as any);
|
||||
const extensionContext = {} as Parameters<typeof tool.execute>[3];
|
||||
|
||||
@@ -154,7 +151,6 @@ describe("before_tool_call hook integration", () => {
|
||||
]);
|
||||
|
||||
const execute = vi.fn().mockResolvedValue({ content: [], details: { ok: true } });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const tool = wrapToolWithBeforeToolCallHook({ name: "exec", execute } as any);
|
||||
const extensionContext = {} as Parameters<typeof tool.execute>[3];
|
||||
|
||||
@@ -174,7 +170,6 @@ describe("before_tool_call hook integration", () => {
|
||||
},
|
||||
});
|
||||
const execute = vi.fn().mockResolvedValue({ content: [], details: { ok: true } });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const tool = wrapToolWithBeforeToolCallHook({ name: "read", execute } as any);
|
||||
const extensionContext = {} as Parameters<typeof tool.execute>[3];
|
||||
|
||||
@@ -189,7 +184,6 @@ describe("before_tool_call hook integration", () => {
|
||||
runBeforeToolCallImpl: async () => undefined,
|
||||
});
|
||||
const execute = vi.fn().mockResolvedValue({ content: [], details: { ok: true } });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const tool = wrapToolWithBeforeToolCallHook({ name: "ReAd", execute } as any, {
|
||||
agentId: "main",
|
||||
sessionKey: "main",
|
||||
@@ -226,11 +220,9 @@ describe("before_tool_call hook integration", () => {
|
||||
.mockResolvedValueOnce({ params: { marker: "B" } }),
|
||||
});
|
||||
const execute = vi.fn().mockResolvedValue({ content: [], details: { ok: true } });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const toolA = wrapToolWithBeforeToolCallHook({ name: "Read", execute } as any, {
|
||||
runId: "run-a",
|
||||
});
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const toolB = wrapToolWithBeforeToolCallHook({ name: "Read", execute } as any, {
|
||||
runId: "run-b",
|
||||
});
|
||||
@@ -266,7 +258,6 @@ describe("before_tool_call hook deduplication (#15502)", () => {
|
||||
|
||||
it("fires hook exactly once when tool goes through wrap + toToolDefinitions", async () => {
|
||||
const execute = vi.fn().mockResolvedValue({ content: [], details: { ok: true } });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const baseTool = { name: "web_fetch", execute, description: "fetch", parameters: {} } as any;
|
||||
|
||||
const wrapped = wrapToolWithBeforeToolCallHook(baseTool, {
|
||||
@@ -288,7 +279,6 @@ describe("before_tool_call hook deduplication (#15502)", () => {
|
||||
|
||||
it("fires hook exactly once when tool goes through wrap + abort + toToolDefinitions", async () => {
|
||||
const execute = vi.fn().mockResolvedValue({ content: [], details: { ok: true } });
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const baseTool = { name: "Bash", execute, description: "bash", parameters: {} } as any;
|
||||
|
||||
const abortController = new AbortController();
|
||||
|
||||
@@ -46,7 +46,6 @@ function appendToolCallAndResult(sm: ReturnType<typeof SessionManager.inMemory>)
|
||||
isError: false,
|
||||
content: [{ type: "text", text: "ok" }],
|
||||
details: { big: "x".repeat(10_000) },
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any);
|
||||
}
|
||||
|
||||
@@ -56,7 +55,6 @@ function getPersistedToolResult(sm: ReturnType<typeof SessionManager.inMemory>)
|
||||
.filter((e) => e.type === "message")
|
||||
.map((e) => (e as { message: AgentMessage }).message);
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
return messages.find((m) => (m as any).role === "toolResult") as any;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,7 @@ function runAllowlistWarningStep(params: {
|
||||
const warnings: string[] = [];
|
||||
const tools = [{ name: "exec" }] as unknown as DummyTool[];
|
||||
applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: (msg) => warnings.push(msg),
|
||||
steps: [
|
||||
@@ -44,9 +42,7 @@ describe("tool-policy-pipeline", () => {
|
||||
test("preserves plugin-only allowlists instead of silently stripping them", () => {
|
||||
const tools = [{ name: "exec" }, { name: "plugin_tool" }] as unknown as DummyTool[];
|
||||
const filtered = applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: (t: any) => (t.name === "plugin_tool" ? { pluginId: "foo" } : undefined),
|
||||
warn: () => {},
|
||||
steps: [
|
||||
@@ -65,9 +61,7 @@ describe("tool-policy-pipeline", () => {
|
||||
const warnings: string[] = [];
|
||||
const tools = [{ name: "exec" }] as unknown as DummyTool[];
|
||||
applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: (msg) => warnings.push(msg),
|
||||
steps: [
|
||||
@@ -123,9 +117,7 @@ describe("tool-policy-pipeline", () => {
|
||||
const warnings: string[] = [];
|
||||
const profilePolicy = resolveToolProfilePolicy("coding");
|
||||
applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: [{ name: "exec" }] as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: (msg) => warnings.push(msg),
|
||||
steps: buildDefaultToolPolicyPipelineSteps({
|
||||
@@ -142,9 +134,7 @@ describe("tool-policy-pipeline", () => {
|
||||
const warnings: string[] = [];
|
||||
const tools = [{ name: "exec" }] as unknown as DummyTool[];
|
||||
const params = {
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: (msg: string) => warnings.push(msg),
|
||||
steps: [
|
||||
@@ -168,9 +158,7 @@ describe("tool-policy-pipeline", () => {
|
||||
|
||||
for (let i = 0; i < 257; i += 1) {
|
||||
applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: (msg: string) => warnings.push(msg),
|
||||
steps: [
|
||||
@@ -184,9 +172,7 @@ describe("tool-policy-pipeline", () => {
|
||||
}
|
||||
|
||||
applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: (msg: string) => warnings.push(msg),
|
||||
steps: [
|
||||
@@ -207,9 +193,7 @@ describe("tool-policy-pipeline", () => {
|
||||
|
||||
for (let i = 0; i < 256; i += 1) {
|
||||
applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: (msg: string) => warnings.push(msg),
|
||||
steps: [
|
||||
@@ -225,9 +209,7 @@ describe("tool-policy-pipeline", () => {
|
||||
warnings.length = 0;
|
||||
|
||||
applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: (msg: string) => warnings.push(msg),
|
||||
steps: [
|
||||
@@ -239,9 +221,7 @@ describe("tool-policy-pipeline", () => {
|
||||
],
|
||||
});
|
||||
applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: (msg: string) => warnings.push(msg),
|
||||
steps: [
|
||||
@@ -256,9 +236,7 @@ describe("tool-policy-pipeline", () => {
|
||||
test("applies allowlist filtering when core tools are explicitly listed", () => {
|
||||
const tools = [{ name: "exec" }, { name: "process" }] as unknown as DummyTool[];
|
||||
const filtered = applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: () => {},
|
||||
steps: [
|
||||
@@ -275,9 +253,7 @@ describe("tool-policy-pipeline", () => {
|
||||
test("applies deny filtering after allow filtering", () => {
|
||||
const tools = [{ name: "exec" }, { name: "process" }] as unknown as DummyTool[];
|
||||
const filtered = applyToolPolicyPipeline({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
tools: tools as any,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
toolMeta: () => undefined,
|
||||
warn: () => {},
|
||||
steps: [
|
||||
|
||||
@@ -20,24 +20,20 @@ function createOwnerPolicyTools() {
|
||||
return [
|
||||
{
|
||||
name: "read",
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
execute: async () => ({ content: [], details: {} }) as any,
|
||||
},
|
||||
{
|
||||
name: "cron",
|
||||
ownerOnly: true,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
execute: async () => ({ content: [], details: {} }) as any,
|
||||
},
|
||||
{
|
||||
name: "gateway",
|
||||
ownerOnly: true,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
execute: async () => ({ content: [], details: {} }) as any,
|
||||
},
|
||||
{
|
||||
name: "whatsapp_login",
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
execute: async () => ({ content: [], details: {} }) as any,
|
||||
},
|
||||
] as unknown as AnyAgentTool[];
|
||||
@@ -126,7 +122,6 @@ describe("tool-policy", () => {
|
||||
{
|
||||
name: "custom_admin_tool",
|
||||
ownerOnly: true,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
execute: async () => ({ content: [], details: {} }) as any,
|
||||
},
|
||||
] as unknown as AnyAgentTool[];
|
||||
@@ -148,12 +143,10 @@ describe("tool-policy", () => {
|
||||
const tools = [
|
||||
{
|
||||
name: "read",
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
execute: async () => ({ content: [], details: {} }) as any,
|
||||
},
|
||||
{
|
||||
name: "nodes",
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
execute: async () => ({ content: [], details: {} }) as any,
|
||||
},
|
||||
] as unknown as AnyAgentTool[];
|
||||
|
||||
Reference in New Issue
Block a user