提交gitea知识库方案

This commit is contained in:
2026-08-11 15:40:11 +08:00
commit cabe98207c
16 changed files with 4237 additions and 0 deletions
@@ -0,0 +1,94 @@
{
"nodes":[
{"id":"g-control","type":"group","x":6940,"y":0,"width":2240,"height":3880,"color":"1","label":"E. 审计、拒绝、撤权、失败与恢复"},
{"id":"g-release","type":"group","x":0,"y":2060,"width":6500,"height":820,"color":"6","label":"D. 发布事务、Git、current、检索与读回"},
{"id":"g-auth","type":"group","x":0,"y":0,"width":5060,"height":780,"color":"5","label":"A. 治理、登录、绑定与双层授权"},
{"id":"g-build","type":"group","x":0,"y":1040,"width":5060,"height":760,"color":"3","label":"C. 明确选择、构建、校验与确认"},
{"id":"g-read","type":"group","x":5280,"y":0,"width":1360,"height":780,"color":"4","label":"B. 唯一 current 读取闭环"},
{"id":"s12","type":"text","text":"S12 构建预览\n\n调用:build_preview → deterministic builder/goldmark\n\n功能:规范化 Markdown、附件与链接,生成 manifest\n\n输出:candidate artifact/hash、构建报告\n\n审计:记录 builder/schema versionLLM 不决定构建结果","x":2260,"y":1180,"width":440,"height":500,"color":"3"},
{"id":"s09","type":"text","text":"S09 本地明确选择\n\n调用:Local Source Gate → 允许根/realpath/类型/大小/secret/PII\n\n功能:只读取用户点选的 Markdown/附件\n\n输出:相对 label、size、hash 预览\n\n审计:不记录绝对路径/正文;越界、symlink、控制文件本地阻断","x":100,"y":1180,"width":440,"height":500,"color":"3"},
{"id":"s16","type":"text","text":"S16 提交发布\n\n调用:submit_discussion_release / submit_confirmed_release\n\n功能:创建幂等 release recordoutbox\n\n输出:release ID、queued、correlation ID\n\n审计:request/release/outbox/audit 同一事务","x":100,"y":2200,"width":440,"height":520,"color":"6"},
{"id":"s24","type":"text","text":"S24 后续消费闭环\n\n调用:再次执行 S07/S08\n\n功能:新会话和其他 Agent 只消费新 current\n\n输出:与 S23 相同 release/hash\n\n审计:不一致触发完整性告警并停止扩散","x":5860,"y":2200,"width":440,"height":520,"color":"6"},
{"id":"s13","type":"text","text":"S13 完整校验\n\n调用:validate_release_request → schema/link/path/secret/PII/policy\n\n功能:拦截结构、安全和治理问题\n\n输出:validation report、policy version\n\n审计:blocking finding 不可被 prompt 绕过","x":2980,"y":1180,"width":440,"height":500,"color":"3"},
{"id":"s14","type":"text","text":"S14 差异预览\n\n调用:preview_release_diff → current reader\n\n功能:比较 candidate 与 base_current\n\n输出:文件/章节/附件变化、candidate hash\n\n审计:current 变化即 stale,要求重新构建","x":3700,"y":1180,"width":440,"height":500,"color":"3"},
{"id":"s19","type":"text","text":"S19 Git/CAS 发布\n\n调用:临时 worktreeGitea project credentialgit commit/push\n\n功能:复核 base_current,完整生成 current,单 commit 非 force push\n\n输出:commit SHA、release manifest\n\n审计:non-fast-forward→STALE_BASEtoken 不入命令行/日志","x":2260,"y":2200,"width":440,"height":520,"color":"6"},
{"id":"s10","type":"text","text":"S10 确认来源范围\n\n调用:框架展示清单 → selection confirmation\n\n功能:确认将要传输的精确内容范围\n\n输出:不可变 Selection Manifest\n\n审计:取消或 manifest 变化即废弃;Agent 自述不算授权","x":820,"y":1180,"width":440,"height":500,"color":"3"},
{"id":"s20","type":"text","text":"S20 不可变导出/current\n\n调用:export、checksum、atomic pointer switch\n\n功能:从 commit 生成 immutable release 并切唯一 current\n\n输出:release path、current version、checksums\n\n审计:校验失败不切 current;旧 release 保留","x":2980,"y":2200,"width":440,"height":520,"color":"6"},
{"id":"s21","type":"text","text":"S21 激活中文检索\n\n调用:规范化 search documentpg_trgm GIN/GiST index\n\n功能:让搜索版本与 current 一致\n\n输出:projectrelease index active\n\n审计:索引失败则 release 不 completed","x":3700,"y":2200,"width":440,"height":520,"color":"6"},
{"id":"s08","type":"text","text":"S08 中文搜索 current\n\n调用:search_current → AuthZ → PostgreSQL pg_trgm\n\n功能:按 projectrelease 做中文子串/相似度检索\n\n输出:带 release/hash 的命中\n\n审计:先授权过滤再查询,不做模型端跨项目过滤","x":6100,"y":140,"width":440,"height":500,"color":"4"},
{"id":"s11","type":"text","text":"S11 分块传输\n\n调用:create_selection / append_selection_content\n\n功能:送入隔离临时区并复算完整 hash\n\n输出:selection ID、完整度、server hash\n\n审计:缺块、乱序、超时、hash 不符时整包拒绝","x":1540,"y":1180,"width":440,"height":500,"color":"3"},
{"id":"s17","type":"text","text":"S17 网关最终复核\n\n调用:token ∩ user ∩ binding ∩ session ∩ grant ∩ policy ∩ Gitea ∩ confirmation\n\n功能:写前再次执行双层权限与精确确认\n\n输出:allowed decision/evidence\n\n审计:任一失败即 denied;主体不取自工具参数","x":820,"y":2200,"width":440,"height":520,"color":"6"},
{"id":"s18","type":"text","text":"S18 Worker 领取\n\n调用:FOR UPDATE SKIP LOCKED claim outboxidempotency key\n\n功能:可靠领取并支持重复安全执行\n\n输出:processing、attempt、worker identity\n\n审计:重复请求归并同一 release","x":1540,"y":2200,"width":440,"height":520,"color":"6"},
{"id":"audit","type":"text","text":"强制审计总线(覆盖 S00S28\n\n调用:Audit Middleware+业务事务+Outbox Worker\n\n事件:request_received → allowed/denied → completed/failed\n\n主体:humanagentservicesessiontoolprojectpolicyconfirmationresultcorrelation\n\n实现:append-only、canonical JSON hash chain、每日签名 checkpoint\n\n规则:request_received 无法落盘即拒绝;审计写入/删除不是 MCP tool","x":7060,"y":140,"width":860,"height":460,"color":"1"},
{"id":"deny","type":"text","text":"Fail Closed 拒绝出口\n\n来源:未绑定、停用、token/session 无效、ProjectGrant 拒绝、Gitea 拒绝/故障、确认无效、策略阻断、完整性异常\n\n输出:稳定错误码+脱敏 next_actioncorrelation ID\n\n功能:任何依赖不确定都不降级为 allow\n\n审计:记录决策依据,不泄露他人或其他项目","x":8200,"y":140,"width":860,"height":460,"color":"1"},
{"id":"s25","type":"text","text":"S25 审计查询\n\n调用:list_my_actions / trace_release / trace_correlation / verify_audit_event\n\n功能:本人或审计角色查看脱敏行为并验证事件链\n\n输出:三主体、decision、result、correlation\n\n审计:查询本身也被审计;无 update/delete","x":7060,"y":780,"width":860,"height":420,"color":"1"},
{"id":"s26","type":"text","text":"S26 撤权/离职\n\n调用:受控 binding/grant/session version updateOAuth revoke\n\n功能:任一层撤销后立即失效\n\n输出:revoked version、session invalidation\n\n审计:下一次调用进入 Fail Closed,不等待 token 到期","x":8200,"y":780,"width":860,"height":420,"color":"1"},
{"id":"s27","type":"text","text":"S27 失败与幂等重试\n\n调用:get_release_status / same idempotency key / cancel_precommit_release\n\n功能:区分 transient、STALE_BASE、blocking、post-commit failure\n\n输出:stable error、attempt、next action\n\n审计:commit 前可取消;commit 后不删除历史","x":7060,"y":1380,"width":860,"height":440,"color":"1"},
{"id":"s07","type":"text","text":"S07 读取唯一 current\n\n调用:get_current_manifest / read_artifact / verify_release_hash\n\n功能:只读授权项目 current\n\n输出:project、release、content_status、hash、正文\n\n审计:禁止 history/build/private source","x":5380,"y":140,"width":440,"height":500,"color":"4"},
{"id":"s15","type":"text","text":"S15 发布确认\n\n调用:框架确认服务签发 confirmation_id\n\n功能:将真实用户确认绑定到 tool/project/hash/base/diff\n\n输出:5 分钟一次性凭证\n\n审计:不可转让、复用或跨 hash;原生 tool prompt 只作交互保护","x":4420,"y":1180,"width":440,"height":500,"color":"3"},
{"id":"decision","type":"text","text":"实施前硬门(不是方案缺陷)\n\nC1-01:确认团队维护 Go\nC1-04:选择成熟 OAuth/OIDC Authorization Server\nC1-00:固定 Codex/Claude Code 支持版本\nC1-05:确认 confirmation 签名/密钥/TTL\nC1-08:确认 Local Source Gate 策略\nG0/G1:飞书 App、Gitea、服务器、TLS、PostgreSQL、监控/密钥\nG2:试点项目、绑定清单、ProjectGrant、Publisher/治理/审计责任人\nG4:审计保留、脱敏、RPO/RTO、备份与事故联系人\n\n没有对应参数时停在该 Gate,不部署、不连接、不自动降级。","x":7060,"y":2020,"width":2000,"height":560,"color":"2"},
{"id":"prd","type":"file","file":"3-业务线/Gitea知识库/Gitea知识库 v1.1 产品需求文档 PRD.md","x":7060,"y":2780,"width":860,"height":460,"color":"5"},
{"id":"baseline","type":"file","file":"3-业务线/Gitea知识库/公司共享 Context 项目仓库发布方案 v1.md","x":8200,"y":2780,"width":860,"height":460,"color":"6"},
{"id":"meta","type":"text","text":"Canvas 元数据\n\n责任人:Verlit 最后更新时间:2026-08-10 最后更新人:Codex\n文件 SHA-256 登记位置:Gitea知识库/resources.md\n范围:本地 C0 工程设计产物;未部署、未运行、未连接远端","x":7060,"y":3440,"width":2000,"height":280,"color":"5"},
{"id":"s22","type":"text","text":"S22 MCP 读回\n\n调用:与用户相同的 current manifest/read_artifact 链\n\n功能:从真实消费入口验证 release/hash/status\n\n输出:readback evidence\n\n审计:Git/current/MCP 任一不一致即 failed","x":4420,"y":2200,"width":440,"height":520,"color":"6"},
{"id":"s23","type":"text","text":"S23 完成回执\n\n调用:release_records completedcompleted auditget_release_status\n\n功能:给出可验证的最终发布事实\n\n输出:release、commit、current/hash、readback、timestamps\n\n审计:completed 事件不能落盘就不返回成功","x":5140,"y":2200,"width":440,"height":520,"color":"6"},
{"id":"s28","type":"text","text":"S28 恢复发布\n\n调用:从已知良好 release 创建新的 A4 candidate → S15 确认 → 正常发布链\n\n功能:用新 commit 恢复 current,保留完整历史\n\n输出:新 release/commit/current、恢复原因\n\n审计:仍需双层权限、validation 和一次性确认","x":8200,"y":1380,"width":860,"height":440,"color":"1"},
{"id":"s01","type":"text","text":"S01 发现 MCP 资源\n\n调用:POST /mcp → 401/.well-known/oauth-protected-resource\n\n功能:让 Agent Host 获取 resource/audience 和授权服务器\n\n输出:PRM、OAuth metadata\n\n审计:Origin/Host/protocol 非法即 request_denied","x":820,"y":140,"width":440,"height":500,"color":"5"},
{"id":"s02","type":"text","text":"S02 飞书 OAuth\n\n调用:Authorization CodePKCE → OAuth AS → 飞书 authorize/token/user_info\n\n功能:确认真实员工身份\n\n输出:飞书 claims、内部 subject 候选\n\n审计:state/PKCE/tenant/redirect;不保存飞书明文 token","x":1540,"y":140,"width":440,"height":500,"color":"5"},
{"id":"s05","type":"text","text":"S05 身份自查\n\n调用:get_my_identity / get_my_project_roles\n\n功能:展示 token subject 的绑定和角色摘要\n\n输出:脱敏 identity/role\n\n审计:humanagentservice;不接受 user_id 参数冒充","x":3700,"y":140,"width":440,"height":500,"color":"5"},
{"id":"s03","type":"text","text":"S03 绑定激活\n\n调用:查询 UserIdentity、FeishuBinding、预配置 GiteaBinding\n\n功能:激活唯一飞书—内部—Gitea 映射\n\n输出:active internal user_id\n\n审计:未配置→binding_pending;冲突/停用→denied","x":2260,"y":140,"width":440,"height":500,"color":"5"},
{"id":"s04","type":"text","text":"S04 MCP 凭据与会话\n\n调用:OAuth AS token/refresh/revoke;创建 AgentSession\n\n功能:逐用户、逐 client 的短期会话\n\n输出:access token、scope、expiry、session\n\n审计:令牌不入业务日志;撤销即时生效","x":2980,"y":140,"width":440,"height":500,"color":"5"},
{"id":"s00","type":"text","text":"S00 治理预配置\n\n调用:受控 migration/import → UserIdentity / FeishuBinding / GiteaBinding / ProjectGrant\n\n功能:建立真实主体、Gitea 数字 ID 和项目动作映射\n\n输出:版本化配置、导入报告、correlation ID\n\n审计:治理主体+变更前后 hash;不开放普通 MCP 写工具","x":100,"y":140,"width":440,"height":500,"color":"5"},
{"id":"s06","type":"text","text":"S06 列出授权项目\n\n调用:list_authorized_projects → ProjectGrant → Gitea live permission\n\n功能:计算两层权限交集\n\n输出:两层都允许的项目\n\n审计:Gitea 故障或任一层拒绝均 fail closed","x":4420,"y":140,"width":440,"height":500,"color":"5"}
],
"edges":[
{"id":"e0001","fromNode":"s00","fromSide":"right","toNode":"s01","toSide":"left","label":"预配置完成"},
{"id":"e0102","fromNode":"s01","fromSide":"right","toNode":"s02","toSide":"left","label":"进入 OAuth"},
{"id":"e0203","fromNode":"s02","fromSide":"right","toNode":"s03","toSide":"left","label":"飞书 claims"},
{"id":"e0304","fromNode":"s03","fromSide":"right","toNode":"s04","toSide":"left","label":"绑定 active"},
{"id":"e0405","fromNode":"s04","fromSide":"right","toNode":"s05","toSide":"left","label":"逐用户 token"},
{"id":"e0506","fromNode":"s05","fromSide":"right","toNode":"s06","toSide":"left","label":"确认本人主体"},
{"id":"e0607","fromNode":"s06","fromSide":"right","toNode":"s07","toSide":"left","label":"只读分支"},
{"id":"e0708","fromNode":"s07","fromSide":"right","toNode":"s08","toSide":"left","label":"读取或搜索"},
{"id":"e0807","fromNode":"s08","fromSide":"bottom","toNode":"s07","toSide":"bottom","label":"继续消费 current"},
{"id":"e0609","fromNode":"s06","fromSide":"bottom","toNode":"s09","toSide":"top","label":"构建/发布分支"},
{"id":"e0910","fromNode":"s09","fromSide":"right","toNode":"s10","toSide":"left","label":"选择预览"},
{"id":"e1011","fromNode":"s10","fromSide":"right","toNode":"s11","toSide":"left","label":"manifest confirmed"},
{"id":"e1112","fromNode":"s11","fromSide":"right","toNode":"s12","toSide":"left","label":"selection sealed"},
{"id":"e1213","fromNode":"s12","fromSide":"right","toNode":"s13","toSide":"left","label":"candidate hash"},
{"id":"e1314","fromNode":"s13","fromSide":"right","toNode":"s14","toSide":"left","label":"validation pass"},
{"id":"e1415","fromNode":"s14","fromSide":"right","toNode":"s15","toSide":"left","label":"精确 diff"},
{"id":"e1516","fromNode":"s15","fromSide":"bottom","toNode":"s16","toSide":"top","label":"一次性确认"},
{"id":"e1617","fromNode":"s16","fromSide":"right","toNode":"s17","toSide":"left","label":"release request"},
{"id":"e1718","fromNode":"s17","fromSide":"right","toNode":"s18","toSide":"left","label":"allowedoutbox"},
{"id":"e1819","fromNode":"s18","fromSide":"right","toNode":"s19","toSide":"left","label":"worker claim"},
{"id":"e1920","fromNode":"s19","fromSide":"right","toNode":"s20","toSide":"left","label":"commit SHA"},
{"id":"e2021","fromNode":"s20","fromSide":"right","toNode":"s21","toSide":"left","label":"current switched"},
{"id":"e2122","fromNode":"s21","fromSide":"right","toNode":"s22","toSide":"left","label":"index active"},
{"id":"e2223","fromNode":"s22","fromSide":"right","toNode":"s23","toSide":"left","label":"readback match"},
{"id":"e2324","fromNode":"s23","fromSide":"right","toNode":"s24","toSide":"left","label":"completed receipt"},
{"id":"e2407","fromNode":"s24","fromSide":"top","toNode":"s07","toSide":"bottom","label":"发布→消费闭环"},
{"id":"ea04","fromNode":"s04","fromSide":"top","toNode":"audit","toSide":"left","label":"身份/会话事件"},
{"id":"ea08","fromNode":"s08","fromSide":"right","toNode":"audit","toSide":"left","label":"读取事件"},
{"id":"ea15","fromNode":"s15","fromSide":"right","toNode":"audit","toSide":"left","label":"确认事件"},
{"id":"ea23","fromNode":"s23","fromSide":"right","toNode":"audit","toSide":"bottom","label":"发布完成事件"},
{"id":"ea25","fromNode":"audit","fromSide":"bottom","toNode":"s25","toSide":"top","label":"脱敏查询/验证"},
{"id":"ea26","fromNode":"s26","fromSide":"top","toNode":"audit","toSide":"right","label":"撤权事件"},
{"id":"ed03","fromNode":"s03","fromSide":"top","toNode":"deny","toSide":"left","label":"未绑定/冲突"},
{"id":"ed06","fromNode":"s06","fromSide":"top","toNode":"deny","toSide":"left","label":"双层权限失败"},
{"id":"ed09","fromNode":"s09","fromSide":"right","toNode":"deny","toSide":"bottom","label":"来源策略阻断"},
{"id":"ed13","fromNode":"s13","fromSide":"right","toNode":"deny","toSide":"bottom","label":"validation 阻断"},
{"id":"ed17","fromNode":"s17","fromSide":"right","toNode":"deny","toSide":"bottom","label":"写前拒绝"},
{"id":"ed22","fromNode":"s22","fromSide":"right","toNode":"deny","toSide":"bottom","label":"完整性失败"},
{"id":"e262d","fromNode":"s26","fromSide":"top","toNode":"deny","toSide":"bottom","label":"即时失效"},
{"id":"ef1927","fromNode":"s19","fromSide":"right","toNode":"s27","toSide":"left","label":"stale/transient"},
{"id":"ef2227","fromNode":"s22","fromSide":"right","toNode":"s27","toSide":"left","label":"post-commit failure"},
{"id":"e2728","fromNode":"s27","fromSide":"right","toNode":"s28","toSide":"left","label":"需要恢复时"},
{"id":"e2815","fromNode":"s28","fromSide":"left","toNode":"s15","toSide":"right","label":"新 A4 candidate 重新确认"},
{"id":"e2712","fromNode":"s27","fromSide":"left","toNode":"s12","toSide":"right","label":"STALE_BASE 重新构建"},
{"id":"e2718","fromNode":"s27","fromSide":"left","toNode":"s18","toSide":"right","label":"瞬时故障幂等续跑"},
{"id":"edprd","fromNode":"decision","fromSide":"bottom","toNode":"prd","toSide":"top","label":"完整需求与 Gate"},
{"id":"ebase","fromNode":"decision","fromSide":"bottom","toNode":"baseline","toSide":"top","label":"v1 冻结基线"},
{"id":"eprdbase","fromNode":"prd","fromSide":"right","toNode":"baseline","toSide":"left","label":"继承+v1.1 差量,不改原文"}
]
}