























@@ -13,37 +13,13 @@ import { patchPluginSessionExtension } from "../plugins/host-hook-state.js";
1313import { createEmptyPluginRegistry } from "../plugins/registry.js";
1414import { setActivePluginRegistry } from "../plugins/runtime.js";
1515import type { PluginHookRegistration } from "../plugins/types.js";
16-17-type ToolDefinitionAdapterModule = typeof import("./pi-tool-definition-adapter.js");
18-type PiToolsAbortModule = typeof import("./pi-tools.abort.js");
19-type BeforeToolCallModule = typeof import("./pi-tools.before-tool-call.js");
20-21-type ToClientToolDefinitions = ToolDefinitionAdapterModule["toClientToolDefinitions"];
22-type ToToolDefinitions = ToolDefinitionAdapterModule["toToolDefinitions"];
23-type WrapToolWithAbortSignal = PiToolsAbortModule["wrapToolWithAbortSignal"];
24-type BeforeToolCallTesting = BeforeToolCallModule["__testing"];
25-type ConsumeAdjustedParamsForToolCall = BeforeToolCallModule["consumeAdjustedParamsForToolCall"];
26-type WrapToolWithBeforeToolCallHook = BeforeToolCallModule["wrapToolWithBeforeToolCallHook"];
27-28-let toClientToolDefinitions!: ToClientToolDefinitions;
29-let toToolDefinitions!: ToToolDefinitions;
30-let wrapToolWithAbortSignal!: WrapToolWithAbortSignal;
31-let beforeToolCallTesting!: BeforeToolCallTesting;
32-let consumeAdjustedParamsForToolCall!: ConsumeAdjustedParamsForToolCall;
33-let wrapToolWithBeforeToolCallHook!: WrapToolWithBeforeToolCallHook;
34-35-beforeEach(async () => {
36-if (!wrapToolWithBeforeToolCallHook) {
37-({ toClientToolDefinitions, toToolDefinitions } =
38-await import("./pi-tool-definition-adapter.js"));
39-({ wrapToolWithAbortSignal } = await import("./pi-tools.abort.js"));
40-({
41-__testing: beforeToolCallTesting,
42- consumeAdjustedParamsForToolCall,
43- wrapToolWithBeforeToolCallHook,
44-} = await import("./pi-tools.before-tool-call.js"));
45-}
46-});
16+import { toClientToolDefinitions, toToolDefinitions } from "./pi-tool-definition-adapter.js";
17+import { wrapToolWithAbortSignal } from "./pi-tools.abort.js";
18+import {
19+__testing as beforeToolCallTesting,
20+consumeAdjustedParamsForToolCall,
21+wrapToolWithBeforeToolCallHook,
22+} from "./pi-tools.before-tool-call.js";
47234824type BeforeToolCallHandlerMock = ReturnType<typeof vi.fn>;
4925此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。