weaver-work-cli 0.1.40 → 0.1.44

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 (401) hide show
  1. package/README.md +17 -0
  2. package/dist/chunks/{archive-JHTONRST.js → archive-P6TBQGKL.js} +13 -5
  3. package/dist/chunks/{archive-oa-FCHLCPHC.js → archive-oa-7TQ2NXOH.js} +12 -5
  4. package/dist/chunks/{asset-RLIHC7DB.js → asset-3ELRG37G.js} +11 -4
  5. package/dist/chunks/{asset-idle-KVOFTLCP.js → asset-idle-WIGMUFMD.js} +7 -3
  6. package/dist/chunks/{attachment-content-RZYDB3MB.js → attachment-content-E3276UOV.js} +5 -4
  7. package/dist/chunks/{blog-42OZTJNP.js → blog-C5NMZAAC.js} +11 -4
  8. package/dist/chunks/{caizhilian-KRK547K5.js → caizhilian-5XSM2DFP.js} +13 -6
  9. package/dist/chunks/{calendar-RTWAMKHD.js → calendar-FI2WNSBO.js} +71 -26
  10. package/dist/chunks/{chunk-CXRQWOZ5.js → chunk-3YBDYOC4.js} +3 -3
  11. package/dist/chunks/{chunk-OOUTBLZ4.js → chunk-56EZERK4.js} +1 -1
  12. package/dist/chunks/chunk-6N4JPNFL.js +76 -0
  13. package/dist/chunks/{chunk-ZUX3P6BQ.js → chunk-727FH2NI.js} +1 -1
  14. package/dist/chunks/chunk-7BDPM5ST.js +11 -0
  15. package/dist/chunks/{chunk-LN447PY2.js → chunk-BCVYBYYT.js} +432 -2247
  16. package/dist/chunks/{chunk-7E6MUOEK.js → chunk-CWYGFU5B.js} +2 -2
  17. package/dist/chunks/{chunk-NOODWMCL.js → chunk-D4ADSZ7H.js} +1 -1
  18. package/dist/chunks/{chunk-WFFNM65B.js → chunk-ETNJSKMM.js} +281 -29
  19. package/dist/chunks/{chunk-CAQNBBQA.js → chunk-F4E4EM35.js} +3 -3
  20. package/dist/chunks/{chunk-4CTESSKI.js → chunk-FAZTGX7S.js} +6 -6
  21. package/dist/chunks/chunk-FRZKBMSW.js +2562 -0
  22. package/dist/chunks/{chunk-BYBSCN4X.js → chunk-G7PQWD4L.js} +6 -3
  23. package/dist/chunks/{chunk-NJKREDA3.js → chunk-GAMZLAG2.js} +1 -1
  24. package/dist/chunks/{chunk-FLS4DPGP.js → chunk-GM6J7Q4B.js} +28 -15
  25. package/dist/chunks/{chunk-NETCCARD.js → chunk-GRDRG6HP.js} +3 -3
  26. package/dist/chunks/chunk-HIT4Y6OI.js +1238 -0
  27. package/dist/chunks/{chunk-EZALDOQH.js → chunk-HP7JIYMT.js} +5 -2
  28. package/dist/chunks/{chunk-IZSSVYAG.js → chunk-IAZ3UPY6.js} +3 -3
  29. package/dist/chunks/{chunk-ZEDWSH32.js → chunk-IC62NFM5.js} +1 -1
  30. package/dist/chunks/{chunk-P26ZWSKU.js → chunk-KIHNAS25.js} +5 -2
  31. package/dist/chunks/{chunk-57IECMWX.js → chunk-N4M2DDFE.js} +29 -15
  32. package/dist/chunks/{chunk-JWRZM2H2.js → chunk-OF4S23UB.js} +4 -4
  33. package/dist/chunks/{chunk-VNBU55SL.js → chunk-PC7VKEB5.js} +80 -2458
  34. package/dist/chunks/{chunk-G2JSIUWF.js → chunk-PUQS5MWL.js} +91 -2
  35. package/dist/chunks/{chunk-E7OK5WD5.js → chunk-Q4OYAQYH.js} +5 -5
  36. package/dist/chunks/{chunk-7BRU4EFH.js → chunk-QVSWRLLU.js} +35 -6
  37. package/dist/chunks/{chunk-T6EGVBKU.js → chunk-TA7FXXJD.js} +6 -3
  38. package/dist/chunks/{chunk-GPMFD4RD.js → chunk-TXUG266F.js} +1 -1
  39. package/dist/chunks/{chunk-4TEDNCON.js → chunk-UFIT2UU3.js} +354 -56
  40. package/dist/chunks/{chunk-LUSPKZKY.js → chunk-UG5G54VL.js} +1 -0
  41. package/dist/chunks/{chunk-NIAJ5ZCG.js → chunk-UL5XUQ25.js} +5 -2
  42. package/dist/chunks/{chunk-FMPJJYYI.js → chunk-WRXSAVKO.js} +1 -1
  43. package/dist/chunks/{chunk-7U577Q7U.js → chunk-WSF4NNMR.js} +3 -3
  44. package/dist/chunks/chunk-XHK4MDR5.js +2497 -0
  45. package/dist/chunks/{chunk-LFMSDBZN.js → chunk-XNIK66I4.js} +326 -161
  46. package/dist/chunks/{chunk-3SO6QL6U.js → chunk-YWX377BY.js} +5 -2
  47. package/dist/chunks/{chunk-BYATLLEF.js → chunk-Z3GDFVJR.js} +1 -1
  48. package/dist/chunks/{chunk-I566ZYNF.js → chunk-Z7VYWPZV.js} +1 -1
  49. package/dist/chunks/{conflict-VR55AOOO.js → conflict-ARLSZJ6V.js} +4 -3
  50. package/dist/chunks/{continuation-2CKSBLA6.js → continuation-3S37AUSH.js} +4 -3
  51. package/dist/chunks/{continuation-RN6PZN2M.js → continuation-3XLYYTKV.js} +4 -3
  52. package/dist/chunks/{continuation-HZIZRZBX.js → continuation-HFW2YT5S.js} +4 -3
  53. package/dist/chunks/{continuation-NLECEJPX.js → continuation-KI7DRRZN.js} +4 -3
  54. package/dist/chunks/{contract-HI4FNPYE.js → contract-DNIIW5VJ.js} +13 -5
  55. package/dist/chunks/{cowork-HJLI353D.js → cowork-GMLRGVIW.js} +31 -14
  56. package/dist/chunks/create-flow-J22BO65E.js +56 -0
  57. package/dist/chunks/{ebuilder-form-HTGI63UU.js → ebuilder-form-ANV2FHYV.js} +12 -7
  58. package/dist/chunks/{ehr-GYXIYH3A.js → ehr-GSTGAIY3.js} +695 -1255
  59. package/dist/chunks/{employee-SAK2QYXX.js → employee-22BGJ3QS.js} +3 -3
  60. package/dist/chunks/{env-DW3G4HUO.js → env-BX3VRFS7.js} +4 -3
  61. package/dist/chunks/{esb-I5INCEFE.js → esb-ATAIASX2.js} +12 -7
  62. package/dist/chunks/{factory-TKXGXS6L.js → factory-PETTFME6.js} +3 -2
  63. package/dist/chunks/{fna-K2MHTQ24.js → fna-YEKBSFSX.js} +14 -8
  64. package/dist/chunks/{group-chat-VYBNMJLG.js → group-chat-BFVXAYFX.js} +7 -4
  65. package/dist/chunks/{host-D5SERMAJ.js → host-HRBXEPDQ.js} +5 -5
  66. package/dist/chunks/{host-JM4YVHFM.js → host-LR55CTHP.js} +5 -5
  67. package/dist/chunks/{host-L3VLITMT.js → host-SUOY6VYQ.js} +5 -5
  68. package/dist/chunks/{host-ZUQTJYYK.js → host-SZGV4UNT.js} +5 -5
  69. package/dist/chunks/{host-256GVCAH.js → host-WIKN2EJ5.js} +5 -5
  70. package/dist/chunks/{hrm-VLRBKTZB.js → hrm-NRDO4W5G.js} +11 -7
  71. package/dist/chunks/{im-QK3VTLXK.js → im-IQ2HN23S.js} +11 -10
  72. package/dist/chunks/{invoice-T5JTA32H.js → invoice-MNRW76PP.js} +636 -1768
  73. package/dist/chunks/{jiuchuanhui-P2FNEQVZ.js → jiuchuanhui-DTRBAX4N.js} +14 -6
  74. package/dist/chunks/{lazy-dispatch-XRRI46M6.js → lazy-dispatch-ZVWAI25B.js} +7 -6
  75. package/dist/chunks/{mail-3Y7MJ6PS.js → mail-ZVAUXOJA.js} +16 -14
  76. package/dist/chunks/{meeting-M7LTXGJE.js → meeting-FEVPZ67S.js} +21 -13
  77. package/dist/chunks/{okr-OBC6S67L.js → okr-SDH3E5RA.js} +12 -5
  78. package/dist/chunks/{operations-5QL3AECO.js → operations-62N6EP3C.js} +4 -3
  79. package/dist/chunks/{plan-5H6I53SK.js → plan-E35JFDI7.js} +12 -5
  80. package/dist/chunks/{project-L75QZV4S.js → project-73QXBAB2.js} +49 -25
  81. package/dist/chunks/reception-UWZVACBN.js +1899 -0
  82. package/dist/chunks/recruit-stage-4MAOCKFY.js +4770 -0
  83. package/dist/chunks/registry-IM5G23LS.js +24 -0
  84. package/dist/chunks/{registry-UGRBCBHO.js → registry-JDUS4E7D.js} +7 -6
  85. package/dist/chunks/{registry-RXPN6BBT.js → registry-KNKSCJNT.js} +7 -6
  86. package/dist/chunks/{registry-NYPYMZXG.js → registry-PO7SI256.js} +4 -4
  87. package/dist/chunks/{registry-QGHFNUWS.js → registry-PVUZQDDQ.js} +3 -3
  88. package/dist/chunks/{room-recommend-A3UDC3CA.js → room-recommend-H7KLXA5R.js} +6 -5
  89. package/dist/chunks/{schedule-5GCACCK7.js → schedule-ESZIBAUO.js} +6 -5
  90. package/dist/chunks/{workflow-M5ZJ7DWF.js → workflow-CWJFJLQU.js} +15 -10
  91. package/dist/cmd/action.js +6 -0
  92. package/dist/cmd/identity/index.js +45 -0
  93. package/dist/cmd/index.js +2 -0
  94. package/dist/core/continuation-ttl.js +18 -0
  95. package/dist/core/error-codes.js +85 -0
  96. package/dist/core/logger.js +11 -0
  97. package/dist/index.js +41 -30
  98. package/dist/internal/e10/auth/commands.js +164 -8
  99. package/dist/internal/e10/auth/error-log.js +182 -0
  100. package/dist/internal/e10/auth/messages.js +6 -0
  101. package/dist/internal/e10/auth/session.js +34 -3
  102. package/dist/internal/e10/auth/xiaoe.js +286 -44
  103. package/dist/internal/e10/auth-recovery.js +72 -14
  104. package/dist/internal/e10/context.js +72 -13
  105. package/dist/internal/e10/index.js +1 -1
  106. package/dist/internal/e10/network-error.js +93 -0
  107. package/dist/internal/e10/request-runtime.js +6 -0
  108. package/dist/internal/skills/install.js +9 -1
  109. package/dist/shortcuts/archive/continuation.js +2 -1
  110. package/dist/shortcuts/archive/index.js +3 -0
  111. package/dist/shortcuts/archive/operations/confirm.js +2 -1
  112. package/dist/shortcuts/archive-oa/continuation.js +2 -1
  113. package/dist/shortcuts/archive-oa/index.js +2 -0
  114. package/dist/shortcuts/archive-oa/operations/confirm.js +2 -1
  115. package/dist/shortcuts/asset/continuation.js +2 -1
  116. package/dist/shortcuts/asset/index.js +2 -0
  117. package/dist/shortcuts/asset-idle/index.js +2 -0
  118. package/dist/shortcuts/blog/continuation.js +2 -1
  119. package/dist/shortcuts/blog/index.js +2 -0
  120. package/dist/shortcuts/caizhilian/continuation.js +2 -1
  121. package/dist/shortcuts/caizhilian/index.js +2 -0
  122. package/dist/shortcuts/caizhilian/operations/confirm.js +3 -2
  123. package/dist/shortcuts/calendar/continuation.js +2 -1
  124. package/dist/shortcuts/calendar/index.js +2 -0
  125. package/dist/shortcuts/calendar/operations/read.js +31 -22
  126. package/dist/shortcuts/calendar/operations/write.js +46 -2
  127. package/dist/shortcuts/contract/continuation.js +2 -1
  128. package/dist/shortcuts/contract/index.js +2 -0
  129. package/dist/shortcuts/contract/operations/write.js +2 -1
  130. package/dist/shortcuts/cowork/continuation.js +2 -1
  131. package/dist/shortcuts/cowork/index.js +2 -0
  132. package/dist/shortcuts/cowork/operations/discuss-write.js +5 -1
  133. package/dist/shortcuts/cowork/operations/item-write.js +1 -7
  134. package/dist/shortcuts/cowork/operations/member-write.js +3 -1
  135. package/dist/shortcuts/cowork/operations/permission-write.js +5 -1
  136. package/dist/shortcuts/cowork/operations/shared.js +7 -0
  137. package/dist/shortcuts/ebuilder-form/continuation.js +2 -1
  138. package/dist/shortcuts/ebuilder-form/index.js +2 -0
  139. package/dist/shortcuts/ebuilder-form/operations/write.js +3 -2
  140. package/dist/shortcuts/ehr/continuation.js +2 -1
  141. package/dist/shortcuts/ehr/index.js +2 -0
  142. package/dist/shortcuts/ehr/operations/attend-write.js +44 -2
  143. package/dist/shortcuts/ehr/operations/hr-contact.js +7 -4
  144. package/dist/shortcuts/ehr/operations/hr-report.js +13 -7
  145. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +317 -63
  146. package/dist/shortcuts/ehr/operations/recruit-position.js +134 -2
  147. package/dist/shortcuts/ehr/operations/recruit-write.js +263 -18
  148. package/dist/shortcuts/ehr/operations/recruit.js +10 -4
  149. package/dist/shortcuts/ehr/operations/shared.js +47 -0
  150. package/dist/shortcuts/esb/continuation.js +2 -1
  151. package/dist/shortcuts/esb/index.js +2 -0
  152. package/dist/shortcuts/esb/operations/trigger.js +2 -1
  153. package/dist/shortcuts/fna/continuation.js +2 -1
  154. package/dist/shortcuts/fna/index.js +2 -0
  155. package/dist/shortcuts/fna/operations/invoice-writeoff.js +1 -1
  156. package/dist/shortcuts/fna/operations/loan.js +1 -1
  157. package/dist/shortcuts/hrm/index.js +2 -0
  158. package/dist/shortcuts/hrm/operations/org.js +118 -0
  159. package/dist/shortcuts/im/continuation.js +2 -1
  160. package/dist/shortcuts/index.js +10 -0
  161. package/dist/shortcuts/invoice/continuation.js +2 -1
  162. package/dist/shortcuts/invoice/index.js +14 -15
  163. package/dist/shortcuts/invoice/invoice-record.js +93 -0
  164. package/dist/shortcuts/invoice/manifest.js +190 -393
  165. package/dist/shortcuts/invoice/operations/add.js +2 -1
  166. package/dist/shortcuts/invoice/operations/delete.js +2 -1
  167. package/dist/shortcuts/invoice/operations/import.js +2 -1
  168. package/dist/shortcuts/invoice/operations/issuing-contract-detail.js +86 -0
  169. package/dist/shortcuts/invoice/operations/issuing-contracts.js +210 -0
  170. package/dist/shortcuts/invoice/operations/registry.js +17 -17
  171. package/dist/shortcuts/invoice/operations/reim-auto.js +4 -569
  172. package/dist/shortcuts/invoice/operations/reim.js +52 -341
  173. package/dist/shortcuts/invoice/operations/shared.js +21 -4
  174. package/dist/shortcuts/invoice/operations/update.js +2 -1
  175. package/dist/shortcuts/invoice/projection.js +10 -62
  176. package/dist/shortcuts/jiuchuanhui/continuation.js +2 -1
  177. package/dist/shortcuts/jiuchuanhui/index.js +2 -0
  178. package/dist/shortcuts/jiuchuanhui/operations/datajson.js +2 -1
  179. package/dist/shortcuts/jiuchuanhui/operations/esb.js +2 -1
  180. package/dist/shortcuts/mail/continuation.js +2 -1
  181. package/dist/shortcuts/mail/index.js +2 -0
  182. package/dist/shortcuts/mail/operations/mail-blacklist.js +1 -1
  183. package/dist/shortcuts/mail/operations/mail-contacts.js +1 -1
  184. package/dist/shortcuts/mail/operations/mail-send.js +1 -1
  185. package/dist/shortcuts/mail/operations/mail-sign.js +1 -1
  186. package/dist/shortcuts/mail/operations/mail-template.js +1 -1
  187. package/dist/shortcuts/meeting/continuation.js +2 -1
  188. package/dist/shortcuts/meeting/index.js +2 -0
  189. package/dist/shortcuts/meeting/operations/change.js +1 -1
  190. package/dist/shortcuts/meeting/operations/create.js +1 -1
  191. package/dist/shortcuts/meeting/operations/eb/catalog.js +4 -1
  192. package/dist/shortcuts/meeting/operations/eb/create-flow.js +101 -35
  193. package/dist/shortcuts/meeting/operations/eb/decision.js +1 -1
  194. package/dist/shortcuts/meeting/operations/eb/factory.js +34 -1
  195. package/dist/shortcuts/meeting/operations/eb/group-chat.js +25 -3
  196. package/dist/shortcuts/meeting/operations/eb/person-cache.js +96 -0
  197. package/dist/shortcuts/meeting/operations/eb/room-recommend.js +33 -11
  198. package/dist/shortcuts/meeting/operations/lifecycle.js +1 -1
  199. package/dist/shortcuts/meeting/operations/receipts.js +1 -1
  200. package/dist/shortcuts/meeting/operations/signs.js +1 -1
  201. package/dist/shortcuts/okr/continuation.js +2 -1
  202. package/dist/shortcuts/okr/index.js +2 -0
  203. package/dist/shortcuts/okr/operations/write.js +1 -1
  204. package/dist/shortcuts/plan/continuation.js +2 -1
  205. package/dist/shortcuts/plan/index.js +2 -0
  206. package/dist/shortcuts/plan/operations/write.js +1 -1
  207. package/dist/shortcuts/project/continuation.js +2 -1
  208. package/dist/shortcuts/project/index.js +2 -0
  209. package/dist/shortcuts/project/operations/read.js +6 -25
  210. package/dist/shortcuts/project/operations/shared.js +22 -0
  211. package/dist/shortcuts/project/operations/write.js +28 -2
  212. package/dist/shortcuts/reception/constants.js +53 -0
  213. package/dist/shortcuts/reception/errors.js +54 -0
  214. package/dist/shortcuts/reception/host.js +125 -0
  215. package/dist/shortcuts/reception/index.js +198 -0
  216. package/dist/shortcuts/reception/manifest.js +177 -0
  217. package/dist/shortcuts/reception/operations/ask.js +71 -0
  218. package/dist/shortcuts/reception/operations/browsertool.js +58 -0
  219. package/dist/shortcuts/reception/operations/compose.js +129 -0
  220. package/dist/shortcuts/reception/operations/customparams.js +74 -0
  221. package/dist/shortcuts/reception/operations/doc.js +238 -0
  222. package/dist/shortcuts/reception/operations/docrender.js +36 -0
  223. package/dist/shortcuts/reception/operations/panels.js +179 -0
  224. package/dist/shortcuts/reception/operations/registry.js +26 -0
  225. package/dist/shortcuts/reception/operations/render-assets.js +184 -0
  226. package/dist/shortcuts/reception/operations/render.js +123 -0
  227. package/dist/shortcuts/reception/operations/runs.js +38 -0
  228. package/dist/shortcuts/reception/operations/schedule.js +127 -0
  229. package/dist/shortcuts/reception/operations/shared.js +196 -0
  230. package/dist/shortcuts/reception/operations/snapshot.js +68 -0
  231. package/dist/shortcuts/reception/operations/types.js +1 -0
  232. package/dist/shortcuts/reception/operations.js +33 -0
  233. package/dist/shortcuts/reception/upload.js +218 -0
  234. package/dist/shortcuts/recruit-stage/context.js +231 -0
  235. package/dist/shortcuts/recruit-stage/continuation.js +74 -0
  236. package/dist/shortcuts/recruit-stage/errors.js +65 -0
  237. package/dist/shortcuts/recruit-stage/host.js +109 -0
  238. package/dist/shortcuts/recruit-stage/index.js +115 -0
  239. package/dist/shortcuts/recruit-stage/manifest.js +29 -0
  240. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +722 -0
  241. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +269 -0
  242. package/dist/shortcuts/recruit-stage/operations/jd-create.js +719 -0
  243. package/dist/shortcuts/recruit-stage/operations/list.js +431 -0
  244. package/dist/shortcuts/recruit-stage/operations/registry.js +38 -0
  245. package/dist/shortcuts/recruit-stage/operations/resume-import.js +1354 -0
  246. package/dist/shortcuts/recruit-stage/operations/search.js +158 -0
  247. package/dist/shortcuts/recruit-stage/operations/types.js +25 -0
  248. package/dist/shortcuts/recruit-stage/school-tiers.json +318 -0
  249. package/dist/shortcuts/recruit-stage/shared.js +608 -0
  250. package/dist/shortcuts/workflow/continuation.js +2 -1
  251. package/dist/shortcuts/workflow/index.js +2 -0
  252. package/dist/shortcuts/workflow/operations/form.js +32 -8
  253. package/dist/shortcuts/workflow/operations/todoSmartConvert/detailFieldRules.js +4 -2
  254. package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +13 -6
  255. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailCache.js +17 -24
  256. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailFetcher.js +14 -9
  257. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +50 -8
  258. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +2 -1
  259. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.detail.js +17 -11
  260. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +7 -39
  261. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +3 -2
  262. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +51 -15
  263. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.pipeline.js +16 -1
  264. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +151 -63
  265. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.subGroup.js +56 -0
  266. package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +39 -14
  267. package/dist/shortcuts/workflow/operations/write.js +1 -1
  268. package/docs/_catalog.md +3 -0
  269. package/docs/agent-invoice.md +1 -1
  270. package/docs/archive-oa.md +1 -1
  271. package/docs/caizhilian.md +1 -1
  272. package/docs/calendar.md +1 -1
  273. package/docs/contract.md +1 -1
  274. package/docs/e10-auth.md +23 -1
  275. package/docs/ehr.md +2 -2
  276. package/docs/esb.md +1 -1
  277. package/docs/im.md +1 -1
  278. package/docs/invoice.md +8 -12
  279. package/docs/okr.md +1 -1
  280. package/docs/operation-manual.md +8 -0
  281. package/docs/reception.md +119 -0
  282. package/package.json +1 -1
  283. package/scripts/clean.mjs +43 -2
  284. package/scripts/install-skill-to-xiaoe.mjs +105 -0
  285. package/scripts/package-skill.mjs +4 -2
  286. package/skill-template/business-info.json +42 -2
  287. package/skill-template/domains/caizhilian.md +1 -1
  288. package/skill-template/domains/reception-flow.md +18 -0
  289. package/skill-template/domains/recruit-stage.md +29 -0
  290. package/skill-template/domains/yepiaotong.md +4 -7
  291. package/skills/weaver-e10-archive-oa/references/source-manifest.json +14 -14
  292. package/skills/weaver-e10-blog/references/blog-publish.md +1 -1
  293. package/skills/weaver-e10-blog/references/source-manifest.json +7 -7
  294. package/skills/weaver-e10-caizhilian/references/source-manifest.json +21 -21
  295. package/skills/weaver-e10-caizhilian/references/write-protocol.md +2 -2
  296. package/skills/weaver-e10-calendar/SKILL.md +2 -1
  297. package/skills/weaver-e10-calendar/references/calendar-write.md +55 -1
  298. package/skills/weaver-e10-cowork/SKILL.md +1 -1
  299. package/skills/weaver-e10-cowork/references/cowork-write.md +3 -1
  300. package/skills/weaver-e10-ebuilder-form/SKILL.md +1 -1
  301. package/skills/weaver-e10-ebuilder-form/references/custom-api.md +1 -1
  302. package/skills/weaver-e10-ebuilder-form/references/openapi-write.md +1 -1
  303. package/skills/weaver-e10-esb/SKILL.md +2 -2
  304. package/skills/weaver-e10-esb/references/source-manifest.json +22 -22
  305. package/skills/weaver-e10-esb/references/trigger.md +2 -2
  306. package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +1 -1
  307. package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +1 -1
  308. package/skills/weaver-e10-jinchengda/references/contract-request-write.md +1 -1
  309. package/skills/weaver-e10-jinchengda/references/source-manifest.json +29 -29
  310. package/skills/weaver-e10-jucailin/SKILL.md +1 -1
  311. package/skills/weaver-e10-jucailin/references/attend-write.md +10 -2
  312. package/skills/weaver-e10-jucailin/references/hr-contact.md +8 -0
  313. package/skills/weaver-e10-jucailin/references/hr-report.md +8 -0
  314. package/skills/weaver-e10-jucailin/references/recruit-create.md +14 -5
  315. package/skills/weaver-e10-jucailin/references/recruit-read.md +1 -1
  316. package/skills/weaver-e10-jucailin/references/recruit-write.md +5 -4
  317. package/skills/weaver-e10-mail/SKILL.md +1 -1
  318. package/skills/weaver-e10-meeting/SKILL.md +39 -7
  319. package/skills/weaver-e10-meeting/references/meeting-change.md +1 -1
  320. package/skills/weaver-e10-meeting/references/meeting-create.md +1 -1
  321. package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +1 -1
  322. package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
  323. package/skills/weaver-e10-okr/references/okr-align.md +1 -1
  324. package/skills/weaver-e10-okr/references/okr-keyresult.md +1 -1
  325. package/skills/weaver-e10-okr/references/okr-write.md +1 -1
  326. package/skills/weaver-e10-okr/references/source-manifest.json +8 -8
  327. package/skills/weaver-e10-plan/references/plan-report-write.md +1 -1
  328. package/skills/weaver-e10-plan/references/source-manifest.json +20 -20
  329. package/skills/weaver-e10-qiyecheng/references/loan-management.md +1 -1
  330. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +18 -18
  331. package/skills/weaver-e10-reception-flow/SKILL.md +173 -0
  332. package/skills/weaver-e10-reception-flow/assets//350/241/214/347/250/213/345/215/225/346/250/241/346/235/277-/346/263/233/345/276/256.docx +0 -0
  333. package/skills/weaver-e10-reception-flow/data/fields-snapshot.json +213 -0
  334. package/skills/weaver-e10-reception-flow/references/browsertool.md +68 -0
  335. package/skills/weaver-e10-reception-flow/references/env-pitfalls.md +51 -0
  336. package/skills/weaver-e10-reception-flow/references/fields-snapshot.md +227 -0
  337. package/skills/weaver-e10-reception-flow/references/guide.md +179 -0
  338. package/skills/weaver-e10-reception-flow/scripts/locate.sh +14 -0
  339. package/skills/weaver-e10-reception-flow/scripts/render.py +724 -0
  340. package/skills/weaver-e10-recruit-stage/SKILL.md +230 -0
  341. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +119 -0
  342. package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +188 -0
  343. package/skills/weaver-e10-recruit-stage/lib/xiaoe-session.mjs +66 -0
  344. package/skills/weaver-e10-recruit-stage/references/position-templates.md +202 -0
  345. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +322 -0
  346. package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +127 -0
  347. package/skills/weaver-e10-recruit-stage/references/recruit-check-install.md +65 -0
  348. package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +63 -0
  349. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +142 -0
  350. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +95 -0
  351. package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +56 -0
  352. package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +101 -0
  353. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +148 -0
  354. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +77 -0
  355. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +59 -0
  356. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-creator.md +69 -0
  357. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +241 -0
  358. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +451 -0
  359. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +128 -0
  360. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +146 -0
  361. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +69 -0
  362. package/skills/weaver-e10-shared/SKILL.md +1 -1
  363. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +10 -2
  364. package/skills/weaver-e10-shijingran/SKILL.md +7 -6
  365. package/skills/weaver-e10-shijingran/references/operations.md +3 -1
  366. package/skills/weaver-e10-shijingran/references/source-manifest.json +30 -28
  367. package/skills/weaver-e10-shijingran/references/write-operations.md +2 -0
  368. package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +2 -0
  369. package/skills/weaver-e10-wenshuding/references/source-manifest.json +3 -3
  370. package/skills/weaver-e10-workflow/SKILL.md +4 -2
  371. package/skills/weaver-e10-workflow/aigroup/default.json +11 -9
  372. package/skills/weaver-e10-workflow/references/source-manifest.json +32 -32
  373. package/skills/weaver-e10-workflow/references/todo-smart-convert.md +23 -13
  374. package/skills/weaver-e10-workflow/tools/todo-summary.cjs +62 -20
  375. package/skills/weaver-e10-yepiaotong/SKILL.md +28 -36
  376. package/skills/weaver-e10-yepiaotong/references/invoice-agent-entry.md +6 -3
  377. package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +13 -10
  378. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +2 -0
  379. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +194 -155
  380. package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +28 -32
  381. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +5 -1
  382. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +8 -10
  383. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +211 -616
  384. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +149 -117
  385. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +17 -20
  386. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +20 -39
  387. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +55 -22
  388. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +7 -17
  389. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +88 -92
  390. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +144 -354
  391. package/skills/weaver-e10-yimiaoban/SKILL.md +1 -1
  392. package/skills/weaver-e10-yimiaoban/references/msg-write.md +1 -1
  393. package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +1 -1
  394. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
  395. package/dist/chunks/chunk-SPRHHSVC.js +0 -465
  396. package/dist/chunks/registry-KMHCPAAD.js +0 -22
  397. package/dist/shortcuts/invoice/markdown.js +0 -172
  398. package/dist/shortcuts/invoice/operations/issuing-qys.js +0 -424
  399. package/skills/weaver-e10-meeting.zip +0 -0
  400. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-examples.md +0 -131
  401. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-form-fill-rules.md +0 -179
