weaver-work-cli 0.1.47 → 0.1.49

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 (229) hide show
  1. package/dist/chunks/{archive-oa-BBDP7AKJ.js → archive-oa-57R2FYHV.js} +565 -17
  2. package/dist/chunks/{attachment-content-MCXQBD6N.js → attachment-content-MU2LPI5P.js} +3 -3
  3. package/dist/chunks/{chunk-J2VEB5K3.js → chunk-2BQESR2U.js} +2 -2
  4. package/dist/chunks/{chunk-727FH2NI.js → chunk-2IGZUMNG.js} +15 -2
  5. package/dist/chunks/{chunk-IP4CWQCF.js → chunk-3NV2ETZR.js} +8 -8
  6. package/dist/chunks/{chunk-OXHHJWNC.js → chunk-3X7VOSBA.js} +1 -1
  7. package/dist/chunks/chunk-5QYE52LG.js +223 -0
  8. package/dist/chunks/{chunk-IRMIEDXN.js → chunk-6GWU63YF.js} +1 -1
  9. package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
  10. package/dist/chunks/{chunk-Q4OYAQYH.js → chunk-72MI3MBX.js} +4 -0
  11. package/dist/chunks/{chunk-AD46OMQK.js → chunk-BRRW7CWA.js} +121 -46
  12. package/dist/chunks/{chunk-76H3IKH6.js → chunk-D2QRZUW4.js} +221 -37
  13. package/dist/chunks/{chunk-GSZTA43P.js → chunk-EJVA5ZVB.js} +2 -2
  14. package/dist/chunks/{chunk-4RWS2YYL.js → chunk-GEOMANP7.js} +3 -3
  15. package/dist/chunks/{chunk-LIEQJIGM.js → chunk-GR76ZDDX.js} +0 -3
  16. package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
  17. package/dist/chunks/chunk-JEQHNNSS.js +158 -0
  18. package/dist/chunks/{chunk-6V5ZPKHV.js → chunk-K3BT54CU.js} +4 -4
  19. package/dist/chunks/{chunk-6AXKWFKG.js → chunk-KV5SOWMS.js} +4 -4
  20. package/dist/chunks/{chunk-JB34OE7R.js → chunk-NBEWUR7L.js} +1 -1
  21. package/dist/chunks/{chunk-PSOMGA3U.js → chunk-ZKEUGS2U.js} +36 -7
  22. package/dist/chunks/{conflict-H7EHQXYY.js → conflict-6347A7YK.js} +2 -2
  23. package/dist/chunks/{contract-3QLAGYQL.js → contract-N6P2HIIE.js} +425 -187
  24. package/dist/chunks/{create-flow-VRVJEOBX.js → create-flow-7WG7LVX5.js} +6 -6
  25. package/dist/chunks/data-QO7QWOIV.js +2525 -0
  26. package/dist/chunks/{ehr-SH2LM3NK.js → ehr-XI4BIVR2.js} +16 -5
  27. package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
  28. package/dist/chunks/{env-66FPSJDV.js → env-LHRKSLG6.js} +2 -2
  29. package/dist/chunks/{factory-UH2TZBVA.js → factory-2H7Z4RWJ.js} +1 -1
  30. package/dist/chunks/{group-chat-CAKMMV7K.js → group-chat-EW6PNDDT.js} +3 -3
  31. package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
  32. package/dist/chunks/{im-NJB7ZYMH.js → im-3RCNL5GT.js} +107 -1
  33. package/dist/chunks/{invoice-UEAHSYAE.js → invoice-FXWH5GPO.js} +2 -71
  34. package/dist/chunks/{lazy-dispatch-25XGTXLM.js → lazy-dispatch-XSAHDK6Z.js} +3 -3
  35. package/dist/chunks/{meeting-VTBFW4HI.js → meeting-N2FQBHXI.js} +10 -10
  36. package/dist/chunks/org-NFE7X7FK.js +12 -0
  37. package/dist/chunks/{reception-5WITA44R.js → reception-MYOKJULO.js} +905 -116
  38. package/dist/chunks/{recruit-stage-CAKZTUA7.js → recruit-stage-FKWS5UQF.js} +118 -29
  39. package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
  40. package/dist/chunks/{registry-AQVGHUM6.js → registry-7VZ6YJUF.js} +2 -2
  41. package/dist/chunks/{registry-PVUZQDDQ.js → registry-BUTEDK3C.js} +1 -1
  42. package/dist/chunks/{registry-JVQBLFQ5.js → registry-CKUVBS53.js} +10 -10
  43. package/dist/chunks/{room-recommend-5U55FMXZ.js → room-recommend-MBCYENQ2.js} +4 -4
  44. package/dist/chunks/{schedule-IDETODCA.js → schedule-5IFMCXME.js} +4 -4
  45. package/dist/chunks/{workflow-BSYT5TGL.js → workflow-2TRU2ZSP.js} +5 -5
  46. package/dist/core/refs.js +19 -2
  47. package/dist/index.js +20 -15
  48. package/dist/shortcuts/archive-oa/constants.js +42 -0
  49. package/dist/shortcuts/archive-oa/host.js +2 -2
  50. package/dist/shortcuts/archive-oa/index.js +38 -0
  51. package/dist/shortcuts/archive-oa/operations/borrow-car.js +117 -3
  52. package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
  53. package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
  54. package/dist/shortcuts/archive-oa/operations/my-borrow-contract.js +271 -0
  55. package/dist/shortcuts/archive-oa/operations/registry.js +9 -4
  56. package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
  57. package/dist/shortcuts/contract/index.js +9 -1
  58. package/dist/shortcuts/contract/manifest.js +14 -2
  59. package/dist/shortcuts/contract/operations/card.js +231 -0
  60. package/dist/shortcuts/contract/operations/registry.js +2 -0
  61. package/dist/shortcuts/contract/operations/review.js +16 -5
  62. package/dist/shortcuts/contract/operations/summary.js +25 -17
  63. package/dist/shortcuts/data/errors.js +64 -0
  64. package/dist/shortcuts/data/host.js +140 -0
  65. package/dist/shortcuts/data/index.js +429 -0
  66. package/dist/shortcuts/data/manifest.js +133 -0
  67. package/dist/shortcuts/data/operations/attend.js +62 -0
  68. package/dist/shortcuts/data/operations/conf.js +384 -0
  69. package/dist/shortcuts/data/operations/ds.js +686 -0
  70. package/dist/shortcuts/data/operations/field.js +68 -0
  71. package/dist/shortcuts/data/operations/index.js +65 -0
  72. package/dist/shortcuts/data/operations/module.js +383 -0
  73. package/dist/shortcuts/data/operations/noun.js +102 -0
  74. package/dist/shortcuts/data/operations/query.js +85 -0
  75. package/dist/shortcuts/data/operations/scene.js +235 -0
  76. package/dist/shortcuts/data/operations/shared.js +279 -0
  77. package/dist/shortcuts/ehr/operations/recruit-write.js +22 -5
  78. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +28 -12
  79. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
  80. package/dist/shortcuts/ehr/recruit-stage/shared.js +90 -8
  81. package/dist/shortcuts/im/index.js +128 -0
  82. package/dist/shortcuts/im/operations/session.js +6 -0
  83. package/dist/shortcuts/index.js +5 -0
  84. package/dist/shortcuts/invoice/host.js +0 -3
  85. package/dist/shortcuts/invoice/manifest.js +0 -1
  86. package/dist/shortcuts/invoice/operations/reim-subsidy.js +1 -71
  87. package/dist/shortcuts/meeting/operations/eb/conflict.js +26 -3
  88. package/dist/shortcuts/meeting/operations/eb/continuation-alias.js +63 -0
  89. package/dist/shortcuts/meeting/operations/eb/create-flow.js +71 -12
  90. package/dist/shortcuts/meeting/operations/eb/factory.js +5 -3
  91. package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
  92. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  93. package/dist/shortcuts/reception/constants.js +11 -0
  94. package/dist/shortcuts/reception/host.js +33 -1
  95. package/dist/shortcuts/reception/index.js +22 -1
  96. package/dist/shortcuts/reception/manifest.js +55 -2
  97. package/dist/shortcuts/reception/operations/ask.js +37 -1
  98. package/dist/shortcuts/reception/operations/compose.js +124 -3
  99. package/dist/shortcuts/reception/operations/doc.js +59 -0
  100. package/dist/shortcuts/reception/operations/docrender.js +25 -1
  101. package/dist/shortcuts/reception/operations/leads.js +245 -0
  102. package/dist/shortcuts/reception/operations/markdown.js +22 -0
  103. package/dist/shortcuts/reception/operations/panels.js +84 -21
  104. package/dist/shortcuts/reception/operations/registry.js +2 -0
  105. package/dist/shortcuts/reception/operations/render.js +76 -3
  106. package/dist/shortcuts/reception/operations/restaurant-rooms.js +118 -0
  107. package/dist/shortcuts/reception/operations/restaurant.js +264 -0
  108. package/dist/shortcuts/reception/operations/restaurantrooms.js +42 -0
  109. package/dist/shortcuts/reception/operations/schedule.js +7 -1
  110. package/dist/shortcuts/reception/upload.js +22 -6
  111. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +28 -12
  112. package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
  113. package/dist/shortcuts/recruit-stage/shared.js +99 -14
  114. package/docs/SKILL.md +1 -0
  115. package/docs/_catalog.md +3 -0
  116. package/docs/archive-oa.md +4 -2
  117. package/docs/data.md +149 -0
  118. package/docs/reception.md +59 -5
  119. package/package.json +1 -1
  120. package/scripts/check-skill-sync.mjs +188 -0
  121. package/scripts/package-skill.mjs +17 -3
  122. package/skill-template/business-info.json +23 -0
  123. package/skill-template/domains/archive-oa.md +2 -1
  124. package/skill-template/domains/data.md +15 -0
  125. package/skill-template/master-skill-template.md +1 -0
  126. package/skill-template/skill-template.md +1 -0
  127. package/skills/weaver-e10-archive-oa/SKILL.md +35 -7
  128. package/skills/weaver-e10-archive-oa/references/borrow-car.md +32 -7
  129. package/skills/weaver-e10-archive-oa/references/contract-search.md +105 -4
  130. package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +2 -2
  131. package/skills/weaver-e10-archive-oa/references/my-borrow-contract.md +97 -0
  132. package/skills/weaver-e10-archive-oa/references/my-borrow.md +6 -1
  133. package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +48 -2
  134. package/skills/weaver-e10-calendar/SKILL.md +1 -1
  135. package/skills/weaver-e10-calendar/references/calendar-query.md +1 -1
  136. package/skills/weaver-e10-calendar/references/calendar-write.md +9 -9
  137. package/skills/weaver-e10-cowork/SKILL.md +9 -6
  138. package/skills/weaver-e10-data/SKILL.md +118 -0
  139. package/skills/weaver-e10-data/references/config-center.md +90 -0
  140. package/skills/weaver-e10-data/references/datasource.md +136 -0
  141. package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
  142. package/skills/weaver-e10-jinchengda/SKILL.md +10 -7
  143. package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +17 -0
  144. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +263 -35
  145. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +8 -5
  146. package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
  147. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +175 -22
  148. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
  149. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +1 -1
  150. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +1 -1
  151. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +124 -19
  152. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +2 -2
  153. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +4 -4
  154. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -0
  155. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
  156. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
  157. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +1 -1
  158. package/skills/weaver-e10-jinchengda/references/contract-risk-report-template.html +178 -0
  159. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  160. package/skills/weaver-e10-jinchengda/references/orchestration.md +7 -7
  161. package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +279 -0
  162. package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +450 -0
  163. package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +358 -0
  164. package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +505 -0
  165. package/skills/weaver-e10-jucailin/SKILL.md +7 -4
  166. package/skills/weaver-e10-jucailin/references/recruit-create.md +3 -2
  167. package/skills/weaver-e10-jucailin/references/recruit-read.md +2 -1
  168. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +3 -3
  169. package/skills/weaver-e10-jucailin/references/safety-boundaries.md +30 -2
  170. package/skills/weaver-e10-mail/SKILL.md +17 -4
  171. package/skills/weaver-e10-meeting/SKILL.md +129 -412
  172. package/skills/weaver-e10-meeting/references/create-flow.md +188 -0
  173. package/skills/weaver-e10-meeting/references/create-guardrails.md +234 -0
  174. package/skills/weaver-e10-meeting/references/pitfalls.md +40 -0
  175. package/skills/weaver-e10-reception-flow/SKILL.md +77 -19
  176. package/skills/weaver-e10-reception-flow/data/fields-snapshot.json +628 -26
  177. package/skills/weaver-e10-reception-flow/references/fields-snapshot.md +96 -26
  178. package/skills/weaver-e10-reception-flow/references/guide.md +4 -3
  179. package/skills/weaver-e10-reception-flow/scripts/render.py +84 -3
  180. package/skills/weaver-e10-recruit-stage/SKILL.md +45 -12
  181. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +78 -8
  182. package/skills/weaver-e10-recruit-stage/references/position-templates.md +5 -0
  183. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +1 -1
  184. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +1 -1
  185. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -11
  186. package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +1 -1
  187. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +1 -1
  188. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
  189. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +16 -0
  190. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +1 -1
  191. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +1 -1
  192. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +1 -1
  193. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +169 -0
  194. package/skills/weaver-e10-shijingran/SKILL.md +6 -2
  195. package/skills/weaver-e10-shijingran/references/source-manifest.json +5 -4
  196. package/skills/weaver-e10-workflow/SKILL.md +1 -1
  197. package/skills/weaver-e10-yepiaotong/SKILL.md +8 -4
  198. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +1 -1
  199. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
  200. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +2 -2
  201. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +1 -1
  202. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +1 -1
  203. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +1 -0
  204. package/skills/weaver-e10-yimiaoban/SKILL.md +2 -1
  205. package/skills/weaver-e10-yimiaoban/references/msg-write.md +32 -0
  206. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +3 -0
  207. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +11 -11
  208. package/dist/chunks/{ebuilder-form-GWDTKEI2.js → ebuilder-form-CBYI6CQ6.js} +3 -3
  209. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-README.md +0 -0
  210. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-SKILL.md +0 -0
  211. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-openai.yaml +0 -0
  212. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-position-templates.md +0 -0
  213. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +0 -0
  214. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +0 -0
  215. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +0 -0
  216. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +0 -0
  217. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +0 -0
  218. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +0 -0
  219. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +0 -0
  220. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +0 -0
  221. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +0 -0
  222. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +0 -0
  223. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +0 -0
  224. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +0 -0
  225. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +0 -0
  226. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +0 -0
  227. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +0 -0
  228. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +0 -0
  229. /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +0 -0
