docs(hooks): add OpenCode hooks config tools design and clarify Runti… - #2332
Open
JohnLee1243 wants to merge 1 commit into
Open
docs(hooks): add OpenCode hooks config tools design and clarify Runti…#2332JohnLee1243 wants to merge 1 commit into
JohnLee1243 wants to merge 1 commit into
Conversation
…meHookRegistry wrapping
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.
docs(hooks): add OpenCode hooks config tools design and clarify RuntimeHookRegistry wrapping
Summary
新增
docs/architecture/extensions/opencode-hooks-config-tools-design.md,作为 BitFun 接入 OpenCode 插件 Hooks / Config / Tool 的正式归档设计;同步在docs/architecture/agent-runtime-services-design.md标注RuntimeHookRegistry自身已是内部共享的可克隆句柄,AgentRuntime不再外套Arc。Fixes #
Type and Areas
Type: docs
Areas: docs (architecture / extensions)
Motivation / Impact
BitFun 已有 command Hook 与 builtin Hook,但缺少 OpenCode 插件 JavaScript function Hook 的接入路径,也没有将插件
config/tool结果投影到 Agent、Permission、Tool、Skill 业务模块的端到端设计。本 PR 沉淀这一设计,作为后续实现、评审与兼容性演进的依据,统一以下核心决策:Command/Builtin/Plugin三种 Handler;Plugin通过host.hook.call调用插件侧 JavaScript function。RuntimeHookRegistry是注册事实的唯一 owner,由AgentRuntime长期持有。AgentHookEngine不长期持有注册状态,每次 dispatch 基于 Registry clone 与一次不可变 snapshot 创建。同步的 1 行注释修正了
AgentRuntime中hooks字段的包装语义,与上述第 2 条决策一致:RuntimeHookRegistry本身已是共享可克隆句柄,无需再外套Arc。No direct user-facing change — 本 PR 仅新增 / 调整设计文档,不改变任何运行时行为。
Verification
Docs-only change,按 AGENTS.md「Verification」第 3 条选择最轻量检查:
git diff --cached --stat确认变更范围:2 个文件、+1122 / -1 行,无意外文件混入。opencode-plugin-complete-compatibility-backlog.zh-CN.md指向已存在的未跟踪同目录文档(属同一 hook-docs 工作流,将在后续 PR 跟进),未引入指向仓库外资源的链接。pnpm run fmt:rs、i18n:audit、theme:color-audit:all等运行时 / 契约检查。Reviewer Notes
agent-runtime-services-design.md的修改为单行注释,与既有结构等价,不影响AgentRuntime的字段布局或语义合同。Checklist