Skip to content

feat: 落地插件宿主、示例模板与脱敏插件 - #30

Merged
SATA260 merged 7 commits into
mainfrom
feat/plugin
Sep 17, 2026
Merged

SATA260 merged 7 commits into
mainfrom
feat/plugin

Conversation

@SATA260

@SATA260 SATA260 commented Sep 17, 2026

Copy link
Copy Markdown
Owner

改了什么 / What changed

  • 落地进程外插件宿主与作者 SDK:六个口改数据或换向,可登记方法;未设 PLUGIN_DIR 时主循环不变。
  • plugin/example 是拷贝模板:不订阅、不改正文、不换向、不登记方法,装进 PLUGIN_DIR 也不改对话。
  • plugin/redact 在 input / request / post-execute 把秘密换成占位符,不拦工具。
  • 顺带修了 ChatPage 工作区草稿的 hydration:首屏不再用 localStorage 当初值。

Closes #16
Closes #28

怎么验证 / How to verify

  • cd server && go test ./...
  • cd plugin/redact && go test .
  • gofmt -l server plugin 无输出;go vet ./...;go build ./cmd/server
  • pnpm test:client
  • pnpm lint:web

相关 Issue / Related issue:#16 ,#28

Made with Cursor

SATA260 and others added 6 commits September 14, 2026 19:00
- 在 `.env.example` 中添加插件目录和 RPC 超时的环境变量示例。
- 更新 `AGENTS.md` 文档,详细说明插件 SDK 和宿主的结构,明确插件与 Agent 的交互方式。
- 在 CI 配置中调整 `gofmt` 检查路径,确保插件示例代码的格式化。
- 新增 `plugin.md` 文档,提供插件开发指南和示例。
- 在 `example/hello` 目录中添加示例插件代码,展示如何实现和使用插件。

- [ ] 确保 `.env.example` 中的插件配置正确。
- [ ] 运行示例插件并验证其功能。
- [ ] 检查文档是否清晰,能否指导用户创建和使用插件。

相关 Issue / Related issue:#21

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- 在 `coordinator_test.go` 中添加了对 `ask` 模式的状态加载测试,确保插件方法在状态合并后仍然可用。
- 在 `hello_plugin_test.go` 中新增测试以验证 `hello` 方法的可执行性和对禁止参数的处理。
- 在 `loop_test.go` 中添加测试以确认在活跃运行时的冲突处理和插件的输入处理。
- 在 `host_test.go` 中增加测试以确保保留方法不能被插件覆盖。

确保所有新增测试通过并覆盖相关功能。
- 在 `ChatPage` 组件中引入 `useEffect` 钩子,以在组件挂载后从本地存储读取上次的工作区草稿。
- 将 `workspaceDraft` 的初始状态设置为空字符串,以避免 SSR 文本不一致的问题。
- 添加中文注释以增强代码可读性。

确保草稿在用户会话中正确加载。
- 新增 `example/redact` 目录,包含脱敏插件的实现,能够在多个接口中将敏感信息替换为占位符。
- 更新 `AGENTS.md` 文档,详细说明脱敏插件的功能和使用方法。
- 在 CI 配置中添加对 `example/redact` 的测试,确保插件功能正常。
- 增加 `redact_plugin_test.go` 测试用例,验证插件在处理用户输入和工具回包时的脱敏效果。

确保敏感信息在用户会话中不会泄露。
- 删除 `example/hello` 和 `example/redact` 目录,迁移示例插件到 `plugin/` 目录下,更新相关文档以反映新的插件结构。
- 修改 `.env.example` 中的插件目录示例,确保与新结构一致。
- 更新 CI 配置,调整测试路径以支持新的插件位置。
- 在 `AGENTS.md` 和 `plugin.md` 中更新插件使用说明,确保用户能够正确理解和使用新的插件结构。

确保插件示例和文档与代码结构保持一致,提升可维护性。
@coderabbitai

coderabbitai Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 3e9ce3f9-4f46-4c6e-8868-ef6127e00322


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

同时留下 PLUGIN_DIR 与 CODEX_BIN,ChatPage 继续用系统选目录并避免 hydration 对不齐。

Co-authored-by: Cursor <cursoragent@cursor.com>
@SATA260
SATA260 merged commit d753500 into main Sep 17, 2026
3 checks passed
@SATA260
SATA260 deleted the feat/plugin branch September 17, 2026 07:21
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.

[Plugin] 敏感凭据自动脱敏插件 (plugin/redact) [Module] 进程外微内核插件宿主:六切面口 (Seams) 与 gRPC 隔离

1 participant