@@ -0,0 +1,429 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { createDataHost } from './host.js';
3
+ import { dataManifest } from './manifest.js';
4
+ import { dataValidationError } from './errors.js';
5
+ import { executeDataOperation, operationNames } from './operations/index.js';
6
+ /** commander 的 camelCase 选项 → operation 的 snake_case 输入。 */
7
+ export function toInput(options) {
8
+ const input = {};
9
+ for (const [key, value] of Object.entries(options)) {
10
+ if (value === undefined)
11
+ continue;
12
+ input[key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)] = value;
13
+ }
14
+ // `--no-escalate` 在 commander 里表现为 escalate=false
15
+ if (input.escalate === false) {
16
+ input.no_escalate = true;
17
+ delete input.escalate;
18
+ }
19
+ return input;
20
+ }
21
+ async function readStdin() {
22
+ const chunks = [];
23
+ for await (const chunk of process.stdin)
24
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
25
+ return Buffer.concat(chunks).toString('utf8');
26
+ }
27
+ async function inputFrom(options) {
28
+ let input = {};
29
+ if (options.input && options.inputJson) {
30
+ throw dataValidationError('input_conflict', '不能同时传 --input 和 --input-json');
31
+ }
32
+ if (options.inputJson)
33
+ input = parseInput(String(options.inputJson), '--input-json');
34
+ if (options.input) {
35
+ let raw;
36
+ try {
37
+ raw = options.input === '-' ? await readStdin() : await readFile(String(options.input), 'utf8');
38
+ }
39
+ catch {
40
+ throw dataValidationError('input_unreadable', `无法读取 --input:${String(options.input)}`);
41
+ }
42
+ input = parseInput(raw, '--input');
43
+ }
44
+ return input;
45
+ }
46
+ function parseInput(raw, label) {
47
+ try {
48
+ const parsed = JSON.parse(raw.replace(/^\uFEFF+/g, ''));
49
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
50
+ throw new Error('not an object');
51
+ return parsed;
52
+ }
53
+ catch {
54
+ throw dataValidationError('input_invalid', `${label} 不是合法 JSON 对象`);
55
+ }
56
+ }
57
+ /**
58
+ * 便捷命令的输出口径:**与旧 CLI 逐字一致**。
59
+ *
60
+ * 技能里有 453 处 `e10-data … --json` 调用,jq 路径直指响应体(如 `.data.records`)。
61
+ * 因此便捷命令一律输出**原始响应体**(不再套一层信封),且关闭「超预算落盘」,
62
+ * 避免大结果被替换成 `{refId, preview…}` 而打断下游解析。
63
+ * 需要统一信封(`{schemaVersion, ok, operation, data, warnings}`)时走 `data run`。
64
+ */
65
+ function emit(ctx, result) {
66
+ ctx.output.write(result.data, { text: result.text, persist: false });
67
+ }
68
+ function emitEnvelope(ctx, operation, result) {
69
+ ctx.output.write({
70
+ schemaVersion: 1,
71
+ ok: true,
72
+ operation,
73
+ data: result.data === undefined ? null : result.data,
74
+ warnings: [],
75
+ }, { text: result.text, persist: false });
76
+ }
77
+ async function run(ctx, operation, input, envelope) {
78
+ const host = createDataHost(ctx);
79
+ const result = await executeDataOperation(operation, input, host);
80
+ if (envelope)
81
+ emitEnvelope(ctx, operation, result);
82
+ else
83
+ emit(ctx, result);
84
+ }
85
+ export const dataShortcut = {
86
+ name: 'data',
87
+ description: '泛微E10数据助手 CLI(数据源查询 / 配置中心 / 场景定位)',
88
+ category: 'shortcut',
89
+ register({ program, action }) {
90
+ const data = program.command('data').description('泛微E10数据助手(DSL 查询 / 数据源发现 / 配置中心 / 场景定位)');
91
+ data.command('schema')
92
+ .description('Print data operation manifest for agents')
93
+ .action(action((ctx) => {
94
+ ctx.output.write(dataManifest, { json: true, persist: false });
95
+ }));
96
+ data.command('run')
97
+ .description('Run a data operation with JSON input')
98
+ .argument('<operation>', `operation name, e.g. data.ds.count(共 ${operationNames().length} 个)`)
99
+ .option('--input <path>', 'JSON input file, or - for stdin')
100
+ .option('--input-json <json>', 'inline JSON input object')
101
+ .action(action(async (ctx, operation, options) => {
102
+ await run(ctx, String(operation), await inputFrom(options), true);
103
+ }));
104
+ // ---------------------------------------------------------------- query
105
+ data.command('query')
106
+ .description('直接执行 DSL 查询(executeQueryDsl)')
107
+ .option('--conn <connId>', '数据连接 ID(CONN_*)')
108
+ .option('--model <model>', '模型标识,如 dw / ebuilder / flow')
109
+ .option('--schema <schema>', '库名')
110
+ .option('--table-id <id>', '数据集 / 流程 ID')
111
+ .option('--dsl <json|@file>', 'DSL 查询体')
112
+ .option('--debug [bool]', '回显 SQL(true/false)')
113
+ .option('--dimension <key>', '后端 confKey(URL query,恒定发送)')
114
+ .option('--conf-group <group>', 'confGroup(URL query,恒定发送)')
115
+ .option('--confGroup <group>', '同 --conf-group')
116
+ .option('--username <name>', '问句中出现的人名(无则传空)')
117
+ .option('--start-date <ym>', '问句日期起始年月(无则传空)')
118
+ .action(action(async (ctx, options) => {
119
+ await run(ctx, 'data.dsl.query', toInput(options), false);
120
+ }));
121
+ // ---------------------------------------------------------------- ds
122
+ const ds = data.command('ds').description('数据源:分组 / 找表 / 元数据 / 取数');
123
+ ds.command('groups')
124
+ .description('内置分组清单(仅用于 ds find 的默认扫描候选集)')
125
+ .option('--pattern <sub>', '按 groupId / 中文名过滤')
126
+ .action(action(async (ctx, options) => {
127
+ await run(ctx, 'data.ds.groups', toInput(options), false);
128
+ }));
129
+ ds.command('find')
130
+ .description('按关键词跨分组找表(并发扇出 + 本地过滤 + 路由建议)')
131
+ .option('--name <keyword>', '表名关键词')
132
+ .option('--keyword <keyword>', '同 --name')
133
+ .option('--source-type <type>', 'LOGIC / ETEAMS,默认 LOGIC')
134
+ .option('--size <n>', '每页条数(≤2000),默认 100')
135
+ .option('--pages <n>', '抓取页数(≤50),默认 1')
136
+ .option('--concurrency <n>', '进程内并发数,默认 10')
137
+ .option('--groups <a,b>', '显式指定扫描分组')
138
+ .option('--all-groups', '扫描全部 58 个分组')
139
+ .option('--max-groups <n>', '默认扫描集上限,默认 6')
140
+ .option('--app-id <id>', 'EB 分组按应用分域时显式传入')
141
+ .option('--limit <n>', '候选上限')
142
+ .option('--loose', '关闭本地关键词过滤')
143
+ .option('--no-escalate', '未命中时不升级全扫')
144
+ .action(action(async (ctx, options) => {
145
+ await run(ctx, 'data.ds.find', toInput(options), false);
146
+ }));
147
+ ds.command('describe')
148
+ .description('并发取字段元数据 + 词库,并给出关联字段/通道提示')
149
+ .option('--group <groupId>', '分组 ID')
150
+ .option('--table <tableId>', '数据集 ID')
151
+ .option('--source-type <type>', 'LOGIC / ETEAMS')
152
+ .option('--app-id <id>', 'EB 分组应用 ID')
153
+ .option('--skill <skillKey>', '词库 skillKey,默认 data-source-query')
154
+ .option('--require', '存在失败分支时直接失败')
155
+ .action(action(async (ctx, options) => {
156
+ await run(ctx, 'data.ds.describe', toInput(options), false);
157
+ }));
158
+ ds.command('tables')
159
+ .description('列分组下的数据集(表)清单')
160
+ .option('--group <groupId>', '分组 ID')
161
+ .option('--name <keyword>', '表名关键词')
162
+ .option('--page <n>', '页码,默认 1')
163
+ .option('--size <n>', '每页条数,默认 100')
164
+ .option('--source-type <type>', 'LOGIC / ETEAMS')
165
+ .option('--app-id <id>', 'EB 分组应用 ID')
166
+ .action(action(async (ctx, options) => {
167
+ await run(ctx, 'data.ds.tables', toInput(options), false);
168
+ }));
169
+ ds.command('fields')
170
+ .description('取数据集字段元数据(/api/ebuilder/common/ds/fields)')
171
+ .option('--group <groupId>', '分组 ID')
172
+ .option('--table <tableId>', '数据集 ID')
173
+ .option('--source-type <type>', 'LOGIC / ETEAMS')
174
+ .option('--app-id <id>', 'EB 分组应用 ID')
175
+ .action(action(async (ctx, options) => {
176
+ await run(ctx, 'data.ds.fields', toInput(options), false);
177
+ }));
178
+ ds.command('fields-dsl')
179
+ .description('取 DSL 口径字段元数据(含 dataKey / formTableId)')
180
+ .option('--group <groupId>', '分组 ID')
181
+ .option('--table <tableId>', '数据集 ID')
182
+ .option('--source-type <type>', 'LOGIC / ETEAMS')
183
+ .option('--app-id <id>', 'EB 分组应用 ID')
184
+ .action(action(async (ctx, options) => {
185
+ await run(ctx, 'data.ds.fields-dsl', toInput(options), false);
186
+ }));
187
+ ds.command('list')
188
+ .description('明细列表取数(getListDatas)')
189
+ .option('--group <groupId>', '分组 ID')
190
+ .option('--table <tableId>', '数据集 ID')
191
+ .option('--fields <a,b|@f>', '返回字段(逗号分隔)')
192
+ .option('--where <json|@file>', '条件树 / 条件数组')
193
+ .option('--order <expr>', '排序,如 "create_time desc"')
194
+ .option('--page <n>', '页码,默认 1')
195
+ .option('--size <n>', '每页条数,默认 20')
196
+ .option('--source-type <type>', 'LOGIC / ETEAMS')
197
+ .option('--app-id <id>', 'EB 分组应用 ID')
198
+ .action(action(async (ctx, options) => {
199
+ await run(ctx, 'data.ds.list', toInput(options), false);
200
+ }));
201
+ ds.command('chart')
202
+ .description('分组聚合取数(getChartDatas)')
203
+ .option('--group <groupId>', '分组 ID')
204
+ .option('--table <tableId>', '数据集 ID')
205
+ .option('--group-by <a,b>', '分组字段')
206
+ .option('--stat <json|@file>', '统计字段(fieldId + aggregator)')
207
+ .option('--where <json|@file>', '条件树 / 条件数组')
208
+ .option('--page <n>', '页码')
209
+ .option('--size <n>', '每页条数,默认 100')
210
+ .option('--source-type <type>', 'LOGIC / ETEAMS')
211
+ .option('--app-id <id>', 'EB 分组应用 ID')
212
+ .action(action(async (ctx, options) => {
213
+ await run(ctx, 'data.ds.chart', toInput(options), false);
214
+ }));
215
+ ds.command('stat')
216
+ .description('统计字段取数(getStatDatas)')
217
+ .option('--group <groupId>', '分组 ID')
218
+ .option('--table <tableId>', '数据集 ID')
219
+ .option('--stat <json|@file>', '统计字段(fieldId + aggregator)')
220
+ .option('--where <json|@file>', '条件树 / 条件数组')
221
+ .option('--source-type <type>', 'LOGIC / ETEAMS')
222
+ .option('--app-id <id>', 'EB 分组应用 ID')
223
+ .action(action(async (ctx, options) => {
224
+ await run(ctx, 'data.ds.stat', toInput(options), false);
225
+ }));
226
+ ds.command('count')
227
+ .description('计数(getCountData)')
228
+ .option('--group <groupId>', '分组 ID')
229
+ .option('--table <tableId>', '数据集 ID')
230
+ .option('--where <json|@file>', '条件树 / 条件数组')
231
+ .option('--source-type <type>', 'LOGIC / ETEAMS')
232
+ .option('--app-id <id>', 'EB 分组应用 ID')
233
+ .action(action(async (ctx, options) => {
234
+ await run(ctx, 'data.ds.count', toInput(options), false);
235
+ }));
236
+ // ---------------------------------------------------------------- noun
237
+ const noun = data.command('noun').description('词库(ChatBI 名词解释)');
238
+ noun.command('list')
239
+ .description('按 skill 取词库')
240
+ .option('--skill <skillKey>', 'skill 标识')
241
+ .option('--source-type <type>', '数据源类型')
242
+ .option('--source-group <groupId>', '数据源分组')
243
+ .option('--source-table <tableId>', '数据集 ID')
244
+ .action(action(async (ctx, options) => {
245
+ await run(ctx, 'data.noun.list', toInput(options), false);
246
+ }));
247
+ noun.command('scope')
248
+ .description('按数据集生效范围批量取词库')
249
+ .option('--ids <a,b|@f>', '数据集 id 列表(取自 scene items)')
250
+ .action(action(async (ctx, options) => {
251
+ await run(ctx, 'data.noun.scope', toInput(options), false);
252
+ }));
253
+ // ---------------------------------------------------------------- field
254
+ const field = data.command('field').description('字段值翻译 / 选项字典');
255
+ field.command('name2id')
256
+ .description('名称 → 字段值 id 候选(浏览按钮类字段)')
257
+ .option('--module <module>', '模块标识,如 hrm / workflow')
258
+ .option('--type <browserType>', '浏览按钮类型')
259
+ .option('--name <text>', '要翻译的名称')
260
+ .option('--form-param <json>', '表单参数')
261
+ .option('--eb-browser-param <json|@file>', 'EB 浏览参数')
262
+ .option('--property-type <type>', '属性类型')
263
+ .action(action(async (ctx, options) => {
264
+ await run(ctx, 'data.field.name2id', toInput(options), false);
265
+ }));
266
+ field.command('options')
267
+ .description('Select/Radio/Checkbox 选项值字典(id↔name)')
268
+ .option('--field-name <name>', '字段名(ds fields 返回的 name)')
269
+ .option('--obj-id <id>', '数据集 / 表 ID')
270
+ .option('--group <groupId>', '分组 ID')
271
+ .option('--source-type <type>', 'LOGIC / ETEAMS')
272
+ .action(action(async (ctx, options) => {
273
+ await run(ctx, 'data.field.options', toInput(options), false);
274
+ }));
275
+ // ---------------------------------------------------------------- conf
276
+ const conf = data.command('conf').description('环境参数配置中心(chatBi config map)');
277
+ conf.command('get')
278
+ .description('按 confKey 取单条配置')
279
+ .argument('<key>', 'confKey(CONN_/DS_/WF_/API_ 前缀可推导 confType)')
280
+ .option('--type <confType>', 'confType(默认由前缀推导)')
281
+ .option('--group <confGroup>', 'confGroup(confType=api 时建议显式指定)')
282
+ .action(action(async (ctx, key, options) => {
283
+ await run(ctx, 'data.conf.get', { ...toInput(options), keys: [key] }, false);
284
+ }));
285
+ conf.command('batch')
286
+ .description('批量取配置')
287
+ .argument('<keys...>', 'confKey 列表')
288
+ .option('--type <confType>', 'confType')
289
+ .option('--group <confGroup>', 'confGroup')
290
+ .action(action(async (ctx, keys, options) => {
291
+ await run(ctx, 'data.conf.batch', { ...toInput(options), keys }, false);
292
+ }));
293
+ conf.command('batch-file')
294
+ .description('按文件批量取配置(逐条单查)')
295
+ .argument('<file>', 'JSON 文件,或 @items.json')
296
+ .action(action(async (ctx, file, options) => {
297
+ await run(ctx, 'data.conf.batch-file', { ...toInput(options), batch_file: file }, false);
298
+ }));
299
+ conf.command('group')
300
+ .description('按 confType + confGroup 批量取回整组配置')
301
+ .argument('<confType>', 'confType,如 api')
302
+ .argument('<confGroup>', 'confGroup,如 workflow')
303
+ .option('--key <confKey>', '只取该组下的一条')
304
+ .action(action(async (ctx, confType, confGroup, options) => {
305
+ await run(ctx, 'data.conf.group', { ...toInput(options), keys: [confType, confGroup] }, false);
306
+ }));
307
+ conf.command('group-file')
308
+ .description('按文件批量取多个分组的配置')
309
+ .argument('<file>', 'JSON 文件,形如 [{confType, confGroup}]')
310
+ .action(action(async (ctx, file, options) => {
311
+ await run(ctx, 'data.conf.group-file', { ...toInput(options), group_file: file }, false);
312
+ }));
313
+ conf.command('resolve')
314
+ .description('把文本里的 #{KEY} 占位符替换为配置值')
315
+ .argument('<text>', "含 #{KEY} 的文本,或 @file.txt")
316
+ .option('--group <confGroup>', 'confGroup')
317
+ .action(action(async (ctx, text, options) => {
318
+ await run(ctx, 'data.conf.resolve', { ...toInput(options), text }, false);
319
+ }));
320
+ conf.command('resolve-file')
321
+ .description('按文件替换 #{KEY} 占位符')
322
+ .argument('<path>', '文本文件路径')
323
+ .option('--group <confGroup>', 'confGroup')
324
+ .action(action(async (ctx, path, options) => {
325
+ await run(ctx, 'data.conf.resolve-file', { ...toInput(options), path }, false);
326
+ }));
327
+ conf.command('add')
328
+ .description('新增配置(已存在默认跳过)')
329
+ .argument('<key>', 'confKey')
330
+ .option('--value <v>', '配置值')
331
+ .option('--name <n>', '配置名称')
332
+ .option('--attrs <json>', 'confAttrs')
333
+ .option('--type <confType>', 'confType')
334
+ .option('--group <confGroup>', 'confGroup')
335
+ .option('--force', '已存在时也重建')
336
+ .action(action(async (ctx, key, options) => {
337
+ await run(ctx, 'data.conf.add', { ...toInput(options), keys: [key] }, false);
338
+ }));
339
+ conf.command('add-file')
340
+ .description('按文件批量新增配置')
341
+ .argument('<file>', 'JSON 文件')
342
+ .option('--type <confType>', 'confType')
343
+ .option('--group <confGroup>', 'confGroup')
344
+ .action(action(async (ctx, file, options) => {
345
+ await run(ctx, 'data.conf.add-file', { ...toInput(options), add_file: file }, false);
346
+ }));
347
+ conf.command('update')
348
+ .description('更新配置的 value / name / attrs')
349
+ .argument('<key>', 'confKey')
350
+ .option('--value <v>', '配置值')
351
+ .option('--name <n>', '配置名称')
352
+ .option('--attrs <json>', 'confAttrs')
353
+ .option('--type <confType>', 'confType')
354
+ .option('--group <confGroup>', 'confGroup')
355
+ .action(action(async (ctx, key, options) => {
356
+ await run(ctx, 'data.conf.update', { ...toInput(options), keys: [key] }, false);
357
+ }));
358
+ conf.command('delete')
359
+ .description('删除配置')
360
+ .argument('<key>', 'confKey')
361
+ .option('--type <confType>', 'confType')
362
+ .option('--group <confGroup>', 'confGroup')
363
+ .action(action(async (ctx, key, options) => {
364
+ await run(ctx, 'data.conf.delete', { ...toInput(options), keys: [key] }, false);
365
+ }));
366
+ // ---------------------------------------------------------------- scene
367
+ const scene = data.command('scene').description('场景定位元数据(getSceneGroups)');
368
+ scene.command('groups')
369
+ .description('场景分组骨架')
370
+ .option('--client <client>', 'agent / all / connector,默认 agent')
371
+ .action(action(async (ctx, options) => {
372
+ await run(ctx, 'data.scene.groups', toInput(options), false);
373
+ }));
374
+ scene.command('items')
375
+ .description('组内条目(接口 / 数据源)')
376
+ .option('--group <groupId>', '分组 ID(19 位雪花号按字符串传)')
377
+ .option('--client <client>', 'agent / all / connector')
378
+ .action(action(async (ctx, options) => {
379
+ await run(ctx, 'data.scene.items', toInput(options), false);
380
+ }));
381
+ scene.command('search')
382
+ .description('关键词候选召回(后端 keyword 优先,本地打分兜底)')
383
+ .option('--keywords <a,b>', '关键词(也支持空格 / 、 分隔)')
384
+ .option('--keyword <a,b>', '同 --keywords')
385
+ .option('--client <client>', 'agent / all / connector')
386
+ .option('--max-groups <n>', '候选分组上限,默认 3')
387
+ .option('--max-items <n>', '每组条目上限,默认 12')
388
+ .option('--scope-group-id <id>', '限定单个分组')
389
+ .option('--server-filter <mode>', 'auto / on / off,默认 auto')
390
+ .action(action(async (ctx, options) => {
391
+ await run(ctx, 'data.scene.search', toInput(options), false);
392
+ }));
393
+ // ---------------------------------------------------------------- module
394
+ const moduleCommand = data.command('module').description('模块配置接口调用(配置中心驱动)');
395
+ moduleCommand.command('call')
396
+ .description('按 confAttrs 组参并调用接口(已确定模块 + 接口之后用)')
397
+ .option('--conf-key <key>', 'confKey')
398
+ .option('--group <module>', '模块唯一标识,如 WORKFLOW / EHR / DOCUMENT')
399
+ .option('--type <confType>', 'confType,默认 api')
400
+ .option('--conf-file <path>', '本地 confAttrs 文件(跳过配置读取)')
401
+ .option('--args <json|@file>', '业务参数(JSON 对象)')
402
+ .option('--query <k=v&k2=v2>', '业务参数(query 串,与 --args 合并)')
403
+ .option('--header <k: v>', '额外请求头(单个)')
404
+ .option('--headers <json|@file>', '额外请求头(JSON 对象)')
405
+ .option('--method <GET|POST|FORM>', '提交方式,默认取 confAttrs.http_method')
406
+ .option('--limit <n>', '行数上限,默认 50;0 = 不截断')
407
+ .option('--fields <a,b|@f>', '只保留这些行字段')
408
+ .option('--raw', '原样输出响应体')
409
+ .option('--show-params', '只打印入/出参说明,不调接口')
410
+ .option('--full', '--show-params 时回显完整 request_example')
411
+ .option('--with-example', '同 --full')
412
+ .option('--no-example', '--show-params 时强制省略 request_example')
413
+ .option('--dry-run', '只组装请求不发送(凭据脱敏)')
414
+ .option('--timeout <sec>', '超时秒数,默认 60')
415
+ .action(action(async (ctx, options) => {
416
+ await run(ctx, 'data.module.call', toInput(options), false);
417
+ }));
418
+ // ---------------------------------------------------------------- attend
419
+ const attend = data.command('attend').description('考勤 REST 接口');
420
+ attend.command('statis')
421
+ .description('考勤假期余额(年假 / 带薪病假 / 带薪事假)')
422
+ .option('--user <人员ID>', '查本人可不传,默认当前登录用户')
423
+ .option('--begin <yyyy-MM-dd>', '起始日期,默认当月 1 号')
424
+ .option('--end <yyyy-MM-dd>', '结束日期,默认当月最后一天')
425
+ .action(action(async (ctx, options) => {
426
+ await run(ctx, 'data.attend.statis', toInput(options), false);
427
+ }));
428
+ },
429
+ };
@@ -0,0 +1,133 @@
1
+ import { operationDefinitions } from './operations/index.js';
2
+ /**
3
+ * data 模块的对外契约。
4
+ *
5
+ * 命名分工沿用仓库约定:顶层命令用**业务域**(`data`),skill 目录用品牌(`weaver-e10-data`)。
6
+ * 命令树顺序固定 `schema` → `run <operation>` → 各业务便捷子命令。
7
+ */
8
+ const INPUT_SCHEMAS = {
9
+ 'data.dsl.query': {
10
+ required: ['conn', 'model', 'schema', 'dsl'],
11
+ optional: ['table_id', 'debug', 'dimension', 'conf_group', 'username', 'start_date'],
12
+ },
13
+ 'data.ds.groups': { required: [], optional: ['pattern'] },
14
+ 'data.ds.find': {
15
+ required: ['name'],
16
+ optional: ['source_type', 'size', 'pages', 'concurrency', 'groups', 'all_groups', 'max_groups', 'app_id', 'limit', 'loose', 'no_escalate'],
17
+ },
18
+ 'data.ds.describe': { required: ['group', 'table'], optional: ['source_type', 'app_id', 'skill', 'require'] },
19
+ 'data.ds.tables': { required: ['group'], optional: ['name', 'page', 'size', 'source_type', 'app_id'] },
20
+ 'data.ds.fields': { required: ['group', 'table'], optional: ['source_type', 'app_id'] },
21
+ 'data.ds.fields-dsl': { required: ['group', 'table'], optional: ['source_type', 'app_id'] },
22
+ 'data.ds.list': {
23
+ required: ['group', 'table', 'fields'],
24
+ optional: ['where', 'order', 'page', 'size', 'source_type', 'app_id'],
25
+ },
26
+ 'data.ds.chart': {
27
+ required: ['group', 'table', 'group_by', 'stat'],
28
+ optional: ['where', 'page', 'size', 'source_type', 'app_id'],
29
+ },
30
+ 'data.ds.stat': { required: ['group', 'table', 'stat'], optional: ['where', 'source_type', 'app_id'] },
31
+ 'data.ds.count': { required: ['group', 'table'], optional: ['where', 'source_type', 'app_id'] },
32
+ 'data.noun.list': { required: ['skill'], optional: ['source_type', 'source_group', 'source_table'] },
33
+ 'data.noun.scope': { required: ['ids'], optional: [] },
34
+ 'data.field.name2id': { required: ['module', 'type', 'name'], optional: ['form_param', 'eb_browser_param', 'property_type'] },
35
+ 'data.field.options': { required: ['field_name', 'obj_id', 'group'], optional: ['source_type'] },
36
+ 'data.conf.get': { required: ['key'], optional: ['type', 'group'] },
37
+ 'data.conf.batch': { required: ['keys'], optional: ['type', 'group'] },
38
+ 'data.conf.batch-file': { required: ['batch_file'], optional: [] },
39
+ 'data.conf.group': { required: ['conf_type', 'conf_group'], optional: ['key'] },
40
+ 'data.conf.group-file': { required: ['group_file'], optional: [] },
41
+ 'data.conf.resolve': { required: ['text'], optional: ['group'] },
42
+ 'data.conf.resolve-file': { required: ['path'], optional: ['group'] },
43
+ 'data.conf.add': { required: ['key', 'value'], optional: ['name', 'attrs', 'type', 'group', 'force'] },
44
+ 'data.conf.add-file': { required: ['add_file'], optional: ['type', 'group'] },
45
+ 'data.conf.update': { required: ['key'], optional: ['value', 'name', 'attrs', 'type', 'group'] },
46
+ 'data.conf.delete': { required: ['key'], optional: ['type', 'group'] },
47
+ 'data.scene.groups': { required: [], optional: ['client'] },
48
+ 'data.scene.items': { required: ['group'], optional: ['client'] },
49
+ 'data.scene.search': {
50
+ required: ['keywords'],
51
+ optional: ['client', 'max_groups', 'max_items', 'scope_group_id', 'server_filter'],
52
+ },
53
+ 'data.module.call': {
54
+ required: [],
55
+ optional: [
56
+ 'conf_key', 'group', 'type', 'conf_file', 'args', 'query', 'header', 'headers',
57
+ 'method', 'limit', 'fields', 'raw', 'show_params', 'full', 'with_example', 'no_example',
58
+ 'dry_run', 'timeout',
59
+ ],
60
+ },
61
+ 'data.attend.statis': { required: [], optional: ['user', 'begin', 'end'] },
62
+ };
63
+ function inputSchemaOf(name) {
64
+ const spec = INPUT_SCHEMAS[name] || { required: [], optional: [] };
65
+ const properties = {};
66
+ for (const key of [...spec.required, ...spec.optional]) {
67
+ properties[key] = { type: key === 'keys' || key === 'ids' ? 'array' : 'string' };
68
+ }
69
+ return {
70
+ type: 'object',
71
+ properties,
72
+ required: spec.required,
73
+ additionalProperties: false,
74
+ };
75
+ }
76
+ export const dataOperations = operationDefinitions().map((definition) => ({
77
+ name: definition.name,
78
+ resource: definition.capability,
79
+ summary: definition.summary,
80
+ command: definition.command,
81
+ inputSchema: inputSchemaOf(definition.name),
82
+ }));
83
+ export const dataManifest = {
84
+ schemaVersion: 1,
85
+ name: 'data',
86
+ title: '泛微E10数据助手(数据源查询 / 配置中心 / 场景定位)',
87
+ version: '0.1.0',
88
+ host: 'e10-data',
89
+ status: 'builtin',
90
+ sourceSkill: 'weaver-e10-data',
91
+ capabilities: ['dsl', 'discovery', 'metadata', 'fetch', 'lexicon', 'field', 'config', 'scene', 'module', 'attend'],
92
+ auth: {
93
+ required: 'e10-session',
94
+ note: '所有操作都要求已登录 E10;登录统一走 `weaver-work-cli auth login --base-url <域名>`,data 模块不提供任何登录入口。',
95
+ },
96
+ rules: [
97
+ '便捷命令(`data ds count` …)与统一入口(`data run data.ds.count`)共用同一份实现;参数名逐字保留,老调用无需改动。',
98
+ '`data --json` 输出**与旧 CLI 逐字一致的原始响应体**(技能里的 jq 路径不变);`data run` 输出 `{schemaVersion, ok, operation, data, warnings}` 信封。',
99
+ '流程类问题一律走 WORKFLOW 模块接口,不用 DSL、也不走数据源;`ds find` 的 routeHint 已给出通道建议。',
100
+ '`ds.find` 的 `/ds/listByPage` 端点当前忽略 name ⇒ 未命中只代表未落在抓取窗口内,不等于表不存在。',
101
+ '`module call` 的 `token` 头在运行时属保留头,必须走 trustedHeaders(INVOICE 已内置换取逻辑)。',
102
+ '人员 / 部门 / 岗位一律走 `weaver-work-cli hrm`;data 通道对 /api/hrm/ 路径有黑名单(退出码 6)。',
103
+ '`hasSearchRight=false` 是权限受限(终端态):结果照常给出但退出码 4,不得交付为「无数据」。',
104
+ '`field name2id`(名称→字段值 id)与 `ds fields`(字段元数据)是两件事;`id2name` 已停用并在本次迁移中删除。',
105
+ ],
106
+ operations: dataOperations,
107
+ withheldOperations: [
108
+ {
109
+ name: 'data.doc.count',
110
+ reason: '文档数量由配置中心 DOCUMENT.POST_DOCUMENT_DOCUMENT_LIST_COUNT 覆盖(conf group api DOCUMENT → module call),不在 data 模块重复封装。',
111
+ },
112
+ {
113
+ name: 'data.doc.list',
114
+ reason: '同上:DOCUMENT.POST_DOCUMENT_DOCUMENT_LIST。注意 documentList 的 data.total 实测恒为 0,总量必须取 count 接口。',
115
+ },
116
+ {
117
+ name: 'data.field.id2name',
118
+ reason: '已停用:技能里 19 处均为禁令;该实现打的是 /api/bcw/test/testRemoteBrowser 探针接口。选项值显示映射改走 field options。',
119
+ },
120
+ {
121
+ name: 'data.refusal.get',
122
+ reason: '拒答话术属智能问数宿主平台职责;场景技能明确「不做拒答 / 话术判定」,迁入只会扩出一个被禁止调用的入口。',
123
+ },
124
+ {
125
+ name: 'data.refusal.rules',
126
+ reason: '同上:getRefusalSpeechRules 由平台在加载完成 / 取数前 / 交付前自行拉取并替换话术。',
127
+ },
128
+ {
129
+ name: 'data.exp.*',
130
+ reason: '专家包远端版本管理属 `weaver-work-cli skills repo …` 资源域,不进 data。',
131
+ },
132
+ ],
133
+ };
@@ -0,0 +1,62 @@
1
+ import { dataValidationError } from '../errors.js';
2
+ import { scanTips, tipsLines } from './shared.js';
3
+ /**
4
+ * 考勤假期余额:`POST /api/attend/web/attendInfoV2/getAttendInfoStatis`。
5
+ *
6
+ * 这是配置中心 `EHR.POST_EHR_GET_ATTEND_INFO_STATIS` 的专用封装(同一端点)。
7
+ * 技能把它定位为「年假 / 带薪病假 / 带薪事假」的**首选调用**,并明确「勿再走 conf group api 翻接口」;
8
+ * 其余假种(婚假 / 产假 / 育儿假 …)走 `POST_EHR_GET_REPORT_LIST`,与本命令互不替代。
9
+ *
10
+ * 返回 `data.vacationBalanceList[]`:`{ id, title, data:[{name, value, key}] }`,
11
+ * key ∈ lastRemaining(历年可请) / remaining(今年可请) / total(总计可请)。
12
+ * ⚠️ 条目数因假种而异(实测年假仅 1 条 `key=total`,带薪病假/带薪事假各 3 条)⇒ 按 key 取值,勿按下标。
13
+ */
14
+ function defaultMonthRange() {
15
+ const now = new Date();
16
+ const year = now.getFullYear();
17
+ const month = now.getMonth() + 1;
18
+ const lastDay = new Date(year, month, 0).getDate();
19
+ const pad = (value) => String(value).padStart(2, '0');
20
+ return { begin: `${year}-${pad(month)}-01`, end: `${year}-${pad(month)}-${pad(lastDay)}` };
21
+ }
22
+ export async function attendStatis(input, host) {
23
+ const session = await host.session();
24
+ const userId = String(input.user || session.userId || '');
25
+ if (!userId) {
26
+ throw dataValidationError('missing_argument', '缺少查询人员:--user <人员ID>(查本人可不传,默认当前登录用户)');
27
+ }
28
+ const range = defaultMonthRange();
29
+ const body = {
30
+ beginDate: String(input.begin || range.begin),
31
+ endDate: String(input.end || range.end),
32
+ userId,
33
+ };
34
+ const response = await host.request({
35
+ method: 'POST',
36
+ path: '/api/attend/web/attendInfoV2/getAttendInfoStatis',
37
+ body,
38
+ operation: 'attend.statis',
39
+ });
40
+ if (String(response?.code) !== '200') {
41
+ const message = String(response?.msg || '');
42
+ if (/没有权限|无权限|权限不足|未授权|无权访问|无查询权限/i.test(message)) {
43
+ throw dataValidationError('permission_denied', '当前用户对该人员考勤数据无查询权限,请检查登录态或联系管理员开通', 4);
44
+ }
45
+ return { data: response, text: `code=${response?.code} msg=${message}` };
46
+ }
47
+ const data = response?.data || {};
48
+ const list = Array.isArray(data.vacationBalanceList) ? data.vacationBalanceList : [];
49
+ const lines = tipsLines(scanTips(response));
50
+ if (!list.length) {
51
+ lines.push(`(空:该人员无假期余额数据) userId=${userId} ${body.beginDate}~${body.endDate}`);
52
+ return { data: response, text: lines.join('\n') };
53
+ }
54
+ lines.push(`== 考勤假期余额 userId=${userId}(${body.beginDate} ~ ${body.endDate})==`);
55
+ for (const item of list) {
56
+ lines.push(`${item.title || item.id || '?'}${item.id ? ` [${item.id}]` : ''}`);
57
+ if (Array.isArray(item.data) && item.data.length) {
58
+ lines.push(` ${item.data.map((cell) => `${cell.name || cell.key}=${cell.value ?? ''}`).join(' ')}`);
59
+ }
60
+ }
61
+ return { data: response, text: lines.join('\n') };
62
+ }