feat(FN-2263): merge fusion/fn-2263 (auto-resolved)
- docs(FN-2263): update README with scaffolded scope and deferral documentation - test(FN-2263): verify hermes runtime plugin build and tests - feat(FN-2263): implement plugin entrypoint with runtime registration shell - feat(FN-2263): scaffold Hermes runtime plugin package - test(FN-2256): add mocks for createResolvedAgentSession in tests - docs(FN-2256): update architecture docs and add changeset - fix(FN-2256): fix lint errors and TypeScript issues - feat(FN-2256): add runtime selection regression tests — Step 4 - feat(FN-2256): route engine session creation through runtime resolver — Step 3 - feat(FN-2256): extend PluginRunner runtime lookup surface — Step 2 - feat(FN-2256): add runtime abstraction and resolver — Step 1
This commit is contained in:
@@ -822,98 +822,6 @@ describe("PluginRunner", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Paperclip runtime compatibility", () => {
|
||||
/**
|
||||
* Verify that the paperclip runtime registration from
|
||||
* plugins/fusion-plugin-paperclip-runtime is correctly resolvable
|
||||
* through the engine's runtime resolution system.
|
||||
*/
|
||||
|
||||
it("should resolve paperclip runtime when registered", () => {
|
||||
const paperclipRuntime = {
|
||||
metadata: {
|
||||
runtimeId: "paperclip",
|
||||
name: "Paperclip Runtime",
|
||||
description: "Paperclip-backed AI session using the user's configured pi provider and model",
|
||||
version: "1.0.0",
|
||||
},
|
||||
factory: vi.fn().mockResolvedValue({}),
|
||||
};
|
||||
mockPluginLoader.getPluginRuntimes.mockReturnValue([
|
||||
{ pluginId: "fusion-plugin-paperclip-runtime", runtime: paperclipRuntime as any },
|
||||
]);
|
||||
|
||||
const result = pluginRunner.getRuntimeById("paperclip");
|
||||
expect(result).toBeDefined();
|
||||
expect(result?.pluginId).toBe("fusion-plugin-paperclip-runtime");
|
||||
expect(result?.runtime.metadata.runtimeId).toBe("paperclip");
|
||||
expect(result?.runtime.metadata.name).toBe("Paperclip Runtime");
|
||||
expect(result?.runtime.metadata.description).toContain("Paperclip");
|
||||
expect(result?.runtime.metadata.version).toBe("1.0.0");
|
||||
});
|
||||
|
||||
it("should expose paperclip runtime metadata correctly", () => {
|
||||
const paperclipRuntime = {
|
||||
metadata: {
|
||||
runtimeId: "paperclip",
|
||||
name: "Paperclip Runtime",
|
||||
description: "Paperclip-backed AI session using the user's configured pi provider and model",
|
||||
version: "1.0.0",
|
||||
},
|
||||
factory: vi.fn().mockResolvedValue({}),
|
||||
};
|
||||
mockPluginLoader.getPluginRuntimes.mockReturnValue([
|
||||
{ pluginId: "fusion-plugin-paperclip-runtime", runtime: paperclipRuntime as any },
|
||||
]);
|
||||
|
||||
const runtimes = pluginRunner.getPluginRuntimes();
|
||||
const paperclip = runtimes.find(r => r.runtime.metadata.runtimeId === "paperclip");
|
||||
|
||||
expect(paperclip).toBeDefined();
|
||||
expect(paperclip?.runtime.metadata).toEqual({
|
||||
runtimeId: "paperclip",
|
||||
name: "Paperclip Runtime",
|
||||
description: "Paperclip-backed AI session using the user's configured pi provider and model",
|
||||
version: "1.0.0",
|
||||
});
|
||||
});
|
||||
|
||||
it("should allow factory invocation for paperclip runtime", async () => {
|
||||
const mockAdapter = {
|
||||
id: "paperclip",
|
||||
name: "Paperclip Runtime",
|
||||
createSession: vi.fn(),
|
||||
promptWithFallback: vi.fn(),
|
||||
describeModel: vi.fn(),
|
||||
dispose: vi.fn(),
|
||||
};
|
||||
const paperclipRuntime = {
|
||||
metadata: {
|
||||
runtimeId: "paperclip",
|
||||
name: "Paperclip Runtime",
|
||||
description: "Paperclip-backed AI session using the user's configured pi provider and model",
|
||||
version: "1.0.0",
|
||||
},
|
||||
factory: vi.fn().mockResolvedValue(mockAdapter),
|
||||
};
|
||||
mockPluginLoader.getPluginRuntimes.mockReturnValue([
|
||||
{ pluginId: "fusion-plugin-paperclip-runtime", runtime: paperclipRuntime as any },
|
||||
]);
|
||||
|
||||
const result = pluginRunner.getRuntimeById("paperclip");
|
||||
expect(result).toBeDefined();
|
||||
|
||||
// Invoke the factory (simulating runtime instantiation)
|
||||
const context = { pluginId: "fusion-plugin-paperclip-runtime" };
|
||||
const runtime = await result!.runtime.factory(context as any);
|
||||
|
||||
expect(paperclipRuntime.factory).toHaveBeenCalledWith(context);
|
||||
expect(runtime).toBe(mockAdapter);
|
||||
expect(runtime.id).toBe("paperclip");
|
||||
expect(runtime.name).toBe("Paperclip Runtime");
|
||||
});
|
||||
});
|
||||
|
||||
describe("getLoader() / getStore()", () => {
|
||||
it("should return the plugin loader", () => {
|
||||
const loader = pluginRunner.getLoader();
|
||||
|
||||
Reference in New Issue
Block a user