feat(capability,gateway): 工具策略落盘 + 主代理代审真接线(裁决 1.1 核对/1.3/10.4.2/13.4.3)
- 1.1(核对):registry 默认两布尔 false 已一致,零代码改动(设计文档已按裁决改写) - 1.3 + 10.4.2:新增迁移 0012_tool_policy(tool_policies 表,表名复数 + idx_tool_policies_name); 新增 registry.PolicyStore/SQLitePolicyStore,启动 Load 覆盖注册初值、SetPolicy 先落库后改内存 (落盘失败保持旧值并报错);面板保存路径不变但从此重启仍在 - 13.4.3:代审真接线 —— restrict.SensitiveCall 结构化判定(terminal / file write / http POST)、 restrict.Gate/Reviewer/Resolver(无代审者或代审报错一律 fail-closed 拦截), 组合根装进 loop.Options.Hooks 的 CallAdmit;gateway.RecordApproval 落 audit_logs (who=角色名 / what=approval.<工具> / result=granted|denied)并广播 approval_notice 帧 - 前端:代审小字「xxx 想要干什么,我审查后批准了」进聊天流顶部(帧→store→组件,文案单一来源 复用 audit.Approval.Explain()),附纯 node 逻辑测试 - 复核:迁移在 data/cyrene.db **副本**上 up/down/up 各一次通过;TestRegistry_PolicyStoreSurvivesRestart 与 TestAdminSetPolicySurvivesRestart 证明「重启后策略仍在」;terminal 触发代审 + 审计有行有端到端断言
This commit is contained in:
1 parent
ed5bd92e1b
commit
63236c9b00
20 files changed
+1709
-24
No files matched your search
@@ -123,3 +123,27 @@ export function SessionStatusHint(): React.ReactNode | null {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** 主代理代审小字(design/11 §4;approval_notice 帧,裁决 13.4.3):敏感操作
|
||||
* (如 terminal 执行命令)经主代理代审后,在聊天流里显示一行小字
|
||||
* 「xxx 想要干什么,我审查后批准了」;被拦截时同一处显示「我审查后拒绝了」。
|
||||
* 文案由后端产出(前端不自己拼),`detail` 作为副文本展示「想干什么」。
|
||||
* 纯展示、无副作用;未收到代审事件时不渲染。 */
|
||||
export function ApprovalNoticeHint(): React.ReactNode | null {
|
||||
const notice = useAppStore((s) => s.approvalNotice);
|
||||
if (!notice) return null;
|
||||
|
||||
return (
|
||||
<div className="mu-rise-in flex flex-wrap items-center gap-2 rounded-[var(--mu-radius)] border border-[var(--mu-glass-border)] bg-[var(--mu-surface-2)]/70 px-3 py-1.5 text-xs">
|
||||
<Icon
|
||||
name="shield"
|
||||
size={13}
|
||||
className={`shrink-0 ${notice.allowed ? "text-[var(--mu-accent)]" : "text-[var(--mu-warn)]"}`}
|
||||
/>
|
||||
<span className="min-w-0 text-[var(--mu-text-mid)]">{notice.explain}</span>
|
||||
{notice.detail ? (
|
||||
<span className="min-w-0 truncate text-[var(--mu-text-lo)]">{notice.detail}</span>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user