weaver-work-cli 0.1.78 → 0.1.81

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 (250) hide show
  1. package/README.md +3 -1
  2. package/dist/chunks/{archive-ENBSUMHV.js → archive-KVV4SM7J.js} +3 -3
  3. package/dist/chunks/{archive-oa-7BFPQ6M5.js → archive-oa-VRSPNLY4.js} +3 -3
  4. package/dist/chunks/{asset-V5SUD3PW.js → asset-JZ5MN6OL.js} +306 -10
  5. package/dist/chunks/{asset-idle-3CEL7WFX.js → asset-idle-B4SAL43V.js} +3 -3
  6. package/dist/chunks/{attachment-content-TFOC3Y3X.js → attachment-content-7W4XQTA7.js} +3 -3
  7. package/dist/chunks/{blog-FLI4SS3P.js → blog-XCBM467O.js} +3 -3
  8. package/dist/chunks/{caizhilian-7WCTKCCP.js → caizhilian-NZVUKCZD.js} +5 -5
  9. package/dist/chunks/{calendar-G726HUUH.js → calendar-OVM2SGYJ.js} +3 -3
  10. package/dist/chunks/{chunk-XNN5PZTI.js → chunk-3WZMDOI3.js} +1 -1
  11. package/dist/chunks/{chunk-FAC4IFGQ.js → chunk-56F2GGE4.js} +5 -5
  12. package/dist/chunks/{chunk-LCM5SSGJ.js → chunk-5MM2IZ27.js} +423 -36
  13. package/dist/chunks/{chunk-BWFCTE43.js → chunk-5NQZO3CO.js} +48 -5
  14. package/dist/chunks/{chunk-ZOTXXGUM.js → chunk-5RIK6OLF.js} +7 -7
  15. package/dist/chunks/{chunk-5E2FDXBU.js → chunk-64RYQOXA.js} +1 -1
  16. package/dist/chunks/{chunk-Z44YFIN6.js → chunk-7BP3HU74.js} +2 -2
  17. package/dist/chunks/{chunk-3Q5F4C5B.js → chunk-AW3HQUOC.js} +5 -5
  18. package/dist/chunks/{chunk-7M5OYRK2.js → chunk-BD3M2YVN.js} +3 -3
  19. package/dist/chunks/{chunk-JEQHNNSS.js → chunk-BFVUBCYO.js} +14 -0
  20. package/dist/chunks/{chunk-PAWXVT6H.js → chunk-CLVEXDEJ.js} +4 -5
  21. package/dist/chunks/{chunk-TBCKK6LH.js → chunk-DWCMKEMO.js} +2 -2
  22. package/dist/chunks/{chunk-USYFVIUR.js → chunk-E3XUYWYA.js} +4 -4
  23. package/dist/chunks/{chunk-E2EY3DMS.js → chunk-FIPTUAOW.js} +2 -2
  24. package/dist/chunks/{chunk-IBTGXLOT.js → chunk-GQEIHXY5.js} +6 -6
  25. package/dist/chunks/{chunk-TD5IOEGN.js → chunk-JUPKXW4P.js} +1 -1
  26. package/dist/chunks/{chunk-UZ2E3VNI.js → chunk-KZ3JR3GE.js} +3 -3
  27. package/dist/chunks/{chunk-4PBN7NJY.js → chunk-L2PKMZIU.js} +1 -1
  28. package/dist/chunks/{chunk-DACQKJ6O.js → chunk-LXWWOHM6.js} +4 -4
  29. package/dist/chunks/{chunk-7DE3VMZD.js → chunk-LYFPWZBD.js} +6 -1
  30. package/dist/chunks/{chunk-2UV4IZIT.js → chunk-MTIV6JEN.js} +2 -2
  31. package/dist/chunks/{chunk-5VQ7JHV4.js → chunk-MWFKLXVU.js} +68 -46
  32. package/dist/chunks/{chunk-PMRNIGKZ.js → chunk-RVVRTW4P.js} +2 -2
  33. package/dist/chunks/{chunk-FPWCCRKT.js → chunk-UASZW22U.js} +3 -3
  34. package/dist/chunks/{chunk-RVEKGVZU.js → chunk-VMUVVTT4.js} +2 -2
  35. package/dist/chunks/{chunk-7SQN5IZR.js → chunk-W4BGNYKR.js} +12 -2
  36. package/dist/chunks/{chunk-OVTCWLNQ.js → chunk-W4R3SXJV.js} +15 -7
  37. package/dist/chunks/{chunk-UDBQJLQF.js → chunk-WF5G5SV3.js} +2 -2
  38. package/dist/chunks/{chunk-VNEU7OUN.js → chunk-WM5ZE67G.js} +1 -1
  39. package/dist/chunks/{chunk-QVKRNL7L.js → chunk-WQ4ZHAEZ.js} +10 -2
  40. package/dist/chunks/{chunk-SWFTWNWL.js → chunk-X7OZKI6F.js} +12 -12
  41. package/dist/chunks/{chunk-WNFDR5PC.js → chunk-Y6HRTEDD.js} +21 -11
  42. package/dist/chunks/{chunk-2KW7AI6P.js → chunk-YFDKTTYX.js} +8 -5
  43. package/dist/chunks/{chunk-BP7BONZO.js → chunk-YLPGCOAM.js} +76 -69
  44. package/dist/chunks/{chunk-LQLIXBJF.js → chunk-YXIPZFMX.js} +1 -1
  45. package/dist/chunks/{cli-WA7FOQKC.js → cli-VCQIDBDQ.js} +37 -37
  46. package/dist/chunks/{commands-J52MJ6NF.js → commands-THGXVOEL.js} +9 -5
  47. package/dist/chunks/{conflict-D4GVAURN.js → conflict-T7URCNS6.js} +2 -2
  48. package/dist/chunks/{contract-GW7US3UF.js → contract-ZLGLQ45G.js} +3 -3
  49. package/dist/chunks/{cowork-GZDODGKF.js → cowork-2MBNOUYS.js} +21 -8
  50. package/dist/chunks/{create-flow-ERDGW3FZ.js → create-flow-OFZC36MV.js} +6 -6
  51. package/dist/chunks/{data-HTQZRPPI.js → data-6O7ANJVT.js} +3 -3
  52. package/dist/chunks/{ebuilder-form-GHNIZ7ET.js → ebuilder-form-OJ3KJVQI.js} +4 -4
  53. package/dist/chunks/{ehr-P6T7OAAV.js → ehr-NWMI5Q7S.js} +8 -32
  54. package/dist/chunks/{employee-QX57HEWS.js → employee-O2EPUYIH.js} +2 -2
  55. package/dist/chunks/{entry-mode-SQU5WTX6.js → entry-mode-TVACGU7K.js} +3 -3
  56. package/dist/chunks/{env-DASBNSEM.js → env-EWG4ZAWP.js} +2 -2
  57. package/dist/chunks/{esb-ATRKVHCD.js → esb-56FV2PIA.js} +5 -5
  58. package/dist/chunks/{factory-A3NAKZAA.js → factory-GQSEJRDY.js} +1 -1
  59. package/dist/chunks/{fna-IKYI3SST.js → fna-YLA3RKRW.js} +3 -3
  60. package/dist/chunks/{group-chat-7SEAVAJR.js → group-chat-5R6L3LCG.js} +3 -3
  61. package/dist/chunks/{host-UY4LQPN4.js → host-42MLO4KX.js} +4 -4
  62. package/dist/chunks/{host-XXGDQM7D.js → host-J72VEDW5.js} +4 -4
  63. package/dist/chunks/{host-EJSJSLVK.js → host-QKCRQS2C.js} +4 -4
  64. package/dist/chunks/{host-EYNLB6S4.js → host-W3BVEATN.js} +4 -4
  65. package/dist/chunks/{host-OT4KNR3G.js → host-YJINI5GG.js} +4 -4
  66. package/dist/chunks/{host-6UOXYOOY.js → host-ZVGBZOHY.js} +4 -4
  67. package/dist/chunks/{hrm-5JQ7QZ6A.js → hrm-3JFZNB42.js} +66 -26
  68. package/dist/chunks/{im-2YJW3EI5.js → im-HKIRPCGD.js} +5 -5
  69. package/dist/chunks/{invoice-37HR6L3W.js → invoice-4PREIOTG.js} +185 -49
  70. package/dist/chunks/{jiuchuanhui-KBWUZ7WT.js → jiuchuanhui-K3PLNENZ.js} +3 -3
  71. package/dist/chunks/{lazy-dispatch-ZDKLS5MR.js → lazy-dispatch-MKGEWZNM.js} +8 -8
  72. package/dist/chunks/{mail-YBKUM6HM.js → mail-6QPVWKXM.js} +3 -3
  73. package/dist/chunks/{meeting-7AEQGBAT.js → meeting-QPPEPBSN.js} +20 -16
  74. package/dist/chunks/{minute-doc-REI6RUE4.js → minute-doc-JMIDZK5D.js} +1 -1
  75. package/dist/chunks/{okr-HW7IULIR.js → okr-67C5LQYD.js} +3 -3
  76. package/dist/chunks/{operations-4P2UYVLH.js → operations-YLKRNAPI.js} +5 -5
  77. package/dist/chunks/{org-MWWIFNAO.js → org-L5XDM2RQ.js} +2 -2
  78. package/dist/chunks/{performance-PM2G6L3E.js → performance-33QZZR4I.js} +3 -3
  79. package/dist/chunks/{plan-3YYGZ7ZM.js → plan-W4BPONRL.js} +3 -3
  80. package/dist/chunks/{project-6PRGBLO2.js → project-OKSEH6AF.js} +3 -3
  81. package/dist/chunks/{reception-7G3J2MA6.js → reception-H5M7SPHT.js} +3 -3
  82. package/dist/chunks/{recruit-stage-TLZJUFHD.js → recruit-stage-O2JGNVMO.js} +16 -86
  83. package/dist/chunks/{registry-4S3RXXWS.js → registry-45VEUYTC.js} +4 -4
  84. package/dist/chunks/{registry-3VTB3KLV.js → registry-BMTQ55G5.js} +5 -5
  85. package/dist/chunks/{registry-KQ4TNUWO.js → registry-PYONXFUF.js} +3 -3
  86. package/dist/chunks/{registry-UVTI323K.js → registry-SAMJ4VH2.js} +14 -14
  87. package/dist/chunks/{registry-AC33ZZVH.js → registry-YY62OFKQ.js} +1 -1
  88. package/dist/chunks/{room-recommend-ELEJUYBN.js → room-recommend-NRLAZJCI.js} +4 -4
  89. package/dist/chunks/{schedule-XBKY7VEA.js → schedule-LNBOCBP5.js} +4 -4
  90. package/dist/chunks/{smart-extract-T5Z4AULN.js → smart-extract-JOTX6UZC.js} +3 -3
  91. package/dist/chunks/{update-77ZUIYSG.js → update-BERR64TI.js} +3 -3
  92. package/dist/chunks/{workflow-SYCBS5XD.js → workflow-ZDQY3TI7.js} +5 -5
  93. package/dist/core/runtime-agent.js +19 -3
  94. package/dist/index.js +4 -4
  95. package/dist/internal/e10/auth/agent-host-key.js +10 -1
  96. package/dist/internal/e10/auth/commands.js +20 -4
  97. package/dist/internal/e10/auth/xiaoe.js +15 -3
  98. package/dist/shortcuts/asset/host.js +39 -1
  99. package/dist/shortcuts/asset/index.js +16 -2
  100. package/dist/shortcuts/asset/manifest.js +115 -1
  101. package/dist/shortcuts/asset/operations/audit-report.js +144 -0
  102. package/dist/shortcuts/asset/operations/registry.js +4 -0
  103. package/dist/shortcuts/asset/operations/write.js +7 -1
  104. package/dist/shortcuts/cowork/operations/read.js +13 -6
  105. package/dist/shortcuts/cowork/operations/shared.js +15 -0
  106. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +1 -14
  107. package/dist/shortcuts/ehr/operations/recruit-write.js +4 -24
  108. package/dist/shortcuts/ehr/operations/recruit.js +23 -13
  109. package/dist/shortcuts/hrm/host.js +51 -4
  110. package/dist/shortcuts/hrm/index.js +45 -26
  111. package/dist/shortcuts/hrm/manifest.js +17 -0
  112. package/dist/shortcuts/hrm/operations/employee.js +3 -7
  113. package/dist/shortcuts/hrm/operations/org.js +2 -4
  114. package/dist/shortcuts/hrm/operations/position.js +2 -4
  115. package/dist/shortcuts/hrm/operations/shared.js +21 -0
  116. package/dist/shortcuts/hrm/operations.js +34 -0
  117. package/dist/shortcuts/im/constants.js +163 -0
  118. package/dist/shortcuts/im/host.js +12 -5
  119. package/dist/shortcuts/im/operations/at-mention.js +4 -2
  120. package/dist/shortcuts/im/operations/file-user.js +3 -1
  121. package/dist/shortcuts/im/operations/msg-sync.js +219 -2
  122. package/dist/shortcuts/im/operations/msg-write.js +70 -30
  123. package/dist/shortcuts/invoice/invoice-record.js +20 -1
  124. package/dist/shortcuts/invoice/manifest.js +13 -7
  125. package/dist/shortcuts/invoice/operations/reim-auto.js +94 -36
  126. package/dist/shortcuts/invoice/projection.js +7 -3
  127. package/dist/shortcuts/invoice/read-enrichment.js +78 -8
  128. package/dist/shortcuts/meeting/host.js +4 -0
  129. package/dist/shortcuts/meeting/operations/eb/create-flow.js +45 -5
  130. package/dist/shortcuts/meeting/operations/env.js +15 -1
  131. package/dist/shortcuts/meeting/operations/rooms.js +7 -0
  132. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +3 -22
  133. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +1 -5
  134. package/dist/shortcuts/recruit-stage/operations/list.js +3 -2
  135. package/dist/shortcuts/recruit-stage/operations/profile.js +3 -2
  136. package/dist/shortcuts/recruit-stage/operations/resume-import.js +8 -55
  137. package/dist/shortcuts/recruit-stage/operations/search.js +2 -2
  138. package/dist/shortcuts/recruit-stage/operations/shortlist.js +3 -2
  139. package/dist/shortcuts/recruit-stage/operations/tag.js +5 -0
  140. package/dist/shortcuts/recruit-stage/shared.js +3 -11
  141. package/dist/shortcuts/workflow/operations/form.js +2 -1
  142. package/docs/agent-invoice.md +26 -8
  143. package/docs/e10-auth.md +14 -1
  144. package/docs/hrm.md +5 -1
  145. package/docs/invoice.md +28 -8
  146. package/docs/operation-manual.md +6 -4
  147. package/docs/ziguanjia.md +5 -1
  148. package/package.json +1 -1
  149. package/scripts/package-skill.mjs +14 -2
  150. package/skill-template/business-info.json +6 -1
  151. package/skill-template/domains/hrm.md +1 -1
  152. package/skill-template/domains/yepiaotong.md +29 -11
  153. package/skill-template/domains/ziguanjia.md +7 -2
  154. package/skills/weaver-e10-caizhilian/references/source-manifest.json +3 -3
  155. package/skills/weaver-e10-cowork/SKILL.md +13 -1
  156. package/skills/weaver-e10-hrm/SKILL.md +16 -2
  157. package/skills/weaver-e10-hrm/references/org.md +1 -1
  158. package/skills/weaver-e10-jucailin/SKILL.md +11 -12
  159. package/skills/weaver-e10-jucailin/agents/openai.yaml +4 -4
  160. package/skills/weaver-e10-jucailin/references/recruit-implement-consult-sop.md +1 -1
  161. package/skills/weaver-e10-jucailin/references/recruit-implement-kb-data-update-channels.md +1 -1
  162. package/skills/weaver-e10-jucailin/references/recruit-implement-kb-talent-base-form.md +1 -1
  163. package/skills/weaver-e10-jucailin/references/recruit-output-links.md +1 -2
  164. package/skills/weaver-e10-jucailin/references/recruit-read.md +5 -27
  165. package/skills/weaver-e10-jucailin/references/recruit-write.md +19 -21
  166. package/skills/weaver-e10-jucailin/references/safety-boundaries.md +2 -2
  167. package/skills/weaver-e10-mail/SKILL.md +11 -3
  168. package/skills/weaver-e10-mail/references/mail-agent-entry.md +1 -1
  169. package/skills/weaver-e10-meeting/SKILL.md +39 -1
  170. package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
  171. package/skills/weaver-e10-plan/references/source-manifest.json +3 -3
  172. package/skills/weaver-e10-recruit-stage/SKILL.md +57 -42
  173. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +27 -22
  174. package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +1 -1
  175. package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +20 -5
  176. package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +96 -22
  177. package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +8 -3
  178. package/skills/weaver-e10-recruit-stage/lib/report-attachment.mjs +7 -6
  179. package/skills/weaver-e10-recruit-stage/lib/resume-import-once.mjs +308 -0
  180. package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +2 -2
  181. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +6 -7
  182. package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +5 -5
  183. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +4 -5
  184. package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +2 -8
  185. package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +0 -2
  186. package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +1 -2
  187. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +7 -5
  188. package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +2 -2
  189. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +3 -3
  190. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +20 -21
  191. package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +12 -7
  192. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +2 -3
  193. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +1 -3
  194. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +75 -52
  195. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +11 -17
  196. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +1 -1
  197. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +3 -4
  198. package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +456 -93
  199. package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +2 -2
  200. package/skills/weaver-e10-recruit-stage/templates/match-report.html +1 -1
  201. package/skills/weaver-e10-shared/SKILL.md +1 -1
  202. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +1 -1
  203. package/skills/weaver-e10-shared-report.html +874 -0
  204. package/skills/weaver-e10-shijingran/references/source-manifest.json +3 -3
  205. package/skills/weaver-e10-skill-maker/references/post-generation-install.md +6 -0
  206. package/skills/weaver-e10-workflow/SKILL.md +4 -4
  207. package/skills/weaver-e10-workflow/aiDeepRead/config.json +138 -142
  208. package/skills/weaver-e10-workflow/references/workflow-deep-read.md +7 -7
  209. package/skills/weaver-e10-yepiaotong/SKILL.md +33 -21
  210. package/skills/weaver-e10-yepiaotong/references/invoice-add.md +2 -2
  211. package/skills/weaver-e10-yepiaotong/references/invoice-agent-entry.md +5 -1
  212. package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +2 -0
  213. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +2 -0
  214. package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +3 -1
  215. package/skills/weaver-e10-yepiaotong/references/invoice-import.md +2 -2
  216. package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +30 -2
  217. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +8 -0
  218. package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +4 -4
  219. package/skills/weaver-e10-yepiaotong/references/name-fuzzy-search.md +3 -3
  220. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +19 -9
  221. package/skills/weaver-e10-yepiaotong/references/reim-customer-search.md +25 -32
  222. package/skills/weaver-e10-yepiaotong/references/reim-eligibility-rules.md +70 -21
  223. package/skills/weaver-e10-yepiaotong/references/reim-fill-validation.md +23 -12
  224. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +52 -17
  225. package/skills/weaver-e10-yepiaotong/references/reim-preapproval-rules.md +23 -19
  226. package/skills/weaver-e10-yepiaotong/references/reim-travel-invoice-matching.md +6 -4
  227. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +127 -63
  228. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +89 -71
  229. package/skills/weaver-e10-yepiaotong/references/travel-application-fill.md +2 -2
  230. package/skills/weaver-e10-yepiaotong/references/workflow-direct-fill.md +28 -20
  231. package/skills/weaver-e10-yepiaotong.zip +0 -0
  232. package/skills/weaver-e10-yimiaoban/SKILL.md +12 -9
  233. package/skills/weaver-e10-yimiaoban/references/constants.md +291 -0
  234. package/skills/weaver-e10-yimiaoban/references/ding-write.md +1 -0
  235. package/skills/weaver-e10-yimiaoban/references/group-read.md +1 -0
  236. package/skills/weaver-e10-yimiaoban/references/group-write.md +1 -0
  237. package/skills/weaver-e10-yimiaoban/references/msg-read.md +10 -1
  238. package/skills/weaver-e10-yimiaoban/references/msg-write.md +3 -1
  239. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +1 -0
  240. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +175 -36
  241. package/skills/weaver-e10-ziguanjia/SKILL.md +26 -6
  242. package/skills/weaver-e10-ziguanjia/references/source-manifest.json +1373 -96
  243. package/skills/weaver-e10-ziguanjia/references/ziguanjia-audit.md +63 -0
  244. package/skills/weaver-e10-ziguanjia/references/ziguanjia-disabled-capabilities.md +5 -1
  245. package/skills/weaver-e10-ziguanjia/references/ziguanjia-idle.md +52 -0
  246. package/skills/weaver-e10-ziguanjia/references/ziguanjia-report.md +59 -0
  247. package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
  248. package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
  249. package/scripts/pysite/__pycache__/sitecustomize.cpython-314.pyc +0 -0
  250. package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +0 -89
