refactor(core): extract shared dedup helpers

This commit is contained in:
Peter Steinberger
2026-03-07 10:40:49 +00:00
parent 14c61bb33f
commit 3c71e2bd48
114 changed files with 3400 additions and 2040 deletions

View File

@@ -1,7 +1,8 @@
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
/**
* Test: after_tool_call hook wiring (pi-embedded-subscribe.handlers.tools.ts)
*/
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { createBaseToolHandlerState } from "../agents/pi-tool-handler-state.test-helpers.js";
const hookMocks = vi.hoisted(() => ({
runner: {
@@ -38,17 +39,7 @@ function createToolHandlerCtx(params: {
},
state: {
toolMetaById: new Map<string, string | undefined>(),
toolMetas: [] as Array<{ toolName?: string; meta?: string }>,
toolSummaryById: new Set<string>(),
lastToolError: undefined,
pendingMessagingTexts: new Map<string, string>(),
pendingMessagingTargets: new Map<string, unknown>(),
pendingMessagingMediaUrls: new Map<string, string[]>(),
messagingToolSentTexts: [] as string[],
messagingToolSentTextsNormalized: [] as string[],
messagingToolSentMediaUrls: [] as string[],
messagingToolSentTargets: [] as unknown[],
blockBuffer: "",
...createBaseToolHandlerState(),
},
log: { debug: vi.fn(), warn: vi.fn() },
flushBlockReplyBuffer: vi.fn(),