diff --git a/README.md b/README.md index 03a8ecd..c48e2f4 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ What you get: - optional implementation-agent handoff after approval Restart OpenCode after installing or updating so it reloads the package-managed runtime. -OpenCode 1.x and 2.x are both supported. +OpenCode 2.x and OpenCode 1.18.29 or later are both supported. ### Pi diff --git a/opencode/index.js b/opencode/index.js index 6dbebb6..42136d5 100644 --- a/opencode/index.js +++ b/opencode/index.js @@ -403,4 +403,7 @@ export const OpenPlanAnnotatorPlugin = async (ctx) => { }; }; -export default OpenPlanAnnotatorPlugin; +export default { + ...OpenPlanAnnotatorPluginV2, + server: OpenPlanAnnotatorPlugin, +}; diff --git a/opencode/index.test.ts b/opencode/index.test.ts index abe4da4..82ec5e1 100644 --- a/opencode/index.test.ts +++ b/opencode/index.test.ts @@ -72,12 +72,14 @@ describe("annotate_plan tool output (V2)", () => { } }); - test("legacy entrypoint retains the V1 plugin function", async () => { + test("package default supports both V2 setup and V1 server entrypoints", async () => { const mod = await loadPluginWithBridge(async () => ({ approved: true }), "v1-shape"); - expect(typeof mod.default).toBe("function"); - expect(mod.OpenPlanAnnotatorPlugin).toBe(mod.default); + expect(typeof mod.default).toBe("object"); + expect(mod.default.id).toBe("open-plan-annotator"); + expect(mod.default.setup).toBe(mod.OpenPlanAnnotatorPluginV2.setup); + expect(mod.default.server).toBe(mod.OpenPlanAnnotatorPlugin); - const plugin = await mod.default({ + const plugin = await mod.default.server({ directory: process.cwd(), client: { session: {