weaver-work-cli 0.1.1 → 0.1.4

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 (351) hide show
  1. package/README.md +187 -76
  2. package/dist/cmd/setup/index.js +5 -5
  3. package/dist/cmd/skills/index.js +1 -1
  4. package/dist/core/hooks.js +7 -0
  5. package/dist/index.js +0 -0
  6. package/dist/internal/e10/auth/commands.js +160 -55
  7. package/dist/internal/e10/auth/crypto.js +7 -22
  8. package/dist/internal/e10/auth/session.js +1 -1
  9. package/dist/internal/e10/auth/xiaoe.js +268 -0
  10. package/dist/internal/e10/context.js +16 -2
  11. package/dist/internal/e10/index.js +1 -0
  12. package/dist/internal/e10/request-runtime.js +344 -0
  13. package/dist/internal/skills/install.js +48 -6
  14. package/dist/internal/skills/reader.js +27 -0
  15. package/dist/shortcuts/archive/continuation.js +70 -0
  16. package/dist/shortcuts/archive/errors.js +53 -0
  17. package/dist/shortcuts/archive/host.js +197 -0
  18. package/dist/shortcuts/archive/index.js +363 -0
  19. package/dist/shortcuts/archive/manifest.js +45 -0
  20. package/dist/shortcuts/archive/operations/archive-info.js +55 -0
  21. package/dist/shortcuts/archive/operations/borrow-car.js +146 -0
  22. package/dist/shortcuts/archive/operations/borrow-list.js +200 -0
  23. package/dist/shortcuts/archive/operations/confirm.js +46 -0
  24. package/dist/shortcuts/archive/operations/download.js +238 -0
  25. package/dist/shortcuts/archive/operations/flow-url.js +240 -0
  26. package/dist/shortcuts/archive/operations/fonds.js +95 -0
  27. package/dist/shortcuts/archive/operations/getPageUrl.js +137 -0
  28. package/dist/shortcuts/archive/operations/registry.js +43 -0
  29. package/dist/shortcuts/archive/operations/search.js +88 -0
  30. package/dist/shortcuts/archive/operations/shared.js +120 -0
  31. package/dist/shortcuts/archive/operations/types.js +23 -0
  32. package/dist/shortcuts/archive/operations/upload.js +182 -0
  33. package/dist/shortcuts/archive/operations.js +13 -0
  34. package/dist/shortcuts/archive/render/search-format.js +276 -0
  35. package/dist/shortcuts/archive/render/search-view.js +125 -0
  36. package/dist/shortcuts/asset/continuation.js +70 -0
  37. package/dist/shortcuts/asset/errors.js +67 -0
  38. package/dist/shortcuts/asset/host.js +438 -0
  39. package/dist/shortcuts/asset/index.js +255 -0
  40. package/dist/shortcuts/asset/manifest.js +471 -0
  41. package/dist/shortcuts/asset/operations/query.js +249 -0
  42. package/dist/shortcuts/asset/operations/registry.js +85 -0
  43. package/dist/shortcuts/asset/operations/shared.js +100 -0
  44. package/dist/shortcuts/asset/operations/type-cache.js +49 -0
  45. package/dist/shortcuts/asset/operations/types.js +1 -0
  46. package/dist/shortcuts/asset/operations/viewlink.js +117 -0
  47. package/dist/shortcuts/asset/operations/write.js +435 -0
  48. package/dist/shortcuts/asset/operations.js +9 -0
  49. package/dist/shortcuts/calendar/continuation.js +70 -0
  50. package/dist/shortcuts/calendar/errors.js +53 -0
  51. package/dist/shortcuts/calendar/host.js +148 -0
  52. package/dist/shortcuts/calendar/index.js +125 -0
  53. package/dist/shortcuts/calendar/manifest.js +26 -0
  54. package/dist/shortcuts/calendar/operations/read.js +259 -0
  55. package/dist/shortcuts/calendar/operations/registry.js +31 -0
  56. package/dist/shortcuts/calendar/operations/shared.js +132 -0
  57. package/dist/shortcuts/calendar/operations/types.js +25 -0
  58. package/dist/shortcuts/calendar/operations/write.js +439 -0
  59. package/dist/shortcuts/calendar/operations.js +8 -0
  60. package/dist/shortcuts/ehr/continuation.js +70 -0
  61. package/dist/shortcuts/ehr/errors.js +53 -0
  62. package/dist/shortcuts/ehr/host.js +213 -0
  63. package/dist/shortcuts/ehr/index.js +205 -0
  64. package/dist/shortcuts/ehr/manifest.js +47 -0
  65. package/dist/shortcuts/ehr/operations/attend-read.js +373 -0
  66. package/dist/shortcuts/ehr/operations/attend-write.js +514 -0
  67. package/dist/shortcuts/ehr/operations/hr-contact.js +363 -0
  68. package/dist/shortcuts/ehr/operations/hr-ds.js +298 -0
  69. package/dist/shortcuts/ehr/operations/hr-report.js +386 -0
  70. package/dist/shortcuts/ehr/operations/recruit-write.js +1629 -0
  71. package/dist/shortcuts/ehr/operations/recruit.js +803 -0
  72. package/dist/shortcuts/ehr/operations/registry.js +43 -0
  73. package/dist/shortcuts/ehr/operations/salary.js +319 -0
  74. package/dist/shortcuts/ehr/operations/shared.js +246 -0
  75. package/dist/shortcuts/ehr/operations/types.js +25 -0
  76. package/dist/shortcuts/ehr/operations.js +25 -0
  77. package/dist/shortcuts/esb/continuation.js +70 -0
  78. package/dist/shortcuts/esb/errors.js +65 -0
  79. package/dist/shortcuts/esb/host.js +187 -0
  80. package/dist/shortcuts/esb/index.js +112 -0
  81. package/dist/shortcuts/esb/manifest.js +91 -0
  82. package/dist/shortcuts/esb/operations/input-format.js +31 -0
  83. package/dist/shortcuts/esb/operations/registry.js +48 -0
  84. package/dist/shortcuts/esb/operations/shared.js +152 -0
  85. package/dist/shortcuts/esb/operations/trigger.js +76 -0
  86. package/dist/shortcuts/esb/operations/types.js +21 -0
  87. package/dist/shortcuts/esb/operations.js +15 -0
  88. package/dist/shortcuts/fna/continuation.js +70 -0
  89. package/dist/shortcuts/fna/errors.js +59 -0
  90. package/dist/shortcuts/fna/host.js +146 -0
  91. package/dist/shortcuts/fna/index.js +111 -0
  92. package/dist/shortcuts/fna/manifest.js +41 -0
  93. package/dist/shortcuts/fna/operations/budget.js +124 -0
  94. package/dist/shortcuts/fna/operations/expense-center.js +148 -0
  95. package/dist/shortcuts/fna/operations/invoice-writeoff.js +212 -0
  96. package/dist/shortcuts/fna/operations/loan.js +195 -0
  97. package/dist/shortcuts/fna/operations/registry.js +35 -0
  98. package/dist/shortcuts/fna/operations/shared.js +210 -0
  99. package/dist/shortcuts/fna/operations/types.js +25 -0
  100. package/dist/shortcuts/fna/operations.js +19 -0
  101. package/dist/shortcuts/hrm/errors.js +38 -0
  102. package/dist/shortcuts/hrm/host.js +156 -0
  103. package/dist/shortcuts/hrm/index.js +111 -0
  104. package/dist/shortcuts/hrm/manifest.js +32 -0
  105. package/dist/shortcuts/hrm/operations/employee.js +338 -0
  106. package/dist/shortcuts/hrm/operations/org.js +110 -0
  107. package/dist/shortcuts/hrm/operations/position.js +176 -0
  108. package/dist/shortcuts/hrm/operations/registry.js +33 -0
  109. package/dist/shortcuts/hrm/operations/shared.js +143 -0
  110. package/dist/shortcuts/hrm/operations/types.js +23 -0
  111. package/dist/shortcuts/hrm/operations.js +19 -0
  112. package/dist/shortcuts/index.js +20 -0
  113. package/dist/shortcuts/invoice/host.js +99 -94
  114. package/dist/shortcuts/invoice/index.js +65 -61
  115. package/dist/shortcuts/invoice/manifest.js +222 -14
  116. package/dist/shortcuts/invoice/operations/browse-field.js +17 -0
  117. package/dist/shortcuts/invoice/operations/issuing.js +198 -0
  118. package/dist/shortcuts/invoice/operations/ocr-preview.js +6 -3
  119. package/dist/shortcuts/invoice/operations/registry.js +17 -0
  120. package/dist/shortcuts/invoice/operations/reim.js +401 -0
  121. package/dist/shortcuts/invoice/operations/shared.js +271 -6
  122. package/dist/shortcuts/invoice/operations/validate-preview.js +1 -1
  123. package/dist/shortcuts/jiuchuanhui/cache.js +441 -0
  124. package/dist/shortcuts/jiuchuanhui/continuation.js +70 -0
  125. package/dist/shortcuts/jiuchuanhui/errors.js +59 -0
  126. package/dist/shortcuts/jiuchuanhui/host.js +159 -0
  127. package/dist/shortcuts/jiuchuanhui/index.js +109 -0
  128. package/dist/shortcuts/jiuchuanhui/manifest.js +469 -0
  129. package/dist/shortcuts/jiuchuanhui/operations/datajson.js +214 -0
  130. package/dist/shortcuts/jiuchuanhui/operations/esb.js +157 -0
  131. package/dist/shortcuts/jiuchuanhui/operations/generic.js +146 -0
  132. package/dist/shortcuts/jiuchuanhui/operations/registry.js +133 -0
  133. package/dist/shortcuts/jiuchuanhui/operations/shared.js +158 -0
  134. package/dist/shortcuts/jiuchuanhui/operations/types.js +1 -0
  135. package/dist/shortcuts/jiuchuanhui/operations.js +8 -0
  136. package/dist/shortcuts/mail/continuation.js +70 -0
  137. package/dist/shortcuts/mail/errors.js +53 -0
  138. package/dist/shortcuts/mail/host.js +182 -0
  139. package/dist/shortcuts/mail/index.js +519 -0
  140. package/dist/shortcuts/mail/manifest.js +38 -0
  141. package/dist/shortcuts/mail/operations/mail-blacklist.js +79 -0
  142. package/dist/shortcuts/mail/operations/mail-contacts.js +195 -0
  143. package/dist/shortcuts/mail/operations/mail-manage.js +335 -0
  144. package/dist/shortcuts/mail/operations/mail-read.js +508 -0
  145. package/dist/shortcuts/mail/operations/mail-send.js +474 -0
  146. package/dist/shortcuts/mail/operations/mail-sign.js +203 -0
  147. package/dist/shortcuts/mail/operations/mail-template.js +170 -0
  148. package/dist/shortcuts/mail/operations/registry.js +41 -0
  149. package/dist/shortcuts/mail/operations/shared.js +64 -0
  150. package/dist/shortcuts/mail/operations/types.js +27 -0
  151. package/dist/shortcuts/mail/operations.js +19 -0
  152. package/dist/shortcuts/plan/continuation.js +70 -0
  153. package/dist/shortcuts/plan/errors.js +70 -0
  154. package/dist/shortcuts/plan/host.js +180 -0
  155. package/dist/shortcuts/plan/index.js +150 -0
  156. package/dist/shortcuts/plan/manifest.js +53 -0
  157. package/dist/shortcuts/plan/operations/link.js +256 -0
  158. package/dist/shortcuts/plan/operations/read.js +259 -0
  159. package/dist/shortcuts/plan/operations/registry.js +33 -0
  160. package/dist/shortcuts/plan/operations/shared.js +246 -0
  161. package/dist/shortcuts/plan/operations/types.js +49 -0
  162. package/dist/shortcuts/plan/operations/version.js +49 -0
  163. package/dist/shortcuts/plan/operations/write.js +710 -0
  164. package/dist/shortcuts/plan/operations.js +8 -0
  165. package/docs/SKILL.md +11 -7
  166. package/docs/_catalog.md +23 -5
  167. package/docs/agent-invoice.md +31 -10
  168. package/docs/agent-skill-install.md +211 -0
  169. package/docs/calendar.md +87 -0
  170. package/docs/e10-auth.md +28 -9
  171. package/docs/ehr.md +186 -0
  172. package/docs/esb.md +64 -0
  173. package/docs/fna.md +72 -0
  174. package/docs/hrm.md +89 -0
  175. package/docs/invoice.md +66 -20
  176. package/docs/jiuchuanhui.md +131 -0
  177. package/docs/operation-manual.md +443 -0
  178. package/docs/plan.md +82 -0
  179. package/docs/wenshuding.md +129 -0
  180. package/docs/ziguanjia.md +89 -0
  181. package/package.json +4 -4
  182. package/scripts/package-skill.mjs +127 -34
  183. package/scripts/postbuild.mjs +13 -0
  184. package/skill-template/business-info.json +13 -2
  185. package/skill-template/domains/calendar.md +15 -0
  186. package/skill-template/domains/esb.md +13 -0
  187. package/skill-template/domains/hrm.md +16 -0
  188. package/skill-template/domains/jiuchuanhui.md +23 -0
  189. package/skill-template/domains/jucailin.md +22 -0
  190. package/skill-template/domains/mail.md +21 -0
  191. package/skill-template/domains/plan.md +17 -0
  192. package/skill-template/domains/qiyecheng.md +17 -0
  193. package/skill-template/domains/shared.md +9 -3
  194. package/skill-template/domains/skill-maker.md +10 -0
  195. package/skill-template/domains/wenshuding.md +22 -0
  196. package/skill-template/domains/{invoice.md → yepiaotong.md} +4 -0
  197. package/skill-template/domains/ziguanjia.md +21 -0
  198. package/skill-template/master-skill-template.md +12 -6
  199. package/skill-template/skill-template.md +40 -9
  200. package/skills/weaver-e10-calendar/SKILL.md +101 -0
  201. package/skills/weaver-e10-calendar/product.json +8 -0
  202. package/skills/weaver-e10-calendar/references/calendar-app-check.md +65 -0
  203. package/skills/weaver-e10-calendar/references/calendar-dict.md +55 -0
  204. package/skills/weaver-e10-calendar/references/calendar-query.md +70 -0
  205. package/skills/weaver-e10-calendar/references/calendar-write.md +97 -0
  206. package/skills/weaver-e10-calendar/references/source-manifest.json +54 -0
  207. package/skills/weaver-e10-esb/SKILL.md +102 -0
  208. package/skills/weaver-e10-esb/product.json +8 -0
  209. package/skills/weaver-e10-esb/references/input-format.md +52 -0
  210. package/skills/weaver-e10-esb/references/source-manifest.json +242 -0
  211. package/skills/weaver-e10-esb/references/trigger.md +99 -0
  212. package/skills/weaver-e10-hrm/SKILL.md +87 -0
  213. package/skills/weaver-e10-hrm/product.json +8 -0
  214. package/skills/weaver-e10-hrm/references/employee.md +109 -0
  215. package/skills/weaver-e10-hrm/references/org.md +95 -0
  216. package/skills/weaver-e10-hrm/references/position.md +95 -0
  217. package/skills/weaver-e10-hrm/references/source-manifest.json +121 -0
  218. package/skills/weaver-e10-jiuchuanhui/SKILL.md +174 -0
  219. package/skills/weaver-e10-jiuchuanhui/product.json +8 -0
  220. package/skills/weaver-e10-jiuchuanhui/references/cache.md +110 -0
  221. package/skills/weaver-e10-jiuchuanhui/references/clue.md +61 -0
  222. package/skills/weaver-e10-jiuchuanhui/references/contact-plan.md +56 -0
  223. package/skills/weaver-e10-jiuchuanhui/references/contact-records.md +48 -0
  224. package/skills/weaver-e10-jiuchuanhui/references/contact.md +56 -0
  225. package/skills/weaver-e10-jiuchuanhui/references/customer.md +69 -0
  226. package/skills/weaver-e10-jiuchuanhui/references/disabled-capabilities.md +24 -0
  227. package/skills/weaver-e10-jiuchuanhui/references/discovery-config.md +60 -0
  228. package/skills/weaver-e10-jiuchuanhui/references/general-helpers.md +59 -0
  229. package/skills/weaver-e10-jiuchuanhui/references/jiuchuanhui-entry.md +60 -0
  230. package/skills/weaver-e10-jiuchuanhui/references/sale.md +72 -0
  231. package/skills/weaver-e10-jiuchuanhui/references/source-manifest.json +2632 -0
  232. package/skills/weaver-e10-jucailin/SKILL.md +101 -0
  233. package/skills/weaver-e10-jucailin/product.json +8 -0
  234. package/skills/weaver-e10-jucailin/references/attend-read.md +73 -0
  235. package/skills/weaver-e10-jucailin/references/attend-write.md +82 -0
  236. package/skills/weaver-e10-jucailin/references/hr-contact.md +92 -0
  237. package/skills/weaver-e10-jucailin/references/hr-datasource.md +104 -0
  238. package/skills/weaver-e10-jucailin/references/hr-report.md +76 -0
  239. package/skills/weaver-e10-jucailin/references/recruit-read.md +76 -0
  240. package/skills/weaver-e10-jucailin/references/recruit-write.md +70 -0
  241. package/skills/weaver-e10-jucailin/references/safety-boundaries.md +35 -0
  242. package/skills/weaver-e10-jucailin/references/salary.md +110 -0
  243. package/skills/weaver-e10-jucailin/references/source-manifest.json +152 -0
  244. package/skills/weaver-e10-mail/SKILL.md +151 -0
  245. package/skills/weaver-e10-mail/product.json +8 -0
  246. package/skills/weaver-e10-mail/references/mail-agent-entry.md +47 -0
  247. package/skills/weaver-e10-mail/references/mail-attachment.md +30 -0
  248. package/skills/weaver-e10-mail/references/mail-blacklist.md +27 -0
  249. package/skills/weaver-e10-mail/references/mail-contacts.md +33 -0
  250. package/skills/weaver-e10-mail/references/mail-manage.md +44 -0
  251. package/skills/weaver-e10-mail/references/mail-read.md +76 -0
  252. package/skills/weaver-e10-mail/references/mail-send.md +43 -0
  253. package/skills/weaver-e10-mail/references/mail-sign.md +33 -0
  254. package/skills/weaver-e10-mail/references/mail-template.md +31 -0
  255. package/skills/weaver-e10-mail/references/safety-boundaries.md +32 -0
  256. package/skills/weaver-e10-plan/SKILL.md +139 -0
  257. package/skills/weaver-e10-plan/product.json +8 -0
  258. package/skills/weaver-e10-plan/references/plan-collect-and-compose.md +123 -0
  259. package/skills/weaver-e10-plan/references/plan-overview-and-routing.md +138 -0
  260. package/skills/weaver-e10-plan/references/plan-report-query.md +154 -0
  261. package/skills/weaver-e10-plan/references/plan-report-remind.md +104 -0
  262. package/skills/weaver-e10-plan/references/plan-report-write.md +162 -0
  263. package/skills/weaver-e10-plan/references/source-manifest.json +858 -0
  264. package/skills/weaver-e10-qiyecheng/SKILL.md +118 -0
  265. package/skills/weaver-e10-qiyecheng/product.json +8 -0
  266. package/skills/weaver-e10-qiyecheng/references/budget.md +65 -0
  267. package/skills/weaver-e10-qiyecheng/references/catalog.md +56 -0
  268. package/skills/weaver-e10-qiyecheng/references/expense-center.md +51 -0
  269. package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +57 -0
  270. package/skills/weaver-e10-qiyecheng/references/loan-management.md +59 -0
  271. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +698 -0
  272. package/skills/weaver-e10-shared/SKILL.md +86 -0
  273. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +127 -0
  274. package/skills/weaver-e10-shared/references/json-output-contract.md +120 -0
  275. package/skills/weaver-e10-shared/references/weaver-e10-installation.md +110 -0
  276. package/skills/weaver-e10-skill-maker/SKILL.md +77 -0
  277. package/skills/weaver-e10-skill-maker/product.json +8 -0
  278. package/skills/weaver-e10-skill-maker/references/business-skill-generation.md +124 -0
  279. package/skills/weaver-e10-skill-maker/references/detector-validation.md +101 -0
  280. package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +230 -0
  281. package/skills/weaver-e10-skill-maker/references/post-generation-install.md +105 -0
  282. package/skills/weaver-e10-skill-maker/references/source-update-detection.md +261 -0
  283. package/skills/weaver-e10-skill-maker/references/weaver-skill-style.md +141 -0
  284. package/skills/weaver-e10-wenshuding/SKILL.md +157 -0
  285. package/skills/weaver-e10-wenshuding/product.json +8 -0
  286. package/skills/weaver-e10-wenshuding/references/archive-agent-entry.md +63 -0
  287. package/skills/weaver-e10-wenshuding/references/archive-borrow-car.md +52 -0
  288. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +52 -0
  289. package/skills/weaver-e10-wenshuding/references/archive-disabled-capabilities.md +22 -0
  290. package/skills/weaver-e10-wenshuding/references/archive-download.md +48 -0
  291. package/skills/weaver-e10-wenshuding/references/archive-flow.md +46 -0
  292. package/skills/weaver-e10-wenshuding/references/archive-fonds.md +34 -0
  293. package/skills/weaver-e10-wenshuding/references/archive-info.md +33 -0
  294. package/skills/weaver-e10-wenshuding/references/archive-search.md +52 -0
  295. package/skills/weaver-e10-wenshuding/references/archive-upload.md +41 -0
  296. package/skills/weaver-e10-wenshuding/references/source-manifest.json +517 -0
  297. package/skills/weaver-e10-yepiaotong/SKILL.md +184 -0
  298. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-add.md +1 -1
  299. package/skills/weaver-e10-yepiaotong/references/invoice-agent-entry.md +47 -0
  300. package/skills/weaver-e10-yepiaotong/references/invoice-browse-field-data.md +204 -0
  301. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-delete.md +1 -1
  302. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-detail.md +13 -5
  303. package/skills/weaver-e10-yepiaotong/references/invoice-disabled-capabilities.md +28 -0
  304. package/skills/weaver-e10-yepiaotong/references/invoice-download.md +31 -0
  305. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +45 -0
  306. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-file-upload.md +15 -4
  307. package/skills/weaver-e10-yepiaotong/references/invoice-import.md +45 -0
  308. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-examples.md +120 -0
  309. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-field-rules.md +161 -0
  310. package/skills/weaver-e10-yepiaotong/references/invoice-issuing.md +99 -0
  311. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-ocr-preview.md +14 -4
  312. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +58 -0
  313. package/skills/weaver-e10-yepiaotong/references/invoice-red.md +261 -0
  314. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +97 -0
  315. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-update.md +1 -1
  316. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-validation-preview.md +10 -3
  317. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +1340 -0
  318. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +845 -0
  319. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +94 -0
  320. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +449 -0
  321. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +266 -0
  322. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +494 -0
  323. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +1103 -0
  324. package/skills/weaver-e10-ziguanjia/SKILL.md +162 -0
  325. package/skills/weaver-e10-ziguanjia/product.json +8 -0
  326. package/skills/weaver-e10-ziguanjia/references/source-manifest.json +147 -0
  327. package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +65 -0
  328. package/skills/weaver-e10-ziguanjia/references/ziguanjia-create.md +45 -0
  329. package/skills/weaver-e10-ziguanjia/references/ziguanjia-depre.md +48 -0
  330. package/skills/weaver-e10-ziguanjia/references/ziguanjia-disabled-capabilities.md +22 -0
  331. package/skills/weaver-e10-ziguanjia/references/ziguanjia-purch.md +57 -0
  332. package/skills/weaver-e10-ziguanjia/references/ziguanjia-query.md +62 -0
  333. package/skills/weaver-e10-ziguanjia/references/ziguanjia-repair.md +83 -0
  334. package/skills/weaver-e10-ziguanjia/references/ziguanjia-resolve.md +49 -0
  335. package/skills/weaver-e10-ziguanjia/references/ziguanjia-return.md +70 -0
  336. package/skills/weaver-e10-ziguanjia/references/ziguanjia-update.md +45 -0
  337. package/skills/weaver-e10-ziguanjia/references/ziguanjia-use.md +60 -0
  338. package/skills/weaver-e10-ziguanjia/references/ziguanjia-viewlink.md +81 -0
  339. package/skills/weaver-work-cli-invoice/SKILL.md +0 -103
  340. package/skills/weaver-work-cli-invoice/references/invoice-agent-entry.md +0 -38
  341. package/skills/weaver-work-cli-invoice/references/invoice-disabled-capabilities.md +0 -26
  342. package/skills/weaver-work-cli-invoice/references/invoice-download.md +0 -22
  343. package/skills/weaver-work-cli-invoice/references/invoice-enterprise-list.md +0 -35
  344. package/skills/weaver-work-cli-invoice/references/invoice-import.md +0 -28
  345. package/skills/weaver-work-cli-invoice/references/invoice-personal-list.md +0 -47
  346. package/skills/weaver-work-cli-shared/SKILL.md +0 -53
  347. package/skills/weaver-work-cli-shared/references/e10-auth-and-session.md +0 -83
  348. package/skills/weaver-work-cli-shared/references/json-output-contract.md +0 -61
  349. package/skills/weaver-work-cli-shared/references/weaver-work-cli-installation.md +0 -61
  350. /package/skills/{weaver-work-cli-shared → weaver-e10-shared}/references/high-risk-write.md +0 -0
  351. /package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/product.json +0 -0