@@ -1,5 +1,5 @@
1
- import { InvoiceCliError, invoiceConfirmationError, invoicePartialError, invoiceValidationError, isInvoiceNetworkError } from '../errors.js';
2
- import { asNonEmptyString, asObject, assertBusinessSuccess, normalizeIdList, objectFingerprint, reqBase, sessionMatches, workflow, } from './shared.js';
1
+ import { InvoiceCliError, invoiceValidationError } from '../errors.js';
2
+ import { asNonEmptyString, assertBusinessSuccess, normalizeIdList, workflow, } from './shared.js';
3
3
  function integerInput(value, name, options = {}) {
4
4
  const min = options.min ?? 1;
5
5
  const max = options.max ?? 200;
@@ -35,14 +35,28 @@ export function addCalendarDays(isoDate, offsetDays) {
35
35
  const [year, month, day] = isoDate.split('-').map(Number);
36
36
  return formatUtcDate(new Date(Date.UTC(year, (month ?? 1) - 1, (day ?? 1) + offsetDays)));
37
37
  }
38
+ /** 按日历月加减;目标月没有这一天时取该月最后一天。 */
39
+ export function addCalendarMonths(isoDate, offsetMonths) {
40
+ const [year, month, day] = isoDate.split('-').map(Number);
41
+ const target = new Date(Date.UTC(year, (month ?? 1) - 1 + offsetMonths, 1));
42
+ const lastDay = new Date(Date.UTC(target.getUTCFullYear(), target.getUTCMonth() + 1, 0)).getUTCDate();
43
+ target.setUTCDate(Math.min(day ?? 1, lastDay));
44
+ return formatUtcDate(target);
45
+ }
38
46
  /** 东八区日历日。 */
39
47
  export function shanghaiCalendarDate(offsetDays = 0, now = new Date()) {
40
48
  const today = new Intl.DateTimeFormat('en-CA', { timeZone: 'Asia/Shanghai' }).format(now);
41
49
  return offsetDays === 0 ? today : addCalendarDays(today, offsetDays);
42
50
  }
43
- /** 不传结束日用东八区当天;无论是否传入,发给接口前都再加 1 天。 */
44
- function requestCreateDateEnd(value) {
45
- return addCalendarDays(optionalDate(value, 'cusCreateDateEnd') ?? shanghaiCalendarDate(0), 1);
51
+ const REQUEST_DEFAULT_LOOKBACK_DAYS = 7;
52
+ const REQUEST_PHONE_LOOKBACK_DAYS = 90;
53
+ const REQUEST_SCENES = new Set(['phone']);
54
+ function requestScene(value) {
55
+ const scene = optionalString(value, 'scene');
56
+ if (scene !== undefined && !REQUEST_SCENES.has(scene)) {
57
+ throw invoiceValidationError('input_invalid', 'scene 只支持 "phone"(话费报销)');
58
+ }
59
+ return scene;
46
60
  }
47
61
  function responseData(value) {
48
62
  return value && typeof value === 'object' && 'data' in value ? value.data : value;
@@ -85,7 +99,7 @@ function projectRequestListResult(value) {
85
99
  return { ...record, data: record.data.map(projectRequestListItem) };
86
100
  }
87
101
  const UNSAFE_JSON_INTEGER_ID = /("id"\s*:\s*)(-?\d{16,})(?=\s*[,}\]])/g;
88
- export function quoteEmployeeIdsInJsonText(text) {
102
+ function quoteEmployeeIdsInJsonText(text) {
89
103
  return text.replace(UNSAFE_JSON_INTEGER_ID, '$1"$2"');
90
104
  }
91
105
  function employeeIdString(value) {
@@ -126,68 +140,6 @@ function stringifyEmployeeSuperiorsIds(value) {
126
140
  function employeeSuperiorsEnvelope(value) {
127
141
  return resultEnvelope(stringifyEmployeeSuperiorsIds(value), 'invoice.reim.employee-superiors');
128
142
  }
129
- const flowCreateFields = ['work_flow_id', 'mainFormId', 'request_name', 'main_fields', 'detail_rows', 'need_user_confirm', 'unable_to_fill'];
130
- const flowUpdateFields = ['requestId', 'mainFormId', 'main_fields', 'detail_rows', 'deleteDetailRows', 'need_user_confirm', 'unable_to_fill'];
131
- const flowMetaFields = new Set(['continuation', 'confirm']);
132
- function flowPayloadFromInput(input, allowedFields) {
133
- const source = asObject(input, 'input');
134
- if (source.payload !== undefined) {
135
- return { value: structuredClone(asObject(source.payload, 'payload')), prefix: 'payload.' };
136
- }
137
- const allowed = new Set(allowedFields);
138
- const value = {};
139
- for (const [key, item] of Object.entries(source)) {
140
- if (flowMetaFields.has(key))
141
- continue;
142
- if (!allowed.has(key))
143
- throw invoiceValidationError('input_invalid', `${key} 不是支持的报销单字段`);
144
- value[key] = item;
145
- }
146
- return { value: structuredClone(value), prefix: '' };
147
- }
148
- function ensureFlowCreatePayload(input) {
149
- const { value, prefix } = flowPayloadFromInput(input, flowCreateFields);
150
- asNonEmptyString(value.work_flow_id, `${prefix}work_flow_id`);
151
- asNonEmptyString(value.mainFormId, `${prefix}mainFormId`);
152
- asNonEmptyString(value.request_name, `${prefix}request_name`);
153
- if (!Array.isArray(value.main_fields))
154
- throw invoiceValidationError('input_invalid', `${prefix}main_fields 必须是数组`);
155
- if (!Array.isArray(value.detail_rows) || value.detail_rows.length === 0) {
156
- throw invoiceValidationError('input_invalid', `${prefix}detail_rows 必须是非空数组`);
157
- }
158
- return value;
159
- }
160
- function ensureFlowUpdatePayload(input) {
161
- const { value, prefix } = flowPayloadFromInput(input, flowUpdateFields);
162
- asNonEmptyString(value.requestId, `${prefix}requestId`);
163
- asNonEmptyString(value.mainFormId, `${prefix}mainFormId`);
164
- const hasMain = Array.isArray(value.main_fields) && value.main_fields.length > 0;
165
- const hasDetails = Array.isArray(value.detail_rows) && value.detail_rows.length > 0;
166
- const hasDeletes = Array.isArray(value.deleteDetailRows) && value.deleteDetailRows.length > 0;
167
- if (!hasMain && !hasDetails && !hasDeletes) {
168
- const target = prefix ? `${prefix}必须` : 'input 必须';
169
- throw invoiceValidationError('input_invalid', `${target}包含 main_fields、detail_rows 或 deleteDetailRows 至少一类变更`);
170
- }
171
- return value;
172
- }
173
- function flowPreview(payload) {
174
- return {
175
- requestName: payload.request_name || '',
176
- workflowId: payload.work_flow_id || '',
177
- mainFormId: payload.mainFormId || '',
178
- mainFieldCount: Array.isArray(payload.main_fields) ? payload.main_fields.length : 0,
179
- detailRowCount: Array.isArray(payload.detail_rows) ? payload.detail_rows.length : 0,
180
- };
181
- }
182
- function updatePreview(payload) {
183
- return {
184
- requestId: String(payload.requestId),
185
- mainFormId: payload.mainFormId,
186
- mainFieldCount: Array.isArray(payload.main_fields) ? payload.main_fields.length : 0,
187
- detailRowCount: Array.isArray(payload.detail_rows) ? payload.detail_rows.length : 0,
188
- deleteDetailRowCount: Array.isArray(payload.deleteDetailRows) ? payload.deleteDetailRows.length : 0,
189
- };
190
- }
191
143
  export class InvoiceReimFileOcrPreviewOperation {
192
144
  name = 'invoice.reim.file-ocr.preview';
193
145
  async execute(input, { host }) {
@@ -220,21 +172,41 @@ export class InvoiceReimFileOcrPreviewOperation {
220
172
  }
221
173
  export class InvoiceReimRequestsListOperation {
222
174
  name = 'invoice.reim.requests.list';
175
+ /**
176
+ * 发起日期窗口:结束日取传入值或东八区当天,发给接口前再加 1 天。
177
+ * 没传开始日时:话费(scene=phone)取结束日前 90 天;其他取结束日前 7 天,
178
+ * 第 1 页查不到再放宽到结束日前 1 个月。
179
+ */
223
180
  async execute(input, { host }) {
224
- const body = {
225
- pageNo: integerInput(input.pageNo, 'pageNo', { min: 1, max: 10000 }),
226
- pageSize: integerInput(input.pageSize, 'pageSize', { min: 1, max: 200, defaultValue: 100 }),
181
+ const pageNo = integerInput(input.pageNo, 'pageNo', { min: 1, max: 10000 });
182
+ const pageSize = integerInput(input.pageSize, 'pageSize', { min: 1, max: 200, defaultValue: 100 });
183
+ const requestname = optionalString(input.requestname, 'requestname');
184
+ const explicitStart = optionalDate(input.cusCreateDateStart, 'cusCreateDateStart');
185
+ const scene = requestScene(input.scene);
186
+ const endDate = optionalDate(input.cusCreateDateEnd, 'cusCreateDateEnd') ?? shanghaiCalendarDate(0);
187
+ const query = async (start) => {
188
+ const body = { pageNo, pageSize };
189
+ if (requestname !== undefined)
190
+ body.requestname = requestname;
191
+ body.cusCreateDateStart = start;
192
+ body.cusCreateDateEnd = addCalendarDays(endDate, 1);
193
+ const result = await host.invoiceRequest({ path: '/api/inc/book/getRequestListByTabId', method: 'POST', body, operation: this.name });
194
+ assertBusinessSuccess(result, `${this.name}_failed`, '接口返回业务失败');
195
+ return result;
227
196
  };
228
- for (const [key, value] of Object.entries({
229
- requestname: optionalString(input.requestname, 'requestname'),
230
- cusCreateDateStart: optionalDate(input.cusCreateDateStart, 'cusCreateDateStart'),
231
- cusCreateDateEnd: requestCreateDateEnd(input.cusCreateDateEnd),
232
- })) {
233
- if (value !== undefined)
234
- body[key] = value;
197
+ let start = explicitStart
198
+ ?? addCalendarDays(endDate, -(scene === 'phone' ? REQUEST_PHONE_LOOKBACK_DAYS : REQUEST_DEFAULT_LOOKBACK_DAYS));
199
+ let widened = false;
200
+ let result = await query(start);
201
+ if (explicitStart === undefined && scene === undefined && pageNo === 1
202
+ && Array.isArray(result?.data) && result.data.length === 0) {
203
+ start = addCalendarMonths(endDate, -1);
204
+ widened = true;
205
+ result = await query(start);
235
206
  }
236
- const result = await host.invoiceRequest({ path: '/api/inc/book/getRequestListByTabId', method: 'POST', body, operation: this.name });
237
- return resultEnvelope(projectRequestListResult(result), 'invoice.reim.requests.list');
207
+ const envelope = resultEnvelope(projectRequestListResult(result), this.name);
208
+ envelope.data.query = { cusCreateDateStart: start, cusCreateDateEnd: endDate, widened };
209
+ return envelope;
238
210
  }
239
211
  }
240
212
  export class InvoiceReimWorkflowResolveOperation {
@@ -257,87 +229,6 @@ export class InvoiceReimWorkflowResolveOperation {
257
229
  return resultEnvelope(result, 'invoice.reim.workflow.resolve');
258
230
  }
259
231
  }
260
- export class InvoiceReimFormStructureOperation {
261
- name = 'invoice.reim.form.structure';
262
- async execute(input, { host }) {
263
- const result = await host.invoiceRequest({
264
- path: '/api/inc/book/getFormStructure',
265
- method: 'GET',
266
- query: {
267
- workflowId: asNonEmptyString(input.workflowId, 'workflowId'),
268
- nodeId: optionalString(input.nodeId, 'nodeId') || '1',
269
- },
270
- operation: this.name,
271
- });
272
- return resultEnvelope(result, 'invoice.reim.form.structure');
273
- }
274
- }
275
- export class InvoiceReimRowInfoOperation {
276
- name = 'invoice.reim.row-info';
277
- async execute(input, { host }) {
278
- const session = await host.getSession();
279
- const result = await host.invoiceFormRequest({
280
- path: '/api/secondev/fna/expense/dataInfo/getRowInfo',
281
- method: 'POST',
282
- query: { sf_request_type: 'fetch' },
283
- fields: {
284
- cdzt: optionalString(input.cdzt, 'cdzt') || session.userId,
285
- requestid: input.requestid === undefined ? '' : String(input.requestid),
286
- invoiceId: asNonEmptyString(input.invoiceId, 'invoiceId'),
287
- },
288
- operation: this.name,
289
- });
290
- return resultEnvelope(result, 'invoice.reim.row-info');
291
- }
292
- }
293
- export class InvoiceReimRowInfoBatchOperation {
294
- name = 'invoice.reim.row-info-batch';
295
- async execute(input, { host }) {
296
- const invoiceIds = normalizeIdList(input.invoiceIds, 'invoiceIds');
297
- const session = await host.getSession();
298
- const cdzt = optionalString(input.cdzt, 'cdzt') || session.userId;
299
- const requestid = input.requestid === undefined ? '' : String(input.requestid);
300
- const results = [];
301
- const CONCURRENCY = 4;
302
- let cursor = 0;
303
- const workers = Array.from({ length: Math.min(CONCURRENCY, invoiceIds.length) }, async () => {
304
- while (cursor < invoiceIds.length) {
305
- const index = cursor;
306
- cursor += 1;
307
- const invoiceId = invoiceIds[index];
308
- try {
309
- const result = await host.invoiceFormRequest({
310
- path: '/api/secondev/fna/expense/dataInfo/getRowInfo',
311
- method: 'POST',
312
- query: { sf_request_type: 'fetch' },
313
- fields: { cdzt, requestid, invoiceId },
314
- operation: this.name,
315
- });
316
- assertBusinessSuccess(result, 'reim_row_info_failed', `获取发票 ${invoiceId} 行预填失败`);
317
- const data = result && typeof result === 'object' && 'data' in result ? result.data : result;
318
- results[index] = { invoiceId, status: 'success', data: data };
319
- }
320
- catch (error) {
321
- const message = error instanceof Error ? error.message : '未知错误';
322
- results[index] = { invoiceId, status: 'fail', error: message };
323
- }
324
- }
325
- });
326
- await Promise.all(workers);
327
- const succeeded = results.filter(r => r.status === 'success');
328
- const failed = results.filter(r => r.status === 'fail');
329
- return {
330
- status: failed.length === results.length ? 'PARTIAL' : 'COMPLETE',
331
- data: {
332
- results,
333
- succeeded: succeeded.length,
334
- failed: failed.length,
335
- total: results.length,
336
- workflow: workflow('invoice.reim.row-info-batch', failed.length ? 'PARTIAL' : 'COMPLETE'),
337
- },
338
- };
339
- }
340
- }
341
232
  export class InvoiceReimEmployeeSuperiorsOperation {
342
233
  name = 'invoice.reim.employee-superiors';
343
234
  async execute(_input, { host }) {
@@ -398,183 +289,3 @@ export class InvoiceReimFieldSearchOperation {
398
289
  };
399
290
  }
400
291
  }
401
- export class InvoiceReimFlowCreatePrepareOperation {
402
- name = 'invoice.reim.flow.create.prepare';
403
- async execute(input, { host, continuation }) {
404
- const payload = ensureFlowCreatePayload(input);
405
- // 挂单预检:提取 detail_rows 中的 invoiceId,查询是否已被其他报销单关联
406
- const invoiceIds = payload.detail_rows
407
- .map((row) => row?.invoiceId)
408
- .filter((id) => typeof id === 'string' && id.trim() !== '');
409
- const assignedWarnings = [];
410
- if (invoiceIds.length > 0) {
411
- try {
412
- const detailResult = await host.invoiceRequest({
413
- path: '/api/inc/get',
414
- method: 'POST',
415
- body: { ids: invoiceIds, mask: 0, userFlag: '1', isDelFlag: '1', req_base: reqBase() },
416
- operation: 'invoice.reim.flow.create.prepare',
417
- });
418
- const infos = Array.isArray(detailResult?.infos) ? detailResult.infos : [];
419
- for (const entry of infos) {
420
- if (entry?.ret?.ret !== 0 || !entry.info)
421
- continue;
422
- const info = entry.info;
423
- const fid = String(info.fid ?? info.id ?? '');
424
- const number = String(info.number ?? fid);
425
- const listReim = info?.oreim?.list_reim;
426
- if (Array.isArray(listReim) && listReim.length > 0) {
427
- const names = listReim
428
- .map((r) => typeof r?.name === 'string' ? r.name : '')
429
- .filter((n) => n.trim())
430
- .join('、');
431
- assignedWarnings.push(`发票 ${number} 已挂在报销单:${names || '(未知)'},继续创建可能导致重复报销`);
432
- }
433
- }
434
- }
435
- catch {
436
- // 预检失败不阻断主流程
437
- }
438
- }
439
- const session = await host.getSession();
440
- const continuationToken = await continuation.issue({
441
- operation: 'invoice.reim.flow.create.apply',
442
- workflow: workflow('invoice.reim.flow.create', 'AWAITING_CONFIRMATION'),
443
- baseUrl: session.baseUrl,
444
- profile: session.profile,
445
- userId: session.userId,
446
- fingerprint: objectFingerprint(payload),
447
- preview: flowPreview(payload),
448
- });
449
- return {
450
- status: 'AWAITING_CONFIRMATION',
451
- data: {
452
- preview: flowPreview(payload),
453
- continuation: continuationToken,
454
- expiresInSeconds: 600,
455
- warnings: assignedWarnings.length > 0 ? assignedWarnings : undefined,
456
- workflow: workflow('invoice.reim.flow.create', 'AWAITING_CONFIRMATION'),
457
- },
458
- };
459
- }
460
- }
461
- export class InvoiceReimFlowCreateApplyOperation {
462
- name = 'invoice.reim.flow.create.apply';
463
- async execute(input, { host, continuation }) {
464
- if (input.confirm !== true)
465
- throw invoiceConfirmationError('invoice.reim.flow.create.apply', { hint: '重新调用时传入 confirm=true' });
466
- const lease = await continuation.verify(input.continuation, 'invoice.reim.flow.create.apply');
467
- const payload = ensureFlowCreatePayload(input);
468
- if (typeof lease.fingerprint !== 'string')
469
- throw invoiceValidationError('continuation_invalid', '报销单创建 continuation 缺少报销单指纹');
470
- if (objectFingerprint(payload) !== lease.fingerprint)
471
- throw invoiceValidationError('target_changed', '报销单载荷与确认时不一致,请重新准备');
472
- const session = await host.getSession();
473
- if (!sessionMatches(lease, session))
474
- throw invoiceValidationError('context_mismatch', '确认上下文已变化,请重新准备报销单创建');
475
- let result;
476
- try {
477
- result = await host.invoiceRequest({ path: '/api/inc/book/createFlowNew', method: 'POST', body: payload, operation: this.name, timeoutMs: 90_000 });
478
- }
479
- catch (error) {
480
- if (isInvoiceNetworkError(error)) {
481
- throw invoicePartialError('报销单创建请求发送后连接中断,结果不确定,禁止自动重试', {
482
- preview: lease.preview,
483
- workflow: workflow('invoice.reim.flow.create', 'EXECUTING'),
484
- }, { stage: 'reim-flow-create' });
485
- }
486
- throw error;
487
- }
488
- assertBusinessSuccess(result, 'reim_flow_create_failed', '报销单创建失败');
489
- const requestId = result?.data?.requestId || result?.requestId;
490
- if (!requestId) {
491
- throw invoicePartialError('报销单创建接口返回成功但缺少 requestId,结果不确定', {
492
- preview: lease.preview,
493
- result,
494
- workflow: workflow('invoice.reim.flow.create', 'VERIFYING'),
495
- }, { stage: 'reim-flow-create-response' });
496
- }
497
- const sessionContext = await host.getSession();
498
- return {
499
- status: 'COMPLETE',
500
- data: {
501
- requestId: String(requestId),
502
- requestName: payload.request_name,
503
- viewUrl: `${sessionContext.baseUrl}/sp/workflow/flowpage/view/${requestId}`,
504
- result,
505
- workflow: workflow('invoice.reim.flow.create', 'COMPLETE'),
506
- },
507
- };
508
- }
509
- }
510
- export class InvoiceReimFlowUpdatePrepareOperation {
511
- name = 'invoice.reim.flow.update.prepare';
512
- async execute(input, { host, continuation }) {
513
- const payload = ensureFlowUpdatePayload(input);
514
- const session = await host.getSession();
515
- const continuationToken = await continuation.issue({
516
- operation: 'invoice.reim.flow.update.apply',
517
- workflow: workflow('invoice.reim.flow.update', 'AWAITING_CONFIRMATION'),
518
- baseUrl: session.baseUrl,
519
- profile: session.profile,
520
- userId: session.userId,
521
- fingerprint: objectFingerprint(payload),
522
- preview: updatePreview(payload),
523
- });
524
- return {
525
- status: 'AWAITING_CONFIRMATION',
526
- data: {
527
- preview: updatePreview(payload),
528
- continuation: continuationToken,
529
- expiresInSeconds: 600,
530
- workflow: workflow('invoice.reim.flow.update', 'AWAITING_CONFIRMATION'),
531
- },
532
- };
533
- }
534
- }
535
- export class InvoiceReimFlowUpdateApplyOperation {
536
- name = 'invoice.reim.flow.update.apply';
537
- async execute(input, { host, continuation }) {
538
- if (input.confirm !== true)
539
- throw invoiceConfirmationError('invoice.reim.flow.update.apply', { hint: '重新调用时传入 confirm=true' });
540
- const lease = await continuation.verify(input.continuation, 'invoice.reim.flow.update.apply');
541
- const payload = ensureFlowUpdatePayload(input);
542
- if (typeof lease.fingerprint !== 'string')
543
- throw invoiceValidationError('continuation_invalid', '报销单更新 continuation 缺少报销单指纹');
544
- if (objectFingerprint(payload) !== lease.fingerprint)
545
- throw invoiceValidationError('target_changed', '报销单更新载荷与确认时不一致,请重新准备');
546
- const session = await host.getSession();
547
- if (!sessionMatches(lease, session))
548
- throw invoiceValidationError('context_mismatch', '确认上下文已变化,请重新准备报销单更新');
549
- let result;
550
- try {
551
- result = await host.invoiceRequest({ path: '/api/inc/book/updateFlow', method: 'POST', body: payload, operation: this.name, timeoutMs: 90_000 });
552
- }
553
- catch (error) {
554
- if (isInvoiceNetworkError(error)) {
555
- throw invoicePartialError('报销单更新请求发送后连接中断,结果不确定,禁止自动重试', {
556
- preview: lease.preview,
557
- workflow: workflow('invoice.reim.flow.update', 'EXECUTING'),
558
- }, { stage: 'reim-flow-update' });
559
- }
560
- throw error;
561
- }
562
- assertBusinessSuccess(result, 'reim_flow_update_failed', '报销单更新失败');
563
- const data = result?.data || {};
564
- if (data.deleteDetailSuccess === false || data.updateFormSuccess === false) {
565
- throw invoicePartialError('报销单更新返回部分失败,可能已有部分变更生效', {
566
- preview: lease.preview,
567
- result,
568
- workflow: workflow('invoice.reim.flow.update', 'VERIFYING'),
569
- }, { stage: 'reim-flow-update-response' });
570
- }
571
- return {
572
- status: 'COMPLETE',
573
- data: {
574
- requestId: String(payload.requestId),
575
- result,
576
- workflow: workflow('invoice.reim.flow.update', 'COMPLETE'),
577
- },
578
- };
579
- }
580
- }
@@ -3,6 +3,7 @@ import { existsSync } from 'node:fs';
3
3
  import { readFile, stat, writeFile } from 'node:fs/promises';
4
4
  import { dirname, extname, basename, resolve } from 'node:path';
5
5
  import { InvoiceCliError, invoiceValidationError, } from '../errors.js';
6
+ import { FULL_EXT_MASK, invoiceExtInfo, invoiceRecordOf } from '../invoice-record.js';
6
7
  const LIST_FIELDS = new Set([
7
8
  'page_size',
8
9
  'start_pos',
@@ -752,8 +753,22 @@ export async function previewOcr(upload, host) {
752
753
  }
753
754
  return { results, invoices };
754
755
  }
756
+ /** 全额红冲发票(`comm_info.pro.status === 8`)不可报销,查询发票时一律不返回。 */
757
+ export function isRedReversedInvoice(record) {
758
+ const raw = record?.comm_info?.pro?.status;
759
+ return (typeof raw === 'number' ? raw : Number(raw ?? 0)) === 8;
760
+ }
755
761
  export async function listInvoices(input, host, flag) {
756
- const body = { flag, page_size: 10, start_pos: 0, req_type: 1, sreim: '3', bill_type: 0, req_base: reqBase() };
762
+ const body = {
763
+ flag,
764
+ page_size: 10,
765
+ start_pos: 0,
766
+ req_type: 1,
767
+ sreim: '3',
768
+ bill_type: 0,
769
+ mext: FULL_EXT_MASK,
770
+ req_base: reqBase(),
771
+ };
757
772
  for (const [key, value] of Object.entries(input)) {
758
773
  if (key === 'flag')
759
774
  continue;
@@ -763,10 +778,12 @@ export async function listInvoices(input, host, flag) {
763
778
  }
764
779
  const session = await host.getSession();
765
780
  const result = await host.invoiceRequest({ path: '/api/inc/sync', method: 'POST', body });
766
- const items = (result.infos || []).map((item) => {
767
- const fid = item?.fid ?? item?.id;
781
+ const items = (result.infos || []).filter((item) => !isRedReversedInvoice(invoiceRecordOf(item))).map((item) => {
782
+ const record = invoiceRecordOf(item);
783
+ const fid = record.fid ?? record.id;
768
784
  if (fid)
769
- item.detailUrl = invoiceDetailUrl(session.baseUrl, String(fid));
785
+ record.detailUrl = invoiceDetailUrl(session.baseUrl, String(fid));
786
+ record.extInfo = invoiceExtInfo(record);
770
787
  return item;
771
788
  });
772
789
  return {
@@ -1,3 +1,4 @@
1
+ import { CONTINUATION_TTL_SECONDS } from '../../../core/continuation-ttl.js';
1
2
  import { invoiceConfirmationError, invoicePartialError, invoiceValidationError, isInvoiceNetworkError } from '../errors.js';
2
3
  import { applyChanges, assertEditable, changePreview, detailInfo, getDetail, normalizeChanges, normalizeScope, objectFingerprint, operateType, preview, reqBase, sessionMatches, stripForbiddenKeys, verifyChangedFields, workflow, } from './shared.js';
3
4
  export class InvoiceUpdatePrepareOperation {
@@ -26,7 +27,7 @@ export class InvoiceUpdatePrepareOperation {
26
27
  });
27
28
  return {
28
29
  status: 'AWAITING_CONFIRMATION',
29
- data: { invoice: preview(info, session.baseUrl), changes: diffs, continuation: continuationToken, expiresInSeconds: 600, workflow: workflow('invoice.update', 'AWAITING_CONFIRMATION') },
30
+ data: { invoice: preview(info, session.baseUrl), changes: diffs, continuation: continuationToken, expiresInSeconds: CONTINUATION_TTL_SECONDS, workflow: workflow('invoice.update', 'AWAITING_CONFIRMATION') },
30
31
  };
31
32
  }
32
33
  }
@@ -1,19 +1,5 @@
1
1
  import { invoiceValidationError } from './errors.js';
2
- /**
3
- * invoice 域的输出投影:把面向程序的完整 envelope 裁成面向阅读的视图。
4
- *
5
- * 背景:`invoice.list` 单条发票有 40+ 字段(`custom_field_*`、`rb`、`oa` 等对调用方无用),
6
- * 10 条即 35KB。调用方要拿到"号码/金额/购销方"就得自己写解析脚本。
7
- * 本模块提供三个出口,让 CLI 直接给出可读结果:
8
- *
9
- * - `--view summary`:语义化平表(仅 list 类 operation,字段口径与 `invoice.reim.candidates.list` 一致)
10
- * - `--view detail`:单张发票的语义详情(仅 `invoice.get`),summary 字段 + 附件/费用说明/查验标记
11
- * - `--fields a,b.c`:通用点路径投影,点路径必须存在于原结构(最小惊讶)
12
- *
13
- * 另有 `--format markdown`(见 markdown.ts):把上面的语义视图渲染成 markdown 文本,
14
- * 属于"渲染档"而非数据档,与 `--json` 互斥。
15
- */
16
- import { assertMarkdownSupported, markdownViewFor, normalizeFormat, } from './markdown.js';
2
+ import { EXT_INFO_FIELDS, invoiceExtInfo, invoiceRecordOf, parseInvoiceExt } from './invoice-record.js';
17
3
  /** `--view summary` 支持的 operation:data 结构里含发票列表 items 的读取类操作。 */
18
4
  export const SUMMARY_OPERATIONS = new Set(['invoice.list', 'invoice.enterprise.list']);
19
5
  /** `--view detail` 支持的 operation:data 结构里含 `infos[]`(每条带 info 包装)的详情类操作。 */
@@ -22,6 +8,7 @@ export const OUTPUT_VIEWS = ['full', 'summary', 'detail'];
22
8
  /**
23
9
  * summary 视图保留的语义字段。命名与 `invoice.reim.candidates.list` 的 items 对齐
24
10
  * (`buyer` = 购买方,`payer` = 销售方),避免同一业务概念在不同 operation 里换名。
11
+ * `EXT_INFO_FIELDS` 来自票面 `ext`(费用说明、城市、备注、起止地等)。
25
12
  */
26
13
  export const SUMMARY_ITEM_FIELDS = [
27
14
  'fid',
@@ -36,6 +23,7 @@ export const SUMMARY_ITEM_FIELDS = [
36
23
  'buyerTaxNo',
37
24
  'payer',
38
25
  'payerTaxNo',
26
+ ...EXT_INFO_FIELDS,
39
27
  'valid',
40
28
  'status',
41
29
  'reimState',
@@ -58,7 +46,8 @@ function numberOrUndefined(value) {
58
46
  * 把一条原始发票对象裁成语义摘要。空值(`''` / `null` / 空数组)直接省键,
59
47
  * 票面本身就有的 `'0'`(如税额)保留,避免制造"字段不存在"的歧义。
60
48
  */
61
- export function summarizeInvoiceItem(item) {
49
+ export function summarizeInvoiceItem(raw) {
50
+ const item = invoiceRecordOf(raw);
62
51
  const comm = asRecord(item.comm_info);
63
52
  const pro = asRecord(comm.pro);
64
53
  const price = asRecord(comm.price);
@@ -79,6 +68,7 @@ export function summarizeInvoiceItem(item) {
79
68
  buyerTaxNo: text(buyer.tcode),
80
69
  payer: text(payer.company),
81
70
  payerTaxNo: text(payer.tcode),
71
+ ...invoiceExtInfo(item),
82
72
  valid: numberOrUndefined(pro.valid),
83
73
  status: numberOrUndefined(pro.status),
84
74
  reimState: numberOrUndefined(pro.sreim),
@@ -108,25 +98,11 @@ export function summarizeListData(data) {
108
98
  }
109
99
  /**
110
100
  * detail 视图比 summary 多出来的语义字段:
111
- * 附件清单、票面费用说明、开票人、查验标记(`is_valid`,与票面 `valid` 不是一个口径)。
101
+ * 附件清单、开票人、查验标记(`is_valid`,与票面 `valid` 不是一个口径)。费用说明已在 summary 里。
112
102
  */
113
- export const DETAIL_EXTRA_FIELDS = ['expenseNote', 'issuer', 'checkState', 'attachments'];
103
+ export const DETAIL_EXTRA_FIELDS = ['issuer', 'checkState', 'attachments'];
114
104
  /** `--view detail` 下 items 的字段集:summary 语义字段 + detail 附加字段。 */
115
105
  export const DETAIL_ITEM_FIELDS = [...SUMMARY_ITEM_FIELDS, ...DETAIL_EXTRA_FIELDS];
116
- /** `info.ext` 是**字符串化的 JSON**(票面扩展字段),解析失败按空对象处理,不让脏数据打断输出。 */
117
- function parseExt(value) {
118
- if (value && typeof value === 'object')
119
- return asRecord(value);
120
- const raw = text(value);
121
- if (!raw)
122
- return {};
123
- try {
124
- return asRecord(JSON.parse(raw));
125
- }
126
- catch {
127
- return {};
128
- }
129
- }
130
106
  function attachmentOf(entry) {
131
107
  const record = asRecord(entry);
132
108
  return {
@@ -148,10 +124,7 @@ export function summarizeInvoiceDetailItem(wrapper) {
148
124
  detailUrl: info.detailUrl ?? wrapper.detailUrl,
149
125
  }),
150
126
  };
151
- const ext = parseExt(info.ext);
152
- const expenseNote = text(ext.expenseDesc);
153
- if (expenseNote)
154
- detail.expenseNote = expenseNote;
127
+ const ext = parseInvoiceExt(info.ext);
155
128
  const issuer = text(ext.issuer);
156
129
  if (issuer)
157
130
  detail.issuer = issuer;
@@ -233,29 +206,6 @@ export function normalizeView(value) {
233
206
  }
234
207
  return view;
235
208
  }
236
- /**
237
- * 把投影参数解析成"最终生效的视图"。`--format markdown` 是渲染档,
238
- * 自带字段口径,因此由 operation 决定视图(list 类 → summary,详情类 → detail);
239
- * 此时若显式传了别的视图属于口径冲突,直接报错而不是悄悄忽略。
240
- */
241
- export function resolveView(operation, projection) {
242
- const { view, fields, format } = projection;
243
- if (format !== 'markdown')
244
- return view ?? 'full';
245
- assertMarkdownSupported(operation, format);
246
- const expected = markdownViewFor(operation);
247
- if (fields?.length) {
248
- throw invoiceValidationError('input_conflict', '--format markdown 自带字段口径,不接受 --fields;要自定义字段请用 --fields 输出 JSON');
249
- }
250
- if (view && view !== expected) {
251
- throw invoiceValidationError('input_conflict', `--format markdown 固定使用 ${expected} 视图,与 --view ${view} 冲突`);
252
- }
253
- return expected;
254
- }
255
- /** 供 CLI 侧解析 `--format`。 */
256
- export function formatFrom(value) {
257
- return normalizeFormat(value);
258
- }
259
209
  /**
260
210
  * 在发起业务请求**之前**校验投影参数是否可用。
261
211
  * 参数写错就该立刻反馈,而不是先打一次网络请求再报 view_unsupported ——
@@ -272,8 +222,6 @@ export function assertProjectionSupported(operation, projection) {
272
222
  if (view === 'detail' && !DETAIL_OPERATIONS.has(operation)) {
273
223
  throw invoiceValidationError('view_unsupported', `${operation} 不支持 --view detail(仅 ${[...DETAIL_OPERATIONS].join('、')})`);
274
224
  }
275
- // 渲染档的可用性与冲突同样要在请求前判掉(resolveView 内含格式白名单校验)。
276
- resolveView(operation, projection);
277
225
  }
278
226
  /**
279
227
  * 应用投影。返回新的 data 与要写进 envelope `meta` 的说明,
@@ -282,7 +230,7 @@ export function assertProjectionSupported(operation, projection) {
282
230
  export function applyInvoiceProjection(operation, data, projection) {
283
231
  assertProjectionSupported(operation, projection);
284
232
  const { fields } = projection;
285
- const view = resolveView(operation, projection);
233
+ const view = projection.view ?? 'full';
286
234
  const activeMeta = (base) => ({
287
235
  projection: { view, ...base },
288
236
  });
@@ -1,3 +1,4 @@
1
+ import { CONTINUATION_TTL_MS } from '../../core/continuation-ttl.js';
1
2
  import { createHmac, randomBytes, timingSafeEqual } from 'node:crypto';
2
3
  import { existsSync } from 'node:fs';
3
4
  import { chmod, mkdir, readFile, writeFile } from 'node:fs/promises';
@@ -35,7 +36,7 @@ function signature(payload, key) {
35
36
  }
36
37
  export function createJiuchuanhuiContinuationSigner(ctx) {
37
38
  return {
38
- async issue(payload, ttlMs = 10 * 60_000) {
39
+ async issue(payload, ttlMs = CONTINUATION_TTL_MS) {
39
40
  const issuedAt = Date.now();
40
41
  const body = encode({ ...payload, issuedAt, expiresAt: issuedAt + ttlMs });
41
42
  const sig = signature(body, await loadKey(ctx));