Files
SupplierSystem/docs/design/20260903-capability-registry.md
T
Ubuntu deb3e72750
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
chore: 以 AI 生鲜配送系统 当前版本作为 SupplierSystem 起点
来源仓库:jxc/ai-fresh-delivery
来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d
快照树:  09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件)

按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据
(生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、
deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值),
整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。
供应商系统后续开发自本提交开始。
2026-10-08 17:35:43 +08:00

53 lines
1.8 KiB
Markdown
Raw 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.
# 能力目录框架(协议驱动,不手写工作流)
日期:2026-09-03
## 目标 / 非目标
### 目标
- 业务能力登记为带 JSON Schema 的函数:业务流程与 AI 共用同一 handler。
- Host 按 schema 发现缺参则问人,不预写「先 A 再 B」剧本。
- 写操作必须人确认后才进 handler。
- 本期只搭框架,用现有录单/导航函数做样例登记,不扫全站 API。
### 非目标
- 不为每个业务设计对话步骤。
- 不把 `/api/data` 任意 SQL 暴露给模型。
- 不改销售价/成本口径、订单状态机、小程序。
## 方案要点
能力记录:`name`、`description`、`inputSchema`、`permissions`、`effect`(read/write)、`surfaces`(api / web_fab)、`handler`(现有函数)。
执行:权限过滤 → 校验 required → write 且无 `confirm=true` 则 `need_confirm` → 再调 handler。
Host 系统提示只保留:选工具、缺参就问、禁止编造、禁止自己给写操作打确认。
## 改动面
- 本文、`docs/design/README.md`
- `server/src/capabilities/*`
- `server/src/mcp/orderEntryAgentHost.ts`、`orderEntryAgent.ts`
## 验收标准
- [x] 目录可按权限/surface 列出
- [x] 缺 required 不进 handler,返回 `need_input`
- [x] write 无 confirm 不进 handler
- [x] web_fab 列表不含 `submit_order`
- [x] Host 工具来自目录而非两套写死剧本
## 验证
- [x] `need_input` / `need_confirm` 单测
- [x] web_fab 无 `submit_order`,api 有
- [ ] 浏览器对话缺客户时会追问(需登录与模型)
偏差:样例能力仍包装现有 handler,新增业务只需 `registerCapability`,不必再写对话步骤。
## 风险与回滚
模型仍可能乱选工具:靠 schema + 权限 + 确认闸。回滚 Host 仍可点名旧 tool 列表。