weaver-work-cli 0.1.48 → 0.1.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/chunks/{archive-oa-EDJDU3V4.js → archive-oa-57R2FYHV.js} +111 -12
  2. package/dist/chunks/{attachment-content-4KSNBPRO.js → attachment-content-EJYIOJPH.js} +3 -3
  3. package/dist/chunks/{chunk-FEP6ELMR.js → chunk-3NCFFHB2.js} +1 -1
  4. package/dist/chunks/chunk-5QYE52LG.js +223 -0
  5. package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
  6. package/dist/chunks/{chunk-NBEWUR7L.js → chunk-6T53BSWZ.js} +158 -44
  7. package/dist/chunks/{chunk-OCYRVZGN.js → chunk-7AYQJSFY.js} +2 -2
  8. package/dist/chunks/{chunk-5B5JXTY2.js → chunk-7ECB22G3.js} +221 -30
  9. package/dist/chunks/{chunk-72MI3MBX.js → chunk-ATEXBEPD.js} +55 -15
  10. package/dist/chunks/{chunk-WMSAWAWZ.js → chunk-BFKLQLBK.js} +8 -8
  11. package/dist/chunks/{chunk-EFOUMXIX.js → chunk-HARQF5IP.js} +28 -28
  12. package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
  13. package/dist/chunks/chunk-JEQHNNSS.js +158 -0
  14. package/dist/chunks/{chunk-NK74RE5F.js → chunk-K67FODVC.js} +3 -3
  15. package/dist/chunks/{chunk-YLCYX7LE.js → chunk-KMRT7NAT.js} +18 -5
  16. package/dist/chunks/{chunk-BCACE6VV.js → chunk-MCZG6HPM.js} +3 -3
  17. package/dist/chunks/{chunk-SVFG6EMV.js → chunk-RYFRGTUV.js} +5 -5
  18. package/dist/chunks/{chunk-PSPOFLSU.js → chunk-WNJUGI2F.js} +1 -1
  19. package/dist/chunks/{chunk-R2HHLJNN.js → chunk-YB3AJYPY.js} +4 -4
  20. package/dist/chunks/{conflict-APGSD5E7.js → conflict-C4UDHCWV.js} +2 -2
  21. package/dist/chunks/{contract-N6P2HIIE.js → contract-VUC6JOPG.js} +464 -9
  22. package/dist/chunks/{create-flow-5TXFOC7X.js → create-flow-6OG2LYBD.js} +6 -6
  23. package/dist/chunks/data-QO7QWOIV.js +2525 -0
  24. package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
  25. package/dist/chunks/{env-B6GKA2J3.js → env-WP57TF2S.js} +2 -2
  26. package/dist/chunks/{factory-MFCKLUT6.js → factory-VUXI7N5C.js} +1 -1
  27. package/dist/chunks/{fna-ZVB2IILI.js → fna-ECOYBQYL.js} +328 -5
  28. package/dist/chunks/{group-chat-YE7WIBFO.js → group-chat-UQRGXILK.js} +3 -3
  29. package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
  30. package/dist/chunks/{im-3RCNL5GT.js → im-TN2JYVGJ.js} +2 -2
  31. package/dist/chunks/{invoice-FXWH5GPO.js → invoice-E7GOITEU.js} +1 -1
  32. package/dist/chunks/{meeting-RYZV2JTQ.js → meeting-4BBLVAWM.js} +10 -10
  33. package/dist/chunks/{msg-parse-4GSQ2WTO.js → msg-parse-FPFVPMYI.js} +5 -1
  34. package/dist/chunks/org-NFE7X7FK.js +12 -0
  35. package/dist/chunks/{reception-VL6TKVAW.js → reception-QGPNTGHG.js} +526 -175
  36. package/dist/chunks/{recruit-stage-ERZD3ZNB.js → recruit-stage-FKWS5UQF.js} +66 -13
  37. package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
  38. package/dist/chunks/{registry-22O6UG4I.js → registry-5CRCN2TV.js} +10 -10
  39. package/dist/chunks/{registry-BUTEDK3C.js → registry-E5RQJVWN.js} +2 -2
  40. package/dist/chunks/{registry-7VZ6YJUF.js → registry-V4CHRQDI.js} +1 -1
  41. package/dist/chunks/{room-recommend-IMZPJMYB.js → room-recommend-AYR3UG7R.js} +4 -4
  42. package/dist/chunks/{schedule-SPPAHER2.js → schedule-JZEFIXUS.js} +4 -4
  43. package/dist/chunks/{workflow-WVEFJ6KC.js → workflow-3ZAF2J5E.js} +4 -4
  44. package/dist/index.js +16 -11
  45. package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
  46. package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
  47. package/dist/shortcuts/archive-oa/operations/registry.js +4 -1
  48. package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
  49. package/dist/shortcuts/contract/host.js +11 -0
  50. package/dist/shortcuts/contract/index.js +13 -0
  51. package/dist/shortcuts/contract/manifest.js +53 -0
  52. package/dist/shortcuts/contract/operations/performance.js +58 -7
  53. package/dist/shortcuts/contract/operations/quote.js +283 -1
  54. package/dist/shortcuts/contract/operations/registry.js +2 -0
  55. package/dist/shortcuts/contract/operations/save-recognize.js +151 -0
  56. package/dist/shortcuts/data/errors.js +64 -0
  57. package/dist/shortcuts/data/host.js +140 -0
  58. package/dist/shortcuts/data/index.js +429 -0
  59. package/dist/shortcuts/data/manifest.js +133 -0
  60. package/dist/shortcuts/data/operations/attend.js +62 -0
  61. package/dist/shortcuts/data/operations/conf.js +384 -0
  62. package/dist/shortcuts/data/operations/ds.js +686 -0
  63. package/dist/shortcuts/data/operations/field.js +68 -0
  64. package/dist/shortcuts/data/operations/index.js +65 -0
  65. package/dist/shortcuts/data/operations/module.js +383 -0
  66. package/dist/shortcuts/data/operations/noun.js +102 -0
  67. package/dist/shortcuts/data/operations/query.js +85 -0
  68. package/dist/shortcuts/data/operations/scene.js +235 -0
  69. package/dist/shortcuts/data/operations/shared.js +279 -0
  70. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +12 -5
  71. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
  72. package/dist/shortcuts/ehr/recruit-stage/shared.js +57 -0
  73. package/dist/shortcuts/fna/host.js +4 -2
  74. package/dist/shortcuts/fna/manifest.js +14 -5
  75. package/dist/shortcuts/fna/operations/audit.js +334 -0
  76. package/dist/shortcuts/fna/operations/registry.js +2 -0
  77. package/dist/shortcuts/im/operations/at-mention.js +6 -3
  78. package/dist/shortcuts/im/operations/msg-parse.js +35 -5
  79. package/dist/shortcuts/im/operations/msg-sync.js +3 -1
  80. package/dist/shortcuts/im/operations/msg-write.js +57 -9
  81. package/dist/shortcuts/index.js +5 -0
  82. package/dist/shortcuts/invoice/manifest.js +1 -1
  83. package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
  84. package/dist/shortcuts/meeting/operations/from-group-chat.js +16 -2
  85. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  86. package/dist/shortcuts/reception/constants.js +13 -6
  87. package/dist/shortcuts/reception/index.js +3 -1
  88. package/dist/shortcuts/reception/manifest.js +3 -2
  89. package/dist/shortcuts/reception/operations/ask.js +20 -2
  90. package/dist/shortcuts/reception/operations/compose.js +11 -0
  91. package/dist/shortcuts/reception/operations/doc.js +59 -0
  92. package/dist/shortcuts/reception/operations/docrender.js +25 -1
  93. package/dist/shortcuts/reception/operations/leads.js +31 -7
  94. package/dist/shortcuts/reception/operations/panels.js +86 -22
  95. package/dist/shortcuts/reception/operations/render.js +40 -0
  96. package/dist/shortcuts/reception/operations/restaurant.js +17 -4
  97. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +12 -5
  98. package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
  99. package/dist/shortcuts/recruit-stage/shared.js +57 -0
  100. package/dist/shortcuts/workflow/operations/read.js +58 -14
  101. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +140 -24
  102. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +42 -14
  103. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +4 -6
  104. package/docs/SKILL.md +2 -1
  105. package/docs/_catalog.md +4 -1
  106. package/docs/data.md +149 -0
  107. package/docs/fna.md +11 -4
  108. package/docs/reception.md +59 -5
  109. package/package.json +1 -1
  110. package/scripts/check-skill-sync.mjs +188 -0
  111. package/scripts/package-skill.mjs +17 -3
  112. package/skill-template/business-info.json +29 -1
  113. package/skill-template/domains/data.md +15 -0
  114. package/skill-template/domains/qiyecheng.md +4 -2
  115. package/skills/weaver-e10-archive-oa/SKILL.md +7 -6
  116. package/skills/weaver-e10-archive-oa/references/contract-search.md +83 -14
  117. package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
  118. package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +35 -11
  119. package/skills/weaver-e10-data/SKILL.md +118 -0
  120. package/skills/weaver-e10-data/references/config-center.md +90 -0
  121. package/skills/weaver-e10-data/references/datasource.md +136 -0
  122. package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
  123. package/skills/weaver-e10-jinchengda/SKILL.md +1 -1
  124. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +5 -5
  125. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +1 -1
  126. package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +44 -2
  127. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
  128. package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +219 -0
  129. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +50 -30
  130. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +24 -15
  131. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
  132. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +96 -2
  133. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +43 -0
  134. package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +997 -0
  135. package/skills/weaver-e10-jinchengda/scripts/render_ebdf_list_card.py +265 -0
  136. package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +83 -0
  137. package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +118 -0
  138. package/skills/weaver-e10-meeting/SKILL.md +39 -7
  139. package/skills/weaver-e10-qiyecheng/SKILL.md +21 -7
  140. package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +104 -0
  141. package/skills/weaver-e10-qiyecheng/references/catalog.md +17 -3
  142. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +136 -30
  143. package/skills/weaver-e10-reception-flow/SKILL.md +70 -19
  144. package/skills/weaver-e10-reception-flow/references/guide.md +5 -4
  145. package/skills/weaver-e10-reception-flow/scripts/render.py +5 -3
  146. package/skills/weaver-e10-recruit-stage/SKILL.md +1 -1
  147. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -6
  148. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +3 -3
  149. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +6 -4
  150. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +3 -3
  151. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +53 -11
  152. package/skills/weaver-e10-workflow/SKILL.md +2 -1
  153. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +29 -6
  154. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +162 -10
  155. package/skills/weaver-e10-yepiaotong/SKILL.md +10 -5
  156. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +19 -32
  157. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +6 -45
  158. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +5 -5
  159. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +4 -37
  160. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +2 -2
  161. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +4 -4
  162. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +22 -35
  163. package/skills/weaver-e10-yimiaoban/SKILL.md +8 -6
  164. package/skills/weaver-e10-yimiaoban/references/msg-read.md +20 -0
  165. package/skills/weaver-e10-yimiaoban/references/msg-write.md +7 -0
  166. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +18 -15
  167. package/dist/chunks/{ebuilder-form-I5ZIX4WO.js → ebuilder-form-CBYI6CQ6.js} +4 -4
