diff --git a/.changeset/chubby-bars-pump.md b/.changeset/chubby-bars-pump.md new file mode 100644 index 0000000..a845151 --- /dev/null +++ b/.changeset/chubby-bars-pump.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/package.json b/package.json index 94bafbe..d9f04e2 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "eslint-plugin-jsdoc": "^62.8.0", "eslint-plugin-security": "^4.0.0", "laufen": "^1.2.1", - "oxfmt": "^0.42.0", - "oxlint": "^1.57.0", + "oxfmt": "^0.44.0", + "oxlint": "^1.59.0", "turbo": "^2.8.20", "vitest": "catalog:" }, diff --git a/packages/agents/src/core/agents/base/agent.test.ts b/packages/agents/src/core/agents/base/agent.test.ts index 70265a3..704dca7 100644 --- a/packages/agents/src/core/agents/base/agent.test.ts +++ b/packages/agents/src/core/agents/base/agent.test.ts @@ -2,13 +2,16 @@ import { describe, expect, it, vi, beforeEach } from "vitest"; import { z } from "zod"; import { agent } from "@/core/agents/base/agent.js"; +import type { StepFinishEvent } from "@/core/types.js"; import { RUNNABLE_META } from "@/lib/runnable.js"; import type { RunnableMeta } from "@/lib/runnable.js"; import { createMockLogger } from "@/testing/index.js"; import { suppressRejection } from "@/utils/promise.js"; -const mockGenerateText = vi.fn(); -const mockStreamText = vi.fn(); +// oxlint-disable-next-line @typescript-eslint/no-explicit-any -- top-level mock needs flexible signature for mockImplementation compatibility +const mockGenerateText = vi.fn<(...args: any[]) => any>(); +// oxlint-disable-next-line @typescript-eslint/no-explicit-any -- top-level mock needs flexible signature for mockImplementation compatibility +const mockStreamText = vi.fn<(...args: any[]) => any>(); const mockStepCountIs = vi.fn<(n: number) => string>().mockReturnValue("mock-stop-condition"); vi.mock( @@ -19,11 +22,17 @@ vi.mock( streamText: (...args: unknown[]) => mockStreamText(...args), stepCountIs: (n: number) => mockStepCountIs(n), Output: { - text: () => ({ parseCompleteOutput: vi.fn() }), - object: ({ schema }: { schema: unknown }) => ({ parseCompleteOutput: vi.fn(), schema }), - array: ({ element }: { element: unknown }) => ({ parseCompleteOutput: vi.fn(), element }), - choice: () => ({ parseCompleteOutput: vi.fn() }), - json: () => ({ parseCompleteOutput: vi.fn() }), + text: () => ({ parseCompleteOutput: vi.fn<() => void>() }), + object: ({ schema }: { schema: unknown }) => ({ + parseCompleteOutput: vi.fn<() => void>(), + schema, + }), + array: ({ element }: { element: unknown }) => ({ + parseCompleteOutput: vi.fn<() => void>(), + element, + }), + choice: () => ({ parseCompleteOutput: vi.fn<() => void>() }), + json: () => ({ parseCompleteOutput: vi.fn<() => void>() }), }, // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Mock factory must return partial shape; full module type is too broad }) as any, @@ -33,7 +42,9 @@ vi.mock( import("@/lib/middleware.js"), () => ({ - withModelMiddleware: vi.fn(async ({ model }: { model: unknown }) => model), + withModelMiddleware: vi.fn<({ model }: { model: unknown }) => Promise>( + async ({ model }: { model: unknown }) => model, + ), // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Mock factory must return partial shape; full module type is too broad }) as any, ); @@ -118,8 +129,8 @@ function createMockStreamResult(overrides?: { usage: Promise.resolve(merged.usage), steps: Promise.resolve([mockStep]), finishReason: Promise.resolve(merged.finishReason), - toTextStreamResponse: vi.fn(() => new Response("mock text stream")), - toUIMessageStreamResponse: vi.fn(() => new Response("mock ui stream")), + toTextStreamResponse: vi.fn<() => Response>(() => new Response("mock text stream")), + toUIMessageStreamResponse: vi.fn<() => Response>(() => new Response("mock ui stream")), }; } @@ -339,7 +350,7 @@ describe("generate() output resolution", () => { ); const a = createSimpleAgent({ - output: { parseCompleteOutput: vi.fn() } as never, + output: { parseCompleteOutput: vi.fn<() => void>() } as never, }); const result = await a.generate({ prompt: "test" }); @@ -401,7 +412,7 @@ describe("generate() system prompt", () => { describe("generate() hooks", () => { it("fires onStart hook with input", async () => { - const onStart = vi.fn(); + const onStart = vi.fn<(event: { input: unknown }) => void>(); const a = createSimpleAgent({ onStart }); await a.generate({ prompt: "hello" }); @@ -414,7 +425,8 @@ describe("generate() hooks", () => { }); it("fires onFinish hook with input, result (including usage), and duration", async () => { - const onFinish = vi.fn(); + const onFinish = + vi.fn<(event: { input: unknown; result: unknown; duration: number }) => void>(); const a = createSimpleAgent({ onFinish }); await a.generate({ prompt: "hello" }); @@ -433,7 +445,7 @@ describe("generate() hooks", () => { }); it("fires onStepFinish hook during tool loop", async () => { - const onStepFinish = vi.fn(); + const onStepFinish = vi.fn<(event: StepFinishEvent) => void>(); mockGenerateText.mockImplementation( async (opts: { onStepFinish?: (step: Record) => Promise }) => { @@ -471,7 +483,7 @@ describe("generate() hooks", () => { }); it("passes through all AI SDK StepResult fields in onStepFinish", async () => { - const onStepFinish = vi.fn(); + const onStepFinish = vi.fn<(event: StepFinishEvent) => void>(); const mockStepData = { stepNumber: 0, @@ -560,7 +572,7 @@ describe("generate() hooks", () => { }); it("preserves tool call args and results without stripping", async () => { - const onStepFinish = vi.fn(); + const onStepFinish = vi.fn<(event: StepFinishEvent) => void>(); const mockStepData = { stepNumber: 0, @@ -613,13 +625,17 @@ describe("generate() hooks", () => { // Full tool call objects preserved (not stripped to toolName + argsTextLength) expect(event.toolCalls).toEqual(mockStepData.toolCalls); - expect(event.toolCalls[0].input).toEqual({ query: "typescript", limit: 10 }); - expect(event.toolCalls[1].input).toEqual({ url: "https://example.com" }); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- asserted via toEqual above + expect(event.toolCalls[0]!.input).toEqual({ query: "typescript", limit: 10 }); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- asserted via toEqual above + expect(event.toolCalls[1]!.input).toEqual({ url: "https://example.com" }); // Full tool result objects preserved (not stripped to toolName + resultTextLength) expect(event.toolResults).toEqual(mockStepData.toolResults); - expect(event.toolResults[0].output).toEqual({ items: [1, 2, 3] }); - expect(event.toolResults[1].output).toEqual({ body: "" }); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- asserted via toEqual above + expect(event.toolResults[0]!.output).toEqual({ items: [1, 2, 3] }); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- asserted via toEqual above + expect(event.toolResults[1]!.output).toEqual({ body: "" }); // Usage passed through as-is expect(event.usage).toEqual(mockStepData.usage); @@ -629,8 +645,8 @@ describe("generate() hooks", () => { }); it("fires both config and override onStart hooks", async () => { - const configOnStart = vi.fn(); - const overrideOnStart = vi.fn(); + const configOnStart = vi.fn<() => void>(); + const overrideOnStart = vi.fn<() => void>(); const a = createSimpleAgent({ onStart: configOnStart }); await a.generate({ prompt: "test", onStart: overrideOnStart }); @@ -640,8 +656,8 @@ describe("generate() hooks", () => { }); it("fires both config and override onFinish hooks", async () => { - const configOnFinish = vi.fn(); - const overrideOnFinish = vi.fn(); + const configOnFinish = vi.fn<() => void>(); + const overrideOnFinish = vi.fn<() => void>(); const a = createSimpleAgent({ onFinish: configOnFinish }); await a.generate({ prompt: "test", onFinish: overrideOnFinish }); @@ -651,8 +667,8 @@ describe("generate() hooks", () => { }); it("fires both config and override onStepFinish hooks", async () => { - const configOnStepFinish = vi.fn(); - const overrideOnStepFinish = vi.fn(); + const configOnStepFinish = vi.fn<() => void>(); + const overrideOnStepFinish = vi.fn<() => void>(); mockGenerateText.mockImplementation( async (opts: { onStepFinish?: (step: Record) => Promise }) => { @@ -708,7 +724,7 @@ describe("generate() error handling", () => { it("fires onError hook when generateText throws", async () => { mockGenerateText.mockRejectedValue(new Error("boom")); - const onError = vi.fn(); + const onError = vi.fn<(event: { input: unknown; error: Error }) => void>(); const a = createSimpleAgent({ onError }); await a.generate({ prompt: "test" }); @@ -725,8 +741,8 @@ describe("generate() error handling", () => { it("fires both config and override onError hooks", async () => { mockGenerateText.mockRejectedValue(new Error("fail")); - const configOnError = vi.fn(); - const overrideOnError = vi.fn(); + const configOnError = vi.fn<() => void>(); + const overrideOnError = vi.fn<() => void>(); const a = createSimpleAgent({ onError: configOnError }); await a.generate({ prompt: "test", onError: overrideOnError }); @@ -737,7 +753,7 @@ describe("generate() error handling", () => { it("does not fire onFinish when generateText throws", async () => { mockGenerateText.mockRejectedValue(new Error("fail")); - const onFinish = vi.fn(); + const onFinish = vi.fn<() => void>(); const a = createSimpleAgent({ onFinish }); await a.generate({ prompt: "test" }); @@ -746,7 +762,7 @@ describe("generate() error handling", () => { }); it("does not fire onError on input validation failure", async () => { - const onError = vi.fn(); + const onError = vi.fn<() => void>(); const a = createTypedAgent({ onError }); // @ts-expect-error - intentionally invalid input @@ -976,7 +992,7 @@ describe("stream() input validation", () => { describe("stream() hooks", () => { it("fires onStart hook with input", async () => { - const onStart = vi.fn(); + const onStart = vi.fn<(event: { input: unknown }) => void>(); const a = createSimpleAgent({ onStart }); await a.stream({ prompt: "hello" }); @@ -989,7 +1005,8 @@ describe("stream() hooks", () => { }); it("fires onFinish hook after stream completes", async () => { - const onFinish = vi.fn(); + const onFinish = + vi.fn<(event: { input: unknown; result: unknown; duration: number }) => void>(); const a = createSimpleAgent({ onFinish }); const result = await a.stream({ prompt: "hello" }); @@ -1022,7 +1039,7 @@ describe("stream() hooks", () => { }); it("fires onStepFinish hook during stream tool loop", async () => { - const onStepFinish = vi.fn(); + const onStepFinish = vi.fn<() => void>(); const streamResult = createMockStreamResult(); mockStreamText.mockImplementation( @@ -1066,7 +1083,7 @@ describe("stream() hooks", () => { }); it("passes through AI SDK StepResult fields in stream onStepFinish", async () => { - const onStepFinish = vi.fn(); + const onStepFinish = vi.fn<(event: StepFinishEvent) => void>(); const mockStepData = { stepNumber: 0, @@ -1159,7 +1176,7 @@ describe("stream() error handling", () => { throw new Error("setup fail"); }); - const onError = vi.fn(); + const onError = vi.fn<(event: { input: unknown; error: Error }) => void>(); const a = createSimpleAgent({ onError }); await a.stream({ prompt: "test" }); @@ -1189,7 +1206,7 @@ describe("stream() error handling", () => { }); it("does not fire onError on input validation failure", async () => { - const onError = vi.fn(); + const onError = vi.fn<() => void>(); const a = createTypedAgent({ onError }); // @ts-expect-error - intentionally invalid input @@ -1203,7 +1220,7 @@ describe("stream() error handling", () => { throw new Error("setup fail"); }); - const onFinish = vi.fn(); + const onFinish = vi.fn<() => void>(); const a = createSimpleAgent({ onFinish }); await a.stream({ prompt: "test" }); @@ -1267,7 +1284,7 @@ describe("fn()", () => { }); it("fn() passes overrides through to generate", async () => { - const onStart = vi.fn(); + const onStart = vi.fn<() => void>(); const a = createSimpleAgent(); const fn = a.fn(); @@ -1296,7 +1313,7 @@ describe("tool integration", () => { const mockTool = { description: "mock tool", inputSchema: { jsonSchema: {} }, - execute: vi.fn(), + execute: vi.fn<() => void>(), }; const a = createSimpleAgent({ tools: { myTool: mockTool as never } }); @@ -1321,11 +1338,15 @@ describe("tool integration", () => { }); it("merges override tools with config tools", async () => { - const configTool = { description: "config", inputSchema: { jsonSchema: {} }, execute: vi.fn() }; + const configTool = { + description: "config", + inputSchema: { jsonSchema: {} }, + execute: vi.fn<() => void>(), + }; const overrideTool = { description: "override", inputSchema: { jsonSchema: {} }, - execute: vi.fn(), + execute: vi.fn<() => void>(), }; const a = createSimpleAgent({ tools: { configTool: configTool as never } }); @@ -1442,8 +1463,8 @@ describe("stream() async error during consumption", () => { const streamError = new Error("async hook error"); mockStreamText.mockReturnValue(createErrorStreamResult(streamError)); - const onError = vi.fn(); - const onFinish = vi.fn(); + const onError = vi.fn<(event: { input: unknown; error: Error }) => void>(); + const onFinish = vi.fn<() => void>(); const a = createSimpleAgent({ onError, onFinish }); const result = await a.stream({ prompt: "test" }); @@ -1507,8 +1528,8 @@ describe("stream() unhandled rejection safety", () => { response: makeSuppressedRejection<{ messages: unknown[] }>(streamError), totalUsage: makeSuppressedRejection(streamError), finishReason: makeSuppressedRejection(streamError), - toTextStreamResponse: vi.fn(() => new Response("")), - toUIMessageStreamResponse: vi.fn(() => new Response("")), + toTextStreamResponse: vi.fn<() => Response>(() => new Response("")), + toUIMessageStreamResponse: vi.fn<() => Response>(() => new Response("")), }); const unhandledRejections: unknown[] = []; @@ -1562,7 +1583,7 @@ describe("stream() unhandled rejection safety", () => { describe("stream() response methods", () => { it("toTextStreamResponse delegates to the AI SDK result", async () => { const mockResponse = new Response("mock text"); - const mockToText = vi.fn(() => mockResponse); + const mockToText = vi.fn<() => Response>(() => mockResponse); mockStreamText.mockReturnValue({ ...createMockStreamResult(), toTextStreamResponse: mockToText, @@ -1583,7 +1604,7 @@ describe("stream() response methods", () => { it("toUIMessageStreamResponse delegates to the AI SDK result", async () => { const mockResponse = new Response("mock ui"); - const mockToUI = vi.fn(() => mockResponse); + const mockToUI = vi.fn<() => Response>(() => mockResponse); mockStreamText.mockReturnValue({ ...createMockStreamResult(), toUIMessageStreamResponse: mockToUI, @@ -1603,7 +1624,7 @@ describe("stream() response methods", () => { it("toTextStreamResponse works with no arguments", async () => { const mockResponse = new Response("text"); - const mockToText = vi.fn(() => mockResponse); + const mockToText = vi.fn<() => Response>(() => mockResponse); mockStreamText.mockReturnValue({ ...createMockStreamResult(), toTextStreamResponse: mockToText, diff --git a/packages/agents/src/core/agents/base/utils.test.ts b/packages/agents/src/core/agents/base/utils.test.ts index cde4d1a..aea4fc2 100644 --- a/packages/agents/src/core/agents/base/utils.test.ts +++ b/packages/agents/src/core/agents/base/utils.test.ts @@ -30,7 +30,7 @@ describe(resolveValue, () => { }); it("does not call a LanguageModel object as a function", async () => { - const model = { doGenerate: vi.fn(), specificationVersion: "v1" }; + const model = { doGenerate: vi.fn<() => void>(), specificationVersion: "v1" }; const result = await resolveValue(model, "input"); expect(result).toBe(model); expect(model.doGenerate).not.toHaveBeenCalled(); @@ -135,7 +135,9 @@ describe(buildAITools, () => { it("wraps agents without inputSchema into prompt-based tools", () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "result" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "result" }), }; const result = buildAITools(undefined, { sub: mockAgent as never }); @@ -148,7 +150,9 @@ describe(buildAITools, () => { it("wraps agents with inputSchema using the schema", () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "result" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "result" }), [RUNNABLE_META]: { name: "custom-name", inputSchema: z.object({ query: z.string() }), @@ -169,7 +173,9 @@ describe(buildAITools, () => { it("uses fallback name when agent has no RUNNABLE_META name", () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "result" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "result" }), }; const result = buildAITools(undefined, { fallbackKey: mockAgent as never }); @@ -183,7 +189,9 @@ describe(buildAITools, () => { it("throws on agent key with dashes", () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "result" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "result" }), }; expect(() => buildAITools(undefined, { "my-agent": mockAgent as never })).toThrow( /Invalid sub-agent key "my-agent"/, @@ -192,7 +200,9 @@ describe(buildAITools, () => { it("throws on agent key with dots", () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "result" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "result" }), }; expect(() => buildAITools(undefined, { "my.agent": mockAgent as never })).toThrow( /Invalid sub-agent key "my\.agent"/, @@ -201,7 +211,9 @@ describe(buildAITools, () => { it("throws on agent key with colons", () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "result" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "result" }), }; expect(() => buildAITools(undefined, { "my:agent": mockAgent as never })).toThrow( /Invalid sub-agent key "my:agent"/, @@ -210,7 +222,9 @@ describe(buildAITools, () => { it("accepts camelCase agent keys", () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "result" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "result" }), }; const result = buildAITools(undefined, { myAgent: mockAgent as never }); @@ -220,7 +234,9 @@ describe(buildAITools, () => { it("accepts snake_case agent keys", () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "result" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "result" }), }; const result = buildAITools(undefined, { my_agent: mockAgent as never }); @@ -231,7 +247,9 @@ describe(buildAITools, () => { it("merges tools and agents together", () => { const tools = { myTool: { description: "test" } as never }; const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "result" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "result" }), }; const result = buildAITools(tools, { sub: mockAgent as never }); @@ -242,7 +260,9 @@ describe(buildAITools, () => { it("execute calls generate on prompt-based agent and returns output", async () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "agent-output" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "agent-output" }), }; const result = buildAITools(undefined, { sub: mockAgent as never }); expect(result).toBeDefined(); @@ -265,7 +285,9 @@ describe(buildAITools, () => { it("execute throws when prompt-based agent returns error", async () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: false, error: { message: "agent failed" } }), + generate: vi + .fn<() => Promise<{ ok: boolean; error: { message: string } }>>() + .mockResolvedValue({ ok: false, error: { message: "agent failed" } }), }; const result = buildAITools(undefined, { sub: mockAgent as never }); expect(result).toBeDefined(); @@ -281,7 +303,9 @@ describe(buildAITools, () => { it("execute calls generate on typed agent with inputSchema and returns output", async () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: true, output: "typed-output" }), + generate: vi + .fn<() => Promise<{ ok: boolean; output: string }>>() + .mockResolvedValue({ ok: true, output: "typed-output" }), [RUNNABLE_META]: { name: "typed-agent", inputSchema: z.object({ query: z.string() }), @@ -308,7 +332,9 @@ describe(buildAITools, () => { it("execute throws when typed agent returns error", async () => { const mockAgent = { - generate: vi.fn().mockResolvedValue({ ok: false, error: { message: "typed failed" } }), + generate: vi + .fn<() => Promise<{ ok: boolean; error: { message: string } }>>() + .mockResolvedValue({ ok: false, error: { message: "typed failed" } }), [RUNNABLE_META]: { name: "typed-agent", inputSchema: z.object({ query: z.string() }), diff --git a/packages/agents/src/core/agents/evolve.test.ts b/packages/agents/src/core/agents/evolve.test.ts index c2da725..b414032 100644 --- a/packages/agents/src/core/agents/evolve.test.ts +++ b/packages/agents/src/core/agents/evolve.test.ts @@ -11,8 +11,8 @@ import { createMockLogger } from "@/testing/index.js"; // Mocks // --------------------------------------------------------------------------- -const mockGenerateText = vi.fn(); -const mockStreamText = vi.fn(); +const mockGenerateText = vi.fn<(...args: unknown[]) => unknown>(); +const mockStreamText = vi.fn<(...args: unknown[]) => unknown>(); const mockStepCountIs = vi.fn<(n: number) => string>().mockReturnValue("mock-stop-condition"); vi.mock( @@ -23,11 +23,17 @@ vi.mock( streamText: (...args: unknown[]) => mockStreamText(...args), stepCountIs: (n: number) => mockStepCountIs(n), Output: { - text: () => ({ parseCompleteOutput: vi.fn() }), - object: ({ schema }: { schema: unknown }) => ({ parseCompleteOutput: vi.fn(), schema }), - array: ({ element }: { element: unknown }) => ({ parseCompleteOutput: vi.fn(), element }), - choice: () => ({ parseCompleteOutput: vi.fn() }), - json: () => ({ parseCompleteOutput: vi.fn() }), + text: () => ({ parseCompleteOutput: vi.fn<() => void>() }), + object: ({ schema }: { schema: unknown }) => ({ + parseCompleteOutput: vi.fn<() => void>(), + schema, + }), + array: ({ element }: { element: unknown }) => ({ + parseCompleteOutput: vi.fn<() => void>(), + element, + }), + choice: () => ({ parseCompleteOutput: vi.fn<() => void>() }), + json: () => ({ parseCompleteOutput: vi.fn<() => void>() }), }, // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Mock factory must return partial shape }) as any, @@ -37,7 +43,9 @@ vi.mock( import("@/lib/middleware.js"), () => ({ - withModelMiddleware: vi.fn(async ({ model }: { model: unknown }) => model), + withModelMiddleware: vi.fn<(args: { model: unknown }) => Promise>( + async ({ model }: { model: unknown }) => model, + ), // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Mock factory must return partial shape }) as any, ); @@ -144,9 +152,9 @@ describe("evolve() with Agent", () => { }); it("shallow merges tools — overriding an existing key", () => { - const toolA = { execute: vi.fn() } as never; - const toolB = { execute: vi.fn() } as never; - const toolBReplacement = { execute: vi.fn() } as never; + const toolA = { execute: vi.fn<() => void>() } as never; + const toolB = { execute: vi.fn<() => void>() } as never; + const toolBReplacement = { execute: vi.fn<() => void>() } as never; const base = agent({ name: "tooled", @@ -213,7 +221,7 @@ describe("evolve() with Agent", () => { }); it("preserves tools when override has no tools field", () => { - const toolA = { execute: vi.fn() } as never; + const toolA = { execute: vi.fn<() => void>() } as never; const base = agent({ name: "tooled", @@ -313,7 +321,7 @@ describe("evolve() with FlowAgent", () => { }); it("overrides hooks on flow agent", () => { - const onStart = vi.fn(); + const onStart = vi.fn<() => void>(); const base = createTestFlowAgent(); const evolved = evolve(base, { onStart }); @@ -511,7 +519,11 @@ describe("evolve() with FlowAgent mapper function", () => { describe("evolve() error handling", () => { it("throws for a plain object that is not an agent", () => { - const fake = { generate: vi.fn(), stream: vi.fn(), fn: vi.fn() }; + const fake = { + generate: vi.fn<() => void>(), + stream: vi.fn<() => void>(), + fn: vi.fn<() => void>(), + }; expect(() => evolve(fake as never, {})).toThrow("evolve() requires an Agent or FlowAgent"); }); diff --git a/packages/agents/src/core/agents/flow/engine.test.ts b/packages/agents/src/core/agents/flow/engine.test.ts index 8112c79..183d601 100644 --- a/packages/agents/src/core/agents/flow/engine.test.ts +++ b/packages/agents/src/core/agents/flow/engine.test.ts @@ -61,19 +61,16 @@ describe(createFlowEngine, () => { }); it("custom step factories receive correct ctx and config", async () => { - const factorySpy = vi.fn( - async ({ - ctx, - config, - }: { + const factorySpy = vi.fn< + (params: { ctx: { signal: AbortSignal; log: unknown }; config: { value: number }; - }) => { - expect(ctx.signal).toBeDefined(); - expect(ctx.log).toBeDefined(); - return config.value + 1; - }, - ); + }) => Promise + >(async ({ ctx, config }) => { + expect(ctx.signal).toBeDefined(); + expect(ctx.log).toBeDefined(); + return config.value + 1; + }); const engine = createFlowEngine({ $: { @@ -262,8 +259,8 @@ describe(createFlowEngine, () => { }); it("if only engine has a hook (flow does not), it fires", async () => { - const engineOnStart = vi.fn(); - const engineOnFinish = vi.fn(); + const engineOnStart = vi.fn<() => void>(); + const engineOnFinish = vi.fn<() => void>(); const engine = createFlowEngine({ onStart: engineOnStart, @@ -279,8 +276,8 @@ describe(createFlowEngine, () => { }); it("if only flow has a hook (engine does not), it fires", async () => { - const flowOnStart = vi.fn(); - const flowOnFinish = vi.fn(); + const flowOnStart = vi.fn<() => void>(); + const flowOnFinish = vi.fn<() => void>(); const engine = createFlowEngine({}); diff --git a/packages/agents/src/core/agents/flow/flow-agent.test.ts b/packages/agents/src/core/agents/flow/flow-agent.test.ts index fc701e3..003e697 100644 --- a/packages/agents/src/core/agents/flow/flow-agent.test.ts +++ b/packages/agents/src/core/agents/flow/flow-agent.test.ts @@ -180,7 +180,9 @@ describe("generate() input validation", () => { }); it("does not call handler when input validation fails", async () => { - const handler = vi.fn(async ({ input }: { input: { x: number } }) => ({ y: input.x })); + const handler = vi.fn<(args: { input: { x: number } }) => Promise<{ y: number }>>( + async ({ input }: { input: { x: number } }) => ({ y: input.x }), + ); const fa = flowAgent<{ x: number }, { y: number }>( { name: "test", @@ -256,7 +258,7 @@ describe("generate() error handling", () => { describe("generate() hooks", () => { it("fires onStart hook with input", async () => { - const onStart = vi.fn(); + const onStart = vi.fn<(event: unknown) => void>(); const fa = createSimpleFlowAgent({ onStart }); await fa.generate({ input: { x: 5 } }); @@ -269,8 +271,11 @@ describe("generate() hooks", () => { }); it("fires onFinish hook with input, result, and duration", async () => { - const onFinish = vi.fn(); - const fa = createSimpleFlowAgent({ onFinish }); + const onFinish = + vi.fn< + (event: { input: { x: number }; result: Record; duration: number }) => void + >(); + const fa = createSimpleFlowAgent({ onFinish: onFinish as never }); await fa.generate({ input: { x: 3 } }); expect(onFinish).toHaveBeenCalledTimes(1); @@ -286,7 +291,7 @@ describe("generate() hooks", () => { }); it("fires onError hook when handler throws", async () => { - const onError = vi.fn(); + const onError = vi.fn<(event: { input: { x: number }; error: Error }) => void>(); const fa = createSimpleFlowAgent({ onError }, async () => { throw new Error("boom"); }); @@ -303,8 +308,8 @@ describe("generate() hooks", () => { }); it("fires both config and override onStart hooks", async () => { - const configOnStart = vi.fn(); - const overrideOnStart = vi.fn(); + const configOnStart = vi.fn<() => void>(); + const overrideOnStart = vi.fn<() => void>(); const fa = createSimpleFlowAgent({ onStart: configOnStart }); await fa.generate({ input: { x: 1 }, onStart: overrideOnStart }); @@ -314,8 +319,8 @@ describe("generate() hooks", () => { }); it("fires both config and override onFinish hooks", async () => { - const configOnFinish = vi.fn(); - const overrideOnFinish = vi.fn(); + const configOnFinish = vi.fn<() => void>(); + const overrideOnFinish = vi.fn<() => void>(); const fa = createSimpleFlowAgent({ onFinish: configOnFinish }); await fa.generate({ input: { x: 1 }, onFinish: overrideOnFinish }); @@ -325,8 +330,8 @@ describe("generate() hooks", () => { }); it("fires both config and override onError hooks", async () => { - const configOnError = vi.fn(); - const overrideOnError = vi.fn(); + const configOnError = vi.fn<() => void>(); + const overrideOnError = vi.fn<() => void>(); const fa = createSimpleFlowAgent({ onError: configOnError }, async () => { throw new Error("fail"); @@ -338,8 +343,8 @@ describe("generate() hooks", () => { }); it("fires both config and override onStepFinish hooks", async () => { - const configOnStepFinish = vi.fn(); - const overrideOnStepFinish = vi.fn(); + const configOnStepFinish = vi.fn<(event: unknown) => void>(); + const overrideOnStepFinish = vi.fn<(event: unknown) => void>(); const fa = flowAgent<{ x: number }, { y: number }>( { @@ -381,10 +386,10 @@ describe("generate() hooks", () => { it("fires config onStepFinish before override onStepFinish", async () => { const order: string[] = []; - const configOnStepFinish = vi.fn(() => { + const configOnStepFinish = vi.fn<() => void>(() => { order.push("config"); }); - const overrideOnStepFinish = vi.fn(() => { + const overrideOnStepFinish = vi.fn<() => void>(() => { order.push("override"); }); @@ -411,7 +416,7 @@ describe("generate() hooks", () => { }); it("does not fire onFinish when handler throws", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<() => void>(); const fa = createSimpleFlowAgent({ onFinish }, async () => { throw new Error("fail"); @@ -422,7 +427,7 @@ describe("generate() hooks", () => { }); it("does not fire onError on input validation failure", async () => { - const onError = vi.fn(); + const onError = vi.fn<() => void>(); const fa = createSimpleFlowAgent({ onError }); // @ts-expect-error - intentionally invalid input @@ -845,7 +850,7 @@ describe("stream() output validation", () => { describe("stream() hooks", () => { it("fires onStart hook with input", async () => { - const onStart = vi.fn(); + const onStart = vi.fn<(event: unknown) => void>(); const fa = createSimpleFlowAgent({ onStart }); await fa.stream({ input: { x: 5 } }); @@ -858,7 +863,7 @@ describe("stream() hooks", () => { }); it("fires onFinish hook after stream completes", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<() => void>(); const fa = createSimpleFlowAgent({ onFinish }); const result = await fa.stream({ input: { x: 3 } }); @@ -883,8 +888,8 @@ describe("stream() hooks", () => { }); it("fires both config and override onStart hooks during stream", async () => { - const configOnStart = vi.fn(); - const overrideOnStart = vi.fn(); + const configOnStart = vi.fn<(event: unknown) => void>(); + const overrideOnStart = vi.fn<(event: unknown) => void>(); const fa = createSimpleFlowAgent({ onStart: configOnStart }); const result = await fa.stream({ input: { x: 7 }, onStart: overrideOnStart }); @@ -920,7 +925,7 @@ describe("stream() hooks", () => { }); it("fires onError hook when handler throws during stream", async () => { - const onError = vi.fn(); + const onError = vi.fn<() => void>(); const fa = createSimpleFlowAgent({ onError }, async () => { throw new Error("stream boom"); }); @@ -1003,7 +1008,7 @@ describe("fn()", () => { }); it("fn() passes overrides through to generate", async () => { - const onStart = vi.fn(); + const onStart = vi.fn<() => void>(); const fa = createSimpleFlowAgent(); const fn = fa.fn(); @@ -1030,7 +1035,11 @@ describe("fn()", () => { describe("generate() with agents dependency", () => { it("handler receives agents from config", async () => { let receivedAgents: Record | undefined; - const mockAgent = { generate: vi.fn(), stream: vi.fn(), fn: vi.fn() }; + const mockAgent = { + generate: vi.fn<() => void>(), + stream: vi.fn<() => void>(), + fn: vi.fn<() => void>(), + }; const fa = flowAgent<{ x: number }, { y: number }>( { @@ -1078,7 +1087,11 @@ describe("generate() with agents dependency", () => { describe("stream() with agents dependency", () => { it("handler receives agents from config during streaming", async () => { let receivedAgents: Record | undefined; - const mockAgent = { generate: vi.fn(), stream: vi.fn(), fn: vi.fn() }; + const mockAgent = { + generate: vi.fn<() => void>(), + stream: vi.fn<() => void>(), + fn: vi.fn<() => void>(), + }; const fa = flowAgent<{ x: number }, { y: number }>( { diff --git a/packages/agents/src/core/agents/flow/steps/agent.test.ts b/packages/agents/src/core/agents/flow/steps/agent.test.ts index 124e308..dd26177 100644 --- a/packages/agents/src/core/agents/flow/steps/agent.test.ts +++ b/packages/agents/src/core/agents/flow/steps/agent.test.ts @@ -26,9 +26,9 @@ function mockAgent(result: Result>): Agent ({ ...r, usage: MOCK_USAGE, finishReason: "stop" as const })) .otherwise((r) => r) as Result; return { - generate: vi.fn(async () => resolved), - stream: vi.fn(), - fn: vi.fn(), + generate: vi.fn<() => Promise>(async () => resolved), + stream: vi.fn<() => Promise>(), + fn: vi.fn<() => void>(), } as unknown as Agent; } @@ -192,7 +192,7 @@ describe("agent()", () => { }); it("fires onError hook on failure", async () => { - const onError = vi.fn(); + const onError = vi.fn<() => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); const agent = mockAgent({ @@ -217,7 +217,7 @@ describe("agent()", () => { }); it("onFinish receives the GenerateResult", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<() => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); const agent = mockAgent({ ok: true, output: "result-text" }); diff --git a/packages/agents/src/core/agents/flow/steps/all.test.ts b/packages/agents/src/core/agents/flow/steps/all.test.ts index 28a3d6b..b9cbbfb 100644 --- a/packages/agents/src/core/agents/flow/steps/all.test.ts +++ b/packages/agents/src/core/agents/flow/steps/all.test.ts @@ -199,7 +199,7 @@ describe("all()", () => { }); it("fires onError hook on failure", async () => { - const onError = vi.fn(); + const onError = vi.fn<(event: { id: string; error: Error }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); @@ -219,7 +219,7 @@ describe("all()", () => { }); it("onFinish receives the results array", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<(event: { id: string; result: unknown[]; duration: number }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); diff --git a/packages/agents/src/core/agents/flow/steps/each.test.ts b/packages/agents/src/core/agents/flow/steps/each.test.ts index 4c963e1..1d5f780 100644 --- a/packages/agents/src/core/agents/flow/steps/each.test.ts +++ b/packages/agents/src/core/agents/flow/steps/each.test.ts @@ -83,7 +83,7 @@ describe("each()", () => { it("handles empty input array", async () => { const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); - const executeSpy = vi.fn(); + const executeSpy = vi.fn<() => Promise>(); const result = await $.each({ id: "each-empty", @@ -174,7 +174,7 @@ describe("each()", () => { }); it("fires onError hook on failure", async () => { - const onError = vi.fn(); + const onError = vi.fn<() => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); @@ -197,7 +197,7 @@ describe("each()", () => { }); it("onFinish receives duration but no result", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<() => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); diff --git a/packages/agents/src/core/agents/flow/steps/factory.test.ts b/packages/agents/src/core/agents/flow/steps/factory.test.ts index cb87954..775bffc 100644 --- a/packages/agents/src/core/agents/flow/steps/factory.test.ts +++ b/packages/agents/src/core/agents/flow/steps/factory.test.ts @@ -130,7 +130,7 @@ describe("step()", () => { }); it("parentHooks.onStepFinish fires on error with result undefined", async () => { - const parentFinish = vi.fn(); + const parentFinish = vi.fn<() => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx, @@ -293,9 +293,9 @@ describe("agent()", () => { .with({ ok: true }, (r) => ({ ...r, usage: MOCK_USAGE, finishReason: "stop" as const })) .otherwise((r) => r) as Result; return { - generate: vi.fn(async () => resolved), - stream: vi.fn(), - fn: vi.fn(), + generate: vi.fn<() => Promise>>(async () => resolved), + stream: vi.fn<() => void>(), + fn: vi.fn<() => void>(), } as unknown as Agent; } @@ -784,12 +784,12 @@ describe("agent() streaming with writer", () => { } { const written: StreamPart[] = []; const writer = { - write: vi.fn(async (chunk: StreamPart) => { + write: vi.fn<(chunk: StreamPart) => Promise>(async (chunk: StreamPart) => { written.push(chunk); }), - close: vi.fn(async () => {}), - abort: vi.fn(async () => {}), - releaseLock: vi.fn(), + close: vi.fn<() => Promise>(async () => {}), + abort: vi.fn<() => Promise>(async () => {}), + releaseLock: vi.fn<() => void>(), ready: Promise.resolve(undefined), desiredSize: 1, closed: new Promise(() => {}), @@ -834,9 +834,9 @@ describe("agent() streaming with writer", () => { }; const agent = { - generate: vi.fn(), - stream: vi.fn(async () => mockStreamResult), - fn: vi.fn(), + generate: vi.fn<() => void>(), + stream: vi.fn<() => Promise>(async () => mockStreamResult), + fn: vi.fn<() => void>(), } as unknown as Agent; const result = await $.agent({ @@ -868,12 +868,14 @@ describe("agent() streaming with writer", () => { const $ = createStepBuilder({ ctx, writer }); const agent = { - generate: vi.fn(), - stream: vi.fn(async () => ({ + generate: vi.fn<() => void>(), + stream: vi.fn< + () => Promise<{ ok: false; error: { code: string; message: string; cause: Error } }> + >(async () => ({ ok: false as const, error: { code: "AGENT_ERROR", message: "stream failed", cause: new Error("root cause") }, })), - fn: vi.fn(), + fn: vi.fn<() => void>(), } as unknown as Agent; const result = await $.agent({ @@ -897,12 +899,14 @@ describe("agent() streaming with writer", () => { const $ = createStepBuilder({ ctx, writer }); const agent = { - generate: vi.fn(), - stream: vi.fn(async () => ({ - ok: false as const, - error: { code: "AGENT_ERROR", message: "no cause error" }, - })), - fn: vi.fn(), + generate: vi.fn<() => void>(), + stream: vi.fn<() => Promise<{ ok: false; error: { code: string; message: string } }>>( + async () => ({ + ok: false as const, + error: { code: "AGENT_ERROR", message: "no cause error" }, + }), + ), + fn: vi.fn<() => void>(), } as unknown as Agent; const result = await $.agent({ @@ -946,9 +950,9 @@ describe("agent() streaming with writer", () => { }; const agent = { - generate: vi.fn(), - stream: vi.fn(async () => mockStreamResult), - fn: vi.fn(), + generate: vi.fn<() => void>(), + stream: vi.fn<() => Promise>(async () => mockStreamResult), + fn: vi.fn<() => void>(), } as unknown as Agent; await $.agent({ diff --git a/packages/agents/src/core/agents/flow/steps/map.test.ts b/packages/agents/src/core/agents/flow/steps/map.test.ts index e6f659b..2b73f89 100644 --- a/packages/agents/src/core/agents/flow/steps/map.test.ts +++ b/packages/agents/src/core/agents/flow/steps/map.test.ts @@ -187,7 +187,7 @@ describe("map()", () => { }); it("fires onError hook on failure", async () => { - const onError = vi.fn(); + const onError = vi.fn<(event: { id: string; error: Error }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); @@ -210,7 +210,7 @@ describe("map()", () => { }); it("onFinish receives the result array", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<(event: { id: string; result: number[]; duration: number }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); diff --git a/packages/agents/src/core/agents/flow/steps/race.test.ts b/packages/agents/src/core/agents/flow/steps/race.test.ts index 6475b35..dd3140c 100644 --- a/packages/agents/src/core/agents/flow/steps/race.test.ts +++ b/packages/agents/src/core/agents/flow/steps/race.test.ts @@ -167,7 +167,7 @@ describe("race()", () => { }); it("fires onError hook on failure", async () => { - const onError = vi.fn(); + const onError = vi.fn<(event: { id: string; error: Error }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); @@ -187,7 +187,7 @@ describe("race()", () => { }); it("onFinish receives the winner result", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<(event: { id: string; result: unknown; duration: number }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); diff --git a/packages/agents/src/core/agents/flow/steps/reduce.test.ts b/packages/agents/src/core/agents/flow/steps/reduce.test.ts index 4fd57d8..523be64 100644 --- a/packages/agents/src/core/agents/flow/steps/reduce.test.ts +++ b/packages/agents/src/core/agents/flow/steps/reduce.test.ts @@ -215,7 +215,7 @@ describe("reduce()", () => { }); it("fires onError hook on failure", async () => { - const onError = vi.fn(); + const onError = vi.fn<() => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); @@ -239,7 +239,7 @@ describe("reduce()", () => { }); it("onFinish receives the final accumulated result", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<() => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); diff --git a/packages/agents/src/core/agents/flow/steps/step.test.ts b/packages/agents/src/core/agents/flow/steps/step.test.ts index 70ddc6b..3751bde 100644 --- a/packages/agents/src/core/agents/flow/steps/step.test.ts +++ b/packages/agents/src/core/agents/flow/steps/step.test.ts @@ -166,7 +166,7 @@ describe("step()", () => { }); it("parentHooks.onStepFinish fires on error with result undefined", async () => { - const parentFinish = vi.fn(); + const parentFinish = vi.fn<(event: unknown) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx, @@ -312,7 +312,7 @@ describe("step()", () => { }); it("onFinish receives the result and duration", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<(event: { id: string; result: unknown; duration: number }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); @@ -333,7 +333,7 @@ describe("step()", () => { }); it("onError receives the error and step id", async () => { - const onError = vi.fn(); + const onError = vi.fn<(event: { id: string; error: Error }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); diff --git a/packages/agents/src/core/agents/flow/steps/while.test.ts b/packages/agents/src/core/agents/flow/steps/while.test.ts index b49a038..87be2da 100644 --- a/packages/agents/src/core/agents/flow/steps/while.test.ts +++ b/packages/agents/src/core/agents/flow/steps/while.test.ts @@ -42,7 +42,7 @@ describe("while()", () => { it("does not call execute when condition is initially false", async () => { const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); - const executeSpy = vi.fn(async () => "value"); + const executeSpy = vi.fn<() => Promise>(async () => "value"); await $.while({ id: "while-no-exec", @@ -179,7 +179,7 @@ describe("while()", () => { }); it("fires onError hook on failure", async () => { - const onError = vi.fn(); + const onError = vi.fn<(event: { id: string; error: Error }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); @@ -202,7 +202,7 @@ describe("while()", () => { }); it("onFinish receives last value and duration", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<(event: { id: string; result: unknown; duration: number }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); @@ -223,7 +223,7 @@ describe("while()", () => { }); it("onFinish receives undefined when condition is initially false", async () => { - const onFinish = vi.fn(); + const onFinish = vi.fn<(event: { id: string; result: unknown; duration: number }) => void>(); const ctx = createMockCtx(); const $ = createStepBuilder({ ctx }); diff --git a/packages/agents/src/core/types.test-d.ts b/packages/agents/src/core/types.test-d.ts index d74a353..0c5c8d8 100644 --- a/packages/agents/src/core/types.test-d.ts +++ b/packages/agents/src/core/types.test-d.ts @@ -4,7 +4,7 @@ import { assertType, describe, expectTypeOf, it } from "vitest"; import type { AIStepResult, StepFinishEvent } from "@/core/types.js"; import { createAgentStepFinishEvent, createFlowStepFinishEvent } from "@/core/types.js"; -describe("StepFinishEvent", () => { +describe("stepFinishEvent", () => { it("has required toolCalls matching AIStepResult", () => { expectTypeOf().toEqualTypeOf(); }); @@ -33,7 +33,7 @@ describe("StepFinishEvent", () => { }); }); -describe("createAgentStepFinishEvent", () => { +describe("createAgentStepFinishEvent()", () => { it("returns StepFinishEvent", () => { expectTypeOf(createAgentStepFinishEvent).returns.toExtend(); }); @@ -44,7 +44,7 @@ describe("createAgentStepFinishEvent", () => { }); }); -describe("createFlowStepFinishEvent", () => { +describe("createFlowStepFinishEvent()", () => { it("returns StepFinishEvent", () => { expectTypeOf(createFlowStepFinishEvent).returns.toExtend(); }); diff --git a/packages/agents/src/core/types.ts b/packages/agents/src/core/types.ts index a27b88a..4313474 100644 --- a/packages/agents/src/core/types.ts +++ b/packages/agents/src/core/types.ts @@ -70,7 +70,9 @@ export type StreamPart = TextStreamPart; * ``` */ export interface AgentChainEntry { - /** Agent name (matches `config.name`). */ + /** + * Agent name (matches `config.name`). + */ readonly id: string; } diff --git a/packages/agents/src/integration/lifecycle.test.ts b/packages/agents/src/integration/lifecycle.test.ts index ce3f488..a6a1a4f 100644 --- a/packages/agents/src/integration/lifecycle.test.ts +++ b/packages/agents/src/integration/lifecycle.test.ts @@ -26,7 +26,9 @@ vi.mock( import("@/lib/middleware.js"), () => ({ - withModelMiddleware: vi.fn(async ({ model }: { model: unknown }) => model), + withModelMiddleware: vi.fn<({ model }: { model: unknown }) => Promise>( + async ({ model }) => model, + ), // oxlint-disable-next-line @typescript-eslint/no-explicit-any -- Mock factory must return partial shape }) as any, ); @@ -81,19 +83,21 @@ function createLifecycleTracker() { return { events, - onStart: vi.fn((_event: { input: unknown }) => { + onStart: vi.fn<(event: { input: unknown }) => void>((_event) => { events.push({ type: "onStart" }); }), - onFinish: vi.fn((_event: { input: unknown; result: unknown; duration: number }) => { - events.push({ type: "onFinish" }); - }), - onError: vi.fn((_event: { input: unknown; error: Error }) => { + onFinish: vi.fn<(event: { input: unknown; result: unknown; duration: number }) => void>( + (_event) => { + events.push({ type: "onFinish" }); + }, + ), + onError: vi.fn<(event: { input: unknown; error: Error }) => void>((_event) => { events.push({ type: "onError" }); }), - onStepStart: vi.fn((event: StepStartEvent) => { + onStepStart: vi.fn<(event: StepStartEvent) => void>((event) => { events.push({ type: "onStepStart", detail: event.stepId }); }), - onStepFinish: vi.fn((event: StepFinishEvent) => { + onStepFinish: vi.fn<(event: StepFinishEvent) => void>((event) => { const id = event.stepId; events.push({ type: "onStepFinish", detail: id }); }), diff --git a/packages/agents/src/lib/hooks.test.ts b/packages/agents/src/lib/hooks.test.ts index 433ab04..100b2de 100644 --- a/packages/agents/src/lib/hooks.test.ts +++ b/packages/agents/src/lib/hooks.test.ts @@ -26,7 +26,7 @@ describe(fireHooks, () => { it("skips undefined handlers", async () => { const log = createMockLogger(); - const called = vi.fn(); + const called = vi.fn<() => void>(); await fireHooks(log, undefined, called, undefined); @@ -35,7 +35,7 @@ describe(fireHooks, () => { it("swallows errors and logs them at warn level", async () => { const log = createMockLogger(); - const after = vi.fn(); + const after = vi.fn<() => void>(); await fireHooks( log, @@ -80,7 +80,7 @@ describe(fireHooks, () => { it("swallows async errors and continues", async () => { const log = createMockLogger(); - const after = vi.fn(); + const after = vi.fn<() => void>(); await fireHooks( log, @@ -103,7 +103,7 @@ describe(fireHooks, () => { describe(wrapHook, () => { it("returns a thunk that calls the hook with the event", () => { - const hook = vi.fn(); + const hook = vi.fn<(event: { id: string }) => void>(); const event = { id: "test" }; const thunk = wrapHook(hook, event); @@ -113,8 +113,7 @@ describe(wrapHook, () => { thunk?.(); - expect(hook).toHaveBeenCalledOnce(); - expect(hook).toHaveBeenCalledWith(event); + expect(hook).toHaveBeenCalledExactlyOnceWith(event); }); it("returns undefined when hookFn is undefined", () => { @@ -132,7 +131,7 @@ describe(wrapHook, () => { it("passes the exact event reference to the hook", () => { const event = { nested: { value: 42 } }; - const hook = vi.fn(); + const hook = vi.fn<(event: { nested: { value: number } }) => void>(); const thunk = wrapHook(hook, event); thunk?.(); @@ -141,7 +140,7 @@ describe(wrapHook, () => { }); it("works with async hooks", async () => { - const hook = vi.fn(async () => {}); + const hook = vi.fn<(event: { id: string }) => Promise>(async () => {}); const event = { id: "async-test" }; const thunk = wrapHook(hook, event); diff --git a/packages/agents/src/lib/middleware.test.ts b/packages/agents/src/lib/middleware.test.ts index dab4c97..7ceb8d5 100644 --- a/packages/agents/src/lib/middleware.test.ts +++ b/packages/agents/src/lib/middleware.test.ts @@ -10,8 +10,8 @@ function createStubModel() { modelId: "test-model", defaultObjectGenerationMode: "json" as const, supportsImageUrls: false, - doGenerate: vi.fn(), - doStream: vi.fn(), + doGenerate: vi.fn<() => Promise>(), + doStream: vi.fn<() => Promise>(), }; } @@ -51,7 +51,9 @@ describe(withModelMiddleware, () => { it("wraps the model when custom middleware is provided", async () => { const model = createStubModel(); - const middleware = createStubMiddleware({ wrapGenerate: vi.fn() }); + const middleware = createStubMiddleware({ + wrapGenerate: vi.fn>(), + }); const result = await withModelMiddleware({ model: model as never, @@ -67,8 +69,12 @@ describe(withModelMiddleware, () => { it("applies multiple middleware in order", async () => { const model = createStubModel(); - const mw1 = createStubMiddleware({ wrapGenerate: vi.fn() }); - const mw2 = createStubMiddleware({ wrapGenerate: vi.fn() }); + const mw1 = createStubMiddleware({ + wrapGenerate: vi.fn>(), + }); + const mw2 = createStubMiddleware({ + wrapGenerate: vi.fn>(), + }); const result = await withModelMiddleware({ model: model as never, diff --git a/packages/agents/src/testing/logger.ts b/packages/agents/src/testing/logger.ts index 6350967..72263eb 100644 --- a/packages/agents/src/testing/logger.ts +++ b/packages/agents/src/testing/logger.ts @@ -10,10 +10,10 @@ import type { Logger } from "@/core/logger.js"; */ export function createMockLogger(): Logger { return { - debug: vi.fn(), - info: vi.fn(), - warn: vi.fn(), - error: vi.fn(), - child: vi.fn(() => createMockLogger()), + debug: vi.fn<() => void>(), + info: vi.fn<() => void>(), + warn: vi.fn<() => void>(), + error: vi.fn<() => void>(), + child: vi.fn<() => Logger>(() => createMockLogger()), } as unknown as Logger; } diff --git a/packages/prompts/src/partials-dir.ts b/packages/prompts/src/partials-dir.ts index 08df204..9d3e55f 100644 --- a/packages/prompts/src/partials-dir.ts +++ b/packages/prompts/src/partials-dir.ts @@ -1,5 +1,4 @@ -import { dirname, resolve } from "node:path"; -import { fileURLToPath } from "node:url"; +import { resolve } from "node:path"; /** Absolute path to the SDK's built-in partials directory. */ -export const PARTIALS_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../prompts"); +export const PARTIALS_DIR = resolve(import.meta.dirname, "../prompts"); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3757316..5232531 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -64,11 +64,11 @@ importers: specifier: ^1.2.1 version: 1.2.1(magicast@0.5.2) oxfmt: - specifier: ^0.42.0 - version: 0.42.0 + specifier: ^0.44.0 + version: 0.44.0 oxlint: - specifier: ^1.57.0 - version: 1.57.0 + specifier: ^1.59.0 + version: 1.59.0 turbo: specifier: ^2.8.20 version: 2.8.20 @@ -1100,230 +1100,230 @@ packages: '@oxc-project/types@0.122.0': resolution: {integrity: sha512-oLAl5kBpV4w69UtFZ9xqcmTi+GENWOcPF7FCrczTiBbmC0ibXxCwyvZGbO39rCVEuLGAZM84DH0pUIyyv/YJzA==} - '@oxfmt/binding-android-arm-eabi@0.42.0': - resolution: {integrity: sha512-dsqPTYsozeokRjlrt/b4E7Pj0z3eS3Eg74TWQuuKbjY4VttBmA88rB7d50Xrd+TZ986qdXCNeZRPEzZHAe+jow==} + '@oxfmt/binding-android-arm-eabi@0.44.0': + resolution: {integrity: sha512-5UvghMd9SA/yvKTWCAxMAPXS1d2i054UeOf4iFjZjfayTwCINcC3oaSXjtbZfCaEpxgJod7XiOjTtby5yEv/BQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [android] - '@oxfmt/binding-android-arm64@0.42.0': - resolution: {integrity: sha512-t+aAjHxcr5eOBphFHdg1ouQU9qmZZoRxnX7UOJSaTwSoKsb6TYezNKO0YbWytGXCECObRqNcUxPoPr0KaraAIg==} + '@oxfmt/binding-android-arm64@0.44.0': + resolution: {integrity: sha512-IVudM1BWfvrYO++Khtzr8q9n5Rxu7msUvoFMqzGJVdX7HfUXUDHwaH2zHZNB58svx2J56pmCUzophyaPFkcG/A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@oxfmt/binding-darwin-arm64@0.42.0': - resolution: {integrity: sha512-ulpSEYMKg61C5bRMZinFHrKJYRoKGVbvMEXA5zM1puX3O9T6Q4XXDbft20yrDijpYWeuG59z3Nabt+npeTsM1A==} + '@oxfmt/binding-darwin-arm64@0.44.0': + resolution: {integrity: sha512-eWCLAIKAHfx88EqEP1Ga2yz7qVcqDU5lemn4xck+07bH182hDdprOHjbogyk0In1Djys3T0/pO2JepFnRJ41Mg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] - '@oxfmt/binding-darwin-x64@0.42.0': - resolution: {integrity: sha512-ttxLKhQYPdFiM8I/Ri37cvqChE4Xa562nNOsZFcv1CKTVLeEozXjKuYClNvxkXmNlcF55nzM80P+CQkdFBu+uQ==} + '@oxfmt/binding-darwin-x64@0.44.0': + resolution: {integrity: sha512-eHTBznHLM49++dwz07MblQ2cOXyIgeedmE3Wgy4ptUESj38/qYZyRi1MPwC9olQJWssMeY6WI3UZ7YmU5ggvyQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] - '@oxfmt/binding-freebsd-x64@0.42.0': - resolution: {integrity: sha512-Og7QS3yI3tdIKYZ58SXik0rADxIk2jmd+/YvuHRyKULWpG4V2fR5V4hvKm624Mc0cQET35waPXiCQWvjQEjwYQ==} + '@oxfmt/binding-freebsd-x64@0.44.0': + resolution: {integrity: sha512-jLMmbj0u0Ft43QpkUVr/0v1ZfQCGWAvU+WznEHcN3wZC/q6ox7XeSJtk9P36CCpiDSUf3sGnzbIuG1KdEMEDJQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] - '@oxfmt/binding-linux-arm-gnueabihf@0.42.0': - resolution: {integrity: sha512-jwLOw/3CW4H6Vxcry4/buQHk7zm9Ne2YsidzTL1kpiMe4qqrRCwev3dkyWe2YkFmP+iZCQ7zku4KwjcLRoh8ew==} + '@oxfmt/binding-linux-arm-gnueabihf@0.44.0': + resolution: {integrity: sha512-n+A/u/ByK1qV8FVGOwyaSpw5NPNl0qlZfgTBqHeGIqr8Qzq1tyWZ4lAaxPoe5mZqE3w88vn3+jZtMxriHPE7tg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxfmt/binding-linux-arm-musleabihf@0.42.0': - resolution: {integrity: sha512-XwXu2vkMtiq2h7tfvN+WA/9/5/1IoGAVCFPiiQUvcAuG3efR97KNcRGM8BetmbYouFotQ2bDal3yyjUx6IPsTg==} + '@oxfmt/binding-linux-arm-musleabihf@0.44.0': + resolution: {integrity: sha512-5eax+FkxyCqAi3Rw0mrZFr7+KTt/XweFsbALR+B5ljWBLBl8nHe4ADrUnb1gLEfQCJLl+Ca5FIVD4xEt95AwIw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxfmt/binding-linux-arm64-gnu@0.42.0': - resolution: {integrity: sha512-ea7s/XUJoT7ENAtUQDudFe3nkSM3e3Qpz4nJFRdzO2wbgXEcjnchKLEsV3+t4ev3r8nWxIYr9NRjPWtnyIFJVA==} + '@oxfmt/binding-linux-arm64-gnu@0.44.0': + resolution: {integrity: sha512-58l8JaHxSGOmOMOG2CIrNsnkRJAj0YcHQCmvNACniOa/vd1iRHhlPajczegzS5jwMENlqgreyiTR9iNlke8qCw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - '@oxfmt/binding-linux-arm64-musl@0.42.0': - resolution: {integrity: sha512-+JA0YMlSdDqmacygGi2REp57c3fN+tzARD8nwsukx9pkCHK+6DkbAA9ojS4lNKsiBjIW8WWa0pBrBWhdZEqfuw==} + '@oxfmt/binding-linux-arm64-musl@0.44.0': + resolution: {integrity: sha512-AlObQIXyVRZ96LbtVljtFq0JqH5B92NU+BQeDFrXWBUWlCKAM0wF5GLfIhCLT5kQ3Sl+U0YjRJ7Alqj5hGQaCg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - '@oxfmt/binding-linux-ppc64-gnu@0.42.0': - resolution: {integrity: sha512-VfnET0j4Y5mdfCzh5gBt0NK28lgn5DKx+8WgSMLYYeSooHhohdbzwAStLki9pNuGy51y4I7IoW8bqwAaCMiJQg==} + '@oxfmt/binding-linux-ppc64-gnu@0.44.0': + resolution: {integrity: sha512-YcFE8/q/BbrCiIiM5piwbkA6GwJc5QqhMQp2yDrqQ2fuVkZ7CInb1aIijZ/k8EXc72qXMSwKpVlBv1w/MsGO/A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] - '@oxfmt/binding-linux-riscv64-gnu@0.42.0': - resolution: {integrity: sha512-gVlCbmBkB0fxBWbhBj9rcxezPydsQHf4MFKeHoTSPicOQ+8oGeTQgQ8EeesSybWeiFPVRx3bgdt4IJnH6nOjAA==} + '@oxfmt/binding-linux-riscv64-gnu@0.44.0': + resolution: {integrity: sha512-eOdzs6RqkRzuqNHUX5C8ISN5xfGh4xDww8OEd9YAmc3OWN8oAe5bmlIqQ+rrHLpv58/0BuU48bxkhnIGjA/ATQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] - '@oxfmt/binding-linux-riscv64-musl@0.42.0': - resolution: {integrity: sha512-zN5OfstL0avgt/IgvRu0zjQzVh/EPkcLzs33E9LMAzpqlLWiPWeMDZyMGFlSRGOdDjuNmlZBCgj0pFnK5u32TQ==} + '@oxfmt/binding-linux-riscv64-musl@0.44.0': + resolution: {integrity: sha512-YBgNTxntD/QvlFUfgvh8bEdwOhXiquX8gaofZJAwYa/Xp1S1DQrFVZEeck7GFktr24DztsSp8N8WtWCBwxs0Hw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] - '@oxfmt/binding-linux-s390x-gnu@0.42.0': - resolution: {integrity: sha512-9X6+H2L0qMc2sCAgO9HS03bkGLMKvOFjmEdchaFlany3vNZOjnVui//D8k/xZAtQv2vaCs1reD5KAgPoIU4msA==} + '@oxfmt/binding-linux-s390x-gnu@0.44.0': + resolution: {integrity: sha512-GLIh1R6WHWshl/i4QQDNgj0WtT25aRO4HNUWEoitxiywyRdhTFmFEYT2rXlcl9U6/26vhmOqG5cRlMLG3ocaIA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] - '@oxfmt/binding-linux-x64-gnu@0.42.0': - resolution: {integrity: sha512-BajxJ6KQvMMdpXGPWhBGyjb2Jvx4uec0w+wi6TJZ6Tv7+MzPwe0pO8g5h1U0jyFgoaF7mDl6yKPW3ykWcbUJRw==} + '@oxfmt/binding-linux-x64-gnu@0.44.0': + resolution: {integrity: sha512-gZOpgTlOsLcLfAF9qgpTr7FIIFSKnQN3hDf/0JvQ4CIwMY7h+eilNjxq/CorqvYcEOu+LRt1W4ZS7KccEHLOdA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - '@oxfmt/binding-linux-x64-musl@0.42.0': - resolution: {integrity: sha512-0wV284I6vc5f0AqAhgAbHU2935B4bVpncPoe5n/WzVZY/KnHgqxC8iSFGeSyLWEgstFboIcWkOPck7tqbdHkzA==} + '@oxfmt/binding-linux-x64-musl@0.44.0': + resolution: {integrity: sha512-1CyS9JTB+pCUFYFI6pkQGGZaT/AY5gnhHVrQQLhFba6idP9AzVYm1xbdWfywoldTYvjxQJV6x4SuduCIfP3W+A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - '@oxfmt/binding-openharmony-arm64@0.42.0': - resolution: {integrity: sha512-p4BG6HpGnhfgHk1rzZfyR6zcWkE7iLrWxyehHfXUy4Qa5j3e0roglFOdP/Nj5cJJ58MA3isQ5dlfkW2nNEpolw==} + '@oxfmt/binding-openharmony-arm64@0.44.0': + resolution: {integrity: sha512-bmEv70Ak6jLr1xotCbF5TxIKjsmQaiX+jFRtnGtfA03tJPf6VG3cKh96S21boAt3JZc+Vjx8PYcDuLj39vM2Pw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@oxfmt/binding-win32-arm64-msvc@0.42.0': - resolution: {integrity: sha512-mn//WV60A+IetORDxYieYGAoQso4KnVRRjORDewMcod4irlRe0OSC7YPhhwaexYNPQz/GCFk+v9iUcZ2W22yxQ==} + '@oxfmt/binding-win32-arm64-msvc@0.44.0': + resolution: {integrity: sha512-yWzB+oCpSnP/dmw85eFLAT5o35Ve5pkGS2uF/UCISpIwDqf1xa7OpmtomiqY/Vzg8VyvMbuf6vroF2khF/+1Vg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] - '@oxfmt/binding-win32-ia32-msvc@0.42.0': - resolution: {integrity: sha512-3gWltUrvuz4LPJXWivoAxZ28Of2O4N7OGuM5/X3ubPXCEV8hmgECLZzjz7UYvSDUS3grfdccQwmjynm+51EFpw==} + '@oxfmt/binding-win32-ia32-msvc@0.44.0': + resolution: {integrity: sha512-TcWpo18xEIE3AmIG2kpr3kz5IEhQgnx0lazl2+8L+3eTopOAUevQcmlr4nhguImNWz0OMeOZrYZOhJNCf16nlQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ia32] os: [win32] - '@oxfmt/binding-win32-x64-msvc@0.42.0': - resolution: {integrity: sha512-Wg4TMAfQRL9J9AZevJ/ZNy3uyyDztDYQtGr4P8UyyzIhLhFrdSmz1J/9JT+rv0fiCDLaFOBQnj3f3K3+a5PzDQ==} + '@oxfmt/binding-win32-x64-msvc@0.44.0': + resolution: {integrity: sha512-oj8aLkPJZppIM4CMQNsyir9ybM1Xw/CfGPTSsTnzpVGyljgfbdP0EVUlURiGM0BDrmw5psQ6ArmGCcUY/yABaQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] - '@oxlint/binding-android-arm-eabi@1.57.0': - resolution: {integrity: sha512-C7EiyfAJG4B70496eV543nKiq5cH0o/xIh/ufbjQz3SIvHhlDDsyn+mRFh+aW8KskTyUpyH2LGWL8p2oN6bl1A==} + '@oxlint/binding-android-arm-eabi@1.59.0': + resolution: {integrity: sha512-etYDw/UaEv936AQUd/CRMBVd+e+XuuU6wC+VzOv1STvsTyZenLChepLWqLtnyTTp4YMlM22ypzogDDwqYxv5cg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [android] - '@oxlint/binding-android-arm64@1.57.0': - resolution: {integrity: sha512-9i80AresjZ/FZf5xK8tKFbhQnijD4s1eOZw6/FHUwD59HEZbVLRc2C88ADYJfLZrF5XofWDiRX/Ja9KefCLy7w==} + '@oxlint/binding-android-arm64@1.59.0': + resolution: {integrity: sha512-TgLc7XVLKH2a4h8j3vn1MDjfK33i9MY60f/bKhRGWyVzbk5LCZ4X01VZG7iHrMmi5vYbAp8//Ponigx03CLsdw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] - '@oxlint/binding-darwin-arm64@1.57.0': - resolution: {integrity: sha512-0eUfhRz5L2yKa9I8k3qpyl37XK3oBS5BvrgdVIx599WZK63P8sMbg+0s4IuxmIiZuBK68Ek+Z+gcKgeYf0otsg==} + '@oxlint/binding-darwin-arm64@1.59.0': + resolution: {integrity: sha512-DXyFPf5ZKldMLloRHx/B9fsxsiTQomaw7cmEW3YIJko2HgCh+GUhp9gGYwHrqlLJPsEe3dYj9JebjX92D3j3AA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] - '@oxlint/binding-darwin-x64@1.57.0': - resolution: {integrity: sha512-UvrSuzBaYOue+QMAcuDITe0k/Vhj6KZGjfnI6x+NkxBTke/VoM7ZisaxgNY0LWuBkTnd1OmeQfEQdQ48fRjkQg==} + '@oxlint/binding-darwin-x64@1.59.0': + resolution: {integrity: sha512-LgvrsdgVLX1qWqIEmNsSmMXJhpAWdtUQ0M+oR0CySwi+9IHWyOGuIL8w8+u/kbZNMyZr4WUyYB5i0+D+AKgkLg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] - '@oxlint/binding-freebsd-x64@1.57.0': - resolution: {integrity: sha512-wtQq0dCoiw4bUwlsNVDJJ3pxJA218fOezpgtLKrbQqUtQJcM9yP8z+I9fu14aHg0uyAxIY+99toL6uBa2r7nxA==} + '@oxlint/binding-freebsd-x64@1.59.0': + resolution: {integrity: sha512-bOJhqX/ny4hrFuTPlyk8foSRx/vLRpxJh0jOOKN2NWW6FScXHPAA5rQbrwdQPcgGB5V8Ua51RS03fke8ssBcug==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] - '@oxlint/binding-linux-arm-gnueabihf@1.57.0': - resolution: {integrity: sha512-qxFWl2BBBFcT4djKa+OtMdnLgoHEJXpqjyGwz8OhW35ImoCwR5qtAGqApNYce5260FQqoAHW8S8eZTjiX67Tsg==} + '@oxlint/binding-linux-arm-gnueabihf@1.59.0': + resolution: {integrity: sha512-vVUXxYMF9trXCsz4m9H6U0IjehosVHxBzVgJUxly1uz4W1PdDyicaBnpC0KRXsHYretLVe+uS9pJy8iM57Kujw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxlint/binding-linux-arm-musleabihf@1.57.0': - resolution: {integrity: sha512-SQoIsBU7J0bDW15/f0/RvxHfY3Y0+eB/caKBQtNFbuerTiA6JCYx9P1MrrFTwY2dTm/lMgTSgskvCEYk2AtG/Q==} + '@oxlint/binding-linux-arm-musleabihf@1.59.0': + resolution: {integrity: sha512-TULQW8YBPGRWg5yZpFPL54HLOnJ3/HiX6VenDPi6YfxB/jlItwSMFh3/hCeSNbh+DAMaE1Py0j5MOaivHkI/9Q==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] - '@oxlint/binding-linux-arm64-gnu@1.57.0': - resolution: {integrity: sha512-jqxYd1W6WMeozsCmqe9Rzbu3SRrGTyGDAipRlRggetyYbUksJqJKvUNTQtZR/KFoJPb+grnSm5SHhdWrywv3RQ==} + '@oxlint/binding-linux-arm64-gnu@1.59.0': + resolution: {integrity: sha512-Gt54Y4eqSgYJ90xipm24xeyaPV854706o/kiT8oZvUt3VDY7qqxdqyGqchMaujd87ib+/MXvnl9WkK8Cc1BExg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - '@oxlint/binding-linux-arm64-musl@1.57.0': - resolution: {integrity: sha512-i66WyEPVEvq9bxRUCJ/MP5EBfnTDN3nhwEdFZFTO5MmLLvzngfWEG3NSdXQzTT3vk5B9i6C2XSIYBh+aG6uqyg==} + '@oxlint/binding-linux-arm64-musl@1.59.0': + resolution: {integrity: sha512-3CtsKp7NFB3OfqQzbuAecrY7GIZeiv7AD+xutU4tefVQzlfmTI7/ygWLrvkzsDEjTlMq41rYHxgsn6Yh8tybmA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - '@oxlint/binding-linux-ppc64-gnu@1.57.0': - resolution: {integrity: sha512-oMZDCwz4NobclZU3pH+V1/upVlJZiZvne4jQP+zhJwt+lmio4XXr4qG47CehvrW1Lx2YZiIHuxM2D4YpkG3KVA==} + '@oxlint/binding-linux-ppc64-gnu@1.59.0': + resolution: {integrity: sha512-K0diOpT3ncDmOfl9I1HuvpEsAuTxkts0VYwIv/w6Xiy9CdwyPBVX88Ga9l8VlGgMrwBMnSY4xIvVlVY/fkQk7Q==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] - '@oxlint/binding-linux-riscv64-gnu@1.57.0': - resolution: {integrity: sha512-uoBnjJ3MMEBbfnWC1jSFr7/nSCkcQYa72NYoNtLl1imshDnWSolYCjzb8LVCwYCCfLJXD+0gBLD7fyC14c0+0g==} + '@oxlint/binding-linux-riscv64-gnu@1.59.0': + resolution: {integrity: sha512-xAU7+QDU6kTJJ7mJLOGgo7oOjtAtkKyFZ0Yjdb5cEo3DiCCPFLvyr08rWiQh6evZ7RiUTf+o65NY/bqttzJiQQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] - '@oxlint/binding-linux-riscv64-musl@1.57.0': - resolution: {integrity: sha512-BdrwD7haPZ8a9KrZhKJRSj6jwCor+Z8tHFZ3PT89Y3Jq5v3LfMfEePeAmD0LOTWpiTmzSzdmyw9ijneapiVHKQ==} + '@oxlint/binding-linux-riscv64-musl@1.59.0': + resolution: {integrity: sha512-KUmZmKlTTyauOnvUNVxK7G40sSSx0+w5l1UhaGsC6KPpOYHenx2oqJTnabmpLJicok7IC+3Y6fXAUOMyexaeJQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] - '@oxlint/binding-linux-s390x-gnu@1.57.0': - resolution: {integrity: sha512-BNs+7ZNsRstVg2tpNxAXfMX/Iv5oZh204dVyb8Z37+/gCh+yZqNTlg6YwCLIMPSk5wLWIGOaQjT0GUOahKYImw==} + '@oxlint/binding-linux-s390x-gnu@1.59.0': + resolution: {integrity: sha512-4usRxC8gS0PGdkHnRmwJt/4zrQNZyk6vL0trCxwZSsAKM+OxhB8nKiR+mhjdBbl8lbMh2gc3bZpNN/ik8c4c2A==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] - '@oxlint/binding-linux-x64-gnu@1.57.0': - resolution: {integrity: sha512-AghS18w+XcENcAX0+BQGLiqjpqpaxKJa4cWWP0OWNLacs27vHBxu7TYkv9LUSGe5w8lOJHeMxcYfZNOAPqw2bg==} + '@oxlint/binding-linux-x64-gnu@1.59.0': + resolution: {integrity: sha512-s/rNE2gDmbwAOOP493xk2X7M8LZfI1LJFSSW1+yanz3vuQCFPiHkx4GY+O1HuLUDtkzGlhtMrIcxxzyYLv308w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - '@oxlint/binding-linux-x64-musl@1.57.0': - resolution: {integrity: sha512-E/FV3GB8phu/Rpkhz5T96hAiJlGzn91qX5yj5gU754P5cmVGXY1Jw/VSjDSlZBCY3VHjsVLdzgdkJaomEmcNOg==} + '@oxlint/binding-linux-x64-musl@1.59.0': + resolution: {integrity: sha512-+yYj1udJa2UvvIUmEm0IcKgc0UlPMgz0nsSTvkPL2y6n0uU5LgIHSwVu4AHhrve6j9BpVSoRksnz8c9QcvITJA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - '@oxlint/binding-openharmony-arm64@1.57.0': - resolution: {integrity: sha512-xvZ2yZt0nUVfU14iuGv3V25jpr9pov5N0Wr28RXnHFxHCRxNDMtYPHV61gGLhN9IlXM96gI4pyYpLSJC5ClLCQ==} + '@oxlint/binding-openharmony-arm64@1.59.0': + resolution: {integrity: sha512-bUplUb48LYsB3hHlQXP2ZMOenpieWoOyppLAnnAhuPag3MGPnt+7caxE3w/Vl9wpQsTA3gzLntQi9rxWrs7Xqg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] - '@oxlint/binding-win32-arm64-msvc@1.57.0': - resolution: {integrity: sha512-Z4D8Pd0AyHBKeazhdIXeUUy5sIS3Mo0veOlzlDECg6PhRRKgEsBJCCV1n+keUZtQ04OP+i7+itS3kOykUyNhDg==} + '@oxlint/binding-win32-arm64-msvc@1.59.0': + resolution: {integrity: sha512-/HLsLuz42rWl7h7ePdmMTpHm2HIDmPtcEMYgm5BBEHiEiuNOrzMaUpd2z7UnNni5LGN9obJy2YoAYBLXQwazrA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] - '@oxlint/binding-win32-ia32-msvc@1.57.0': - resolution: {integrity: sha512-StOZ9nFMVKvevicbQfql6Pouu9pgbeQnu60Fvhz2S6yfMaii+wnueLnqQ5I1JPgNF0Syew4voBlAaHD13wH6tw==} + '@oxlint/binding-win32-ia32-msvc@1.59.0': + resolution: {integrity: sha512-rUPy+JnanpPwV/aJCPnxAD1fW50+XPI0VkWr7f0vEbqcdsS8NpB24Rw6RsS7SdpFv8Dw+8ugCwao5nCFbqOUSg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ia32] os: [win32] - '@oxlint/binding-win32-x64-msvc@1.57.0': - resolution: {integrity: sha512-6PuxhYgth8TuW0+ABPOIkGdBYw+qYGxgIdXPHSVpiCDm+hqTTWCmC739St1Xni0DJBt8HnSHTG67i1y6gr8qrA==} + '@oxlint/binding-win32-x64-msvc@1.59.0': + resolution: {integrity: sha512-xkE7puteDS/vUyRngLXW0t8WgdWoS/tfxXjhP/P7SMqPDx+hs44SpssO3h3qmTqECYEuXBUPzcAw5257Ka+ofA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] @@ -4034,17 +4034,17 @@ packages: outdent@0.5.0: resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==} - oxfmt@0.42.0: - resolution: {integrity: sha512-QhejGErLSMReNuZ6vxgFHDyGoPbjTRNi6uGHjy0cvIjOQFqD6xmr/T+3L41ixR3NIgzcNiJ6ylQKpvShTgDfqg==} + oxfmt@0.44.0: + resolution: {integrity: sha512-lnncqvHewyRvaqdrnntVIrZV2tEddz8lbvPsQzG/zlkfvgZkwy0HP1p/2u1aCDToeg1jb9zBpbJdfkV73Itw+w==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true - oxlint@1.57.0: - resolution: {integrity: sha512-DGFsuBX5MFZX9yiDdtKjTrYPq45CZ8Fft6qCltJITYZxfwYjVdGf/6wycGYTACloauwIPxUnYhBVeZbHvleGhw==} + oxlint@1.59.0: + resolution: {integrity: sha512-0xBLeGGjP4vD9pygRo8iuOkOzEU1MqOnfiOl7KYezL/QvWL8NUg6n03zXc7ZVqltiOpUxBk2zgHI3PnRIEdAvw==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true peerDependencies: - oxlint-tsgolint: '>=0.15.0' + oxlint-tsgolint: '>=0.18.0' peerDependenciesMeta: oxlint-tsgolint: optional: true @@ -5726,118 +5726,118 @@ snapshots: '@oxc-project/types@0.122.0': {} - '@oxfmt/binding-android-arm-eabi@0.42.0': + '@oxfmt/binding-android-arm-eabi@0.44.0': optional: true - '@oxfmt/binding-android-arm64@0.42.0': + '@oxfmt/binding-android-arm64@0.44.0': optional: true - '@oxfmt/binding-darwin-arm64@0.42.0': + '@oxfmt/binding-darwin-arm64@0.44.0': optional: true - '@oxfmt/binding-darwin-x64@0.42.0': + '@oxfmt/binding-darwin-x64@0.44.0': optional: true - '@oxfmt/binding-freebsd-x64@0.42.0': + '@oxfmt/binding-freebsd-x64@0.44.0': optional: true - '@oxfmt/binding-linux-arm-gnueabihf@0.42.0': + '@oxfmt/binding-linux-arm-gnueabihf@0.44.0': optional: true - '@oxfmt/binding-linux-arm-musleabihf@0.42.0': + '@oxfmt/binding-linux-arm-musleabihf@0.44.0': optional: true - '@oxfmt/binding-linux-arm64-gnu@0.42.0': + '@oxfmt/binding-linux-arm64-gnu@0.44.0': optional: true - '@oxfmt/binding-linux-arm64-musl@0.42.0': + '@oxfmt/binding-linux-arm64-musl@0.44.0': optional: true - '@oxfmt/binding-linux-ppc64-gnu@0.42.0': + '@oxfmt/binding-linux-ppc64-gnu@0.44.0': optional: true - '@oxfmt/binding-linux-riscv64-gnu@0.42.0': + '@oxfmt/binding-linux-riscv64-gnu@0.44.0': optional: true - '@oxfmt/binding-linux-riscv64-musl@0.42.0': + '@oxfmt/binding-linux-riscv64-musl@0.44.0': optional: true - '@oxfmt/binding-linux-s390x-gnu@0.42.0': + '@oxfmt/binding-linux-s390x-gnu@0.44.0': optional: true - '@oxfmt/binding-linux-x64-gnu@0.42.0': + '@oxfmt/binding-linux-x64-gnu@0.44.0': optional: true - '@oxfmt/binding-linux-x64-musl@0.42.0': + '@oxfmt/binding-linux-x64-musl@0.44.0': optional: true - '@oxfmt/binding-openharmony-arm64@0.42.0': + '@oxfmt/binding-openharmony-arm64@0.44.0': optional: true - '@oxfmt/binding-win32-arm64-msvc@0.42.0': + '@oxfmt/binding-win32-arm64-msvc@0.44.0': optional: true - '@oxfmt/binding-win32-ia32-msvc@0.42.0': + '@oxfmt/binding-win32-ia32-msvc@0.44.0': optional: true - '@oxfmt/binding-win32-x64-msvc@0.42.0': + '@oxfmt/binding-win32-x64-msvc@0.44.0': optional: true - '@oxlint/binding-android-arm-eabi@1.57.0': + '@oxlint/binding-android-arm-eabi@1.59.0': optional: true - '@oxlint/binding-android-arm64@1.57.0': + '@oxlint/binding-android-arm64@1.59.0': optional: true - '@oxlint/binding-darwin-arm64@1.57.0': + '@oxlint/binding-darwin-arm64@1.59.0': optional: true - '@oxlint/binding-darwin-x64@1.57.0': + '@oxlint/binding-darwin-x64@1.59.0': optional: true - '@oxlint/binding-freebsd-x64@1.57.0': + '@oxlint/binding-freebsd-x64@1.59.0': optional: true - '@oxlint/binding-linux-arm-gnueabihf@1.57.0': + '@oxlint/binding-linux-arm-gnueabihf@1.59.0': optional: true - '@oxlint/binding-linux-arm-musleabihf@1.57.0': + '@oxlint/binding-linux-arm-musleabihf@1.59.0': optional: true - '@oxlint/binding-linux-arm64-gnu@1.57.0': + '@oxlint/binding-linux-arm64-gnu@1.59.0': optional: true - '@oxlint/binding-linux-arm64-musl@1.57.0': + '@oxlint/binding-linux-arm64-musl@1.59.0': optional: true - '@oxlint/binding-linux-ppc64-gnu@1.57.0': + '@oxlint/binding-linux-ppc64-gnu@1.59.0': optional: true - '@oxlint/binding-linux-riscv64-gnu@1.57.0': + '@oxlint/binding-linux-riscv64-gnu@1.59.0': optional: true - '@oxlint/binding-linux-riscv64-musl@1.57.0': + '@oxlint/binding-linux-riscv64-musl@1.59.0': optional: true - '@oxlint/binding-linux-s390x-gnu@1.57.0': + '@oxlint/binding-linux-s390x-gnu@1.59.0': optional: true - '@oxlint/binding-linux-x64-gnu@1.57.0': + '@oxlint/binding-linux-x64-gnu@1.59.0': optional: true - '@oxlint/binding-linux-x64-musl@1.57.0': + '@oxlint/binding-linux-x64-musl@1.59.0': optional: true - '@oxlint/binding-openharmony-arm64@1.57.0': + '@oxlint/binding-openharmony-arm64@1.59.0': optional: true - '@oxlint/binding-win32-arm64-msvc@1.57.0': + '@oxlint/binding-win32-arm64-msvc@1.59.0': optional: true - '@oxlint/binding-win32-ia32-msvc@1.57.0': + '@oxlint/binding-win32-ia32-msvc@1.59.0': optional: true - '@oxlint/binding-win32-x64-msvc@1.57.0': + '@oxlint/binding-win32-x64-msvc@1.59.0': optional: true '@pinojs/redact@0.4.0': {} @@ -9545,51 +9545,51 @@ snapshots: outdent@0.5.0: {} - oxfmt@0.42.0: + oxfmt@0.44.0: dependencies: tinypool: 2.1.0 optionalDependencies: - '@oxfmt/binding-android-arm-eabi': 0.42.0 - '@oxfmt/binding-android-arm64': 0.42.0 - '@oxfmt/binding-darwin-arm64': 0.42.0 - '@oxfmt/binding-darwin-x64': 0.42.0 - '@oxfmt/binding-freebsd-x64': 0.42.0 - '@oxfmt/binding-linux-arm-gnueabihf': 0.42.0 - '@oxfmt/binding-linux-arm-musleabihf': 0.42.0 - '@oxfmt/binding-linux-arm64-gnu': 0.42.0 - '@oxfmt/binding-linux-arm64-musl': 0.42.0 - '@oxfmt/binding-linux-ppc64-gnu': 0.42.0 - '@oxfmt/binding-linux-riscv64-gnu': 0.42.0 - '@oxfmt/binding-linux-riscv64-musl': 0.42.0 - '@oxfmt/binding-linux-s390x-gnu': 0.42.0 - '@oxfmt/binding-linux-x64-gnu': 0.42.0 - '@oxfmt/binding-linux-x64-musl': 0.42.0 - '@oxfmt/binding-openharmony-arm64': 0.42.0 - '@oxfmt/binding-win32-arm64-msvc': 0.42.0 - '@oxfmt/binding-win32-ia32-msvc': 0.42.0 - '@oxfmt/binding-win32-x64-msvc': 0.42.0 - - oxlint@1.57.0: + '@oxfmt/binding-android-arm-eabi': 0.44.0 + '@oxfmt/binding-android-arm64': 0.44.0 + '@oxfmt/binding-darwin-arm64': 0.44.0 + '@oxfmt/binding-darwin-x64': 0.44.0 + '@oxfmt/binding-freebsd-x64': 0.44.0 + '@oxfmt/binding-linux-arm-gnueabihf': 0.44.0 + '@oxfmt/binding-linux-arm-musleabihf': 0.44.0 + '@oxfmt/binding-linux-arm64-gnu': 0.44.0 + '@oxfmt/binding-linux-arm64-musl': 0.44.0 + '@oxfmt/binding-linux-ppc64-gnu': 0.44.0 + '@oxfmt/binding-linux-riscv64-gnu': 0.44.0 + '@oxfmt/binding-linux-riscv64-musl': 0.44.0 + '@oxfmt/binding-linux-s390x-gnu': 0.44.0 + '@oxfmt/binding-linux-x64-gnu': 0.44.0 + '@oxfmt/binding-linux-x64-musl': 0.44.0 + '@oxfmt/binding-openharmony-arm64': 0.44.0 + '@oxfmt/binding-win32-arm64-msvc': 0.44.0 + '@oxfmt/binding-win32-ia32-msvc': 0.44.0 + '@oxfmt/binding-win32-x64-msvc': 0.44.0 + + oxlint@1.59.0: optionalDependencies: - '@oxlint/binding-android-arm-eabi': 1.57.0 - '@oxlint/binding-android-arm64': 1.57.0 - '@oxlint/binding-darwin-arm64': 1.57.0 - '@oxlint/binding-darwin-x64': 1.57.0 - '@oxlint/binding-freebsd-x64': 1.57.0 - '@oxlint/binding-linux-arm-gnueabihf': 1.57.0 - '@oxlint/binding-linux-arm-musleabihf': 1.57.0 - '@oxlint/binding-linux-arm64-gnu': 1.57.0 - '@oxlint/binding-linux-arm64-musl': 1.57.0 - '@oxlint/binding-linux-ppc64-gnu': 1.57.0 - '@oxlint/binding-linux-riscv64-gnu': 1.57.0 - '@oxlint/binding-linux-riscv64-musl': 1.57.0 - '@oxlint/binding-linux-s390x-gnu': 1.57.0 - '@oxlint/binding-linux-x64-gnu': 1.57.0 - '@oxlint/binding-linux-x64-musl': 1.57.0 - '@oxlint/binding-openharmony-arm64': 1.57.0 - '@oxlint/binding-win32-arm64-msvc': 1.57.0 - '@oxlint/binding-win32-ia32-msvc': 1.57.0 - '@oxlint/binding-win32-x64-msvc': 1.57.0 + '@oxlint/binding-android-arm-eabi': 1.59.0 + '@oxlint/binding-android-arm64': 1.59.0 + '@oxlint/binding-darwin-arm64': 1.59.0 + '@oxlint/binding-darwin-x64': 1.59.0 + '@oxlint/binding-freebsd-x64': 1.59.0 + '@oxlint/binding-linux-arm-gnueabihf': 1.59.0 + '@oxlint/binding-linux-arm-musleabihf': 1.59.0 + '@oxlint/binding-linux-arm64-gnu': 1.59.0 + '@oxlint/binding-linux-arm64-musl': 1.59.0 + '@oxlint/binding-linux-ppc64-gnu': 1.59.0 + '@oxlint/binding-linux-riscv64-gnu': 1.59.0 + '@oxlint/binding-linux-riscv64-musl': 1.59.0 + '@oxlint/binding-linux-s390x-gnu': 1.59.0 + '@oxlint/binding-linux-x64-gnu': 1.59.0 + '@oxlint/binding-linux-x64-musl': 1.59.0 + '@oxlint/binding-openharmony-arm64': 1.59.0 + '@oxlint/binding-win32-arm64-msvc': 1.59.0 + '@oxlint/binding-win32-ia32-msvc': 1.59.0 + '@oxlint/binding-win32-x64-msvc': 1.59.0 p-filter@2.1.0: dependencies: