weaver-work-cli 0.1.75 → 0.1.78

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 (268) hide show
  1. package/README.md +3 -1
  2. package/dist/chunks/{archive-OZJ6PYUR.js → archive-ENBSUMHV.js} +1 -1
  3. package/dist/chunks/{archive-oa-BHL5RK2F.js → archive-oa-7BFPQ6M5.js} +1 -1
  4. package/dist/chunks/{asset-HKRFRQR2.js → asset-V5SUD3PW.js} +1 -1
  5. package/dist/chunks/{asset-idle-GGIR4KE7.js → asset-idle-3CEL7WFX.js} +1 -1
  6. package/dist/chunks/{attachment-content-4OV65NK5.js → attachment-content-TFOC3Y3X.js} +3 -3
  7. package/dist/chunks/{blog-HYDP4DV3.js → blog-FLI4SS3P.js} +1 -1
  8. package/dist/chunks/{caizhilian-JS4RQZ6Z.js → caizhilian-7WCTKCCP.js} +3 -3
  9. package/dist/chunks/{calendar-SWRY4DIT.js → calendar-G726HUUH.js} +1 -1
  10. package/dist/chunks/{chunk-5ZJGPEIB.js → chunk-2KW7AI6P.js} +1 -1
  11. package/dist/chunks/{chunk-JOY3HZXL.js → chunk-2UV4IZIT.js} +21 -15
  12. package/dist/chunks/{chunk-FEZK536Z.js → chunk-4PBN7NJY.js} +353 -43
  13. package/dist/chunks/{chunk-VOMDD2C5.js → chunk-5E2FDXBU.js} +1 -1
  14. package/dist/chunks/{chunk-ZUB4M4N3.js → chunk-5VQ7JHV4.js} +134 -49
  15. package/dist/chunks/{chunk-I6NOHKEK.js → chunk-7SQN5IZR.js} +1 -1
  16. package/dist/chunks/{chunk-4FCBEWNB.js → chunk-BP7BONZO.js} +675 -86
  17. package/dist/chunks/{chunk-U6Y32KEV.js → chunk-BWFCTE43.js} +1 -1
  18. package/dist/chunks/{chunk-PG5YSNYY.js → chunk-DACQKJ6O.js} +3 -3
  19. package/dist/chunks/{chunk-KWJEICD4.js → chunk-E2EY3DMS.js} +2 -2
  20. package/dist/chunks/{chunk-KEA4XQPO.js → chunk-FAC4IFGQ.js} +4 -4
  21. package/dist/chunks/{chunk-MXCRKXOP.js → chunk-FPWCCRKT.js} +1 -1
  22. package/dist/chunks/{minute-doc-OQUMDTKG.js → chunk-IBTGXLOT.js} +101 -18
  23. package/dist/chunks/{chunk-OJ4JPD25.js → chunk-LQLIXBJF.js} +6 -8
  24. package/dist/chunks/{chunk-BNKUHN4N.js → chunk-OVTCWLNQ.js} +2 -2
  25. package/dist/chunks/{chunk-5D2V7ZAN.js → chunk-PMRNIGKZ.js} +1 -1
  26. package/dist/chunks/{chunk-OQCK5SAU.js → chunk-RVEKGVZU.js} +1 -1
  27. package/dist/chunks/{chunk-2AUFKU2D.js → chunk-SWFTWNWL.js} +11 -11
  28. package/dist/chunks/{chunk-TA2RBUTH.js → chunk-TBCKK6LH.js} +1 -1
  29. package/dist/chunks/{chunk-SU6IJD6D.js → chunk-TD5IOEGN.js} +1 -1
  30. package/dist/chunks/{chunk-J7FAAHWH.js → chunk-UDBQJLQF.js} +1 -1
  31. package/dist/chunks/{chunk-BSR5TM7U.js → chunk-USYFVIUR.js} +22 -7
  32. package/dist/chunks/{chunk-ERZY6GYL.js → chunk-UZ2E3VNI.js} +1 -1
  33. package/dist/chunks/{chunk-NWYHCZTY.js → chunk-VNEU7OUN.js} +1 -1
  34. package/dist/chunks/{chunk-5QUTQHXF.js → chunk-WNFDR5PC.js} +198 -80
  35. package/dist/chunks/{chunk-LJI4N6FV.js → chunk-XNN5PZTI.js} +1 -1
  36. package/dist/chunks/{chunk-QJWVYOOV.js → chunk-Z44YFIN6.js} +2 -2
  37. package/dist/chunks/{chunk-ZWIMLT6P.js → chunk-ZOTXXGUM.js} +7 -7
  38. package/dist/chunks/{cli-FULPXIKJ.js → cli-WA7FOQKC.js} +35 -35
  39. package/dist/chunks/{commands-BNWFNTD3.js → commands-J52MJ6NF.js} +3 -3
  40. package/dist/chunks/{conflict-5BKCDV2F.js → conflict-D4GVAURN.js} +2 -2
  41. package/dist/chunks/{contract-WI23OXVC.js → contract-GW7US3UF.js} +4400 -3548
  42. package/dist/chunks/{cowork-DZBBVNMQ.js → cowork-GZDODGKF.js} +1 -1
  43. package/dist/chunks/{create-flow-7ZRBRKX7.js → create-flow-ERDGW3FZ.js} +10 -6
  44. package/dist/chunks/{data-PAZVE6QE.js → data-HTQZRPPI.js} +1 -1
  45. package/dist/chunks/{ebuilder-form-5SQXIGXN.js → ebuilder-form-GHNIZ7ET.js} +2 -2
  46. package/dist/chunks/{ehr-CX5F4ZAU.js → ehr-P6T7OAAV.js} +2 -2
  47. package/dist/chunks/{entry-mode-I2BYNONZ.js → entry-mode-SQU5WTX6.js} +3 -3
  48. package/dist/chunks/{env-ZAQZ7EHN.js → env-DASBNSEM.js} +2 -2
  49. package/dist/chunks/{esb-DQTXDIBF.js → esb-ATRKVHCD.js} +3 -3
  50. package/dist/chunks/{factory-XRI6KZ7H.js → factory-A3NAKZAA.js} +1 -1
  51. package/dist/chunks/{fna-FK6HQVJL.js → fna-IKYI3SST.js} +1 -1
  52. package/dist/chunks/{group-chat-MLWNYM2P.js → group-chat-7SEAVAJR.js} +3 -3
  53. package/dist/chunks/{host-MEC4VQZA.js → host-6UOXYOOY.js} +2 -2
  54. package/dist/chunks/{host-KUMU3DDK.js → host-EJSJSLVK.js} +2 -2
  55. package/dist/chunks/{host-3EPREGXS.js → host-EYNLB6S4.js} +2 -2
  56. package/dist/chunks/{host-T6NNQGVZ.js → host-OT4KNR3G.js} +2 -2
  57. package/dist/chunks/{host-VI7Q45PM.js → host-UY4LQPN4.js} +2 -2
  58. package/dist/chunks/{host-J74JGYAW.js → host-XXGDQM7D.js} +2 -2
  59. package/dist/chunks/{hrm-KKVAW4P5.js → hrm-5JQ7QZ6A.js} +2 -2
  60. package/dist/chunks/{im-47CIWQNL.js → im-2YJW3EI5.js} +2 -2
  61. package/dist/chunks/{invoice-CDYRBNIG.js → invoice-37HR6L3W.js} +937 -552
  62. package/dist/chunks/{jiuchuanhui-M7QTRHZK.js → jiuchuanhui-KBWUZ7WT.js} +1 -1
  63. package/dist/chunks/{lazy-dispatch-FKQJZFI5.js → lazy-dispatch-ZDKLS5MR.js} +6 -6
  64. package/dist/chunks/{mail-NRBS5N6Y.js → mail-YBKUM6HM.js} +1 -1
  65. package/dist/chunks/{meeting-WC5LD3IO.js → meeting-7AEQGBAT.js} +19 -13
  66. package/dist/chunks/minute-doc-REI6RUE4.js +20 -0
  67. package/dist/chunks/{okr-EHKSKMPL.js → okr-HW7IULIR.js} +1 -1
  68. package/dist/chunks/{operations-V5VM5MS2.js → operations-4P2UYVLH.js} +3 -3
  69. package/dist/chunks/{performance-ZJADXJPN.js → performance-PM2G6L3E.js} +1 -1
  70. package/dist/chunks/{plan-OTDNBDJ7.js → plan-3YYGZ7ZM.js} +1 -1
  71. package/dist/chunks/{project-4XVBQ3HX.js → project-6PRGBLO2.js} +39 -15
  72. package/dist/chunks/{reception-3FAHOOH7.js → reception-7G3J2MA6.js} +1 -1
  73. package/dist/chunks/{recruit-stage-3WTVWW2K.js → recruit-stage-TLZJUFHD.js} +544 -464
  74. package/dist/chunks/{registry-TJGCVRCW.js → registry-3VTB3KLV.js} +3 -3
  75. package/dist/chunks/{registry-F4YFZLOD.js → registry-KQ4TNUWO.js} +1 -1
  76. package/dist/chunks/{registry-NBTBXR4L.js → registry-UVTI323K.js} +12 -11
  77. package/dist/chunks/{room-recommend-KL62XB2Y.js → room-recommend-ELEJUYBN.js} +4 -4
  78. package/dist/chunks/{schedule-XOISYUPB.js → schedule-XBKY7VEA.js} +4 -4
  79. package/dist/chunks/{smart-extract-UYGNV3BM.js → smart-extract-T5Z4AULN.js} +1 -1
  80. package/dist/chunks/{update-AV5VOXGY.js → update-77ZUIYSG.js} +2 -2
  81. package/dist/chunks/{workflow-V54LJPXL.js → workflow-SYCBS5XD.js} +3 -3
  82. package/dist/index.js +3 -3
  83. package/dist/internal/update/service.js +9 -8
  84. package/dist/shortcuts/contract/data/collection-ledger-html.js +109 -33
  85. package/dist/shortcuts/contract/data/collection-node-catalog.js +26 -2
  86. package/dist/shortcuts/contract/data/report-renderers.js +75 -31
  87. package/dist/shortcuts/contract/data/report-spec.js +17 -3
  88. package/dist/shortcuts/contract/manifest.js +20 -3
  89. package/dist/shortcuts/contract/operations/bizreview-report.js +23 -2
  90. package/dist/shortcuts/contract/operations/collection-node.js +116 -1
  91. package/dist/shortcuts/contract/operations/compare-report.js +27 -5
  92. package/dist/shortcuts/contract/operations/credit-page.js +11 -2
  93. package/dist/shortcuts/contract/operations/docx-slots.js +27 -2
  94. package/dist/shortcuts/contract/operations/draft-submit.js +9 -6
  95. package/dist/shortcuts/contract/operations/elements-build.js +162 -30
  96. package/dist/shortcuts/contract/operations/elements-spec.js +50 -0
  97. package/dist/shortcuts/contract/operations/generated-submit.js +35 -0
  98. package/dist/shortcuts/contract/operations/ledger-card.js +32 -2
  99. package/dist/shortcuts/contract/operations/ledger-stat.js +17 -5
  100. package/dist/shortcuts/contract/operations/ledger.js +88 -16
  101. package/dist/shortcuts/contract/operations/metrics.js +16 -3
  102. package/dist/shortcuts/contract/operations/ops-draft.js +359 -27
  103. package/dist/shortcuts/contract/operations/page.js +23 -0
  104. package/dist/shortcuts/contract/operations/quote-recognize.js +91 -13
  105. package/dist/shortcuts/contract/operations/quote-submit.js +16 -0
  106. package/dist/shortcuts/contract/operations/review-report.js +11 -3
  107. package/dist/shortcuts/contract/operations/save-recognize.js +62 -1
  108. package/dist/shortcuts/contract/operations/triage.js +18 -3
  109. package/dist/shortcuts/contract/operations/viewlink.js +17 -1
  110. package/dist/shortcuts/ehr/operations/recruit.js +255 -90
  111. package/dist/shortcuts/invoice/business-response.js +13 -0
  112. package/dist/shortcuts/invoice/calendar.js +24 -0
  113. package/dist/shortcuts/invoice/host.js +26 -15
  114. package/dist/shortcuts/invoice/index.js +2 -2
  115. package/dist/shortcuts/invoice/invoice-record.js +7 -2
  116. package/dist/shortcuts/invoice/manifest.js +179 -155
  117. package/dist/shortcuts/invoice/operations/get.js +9 -3
  118. package/dist/shortcuts/invoice/operations/issuing-red-requests.js +138 -0
  119. package/dist/shortcuts/invoice/operations/registry.js +4 -5
  120. package/dist/shortcuts/invoice/operations/reim-auto.js +40 -2
  121. package/dist/shortcuts/invoice/operations/reim-customer-projects.js +79 -0
  122. package/dist/shortcuts/invoice/operations/reim-customer.js +79 -30
  123. package/dist/shortcuts/invoice/operations/reim-relation.js +0 -146
  124. package/dist/shortcuts/invoice/operations/reim.js +2 -126
  125. package/dist/shortcuts/invoice/operations/shared.js +15 -17
  126. package/dist/shortcuts/invoice/preapproval-enrichment.js +180 -0
  127. package/dist/shortcuts/invoice/projection.js +14 -0
  128. package/dist/shortcuts/invoice/read-enrichment.js +123 -0
  129. package/dist/shortcuts/meeting/confirm-gate.js +42 -0
  130. package/dist/shortcuts/meeting/continuation.js +6 -2
  131. package/dist/shortcuts/meeting/minute-doc.js +119 -12
  132. package/dist/shortcuts/meeting/operations/attachment.js +19 -0
  133. package/dist/shortcuts/meeting/operations/compose-outcome.js +24 -2
  134. package/dist/shortcuts/meeting/operations/eb/conflict.js +2 -1
  135. package/dist/shortcuts/meeting/operations/eb/create-flow.js +162 -19
  136. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +22 -3
  137. package/dist/shortcuts/meeting/operations/group-share.js +268 -0
  138. package/dist/shortcuts/meeting/operations/minute-content.js +58 -1
  139. package/dist/shortcuts/meeting/operations/minute-export.js +295 -0
  140. package/dist/shortcuts/meeting/operations/registry.js +4 -0
  141. package/dist/shortcuts/project/operations/read.js +40 -15
  142. package/dist/shortcuts/recruit-stage/context.js +16 -81
  143. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +89 -53
  144. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +15 -5
  145. package/dist/shortcuts/recruit-stage/operations/jd-create.js +46 -108
  146. package/dist/shortcuts/recruit-stage/operations/list.js +203 -74
  147. package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -85
  148. package/dist/shortcuts/recruit-stage/operations/search.js +113 -53
  149. package/dist/shortcuts/recruit-stage/shared.js +153 -4
  150. package/dist/shortcuts/workflow/endpoints.js +2 -0
  151. package/dist/shortcuts/workflow/operations/form.js +11 -0
  152. package/dist/shortcuts/workflow/operations/read.js +24 -5
  153. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +2 -2
  154. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +2 -0
  155. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +28 -4
  156. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.node.js +198 -0
  157. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +4 -2
  158. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.subordinate.js +70 -0
  159. package/dist/shortcuts/workflow/operations/todoSmartConvert/workflowClarification.js +15 -5
  160. package/docs/agent-invoice.md +28 -2
  161. package/docs/invoice.md +60 -9
  162. package/docs/project.md +1 -1
  163. package/package.json +1 -1
  164. package/skill-template/domains/yepiaotong.md +36 -7
  165. package/skills/weaver-e10-jinchengda/SKILL.md +64 -28
  166. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +4 -4
  167. package/skills/weaver-e10-jinchengda/references/contract-bizreview-report-template.html +1 -1
  168. package/skills/weaver-e10-jinchengda/references/contract-bizreview.md +5 -4
  169. package/skills/weaver-e10-jinchengda/references/contract-collection-node.md +26 -2
  170. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
  171. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +9 -8
  172. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +47 -52
  173. package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
  174. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +5 -5
  175. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +1 -1
  176. package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +7 -1
  177. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +21 -12
  178. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +44 -1
  179. package/skills/weaver-e10-jinchengda/references/contract-firstscreen-guide.md +5 -4
  180. package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +8 -0
  181. package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +33 -3
  182. package/skills/weaver-e10-jinchengda/references/contract-ledger-report.md +1 -1
  183. package/skills/weaver-e10-jinchengda/references/contract-material-gap.md +17 -3
  184. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +12 -12
  185. package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +18 -10
  186. package/skills/weaver-e10-jinchengda/references/contract-ops-draft.md +77 -37
  187. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +7 -0
  188. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +55 -12
  189. package/skills/weaver-e10-jinchengda/references/contract-review-todo.md +102 -0
  190. package/skills/weaver-e10-jinchengda/references/contract-sign-launch.md +1 -17
  191. package/skills/weaver-e10-jinchengda/references/contract-smart-draft.md +11 -8
  192. package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +2 -1
  193. package/skills/weaver-e10-jinchengda/references/orchestration.md +6 -6
  194. package/skills/weaver-e10-meeting/SKILL.md +203 -80
  195. package/skills/weaver-e10-meeting/references/create-quickstart.md +98 -0
  196. package/skills/weaver-e10-meeting/references/delivery-checklist.md +34 -0
  197. package/skills/weaver-e10-meeting/references/error-codes.md +44 -0
  198. package/skills/weaver-e10-meeting/references/minutes-pipeline.md +56 -3
  199. package/skills/weaver-e10-meeting/references/room-recommend.md +2 -0
  200. package/skills/weaver-e10-recruit-stage/SKILL.md +158 -146
  201. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +64 -51
  202. package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +56 -18
  203. package/skills/weaver-e10-recruit-stage/lib/recruit-attach-probe.mjs +127 -0
  204. package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +217 -30
  205. package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +39 -7
  206. package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +2 -2
  207. package/skills/weaver-e10-recruit-stage/references/position-templates.md +10 -10
  208. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +18 -18
  209. package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +29 -31
  210. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +2 -2
  211. package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +4 -2
  212. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +19 -20
  213. package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +4 -4
  214. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +3 -3
  215. package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +10 -0
  216. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +4 -3
  217. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +21 -25
  218. package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +1 -1
  219. package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +19 -7
  220. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +31 -58
  221. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +3 -1
  222. package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +2 -2
  223. package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +2 -2
  224. package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +1 -1
  225. package/skills/weaver-e10-recruit-stage/templates/match-report.html +25 -15
  226. package/skills/weaver-e10-shijingran/SKILL.md +2 -2
  227. package/skills/weaver-e10-shijingran/references/operations.md +5 -2
  228. package/skills/weaver-e10-shijingran/references/source-manifest.json +41 -40
  229. package/skills/weaver-e10-workflow/SKILL.md +13 -9
  230. package/skills/weaver-e10-workflow/references/todo-dialogue.md +33 -8
  231. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +19 -14
  232. package/skills/weaver-e10-workflow/references/workflow-create.md +1 -1
  233. package/skills/weaver-e10-workflow/references/workflow-query.md +4 -2
  234. package/skills/weaver-e10-workflow/references/workflow-view.md +3 -3
  235. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +132 -42
  236. package/skills/weaver-e10-yepiaotong/SKILL.md +133 -61
  237. package/skills/weaver-e10-yepiaotong/references/invoice-add.md +3 -1
  238. package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +18 -2
  239. package/skills/weaver-e10-yepiaotong/references/invoice-disabled-capabilities.md +3 -3
  240. package/skills/weaver-e10-yepiaotong/references/invoice-download.md +1 -1
  241. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +13 -1
  242. package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +3 -1
  243. package/skills/weaver-e10-yepiaotong/references/invoice-import.md +6 -4
  244. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +42 -45
  245. package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +1 -1
  246. package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +18 -2
  247. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +14 -1
  248. package/skills/weaver-e10-yepiaotong/references/invoice-red-workflow.md +96 -0
  249. package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +56 -369
  250. package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +16 -6
  251. package/skills/weaver-e10-yepiaotong/references/name-fuzzy-search.md +38 -0
  252. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +163 -646
  253. package/skills/weaver-e10-yepiaotong/references/reim-customer-search.md +90 -44
  254. package/skills/weaver-e10-yepiaotong/references/reim-eligibility-rules.md +85 -0
  255. package/skills/weaver-e10-yepiaotong/references/reim-fill-validation.md +61 -0
  256. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +91 -280
  257. package/skills/weaver-e10-yepiaotong/references/reim-preapproval-rules.md +98 -0
  258. package/skills/weaver-e10-yepiaotong/references/reim-travel-invoice-matching.md +48 -0
  259. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +234 -695
  260. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +395 -204
  261. package/skills/weaver-e10-yepiaotong/references/travel-application-fill.md +84 -0
  262. package/skills/weaver-e10-yepiaotong/references/workflow-direct-fill.md +165 -0
  263. package/templates/meeting/minute.docx +0 -0
  264. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +0 -93
  265. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +0 -774
  266. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +0 -111
  267. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +0 -360
  268. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +0 -167
@@ -1,7 +1,8 @@
1
- import { randomBytes, randomUUID } from 'node:crypto';
2
- import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
1
+ import { createHash, randomBytes, randomUUID } from 'node:crypto';
2
+ import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
3
3
  import { homedir } from 'node:os';
4
- import { join, resolve } from 'node:path';
4
+ import { dirname, join, relative, resolve } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
5
6
  import { ehrValidationError } from '../errors.js';
6
7
  import { READ, SCHEMA_ID, ehrSuccess, schemaOf, } from './types.js';
7
8
  import { compact, menuShapeOf, normalizePaged, toMenuList, toNumber, toPageQuery, toPositiveInt } from './shared.js';
@@ -33,20 +34,33 @@ export function isSelfTenant(tenantKey) {
33
34
  }
34
35
  /**
35
36
  * 缓存结构版本:结构或健康判据变化时 +1,旧缓存自动失效重建(用户无需手工删文件)。
37
+ * v12 变更:增加代码哈希与易变菜单/列表短 TTL;直读业务表取数上限收口到 1000 行。
38
+ * v11 变更:去菜单闸门收口(列表/搜索/反馈/AI方案失败均直读表)+ feedbackTodo 直读本地筛选 +
39
+ * candidate.search 过滤后 total 语义修正;v10 及更早缓存一律重建,避免旧 listId/旧菜单继续命中。
40
+ * v10 变更:缓存增加 ownerUserId,按登录用户隔离;v9 缓存可能由另一账号播种,
41
+ * 其 menus/targets/defaultRecruitFlow/digitalHumanMenu 不能跨账号复用。
42
+ * v9 变更:招聘读取改为按表单 objId 直读(dataset/v2/getAllData),菜单/list 只作快路径。
43
+ * v8 及更早缓存可能由有菜单权限的账号播种,含 lists/targets;新代码若沿用旧菜单会绕过
44
+ * 当前账号的数据权限/菜单可见性,造成「技能更新后仍走旧入口」,必须作废重建。
36
45
  * v8 变更:字典/业务配置改 B 通道按 objId 直读(与菜单解耦);分页以「本页 0 行」判末页;
37
46
  * options/biz_config 降为 warn;memo 补 TTL 与健康校验。
38
- * v7 及更早的缓存可能含「字典残缺但 degraded 为空」的产物,必须作废。
39
47
  */
40
- export const RECRUIT_CACHE_VERSION = 8;
48
+ export const RECRUIT_CACHE_VERSION = 12;
41
49
  /**
42
50
  * 主缓存、快照、进程内 memo 统一 TTL(默认 12h),过期 → 快照双探针 → 全量重建,
43
51
  * 使菜单改名/字段调整/字典更新最多 12h 自愈。`E10_RS_RECRUIT_CACHE_TTL_MS` 仅供排障覆盖。
44
52
  */
45
53
  const RECRUIT_CACHE_TTL_DEFAULT_MS = 12 * 60 * 60 * 1000;
54
+ /** 菜单/列表入口随账号权限变化,易变部分单独短 TTL;稳定 schema/字典仍走主缓存 TTL。 */
55
+ const RECRUIT_VOLATILE_TTL_DEFAULT_MS = 5 * 60 * 1000;
46
56
  function recruitCacheTtlMs() {
47
57
  const raw = Number(process.env.E10_RS_RECRUIT_CACHE_TTL_MS || '');
48
58
  return Number.isFinite(raw) && raw > 0 ? raw : RECRUIT_CACHE_TTL_DEFAULT_MS;
49
59
  }
60
+ function recruitVolatileTtlMs() {
61
+ const raw = Number(process.env.E10_RS_RECRUIT_VOLATILE_TTL_MS || '');
62
+ return Number.isFinite(raw) && raw > 0 ? raw : RECRUIT_VOLATILE_TTL_DEFAULT_MS;
63
+ }
50
64
  /** 关键表单:字段列表为空即判上下文不可用(抛错且不落盘),避免坏缓存固化后所有操作中断。 */