package/docs/data.md ADDED
@@ -0,0 +1,149 @@
1
+ # 泛微 E10 数据助手(data)
2
+
3
+ `data` 是 E10 问数能力的聚合命令,覆盖 8 个业务域:**DSL 查询(query)**、**数据源(ds)**、**词库(noun)**、**字段值翻译(field)**、**配置中心(conf)**、**场景定位(scene)**、**模块接口调用(module)**、**考勤(attend)**,共 **31 个 operation**。
4
+
5
+ 由原独立 CLI `e10-data` 迁移而来。迁移只换了**承载进程**(登录与凭据改由 `weaver-work-cli` 统一托管),业务参数名与输出口径逐字保留,技能里 453 处 `e10-data …` 调用可直接换成 `weaver-work-cli data …`。
6
+
7
+ ```text
8
+ weaver-work-cli data --help
9
+ weaver-work-cli data schema
10
+ weaver-work-cli --json data run <operation> --input -
11
+ ```
12
+
13
+ `schema` 是能力清单的唯一事实来源:每个 operation 的 `inputSchema`、`command` 路径,以及 `withheldOperations`(刻意不迁的能力 + 书面理由)。
14
+
15
+ ## 实现位置
16
+
17
+ | 路径 | 职责 |
18
+ | --- | --- |
19
+ | `src/shortcuts/data/index.ts` | 命令树、camelCase→snake_case 参数翻译、两种输出口径 |
20
+ | `src/shortcuts/data/manifest.ts` | `schema` 契约、inputSchema、禁用边界声明 |
21
+ | `src/shortcuts/data/host.ts` | E10 会话桥接、`ebbusinessid` 注入、JSON / form / multipart、退出码映射 |
22
+ | `src/shortcuts/data/errors.ts` | `DataCliError` 与退出码常量(数值与旧 CLI 一致) |
23
+ | `src/shortcuts/data/operations/index.ts` | 31 个 operation 注册表与统一分发 |
24
+ | `src/shortcuts/data/operations/{query,ds,noun,field,conf,scene,module,attend}.ts` | 按业务域拆分的实现 |
25
+ | `src/shortcuts/data/operations/shared.ts` | 雪花 ID 保精度、条件树、stat / order、平台提示扫描、人读渲染 |
26
+
27
+ 命令树顺序固定:`schema` → `run <operation>` → 各业务便捷子命令。与仓库里其他 25 个 shortcut 同构。
28
+
29
+ ## 认证
30
+
31
+ 复用 `src/internal/e10` 的 E10 会话(`requireE10Session`),一次命令内只加载一次 session 并缓存复用。**`data` 不提供任何登录入口**,登录统一走:
32
+
33
+ ```text
34
+ weaver-work-cli auth login --base-url <E10 域名>
35
+ ```
36
+
37
+ 已登录态过期时 `host.ts` 抛 `authentication/session_expired`(退出码 2),不自行换票、不重放。
38
+
39
+ `ebbusinessid: 10000000000000000` 由本模块恒定下发(运行时不会自动注入),其他头(`Accept` / `langType` / `timeZoneOffset` / `Cookie` / `eteamsid` / `User-Agent` / `Origin`)由 `createE10RequestRuntime` 负责。`token` 属运行时保留头,INVOICE 场景必须走 `trustedHeaders`。
40
+
41
+ ## 两种输出口径
42
+
43
+ | 入口 | 输出 | 适用 |
44
+ | --- | --- | --- |
45
+ | `data <族> <动作>`(便捷命令) | **原始响应体**,不套信封、关闭超预算落盘 | 技能里的 jq 路径(`.data.records` 等)直接命中 |
46
+ | `data run <operation>` | `{schemaVersion, ok, operation, data, warnings}` 信封 | 需要统一契约的 Agent 调用 |
47
+
48
+ 便捷命令刻意 `persist: false`:大结果被替换成 `{refId, preview}` 会直接打断下游 jq 解析。
49
+
50
+ ## 命令树
51
+
52
+ | 族 | 便捷命令 | operation |
53
+ | --- | --- | --- |
54
+ | DSL | `data query` | `data.dsl.query` |
55
+ | 数据源 | `data ds groups / find / describe / tables / fields / fields-dsl / list / chart / stat / count` | `data.ds.*` |
56
+ | 词库 | `data noun list / scope` | `data.noun.*` |
57
+ | 字段 | `data field name2id / options` | `data.field.*` |
58
+ | 配置中心 | `data conf get / batch / batch-file / group / group-file / resolve / resolve-file / add / add-file / update / delete` | `data.conf.*` |
59
+ | 场景 | `data scene groups / items / search` | `data.scene.*` |
60
+ | 模块接口 | `data module call` | `data.module.call` |
61
+ | 考勤 | `data attend statis` | `data.attend.statis` |
62
+
63
+ ## 各业务域要点
64
+
65
+ ### query:DSL 查询
66
+
67
+ `POST /api/dw/dsl/executeQueryDsl`,四个 URL query 参数(`dimension` / `confGroup` / `username` / `startDate`)**恒定发送**——缺键即失败,空值是合法的(表示"问句里没有")。
68
+
69
+ ### ds:数据源发现与取数
70
+
71
+ - **`ds find` 的语义是「抓窗口 + 本地过滤」,不是后端精确搜索。**`/api/dw/newetl/chatBi/ds/listByPage` 当前忽略 `name`,所以命令会按 `--size`(≤2000)× `--pages`(≤50)抓取并在本地按表名过滤。**未命中只代表没落在窗口内,不等于表不存在** —— 输出里的 `nameFilter.note` 会写清本次比对了多少行。
72
+ - 默认只扫 `DS_CORE_GROUPS` 的核心分组;未命中且 `pages × size ≤ 2000` 时**自动升级全扫**(`--no-escalate` 关闭),仍在核心集则显式 `--all-groups`。
73
+ - 输出顶层带 `routeHint`:按命中分组给出该走哪条通道(WORKFLOW / DS_EB / DS_FORM / PROJECT/PMO / EHR / BLOG_DAILY / DOCUMENT / CRM / ESB / DS)。流程类问题**一律走 WORKFLOW 模块接口**,不用 DSL、也不走数据源。
74
+ - **`ds describe`** 一次并发取字段元数据 + 词库,并给出关联字段预判;`--require` 让失败分支直接失败。
75
+ - **取数四件套**(`list` / `chart` / `stat` / `count`)共用 DTO 骨架:`--group` + `--table` 定位,`--where` 走条件树(数组 = AND 根,元素可为内嵌条件组;对象 = 完整条件树),`--stat` 的聚合键是大写枚举(`aggregator: "SUM"`),`--order` 形如 `"create_time desc"`。
76
+
77
+ ### conf:配置中心
78
+
79
+ - `confType` 默认由 `confKey` 前缀推导:`CONN_`→`conn`、`DS_`→`ds`、`WF_`→`wf`、`API_`→`api`;无法推导时报 `conf_type_unknown`(退出码 8),需显式 `--type`。
80
+ - `confGroup` 只在 `confType=api` 或显式传 `--group` 时下发,避免污染没有分组列的配置类型。
81
+ - 同一 `confKey` 可分布在多个 `confGroup`,内部用 `组|键` 做映射键,避免互相覆盖。
82
+ - 批量接口不可用时**自动降级逐条单查**;`batch-file` 直接跳过批量接口。
83
+
84
+ ### module:配置中心驱动的接口调用
85
+
86
+ `module call` 是「已确定模块 + 接口」之后的通用执行器:按 `confAttrs` 的 `request_example` / 入参说明组装请求并发出去。
87
+
88
+ - `--show-params` 只打印入/出参说明;`--dry-run` 只组装不发送(凭据脱敏);`--raw` 原样输出响应体。
89
+ - **`body` 必须传对象,不能传已序列化的 JSON 字符串**:运行时会再 `JSON.stringify` 一次,传字符串会发出"被转义的 JSON 字面量",服务端表现为 HTTP 200 + 业务 500/400。form 提交走 `form` 字段。
90
+ - `--limit` 默认 50 行(`0` = 不截断),`--fields` 只保留指定行字段。
91
+ - **`/api/hrm/` 路径命中黑名单**(退出码 6):人员 / 部门 / 岗位一律走 `weaver-work-cli hrm`。
92
+ - **`hasSearchRight=false` 是权限受限的终端态**:结果字段必为空,命令以退出码 4 结束。不得交付为「无数据」,也不得换参重试。
93
+
94
+ ### scene / noun:场景定位与词库
95
+
96
+ `scene search` 优先用后端 keyword 召回,后端不支持时才本地打分兜底(实际走哪条会打到 stderr)。`scene items` 的 `groupId` / 数据集 id 都是 19 位雪花号,**按字符串传**;`noun scope` 直接吃 `scene items` 里的数据集 id 列表。
97
+
98
+ ### field:字段值翻译
99
+
100
+ - `field name2id`:名称 → 字段值 id,只管**浏览按钮类**字段(RelateBrowser / Ebuilder / Workflow,靠 `config.browserParams`)。
101
+ - `field options`:Select / Radio / Checkbox 的**选项值字典**(id↔name),选项类取值翻译走这个。
102
+ - 两者与 `ds fields`(字段元数据)是三件不同的事,不要混用。
103
+
104
+ ### attend:考勤
105
+
106
+ `POST /api/attend/web/attendInfoV2/getAttendInfoStatis`,返回年假 / 带薪病假 / 带薪事假余额。`--user` 缺省当前登录用户,`--begin` / `--end` 缺省当月。
107
+
108
+ ## 退出码
109
+
110
+ | 码 | 含义 | 框架映射 |
111
+ | --- | --- | --- |
112
+ | 0 | 正常(**空结果也算正常**) | — |
113
+ | 2 | 未登录 / 凭据失效 | `UsageError` |
114
+ | 3 | 非 JSON 响应 / `confAttrs` 异常 | `AuthError` |
115
+ | 4 | 权限受限(`hasSearchRight=false`) | `PolicyError` |
116
+ | 6 | 命中 HRM 路径黑名单 | `PolicyError` |
117
+ | 7 | 请求失败(HTTP / 网络) | `NetworkError` |
118
+ | 8 | 用法错误(缺参、JSON 非法、未知 operation) | `UsageError` |
119
+
120
+ 退出码数值**必须与旧 CLI 一致**,技能侧按码分流。
121
+
122
+ ## 关键陷阱
123
+
124
+ **雪花 ID 精度**:E10 的 id 是 19 位,超出 `Number.MAX_SAFE_INTEGER`,`JSON.parse` 会把末几位归零且**后端不报错、只是查不到数据**。`parseJsonSafe` 在解析前把 ≥16 位整数预置为字符串,与旧 CLI 口径一致。
125
+
126
+ **平台范围提示**:平台在"范围过大不予查询"或"范围被收窄"时,只把 `tipTimeout` / `tipTimelimit`(及对应 Msg,含 `tipTimeLimit*` 变体)塞在响应**内层**(层级随通道不同)。`scanTips` 递归提取、`tipFields` 规范到输出顶层,`tipsLines` 打 `[!]` 行。看到 `tipTimeout=true` **不能当成 0 行**。
127
+
128
+ **`data --json` 不等于 `data run --json`**:前者是原始响应体(技能里 453 处 jq 依赖它),后者是信封。写新调用时按消费方选。
129
+
130
+ **并发扇出**:`ds find` / `ds describe` / `conf group-file` 在进程内并发,`--concurrency` 可调(默认 10)。分组失败不中断整体,失败明细在输出的 `errors` 里。
131
+
132
+ ## 未迁移的能力(`withheldOperations`)
133
+
134
+ | operation | 理由 |
135
+ | --- | --- |
136
+ | `data.doc.count` / `data.doc.list` | 由配置中心 DOCUMENT 覆盖(`data conf group api DOCUMENT` → `data module call`),不在 data 模块重复封装。注意 `documentList` 的 `data.total` 实测恒为 0,总量必须取 count 接口 |
137
+ | `data.field.id2name` | 已停用:技能里 19 处均为禁令;底层打的是 `/api/bcw/test/testRemoteBrowser` 探针接口。选项值显示映射改走 `field options` |
138
+ | `data.refusal.get` / `data.refusal.rules` | 拒答话术属智能问数宿主平台职责,场景技能明确「不做拒答 / 话术判定」 |
139
+ | `data.exp.*` | 专家包远端版本管理属 `weaver-work-cli skills repo …` 资源域 |
140
+
141
+ ## 测试
142
+
143
+ `test/business/data-operations.test.ts` 覆盖:雪花 ID 保精度、BOM、条件树(数组 / 内嵌组 / 缺字段报错 / 空值)、stat 与 order 归一化、平台提示扫描、confType 推导、operation 注册表与 manifest 对齐(含 withheld 不与实现重叠)、参数翻译(含 `--no-escalate`)。
144
+
145
+ ```text
146
+ node --import tsx --test test/business/data-operations.test.ts
147
+ ```
148
+
149
+ 需要真实登录态的命令冒烟(`ds count` 新旧对照、`module call` 真实调用)不在单测内,需手工执行。
package/docs/fna.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # 齐业成费控中心(FNA)CLI
2
2
 
