Repository navigation
fix: support OpenCode v2 plugin lifecycle - #152
Merged
Merged
Conversation
Export one shared definition for OpenCode v2 setup and v1.18.29+ server hooks. Inject recall into model-facing content, reuse it per session and user turn across tool continuations, and bound cached state and subprocess work. Resolve npm installations to their native executable so forced timeouts reap the memory command, including Windows installs. Validated go build, make test, focused plugin runtime and timeout tests, and 258 CLI E2E checks. Official OpenCode 2.0.18 and 1.18.29 runs against an isolated local model fixture verify plugin loading, recall, shell environment, and v2 compaction without paid providers. Document the supported versions and required setup refresh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenCode 2 rejects the installed Mnemon plugin's V1-only named export, so conversations continue without recall, shell environment setup, or compaction guidance. Export one
{ id, setup, server }definition:setupuses the V2 hook contracts, whileserverkeeps compatibility with OpenCode 1.18.29 and newer.Closes #150.
Recall is attached to the latest user message on every outgoing model request. Fresh tool-continuation copies reuse the current turn's recall; session isolation, a bounded cache, and unload cleanup prevent stale or repeated injection. CLI execution uses argument arrays and a hard timeout, resolving standard npm installs to their native executable so a timed-out launcher cannot leave its child running. The setup notes explain the supported versions and how to refresh existing installations.
Verified against real OpenCode 2.0.18 processes with the original and fixed templates installed by
mnemon setup, an isolated synthetic store, and a local deterministic provider:MNEMON_OPENCODE=1Validation:
go build -o mnemon .andmake testpass.go test ./test/memory/opencode -v -count=1passes, including real SIGTERM-ignoring child processes for direct and npm installation paths.The callback and process regressions remain in the explicit integration tier. Actual host runs used macOS arm64; Windows command resolution is covered by mocked path fixtures. All model traffic uses the local fixture; no paid provider is required. The older V1 loader support floor is documented as 1.18.29.