Repository navigation
Conversation
The `.` entrypoint exported only named symbols — no default at all — so the V2 loader's bare-ref resolution schema-failed with `Missing key at ["default"]` (shekohex#67). The documented `opencode-pty/v2` subpath ref cannot install either (the V2 loader parses subpath refs as npm install specs), leaving no published-package path to load the plugin on V2. Add the dual-mode default export (the pattern opencode-mem shipped in 2.27.0 via PR #311): `{ id, server, setup }` — V1 (>= 1.18.29) calls `server()`, V2 calls `setup()`. The `./v2` subpath export stays for direct-import consumers. Correct the README's V2 example, which used the V1 `plugin` field (silently ignored by V2) and recommended the un-installable subpath ref. Refs shekohex#67.
|
Independent verification on 2.0.28 (third-party, isolated, non-destructive) I reproduced this PR's fix and also checked the two things the PR description doesn't Setup
Reproduced with Beyond the PR description: tools + a real PTYThe PR verifies "plugin listed by the server, zero plugin-load failures". Loading a
Host-side confirmation that One gap to note: there is no resize surface to test. CI on this PR has not run
Since the workflow couldn't run, I ran the CI matrix locally in the workflow's own order
(main at One thing worth flagging for the release
That is why the middle row above still shows zero pty commands: fixing the entrypoint So the sequence that actually unblocks V2 users looks like: approve this PR's CI run → merge ReproducingAll of the above is scripted and read-only:
Happy to share the scripts/logs or re-run against a newer build if useful. |
Problem
Refs #67 — the plugin cannot be loaded on OpenCode V2 from its published package. There are two independent gaps:
opencode-pty/v2subpath ref cannot install — the V2 loader parses subpath refs as npm install specs (NpmInstallFailedError). Loader-side; not fixable in this repo..entrypoint (dist/index.js) exports only named symbols (PTYPlugin,server) and no default export at all, so the loader's bare-ref resolution fails validation:PluginModule.LoadError: Plugin must export a default definition with an id and an effect or setup function (cause: SchemaError(Missing key at ["default"])).Since the loader resolves a bare npm ref to the
.export (falling back todist/index.js), gap 2 is fixable plugin-side — and fixing it also makes the subpath unnecessary.Fix
Make the
.entrypoint a dual-mode default export — the same patternopencode-memshipped in 2.27.0 (tickernelz/opencode-mem PR #311), which is published and verified working on V2:./v2subpath export is unchanged (stays valid for direct-import consumers).serverare supported since 1.18.29.pluginfield (silently ignored by V2 — a V1-shaped array produces zero plugin loads) and recommended the un-installable subpath ref. Now documents the bare ref + thepluginsobject form, with notes on both failure modes.Verification
bun run build:plugin+bun run typecheck+biome lint/formatclean.test/dual-mode-default.test.ts) pins the default shape (id,server,setup) and the named V2 re-export.dist/index.jsfrom the package cache):SchemaError(Missing key at ["default"])— plugin fails to load.🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com