3
- 对应 `src/shortcuts/fna`,把泛微齐业成 FNA 费控中心 12 个源接口固化为 14 个 operation(预算 2 / 费用中心 3 + 报销报表 AI 问答 1 / 借款管理 4 / 发票核销 4,其中提醒还款与催票为 prepare/apply 写链)。源资料:`/Users/zhufangyuan/Desktop/weaver-e10-qiyecheng`(指纹见 `skills/weaver-e10-qiyecheng/references/source-manifest.json`)。
3
+ 对应 `src/shortcuts/fna`,把泛微齐业成 FNA 费控中心 13 个源接口固化为 16 个 operation(预算 2 / 费用中心 3 + 报销报表 AI 问答 1 / AI 规则预审 2 / 借款管理 4 / 发票核销 4,其中提醒还款、催票与 AI 预审为 prepare/apply 写链)。源资料指纹见 `skills/weaver-e10-qiyecheng/references/source-manifest.json`。
4
4
 
5
5
  ## 公共前置
6
6
 
7
- - 认证、profile、HTTP client 由 `src/internal/e10` 托管;业务 host 只适配 `/api/fna/`、`/api/app/fna/` 与 `/api/secondev/fna/` 路径(`src/shortcuts/fna/host.ts` 的 `assertPath` 白名单)。
7
+ - 认证、profile、HTTP client 由 `src/internal/e10` 托管;业务 host 只适配 `/api/fna/`、`/api/app/fna/`、`/api/secondev/fna/` 与 `/api/ai/application/rule/check/` 路径(`src/shortcuts/fna/host.ts` 的 `assertPath` 白名单)。
8
8
  - 成功判定统一走 WeaResult(`success` 或 `status` 布尔 / `code==200`);费用中心 AI 查询用 `success`,预算/借款/核销用 `status`。
