refactor(plugin):Merge OpenCode plugins#1859
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
|
整体方向 +1,分层清晰,工具语义也设计得到位。merge 前几个 must-fix,后面是建议。 🔴 必修
🟡 强烈建议
💡 架构层面(不阻塞合并,可开 follow-up)读侧工具( |
Rename wrapper to .mjs, clean install docs, align README/INSTALL wording with the current directory layout, remove invalid README_ZH.md from package files, and pin @opencode-ai/plugin version.
79a6170 to
33f4ee7
Compare
ZaynJarvis
left a comment
There was a problem hiding this comment.
Nice work merging the split plugins into one unified package. Two suggestions:
-
Remove
autoStartServer— the plugin should only take an endpoint URL + API key. Decoupling from server lifecycle is cleaner and avoids the detached-process management problem (no PID tracking / no shutdown). -
Wrapper path assumption —
wrappers/openviking.mjsexports from"./openviking/index.mjs", which assumes the source-install directory layout. This will break when installed as an npm package. Consider adjusting or documenting the constraint.
Otherwise the architecture is solid — native OpenCode plugin API (event/tool/system.transform/messages.transform) is the right call over the shell-hook approach.
|
One more — the 10-minute auto-commit interval may not be the best trigger. Memories are already in the session context while the conversation is alive. Committing on a timer wastes cycles when context is intact. Consider committing only at context-loss boundaries (session end, compaction, context window pressure) instead of on a fixed interval. |
…to-start logic from the plugin runtime - Replace fixed-interval auto commits with lifecycle-boundary commits - Commit sessions on compaction, deletion, error, and plugin shutdown - Exclude source-install wrapper files from the npm package - Update docs to clarify wrapper usage and remove deprecated config fields
|
记忆召回应使用 chat.message 钩子替代 experimental.chat.messages.transform memory-recall.mjs 和 index.mjs 中的召回实现使用了 experimental.chat.messages.transform 注入 。这个钩子有一个问题:它没有状态——对消息的修改不会持久化到会话存储。每次 LLM API 调用(含工具调用续接)都会重新触发,导致每次注入的记忆集合可能不同。 问题示意: 后果:上下文不一致、前序记忆丢失、KV-cache 命中率极差、OpenViking API 重复调用。 解决方案:使用 chat.message + synthetic: true chat.message 钩子在用户消息创建时触发一次,修改 output.parts 会持久化到会话历史。synthetic: true 在 TUI 中不可见但对 LLM 作为 context 发送。 需改动 index.mjs: 需改动 memory-recall.mjs: 另外: OpenCode schema 要求 Part ID 必须以 参见 #1977 |
…c parts Replace experimental.chat.messages.transform recall injection with chat.message. Inject recalled memories as hidden synthetic text parts persisted in session history. Preserve idempotency with relevant-memories marker detection and update README wording.
yangxinxin-7
left a comment
There was a problem hiding this comment.
OK, good addition.
* Merge opencode plugins * update:readme&install docs * Fix Opencode plugin packaging issues Rename wrapper to .mjs, clean install docs, align README/INSTALL wording with the current directory layout, remove invalid README_ZH.md from package files, and pin @opencode-ai/plugin version. * Address OpenCode plugin review feedback - Remove OpenViking server auto-start logic from the plugin runtime - Replace fixed-interval auto commits with lifecycle-boundary commits - Commit sessions on compaction, deletion, error, and plugin shutdown - Exclude source-install wrapper files from the npm package - Update docs to clarify wrapper usage and remove deprecated config fields * fix(opencode-plugin): persist memory recall via chat.message synthetic parts Replace experimental.chat.messages.transform recall injection with chat.message. Inject recalled memories as hidden synthetic text parts persisted in session history. Preserve idempotency with relevant-memories marker detection and update README wording.
Description
Adds a unified OpenCode plugin package for OpenViking. The plugin merges repository retrieval and long-term memory capabilities into a package-style OpenCode plugin that can be enabled through OpenCode's plugin configuration.
Related Issue
N/A
Type of Change
Changes Made
examples/opencode-pluginas a unified OpenCode plugin package."plugin": ["openviking-opencode-plugin"].Testing
Checklist