[建议 / Feature] 为插件/Hook 提供"请求内容改写"能力,并补齐敏感信息防护的交互缺口
Open
Nobody has claimed this yet.
priority: P2
status: 待评估
type: 功能建议
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
提交前确认 · Pre-submission checklist
- 我已搜索过现有 issue,确认这不是重复提议 / I searched existing issues and confirmed this isn't a duplicate.
- 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category
对话 / Agent 交互 · Agent chat / interaction
涉及的 Agent 框架 · Agent framework
ZCode Agent(自研)
使用场景 · Use case
- 个人开发者防泄密:prompt 和被读取的文件里常带 API 密钥、.env 连接串、私钥,每次对话都会以明文发往模型服务商。希望存在类似 OpenCode 生态 opencode-vibeguard 的能力:请求发出前自动把敏感串替换为占位符(服务商永远看不到明文),响应返回后再还原,本地显示与工具执行完全无感。
- 企业合规:内部代码、客户数据不允许出域。企业需要统一策略的脱敏插件,在数据离开本机前完成脱敏,满足合规与审计要求。
- 发送前确认:输入内容命中疑似敏感信息时,希望弹出原生确认框让用户选择是否发送;目前对用户 prompt 只有"事后阻止",无法交互确认。
建议方案 · Proposal
- 新增一对请求管线钩子 LLMRequestTransform / LLMResponseTransform:前者在每次调用模型前收到即将发送的消息负载(含用户 prompt、历史工具输入/输出)并返回改写后的负载;后者在响应渲染/落库前收到响应内容并返回改写后内容(用于把占位符还原)。执行顺序、超时、失败策略沿用现有 hook 协议约定。
- UserPromptSubmit 支持 ask 决策,弹出与 PreToolUse 相同的原生确认框(目前 ask 仅 PreToolUse 支持)。
- hook 输出支持结构化命中条目(类型 / 位置 / 片段),由客户端渲染为列表或高亮,替代纯文本拼接。
预期价值 · Expected value
- 安全:密钥 / PII 无感脱敏,敏感数据不出本机,补齐与竞品的插件生态差距。
- 生态:开放请求管线后,可催生脱敏、审计日志、数据分级等一整类插件。
你认为的优先级 · Your perceived priority
中 · Medium
你使用的 ZCode 版本 / 环境 · ZCode version / environment
v3.10.1/win11
补充材料 · Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue identifies no repository files or tests. Start by locating the existing hook protocol, UserPromptSubmit and PreToolUse handling, and the model request/response pipeline. Done means the proposed request and response transforms, prompt confirmation, and structured hit reporting have defined ordering and failure behavior and are covered by the relevant project checks.
Written by the indexing model from the issue text.
Assessment
- Domain
- ai, backend-api-design, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100