weaver-work-cli 0.1.54 → 0.1.57

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 (189) hide show
  1. package/dist/chunks/{archive-ZQ4A4TV6.js → archive-4SQAVTIB.js} +3 -2
  2. package/dist/chunks/{archive-oa-57R2FYHV.js → archive-oa-W2UEJ67L.js} +137 -8
  3. package/dist/chunks/{asset-ZOJVBWZH.js → asset-EGZEABBI.js} +3 -2
  4. package/dist/chunks/{asset-idle-XGB5IPGT.js → asset-idle-EBUZBB6M.js} +3 -2
  5. package/dist/chunks/{attachment-content-2EPEI4HV.js → attachment-content-QGM5MLQE.js} +4 -3
  6. package/dist/chunks/{blog-QSHLZSFW.js → blog-2YKMWOWI.js} +3 -2
  7. package/dist/chunks/{caizhilian-KCQYFH72.js → caizhilian-QJ4FLSQJ.js} +5 -4
  8. package/dist/chunks/{calendar-DLGMRJQA.js → calendar-H4QTJCUY.js} +3 -2
  9. package/dist/chunks/{chunk-XPQN4E5O.js → chunk-44KJ7WFA.js} +300 -55
  10. package/dist/chunks/{chunk-CZNZKOHR.js → chunk-4GG72JAT.js} +2 -2
  11. package/dist/chunks/{chunk-YIKSL36S.js → chunk-5N222HK6.js} +2 -2
  12. package/dist/chunks/{chunk-XHMJBRLZ.js → chunk-6DVL5IN5.js} +4 -1
  13. package/dist/chunks/{chunk-JJRIT2ZN.js → chunk-6MS3RLPO.js} +5 -334
  14. package/dist/chunks/{chunk-QUDHSMG3.js → chunk-7EBV7Q3R.js} +112 -27
  15. package/dist/chunks/{chunk-CNVZETM5.js → chunk-AHJZIMCX.js} +1 -1
  16. package/dist/chunks/{chunk-TGAGQV4I.js → chunk-CQ4OVCKG.js} +2 -2
  17. package/dist/chunks/{chunk-2BQESR2U.js → chunk-DVR2EDUU.js} +99 -34
  18. package/dist/chunks/{chunk-7KKI5KDY.js → chunk-FDAJC7R4.js} +4 -4
  19. package/dist/chunks/{chunk-GR76ZDDX.js → chunk-FMNCSYIG.js} +2 -2
  20. package/dist/chunks/{chunk-6LGLI46Q.js → chunk-L2LMBFG5.js} +1 -1
  21. package/dist/chunks/{chunk-DLY5GUXX.js → chunk-PH7N4UFT.js} +1 -1
  22. package/dist/chunks/{chunk-U6R6FZHD.js → chunk-SFM3M2L3.js} +286 -93
  23. package/dist/chunks/chunk-SHYQUBY3.js +48 -0
  24. package/dist/chunks/{chunk-HFXK54M4.js → chunk-TGM7BWEH.js} +2 -2
  25. package/dist/chunks/{chunk-Z7B7QSR2.js → chunk-TJUAGZU7.js} +11 -11
  26. package/dist/chunks/{chunk-LYOFRYC4.js → chunk-UI66EMOR.js} +4 -4
  27. package/dist/chunks/{chunk-762M5XJS.js → chunk-VMCCRWFO.js} +2 -2
  28. package/dist/chunks/{chunk-FE3CQAAM.js → chunk-WHJIUKJW.js} +681 -48
  29. package/dist/chunks/{chunk-PGO4ILMQ.js → chunk-WMB3SMXI.js} +1 -1
  30. package/dist/chunks/chunk-WMRNO6IU.js +337 -0
  31. package/dist/chunks/{chunk-6NXT4ICB.js → chunk-WVH5ESDA.js} +1 -1
  32. package/dist/chunks/{chunk-O6RIBG5E.js → chunk-XU3FL3AW.js} +4 -4
  33. package/dist/chunks/{chunk-Z6UUBY37.js → chunk-Z4IPY5GV.js} +2 -2
  34. package/dist/chunks/{conflict-K2IAKKFR.js → conflict-VAFFPUY3.js} +2 -2
  35. package/dist/chunks/{contract-LJRAXVZU.js → contract-LLRKMLQQ.js} +2655 -1319
  36. package/dist/chunks/{cowork-3ACICHDQ.js → cowork-2RDFBZWB.js} +3 -2
  37. package/dist/chunks/{create-flow-UL37MZGP.js → create-flow-TVYE3IOH.js} +6 -6
  38. package/dist/chunks/{data-WK5CQXNF.js → data-WVICO3DT.js} +57 -11
  39. package/dist/chunks/{ebuilder-form-CBYI6CQ6.js → ebuilder-form-TWSXS5NA.js} +7 -6
  40. package/dist/chunks/{ehr-XI4BIVR2.js → ehr-52GBKNJR.js} +3 -2
  41. package/dist/chunks/{env-BZDB5OVZ.js → env-BVVFIN4P.js} +2 -2
  42. package/dist/chunks/{esb-4BQHNP5C.js → esb-HJSXCEOM.js} +5 -4
  43. package/dist/chunks/{factory-VD3YI6N7.js → factory-RCQ36LLE.js} +1 -1
  44. package/dist/chunks/{fna-ECOYBQYL.js → fna-OBACRT3J.js} +72 -3
  45. package/dist/chunks/{group-chat-DHNVO76L.js → group-chat-YFZDUUY3.js} +3 -3
  46. package/dist/chunks/{host-TUOIOEMC.js → host-2BKMPWDH.js} +4 -3
  47. package/dist/chunks/{host-3TNBMDTR.js → host-KJT3G5D2.js} +4 -3
  48. package/dist/chunks/{host-7OWWPLM4.js → host-KOWUMNAY.js} +4 -3
  49. package/dist/chunks/{host-M4XP5URR.js → host-MFXRA2MY.js} +4 -3
  50. package/dist/chunks/{host-7NTIBSPK.js → host-TTSGY5NZ.js} +4 -3
  51. package/dist/chunks/{host-G3VU7SDW.js → host-W4JCNRFS.js} +4 -3
  52. package/dist/chunks/{hrm-YGIR3HGF.js → hrm-AK3WGBMN.js} +4 -3
  53. package/dist/chunks/{im-TN2JYVGJ.js → im-JZSBPO4Z.js} +4 -3
  54. package/dist/chunks/{invoice-V7ZTITUO.js → invoice-7JGSEWT5.js} +22 -9
  55. package/dist/chunks/{jiuchuanhui-ASFZBMPU.js → jiuchuanhui-K4EQU6GK.js} +3 -2
  56. package/dist/chunks/{lazy-dispatch-XSAHDK6Z.js → lazy-dispatch-JHGFCKJN.js} +5 -4
  57. package/dist/chunks/{mail-M3HJF5ER.js → mail-IKVCQCVZ.js} +3 -2
  58. package/dist/chunks/{meeting-OWG4O2XH.js → meeting-JOHV4RH3.js} +14 -12
  59. package/dist/chunks/minute-doc-JLS4KMFZ.js +156 -0
  60. package/dist/chunks/{okr-EVX7FB5G.js → okr-KV43FPPX.js} +3 -2
  61. package/dist/chunks/{operations-J7PUIVWZ.js → operations-ZPWBMYKE.js} +5 -4
  62. package/dist/chunks/{plan-2QJQEPBO.js → plan-WOYR4WEG.js} +3 -2
  63. package/dist/chunks/{project-XELELW2T.js → project-CQJKBUIL.js} +3 -2
  64. package/dist/chunks/{reception-QGPNTGHG.js → reception-MPBU3JXC.js} +3 -2
  65. package/dist/chunks/{recruit-stage-XCMVEQA2.js → recruit-stage-USTTRHOX.js} +3 -2
  66. package/dist/chunks/{registry-CJOVECZD.js → registry-GURQG4ZV.js} +3 -2
  67. package/dist/chunks/{registry-ASYCWF2U.js → registry-LITYOH2W.js} +12 -10
  68. package/dist/chunks/{registry-QJCZ2GVG.js → registry-SS5J2FZQ.js} +5 -4
  69. package/dist/chunks/{room-recommend-LSVAMGKV.js → room-recommend-62MECG4J.js} +4 -4
  70. package/dist/chunks/{schedule-7QOPRUU4.js → schedule-6QRXIBGU.js} +4 -4
  71. package/dist/chunks/{smart-extract-FOUYNIG3.js → smart-extract-APX2PNIN.js} +3 -2
  72. package/dist/chunks/{workflow-YHXFIU63.js → workflow-WMPW3WSB.js} +5 -4
  73. package/dist/index.js +33 -32
  74. package/dist/internal/e10/auth/agent-host-key.js +68 -0
  75. package/dist/internal/e10/auth/agent-hosts.js +250 -0
  76. package/dist/internal/e10/auth/commands.js +99 -30
  77. package/dist/internal/e10/auth/paths.js +9 -0
  78. package/dist/internal/e10/auth/session.js +17 -0
  79. package/dist/internal/e10/auth/xiaoe.js +37 -3
  80. package/dist/shortcuts/archive-oa/operations/contract-modules.js +106 -0
  81. package/dist/shortcuts/archive-oa/operations/contract.js +38 -4
  82. package/dist/shortcuts/archive-oa/operations/registry.js +2 -1
  83. package/dist/shortcuts/contract/index.js +6 -7
  84. package/dist/shortcuts/contract/manifest.js +101 -24
  85. package/dist/shortcuts/contract/ooxml/docx-table.js +75 -3
  86. package/dist/shortcuts/contract/ooxml/xlsx.js +49 -13
  87. package/dist/shortcuts/contract/operations/card-action.js +113 -12
  88. package/dist/shortcuts/contract/operations/card-ebdf-list.js +29 -7
  89. package/dist/shortcuts/contract/operations/card-plan.js +75 -9
  90. package/dist/shortcuts/contract/operations/card-risk-report.js +2 -2
  91. package/dist/shortcuts/contract/operations/card.js +1 -1
  92. package/dist/shortcuts/contract/operations/clause-library.js +88 -16
  93. package/dist/shortcuts/contract/operations/compare-screen.js +378 -0
  94. package/dist/shortcuts/contract/operations/compare.js +1 -1
  95. package/dist/shortcuts/contract/operations/credit-page.js +1 -1
  96. package/dist/shortcuts/contract/operations/docx-slots.js +1000 -0
  97. package/dist/shortcuts/contract/operations/flow.js +2 -2
  98. package/dist/shortcuts/contract/operations/quote-to-contract.js +495 -0
  99. package/dist/shortcuts/contract/operations/quote.js +2 -229
  100. package/dist/shortcuts/contract/operations/recommend.js +1 -1
  101. package/dist/shortcuts/contract/operations/registry.js +6 -2
  102. package/dist/shortcuts/contract/operations/review.js +230 -4
  103. package/dist/shortcuts/contract/operations/save-recognize.js +122 -3
  104. package/dist/shortcuts/contract/operations/template.js +11 -10
  105. package/dist/shortcuts/data/operations/ds.js +5 -5
  106. package/dist/shortcuts/data/operations/shared.js +76 -4
  107. package/dist/shortcuts/fna/manifest.js +7 -2
  108. package/dist/shortcuts/fna/operations/budget.js +68 -0
  109. package/dist/shortcuts/invoice/manifest.js +8 -3
  110. package/dist/shortcuts/invoice/operations/reim.js +10 -3
  111. package/dist/shortcuts/meeting/minute-doc.js +153 -0
  112. package/dist/shortcuts/meeting/operations/compose-outcome.js +176 -0
  113. package/dist/shortcuts/meeting/operations/eb/catalog.js +1 -1
  114. package/dist/shortcuts/meeting/operations/eb/create-flow.js +26 -0
  115. package/dist/shortcuts/meeting/operations/eb/decision-task-batch.js +144 -0
  116. package/dist/shortcuts/meeting/operations/eb/decision.js +92 -4
  117. package/dist/shortcuts/meeting/operations/eb/index.js +133 -4
  118. package/dist/shortcuts/meeting/operations/eb/meeting-link.js +90 -0
  119. package/dist/shortcuts/meeting/operations/from-group-chat.js +46 -0
  120. package/dist/shortcuts/meeting/operations/minute-content.js +61 -0
  121. package/dist/shortcuts/meeting/operations/registry.js +14 -1
  122. package/dist/shortcuts/meeting/operations/self-check.js +49 -0
  123. package/dist/shortcuts/workflow/endpoints.js +2 -0
  124. package/dist/shortcuts/workflow/operations/read.js +114 -8
  125. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +72 -46
  126. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +41 -0
  127. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +46 -11
  128. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +18 -1
  129. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroupAdd.js +51 -0
  130. package/docs/e10-auth.md +78 -0
  131. package/docs/fna.md +8 -3
  132. package/docs/invoice.md +1 -1
  133. package/package.json +4 -2
  134. package/scripts/pack-offline.mjs +228 -0
  135. package/scripts/package-skill.mjs +14 -5
  136. package/skill-template/business-info.json +3 -0
  137. package/skill-template/domains/qiyecheng.md +4 -3
  138. package/skills/weaver-e10-archive-oa/SKILL.md +6 -1
  139. package/skills/weaver-e10-archive-oa/references/contract-search.md +91 -4
  140. package/skills/weaver-e10-jinchengda/SKILL.md +100 -81
  141. package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +11 -6
  142. package/skills/weaver-e10-jinchengda/references/contract-action-card.md +5 -4
  143. package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +38 -12
  144. package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +1 -1
  145. package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
  146. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +20 -6
  147. package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +8 -3
  148. package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +56 -13
  149. package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +7 -0
  150. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
  151. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +11 -5
  152. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +1 -1
  153. package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
  154. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +38 -7
  155. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +13 -25
  156. package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +9 -8
  157. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +8 -6
  158. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +10 -7
  159. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +2 -2
  160. package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +3 -1
  161. package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +26 -18
  162. package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +4 -4
  163. package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +18 -13
  164. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +5 -3
  165. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +105 -49
  166. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  167. package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +3 -6
  168. package/skills/weaver-e10-meeting/SKILL.md +47 -9
  169. package/skills/weaver-e10-qiyecheng/SKILL.md +16 -7
  170. package/skills/weaver-e10-qiyecheng/references/budget.md +77 -3
  171. package/skills/weaver-e10-qiyecheng/references/catalog.md +6 -4
  172. package/skills/weaver-e10-qiyecheng/references/getEnabledTemplate-api.md +255 -0
  173. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +70 -25
  174. package/skills/weaver-e10-workflow/SKILL.md +54 -40
  175. package/skills/weaver-e10-workflow/references/todo-dialogue.md +134 -0
  176. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +102 -80
  177. package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +23 -13
  178. package/skills/weaver-e10-workflow/references/workflow-query.md +68 -46
  179. package/skills/weaver-e10-workflow/references/workflow-view.md +21 -13
  180. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +317 -332
  181. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +1 -0
  182. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +23 -13
  183. package/skills/weaver-e10-yepiaotong.zip +0 -0
  184. package/dist/shortcuts/contract/ooxml/docx.js +0 -295
  185. package/dist/shortcuts/contract/operations/docx-fillfromquote.js +0 -532
  186. package/skills/weaver-e10-jinchengda/references/contract-risk-report-template.html +0 -178
  187. package/skills/weaver-e10-jinchengda/references/source-manifest.json +0 -1270
  188. package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +0 -998
  189. package/skills/weaver-e10-workflow/tools/todo-serve.cjs +0 -327
