Skip to content

feat(opencode): report from opencode 2 through the module's default export - #98

Merged
omartelo merged 1 commit into
mainfrom
feat/opencode-2
Nov 1, 2026
Merged

omartelo merged 1 commit into
mainfrom
feat/opencode-2

Conversation

@omartelo

@omartelo omartelo commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

opencode 2 loads plugins through a new door and renamed every event the card reads, so under it an opencode card had no spinner, ring, bell or title. opencode/lich.js now serves both generations from one file:

  • opencode 1 keeps running the named LichPlugin, now also reached through the default export's server(). 1.18.23 and 1.19.4 initialize it once per run with both exports present.
  • opencode 2 reads the default export's id and setup(ctx). The reports ride session.execution.started (session start, then busy), session.execution.succeeded, failed and interrupted (done), session.renamed (title), permission.asked (waiting, reason = action), ctx.tool.hook("execute.before") (tool line) and write, edit and patch finishing (touched).
  • No opencode 2 event carries a parent, so a sub-session is looked up once with ctx.session.get and dropped when it has a parentID.
  • opencode 1 also calls setup(), with a context that has neither event nor session; the 2.x half stands down there, and outside lich.

opencode 2 reads global plugins from ~/.config/opencode/plugins/ only. The companion lich change installs the module there and removes the copy an older lich left in plugin/ (lichdotdev/lich, feat/opencode-2).

No endpoint, field or accepted value changes: this is a patch release (0.20.9), inside the range every current lich installs.

Test plan

  • node --test tests/*.test.mjs: 481 pass, including the new tests/opencode2.test.mjs driven by event payloads taken off a probe plugin under opencode run --standalone 2.2.5.
  • Real opencode 1.18.23 and 1.19.4, module in plugins/ and in plugin/: LichPlugin initializes once per run, setup() returns without subscribing.
  • Real opencode 2.2.5: a default-exported plain object (no @opencode/plugin import) loads, sees the spawn's environment, and ctx.session.get returns parentID for a subagent child.

@omartelo
omartelo merged commit 760aaa8 into main Nov 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant