feat: Add Bitwarden secrets and Anthropic distill support#349
Open
Coke1120 wants to merge 5 commits intoCortexReach:masterfrom
Open
feat: Add Bitwarden secrets and Anthropic distill support#349Coke1120 wants to merge 5 commits intoCortexReach:masterfrom
Coke1120 wants to merge 5 commits intoCortexReach:masterfrom
Conversation
AliceLJY
requested changes
Mar 26, 2026
Collaborator
AliceLJY
left a comment
There was a problem hiding this comment.
整体设计清晰,测试覆盖核心路径,两个特性 scope 控制得好 👍
Must Fix
1. resolveSecretValueSync 阻塞启动
execFileSync("bws", ...) 在插件 activate() 路径上会阻塞事件循环。如果 Bitwarden CLI 慢或网络抖动,会卡住整个 OpenClaw 启动。
建议:activate() 已经返回 Promise,改用 async 版本 resolveSecretValue。或者至少加个明确的 timeout 错误提示,让用户知道卡在哪。
2. Distill worker 重复了 Bitwarden 解析逻辑
lesson-extract-worker.mjs 里的 resolveMaybeBitwardenSecret() 和 src/secret-resolver.ts 逻辑重复。Worker 是独立脚本可以理解,但至少加个注释标明两处必须同步更新,或抽成共享 ESM 模块。
Nice to have
anthropicGenerateJson(worker)和createAnthropicApiKeyClient(llm-client)独立构建 Anthropic 请求,后续可能分叉,建议加 TODO 注释- 补一个
bws://URL 解析的边缘 case 测试(无 hostname / 缺 secret ID)
修完 1-2 就可以合,辛苦了 🙏
- Change register() to async and replace all resolveSecretValueSync / resolveSecretValuesSync calls with their async counterparts so Bitwarden CLI invocations no longer block the event loop during plugin activation - Add sync comment in lesson-extract-worker.mjs flagging the duplicate Bitwarden resolution logic that must stay in sync with src/secret-resolver.ts - Add TODO comments in anthropicGenerateJson (worker) and createAnthropicApiKeyClient (llm-client) noting the two implementations may diverge and should eventually be unified - Add three edge-case tests for malformed bws:// URLs (empty hostname, empty path after prefix strip) - await plugin.register() in plugin-manifest-regression test to match the now-async register signature Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ister After making register() async, all test callsites must await it or hook registrations won't complete before assertions run. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…resolver tests Resolves the package.json conflict between branch and master: keeps secret-resolver.test.mjs (added in this branch) and adds session-summary-before-reset.test.mjs (added on master). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
src/secret-resolver.ts) for secure API key management via Bitwarden CLI or env varssrc/llm-client.ts) with distill/extraction supportcli.ts) exposing distill functionalityTest plan
test/secret-resolver.test.mjs— verify Bitwarden and env-var resolution pathstest/llm-api-key-client.test.mjs— verify Anthropic client key handlingtest/plugin-manifest-regression.mjs— verify manifest schema unchangedexamples/new-session-distill/with a real sessionCloses #348
🤖 Generated with Claude Code