aps-agent/docs/architecture/dialog.md

33 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 对话入口:已下线(自然语言统一交给 Pi Agent)
> 状态:**已下线**。`server/agent_core/dialog.py`、`server/agent_core/intent.py`、
> `server/agent_core/assistant.py` 已删除;对话链路不再做规则/关键词意图识别。
## 现行入口
```
用户输入 → /api/chat → IntentResult(intent="assistant.reply", params={"query": ..., "_piPrimary": True})
→ workflow.handle_intent → fallback_lane.propose_reply()
→ Pi headless(唯一自然语言理解 + 工具选择)
→ 封闭 IntentName 工具目录 + paramsSchema
→ workflow / harness(P0 只读直通、P2 确认卡、P3 人工审批)
```
- 自然语言理解与工具选择只发生在 Pi 内部;服务端不再维护快路正则、关键词表或澄清状态机。
- `IntentResult` 仍是服务端与 Pi 之间的**结构化工具请求信封**,不是意图识别结果。
- 工具调用一律走既有门禁:P0/P1 只读直通、P2 出确认卡、P3 走白名单 fail-closed;
缺人/缺料/缺能力/缺源数据的结论保持权威,不被 Pi 文案覆盖。
- 多轮澄清与补数引导由 Pi 在同一轮对话内完成;缺数据时给补数步骤,不提示「先试排」。
## 工具参数与采用边界
- 工具目录由 `_primary_tool_catalog()` 下发 `paramsSchema`:`_PRIMARY_TOOL_PARAM_SCHEMAS` 中的已登记工具是封闭契约,`_validate_tool_params()` 拒绝未知字段、错误类型、非法枚举或范围;未单独登记参数的工具才使用 `_OPEN_PARAMS_SCHEMA`。
- `data.analyze` / `folder.analyze` 走 P0 预览:`analyze_project_deep(..., apply=False)` 与 `analyze_work_dir(..., apply_sql=False)` 只读项目上下文、深拷贝世界和 SQL 预览,返回 `readOnly` 与 `pendingAdoption`。
- 写入只在 `workflow._stage_pending_adoption()` 生成 P2 `import.commit` 确认卡后发生;批准后 `execute_confirmed()` 的 `action == "import.commit"` 分支才采用主数据并调用 `ingest_project_analyze_report()`。
- SOP 控制台同样不绕过门禁:`postSopStage(sessionId, assetId)` 调 `/api/sop/stage`,由 `compile_sop_by_asset(kb_assets, asset_id)` 编译后走 P2 `sop.apply` 确认卡。
## 相关文档
- [fallback.md](./fallback.md):Pi 主入口的围墙、审计、熔断与确认卡流程。
- [modules.md](./modules.md):`core-fallback-lane` 登记与黄金测试。