fix(adapter-claude): 支持适配器多实例启用#887
Conversation
在 Claude 适配器入口导出 reusable = true。 该变更使 Koishi 允许同一插件创建多份配置实例,避免第二份 Claude 配置被判定为不可重用而无法正常启用。 影响文件:packages/adapter-claude/src/index.ts。 多实例仍需使用不同的 platform 配置,以避免 ChatLuna 平台注册名称冲突。
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughClaude 适配器模块新增导出常量 ChangesClaude 适配器可重用性标记
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request enables multi-instance support for the Claude adapter by exporting reusable = true. However, a critical issue was identified: because logger is declared as a module-level global variable, initializing multiple instances will overwrite it, potentially causing unexpected behavior or memory leaks in older instances. It is recommended to avoid using a global logger and instead bind it to individual instances or pass the context directly.
在 Claude 适配器入口导出 reusable = true ,该变更使 Koishi 允许同一插件创建多份配置实例,避免第二份 Claude 配置被判定为不可重用而无法正常启用。
影响文件:packages/adapter-claude/src/index.ts
另外也对其他的adapter进行了一轮排查,没有发现类似问题