You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 542a51c
Browse filesBrowse the repository at this point in the historyBrowse files
fix(hook): migrate opencode hook to session.status; ship .opencode/package.json baseline
opencode v1.15.x silently broke sessions for users with our installed plugin
and tool-override files. Two upstream changes are at play:
- session.idle was deprecated (anomalyco/opencode bdfa213c, 2025-11-17)
in favor of session.status with status.type === "idle". The
deprecated event still fires today, but listening only for it is a
walking time bomb.
- When .opencode/tools/*.ts imports from @opencode-ai/plugin, opencode
runs bun install against .opencode/ at startup. Without a baseline
package.json, arborist can write "@opencode-ai/plugin": "local"
(the dev-build sentinel), which then fails to resolve and the entire
session goes unresponsive — every prompt silently dies with
ERR_MODULE_NOT_FOUND. See anomalyco/opencode#28286.
This commit:
- Switches the generated plugin to listen for session.status + idle and
default-export a PluginModule { id, server } shape (the v1 loader
requires path plugins to carry an explicit id).
- Ships .opencode/package.json pinning @opencode-ai/plugin to "latest";
opencode's arborist will overwrite that on first install with a real
published version, pre-empting the @Local resolution failure.
- Extends HookTarget with support_files so the package.json lands
transparently alongside the plugin, including for users upgrading from
a trie release where their plugin file is already up to date.
Tests updated; new tests for the package.json baseline + idempotency.
Full suite: 526 passed, 1 skipped. Ruff clean.
Without this file, opencode runs `bun install` against the `.opencode/`
171
+
directory at startup and tries to add `@opencode-ai/plugin` with a version
172
+
derived from the running opencode build. For dev/source builds (or any
173
+
stale state where the version resolves to `"local"`), bun writes
174
+
`"@opencode-ai/plugin": "local"` into the generated package.json, the next
175
+
install fails ("No matching version found for @opencode-ai/plugin@local"),
176
+
and every `.opencode/tools/*.ts` import that pulls from `@opencode-ai/plugin`
177
+
dies with ERR_MODULE_NOT_FOUND. The user-visible symptom is that opencode
178
+
sessions become silently unresponsive (see anomalyco/opencode#28286 and
179
+
#27676).
180
+
181
+
Shipping a known-good baseline pinned to `"latest"` pre-empts opencode's
182
+
broken auto-pin: arborist will overwrite our `"latest"` with the running
183
+
opencode version, which is a real published version and resolves cleanly.
184
+
185
+
We declare it as a `dependencies` entry (not `peerDependencies`) so bun's
186
+
arborist treats it as the canonical install target.
187
+
"""
188
+
return"""{
189
+
"//": "Auto-generated by `trie setup`. Do not hand-edit — opencode rewrites this on every startup. The pin pre-empts the @opencode-ai/plugin@local resolution failure that silently kills tool overrides; see https://github.com/anomalyco/opencode/issues/28286.",
0 commit comments