51
65
  const RECRUIT_CRITICAL_FORMS = new Set(['position_manage', 'talent_pool', 'interview_plan']);
52
66
  /** 关键表单中文名(报错用;表单自身 objName 在解析失败时取不到,不能依赖) */
@@ -79,6 +93,15 @@ function hasCriticalFields(cache) {
79
93
  return false;
80
94
  return true;
81
95
  }
96
+ /** 旧缓存未写 codeHash 时允许命中一次;新代码写入后哈希不一致即重建。 */
97
+ function codeHashOk(cache) {
98
+ return !cache?.codeHash || cache.codeHash === recruitCodeHash();
99
+ }
100
+ /** 易变菜单/列表入口是否仍在短 TTL 内;缺失时按主缓存 savedAt 判断,避免旧缓存永久保留旧入口。 */
101
+ function volatileFresh(cache) {
102
+ const at = Number(cache?.volatileSavedAt || cache?.savedAt || 0);
103
+ return at > 0 && Date.now() - at <= recruitVolatileTtlMs();
104
+ }
82
105
  /** 逻辑名 -> objTag(权威映射,与 _init_env_cache.mjs 一致) */
83
106
  const RECRUIT_TAGS = {
84
107
  talent_pool: 'uf_rcrt_talent_pool',
@@ -142,6 +165,44 @@ function cacheDirFor(baseUrl) {
142
165
  const home = process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), '.weaver-work-cli');
143
166
  return join(home, 'env-cache', 'recruit-ops', host);
144
167
  }
168
+ let recruitCodeHashMemo = '';
169
+ function collectRecruitCodeFiles(root, rel, out) {
170
+ const abs = join(root, rel);
171
+ if (!existsSync(abs))
172
+ return;
173
+ const st = statSync(abs);
174
+ if (st.isDirectory()) {
175
+ for (const entry of readdirSync(abs).sort())
176
+ collectRecruitCodeFiles(root, join(rel, entry), out);
177
+ return;
178
+ }
179
+ if (/\.(ts|js|mjs)$/.test(abs))
180
+ out.push(abs);
181
+ }
182
+ /**
183
+ * 招聘上下文相关代码哈希。技能/CLI 契约代码变化后,旧缓存即使版本号未改也会自动失效;
184
+ * 读取不到源码/产物时退化为结构版本常量,不阻断业务。
185
+ */
186
+ function recruitCodeHash() {
187
+ if (recruitCodeHashMemo)
188
+ return recruitCodeHashMemo;
189
+ const here = fileURLToPath(import.meta.url);
190
+ const shortcutsDir = dirname(dirname(dirname(here)));
191
+ const files = [];
192
+ collectRecruitCodeFiles(shortcutsDir, 'recruit-stage', files);
193
+ collectRecruitCodeFiles(shortcutsDir, join('ehr', 'operations', 'recruit'), files);
194
+ collectRecruitCodeFiles(shortcutsDir, join('ehr', 'operations', 'shared'), files);
195
+ const h = createHash('sha256');
196
+ h.update('recruit-context-v12\n');
197
+ // 只哈希相对路径 + 内容:绝对路径随安装位置变化,会让同一份代码在不同安装间算出不同哈希,
198
+ // 共用 ~/.weaver-work-cli/env-cache 时互相判失效、每次交替全量重建。
199
+ for (const file of files.sort()) {
200
+ const rel = relative(shortcutsDir, file).replace(/\\/g, '/');
201
+ h.update(`${rel}\0${readFileSync(file, 'utf8')}\0`);
202
+ }
203
+ recruitCodeHashMemo = h.digest('hex').slice(0, 24);
204
+ return recruitCodeHashMemo;
205
+ }
145
206
  function snapshotPathFor(baseUrl) {
146
207
  const url = new URL(baseUrl);
147
208
  const host = url.hostname + (url.port ? `_${url.port}` : '');
@@ -154,9 +215,10 @@ function readContextSnapshot(baseUrl) {
154
215
  const raw = JSON.parse(readFileSync(snapshotPathFor(baseUrl), 'utf8'));
155
216
  if (!raw?.at || raw.cacheVersion !== RECRUIT_CACHE_VERSION)
156
217
  return null;
218
+ // 不再按 owner 直接拒绝:跨账号可复用稳定 schema,菜单字段由调用方丢弃。
157
219
  if (Date.now() - raw.at > recruitCacheTtlMs())
158
220
  return null;
159
- if (!raw.resolved || !hasCriticalFields({ ...raw.resolved, appId: raw.appId }))
221
+ if (!raw.resolved || !codeHashOk(raw.resolved) || !hasCriticalFields({ ...raw.resolved, appId: raw.appId }))
160
222
  return null;
161
223
  return raw;
162
224
  }
@@ -164,7 +226,7 @@ function readContextSnapshot(baseUrl) {
164
226
  return null;
165
227
  }
166
228
  }