@@ -2,7 +2,7 @@ import { workflowValidationError } from '../../errors.js';
2
2
  import { FLOW_STATUS_HINT } from '../flow-status.js';
3
3
  import { TIME_DESCRIPTIONS, SORT_OPTIONS } from '../read.js';
4
4
  import { planTodoOutput } from './todoOutputPlanner.js';
5
- import { assertKnownKeys, buildSkillTiming, CATEGORY_VALUES, DEFAULT_CATEGORY, DEFAULT_TOP_N, FETCH_PAGE_SIZE, GROUP_BY_VALUES, STAGE_VALUES, workflowSuccess, } from './todoSmartConvert.core.js';
5
+ import { assertKnownKeys, buildSkillTiming, CATEGORY_VALUES, DEFAULT_CATEGORY, DEFAULT_TOP_N, FETCH_PAGE_SIZE, GROUP_BY_VALUES, OUTPUT_MODE_VALUES, readOutputMode, STAGE_VALUES, workflowSuccess, } from './todoSmartConvert.core.js';
6
6
  import { collectRawTodos } from './todoSmartConvert.collect.js';
7
7
  import { runSmartConvert } from './todoSmartConvert.aggregate.js';
8
8
  import { runGroup } from './todoSmartConvert.group.js';
@@ -11,13 +11,20 @@ import { runSmartGroup, assemblePriorityGroup, stripPriorityRawFields } from './
11
11
  import { runSummary, runSummaryContext } from './todoSmartConvert.summary.js';