@@ -136,6 +136,9 @@ const invoiceTravelIdsSchema = arrayOf(objectSchema({
136
136
  date: { type: 'string' },
137
137
  type: { type: 'integer' },
138
138
  }, [], true), { description: '本张发票已关联的凭证列表,原样保留 fid、文件、金额、日期及状态;无关联为 [],不逐个补查凭证详情。' });
139
+ const tollSummaryNamesSchema = arrayOf({ type: 'string' }, {
140
+ description: '仅 comm_info.pro.cname 为「电子发票(通行费)」时返回:从详情 flist 中提取名称含「票据汇总单」的未删除文件名,按原序保留完整名称。列表和候选均按真实发票 ID 批量读取详情,不能凭列表 flist 或空数组判定汇总单完整;详情入口直接提取当次结果,不递归补读。无匹配项为 [],补读未能核实时返回 [] 并附 warnings,不沿用列表旧值,其他票种不返回。',
141
+ });
139
142
  const extInfoSchema = objectSchema({
140
143
  expenseNote: { type: 'string', description: '费用说明(ext.expenseDesc),如「上海-武汉」' },
141
144
  content: { type: 'string', description: '消费内容(ext.content;为空时取 ext.products[].name)' },
@@ -196,6 +199,7 @@ const invoiceInfoSchema = objectSchema({
196
199
  fylx: { type: 'string', description: '原始费用类型 ID,保留兼容;读取中文名称使用 fyn。' },
197
200
  fyn: { type: ['string', 'null'], description: '按 /api/inc/syncFylx 的 fyid → fyn 映射得到的费用类型中文名称;无法映射为 null 并附 warnings,不用票面 kind 猜测。' },
198
201
  travel_ids: invoiceTravelIdsSchema,
202
+ tollSummaryNames: tollSummaryNamesSchema,
199
203
  }, [], true);
200
204
  const invoiceResultItemSchema = objectSchema({
201
205
  info: invoiceInfoSchema,
@@ -293,12 +297,12 @@ const listOutputSchema = objectSchema({
293
297
  */
294
298
  const summaryOutputView = {
295
299
  name: 'summary',
296
- description: '语义化平表,省略常规空值字段;列表级汇总在前、items 在后,并附 itemCount。含 fyn(费用类型中文名)、travel_ids(相关凭证,无关联为 [])及 ext 的费用说明、城市、备注、起止地、乘车人 userId / passengerName 等。费用类型无法映射时保留 fyn:null,说明见 warnings。顶层保留 employeeInfo 当前人员信息及 preApprovals 普通事前申请候选,不放入明细。用 CLI 的 --view summary 启用。',
300
+ description: '语义化平表,省略常规空值字段;列表级汇总在前、items 在后,并附 itemCount。含 fyn(费用类型中文名)、travel_ids(相关凭证,无关联为 [])、通行费票的 tollSummaryNames(票据汇总单文件名数组)及 ext 的费用说明、城市、备注、起止地、乘车人 userId / passengerName 等。费用类型无法映射时保留 fyn:null,说明见 warnings。顶层保留 employeeInfo 当前人员信息及 preApprovals 普通事前申请候选,不放入明细。用 CLI 的 --view summary 启用。',
297
301
  itemFields: SUMMARY_ITEM_FIELDS,
298
302
  };
299
303
  const detailOutputView = {
300
304
  name: 'detail',
301
- description: '单张发票的语义详情:summary 字段(含 fyn 中文费用类型、travel_ids 相关凭证、ext 费用说明、行程及乘车人 userId / passengerName),外加 attachments(发票自身附件)、issuer(开票人)、checkState(查验标记,0=未查验,与票面 valid 不是一个口径)。顶层保留 employeeInfo 当前人员信息及 preApprovals 普通事前申请候选。用 CLI 的 --view detail 启用。',
305
+ description: '单张发票的语义详情:summary 字段(含 fyn 中文费用类型、travel_ids 相关凭证、通行费票的 tollSummaryNames 文件名数组、ext 费用说明、行程及乘车人 userId / passengerName),外加 attachments(发票自身附件)、issuer(开票人)、checkState(查验标记,0=未查验,与票面 valid 不是一个口径)。顶层保留 employeeInfo 当前人员信息及 preApprovals 普通事前申请候选。用 CLI 的 --view detail 启用。',
302
306
  itemFields: DETAIL_ITEM_FIELDS,
303
307
  };
304
308
  const uploadOutputSchema = objectSchema({
@@ -448,6 +452,7 @@ const workflowResolveDataSchema = objectSchema({
448
452
  }, [], true);
449
453
  const reimCandidateItemSchema = objectSchema({
450
454
  fid: { type: 'string' },
455
+ detailUrl: { type: 'string', description: '当前 E10 会话 baseUrl 与本票真实 fid 生成的详情链接,形如 {baseUrl}/sp/inc/incDetail?fid={fid};两组每张票均返回,无需另查详情。' },
451
456
  number: { type: 'string' },
452
457
  date: { type: 'string' },
453
458
  total: { type: 'string' },
@@ -458,16 +463,17 @@ const reimCandidateItemSchema = objectSchema({
458
463
  extInfo: { ...extInfoSchema, description: '已解析的城市、起止地点、站点、行程说明等;供出差目的地及办公起点交通候选筛选复用,空值省键。' },
459
464
  consumptionTime: { type: ['number', 'string'], description: '原始消费时间 modify_info.cstm,秒级时间戳;仅真实值存在时返回,不以开票日代替。' },
460
465
  travel_ids: invoiceTravelIdsSchema,
466
+ tollSummaryNames: tollSummaryNamesSchema,
461
467
  status: { type: 'integer' },
462
468
  valid: { type: 'integer' },
463
469
  reimRequests: arrayOf({ type: 'string' }),
464
- }, ['fid', 'number', 'total'], true);
470
+ }, ['fid', 'number', 'total', 'detailUrl'], true);
465
471
  const reimCandidatesOutputSchema = objectSchema({
466
472
  employeeInfo: employeeInfoSchema,
467
473
  preApprovals: preApprovalsSchema,
468
- total: { type: 'integer' },
469
- fetched: { type: 'integer' },
470
- hasMore: { type: 'boolean' },
474
+ total: { type: 'integer', description: '服务端返回的参考总数,可能不准确,不用于结束分页或证明结果完整。' },
475
+ fetched: { type: 'integer', description: '本次实际返回的去重候选张数,已剔除全额红冲票。' },
476
+ hasMore: { type: 'boolean', description: 'false 仅表示已按有效 end_flag 读完且无截断;显式限量或分页异常时为 true,返回 PARTIAL 并附 warning,不能视为完整候选。' },
471
477
  available: arrayOf(reimCandidateItemSchema),
472
478
  assigned: arrayOf(reimCandidateItemSchema),
473
479
  summary: objectSchema({
@@ -1087,7 +1093,7 @@ export const invoiceOperations = [
1087
1093
  consumption_tm_begin: epochDateProperty('消费日期起(含)'),
1088
1094
  consumption_tm_end: epochEndDateProperty('消费日期止(含)'),
1089
1095
  page_size: { type: 'integer', minimum: 10, maximum: 200, default: 50, description: '单页条数。' },
1090
- max_items: { type: 'integer', minimum: 1, maximum: 500, default: 200, description: '最多拉取条数,超出截断并产生 warning。' },
1096
+ max_items: { type: 'integer', minimum: 1, maximum: Number.MAX_SAFE_INTEGER, description: '仅显式传入时限制返回张数;不传则按 end_flag 自动读取全部候选,无默认条数上限。限量导致未读完或丢弃候选时返回 PARTIAL、hasMore=true 和 warning。' },
1091
1097
  includePreApprovals: includePreApprovalsProperty,
1092
1098
  },
1093
1099
  },
@@ -1,8 +1,8 @@
1
1
  import { invoiceValidationError } from '../errors.js';
2
- import { FULL_EXT_MASK, invoiceExtInfo, invoiceRecordOf } from '../invoice-record.js';
3
- import { readInvoiceEmployeeInfo } from '../read-enrichment.js';
2
+ import { FULL_EXT_MASK, invoiceExtInfo, invoiceRecordOf, invoiceTollSummaryNames } from '../invoice-record.js';
3
+ import { readInvoiceEmployeeInfo, readInvoiceTollSummaryFiles } from '../read-enrichment.js';
4
4
  import { readInvoicePreApprovals } from '../preapproval-enrichment.js';
5
- import { isRedReversedInvoice, optionalEpochSeconds, reqBase, workflow } from './shared.js';
5
+ import { invoiceDetailUrl, isRedReversedInvoice, optionalEpochSeconds, reqBase, workflow } from './shared.js';
6
6
  const MONEY_PATTERN = /^-?\d+(?:\.\d{1,2})?$/u;
7
7
  function boundedInteger(value, name, options) {
8
8
  const parsed = value === undefined ? options.defaultValue : Number(value);
@@ -53,15 +53,18 @@ function reimRequestNames(info) {
53
53
  .map((entry) => (typeof entry?.name === 'string' ? entry.name : ''))
54
54
  .filter((name) => name.trim());
55
55
  }
56
- function candidateItem(info) {
56
+ function candidateItem(info, baseUrl) {
57
57
  const pro = info?.comm_info?.pro || {};
58
58
  const price = info?.comm_info?.price || {};
59
59
  const extInfo = invoiceExtInfo(info);
60
+ const tollSummaryNames = invoiceTollSummaryNames(info);
61
+ const fid = invoiceRecordId(info);
60
62
  const consumptionTime = info?.modify_info?.cstm;
61
63
  const hasConsumptionTime = typeof consumptionTime === 'number'
62
64
  || typeof consumptionTime === 'string' && consumptionTime.trim().length > 0;
63
65
  return {
64
- fid: invoiceRecordId(info),
66
+ fid,
67
+ detailUrl: invoiceDetailUrl(baseUrl, fid),
65
68
  number: String(info.number ?? ''),
66
69
  date: String(pro.date ?? ''),
67
70
  total: String(price.total ?? ''),
@@ -72,6 +75,7 @@ function candidateItem(info) {
72
75
  extInfo,
73
76
  ...(hasConsumptionTime ? { consumptionTime } : {}),
74
77
  travel_ids: Array.isArray(info.travel_ids) ? info.travel_ids : [],
78
+ ...(tollSummaryNames === undefined ? {} : { tollSummaryNames }),
75
79
  status: typeof pro.status === 'number' ? pro.status : Number(pro.status ?? 0),
76
80
  valid: typeof pro.valid === 'number' ? pro.valid : Number(pro.valid ?? 0),
77
81
  reimRequests: reimRequestNames(info),
@@ -85,7 +89,10 @@ export class InvoiceReimCandidatesListOperation {
85
89
  throw invoiceValidationError('input_invalid', 'includePreApprovals 必须是布尔值');
86
90
  }
87
91
  const pageSize = boundedInteger(input.page_size, 'page_size', { min: 10, max: 200, defaultValue: 50 });
88
- const maxItems = boundedInteger(input.max_items, 'max_items', { min: 1, max: 500, defaultValue: 200 });
92
+ const maxItems = input.max_items === undefined ? undefined : Number(input.max_items);
93
+ if (maxItems !== undefined && (!Number.isSafeInteger(maxItems) || maxItems < 1)) {
94
+ throw invoiceValidationError('input_invalid', 'max_items 必须是正安全整数;不传时自动读取全部候选');
95
+ }
89
96
  const dateBegin = optionalEpochSeconds(input.date_begin, 'date_begin');
90
97
  const dateEnd = optionalEpochSeconds(input.date_end, 'date_end');
91
98
  const consumptionBegin = optionalEpochSeconds(input.consumption_tm_begin, 'consumption_tm_begin');
@@ -98,12 +105,12 @@ export class InvoiceReimCandidatesListOperation {
98
105
  }
99
106
  const warnings = [];
100
107
  const kept = [];
108
+ const seenIds = new Set();
101
109
  let total = 0;
102
- let hasMore = false;
110
+ let complete = false;
103
111
  let startPos = 0;
104
- let pulled = 0;
105
112
  let employee;
106
- do {
113
+ while (true) {
107
114
  const body = {
108
115
  flag: 0,
109
116
  page_size: pageSize,
@@ -136,33 +143,90 @@ export class InvoiceReimCandidatesListOperation {
136
143
  else {
137
144
  result = await host.invoiceRequest(request);
138
145
  }
139
- total = Number(result?.total ?? 0);
140
- const infos = Array.isArray(result?.infos) ? result.infos : [];
146
+ // total 只是服务端参考值,可能低估、缺失或滞后,不能用于结束分页。
147
+ const reportedTotal = Number(result?.total);
148
+ if (Number.isSafeInteger(reportedTotal) && reportedTotal >= 0)
149
+ total = reportedTotal;
150
+ const endFlag = result?.end_flag;
151
+ const hasMore = endFlag === 1 || endFlag === '1' ? true
152
+ : endFlag === 0 || endFlag === '0' ? false : null;
153
+ if (!Array.isArray(result?.infos)) {
154
+ warnings.push('发票接口未返回有效 infos 数组,候选未完整读取,不能将当前结果视为全部发票');
155
+ break;
156
+ }
157
+ const infos = result.infos;
158
+ if (infos.length === 0) {
159
+ if (startPos === 0 && hasMore === false)
160
+ complete = true;
161
+ else
162
+ warnings.push('发票分页返回空页,无法确认后续候选已完整读取,不能将当前结果视为全部发票');
163
+ break;
164
+ }
165
+ let newIds = 0;
166
+ let invalidId = false;
167
+ let omitted = false;
141
168
  for (const raw of infos) {
142
- pulled += 1;
143
169
  const info = invoiceRecordOf(raw);
170
+ const id = invoiceRecordId(info);
171
+ if (!id.trim()) {
172
+ invalidId = true;
173
+ continue;
174
+ }
175
+ if (seenIds.has(id))
176
+ continue;
177
+ seenIds.add(id);
178
+ newIds += 1;
144
179
  if (isRedReversedInvoice(info))
145
180
  continue;
181
+ if (maxItems !== undefined && kept.length >= maxItems) {
182
+ omitted = true;
183
+ continue;
184
+ }
146
185
  kept.push(info);
147
186
  }
148
- startPos += infos.length;
149
- hasMore = result?.end_flag === 1;
150
- // 空页但 end_flag 未置位时直接收手,避免接口异常导致空转。
151
- if (infos.length === 0)
187
+ if (invalidId) {
188
+ warnings.push('发票分页包含缺少业务 ID 的记录,候选未完整读取,不能将当前结果视为全部发票');
189
+ break;
190
+ }
191
+ if (newIds === 0) {
192
+ warnings.push('发票分页返回重复记录且未取得新发票,候选未完整读取,不能将当前结果视为全部发票');
193
+ break;
194
+ }
195
+ if (hasMore === null) {
196
+ warnings.push('发票接口缺少有效 end_flag,无法确认候选是否已完整读取,不能将当前结果视为全部发票');
197
+ break;
198
+ }
199
+ if (omitted || maxItems !== undefined && kept.length >= maxItems && hasMore) {
200
+ warnings.push(`已按显式 max_items=${maxItems} 截断发票候选,当前结果不完整;移除 max_items 可自动读取全部候选`);
152
201
  break;
153
- } while (kept.length < maxItems && pulled < total && hasMore);
154
- const capped = kept.slice(0, maxItems);
155
- if (kept.length > maxItems) {
156
- warnings.push(`符合条件发票共 ${kept.length} 张,已按 max_items=${maxItems} 截断,可调大 max_items 或缩小日期范围`);
202
+ }
203
+ if (!hasMore) {
204
+ complete = true;
205
+ break;
206
+ }
207
+ // 偏移按请求的页大小推进,不能按过滤红冲或去重后的数量计算。
208
+ startPos += pageSize;
157
209
  }
210
+ const [approval, tollWarnings] = await Promise.all([
211
+ readInvoicePreApprovals(host, {
212
+ operation: this.name,
213
+ invoices: kept,
214
+ includePreApprovals: input.includePreApprovals,
215
+ }),
216
+ readInvoiceTollSummaryFiles(host, kept, this.name),
217
+ ]);
218
+ warnings.push(...approval.warnings, ...tollWarnings);
158
219
  const available = [];
159
220
  const assigned = [];
160
- for (const info of capped) {
161
- const item = candidateItem(info);
162
- if (item.reimRequests.length)
163
- assigned.push(item);
164
- else
165
- available.push(item);
221
+ if (kept.length) {
222
+ const { baseUrl } = await host.getSession();
223
+ for (const info of kept) {
224
+ const item = candidateItem(info, baseUrl);
225
+ if (item.reimRequests.length)
226
+ assigned.push(item);
227
+ else
228
+ available.push(item);
229
+ }
166
230
  }
167
231
  const summarize = (items) => {
168
232
  const { amount, invalid } = sumMoney(items.map((item) => item.total));
@@ -176,25 +240,19 @@ export class InvoiceReimCandidatesListOperation {
176
240
  availableAmount: summarize(available),
177
241
  assignedAmount: summarize(assigned),
178
242
  };
179
- const approval = await readInvoicePreApprovals(host, {
180
- operation: this.name,
181
- invoices: capped,
182
- includePreApprovals: input.includePreApprovals,
183
- });
184
- warnings.push(...approval.warnings);
185
243
  return {
186
- status: 'COMPLETE',
244
+ status: complete ? 'COMPLETE' : 'PARTIAL',
187
245
  data: {
188
246
  total,
189
- fetched: capped.length,
190
- hasMore: pulled < total,
247
+ fetched: kept.length,
248
+ hasMore: !complete,
191
249
  available,
192
250
  assigned,
193
251
  summary,
194
252
  employeeInfo: employee?.info ?? null,
195
253
  preApprovals: approval.preApprovals,
196
254
  warnings,
197
- workflow: workflow(this.name, 'COMPLETE'),
255
+ workflow: workflow(this.name, complete ? 'COMPLETE' : 'PARTIAL'),
198
256
  },
199
257
  };
200
258
  }
@@ -1,5 +1,5 @@
1
1
  import { invoiceValidationError } from './errors.js';
2
- import { EXT_INFO_FIELDS, invoiceExtInfo, invoiceRecordOf, parseInvoiceExt } from './invoice-record.js';
2
+ import { EXT_INFO_FIELDS, invoiceExtInfo, invoiceRecordOf, invoiceTollSummaryNames, parseInvoiceExt } from './invoice-record.js';
3
3
  /** `--view summary` 支持的 operation:data 结构里含发票列表 items 的读取类操作。 */
4
4
  export const SUMMARY_OPERATIONS = new Set(['invoice.list', 'invoice.enterprise.list']);
5
5
  /** `--view detail` 支持的 operation:data 结构里含 `infos[]`(每条带 info 包装)的详情类操作。 */
@@ -18,6 +18,7 @@ export const SUMMARY_ITEM_FIELDS = [
18
18
  'typeName',
19
19
  'fyn',
20
20
  'travel_ids',
21
+ 'tollSummaryNames',
21
22
  'date',
22
23
  'amount',
23
24
  'total',
@@ -46,7 +47,8 @@ function numberOrUndefined(value) {
46
47
  return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
47
48
  }
48
49
  /**
49
- * 把一条原始发票对象裁成语义摘要。空值(`''` / `null` / 空数组)直接省键,
50
+ * 把一条原始发票对象裁成语义摘要。常规空值(`''` / `null` / 空数组)省键,
51
+ * fyn、travel_ids 及适用票种的 tollSummaryNames 保留空值口径。
50
52
  * 票面本身就有的 `'0'`(如税额)保留,避免制造"字段不存在"的歧义。
51
53
  */
52
54
  export function summarizeInvoiceItem(raw) {
@@ -59,6 +61,7 @@ export function summarizeInvoiceItem(raw) {
59
61
  const modify = asRecord(item.modify_info);
60
62
  const reimList = Array.isArray(asRecord(item.oreim).list_reim) ? asRecord(item.oreim).list_reim : [];
61
63
  const fid = text(item.fid ?? item.id);
64
+ const tollSummaryNames = invoiceTollSummaryNames(item);
62
65
  const summary = {
63
66
  id: fid,
64
67
  fid,
@@ -67,6 +70,7 @@ export function summarizeInvoiceItem(raw) {
67
70
  typeName: text(pro.cname),
68
71
  fyn: typeof item.fyn === 'string' ? item.fyn : null,
69
72
  travel_ids: Array.isArray(item.travel_ids) ? item.travel_ids : [],
73
+ ...(tollSummaryNames === undefined ? {} : { tollSummaryNames }),
70
74
  date: text(pro.date),
71
75
  amount: text(price.amount),
72
76
  total: text(price.total),
@@ -84,7 +88,7 @@ export function summarizeInvoiceItem(raw) {
84
88
  detailUrl: text(item.detailUrl),
85
89
  };
86
90
  for (const [key, value] of Object.entries(summary)) {
87
- if (key === 'fyn' || key === 'travel_ids')
91
+ if (key === 'fyn' || key === 'travel_ids' || key === 'tollSummaryNames')
88
92
  continue;
89
93
  if (value === '' || value === undefined || value === null)
90
94
  delete summary[key];
@@ -1,8 +1,72 @@
1
1
  import { InvoiceCliError } from './errors.js';
2
- import { invoiceRecordOf } from './invoice-record.js';
2
+ import { invoiceRecordOf, invoiceTollSummaryNames } from './invoice-record.js';
3
3
  import { readInvoicePreApprovals } from './preapproval-enrichment.js';
4
+ import { assertBusinessSuccess } from './business-response.js';
4
5
  const EXPENSE_TYPE_TIMEOUT_MS = 5_000;
5
6
  const EMPLOYEE_INFO_TIMEOUT_MS = 5_000;
7
+ const TOLL_FILES_TIMEOUT_MS = 10_000;
8
+ const TOLL_FILES_BATCH_SIZE = 100;
9
+ /** sync 的附件不能代表汇总单完整性;通行费票统一批量读详情,不改写票面、凭证或金额。 */
10
+ export async function readInvoiceTollSummaryFiles(host, invoices, operation) {
11
+ const pending = new Map();
12
+ const warnings = [];
13
+ for (const item of invoices) {
14
+ const record = invoiceRecordOf(item);
15
+ const names = invoiceTollSummaryNames(record);
16
+ if (names === undefined)
17
+ continue;
18
+ record.tollSummaryNames = [];
19
+ if (Number(record.comm_info?.pro?.status) === 8)
20
+ continue;
21
+ const rawId = record.fid ?? record.id;
22
+ const fid = typeof rawId === 'string' ? rawId
23
+ : typeof rawId === 'number' && Number.isSafeInteger(rawId) ? String(rawId) : '';
24
+ if (!/^[1-9]\d*$/u.test(fid)) {
25
+ warnings.push('通行费发票缺少有效业务 ID,票据汇总单未能核实;tollSummaryNames 返回 []。');
26
+ continue;
27
+ }
28
+ const records = pending.get(fid) ?? [];
29
+ records.push(record);
30
+ pending.set(fid, records);
31
+ }
32
+ const ids = [...pending.keys()];
33
+ for (let start = 0; start < ids.length; start += TOLL_FILES_BATCH_SIZE) {
34
+ const batch = ids.slice(start, start + TOLL_FILES_BATCH_SIZE);
35
+ const unresolved = new Set(batch);
36
+ try {
37
+ const result = await host.invoiceRequest({
38
+ path: '/api/inc/get',
39
+ method: 'POST',
40
+ operation,
41
+ timeoutMs: TOLL_FILES_TIMEOUT_MS,
42
+ body: { ids: batch, userFlag: '1', isDelFlag: '1', req_base: { trace: String(Date.now()), dev: 1 } },
43
+ });
44
+ assertBusinessSuccess(result, 'toll_summary_files_failed', '通行费票据汇总单补读失败');
45
+ for (const item of Array.isArray(result?.infos) ? result.infos : []) {
46
+ if (item?.ret?.ret !== undefined && Number(item.ret.ret) !== 0)
47
+ continue;
48
+ const detail = invoiceRecordOf(item);
49
+ const fid = String(detail.fid ?? detail.id ?? '');
50
+ if (!unresolved.has(fid) || !Array.isArray(detail.flist))
51
+ continue;
52
+ // 仅合入同一真实发票的附件,供完整输出及语义投影共用;不覆盖 travel_ids 等列表数据。
53
+ for (const record of pending.get(fid)) {
54
+ record.flist = detail.flist;
55
+ record.tollSummaryNames = invoiceTollSummaryNames({ comm_info: record.comm_info, flist: detail.flist });
56
+ }
57
+ unresolved.delete(fid);
58
+ }
59
+ }
60
+ catch (error) {
61
+ if (error && typeof error === 'object' && 'type' in error && error.type === 'authentication')
62
+ throw error;
63
+ }
64
+ if (unresolved.size) {
65
+ warnings.push(`通行费发票 ${[...unresolved].join('、')} 的票据汇总单未能核实,tollSummaryNames 返回 [];发票结果保留,此空数组不表示已确认没有汇总单。`);
66
+ }
67
+ }
68
+ return warnings;
69
+ }
6
70
  function employeeEntities(value) {
7
71
  if (value === undefined || value === null)
8
72
  return [];
@@ -91,7 +155,7 @@ async function readExpenseTypes(host, operation) {
91
155
  return { names: null, warnings: ['费用类型字典暂不可用,fyn 返回 null;发票和相关凭证仍正常返回。'] };
92
156
  }
93
157
  }
94
- /** 列表/详情主请求、费用字典和当前人员卡片并行;整批各查一次,不逐票补查。 */
158
+ /** 主请求、费用字典和人员卡片并行;列表通行费统一批量补读详情文件。 */
95
159
  export async function readInvoicesWithMetadata(host, request, options = {}) {
96
160
  if (options.includePreApprovals !== undefined && typeof options.includePreApprovals !== 'boolean') {
97
161
  throw new InvoiceCliError('validation', 'input_invalid', 'includePreApprovals 必须是布尔值');
@@ -108,16 +172,22 @@ export async function readInvoicesWithMetadata(host, request, options = {}) {
108
172
  const id = record.fylx === undefined || record.fylx === null ? '' : String(record.fylx);
109
173
  record.fyn = types.names?.get(id) ?? null;
110
174
  record.travel_ids = Array.isArray(record.travel_ids) ? record.travel_ids : [];
175
+ const tollSummaryNames = invoiceTollSummaryNames(record);
176
+ if (tollSummaryNames !== undefined)
177
+ record.tollSummaryNames = tollSummaryNames;
111
178
  if (id && types.names && record.fyn === null)
112
179
  missing.add(id);
113
180
  }
114
181
  if (missing.size) {
115
182
  types.warnings.push(`费用类型字典未匹配 ${missing.size} 个 ID:${[...missing].slice(0, 10).join('、')};对应 fyn 返回 null。`);
116
183
  }
117
- const approval = await readInvoicePreApprovals(host, {
118
- operation: request.operation,
119
- invoices: infos,
120
- includePreApprovals: options.includePreApprovals,
121
- });
122
- return { response, employeeInfo: employee.info, preApprovals: approval.preApprovals, warnings: [...types.warnings, ...employee.warnings, ...approval.warnings] };
184
+ const [approval, tollWarnings] = await Promise.all([
185
+ readInvoicePreApprovals(host, {
186
+ operation: request.operation,
187
+ invoices: infos,
188
+ includePreApprovals: options.includePreApprovals,
189
+ }),
190
+ request.path === '/api/inc/sync' ? readInvoiceTollSummaryFiles(host, infos, request.operation) : [],
191
+ ]);
192
+ return { response, employeeInfo: employee.info, preApprovals: approval.preApprovals, warnings: [...types.warnings, ...employee.warnings, ...approval.warnings, ...tollWarnings] };
123
193
  }
@@ -103,6 +103,10 @@ export function createMeetingHost(ctx, dependencies = {}) {
103
103
  userId: e10Session.userId,
104
104
  tenantKey: e10Session.tenantKey,
105
105
  eteamsId: e10Session.eteamsId,
106
+ tenantName: e10Session.tenantName,
107
+ department: e10Session.department,
108
+ subcompany: e10Session.subcompany,
109
+ position: e10Session.position,
106
110
  };
107
111
  }
108
112
  return e10Session;
@@ -1417,6 +1417,16 @@ const ebMeetingCreateFlowPrepare = {
1417
1417
  + '不传 = 未确认:即使传了 address,CLI 也会把"你指定的这间"和推荐候选一起列出来让用户点选。'
1418
1418
  + '⛔ 不要自己从 room.list / room.recommend 里挑一间塞进 address —— 那是替用户拍板',
1419
1419
  },
1420
+ preferAlternatives: {
1421
+ type: 'boolean',
1422
+ description: '时间已确认(timeConfirmed)时默认**不**扫全天找替代时段(该路要查当天全部会议、回执与日程,明显更慢)。'
1423
+ + '用户明确说"这个时间不行的话还有别的时段吗"再传 true',
1424
+ },
1425
+ includeContinuation: {
1426
+ type: 'boolean',
1427
+ description: '默认不返回 continuation 长串(约 4.8KB,模型只用 continuationId)。'
1428
+ + '只有需要把票据原样落库/转交时才传 true',
1429
+ },
1420
1430
  roomStrategy: {
1421
1431
  type: 'string',
1422
1432
  enum: ['auto', 'ask'],
@@ -1521,7 +1531,12 @@ const ebMeetingCreateFlowPrepare = {
1521
1531
  // ⛔ 但时间都没定(既没时刻、也没时段、也没日期)时**不要**弹入口:
1522
1532
  // 那个选择对用户毫无意义,而且会一路走到 room_unavailable(把"缺时间"错报成"没房间")。
1523
1533
  // 让流程继续往下,由后面的时间闸门给时段候选。
1524
- if (!entryResolved && args.skipPreflight !== true && !isTimeMissing(args)) {
1534
+ // ⛔ 只给了 `floor`("三楼的会议室")也不弹:用户已经在说"帮我在这层挑一间",
1535
+ // 再问"直发还是推荐"纯属多一轮(2026-12-01 实测:三楼层/投影场景都被弹了入口)。
1536
+ const floorOnly = String(args.address ?? '').trim() === ''
1537
+ && Number.isFinite(Number(args.floor))
1538
+ && Number(args.floor) > 0;
1539
+ if (!entryResolved && args.skipPreflight !== true && !isTimeMissing(args) && !floorOnly) {
1525
1540
  const { createEntryToken } = await import('./entry-mode.js');
1526
1541
  const tokenDirect = await createEntryToken(env, 'direct_form');
1527
1542
  const tokenAssist = await createEntryToken(env, 'assist');
@@ -1924,7 +1939,11 @@ const ebMeetingCreateFlowPrepare = {
1924
1939
  // 完全多余 —— 楼层本来就不是具体房间,直接按楼层推荐的第一名定下来,写进确认摘要说明即可。
1925
1940
  // 只有该楼层**一间可用都没有**时才继续走后面的"未解析"分支(会明确告知)。
1926
1941
  let floorAutoPick = null;
1927
- if (floorHint !== null && String(addressInput ?? '').trim() !== '') {
1942
+ // ⛔ 只认 address 非空(楼层从 address 文本推断)。结构化 `floor` 由下面的 floorGiven 单独处理:
1943
+ // 用户说"三楼的会议室"= 已经表达了"要你帮我挑",不该再问"直发还是推荐"。
1944
+ const floorGiven = Number.isFinite(Number(args.floor))
1945
+ && Number(args.floor) > 0;
1946
+ if (floorHint !== null && (String(addressInput ?? '').trim() !== '' || floorGiven)) {
1928
1947
  const floorRec = await roomTask.catch(() => null);
1929
1948
  const first = floorRec?.candidates?.[0] ?? floorRec?.best ?? null;
1930
1949
  if (first?.id) {
@@ -2012,12 +2031,16 @@ const ebMeetingCreateFlowPrepare = {
2012
2031
  return getMeetingOperation('meeting.eb.conflict.member').handler({ beginDatetime: beginText, endDatetime: endText, hrmMembers: memberIds.join(',') }, env);
2013
2032
  })().catch(noteFailure('参会人**会议占用**检测'))
2014
2033
  : Promise.resolve(null);
2034
+ // ⛔ 时间已经定了就别再扫全天找"替代时段":那一路要查当天全部会议 + 回执 + 日程,实测 7.3s。
2035
+ // 判断要用**展开后的** timeConfirmed(dateFrom+time_slot 也会置 true),不能用原始 args.timeConfirmed,
2036
+ // 否则「晚上」这种写法仍会白扫一遍(2026-12-01 实测踩到)。
2037
+ const wantAlternatives = timeConfirmed !== true || args.preferAlternatives === true;
2015
2038
  const availabilityTask = cachedChecks
2016
2039
  ? Promise.resolve({
2017
2040
  slots: cachedChecks.freeSlots,
2018
2041
  ...(cachedChecks.blockingSummary ? { blockingSummary: cachedChecks.blockingSummary } : {}),
2019
2042
  })
2020
- : (enrich && beginText && endText && memberIds.length > 0)
2043
+ : (wantAlternatives && enrich && beginText && endText && memberIds.length > 0)
2021
2044
  ? findCommonFreeSlots(env, {
2022
2045
  rangeStart: `${day} 00:00`,
2023
2046
  rangeEnd: `${day} 23:59`,
@@ -2036,8 +2059,22 @@ const ebMeetingCreateFlowPrepare = {
2036
2059
  const formPreloadTask = resolvedEarly?.workflowId
2037
2060
  ? loadCreateForm(env, resolvedEarly.workflowId).catch(() => null)
2038
2061
  : Promise.resolve(null);
2062
+ // 每路单独计时:只看一个 parallelMs 说不清"慢在哪一路",用户只能看到"17 秒"(2026-12-01)。
2063
+ const timed = async (label, task) => {
2064
+ const begin = Date.now();
2065
+ try {
2066
+ return await task;
2067
+ }
2068
+ finally {
2069
+ mark(label, begin);
2070
+ }
2071
+ };
2039
2072
  const [roomRec, memberConflict, free, roomConflict, preloadedForm] = await Promise.all([
2040
- roomTask, conflictTask, availabilityTask, roomConflictTask, formPreloadTask,
2073
+ timed('roomRecommendMs', roomTask),
2074
+ timed('memberConflictMs', conflictTask),
2075
+ timed('freeSlotsMs', availabilityTask),
2076
+ timed('roomOccupancyMs', roomConflictTask),
2077
+ timed('formPreloadMs', formPreloadTask),
2041
2078
  ]);
2042
2079
  mark('enrichMs', enrichStarted);
2043
2080
  timings.parallelMs = Date.now() - startedAt;
@@ -2972,7 +3009,10 @@ const ebMeetingCreateFlowPrepare = {
2972
3009
  ...(invitationDocInfo ? { invitationDoc: invitationDocInfo } : {}),
2973
3010
  ...(Object.keys(decisions).length > 0 ? { decisions } : {}),
2974
3011
  },
2975
- continuation,
3012
+ // 长串 ~4.8KB,占这份返回的近两成;模型只用 continuationId(文档也禁止手抄长串),
3013
+ // 每次多传 4.8KB 就是白付序列化+回传的钱(2026-12-01 实测输出 25KB → 20KB)。
3014
+ // 少数要原串的调用方(自定义落库/调试)传 includeContinuation: true。
3015
+ ...(args.includeContinuation === true ? { continuation } : {}),
2976
3016
  continuationId: await saveContinuationAlias(continuation, CONTINUATION_TTL_MS).catch(() => null),
2977
3017
  // 长 token 有 4KB,模型转述时会被截断/改写(实测出现过 fingerprint 被改成 "x" 导致验签失败)。
2978
3018
  // 这里把"该用哪个"写成一句话,避免模型自己挑。
@@ -197,7 +197,21 @@ const meetingEnvDetect = {
197
197
  handler: async (args, { host, ctx }) => {
198
198
  const result = await resolveMeetingEnvMode(host, ctx, { refresh: args.refresh === true });
199
199
  const { warning, ...data } = result;
200
- return meetingSuccess('meeting.env.detect', data, warning ? { warnings: [warning] } : undefined);
200
+ // 登录态(E10AuthData)里本来就有"我是谁、在哪个部门/分部/岗位",以前没往上带,
201
+ // 模型于是分不清「本部门 / 本分部 / 本公司 / 分部下的直属部门」各指哪一层,
202
+ // 只能把"本部门"原样丢给 member.expand → 模糊搜"本" → 返回一堆无关部门(2026-12-01 实测)。
203
+ // 这里只做**透传**,不做任何关键词解析:词义由模型按组织树自己推。
204
+ const session = await host.getSession();
205
+ return meetingSuccess('meeting.env.detect', {
206
+ ...data,
207
+ identity: {
208
+ userId: session?.userId ?? '',
209
+ department: session?.department ?? '',
210
+ subcompany: session?.subcompany ?? '',
211
+ position: session?.position ?? '',
212
+ tenantName: session?.tenantName ?? '',
213
+ },
214
+ }, warning ? { warnings: [warning] } : undefined);
201
215
  },
202
216
  };
203
217
  // ---------------------------------------------------------------------------
@@ -105,6 +105,13 @@ const meetingRoomUsage = {
105
105
  },
106
106
  },
107
107
  handler: async (args, { host }) => {
108
+ // ⛔ 空参会一路打到上游 `/getRoomUsageData`,服务端只回一句「系统内部错误」(code 500),
109
+ // 调用方完全看不出是"漏了 bywhat"——2026-12-01 授权后复测把它记成「上游 HTTP/系统错误」。
110
+ // bywhat 决定按月/周/日查,缺了服务端根本不知道查什么,这里先拦。
111
+ // 提示只写"要做什么":服务端为什么返 500 属于实现细节,不进给调用方的 message。
112
+ if (args.bywhat === undefined || args.bywhat === null) {
113
+ throw meetingValidationError('bywhat_required', 'bywhat 必填:2=按月、3=按周、4=按日', { allowed: [2, 3, 4] });
114
+ }
108
115
  const query = {};
109
116
  if (args.roomid !== undefined)
110
117
  query.roomid = toIdString(args.roomid, 'roomid');