weaver-work-cli 0.1.42 → 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 (318) hide show
  1. package/README.md +17 -0
  2. package/dist/chunks/{archive-J4I6MCKF.js → archive-P6TBQGKL.js} +13 -5
  3. package/dist/chunks/{archive-oa-BRZKKTO4.js → archive-oa-7TQ2NXOH.js} +12 -5
  4. package/dist/chunks/{asset-L7D4FAOZ.js → asset-3ELRG37G.js} +11 -4
  5. package/dist/chunks/{asset-idle-DADLLV75.js → asset-idle-WIGMUFMD.js} +7 -3
  6. package/dist/chunks/{attachment-content-K4C7VLWQ.js → attachment-content-E3276UOV.js} +5 -4
  7. package/dist/chunks/{blog-BVGQ7NZL.js → blog-C5NMZAAC.js} +11 -4
  8. package/dist/chunks/{caizhilian-SAADNFD6.js → caizhilian-5XSM2DFP.js} +13 -6
  9. package/dist/chunks/{calendar-Q7NQY5Z2.js → calendar-FI2WNSBO.js} +12 -5
  10. package/dist/chunks/{chunk-YRSZQUD2.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-EKWAQSLU.js → chunk-BCVYBYYT.js} +432 -2248
  16. package/dist/chunks/{chunk-W7BEHOSR.js → chunk-CWYGFU5B.js} +2 -2
  17. package/dist/chunks/{chunk-NOODWMCL.js → chunk-D4ADSZ7H.js} +1 -1
  18. package/dist/chunks/{chunk-SA6VBIHY.js → chunk-ETNJSKMM.js} +214 -16
  19. package/dist/chunks/{chunk-BBKDXQEC.js → chunk-F4E4EM35.js} +3 -3
  20. package/dist/chunks/{chunk-IZ7S7QUS.js → chunk-FAZTGX7S.js} +6 -6
  21. package/dist/chunks/{chunk-NKZRQXST.js → chunk-FRZKBMSW.js} +52 -36
  22. package/dist/chunks/{chunk-BYBSCN4X.js → chunk-G7PQWD4L.js} +6 -3
  23. package/dist/chunks/{chunk-GEWYMQME.js → chunk-GAMZLAG2.js} +1 -1
  24. package/dist/chunks/{chunk-R4CHUSKC.js → chunk-GM6J7Q4B.js} +4 -4
  25. package/dist/chunks/{chunk-APVFJUQH.js → chunk-GRDRG6HP.js} +3 -3
  26. package/dist/chunks/{chunk-LDZQPUIA.js → chunk-HIT4Y6OI.js} +1 -1
  27. package/dist/chunks/{chunk-EZALDOQH.js → chunk-HP7JIYMT.js} +5 -2
  28. package/dist/chunks/{chunk-LADPYOWC.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-BIPYLLVS.js → chunk-N4M2DDFE.js} +15 -15
  32. package/dist/chunks/{chunk-QKNKR4RH.js → chunk-OF4S23UB.js} +4 -4
  33. package/dist/chunks/{chunk-JPRO6ER2.js → chunk-PC7VKEB5.js} +57 -60
  34. package/dist/chunks/{chunk-4PD5NWAX.js → chunk-PUQS5MWL.js} +2 -2
  35. package/dist/chunks/{chunk-2LV74IWP.js → chunk-Q4OYAQYH.js} +1 -1
  36. package/dist/chunks/{chunk-72CKAUAG.js → chunk-QVSWRLLU.js} +7 -5
  37. package/dist/chunks/{chunk-4RAE6JXP.js → chunk-TA7FXXJD.js} +6 -3
  38. package/dist/chunks/{chunk-GPMFD4RD.js → chunk-TXUG266F.js} +1 -1
  39. package/dist/chunks/{chunk-FOAA27U5.js → chunk-UFIT2UU3.js} +16 -4
  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-G4UR6NXN.js → chunk-WSF4NNMR.js} +3 -3
  44. package/dist/chunks/chunk-XHK4MDR5.js +2497 -0
  45. package/dist/chunks/{chunk-3KTFS4IA.js → chunk-XNIK66I4.js} +19 -9
  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-GHXCDPTM.js → chunk-Z7VYWPZV.js} +1 -1
  49. package/dist/chunks/{conflict-F2OMZRTO.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-5BETHRSG.js → contract-DNIIW5VJ.js} +13 -5
  55. package/dist/chunks/{cowork-3MN6EQQO.js → cowork-GMLRGVIW.js} +11 -4
  56. package/dist/chunks/{create-flow-5FQNNMVO.js → create-flow-J22BO65E.js} +8 -7
  57. package/dist/chunks/{ebuilder-form-SBHOYBUD.js → ebuilder-form-ANV2FHYV.js} +12 -7
  58. package/dist/chunks/{ehr-KMOJULKG.js → ehr-GSTGAIY3.js} +266 -24
  59. package/dist/chunks/{employee-SAK2QYXX.js → employee-22BGJ3QS.js} +3 -3
  60. package/dist/chunks/{env-LB7NBL2O.js → env-BX3VRFS7.js} +4 -3
  61. package/dist/chunks/{esb-W2PJCFCX.js → esb-ATAIASX2.js} +12 -7
  62. package/dist/chunks/{factory-6ZFQXQ46.js → factory-PETTFME6.js} +3 -2
  63. package/dist/chunks/{fna-ZQPCUV4R.js → fna-YEKBSFSX.js} +14 -8
  64. package/dist/chunks/{group-chat-2HHAJN46.js → group-chat-BFVXAYFX.js} +5 -4
  65. package/dist/chunks/{host-ATKVNZAT.js → host-HRBXEPDQ.js} +5 -5
  66. package/dist/chunks/{host-BQH22NTQ.js → host-LR55CTHP.js} +5 -5
  67. package/dist/chunks/{host-X2CSLFM6.js → host-SUOY6VYQ.js} +5 -5
  68. package/dist/chunks/{host-4CBHGOHT.js → host-SZGV4UNT.js} +5 -5
  69. package/dist/chunks/{host-YTODKMSL.js → host-WIKN2EJ5.js} +5 -5
  70. package/dist/chunks/{hrm-FFM4UJFS.js → hrm-NRDO4W5G.js} +11 -7
  71. package/dist/chunks/{im-VEHKDQPB.js → im-IQ2HN23S.js} +8 -7
  72. package/dist/chunks/{invoice-LVIKSIIF.js → invoice-MNRW76PP.js} +636 -1768
  73. package/dist/chunks/{jiuchuanhui-X6DINO5P.js → jiuchuanhui-DTRBAX4N.js} +14 -6
  74. package/dist/chunks/{lazy-dispatch-KSWTN5L6.js → lazy-dispatch-ZVWAI25B.js} +7 -6
  75. package/dist/chunks/{mail-VDKRGUD3.js → mail-ZVAUXOJA.js} +16 -14
  76. package/dist/chunks/{meeting-CLC6HP3Z.js → meeting-FEVPZ67S.js} +21 -14
  77. package/dist/chunks/{okr-CHG4OO3U.js → okr-SDH3E5RA.js} +12 -5
  78. package/dist/chunks/{operations-5QL3AECO.js → operations-62N6EP3C.js} +4 -3
  79. package/dist/chunks/{plan-XWR75667.js → plan-E35JFDI7.js} +12 -5
  80. package/dist/chunks/{project-5BXOOKMG.js → project-73QXBAB2.js} +11 -4
  81. package/dist/chunks/reception-UWZVACBN.js +1899 -0
  82. package/dist/chunks/{recruit-stage-DGMFNNDE.js → recruit-stage-4MAOCKFY.js} +320 -57
  83. package/dist/chunks/registry-IM5G23LS.js +24 -0
  84. package/dist/chunks/{registry-RHMW6ANW.js → registry-JDUS4E7D.js} +7 -6
  85. package/dist/chunks/{registry-7FFOXIAW.js → registry-KNKSCJNT.js} +7 -6
  86. package/dist/chunks/{registry-Z43434VG.js → registry-PO7SI256.js} +4 -4
  87. package/dist/chunks/{registry-OZSMDVPP.js → registry-PVUZQDDQ.js} +3 -3
  88. package/dist/chunks/{room-recommend-62H7ZQQ6.js → room-recommend-H7KLXA5R.js} +6 -5
  89. package/dist/chunks/{schedule-FNXKH3DQ.js → schedule-ESZIBAUO.js} +6 -5
  90. package/dist/chunks/{workflow-ADHKCAJK.js → workflow-CWJFJLQU.js} +13 -8
  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 +37 -31
  98. package/dist/internal/e10/auth/commands.js +163 -8
  99. package/dist/internal/e10/auth/error-log.js +182 -0
  100. package/dist/internal/e10/auth/session.js +17 -3
  101. package/dist/internal/e10/auth-recovery.js +39 -12
  102. package/dist/internal/e10/context.js +17 -2
  103. package/dist/internal/skills/install.js +9 -1
  104. package/dist/shortcuts/archive/continuation.js +2 -1
  105. package/dist/shortcuts/archive/index.js +3 -0
  106. package/dist/shortcuts/archive/operations/confirm.js +2 -1
  107. package/dist/shortcuts/archive-oa/continuation.js +2 -1
  108. package/dist/shortcuts/archive-oa/index.js +2 -0
  109. package/dist/shortcuts/archive-oa/operations/confirm.js +2 -1
  110. package/dist/shortcuts/asset/continuation.js +2 -1
  111. package/dist/shortcuts/asset/index.js +2 -0
  112. package/dist/shortcuts/asset-idle/index.js +2 -0
  113. package/dist/shortcuts/blog/continuation.js +2 -1
  114. package/dist/shortcuts/blog/index.js +2 -0
  115. package/dist/shortcuts/caizhilian/continuation.js +2 -1
  116. package/dist/shortcuts/caizhilian/index.js +2 -0
  117. package/dist/shortcuts/caizhilian/operations/confirm.js +3 -2
  118. package/dist/shortcuts/calendar/continuation.js +2 -1
  119. package/dist/shortcuts/calendar/index.js +2 -0
  120. package/dist/shortcuts/calendar/operations/write.js +1 -1
  121. package/dist/shortcuts/contract/continuation.js +2 -1
  122. package/dist/shortcuts/contract/index.js +2 -0
  123. package/dist/shortcuts/contract/operations/write.js +2 -1
  124. package/dist/shortcuts/cowork/continuation.js +2 -1
  125. package/dist/shortcuts/cowork/index.js +2 -0
  126. package/dist/shortcuts/ebuilder-form/continuation.js +2 -1
  127. package/dist/shortcuts/ebuilder-form/index.js +2 -0
  128. package/dist/shortcuts/ebuilder-form/operations/write.js +3 -2
  129. package/dist/shortcuts/ehr/continuation.js +2 -1
  130. package/dist/shortcuts/ehr/index.js +2 -0
  131. package/dist/shortcuts/ehr/operations/attend-write.js +1 -1
  132. package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +182 -3
  133. package/dist/shortcuts/ehr/operations/recruit-position.js +134 -2
  134. package/dist/shortcuts/ehr/operations/recruit-write.js +1 -1
  135. package/dist/shortcuts/esb/continuation.js +2 -1
  136. package/dist/shortcuts/esb/index.js +2 -0
  137. package/dist/shortcuts/esb/operations/trigger.js +2 -1
  138. package/dist/shortcuts/fna/continuation.js +2 -1
  139. package/dist/shortcuts/fna/index.js +2 -0
  140. package/dist/shortcuts/fna/operations/invoice-writeoff.js +1 -1
  141. package/dist/shortcuts/fna/operations/loan.js +1 -1
  142. package/dist/shortcuts/hrm/index.js +2 -0
  143. package/dist/shortcuts/im/continuation.js +2 -1
  144. package/dist/shortcuts/index.js +5 -0
  145. package/dist/shortcuts/invoice/continuation.js +2 -1
  146. package/dist/shortcuts/invoice/index.js +14 -15
  147. package/dist/shortcuts/invoice/invoice-record.js +93 -0
  148. package/dist/shortcuts/invoice/manifest.js +190 -393
  149. package/dist/shortcuts/invoice/operations/add.js +2 -1
  150. package/dist/shortcuts/invoice/operations/delete.js +2 -1
  151. package/dist/shortcuts/invoice/operations/import.js +2 -1
  152. package/dist/shortcuts/invoice/operations/issuing-contract-detail.js +86 -0
  153. package/dist/shortcuts/invoice/operations/issuing-contracts.js +210 -0
  154. package/dist/shortcuts/invoice/operations/registry.js +17 -17
  155. package/dist/shortcuts/invoice/operations/reim-auto.js +4 -569
  156. package/dist/shortcuts/invoice/operations/reim.js +52 -341
  157. package/dist/shortcuts/invoice/operations/shared.js +21 -4
  158. package/dist/shortcuts/invoice/operations/update.js +2 -1
  159. package/dist/shortcuts/invoice/projection.js +10 -62
  160. package/dist/shortcuts/jiuchuanhui/continuation.js +2 -1
  161. package/dist/shortcuts/jiuchuanhui/index.js +2 -0
  162. package/dist/shortcuts/jiuchuanhui/operations/datajson.js +2 -1
  163. package/dist/shortcuts/jiuchuanhui/operations/esb.js +2 -1
  164. package/dist/shortcuts/mail/continuation.js +2 -1
  165. package/dist/shortcuts/mail/index.js +2 -0
  166. package/dist/shortcuts/mail/operations/mail-blacklist.js +1 -1
  167. package/dist/shortcuts/mail/operations/mail-contacts.js +1 -1
  168. package/dist/shortcuts/mail/operations/mail-send.js +1 -1
  169. package/dist/shortcuts/mail/operations/mail-sign.js +1 -1
  170. package/dist/shortcuts/mail/operations/mail-template.js +1 -1
  171. package/dist/shortcuts/meeting/continuation.js +2 -1
  172. package/dist/shortcuts/meeting/index.js +2 -0
  173. package/dist/shortcuts/meeting/operations/change.js +1 -1
  174. package/dist/shortcuts/meeting/operations/create.js +1 -1
  175. package/dist/shortcuts/meeting/operations/eb/create-flow.js +16 -7
  176. package/dist/shortcuts/meeting/operations/eb/decision.js +1 -1
  177. package/dist/shortcuts/meeting/operations/eb/factory.js +1 -1
  178. package/dist/shortcuts/meeting/operations/lifecycle.js +1 -1
  179. package/dist/shortcuts/meeting/operations/receipts.js +1 -1
  180. package/dist/shortcuts/meeting/operations/signs.js +1 -1
  181. package/dist/shortcuts/okr/continuation.js +2 -1
  182. package/dist/shortcuts/okr/index.js +2 -0
  183. package/dist/shortcuts/okr/operations/write.js +1 -1
  184. package/dist/shortcuts/plan/continuation.js +2 -1
  185. package/dist/shortcuts/plan/index.js +2 -0
  186. package/dist/shortcuts/plan/operations/write.js +1 -1
  187. package/dist/shortcuts/project/continuation.js +2 -1
  188. package/dist/shortcuts/project/index.js +2 -0
  189. package/dist/shortcuts/reception/constants.js +53 -0
  190. package/dist/shortcuts/reception/errors.js +54 -0
  191. package/dist/shortcuts/reception/host.js +125 -0
  192. package/dist/shortcuts/reception/index.js +198 -0
  193. package/dist/shortcuts/reception/manifest.js +177 -0
  194. package/dist/shortcuts/reception/operations/ask.js +71 -0
  195. package/dist/shortcuts/reception/operations/browsertool.js +58 -0
  196. package/dist/shortcuts/reception/operations/compose.js +129 -0
  197. package/dist/shortcuts/reception/operations/customparams.js +74 -0
  198. package/dist/shortcuts/reception/operations/doc.js +238 -0
  199. package/dist/shortcuts/reception/operations/docrender.js +36 -0
  200. package/dist/shortcuts/reception/operations/panels.js +179 -0
  201. package/dist/shortcuts/reception/operations/registry.js +26 -0
  202. package/dist/shortcuts/reception/operations/render-assets.js +184 -0
  203. package/dist/shortcuts/reception/operations/render.js +123 -0
  204. package/dist/shortcuts/reception/operations/runs.js +38 -0
  205. package/dist/shortcuts/reception/operations/schedule.js +127 -0
  206. package/dist/shortcuts/reception/operations/shared.js +196 -0
  207. package/dist/shortcuts/reception/operations/snapshot.js +68 -0
  208. package/dist/shortcuts/reception/operations/types.js +1 -0
  209. package/dist/shortcuts/reception/operations.js +33 -0
  210. package/dist/shortcuts/reception/upload.js +218 -0
  211. package/dist/shortcuts/recruit-stage/context.js +145 -33
  212. package/dist/shortcuts/recruit-stage/continuation.js +2 -1
  213. package/dist/shortcuts/recruit-stage/operations/jd-create.js +106 -17
  214. package/dist/shortcuts/recruit-stage/operations/resume-import.js +166 -10
  215. package/dist/shortcuts/workflow/continuation.js +2 -1
  216. package/dist/shortcuts/workflow/index.js +2 -0
  217. package/dist/shortcuts/workflow/operations/form.js +32 -8
  218. package/dist/shortcuts/workflow/operations/write.js +1 -1
  219. package/docs/_catalog.md +3 -0
  220. package/docs/agent-invoice.md +1 -1
  221. package/docs/archive-oa.md +1 -1
  222. package/docs/caizhilian.md +1 -1
  223. package/docs/calendar.md +1 -1
  224. package/docs/contract.md +1 -1
  225. package/docs/e10-auth.md +16 -0
  226. package/docs/ehr.md +2 -2
  227. package/docs/esb.md +1 -1
  228. package/docs/im.md +1 -1
  229. package/docs/invoice.md +8 -12
  230. package/docs/okr.md +1 -1
  231. package/docs/reception.md +119 -0
  232. package/package.json +1 -1
  233. package/scripts/clean.mjs +43 -2
  234. package/skill-template/business-info.json +18 -2
  235. package/skill-template/domains/caizhilian.md +1 -1
  236. package/skill-template/domains/reception-flow.md +18 -0
  237. package/skill-template/domains/yepiaotong.md +4 -7
  238. package/skills/weaver-e10-archive-oa/references/source-manifest.json +14 -14
  239. package/skills/weaver-e10-blog/references/blog-publish.md +1 -1
  240. package/skills/weaver-e10-blog/references/source-manifest.json +7 -7
  241. package/skills/weaver-e10-caizhilian/references/source-manifest.json +21 -21
  242. package/skills/weaver-e10-caizhilian/references/write-protocol.md +2 -2
  243. package/skills/weaver-e10-calendar/references/calendar-write.md +1 -1
  244. package/skills/weaver-e10-cowork/SKILL.md +1 -1
  245. package/skills/weaver-e10-ebuilder-form/SKILL.md +1 -1
  246. package/skills/weaver-e10-ebuilder-form/references/custom-api.md +1 -1
  247. package/skills/weaver-e10-ebuilder-form/references/openapi-write.md +1 -1
  248. package/skills/weaver-e10-esb/SKILL.md +2 -2
  249. package/skills/weaver-e10-esb/references/source-manifest.json +22 -22
  250. package/skills/weaver-e10-esb/references/trigger.md +2 -2
  251. package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +1 -1
  252. package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +1 -1
  253. package/skills/weaver-e10-jinchengda/references/contract-request-write.md +1 -1
  254. package/skills/weaver-e10-jinchengda/references/source-manifest.json +29 -29
  255. package/skills/weaver-e10-jucailin/SKILL.md +1 -1
  256. package/skills/weaver-e10-jucailin/references/attend-write.md +2 -2
  257. package/skills/weaver-e10-jucailin/references/recruit-create.md +12 -3
  258. package/skills/weaver-e10-jucailin/references/recruit-write.md +1 -1
  259. package/skills/weaver-e10-meeting/SKILL.md +8 -6
  260. package/skills/weaver-e10-meeting/references/meeting-change.md +1 -1
  261. package/skills/weaver-e10-meeting/references/meeting-create.md +1 -1
  262. package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +1 -1
  263. package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
  264. package/skills/weaver-e10-okr/references/okr-align.md +1 -1
  265. package/skills/weaver-e10-okr/references/okr-keyresult.md +1 -1
  266. package/skills/weaver-e10-okr/references/okr-write.md +1 -1
  267. package/skills/weaver-e10-okr/references/source-manifest.json +8 -8
  268. package/skills/weaver-e10-plan/references/plan-report-write.md +1 -1
  269. package/skills/weaver-e10-plan/references/source-manifest.json +20 -20
  270. package/skills/weaver-e10-qiyecheng/references/loan-management.md +1 -1
  271. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +18 -18
  272. package/skills/weaver-e10-reception-flow/SKILL.md +173 -0
  273. 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
  274. package/skills/weaver-e10-reception-flow/data/fields-snapshot.json +213 -0
  275. package/skills/weaver-e10-reception-flow/references/browsertool.md +68 -0
  276. package/skills/weaver-e10-reception-flow/references/env-pitfalls.md +51 -0
  277. package/skills/weaver-e10-reception-flow/references/fields-snapshot.md +227 -0
  278. package/skills/weaver-e10-reception-flow/references/guide.md +179 -0
  279. package/skills/weaver-e10-reception-flow/scripts/locate.sh +14 -0
  280. package/skills/weaver-e10-reception-flow/scripts/render.py +724 -0
  281. package/skills/weaver-e10-recruit-stage/SKILL.md +9 -5
  282. package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +1 -1
  283. package/skills/weaver-e10-recruit-stage/lib/xiaoe-session.mjs +66 -0
  284. package/skills/weaver-e10-recruit-stage/references/position-templates.md +202 -0
  285. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +22 -0
  286. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +14 -1
  287. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +6 -0
  288. package/skills/weaver-e10-shijingran/SKILL.md +5 -5
  289. package/skills/weaver-e10-shijingran/references/source-manifest.json +37 -36
  290. package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +2 -0
  291. package/skills/weaver-e10-wenshuding/references/source-manifest.json +3 -3
  292. package/skills/weaver-e10-workflow/references/source-manifest.json +32 -32
  293. package/skills/weaver-e10-yepiaotong/SKILL.md +19 -26
  294. package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +13 -10
  295. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +2 -0
  296. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +194 -155
  297. package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +28 -32
  298. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +5 -1
  299. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +8 -10
  300. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +211 -616
  301. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +149 -117
  302. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +17 -20
  303. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +20 -39
  304. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +55 -22
  305. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +7 -17
  306. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +88 -92
  307. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +144 -354
  308. package/skills/weaver-e10-yimiaoban/SKILL.md +1 -1
  309. package/skills/weaver-e10-yimiaoban/references/msg-write.md +1 -1
  310. package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +1 -1
  311. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
  312. package/dist/chunks/chunk-TTPJJJC4.js +0 -465
  313. package/dist/chunks/registry-BKBZPBAJ.js +0 -23
  314. package/dist/shortcuts/invoice/markdown.js +0 -172
  315. package/dist/shortcuts/invoice/operations/issuing-qys.js +0 -424
  316. package/skills/weaver-e10-meeting.zip +0 -0
  317. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-examples.md +0 -131
  318. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-form-fill-rules.md +0 -179
