docs: 记忆文件同步架构改进交付态(纯文档,零代码)
- 架构设计说明书.md:同步桌面终版——§2.1 补 trace 顺序测试守卫、§4.2.1 无 key 告警闭环、 §4.3.4 重写为 Redis 双层锁(TTL 30s/Lua 释放/进程内备)、§5.3/§6.10/§7.1/§7.2/§7.3/§7.4/§9.4 锁与告警状态更新、基线 510 - FRAMEWORK/FLOW/REQUIREMENTS:风控 Tool 四→五(补 query_overdue_alerts)、词表 42→45 口径 - README:risk-m3 tag 注记 + API 契约表改五只读 Tool - 注:交接文档.md v2.2 同步更新(该文件被 .gitignore 忽略,仅本地)
This commit is contained in:
+1
-1
@@ -73,7 +73,7 @@ agent_service:LangGraph StateGraph + DeepSeek;tool(意图→Tool) → llm
|
||||
↓
|
||||
Tool(tool_service.run_tool:白名单 → 归属校验 → 执行 → agent_tool_call 落库):
|
||||
- CoreReadOnlyRepository:持仓/流水/L0(customer_id 由会话注入,不来自 LLM) 【T-04 已做 app/tool/core_tools.py 三 Tool】
|
||||
- 风控四 Tool:alert_query/customer_context/suitability_check/aml_lookup 【C1 已做 chat_tools(RISK_TOOL_REGISTRY)】
|
||||
- 风控五 Tool:query_overdue_alerts(C5 追加)/alert_query/customer_context/suitability_check/aml_lookup 【RISK_TOOL_REGISTRY 现 5 个】
|
||||
- milvus_tool:产品规则 RAG + source_refs 【已做 T-21(app/tool/kb_tools.py + rag_service/milvus_service;仅 customer/advisor 意图开放)】
|
||||
- memory_service:读/写 L1/L2/L3(ProfileGuard) 【窗口读写已做;画像读写待做】
|
||||
↓
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
| 风控监测 Agent | 预警、L3、R-02 适当性 | 交易事件、AML 名单 | **已实现 B1~B7 + C1~C3(对话线四 Tool + risk 分支 StateGraph,A-6 验收)**;追加 FR-8/9/10(C4~C6:集中度/时效升级/行为链)方案已定稿待编码 |
|
||||
| Core 只读层 | L0 事实查询 | `jinrong_core` | **已实现 + 已接对话 Tool(T-04)**:core_ro 经 app/tool/core_tools.py 三只读 Tool(L0/持仓/流水)进 chat;风控扩展查询照旧 |
|
||||
| 共用底座 | 会话、审计、输入防护 | MySQL 11 表 + Redis | **已接入(2026-09-07)**:会话(T-06 session_repository + memory_service 窗口)、审计中间件(T-02 http_access + input_guard_log 双写)、agent_tool_call Tool 留痕(T-04)、输入防护(T-03 input_guard:注入词表纯函数检测 + oversize + Redis 固定窗口限流,chat 链路 限流→注入/超长→归属) |
|
||||
| 对话编排 | LangGraph StateGraph + DeepSeek | langgraph/langchain-openai | **已实现(T-07 骨架 + T-04 Tool 节点 + C1 风控四 Tool + C2 risk 分支,2026-09-07)**:tool(分组关键词意图→Tool,customer/advisor/risk)→llm→guard(免责声明);analyst 分支与 LLM intent 待后续 |
|
||||
| 对话编排 | LangGraph StateGraph + DeepSeek | langgraph/langchain-openai | **已实现(T-07 骨架 + T-04 Tool 节点 + C1 风控四 Tool + C5 追加 query_overdue_alerts 共五只 + C2 risk 分支)**:tool(分组关键词意图→Tool,customer/advisor/risk)→llm→guard(免责声明);analyst 分支与 LLM intent 待后续 |
|
||||
| 同步脚本 | 归属、Neo4j | Core → agent / 图库 | **sync_*.py 已实现** |
|
||||
|
||||
------
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
| --- | --- | --- | --- | --- |
|
||||
| F-01 | JWT + RBAC + 数据归属 | 越权 403 + audit;JWT 手册 §13 | **已完成(T-01,2026-09-07)**:auth_service 验签/吊销 + deps 工厂(Bearer 全环境 + dev debug 头兜底)+ X-Agent-Type 准入矩阵 + 归属断言(B6 已有);越权 403 + audit + input_guard_log 双写 | ~~T-01~~ |
|
||||
| F-02 | 全量审计留痕 | trace_id 可还原 | **已完成(T-02,2026-09-07)**:http_access 审计中间件 + X-Trace-Id/X-Request-Id 双贯通 + 4xx/500 统一错误体;业务判定审计 B6 已接 | ~~T-02~~ |
|
||||
| F-03 | 输入防护 | input_guard_log | **完成(2026-09-07,T-03)**:prompt_injection(词表 42 条纯函数检测,命中即拒)/ oversize(4000,Pydantic 硬顶 20000)/ rate_limit(Redis 固定窗口 actor 级 30 次/分 fail-open);chat 链路 blocked 全留痕,fail-fast 不建会话 | — |
|
||||
| F-03 | 输入防护 | input_guard_log | **完成(2026-09-07,T-03)**:prompt_injection(词表纯函数检测,T-03 初版 42 条、2026-09-09 实测扩至 **45 条** = 18+11+9+7,命中即拒)/ oversize(4000,Pydantic 硬顶 20000)/ rate_limit(Redis 固定窗口 actor 级 30 次/分 fail-open);chat 链路 blocked 全留痕,fail-fast 不建会话 | — |
|
||||
| F-04 | Core 只读层 | 不改 Core 账;Repository 只 SELECT | **已完成(T-04,2026-09-07)**:core_ro(含风控扩展)经 app/tool/core_tools.py 三只读 Tool 接入 chat(L0/持仓/流水);Tool 层归属校验(A-01 语义:customer 本人/advisor assigned/risk_officer 全量)+ agent_tool_call 全留痕;Core 侧仍仅 SELECT | ~~T-04~~ |
|
||||
| R0-DB | MySQL 共用 11 表 + Redis | 01-mysql-共用底座.sql | SQL 已定;本机已灌库(B9b 走查验证) | T-05(本机已完成) |
|
||||
| R0-CORE | Core 模拟 + 同步 | reset.ps1 + sync 脚本 | **脚本已落地** | T-05 |
|
||||
|
||||
**F-01 部分完成说明:** B6 已落地 `app/api/deps.py`(AuthContext Pydantic + `get_auth_context()` 工厂,dev 从 `X-Debug-Role`/`X-Debug-Actor` 头构造;T-01 就绪后仅替换工厂内部为 JWT 解析)。
|
||||
|
||||
**F-04 完成说明(T-04,2026-09-07):** `app/repository/core_ro.py`(含风控扩展)仅 SELECT 不变;对话接入经 `app/tool/core_tools.py`(query_customer_profile / query_holdings / query_recent_trades,TOOL_REGISTRY 白名单)+ `app/service/tool_service.py`(run_tool:归属校验→执行→agent_tool_call 落库);agent_service 图为 START→tool→llm→guard,customer_id 由会话注入不接受 LLM 生成。风控四 Tool 归 C1 复用同一 runner。
|
||||
**F-04 完成说明(T-04,2026-09-07):** `app/repository/core_ro.py`(含风控扩展)仅 SELECT 不变;对话接入经 `app/tool/core_tools.py`(query_customer_profile / query_holdings / query_recent_trades,TOOL_REGISTRY 白名单)+ `app/service/tool_service.py`(run_tool:归属校验→执行→agent_tool_call 落库);agent_service 图为 START→tool→llm→guard,customer_id 由会话注入不接受 LLM 生成。风控五 Tool(C1 四只 + C5 追加 query_overdue_alerts,RISK_TOOL_REGISTRY 实 5 个)复用同一 runner。
|
||||
|
||||
## Wave 1 · 内部 Agent P0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user