9
9
  - JSON 输出与错误 envelope、退出码遵循共享规则;写操作不满足确认条件返回 `confirmation.required`(exit 10),请求发出后结果不确定返回 `partial/write_uncertain`(exit 11)。
10
10
 
11
11
  ## Agent 入口
12
12
 
13
- 面向 Agent 时先读 `skills/weaver-e10-qiyecheng/SKILL.md`,再按入口路由读取 `references/`(catalog/budget/expense-center/expense-chart/loan-management/invoice-writeoff)。
13
+ 面向 Agent 时先读 `skills/weaver-e10-qiyecheng/SKILL.md`,再按入口路由读取 `references/`(catalog/budget/expense-center/expense-chart/ai-check-audit/loan-management/invoice-writeoff)。
14
14
 
15
15
  ## Operation 目录
16
16
 
@@ -22,6 +22,8 @@
22
22
  | `fna.expense.loan.sum` | read | POST `expense/center/getSumLoanAmountByAi`;只认数字 ID;空 data 自动重试 2 次;已知仅统计首条记录缺陷 |
23
23
  | `fna.expense.prepay.writeoff.sum` | read | POST `expense/center/selectPrepayWriteOffAmountBySkill`;body 可空 |
24
24
  | `fna.expense.chart` | read | GET `getExpenseChart`(`/api/secondev/fna/`);`userInput` 必填 ≤500 字;`maxRows` 本地截断 1-5000,默认 200;超时 180s;返回 `kind=rows/empty/clarify/blocked/unexpected`;无权限文案额外返回 `meta.permissionDenied=true` |
25
+ | `fna.audit.check.prepare` | write | 校验 `workflowId`/`requestId`/`nodeId`(>0)与枚举,签发 continuation,不触网 |
26
+ | `fna.audit.check.apply` | write | POST `ai/application/rule/check/aiCheckAudit`;需 `confirm:true` + continuation;超时 600s;`status=checked/empty/unparsed`;写预审记录并消耗大模型 |
25
27
  | `fna.loan.main.page` | read | POST `loanManagementMenu/mainPage` |
26
28
  | `fna.loan.main.list` | read | POST `loanManagementMenu/mainPageList`;`current`/`pageSize`/`menuCode`/`permissionSetCode` 必填 |
27
29
  | `fna.loan.remind.repay.prepare` | write | 校验 displayData 行并预览,不发送 |
@@ -31,7 +33,7 @@
31
33
  | `fna.invoice.writeoff.callticket.prepare` | write | 校验 requestids 并预览,不发送 |
32
34
  | `fna.invoice.writeoff.callticket.apply` | write | 需 `confirm:true` + continuation;指纹与 prepare 一致 |
33
35
 
34
- 完整 schema(inputSchema/required/enum)以 `weaver-work-cli fna schema` 为准。`withheldOperations` 记录了未实现的按钮能力(确认已还、核销明细)与 ID 解析边界。
36
+ 完整 schema(inputSchema/required/enum)以 `weaver-work-cli fna schema` 为准。`withheldOperations` 记录了未实现的按钮能力(确认已还、核销明细)、ID 解析边界、AI 报表 SQL 与规则配置维护、表单明细回传边界。
35
37
 
36
38
  ## 常用命令
37
39
 
@@ -41,6 +43,7 @@ Windows PowerShell:
41
43
  weaver-work-cli --json fna run fna.budget.application.detail --input-json '{"requestId":"1001"}'
42
44
  weaver-work-cli --json fna run fna.expense.reimbursed.sum --input-json '{"startDate":"2026-01-01","endDate":"2026-08-31"}'
43
45
  weaver-work-cli --json fna run fna.expense.chart --input-json '{"userInput":"2026-08 各部门报销金额排名前三"}'
46
+ weaver-work-cli --json fna run fna.audit.check.prepare --input-json '{"workflowId":"100000000000000001","requestId":"133000000000000001","nodeId":"111000000000000001","dimension":"node"}'
44
47
  weaver-work-cli --json fna run fna.loan.main.list --input-json '{"current":1,"pageSize":20,"menuCode":"fesx_fna_borrowingManagement","permissionSetCode":"fesx_fna_borrowingManagement.default"}'
45
48
  weaver-work-cli --json fna run fna.invoice.writeoff.list --input-json '{"current":1,"pageSize":20,"invoiceStatus":"unarrivedTicket"}'