167
- function writeContextSnapshot(baseUrl, appId, resolved) {
229
+ function writeContextSnapshot(baseUrl, appId, resolved, currentUserId) {
168
230
  // 与 persistContextCache 同口径:**致命**残缺不写快照(否则快照文件成为永不过期的残缺源);
169
231
  // warn(菜单形状未知等)允许写,快照里的 warn/menuShape 同样经 meta.cache 暴露。
170
232
  if (Array.isArray(resolved?.degraded) && resolved.degraded.length)
@@ -174,7 +236,9 @@ function writeContextSnapshot(baseUrl, appId, resolved) {
174
236
  try {
175
237
  const path = snapshotPathFor(baseUrl);
176
238
  mkdirSync(join(path, '..'), { recursive: true });
177
- writeFileSync(path, JSON.stringify({ at: Date.now(), cacheVersion: RECRUIT_CACHE_VERSION, appId, resolved }), 'utf8');
239
+ writeFileSync(path, JSON.stringify({
240
+ at: Date.now(), cacheVersion: RECRUIT_CACHE_VERSION, appId, ownerUserId: currentUserId, resolved,
241
+ }), 'utf8');
178
242
  }
179
243
  catch { /* 快照写失败不影响主流程 */ }
180
244
  }
@@ -304,11 +368,14 @@ function datasetPageSize(fallback) {
304
368
  */
305
369
  async function fetchAllDatasetRows(host, objId, options) {
306
370
  const rows = [];
307
- const maxPages = Math.max(1, Math.ceil(options.maxRows / Math.max(1, options.pageSize)));
371
+ // 平台可能把每页 pageSize 静默截断;页数预算按保守页大小计算,避免 nominal 页大导致提前翻页中断。
372
+ const safePageSize = Math.max(1, Math.min(options.pageSize, 100));
373
+ const maxPages = Math.max(1, Math.ceil(options.maxRows / safePageSize));
308
374
  let pageNo = 1;
309
375
  for (;;) {
310
- if (pageNo > maxPages)
311
- return { rows, pages: pageNo - 1, truncated: true };
376
+ if (pageNo > maxPages || rows.length >= options.maxRows) {
377
+ return { rows, pages: pageNo - 1, truncated: rows.length >= options.maxRows };
378
+ }
312
379
  const response = (await host.request({
313
380
  method: 'POST',
314
381
  path: '/api/ebuilder/form/dataset/v2/getAllData',
@@ -320,10 +387,71 @@ async function fetchAllDatasetRows(host, objId, options) {
320
387
  const pageRows = response?.data?.datajson?.datas || [];
321
388
  if (!pageRows.length)
322
389
  return { rows, pages: pageNo, truncated: false };
323
- rows.push(...pageRows);
390
+ rows.push(...pageRows.slice(0, Math.max(0, options.maxRows - rows.length)));
324
391
  pageNo += 1;
325
392
  }
326
393
  }
394
+ /**
395
+ * 菜单/列表入口解析。菜单只做寻址快路径,不做授权闸门;失败或 0 节点降级为空列表继续。
396
+ * 这部分随账号权限变化,缓存按独立短 TTL 刷新;表单/字段/字典等稳定 schema 不走此短 TTL。
397
+ */
398
+ async function resolveRecruitMenus(host, appId) {
399
+ const flat = [];
400
+ const walk = (nodes) => {
401
+ for (const node of toMenuList(nodes)) {
402
+ if (node && typeof node === 'object') {
403
+ flat.push(node);
404
+ walk(node.children ?? node.childs);
405
+ }
406
+ }
407
+ };
408
+ let menuFailed = false;
409
+ let menuShape = 'unavailable';
410
+ try {
411
+ const menuResponse = (await host.request({
412
+ path: '/api/cusapp/app/allMenus',
413
+ query: { isFront: 1, appId, terminalType: 'PC' },
414
+ }));
415
+ menuShape = menuShapeOf(menuResponse?.data);
416
+ walk(menuResponse?.data);
417
+ }
418
+ catch {
419
+ menuFailed = true;
420
+ }
421
+ const menuWarn = [];
422
+ if (menuFailed || !flat.length)
423
+ menuWarn.push('menus');
424
+ const searchMenus = [];
425
+ const pages = [];
426
+ for (const node of flat) {
427
+ if (node.pageType === 'SEARCH') {
428
+ searchMenus.push({ menuName: node.menuName, listId: String(node.pageId || ''), cusMenuId: String(node.id || '') });
429
+ }
430
+ else if (node.pageType === 'PAGE') {
431
+ pages.push({ menuName: node.menuName, pageId: String(node.pageId || '') });
432
+ }
433
+ }
434
+ const lists = {
435
+ talent: null, demand: null, position: null, entry: null, offer: null,
436
+ interview: null, candidate: null,
437
+ dict: searchMenus.find((m) => (m.menuName || '').trim() === '数据字典') || null,
438
+ biz_config: searchMenus.find((m) => (m.menuName || '').trim() === '业务配置映射表') || null,
439
+ all_search: searchMenus, pages,
440
+ };
441
+ for (const [biz, keywords] of Object.entries(LIST_KEYWORDS)) {
442
+ for (const menu of searchMenus) {
443
+ if (keywords.some((keyword) => (menu.menuName || '').includes(keyword))) {
444
+ lists[biz] = menu;
445
+ break;
446
+ }
447
+ }
448
+ }
449
+ if (!menuFailed && flat.length > 0
450
+ && Object.keys(LIST_KEYWORDS).filter((k) => k !== 'biz_config').every((k) => !lists[k])) {
451
+ menuWarn.push('menus-renamed');
452
+ }
453
+ return { lists, menuShape, menuWarn };
454
+ }
327
455
  /** 五层解析主流程(磁盘缓存缺失时执行;每层失败必须报错,禁止臆造) */
328
456
  async function resolveRecruitEnv(host, appId) {
329
457
  // 解析降级标记:degraded = 致命(尝试过且失败)→ 不落盘不命中;warn = 非致命(可选依赖不可用)→ 照常落盘。
@@ -359,46 +487,11 @@ async function resolveRecruitEnv(host, appId) {
359
487
  // 业务配置表有 page/list 兜底,不强制。
360
488
  if (!forms.dictionary?.objId)
361
489
  degraded.push('dict');
362
- // L3:allMenus 菜单树 -> SEARCH 列表 + PAGE 页面
363
- // 菜单是**可选依赖**:只定位列表/页面入口,地址另有固定路由兜底。接口失败或返回结构不可控
364
- // (数组/包装对象/空对象/缺字段)一律降级为空菜单继续,且只进 warn——不得阻断上下文解析,
365
- // 否则该环境会「每次冷启动都在同处失败、永不生成缓存」。降级必须留痕,否则残缺上下文会被判健康落盘。
366
- const flat = [];
367
- const walk = (nodes) => {
368
- for (const node of toMenuList(nodes)) {
369
- if (node && typeof node === 'object') {
370
- flat.push(node);
371
- walk(node.children ?? node.childs);
372
- }
373
- }
374
- };
375
- let menuFailed = false;
376
- let menuShape = 'unavailable';
377
- try {
378
- const menuResponse = (await host.request({
379
- path: '/api/cusapp/app/allMenus',
380
- query: { isFront: 1, appId, terminalType: 'PC' },
381
- }));
382
- // 只传 data:由 toMenuList 自行识别 cusAppMenus 包装;不要再 `|| menuData` 把整个对象塞进遍历
383
- menuShape = menuShapeOf(menuResponse?.data);
384
- walk(menuResponse?.data);
385
- }
386
- catch {
387
- menuFailed = true; /* 菜单不可用:降级为空菜单,后续解析与业务链路照常继续 */
388
- }
389
- // 菜单不可用(失败/形状未知/0 节点)只进 warn:只做寻址、不做授权,不决定业务成败。
390
- if (menuFailed || !flat.length)
391
- warn.push('menus');
392
- const searchMenus = [];
393
- const pages = [];
394
- for (const node of flat) {
395
- if (node.pageType === 'SEARCH') {
396
- searchMenus.push({ menuName: node.menuName, listId: String(node.pageId || ''), cusMenuId: String(node.id || '') });
397
- }
398
- else if (node.pageType === 'PAGE') {
399
- pages.push({ menuName: node.menuName, pageId: String(node.pageId || '') });
400
- }
401
- }
490
+ // L3:allMenus 菜单树 -> SEARCH 列表 + PAGE 页面。菜单是可选寻址依赖,不做授权闸门。
491
+ const menus = await resolveRecruitMenus(host, appId);
492
+ const lists = menus.lists;
493
+ const menuShape = menus.menuShape;
494
+ warn.push(...menus.menuWarn);
402
495
  // L4:ds/fields 并行拉全部已解析表单的字段映射 + 选择类字段选项(零额外请求)
403
496
  const fields = {};
404
497
  const fieldOptions = {};
@@ -424,7 +517,7 @@ async function resolveRecruitEnv(host, appId) {
424
517
  const loadDict = async () => {
425
518
  if (dictObjId) {
426
519
  try {
427
- const page = await fetchAllDatasetRows(host, dictObjId, { pageSize: datasetPageSize(500), maxRows: 20000 });
520
+ const page = await fetchAllDatasetRows(host, dictObjId, { pageSize: datasetPageSize(500), maxRows: 1000 });
428
521
  if (page.truncated)
429
522
  warn.push('dict-truncated');
430
523
  for (const row of page.rows) {
@@ -466,7 +559,7 @@ async function resolveRecruitEnv(host, appId) {
466
559
  const loadBizConfig = async () => {
467
560
  if (bizConfig.objId) {
468
561
  try {
469
- const page = await fetchAllDatasetRows(host, bizConfig.objId, { pageSize: datasetPageSize(100), maxRows: 5000 });
562
+ const page = await fetchAllDatasetRows(host, bizConfig.objId, { pageSize: datasetPageSize(100), maxRows: 1000 });
470
563
  if (page.truncated)
471
564
  warn.push('biz_config-truncated');
472
565
  for (const row of page.rows) {
@@ -543,30 +636,6 @@ async function resolveRecruitEnv(host, appId) {
543
636
  }
544
637
  catch { /* 后台权限不足不阻塞,保持空 */ }
545
638
  }
546
- const lists = {
547
- talent: null, demand: null, position: null, entry: null, offer: null,
548
- // dict / biz_config 仅作为菜单元数据保留(供 describeTargets 诊断);
549
- // 字典与业务配置的实际读取已改走 dataset/v2 B 通道,不再依赖这两个菜单项。
550
- interview: null, candidate: null,
551
- dict: searchMenus.find((m) => (m.menuName || '').trim() === '数据字典') || null,
552
- biz_config: searchMenus.find((m) => (m.menuName || '').trim() === '业务配置映射表') || null,
553
- all_search: searchMenus, pages,
554
- };
555
- for (const [biz, keywords] of Object.entries(LIST_KEYWORDS)) {
556
- for (const menu of searchMenus) {
557
- if (keywords.some((keyword) => (menu.menuName || '').includes(keyword))) {
558
- lists[biz] = menu;
559
- break;
560
- }
561
- }
562
- }
563
- // 菜单树正常但 7 个业务列表全部未按关键词匹配到 → 大概率租户改了菜单名。
564
- // 缓存仍健康落盘(列表寻址属环境配置问题,12h TTL 兜底),但必须留痕供上层预警,
565
- // 否则列表类功能最长 12h 内持续报错而无任何提示。
566
- if (!menuFailed && flat.length > 0
567
- && Object.keys(LIST_KEYWORDS).filter((k) => k !== 'biz_config').every((k) => !lists[k])) {
568
- warn.push('menus-renamed');
569
- }
570
639
  // 同一 code 可能被多条路径 push(如 dict 既可能是 tag 缺失、也可能是 B 通道拉空),
571
640
  // 去重后再回传/落盘:degraded/warn 会被技能层直接展示给用户。
572
641
  const dedupe = (list) => [...new Set(list)];
@@ -584,6 +653,7 @@ async function resolveRecruitEnv(host, appId) {
584
653
  dict: { by_name: dictByName, raw: dictRaw },
585
654
  ebdDetailPageId,
586
655
  selfUse,
656
+ volatileSavedAt: Date.now(),
587
657
  };
588
658
  }
589
659
  /**
@@ -629,13 +699,54 @@ function toCacheMeta(cache, source, savedAt, persisted = true) {
629
699
  function srcAge(saved, source) {
630
700
  return source === 'rebuild' ? 0 : Math.max(0, Date.now() - saved);
631
701
  }
702
+ /** 稳定 schema 命中后,只重新解析易变菜单/列表入口,避免账号权限变更后沿用旧 listId。 */
703
+ async function refreshVolatileMenus(host, appId, cache) {
704
+ const menus = await resolveRecruitMenus(host, appId);
705
+ // 菜单接口抖动时 resolveRecruitMenus 会返回全 null 列表 + warn。此时不能覆盖已有有效入口,
706
+ // 否则一次瞬时失败会把本来可用的列表地址清空并落盘(下次命中仍为空,最长等 5 分钟)。
707
+ const failed = menus.menuWarn.includes('menus');
708
+ const hasBizList = ['talent', 'demand', 'position', 'entry', 'offer', 'interview', 'candidate', 'dict', 'biz_config']
709
+ .some((k) => !!cache.lists?.[k]);
710
+ if (!failed || !hasBizList) {
711
+ cache.lists = menus.lists;
712
+ cache.menuShape = menus.menuShape;
713
+ }
714
+ const keptWarn = (Array.isArray(cache.warn) ? cache.warn : [])
715
+ .filter((w) => w !== 'menus' && w !== 'menus-renamed');
716
+ cache.warn = [...new Set([...keptWarn, ...menus.menuWarn])];
717
+ cache.volatileSavedAt = Date.now();
718
+ }
719
+ /**
720
+ * 跨账号复用:只保留租户级稳定 schema(forms / fields / dict / options),
721
+ * 菜单与列表入口随账号权限变化一律丢弃——不是「没菜单读不到数据」,而是不能拿
722
+ * 他人账号的 listId 去查 A 通道(可能越权/查错台账)。丢弃后列表走 B 通道直读兜底,
723
+ * 易变 TTL 置 0 让下次调用按当前账号重新解析菜单。
724
+ */
725
+ function adoptStableSchemaOnly(cache, currentUserId) {
726
+ cache.lists = {
727
+ talent: null, demand: null, position: null, entry: null, offer: null,
728
+ interview: null, candidate: null, dict: null, biz_config: null,
729
+ all_search: [], pages: [],
730
+ };
731
+ cache.menuShape = 'unavailable';
732
+ const kept = (Array.isArray(cache.warn) ? cache.warn : []).filter((w) => w !== 'menus' && w !== 'menus-renamed');
733
+ cache.warn = [...new Set([...kept, 'menus'])];
734
+ // 当前会话拿不到 userId 时保留原归属,否则写空会把「可识别的他人缓存」变成「无主缓存」,
735
+ // 下次判定又退化成 miss → 每次都全量重建。
736
+ cache.ownerUserId = currentUserId || cache.ownerUserId || '';
737
+ // 用 1(不是 0)强制下次调用刷新菜单:volatileFresh 在 volatileSavedAt 为 0 时会回退到
738
+ // savedAt(刚写入=新鲜),菜单会被误判为 5 分钟内有效、迟迟不恢复。
739
+ cache.volatileSavedAt = 1;
740
+ }
632
741
  export function createRecruitContextLoader() {
633
742
  const memo = new Map();
634
743
  let last = null;
635
744
  async function load(host) {
636
745
  const session = await host.getSession();
637
746
  const baseUrl = session.baseUrl.replace(/\/+$/, '');
638
- const memoKey = baseUrl;
747
+ const currentUserId = String(session.userId || '');
748
+ // 菜单/列表权限随登录用户变化:memo 也必须按用户隔离,不能同一进程跨账号复用。
749
+ const memoKey = baseUrl + '|' + currentUserId;
639
750
  // 进程内 memo:单次调用内多次 load 复用。命中条件与磁盘同口径(savedAt 新鲜 + degraded 空 +
640
751
  // 关键字段齐),否则丢弃重来——否则常驻进程会永久短路磁盘 TTL 与健康校验。
641
752
  const cached = memo.get(memoKey);
@@ -644,12 +755,20 @@ export function createRecruitContextLoader() {
644
755
  const memoUsable = Number(cached.savedAt || 0) > 0
645
756
  && memoAge <= recruitCacheTtlMs()
646
757
  && !(Array.isArray(cached.degraded) && cached.degraded.length)
758
+ && codeHashOk(cached)
647
759
  && hasCriticalFields(cached);
648
- if (memoUsable) {
760
+ if (memoUsable && volatileFresh(cached)) {
649
761
  // 云端运行时从不落盘:memo 命中也必须如实报 persisted=false,否则上层会以为「已缓存 12h」。
650
762
  last = toCacheMeta(cached, 'memo', cached.savedAt, !isXiaoECloudRuntime());
651
763
  return cached;
652
764
  }
765
+ // 云端(网页版/沙箱)没有磁盘缓存可回退:易变菜单过期若直接丢 memo,会退化成每 5 分钟
766
+ // 一次全量重建(约 2s)。这里只刷新菜单/列表入口即可。
767
+ if (memoUsable && isXiaoECloudRuntime()) {
768
+ await refreshVolatileMenus(host, cached.appId, cached);
769
+ last = toCacheMeta(cached, 'memo', cached.savedAt, false);
770
+ return cached;
771
+ }
653
772
  memo.delete(memoKey);
654
773
  }
655
774
  // 网页端/沙箱容器不持久:跳过磁盘读写,只留进程内 memo(每次全量解析约 2s,属设计内成本)。
@@ -674,8 +793,27 @@ export function createRecruitContextLoader() {
674
793
  const candidate = JSON.parse(readFileSync(file, 'utf8'));
675
794
  const savedAt = Number(candidate?.savedAt || 0);
676
795
  const fresh = savedAt > 0 && (Date.now() - savedAt) <= recruitCacheTtlMs();
677
- if (candidate && candidate.cacheVersion === RECRUIT_CACHE_VERSION && fresh && hasCriticalFields(candidate)) {
796
+ // owner 相同=直接命中;owner 不同=只复用稳定 schema(菜单/列表入口一律丢弃)。
797
+ // 旧缓存无 owner 且当前也拿不到 userId 时无法判定,沿用旧行为按命中处理(不破坏存量环境);
798
+ // 但「缓存有明确归属、当前拿不到 userId」必须按跨账号处理。
799
+ const ownerOk = (!currentUserId && !candidate?.ownerUserId)
800
+ || (!!currentUserId && !!candidate?.ownerUserId
801
+ && String(candidate.ownerUserId) === currentUserId);
802
+ const ownerMismatch = !!currentUserId && !!candidate?.ownerUserId
803
+ && String(candidate.ownerUserId) !== currentUserId;
804
+ // 会话拿不到 userId(登录态残缺)但缓存有明确归属:无法证明是同一人,按跨账号处理,
805
+ // 至少不能沿用他人的菜单/列表入口(ISS-302)。
806
+ const ownerUnprovable = !currentUserId && !!candidate?.ownerUserId;
807
+ if (candidate && (ownerOk || ownerMismatch || ownerUnprovable)
808
+ && candidate.cacheVersion === RECRUIT_CACHE_VERSION && fresh
809
+ && codeHashOk(candidate) && hasCriticalFields(candidate)) {
810
+ if (ownerMismatch || ownerUnprovable)
811
+ adoptStableSchemaOnly(candidate, currentUserId);
812
+ else if (!volatileFresh(candidate))
813
+ await refreshVolatileMenus(host, appId, candidate);
678
814
  memo.set(memoKey, candidate);
815
+ // 命中回写只更新易变字段:savedAt 必须沿用旧值,否则 12h 主 TTL 变滑动窗口(ISS-301)。
816
+ persistContextCache(baseUrl, appId, candidate, { preserveSavedAt: true });
679
817
  last = toCacheMeta(candidate, 'disk', savedAt);
680
818
  return candidate;
681
819
  }
@@ -701,8 +839,20 @@ export function createRecruitContextLoader() {
701
839
  }
702
840
  if (tagStillMatches) {
703
841
  // 必须带 savedAt:memo 命中依赖它判 TTL,缺了会导致快照采纳后 memo 永不命中。
704
- const adopted = { ...snapshot.resolved, cacheVersion: RECRUIT_CACHE_VERSION, savedAt: Date.now() };
705
- persistContextCache(baseUrl, appId, adopted);
842
+ const ownerMismatch = !!currentUserId && !!String(snapshot.ownerUserId || '')
843
+ && String(snapshot.ownerUserId) !== currentUserId;
844
+ const adopted = {
845
+ ...snapshot.resolved,
846
+ cacheVersion: RECRUIT_CACHE_VERSION,
847
+ ownerUserId: currentUserId || snapshot.ownerUserId,
848
+ // 沿用快照的生成时间,不重置为 now:否则「快照 + 缓存」可把 12h 有效期叠成 24h(ISS-301 同族)。
849
+ savedAt: Number(snapshot.at) || Date.now(),
850
+ };
851
+ if (ownerMismatch)
852
+ adoptStableSchemaOnly(adopted, currentUserId);
853
+ else if (!volatileFresh(adopted))
854
+ await refreshVolatileMenus(host, appId, adopted);
855
+ persistContextCache(baseUrl, appId, adopted, { preserveSavedAt: true });
706
856
  memo.set(memoKey, adopted);
707
857
  last = toCacheMeta(adopted, 'snapshot', adopted.savedAt);
708
858
  return adopted;
@@ -712,10 +862,15 @@ export function createRecruitContextLoader() {
712
862
  // 写磁盘缓存(结构同 v7,供后续进程/ehr 技能共享)
713
863
  const degradedNow = Array.isArray(resolved.degraded) && resolved.degraded.length > 0;
714
864
  const persisted = !degradedNow && !cloudRuntime;
715
- persistContextCache(baseUrl, appId, { ...resolved, cacheVersion: RECRUIT_CACHE_VERSION });
865
+ const withStamp = {
866
+ ...resolved,
867
+ ownerUserId: currentUserId,
868
+ codeHash: recruitCodeHash(),
869
+ savedAt: Date.now(),
870
+ };
871
+ persistContextCache(baseUrl, appId, withStamp);
716
872
  // 同步留一份冷启动快照(下次缓存被清/版本变化时用它省掉全量重建)
717
- writeContextSnapshot(baseUrl, appId, resolved);
718
- const withStamp = { ...resolved, savedAt: Date.now() };
873
+ writeContextSnapshot(baseUrl, appId, withStamp, currentUserId);
719
874
  // 🔴 v8:degraded 非空的结果**不写 memo**。否则同一常驻进程内后续每次 load 都拿到这份
720
875
  // 残缺上下文(dict 空),永远不会重试——「不落盘不命中」就只对磁盘生效,窗口内仍会复发。
721
876
  if (!degradedNow)
@@ -725,8 +880,13 @@ export function createRecruitContextLoader() {
725
880
  }
726
881
  return { load, lastMeta: () => last };
727
882
  }
728
- /** 写环境上下文磁盘缓存;失败不阻塞,可经 WEAVER_CLI_DEBUG_CACHE=1 诊断。 */
729
- function persistContextCache(baseUrl, appId, cache) {
883
+ /**
884
+ * 写环境上下文磁盘缓存;失败不阻塞,可经 WEAVER_CLI_DEBUG_CACHE=1 诊断。
885
+ * `preserveSavedAt`:命中路径回写时必须置 true。savedAt 是「稳定 schema 的年龄」,
886
+ * 命中一次就把它刷成 now 等于把 12h TTL 变成滑动窗口——天天用就永不重建,
887
+ * 服务端改字段/改字典永远感知不到(2026-11-30 审计 ISS-301)。
888
+ */
889
+ function persistContextCache(baseUrl, appId, cache, options = {}) {
730
890
  // 致命残缺(degraded 非空)绝不落盘,否则固化后录入会永久被拦;warn 不拦,
731
891
  // 拦住等于把「一次适配不认识」升级成「该环境永不缓存」。
732
892
  if (Array.isArray(cache?.degraded) && cache.degraded.length) {
@@ -756,8 +916,13 @@ function persistContextCache(baseUrl, appId, cache) {
756
916
  envKey: `${dir.split(/[\\/]/).pop()}|${appId}`,
757
917
  ...cache,
758
918
  cacheVersion: RECRUIT_CACHE_VERSION,
759
- // 🔴 savedAt 必须在 ...cache 之后:防止调用方携带旧 savedAt 把新写入标成过期
760
- savedAt: Date.now(),
919
+ codeHash: recruitCodeHash(),
920
+ // 🔴 savedAt 必须在 ...cache 之后:防止调用方携带旧 savedAt 把新写入标成过期。
921
+ // 命中回写(preserveSavedAt)例外:沿用调用方原 savedAt,只更新 volatileSavedAt 等易变字段,
922
+ // 否则每次命中都会刷新主 TTL,12h 自愈永久失效。
923
+ savedAt: options.preserveSavedAt && Number(cache?.savedAt || 0) > 0
924
+ ? Number(cache.savedAt)
925
+ : Date.now(),
761
926
  }, null, 2), 'utf8');
762
927
  renameSync(tmp, file);
763
928
  }
@@ -0,0 +1,13 @@
1
+ import { InvoiceCliError } from './errors.js';
2
+ export function assertBusinessSuccess(value, subtype, fallbackMessage) {
3
+ const result = value && typeof value === 'object' ? value : {};
4
+ const code = result.code ?? result.res_base?.ret;
5
+ const failed = result.fail === true || result.status === false || (code !== undefined && code !== 0 && code !== 200);
6
+ if (!failed)
7
+ return;
8
+ throw new InvoiceCliError('api', subtype, result.message || result.msg || result.res_base?.message || fallbackMessage, {
9
+ code,
10
+ details: { result },
11
+ exitCode: 1,
12
+ });
13
+ }
@@ -0,0 +1,24 @@
1
+ function formatUtcDate(date) {
2
+ const y = date.getUTCFullYear();
3
+ const m = String(date.getUTCMonth() + 1).padStart(2, '0');
4
+ const d = String(date.getUTCDate()).padStart(2, '0');
5
+ return `${y}-${m}-${d}`;
6
+ }
7
+ /** 按日历日加减,跨月、跨年按公历进位。 */
8
+ export function addCalendarDays(isoDate, offsetDays) {
9
+ const [year, month, day] = isoDate.split('-').map(Number);
10
+ return formatUtcDate(new Date(Date.UTC(year, (month ?? 1) - 1, (day ?? 1) + offsetDays)));
11
+ }
12
+ /** 按日历月加减;目标月没有这一天时取该月最后一天。 */
13
+ export function addCalendarMonths(isoDate, offsetMonths) {
14
+ const [year, month, day] = isoDate.split('-').map(Number);
15
+ const target = new Date(Date.UTC(year, (month ?? 1) - 1 + offsetMonths, 1));
16
+ const lastDay = new Date(Date.UTC(target.getUTCFullYear(), target.getUTCMonth() + 1, 0)).getUTCDate();
17
+ target.setUTCDate(Math.min(day ?? 1, lastDay));
18
+ return formatUtcDate(target);
19
+ }
20
+ /** 东八区日历日。 */
21
+ export function shanghaiCalendarDate(offsetDays = 0, now = new Date()) {
22
+ const today = new Intl.DateTimeFormat('en-CA', { timeZone: 'Asia/Shanghai' }).format(now);
23
+ return offsetDays === 0 ? today : addCalendarDays(today, offsetDays);
24
+ }
@@ -99,6 +99,7 @@ export function createInvoiceHost(ctx, dependencies = {}) {
99
99
  let e10Session = null;
100
100
  let sessionContext = null;
101
101
  let invoiceToken = null;
102
+ let invoiceTokenPromise = null;
102
103
  let tokenStore = null;
103
104
  const requireSession = dependencies.requireSession || requireE10Session;
104
105
  const tokenStoreFactory = dependencies.tokenStoreFactory || createInvoiceTokenStore;
@@ -118,6 +119,21 @@ export function createInvoiceHost(ctx, dependencies = {}) {
118
119
  return sessionContext;
119
120
  }
120
121
  async function ensureInvoiceToken(timeoutMs = 30_000) {
122
+ if (invoiceToken)
123
+ return invoiceToken;
124
+ if (invoiceTokenPromise)
125
+ return invoiceTokenPromise;
126
+ const pending = loadInvoiceToken(timeoutMs);
127
+ invoiceTokenPromise = pending;
128
+ try {
129
+ return await pending;
130
+ }
131
+ finally {
132
+ if (invoiceTokenPromise === pending)
133
+ invoiceTokenPromise = null;
134
+ }
135
+ }
136
+ async function loadInvoiceToken(timeoutMs) {
121
137
  await ensureSession();
122
138
  const context = await getSession();
123
139
  tokenStore ||= tokenStoreFactory(context);
@@ -145,11 +161,15 @@ export function createInvoiceHost(ctx, dependencies = {}) {
145
161
  invoiceToken = token;
146
162
  return token;
147
163
  }
148
- async function ensureContext(needsInvoiceToken, timeoutMs, path) {
149
- await ensureSession();
164
+ async function ensureContext(needsInvoiceToken, timeoutMs, path, operation) {
165
+ const session = await ensureSession();
150
166
  const tokenEndpoint = path === '/api/inc/proxy/getToken' || path === '/api/app/inc/proxy/getToken';
151
167
  if (tokenEndpoint)
152
168
  return undefined;
169
+ // 当前人员卡片使用 E10 公共会话,此路径不发送业票通专用 Token。
170
+ const employeeCardPath = `/api/bs/hrm/card/get/${encodeURIComponent(session.userId)}`;
171
+ if (!needsInvoiceToken && path === employeeCardPath)
172
+ return undefined;
153
173
  if (!needsInvoiceToken) {
154
174
  // 兼容调用方参数,但业务路径仍强制补齐发票 Token。
155
175
  }
@@ -188,7 +208,7 @@ export function createInvoiceHost(ctx, dependencies = {}) {
188
208
  async function invoiceRequest(request, canRetryExpiredToken = true) {
189
209
  const { method = 'POST', path, query, headers, body, operation, needsInvoiceToken = true, timeoutMs = 30_000, } = request;
190
210
  assertPath(path);
191
- const token = await ensureContext(needsInvoiceToken, timeoutMs, path);
211
+ const token = await ensureContext(needsInvoiceToken, timeoutMs, path, operation);
192
212
  const response = await (await runtime()).requestJson({
193
213
  module: 'invoice',
194
214
  operation,
@@ -220,16 +240,7 @@ export function createInvoiceHost(ctx, dependencies = {}) {
220
240
  exitCode: 1,
221
241
  });
222
242
  }
223
- let value = response.value;
224
- if (request.rewriteJsonText && response.text) {
225
- try {
226
- value = JSON.parse(request.rewriteJsonText(response.text));
227
- }
228
- catch {
229
- value = response.value;
230
- }
231
- }
232
- return handleBusinessResponse(value, () => invoiceRequest(request, false), canRetryExpiredToken && Boolean(token));
243
+ return handleBusinessResponse(response.value, () => invoiceRequest(request, false), canRetryExpiredToken && Boolean(token));
233
244
  }
234
245
  async function invoiceMultipartRequest(request, canRetryExpiredToken = true) {
235
246
  const { method = 'POST', path, query, fields = {}, file, headers, operation, needsInvoiceToken = true, timeoutMs = 30_000, } = request;
@@ -237,7 +248,7 @@ export function createInvoiceHost(ctx, dependencies = {}) {
237
248
  throw invoiceValidationError('input_invalid', 'multipart 请求需要文件、URL 或表单字段');
238
249
  }
239
250
  assertPath(path);
240
- const token = await ensureContext(needsInvoiceToken, timeoutMs, path);
251
+ const token = await ensureContext(needsInvoiceToken, timeoutMs, path, operation);
241
252
  const form = new FormData();
242
253
  for (const [key, value] of Object.entries(fields)) {
243
254
  if (value === undefined || value === null)
@@ -277,7 +288,7 @@ export function createInvoiceHost(ctx, dependencies = {}) {
277
288
  async function invoiceFormRequest(request, canRetryExpiredToken = true) {
278
289
  const { method = 'POST', path, query, fields = {}, operation, needsInvoiceToken = true, timeoutMs = 30_000, } = request;
279
290
  assertPath(path);
280
- const token = await ensureContext(needsInvoiceToken, timeoutMs, path);
291
+ const token = await ensureContext(needsInvoiceToken, timeoutMs, path, operation);
281
292
  const form = new URLSearchParams();
282
293
  for (const [key, value] of Object.entries(fields)) {
283
294
  if (value === undefined || value === null)