fix: resolve pi-tools typing regressions

This commit is contained in:
Peter Steinberger 2026-03-03 02:27:12 +00:00
parent 2380c1b5fd
commit 6ab9e00e17
2 changed files with 8 additions and 3 deletions

View File

@ -75,10 +75,14 @@ export function createPluginRuntimeMock(overrides: DeepPartial<PluginRuntime> =
chunkMarkdownTextWithMode: vi.fn((text: string) => (text ? [text] : [])),
chunkText: vi.fn((text: string) => (text ? [text] : [])),
chunkTextWithMode: vi.fn((text: string) => (text ? [text] : [])),
resolveChunkMode: vi.fn(() => "length"),
resolveChunkMode: vi.fn(
() => "length",
) as unknown as PluginRuntime["channel"]["text"]["resolveChunkMode"],
resolveTextChunkLimit: vi.fn(() => 4000),
hasControlCommand: vi.fn(() => false),
resolveMarkdownTableMode: vi.fn(() => "code"),
resolveMarkdownTableMode: vi.fn(
() => "code",
) as unknown as PluginRuntime["channel"]["text"]["resolveMarkdownTableMode"],
convertMarkdownTables: vi.fn((text: string) => text),
},
reply: {

View File

@ -6,6 +6,7 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import type { EditToolOptions } from "@mariozechner/pi-coding-agent";
import { afterEach, describe, expect, it, vi } from "vitest";
const mocks = vi.hoisted(() => ({
@ -16,7 +17,7 @@ vi.mock("@mariozechner/pi-coding-agent", async (importOriginal) => {
const actual = await importOriginal<typeof import("@mariozechner/pi-coding-agent")>();
return {
...actual,
createEditTool: (cwd: string, options?: { operations?: unknown }) => {
createEditTool: (cwd: string, options?: EditToolOptions) => {
const base = actual.createEditTool(cwd, options);
return {
...base,