46
49
  ```
@@ -51,6 +54,7 @@ macOS/Linux(bash/zsh):
51
54
  weaver-work-cli --json fna run fna.budget.application.detail --input-json '{"requestId":"1001"}'
52
55
  weaver-work-cli --json fna run fna.expense.reimbursed.sum --input-json '{"startDate":"2026-01-01","endDate":"2026-08-31"}'
53
56
  weaver-work-cli --json fna run fna.expense.chart --input-json '{"userInput":"2026-08 各部门报销金额排名前三"}'
57
+ weaver-work-cli --json fna run fna.audit.check.prepare --input-json '{"workflowId":"100000000000000001","requestId":"133000000000000001","nodeId":"111000000000000001","dimension":"node"}'
54
58
  weaver-work-cli --json fna run fna.loan.main.list --input-json '{"current":1,"pageSize":20,"menuCode":"fesx_fna_borrowingManagement","permissionSetCode":"fesx_fna_borrowingManagement.default"}'
55
59
  weaver-work-cli --json fna run fna.invoice.writeoff.list --input-json '{"current":1,"pageSize":20,"invoiceStatus":"unarrivedTicket"}'
56
60
  ```
@@ -66,6 +70,9 @@ weaver-work-cli --json fna run fna.invoice.writeoff.list --input-json '{"current
66
70
  - 超 2^53 的 requestId 无法用 JS 数字精确表达,保留字符串并提示人工核验(真实环境 ID 一般在安全整数内,已按数字发送)。
67
71
  - `fna.expense.chart`:`code` 恒为 200,必须按 `data` 类型/`kind` 判成败;追问与安全拦截都是字符串 `data`,`meta.messageKindInferred=true` 表示归类为 CLI 推断。实测真实查询 3.3~66.6s,CLI 超时设 180s,禁止自动重试(每次都会消耗模型额度)。不做当前人强制过滤,结果可能是全租户范围;`userInput` 为商品化输入,个人口径必须改用 `fna.expense.reimbursed.sum`。二开包未安装时该 operation 会 404/500,需与其它 `fna.*` 正常但本 operation 失败区分。
68
72
  - `fna.expense.chart` 的权限语义:文案含「权限 / 越权」时 CLI 归类为 `clarify` 并置 `meta.permissionDenied=true`(纯权限提示不带「不明确」关键词也照样识别,避免落进 `unexpected` 被误判)。这是**终止信号**,不是换问法信号:Agent 必须直接告知权限边界,禁止改调 `fna.expense.reimbursed.sum`、`fna.budget.*`、借款 / 核销等接口按部门 / 人员 / 金额拼装同一份报表,也禁止自写 SQL 绕过。
73
+ - `fna.audit.check.*`:服务端不做必填校验,`workflowId`/`requestId`/`nodeId` 传 0 只返回空数据,CLI 在入参阶段拦截 0 与非数字;ID 统一转数字字符串发送(避免 > 2^53 精度丢失)。`checkMode` 会覆盖流程配置,`recordId` 是追加语义,`userId` 是执行人身份(人员不存在直接失败,不回退当前登录人)。
74
+ - `fna.audit.check.apply` 的判据是 `data.status`:`empty` 属业务成功但无可审数据(`formDataList is empty` / `dataSourceMap is empty` / `no rules to check`),`unparsed` 表示接口已执行但 `chatMessage.content` 无法二次解析;两者都不是失败,不得重跑或编造结论。`formDataList` 体积大,CLI 只回传 `id/refId/title`。
75
+ - `fna.audit.check.apply` 超时/断网返回 `partial/write_uncertain`(预审记录可能已生成),禁止自动重试,须按 `requestId`+`nodeId` 回查。
69
76
 
70
77
  ## 验证
71
78
 
package/docs/reception.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # reception — 泛微客户参观接待流程
2
2
 
3
- `reception` 模块把「客户参观接待」这条业务链路收敛成三个 operation:出面板、出件并挂附件、输出填单页。
3
+ `reception` 模块把「客户参观接待」这条业务链路收敛成五个 operation:出面板、出件并挂附件、输出填单页、一步合并、查包厢候选。
4
4
  它原本是一个独立的 `@weaver/reception-cli` 包(含自建鉴权、会话缓存、写闸门、客户/人员 ID 检索),
5
5
  现已并入 `weaver-work-cli`,**独立包退役**。
6
6
 
@@ -25,10 +25,14 @@
25
25
  weaver-work-cli reception --help
26
26
  weaver-work-cli reception schema
27
27
  weaver-work-cli --json reception ask --known-file known.json [--user "<姓名>"]
28
- weaver-work-cli --json reception doc --run-id <id> --answers-file answers.json --snapshot <skill>/data/fields-snapshot.json
29
- weaver-work-cli --json reception render --run-id <id>
28
+ weaver-work-cli --json reception doc-render --run-id <id> --answers-file answers.json \
29
+ [--restaurant-rooms-file rooms.json] --snapshot <skill>/data/fields-snapshot.json
30
+ weaver-work-cli --json reception restaurant-rooms --out rooms.json # 提了小餐厅才跑
30
31
  ```
31
32
 
33
+ `doc-render` = `doc` + `render` 合并,省一次工具往返;两步之间没有人工确认点,所以合成一条。
34
+ 旧版 CLI 不认它时退回 `doc` + `render`,语义完全一致。
35
+
32
36
  > 示例为 macOS/Linux 写法;**Windows PowerShell** 下路径用引号包起来即可(`--snapshot "C:\...\fields-snapshot.json"`),参数完全一致。
33
37
 
34
38
  `--snapshot` 只在 `doc` 传一次:`doc` 成功后路径写进 run,`render` 直接复用。
@@ -47,14 +51,64 @@ weaver-work-cli --json reception run reception.ask --input-json '{"known":{"cust
47
51
  | `reception.ask` | read | 按 7 项抽取结果算缺口、出面板,返回 `runId` |
48
52
  | `reception.doc` | read | 渲染行程单 docx + 内部参考 md,上传两份附件拿 fileid |
49
53
  | `reception.render` | read | 按快照拼 `customParams`,输出 `<browsertool>` |
54
+ | `reception.docRender` | read | `doc` + `render` 合成一步 |
55
+ | `reception.restaurantRooms` | read | 实查「小食堂包厢」,产出可直接喂给 `--restaurant-rooms-file` 的候选 |
50
56
 
51
57
  全链路 **零写请求**(`writePolicy: none`):只上传附件,流程由用户在页面上提交。
52
- 因此三个 operation 都是 `read`,也没有 continuation 票据。
58
+ 因此所有 operation 都是 `read`,也没有 continuation 票据。
59
+
60
+ ## 会议与小餐厅口径
61
+
62
+ 两条链路都容易「看着传了、其实没生效」,规则写在这里,改代码时照着守。
63
+
64
+ **会议**(`applyMeetingPolicy`,`leads.ts`):
65
+
66
+ | 输入 | 结果 |
67
+ |---|---|
68
+ | `meetingExplicit:true` + `meeting` 是 | 有合法房间沿用,否则按人数上界自动定(≤12→130,13~20→131,>20→131 并提示超限) |
69
+ | `meetingExplicit` 缺失/false | `ask` 直接丢掉 `meeting`,视为**未表态**,不造数据 |
70
+ | 没表态但 `meetingRoom` 合法 | 视为要开会(已经点名房间,不再问) |
71
+ | 明确否定 | 房间写 `不需会议室`,6 个会议字段全不填 |
72
+
73
+ **会议屏是必问项**:`buildPanels` 只有在 `meeting` 已经是「是」或「否」时才跳过它,否则一定出第 3 屏。
74
+ 「晚上订小餐厅」不构成表态——小餐厅是晚餐场地,与会议室预定是两条独立线索。
75
+
76
+ **硬校验**:`render` 阶段 `meeting` 仍为空时直接抛 `MEETING_UNCONFIRMED`,不产出填单页。
77
+ 这条不依赖模型自觉,绕过面板直接调 `doc-render` 也会被拦;错误里带 `details.files`,
78
+ 说明文件已生成、补问后重跑 `--run-id` 即可。
79
+
80
+ **接待细节屏常驻**:`logistics` 无论原话信息多全都照出,已识别项放 `panels[].prefilled`,
81
+ 由模型在提问前复述;面板手输内容再由 `parseLogistics` 拆成 6 个子项。
82
+
83
+ **默认值回显**:回包 `data.defaultsApplied` 列出被兜底填充的字段(人数缺省 10、会议室默认 131、包厢按容量匹配),
84
+ 执行方必须在正文里提示用户确认,不能当成已确认项。
85
+
86
+ **定房必须在 `doc` 之前**:md/docx 在 `doc` 阶段一次成文,只放在 `render` 里跑的话,
87
+ 参考文档永远写「场地待定」而填单页有房间,两份产物互相打脸。现在 `doc` 里先跑一遍,
88
+ `render` 再跑一遍只是沿用结果。
89
+
90
+ **小餐厅**(`normalizeRestaurant`,`restaurant.ts`):
91
+
92
+ - 触发看「用户说过没有」(小餐厅/包厢/包间/小食堂/内部餐厅),**光有候选不算**;
93
+ - 人数口径:用户明确给 > 来访人数(区间取上界)> **缺省 10**。不拿「客户 + 陪同」凑数——
94
+ 客户人数没给时那样只会得到 1~2 人,订出来的包厢装不下整桌;
95
+ - 候选只能来自建模表单「小食堂包厢」实查(`reception restaurant-rooms`),CLI 从里面挑一间:
96
+ 装得下的最小间优先,同容量按规格(包厢 > 通包 > 茶室);
97
+ - 提了却没拿到包厢号 → `render` 直接 `RESTAURANT_DETAIL_MISSING`,不出半成品填单页;
98
+ 确实无可用包厢时加 `--allow-missing-restaurant` 放行,明细留空进待办;
99
+ - **包厢名只有一个来源**:`data.restaurant.roomNo`。md 和 `customParams` 都读它,
100
+ 不允许渲染层或模型另拟一个名字;
101
+ - **answers 里的 restaurant 是原始入参**(没有 `booked`):`mergeAnswers` 对它逐字段并入而不是整体覆盖。
102
+ 整体覆盖会把 `doc` 归一好的 booking 冲掉,`compose` 判定「没订餐」直接跳过、`render` 的缺包厢号校验也因为
103
+ `booked` 丢失而失效——表现就是「文档写了包厢、页面一行没有、还不报错」。
104
+ 同时 `normalizeRestaurant` 会把这份原始对象当 `explicit` 读,用户点名的包厢/人数/时间才不会被忽略;
105
+ - `--allow-missing-restaurant` 在 `doc-render` 与 `render` 上都支持(合并链路必须透传,否则开关失效)。
106
+ - 被拦时错误里会带 `details.files`:产物已生成,补参数重跑 `doc-render --run-id` 即可,不必重出件。
53
107
 
54
108
  ## 典型链路
55
109
 
56
110
  ```text