@@ -0,0 +1,514 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { ehrConfirmationError, ehrPartialError, ehrValidationError, EhrCliError } from '../errors.js';
3
+ import { READ, SCHEMA_DATE, SCHEMA_ID, ehrSuccess, schemaOf, WRITE, } from './types.js';
4
+ import { assertEnum, assertEnumArray, compact, pickDefined, toIdList } from './shared.js';
5
+ const CONTINUATION_TTL_SECONDS = 600;
6
+ const CARD_TYPES = ['CHECKIN', 'CHECKOUT', 'LEAVE', 'RETURN', 'CHECKIN_AND_RETURN', 'CHECKOUT_AND_LEAVE'];
7
+ const APPEAL_TYPES = [
8
+ 'leave',
9
+ 'overTime',
10
+ 'businessTrip',
11
+ 'respLeave',
12
+ 'manualSignFlow',
13
+ 'outSide',
14
+ 'processChange',
15
+ 'reissueCard',
16
+ 'schedulingShift',
17
+ 'substitute',
18
+ ];
19
+ const HANDLE_RESULTS = ['APPROVE', 'REJECT', 'INVALID'];
20
+ export const CARD_CHECK_NOTICE = [
21
+ '【考勤打卡说明】',
22
+ '- 若考勤打卡方式开启了“允许 PC 电脑端打卡”,可通过本技能进行签到、签退打卡;',
23
+ '- 若设置为只允许移动端打卡并开启了地图定位校验、WiFi 校验等,智能工具无法获取当前定位位置信息,无法完成考勤打卡,请使用 IM APP 移动端、移动端企业微信等移动端完成考勤打卡。',
24
+ ].join('\n');
25
+ function fingerprint(value) {
26
+ return createHash('sha256').update(JSON.stringify(value ?? null)).digest('hex').slice(0, 32);
27
+ }
28
+ function requireConfirm(args, action) {
29
+ if (args.confirm !== true) {
30
+ throw ehrConfirmationError(action, { hint: '重新调用时传入 confirm=true 与 prepare 返回的 continuation' });
31
+ }
32
+ }
33
+ /** 校验 continuation 与当前登录上下文一致,避免切换租户/账号后误执行写操作。 */
34
+ async function verifyLease(args, action, env) {
35
+ const lease = await env.continuation.verify(args.continuation, action);
36
+ const session = await env.host.getSession();
37
+ if (lease.baseUrl !== session.baseUrl || lease.profile !== session.profile || lease.userId !== session.userId) {
38
+ throw ehrValidationError('context_mismatch', '确认上下文已变化(租户或登录账号不同),请重新执行 prepare');
39
+ }
40
+ return lease;
41
+ }
42
+ function isNetworkError(error) {
43
+ return error instanceof EhrCliError && error.type === 'network';
44
+ }
45
+ const attendCardStatus = {
46
+ name: 'ehr.attend.card.status',
47
+ resource: 'attend',
48
+ method: 'card.status',
49
+ action: 'ehr.attend.card.status',
50
+ summary: '查询当前打卡按钮状态,返回 timecardStatus(CHECKIN 表示应打上班卡,CHECKOUT 表示应打下班卡)',
51
+ capability: 'attend',
52
+ risk: READ,
53
+ inputSchema: schemaOf({}),
54
+ handler: async (_args, { host }) => {
55
+ const response = await host.request({
56
+ method: 'POST',
57
+ path: '/api/attend/card/attendinfo/getAttendCheckButtonStatus',
58
+ body: {},
59
+ });
60
+ return ehrSuccess('ehr.attend.card.status', response?.data);
61
+ },
62
+ };
63
+ // ---------------------------------------------------------------------------
64
+ // PC 端考勤打卡
65
+ // ---------------------------------------------------------------------------
66
+ const cardCheckSchema = {
67
+ type: {
68
+ type: 'string',
69
+ enum: [...CARD_TYPES],
70
+ description: 'CHECKIN 上班签到 / CHECKOUT 下班签退 / LEAVE 外出 / RETURN 返回 / CHECKIN_AND_RETURN 上班+返回 / CHECKOUT_AND_LEAVE 下班+外出',
71
+ },
72
+ addTime: { type: 'string', pattern: '^\\d{14}$', description: '格式 yyyyMMddHHmmss,仅租户开启多时区时生效' },
73
+ };
74
+ const ehrAttendCardCheckPrepare = {
75
+ name: 'ehr.attend.card.check.prepare',
76
+ resource: 'attend',
77
+ method: 'card.check.prepare',
78
+ action: 'ehr.attend.card.check.prepare',
79
+ summary: '准备 PC 端考勤打卡:校验打卡类型并生成确认预览,不发送打卡请求',
80
+ capability: 'attend',
81
+ risk: WRITE,
82
+ requiresConfirmation: true,
83
+ inputSchema: schemaOf({ ...cardCheckSchema }, { required: ['type'] }),
84
+ handler: async (args, { host, continuation }) => {
85
+ const type = assertEnum(args.type, CARD_TYPES, 'type');
86
+ const session = await host.getSession();
87
+ if (!session.userId || !session.eteamsId || !session.tenantKey) {
88
+ throw ehrValidationError('card_sign_unavailable', '无法构造打卡凭证:当前登录态缺少 empId、ETEAMSID 或 tenantKey,请重新登录后重试');
89
+ }
90
+ const preview = {
91
+ type,
92
+ attendSource: 'pc',
93
+ addTime: args.addTime,
94
+ empId: session.userId,
95
+ profile: session.profile,
96
+ baseUrl: session.baseUrl,
97
+ notice: CARD_CHECK_NOTICE,
98
+ };
99
+ const token = await continuation.issue({
100
+ operation: 'ehr.attend.card.check.apply',
101
+ baseUrl: session.baseUrl,
102
+ profile: session.profile,
103
+ userId: session.userId,
104
+ payload: { type, addTime: args.addTime },
105
+ fingerprint: fingerprint(preview),
106
+ }, CONTINUATION_TTL_SECONDS * 1000);
107
+ return ehrSuccess('ehr.attend.card.check.prepare', {
108
+ status: 'AWAITING_CONFIRMATION',
109
+ preview,
110
+ continuation: token,
111
+ expiresInSeconds: CONTINUATION_TTL_SECONDS,
112
+ });
113
+ },
114
+ };
115
+ const ehrAttendCardCheckApply = {
116
+ name: 'ehr.attend.card.check.apply',
117
+ resource: 'attend',
118
+ method: 'card.check.apply',
119
+ action: 'ehr.attend.card.check.apply',
120
+ summary: '执行 PC 端考勤打卡;必须在用户明确确认后调用,且要求 prepare 返回的 continuation',
121
+ capability: 'attend',
122
+ risk: WRITE,
123
+ requiresConfirmation: true,
124
+ inputSchema: schemaOf({
125
+ ...cardCheckSchema,
126
+ confirm: { const: true },
127
+ continuation: { type: 'string', minLength: 1 },
128
+ }, { required: ['type', 'confirm', 'continuation'] }),
129
+ handler: async (args, env) => {
130
+ requireConfirm(args, 'ehr.attend.card.check.apply');
131
+ const type = assertEnum(args.type, CARD_TYPES, 'type');
132
+ const lease = await verifyLease(args, 'ehr.attend.card.check.apply', env);
133
+ const payload = (lease.payload || {});
134
+ if (payload.type !== type) {
135
+ throw ehrValidationError('target_changed', '打卡类型与 prepare 时的快照不一致,请重新执行 prepare');
136
+ }
137
+ // 凭证在 apply 阶段按最新会话重新构造,避免 continuation 中携带可复用的签名材料。
138
+ const sign = await env.host.buildCardSign();
139
+ const session = await env.host.getSession();
140
+ const body = {
141
+ type,
142
+ sign,
143
+ // 必须显式声明 pc:否则服务端按 UA 判定来源,非浏览器 UA 会被判为非 PC 来源并在要求定位时直接失败。
144
+ attendSource: 'pc',
145
+ };
146
+ if (args.addTime !== undefined)
147
+ body.addTime = args.addTime;
148
+ let response;
149
+ try {
150
+ response = await env.host.request({
151
+ method: 'POST',
152
+ path: '/api/attend/card/attendinfo/check',
153
+ query: { ETEAMSID: session.eteamsId },
154
+ body,
155
+ });
156
+ }
157
+ catch (error) {
158
+ if (isNetworkError(error)) {
159
+ throw ehrPartialError('打卡请求发送后连接中断,是否打卡成功不确定,禁止自动重试,请通过 ehr.attend.card.status 或打卡记录复核', { attempted: { type } }, { stage: 'card.check' });
160
+ }
161
+ throw error;
162
+ }
163
+ return ehrSuccess('ehr.attend.card.check.apply', {
164
+ status: 'COMPLETE',
165
+ result: response?.data,
166
+ message: response?.data?.message,
167
+ notice: CARD_CHECK_NOTICE,
168
+ });
169
+ },
170
+ };
171
+ // ---------------------------------------------------------------------------
172
+ // 创建申诉
173
+ // ---------------------------------------------------------------------------
174
+ const appealItemSchema = {
175
+ type: 'object',
176
+ additionalProperties: false,
177
+ properties: {
178
+ appealType: { type: 'string', enum: [...APPEAL_TYPES] },
179
+ checkin: { type: 'string', pattern: '^\\d{2}:\\d{2}$' },
180
+ checkout: { type: 'string', pattern: '^\\d{2}:\\d{2}$' },
181
+ vacation: { type: 'string' },
182
+ nextday: { type: 'boolean' },
183
+ },
184
+ required: ['appealType'],
185
+ };
186
+ const appealSaveSchema = {
187
+ attendDay: { type: 'string', pattern: '^\\d{8}$', description: '考勤日期,格式 yyyyMMdd,注意不是 yyyy-MM-dd' },
188
+ periodId: { oneOf: [{ type: 'integer' }, { type: 'string', minLength: 1 }] },
189
+ attendInfoKey: { type: 'string', minLength: 1 },
190
+ appeals: { type: 'array', items: appealItemSchema, minItems: 1 },
191
+ appealDesc: { type: 'string' },
192
+ timecardId: { oneOf: [{ type: 'integer' }, { type: 'string' }] },
193
+ attendStatus: { type: 'string' },
194
+ nextDayVal: { type: 'boolean' },
195
+ appealId: { type: 'string' },
196
+ userId: { oneOf: [{ type: 'integer', minimum: 1 }, { type: 'string', minLength: 1 }] },
197
+ };
198
+ function validateAppeals(value) {
199
+ if (!Array.isArray(value) || value.length === 0) {
200
+ throw ehrValidationError('appeals_required', 'appeals 必填且至少包含一项');
201
+ }
202
+ return value.map((item, index) => {
203
+ if (!item || typeof item !== 'object' || Array.isArray(item)) {
204
+ throw ehrValidationError('appeal_item_invalid', `appeals[${index}] 必须是对象`);
205
+ }
206
+ const record = item;
207
+ return {
208
+ appealType: assertEnum(record.appealType, APPEAL_TYPES, `appeals[${index}].appealType`),
209
+ ...pickDefined(record, ['checkin', 'checkout', 'vacation', 'nextday']),
210
+ };
211
+ });
212
+ }
213
+ const ehrAttendAppealSavePrepare = {
214
+ name: 'ehr.attend.appeal.save.prepare',
215
+ resource: 'attend',
216
+ method: 'appeal.save.prepare',
217
+ action: 'ehr.attend.appeal.save.prepare',
218
+ summary: '准备创建考勤申诉:校验参数(传 userId 时先校验可申诉状态)并生成确认预览,不提交申诉',
219
+ capability: 'attend',
220
+ risk: WRITE,
221
+ requiresConfirmation: true,
222
+ inputSchema: schemaOf({ ...appealSaveSchema }, { required: ['attendDay', 'periodId', 'attendInfoKey', 'appeals'] }),
223
+ handler: async (args, { host, continuation }) => {
224
+ const appeals = validateAppeals(args.appeals);
225
+ let appealable;
226
+ let appealformIds;
227
+ if (args.userId !== undefined) {
228
+ const gate = await host.request({
229
+ method: 'GET',
230
+ path: '/api/attend/web/attendinfo/getAppealformId',
231
+ query: { userId: String(args.userId) },
232
+ });
233
+ const gateData = gate?.data || {};
234
+ appealable = gateData.stillShowAppeal === true;
235
+ appealformIds = gateData.appealformIds;
236
+ if (!appealable) {
237
+ throw ehrValidationError('appeal_not_allowed', '当前不可申诉(stillShowAppeal=false),不要继续提交申诉', {
238
+ appealformIds,
239
+ });
240
+ }
241
+ }
242
+ const preview = {
243
+ attendDay: args.attendDay,
244
+ periodId: String(args.periodId),
245
+ attendInfoKey: args.attendInfoKey,
246
+ appeals,
247
+ appealDesc: args.appealDesc,
248
+ timecardId: args.timecardId !== undefined ? String(args.timecardId) : undefined,
249
+ attendStatus: args.attendStatus,
250
+ nextDayVal: args.nextDayVal,
251
+ appealable,
252
+ };
253
+ const session = await host.getSession();
254
+ const token = await continuation.issue({
255
+ operation: 'ehr.attend.appeal.save.apply',
256
+ baseUrl: session.baseUrl,
257
+ profile: session.profile,
258
+ userId: session.userId,
259
+ payload: { ...preview },
260
+ fingerprint: fingerprint(preview),
261
+ }, CONTINUATION_TTL_SECONDS * 1000);
262
+ return ehrSuccess('ehr.attend.appeal.save.prepare', {
263
+ status: 'AWAITING_CONFIRMATION',
264
+ preview,
265
+ continuation: token,
266
+ expiresInSeconds: CONTINUATION_TTL_SECONDS,
267
+ });
268
+ },
269
+ };
270
+ const ehrAttendAppealSaveApply = {
271
+ name: 'ehr.attend.appeal.save.apply',
272
+ resource: 'attend',
273
+ method: 'appeal.save.apply',
274
+ action: 'ehr.attend.appeal.save.apply',
275
+ summary: '提交考勤申诉;会生成审批流程,必须在用户明确确认后调用',
276
+ capability: 'attend',
277
+ risk: WRITE,
278
+ requiresConfirmation: true,
279
+ inputSchema: schemaOf({
280
+ ...appealSaveSchema,
281
+ userId: undefined,
282
+ confirm: { const: true },
283
+ continuation: { type: 'string', minLength: 1 },
284
+ }, { required: ['attendDay', 'periodId', 'attendInfoKey', 'appeals', 'confirm', 'continuation'] }),
285
+ handler: async (args, env) => {
286
+ requireConfirm(args, 'ehr.attend.appeal.save.apply');
287
+ const appeals = validateAppeals(args.appeals);
288
+ const lease = await verifyLease(args, 'ehr.attend.appeal.save.apply', env);
289
+ const payload = (lease.payload || {});
290
+ // 申诉目标一旦变化(日期/时段/理由),继续提交会写错对象,必须重新确认。
291
+ for (const key of ['attendDay', 'periodId', 'attendInfoKey', 'appealDesc']) {
292
+ if (String(payload[key] ?? '') !== String(args[key] ?? '')) {
293
+ throw ehrValidationError('target_changed', `申诉参数 ${key} 与 prepare 时的快照不一致,请重新执行 prepare`);
294
+ }
295
+ }
296
+ const body = {
297
+ attendDay: args.attendDay,
298
+ periodId: String(args.periodId),
299
+ attendInfoKey: args.attendInfoKey,
300
+ appeals,
301
+ ...pickDefined(args, ['appealDesc', 'attendStatus', 'nextDayVal', 'appealId']),
302
+ };
303
+ if (args.timecardId !== undefined)
304
+ body.timecardId = String(args.timecardId);
305
+ let response;
306
+ try {
307
+ response = await env.host.request({
308
+ method: 'POST',
309
+ path: '/api/attend/web/attendinfo/saveAttendAppealInfo',
310
+ body: compact(body),
311
+ });
312
+ }
313
+ catch (error) {
314
+ if (isNetworkError(error)) {
315
+ throw ehrPartialError('申诉提交请求发送后连接中断,是否已提交不确定,禁止自动重试,请通过 ehr.attend.appeal.list 复核', { attempted: { attendDay: args.attendDay, periodId: args.periodId } }, { stage: 'appeal.save' });
316
+ }
317
+ throw error;
318
+ }
319
+ return ehrSuccess('ehr.attend.appeal.save.apply', {
320
+ status: 'COMPLETE',
321
+ result: response?.data,
322
+ verifyHint: '可通过 ehr.attend.appeal.list 回查申诉是否已生成',
323
+ });
324
+ },
325
+ };
326
+ // ---------------------------------------------------------------------------
327
+ // 处理申诉
328
+ // ---------------------------------------------------------------------------
329
+ const appealResultSchema = {
330
+ id: { type: 'string', pattern: '^\\d+$', description: '申诉记录 ID,来自 appeal.list' },
331
+ handleResult: { type: 'string', enum: [...HANDLE_RESULTS] },
332
+ suggestion: { type: 'string', maxLength: 500 },
333
+ };
334
+ const ehrAttendAppealResultPrepare = {
335
+ name: 'ehr.attend.appeal.result.prepare',
336
+ resource: 'attend',
337
+ method: 'appeal.result.prepare',
338
+ action: 'ehr.attend.appeal.result.prepare',
339
+ summary: '准备处理申诉(通过/退回/无效):生成确认预览,不提交处理',
340
+ capability: 'attend',
341
+ risk: WRITE,
342
+ requiresConfirmation: true,
343
+ inputSchema: schemaOf({ ...appealResultSchema }, { required: ['id', 'handleResult'] }),
344
+ handler: async (args, { host, continuation }) => {
345
+ const handleResult = assertEnum(args.handleResult, HANDLE_RESULTS, 'handleResult');
346
+ const preview = {
347
+ id: String(args.id),
348
+ handleResult,
349
+ suggestion: args.suggestion,
350
+ };
351
+ const session = await host.getSession();
352
+ const token = await continuation.issue({
353
+ operation: 'ehr.attend.appeal.result.apply',
354
+ baseUrl: session.baseUrl,
355
+ profile: session.profile,
356
+ userId: session.userId,
357
+ payload: preview,
358
+ fingerprint: fingerprint(preview),
359
+ }, CONTINUATION_TTL_SECONDS * 1000);
360
+ return ehrSuccess('ehr.attend.appeal.result.prepare', {
361
+ status: 'AWAITING_CONFIRMATION',
362
+ preview,
363
+ continuation: token,
364
+ expiresInSeconds: CONTINUATION_TTL_SECONDS,
365
+ });
366
+ },
367
+ };
368
+ const ehrAttendAppealResultApply = {
369
+ name: 'ehr.attend.appeal.result.apply',
370
+ resource: 'attend',
371
+ method: 'appeal.result.apply',
372
+ action: 'ehr.attend.appeal.result.apply',
373
+ summary: '提交申诉处理结果;不可逆转,必须在用户明确确认后调用',
374
+ capability: 'attend',
375
+ risk: WRITE,
376
+ requiresConfirmation: true,
377
+ inputSchema: schemaOf({ ...appealResultSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['id', 'handleResult', 'confirm', 'continuation'] }),
378
+ handler: async (args, env) => {
379
+ requireConfirm(args, 'ehr.attend.appeal.result.apply');
380
+ const handleResult = assertEnum(args.handleResult, HANDLE_RESULTS, 'handleResult');
381
+ const lease = await verifyLease(args, 'ehr.attend.appeal.result.apply', env);
382
+ const payload = (lease.payload || {});
383
+ if (String(payload.id ?? '') !== String(args.id) || payload.handleResult !== handleResult) {
384
+ throw ehrValidationError('target_changed', '申诉目标或处理结果与 prepare 时的快照不一致,请重新执行 prepare');
385
+ }
386
+ const body = {
387
+ id: Number(args.id),
388
+ handleResult,
389
+ };
390
+ if (args.suggestion !== undefined)
391
+ body.suggestion = args.suggestion;
392
+ let response;
393
+ try {
394
+ response = await env.host.request({
395
+ method: 'POST',
396
+ path: '/api/attend/web/appeal/updateResult',
397
+ body,
398
+ });
399
+ }
400
+ catch (error) {
401
+ if (isNetworkError(error)) {
402
+ throw ehrPartialError('申诉处理请求发送后连接中断,是否已处理不确定,禁止自动重试,请通过 ehr.attend.appeal.list 复核', { attempted: { id: args.id, handleResult } }, { stage: 'appeal.result' });
403
+ }
404
+ throw error;
405
+ }
406
+ return ehrSuccess('ehr.attend.appeal.result.apply', {
407
+ status: 'COMPLETE',
408
+ result: response?.data,
409
+ verifyHint: '可通过 ehr.attend.appeal.list 回查处理结果',
410
+ });
411
+ },
412
+ };
413
+ // ---------------------------------------------------------------------------
414
+ // 报表重算
415
+ // ---------------------------------------------------------------------------
416
+ const recalcSchema = {
417
+ beginDate: SCHEMA_DATE,
418
+ endDate: SCHEMA_DATE,
419
+ onlyEmpIds: { type: 'array', items: SCHEMA_ID, description: '限定重算的人员 ID;不传则重算全部' },
420
+ };
421
+ const ehrAttendReportRecalcPrepare = {
422
+ name: 'ehr.attend.report.recalc.prepare',
423
+ resource: 'attend',
424
+ method: 'report.recalc.prepare',
425
+ action: 'ehr.attend.report.recalc.prepare',
426
+ summary: '准备考勤报表重算:校验日期范围与人员范围并生成确认预览,不触发重算',
427
+ capability: 'attend',
428
+ risk: WRITE,
429
+ requiresConfirmation: true,
430
+ inputSchema: schemaOf({ ...recalcSchema }, { required: ['beginDate', 'endDate'] }),
431
+ handler: async (args, { host, continuation }) => {
432
+ const { beginDate, endDate } = args;
433
+ if (beginDate > endDate) {
434
+ throw ehrValidationError('date_range_invalid', 'beginDate 不得晚于 endDate');
435
+ }
436
+ const onlyEmpIds = toIdList(args.onlyEmpIds, 'onlyEmpIds');
437
+ const preview = {
438
+ beginDate,
439
+ endDate,
440
+ onlyEmpIds,
441
+ scope: onlyEmpIds?.length ? `指定 ${onlyEmpIds.length} 人` : '全部人员',
442
+ };
443
+ const session = await host.getSession();
444
+ const token = await continuation.issue({
445
+ operation: 'ehr.attend.report.recalc.apply',
446
+ baseUrl: session.baseUrl,
447
+ profile: session.profile,
448
+ userId: session.userId,
449
+ payload: preview,
450
+ fingerprint: fingerprint(preview),
451
+ }, CONTINUATION_TTL_SECONDS * 1000);
452
+ return ehrSuccess('ehr.attend.report.recalc.prepare', {
453
+ status: 'AWAITING_CONFIRMATION',
454
+ preview,
455
+ continuation: token,
456
+ expiresInSeconds: CONTINUATION_TTL_SECONDS,
457
+ });
458
+ },
459
+ };
460
+ const ehrAttendReportRecalcApply = {
461
+ name: 'ehr.attend.report.recalc.apply',
462
+ resource: 'attend',
463
+ method: 'report.recalc.apply',
464
+ action: 'ehr.attend.report.recalc.apply',
465
+ summary: '触发考勤报表异步重算;会占用服务端资源且同一时刻仅允许一个任务,必须在用户明确确认后调用',
466
+ capability: 'attend',
467
+ risk: WRITE,
468
+ requiresConfirmation: true,
469
+ inputSchema: schemaOf({ ...recalcSchema, confirm: { const: true }, continuation: { type: 'string', minLength: 1 } }, { required: ['beginDate', 'endDate', 'confirm', 'continuation'] }),
470
+ handler: async (args, env) => {
471
+ requireConfirm(args, 'ehr.attend.report.recalc.apply');
472
+ const lease = await verifyLease(args, 'ehr.attend.report.recalc.apply', env);
473
+ const payload = (lease.payload || {});
474
+ if (payload.beginDate !== args.beginDate || payload.endDate !== args.endDate) {
475
+ throw ehrValidationError('target_changed', '重算日期范围与 prepare 时的快照不一致,请重新执行 prepare');
476
+ }
477
+ const body = { beginDate: args.beginDate, endDate: args.endDate };
478
+ const onlyEmpIds = toIdList(args.onlyEmpIds, 'onlyEmpIds');
479
+ if (onlyEmpIds?.length)
480
+ body.onlyEmpIds = onlyEmpIds;
481
+ let response;
482
+ try {
483
+ response = await env.host.request({
484
+ method: 'POST',
485
+ path: '/api/attend/web/attendWorkTimeSummaryReport/recalcStatus',
486
+ body,
487
+ });
488
+ }
489
+ catch (error) {
490
+ if (isNetworkError(error)) {
491
+ throw ehrPartialError('重算请求发送后连接中断,任务是否已提交不确定,禁止自动重试;重算为异步任务,请稍后通过出勤报表复核', { attempted: { beginDate: args.beginDate, endDate: args.endDate } }, { stage: 'report.recalc' });
492
+ }
493
+ throw error;
494
+ }
495
+ return ehrSuccess('ehr.attend.report.recalc.apply', {
496
+ status: 'COMPLETE',
497
+ result: response?.data,
498
+ async: true,
499
+ verifyHint: '重算是异步任务,提交成功不代表计算完成;可通过 ehr.attend.report.get 复核',
500
+ });
501
+ },
502
+ };
503
+ export const attendWriteOperations = [
504
+ attendCardStatus,
505
+ ehrAttendCardCheckPrepare,
506
+ ehrAttendCardCheckApply,
507
+ ehrAttendAppealSavePrepare,
508
+ ehrAttendAppealSaveApply,
509
+ ehrAttendAppealResultPrepare,
510
+ ehrAttendAppealResultApply,
511
+ ehrAttendReportRecalcPrepare,
512
+ ehrAttendReportRecalcApply,
513
+ ];
514
+ export { assertEnumArray };