Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: v2 still unloadable via npm spec on OpenCode 2.0.32 — ./v2 subpath not usable as a plugin spec; ship v2 as root default export

未关闭
#85 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
bun, typescript
领域
cli, devtools

调研方向

Start by reading package.json and the v2 entry point at dist/src/v2/index.js; compare their exports with the plugin loader error quoted in the issue. Check how the package root and v2 export are configured, then verify that the published root entry provides the v2 definition OpenCode expects while retaining the named v1 export if needed. Done means the issue's root plugin spec, "opencode-pty", loads on OpenCode 2 without a shim.

由索引模型根据 Issue 内容生成。

描述

Summary

On OpenCode 2.0.32 (macOS arm64), [email protected] still fails to load as an npm plugin. This adds two things #67 and #83 don't cover yet:

  1. The ./v2 subpath can't be used as a plugin spec. The README's V2 example is "plugins": ["opencode-pty/v2"], and OpenCode 2 parses that string as a package name rather than a subpath export. The only way left is a local shim file. I couldn't get one stable here: with a partial dependency tree, the plugin activation step hung (Location plugins did not finish activating) and blocked every command. I can't say whether that's the shim's fault or the adapter's.
  2. What would fix it: publish with the v2 definition as the package's root default export, i.e. export default define({ id, setup }) from dist/index.js. You could keep the named PTYPlugin export for v1 hosts, or gate on the host version. With that, "plugins": ["opencode-pty"] loads on v2 with no shim.

Evidence

  • package.json main: dist/index.js exports only the named PTYPlugin. exports["./v2"] points to dist/src/v2/index.js, which does contain define({ id, setup }).
  • Load error (from ~/.local/share/opencode/log/opencode.log): Plugin must export a default definition with an id and an effect or setup function.
  • npm latest is still 0.4.0, published 2026-09-18.

Related

  • #67, #83: same load failure. This issue adds the subpath-spec detail and a concrete export fix.
  • #80: once v2 loads, the adapter should also wire the permission authorizer, so that permission.bash deny/ask covers the pty tools.
主要语言
TypeScript
星标
601
派生
66
平均合并
4 天 9 小时
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

shekohex/opencode-pty 的其他 Issue

查看 shekohex/opencode-pty 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。