57
- ask(出面板,≤2 屏)
111
+ ask(出面板,最多 3 屏:需求 / 接待细节 / 是否会议)
58
112
  → ask_user(panels) 只调一次
59
113
  → (案例 + 专家检索,软依赖) 结果写 cases.json
60
114
  → doc 两份产物 + attachments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weaver-work-cli",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "面向泛微工作工具链的可扩展 TypeScript CLI 基础框架(E10 业票通等能力)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,188 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * 接待技能包版本一致性检查。
4
+ *
5
+ * 背景:这套技能同时存在 4 份副本(源码 / WorkBuddy / 小e / 全局包)+ 2 个 zip,
6
+ * 历史上反复出现「某一份落后」「客户端回滚」「切分支把工作区覆盖掉」三类事故,
7
+ * 而症状都是「跑起来行为不对」,很难第一眼看出是拷贝不一致。
8
+ *
9
+ * 用法:
10
+ * node scripts/check-skill-sync.mjs # 检查并打印表格
11
+ * node scripts/check-skill-sync.mjs --strict # 任一不一致以非 0 退出(可进 CI)
12
+ *
13
+ * 判据:逐文件 sha256 与源码主题包比对;zip 额外校验版本号与主表字段数。
14
+ */
15
+ import { createHash } from 'node:crypto';
16
+ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
17
+ import { basename, join, relative } from 'node:path';
18
+ import { fileURLToPath } from 'node:url';
19
+ import { dirname } from 'node:path';
20
+ import { inflateRawSync } from 'node:zlib';
21
+
22
+ const HERE = dirname(fileURLToPath(import.meta.url));
23
+ const REPO = join(HERE, '..');
24
+ const SKILLS = join(REPO, 'skills');
25
+ const ZIP_DIR = 'F:/workfw/cli/weaver-e10-reception-flow/rebuild-1028/dist';
26
+
27
+ const MAIN = 'weaver-e10-reception-flow';
28
+ const TEST = 'weaver-e10-reception-flow-test';
29
+
30
+ const HOSTS = [
31
+ ['WorkBuddy', 'C:/Users/think/.workbuddy/skills'],
32
+ ['小e', 'C:/Users/think/AppData/Local/xiaoeUserData/userdata/739408349770028237/tenant-skills'],
33
+ ['全局包', 'D:/nodejs/node_global/node_modules/weaver-work-cli/skills'],
34
+ ];
35
+
36
+ const sha = (p) => createHash('sha256').update(readFileSync(p)).digest('hex').slice(0, 12);
37
+
38
+ /** 宿主自有文件:安装器写的元数据与客户端标识,源码里没有,比对时忽略。 */
39
+ const HOST_OWNED = new Set(['product.json', '.skill-id']);
40
+
41
+ function walk(dir, base = dir) {
42
+ const out = [];
43
+ for (const name of readdirSync(dir)) {
44
+ const full = join(dir, name);
45
+ if (statSync(full).isDirectory()) out.push(...walk(full, base));
46
+ else if (!HOST_OWNED.has(name)) out.push(relative(base, full).replace(/\\/g, '/'));
47
+ }
48
+ return out.sort();
49
+ }
50
+
51
+ function readVersion(skillDir) {
52
+ const p = join(skillDir, 'SKILL.md');
53
+ if (!existsSync(p)) return null;
54
+ const head = readFileSync(p, 'utf8').split('\n').slice(0, 40).join('\n');
55
+ const ver = /^version:\s*(.+)$/m.exec(head)?.[1]?.trim() || '?';
56
+ const name = /^name:\s*(.+)$/m.exec(head)?.[1]?.trim() || '';
57
+ const snapPath = join(skillDir, 'data/fields-snapshot.json');
58
+ let mainFieldCount = '-';
59
+ let workflowId = '-';
60
+ if (existsSync(snapPath)) {
61
+ const snap = JSON.parse(readFileSync(snapPath, 'utf8'));
62
+ mainFieldCount = String(snap.mainFieldCount ?? '-');
63
+ workflowId = String(snap.workflow?.workflowId ?? '-');
64
+ }
65
+ return { name, version: ver, mainFieldCount, workflowId };
66
+ }
67
+
68
+ function diffFiles(a, b) {
69
+ const fa = walk(a);
70
+ const fb = walk(b);
71
+ const onlyA = fa.filter((f) => !fb.includes(f));
72
+ const onlyB = fb.filter((f) => !fa.includes(f));
73
+ const changed = fa.filter((f) => fb.includes(f) && sha(join(a, f)) !== sha(join(b, f)));
74
+ return { onlyA, onlyB, changed };
75
+ }
76
+
77
+ /** 极简 zip 读取:只取中央目录里我们关心的条目(不引第三方依赖)。 */
78
+ function readZipEntries(file) {
79
+ const buf = readFileSync(file);
80
+ const entries = new Map();
81
+ let i = buf.length - 22;
82
+ while (i > 0 && buf.readUInt32LE(i) !== 0x06054b50) i -= 1;
83
+ if (i <= 0) return entries;
84
+ const count = buf.readUInt16LE(i + 10);
85
+ let off = buf.readUInt32LE(i + 16);
86
+ for (let n = 0; n < count; n += 1) {
87
+ if (buf.readUInt32LE(off) !== 0x02014b50) break;
88
+ const method = buf.readUInt16LE(off + 10);
89
+ const compSize = buf.readUInt32LE(off + 20);
90
+ const nameLen = buf.readUInt16LE(off + 28);
91
+ const extraLen = buf.readUInt16LE(off + 30);
92
+ const commentLen = buf.readUInt16LE(off + 32);
93
+ const localOff = buf.readUInt32LE(off + 42);
94
+ const name = buf.toString('utf8', off + 46, off + 46 + nameLen);
95
+ const dataStart = localOff + 30 + buf.readUInt16LE(localOff + 26) + buf.readUInt16LE(localOff + 28);
96
+ const raw = buf.subarray(dataStart, dataStart + compSize);
97
+ entries.set(name, method === 0 ? raw : inflateRawSync(raw));
98
+ off += 46 + nameLen + extraLen + commentLen;
99
+ }
100
+ return entries;
101
+ }
102
+
103
+ const strict = process.argv.includes('--strict');
104
+ const problems = [];
105
+
106
+ const srcMain = join(SKILLS, MAIN);
107
+ const srcTest = join(SKILLS, TEST);
108
+ if (!existsSync(srcMain)) {
109
+ console.error(`源技能目录不存在:${srcMain}`);
110
+ process.exit(1);
111
+ }
112
+ const want = readVersion(srcMain);
113
+
114
+ console.log(`源码主题包:v${want.version} | 主表 ${want.mainFieldCount} 字段 | workflowId ${want.workflowId}`);
115
+ console.log('');
116
+
117
+ const rows = [];
118
+ for (const [label, root] of HOSTS) {
119
+ for (const [kind, name, ref] of [['正式', MAIN, srcMain], ['test', TEST, srcTest]]) {
120
+ const dir = join(root, name);
121
+ if (!existsSync(dir)) {
122
+ rows.push([`${label} ${kind}`, '缺失', '-', '-', '-']);
123
+ problems.push(`${label} ${kind} 不存在:${dir}`);
124
+ continue;
125
+ }
126
+ const info = readVersion(dir);
127
+ const d = diffFiles(ref, dir);
128
+ const drift = d.onlyA.length + d.onlyB.length + d.changed.length;
129
+ const detail = [
130
+ ...d.changed.map((f) => `改 ${f}`),
131
+ ...d.onlyA.map((f) => `缺 ${f}`),
132
+ ...d.onlyB.map((f) => `多 ${f}`),
133
+ ].join(' ');
134
+ rows.push([
135
+ `${label} ${kind}`,
136
+ `v${info.version}`,
137
+ info.mainFieldCount,
138
+ drift === 0 ? '一致' : `${drift} 处不同`,
139
+ detail,
140
+ ]);
141
+ if (info.version !== want.version) problems.push(`${label} ${kind} 版本 v${info.version} ≠ 源码 v${want.version}`);
142
+ if (drift) problems.push(`${label} ${kind} 有 ${drift} 个文件与源码不一致:${detail}`);
143
+ }
144
+ }
145
+
146
+ // test 版与正式版只应差 name 一行
147
+ if (existsSync(srcTest)) {
148
+ const d = diffFiles(srcMain, srcTest);
149
+ const onlyName = d.changed.length === 1 && d.changed[0] === 'SKILL.md';
150
+ if (!onlyName || d.onlyA.length || d.onlyB.length) {
151
+ problems.push(`源码 test 版与正式版差异超出 name 行:${[...d.changed, ...d.onlyA].join(',')}`);
152
+ }
153
+ }
154
+
155
+ const w = [14, 10, 8, 12];
156
+ const head = ['位置', '版本', '主表', '与源码比对'];
157
+ console.log(head.map((h, i) => h.padEnd(w[i])).join('') + '明细');
158
+ console.log('-'.repeat(78));
159
+ for (const r of rows) {
160
+ console.log(r.map((c, i) => String(c).padEnd(w[i] ?? 28)).join(''));
161
+ }
162
+
163
+ console.log('');
164
+ console.log('=== zip ===');
165
+ if (!existsSync(ZIP_DIR)) {
166
+ problems.push(`zip 目录不存在:${ZIP_DIR}`);
167
+ } else {
168
+ const zips = readdirSync(ZIP_DIR).filter((f) => f.endsWith('.zip') && f.includes(`v${want.version}`));
169
+ if (!zips.length) problems.push(`未找到 v${want.version} 的 zip`);
170
+ for (const z of zips) {
171
+ const entries = readZipEntries(join(ZIP_DIR, z));
172
+ const skillMd = entries.get('SKILL.md')?.toString('utf8') || '';
173
+ const ver = /^version:\s*(.+)$/m.exec(skillMd.split('\n').slice(0, 40).join('\n'))?.[1]?.trim() || '?';
174
+ const snap = JSON.parse(entries.get('data/fields-snapshot.json')?.toString('utf8') || '{}');
175
+ const ok = ver === want.version && String(snap.mainFieldCount) === want.mainFieldCount
176
+ && String(snap.workflow?.workflowId) === want.workflowId;
177
+ console.log(` ${ok ? 'OK ' : 'FAIL'} ${z} v${ver} / 主表 ${snap.mainFieldCount} / wf ${snap.workflow?.workflowId}`);
178
+ if (!ok) problems.push(`zip 内容与源码不一致:${z}`);
179
+ }
180
+ }
181
+
182
+ console.log('');
183
+ if (problems.length) {
184
+ console.log(`发现 ${problems.length} 个问题:`);
185
+ for (const p of problems) console.log(` - ${p}`);
186
+ process.exit(strict ? 1 : 0);
187
+ }
188
+ console.log('全部一致:源码 / WorkBuddy / 小e / 全局包 / zip');
@@ -75,13 +75,27 @@ function defaultOutput(skillNames) {
75
75
  return path.join(repositoryRoot, 'dist', 'weaver-e10-skills.zip')
76
76
  }