@@ -0,0 +1,1899 @@
1
+ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
+ const require = __esbuildCreateRequire(import.meta.url);
3
+ import {
4
+ stateRoot
5
+ } from "./chunk-AJ62BGAW.js";
6
+ import {
7
+ E10ApiError,
8
+ createE10RequestRuntime,
9
+ getE10Session
10
+ } from "./chunk-ETNJSKMM.js";
11
+ import "./chunk-UFIT2UU3.js";
12
+ import {
13
+ CliError,
14
+ isCliError,
15
+ toErrorEnvelope
16
+ } from "./chunk-UG5G54VL.js";
17
+ import "./chunk-BUSC6UAE.js";
18
+
19
+ // src/shortcuts/reception/index.ts
20
+ import { join as join6 } from "node:path";
21
+
22
+ // src/shortcuts/reception/constants.ts
23
+ var DEFAULT_WORKFLOW = "\u6CDB\u5FAE\u5BA2\u6237\u53C2\u89C2\u63A5\u5F85\u6D41\u7A0B";
24
+ var STATE_SUBDIR = "reception";
25
+ var LOGISTICS_FIELDS = ["headcount", "meetingRoom", "pickup", "meal", "hotel", "gift"];
26
+ var LOGISTICS_LABEL = {
27
+ headcount: "\u4EBA\u6570",
28
+ meetingRoom: "\u4F1A\u8BAE\u5BA4",
29
+ pickup: "\u63A5\u9001/\u7528\u8F66",
30
+ meal: "\u7528\u9910",
31
+ hotel: "\u4F4F\u5BBF",
32
+ gift: "\u4F34\u624B\u793C",
33
+ mobile: "\u624B\u673A"
34
+ };
35
+ var LOGISTICS_TITLE = "\u63A5\u5F85\u7EC6\u8282(\u4EBA\u6570\u3001\u5177\u4F53\u5B89\u6392\u3001\u7528\u9910\u60C5\u51B5\u7B49)";
36
+ var LOGISTICS_PLACEHOLDER = "\u5BA2\u6237\u4EBA\u6570\u3001\u662F\u5426\u4F1A\u8BAE\u3001\u662F\u5426\u63A5\u9001\u3001\u662F\u5426\u7528\u9910\u3001\u662F\u5426\u4EE3\u8BA2\u4F4F\u5BBF\u3001\u662F\u5426\u4F34\u624B\u793C\u3001\u966A\u540C\u4EBA\u5458\u624B\u673A\u53F7";
37
+ var LOGISTICS_HINT = [
38
+ "\u7167\u8F93\u5165\u6846\u7070\u5B57\u6837\u4F8B\u5199\uFF0C\u9017\u53F7\u6216\u300C\uFF5C\u300D\u9694\u5F00\u90FD\u884C\uFF1B\u6CA1\u5B9A\u7684\u9879\u76F4\u63A5\u4E0D\u5199\u3002",
39
+ "\u4EBA\u6570\uFF1A\u5982\u300C10\u4EBA\u300D",
40
+ "\u4F1A\u8BAE\u5BA4\uFF1A\u603B\u90E8129 / \u603B\u90E8130 / \u603B\u90E8131\uFF0C\u6216\u300C\u4E0D\u9700\u4F1A\u8BAE\u5BA4\u300D",
41
+ "\u63A5\u9001/\u7528\u8F66\uFF1A\u5982\u300C\u8679\u6865\u63A5\u673A2\u8F86\u5546\u52A1\u8F66 10:00\u300D\u6216\u300C\u4E0D\u7528\u8F66\u300D",
42
+ "\u7528\u9910\uFF1A\u516C\u53F8\u98DF\u5802 / \u5C0F\u9910\u5385 / \u5916\u90E8\u9910\u5385 / \u4E0D\u7528\u9910",
43
+ "\u4F4F\u5BBF\uFF1A\u5982\u300C2\u95F4\u5927\u5E8A\u623F\u4F4F1\u665A\u300D\u6216\u300C\u4E0D\u4F4F\u300D",
44
+ "\u4F34\u624B\u793C\uFF1A\u5982\u300C\u793C\u76D2\u6BCF\u4EBA1\u4EFD\u300D\u6216\u300C\u4E0D\u7528\u300D",
45
+ "\u624B\u673A\uFF1A11 \u4F4D\uFF0C\u53EA\u7528\u4E8E\u884C\u7A0B\u5355\u663E\u793A\u63A5\u5F85\u4EBA\u8054\u7CFB\u65B9\u5F0F\uFF08\u7CFB\u7EDF\u4E0D\u67E5\u5458\u5DE5\u624B\u673A\u53F7\uFF09"
46
+ ].join("\n");
47
+ var CUSTOMER_NEED_OPTIONS = [
48
+ "\u4E86\u89E3\u6CDB\u5FAE\u4EA7\u54C1\u4E0E\u653F\u52A1\u884C\u4E1A\u89E3\u51B3\u65B9\u6848",
49
+ "\u53C2\u89C2\u603B\u90E8\u73AF\u5883\u4E0E\u5C55\u5385\uFF0C\u4E86\u89E3\u516C\u53F8\u5B9E\u529B",
50
+ "\u4EA4\u6D41\u5177\u4F53\u9879\u76EE\u5408\u4F5C\u4E0E\u5B9E\u65BD\u7EC6\u8282",
51
+ "\u6682\u672A\u786E\u5B9A\uFF0C\u5148\u8FDB\u5F85\u529E"
52
+ ];
53
+ var SNAPSHOT_KIND = "reception-fields-snapshot";
54
+ var PYTHON_CACHE_TTL_MS = 7 * 24 * 3600 * 1e3;
55
+
56
+ // src/shortcuts/reception/errors.ts
57
+ var ReceptionCliError = class extends CliError {
58
+ type;
59
+ subtype;
60
+ retryable;
61
+ stage;
62
+ details;
63
+ constructor(type, subtype, message, options = {}) {
64
+ super(message, options.exitCode ?? 1 /* GeneralError */);
65
+ this.name = "ReceptionCliError";
66
+ this.type = type;
67
+ this.subtype = subtype;
68
+ this.retryable = options.retryable ?? false;
69
+ this.stage = options.stage;
70
+ this.details = options.details;
71
+ }
72
+ };
73
+ var receptionValidationError = (subtype, message, details) => new ReceptionCliError("validation", subtype, message, {
74
+ details,
75
+ exitCode: 2 /* UsageError */
76
+ });
77
+ var receptionEnvironmentError = (subtype, message, details) => new ReceptionCliError("environment", subtype, message, {
78
+ details,
79
+ exitCode: 3 /* AuthError */
80
+ });
81
+ var receptionBusinessError = (subtype, message, details) => new ReceptionCliError("business", subtype, message, {
82
+ details,
83
+ exitCode: 1 /* GeneralError */
84
+ });
85
+ var receptionRunNotFound = (runId, stateDir) => new ReceptionCliError("business", "RUN_NOT_FOUND", `\u627E\u4E0D\u5230 run\uFF1A${runId}`, {
86
+ exitCode: 1 /* GeneralError */,
87
+ details: {
88
+ runId,
89
+ stateDir,
90
+ hint: "\u628A ask \u7528\u8FC7\u7684 --known \u4E0E answers \u4E00\u8D77\u5E26\u4E0A\u91CD\u8DD1 doc\uFF0CCLI \u4F1A\u73B0\u573A\u91CD\u5EFA run"
91
+ }
92
+ });
93
+
94
+ // src/shortcuts/reception/upload.ts
95
+ import { createHash } from "node:crypto";
96
+ import { readFile, stat } from "node:fs/promises";
97
+ import { basename } from "node:path";
98
+ var UploadProtocolError = class extends Error {
99
+ constructor(subtype, message, httpStatus, detail, contentType) {
100
+ super(message);
101
+ this.subtype = subtype;
102
+ this.httpStatus = httpStatus;
103
+ this.detail = detail;
104
+ this.contentType = contentType;
105
+ this.name = "UploadProtocolError";
106
+ }
107
+ subtype;
108
+ httpStatus;
109
+ detail;
110
+ contentType;
111
+ };
112
+ var object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
113
+ var hasKeys = (value) => Object.keys(value).length > 0;
114
+ function checkedData(response) {
115
+ const contentType = response.headers?.get?.("content-type") || "";
116
+ const text = String(response.text || "");
117
+ const isHtml = /text\/html/i.test(contentType) || /^\s*<!DOCTYPE\s+html|^\s*<html[\s>]/i.test(text);
118
+ if (response.status !== 200) {
119
+ throw new UploadProtocolError(
120
+ response.status === 401 ? "upload_auth_expired" : "upload_http_error",
121
+ response.status === 401 ? "\u767B\u5F55\u5DF2\u5931\u6548\uFF0C\u8BF7\u5728\u539F\u767B\u5F55\u5DE5\u5177\u4E2D\u6062\u590D\u540E\u518D\u8BD5" : `\u6587\u4EF6\u670D\u52A1 HTTP ${response.status}`,
122
+ response.status,
123
+ text.slice(0, 300) || void 0,
124
+ contentType || void 0
125
+ );
126
+ }
127
+ if (isHtml) {
128
+ throw new UploadProtocolError(
129
+ "upload_response_html",
130
+ "\u6587\u4EF6\u670D\u52A1\u8FD4\u56DE\u4E86 HTML \u9875\u9762\uFF08\u901A\u5E38\u662F\u767B\u5F55\u9875\u6216\u9519\u8BEF\u9875\uFF09",
131
+ response.status,
132
+ text.slice(0, 300),
133
+ contentType
134
+ );
135
+ }
136
+ const envelope = object(response.value);
137
+ const data = envelope.data === void 0 ? envelope : object(envelope.data);
138
+ if (!hasKeys(data)) {
139
+ throw new UploadProtocolError(
140
+ "upload_response_invalid",
141
+ "\u6587\u4EF6\u670D\u52A1\u54CD\u5E94\u7F3A\u5C11\u6570\u636E\u5BF9\u8C61",
142
+ response.status,
143
+ text.slice(0, 300) || void 0,
144
+ contentType || void 0
145
+ );
146
+ }
147
+ for (const record of [
148
+ envelope,
149
+ data,
150
+ object(data.fileObj),
151
+ object(data.uploadModuleDto),
152
+ object(data.imUploadInfoDto),
153
+ object(object(data.uploadModuleDto).fileObj),
154
+ object(object(data.imUploadInfoDto).fileObj)
155
+ ]) {
156
+ if (!hasKeys(record)) continue;
157
+ const flag = (value, literal) => value === literal || String(value).toLowerCase() === String(literal);
158
+ const code = record.code == null ? "" : String(record.code).toLowerCase();
159
+ if (flag(record.status, false) || flag(record.success, false) || flag(record.fail, true) || code && !["0", "200", "success"].includes(code)) {
160
+ throw new UploadProtocolError(
161
+ "upload_business_failed",
162
+ String(record.msg || record.message || "\u6587\u4EF6\u670D\u52A1\u672A\u786E\u8BA4\u64CD\u4F5C\u6210\u529F"),
163
+ response.status,
164
+ text.slice(0, 300),
165
+ contentType
166
+ );
167
+ }
168
+ }
169
+ return data;
170
+ }
171
+ function fileRecord(data) {
172
+ const candidates = [
173
+ [data, void 0],
174
+ [object(data.fileObj), data],
175
+ [object(data.uploadModuleDto), data],
176
+ [object(object(data.uploadModuleDto).fileObj), object(data.uploadModuleDto)],
177
+ [object(data.imUploadInfoDto), data],
178
+ [object(object(data.imUploadInfoDto).fileObj), object(data.imUploadInfoDto)]
179
+ ];
180
+ let result;
181
+ for (const [record, parent] of candidates) {
182
+ if (!hasKeys(record)) continue;
183
+ if (record.fileId && record.fileid && String(record.fileId) !== String(record.fileid)) {
184
+ throw new UploadProtocolError("upload_file_id_conflict", "\u6587\u4EF6\u670D\u52A1\u8FD4\u56DE\u51B2\u7A81\u7684\u6587\u4EF6 ID");
185
+ }
186
+ const id = record.fileId ?? record.fileid;
187
+ if (id === void 0 || id === null || id === "") continue;
188
+ if (typeof id !== "string" && typeof id !== "number" || typeof id === "number" && (!Number.isSafeInteger(id) || id <= 0)) {
189
+ throw new UploadProtocolError("upload_file_id_invalid", "\u6587\u4EF6\u670D\u52A1\u8FD4\u56DE\u65E0\u6548\u6587\u4EF6 ID");
190
+ }
191
+ const text = String(id).trim();
192
+ if (!text || text === "0") continue;
193
+ if (result && result.id !== text) {
194
+ throw new UploadProtocolError("upload_file_id_conflict", "\u6587\u4EF6\u670D\u52A1\u8FD4\u56DE\u51B2\u7A81\u7684\u6587\u4EF6 ID");
195
+ }
196
+ result ??= { id: text, sizes: [] };
197
+ result.sizes.push(record.size, parent?.size, data.size);
198
+ }
199
+ return result;
200
+ }
201
+ function terminal(data, expectedSize) {
202
+ const record = fileRecord(data);
203
+ if (!record || data.endChunk === false || data.endChunk === "false") {
204
+ throw new UploadProtocolError("upload_not_terminal", "\u4E0A\u4F20\u672A\u8FD4\u56DE\u5DF2\u5B8C\u6210\u7684\u6587\u4EF6 ID");
205
+ }
206
+ for (const value of record.sizes) {
207
+ if (value === void 0 || value === null || value === "") continue;
208
+ const size = Number(value);
209
+ if (!Number.isSafeInteger(size) || size < 0 || size !== 0 && size !== expectedSize) {
210
+ throw new UploadProtocolError(
211
+ "upload_size_mismatch",
212
+ `\u670D\u52A1\u7AEF\u6587\u4EF6\u5927\u5C0F\u4E0E\u672C\u5730\u4E0D\u4E00\u81F4\uFF08\u670D\u52A1\u7AEF ${value}\uFF0C\u672C\u5730 ${expectedSize}\uFF09`
213
+ );
214
+ }
215
+ }
216
+ return record.id;
217
+ }
218
+ async function send(transport, path, fields, file) {
219
+ const form = new FormData();
220
+ for (const [key, value] of Object.entries(fields)) form.append(key, value);
221
+ if (file) {
222
+ form.append(
223
+ "file",
224
+ new Blob([new Uint8Array(file.buffer.subarray(file.start, file.start + file.size))]),
225
+ `e10upload.${file.ext}`
226
+ );
227
+ }
228
+ return checkedData(await transport.post(path, form));
229
+ }
230
+ async function uploadToFileService(input) {
231
+ const buffer = await readFile(input.filePath);
232
+ const info = await stat(input.filePath);
233
+ const name = input.name || basename(input.filePath);
234
+ const ext = (name.match(/\.([^.]+)$/) || [, "bin"])[1].toLowerCase();
235
+ const lastModified = String(Math.floor(info.mtimeMs));
236
+ const fields = {
237
+ compressImg: "false",
238
+ name,
239
+ size: String(buffer.length),
240
+ module: input.module,
241
+ MD5: createHash("md5").update(buffer).digest("hex"),
242
+ lastModified,
243
+ lastModifiedDate: lastModified
244
+ };
245
+ if (input.userId) fields.userid = String(input.userId);
246
+ const identity = await send(input.transport, "/api/baseserver/layout/teamsCheck", {});
247
+ const employeeId = object(identity.currentUser).employeeId;
248
+ const employeeText = employeeId === void 0 || employeeId === null ? "" : String(employeeId).trim();
249
+ if (!employeeText) {
250
+ throw new UploadProtocolError(
251
+ "upload_identity_missing",
252
+ "\u8EAB\u4EFD\u6821\u9A8C\u672A\u8FD4\u56DE employeeId\uFF0C\u65E0\u6CD5\u786E\u8BA4\u4E0A\u4F20\u8EAB\u4EFD"
253
+ );
254
+ }
255
+ if (input.userId && employeeText !== String(input.userId).trim()) {
256
+ throw new UploadProtocolError(
257
+ "upload_identity_mismatch",
258
+ `\u4F1A\u8BDD\u7528\u6237\uFF08${input.userId}\uFF09\u4E0E\u6587\u4EF6\u670D\u52A1\u8BA4\u5230\u7684\u7528\u6237\uFF08${employeeText}\uFF09\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55`
259
+ );
260
+ }
261
+ const pre = await send(input.transport, "/api/file/preUploadCheck?sf_request_type=ajax", fields);
262
+ const type = String(pre.uploadType || "");
263
+ if (!["second", "common", "chunk"].includes(type)) {
264
+ throw new UploadProtocolError(
265
+ "upload_type_invalid",
266
+ `\u6587\u4EF6\u670D\u52A1\u8FD4\u56DE\u672A\u77E5\u4E0A\u4F20\u7B56\u7565\uFF1A${type || "(\u7A7A)"}`
267
+ );
268
+ }
269
+ if (type === "second") {
270
+ return { fileid: terminal(pre, buffer.length), name, size: buffer.length, kind: ext };
271
+ }
272
+ const preUploadId = String(pre.preUploadId ?? "").trim();
273
+ if (!preUploadId || preUploadId === "0") {
274
+ throw new UploadProtocolError("upload_precheck_invalid", "\u9884\u68C0\u672A\u8FD4\u56DE\u6709\u6548 preUploadId");
275
+ }
276
+ const uploadFields = { ...fields, preUploadId, uploadType: type };
277
+ if (type === "common") {
278
+ const data = await send(input.transport, "/api/file/module/upload?sf_request_type=ajax", uploadFields, {
279
+ name,
280
+ ext,
281
+ buffer,
282
+ start: 0,
283
+ size: buffer.length
284
+ });
285
+ return { fileid: terminal(data, buffer.length), name, size: buffer.length, kind: ext };
286
+ }
287
+ const chunkMiB = Number(pre.chunkDto?.chunkSize);
288
+ if (!Number.isSafeInteger(chunkMiB) || chunkMiB <= 0 || buffer.length <= 0) {
289
+ throw new UploadProtocolError(
290
+ "upload_chunk_size_invalid",
291
+ "\u5206\u7247\u4E0A\u4F20\u8981\u6C42\u975E\u7A7A\u6587\u4EF6\u4E0E\u6B63\u6574\u6570 MiB \u5206\u7247\u5927\u5C0F"
292
+ );
293
+ }
294
+ const chunkSize = chunkMiB * 1024 * 1024;
295
+ const count = Math.max(1, Math.ceil(buffer.length / chunkSize));
296
+ if (pre.chunkDto?.chunkCount !== void 0 && Number(pre.chunkDto.chunkCount) !== count) {
297
+ throw new UploadProtocolError(
298
+ "upload_chunk_count_mismatch",
299
+ `\u670D\u52A1\u7AEF\u5206\u7247\u6570\uFF08${pre.chunkDto.chunkCount}\uFF09\u4E0E\u672C\u5730\u8BA1\u7B97\uFF08${count}\uFF09\u4E0D\u4E00\u81F4`
300
+ );
301
+ }
302
+ let fileid = "";
303
+ for (let index = 0; index < count; index += 1) {
304
+ const start = index * chunkSize;
305
+ const size = Math.min(chunkSize, buffer.length - start);
306
+ const data = await send(
307
+ input.transport,
308
+ "/api/file/module/upload?sf_request_type=ajax",
309
+ { ...uploadFields, chunk: String(index), chunks: String(count), uploadShardSize: String(size) },
310
+ { name, ext, buffer, start, size }
311
+ );
312
+ if (index === count - 1) {
313
+ fileid = terminal(data, buffer.length);
314
+ } else if (data.endChunk !== false || fileRecord(data)) {
315
+ throw new UploadProtocolError("upload_chunk_terminal_early", "\u4E2D\u95F4\u5206\u7247\u7F3A\u5C11\u672A\u5B8C\u6210\u6807\u8BB0\u6216\u63D0\u524D\u8FD4\u56DE\u4E86\u6587\u4EF6 ID");
316
+ }
317
+ }
318
+ if (!fileid) throw new UploadProtocolError("upload_not_terminal", "\u5206\u7247\u4E0A\u4F20\u672A\u786E\u8BA4\u5B8C\u6210");
319
+ return { fileid, name, size: buffer.length, kind: ext };
320
+ }
321
+
322
+ // src/shortcuts/reception/host.ts
323
+ var UPLOAD_TIMEOUT_MS = 18e4;
324
+ function createReceptionHost(ctx) {
325
+ let cached = null;
326
+ async function resolve() {
327
+ if (cached) return cached;
328
+ const e10 = await getE10Session(ctx);
329
+ if (!e10) {
330
+ cached = {
331
+ e10: null,
332
+ info: {
333
+ available: false,
334
+ baseUrl: "",
335
+ userId: "",
336
+ reason: "\u672A\u53D6\u5F97 E10 \u4F1A\u8BDD\uFF1A\u9644\u4EF6\u4E0D\u4F1A\u4E0A\u4F20\uFF0C\u4EA7\u7269\u6309\u672C\u5730\u6587\u4EF6\u4EA4\u4ED8"
337
+ }
338
+ };
339
+ return cached;
340
+ }
341
+ cached = {
342
+ e10,
343
+ info: { available: true, baseUrl: e10.getBaseUrl(), userId: e10.userId }
344
+ };
345
+ return cached;
346
+ }
347
+ async function getSession() {
348
+ return (await resolve()).info;
349
+ }
350
+ async function requireRuntime() {
351
+ const { e10, info } = await resolve();
352
+ if (!e10) {
353
+ throw receptionEnvironmentError("NO_SESSION", info.reason || "\u672A\u53D6\u5F97 E10 \u4F1A\u8BDD");
354
+ }
355
+ return { runtime: createE10RequestRuntime(ctx, e10), session: info };
356
+ }
357
+ async function uploadFile(filePath, options = {}) {
358
+ const { e10, info } = await resolve();
359
+ if (!e10) {
360
+ return {
361
+ ok: false,
362
+ reason: "NO_SESSION",
363
+ localPath: filePath,
364
+ error: info.reason || "\u65E0\u53EF\u7528\u4F1A\u8BDD\uFF0C\u5DF2\u8DF3\u8FC7\u4E0A\u4F20\uFF08\u6587\u4EF6\u5DF2\u751F\u6210\uFF0C\u6309\u672C\u5730\u6587\u4EF6\u4EA4\u4ED8\uFF09"
365
+ };
366
+ }
367
+ const baseUrl = String(info.baseUrl || "").replace(/\/+$/u, "");
368
+ const runtime = createE10RequestRuntime(ctx, e10);
369
+ const module = options.module || process.env.RECEPTION_UPLOAD_MODULE || "document";
370
+ try {
371
+ const uploaded = await uploadToFileService({
372
+ transport: {
373
+ post: (path, formData) => runtime.requestJson({
374
+ module: "reception",
375
+ operation: "reception.upload",
376
+ method: "POST",
377
+ path,
378
+ formData,
379
+ headers: {
380
+ langtype: "zh_CN",
381
+ referer: `${baseUrl}/`
382
+ },
383
+ timeoutMs: UPLOAD_TIMEOUT_MS
384
+ })
385
+ },
386
+ filePath,
387
+ module,
388
+ userId: info.userId ? String(info.userId) : void 0,
389
+ name: options.name
390
+ });
391
+ return {
392
+ ok: true,
393
+ fileid: uploaded.fileid,
394
+ name: uploaded.name,
395
+ size: uploaded.size,
396
+ kind: uploaded.kind,
397
+ localPath: filePath,
398
+ previewUrl: `${baseUrl}/sp/file/filePreview/${uploaded.fileid}`
399
+ };
400
+ } catch (error) {
401
+ if (error instanceof UploadProtocolError) {
402
+ return {
403
+ ok: false,
404
+ localPath: filePath,
405
+ reason: error.subtype,
406
+ error: error.message,
407
+ httpStatus: error.httpStatus,
408
+ contentType: error.contentType,
409
+ detail: error.detail,
410
+ hint: `\u94FE\u8DEF teamsCheck \u2192 preUploadCheck \u2192 module/upload\uFF0Cmodule=${module}`
411
+ };
412
+ }
413
+ if (error instanceof E10ApiError) {
414
+ return { ok: false, localPath: filePath, reason: "UPLOAD_NETWORK", error: `\u7F51\u7EDC\u5F02\u5E38: ${error.message}` };
415
+ }
416
+ return {
417
+ ok: false,
418
+ localPath: filePath,
419
+ reason: "UPLOAD_LOCAL_ERROR",
420
+ error: `\u4E0A\u4F20\u5F02\u5E38: ${error.message}`
421
+ };
422
+ }
423
+ }
424
+ return { getSession, requireRuntime, uploadFile };
425
+ }
426
+
427
+ // src/shortcuts/reception/operations/panels.ts
428
+ function parseLogistics(text) {
429
+ const raw = String(text || "").trim();
430
+ if (!raw) return {};
431
+ const out = {};
432
+ if (/^(暂未确定|待定|都不确定|还没定|都没定)/.test(raw)) return out;
433
+ const FIELD_HINTS = ["\u5BA2\u6237\u4EBA\u6570", "\u662F\u5426\u4F1A\u8BAE", "\u662F\u5426\u63A5\u9001", "\u662F\u5426\u7528\u9910", "\u662F\u5426\u4EE3\u8BA2\u4F4F\u5BBF", "\u662F\u5426\u4F34\u624B\u793C", "\u966A\u540C\u4EBA\u5458\u624B\u673A\u53F7"];
434
+ if (!/\d/.test(raw) && FIELD_HINTS.filter((word) => raw.includes(word)).length >= 2) return out;
435
+ const mobile = raw.match(/(?<!\d)1[3-9]\d{9}(?!\d)/);
436
+ if (mobile) out.mobile = mobile[0];
437
+ const segs = raw.replace(/[①②③④⑤⑥⑦⑧⑨]/g, "\n").replace(/[((]\s*\d\s*[))]/g, "\n").replace(/(^|[\s||;;,,。])\d\s*[.))、]/g, "\n").replace(/总部\s*(\d{3})/g, "\u603B\u90E8$1").replace(/(\d)\s*[人名位]/g, "$1\u4EBA").replace(/(\d)\s*间/g, "$1\u95F4").split(/[\n||;;,,。、]+/).map((item) => item.trim()).filter(Boolean);
438
+ for (const part of segs) {
439
+ if (!out.meetingRoom) {
440
+ const room = part.match(/(?:总部\s*)?(?<!\d)(129|130|131)(?!\d)\s*会议室/) || part.match(/总部\s*(?<!\d)(129|130|131)(?!\d)/);
441
+ if (room) out.meetingRoom = `\u603B\u90E8${room[1]}\u4F1A\u8BAE\u5BA4`;
442
+ else if (/(不需要|不用|无需|没有)会议室/.test(part)) out.meetingRoom = "\u4E0D\u9700\u4F1A\u8BAE\u5BA4";
443
+ else {
444
+ const named = part.match(/([\u4e00-\u9fa5]{2,8}会议室)/);
445
+ if (named) out.meetingRoom = named[1];
446
+ }
447
+ }
448
+ if (!out.headcount) {
449
+ const band = part.match(/(5人以内|6-10人|11-20人|20人以上)/);
450
+ if (band) {
451
+ out.headcount = band[1] === "5\u4EBA\u4EE5\u5185" ? 5 : band[1] === "6-10\u4EBA" ? 6 : band[1] === "11-20\u4EBA" ? 11 : 20;
452
+ out.headcountBand = band[1];
453
+ } else {
454
+ const exact = part.match(/(\d{1,3})\s*人/);
455
+ if (exact) out.headcount = Number(exact[1]);
456
+ }
457
+ }
458
+ if (!out.meal) {
459
+ if (/(不用餐|不需要用餐|不吃饭|吃过再来)/.test(part)) out.meal = "\u4E0D\u7528\u9910";
460
+ else if (/(午餐|晚餐|中饭|午饭|晚饭|食堂|小餐厅|外部餐厅|餐厅)/.test(part)) out.meal = part;
461
+ }
462
+ if (!out.hotel) {
463
+ if (/(无需住宿|不需要住宿|不用住宿|不住|不用订房|当天往返|不需住宿)/.test(part)) out.hotel = "\u65E0\u9700\u4F4F\u5BBF";
464
+ else if (/(住宿|订房|间房|住\s*\d*\s*晚|\d+\s*晚)/.test(part)) out.hotel = part;
465
+ }
466
+ if (!out.pickup) {
467
+ if (/(自行前往|自驾|自己过去|不用接|不需要接|不用车|不需要用车|无需用车|不用派车)/.test(part)) {
468
+ out.pickup = "\u5BA2\u6237\u81EA\u884C\u524D\u5F80";
469
+ } else if (/(接站|接机|用车|派车|商务车|大巴|司机|接送|高铁)/.test(part)) {
470
+ out.pickup = part;
471
+ }
472
+ }
473
+ if (!out.gift) {
474
+ if (/(不需要伴手礼|无需伴手礼|不用伴手礼|不送|不用礼品|伴手礼(不用|不需要|免)|礼品(不用|不需要))/.test(part)) {
475
+ out.gift = "\u4E0D\u9700\u8981\u4F34\u624B\u793C";
476
+ } else if (/(伴手礼|纪念品|礼品|礼盒)/.test(part)) {
477
+ out.gift = part;
478
+ }
479
+ }
480
+ }
481
+ return out;
482
+ }
483
+ function setCompanionMobile(data, mobile) {
484
+ const value = String(mobile || "").trim();
485
+ if (!value) return;
486
+ const list = Array.isArray(data.companions) ? data.companions.slice() : [];
487
+ if (list.length) {
488
+ const first = typeof list[0] === "string" ? { name: list[0] } : { ...list[0] };
489
+ first.mobile = value;
490
+ list[0] = first;
491
+ data.companions = list;
492
+ } else {
493
+ data.mobile = value;
494
+ }
495
+ }
496
+ function mergeAnswers(run, answers = {}) {
497
+ const data = { ...run.data || {} };
498
+ if (answers && typeof answers === "object") {
499
+ if (answers.fields && typeof answers.fields === "object") Object.assign(data, answers.fields);
500
+ if (answers.customer_need) data.demand = String(answers.customer_need);
501
+ if (answers.logistics) {
502
+ const raw = String(answers.logistics).trim();
503
+ if (raw) {
504
+ data.logisticsRaw = raw;
505
+ const parsed = parseLogistics(raw);
506
+ const mobile = parsed.mobile;
507
+ delete parsed.mobile;
508
+ Object.assign(data, parsed);
509
+ if (mobile) setCompanionMobile(data, mobile);
510
+ }
511
+ }
512
+ if (answers.companion_mobile) setCompanionMobile(data, answers.companion_mobile);
513
+ }
514
+ return data;
515
+ }
516
+ function buildPanels(data) {
517
+ const panels = [];
518
+ if (!data.demand) {
519
+ panels.push({
520
+ id: "customer_need",
521
+ // 同样受「标题单行」约束:不写 ①②③ 追问清单,只留一句
522
+ title: "\u5BA2\u6237\u9700\u6C42\uFF08\u9009\u4E00\u4E2A\uFF0C\u4E5F\u53EF\u81EA\u5DF1\u5199\uFF09",
523
+ inputType: "single",
524
+ required: false,
525
+ allowCustomInput: true,
526
+ options: CUSTOMER_NEED_OPTIONS.map((item) => ({ label: item, value: item }))
527
+ });
528
+ }
529
+ const missing = LOGISTICS_FIELDS.filter((key) => !data[key]);
530
+ const mobile = ((data.companions || []).find((item) => item && item.mobile) || {}).mobile || "";
531
+ if (missing.length || !mobile) {
532
+ const known = LOGISTICS_FIELDS.filter((key) => data[key]).map((key) => `${LOGISTICS_LABEL[key]}\uFF1A${data[key]}`);
533
+ if (mobile) known.push(`${LOGISTICS_LABEL.mobile}\uFF1A${mobile}`);
534
+ panels.push({
535
+ id: "logistics",
536
+ // 标题严格单行:不拼字段清单、不拼已识别项、不讲规则——拼了必被截断成「…」
537
+ title: LOGISTICS_TITLE,
538
+ inputType: "text",
539
+ required: false,
540
+ allowCustomInput: true,
541
+ hint: known.length ? `\u5DF2\u8BC6\u522B\uFF1A${known.join("\uFF1B")}
542
+ \u8865\u6CA1\u5199\u7684\u5C31\u884C\u3002
543
+ ${LOGISTICS_HINT}` : LOGISTICS_HINT,
544
+ placeholder: LOGISTICS_PLACEHOLDER
545
+ });
546
+ }
547
+ return panels;
548
+ }
549
+
550
+ // src/shortcuts/reception/operations/runs.ts
551
+ import { randomBytes } from "node:crypto";
552
+ import { join } from "node:path";
553
+
554
+ // src/shortcuts/reception/operations/shared.ts
555
+ import { createHash as createHash2 } from "node:crypto";
556
+ import { chmodSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
557
+ import { dirname } from "node:path";
558
+ function canonical(value) {
559
+ if (value === null || typeof value !== "object") return JSON.stringify(value ?? null);
560
+ if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
561
+ const record = value;
562
+ const keys = Object.keys(record).sort();
563
+ return `{${keys.map((key) => `${JSON.stringify(key)}:${canonical(record[key])}`).join(",")}}`;
564
+ }
565
+ function sha256(text) {
566
+ return createHash2("sha256").update(String(text)).digest("hex");
567
+ }
568
+ function ensureDir(path) {
569
+ try {
570
+ mkdirSync(path, { recursive: true });
571
+ } catch {
572
+ }
573
+ }
574
+ function readJson(path, fallback = null) {
575
+ try {
576
+ return JSON.parse(readFileSync(path, "utf8"));
577
+ } catch {
578
+ return fallback;
579
+ }
580
+ }
581
+ function writeJson(path, value) {
582
+ ensureDir(dirname(path));
583
+ writeFileSync(path, JSON.stringify(value, null, 2));
584
+ }
585
+ var BOM = /^\uFEFF/;
586
+ var ZERO_WIDTH = /[\u200B-\u200D\uFEFF]/g;
587
+ function parseJsonText(raw) {
588
+ const src = String(raw ?? "");
589
+ const hasBom = src.charCodeAt(0) === 65279;
590
+ const cleaned = src.replace(BOM, "").replace(ZERO_WIDTH, "").trim();
591
+ try {
592
+ return { ok: true, value: JSON.parse(cleaned), hasBom };
593
+ } catch (firstError) {
594
+ const fixed = cleaned.replace(/[\u201C\u201D]/g, '"').replace(/[\u2018\u2019]/g, "'").replace(/,\s*([}\]])/g, "$1");
595
+ try {
596
+ return { ok: true, value: JSON.parse(fixed), hasBom, autoFixed: true };
597
+ } catch {
598
+ return {
599
+ ok: false,
600
+ reason: "invalid",
601
+ error: firstError.message,
602
+ preview: cleaned.slice(0, 120),
603
+ hasBom
604
+ };
605
+ }
606
+ }
607
+ }
608
+ function readJsonArg(options, name) {
609
+ const filePath = textOf(options, `${name}File`) || textOf(options, `${name}-file`);
610
+ if (filePath) {
611
+ let raw;
612
+ try {
613
+ raw = readFileSync(filePath, "utf8");
614
+ } catch (error) {
615
+ return {
616
+ ok: false,
617
+ reason: "file_unreadable",
618
+ path: filePath,
619
+ error: error.message
620
+ };
621
+ }
622
+ return { ...parseJsonText(raw), source: "file", path: filePath };
623
+ }
624
+ const inline = options[name];
625
+ if (inline === void 0 || inline === null || inline === true) {
626
+ return { ok: false, reason: "missing" };
627
+ }
628
+ return { ...parseJsonText(String(inline)), source: "inline" };
629
+ }
630
+ function jsonArg(options, name, config = {}) {
631
+ const prefix = config.code || name.toUpperCase().replace(/-/g, "_");
632
+ const result = readJsonArg(options, name);
633
+ if (result.ok) return result.value;
634
+ if (result.reason === "missing") {
635
+ if (!config.required) return null;
636
+ throw receptionValidationError(
637
+ `${prefix}_REQUIRED`,
638
+ `\u7F3A\u5C11 --${name} <JSON> \u6216 --${name}-file <path>`,
639
+ {
640
+ hint: config.hint || `\u63A8\u8350\u7528\u6587\u4EF6\u4F20\u53C2\uFF1A\u5148\u5199 ${name}.json\uFF0C\u518D --${name}-file ${name}.json`
641
+ }
642
+ );
643
+ }
644
+ if (result.reason === "file_unreadable") {
645
+ throw receptionValidationError(
646
+ `${prefix}_FILE_UNREADABLE`,
647
+ `\u8BFB\u4E0D\u5230 --${name}-file\uFF1A${result.path}`,
648
+ {
649
+ path: result.path,
650
+ detail: result.error,
651
+ hint: "\u68C0\u67E5\u6587\u4EF6\u662F\u5426\u5B58\u5728\u3001\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3001\u662F\u5426\u6709\u8BFB\u6743\u9650\uFF1B\u4E0D\u8981\u56E0\u6B64\u6539\u56DE\u5185\u8054\u4F20\u53C2"
652
+ }
653
+ );
654
+ }
655
+ throw receptionValidationError(
656
+ `${prefix}_INVALID`,
657
+ `--${name} \u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${result.error}`,
658
+ {
659
+ hint: "\u5E38\u89C1\u539F\u56E0\uFF1AUTF-8 BOM\uFF08hasBom:true\uFF09\u3001\u4E2D\u6587\u5F15\u53F7\u3001\u5C3E\u968F\u9017\u53F7\u3001shell \u5403\u6389\u53CC\u5F15\u53F7\u3002\u8BF7\u770B preview \u5B9A\u4F4D\uFF0C\u4FEE JSON \u672C\u8EAB\uFF0C\u4E0D\u8981\u6362\u4F20\u53C2\u65B9\u5F0F\u91CD\u8BD5",
660
+ preview: result.preview,
661
+ hasBom: result.hasBom
662
+ }
663
+ );
664
+ }
665
+ function textOf(options, key) {
666
+ const value = options[key];
667
+ if (value === void 0 || value === null || value === true || value === false) return "";
668
+ return String(value).trim();
669
+ }
670
+ function nameList(value) {
671
+ const list = Array.isArray(value) ? value : String(value ?? "").split(/[,,、;;\s]+/);
672
+ return list.map((item) => typeof item === "string" ? item : item && (item.name || item.id) || "").map((item) => String(item).trim()).filter(Boolean);
673
+ }
674
+
675
+ // src/shortcuts/reception/operations/runs.ts
676
+ function pad(value) {
677
+ return String(value).padStart(2, "0");
678
+ }
679
+ function newRunId(now = /* @__PURE__ */ new Date()) {
680
+ const stamp = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
681
+ return `rc-${stamp}-${randomBytes(2).toString("hex")}`;
682
+ }
683
+ function runsDir(stateDir) {
684
+ return join(stateDir, "runs");
685
+ }
686
+ function runPath(stateDir, runId) {
687
+ return join(runsDir(stateDir), `${runId}.json`);
688
+ }
689
+ function saveRun(stateDir, run) {
690
+ ensureDir(runsDir(stateDir));
691
+ writeJson(runPath(stateDir, run.runId), run);
692
+ return run;
693
+ }
694
+ function loadRun(stateDir, runId) {
695
+ if (!runId) {
696
+ throw receptionValidationError(
697
+ "RUN_ID_MISSING",
698
+ "\u7F3A\u5C11 --run-id\uFF08\u6B63\u5E38\u6D41\u7A0B\u5148\u7528 ask \u53D6 runId\uFF1Brun \u5DF2\u5931\u6548\u65F6\u6539\u7528 --known \u73B0\u573A\u91CD\u5EFA\uFF09",
699
+ { hint: `reception doc --known '{"customer":"\u2026","visitDate":"\u2026"}' --answers '{\u2026}'` }
700
+ );
701
+ }
702
+ const found = readJson(runPath(stateDir, runId));
703
+ if (!found) throw receptionRunNotFound(runId, stateDir);
704
+ return found;
705
+ }
706
+ function tryLoadRun(stateDir, runId) {
707
+ if (!runId) return null;
708
+ return readJson(runPath(stateDir, runId));
709
+ }
710
+
711
+ // src/shortcuts/reception/operations/ask.ts
712
+ async function ask(input, ctx) {
713
+ const startedAt = Date.now();
714
+ const known = input.known || {};
715
+ const workflow = input.workflow || DEFAULT_WORKFLOW;
716
+ const warnings = [];
717
+ const customerKeyword = input.customer || (typeof known.customer === "string" ? known.customer : "");
718
+ const data = { ...known };
719
+ delete data.customerId;
720
+ if (customerKeyword) data.customer = customerKeyword;
721
+ const escorts = nameList(known.escorts);
722
+ const explicitUser = nameList(input.user || "");
723
+ const companions = nameList(known.companions);
724
+ const names = escorts.length ? escorts : explicitUser.length ? explicitUser : companions;
725
+ if (names.length) data.companions = names.map((name) => ({ name }));
726
+ data.empId = "";
727
+ const runId = newRunId();
728
+ saveRun(ctx.stateDir, {
729
+ runId,
730
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
731
+ workflow,
732
+ outDir: ctx.outDir,
733
+ base: "",
734
+ data,
735
+ customer: null,
736
+ user: null,
737
+ mode: "browsertool"
738
+ });
739
+ const panels = buildPanels(data);
740
+ return {
741
+ state: "asked",
742
+ ok: true,
743
+ data: {
744
+ runId,
745
+ known: {
746
+ customer: data.customer || "",
747
+ visitDate: data.visitDate || "",
748
+ visitType: data.visitType || "",
749
+ companions: data.companions || [],
750
+ // 兜底由 render 阶段补:ask 不读会话,这里恒为空
751
+ contactFallback: ""
752
+ },
753
+ panels,
754
+ timings: { totalMs: Date.now() - startedAt }
755
+ },
756
+ warnings,
757
+ next: {
758
+ command: "ask_user(panels) \u2192 weaver-work-cli reception doc --run-id \u2026 --answers '{...}'",
759
+ reason: "\u4E00\u6B21\u95EE\u5B8C\uFF1Banswers \u539F\u6837\u56DE\u4F20"
760
+ }
761
+ };
762
+ }
763
+ var askOperation = {
764
+ execute: (input, ctx) => ask(input, ctx)
765
+ };
766
+
767
+ // src/shortcuts/reception/operations/doc.ts
768
+ import { readFileSync as readFileSync2 } from "node:fs";
769
+ import { basename as basename2, join as join4 } from "node:path";
770
+
771
+ // src/shortcuts/reception/operations/render-assets.ts
772
+ import { spawnSync, execFile } from "node:child_process";
773
+ import { existsSync } from "node:fs";
774
+ import { join as join3 } from "node:path";
775
+
776
+ // src/shortcuts/reception/operations/snapshot.ts
777
+ import { join as join2 } from "node:path";
778
+ function resolveSnapshot(explicitPath = "") {
779
+ const candidates = [
780
+ explicitPath,
781
+ process.env.RECEPTION_SNAPSHOT || "",
782
+ process.env.RECEPTION_SKILL_DIR ? join2(process.env.RECEPTION_SKILL_DIR, "data", "fields-snapshot.json") : "",
783
+ join2(process.cwd(), "data", "fields-snapshot.json"),
784
+ join2(process.cwd(), "..", "data", "fields-snapshot.json")
785
+ ].filter(Boolean);
786
+ for (const path of candidates) {
787
+ const parsed = readJson(path);
788
+ if (parsed && parsed.kind === SNAPSHOT_KIND) return { path, snapshot: parsed };
789
+ }
790
+ return { path: "", snapshot: null };
791
+ }
792
+ function skillRootFromSnapshot(snapshotPath) {
793
+ return join2(snapshotPath, "..", "..");
794
+ }
795
+
796
+ // src/shortcuts/reception/operations/render-assets.ts
797
+ var PYTHON_CACHE_FILE = "python.json";
798
+ var pythonCache;
799
+ function runSync(file, args, options = {}) {
800
+ const result = spawnSync(file, args, { encoding: "utf8", maxBuffer: 16 * 1024 * 1024, ...options });
801
+ return {
802
+ stdout: String(result.stdout || ""),
803
+ stderr: String(result.stderr || ""),
804
+ status: result.status
805
+ };
806
+ }
807
+ function runAsync(file, args) {
808
+ return new Promise((resolve) => {
809
+ execFile(file, args, { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 }, (error, stdout, stderr) => {
810
+ resolve({
811
+ stdout: String(stdout || ""),
812
+ stderr: String(stderr || ""),
813
+ status: error ? typeof error.code === "number" ? error.code : 1 : 0
814
+ });
815
+ });
816
+ });
817
+ }
818
+ function lastJsonLine(text) {
819
+ const lines = String(text || "").split(/\r?\n/).filter((line) => line.trim().startsWith("{"));
820
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
821
+ try {
822
+ return JSON.parse(lines[index]);
823
+ } catch {
824
+ }
825
+ }
826
+ return null;
827
+ }
828
+ function pickPython(stateDir) {
829
+ if (pythonCache !== void 0) return pythonCache;
830
+ if (process.env.RECEPTION_PY) {
831
+ pythonCache = process.env.RECEPTION_PY;
832
+ return pythonCache;
833
+ }
834
+ const cachePath = join3(stateDir, PYTHON_CACHE_FILE);
835
+ const disk = readJson(cachePath);
836
+ if (disk?.py && Date.now() - Number(disk.at || 0) < PYTHON_CACHE_TTL_MS) {
837
+ if (runSync(disk.py, ["-c", "import docx"], { stdio: "ignore" }).status === 0) {
838
+ pythonCache = disk.py;
839
+ return pythonCache;
840
+ }
841
+ }
842
+ for (const candidate of ["python3", "python", "py"]) {
843
+ const args = candidate === "py" ? ["-3", "-c", "import docx"] : ["-c", "import docx"];
844
+ if (runSync(candidate, args, { stdio: "ignore" }).status === 0) {
845
+ pythonCache = candidate;
846
+ try {
847
+ writeJson(cachePath, { py: candidate, at: Date.now() });
848
+ } catch {
849
+ }
850
+ return candidate;
851
+ }
852
+ }
853
+ pythonCache = null;
854
+ return null;
855
+ }
856
+ function resolveRenderPy(explicitPath = "", snapshotPath = "") {
857
+ const candidates = [
858
+ explicitPath,
859
+ process.env.RECEPTION_RENDER_PY || "",
860
+ snapshotPath ? join3(skillRootFromSnapshot(snapshotPath), "scripts", "render.py") : "",
861
+ join3(process.cwd(), "scripts", "render.py")
862
+ ].filter(Boolean);
863
+ for (const path of candidates) {
864
+ if (existsSync(path)) return path;
865
+ }
866
+ throw receptionEnvironmentError(
867
+ "RENDER_PY_MISSING",
868
+ "\u627E\u4E0D\u5230 render.py\uFF1A\u8BF7\u4F20 --render-py\uFF0C\u6216\u786E\u4FDD\u6280\u80FD\u5305 scripts/render.py \u5B58\u5728",
869
+ { candidates }
870
+ );
871
+ }
872
+ function parseRenderOutput(result, outDir) {
873
+ const parsed = lastJsonLine(result.stdout);
874
+ if (!parsed) {
875
+ throw receptionBusinessError("RENDER_NO_JSON", "\u6E32\u67D3\u5931\u8D25\uFF1Arender.py \u672A\u8FD4\u56DE JSON", {
876
+ hint: `\u68C0\u67E5 ${outDir} \u662F\u5426\u53EF\u5199\u3001render.py \u662F\u5426\u5B8C\u6574`,
877
+ detail: String(result.stderr || "").split(/\r?\n/).filter(Boolean).slice(-12).join("\n").slice(-1200)
878
+ });
879
+ }
880
+ if (!parsed.ok) {
881
+ throw receptionBusinessError("RENDER_FAILED", `\u6E32\u67D3\u5931\u8D25: ${parsed.error || "\u672A\u77E5\u9519\u8BEF"}`, {
882
+ hint: "\u591A\u4E3A\u5B57\u6BB5\u7C7B\u578B\u4E0D\u5339\u914D\uFF08\u65E5\u671F\u9700 yyyy-MM-dd\u3001\u91D1\u989D\u4E3A\u6570\u5B57\uFF09\uFF1B\u6309 detail \u4FEE\u6570\u636E\u540E\u91CD\u8DD1",
883
+ detail: String(result.stderr || "").split(/\r?\n/).filter(Boolean).slice(-12).join("\n").slice(-1200)
884
+ });
885
+ }
886
+ return parsed;
887
+ }
888
+ async function renderOnly(options) {
889
+ ensureDir(options.outDir);
890
+ const args = [options.renderPy, "--data", options.dataPath, "--out-dir", options.outDir, "--only", options.only];
891
+ const raw = await runAsync(options.python, args);
892
+ return parseRenderOutput(raw, options.outDir);
893
+ }
894
+ function mergeTwo(docx, md) {
895
+ const files = [...docx.files || [], ...md.files || []];
896
+ const qa = { ...docx.qa || {}, ...md.qa || {} };
897
+ if (docx.qa && docx.qa.external) qa.external = docx.qa.external;
898
+ const warnings = [
899
+ ...docx.qa && docx.qa.warnings || [],
900
+ ...md.qa && md.qa.warnings || []
901
+ ];
902
+ if (warnings.length) qa.warnings = warnings;
903
+ const verify = { ...docx.verify || {}, ...md.verify || {} };
904
+ verify.fileCount = files.length;
905
+ return {
906
+ ok: true,
907
+ files,
908
+ qa,
909
+ verify,
910
+ agendaRows: docx.agendaRows || md.agendaRows || [],
911
+ scheduleRows: docx.scheduleRows || md.scheduleRows || []
912
+ };
913
+ }
914
+ async function renderBoth(options) {
915
+ ensureDir(options.outDir);
916
+ const startedAt = Date.now();
917
+ let docxMs = 0;
918
+ let mdMs = 0;
919
+ const docxPromise = renderOnly({ ...options, only: "docx" }).then((result) => {
920
+ docxMs = Date.now() - startedAt;
921
+ return result;
922
+ });
923
+ const mdPromise = renderOnly({ ...options, only: "md" }).then((result) => {
924
+ mdMs = Date.now() - startedAt;
925
+ return result;
926
+ });
927
+ const [docxResult, mdResult] = await Promise.all([docxPromise, mdPromise]);
928
+ return {
929
+ result: mergeTwo(docxResult, mdResult),
930
+ docxResult,
931
+ mdResult,
932
+ docxMs,
933
+ mdMs,
934
+ parallelMs: Date.now() - startedAt
935
+ };
936
+ }
937
+ function requirePython(stateDir) {
938
+ const python = pickPython(stateDir);
939
+ if (!python) {
940
+ throw receptionEnvironmentError(
941
+ "NO_PYTHON_DOCX",
942
+ "\u7F3A python3 + python-docx\uFF0C\u65E0\u6CD5\u6E32\u67D3 docx",
943
+ { hint: "pip install python-docx\uFF1B\u79BB\u7EBF\u73AF\u5883\u53EA\u80FD\u4EA4\u4ED8 md" }
944
+ );
945
+ }
946
+ return python;
947
+ }
948
+
949
+ // src/shortcuts/reception/operations/doc.ts
950
+ function applyCases(data, casesFile) {
951
+ let raw;
952
+ try {
953
+ raw = readFileSync2(casesFile, "utf8");
954
+ } catch (error) {
955
+ throw receptionValidationError("CASES_FILE_UNREADABLE", `\u8BFB\u4E0D\u5230 --cases-file\uFF1A${casesFile}`, {
956
+ path: casesFile,
957
+ detail: error.message,
958
+ hint: "\u68C0\u67E5\u8DEF\u5F84\u4E0E\u8BFB\u6743\u9650"
959
+ });
960
+ }
961
+ const parsed = parseJsonText(raw);
962
+ if (!parsed.ok) {
963
+ throw receptionValidationError("CASES_INVALID", `--cases-file \u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${parsed.error}`, {
964
+ preview: parsed.preview,
965
+ hasBom: parsed.hasBom,
966
+ hint: "\u5E38\u89C1\u539F\u56E0\uFF1AUTF-8 BOM\uFF08hasBom:true\uFF09\u3001\u4E2D\u6587\u5F15\u53F7\u3001\u5C3E\u968F\u9017\u53F7\uFF1B\u4FEE JSON \u672C\u8EAB\uFF0C\u4E0D\u8981\u6362\u4F20\u53C2\u65B9\u5F0F"
967
+ });
968
+ }
969
+ const payload = parsed.value;
970
+ const list = Array.isArray(payload) ? payload : payload.cases || payload.items || [];
971
+ if (Array.isArray(list) && list.length) data.cases = list;
972
+ if (payload && !Array.isArray(payload)) {
973
+ const note = payload.note || payload.casesNote || "";
974
+ if (note) data.casesNote = String(note);
975
+ const query = payload.query || payload.casesQuery || "";
976
+ if (query) data.casesQuery = String(query);
977
+ const experts = payload.experts || payload.expertItems || [];
978
+ if (Array.isArray(experts) && experts.length) data.experts = experts;
979
+ const expertsNote = payload.expertsNote || payload.expertNote || "";
980
+ if (expertsNote) data.expertsNote = String(expertsNote);
981
+ const expertsQuery = payload.expertsQuery || payload.expertQuery || "";
982
+ if (expertsQuery) data.expertsQuery = String(expertsQuery);
983
+ }
984
+ }
985
+ async function doc(input, ctx) {
986
+ const startedAt = Date.now();
987
+ const runIdArg = String(input.runId || "").trim();
988
+ const knownArg = input.known || null;
989
+ let run = runIdArg ? tryLoadRun(ctx.stateDir, runIdArg) : null;
990
+ let rebuilt = false;
991
+ if (!run) {
992
+ if (!knownArg) {
993
+ if (!runIdArg) {
994
+ throw receptionValidationError(
995
+ "RUN_ID_MISSING",
996
+ "\u7F3A\u5C11 --run-id\uFF1A\u6B63\u5E38\u6D41\u7A0B\u5148\u7528 ask \u53D6 runId\uFF1Brun \u5DF2\u5931\u6548\u65F6\u6539\u7528 --known \u73B0\u573A\u91CD\u5EFA",
997
+ { hint: `reception doc --known '{"customer":"\u2026","visitDate":"\u2026"}' --answers '{\u2026}'` }
998
+ );
999
+ }
1000
+ throw receptionValidationError(
1001
+ "RUN_NOT_FOUND",
1002
+ `\u627E\u4E0D\u5230 run\uFF1A${runIdArg}\uFF08\u53EF\u80FD\u5DF2\u8FC7\u671F\u6216\u6362\u4E86\u673A\u5668\uFF09`,
1003
+ { runId: runIdArg, stateDir: ctx.stateDir, hint: "\u628A ask \u7528\u8FC7\u7684 --known \u4E00\u8D77\u5E26\u4E0A\u91CD\u8DD1\u672C\u6761\uFF0CCLI \u4F1A\u73B0\u573A\u91CD\u5EFA run" }
1004
+ );
1005
+ }
1006
+ rebuilt = Boolean(runIdArg);
1007
+ const session = await ctx.host.getSession();
1008
+ run = {
1009
+ // 重建的 run 用新 id:传进来的那个已经不存在了,复用它会让人误以为原 run 还在
1010
+ runId: newRunId(),
1011
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1012
+ workflow: input.workflow || DEFAULT_WORKFLOW,
1013
+ outDir: input.outDir || ctx.outDir,
1014
+ base: session.baseUrl,
1015
+ data: { ...knownArg },
1016
+ customer: null,
1017
+ user: null,
1018
+ mode: "browsertool"
1019
+ };
1020
+ }
1021
+ const answers = input.answers ?? run.answers ?? {};
1022
+ const data = mergeAnswers(run, answers);
1023
+ if (input.casesFile) applyCases(data, input.casesFile);
1024
+ const outDir = input.outDir || run.outDir || ctx.outDir;
1025
+ ensureDir(outDir);
1026
+ const warnings = [];
1027
+ const dataHash = sha256(canonical(data)).slice(0, 32);
1028
+ const dataPath = join4(ctx.stateDir, `doc-data-${dataHash.slice(0, 12)}.json`);
1029
+ writeJson(dataPath, data);
1030
+ const python = requirePython(ctx.stateDir);
1031
+ const renderPy = resolveRenderPy(input.renderPy || "", input.snapshot || "");
1032
+ const noUpload = input.noUpload === true;
1033
+ const sessionPromise = noUpload ? Promise.resolve(null) : ctx.host.getSession();
1034
+ const renderPromise = renderBoth({ python, renderPy, dataPath, outDir });
1035
+ const uploadPromise = renderPromise.then(async (rendered2) => {
1036
+ if (noUpload) return null;
1037
+ const session = await sessionPromise;
1038
+ if (!session || !session.available) {
1039
+ return { ups: [], uploadMs: 0, base: "", skipped: "NO_SESSION" };
1040
+ }
1041
+ const uploadStartedAt = Date.now();
1042
+ const picks = ["docx", "md"].map((kind) => ({
1043
+ kind,
1044
+ file: (rendered2.result.files || []).find((file) => file.kind === kind)
1045
+ })).filter((item) => item.file);
1046
+ const ups = [];
1047
+ for (const item of picks) {
1048
+ const result = await ctx.host.uploadFile(item.file.path);
1049
+ ups.push({ kind: item.kind, ...result });
1050
+ }
1051
+ return { ups, uploadMs: Date.now() - uploadStartedAt, base: session.baseUrl };
1052
+ });
1053
+ const [rendered, uploadResult] = await Promise.all([renderPromise, uploadPromise]);
1054
+ const docxMs = rendered.docxMs;
1055
+ const mdMs = rendered.mdMs;
1056
+ let attachment = null;
1057
+ let attachments = [];
1058
+ let uploadMs = null;
1059
+ let uploadDiagnostics = [];
1060
+ if (uploadResult) {
1061
+ uploadMs = uploadResult.uploadMs;
1062
+ const succeeded = uploadResult.ups.filter((item) => item.ok && item.fileid);
1063
+ const failed = uploadResult.ups.filter((item) => !item.ok);
1064
+ if (succeeded.length) {
1065
+ attachments = succeeded.map((item) => ({
1066
+ fileid: String(item.fileid),
1067
+ name: item.name || "",
1068
+ kind: item.kind
1069
+ }));
1070
+ attachment = attachments.find((item) => item.kind === "docx") || attachments[0];
1071
+ }
1072
+ if (failed.length) {
1073
+ uploadDiagnostics = failed.map((item) => ({
1074
+ kind: item.kind,
1075
+ error: item.reason || item.error || "\u672A\u77E5",
1076
+ httpStatus: item.httpStatus ?? null,
1077
+ contentType: item.contentType || null,
1078
+ hint: item.hint || null,
1079
+ responsePreview: item.detail ? String(item.detail).slice(0, 300) : null
1080
+ }));
1081
+ const reason = uploadDiagnostics.map((item) => {
1082
+ const bits = [`${item.kind}:${item.error}`];
1083
+ if (item.httpStatus) bits.push(`HTTP ${item.httpStatus}`);
1084
+ if (item.contentType && !/json/i.test(String(item.contentType))) {
1085
+ bits.push(`content-type=${item.contentType}`);
1086
+ }
1087
+ if (item.responsePreview) bits.push(`\u54CD\u5E94\u7247\u6BB5=${String(item.responsePreview).slice(0, 160)}`);
1088
+ if (item.hint) bits.push(`\u63D0\u793A=${item.hint}`);
1089
+ return bits.join(" | ");
1090
+ }).join("\uFF1B");
1091
+ warnings.push(`\u9644\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF08${reason}\uFF09\uFF1A\u672C\u5730\u6587\u4EF6\u5DF2\u751F\u6210\uFF08\u89C1 data.files\uFF09\uFF0C\u53EF\u5728\u9875\u9762\u624B\u52A8\u6DFB\u52A0`);
1092
+ }
1093
+ if (uploadResult.skipped === "NO_SESSION") {
1094
+ warnings.push("\u672A\u53D6\u5F97 E10 \u4F1A\u8BDD\uFF1A\u9644\u4EF6\u672A\u4E0A\u4F20\uFF0C\u4EA7\u7269\u6309\u672C\u5730\u6587\u4EF6\u4EA4\u4ED8");
1095
+ }
1096
+ } else if (noUpload) {
1097
+ warnings.push("\u5DF2\u6309 --no-upload \u8DF3\u8FC7\u4E0A\u4F20\uFF1A\u9875\u9762\u4E0A\u9700\u8981\u624B\u52A8\u6DFB\u52A0\u9644\u4EF6");
1098
+ }
1099
+ run.answers = answers;
1100
+ run.data = data;
1101
+ run.files = rendered.result.files || [];
1102
+ if (input.snapshot) run.snapshotPath = input.snapshot;
1103
+ if (uploadResult && uploadResult.base) run.base = uploadResult.base;
1104
+ if (attachment) run.attachmentFileid = String(attachment.fileid);
1105
+ if (attachments.length) run.attachmentFileids = attachments;
1106
+ saveRun(ctx.stateDir, run);
1107
+ let internalDoc = null;
1108
+ const mdFile = (rendered.result.files || []).find((file) => file.kind === "md");
1109
+ if (mdFile?.path) {
1110
+ try {
1111
+ internalDoc = {
1112
+ name: basename2(mdFile.path),
1113
+ path: mdFile.path,
1114
+ content: readFileSync2(mdFile.path, "utf8")
1115
+ };
1116
+ } catch {
1117
+ internalDoc = null;
1118
+ }
1119
+ }
1120
+ return {
1121
+ state: "doc-ready",
1122
+ ok: true,
1123
+ data: {
1124
+ runId: run.runId,
1125
+ rebuilt,
1126
+ files: (rendered.result.files || []).map((file) => ({ kind: file.kind, path: file.path, size: file.size })),
1127
+ internalDoc,
1128
+ attachment,
1129
+ attachments,
1130
+ attachmentPending: attachments.length === 0,
1131
+ uploadDiagnostics,
1132
+ qa: rendered.result.qa || {},
1133
+ verify: rendered.result.verify || {},
1134
+ timings: {
1135
+ docxMs,
1136
+ mdMs,
1137
+ uploadMs,
1138
+ parallelMs: rendered.parallelMs,
1139
+ totalMs: Date.now() - startedAt
1140
+ }
1141
+ },
1142
+ warnings,
1143
+ next: {
1144
+ command: `weaver-work-cli reception render --run-id ${run.runId}`,
1145
+ reason: "\u9644\u4EF6 fileid \u5DF2\u5199\u5165 run\uFF0Crender \u4F1A\u81EA\u52A8\u5E26\u4E0A"
1146
+ }
1147
+ };
1148
+ }
1149
+ var docOperation = {
1150
+ execute: (input, ctx) => doc(input, ctx)
1151
+ };
1152
+
1153
+ // src/shortcuts/reception/operations/render.ts
1154
+ import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
1155
+ import { join as join5 } from "node:path";
1156
+
1157
+ // src/shortcuts/reception/operations/browsertool.ts
1158
+ var SDK_RENDER_TYPES = ["inline", "popup", "drawer"];
1159
+ function normalizeRenderType(value) {
1160
+ const text = String(value || "").trim().toLowerCase();
1161
+ return SDK_RENDER_TYPES.includes(text) ? text : "";
1162
+ }
1163
+ var DEFAULT_SDK_RENDER = normalizeRenderType(process.env.RECEPTION_SDK_RENDER) || "drawer";
1164
+ var resolveRenderType = (value) => normalizeRenderType(value) || DEFAULT_SDK_RENDER;
1165
+ function renderBrowsertool(options) {
1166
+ const base = String(options.baseUrl || "").replace(/\/+$/u, "");
1167
+ const id = String(options.workflowId || "").trim();
1168
+ if (!base || !id) throw new Error("\u6E32\u67D3 browsertool \u9700\u8981 baseUrl \u4E0E workflowId");
1169
+ const renderType = normalizeRenderType(options.sdkRenderType) || DEFAULT_SDK_RENDER;
1170
+ const createPath = `/flowpage/create/${id}`;
1171
+ const payload = {
1172
+ version: 1,
1173
+ callId: "call_001",
1174
+ toolId: "fill_form",
1175
+ arguments: {
1176
+ type: "e10",
1177
+ title: String(options.workflowName || ""),
1178
+ src: `${base}/sp/workflow${createPath}?workflowId=${id}&isCreate=1`,
1179
+ sdkRenderType: renderType,
1180
+ sdkOptions: {
1181
+ compName: "ui.CorsComponent",
1182
+ routerType: "MemoryRouter",
1183
+ routerProps_pc: { initialEntries: [createPath] },
1184
+ routerProps_mobile: { initialEntries: [createPath] },
1185
+ params_pc: { app: "@weapp/workflow", compName: "Comp.WffpRoute", noMDialog: true },
1186
+ params_mobile: { app: "@weapp/workflow", compName: "Comp.MWffpRoute", noMDialog: true },
1187
+ params: {
1188
+ customParams: {
1189
+ ...options.customParams.values,
1190
+ fieldAssignKeys: options.customParams.keys.join(",")
1191
+ }
1192
+ }
1193
+ }
1194
+ }
1195
+ };
1196
+ return `<browsertool>
1197
+ ${JSON.stringify(payload, null, 2)}
1198
+ </browsertool>`;
1199
+ }
1200
+
1201
+ // src/shortcuts/reception/operations/customparams.ts
1202
+ var MULTI_SEPARATOR = ",";
1203
+ var ROW_SEPARATOR = ";";
1204
+ var SCALAR_KEYS = ["id", "optionId", "fileId", "fileid", "fid", "value"];
1205
+ function urlParamScalar(value) {
1206
+ if (value === null || value === void 0) return "";
1207
+ if (typeof value === "object") {
1208
+ const record = value;
1209
+ for (const key of SCALAR_KEYS) {
1210
+ const picked = record[key];
1211
+ if (picked === null || picked === void 0) continue;
1212
+ const text = String(picked).trim();
1213
+ if (text) return text;
1214
+ }
1215
+ return "";
1216
+ }
1217
+ return String(value).trim();
1218
+ }
1219
+ function urlParamValue(value) {
1220
+ if (value === null || value === void 0) return "";
1221
+ if (Array.isArray(value)) {
1222
+ return value.map((item) => urlParamScalar(item)).filter(Boolean).join(MULTI_SEPARATOR);
1223
+ }
1224
+ return urlParamScalar(value);
1225
+ }
1226
+ function buildCustomParams(items = []) {
1227
+ const ordered = [];
1228
+ const main = /* @__PURE__ */ new Map();
1229
+ const detail = /* @__PURE__ */ new Map();
1230
+ for (const item of items) {
1231
+ const fieldId = String(item && item.fieldId || "").trim();
1232
+ if (!fieldId) continue;
1233
+ const text = urlParamValue(item.value);
1234
+ if (!text) continue;
1235
+ const isDetail = item.dataIndex !== void 0 && item.dataIndex !== null;
1236
+ if (!isDetail) {
1237
+ if (!main.has(fieldId) && !detail.has(fieldId)) ordered.push(fieldId);
1238
+ main.set(fieldId, text);
1239
+ continue;
1240
+ }
1241
+ if (!detail.has(fieldId)) {
1242
+ if (!main.has(fieldId)) ordered.push(fieldId);
1243
+ detail.set(fieldId, []);
1244
+ }
1245
+ const index = Number(item.dataIndex);
1246
+ detail.get(fieldId).push({ index: Number.isFinite(index) ? index : 0, text });
1247
+ }
1248
+ const values = {};
1249
+ for (const fieldId of ordered) {
1250
+ const rows = detail.get(fieldId);
1251
+ if (rows && rows.length) {
1252
+ rows.sort((left, right) => left.index - right.index);
1253
+ values[fieldId] = rows.map((row) => row.text).join(ROW_SEPARATOR);
1254
+ continue;
1255
+ }
1256
+ values[fieldId] = main.get(fieldId) ?? "";
1257
+ }
1258
+ return { values, keys: ordered };
1259
+ }
1260
+
1261
+ // src/shortcuts/reception/operations/schedule.ts
1262
+ var STANDARD_AGENDA = [
1263
+ { offset: 0, item: "\u516C\u53F8\u53C2\u89C2", activity: "\u53C2\u89C2\u6CDB\u5FAE\u4E0A\u6D77\u603B\u90E8\u5C55\u5385\u4E0E\u529E\u516C\u533A\uFF0C\u4E86\u89E3\u516C\u53F8\u53D1\u5C55\u5386\u7A0B\u4E0E\u4EA7\u54C1\u80FD\u529B" },
1264
+ { offset: 45, item: "\u65B9\u6848\u4ECB\u7ECD", activity: "" },
1265
+ { offset: 120, item: "\u8BA8\u8BBA\u4EA4\u6D41", activity: "\u53CC\u65B9\u56F4\u7ED5\u5173\u6CE8\u70B9\u4EA4\u6D41\u7B54\u7591\uFF0C\u660E\u786E\u540E\u7EED\u63A8\u8FDB\u8282\u594F" }
1266
+ ];
1267
+ var SEVEN = ["date", "time", "item", "place", "person", "activity", "remark"];
1268
+ function hhmmPlus(start, mins) {
1269
+ const base = /^\d{1,2}:\d{2}$/.test(String(start || "")) ? String(start) : "09:30";
1270
+ const [hour, minute] = base.split(":").map(Number);
1271
+ const total = ((hour * 60 + minute + mins) % 1440 + 1440) % 1440;
1272
+ return `${String(Math.floor(total / 60)).padStart(2, "0")}:${String(total % 60).padStart(2, "0")}`;
1273
+ }
1274
+ function pick7(row) {
1275
+ if (!row || typeof row !== "object" || Array.isArray(row)) return null;
1276
+ const source = row;
1277
+ const out = {};
1278
+ for (const key of SEVEN) {
1279
+ const value = source[key];
1280
+ if (value !== null && value !== void 0 && String(value).trim()) out[key] = String(value).trim();
1281
+ }
1282
+ return Object.keys(out).length ? out : null;
1283
+ }
1284
+ function normalizeScheduleRows(data = {}) {
1285
+ const rows = [];
1286
+ const push = (row) => {
1287
+ if (row) rows.push(row);
1288
+ };
1289
+ const companions = Array.isArray(data.companions) ? data.companions : [];
1290
+ const escortNames = nameList(data.escorts);
1291
+ const mainPerson = escortNames[0] || companions.map((item) => typeof item === "string" ? item : item && item.name || "").filter(Boolean)[0] || data.contact || "";
1292
+ if (Array.isArray(data.scheduleRows)) data.scheduleRows.forEach((row) => push(pick7(row)));
1293
+ if (!rows.length && Array.isArray(data.schedule)) {
1294
+ data.schedule.forEach((row) => {
1295
+ if (Array.isArray(row)) {
1296
+ const [time, item, place] = row;
1297
+ push(pick7({ date: data.visitDate || data.arrivalDate || "", time, item, place, person: mainPerson }));
1298
+ } else {
1299
+ push(pick7(row));
1300
+ }
1301
+ });
1302
+ }
1303
+ if (!rows.length && Array.isArray(data.agenda)) {
1304
+ data.agenda.forEach((row) => push(pick7({
1305
+ date: data.visitDate || data.arrivalDate || "",
1306
+ time: row && (row.start || row.time) || "",
1307
+ item: row && row.item,
1308
+ place: row && row.place,
1309
+ person: row && row.person || mainPerson,
1310
+ activity: row && row.activity,
1311
+ remark: row && row.remark
1312
+ })));
1313
+ }
1314
+ if (!rows.length) {
1315
+ const date = data.visitDate || data.arrivalDate || "";
1316
+ const start = /^\d{1,2}:\d{2}$/.test(String(data.agendaStart || "")) ? String(data.agendaStart) : "09:30";
1317
+ const room = data.meetingRoom || "\u603B\u90E8129/130/131\u4F1A\u8BAE\u5BA4\uFF08\u6309\u4EBA\u6570\u62E9\u4E00\uFF09";
1318
+ for (const item of STANDARD_AGENDA) {
1319
+ push(pick7({
1320
+ date,
1321
+ time: hhmmPlus(start, item.offset),
1322
+ item: item.item,
1323
+ place: item.item === "\u516C\u53F8\u53C2\u89C2" ? "\u6CDB\u5FAE\u4E0A\u6D77\u603B\u90E8" : room,
1324
+ person: mainPerson,
1325
+ activity: item.item === "\u65B9\u6848\u4ECB\u7ECD" ? data.demand || "\u4EA7\u54C1\u4E0E\u65B9\u6848\u4ECB\u7ECD" : item.activity
1326
+ }));
1327
+ }
1328
+ }
1329
+ for (const row of rows) if (!row.person && mainPerson) row.person = mainPerson;
1330
+ return rows;
1331
+ }
1332
+
1333
+ // src/shortcuts/reception/operations/compose.ts
1334
+ var pick = (map, key) => key && map && map[String(key)] !== void 0 ? String(map[String(key)]) : "";
1335
+ function normAttachmentIds(list, single = "") {
1336
+ const fromList = (Array.isArray(list) ? list : []).map((item) => {
1337
+ if (typeof item === "string") return item.trim();
1338
+ if (!item || typeof item !== "object") return "";
1339
+ const record = item;
1340
+ return String(record.fileid || record.optionId || record.fileId || record.id || "").trim();
1341
+ }).filter(Boolean);
1342
+ if (fromList.length) return [...new Set(fromList)];
1343
+ return String(single || "").split(",").map((item) => item.trim()).filter(Boolean);
1344
+ }
1345
+ function composeInitialValues(options) {
1346
+ const { snapshot, data = {}, attachmentFileid = "", attachmentFileids = null } = options;
1347
+ const fields = snapshot && snapshot.fields || [];
1348
+ const codes = snapshot && snapshot.optionCodes || {};
1349
+ const warnings = [];
1350
+ const todos = [];
1351
+ const params = { values: {}, keys: [] };
1352
+ const valueOf = (name) => {
1353
+ switch (name) {
1354
+ // 客户名直接传中文,宿主已支持;不再拼 {id,name} 对象
1355
+ case "\u6765\u8BBF\u5BA2\u6237\u540D\u79F0":
1356
+ return data.customer || "";
1357
+ case "\u53C2\u89C2\u8BBF\u95EE\u7C7B\u578B":
1358
+ return pick(codes["\u53C2\u89C2\u8BBF\u95EE\u7C7B\u578B"], data.visitType) || data.visitType || "";
1359
+ case "\u5BA2\u6237\u5230\u8FBE\u65E5\u671F":
1360
+ case "\u5BA2\u6237\u53C2\u89C2\u65E5\u671F":
1361
+ return data.visitDate || data.arrivalDate || "";
1362
+ case "\u5BA2\u6237\u9700\u6C42":
1363
+ return data.demand || "";
1364
+ case "\u5BA2\u6237\u6027\u8D28":
1365
+ return pick(codes["\u5BA2\u6237\u6027\u8D28"], data.nature) || data.nature || "";
1366
+ case "\u9879\u76EE\u91D1\u989D\uFF08\u4E07\u5143\uFF09":
1367
+ return data.amount === 0 || data.amount ? data.amount : "";
1368
+ case "\u6CDB\u5FAE\u5206\u652F\u673A\u6784\u53C2\u4E0E\u4EBA\u5458\uFF08\u4E3B\u8054\u7EDC\u4EBA\uFF0C\u6B64\u4EBA\u5FC5\u987B\u966A\u5BA2\u6237\u4E00\u540C\u53C2\u89C2\uFF09": {
1369
+ const escorts = nameList(data.escorts);
1370
+ if (escorts.length) return escorts;
1371
+ const list = Array.isArray(data.companions) ? data.companions : [];
1372
+ const names = list.map((item) => typeof item === "string" ? item : item && (item.name || item.id)).map((item) => String(item || "").trim()).filter(Boolean);
1373
+ if (names.length) return names;
1374
+ return data.empId ? [String(data.empId)] : [];
1375
+ }
1376
+ case "\u662F\u5426\u9700\u8981\u9AD8\u5C42\u53C2\u4E0E":
1377
+ return pick(codes["\u662F\u5426\u9700\u8981\u9AD8\u5C42\u53C2\u4E0E"], data.senior) || data.senior || "";
1378
+ case "\u5BA2\u6237\u5E26\u961F\u4EBA":
1379
+ return data.leader || "";
1380
+ case "\u5BA2\u6237\u53C2\u89C2\u63A5\u5F85\u884C\u7A0B\u5355\uFF08\u7531\u884C\u653F\u7ECF\u7406\u6C47\u603B\u540E\u53CD\u9988\uFF09":
1381
+ return "";
1382
+ default:
1383
+ return "";
1384
+ }
1385
+ };
1386
+ const items = [];
1387
+ for (const field of fields) {
1388
+ if (field.doNotWrite) continue;
1389
+ const value = valueOf(field.name);
1390
+ if (value === "" || value === null || value === void 0) {
1391
+ if (field.required && ["\u5BA2\u6237\u6027\u8D28", "\u9879\u76EE\u91D1\u989D\uFF08\u4E07\u5143\uFF09", "\u5BA2\u6237\u5E26\u961F\u4EBA", "\u662F\u5426\u9700\u8981\u9AD8\u5C42\u53C2\u4E0E"].includes(field.name)) {
1392
+ todos.push(`${field.name} \u672A\u586B`);
1393
+ }
1394
+ continue;
1395
+ }
1396
+ items.push({ fieldId: field.id, value });
1397
+ }
1398
+ const mount = snapshot && snapshot.attachmentMountField && snapshot.attachmentMountField.fieldId || "";
1399
+ const attachIds = normAttachmentIds(attachmentFileids, attachmentFileid);
1400
+ const attachmentPending = attachIds.length === 0;
1401
+ if (mount && attachIds.length) items.push({ fieldId: mount, value: attachIds });
1402
+ const details = snapshot && snapshot.details || {};
1403
+ const rows = normalizeScheduleRows(data);
1404
+ const switchCode = details.switch && details.switch.codes && details.switch.codes[details.switch.on] || "1";
1405
+ if (rows.length && details.switch) items.push({ fieldId: details.switch.fieldId, value: switchCode });
1406
+ for (const [semantic, fieldId] of Object.entries(details.columns || {})) {
1407
+ rows.forEach((row, index) => items.push({
1408
+ fieldId: String(fieldId),
1409
+ value: row[semantic],
1410
+ dataIndex: index
1411
+ }));
1412
+ }
1413
+ if (!rows.length) warnings.push("\u65E5\u7A0B\u660E\u7EC6\u4E3A 0 \u884C\uFF1A\u9875\u9762\u4E0A\u660E\u7EC6\u4F1A\u662F\u7A7A\u7684");
1414
+ const built = buildCustomParams(items);
1415
+ params.values = built.values;
1416
+ params.keys = built.keys;
1417
+ if (attachmentPending) todos.push("\u884C\u7A0B\u5355\u9644\u4EF6\u672A\u4E0A\u4F20\uFF08\u53EF\u5728\u9875\u9762\u624B\u52A8\u6DFB\u52A0\uFF09");
1418
+ if (!data.companions || !data.companions.length) todos.push("\u966A\u540C\u4EBA\u5458\u672A\u586B");
1419
+ if (!data.demand) todos.push("\u5BA2\u6237\u9700\u6C42\u672A\u586B");
1420
+ return {
1421
+ values: params.values,
1422
+ keys: params.keys,
1423
+ todos,
1424
+ warnings,
1425
+ attachmentPending,
1426
+ detailRowCount: rows.length,
1427
+ items
1428
+ };
1429
+ }
1430
+
1431
+ // src/shortcuts/reception/operations/render.ts
1432
+ async function render(input, ctx) {
1433
+ const startedAt = Date.now();
1434
+ const run = loadRun(ctx.stateDir, String(input.runId || "").trim());
1435
+ const snapshotPath = String(input.snapshot || "").trim() || run.snapshotPath || "";
1436
+ const resolved = resolveSnapshot(snapshotPath);
1437
+ if (!resolved.snapshot) {
1438
+ throw receptionEnvironmentError(
1439
+ "SNAPSHOT_MISSING",
1440
+ "\u672A\u627E\u5230\u5B57\u6BB5\u5FEB\u7167 data/fields-snapshot.json",
1441
+ {
1442
+ hint: '\u4F20 --snapshot "<\u6280\u80FD\u76EE\u5F55>/data/fields-snapshot.json"\uFF1Bdoc \u4F20\u8FC7\u7684\u8BDD\u901A\u5E38\u5DF2\u8BB0\u5728 run \u91CC\uFF0C\u4E0D\u5FC5\u91CD\u590D\u4F20',
1443
+ snapshotPath
1444
+ }
1445
+ );
1446
+ }
1447
+ const answers = input.answers ?? run.answers ?? {};
1448
+ const data = mergeAnswers(run, answers);
1449
+ const argAttachment = String(input.attachmentFileid || "").trim();
1450
+ const runAttachments = Array.isArray(run.attachmentFileids) ? run.attachmentFileids : [];
1451
+ const hasCompanions = Array.isArray(data.companions) && data.companions.length > 0;
1452
+ const hasEscorts = nameList(data.escorts).length > 0;
1453
+ if (!data.empId && !hasCompanions && !hasEscorts) {
1454
+ const session = await ctx.host.getSession();
1455
+ data.empId = session.userId || "";
1456
+ }
1457
+ const composed = composeInitialValues({
1458
+ snapshot: resolved.snapshot,
1459
+ data,
1460
+ attachmentFileid: argAttachment || run.attachmentFileid || "",
1461
+ attachmentFileids: argAttachment ? null : runAttachments
1462
+ });
1463
+ const escortNames = nameList(data.escorts);
1464
+ const filledNames = (Array.isArray(data.companions) ? data.companions : []).map((item) => typeof item === "string" ? item : item && (item.name || item.id) || "").map((item) => String(item || "").trim()).filter(Boolean);
1465
+ if (escortNames.length && filledNames.length && !escortNames.some((name) => filledNames.includes(name))) {
1466
+ composed.warnings.push([
1467
+ "\u4E3B\u8054\u7EDC\u4EBA\u53EF\u80FD\u586B\u9519\uFF1A",
1468
+ `\u6307\u5B9A\u5BF9\u63A5\u4EBA\u4E3A ${escortNames.join(",")}\uFF0C\u5B9E\u9645\u586B\u5165 ${filledNames.join(",")}\u3002`,
1469
+ "\u8BF7\u5728\u9875\u9762\u4E0A\u6838\u5BF9\u300C\u6CDB\u5FAE\u5206\u652F\u673A\u6784\u53C2\u4E0E\u4EBA\u5458\uFF08\u4E3B\u8054\u7EDC\u4EBA\uFF09\u300D\u5B57\u6BB5\u3002"
1470
+ ].join(""));
1471
+ }
1472
+ if (!composed.keys.length) {
1473
+ return {
1474
+ state: "empty",
1475
+ ok: false,
1476
+ data: { customParams: {}, fieldAssignKeys: "", todos: composed.todos },
1477
+ warnings: composed.warnings,
1478
+ next: {
1479
+ command: "weaver-work-cli reception render --run-id \u2026 --answers '{...}'",
1480
+ reason: "\u6CA1\u6709\u4EFB\u4F55\u5B57\u6BB5\u6709\u503C\uFF0C\u5148\u8865\u9F50 answers"
1481
+ }
1482
+ };
1483
+ }
1484
+ const baseUrl = run.base || (await ctx.host.getSession()).baseUrl || resolved.snapshot.env && resolved.snapshot.env.baseUrl || "";
1485
+ const browsertool = renderBrowsertool({
1486
+ baseUrl,
1487
+ workflowId: resolved.snapshot.workflow && resolved.snapshot.workflow.workflowId || "",
1488
+ workflowName: resolved.snapshot.workflow && resolved.snapshot.workflow.name || run.workflow,
1489
+ customParams: { values: composed.values, keys: composed.keys },
1490
+ sdkRenderType: input.sdkRender
1491
+ });
1492
+ let browsertoolFile = "";
1493
+ try {
1494
+ const dir = runsDir(ctx.stateDir);
1495
+ mkdirSync2(dir, { recursive: true, mode: 448 });
1496
+ const file = join5(dir, `${run.runId}.browsertool.json`);
1497
+ const payload = browsertool.replace(/^<browsertool>\s*/u, "").replace(/\s*<\/browsertool>$/u, "");
1498
+ writeFileSync2(file, payload, "utf8");
1499
+ browsertoolFile = file.replace(/\\/gu, "/");
1500
+ } catch (error) {
1501
+ composed.warnings.push(
1502
+ `browsertool \u843D\u76D8\u5931\u8D25\uFF08${error.message}\uFF09\uFF1A\u6309\u6574\u6BB5 browsertool \u8F93\u51FA\u5373\u53EF`
1503
+ );
1504
+ }
1505
+ return {
1506
+ state: "rendered",
1507
+ ok: true,
1508
+ data: {
1509
+ customParams: composed.values,
1510
+ fieldAssignKeys: composed.keys.join(","),
1511
+ detailRowCount: composed.detailRowCount,
1512
+ attachmentPending: composed.attachmentPending,
1513
+ sdkRenderType: resolveRenderType(input.sdkRender),
1514
+ todos: composed.todos,
1515
+ browsertool,
1516
+ browsertoolFile,
1517
+ browsertoolRef: browsertoolFile ? `<browsertool-file path="${browsertoolFile}" />` : "",
1518
+ timings: { totalMs: Date.now() - startedAt }
1519
+ },
1520
+ warnings: composed.warnings,
1521
+ next: {
1522
+ command: "\u628A data.browsertool \u6574\u6BB5\u539F\u6837\u4F5C\u4E3A\u56DE\u590D\u6B63\u6587\uFF08\u4E0D\u5305\u4EE3\u7801\u5757\uFF09",
1523
+ reason: "\u5BBF\u4E3B\u4F1A\u6253\u5F00\u65B0\u5EFA\u9875\u5E76\u5E26\u503C\uFF1B\u7528\u6237\u81EA\u5DF1\u63D0\u4EA4"
1524
+ }
1525
+ };
1526
+ }
1527
+ var renderOperation = {
1528
+ execute: (input, ctx) => render(input, ctx)
1529
+ };
1530
+
1531
+ // src/shortcuts/reception/operations/docrender.ts
1532
+ async function docRender(input, ctx) {
1533
+ const docResult = await doc(input, ctx);
1534
+ if (!docResult.ok) return docResult;
1535
+ const runId = String((docResult.data || {}).runId || input.runId || "");
1536
+ const renderResult = await render({ runId, sdkRender: input.sdkRender }, ctx);
1537
+ return {
1538
+ state: renderResult.state,
1539
+ ok: renderResult.ok,
1540
+ data: {
1541
+ ...docResult.data,
1542
+ ...renderResult.data,
1543
+ runId
1544
+ },
1545
+ warnings: [...docResult.warnings || [], ...renderResult.warnings || []],
1546
+ next: renderResult.next
1547
+ };
1548
+ }
1549
+ var docRenderOperation = {
1550
+ execute: (input, ctx) => docRender(input, ctx)
1551
+ };
1552
+
1553
+ // src/shortcuts/reception/operations/registry.ts
1554
+ var REGISTRY = /* @__PURE__ */ new Map([
1555
+ ["reception.ask", askOperation],
1556
+ ["reception.doc", docOperation],
1557
+ ["reception.docRender", docRenderOperation],
1558
+ ["reception.render", renderOperation]
1559
+ ]);
1560
+ function getReceptionOperation(name) {
1561
+ const hit = REGISTRY.get(name);
1562
+ if (!hit) {
1563
+ throw new Error(`\u672A\u77E5 operation: ${name}\uFF08\u53EF\u7528\uFF1A${[...REGISTRY.keys()].join(" / ")}\uFF09`);
1564
+ }
1565
+ return hit;
1566
+ }
1567
+ var receptionOperationNames = [...REGISTRY.keys()];
1568
+
1569
+ // src/shortcuts/reception/manifest.ts
1570
+ var receptionOperations = [
1571
+ {
1572
+ name: "reception.ask",
1573
+ risk: "read",
1574
+ summary: "\u6309 7 \u9879\u62BD\u53D6\u7ED3\u679C\u51FA\u4EA4\u4E92\u9762\u677F\uFF1A\u7F3A\u9879\u624D\u51FA\u5C4F\uFF0C\u603B\u5C4F\u6570 \u22642\uFF08\u5BA2\u6237\u9700\u6C42 + \u63A5\u5F85\u7EC6\u8282\uFF09\u3002\u8FD4\u56DE runId \u4F9B doc \u4F7F\u7528\u3002",
1575
+ inputSchema: {
1576
+ type: "object",
1577
+ additionalProperties: false,
1578
+ required: ["known"],
1579
+ properties: {
1580
+ known: {
1581
+ type: "object",
1582
+ description: "\u6A21\u578B\u62BD\u53D6\u7684 7 \u9879\uFF1Acustomer/headcount/visitDate/visitType/companions/demand/\u63A5\u5F85\u7EC6\u8282",
1583
+ additionalProperties: true
1584
+ },
1585
+ user: { type: "string", description: "\u966A\u540C\u4EBA\u5458\u59D3\u540D\uFF0C\u591A\u4EBA\u7528\u9017\u53F7\u5206\u9694\uFF1B\u4E0D\u4F20\u5219\u7528\u5F53\u524D\u767B\u5F55\u4EBA\u515C\u5E95" },
1586
+ customer: { type: "string", description: "\u5BA2\u6237\u540D\u79F0\uFF08\u8986\u76D6 known.customer\uFF09" },
1587
+ workflow: { type: "string", description: "\u76EE\u6807\u6D41\u7A0B\u540D\uFF0C\u9ED8\u8BA4\u300C\u6CDB\u5FAE\u5BA2\u6237\u53C2\u89C2\u63A5\u5F85\u6D41\u7A0B\u300D" }
1588
+ }
1589
+ },
1590
+ outputSchema: {
1591
+ type: "object",
1592
+ properties: {
1593
+ runId: { type: "string" },
1594
+ panels: { type: "array", items: { type: "object" } },
1595
+ known: { type: "object" },
1596
+ timings: { type: "object" }
1597
+ }
1598
+ }
1599
+ },
1600
+ {
1601
+ name: "reception.doc",
1602
+ risk: "read",
1603
+ summary: "\u751F\u6210\u5BA2\u6237\u7248\u884C\u7A0B\u5355 docx \u4E0E\u5185\u90E8\u7248\u63A5\u5F85\u4EA4\u6D41\u53C2\u8003\u6587\u6863 md\uFF0C\u5E76\u4E0A\u4F20\u4E24\u4EFD\u9644\u4EF6\u62FF fileid\u3002\u96F6\u5199\u8BF7\u6C42\uFF1A\u6D41\u7A0B\u4E0D\u843D\u5E93\u3001\u4E0D\u63D0\u4EA4\u3002",
1604
+ inputSchema: {
1605
+ type: "object",
1606
+ additionalProperties: false,
1607
+ properties: {
1608
+ runId: { type: "string", description: "ask \u8FD4\u56DE\u7684 runId\uFF1Brun \u5931\u6548\u65F6\u6539\u7528 known \u73B0\u573A\u91CD\u5EFA" },
1609
+ known: { type: "object", description: "run \u5931\u6548\u65F6\u7684 7 \u9879\u62BD\u53D6\u7ED3\u679C\uFF0C\u7528\u4E8E\u73B0\u573A\u91CD\u5EFA run" },
1610
+ answers: { type: "object", description: "ask_user \u9762\u677F\u56DE\u586B\u503C\uFF1A{customer_need, logistics, fields}" },
1611
+ casesFile: { type: "string", description: "\u6848\u4F8B + \u4E13\u5BB6\u68C0\u7D22\u7ED3\u679C JSON \u6587\u4EF6\u8DEF\u5F84\uFF08\u8F6F\u4F9D\u8D56\uFF0C\u7F3A\u7701\u5219\u4E0D\u6CE8\u5165\uFF09" },
1612
+ workflow: { type: "string", description: "\u76EE\u6807\u6D41\u7A0B\u540D" },
1613
+ outDir: { type: "string", description: "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55" },
1614
+ noUpload: { type: "boolean", description: "\u8DF3\u8FC7\u9644\u4EF6\u4E0A\u4F20\uFF0C\u53EA\u51FA\u672C\u5730\u6587\u4EF6" },
1615
+ snapshot: { type: "string", description: "\u5B57\u6BB5\u5FEB\u7167\u8DEF\u5F84\uFF1B\u540C\u65F6\u7528\u4E8E\u63A8\u5BFC\u6280\u80FD\u5305\u5185 render.py \u4F4D\u7F6E" },
1616
+ renderPy: { type: "string", description: "\u663E\u5F0F\u6307\u5B9A render.py \u8DEF\u5F84" }
1617
+ }
1618
+ },
1619
+ outputSchema: {
1620
+ type: "object",
1621
+ properties: {
1622
+ runId: { type: "string" },
1623
+ rebuilt: { type: "boolean" },
1624
+ files: { type: "array", items: { type: "object" } },
1625
+ internalDoc: {
1626
+ type: ["object", "null"],
1627
+ description: "\u5185\u90E8\u53C2\u8003\u6587\u6863\u6B63\u6587 {name,path,content}\uFF1Bnull \u8868\u793A\u6CA1\u751F\u6210\u3002\u6A21\u578B\u636E\u6B64\u5728\u5BF9\u8BDD\u4E2D\u539F\u6837\u8D34\u51FA\uFF0C\u4E0D\u5FC5\u518D\u8BFB\u4EA7\u7269\u6587\u4EF6"
1628
+ },
1629
+ attachments: { type: "array", items: { type: "object" } },
1630
+ attachmentPending: { type: "boolean" },
1631
+ qa: { type: "object" },
1632
+ verify: { type: "object" },
1633
+ timings: { type: "object" }
1634
+ }
1635
+ }
1636
+ },
1637
+ {
1638
+ name: "reception.render",
1639
+ risk: "read",
1640
+ summary: "\u6309\u5FEB\u7167\u628A\u63A5\u5F85\u6570\u636E\u62FC\u6210 customParams\uFF0C\u8F93\u51FA <browsertool> \u4F9B\u5BBF\u4E3B\u6253\u5F00\u586B\u5355\u9875\u3002\u7EAF\u672C\u5730\uFF0C\u4E0D\u8C03\u63A5\u53E3\u3002",
1641
+ inputSchema: {
1642
+ type: "object",
1643
+ additionalProperties: false,
1644
+ required: ["runId"],
1645
+ properties: {
1646
+ runId: { type: "string", description: "ask / doc \u8FD4\u56DE\u7684 runId" },
1647
+ answers: { type: "object", description: "\u9762\u677F\u56DE\u586B\u503C\uFF0C\u8986\u76D6 run.answers" },
1648
+ attachmentFileid: { type: "string", description: "\u663E\u5F0F\u6307\u5B9A\u9644\u4EF6 fileid\uFF0C\u591A\u4E2A\u7528\u9017\u53F7\u5206\u9694" },
1649
+ sdkRender: {
1650
+ type: "string",
1651
+ enum: ["inline", "popup", "drawer"],
1652
+ description: "\u6253\u5F00\u5F62\u6001\uFF1Adrawer \u4E3A\u53F3\u4FA7\u62BD\u5C49\uFF08\u9ED8\u8BA4\uFF09"
1653
+ },
1654
+ snapshot: { type: "string", description: "\u5B57\u6BB5\u5FEB\u7167\u8DEF\u5F84" }
1655
+ }
1656
+ },
1657
+ outputSchema: {
1658
+ type: "object",
1659
+ properties: {
1660
+ customParams: { type: "object" },
1661
+ fieldAssignKeys: { type: "string" },
1662
+ detailRowCount: { type: "integer" },
1663
+ attachmentPending: { type: "boolean" },
1664
+ sdkRenderType: { type: "string" },
1665
+ todos: { type: "array", items: { type: "string" } },
1666
+ browsertool: { type: "string" },
1667
+ browsertoolFile: { type: "string", description: "browsertool \u843D\u76D8\u7684\u7EDD\u5BF9\u8DEF\u5F84\uFF08\u6B63\u659C\u6760\uFF09" },
1668
+ browsertoolRef: { type: "string", description: "\u6587\u4EF6\u5F15\u7528\u5F62\u6001\uFF0C\u5BBF\u4E3B\u652F\u6301\u65F6\u6A21\u578B\u53EA\u8F93\u51FA\u8FD9\u4E00\u884C" },
1669
+ timings: { type: "object" }
1670
+ }
1671
+ }
1672
+ },
1673
+ {
1674
+ name: "reception.docRender",
1675
+ risk: "read",
1676
+ summary: "\u4E00\u6B21\u5B8C\u6210 doc + render\uFF1A\u51FA docx/md\u3001\u4E0A\u4F20\u9644\u4EF6\u3001\u62FC customParams\u3001\u843D browsertool\u3002\u4E24\u8005\u4E4B\u95F4\u6CA1\u6709\u4EBA\u5DE5\u786E\u8BA4\u70B9\uFF0C\u5408\u5E76\u53EA\u4E3A\u7701\u4E00\u6B21\u5DE5\u5177\u5F80\u8FD4\uFF1B\u5931\u8D25\u8BED\u4E49\u4E0E\u5206\u5F00\u8C03\u7528\u4E00\u81F4\u3002",
1677
+ inputSchema: {
1678
+ type: "object",
1679
+ additionalProperties: false,
1680
+ properties: {
1681
+ runId: { type: "string", description: "ask \u8FD4\u56DE\u7684 runId\uFF1Brun \u5931\u6548\u65F6\u6539\u7528 known \u73B0\u573A\u91CD\u5EFA" },
1682
+ known: { type: "object", description: "run \u5931\u6548\u65F6\u7684 7 \u9879\u62BD\u53D6\u7ED3\u679C\uFF0C\u7528\u4E8E\u73B0\u573A\u91CD\u5EFA run" },
1683
+ answers: { type: "object", description: "ask_user \u9762\u677F\u56DE\u586B\u503C\uFF1A{customer_need, logistics, fields}" },
1684
+ casesFile: { type: "string", description: "\u6848\u4F8B + \u4E13\u5BB6\u68C0\u7D22\u7ED3\u679C JSON \u6587\u4EF6\u8DEF\u5F84\uFF08\u8F6F\u4F9D\u8D56\uFF09" },
1685
+ workflow: { type: "string", description: "\u76EE\u6807\u6D41\u7A0B\u540D" },
1686
+ outDir: { type: "string", description: "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55" },
1687
+ noUpload: { type: "boolean", description: "\u8DF3\u8FC7\u9644\u4EF6\u4E0A\u4F20\uFF0C\u53EA\u51FA\u672C\u5730\u6587\u4EF6" },
1688
+ snapshot: { type: "string", description: "\u5B57\u6BB5\u5FEB\u7167\u8DEF\u5F84\uFF1B\u540C\u65F6\u7528\u4E8E\u63A8\u5BFC\u6280\u80FD\u5305\u5185 render.py \u4F4D\u7F6E" },
1689
+ renderPy: { type: "string", description: "\u663E\u5F0F\u6307\u5B9A render.py \u8DEF\u5F84" },
1690
+ sdkRender: {
1691
+ type: "string",
1692
+ enum: ["inline", "popup", "drawer"],
1693
+ description: "\u586B\u5355\u9875\u6253\u5F00\u5F62\u6001\uFF1Adrawer \u4E3A\u53F3\u4FA7\u62BD\u5C49\uFF08\u9ED8\u8BA4\uFF09"
1694
+ }
1695
+ }
1696
+ },
1697
+ outputSchema: {
1698
+ type: "object",
1699
+ properties: {
1700
+ runId: { type: "string" },
1701
+ rebuilt: { type: "boolean" },
1702
+ files: { type: "array", items: { type: "object" } },
1703
+ internalDoc: {
1704
+ type: ["object", "null"],
1705
+ description: "\u5185\u90E8\u53C2\u8003\u6587\u6863\u6B63\u6587 {name,path,content}\uFF1Bnull \u8868\u793A\u6CA1\u751F\u6210\u3002\u6A21\u578B\u636E\u6B64\u5728\u5BF9\u8BDD\u4E2D\u539F\u6837\u8D34\u51FA\uFF0C\u4E0D\u5FC5\u518D\u8BFB\u4EA7\u7269\u6587\u4EF6"
1706
+ },
1707
+ attachments: { type: "array", items: { type: "object" } },
1708
+ attachmentPending: { type: "boolean" },
1709
+ uploadDiagnostics: { type: "array", items: { type: "object" } },
1710
+ customParams: { type: "object" },
1711
+ fieldAssignKeys: { type: "string" },
1712
+ detailRowCount: { type: "integer" },
1713
+ todos: { type: "array", items: { type: "string" } },
1714
+ browsertool: { type: "string" },
1715
+ browsertoolFile: { type: "string" },
1716
+ browsertoolRef: { type: "string" },
1717
+ qa: { type: "object" },
1718
+ timings: { type: "object" }
1719
+ }
1720
+ }
1721
+ }
1722
+ ];
1723
+ var receptionManifest = {
1724
+ schemaVersion: 1,
1725
+ name: "reception",
1726
+ title: "\u6CDB\u5FAE\u5BA2\u6237\u53C2\u89C2\u63A5\u5F85\u6D41\u7A0B\uFF08\u9762\u677F/\u51FA\u4EF6/\u586B\u5355\u9875\uFF09",
1727
+ version: "1.0.0",
1728
+ host: "e10-reception",
1729
+ status: "builtin",
1730
+ sourceSkill: "weaver-e10-reception-flow",
1731
+ capabilities: ["reception"],
1732
+ /** 全链路零写请求:只上传附件,流程由用户在页面上提交。 */
1733
+ writePolicy: "none",
1734
+ operations: receptionOperations,
1735
+ operationNames: receptionOperationNames
1736
+ };
1737
+ function assertManifestMatchesRegistry() {
1738
+ const declared = receptionOperations.map((item) => item.name).sort();
1739
+ const registered = [...receptionOperationNames].sort();
1740
+ if (declared.join(",") !== registered.join(",")) {
1741
+ throw new Error(`manifest \u4E0E registry \u4E0D\u4E00\u81F4\uFF1A
1742
+ manifest=${declared.join(",")}
1743
+ registry=${registered.join(",")}`);
1744
+ }
1745
+ }
1746
+
1747
+ // src/shortcuts/reception/operations.ts
1748
+ var FORBIDDEN_INPUT_KEYS = /* @__PURE__ */ new Set([
1749
+ "access_token",
1750
+ "app_key",
1751
+ "app_secret",
1752
+ "cookie",
1753
+ "eteamsid",
1754
+ "token",
1755
+ "sid",
1756
+ "eteamsId"
1757
+ ]);
1758
+ function normalizeInput(raw) {
1759
+ return raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
1760
+ }
1761
+ async function executeReceptionOperation(operation, rawInput, context) {
1762
+ const handler = getReceptionOperation(operation);
1763
+ const input = normalizeInput(rawInput);
1764
+ for (const key of Object.keys(input)) {
1765
+ if (FORBIDDEN_INPUT_KEYS.has(key)) {
1766
+ throw receptionValidationError("FORBIDDEN_INPUT", `\u7981\u6B62\u4F20\u5165\u51ED\u636E\u5B57\u6BB5\uFF1A${key}`, {
1767
+ hint: "\u51ED\u636E\u7531 CLI \u8FD0\u884C\u65F6\u7EDF\u4E00\u6CE8\u5165\uFF0C\u4E1A\u52A1\u5165\u53C2\u4E0D\u63A5\u53D7"
1768
+ });
1769
+ }
1770
+ }
1771
+ return handler.execute(input, context);
1772
+ }
1773
+
1774
+ // src/shortcuts/reception/index.ts
1775
+ function asOptions(value) {
1776
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1777
+ }
1778
+ function stateDirOf(ctx) {
1779
+ return join6(stateRoot(ctx), STATE_SUBDIR);
1780
+ }
1781
+ function contextOf(ctx, options) {
1782
+ const stateDir = stateDirOf(ctx);
1783
+ const outDir = textOf(options, "outDir") || join6(stateDir, "out");
1784
+ return { host: createReceptionHost(ctx), stateDir, outDir };
1785
+ }
1786
+ function successEnvelope(operation, state, data, warnings, next) {
1787
+ return {
1788
+ schemaVersion: 1,
1789
+ ok: true,
1790
+ operation,
1791
+ data: data === void 0 ? null : data,
1792
+ meta: { state, ...next ? { next } : {} },
1793
+ warnings
1794
+ };
1795
+ }
1796
+ function failureEnvelope(error) {
1797
+ return { schemaVersion: 1, ok: false, error: toErrorEnvelope(error) };
1798
+ }
1799
+ async function runOperation(ctx, operation, input, options) {
1800
+ try {
1801
+ const result = await executeReceptionOperation(operation, input, contextOf(ctx, options));
1802
+ const envelope = successEnvelope(
1803
+ operation,
1804
+ result.state,
1805
+ result.data,
1806
+ result.warnings || [],
1807
+ result.next || null
1808
+ );
1809
+ ctx.output.write(envelope, { json: true });
1810
+ if (result.ok === false) process.exitCode = 2 /* UsageError */;
1811
+ } catch (error) {
1812
+ ctx.output.write(failureEnvelope(error), { json: true });
1813
+ process.exitCode = isCliError(error) ? error.exitCode : 1 /* GeneralError */;
1814
+ }
1815
+ }
1816
+ function parseAnswers(options, code = "ANSWERS") {
1817
+ return jsonArg(options, "answers", { code });
1818
+ }
1819
+ var receptionShortcut = {
1820
+ name: "reception",
1821
+ description: "\u6CDB\u5FAE\u5BA2\u6237\u53C2\u89C2\u63A5\u5F85\u6D41\u7A0B\uFF08\u9762\u677F / \u884C\u7A0B\u5355\u4E0E\u5185\u90E8\u65B9\u6848 / \u586B\u5355\u9875\u9884\u586B\uFF09",
1822
+ category: "shortcut",
1823
+ register({ program, action }) {
1824
+ assertManifestMatchesRegistry();
1825
+ const reception = program.command("reception").description("\u6CDB\u5FAE\u5BA2\u6237\u53C2\u89C2\u63A5\u5F85\u6D41\u7A0B\uFF1A\u51FA\u9762\u677F \u2192 \u51FA\u4E24\u4EFD\u4EA7\u7269\u5E76\u6302\u9644\u4EF6 \u2192 \u8F93\u51FA\u586B\u5355\u9875 browsertool");
1826
+ reception.command("schema").description("\u8F93\u51FA operation \u5408\u7EA6\uFF08Agent \u81EA\u67E5\u5165\u53E3\uFF09").action(action((ctx) => {
1827
+ ctx.output.write(receptionManifest, { json: true });
1828
+ }));
1829
+ reception.command("run").description("\u6309 operation \u540D\u6267\u884C\uFF08reception.ask / reception.doc / reception.render\uFF09").argument("<operation>", "operation \u540D\uFF0C\u5982 reception.ask").option("--input <path>", "JSON \u5165\u53C2\u6587\u4EF6\uFF0C- \u8868\u793A stdin").option("--input-json <json>", "\u5185\u8054 JSON \u5165\u53C2").option("--out-dir <dir>", "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55").action(action(async (ctx, operation, options) => {
1830
+ const opts = asOptions(options);
1831
+ let input = {};
1832
+ if (opts.inputJson) {
1833
+ const parsed = jsonArg({ inputJson: opts.inputJson }, "inputJson", { code: "INPUT_JSON", required: true });
1834
+ input = normalizeInput(parsed);
1835
+ } else if (typeof opts.input === "string" && opts.input.trim() && opts.input !== "-") {
1836
+ throw receptionValidationError("INPUT_UNSUPPORTED", "\u8BF7\u7528 --input-json \u4F20\u53C2\uFF0C\u6216\u76F4\u63A5\u4F7F\u7528\u52A8\u8BCD\u547D\u4EE4", {
1837
+ hint: "read \u7C7B\u64CD\u4F5C\u6CA1\u6709\u5927\u7ED3\u679C\u56DE\u4F20\u9700\u6C42\uFF0C\u4E0D\u652F\u6301 --input \u6587\u4EF6"
1838
+ });
1839
+ }
1840
+ await runOperation(ctx, String(operation), input, opts);
1841
+ }));
1842
+ reception.command("ask").description("\u51FA\u4EA4\u4E92\u9762\u677F\uFF08\u7F3A\u9879\u624D\u51FA\u5C4F\uFF0C\u603B\u5C4F\u6570 \u22642\uFF09").option("--known <json>", "7 \u9879\u62BD\u53D6\u7ED3\u679C\uFF08\u5185\u8054 JSON\uFF09").option("--known-file <path>", "7 \u9879\u62BD\u53D6\u7ED3\u679C\uFF08JSON \u6587\u4EF6\uFF0C\u63A8\u8350\uFF09").option("--user <names>", "\u966A\u540C\u4EBA\u5458\u59D3\u540D\uFF0C\u591A\u4EBA\u9017\u53F7\u5206\u9694\uFF1B\u4E0D\u4F20\u7528\u5F53\u524D\u767B\u5F55\u4EBA\u515C\u5E95").option("--customer <name>", "\u5BA2\u6237\u540D\u79F0\uFF0C\u8986\u76D6 known.customer").option("--workflow <name>", `\u76EE\u6807\u6D41\u7A0B\u540D\uFF0C\u9ED8\u8BA4\u300C${DEFAULT_WORKFLOW}\u300D`).option("--out-dir <dir>", "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55").action(action(async (ctx, options) => {
1843
+ const opts = asOptions(options);
1844
+ const known = jsonArg(opts, "known", {
1845
+ code: "KNOWN",
1846
+ required: true,
1847
+ hint: "\u63A8\u8350\u7528\u6587\u4EF6\u4F20\u53C2\uFF1A\u5148\u5199 known.json\uFF08\u65E0 BOM \u7684 UTF-8\uFF09\uFF0C\u518D reception ask --known-file known.json"
1848
+ });
1849
+ await runOperation(ctx, "reception.ask", {
1850
+ known,
1851
+ user: textOf(opts, "user") || void 0,
1852
+ customer: textOf(opts, "customer") || void 0,
1853
+ workflow: textOf(opts, "workflow") || void 0
1854
+ }, opts);
1855
+ }));
1856
+ reception.command("doc").description("\u751F\u6210\u884C\u7A0B\u5355 docx + \u5185\u90E8\u53C2\u8003\u6587\u6863 md\uFF0C\u5E76\u4E0A\u4F20\u9644\u4EF6\uFF08\u96F6\u5199\u8BF7\u6C42\uFF09").option("--run-id <id>", "ask \u8FD4\u56DE\u7684 runId").option("--known <json>", "run \u5931\u6548\u65F6\u7528\u4E8E\u73B0\u573A\u91CD\u5EFA\u7684 7 \u9879\u62BD\u53D6\u7ED3\u679C").option("--known-file <path>", "\u540C\u4E0A\uFF0CJSON \u6587\u4EF6").option("--answers <json>", "\u9762\u677F\u56DE\u586B\u503C\uFF08\u5185\u8054 JSON\uFF09").option("--answers-file <path>", "\u9762\u677F\u56DE\u586B\u503C\uFF08JSON \u6587\u4EF6\uFF0C\u63A8\u8350\uFF09").option("--cases-file <path>", "\u6848\u4F8B + \u4E13\u5BB6\u68C0\u7D22\u7ED3\u679C JSON").option("--workflow <name>", "\u76EE\u6807\u6D41\u7A0B\u540D").option("--out-dir <dir>", "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55").option("--snapshot <path>", "\u5B57\u6BB5\u5FEB\u7167\u8DEF\u5F84\uFF08\u540C\u65F6\u7528\u4E8E\u63A8\u5BFC render.py\uFF09").option("--render-py <path>", "\u663E\u5F0F\u6307\u5B9A render.py").option("--no-upload", "\u8DF3\u8FC7\u9644\u4EF6\u4E0A\u4F20\uFF0C\u53EA\u51FA\u672C\u5730\u6587\u4EF6").action(action(async (ctx, options) => {
1857
+ const opts = asOptions(options);
1858
+ await runOperation(ctx, "reception.doc", {
1859
+ runId: textOf(opts, "runId") || void 0,
1860
+ known: jsonArg(opts, "known", { code: "KNOWN" }) || void 0,
1861
+ answers: parseAnswers(opts) || void 0,
1862
+ casesFile: textOf(opts, "casesFile") || void 0,
1863
+ workflow: textOf(opts, "workflow") || void 0,
1864
+ outDir: textOf(opts, "outDir") || void 0,
1865
+ snapshot: textOf(opts, "snapshot") || void 0,
1866
+ renderPy: textOf(opts, "renderPy") || void 0,
1867
+ noUpload: opts.upload === false
1868
+ }, opts);
1869
+ }));
1870
+ reception.command("render").description("\u8F93\u51FA\u586B\u5355\u9875 browsertool\uFF08\u7EAF\u672C\u5730\uFF0C\u4E0D\u8C03\u63A5\u53E3\uFF09").option("--run-id <id>", "ask / doc \u8FD4\u56DE\u7684 runId").option("--answers <json>", "\u9762\u677F\u56DE\u586B\u503C\uFF08\u5185\u8054 JSON\uFF09").option("--answers-file <path>", "\u9762\u677F\u56DE\u586B\u503C\uFF08JSON \u6587\u4EF6\uFF0C\u63A8\u8350\uFF09").option("--attachment-fileid <ids>", "\u9644\u4EF6 fileid\uFF0C\u591A\u4E2A\u9017\u53F7\u5206\u9694").option("--sdk-render <type>", "\u6253\u5F00\u5F62\u6001\uFF1Ainline / popup / drawer\uFF08\u9ED8\u8BA4 drawer\uFF09").option("--snapshot <path>", "\u5B57\u6BB5\u5FEB\u7167\u8DEF\u5F84").action(action(async (ctx, options) => {
1871
+ const opts = asOptions(options);
1872
+ await runOperation(ctx, "reception.render", {
1873
+ runId: textOf(opts, "runId") || void 0,
1874
+ answers: parseAnswers(opts) || void 0,
1875
+ attachmentFileid: textOf(opts, "attachmentFileid") || void 0,
1876
+ sdkRender: textOf(opts, "sdkRender") || void 0,
1877
+ snapshot: textOf(opts, "snapshot") || void 0
1878
+ }, opts);
1879
+ }));
1880
+ reception.command("doc-render").description("\u4E00\u6B21\u5B8C\u6210\u300C\u51FA\u4EF6 + \u4F20\u9644\u4EF6 + \u62FC\u586B\u5355\u53C2\u6570\u300D\uFF08doc \u4E0E render \u5408\u5E76\uFF0C\u7701\u4E00\u6B21\u5DE5\u5177\u5F80\u8FD4\uFF09").option("--run-id <id>", "ask \u8FD4\u56DE\u7684 runId").option("--known <json>", "run \u5931\u6548\u65F6\u7528\u4E8E\u73B0\u573A\u91CD\u5EFA\u7684 7 \u9879\u62BD\u53D6\u7ED3\u679C").option("--known-file <path>", "\u540C\u4E0A\uFF0CJSON \u6587\u4EF6").option("--answers <json>", "\u9762\u677F\u56DE\u586B\u503C\uFF08\u5185\u8054 JSON\uFF09").option("--answers-file <path>", "\u9762\u677F\u56DE\u586B\u503C\uFF08JSON \u6587\u4EF6\uFF0C\u63A8\u8350\uFF09").option("--cases-file <path>", "\u6848\u4F8B + \u4E13\u5BB6\u68C0\u7D22\u7ED3\u679C JSON").option("--workflow <name>", "\u76EE\u6807\u6D41\u7A0B\u540D").option("--out-dir <dir>", "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55").option("--snapshot <path>", "\u5B57\u6BB5\u5FEB\u7167\u8DEF\u5F84\uFF08\u540C\u65F6\u7528\u4E8E\u63A8\u5BFC render.py\uFF09").option("--render-py <path>", "\u663E\u5F0F\u6307\u5B9A render.py").option("--no-upload", "\u8DF3\u8FC7\u9644\u4EF6\u4E0A\u4F20\uFF0C\u53EA\u51FA\u672C\u5730\u6587\u4EF6").option("--sdk-render <type>", "\u6253\u5F00\u5F62\u6001\uFF1Ainline / popup / drawer\uFF08\u9ED8\u8BA4 drawer\uFF09").action(action(async (ctx, options) => {
1881
+ const opts = asOptions(options);
1882
+ await runOperation(ctx, "reception.docRender", {
1883
+ runId: textOf(opts, "runId") || void 0,
1884
+ known: jsonArg(opts, "known", { code: "KNOWN" }) || void 0,
1885
+ answers: parseAnswers(opts) || void 0,
1886
+ casesFile: textOf(opts, "casesFile") || void 0,
1887
+ workflow: textOf(opts, "workflow") || void 0,
1888
+ outDir: textOf(opts, "outDir") || void 0,
1889
+ snapshot: textOf(opts, "snapshot") || void 0,
1890
+ renderPy: textOf(opts, "renderPy") || void 0,
1891
+ noUpload: opts.upload === false,
1892
+ sdkRender: textOf(opts, "sdkRender") || void 0
1893
+ }, opts);
1894
+ }));
1895
+ }
1896
+ };
1897
+ export {
1898
+ receptionShortcut
1899
+ };