/** * Layer 1: Hook Merger Tests for before_agent_start * * Validates that modelOverride and providerOverride fields are correctly * propagated through the hook merger, including priority ordering and * backward compatibility.
*/ import { beforeEach, describe, expect, it } from "vitest"; import { createHookRunner } from "./hooks.js"; import { addStaticTestHooks, addTestHook, TEST_PLUGIN_AGENT_CTX } from "./hooks.test-helpers.js"; import { createEmptyPluginRegistry, type PluginRegistry } from "./registry.js"; import type { PluginHookBeforeAgentStartResult, PluginHookRegistration } from "./types.js";
it("lower-priority plugin does not overwrite if it returns undefined", async () => { const result = await runWithHooks([
{
pluginId: "high-priority",
result: { modelOverride: "llama3.3:8b", providerOverride: "ollama" },
priority: 10,
},
{
pluginId: "low-priority",
result: { prependContext: "some context" },
priority: 1,
},
]);
// High-priority ran first (priority 10), low-priority ran second (priority 1). // Low-priority didn't return modelOverride, so ?? falls back to acc's value.
expect(result?.modelOverride).toBe("llama3.3:8b");
expect(result?.providerOverride).toBe("ollama");
expect(result?.prependContext).toBe("some context");
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.