77
77
 
78
- function shouldSkip(entry, relativePath) {
78
+ /**
79
+ * 需要随包分发 scripts/ 与 assets/ 的技能。
80
+ *
81
+ * reception 的全部出件能力都在技能包里:scripts/render.py 负责渲染,
82
+ * assets/行程单模板-泛微.docx 是客户版行程单模板。少了任何一个,
83
+ * 装上去一问就报「render.py 缺失」,而包本身看着是完整的。
84
+ */
85
+ const SKILLS_WITH_ASSETS = new Set(['weaver-e10-reception-flow'])
86
+
87
+ function shouldSkip(entry, relativePath, skillName = '') {
79
88
  if (entry.name === '.DS_Store' || entry.name.startsWith('.')) return true
89
+ // Word 打开文档时生成的 ~$ 临时文件,不能进包
90
+ if (entry.name.startsWith('~$')) return true
80
91
  if (relativePath === 'product.json') return true
81
92
  if (relativePath === 'references/source-manifest.json') return true
82
93
  // 用户意图是本机产物(2026-11-01 起与 default.json 同目录),不随包分发
83
94
  if (relativePath.endsWith('user-intents.json')) return true
84
- if (entry.isDirectory() && ['cache', 'assets', 'node_modules', 'scripts'].includes(entry.name)) return true
95
+ if (entry.isDirectory() && ['cache', 'node_modules'].includes(entry.name)) return true
96
+ if (entry.isDirectory() && ['assets', 'scripts'].includes(entry.name)) {
97
+ return !SKILLS_WITH_ASSETS.has(skillName)
98
+ }
85
99
  return false
86
100
  }
87
101
 
@@ -257,7 +271,7 @@ async function copySkill(skillName, stagingRoot, packagedEntries, productMetadat
257
271
  .sort((a, b) => a.name.localeCompare(b.name))
258
272
  for (const entry of entries) {
259
273
  const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name
260
- if (shouldSkip(entry, relativePath)) continue
274
+ if (shouldSkip(entry, relativePath, skillName)) continue
261
275
  assertSafeRelativePath(relativePath)
262
276
  const source = path.join(sourceRoot, relativePath)
263
277
  const target = path.join(packageRoot, relativePath)
@@ -126,7 +126,12 @@
126
126
  "对公支付",
127
127
  "报销报表",
128
128
  "报表统计",
129
- "报销排名"
129
+ "报销排名",
130
+ "AI预审",
131
+ "规则预审",
132
+ "预审",
133
+ "规则校验",
134
+ "AI规则"
130
135
  ],
131
136
  "weaver-e10-hrm": [
132
137
  "组织管理",
@@ -142,6 +147,29 @@
142
147
  "批量查人员",
143
148
  "批量查岗位"
144
149
  ],
150
+ "weaver-e10-data": [
151
+ "问数",
152
+ "取数",
153
+ "查数据",
154
+ "数据源",
155
+ "数据集",
156
+ "统计",
157
+ "汇总",
158
+ "明细",
159
+ "报表",
160
+ "排名",
161
+ "趋势",
162
+ "有多少条",
163
+ "找表",
164
+ "字段元数据",
165
+ "配置中心",
166
+ "接口入参",
167
+ "场景定位",
168
+ "词库",
169
+ "名词解释",
170
+ "考勤余额",
171
+ "年假余额"
172
+ ],
145
173
  "weaver-e10-esb": [
146
174
  "ESB",
147
175
  "动作流",
@@ -0,0 +1,15 @@
1
+ 本业务域用于泛微 E10 问数(数据源取数 / 配置中心 / 场景定位 / 模块接口调用,共 8 族 31 个 operation)。入口 `SKILL.md` 先路由到 `weaver-e10-shared/SKILL.md`,再给出通道选择表、取数纪律、退出码与禁用边界。具体用法拆到 `references/`:
2
+
3
+ - `datasource.md`:`ds groups/find/describe/tables/fields/fields-dsl` 发现链路,`list/chart/stat/count` 取数四件套,条件树 `--where` 两种写法,`--stat` 的 `aggregator` 枚举,平台范围提示判读。
4
+ - `config-center.md`:`conf` 十一子命令与 `confType` 前缀推导;`module call` 的 confAttrs 驱动、`--show-params` / `--dry-run` 工作流、保留头与 HRM 黑名单、`hasSearchRight=false` 的终端态。
5
+ - `scene-and-misc.md`:`scene` 场景召回(后端 keyword 优先、本地打分兜底、过滤方式走 stderr)、`noun` 词库、`field` 的名称→id 与选项字典分工、`attend` 假期余额按 `key` 取值、`query` 裸 DSL。
6
+
7
+ 调优重点:
8
+
9
+ - `weaver-work-cli data schema` 是 operation 合约第一信息源,`withheldOperations` 声明 doc 系列、`field.id2name`、refusal、exp 四条禁用边界,直接说明不可用,不引导用户绕过。
10
+ - **先选通道再取数**:流程类走 WORKFLOW 模块接口,人员/部门/岗位走 `weaver-work-cli hrm`(data 对 `/api/hrm/` 有黑名单,退出码 6),文档走配置中心 DOCUMENT,只有表单类业务数据才走数据源。
11
+ - **先 `ds describe` 再取数**:字段名、`tableId`、聚合口径都从元数据里取,不凭表名猜字段;`groupId`/`tableId` 等 19 位雪花号一律按字符串传。
12
+ - `ds find` 的真实语义是「抓窗口 + 本地过滤」——后端 `/ds/listByPage` 当前忽略 `name`,**未命中 ≠ 表不存在**,输出里的 `nameFilter.note` 会说明窗口大小。
13
+ - 便捷命令输出**原始响应体**(保住旧 `e10-data` 调用的 jq 路径),`data run` 才输出统一信封;两者共用同一份实现。
14
+ - 退出码语义固定:2 未登录 / 3 非 JSON / 4 权限受限 / 6 HRM 黑名单 / 7 请求失败 / 8 用法。`hasSearchRight=false` 时结果为空但退出码 4,**不得交付为「无数据」**。
15
+ - `tipTimeout=true` 是平台拒绝查询(不是 0 行),`tipTimelimit=true` 是范围被收窄(不能当全区间结论),文案原样转述。
@@ -1,9 +1,10 @@
1
1
  本业务域用于 E10 齐业成费控中心(FNA)。入口 `SKILL.md` 沿用 weaver 风格:CRITICAL 共享前置、能力范围、路由优先级、逐 operation 命令表、执行原则、写操作失败决策树和“不在本 skill 范围”。具体用法拆到 `references/`:
2
2
 
3
- - `catalog.md`:接口目录与按模块路由(四大模块 11 接口 ↔ 13 operations),通用约定与写操作边界。
3
+ - `catalog.md`:接口目录与按模块路由(五大模块 13 接口 ↔ 16 operations),通用约定与写操作边界。
4
4
  - `budget.md`:预算查询(事前申请单预算详情、预算执行报表),含 `formDatas` 二层嵌套与金额列名口径。
5
5
  - `expense-center.md`:费用中心(报销金额 / 借款分段 / 预付核销),含日期口径差异、借款接口缺陷与空响应处理。
6
6
  - `expense-chart.md`:报销报表 AI 问答(自然语言出部门/期间/费用类型报表),含 `kind` 五态、模型额度、全租户数据范围与二开接口依赖。
7
+ - `ai-check-audit.md`:AI 规则预审(提交前按流程规则校验单据,prepare→apply 写链),含 `status` 三态、ID 约定、`checkMode`/`dimension`/`recordId` 语义与结果不确定处理。
7
8
  - `loan-management.md`:借款管理(汇总/列表/提醒还款 prepare→apply 写链),含 menuCode 核对与回查策略。
8
9
  - `invoice-writeoff.md`:发票核销(金额 tab/列表/催票 prepare→apply 写链),含 invoiceStatus 枚举与回查策略。
9
10
  - `source-manifest.json`:源资料指纹与生成产物基线,供更新检测。
@@ -13,6 +14,7 @@ Agent 调优重点:
13
14
  - `weaver-work-cli fna schema` 是 operation 合约第一信息源(inputSchema/required/withheldOperations)。
14
15
  - 业务输入只包含数字 ID 与业务字段,不含 Cookie、ETEAMSID、Token 等认证字段。
15
16
  - 借款费用中心接口只认数字 ID;`menuCode`/`permissionSetCode` 环境相关需与环境核对。
16
- - 提醒还款/催票必须走 `fna.*.prepare -> 用户明确确认 -> apply`,只接受 CLI 生成的 continuation,不手工构造。
17
+ - 提醒还款/催票/AI 预审必须走 `fna.*.prepare -> 用户明确确认 -> apply`,只接受 CLI 生成的 continuation,不手工构造。
18
+ - AI 预审按 `data.status` 回话(`checked`/`empty`/`unparsed`),`empty` 不是报错;`workflowId`/`requestId`/`nodeId` 不得传 0。
17
19
  - 结果为 `partial/write_uncertain` 时停止并做一次只读回查,不自动重放写请求。
18
20
  - 借款金额查询已知只统计首条记录,对外汇报注明口径。