diff --git a/.workbuddy/memory/2026-11-03.md b/.workbuddy/memory/2026-11-03.md
new file mode 100644
index 0000000..0b03dc6
--- /dev/null
+++ b/.workbuddy/memory/2026-11-03.md
@@ -0,0 +1,13 @@
+# 2026-11-03
+
+### 00:00–01:55 批次 21–23:官方前端最后 183 条端点(900/900)
+
+- **三批**:aiCenter 75 / extend 64 / teamwork 40,另收尾 4 条(Dataset/Selector、DatasetLog、saveInterfaceList、ShortLink `{id}/Config`)。
+- **实现方式**:新增 `platform/compat/res.rs` 通用资源引擎(`Res{table,fields,keyword,order,scope}` → list/info/create/update/delete),约 150 条是薄封装;业务动作手写(版本、复制、分享、回收站、切片/召回、日程)。
+- **表**:AI 用既有官方 `base_ai_*`;新增 `ext_*` 18 张(extend 15 + teamwork 3)。
+- 🔴 **踩坑 1**:`main.rs::whitelist_self_check` 会把 `ext_*` 判成「孤儿 DDL」⇒ 启动失败。正确做法是在 `sspf_store::db` 加 `EXTEND_TABLES`/`TEAMWORK_TABLES` 常量(与 REPORT/WORKFLOW 同机制)并在闸门里放行;`db.rs` 的两条表数断言也要同步。
+- 🔴 **踩坑 2**:`docs/contract.md` 的 `[ENDPOINT]` 是 **pack-sync 生成物** ⇒ 手改后必须跑 `python3 scripts/pack-sync.py`,否则 verify 第一步红。`[OFFICIAL]` 是手写台账,脚本不碰。
+- 🔴 **踩坑 3**:官方前端有**两个** ShortLink 配置函数(`getConfig/{id}` 与 `{id}/Config`)⇒ 两条路由都要留,不能只改一条。
+- **诚实失败(21 条)**:LLM 推理 / 供应商连通性 / MCP 同步 / SMTP / IMAP / Excel 导入导出 / 文件上传打包预览 —— 一律 400 + 人话(见 known-limitations §I)。
+- **数字**:契约 948 条;官方台账 934/940(742/192/6);fe-gap **900/900(100%)**;test **673 passed**;verify --smoke 14 步全绿;723 探针 0 404/405/500;OPTIONS 948 全 405。
+- **测试**:新增 `tests/ext_batches_it.rs` 6 条(路由存在 / AI 召回 / 诚实失败 / extend / teamwork / 未登录 602)。
diff --git a/HANDOFF.md b/HANDOFF.md
index 0491fc9..ef37495 100644
--- a/HANDOFF.md
+++ b/HANDOFF.md
@@ -1,6 +1,6 @@
# HANDOFF —— 交给下一个 session 的现场交接
-> 更新于 2026-11-02(面 B **批次 19 收尾** —— workFlow 104 条),
+> 更新于 2026-11-03(面 B **批次 21–23** —— aiCenter 75 + extend 64 + teamwork 40),
> 底部保留 2026-11-01 19:00 的「批次 12 方向决策」与
> **20:10 的「前端 MVP 用 React 模板、除了认证其它都留给集成阶段」**。**开工先读这一页**
> (尤其 **§0-bis 的「下一轮的优先级改了」**),再读 `CLAUDE.md`(硬约定),
@@ -32,7 +32,7 @@
## 0-0-bis. 2026-11-02 23:40 MCP 扩面:26 → 52 个业务工具
-参考 dacli 的命令面,把 MCP 从「26 个工具」扩到 **49 个**(4 元工具不变,仍是分层加载):
+参考 dacli 的命令面,把 MCP 从「26 个工具」扩到 **52 个**(4 元工具不变,仍是分层加载):
| 域 | 新增 |
|---|---|
@@ -53,6 +53,35 @@
---
+## 0-0-ter. 2026-11-03 批次 21–23:官方前端端点补到 **900/900**
+
+按 `scripts/fe-gap.py` 的缺口表,把最后三族做完(另收尾 4 条零散缺口):
+
+| 批 | 族 | 条数 | 落地 |
+|---|---|---|---|
+| 21 | `aiCenter` | 75 | 智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史 **真落库**(官方 `base_ai_*` 表);文档切片 + 关键词召回真做 |
+| 22 | `extend` | 64 | CRM / 销售订单 / 员工 / 甘特 / 控件示例 / 邮件 / 大数据 **真落库**(新增 `ext_*` 15 张) |
+| 23 | `teamwork` | 40 | 文件**元数据**(目录 / 移动 / 复制 / 分享 / 回收站 / 标签 / 空间)+ 日程 **真落库**(`ext_document*` 3 张 + 官方 `base_schedule`) |
+| 收尾 | systemData / onlineDev | 4 | `Dataset/Selector`、`DatasetLog/{id}`(如实空分页)、`InterfaceOauth/saveInterfaceList`、`ShortLink/{id}/Config`(与旧 `getConfig/{id}` 同 handler) |
+
+🔴 **实现方式**:新增 `src/backend/src/platform/compat/res.rs` **通用资源引擎**
+(`Res{table, fields, keyword, order, scope}` ⇒ list / info / create / update / delete),
+三族里约 150 条是薄封装;有业务语义的动作(版本、复制、分享、回收站、切片/召回、日程)手写。
+
+🔴 **新增表的登记**:`ext_*` 18 张既不是 `base_*` 平台表、也不是业务包表 ⇒
+在 `sspf_store::db::{EXTEND_TABLES, TEAMWORK_TABLES}` 登记,并在 `main.rs` 的
+**孤儿 DDL 闸门**里放行(与 `REPORT_TABLES` / `WORKFLOW_TABLES` 同一套机制)。
+
+🔴 **诚实失败**(见 `docs/known-limitations.md` §I):LLM 推理、供应商连通性、MCP 同步、
+SMTP/IMAP、Excel 导入导出、文件上传/打包/预览 —— 一律 `400` + 人话,**不返假成功**。
+
+⇒ 复验:`cargo test --workspace` **673 passed / 0 failed**;`verify.sh --smoke` **14 步全绿**;
+723 条端点探针 **0 个 404/405/500**;OPTIONS **948 条全 405**;
+`check-contract` PASS=10(契约 948 条 / 官方台账覆盖 **934/940**,implemented 742 / partial 192 / absent 6);
+`fe-gap` **900/900(100%)**。
+
+---
+
## 0. ⚠️ 修正上一版口径(很重要)
上一版说「跑 pnpm 必须 `dangerouslyDisableSandbox`」。**这条不完整**:真正拦住 fs 的是
@@ -397,21 +426,26 @@ React 模板的加模块成本 = **改/加 8 个文件、15~20 分钟**(`HOWTO
---
-## 1. 一句话现状(2026-11-02 批次 20 —— msgCenter 全族 50 条收尾)
+## 1. 一句话现状(2026-11-03 批次 21–23 —— aiCenter / extend / teamwork 收尾)
**📌 当前数字(以此为准,下面各批的「当时数字」仅存档)**:
-- 契约端点 **765 条**(面 A 28 + 面 B **735** + 两面共用 2);`tables` → **153**
- (`schema.sql` **152** 张 + 业务包 1 张;平台表 `BASE_TABLES` **123** +
- `WORKFLOW_TABLES` **24** + `REPORT_TABLES` **2** + 内嵌业务表 3)。
-- `cargo test --offline --workspace` = **全绿 0 failed**(**667 passed**;主 lib 105;
- `batch19_it` **7**、`batch20_it` **6**、`verify_fixes_it` **7**、`mcp_tools_it` **6**)。
-- 十二道闸门全绿;`check-contract` `PASS=10 FAIL=0`,官方端点覆盖 **751/757**
- (implemented 581 / partial 170 / absent 6;oos 4 单列)。
-- `python3 scripts/fe-gap.py`:合计 **717 / 900(79.7%)**、**`msgCenter` 50/50(100%)**、
- **`workFlow` 104/104(100%)**、**`core` 27/27(100%)**、**`onlineDev` 100/101(99.0%)**、
- **`permission` 137/137(100%)**、**`system` 196/196(100%)**、
- **`systemData` 103/106(97.2%)**。
+- 契约端点 **948 条**(面 A 28 + 面 B **918** + 两面共用 2);`tables` → **171**
+ (`schema.sql` **170** 张 + 业务包 1 张;平台表 `BASE_TABLES` **123** +
+ `WORKFLOW_TABLES` **24** + `REPORT_TABLES` **2** + 内嵌业务表 3 +
+ `EXTEND_TABLES` **15** + `TEAMWORK_TABLES` **3**)。
+- `cargo test --offline --workspace` = **全绿 0 failed**(**673 passed**;主 lib 105;
+ `batch19_it` **7**、`batch20_it` **6**、`verify_fixes_it` **7**、`mcp_tools_it` **6**、
+ `ext_batches_it` **6**)。
+- 闸门全绿;`check-contract` `PASS=10 FAIL=0`,官方端点覆盖 **934/940**
+ (implemented 742 / partial 192 / absent 6;oos 1 单列)。
+- `python3 scripts/fe-gap.py`:合计 **900 / 900(100%)** —— **`aiCenter` 75/75、
+ `extend` 64/64、`teamwork` 40/40、`msgCenter` 50/50、`workFlow` 104/104、
+ `core` 27/27、`system` 196/196、`permission` 137/137 全部 100%;
+ `systemData` 106/106、`onlineDev` 101/101**。
+- 🔴 **批次 21–23 把官方前端的最后 183 条缺口做完了**(179 + 收尾 4):
+ 见 §0-0-ter 与 `docs/known-limitations.md` §I。真落库 158 条、诚实失败 21 条
+ (LLM / SMTP / IMAP / MCP / 文件服务 / Excel 一律 `400` + 人话)。
- 🔴 **批次 20 把 msgCenter 做完了**(用户 2026-11-02 指示「msgCenter 50 去做完吧」):
官方前端 `src/api/msgCenter/**` 的**全部 50 个接口** ⇒ 落 **51 条面 B 端点**
(50 条前端接口 + 1 条**动态路径别名**,见下),新增 `platform/compat/msg_center.rs`。
diff --git a/crates/sspf-store/src/db.rs b/crates/sspf-store/src/db.rs
index 8355f1c..3dcfc45 100644
--- a/crates/sspf-store/src/db.rs
+++ b/crates/sspf-store/src/db.rs
@@ -114,7 +114,43 @@ pub const WORKFLOW_TABLES: [&str; 24] = [
"workflow_version",
];
-/// `PGLITE_DIR=memory://` 的临时库标记(与 `config::TEMP_DIR_MARKER` 同值)。
+/// 🔴 **extend 示例模块的表**(官方 `/api/extend/**` 契约面的落库载体)。
+///
+/// 🔴 官方 `jnpf-extend` 的示例业务表在官方 DDL 里叫 `ext_*`;本仓照这个名字建,
+/// 不改成 `base_*`(改了就和官方对不上,集成期要多一层映射)。
+/// 它们**不是**平台表、也**不是**业务包表(没有 spec)⇒ 与 `REPORT_TABLES` /
+/// `WORKFLOW_TABLES` 同性质:**契约面的固定装置**。
+///
+/// 🔴 金额 / 业务日期列用 TEXT(示例页只展示):本仓的绑定参数是 `$N::text`,
+/// 进 NUMERIC/TIMESTAMP 列会报类型错;审计列仍是 TIMESTAMP。
+pub const EXTEND_TABLES: [&str; 15] = [
+ "ext_big_data",
+ "ext_customer",
+ "ext_goods_classify",
+ "ext_goods",
+ "ext_crm_order",
+ "ext_crm_order_entry",
+ "ext_crm_collection_plan",
+ "ext_email",
+ "ext_email_config",
+ "ext_employee",
+ "ext_project",
+ "ext_project_task",
+ "ext_table_example",
+ "ext_sale_product",
+ "ext_sale_product_entry",
+];
+
+/// 🔴 **teamwork 的表**(官方 `jnpf-file` 的文档 / 空间 + 分享关系)。
+///
+/// 与 [`EXTEND_TABLES`] 同性质:契约面固定装置,不是平台表、不是业务包表。
+pub const TEAMWORK_TABLES: [&str; 3] = [
+ "ext_document",
+ "ext_document_space",
+ "ext_document_share",
+];
+
+/// `PGLITE_DIR=memory://` 的临时库标记(与 `config::TEMP_DIR_MARKER` 同值)。/// `PGLITE_DIR=memory://` 的临时库标记(与 `config::TEMP_DIR_MARKER` 同值)。
const TEMP_DIR_MARKER: &str = "memory://";
// PostgreSQL 内建类型 OID(`scalar_text` 按列类型分派时只需这几个)。
@@ -1304,10 +1340,13 @@ mod tests {
let mut expected = EMBEDDED_BUSINESS_TABLES.to_vec();
expected.extend_from_slice(&REPORT_TABLES);
expected.extend_from_slice(&WORKFLOW_TABLES);
+ expected.extend_from_slice(&EXTEND_TABLES);
+ expected.extend_from_slice(&TEAMWORK_TABLES);
expected.sort();
assert_eq!(
business_names, expected,
- "schema.sql 里的非平台表必须恰好是面 A 内嵌的 3 张 + 报表元数据 2 张 + 流程元数据 24 张(业务包表住 packs/)"
+ "schema.sql 里的非平台表必须恰好是面 A 内嵌 3 + 报表元数据 2 + 流程元数据 24 \
+ + extend 示例 15 + teamwork 3(业务包表住 packs/)"
);
// 🔴 与 main.rs 的 BASE_TABLES 对账的另一半在那边(孤儿 DDL 闸门)。
@@ -1340,12 +1379,16 @@ mod tests {
BASE_TABLE_COUNT
+ EMBEDDED_BUSINESS_TABLES.len()
+ REPORT_TABLES.len()
- + WORKFLOW_TABLES.len(),
+ + WORKFLOW_TABLES.len()
+ + EXTEND_TABLES.len()
+ + TEAMWORK_TABLES.len(),
"ddl_tables 应解析出 {} 张表({} 平台 + {} 面 A 内嵌业务 + {} 报表元数据 + {} 流程元数据)",
BASE_TABLE_COUNT
+ EMBEDDED_BUSINESS_TABLES.len()
+ REPORT_TABLES.len()
- + WORKFLOW_TABLES.len(),
+ + WORKFLOW_TABLES.len()
+ + EXTEND_TABLES.len()
+ + TEAMWORK_TABLES.len(),
BASE_TABLE_COUNT,
EMBEDDED_BUSINESS_TABLES.len(),
REPORT_TABLES.len(),
diff --git a/docs/contract.md b/docs/contract.md
index 27611b6..640c7a9 100644
--- a/docs/contract.md
+++ b/docs/contract.md
@@ -1677,7 +1677,7 @@ B GET /api/visualdev/share/Selector 登录 platform
B POST /api/visualdev/ocr 登录 platform
B GET /api/visualdev/ShortLink/{id} onlineDev.formDesign platform
B PUT /api/visualdev/ShortLink onlineDev.formDesign platform
-B GET /api/visualdev/ShortLink/getConfig/{id} 登录 platform
+B GET /api/visualdev/ShortLink/{id}/Config 登录 platform
B POST /api/visualdev/ShortLink/checkPwd 登录 platform
B GET /api/visualdev/ShortLink/Config 登录 platform
B POST /api/visualdev/ShortLink/{id}/ListLink 登录 platform
@@ -1912,6 +1912,190 @@ B PUT /api/message/Supplier/{id}/Actions/State 登录 platform
B GET /api/message/Supplier/{id}/VariableList 登录 platform
B POST /api/message/Account/{id} integrationCenter.sms|integrationCenter.email|integrationCenter.weChatMp|integrationCenter.webhook platform
+B GET /api/ai/Agent 登录 platform
+B POST /api/ai/Agent 登录 platform
+B GET /api/ai/Agent/Selector 登录 platform
+B POST /api/ai/Agent/Save 登录 platform
+B GET /api/ai/Agent/Info/{id} 登录 platform
+B POST /api/ai/Agent/Info/{id} 登录 platform
+B DELETE /api/ai/Agent/Info/{id} 登录 platform
+B GET /api/ai/Agent/Version/{id} 登录 platform
+B GET /api/ai/Agent/{id} 登录 platform
+B PUT /api/ai/Agent/{id} 登录 platform
+B DELETE /api/ai/Agent/{id} 登录 platform
+B POST /api/ai/Agent/{id}/Actions/Copy 登录 platform
+B GET /api/ai/AiSupplier 登录 platform
+B POST /api/ai/AiSupplier 登录 platform
+B GET /api/ai/AiSupplier/Selector 登录 platform
+B POST /api/ai/AiSupplier/checkAi 登录 platform
+B GET /api/ai/AiSupplier/{id} 登录 platform
+B PUT /api/ai/AiSupplier/{id} 登录 platform
+B DELETE /api/ai/AiSupplier/{id} 登录 platform
+B POST /api/ai/Chat/Send 登录 platform
+B POST /api/ai/Chat/Translate 登录 platform
+B POST /api/ai/Chat/Optimize 登录 platform
+B GET /api/ai/Chat/Close/{id} 登录 platform
+B GET /api/ai/Chat/history/list 登录 platform
+B DELETE /api/ai/Chat/history/cleanAll 登录 platform
+B GET /api/ai/Chat/history/get/{id} 登录 platform
+B PUT /api/ai/Chat/history/update/{id} 登录 platform
+B DELETE /api/ai/Chat/history/delete/{id} 登录 platform
+B GET /api/ai/Document 登录 platform
+B POST /api/ai/Document 登录 platform
+B GET /api/ai/Document/{id} 登录 platform
+B PUT /api/ai/Document/{id} 登录 platform
+B DELETE /api/ai/Document/{id} 登录 platform
+B GET /api/ai/Document/{id}/getText 登录 platform
+B POST /api/ai/Document/{id}/section 登录 platform
+B POST /api/ai/Document/{id}/study 登录 platform
+B GET /api/ai/Knowledge 登录 platform
+B POST /api/ai/Knowledge 登录 platform
+B GET /api/ai/Knowledge/Selector 登录 platform
+B POST /api/ai/Knowledge/getListByIds 登录 platform
+B GET /api/ai/Knowledge/Relation/{id} 登录 platform
+B GET /api/ai/Knowledge/{id} 登录 platform
+B PUT /api/ai/Knowledge/{id} 登录 platform
+B DELETE /api/ai/Knowledge/{id} 登录 platform
+B POST /api/ai/Knowledge/{id}/Test 登录 platform
+B GET /api/ai/Mcp 登录 platform
+B POST /api/ai/Mcp 登录 platform
+B GET /api/ai/Mcp/Selector 登录 platform
+B GET /api/ai/Mcp/Sync/{id} 登录 platform
+B POST /api/ai/Mcp/getListByIds 登录 platform
+B GET /api/ai/Mcp/{id} 登录 platform
+B PUT /api/ai/Mcp/{id} 登录 platform
+B DELETE /api/ai/Mcp/{id} 登录 platform
+B GET /api/ai/Model 登录 platform
+B GET /api/ai/Model/{id} 登录 platform
+B PUT /api/ai/Model/{id} 登录 platform
+B GET /api/ai/Prompt 登录 platform
+B POST /api/ai/Prompt 登录 platform
+B GET /api/ai/Prompt/{id} 登录 platform
+B PUT /api/ai/Prompt/{id} 登录 platform
+B DELETE /api/ai/Prompt/{id} 登录 platform
+B GET /api/ai/Serve 登录 platform
+B POST /api/ai/Serve 登录 platform
+B GET /api/ai/Serve/Selector 登录 platform
+B GET /api/ai/Serve/{id} 登录 platform
+B PUT /api/ai/Serve/{id} 登录 platform
+B DELETE /api/ai/Serve/{id} 登录 platform
+B GET /api/ai/Skills 登录 platform
+B POST /api/ai/Skills/getListByIds 登录 platform
+B GET /api/ai/Skills/{id} 登录 platform
+B GET /api/ai/Tool 登录 platform
+B POST /api/ai/Tool/getListByIds 登录 platform
+B GET /api/ai/Tool/{id} 登录 platform
+B POST /api/ai/visualdev 登录 platform
+B POST /api/ai/workflow 登录 platform
+B GET /api/extend/BigData 登录 platform
+B POST /api/extend/BigData 登录 platform
+B GET /api/extend/CrmOrder 登录 platform
+B GET /api/extend/CrmOrder/Customer 登录 platform
+B GET /api/extend/CrmOrder/Goods 登录 platform
+B GET /api/extend/CrmOrder/OrderEntry/{id}/Items 登录 platform
+B DELETE /api/extend/CrmOrder/{id} 登录 platform
+B GET /api/extend/CrmOrder/{id}/CollectionPlan 登录 platform
+B GET /api/extend/DocumentPreview 登录 platform
+B GET /api/extend/DocumentPreview/{id}/Preview 登录 platform
+B GET /api/extend/Email 登录 platform
+B POST /api/extend/Email 登录 platform
+B POST /api/extend/Email/Actions/SaveDraft 登录 platform
+B GET /api/extend/Email/Config 登录 platform
+B PUT /api/extend/Email/Config 登录 platform
+B POST /api/extend/Email/Config/Actions/CheckMail 登录 platform
+B POST /api/extend/Email/Receive 登录 platform
+B GET /api/extend/Email/{id} 登录 platform
+B DELETE /api/extend/Email/{id} 登录 platform
+B PUT /api/extend/Email/{id}/Actions/Read 登录 platform
+B PUT /api/extend/Email/{id}/Actions/Unread 登录 platform
+B PUT /api/extend/Email/{id}/Actions/Star 登录 platform
+B PUT /api/extend/Email/{id}/Actions/Unstar 登录 platform
+B GET /api/extend/Employee 登录 platform
+B GET /api/extend/Employee/ExportData 登录 platform
+B POST /api/extend/Employee/ImportData 登录 platform
+B GET /api/extend/Employee/ImportPreview 登录 platform
+B GET /api/extend/Employee/TemplateDownload 登录 platform
+B DELETE /api/extend/Employee/{id} 登录 platform
+B GET /api/extend/ProjectGantt 登录 platform
+B POST /api/extend/ProjectGantt 登录 platform
+B POST /api/extend/ProjectGantt/Task 登录 platform
+B GET /api/extend/ProjectGantt/Task/{id} 登录 platform
+B PUT /api/extend/ProjectGantt/Task/{id} 登录 platform
+B GET /api/extend/ProjectGantt/{id} 登录 platform
+B PUT /api/extend/ProjectGantt/{id} 登录 platform
+B DELETE /api/extend/ProjectGantt/{id} 登录 platform
+B GET /api/extend/ProjectGantt/{id}/Task 登录 platform
+B GET /api/extend/ProjectGantt/{id}/Task/Selector/{taskId} 登录 platform
+B GET /api/extend/TableExample 登录 platform
+B POST /api/extend/TableExample 登录 platform
+B GET /api/extend/TableExample/All 登录 platform
+B GET /api/extend/TableExample/CityList/{id} 登录 platform
+B GET /api/extend/TableExample/ControlSample/{id} 登录 platform
+B GET /api/extend/TableExample/IndustryList 登录 platform
+B PUT /api/extend/TableExample/UpdateSign/{id} 登录 platform
+B GET /api/extend/TableExample/{id} 登录 platform
+B PUT /api/extend/TableExample/{id} 登录 platform
+B DELETE /api/extend/TableExample/{id} 登录 platform
+B GET /api/extend/TableExample/{id}/Actions/Postil 登录 platform
+B PUT /api/extend/TableExample/{id}/Actions/RowsEdit 登录 platform
+B POST /api/extend/TableExample/{id}/Postil 登录 platform
+B DELETE /api/extend/TableExample/{id}/Postil/{index} 登录 platform
+B GET /api/extend/saleOrder/Classify 登录 platform
+B GET /api/extend/saleOrder/Customer 登录 platform
+B GET /api/extend/saleOrder/Goods 登录 platform
+B GET /api/extend/saleOrder/Goods/Selector 登录 platform
+B GET /api/extend/saleOrder/Goods/getGoodList 登录 platform
+B GET /api/extend/saleOrder/Product 登录 platform
+B POST /api/extend/saleOrder/Product 登录 platform
+B GET /api/extend/saleOrder/Product/ProductEntry/{id} 登录 platform
+B GET /api/extend/saleOrder/Product/{id} 登录 platform
+B PUT /api/extend/saleOrder/Product/{id} 登录 platform
+B DELETE /api/extend/saleOrder/Product/{id} 登录 platform
+B GET /api/file/Document 登录 platform
+B POST /api/file/Document 登录 platform
+B GET /api/file/Document/list 登录 platform
+B PUT /api/file/Document/tag 登录 platform
+B POST /api/file/Document/BatchDelete 登录 platform
+B POST /api/file/Document/FolderTree 登录 platform
+B GET /api/file/Document/Detail 登录 platform
+B PUT /api/file/Document/Actions/MoveTo/{toId} 登录 platform
+B POST /api/file/Document/Actions/Copy/{toId} 登录 platform
+B POST /api/file/Document/Actions/Share 登录 platform
+B POST /api/file/Document/Actions/CancelShare 登录 platform
+B POST /api/file/Document/Actions/ShareAdjustment/{id} 登录 platform
+B GET /api/file/Document/Share 登录 platform
+B GET /api/file/Document/ShareTome 登录 platform
+B GET /api/file/Document/ShareUser/{id} 登录 platform
+B GET /api/file/Document/Trash 登录 platform
+B POST /api/file/Document/Trash 登录 platform
+B POST /api/file/Document/Trash/Actions/Recovery 登录 platform
+B POST /api/file/Document/PackDownload 登录 platform
+B POST /api/file/Document/merge 登录 platform
+B POST /api/file/Document/UploadBlob 登录 platform
+B GET /api/file/Document/getIcon 登录 platform
+B GET /api/file/Document/recent 登录 platform
+B GET /api/file/Document/{id} 登录 platform
+B PUT /api/file/Document/{id} 登录 platform
+B GET /api/file/DocumentSpace 登录 platform
+B POST /api/file/DocumentSpace 登录 platform
+B POST /api/file/DocumentSpace/MoveOut 登录 platform
+B POST /api/file/DocumentSpace/Release 登录 platform
+B GET /api/file/DocumentSpace/Selector 登录 platform
+B GET /api/file/DocumentSpace/getDocumentList 登录 platform
+B GET /api/file/DocumentSpace/{id} 登录 platform
+B PUT /api/file/DocumentSpace/{id} 登录 platform
+B DELETE /api/file/DocumentSpace/{id} 登录 platform
+B GET /api/system/Schedule 登录 platform
+B POST /api/system/Schedule 登录 platform
+B GET /api/system/Schedule/detail 登录 platform
+B GET /api/system/Schedule/{id} 登录 platform
+B PUT /api/system/Schedule/{id}/{kind} 登录 platform
+B DELETE /api/system/Schedule/{id}/{kind} 登录 platform
+B GET /api/system/Dataset/Selector dataCenter.dataset platform
+B GET /api/system/DatasetLog/{id} dataCenter.dataset platform
+B POST /api/system/InterfaceOauth/saveInterfaceList integrationCenter.openApi platform
+B GET /api/visualdev/ShortLink/getConfig/{id} 登录 platform
+
# 🔴 以下由 `scripts/pack-sync.py` 从 `packs/*` 生成 —— **不许手改**
# (下次同步会被覆盖;改包就够)
@@ -1935,7 +2119,7 @@ B DELETE /api/asset/DataResource/{id} permission.asset.dataResource asset
[FACE]
# face 条数 说明
A 28 面 A 专属(+ 2 条共用 ⇒ 面 A 合计 30 条)
-B 735 面 B 专属(官方 JNPF 形状;批次 13 新增 Area 7 + Variate 7;批次 14 新增数据中心 29;批次 15 新增系统服务 39;批次 16 新增权限关系 26;批次 17 新增 onlineDev 78 + Report 23;批次 18 新增 core 22;批次 19 新增 workFlow 104;批次 20 新增 msgCenter 51(前端 50 + 动态路径别名 1))
+B 918 面 B 专属(官方 JNPF 形状;批次 13 新增 Area 7 + Variate 7;批次 14 新增数据中心 29;批次 15 新增系统服务 39;批次 16 新增权限关系 26;批次 17 新增 onlineDev 78 + Report 23;批次 18 新增 core 22;批次 19 新增 workFlow 104;批次 20 新增 msgCenter 51(前端 50 + 动态路径别名 1);批次 21–23 新增 aiCenter 75 + extend 64 + teamwork 40 + 收尾 4)
AB 2 两面共用(CurrentUser / Authority Data —— 按判别头分流)
[OFFICIAL]
@@ -2416,9 +2600,9 @@ GET /api/system/Tag/{id}/Actions/Export partial TagController.java:169 同上:
# 三者同时成立 ⇒ 前端历史遗留的死声明,不是本仓缺口。
# 记 `oos`(不进覆盖分母)而非 `absent`:它们压根不是官方端点,算进分母会让覆盖率说谎。
# 它们仍会被 `scripts/fe-gap.py` 报成缺口(那把尺子只比「前端声明了什么」)—— 已知且有意。
-GET /api/system/Dataset/Selector oos DataSetController.java:82 死声明:`dataset.ts:76 getDatasetSelector` 无人调用;`DataSetController` 只有 `/getList`(那是 `getDatasetSelectorList` 的端点)⇒ 不实现
-GET /api/system/DatasetLog/{id} oos DataSetController.java:82 死声明:`dataset.ts:40 getDataSetLog` 无人调用;全仓 Java **没有任何** `DatasetLog` 映射(`InterfaceOauth/dataInterfaceLog/{id}` 是另一个端点)⇒ 不实现
-POST /api/system/InterfaceOauth/saveInterfaceList oos InterfaceOauthController.java:74 死声明:`openApi.ts:32 saveInterfaceList` 无人调用;该控制器只有读的 `getInterfaceList`,保存走 `POST /api/system/InterfaceOauth` 本身 ⇒ 不实现
+GET /api/system/Dataset/Selector implemented api/systemData/dataset.ts:77 面 B 已落地:数据集下拉(id / fullName / enCode / type)
+GET /api/system/DatasetLog/{id} partial api/systemData/dataset.ts:41 本仓不落数据集执行日志 ⇒ **如实返回空分页**(不编造记录)
+POST /api/system/InterfaceOauth/saveInterfaceList implemented api/systemData/openApi.ts:33 面 B 已落地:写 `f_data_interface_ids`(官方前端暂无消费点)
# ---- 权限关系(批次 16):角色绑定 / 在线用户 / 自定义范围 / 工作详情 / 导入导出 ----
GET /api/permission/RoleRelation partial RoleRelationController.java:80 面 B 已落地:按 `type` 三分支(user 补岗位/组织名;organize/position 给树路径)。**`gender` 返原码**:本仓没种子化 `SEX_TYPE` 字典,不做翻译。用户的 `position` 由 `base_user.f_position_id`(逗号分隔)反查 `base_position.f_full_name` —— 官方是查 `base_user_relation`,但本仓的岗位**只**落在 `f_position_id`(同 `GetPosition`)
POST /api/permission/RoleRelation implemented RoleRelationController.java:153 面 B 已落地:空 ids / 角色不存在 / 停用用户过滤 / 已绑定跳过 / 超管不能添加 / 三态返回(`部分成功`)逐条对齐;绑完**把用户踢下线**(官方 `delCurUser`)。🔴 `f_object_type` **全小写**(`user`/`organize`/`position`,官方 `PermissionConst` 逐字):授权引擎只认小写,写成首字母大写会**绑定成功但权限永不生效**
@@ -2493,7 +2677,7 @@ GET /api/visualdev/share/Selector implemented SystemShareController.java:87 面
POST /api/visualdev/ocr partial OcrController.java:48 本仓无 OCR 服务 ⇒ **明确业务失败**
GET /api/visualdev/ShortLink/{id} implemented VisualdevShortLinkController.java:101 面 B 已落地:按官方 `jnpf-visualdev` 的 Controller 形状实现
PUT /api/visualdev/ShortLink implemented VisualdevShortLinkController.java:139 面 B 已落地:按官方 `jnpf-visualdev` 的 Controller 形状实现
-GET /api/visualdev/ShortLink/getConfig/{id} implemented VisualdevShortLinkController.java:229 面 B 已落地:按官方 `jnpf-visualdev` 的 Controller 形状实现
+GET /api/visualdev/ShortLink/{id}/Config implemented VisualdevShortLinkController.java:229 面 B 已落地:按官方 `jnpf-visualdev` 的 Controller 形状实现
POST /api/visualdev/ShortLink/checkPwd implemented VisualdevShortLinkController.java:244 面 B 已落地:按官方 `jnpf-visualdev` 的 Controller 形状实现
GET /api/visualdev/ShortLink/Config implemented VisualdevShortLinkController.java:263 面 B 已落地:按官方 `jnpf-visualdev` 的 Controller 形状实现
POST /api/visualdev/ShortLink/{id}/ListLink implemented VisualdevShortLinkController.java:292 面 B 已落地:按官方 `jnpf-visualdev` 的 Controller 形状实现
@@ -2724,6 +2908,186 @@ POST /api/message/Supplier/TestConnect partial api/msgCenter/supplier.ts:45 本
PUT /api/message/Supplier/{id}/Actions/State implemented IntgSupplierController.java:275 面 B 已落地:消息中心(账号 / 发送配置 / 模板 / 敏感词 / 接收配置 / 监控 / 供应商)**真落库**到官方 `base_msg_*` + `base_intg_supplier*` 表(DDL 逐字照官方);**真发消息 / 真连服务商**的动作因本仓无 HTTP 客户端 ⇒ **明确业务失败**
GET /api/message/Supplier/{id}/VariableList implemented IntgSupplierController.java:266 面 B 已落地:消息中心(账号 / 发送配置 / 模板 / 敏感词 / 接收配置 / 监控 / 供应商)**真落库**到官方 `base_msg_*` + `base_intg_supplier*` 表(DDL 逐字照官方);**真发消息 / 真连服务商**的动作因本仓无 HTTP 客户端 ⇒ **明确业务失败**
POST /api/message/Account/{id} partial api/msgCenter/accountConfig.ts:33 官方前端 `testConfig` 的**动态**路径(`${Api.Prefix}/${data.testType}`,`api/msgCenter/accountConfig.ts:33`)的**同语义别名**;运行期 `testType` 写死为 `testSendMail` ⇒ 打到官方静态端点(已实现)。本仓无 HTTP 客户端 ⇒ **明确业务失败**(不返假发送结果)
+GET /api/ai/Agent implemented api/aiCenter/aiAgent.ts:9 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Agent implemented api/aiCenter/aiAgent.ts:17 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Agent/Selector implemented api/aiCenter/aiAgent.ts:13 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Agent/Save implemented api/aiCenter/aiAgent.ts:37 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Agent/Info/{id} implemented api/aiCenter/aiAgent.ts:41 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Agent/Info/{id} implemented api/aiCenter/aiAgent.ts:53 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+DELETE /api/ai/Agent/Info/{id} implemented api/aiCenter/aiAgent.ts:49 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Agent/Version/{id} implemented api/aiCenter/aiAgent.ts:45 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Agent/{id} implemented api/aiCenter/aiAgent.ts:25 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+PUT /api/ai/Agent/{id} implemented api/aiCenter/aiAgent.ts:21 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+DELETE /api/ai/Agent/{id} implemented api/aiCenter/aiAgent.ts:29 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Agent/{id}/Actions/Copy implemented api/aiCenter/aiAgent.ts:33 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/AiSupplier implemented api/aiCenter/aiModel.ts:9 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/AiSupplier implemented api/aiCenter/aiModel.ts:17 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/AiSupplier/Selector implemented api/aiCenter/aiModel.ts:13 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/AiSupplier/checkAi partial api/aiCenter/aiModel.ts:33 本仓无 HTTP 客户端 ⇒ 无法连供应商,明确业务失败
+GET /api/ai/AiSupplier/{id} implemented api/aiCenter/aiModel.ts:25 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+PUT /api/ai/AiSupplier/{id} implemented api/aiCenter/aiModel.ts:21 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+DELETE /api/ai/AiSupplier/{id} implemented api/aiCenter/aiModel.ts:29 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Chat/Send partial api/aiCenter/aiChat.ts:9 本仓无 HTTP 客户端 ⇒ 无法调 LLM,明确业务失败(元数据管理可用)
+POST /api/ai/Chat/Translate partial api/aiCenter/aiChat.ts:19 本仓无 LLM 推理服务 ⇒ 明确业务失败
+POST /api/ai/Chat/Optimize partial api/aiCenter/aiChat.ts:47 本仓无 LLM 推理服务 ⇒ 明确业务失败
+GET /api/ai/Chat/Close/{id} implemented api/aiCenter/aiChat.ts:23 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Chat/history/list implemented api/aiCenter/aiChat.ts:27 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+DELETE /api/ai/Chat/history/cleanAll implemented api/aiCenter/aiChat.ts:43 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Chat/history/get/{id} implemented api/aiCenter/aiChat.ts:31 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+PUT /api/ai/Chat/history/update/{id} implemented api/aiCenter/aiChat.ts:35 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+DELETE /api/ai/Chat/history/delete/{id} implemented api/aiCenter/aiChat.ts:39 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Document implemented api/aiCenter/aiDocument.ts:9 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Document implemented api/aiCenter/aiDocument.ts:13 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Document/{id} implemented api/aiCenter/aiDocument.ts:21 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+PUT /api/ai/Document/{id} implemented api/aiCenter/aiDocument.ts:17 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+DELETE /api/ai/Document/{id} implemented api/aiCenter/aiDocument.ts:25 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Document/{id}/getText implemented api/aiCenter/aiDocument.ts:37 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Document/{id}/section partial api/aiCenter/aiDocument.ts:29 本地按行切片(真做);无向量化
+POST /api/ai/Document/{id}/study partial api/aiCenter/aiDocument.ts:33 本地切片 + 落 f_state(真做);无向量库,召回走关键词
+GET /api/ai/Knowledge implemented api/aiCenter/aiKnowledge.ts:9 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Knowledge implemented api/aiCenter/aiKnowledge.ts:21 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Knowledge/Selector implemented api/aiCenter/aiKnowledge.ts:13 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Knowledge/getListByIds implemented api/aiCenter/aiKnowledge.ts:17 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Knowledge/Relation/{id} implemented api/aiCenter/aiKnowledge.ts:41 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Knowledge/{id} implemented api/aiCenter/aiKnowledge.ts:29 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+PUT /api/ai/Knowledge/{id} implemented api/aiCenter/aiKnowledge.ts:25 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+DELETE /api/ai/Knowledge/{id} implemented api/aiCenter/aiKnowledge.ts:33 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Knowledge/{id}/Test partial api/aiCenter/aiKnowledge.ts:37 关键词召回(真做,score=命中词占比);无向量相似度
+GET /api/ai/Mcp implemented api/aiCenter/aiMcp.ts:9 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Mcp implemented api/aiCenter/aiMcp.ts:21 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Mcp/Selector implemented api/aiCenter/aiMcp.ts:13 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Mcp/Sync/{id} partial api/aiCenter/aiMcp.ts:37 本仓无 HTTP/stdio 客户端 ⇒ 无法连 MCP 服务,明确业务失败
+POST /api/ai/Mcp/getListByIds implemented api/aiCenter/aiMcp.ts:17 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Mcp/{id} implemented api/aiCenter/aiMcp.ts:29 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+PUT /api/ai/Mcp/{id} implemented api/aiCenter/aiMcp.ts:25 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+DELETE /api/ai/Mcp/{id} implemented api/aiCenter/aiMcp.ts:33 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Model implemented api/aiCenter/aiModelConfig.ts:9 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Model/{id} implemented api/aiCenter/aiModelConfig.ts:17 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+PUT /api/ai/Model/{id} implemented api/aiCenter/aiModelConfig.ts:13 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Prompt implemented api/aiCenter/aiPrompt.ts:9 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Prompt implemented api/aiCenter/aiPrompt.ts:13 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Prompt/{id} implemented api/aiCenter/aiPrompt.ts:21 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+PUT /api/ai/Prompt/{id} implemented api/aiCenter/aiPrompt.ts:17 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+DELETE /api/ai/Prompt/{id} implemented api/aiCenter/aiPrompt.ts:25 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Serve implemented api/aiCenter/aiAgentService.ts:9 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Serve implemented api/aiCenter/aiAgentService.ts:17 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Serve/Selector implemented api/aiCenter/aiAgentService.ts:13 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Serve/{id} implemented api/aiCenter/aiAgentService.ts:25 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+PUT /api/ai/Serve/{id} implemented api/aiCenter/aiAgentService.ts:21 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+DELETE /api/ai/Serve/{id} implemented api/aiCenter/aiAgentService.ts:29 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Skills implemented api/aiCenter/aiSkills.ts:9 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Skills/getListByIds implemented api/aiCenter/aiSkills.ts:13 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Skills/{id} implemented api/aiCenter/aiSkills.ts:17 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Tool implemented api/aiCenter/aiTool.ts:9 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/Tool/getListByIds implemented api/aiCenter/aiTool.ts:13 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+GET /api/ai/Tool/{id} implemented api/aiCenter/aiTool.ts:17 面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败
+POST /api/ai/visualdev partial api/aiCenter/aiChat.ts:52 本仓无 LLM ⇒ 不生成表单;传 id 时按 id 查已有表单
+POST /api/ai/workflow partial api/aiCenter/aiChat.ts:56 本仓无 LLM ⇒ 不生成流程;传 id 时按 id 查已有模板
+GET /api/extend/BigData implemented api/extend/bigData.ts:9 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+POST /api/extend/BigData implemented api/extend/bigData.ts:13 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/CrmOrder implemented api/extend/order.ts:9 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/CrmOrder/Customer implemented api/extend/order.ts:25 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/CrmOrder/Goods implemented api/extend/order.ts:29 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/CrmOrder/OrderEntry/{id}/Items implemented api/extend/order.ts:17 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+DELETE /api/extend/CrmOrder/{id} implemented api/extend/order.ts:13 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/CrmOrder/{id}/CollectionPlan implemented api/extend/order.ts:21 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/DocumentPreview implemented api/extend/documentPreview.ts:9 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/DocumentPreview/{id}/Preview partial api/extend/documentPreview.ts:13 本仓无 onlyoffice / 文件服务 ⇒ 明确业务失败
+GET /api/extend/Email implemented api/extend/email.ts:9 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+POST /api/extend/Email partial api/extend/email.ts:25 本仓无 SMTP ⇒ 不发信;草稿走 SaveDraft 真存
+POST /api/extend/Email/Actions/SaveDraft implemented api/extend/email.ts:29 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/Email/Config implemented api/extend/email.ts:13 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/Email/Config implemented api/extend/email.ts:17 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+POST /api/extend/Email/Config/Actions/CheckMail partial api/extend/email.ts:21 本仓无 SMTP/IMAP 客户端 ⇒ 明确业务失败
+POST /api/extend/Email/Receive partial api/extend/email.ts:57 本仓无 IMAP 客户端 ⇒ 明确业务失败
+GET /api/extend/Email/{id} implemented api/extend/email.ts:33 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+DELETE /api/extend/Email/{id} implemented api/extend/email.ts:37 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/Email/{id}/Actions/Read implemented api/extend/email.ts:41 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/Email/{id}/Actions/Unread implemented api/extend/email.ts:45 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/Email/{id}/Actions/Star implemented api/extend/email.ts:49 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/Email/{id}/Actions/Unstar implemented api/extend/email.ts:53 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/Employee implemented api/extend/employee.ts:9 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/Employee/ExportData partial api/extend/employee.ts:17 本仓无文件服务与 Excel 库 ⇒ 明确业务失败
+POST /api/extend/Employee/ImportData partial api/extend/employee.ts:25 本仓无文件服务与 Excel 库 ⇒ 明确业务失败
+GET /api/extend/Employee/ImportPreview partial api/extend/employee.ts:29 本仓无文件服务与 Excel 库 ⇒ 明确业务失败
+GET /api/extend/Employee/TemplateDownload partial api/extend/employee.ts:21 本仓无文件服务 ⇒ 明确业务失败
+DELETE /api/extend/Employee/{id} implemented api/extend/employee.ts:13 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/ProjectGantt implemented api/extend/projectGantt.ts:9 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+POST /api/extend/ProjectGantt implemented api/extend/projectGantt.ts:13 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+POST /api/extend/ProjectGantt/Task implemented api/extend/projectGantt.ts:41 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/ProjectGantt/Task/{id} implemented api/extend/projectGantt.ts:37 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/ProjectGantt/Task/{id} implemented api/extend/projectGantt.ts:45 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/ProjectGantt/{id} implemented api/extend/projectGantt.ts:25 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/ProjectGantt/{id} implemented api/extend/projectGantt.ts:17 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+DELETE /api/extend/ProjectGantt/{id} implemented api/extend/projectGantt.ts:21 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/ProjectGantt/{id}/Task implemented api/extend/projectGantt.ts:29 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/ProjectGantt/{id}/Task/Selector/{taskId} implemented api/extend/projectGantt.ts:33 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/TableExample implemented api/extend/table.ts:29 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+POST /api/extend/TableExample implemented api/extend/table.ts:13 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/TableExample/All implemented api/extend/table.ts:33 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/TableExample/CityList/{id} implemented api/extend/table.ts:9 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/TableExample/ControlSample/{id} implemented api/extend/table.ts:61 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/TableExample/IndustryList implemented api/extend/table.ts:21 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/TableExample/UpdateSign/{id} implemented api/extend/table.ts:57 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/TableExample/{id} implemented api/extend/table.ts:25 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/TableExample/{id} implemented api/extend/table.ts:53 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+DELETE /api/extend/TableExample/{id} implemented api/extend/table.ts:17 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/TableExample/{id}/Actions/Postil implemented api/extend/table.ts:41 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/TableExample/{id}/Actions/RowsEdit implemented api/extend/table.ts:37 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+POST /api/extend/TableExample/{id}/Postil implemented api/extend/table.ts:45 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+DELETE /api/extend/TableExample/{id}/Postil/{index} implemented api/extend/table.ts:49 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/saleOrder/Classify implemented api/extend/saleOrder.ts:33 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/saleOrder/Customer implemented api/extend/saleOrder.ts:29 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/saleOrder/Goods implemented api/extend/saleOrder.ts:37 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/saleOrder/Goods/Selector implemented api/extend/saleOrder.ts:49 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/saleOrder/Goods/getGoodList implemented api/extend/saleOrder.ts:41 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/saleOrder/Product implemented api/extend/saleOrder.ts:9 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+POST /api/extend/saleOrder/Product implemented api/extend/saleOrder.ts:17 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/saleOrder/Product/ProductEntry/{id} implemented api/extend/saleOrder.ts:45 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/extend/saleOrder/Product/{id} implemented api/extend/saleOrder.ts:13 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+PUT /api/extend/saleOrder/Product/{id} implemented api/extend/saleOrder.ts:21 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+DELETE /api/extend/saleOrder/Product/{id} implemented api/extend/saleOrder.ts:25 面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败
+GET /api/file/Document implemented api/teamwork/document.ts:11 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/Document implemented api/teamwork/document.ts:19 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/Document/list implemented api/teamwork/document.ts:15 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+PUT /api/file/Document/tag implemented api/teamwork/document.ts:23 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/Document/BatchDelete implemented api/teamwork/document.ts:31 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/Document/FolderTree implemented api/teamwork/document.ts:35 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/Document/Detail implemented api/teamwork/document.ts:43 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+PUT /api/file/Document/Actions/MoveTo/{toId} implemented api/teamwork/document.ts:47 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/Document/Actions/Copy/{toId} implemented api/teamwork/document.ts:51 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/Document/Actions/Share implemented api/teamwork/document.ts:59 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/Document/Actions/CancelShare implemented api/teamwork/document.ts:55 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/Document/Actions/ShareAdjustment/{id} implemented api/teamwork/document.ts:63 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/Document/Share implemented api/teamwork/document.ts:67 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/Document/ShareTome implemented api/teamwork/document.ts:75 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/Document/ShareUser/{id} implemented api/teamwork/document.ts:79 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/Document/Trash implemented api/teamwork/document.ts:83 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/Document/Trash implemented api/teamwork/document.ts:87 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/Document/Trash/Actions/Recovery implemented api/teamwork/document.ts:91 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/Document/PackDownload partial api/teamwork/document.ts:95 本仓无文件服务 ⇒ 明确业务失败
+POST /api/file/Document/merge partial api/teamwork/document.ts:99 本仓无文件服务 ⇒ 分片合并明确失败
+POST /api/file/Document/UploadBlob partial api/teamwork/document.ts:103 本仓无文件服务 ⇒ 只支持元数据,上传明确失败
+GET /api/file/Document/getIcon implemented api/teamwork/document.ts:107 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/Document/recent implemented api/teamwork/document.ts:71 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/Document/{id} implemented api/teamwork/document.ts:39 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+PUT /api/file/Document/{id} implemented api/teamwork/document.ts:27 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/DocumentSpace implemented api/teamwork/documentSpace.ts:9 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/DocumentSpace implemented api/teamwork/documentSpace.ts:25 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/DocumentSpace/MoveOut implemented api/teamwork/documentSpace.ts:41 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/file/DocumentSpace/Release implemented api/teamwork/documentSpace.ts:37 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/DocumentSpace/Selector implemented api/teamwork/documentSpace.ts:17 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/DocumentSpace/getDocumentList implemented api/teamwork/documentSpace.ts:13 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/file/DocumentSpace/{id} implemented api/teamwork/documentSpace.ts:33 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+PUT /api/file/DocumentSpace/{id} implemented api/teamwork/documentSpace.ts:29 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+DELETE /api/file/DocumentSpace/{id} implemented api/teamwork/documentSpace.ts:21 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/system/Schedule implemented api/teamwork/schedule.ts:9 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+POST /api/system/Schedule implemented api/teamwork/schedule.ts:13 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/system/Schedule/detail implemented api/teamwork/schedule.ts:29 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/system/Schedule/{id} implemented api/teamwork/schedule.ts:25 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+PUT /api/system/Schedule/{id}/{kind} implemented api/teamwork/schedule.ts:17 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+DELETE /api/system/Schedule/{id}/{kind} implemented api/teamwork/schedule.ts:21 面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败
+GET /api/visualdev/ShortLink/getConfig/{id} implemented api/onlineDev/shortLink.ts:17 面 B 已落地:外链配置(与 `{id}/Config` 同一 handler;官方前端两个函数都在用)
[RULER]
# name 期望断言数(尺子**自己**断言的条数;跑出来的条数对不上 ⇒ 失败)
diff --git a/docs/known-limitations.md b/docs/known-limitations.md
index 54073f5..bb9ee5b 100644
--- a/docs/known-limitations.md
+++ b/docs/known-limitations.md
@@ -110,3 +110,20 @@
而本仓前端 `src/frontend/src/api/request.ts` **也发**前两个(与官方同款)⇒ **只有 `Vue-Version` 是本仓前端唯一不发的**。
🔴 **本仓前端禁止发 `Vue-Version`**(发了 ⇒ 面 A 请求被误判成面 B ⇒ 契约整体错位)。
🔴 `scripts/check-module.sh` 的「全局红线」段**静态钉住两侧**:前端**禁发**该头 + 面 B 尺子**必带**该头。
+
+## I. AI 中心 / extend 示例 / teamwork(批次 21–23,2026-11-03)
+
+> 这三族把官方前端 `src/api/**` 的**最后 179 条**端点补齐(`fe-gap` 从 717/900 → **900/900**)。
+> 口径与批次 20 一致:**能本地自洽的真落库,需要外部能力的如实失败**。
+
+| # | 限制 | 为什么接受 / 代价 |
+|---|---|---|
+| (ar) | **AI 中心没有 LLM 推理能力**:`Chat/Send` / `Translate` / `Optimize` / `AiSupplier/checkAi` / `Mcp/Sync` 一律 `code=400` + 人话 | 本仓 `src/backend/Cargo.toml` **没有 HTTP 客户端**(无 reqwest / hyper client)。假装流式返回一段文本 = 骗前端。代价:AI 中心页面只能做**元数据管理**,对话/翻译/连通性检查用不了 |
+| (as) | **知识库召回是关键词匹配,不是向量检索**:`Document/{id}/study` 本地按行切片(≤800 字)并落 `f_state=1`;`Knowledge/{id}/Test` 用 ILIKE 命中的词数占比当 `score` | 本仓没有向量库 / embedding 服务。**真做了切片与召回**(不是空壳),但语义召回质量不如向量检索。代价:同义词、跨语言召回会漏 |
+| (at) | **AI 中心的守卫只到「登录」**:官方是 `@SaCheckPermission("aiCenter.*")`,本仓没有 AI 菜单/权限点种子 | 如实降级(`require_login_face_b`)。代价:**任何登录用户都能改 AI 配置**(dev 环境可接受;集成期补菜单种子后改回 `guard(...)` 即可) |
+| (au) | **供应商密钥不下发**:列表/详情的 `credential` 恒空串,只给 `credentialConfigured` 布尔 | 官方会把密钥原样返给前端编辑;但本仓守卫只到登录 ⇒ 不能把密钥发给任何登录用户。代价:编辑供应商时**必须重新输入密钥**(留空=不改,更新逻辑已处理) |
+| (av) | **extend 的邮件 / 导入导出 / 预览不可用**:`POST Email`(发信)、`Email/Receive`、`Email/Config/Actions/CheckMail`、`Employee/{ExportData,ImportData,ImportPreview,TemplateDownload}`、`DocumentPreview/{id}/Preview` 一律 400 | 没有 SMTP/IMAP 客户端、没有 Excel 库、没有文件服务。草稿(`SaveDraft`)与邮箱配置**真落库**。代价:这些示例页的「发送/导出」按钮只会提示失败 |
+| (aw) | **extend 的金额 / 业务日期列是 TEXT** | 本仓的 SQL 绑定参数是 `$N::text`(进 NUMERIC/TIMESTAMP 列需逐列 cast)⇒ 示例页只做展示,用 TEXT 换实现简单。代价:**不能直接用 SQL 做金额汇总/日期比较**(报表要用需先 cast) |
+| (ax) | **`TableExample/CityList/{id}` 依赖 `base_province`**,本仓**没有行政区划种子** ⇒ 恒空列表 | 不编造城市数据。代价:控件示例的「城市」下拉为空(`IndustryList` 是官方同款静态选项,有值) |
+| (ay) | **teamwork 只存文件元数据,不存字节**:`UploadBlob` / `PackDownload` / `merge` 一律 400;文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / 最近 / 标签 / 空间**真落库** | 本仓没有对象存储 / onlyoffice / 分片合并。代价:页面上传文件会失败,但目录与分享体系可用 |
+| (az) | **日程只落库,不推送提醒**:`base_schedule` 的 `reminderTime` / `sendConfigId` 原样存,**没有调度器真发提醒** | 本仓的 `scheduletask` 只登记任务、不执行;IM/邮件通道也没有。代价:日程到点不会通知 |
diff --git a/scripts/gen-contract-endpoints.py b/scripts/gen-contract-endpoints.py
index 509d032..2acd723 100644
--- a/scripts/gen-contract-endpoints.py
+++ b/scripts/gen-contract-endpoints.py
@@ -25,6 +25,7 @@
"""
import importlib.util
+import json
import os
import re
import sys
@@ -762,7 +763,15 @@ PARTIAL_NOTES[("GET", "/api/message/Receive")] = (
# 🔴 **端点顺序**:按官方模块分组,组内按路径排 —— 与 `routes.rs` 的注册顺序对齐
# (⇒ 契约读起来与代码读起来同序 ⇒ 人工 review 不用来回跳)。
-MODULE_ORDER = ["core", "online_dev", "report", "workflow", "msg_center"]
+MODULE_ORDER = ["core", "online_dev", "report", "workflow", "msg_center",
+ "ai", "extend", "teamwork"]
+
+# 🔴 **批次 21–23**:AI 中心 / extend 示例 / teamwork(文件 + 日程)三族。
+# 官方出处直接取官方前端 `api/
/**:行号`(与 `scripts/fe-gap.py` 同一份扫描结果),
+# 因为这三族在官方 Java 里分散在 `jnpf-ai-v3` / `jnpf-extend` / `jnpf-file` /
+# `jnpf-system` 四个模块,逐条对 Java 行号收益不大、且更容易漂。
+_EXT_SOURCES = json.load(
+ open(os.path.join(HERE, "official-ext-sources.json"), encoding="utf-8"))
# 🔴 **默认 note**(未在 `PARTIAL_NOTES` 里显式标注的端点)。
DEFAULT_NOTES = {
@@ -775,6 +784,13 @@ DEFAULT_NOTES = {
"workflow": "面 B 已落地:流程**元数据**(模板 / 版本 / 节点 / 评论 / 委托 / "
"监控 / 触发记录)**真落库**到官方 24 张 `workflow_*` 表(DDL 逐字照官方);"
"**引擎动作**(发起 / 审批 / 办理 …)因本仓未接入 Flowable ⇒ **明确业务失败**",
+ "ai": "面 B 已落地:AI 中心元数据(智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / "
+ "提示词 / 服务 / 技能 / 工具 / 会话历史)真落库到官方 `base_ai_*` 表;"
+ "**调模型推理 / 供应商连通性检查 / MCP 工具同步**因本仓无 HTTP 客户端明确失败",
+ "extend": "面 B 已落地:官方示例模块真落库到 `ext_*` 15 张表;"
+ "需要 SMTP/IMAP、文件服务、Excel 引擎的动作明确失败",
+ "teamwork": "面 B 已落地:文件**元数据**(文件夹 / 改名 / 移动 / 复制 / 分享 / 回收站 / "
+ "最近 / 标签 / 空间)与日程真落库;上传 / 打包下载 / 分片合并因本仓无文件服务明确失败",
"msg_center": "面 B 已落地:消息中心(账号 / 发送配置 / 模板 / 敏感词 / 接收配置 / "
"监控 / 供应商)**真落库**到官方 `base_msg_*` + `base_intg_supplier*` "
"表(DDL 逐字照官方);**真发消息 / 真连服务商**的动作因本仓无 HTTP "
@@ -829,9 +845,63 @@ def build_rows(modules):
return ep_rows, off_rows
+# ---- 批次 21–23:三族的「部分落地」说明(诚实的降级点)----
+PARTIAL_NOTES.update({
+ ("POST", "/api/ai/Chat/Send"): (
+ "partial", "本仓无 HTTP 客户端 ⇒ 无法调 LLM,明确业务失败(元数据管理可用)"),
+ ("POST", "/api/ai/Chat/Translate"): (
+ "partial", "本仓无 LLM 推理服务 ⇒ 明确业务失败"),
+ ("POST", "/api/ai/Chat/Optimize"): (
+ "partial", "本仓无 LLM 推理服务 ⇒ 明确业务失败"),
+ ("POST", "/api/ai/AiSupplier/checkAi"): (
+ "partial", "本仓无 HTTP 客户端 ⇒ 无法连供应商,明确业务失败"),
+ ("GET", "/api/ai/Mcp/Sync/{id}"): (
+ "partial", "本仓无 HTTP/stdio 客户端 ⇒ 无法连 MCP 服务,明确业务失败"),
+ ("POST", "/api/ai/visualdev"): (
+ "partial", "本仓无 LLM ⇒ 不生成表单;传 id 时按 id 查已有表单"),
+ ("POST", "/api/ai/workflow"): (
+ "partial", "本仓无 LLM ⇒ 不生成流程;传 id 时按 id 查已有模板"),
+ ("POST", "/api/ai/Document/{id}/section"): (
+ "partial", "本地按行切片(真做);无向量化"),
+ ("POST", "/api/ai/Document/{id}/study"): (
+ "partial", "本地切片 + 落 f_state(真做);无向量库,召回走关键词"),
+ ("POST", "/api/ai/Knowledge/{id}/Test"): (
+ "partial", "关键词召回(真做,score=命中词占比);无向量相似度"),
+ ("POST", "/api/extend/Email"): (
+ "partial", "本仓无 SMTP ⇒ 不发信;草稿走 SaveDraft 真存"),
+ ("POST", "/api/extend/Email/Config/Actions/CheckMail"): (
+ "partial", "本仓无 SMTP/IMAP 客户端 ⇒ 明确业务失败"),
+ ("POST", "/api/extend/Email/Receive"): (
+ "partial", "本仓无 IMAP 客户端 ⇒ 明确业务失败"),
+ ("GET", "/api/extend/Employee/ExportData"): (
+ "partial", "本仓无文件服务与 Excel 库 ⇒ 明确业务失败"),
+ ("POST", "/api/extend/Employee/ImportData"): (
+ "partial", "本仓无文件服务与 Excel 库 ⇒ 明确业务失败"),
+ ("GET", "/api/extend/Employee/ImportPreview"): (
+ "partial", "本仓无文件服务与 Excel 库 ⇒ 明确业务失败"),
+ ("GET", "/api/extend/Employee/TemplateDownload"): (
+ "partial", "本仓无文件服务 ⇒ 明确业务失败"),
+ ("GET", "/api/extend/DocumentPreview/{id}/Preview"): (
+ "partial", "本仓无 onlyoffice / 文件服务 ⇒ 明确业务失败"),
+ ("POST", "/api/file/Document/UploadBlob"): (
+ "partial", "本仓无文件服务 ⇒ 只支持元数据,上传明确失败"),
+ ("POST", "/api/file/Document/PackDownload"): (
+ "partial", "本仓无文件服务 ⇒ 明确业务失败"),
+ ("POST", "/api/file/Document/merge"): (
+ "partial", "本仓无文件服务 ⇒ 分片合并明确失败"),
+})
+
+
def official_entry(mod, key, path):
"""⇒ (src, status, note) —— 官方出处 + 落地状态 + 偏差说明。"""
method = key[0]
+ if mod in ("ai", "extend", "teamwork"):
+ table = _EXT_SOURCES.get(mod) or {}
+ src = table.get("%s %s" % (method, norm_path(path)))
+ if not src:
+ raise SystemExit("三族没有官方出处可登记:%s %s" % (mod, path))
+ status, note = PARTIAL_NOTES.get(key, ("implemented", DEFAULT_NOTES[mod]))
+ return src, status, note
if mod == "report":
line = REPORT_FRONTEND_LINES.get("%s %s" % (method, path))
src = "%s:%d" % (REPORT_SRC, line) if line else REPORT_SRC
diff --git a/scripts/official-ext-sources.json b/scripts/official-ext-sources.json
new file mode 100644
index 0000000..d75dae3
--- /dev/null
+++ b/scripts/official-ext-sources.json
@@ -0,0 +1,187 @@
+{
+ "ai": {
+ "DELETE /api/ai/Agent/Info/{}": "api/aiCenter/aiAgent.ts:49",
+ "DELETE /api/ai/Agent/{}": "api/aiCenter/aiAgent.ts:29",
+ "DELETE /api/ai/AiSupplier/{}": "api/aiCenter/aiModel.ts:29",
+ "DELETE /api/ai/Chat/history/cleanAll": "api/aiCenter/aiChat.ts:43",
+ "DELETE /api/ai/Chat/history/delete/{}": "api/aiCenter/aiChat.ts:39",
+ "DELETE /api/ai/Document/{}": "api/aiCenter/aiDocument.ts:25",
+ "DELETE /api/ai/Knowledge/{}": "api/aiCenter/aiKnowledge.ts:33",
+ "DELETE /api/ai/Mcp/{}": "api/aiCenter/aiMcp.ts:33",
+ "DELETE /api/ai/Prompt/{}": "api/aiCenter/aiPrompt.ts:25",
+ "DELETE /api/ai/Serve/{}": "api/aiCenter/aiAgentService.ts:29",
+ "GET /api/ai/Agent": "api/aiCenter/aiAgent.ts:9",
+ "GET /api/ai/Agent/Info/{}": "api/aiCenter/aiAgent.ts:41",
+ "GET /api/ai/Agent/Selector": "api/aiCenter/aiAgent.ts:13",
+ "GET /api/ai/Agent/Version/{}": "api/aiCenter/aiAgent.ts:45",
+ "GET /api/ai/Agent/{}": "api/aiCenter/aiAgent.ts:25",
+ "GET /api/ai/AiSupplier": "api/aiCenter/aiModel.ts:9",
+ "GET /api/ai/AiSupplier/Selector": "api/aiCenter/aiModel.ts:13",
+ "GET /api/ai/AiSupplier/{}": "api/aiCenter/aiModel.ts:25",
+ "GET /api/ai/Chat/Close/{}": "api/aiCenter/aiChat.ts:23",
+ "GET /api/ai/Chat/history/get/{}": "api/aiCenter/aiChat.ts:31",
+ "GET /api/ai/Chat/history/list": "api/aiCenter/aiChat.ts:27",
+ "GET /api/ai/Document": "api/aiCenter/aiDocument.ts:9",
+ "GET /api/ai/Document/{}": "api/aiCenter/aiDocument.ts:21",
+ "GET /api/ai/Document/{}/getText": "api/aiCenter/aiDocument.ts:37",
+ "GET /api/ai/Knowledge": "api/aiCenter/aiKnowledge.ts:9",
+ "GET /api/ai/Knowledge/Relation/{}": "api/aiCenter/aiKnowledge.ts:41",
+ "GET /api/ai/Knowledge/Selector": "api/aiCenter/aiKnowledge.ts:13",
+ "GET /api/ai/Knowledge/{}": "api/aiCenter/aiKnowledge.ts:29",
+ "GET /api/ai/Mcp": "api/aiCenter/aiMcp.ts:9",
+ "GET /api/ai/Mcp/Selector": "api/aiCenter/aiMcp.ts:13",
+ "GET /api/ai/Mcp/Sync/{}": "api/aiCenter/aiMcp.ts:37",
+ "GET /api/ai/Mcp/{}": "api/aiCenter/aiMcp.ts:29",
+ "GET /api/ai/Model": "api/aiCenter/aiModelConfig.ts:9",
+ "GET /api/ai/Model/{}": "api/aiCenter/aiModelConfig.ts:17",
+ "GET /api/ai/Prompt": "api/aiCenter/aiPrompt.ts:9",
+ "GET /api/ai/Prompt/{}": "api/aiCenter/aiPrompt.ts:21",
+ "GET /api/ai/Serve": "api/aiCenter/aiAgentService.ts:9",
+ "GET /api/ai/Serve/Selector": "api/aiCenter/aiAgentService.ts:13",
+ "GET /api/ai/Serve/{}": "api/aiCenter/aiAgentService.ts:25",
+ "GET /api/ai/Skills": "api/aiCenter/aiSkills.ts:9",
+ "GET /api/ai/Skills/{}": "api/aiCenter/aiSkills.ts:17",
+ "GET /api/ai/Tool": "api/aiCenter/aiTool.ts:9",
+ "GET /api/ai/Tool/{}": "api/aiCenter/aiTool.ts:17",
+ "POST /api/ai/Agent": "api/aiCenter/aiAgent.ts:17",
+ "POST /api/ai/Agent/Info/{}": "api/aiCenter/aiAgent.ts:53",
+ "POST /api/ai/Agent/Save": "api/aiCenter/aiAgent.ts:37",
+ "POST /api/ai/Agent/{}/Actions/Copy": "api/aiCenter/aiAgent.ts:33",
+ "POST /api/ai/AiSupplier": "api/aiCenter/aiModel.ts:17",
+ "POST /api/ai/AiSupplier/checkAi": "api/aiCenter/aiModel.ts:33",
+ "POST /api/ai/Chat/Optimize": "api/aiCenter/aiChat.ts:47",
+ "POST /api/ai/Chat/Send": "api/aiCenter/aiChat.ts:9",
+ "POST /api/ai/Chat/Translate": "api/aiCenter/aiChat.ts:19",
+ "POST /api/ai/Document": "api/aiCenter/aiDocument.ts:13",
+ "POST /api/ai/Document/{}/section": "api/aiCenter/aiDocument.ts:29",
+ "POST /api/ai/Document/{}/study": "api/aiCenter/aiDocument.ts:33",
+ "POST /api/ai/Knowledge": "api/aiCenter/aiKnowledge.ts:21",
+ "POST /api/ai/Knowledge/getListByIds": "api/aiCenter/aiKnowledge.ts:17",
+ "POST /api/ai/Knowledge/{}/Test": "api/aiCenter/aiKnowledge.ts:37",
+ "POST /api/ai/Mcp": "api/aiCenter/aiMcp.ts:21",
+ "POST /api/ai/Mcp/getListByIds": "api/aiCenter/aiMcp.ts:17",
+ "POST /api/ai/Prompt": "api/aiCenter/aiPrompt.ts:13",
+ "POST /api/ai/Serve": "api/aiCenter/aiAgentService.ts:17",
+ "POST /api/ai/Skills/getListByIds": "api/aiCenter/aiSkills.ts:13",
+ "POST /api/ai/Tool/getListByIds": "api/aiCenter/aiTool.ts:13",
+ "POST /api/ai/visualdev": "api/aiCenter/aiChat.ts:52",
+ "POST /api/ai/workflow": "api/aiCenter/aiChat.ts:56",
+ "PUT /api/ai/Agent/{}": "api/aiCenter/aiAgent.ts:21",
+ "PUT /api/ai/AiSupplier/{}": "api/aiCenter/aiModel.ts:21",
+ "PUT /api/ai/Chat/history/update/{}": "api/aiCenter/aiChat.ts:35",
+ "PUT /api/ai/Document/{}": "api/aiCenter/aiDocument.ts:17",
+ "PUT /api/ai/Knowledge/{}": "api/aiCenter/aiKnowledge.ts:25",
+ "PUT /api/ai/Mcp/{}": "api/aiCenter/aiMcp.ts:25",
+ "PUT /api/ai/Model/{}": "api/aiCenter/aiModelConfig.ts:13",
+ "PUT /api/ai/Prompt/{}": "api/aiCenter/aiPrompt.ts:17",
+ "PUT /api/ai/Serve/{}": "api/aiCenter/aiAgentService.ts:21"
+ },
+ "extend": {
+ "DELETE /api/extend/CrmOrder/{}": "api/extend/order.ts:13",
+ "DELETE /api/extend/Email/{}": "api/extend/email.ts:37",
+ "DELETE /api/extend/Employee/{}": "api/extend/employee.ts:13",
+ "DELETE /api/extend/ProjectGantt/{}": "api/extend/projectGantt.ts:21",
+ "DELETE /api/extend/TableExample/{}": "api/extend/table.ts:17",
+ "DELETE /api/extend/TableExample/{}/Postil/{}": "api/extend/table.ts:49",
+ "DELETE /api/extend/saleOrder/Product/{}": "api/extend/saleOrder.ts:25",
+ "GET /api/extend/BigData": "api/extend/bigData.ts:9",
+ "GET /api/extend/CrmOrder": "api/extend/order.ts:9",
+ "GET /api/extend/CrmOrder/Customer": "api/extend/order.ts:25",
+ "GET /api/extend/CrmOrder/Goods": "api/extend/order.ts:29",
+ "GET /api/extend/CrmOrder/OrderEntry/{}/Items": "api/extend/order.ts:17",
+ "GET /api/extend/CrmOrder/{}/CollectionPlan": "api/extend/order.ts:21",
+ "GET /api/extend/DocumentPreview": "api/extend/documentPreview.ts:9",
+ "GET /api/extend/DocumentPreview/{}/Preview": "api/extend/documentPreview.ts:13",
+ "GET /api/extend/Email": "api/extend/email.ts:9",
+ "GET /api/extend/Email/Config": "api/extend/email.ts:13",
+ "GET /api/extend/Email/{}": "api/extend/email.ts:33",
+ "GET /api/extend/Employee": "api/extend/employee.ts:9",
+ "GET /api/extend/Employee/ExportData": "api/extend/employee.ts:17",
+ "GET /api/extend/Employee/ImportPreview": "api/extend/employee.ts:29",
+ "GET /api/extend/Employee/TemplateDownload": "api/extend/employee.ts:21",
+ "GET /api/extend/ProjectGantt": "api/extend/projectGantt.ts:9",
+ "GET /api/extend/ProjectGantt/Task/{}": "api/extend/projectGantt.ts:37",
+ "GET /api/extend/ProjectGantt/{}": "api/extend/projectGantt.ts:25",
+ "GET /api/extend/ProjectGantt/{}/Task": "api/extend/projectGantt.ts:29",
+ "GET /api/extend/ProjectGantt/{}/Task/Selector/{}": "api/extend/projectGantt.ts:33",
+ "GET /api/extend/TableExample": "api/extend/table.ts:29",
+ "GET /api/extend/TableExample/All": "api/extend/table.ts:33",
+ "GET /api/extend/TableExample/CityList/{}": "api/extend/table.ts:9",
+ "GET /api/extend/TableExample/ControlSample/{}": "api/extend/table.ts:61",
+ "GET /api/extend/TableExample/IndustryList": "api/extend/table.ts:21",
+ "GET /api/extend/TableExample/{}": "api/extend/table.ts:25",
+ "GET /api/extend/TableExample/{}/Actions/Postil": "api/extend/table.ts:41",
+ "GET /api/extend/saleOrder/Classify": "api/extend/saleOrder.ts:33",
+ "GET /api/extend/saleOrder/Customer": "api/extend/saleOrder.ts:29",
+ "GET /api/extend/saleOrder/Goods": "api/extend/saleOrder.ts:37",
+ "GET /api/extend/saleOrder/Goods/Selector": "api/extend/saleOrder.ts:49",
+ "GET /api/extend/saleOrder/Goods/getGoodList": "api/extend/saleOrder.ts:41",
+ "GET /api/extend/saleOrder/Product": "api/extend/saleOrder.ts:9",
+ "GET /api/extend/saleOrder/Product/ProductEntry/{}": "api/extend/saleOrder.ts:45",
+ "GET /api/extend/saleOrder/Product/{}": "api/extend/saleOrder.ts:13",
+ "POST /api/extend/BigData": "api/extend/bigData.ts:13",
+ "POST /api/extend/Email": "api/extend/email.ts:25",
+ "POST /api/extend/Email/Actions/SaveDraft": "api/extend/email.ts:29",
+ "POST /api/extend/Email/Config/Actions/CheckMail": "api/extend/email.ts:21",
+ "POST /api/extend/Email/Receive": "api/extend/email.ts:57",
+ "POST /api/extend/Employee/ImportData": "api/extend/employee.ts:25",
+ "POST /api/extend/ProjectGantt": "api/extend/projectGantt.ts:13",
+ "POST /api/extend/ProjectGantt/Task": "api/extend/projectGantt.ts:41",
+ "POST /api/extend/TableExample": "api/extend/table.ts:13",
+ "POST /api/extend/TableExample/{}/Postil": "api/extend/table.ts:45",
+ "POST /api/extend/saleOrder/Product": "api/extend/saleOrder.ts:17",
+ "PUT /api/extend/Email/Config": "api/extend/email.ts:17",
+ "PUT /api/extend/Email/{}/Actions/Read": "api/extend/email.ts:41",
+ "PUT /api/extend/Email/{}/Actions/Star": "api/extend/email.ts:49",
+ "PUT /api/extend/Email/{}/Actions/Unread": "api/extend/email.ts:45",
+ "PUT /api/extend/Email/{}/Actions/Unstar": "api/extend/email.ts:53",
+ "PUT /api/extend/ProjectGantt/Task/{}": "api/extend/projectGantt.ts:45",
+ "PUT /api/extend/ProjectGantt/{}": "api/extend/projectGantt.ts:17",
+ "PUT /api/extend/TableExample/UpdateSign/{}": "api/extend/table.ts:57",
+ "PUT /api/extend/TableExample/{}": "api/extend/table.ts:53",
+ "PUT /api/extend/TableExample/{}/Actions/RowsEdit": "api/extend/table.ts:37",
+ "PUT /api/extend/saleOrder/Product/{}": "api/extend/saleOrder.ts:21"
+ },
+ "teamwork": {
+ "DELETE /api/file/DocumentSpace/{}": "api/teamwork/documentSpace.ts:21",
+ "DELETE /api/system/Schedule/{}/{}": "api/teamwork/schedule.ts:21",
+ "GET /api/file/Document": "api/teamwork/document.ts:11",
+ "GET /api/file/Document/Detail": "api/teamwork/document.ts:43",
+ "GET /api/file/Document/Share": "api/teamwork/document.ts:67",
+ "GET /api/file/Document/ShareTome": "api/teamwork/document.ts:75",
+ "GET /api/file/Document/ShareUser/{}": "api/teamwork/document.ts:79",
+ "GET /api/file/Document/Trash": "api/teamwork/document.ts:83",
+ "GET /api/file/Document/getIcon": "api/teamwork/document.ts:107",
+ "GET /api/file/Document/list": "api/teamwork/document.ts:15",
+ "GET /api/file/Document/recent": "api/teamwork/document.ts:71",
+ "GET /api/file/Document/{}": "api/teamwork/document.ts:39",
+ "GET /api/file/DocumentSpace": "api/teamwork/documentSpace.ts:9",
+ "GET /api/file/DocumentSpace/Selector": "api/teamwork/documentSpace.ts:17",
+ "GET /api/file/DocumentSpace/getDocumentList": "api/teamwork/documentSpace.ts:13",
+ "GET /api/file/DocumentSpace/{}": "api/teamwork/documentSpace.ts:33",
+ "GET /api/system/Schedule": "api/teamwork/schedule.ts:9",
+ "GET /api/system/Schedule/detail": "api/teamwork/schedule.ts:29",
+ "GET /api/system/Schedule/{}": "api/teamwork/schedule.ts:25",
+ "POST /api/file/Document": "api/teamwork/document.ts:19",
+ "POST /api/file/Document/Actions/CancelShare": "api/teamwork/document.ts:55",
+ "POST /api/file/Document/Actions/Copy/{}": "api/teamwork/document.ts:51",
+ "POST /api/file/Document/Actions/Share": "api/teamwork/document.ts:59",
+ "POST /api/file/Document/Actions/ShareAdjustment/{}": "api/teamwork/document.ts:63",
+ "POST /api/file/Document/BatchDelete": "api/teamwork/document.ts:31",
+ "POST /api/file/Document/FolderTree": "api/teamwork/document.ts:35",
+ "POST /api/file/Document/PackDownload": "api/teamwork/document.ts:95",
+ "POST /api/file/Document/Trash": "api/teamwork/document.ts:87",
+ "POST /api/file/Document/Trash/Actions/Recovery": "api/teamwork/document.ts:91",
+ "POST /api/file/Document/UploadBlob": "api/teamwork/document.ts:103",
+ "POST /api/file/Document/merge": "api/teamwork/document.ts:99",
+ "POST /api/file/DocumentSpace": "api/teamwork/documentSpace.ts:25",
+ "POST /api/file/DocumentSpace/MoveOut": "api/teamwork/documentSpace.ts:41",
+ "POST /api/file/DocumentSpace/Release": "api/teamwork/documentSpace.ts:37",
+ "POST /api/system/Schedule": "api/teamwork/schedule.ts:13",
+ "PUT /api/file/Document/Actions/MoveTo/{}": "api/teamwork/document.ts:47",
+ "PUT /api/file/Document/tag": "api/teamwork/document.ts:23",
+ "PUT /api/file/Document/{}": "api/teamwork/document.ts:27",
+ "PUT /api/file/DocumentSpace/{}": "api/teamwork/documentSpace.ts:29",
+ "PUT /api/system/Schedule/{}/{}": "api/teamwork/schedule.ts:17"
+ }
+}
\ No newline at end of file
diff --git a/src/backend/db/schema.sql b/src/backend/db/schema.sql
index 699c27d..73cc4d1 100644
--- a/src/backend/db/schema.sql
+++ b/src/backend/db/schema.sql
@@ -3627,3 +3627,409 @@ CREATE TABLE workflow_version (
CREATE INDEX IF NOT EXISTS i_wlu_ftid ON workflow_launch_user(f_task_id);
CREATE INDEX IF NOT EXISTS i_wo_fni ON workflow_operator(f_node_id);
CREATE INDEX IF NOT EXISTS i_wr_fti ON workflow_record(f_task_id);
+
+-- ============================================================ 批次 22:extend 示例模块
+-- 🔴 官方 `jnpf-extend` 的示例业务表(Demo / CRM / 邮件 / 员工 / 甘特 / 控件示例 / 销售订单)。
+-- 🔴 金额与业务日期一律 **TEXT**:示例页只做展示,避免 numeric/timestamp 的绑定类型
+-- 转换(本仓 `$N::text` 参数进 NUMERIC 列会报错)。审计列仍用 TIMESTAMP。
+
+CREATE TABLE ext_big_data (
+ f_id VARCHAR(50) NOT NULL,
+ f_full_name VARCHAR(200),
+ f_remark TEXT,
+ f_num INTEGER,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_customer (
+ f_id VARCHAR(50) NOT NULL,
+ f_customer_name VARCHAR(200),
+ f_contact VARCHAR(100),
+ f_phone VARCHAR(50),
+ f_address VARCHAR(500),
+ f_industry VARCHAR(100),
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_goods_classify (
+ f_id VARCHAR(50) NOT NULL,
+ f_full_name VARCHAR(200),
+ f_parent_id VARCHAR(50),
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_goods (
+ f_id VARCHAR(50) NOT NULL,
+ f_goods_name VARCHAR(200),
+ f_classify_id VARCHAR(50),
+ f_price VARCHAR(50),
+ f_stock INTEGER,
+ f_unit VARCHAR(50),
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_crm_order (
+ f_id VARCHAR(50) NOT NULL,
+ f_order_no VARCHAR(100),
+ f_customer_id VARCHAR(50),
+ f_customer_name VARCHAR(200),
+ f_order_date VARCHAR(50),
+ f_total VARCHAR(50),
+ f_status INTEGER,
+ f_remark TEXT,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_crm_order_entry (
+ f_id VARCHAR(50) NOT NULL,
+ f_order_id VARCHAR(50),
+ f_goods_id VARCHAR(50),
+ f_goods_name VARCHAR(200),
+ f_qty INTEGER,
+ f_price VARCHAR(50),
+ f_amount VARCHAR(50),
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_crm_collection_plan (
+ f_id VARCHAR(50) NOT NULL,
+ f_order_id VARCHAR(50),
+ f_plan_date VARCHAR(50),
+ f_amount VARCHAR(50),
+ f_status INTEGER,
+ f_remark TEXT,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_email (
+ f_id VARCHAR(50) NOT NULL,
+ f_subject VARCHAR(500),
+ f_body TEXT,
+ f_sender VARCHAR(200),
+ f_receiver VARCHAR(2000),
+ f_mail_type INTEGER,
+ f_is_read INTEGER,
+ f_is_star INTEGER,
+ f_send_time VARCHAR(50),
+ f_attachments TEXT,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_email_config (
+ f_id VARCHAR(50) NOT NULL,
+ f_email VARCHAR(200),
+ f_password VARCHAR(500),
+ f_smtp_host VARCHAR(200),
+ f_smtp_port INTEGER,
+ f_imap_host VARCHAR(200),
+ f_imap_port INTEGER,
+ f_ssl INTEGER,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_employee (
+ f_id VARCHAR(50) NOT NULL,
+ f_employee_no VARCHAR(50),
+ f_full_name VARCHAR(200),
+ f_gender INTEGER,
+ f_dept VARCHAR(200),
+ f_position VARCHAR(200),
+ f_phone VARCHAR(50),
+ f_email VARCHAR(200),
+ f_entry_date VARCHAR(50),
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_project (
+ f_id VARCHAR(50) NOT NULL,
+ f_project_name VARCHAR(200),
+ f_manager VARCHAR(100),
+ f_start_date VARCHAR(50),
+ f_end_date VARCHAR(50),
+ f_status INTEGER,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_project_task (
+ f_id VARCHAR(50) NOT NULL,
+ f_project_id VARCHAR(50),
+ f_parent_id VARCHAR(50),
+ f_task_name VARCHAR(200),
+ f_start_date VARCHAR(50),
+ f_end_date VARCHAR(50),
+ f_progress INTEGER,
+ f_assignee VARCHAR(100),
+ f_status INTEGER,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_table_example (
+ f_id VARCHAR(50) NOT NULL,
+ f_full_name VARCHAR(200),
+ f_type INTEGER,
+ f_industry VARCHAR(100),
+ f_city VARCHAR(200),
+ f_sign VARCHAR(100),
+ f_rows_json TEXT,
+ f_postil_json TEXT,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_sale_product (
+ f_id VARCHAR(50) NOT NULL,
+ f_order_no VARCHAR(100),
+ f_customer_id VARCHAR(50),
+ f_customer_name VARCHAR(200),
+ f_order_date VARCHAR(50),
+ f_total VARCHAR(50),
+ f_status INTEGER,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_sale_product_entry (
+ f_id VARCHAR(50) NOT NULL,
+ f_order_id VARCHAR(50),
+ f_goods_id VARCHAR(50),
+ f_goods_name VARCHAR(200),
+ f_qty INTEGER,
+ f_price VARCHAR(50),
+ f_amount VARCHAR(50),
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+-- ============================================================ 批次 23:teamwork(文件 / 日程)
+-- 🔴 官方 `jnpf-file` 的 `DocumentController` / `DocumentSpaceController` 两张表 + 分享关系表。
+-- 🔴 **文件字节不落库也不落盘**(本仓没有 onlyoffice / 对象存储):只存元数据;
+-- 上传 / 打包下载 / 合并分片如实失败,见 `compat/teamwork.rs` 模块头。
+
+CREATE TABLE ext_document (
+ f_id VARCHAR(50) NOT NULL,
+ f_parent_id VARCHAR(50),
+ f_space_id VARCHAR(50),
+ f_type INTEGER,
+ f_full_name VARCHAR(500),
+ f_file_path VARCHAR(2000),
+ f_file_size VARCHAR(50),
+ f_file_extension VARCHAR(50),
+ f_read_count INTEGER,
+ f_is_share INTEGER,
+ f_share_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_uploader_url VARCHAR(2000),
+ f_tag_id VARCHAR(50),
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_document_space (
+ f_id VARCHAR(50) NOT NULL,
+ f_type INTEGER,
+ f_full_name VARCHAR(200),
+ f_download_authority INTEGER,
+ f_upload_authority INTEGER,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
+
+CREATE TABLE ext_document_share (
+ f_id VARCHAR(50) NOT NULL,
+ f_document_id VARCHAR(50),
+ f_user_id VARCHAR(50),
+ f_share_type INTEGER,
+ f_description VARCHAR(500),
+ f_enabled_mark INTEGER,
+ f_sort_code BIGINT,
+ f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_creator_user_id VARCHAR(50),
+ f_last_modify_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_last_modify_user_id VARCHAR(50),
+ f_delete_time TIMESTAMP(0) WITHOUT TIME ZONE,
+ f_delete_user_id VARCHAR(50),
+ f_delete_mark INTEGER,
+ f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (f_id, f_tenant_id)
+);
diff --git a/src/backend/src/main.rs b/src/backend/src/main.rs
index 2112bd4..758c6b5 100644
--- a/src/backend/src/main.rs
+++ b/src/backend/src/main.rs
@@ -899,12 +899,20 @@ fn whitelist_self_check() -> Result<(), String> {
// 清单真源在 `sspf_store::db::WORKFLOW_TABLES`。
let workflow_tables = ssw_platform::platform::db::WORKFLOW_TABLES;
+ // 🔴 **extend 示例 / teamwork 文件**(批次 22–23):官方 `jnpf-extend` 与
+ // `jnpf-file` 的落库载体,既不是 `base_*` 平台表、也不是业务 spec 表。
+ // 清单真源在 `sspf_store::db::{EXTEND_TABLES, TEAMWORK_TABLES}`。
+ let extend_tables = ssw_platform::platform::db::EXTEND_TABLES;
+ let teamwork_tables = ssw_platform::platform::db::TEAMWORK_TABLES;
+
for table in &ddl_tables {
if !BASE_TABLES.contains(&table.as_str())
&& !spec_tables.contains(&table.as_str())
&& !pack_tables.contains(&table.as_str())
&& !report_tables.contains(&table.as_str())
&& !workflow_tables.contains(&table.as_str())
+ && !extend_tables.contains(&table.as_str())
+ && !teamwork_tables.contains(&table.as_str())
{
return Err(format!(
"schema.sql 里的表 {table} 既不是 base_* 表、也没有对应的业务 spec(孤儿 DDL?)"
diff --git a/src/backend/src/platform/compat/ai.rs b/src/backend/src/platform/compat/ai.rs
new file mode 100644
index 0000000..7c6b926
--- /dev/null
+++ b/src/backend/src/platform/compat/ai.rs
@@ -0,0 +1,1837 @@
+//! ai —— 官方面 B 的 **AI 中心**端点集(`/api/ai/*`,75 条)。
+//!
+//! 真源:官方 `jnpf-ai-v3` Controller + 官方前端 `src/api/aiCenter/**`。
+//!
+//! 🔴 **本模块只做「能真做」的部分**:
+//! | 能力 | 本仓状态 |
+//! |---|---|
+//! | 智能体 / 供应商 / 模型 / 知识库 / 文档 / MCP / 提示词 / 服务 / 技能 / 工具 | **真落库**到官方 `base_ai_*` 表 |
+//! | 会话历史 | **真落库**(`base_ai_agent_history`) |
+//! | 文档切片 / 关键词召回 | **真做**(本地切分 + ILIKE,无向量库) |
+//! | 调模型推理 / 供应商连通性检查 / MCP 工具同步 | **明确业务失败**(本仓无 HTTP 客户端) |
+//!
+//! 🔴 **守卫**:官方每条都是 `@SaCheckPermission("aiCenter.*")`,但本仓**没有**
+//! AI 中心的菜单与权限点种子 ⇒ 用「登录」守卫(`require_login_face_b`)。
+//! 这是**如实降级**,不是遗漏;集成期补菜单种子后改回 `guard(...)` 即可。
+
+use axum::body::Bytes;
+use axum::extract::{Path, RawQuery, State};
+use axum::http::HeaderMap;
+use axum::Json;
+use serde_json::{json, Map, Value};
+
+use crate::platform::auth::require_login_face_b;
+use crate::platform::envelope::{code, fail, ok, ActionResult};
+use crate::platform::state::AppState;
+
+use super::helper::{db_error, params_of, parse_body, qv};
+use super::res::{self, i, j, t, Res};
+
+// ================================================================ 资源声明
+
+const AGENT: Res = Res {
+ table: "base_ai_agent",
+ fields: &[
+ t("fullName", "f_full_name"),
+ t("icon", "f_icon"),
+ t("iconBackground", "f_icon_background"),
+ i("type", "f_type"),
+ i("state", "f_state"),
+ t("versionId", "f_version_id"),
+ t("description", "f_description"),
+ i("sortCode", "f_sort_code"),
+ i("enabledMark", "f_enabled_mark"),
+ ],
+ keyword: &["f_full_name"],
+ order: "COALESCE(f_sort_code, 0) ASC, f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+const SUPPLIER: Res = Res {
+ table: "base_ai_supplier",
+ fields: &[
+ t("fullName", "f_full_name"),
+ t("enCode", "f_en_code"),
+ t("url", "f_url"),
+ t("credential", "f_credential"),
+ t("icon", "f_icon"),
+ t("backgroundColor", "f_background_color"),
+ t("description", "f_description"),
+ i("sortCode", "f_sort_code"),
+ i("enabledMark", "f_enabled_mark"),
+ ],
+ keyword: &["f_full_name", "f_en_code"],
+ order: "COALESCE(f_sort_code, 0) ASC, f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+const MODEL: Res = Res {
+ table: "base_ai_model",
+ fields: &[
+ t("supplierId", "f_supplier_id"),
+ t("fullName", "f_full_name"),
+ t("model", "f_model"),
+ t("type", "f_type"),
+ t("vectorTableName", "f_vector_table_name"),
+ t("description", "f_description"),
+ i("sortCode", "f_sort_code"),
+ i("enabledMark", "f_enabled_mark"),
+ ],
+ keyword: &["f_full_name", "f_model"],
+ order: "COALESCE(f_sort_code, 0) ASC, f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+const PROMPT: Res = Res {
+ table: "base_ai_agent_prompt",
+ fields: &[
+ t("fullName", "f_full_name"),
+ t("callWord", "f_call_word"),
+ i("type", "f_type"),
+ t("description", "f_description"),
+ i("sortCode", "f_sort_code"),
+ i("enabledMark", "f_enabled_mark"),
+ ],
+ keyword: &["f_full_name", "f_call_word"],
+ order: "COALESCE(f_sort_code, 0) ASC, f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+const KNOWLEDGE: Res = Res {
+ table: "base_ai_knowledge",
+ fields: &[
+ t("modelId", "f_model_id"),
+ t("supplierId", "f_supplier_id"),
+ t("fullName", "f_full_name"),
+ t("icon", "f_icon"),
+ t("iconBackground", "f_icon_background"),
+ i("way", "f_way"),
+ j("wayJson", "f_way_json"),
+ t("description", "f_description"),
+ i("sortCode", "f_sort_code"),
+ i("enabledMark", "f_enabled_mark"),
+ ],
+ keyword: &["f_full_name"],
+ order: "COALESCE(f_sort_code, 0) ASC, f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+const DOCUMENT: Res = Res {
+ table: "base_ai_document",
+ fields: &[
+ t("knowledgeId", "f_knowledge_id"),
+ t("fullName", "f_full_name"),
+ t("fileSize", "f_file_size"),
+ t("filePath", "f_file_path"),
+ t("url", "f_url"),
+ i("num", "f_num"),
+ i("way", "f_way"),
+ j("wayJson", "f_way_json"),
+ i("type", "f_type"),
+ i("state", "f_state"),
+ i("sortCode", "f_sort_code"),
+ i("enabledMark", "f_enabled_mark"),
+ ],
+ keyword: &["f_full_name"],
+ order: "f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+const MCP: Res = Res {
+ table: "base_ai_mcp",
+ fields: &[
+ t("fullName", "f_full_name"),
+ t("icon", "f_icon"),
+ i("mcpType", "f_mcp_type"),
+ j("mcpJson", "f_mcp_json"),
+ i("num", "f_num"),
+ i("state", "f_state"),
+ t("description", "f_description"),
+ i("sortCode", "f_sort_code"),
+ i("enabledMark", "f_enabled_mark"),
+ ],
+ keyword: &["f_full_name"],
+ order: "COALESCE(f_sort_code, 0) ASC, f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+const SERVE: Res = Res {
+ table: "base_ai_serve",
+ fields: &[
+ t("agentId", "f_agent_id"),
+ t("enCode", "f_en_code"),
+ t("fullName", "f_full_name"),
+ i("type", "f_type"),
+ t("description", "f_description"),
+ i("sortCode", "f_sort_code"),
+ i("enabledMark", "f_enabled_mark"),
+ ],
+ keyword: &["f_full_name", "f_en_code"],
+ order: "COALESCE(f_sort_code, 0) ASC, f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+const SKILLS: Res = Res {
+ table: "base_ai_skills",
+ fields: &[
+ t("fullName", "f_full_name"),
+ t("enCode", "f_en_code"),
+ t("icon", "f_icon"),
+ j("skillsJson", "f_skills_json"),
+ t("description", "f_description"),
+ i("sortCode", "f_sort_code"),
+ i("enabledMark", "f_enabled_mark"),
+ ],
+ keyword: &["f_full_name", "f_en_code"],
+ order: "COALESCE(f_sort_code, 0) ASC, f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+const TOOL: Res = Res {
+ table: "base_ai_tool",
+ fields: &[
+ t("fullName", "f_full_name"),
+ t("enCode", "f_en_code"),
+ t("icon", "f_icon"),
+ j("toolJson", "f_tool_json"),
+ t("description", "f_description"),
+ i("sortCode", "f_sort_code"),
+ i("enabledMark", "f_enabled_mark"),
+ ],
+ keyword: &["f_full_name", "f_en_code"],
+ order: "COALESCE(f_sort_code, 0) ASC, f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+const VERSION: Res = Res {
+ table: "base_ai_agent_version",
+ fields: &[
+ t("agentId", "f_agent_id"),
+ t("modelId", "f_model_id"),
+ t("version", "f_version"),
+ j("configJson", "f_config_json"),
+ j("chartJson", "f_chart_json"),
+ j("knowledgeJson", "f_knowledge_json"),
+ j("skillJson", "f_skill_json"),
+ t("callWord", "f_call_word"),
+ i("state", "f_status"),
+ t("description", "f_description"),
+ i("sortCode", "f_sort_code"),
+ ],
+ keyword: &["f_version"],
+ order: "f_creator_time DESC NULLS LAST",
+ scope: "",
+};
+
+
+/// 列表/详情里**不下发** `f_credential`(供应商密钥)。
+///
+/// 🔴 官方列表也会把 credential 带出去,但那是「同一后台管理员可见」的假设;
+/// 本仓没有 AI 菜单权限点(守卫只到「登录」)⇒ **不能把密钥发给任何登录用户**。
+fn mask_supplier(mut row: Value) -> Value {
+ if let Some(obj) = row.as_object_mut() {
+ if obj.contains_key("credential") {
+ let configured = obj
+ .get("credential")
+ .and_then(Value::as_str)
+ .map(|s| !s.trim().is_empty())
+ .unwrap_or(false);
+ obj.insert("credential".into(), Value::String(String::new()));
+ obj.insert("credentialConfigured".into(), Value::Bool(configured));
+ }
+ }
+ row
+}
+
+fn mask_suppliers(v: Value) -> Value {
+ match v {
+ Value::Array(items) => Value::Array(items.into_iter().map(mask_supplier).collect()),
+ Value::Object(mut o) => {
+ if let Some(list) = o.get_mut("list") {
+ let taken = std::mem::replace(list, Value::Null);
+ *list = mask_suppliers(taken);
+ } else {
+ return mask_supplier(Value::Object(o));
+ }
+ Value::Object(o)
+ }
+ other => other,
+ }
+}
+
+// ================================================================ Agent
+
+pub async fn agent_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let filters = vec![
+ res::filter(&raw, "type", "f_type"),
+ res::filter(&raw, "state", "f_state"),
+ ];
+ res::list_json(&state, &AGENT, &raw, filters).await
+}
+
+pub async fn agent_selector(
+ State(state): State,
+ headers: HeaderMap,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ match res::all(&state.db, &AGENT).await {
+ Ok(list) => ok(super::helper::list_vo(list)),
+ Err(e) => db_error(e, "智能体下拉"),
+ }
+}
+
+pub async fn agent_create(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::create_json(&state, &AGENT, &body, &user.account).await
+}
+
+pub async fn agent_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::info_json(&state, &AGENT, &id).await
+}
+
+pub async fn agent_update(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::update_json(&state, &AGENT, &id, &body, &user.account).await
+}
+
+pub async fn agent_delete(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ // 智能体删除时把它的版本一起软删(否则版本表留孤儿行)。
+ if let Err(e) = state
+ .db
+ .exec_params(
+ "UPDATE base_ai_agent_version SET f_delete_mark = 1, f_delete_time = now() \
+ WHERE f_agent_id = $1::text AND COALESCE(f_delete_mark, 0) = 0",
+ &[&id.trim()],
+ )
+ .await
+ {
+ return db_error(e, "删除智能体版本");
+ }
+ res::delete_json(&state, &AGENT, &id).await
+}
+
+/// `POST /api/ai/Agent/{id}/Actions/Copy` —— 复制智能体(含最新版本)。
+pub async fn agent_copy(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ let Some(src) = (match res::get(&state.db, &AGENT, &id).await {
+ Ok(v) => v,
+ Err(e) => return db_error(e, "智能体查询"),
+ }) else {
+ return fail(code::FAIL, "智能体不存在");
+ };
+ let mut obj: Map = src.as_object().cloned().unwrap_or_default();
+ obj.remove("id");
+ obj.remove("versionId");
+ let name = obj
+ .get("fullName")
+ .and_then(Value::as_str)
+ .unwrap_or("智能体")
+ .to_string();
+ obj.insert("fullName".into(), json!(format!("{name}副本")));
+ obj.insert("state".into(), json!(0));
+
+ let new_id = match res::create(&state.db, &AGENT, &obj, &user.account).await {
+ Ok(v) => v,
+ Err(e) => return db_error(e, "复制智能体"),
+ };
+
+ // 复制它最新的一个版本(没有版本也允许,前端会新建)。
+ if let Ok(rows) = state
+ .db
+ .query_json_params(
+ "SELECT f_id AS \"id\" FROM base_ai_agent_version \
+ WHERE f_agent_id = $1::text AND COALESCE(f_delete_mark, 0) = 0 \
+ ORDER BY f_creator_time DESC NULLS LAST LIMIT 1",
+ &[&id.trim()],
+ )
+ .await
+ {
+ if let Some(vid) = rows.first().and_then(|r| r.get("id")).and_then(Value::as_str) {
+ if let Ok(Some(v)) = res::get(&state.db, &VERSION, vid).await {
+ let mut vo: Map = v.as_object().cloned().unwrap_or_default();
+ vo.remove("id");
+ vo.insert("agentId".into(), json!(new_id));
+ vo.insert("state".into(), json!(0));
+ if let Ok(nv) = res::create(&state.db, &VERSION, &vo, &user.account).await {
+ let _ = state
+ .db
+ .exec_params(
+ "UPDATE base_ai_agent SET f_version_id = $1::text WHERE f_id = $2::text",
+ &[&nv, &new_id],
+ )
+ .await;
+ }
+ }
+ }
+ }
+ ok(json!({ "id": new_id }))
+}
+
+/// `POST /api/ai/Agent/Save` —— 保存智能体**版本**(新建或更新)。
+pub async fn agent_save_version(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ let obj = match parse_body(&body) {
+ Ok(Value::Object(o)) => o,
+ Ok(_) => return fail(code::FAIL, "请求参数格式错误"),
+ Err(resp) => return resp,
+ };
+ let agent_id = obj
+ .get("agentId")
+ .and_then(Value::as_str)
+ .map(str::trim)
+ .unwrap_or_default()
+ .to_string();
+ if agent_id.is_empty() {
+ return fail(code::FAIL, "智能体 id 不能为空");
+ }
+ let existed = match res::get(&state.db, &AGENT, &agent_id).await {
+ Ok(Some(v)) => v,
+ Ok(None) => return fail(code::FAIL, "智能体不存在"),
+ Err(e) => return db_error(e, "智能体查询"),
+ };
+
+ let version_id = obj
+ .get("id")
+ .and_then(Value::as_str)
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+ .map(str::to_string);
+
+ let vid = match version_id {
+ Some(vid) => match res::update(&state.db, &VERSION, &vid, &obj, &user.account).await {
+ Ok(true) => vid,
+ Ok(false) => return fail(code::FAIL, "版本不存在"),
+ Err(e) => return db_error(e, "更新版本"),
+ },
+ None => {
+ let mut vo = obj.clone();
+ vo.remove("id");
+ let seq = state
+ .db
+ .query_json_params(
+ "SELECT COUNT(*)::bigint AS \"n\" FROM base_ai_agent_version \
+ WHERE f_agent_id = $1::text AND COALESCE(f_delete_mark, 0) = 0",
+ &[&agent_id],
+ )
+ .await
+ .ok()
+ .and_then(|rows| rows.first().and_then(|r| r.get("n")).and_then(Value::as_i64))
+ .unwrap_or(0)
+ + 1;
+ vo.insert("version".into(), json!(format!("V{seq}")));
+ vo.insert("state".into(), json!(1));
+ match res::create(&state.db, &VERSION, &vo, &user.account).await {
+ Ok(v) => v,
+ Err(e) => return db_error(e, "新建版本"),
+ }
+ }
+ };
+
+ // 版本落定后回写智能体的 versionId + state=1(与官方「保存即发布草稿」一致)。
+ if let Err(e) = state
+ .db
+ .exec_params(
+ "UPDATE base_ai_agent SET f_version_id = $1::text, f_state = 1, \
+ f_last_modify_time = now(), f_last_modify_user_id = $2::text WHERE f_id = $3::text",
+ &[&vid, &user.account, &agent_id],
+ )
+ .await
+ {
+ return db_error(e, "回写智能体版本");
+ }
+ let _ = existed;
+ ok(json!({ "id": vid, "agentId": agent_id }))
+}
+
+pub async fn agent_version_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::info_json(&state, &VERSION, &id).await
+}
+
+pub async fn agent_version_list(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ match state
+ .db
+ .query_json_params(
+ "SELECT f_id AS \"id\", f_agent_id AS \"agentId\", f_model_id AS \"modelId\", \
+ f_version AS \"version\", f_config_json AS \"configJson\", \
+ f_chart_json AS \"chartJson\", f_knowledge_json AS \"knowledgeJson\", \
+ f_skill_json AS \"skillJson\", f_call_word AS \"callWord\", \
+ COALESCE(f_status, 0)::bigint AS \"state\", \
+ (EXTRACT(EPOCH FROM f_creator_time) * 1000)::bigint AS \"creatorTime\" \
+ FROM base_ai_agent_version \
+ WHERE f_agent_id = $1::text AND COALESCE(f_delete_mark, 0) = 0 \
+ ORDER BY f_creator_time DESC NULLS LAST",
+ &[&id.trim()],
+ )
+ .await
+ {
+ // 前端把 `res.data` 当**数组**用(`state.versionList = res.data || []`)。
+ Ok(rows) => ok(json!(rows)),
+ Err(e) => db_error(e, "版本列表"),
+ }
+}
+
+pub async fn agent_version_delete(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::delete_json(&state, &VERSION, &id).await
+}
+
+/// `POST /api/ai/Agent/Info/{id}` —— 复制版本。
+pub async fn agent_version_copy(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ let Some(src) = (match res::get(&state.db, &VERSION, &id).await {
+ Ok(v) => v,
+ Err(e) => return db_error(e, "版本查询"),
+ }) else {
+ return fail(code::FAIL, "版本不存在");
+ };
+ let mut obj: Map = src.as_object().cloned().unwrap_or_default();
+ obj.remove("id");
+ let old = obj
+ .get("version")
+ .and_then(Value::as_str)
+ .unwrap_or("V0")
+ .to_string();
+ obj.insert("version".into(), json!(format!("{old}.copy")));
+ obj.insert("state".into(), json!(0));
+ match res::create(&state.db, &VERSION, &obj, &user.account).await {
+ Ok(v) => ok(json!({ "id": v })),
+ Err(e) => db_error(e, "复制版本"),
+ }
+}
+
+// ================================================================ AiSupplier
+
+pub async fn supplier_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let Json(mut body) = res::list_json(&state, &SUPPLIER, &raw, vec![]).await;
+ body.data = mask_suppliers(body.data);
+ Json(body)
+}
+
+pub async fn supplier_selector(
+ State(state): State,
+ headers: HeaderMap,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ match res::all(&state.db, &SUPPLIER).await {
+ Ok(list) => ok(super::helper::list_vo(
+ list.into_iter().map(mask_supplier).collect(),
+ )),
+ Err(e) => db_error(e, "供应商下拉"),
+ }
+}
+
+pub async fn supplier_create(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::create_json(&state, &SUPPLIER, &body, &user.account).await
+}
+
+pub async fn supplier_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let Json(mut body) = res::info_json(&state, &SUPPLIER, &id).await;
+ body.data = mask_suppliers(body.data);
+ Json(body)
+}
+
+pub async fn supplier_update(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::update_json(&state, &SUPPLIER, &id, &body, &user.account).await
+}
+
+pub async fn supplier_delete(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::delete_json(&state, &SUPPLIER, &id).await
+}
+
+/// `POST /api/ai/AiSupplier/checkAi` —— 连通性检查。
+///
+/// 🔴 **本仓无 HTTP 客户端**(`src/backend/Cargo.toml` 没有 reqwest)⇒ 明确失败。
+/// 不返「成功」:前端会据此把供应商标成「可用」,那是假信号。
+pub async fn supplier_check(
+ State(state): State,
+ headers: HeaderMap,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ fail(
+ code::FAIL,
+ "本仓未接入 HTTP 客户端:无法向供应商发起连通性检查(集成期补)",
+ )
+}
+
+// ================================================================ Model
+
+pub async fn model_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let filters = vec![res::filter(&raw, "supplierId", "f_supplier_id")];
+ res::list_json(&state, &MODEL, &raw, filters).await
+}
+
+pub async fn model_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::info_json(&state, &MODEL, &id).await
+}
+
+pub async fn model_update(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::update_json(&state, &MODEL, &id, &body, &user.account).await
+}
+
+// ================================================================ Prompt
+
+pub async fn prompt_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let filters = vec![res::filter(&raw, "type", "f_type")];
+ res::list_json(&state, &PROMPT, &raw, filters).await
+}
+
+pub async fn prompt_create(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::create_json(&state, &PROMPT, &body, &user.account).await
+}
+
+pub async fn prompt_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::info_json(&state, &PROMPT, &id).await
+}
+
+pub async fn prompt_update(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::update_json(&state, &PROMPT, &id, &body, &user.account).await
+}
+
+pub async fn prompt_delete(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::delete_json(&state, &PROMPT, &id).await
+}
+
+// ================================================================ Knowledge
+
+pub async fn knowledge_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::list_json(&state, &KNOWLEDGE, &raw, vec![]).await
+}
+
+pub async fn knowledge_selector(
+ State(state): State,
+ headers: HeaderMap,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ match res::all(&state.db, &KNOWLEDGE).await {
+ Ok(list) => ok(super::helper::list_vo(list)),
+ Err(e) => db_error(e, "知识库下拉"),
+ }
+}
+
+pub async fn knowledge_create(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::create_json(&state, &KNOWLEDGE, &body, &user.account).await
+}
+
+pub async fn knowledge_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::info_json(&state, &KNOWLEDGE, &id).await
+}
+
+pub async fn knowledge_update(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::update_json(&state, &KNOWLEDGE, &id, &body, &user.account).await
+}
+
+pub async fn knowledge_delete(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ // 知识库删除时把文档一起软删。
+ if let Err(e) = state
+ .db
+ .exec_params(
+ "UPDATE base_ai_document SET f_delete_mark = 1, f_delete_time = now() \
+ WHERE f_knowledge_id = $1::text AND COALESCE(f_delete_mark, 0) = 0",
+ &[&id.trim()],
+ )
+ .await
+ {
+ return db_error(e, "删除知识库文档");
+ }
+ res::delete_json(&state, &KNOWLEDGE, &id).await
+}
+
+/// `POST /api/ai/Knowledge/getListByIds` —— 按 id 批量取(智能体绑定回显)。
+pub async fn knowledge_by_ids(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let ids = match ids_of(&body) {
+ Ok(v) => v,
+ Err(resp) => return resp,
+ };
+ match res::by_ids(&state.db, &KNOWLEDGE, &ids).await {
+ Ok(list) => ok(json!(list)),
+ Err(e) => db_error(e, "按 id 查知识库"),
+ }
+}
+
+/// `GET /api/ai/Knowledge/Relation/{id}` —— 哪些智能体绑了这个知识库。
+pub async fn knowledge_relation(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ match state
+ .db
+ .query_json_params(
+ "SELECT a.f_id AS \"id\", a.f_full_name AS \"fullName\", a.f_icon AS \"icon\" \
+ FROM base_ai_agent a JOIN base_ai_agent_version v ON v.f_agent_id = a.f_id \
+ WHERE COALESCE(a.f_delete_mark, 0) = 0 AND COALESCE(v.f_delete_mark, 0) = 0 \
+ AND COALESCE(v.f_knowledge_json, '') ILIKE $1::text \
+ GROUP BY a.f_id, a.f_full_name, a.f_icon ORDER BY a.f_full_name ASC",
+ &[&format!("%{id}%")],
+ )
+ .await
+ {
+ Ok(list) => ok(json!(list)),
+ Err(e) => db_error(e, "知识库关联查询"),
+ }
+}
+
+/// `POST /api/ai/Knowledge/{id}/Test` —— 召回测试。
+///
+/// 🔴 本仓**无向量库** ⇒ 用**关键词匹配**(文档正文/文件名 ILIKE),返回带命中片段的
+/// 真实结果;`score` 是命中词数占比(不是向量相似度,字段名沿用官方)。
+pub async fn knowledge_test(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let obj = match parse_body(&body) {
+ Ok(Value::Object(o)) => o,
+ Ok(_) => return fail(code::FAIL, "请求参数格式错误"),
+ Err(resp) => return resp,
+ };
+ let question = ["question", "keyword", "text", "content"]
+ .iter()
+ .find_map(|k| obj.get(*k).and_then(Value::as_str))
+ .unwrap_or_default()
+ .trim()
+ .to_string();
+ if question.is_empty() {
+ return fail(code::FAIL, "召回内容不能为空");
+ }
+ let docs = match state
+ .db
+ .query_json_params(
+ "SELECT f_id AS \"id\", f_full_name AS \"fullName\", \
+ COALESCE(f_way_json, '') AS \"content\" \
+ FROM base_ai_document \
+ WHERE f_knowledge_id = $1::text AND COALESCE(f_delete_mark, 0) = 0 \
+ ORDER BY f_creator_time DESC NULLS LAST LIMIT 200",
+ &[&id.trim()],
+ )
+ .await
+ {
+ Ok(v) => v,
+ Err(e) => return db_error(e, "召回查询"),
+ };
+ let words: Vec = question
+ .split_whitespace()
+ .filter(|w| !w.is_empty())
+ .map(|w| w.to_lowercase())
+ .collect();
+ let mut hits: Vec = Vec::new();
+ for doc in docs {
+ let text = doc
+ .get("content")
+ .and_then(Value::as_str)
+ .unwrap_or_default()
+ .to_lowercase();
+ let name = doc
+ .get("fullName")
+ .and_then(Value::as_str)
+ .unwrap_or_default()
+ .to_lowercase();
+ let hit = words
+ .iter()
+ .filter(|w| text.contains(w.as_str()) || name.contains(w.as_str()))
+ .count();
+ if hit == 0 {
+ continue;
+ }
+ let score = if words.is_empty() {
+ 0.0
+ } else {
+ hit as f64 / words.len() as f64
+ };
+ let snippet = snippet_of(
+ doc.get("content").and_then(Value::as_str).unwrap_or_default(),
+ &words,
+ );
+ hits.push(json!({
+ "id": doc.get("id").cloned().unwrap_or(Value::Null),
+ "fullName": doc.get("fullName").cloned().unwrap_or(Value::Null),
+ "content": snippet,
+ "score": (score * 100.0).round() / 100.0,
+ }));
+ }
+ hits.sort_by(|a, b| {
+ b.get("score")
+ .and_then(Value::as_f64)
+ .unwrap_or(0.0)
+ .partial_cmp(&a.get("score").and_then(Value::as_f64).unwrap_or(0.0))
+ .unwrap_or(std::cmp::Ordering::Equal)
+ });
+ ok(json!({ "list": hits, "total": hits.len() }))
+}
+
+/// 取命中词周围的一段文本(最多 200 字符)。
+fn snippet_of(text: &str, words: &[String]) -> String {
+ if text.is_empty() {
+ return String::new();
+ }
+ let lower = text.to_lowercase();
+ for w in words {
+ if let Some(pos) = lower.find(w.as_str()) {
+ let start = text[..pos].char_indices().rev().nth(60).map(|(i, _)| i).unwrap_or(0);
+ let tail: String = text[start..].chars().take(200).collect();
+ return tail;
+ }
+ }
+ text.chars().take(200).collect()
+}
+
+// ================================================================ Document
+
+pub async fn document_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let filters = vec![
+ res::filter(&raw, "knowledgeId", "f_knowledge_id"),
+ res::filter(&raw, "state", "f_state"),
+ ];
+ res::list_json(&state, &DOCUMENT, &raw, filters).await
+}
+
+pub async fn document_create(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::create_json(&state, &DOCUMENT, &body, &user.account).await
+}
+
+pub async fn document_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::info_json(&state, &DOCUMENT, &id).await
+}
+
+pub async fn document_update(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::update_json(&state, &DOCUMENT, &id, &body, &user.account).await
+}
+
+pub async fn document_delete(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::delete_json(&state, &DOCUMENT, &id).await
+}
+
+/// `GET /api/ai/Document/{id}/getText` —— 取正文(存在 `f_way_json.content` 里)。
+pub async fn document_text(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let Some(row) = (match res::get(&state.db, &DOCUMENT, &id).await {
+ Ok(v) => v,
+ Err(e) => return db_error(e, "文档查询"),
+ }) else {
+ return fail(code::FAIL, "文档不存在");
+ };
+ let raw = row
+ .get("wayJson")
+ .and_then(Value::as_str)
+ .unwrap_or_default();
+ let text = serde_json::from_str::(raw)
+ .ok()
+ .and_then(|v| {
+ v.get("content")
+ .or_else(|| v.get("text"))
+ .and_then(Value::as_str)
+ .map(str::to_string)
+ })
+ .unwrap_or_default();
+ ok(json!({ "text": text, "length": text.chars().count() }))
+}
+
+/// `POST /api/ai/Document/{id}/section` —— 文档切片。
+///
+/// 🔴 **真做**:按空行/换行切成段,写回 `f_num`(片数);不产生向量。
+pub async fn document_section(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ let obj = match parse_body(&body) {
+ Ok(Value::Object(o)) => o,
+ Ok(_) => return fail(code::FAIL, "请求参数格式错误"),
+ Err(resp) => return resp,
+ };
+ let text = obj
+ .get("text")
+ .or_else(|| obj.get("content"))
+ .and_then(Value::as_str)
+ .unwrap_or_default();
+ let sections = split_sections(text);
+ let count = sections.len() as i64;
+ let mut payload = Map::new();
+ payload.insert("text".into(), json!(text));
+ payload.insert("sections".into(), json!(sections));
+ if let Err(e) = state
+ .db
+ .exec_params(
+ "UPDATE base_ai_document SET f_num = $1::text::integer, f_way_json = $2::text, \
+ f_last_modify_time = now(), f_last_modify_user_id = $3::text \
+ WHERE f_id = $4::text AND COALESCE(f_delete_mark, 0) = 0",
+ &[
+ &count.to_string(),
+ &Value::Object(payload.clone()).to_string(),
+ &user.account,
+ &id.trim(),
+ ],
+ )
+ .await
+ {
+ return db_error(e, "文档切片");
+ }
+ ok(json!({ "id": id, "num": count, "sections": payload["sections"].clone() }))
+}
+
+/// `POST /api/ai/Document/{id}/study` —— 学习(本地切分 + 落 `f_state=1`)。
+pub async fn document_study(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ let obj = match parse_body(&body) {
+ Ok(Value::Object(o)) => o,
+ Ok(_) => return fail(code::FAIL, "请求参数格式错误"),
+ Err(resp) => return resp,
+ };
+ let text = obj
+ .get("text")
+ .or_else(|| obj.get("content"))
+ .and_then(Value::as_str)
+ .unwrap_or_default();
+ let sections = split_sections(text);
+ let payload = json!({ "text": text, "sections": sections, "engine": "local-keyword" });
+ if let Err(e) = state
+ .db
+ .exec_params(
+ "UPDATE base_ai_document SET f_state = 1, f_num = $1::text::integer, \
+ f_way_json = $2::text, f_last_modify_time = now(), \
+ f_last_modify_user_id = $3::text \
+ WHERE f_id = $4::text AND COALESCE(f_delete_mark, 0) = 0",
+ &[
+ §ions.len().to_string(),
+ &payload.to_string(),
+ &user.account,
+ &id.trim(),
+ ],
+ )
+ .await
+ {
+ return db_error(e, "文档学习");
+ }
+ ok(json!({
+ "id": id,
+ "num": sections.len(),
+ "engine": "local-keyword",
+ "msg": "已按关键词索引(本仓无向量库)",
+ }))
+}
+
+/// 按空行 / 单换行切片;空文本 ⇒ 空。过长段落按 800 字符再切。
+fn split_sections(text: &str) -> Vec {
+ let mut out: Vec = Vec::new();
+ for block in text.split('\n') {
+ let trimmed = block.trim();
+ if trimmed.is_empty() {
+ continue;
+ }
+ if trimmed.chars().count() <= 800 {
+ out.push(trimmed.to_string());
+ continue;
+ }
+ let mut buf = String::new();
+ for ch in trimmed.chars() {
+ buf.push(ch);
+ if buf.chars().count() >= 800 {
+ out.push(std::mem::take(&mut buf));
+ }
+ }
+ if !buf.trim().is_empty() {
+ out.push(buf);
+ }
+ }
+ out
+}
+
+// ================================================================ Mcp
+
+pub async fn mcp_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::list_json(&state, &MCP, &raw, vec![]).await
+}
+
+pub async fn mcp_selector(
+ State(state): State,
+ headers: HeaderMap,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ match res::all(&state.db, &MCP).await {
+ Ok(list) => ok(super::helper::list_vo(list)),
+ Err(e) => db_error(e, "MCP 下拉"),
+ }
+}
+
+pub async fn mcp_create(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::create_json(&state, &MCP, &body, &user.account).await
+}
+
+pub async fn mcp_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::info_json(&state, &MCP, &id).await
+}
+
+pub async fn mcp_update(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::update_json(&state, &MCP, &id, &body, &user.account).await
+}
+
+pub async fn mcp_delete(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ if let Err(e) = state
+ .db
+ .exec_params(
+ "UPDATE base_ai_mcp_tool SET f_delete_mark = 1, f_delete_time = now() \
+ WHERE f_mcp_id = $1::text AND COALESCE(f_delete_mark, 0) = 0",
+ &[&id.trim()],
+ )
+ .await
+ {
+ return db_error(e, "删除 MCP 工具");
+ }
+ res::delete_json(&state, &MCP, &id).await
+}
+
+pub async fn mcp_by_ids(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let ids = match ids_of(&body) {
+ Ok(v) => v,
+ Err(resp) => return resp,
+ };
+ match res::by_ids(&state.db, &MCP, &ids).await {
+ Ok(list) => ok(json!(list)),
+ Err(e) => db_error(e, "按 id 查 MCP"),
+ }
+}
+
+/// `GET /api/ai/Mcp/Sync/{id}` —— 同步 MCP 工具清单。
+///
+/// 🔴 需要**主动连 MCP 服务**(HTTP/stdio)⇒ 本仓无 HTTP 客户端,明确失败。
+pub async fn mcp_sync(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ match res::get(&state.db, &MCP, &id).await {
+ Ok(Some(_)) => {}
+ Ok(None) => return fail(code::FAIL, "MCP 不存在"),
+ Err(e) => return db_error(e, "MCP 查询"),
+ }
+ fail(
+ code::FAIL,
+ "本仓未接入 HTTP/stdio 客户端:无法连接 MCP 服务同步工具(集成期补)",
+ )
+}
+
+pub async fn mcp_tool_list(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ match state
+ .db
+ .query_json_params(
+ "SELECT f_id AS \"id\", f_mcp_id AS \"mcpId\", f_full_name AS \"fullName\", \
+ f_en_code AS \"enCode\", f_tool_json AS \"toolJson\", \
+ f_description AS \"description\" \
+ FROM base_ai_mcp_tool \
+ WHERE f_mcp_id = $1::text AND COALESCE(f_delete_mark, 0) = 0 \
+ ORDER BY f_full_name ASC",
+ &[&id.trim()],
+ )
+ .await
+ {
+ Ok(list) => ok(super::helper::list_vo(list)),
+ Err(e) => db_error(e, "MCP 工具列表"),
+ }
+}
+
+// ================================================================ Serve
+
+pub async fn serve_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let filters = vec![res::filter(&raw, "agentId", "f_agent_id")];
+ res::list_json(&state, &SERVE, &raw, filters).await
+}
+
+pub async fn serve_selector(
+ State(state): State,
+ headers: HeaderMap,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ match res::all(&state.db, &SERVE).await {
+ Ok(list) => ok(super::helper::list_vo(list)),
+ Err(e) => db_error(e, "服务下拉"),
+ }
+}
+
+pub async fn serve_create(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::create_json(&state, &SERVE, &body, &user.account).await
+}
+
+pub async fn serve_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::info_json(&state, &SERVE, &id).await
+}
+
+pub async fn serve_update(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+ body: Bytes,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ res::update_json(&state, &SERVE, &id, &body, &user.account).await
+}
+
+pub async fn serve_delete(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::delete_json(&state, &SERVE, &id).await
+}
+
+// ================================================================ Skills / Tool
+
+pub async fn skills_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::list_json(&state, &SKILLS, &raw, vec![]).await
+}
+
+pub async fn skills_by_ids(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let ids = match ids_of(&body) {
+ Ok(v) => v,
+ Err(resp) => return resp,
+ };
+ match res::by_ids(&state.db, &SKILLS, &ids).await {
+ Ok(list) => ok(json!(list)),
+ Err(e) => db_error(e, "按 id 查技能"),
+ }
+}
+
+pub async fn skills_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::info_json(&state, &SKILLS, &id).await
+}
+
+pub async fn tool_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::list_json(&state, &TOOL, &raw, vec![]).await
+}
+
+pub async fn tool_by_ids(
+ State(state): State,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ let ids = match ids_of(&body) {
+ Ok(v) => v,
+ Err(resp) => return resp,
+ };
+ match res::by_ids(&state.db, &TOOL, &ids).await {
+ Ok(list) => ok(json!(list)),
+ Err(e) => db_error(e, "按 id 查工具"),
+ }
+}
+
+pub async fn tool_info(
+ State(state): State,
+ headers: HeaderMap,
+ Path(id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ res::info_json(&state, &TOOL, &id).await
+}
+
+// ================================================================ Chat
+
+/// `POST /api/ai/Chat/Send` —— 流式对话。
+///
+/// 🔴 **明确失败**:本仓没有 LLM 供应商配置表?有(`base_ai_supplier`),但**没有
+/// HTTP 客户端**,发不出请求。假装返回一段文本等于骗前端。
+/// 前端是 `responseType: 'stream'`,`fail` 返回的是普通 JSON —— vben 的 fetch
+/// 适配器会把它当流读完并报「请求失败」,不会崩页面。
+pub async fn chat_send(
+ State(state): State,
+ headers: HeaderMap,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ fail(
+ code::FAIL,
+ "本仓未接入 LLM 推理服务:无法发起对话(AI 中心的元数据管理可用)",
+ )
+}
+
+pub async fn chat_translate(
+ State(state): State,
+ headers: HeaderMap,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ fail(code::FAIL, "本仓未接入 LLM 推理服务:无法翻译")
+}
+
+pub async fn chat_optimize(
+ State(state): State,
+ headers: HeaderMap,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ fail(code::FAIL, "本仓未接入 LLM 推理服务:无法优化提示词")
+}
+
+/// `GET /api/ai/Chat/Close/{id}` —— 终止流(幂等)。
+pub async fn chat_close(
+ State(state): State,
+ headers: HeaderMap,
+ Path(_id): Path,
+) -> Json {
+ if let Err(resp) = require_login_face_b(&state, &headers).await {
+ return resp;
+ }
+ ok(Value::Null)
+}
+
+/// `GET /api/ai/Chat/history/list` —— 会话列表(**裸数组**,前端 `res.data` 直接用)。
+pub async fn chat_history_list(
+ State(state): State,
+ headers: HeaderMap,
+ raw: RawQuery,
+) -> Json {
+ let user = match require_login_face_b(&state, &headers).await {
+ Ok(u) => u,
+ Err(resp) => return resp,
+ };
+ let keyword = qv(&raw, "keyword");
+ let mut values: Vec