12
12
  import { runSubGroup } from './todoSmartConvert.subGroup.js';
13
13
  import { runGroupSummary, runGroupSummaryContext } from './todoSmartConvert.groupSummary.js';
14
+ import { runSmartGroupAdd } from './todoSmartConvert.smartGroupAdd.js';
14
15
  import { schemaOf, } from '../types.js';
15
16
  const inputSchema = schemaOf({
17
+ outputMode: {
18
+ type: 'string',
19
+ enum: [...OUTPUT_MODE_VALUES],
20
+ description: 'query:标题清单,默认最多500条,明确扩大时最多1000条;summary:完整摘要,默认及最多100条。'
21
+ + '两种模式无时间条件时按各自条数阈值降级,最低近7天;不传保留历史取数及降级规则。',
22
+ },
16
23
  stage: {
17
24
  type: 'string',
18
25
  enum: [...STAGE_VALUES],
19
26
  default: 'auto',
20
- description: '阶段:auto、collect、group、smartGroup、summaryContext、summary、groupSummaryContext、groupSummary 或 aggregate。',
27
+ description: '阶段:auto、collect、group、smartGroup、summaryContext、summary、groupSummaryContext、groupSummary、smartGroupAdd 或 aggregate。',
21
28
  },
22
29
  items: {
23
30
  type: 'array',
@@ -69,8 +76,8 @@ const inputSchema = schemaOf({
69
76
  limit: {
70
77
  type: 'integer',
71
78
  minimum: 1,
72
- description: 'collect 目标条数;不传 = 不限条数(翻页取完为止,无时间条件时按降级链自动收窄范围);'
73
- + '传了则累计到该条数即停。单页最多 ' + FETCH_PAGE_SIZE + ' 条。(2026-11-11:原 500 上限已废除)',
79
+ description: 'collect 取数条数:outputMode=query 默认500、最多1000,summary 默认及最多100;显式模式严格限制返回条数。'
80
+ + '未指定 outputMode 时保留历史行为:不传不限条数,传入值为整页停止阈值。单页最多 ' + FETCH_PAGE_SIZE + ' 条。',
74
81
  },
75
82
  pageSize: {
76
83
  type: 'integer',
@@ -87,9 +94,13 @@ const inputSchema = schemaOf({
87
94
  // 校验/澄清/报文形态完全一致,只是 search 的查询模式开关(sort/totalOnly/batchType/planJson/queryJson)不在此列。
88
95
  workflow: { type: 'array', items: { type: 'string' }, description: '工作流条件,多个 or;支持 "名称(ID)";纯名称多命中/0 命中返回澄清候选' },
89
96
  workflowTerm: { type: 'string', enum: ['in', 'notin'] },
90
- creator: { type: 'string', description: '发起人姓名,支持 "名称(ID)";纯名称多命中返回澄清候选,0 命中报错' },
91
- creatorDept: { type: 'string', description: '发起人部门;纯名称多命中返回澄清候选,0 命中报错' },
92
- creatorSubcom: { type: 'string', description: '发起人分部;纯名称多命中返回澄清候选,0 命中报错' },
97
+ creator: { type: 'string', description: '发起人姓名,支持 "名称(ID)" 与 "我"(=当前登录人);纯名称多命中返回澄清候选,0 命中报错' },
98
+ creatorDept: { type: 'string', description: '发起人部门;支持 "我的部门"/"本部门"(=当前登录人部门);纯名称多命中返回澄清候选,0 命中报错' },
99
+ creatorSubcom: { type: 'string', description: '发起人分部;支持 "我的分部"/"本分部"(=当前登录人分部);纯名称多命中返回澄清候选,0 命中报错' },
100
+ unoperator: { type: 'string', description: '未操作者姓名(人员浏览按钮条件),支持 "名称(ID)" 与 "我"(=当前登录人);纯名称多命中返回澄清候选,0 命中报错' },
101
+ sourceUserid: { type: 'string', description: '来源(人员浏览按钮条件),支持 "名称(ID)" 与 "我"(=当前登录人);纯名称多命中返回澄清候选,0 命中报错' },
102
+ creatorcode: { type: 'string', description: '发起人工号(文本条件)' },
103
+ creatorcodeTerm: { type: 'string', enum: ['in', 'notin', 'eq', 'ne'] },
93
104
  workflowType: { type: 'string', description: '工作流类型;纯名称多命中返回澄清候选,0 命中报错' },
94
105
  requestName: { type: 'string', description: '流程标题 like 模糊' },
95
106
  requestNameTerm: { type: 'string', enum: ['in', 'notin', 'eq', 'ne'] },
@@ -143,14 +154,24 @@ const inputSchema = schemaOf({
143
154
  groupInfo: { type: 'object' },
144
155
  groupingBrief: { type: 'array', items: { type: 'object' } },
145
156
  detailStats: { type: 'object' },
157
+ // smartGroupAdd(2026-11-13):产物落库,与 E10 WflSmartGroupAddParamsDto 同名
158
+ queryPrompt: { type: 'string', description: 'smartGroupAdd:用户本轮完整提示词(落库字段 queryPrompt,缺省空串)' },
159
+ querySummary: { type: 'string', description: 'smartGroupAdd:待落库的三键产物 JSON 字符串(smartSummaryTitle/totalCount/wfIdGroup)' },
160
+ queryCost: { type: 'string', description: 'smartGroupAdd:耗时(预留字段,当前固定空串)' },
146
161
  });
162
+ /** 裸 stage 响应统一携带的正路指引(2026-11-16):stage 是编排脚本的内部实现,直调属于走错入口。 */
163
+ const ORCHESTRATOR_HINT = '待办汇总的完整交付(含落库与组件载荷)请使用编排脚本 tools/todo-summary.cjs 执行:'
164
+ + 'run 一键跑完取数→分组→摘要→落库;NEEDS_SUMMARIES/NEEDS_GROUP_SUMMARIES 停止后按其提示用 finish --summaries/--group-summaries 续跑。'
165
+ + '直接调用裸 stage 无法产出交付物,遇到参数类错误不要补参数重试,应改用上述入口。';
147
166
  function finish(env, args, startedAt, stage, data, meta, warnings) {
148
167
  const timing = buildSkillTiming(stage, args.skillTiming, startedAt);
149
168
  const planned = planTodoOutput({
150
169
  ctx: env.ctx,
151
170
  operation: 'workflow.todoSmartConvert',
152
171
  data,
153
- meta: { ...(meta ?? {}), timing },
172
+ // 软提示(2026-11-16):裸 stage 是编排脚本的内部实现——每个响应都带上正路指引,
173
+ // 给直调的调用方(弱模型)一个"回到 run"的路标。零锁、零副作用,替代 CLI 硬锁方案。
174
+ meta: { orchestratorHint: ORCHESTRATOR_HINT, ...(meta ?? {}), timing },
154
175
  warnings,
155
176
  });
156
177
  return workflowSuccess('workflow.todoSmartConvert', planned.data, planned.meta, warnings);
@@ -166,6 +187,7 @@ export const workflowTodoSmartConvertOperations = [{
166
187
  inputSchema,
167
188
  handler: async (args, env) => {
168
189
  assertKnownKeys(args);
190
+ const outputMode = readOutputMode(args.outputMode);
169
191
  const startedAt = Date.now();
170
192
  const stage = args.stage === undefined || args.stage === null || args.stage === ''
171
193
  ? inferStage(args)
@@ -196,11 +218,14 @@ export const workflowTodoSmartConvertOperations = [{
196
218
  };
197
219
  };
198
220
  if ((stage === 'group' || stage === 'smartGroup' || stage === 'aggregate') && !hasItems) {
199
- throw workflowValidationError('items_required', 'stage=' + stage + ' 需要 items:先执行 stage=collect,再回灌 data.items', { retryAllowed: false });
221
+ throw workflowValidationError('items_required', 'stage=' + stage + ' 需要 items:先执行 stage=collect,再回灌 data.items。'
222
+ + '若目标是完整待办汇总交付,请不要手动逐阶段调用——改用编排脚本 todo-summary.cjs 的 run 一键执行'
223
+ + '(它会自动串接 collect→smartGroup→summary→smartGroupAdd 落库并生成组件载荷),'
224
+ + '当前报错说明走错了入口,补参数重试只会继续偏离。', { retryAllowed: false });
200
225
  }
201
226
  if (stage === 'smartGroup') {
202
227
  const result = await runSmartGroup(args, env);
203
- if (args.withDetailContext === true) {
228
+ if (args.withDetailContext === true && outputMode !== 'query') {
204
229
  const context = await runSummaryContext({
205
230
  ...args,
206
231
  wfIdGroup: result.data.wfIdGroup,
@@ -219,7 +244,9 @@ export const workflowTodoSmartConvertOperations = [{
219
244
  }
220
245
  if (stage === 'summary') {
221
246
  if (!Array.isArray(args.aiSummaries)) {
222
- throw workflowValidationError('ai_summaries_required', 'stage=summary 需要 aiSummaries:先执行 stage=summaryContext', { retryAllowed: false });
247
+ throw workflowValidationError('ai_summaries_required', 'stage=summary 需要 aiSummaries:先执行 stage=summaryContext。'
248
+ + '若目标是完整待办汇总交付,请改用编排脚本 todo-summary.cjs:它会把待写摘要素材写入 need-summaries.json,'
249
+ + '按其条目写 aiSummaries.json 后用 finish --summaries 回填——不要手动逐阶段调用。', { retryAllowed: false });
223
250
  }
224
251
  const result = await runSummary(args, env);
225
252
  // 2026-11-03 用户定:**ai 二次分组后移到单条摘要之后**(两者不再耦合)。
@@ -282,6 +309,14 @@ export const workflowTodoSmartConvertOperations = [{
282
309
  branch: 'todo-smart-convert', stage, aiSummarized: true, ...result.meta,
283
310
  }, final.warnings);
284
311
  }
312
+ if (stage === 'smartGroupAdd') {
313
+ // 产物落库(2026-11-13):三键 JSON 存 E10 服务端,返回主键 id 给组件载荷用。
314
+ // 失败(网络 / 接口 fail / id=0)直接抛错——不降级不回退,交付随之中断。
315
+ const result = await runSmartGroupAdd(args, env);
316
+ return finish(env, args, startedAt, stage, { id: result.id }, {
317
+ branch: 'todo-smart-convert', stage,
318
+ });
319
+ }
285
320
  if (stage === 'group' || resumed) {
286
321
  return finish(env, args, startedAt, 'group', runGroup(args), {
287
322
  branch: 'todo-smart-convert', stage: 'group', deterministic: true, ...(resumed ? { resumed: true } : {}),
@@ -1,6 +1,6 @@
1
1
  import { workflowValidationError } from '../../errors.js';
2
2
  import { renderGroupSummaryTemplate, } from './businessRules.js';
3
- import { asRecord, readBoundedInt, } from './todoSmartConvert.core.js';
3
+ import { asRecord, readBoundedInt, readOutputMode, } from './todoSmartConvert.core.js';
4
4
  import { configuredPrioritySort, describePrioritySort, PRIORITY_GROUP_ID, PRIORITY_GROUP_TITLE, runGroup, GROUP_MIN_ITEMS_FOR_SUBGROUP, selectPriorityRows, sortPriorityRows, } from './todoSmartConvert.group.js';
5
5
  import { fetchDetailFacts, stampsOfRows } from './todoSmartConvert.detail.js';
6
6
  import { activeRuleFor, evaluateFocusKeywords, generalRules, priorityRuleExpr, primeRules } from './aigroupRules.js';
@@ -511,6 +511,23 @@ export function applySubGroups(groups, options) {
511
511
  export async function runSmartGroup(args, env, options = {}) {
512
512
  const base = runGroup(args);
513
513
  const groups = (base.wfIdGroup ?? []);
514
+ if (readOutputMode(args.outputMode) === 'query') {
515
+ const orderedGroups = stripPriorityRawFields(flattenFinalGroups(groups));
516
+ for (const group of orderedGroups) {
517
+ for (const row of rowsOfGroup(group))
518
+ row.summary = '';
519
+ }
520
+ return {
521
+ data: {
522
+ smartSummaryTitle: base.smartSummaryTitle,
523
+ totalCount: totalTodoCount(orderedGroups),
524
+ wfIdGroup: orderedGroups,
525
+ },
526
+ warnings: (base.warnings ?? [])
527
+ .filter((text) => !text.startsWith('markdown 只展示前')),
528
+ facts: new Map(),
529
+ };
530
+ }
514
531
  /** `null` = 确定性模式;数组(可能为空)= 兼容模式 */
515
532
  const plans = args.aiGroups === undefined || args.aiGroups === null
516
533
  ? undefined
@@ -0,0 +1,51 @@
1
+ import { WORKFLOW_ENDPOINTS } from '../../endpoints.js';
2
+ import { workflowValidationError } from '../../errors.js';
3
+ /** queryTypeId 固定值(2026-11-13 用户定稿):待办智能汇总落库的类型标识。 */
4
+ const QUERY_TYPE_ID = 'todo_smart_group';
5
+ /**
6
+ * stage=smartGroupAdd:把待办汇总的三键产物 JSON 落到 E10 服务端(2026-11-13 用户定稿)。
7
+ *
8
+ * 接口:`POST /api/workflow/list/smartgroup/add`(WflSmartGroupAction,publicPermission=true)
9
+ * 入参 `WflSmartGroupAddParamsDto`:
10
+ * - `queryTypeId`:固定 `todo_smart_group`(为空服务端直接返回 0、不落库);
11
+ * - `queryPrompt`:用户本轮完整提示词(脚本经 `--prompt` 透传,缺省空串);
12
+ * - `querySummary`:产物 JSON 字符串(smartSummaryTitle / totalCount / wfIdGroup 三键本体);
13
+ * - `queryCost`:耗时——先固定空串(预留字段);
14
+ * - `queryTimestamp` / `queryFeedback` 不传(服务端默认当前时间 / 反馈留空)。
15
+ * 返回 `WeaResult<Long>` = 落库主键 id。
16
+ *
17
+ * 为什么走 `workflowBinaryRequest` 而不是 `workflowRequest`:`IdGenerator.generate()` 产出的
18
+ * 雪花主键超过 JS Number 安全整数范围(2^53),标准 JSON.parse 会**静默丢失末几位精度**,
19
+ * 组件拿错的 id 就查不回数据。binary 通道拿到的是响应原文 Buffer,用正则把 `data` 字段按
20
+ * **原样数字串**提出,全程不经 JSON.parse;该字符串一路传到组件载荷 `params.data.id`。
21
+ *
22
+ * 失败口径(2026-11-13 用户定稿):**不降级、不回退**——接口失败 / id 无效一律抛错,
23
+ * 由脚本 exit 1 中断交付,skill 不再继续。
24
+ */
25
+ export async function runSmartGroupAdd(args, env) {
26
+ const querySummary = String(args.querySummary ?? '');
27
+ if (!querySummary.trim()) {
28
+ throw workflowValidationError('query_summary_required', 'stage=smartGroupAdd 需要 querySummary:待落库的三键产物 JSON 字符串(smartSummaryTitle/totalCount/wfIdGroup)', { retryAllowed: false });
29
+ }
30
+ const queryPrompt = String(args.queryPrompt ?? '');
31
+ const queryCost = String(args.queryCost ?? '');
32
+ const result = await env.host.workflowBinaryRequest({
33
+ method: 'POST',
34
+ path: WORKFLOW_ENDPOINTS.SMART_GROUP_ADD,
35
+ operation: 'workflow.todoSmartConvert.smartGroupAdd',
36
+ body: {
37
+ queryTypeId: QUERY_TYPE_ID,
38
+ queryPrompt,
39
+ querySummary,
40
+ queryCost,
41
+ },
42
+ });
43
+ const text = result.content.toString('utf8');
44
+ // WeaResult<Long> 成功响应的 data 是纯数字字面量;fail / 参数无效(服务端返回 0L)时按失败处理。
45
+ const match = text.match(/"data"\s*:\s*(\d+)/);
46
+ const id = match ? match[1] : '';
47
+ if (!id || id === '0') {
48
+ throw workflowValidationError('smart_group_add_failed', `智能分组产物落库失败:接口未返回有效 id(HTTP ${result.status},响应片段:${text.slice(0, 300)})`, { retryAllowed: true });
49
+ }
50
+ return { id };
51
+ }
package/docs/e10-auth.md CHANGED
@@ -39,6 +39,84 @@ weaver-work-cli auth profile use PROFILE_NAME
39
39
  weaver-work-cli auth export-weaver-env
40
40
  ```
41
41
 
42
+ `auth login`、`auth oidc`、`auth init`、`auth set` 和 `auth xiaoe` 在未显式传入
43
+ `--base-url`、且当前 profile 没有保存域名时,默认使用 `https://weapp.eteams.cn`。
44
+ XiaoE 宿主(网页端 `XIAOE_CLIENT_TYPE=cloud`、桌面客户端 `client`)保持原有解析逻辑:
45
+ 先从环境上下文取 E10 目标域(`WEAVER_XIAOE_E10_*` / `WEAVER_XIAOE_DEFAULT_*`、
46
+ `WEAVER_XIAOE_E10_DOMAIN` 等专用变量,以及登录凭据映射),取不到才回退内置默认值;
47
+ `XIAOE_DOMAIN` 只表示 XiaoE 服务地址,永远不作为 E10 目标域。
48
+
49
+ ### 多智能体宿主的登录归属
50
+
51
+ 同一台机器上可能有多个智能体宿主(WorkBuddy、智能小 E、Codex、豆包办公、千问)在跑 CLI。
52
+ 宿主各自记住自己的登录目标,记录在鉴权根目录的 `agents.json`:
53
+
54
+ ```json
55
+ {
56
+ "version": 1,
57
+ "hosts": {
58
+ "workbuddy": {
59
+ "profile": "eteams",
60
+ "baseUrl": "https://weapp.eteams.cn",
61
+ "agentType": "workbuddy",
62
+ "updatedAt": "2026-11-16T10:06:49.955Z"
63
+ },
64
+ "xiaoe": {
65
+ "profile": "e-cology",
66
+ "baseUrl": "https://www.e-cology.com.cn",
67
+ "agentType": "XiaoE",
68
+ "updatedAt": "2026-11-16T10:02:24.262Z"
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ `profile` 是权威字段,凭据位于 `profiles/<profile>/auth`;`baseUrl` / `agentType` 只作排查与
75
+ 一致性校验。宿主 key 由环境变量前缀判定,**只检查变量是否存在,不读取值**:
76
+
77
+ | 宿主 | 判定依据 | key | agentType | 回跳协议 |
78
+ |---|---|---|---|---|
79
+ | 智能小 E | 任一 `XIAOE_*` / `WEAVER_XIAOE_*` | `xiaoe` | `XiaoE` | `xiaoe-client://` |
80
+ | WorkBuddy | 任一 `WORKBUDDY` / `WORKBUDDY_*` | `workbuddy` | `workbuddy` | `workbuddy://` |
81
+ | Codex | 任一 `CODEX` / `CODEX_*` | `codex` | `codex` | `codex://` |
82
+ | 豆包办公 | 任一 `DOUBAO_OFFICE_*`(`DOUBAO_OFFICE_AGENT_NAME=doubao_moa` 最稳定) | `doubao` | `doubao` | 需宿主注入 `WEAVER_AGENT_RETURN_URL` |
83
+ | 千问(QwenWork) | 任一 `QWENWORK_*`(注意不是 `QWEN_*`) | `qwen` | `qwen` | 需宿主注入 `WEAVER_AGENT_RETURN_URL` |
84
+ | 终端 / 未知 | 以上都不命中 | `default` | `weaver-work-cli` | 无 |
85
+
86
+ 判定顺序即上表顺序,XiaoE 优先(网页端沙箱里可能同时存在其他框架变量)。
87
+ `DOUBAO_` / `QWEN_` / `DASHSCOPE_` 等属对方平台保留前缀,CLI 只读不写。
88
+ 豆包与千问的自定义协议未注册前,显式 `auth login` 的成功页需靠
89
+ `--agent-return-url` 或 `WEAVER_AGENT_RETURN_URL` 指定返回地址;显式 `--agent_type` 也会
90
+ 归一化到同一分区(`doubao_moa` → `doubao`)。
91
+
92
+ 目标解析优先级(登录命令与业务命令共用,前者写、后者只读):
93
+
94
+ 1. 显式 `--auth` / `--profile` / `--base-url`
95
+ 2. `agents.json` 中当前宿主的记录 → 其 `profile` 的 `config.json`
96
+ 3. 全局 `profile` 指针(无宿主记录时的旧行为)
97
+ 4. `resolveDefaultE10BaseUrl(env)`
98
+
99
+ 记录存在但不可用时**按未登录处理,不回落**到其他 profile——回落等于带着另一个租户的
100
+ 凭据干活。三种不可用状态:`profile-missing`(目录被删)、`auth-missing`(凭据被
101
+ `auth logout` 清掉)、`domain-mismatch`(该 profile 后来被别的宿主登录到了另一个域名)。
102
+ `agents.json` 损坏、JSON 非法或 `version` 不认识时整体忽略,按「没有记录」回退,
103
+ 不抛错也不删除文件。
104
+
105
+ 写入时机:`auth login` / `oidc` / `init` / `set` / `xiaoe` 成功、以及 `auth profile use` 显式切换
106
+ 时 upsert 当前宿主分区(合并写入,其他宿主原样保留,文件权限 `0600`)。`auth logout` 只清
107
+ 凭据、保留记录;`--is-connector` 下**不写入**(连接器授权不改写用户的宿主记忆)。
108
+ `auth status` 会额外输出 `agentHost`(当前宿主 key),`profile` 也按宿主记录解析。
109
+
110
+ `agents.json` 的读-改-写通过 `agents.json.lock` 串行化:两个宿主几乎同时登录时,后写者
111
+ 不会覆盖前者分区(否则记录丢失会回落全局指针,等于用错账号)。锁等待上限 600 ms,
112
+ 超时或锁文件不可写时退化为直接写入——宁可极少数情况丢记录,也不让登录卡住;
113
+ 上次进程崩溃残留的锁会被超时清理。
114
+
115
+ `profileNameFromUrl` 只看注册域名标签,`weapp.xx.cn` 与 `www.xx.cn` 会撞成同一个 profile。
116
+ 因此登录写盘时会检查命名占用:**另一个宿主已占用同名 profile 且域名不同**时自动改名为
117
+ `<name>-<hostKey>`(如 `eteams-xiaoe`),两边各自可正常使用;**两个宿主登录同一个域名**时
118
+ 不加后缀,共用一份凭据(同租户没必要维护两份登录态)。显式 `--profile` 始终优先,不再自动改名。
119
+
42
120
  `auth login` 和 `auth oidc` 都严格走 E10 OAuth2.0 浏览器授权登录,不会读取或消费 XiaoE 统一登录凭据。本地默认监听
43
121
  `http://127.0.0.1:19800/callback`。如端口被占用,可以使用
44
122
  `--port 19801` 指定其他端口;如需要区分客户端来源,可以使用
package/docs/fna.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 齐业成费控中心(FNA)CLI
2
2
 
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`。
3
+ 对应 `src/shortcuts/fna`,把泛微齐业成 FNA 费控中心 14 个源接口固化为 17 个 operation(预算 3 / 费用中心 3 + 报销报表 AI 问答 1 / AI 规则预审 2 / 借款管理 4 / 发票核销 4,其中提醒还款、催票与 AI 预审为 prepare/apply 写链)。源资料指纹见 `skills/weaver-e10-qiyecheng/references/source-manifest.json`。
4
4
 
5
5
  ## 公共前置
6
6
 
@@ -16,6 +16,7 @@
16
16
 
17
17
  | Operation | 风险 | 固定规则与要点 |
18
18
  |---|---|---|
19
+ | `fna.budget.template.list` | read | GET `template/information/getEnabledTemplate`;`@WeaPermission()`(非公开接口);`yearsValue` 可选 1900-2999;服务端按「已发布 + e-builder 过滤 + 模板执行权限」过滤,`group_year=:yearsValue OR compile_method=2`(无周期模板任何年度都返回);节点标题 `模板名称(YYYY年)`,CLI 拆出 `title`/`baseName`/`budgetYear`,`templateId` 恒字符串 |
19
20
  | `fna.budget.application.detail` | read | GET `preApplication/getApplicationDetail`;`requestId` 必填 |
20
21
  | `fna.budget.execute.list` | read | POST `execute/getExecuteListByAi`;`current`/`pageSize` 必填;`templateId` 空仅返回表头 |
21
22
  | `fna.expense.reimbursed.sum` | read | POST `expense/center/getSumReimbursedAmountByAi`;body 可空 |
@@ -33,11 +34,11 @@
33
34
  | `fna.invoice.writeoff.callticket.prepare` | write | 校验 requestids 并预览,不发送 |
34
35
  | `fna.invoice.writeoff.callticket.apply` | write | 需 `confirm:true` + continuation;指纹与 prepare 一致 |
35
36
 
36
- 完整 schema(inputSchema/required/enum)以 `weaver-work-cli fna schema` 为准。`withheldOperations` 记录了未实现的按钮能力(确认已还、核销明细)、ID 解析边界、AI 报表 SQL 与规则配置维护、表单明细回传边界。
37
+ 完整 schema(inputSchema/required/enum)以 `weaver-work-cli fna schema` 为准。`withheldOperations` 记录了未实现的按钮能力(确认已还、核销明细)、ID 解析边界、AI 报表 SQL 与规则配置维护、表单明细回传边界,以及 `getEnabledTemplateNoAuth`(免菜单权限 + 跳过 e-builder 与执行权限过滤,会越权返回全部已发布模板,不封装)。
37
38
 
38
39
  ## 流程链接(单据跳转)
39
40
 
40
- 输出单据标题/申请名称时须同时给出流程详情链接:`{baseUrl}/sp/workflow/flowpage/view/{requestId}`——`{baseUrl}` 取 `weaver-work-cli auth status --no-check` 的 `baseUrl`(禁止硬编码),`{requestId}` 取列表行的 `id`(`fna.loan.main.list`、`fna.invoice.writeoff.list`)或详情/预审入参的 `requestId`;ID 一律按字符串拼接(超 2^53),链接只带 `requestId`,不拼任何凭证。`fna.budget.execute.list` 与 `fna.expense.chart` 的行通常不含 `requestId`,不得反推链接。
41
+ 输出单据标题/申请名称时须同时给出流程详情链接:`{baseUrl}/sp/workflow/flowpage/view/{requestId}`——`{baseUrl}` 取 `weaver-work-cli auth status --no-check` 的 `baseUrl`(禁止硬编码),`{requestId}` 取列表行的 `id`(`fna.loan.main.list`、`fna.invoice.writeoff.list`)或详情/预审入参的 `requestId`;ID 一律按字符串拼接(超 2^53),链接只带 `requestId`,不拼任何凭证。`fna.budget.execute.list`、`fna.budget.template.list` 与 `fna.expense.chart` 的行/节点不是单据(维度明细、模板、报表行),通常不含 `requestId`,不得反推链接。
41
42
 
42
43
  ## 自用系统专场(仅 e-cology)
43
44
 
@@ -53,6 +54,7 @@
53
54
  Windows PowerShell:
54
55
 
55
56
  ```powershell
57
+ weaver-work-cli --json fna run fna.budget.template.list --input-json '{"yearsValue":2026}'
56
58
  weaver-work-cli --json fna run fna.budget.application.detail --input-json '{"requestId":"1001"}'
57
59
  weaver-work-cli --json fna run fna.expense.reimbursed.sum --input-json '{"startDate":"2026-01-01","endDate":"2026-08-31"}'
58
60
  weaver-work-cli --json fna run fna.expense.chart --input-json '{"userInput":"2026-08 各部门报销金额排名前三"}'
@@ -64,6 +66,7 @@ weaver-work-cli --json fna run fna.invoice.writeoff.list --input-json '{"current
64
66
  macOS/Linux(bash/zsh):
65
67
 
66
68
  ```bash
69
+ weaver-work-cli --json fna run fna.budget.template.list --input-json '{"yearsValue":2026}'
67
70
  weaver-work-cli --json fna run fna.budget.application.detail --input-json '{"requestId":"1001"}'
68
71
  weaver-work-cli --json fna run fna.expense.reimbursed.sum --input-json '{"startDate":"2026-01-01","endDate":"2026-08-31"}'
69
72
  weaver-work-cli --json fna run fna.expense.chart --input-json '{"userInput":"2026-08 各部门报销金额排名前三"}'
@@ -79,6 +82,8 @@ weaver-work-cli --json fna run fna.invoice.writeoff.list --input-json '{"current
79
82
  - 金额单位元:`data` 原始精度字符串、`displayData` 格式化;费用中心借款/预付核销接口金额实测可能返回字符串或数字。
80
83
  - 借款 `getSumLoanAmountByAi` 仅统计首条借款记录(for 循环内 return),汇报需注明口径。
81
84
  - 日期口径:报销按明细费用日期、借款按流程创建时间、预付核销按核销记录创建时间。
85
+ - `fna.budget.template.list` 口径:只返回「已发布 + 当前人有模板执行权限」的模板,同租户不同人条数不同,且无 `order by`(顺序由数据库决定);`yearsValue` 只放宽为 `group_year=:yearsValue OR compile_method=2`,无周期模板(`budgetYear=null`)会混入任意年度结果,严格年度口径需按 `budgetYear` 二次过滤;服务端对每个模板做一次 `selectById` 权限判定,模板量大时耗时线性上升。节点是**平铺一层**(`parentId` 恒空),名称按当前登录人语言替换,跨语言不能硬编码中文库值。
86
+ - 按模板名称查预算的解析口径(Agent 侧行为,CLI 不做匹配):归一化 `baseName` 后「全等 → 前缀 → 包含」逐级降级,任一级命中多条即歧义、必须列候选待确认,禁止取第一条;「下级独立」与「上下级独立」互为子串,只能靠全等优先区分。报表侧另有既有行为:按月模板不传 `formDatas.periodName` 时只返回 1 行汇总、`total` 与 `rows` 长度不一致,不是解析失败。
82
87
  - `menuCode`/`permissionSetCode` 环境相关,示例值需与环境核对。
83
88
  - 超 2^53 的 requestId 无法用 JS 数字精确表达,保留字符串并提示人工核验(真实环境 ID 一般在安全整数内,已按数字发送)。
84
89
  - `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 失败区分。
package/docs/invoice.md CHANGED
@@ -71,7 +71,7 @@ weaver-work-cli --json invoice list --fields number,detailUrl
71
71
  | `invoice.delete.prepare/apply` | 高风险写 | 固定软删除 `flag=0`,确认后执行并回查 |
72
72
  | `invoice.browse-field.data` | 只读 | 基于详情接口生成流程表单发票浏览按钮 JSON |
73
73
  | `invoice.reim.file-ocr.preview` | 文件识别预览 | 对 E10 fileId 调用报销场景的发票识别接口,只保留成功项 |
74
- | `invoice.reim.requests.list` | 只读 | 查询事前申请流程列表,默认 `pageNo=1`、`pageSize=100`;结束日取传入的 `cusCreateDateEnd` 或东八区当天,发给接口时再 + 1 天;未传 `cusCreateDateStart` 时取结束日前 7 天,第 1 页为空自动放宽到结束日前 1 个月再查一次,`scene="phone"`(话费)时取结束日前 90 天且不放宽;返回 `data.query`(实际 `cusCreateDateStart`、业务结束日 `cusCreateDateEnd`、`widened`);每条只输出 `requestid` / `workflowid` / `requestname` / `flowStatus` / `creatorId` / `creatorName` / `createTime` |
74
+ | `invoice.reim.requests.list` | 只读 | 查询事前申请流程列表,默认 `pageNo=1`、`pageSize=100`;结束日取传入的 `cusCreateDateEnd` 或东八区当天,发给接口时再 + 1 天;未传 `cusCreateDateStart` 时取结束日前 7 天,第 1 页为空自动放宽到结束日前 1 个月再查一次,`scene="phone"`(话费)时取结束日前 90 天且不放宽;列表在 `data.result.data`,另有 `data.query`(实际 `cusCreateDateStart`、业务结束日 `cusCreateDateEnd`、`widened`);每条只输出 `requestid` / `workflowid` / `requestname` / `flowStatus` / `creatorId` / `creatorName` / `createTime` |
75
75
  | `invoice.reim.workflow.resolve` | 只读 | 根据事前申请 ID 获取报销工作流;无事前申请时传空数组 |
76
76
  | `invoice.reim.candidates.list` | 只读 | 按日期自动翻页拉取未报销发票,分成 `available`(可报)/ `assigned`(已挂单)两组并给出金额合计 |
77
77
  | `invoice.reim.employee-superiors` | 只读 | 获取当前人员和上级信息 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weaver-work-cli",
3
- "version": "0.1.54",
3
+ "version": "0.1.57",
4
4
  "description": "面向泛微工作工具链的可扩展 TypeScript CLI 基础框架(E10 业票通等能力)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,7 +11,8 @@
11
11
  "skill-template",
12
12
  "templates",
13
13
  "scripts",
14
- "tools"
14
+ "tools",
15
+ "!tools/workflow-todo-mock.mjs"
15
16
  ],
16
17
  "bin": {
17
18
  "weaver-work-cli": "./dist/index.js"
@@ -24,6 +25,7 @@
24
25
  "start": "node dist/index.js",
25
26
  "build:skill": "node scripts/package-skill.mjs",
26
27
  "build:yepiaotong-skill": "node scripts/package-skill.mjs yepiaotong",
28
+ "pack:full": "node scripts/pack-offline.mjs",
27
29
  "prepublishOnly": "npm run build && npm run test",
28
30
  "prepack": "npm run build"
29
31
  },
@@ -0,0 +1,228 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * 打包「自包含 / 可离线安装」的 npm 包。
4
+ *
5
+ * 与 `npm pack` 的区别:
6
+ * npm pack 只会带上**当前平台**已安装的可选依赖(例如 keyring 只带 darwin-arm64),
7
+ * 在 Linux / Windows 上安装后原生模块缺失,CLI 起不来。
8
+ * 本脚本会把 dependencies 的**整棵递归依赖树**(含所有平台的 optionalDependencies)
9
+ * 抓齐并塞进 tgz,产物可以直接:
10
+ * npm i -g ./weaver-work-cli-x.y.z-full.tgz --offline
11
+ *
12
+ * 用法:
13
+ * node scripts/pack-offline.mjs # 构建 + 打包 + 隔离验证
14
+ * node scripts/pack-offline.mjs --no-build # 复用现有 dist
15
+ * node scripts/pack-offline.mjs --no-verify # 跳过安装验证
16
+ * node scripts/pack-offline.mjs --out dist-pkg # 指定产物目录(默认仓库根)
17
+ */
18
+ import { execFileSync } from 'node:child_process'
19
+ import fs from 'node:fs'
20
+ import os from 'node:os'
21
+ import path from 'node:path'
22
+ import { fileURLToPath } from 'node:url'
23
+
24
+ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
25
+ const STAGE = path.join(ROOT, '.pack-tmp')
26
+ const CACHE = path.join(ROOT, '.pack-cache')
27
+ const NM = path.join(STAGE, 'package', 'node_modules')
28
+
29
+ const argv = process.argv.slice(2)
30
+ const has = (flag) => argv.includes(flag)
31
+ const valueOf = (flag, fallback) => {
32
+ const i = argv.indexOf(flag)
33
+ return i >= 0 && argv[i + 1] ? argv[i + 1] : fallback
34
+ }
35
+
36
+ const OUT_DIR = path.resolve(ROOT, valueOf('--out', '.'))
37
+ const SKIP_BUILD = has('--no-build')
38
+ const SKIP_VERIFY = has('--no-verify')
39
+
40
+ function run(cmd, args, opts = {}) {
41
+ return execFileSync(cmd, args, { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf8', ...opts }).trim()
42
+ }
43
+
44
+ function readJson(file) {
45
+ return JSON.parse(fs.readFileSync(file, 'utf8'))
46
+ }
47
+
48
+ function rmrf(target) {
49
+ fs.rmSync(target, { recursive: true, force: true })
50
+ }
51
+
52
+ /** 复制目录,顺手丢掉 .DS_Store / .git / 依赖自带的 node_modules 等无用物 */
53
+ function copyTree(src, dest) {
54
+ fs.cpSync(src, dest, {
55
+ recursive: true,
56
+ dereference: true,
57
+ filter: (from) => {
58
+ const base = path.basename(from)
59
+ return !['.DS_Store', '.git', '.github', 'node_modules'].includes(base)
60
+ },
61
+ })
62
+ }
63
+
64
+ /** 把形如 "^1.2.3" / "~1.2.3" / "1.3.0" 的声明解析成已安装或远程的具体版本 */
65
+ function resolveVersion(name, range, installedMeta) {
66
+ if (/^\d+\.\d+\.\d+/.test(range)) return range.replace(/^[^0-9]*/, '')
67
+ if (installedMeta?.version) return installedMeta.version
68
+ return run('npm', ['view', `${name}@${range}`, 'version', '--json'], { cwd: ROOT })
69
+ .replace(/[\[\]"\s]/g, '')
70
+ .split(',')[0]
71
+ }
72
+
73
+ /** 下载并解包某个具体版本到 stage 的 node_modules 下 */
74
+ function fetchIntoStage(name, version) {
75
+ fs.mkdirSync(CACHE, { recursive: true })
76
+ const tgz = path.join(CACHE, `${name.replace('/', '__')}-${version}.tgz`)
77
+ if (!fs.existsSync(tgz)) {
78
+ const filename = run('npm', ['pack', `${name}@${version}`, '--pack-destination', CACHE, '--silent'], {
79
+ cwd: ROOT,
80
+ })
81
+ .split('\n')
82
+ .filter(Boolean)
83
+ .pop()
84
+ const produced = path.join(CACHE, filename)
85
+ if (produced !== tgz) fs.renameSync(produced, tgz)
86
+ }
87
+ const dest = path.join(NM, name)
88
+ rmrf(dest)
89
+ fs.mkdirSync(dest, { recursive: true })
90
+ execFileSync('tar', ['-xzf', tgz, '-C', dest, '--strip-components=1'], { stdio: 'inherit' })
91
+ console.log(` + ${name}@${version} (registry)`)
92
+ }
93
+
94
+ /**
95
+ * 递归补齐依赖树:bundleDependencies 为根,按 dependencies + optionalDependencies 展开。
96
+ * 本地 node_modules 已有的直接复制;平台相关、本地未安装的从 registry 抓。
97
+ */
98
+ function collectDependencies(rootPkg) {
99
+ const bundleRoots = rootPkg.bundleDependencies ?? rootPkg.bundledDependencies ?? Object.keys(rootPkg.dependencies ?? {})
100
+ const queue = bundleRoots.map((name) => ({
101
+ name,
102
+ range: rootPkg.dependencies?.[name] ?? '*',
103
+ }))
104
+ const seen = new Set()
105
+
106
+ while (queue.length) {
107
+ const { name, range } = queue.shift()
108
+ const localDir = path.join(ROOT, 'node_modules', name)
109
+ const localMeta = fs.existsSync(path.join(localDir, 'package.json'))
110
+ ? readJson(path.join(localDir, 'package.json'))
111
+ : null
112
+ const version = resolveVersion(name, range, localMeta)
113
+ const key = `${name}@${version}`
114
+ if (seen.has(key)) continue
115
+ seen.add(key)
116
+
117
+ const dest = path.join(NM, name)
118
+ if (!fs.existsSync(dest)) {
119
+ if (localMeta?.version === version) {
120
+ copyTree(localDir, dest)
121
+ console.log(` + ${name}@${version} (local)`)
122
+ } else {
123
+ fetchIntoStage(name, version)
124
+ }
125
+ }
126
+
127
+ const meta = readJson(path.join(dest, 'package.json'))
128
+ for (const [depName, depRange] of Object.entries({
129
+ ...meta.dependencies,
130
+ ...meta.optionalDependencies,
131
+ })) {
132
+ queue.push({ name: depName, range: depRange })
133
+ }
134
+ }
135
+
136
+ return [...seen].sort()
137
+ }
138
+
139
+ function verify(tgz, rootPkg) {
140
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'wwcli-offline-'))
141
+ const prefix = path.join(tmp, 'prefix')
142
+ const installed = path.join(prefix, 'lib', 'node_modules', rootPkg.name)
143
+ try {
144
+ console.log('\n[verify] 离线安装到临时 prefix …')
145
+ run('npm', ['install', '-g', tgz, '--prefix', prefix, '--offline', '--no-audit', '--no-fund', '--loglevel=error'], {
146
+ cwd: tmp,
147
+ })
148
+
149
+ const bin = path.join(prefix, 'bin', rootPkg.name)
150
+ const version = run(bin, ['--version'], { cwd: tmp })
151
+ console.log(` ✓ ${rootPkg.name} --version → ${version}`)
152
+
153
+ const help = run(bin, ['--help'], { cwd: tmp })
154
+ console.log(` ✓ --help 输出 ${help.split('\n').length} 行`)
155
+
156
+ const keyring = run(process.execPath, ['-e', "require('@napi-rs/keyring');console.log('ok')"], {
157
+ cwd: installed,
158
+ })
159
+ console.log(` ✓ 原生模块可加载(${keyring})`)
160
+
161
+ const platforms = fs
162
+ .readdirSync(path.join(installed, 'node_modules', '@napi-rs'))
163
+ .filter((n) => n.startsWith('keyring-'))
164
+ console.log(` ✓ keyring 平台二进制 ${platforms.length} 个:${platforms.join(', ')}`)
165
+ return true
166
+ } finally {
167
+ rmrf(tmp)
168
+ }
169
+ }
170
+
171
+ // ---------- main ----------
172
+ if (!SKIP_BUILD) {
173
+ console.log('[1/5] 构建 dist …')
174
+ execFileSync('npm', ['run', 'build'], { cwd: ROOT, stdio: 'inherit' })
175
+ } else {
176
+ console.log('[1/5] 跳过构建,复用现有 dist')
177
+ }
178
+
179
+ const pkg = readJson(path.join(ROOT, 'package.json'))
180
+ const pkgDir = path.join(STAGE, 'package')
181
+
182
+ console.log('[2/5] 准备暂存目录 …')
183
+ rmrf(STAGE)
184
+ fs.mkdirSync(pkgDir, { recursive: true })
185
+
186
+ const files = pkg.files ?? []
187
+ for (const entry of files) {
188
+ const src = path.join(ROOT, entry)
189
+ if (!fs.existsSync(src)) {
190
+ console.warn(` ! files 中声明的 ${entry} 不存在,跳过`)
191
+ continue
192
+ }
193
+ const dest = path.join(pkgDir, entry)
194
+ if (fs.statSync(src).isDirectory()) copyTree(src, dest)
195
+ else fs.copyFileSync(src, dest)
196
+ }
197
+ for (const extra of ['package.json', 'README.md', 'LICENSE']) {
198
+ const src = path.join(ROOT, extra)
199
+ if (fs.existsSync(src)) fs.copyFileSync(src, path.join(pkgDir, extra))
200
+ }
201
+ // bin 入口必须可执行,否则 npm link / 直接执行会 permission denied
202
+ fs.chmodSync(path.join(pkgDir, 'dist', 'index.js'), 0o755)
203
+
204
+ console.log('[3/5] 递归收集依赖(含各平台可选二进制)…')
205
+ const bundled = collectDependencies(pkg)
206
+
207
+ console.log('[4/5] 生成 tgz …')
208
+ const tgzName = `${pkg.name}-${pkg.version}-full.tgz`
209
+ const tgz = path.join(OUT_DIR, tgzName)
210
+ fs.mkdirSync(OUT_DIR, { recursive: true })
211
+ fs.rmSync(tgz, { force: true })
212
+ execFileSync('tar', ['-czf', tgz, '-C', STAGE, 'package'], { stdio: 'inherit' })
213
+
214
+ const sizeMb = (fs.statSync(tgz).size / 1024 / 1024).toFixed(2)
215
+ const entryCount = Number(run('tar', ['-tzf', tgz]).split('\n').length)
216
+ const shown = path.relative(ROOT, tgz)
217
+ console.log(` 产物:${shown.startsWith('..') ? tgz : shown}(${sizeMb} MB,${entryCount} 个条目)`)
218
+ console.log(` 依赖:${bundled.join(', ')}`)
219
+
220
+ if (!SKIP_VERIFY) {
221
+ console.log('[5/5] 隔离验证(--offline 全局安装)…')
222
+ verify(tgz, pkg)
223
+ } else {
224
+ console.log('[5/5] 跳过验证')
225
+ }
226
+
227
+ if (!has('--keep-stage')) rmrf(STAGE)
228
+ console.log('\n完成 ✔')