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,197 @@
1
+ import { requireE10Session } from '../../internal/e10/context.js';
2
+ import { getActiveProfile } from '../../internal/e10/auth/session.js';
3
+ import { E10ApiError, createE10RequestRuntime } from '../../internal/e10/request-runtime.js';
4
+ import { ArchiveCliError, archiveAuthError, archiveNetworkError, archiveValidationError, } from './errors.js';
5
+ function inferProfile(ctx) {
6
+ const options = ctx.getGlobalOptions();
7
+ return options.profile || getActiveProfile();
8
+ }
9
+ /**
10
+ * 判断响应是否业务成功。档案核心系统响应契约:
11
+ * - 大多返回 WeaResult 形态 { code, msg, status, data }
12
+ * - custom API(ebuilder)返回 { success, data, msg } 或 { code:200, data, msg }
13
+ * - fullSearch 返回 { status, message, data } / { code:200, data }
14
+ */
15
+ export function isArchiveBusinessSuccess(value) {
16
+ if (!value || typeof value !== 'object')
17
+ return false;
18
+ if (typeof value.success === 'boolean')
19
+ return value.success;
20
+ if (typeof value.status === 'boolean')
21
+ return value.status;
22
+ // ebuilder 自定义接口(getFormDataList / getFormDataByPk)把业务状态放在 datajson.status
23
+ if (value.datajson && typeof value.datajson === 'object' && typeof value.datajson.status === 'boolean') {
24
+ return value.datajson.status;
25
+ }
26
+ if (value.code !== undefined && value.code !== null)
27
+ return Number(value.code) === 200;
28
+ return false;
29
+ }
30
+ export function archiveBusinessMessage(value) {
31
+ if (!value || typeof value !== 'object')
32
+ return '档案核心系统接口返回业务失败';
33
+ const candidates = [
34
+ value.msg,
35
+ value.message,
36
+ value.errMsg,
37
+ value.data?.message,
38
+ value.data?.msg,
39
+ value.datajson?.msg,
40
+ value.datajson?.message,
41
+ ];
42
+ for (const item of candidates) {
43
+ if (typeof item === 'string' && item.trim())
44
+ return item;
45
+ }
46
+ return '档案核心系统接口返回业务失败';
47
+ }
48
+ function archiveBusinessCode(value) {
49
+ if (!value || typeof value !== 'object')
50
+ return undefined;
51
+ const code = value.code ?? value.status;
52
+ if (typeof code === 'string' || typeof code === 'number')
53
+ return code;
54
+ return undefined;
55
+ }
56
+ export function assertArchivePath(requestPath) {
57
+ if (typeof requestPath !== 'string' || !requestPath.startsWith('/') || requestPath.startsWith('//')) {
58
+ throw archiveValidationError('path_invalid', '请求路径必须是相对绝对路径');
59
+ }
60
+ if (/^https?:/i.test(requestPath) || /[\r\n]/.test(requestPath) || requestPath.includes('/../')) {
61
+ throw archiveValidationError('path_invalid', '请求路径不允许跨域或路径逃逸');
62
+ }
63
+ if (!requestPath.startsWith('/api/')) {
64
+ throw archiveValidationError('path_not_allowed', '档案模块只能调用 /api/ 路径');
65
+ }
66
+ }
67
+ function formBody(form) {
68
+ if (!form)
69
+ return undefined;
70
+ const params = new URLSearchParams();
71
+ for (const [key, value] of Object.entries(form)) {
72
+ if (value === undefined || value === null)
73
+ continue;
74
+ params.set(key, typeof value === 'string' ? value : JSON.stringify(value));
75
+ }
76
+ return params;
77
+ }
78
+ function omitEmptyQueryValues(query) {
79
+ if (!query)
80
+ return undefined;
81
+ return Object.fromEntries(Object.entries(query).filter(([, value]) => value !== ''));
82
+ }
83
+ function mapRuntimeNetworkError(error) {
84
+ if (error instanceof E10ApiError && error.type === 'network') {
85
+ throw archiveNetworkError(error.subtype, error.message, {
86
+ retryable: error.retryable,
87
+ details: error.details,
88
+ });
89
+ }
90
+ throw error;
91
+ }
92
+ export function createArchiveHost(ctx, dependencies = {}) {
93
+ let e10Session = null;
94
+ let sessionContext = null;
95
+ const requireSession = dependencies.requireSession || requireE10Session;
96
+ async function ensureSession() {
97
+ if (!e10Session) {
98
+ e10Session = await requireSession(ctx);
99
+ sessionContext = {
100
+ baseUrl: e10Session.getBaseUrl(),
101
+ profile: inferProfile(ctx),
102
+ userId: e10Session.userId,
103
+ tenantKey: e10Session.tenantKey,
104
+ eteamsId: e10Session.eteamsId,
105
+ };
106
+ }
107
+ return e10Session;
108
+ }
109
+ async function getSession() {
110
+ await ensureSession();
111
+ return sessionContext;
112
+ }
113
+ async function runtime() {
114
+ return createE10RequestRuntime(ctx, await ensureSession(), {
115
+ interceptors: dependencies.interceptors,
116
+ fetch: dependencies.fetch,
117
+ });
118
+ }
119
+ async function doRequest(request, binary) {
120
+ const { method, path, query, body, operation, form, multipart, headers: extraHeaders = {}, timeoutMs = 60_000, } = request;
121
+ assertArchivePath(path);
122
+ const resolvedMethod = method || (body === undefined && form === undefined && multipart === undefined ? 'GET' : 'POST');
123
+ const rt = await runtime();
124
+ const response = binary
125
+ ? await rt.requestBinary({
126
+ module: 'archive',
127
+ operation,
128
+ method: resolvedMethod,
129
+ path,
130
+ query: omitEmptyQueryValues(query),
131
+ body: multipart === undefined ? body : undefined,
132
+ form: multipart === undefined && form === undefined ? undefined : formBody(form ?? {}),
133
+ formData: multipart,
134
+ headers: { 'X-Requested-With': 'XMLHttpRequest', ...extraHeaders },
135
+ timeoutMs,
136
+ })
137
+ : await rt.requestJson({
138
+ module: 'archive',
139
+ operation,
140
+ method: resolvedMethod,
141
+ path,
142
+ query: omitEmptyQueryValues(query),
143
+ body: multipart === undefined ? body : undefined,
144
+ form: multipart === undefined && form === undefined ? undefined : formBody(form ?? {}),
145
+ formData: multipart,
146
+ headers: { 'X-Requested-With': 'XMLHttpRequest', ...extraHeaders },
147
+ timeoutMs,
148
+ });
149
+ return response;
150
+ }
151
+ async function request(request) {
152
+ const response = await doRequest(request, false).catch((error) => mapRuntimeNetworkError(error));
153
+ if (response.status === 401 || response.status === 302) {
154
+ throw archiveAuthError('session_expired', 'E10 登录态已失效,请先向用户确认 E10 登录域名,再运行 weaver-work-cli auth login --base-url <域名> 完成登录', { httpStatus: response.status });
155
+ }
156
+ if (response.parseError) {
157
+ if (response.status < 200 || response.status >= 300) {
158
+ throw new ArchiveCliError('api', 'http_error', `档案核心系统接口 HTTP ${response.status}`, {
159
+ code: response.status,
160
+ details: { status: response.status },
161
+ exitCode: 1,
162
+ });
163
+ }
164
+ throw archiveNetworkError('protocol', `接口返回不是合法 JSON(HTTP ${response.status})`, { retryable: false });
165
+ }
166
+ if (response.status < 200 || response.status >= 300) {
167
+ throw new ArchiveCliError('api', 'http_error', `档案核心系统接口 HTTP ${response.status}`, {
168
+ code: response.status,
169
+ details: { status: response.status, message: archiveBusinessMessage(response.value) },
170
+ exitCode: 1,
171
+ });
172
+ }
173
+ if (!isArchiveBusinessSuccess(response.value)) {
174
+ throw new ArchiveCliError('api', 'business_error', archiveBusinessMessage(response.value), {
175
+ code: archiveBusinessCode(response.value),
176
+ details: { code: archiveBusinessCode(response.value), message: archiveBusinessMessage(response.value) },
177
+ exitCode: 1,
178
+ });
179
+ }
180
+ return response.value;
181
+ }
182
+ async function requestBinary(request) {
183
+ const response = await doRequest(request, true).catch((error) => mapRuntimeNetworkError(error));
184
+ if (response.status === 401 || response.status === 302) {
185
+ throw archiveAuthError('session_expired', 'E10 登录态已失效,请先登录', { httpStatus: response.status });
186
+ }
187
+ if (response.status < 200 || response.status >= 300) {
188
+ throw new ArchiveCliError('api', 'http_error', `档案下载 HTTP ${response.status}`, {
189
+ code: response.status,
190
+ details: { status: response.status },
191
+ exitCode: 1,
192
+ });
193
+ }
194
+ return { status: response.status, contentType: response.contentType, content: response.content };
195
+ }
196
+ return { request, requestBinary, getSession };
197
+ }
@@ -0,0 +1,363 @@
1
+ import { readFile, writeFile } from 'node:fs/promises';
2
+ import { resolve } from 'node:path';
3
+ import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
4
+ import { formatSearchCard, formatSearchHtml, formatSearchText } from './render/search-format.js';
5
+ import { createArchiveContinuationSigner } from './continuation.js';
6
+ import { createArchiveHost } from './host.js';
7
+ import { archiveManifest } from './manifest.js';
8
+ import { executeArchiveOperation } from './operations.js';
9
+ import { archiveValidationError } from './errors.js';
10
+ function asOptions(value) {
11
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
12
+ }
13
+ async function readStdin() {
14
+ const chunks = [];
15
+ for await (const chunk of process.stdin) {
16
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
17
+ }
18
+ return Buffer.concat(chunks).toString('utf8');
19
+ }
20
+ export async function inputFrom(options, extra = {}) {
21
+ const opts = asOptions(options);
22
+ let input = {};
23
+ if (opts.input && opts.inputJson) {
24
+ throw archiveValidationError('input_conflict', '不能同时传 --input 和 --input-json');
25
+ }
26
+ if (opts.inputJson) {
27
+ input = parseJsonInput(String(opts.inputJson), '--input-json');
28
+ }
29
+ if (opts.input) {
30
+ let raw;
31
+ try {
32
+ raw = opts.input === '-' ? await readStdin() : await readFile(String(opts.input), 'utf8');
33
+ }
34
+ catch {
35
+ throw archiveValidationError('input_unreadable', `无法读取 --input:${String(opts.input)}`);
36
+ }
37
+ input = parseJsonInput(raw, '--input');
38
+ }
39
+ return {
40
+ ...input,
41
+ ...Object.fromEntries(Object.entries(extra).filter(([, value]) => value !== undefined && value !== '')),
42
+ };
43
+ }
44
+ function parseJsonInput(raw, label) {
45
+ try {
46
+ const parsed = JSON.parse(raw.replace(/^\uFEFF/u, ''));
47
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
48
+ throw new Error('input must be an object');
49
+ }
50
+ return parsed;
51
+ }
52
+ catch {
53
+ throw archiveValidationError('input_invalid', `${label} 不是合法 JSON 对象`);
54
+ }
55
+ }
56
+ function withJsonInputOptions(command) {
57
+ command
58
+ .option('--input <path>', 'JSON input file, or - for stdin')
59
+ .option('--input-json <json>', 'inline JSON input object');
60
+ return command;
61
+ }
62
+ function intOption(value) {
63
+ if (value === undefined || value === null || value === '')
64
+ return undefined;
65
+ const parsed = Number(value);
66
+ return Number.isInteger(parsed) ? parsed : undefined;
67
+ }
68
+ function stringOption(value) {
69
+ if (value === undefined || value === null || value === '')
70
+ return undefined;
71
+ return String(value);
72
+ }
73
+ function successEnvelope(result) {
74
+ return {
75
+ schemaVersion: 1,
76
+ ok: true,
77
+ operation: result.action,
78
+ data: result.data,
79
+ ...(result.meta ? { meta: result.meta } : {}),
80
+ warnings: [],
81
+ };
82
+ }
83
+ function failureEnvelope(error) {
84
+ const structured = error;
85
+ return {
86
+ schemaVersion: 1,
87
+ ok: false,
88
+ ...(structured?.partialData === undefined ? {} : { data: structured.partialData }),
89
+ error: toErrorEnvelope(error),
90
+ };
91
+ }
92
+ async function executeAndPrint(ctx, operation, input) {
93
+ try {
94
+ const result = await executeArchiveOperation(operation, input, {
95
+ ctx,
96
+ host: createArchiveHost(ctx),
97
+ continuation: createArchiveContinuationSigner(ctx),
98
+ });
99
+ ctx.output.write(successEnvelope(result), { json: true });
100
+ }
101
+ catch (error) {
102
+ console.error(JSON.stringify(failureEnvelope(error), null, 2));
103
+ process.exitCode = isCliError(error) ? error.exitCode : ExitCode.GeneralError;
104
+ }
105
+ }
106
+ /** archive search 的 text/html 展示:不再输出 JSON envelope,按展示契约直接打印。 */
107
+ async function executeSearchPrint(ctx, input, format, outputPath) {
108
+ const env = {
109
+ ctx,
110
+ host: createArchiveHost(ctx),
111
+ continuation: createArchiveContinuationSigner(ctx),
112
+ };
113
+ try {
114
+ const result = await executeArchiveOperation('archive.search.run', input, env);
115
+ const rows = Array.isArray(result.data) ? result.data : [];
116
+ const meta = (result.meta ?? {});
117
+ const baseUrl = (await env.host.getSession()).baseUrl;
118
+ if (format === 'html') {
119
+ const html = formatSearchHtml(rows, {
120
+ baseUrl,
121
+ keyword: meta.keyword,
122
+ total: meta.total,
123
+ pageNo: meta.pageNo,
124
+ totalPage: meta.totalPage,
125
+ heading: `「${String(meta.keyword ?? '').trim() || '档案'}」检索结果`,
126
+ });
127
+ if (outputPath) {
128
+ const absolutePath = resolve(outputPath);
129
+ await writeFile(absolutePath, html, 'utf8');
130
+ ctx.output.raw(`HTML 已写入:${absolutePath}`);
131
+ return;
132
+ }
133
+ ctx.output.raw(html);
134
+ return;
135
+ }
136
+ if (format === 'card') {
137
+ ctx.output.raw(formatSearchCard(rows, { baseUrl, ...meta }));
138
+ return;
139
+ }
140
+ ctx.output.raw(formatSearchText(rows, meta));
141
+ }
142
+ catch (error) {
143
+ console.error(JSON.stringify(failureEnvelope(error), null, 2));
144
+ process.exitCode = isCliError(error) ? error.exitCode : ExitCode.GeneralError;
145
+ }
146
+ }
147
+ export const archiveShortcut = {
148
+ name: 'archive',
149
+ description: 'E10 文书定档案管理 CLI',
150
+ category: 'shortcut',
151
+ register({ program, action }) {
152
+ const archive = program.command('archive').description('E10 文书定档案管理');
153
+ archive.command('schema')
154
+ .description('Print archive operation manifest for agents')
155
+ .action(action((ctx) => {
156
+ ctx.output.write(archiveManifest, { json: true });
157
+ }));
158
+ withJsonInputOptions(archive.command('run')
159
+ .description('Run an archive operation with JSON input')
160
+ .argument('<operation>', 'operation name, e.g. archive.borrow-car.list'))
161
+ .action(action(async (ctx, operation, options) => {
162
+ await executeAndPrint(ctx, String(operation), await inputFrom(options));
163
+ }));
164
+ withJsonInputOptions(archive.command('fonds')
165
+ .description('List fonds of collect/manage library')
166
+ .option('--menu-sign <sign>', 'collectLib or manageLib, default collectLib'))
167
+ .action(action(async (ctx, options) => {
168
+ const opts = asOptions(options);
169
+ await executeAndPrint(ctx, 'archive.fonds.list', await inputFrom(options, {
170
+ menuSign: stringOption(opts.menuSign),
171
+ }));
172
+ }));
173
+ archive.command('prelib')
174
+ .description('List pre-archive efile library nodes')
175
+ .action(action(async (ctx) => {
176
+ await executeAndPrint(ctx, 'archive.prelib.tree', {});
177
+ }));
178
+ withJsonInputOptions(archive.command('search')
179
+ .description('Full-text search borrowable archives')
180
+ .option('--key <keyword>', 'search keyword')
181
+ .option('--page-no <page>', 'page number, starts from 0')
182
+ .option('--page-size <size>', 'page size')
183
+ .option('--format <fmt>', 'output format: json (default), text, card (in-chat), html')
184
+ .option('--output <path>', 'save html output to file (html format only)'))
185
+ .action(action(async (ctx, options) => {
186
+ const opts = asOptions(options);
187
+ const input = await inputFrom(options, {
188
+ key: stringOption(opts.key),
189
+ pageNo: intOption(opts.pageNo),
190
+ pageSize: intOption(opts.pageSize),
191
+ });
192
+ const format = String(stringOption(opts.format) ?? 'json').toLowerCase();
193
+ if (format === 'text' || format === 'card' || format === 'html') {
194
+ await executeSearchPrint(ctx, input, format, stringOption(opts.output));
195
+ return;
196
+ }
197
+ await executeAndPrint(ctx, 'archive.search.run', input);
198
+ }));
199
+ withJsonInputOptions(archive.command('info')
200
+ .description('Get archive basic info by arc id or dataId+formId')
201
+ .option('--arc-dangan <id>', '{档案ID}_{表单ID}')
202
+ .option('--data-id <id>', 'archive data id')
203
+ .option('--form-id <id>', 'archive form id'))
204
+ .action(action(async (ctx, options) => {
205
+ const opts = asOptions(options);
206
+ await executeAndPrint(ctx, 'archive.info.get', await inputFrom(options, {
207
+ arcDangan: stringOption(opts.arcDangan),
208
+ dataId: stringOption(opts.dataId),
209
+ formId: stringOption(opts.formId),
210
+ }));
211
+ }));
212
+ const borrowCar = archive.command('borrow-car').description('Borrow car commands');
213
+ withJsonInputOptions(borrowCar.command('list')
214
+ .description('List my borrow car entries')
215
+ .option('--page-no <page>', 'page number, starts from 1')
216
+ .option('--page-size <size>', 'page size'))
217
+ .action(action(async (ctx, options) => {
218
+ const opts = asOptions(options);
219
+ await executeAndPrint(ctx, 'archive.borrow-car.list', await inputFrom(options, {
220
+ pageNo: intOption(opts.pageNo),
221
+ pageSize: intOption(opts.pageSize),
222
+ }));
223
+ }));
224
+ withJsonInputOptions(borrowCar.command('add')
225
+ .description('Add archives to my borrow car directly (no confirmation)'))
226
+ .action(action(async (ctx, options) => {
227
+ await executeAndPrint(ctx, 'archive.borrow-car.add', await inputFrom(options));
228
+ }));
229
+ const borrowList = archive.command('borrow-list').description('Borrow order commands');
230
+ withJsonInputOptions(borrowList.command('list')
231
+ .description('List my borrow orders')
232
+ .option('--page-no <page>', 'page number, starts from 1')
233
+ .option('--page-size <size>', 'page size'))
234
+ .action(action(async (ctx, options) => {
235
+ const opts = asOptions(options);
236
+ await executeAndPrint(ctx, 'archive.borrow-list.list', await inputFrom(options, {
237
+ pageNo: intOption(opts.pageNo),
238
+ pageSize: intOption(opts.pageSize),
239
+ }));
240
+ }));
241
+ withJsonInputOptions(borrowList.command('detail')
242
+ .description('Get borrow order detail')
243
+ .option('--data-id <id>', 'borrow order data id'))
244
+ .action(action(async (ctx, options) => {
245
+ const opts = asOptions(options);
246
+ await executeAndPrint(ctx, 'archive.borrow-list.detail', await inputFrom(options, {
247
+ dataId: stringOption(opts.dataId),
248
+ }));
249
+ }));
250
+ withJsonInputOptions(borrowList.command('download-prepare')
251
+ .description('Prepare downloading borrow order original files')
252
+ .option('--data-id <id>', 'borrow order data id')
253
+ .option('--export-type <type>', '0 direct export, 1 grouped export')
254
+ .option('--export-structure <value>', '0 by entry, 1 by original text, 2 both')
255
+ .option('--group-field <field>', 'entry group field id')
256
+ .option('--document-field <field>', 'original text group field id')
257
+ .option('--output <path>', 'output zip path, default is the user Downloads directory'))
258
+ .action(action(async (ctx, options) => {
259
+ const opts = asOptions(options);
260
+ await executeAndPrint(ctx, 'archive.borrow-list.download.prepare', await inputFrom(options, {
261
+ dataId: stringOption(opts.dataId),
262
+ exportType: stringOption(opts.exportType),
263
+ exportStructure: stringOption(opts.exportStructure),
264
+ groupField: stringOption(opts.groupField),
265
+ documentField: stringOption(opts.documentField),
266
+ output: stringOption(opts.output),
267
+ }));
268
+ }));
269
+ withJsonInputOptions(borrowList.command('download-apply')
270
+ .description('Apply downloading borrow order original files')
271
+ .option('--data-id <id>', 'optional echo of borrow order data id')
272
+ .option('--continuation <token>', 'continuation token from prepare')
273
+ .option('--yes', 'confirm the write operation'))
274
+ .action(action(async (ctx, options) => {
275
+ const opts = asOptions(options);
276
+ await executeAndPrint(ctx, 'archive.borrow-list.download.apply', await inputFrom(options, {
277
+ dataId: stringOption(opts.dataId),
278
+ continuation: stringOption(opts.continuation),
279
+ confirm: opts.yes === true ? true : undefined,
280
+ }));
281
+ }));
282
+ const flow = archive.command('flow').description('Borrow workflow URL commands');
283
+ withJsonInputOptions(flow.command('borrow-car-prepare')
284
+ .description('Prepare starting a borrow workflow from borrow car'))
285
+ .action(action(async (ctx, options) => {
286
+ await executeAndPrint(ctx, 'archive.flow.borrow-car.prepare', await inputFrom(options));
287
+ }));
288
+ withJsonInputOptions(flow.command('borrow-car-apply')
289
+ .description('Apply starting a borrow workflow from borrow car')
290
+ .option('--continuation <token>', 'continuation token from prepare')
291
+ .option('--yes', 'confirm the write operation'))
292
+ .action(action(async (ctx, options) => {
293
+ const opts = asOptions(options);
294
+ await executeAndPrint(ctx, 'archive.flow.borrow-car.apply', await inputFrom(options, {
295
+ continuation: stringOption(opts.continuation),
296
+ confirm: opts.yes === true ? true : undefined,
297
+ }));
298
+ }));
299
+ withJsonInputOptions(flow.command('search-prepare')
300
+ .description('Prepare starting a borrow workflow from search results'))
301
+ .action(action(async (ctx, options) => {
302
+ await executeAndPrint(ctx, 'archive.flow.search.prepare', await inputFrom(options));
303
+ }));
304
+ withJsonInputOptions(flow.command('search-apply')
305
+ .description('Apply starting a borrow workflow from search results')
306
+ .option('--continuation <token>', 'continuation token from prepare')
307
+ .option('--yes', 'confirm the write operation'))
308
+ .action(action(async (ctx, options) => {
309
+ const opts = asOptions(options);
310
+ await executeAndPrint(ctx, 'archive.flow.search.apply', await inputFrom(options, {
311
+ continuation: stringOption(opts.continuation),
312
+ confirm: opts.yes === true ? true : undefined,
313
+ }));
314
+ }));
315
+ withJsonInputOptions(flow.command('renew-prepare')
316
+ .description('Prepare renewing a borrow order')
317
+ .option('--data-id <id>', 'borrow order data id'))
318
+ .action(action(async (ctx, options) => {
319
+ const opts = asOptions(options);
320
+ await executeAndPrint(ctx, 'archive.flow.renew.prepare', await inputFrom(options, {
321
+ dataId: stringOption(opts.dataId),
322
+ }));
323
+ }));
324
+ withJsonInputOptions(flow.command('renew-apply')
325
+ .description('Apply renewing a borrow order')
326
+ .option('--continuation <token>', 'continuation token from prepare')
327
+ .option('--yes', 'confirm the write operation'))
328
+ .action(action(async (ctx, options) => {
329
+ const opts = asOptions(options);
330
+ await executeAndPrint(ctx, 'archive.flow.renew.apply', await inputFrom(options, {
331
+ continuation: stringOption(opts.continuation),
332
+ confirm: opts.yes === true ? true : undefined,
333
+ }));
334
+ }));
335
+ const upload = archive.command('upload').description('Pre-archive upload commands');
336
+ withJsonInputOptions(upload.command('prepare')
337
+ .description('Prepare uploading a local file to the pre-archive efile library')
338
+ .option('--file <path>', 'local file path')
339
+ .option('--fonds-id <id>', 'target fonds id')
340
+ .option('--tree-id <id>', 'efile library node id, resolved automatically when omitted'))
341
+ .action(action(async (ctx, options) => {
342
+ const opts = asOptions(options);
343
+ await executeAndPrint(ctx, 'archive.upload.prelib.prepare', await inputFrom(options, {
344
+ file: stringOption(opts.file),
345
+ fondsId: stringOption(opts.fondsId),
346
+ treeId: stringOption(opts.treeId),
347
+ }));
348
+ }));
349
+ withJsonInputOptions(upload.command('apply')
350
+ .description('Apply uploading a local file to the pre-archive efile library')
351
+ .option('--fonds-id <id>', 'optional echo of target fonds id')
352
+ .option('--continuation <token>', 'continuation token from prepare')
353
+ .option('--yes', 'confirm the write operation'))
354
+ .action(action(async (ctx, options) => {
355
+ const opts = asOptions(options);
356
+ await executeAndPrint(ctx, 'archive.upload.prelib.apply', await inputFrom(options, {
357
+ fondsId: stringOption(opts.fondsId),
358
+ continuation: stringOption(opts.continuation),
359
+ confirm: opts.yes === true ? true : undefined,
360
+ }));
361
+ }));
362
+ },
363
+ };
@@ -0,0 +1,45 @@
1
+ import { archiveOperationDefinitions } from './operations/registry.js';
2
+ /** 对外契约:只暴露操作名 / 资源 / 摘要 / 风险 / 是否需确认 / 入参 schema。 */
3
+ export const archiveOperations = archiveOperationDefinitions().map((definition) => ({
4
+ name: definition.name,
5
+ resource: definition.resource,
6
+ summary: definition.summary,
7
+ ...(definition.capability ? { capability: definition.capability } : {}),
8
+ risk: definition.risk,
9
+ ...(definition.requiresConfirmation ? { requiresConfirmation: true } : {}),
10
+ inputSchema: definition.inputSchema,
11
+ }));
12
+ export const archiveManifest = {
13
+ schemaVersion: 1,
14
+ name: 'archive',
15
+ title: '泛微E10文书定档案管理',
16
+ version: '0.1.0',
17
+ host: 'e10-archive',
18
+ status: 'builtin',
19
+ sourceSkill: 'weaver-e10-wenshuding',
20
+ capabilities: ['fonds', 'prelib', 'search', 'borrowCar', 'borrowList', 'flow', 'download', 'upload'],
21
+ auth: {
22
+ required: 'e10-session',
23
+ note: '所有操作都要求已登录 E10(weaver-work-cli auth login --base-url <域名>),未登录时返回 auth_error。',
24
+ },
25
+ rules: [
26
+ '写操作(*.apply)必须先执行同名的 prepare 拿到 continuation,再带 confirm=true 执行 apply;CLI 用 --yes 表示确认。',
27
+ '借阅单下载为异步任务:apply 会轮询打包进度,完成后把 zip 保存到当前用户的「下载」目录(可用 output 指定路径)。',
28
+ '发起借阅/续借只返回流程创建页 URL,CLI 不自动打开浏览器,需由用户或上层在浏览器中打开。',
29
+ '借阅车/借阅单列表优先自定义接口,接口未发布时自动回退 ebuilder 列表链路,回退时行的字段更少(提供 fields/display)。',
30
+ ],
31
+ operations: archiveOperations,
32
+ withheldOperations: [
33
+ {
34
+ name: 'archive.borrow.submit',
35
+ reason: '借阅申请表单的字段结构、必填项与提交契约尚未固化为接口,目前只能通过流程创建页 URL 由用户在浏览器完成。',
36
+ },
37
+ {
38
+ name: 'archive.borrow-car.remove',
39
+ reason: '缺少借阅车移除接口的请求契约与权限回查方式,暂不开放。',
40
+ },
41
+ ],
42
+ };
43
+ export function hasArchiveOperationInManifest(operation) {
44
+ return archiveOperations.some((item) => item.name === operation);
45
+ }
@@ -0,0 +1,55 @@
1
+ import { archiveValidationError } from '../errors.js';
2
+ import { READ, archiveSuccess, schemaOf, } from './types.js';
3
+ import { unwrapData } from './shared.js';
4
+ /** 拆解 `{档案ID}_{表单ID}` 复合标识。 */
5
+ function splitArcId(arcDangan, field) {
6
+ const text = typeof arcDangan === 'string' ? arcDangan : String(arcDangan ?? '');
7
+ const [dataId, formId] = text.split('_');
8
+ if (!dataId || !formId || !/^\d+$/.test(dataId) || !/^\d+$/.test(formId)) {
9
+ throw archiveValidationError('arc_id_invalid', `${field} 必须是 {档案ID}_{表单ID} 格式的数字 ID 对`);
10
+ }
11
+ return { dataId, formId };
12
+ }
13
+ /**
14
+ * 档案基本信息。输入可以是 arc_dangan({档案ID}_{表单ID})或 dataId+formId 组合。
15
+ */
16
+ const archiveInfoGet = {
17
+ name: 'archive.info.get',
18
+ resource: 'info',
19
+ method: 'get',
20
+ action: 'archive.info.get',
21
+ summary: '查看档案条目的基本信息(年度/案卷号/起止件号/文件日期/保管期限/密级/库位等);输入为档案标识 {档案ID}_{表单ID}(可来自借阅车 arc_dangan)',
22
+ capability: 'archive',
23
+ risk: READ,
24
+ inputSchema: schemaOf({
25
+ arcDangan: { type: 'string', description: '{档案ID}_{表单ID},与 dataId+formId 二选一' },
26
+ dataId: { type: 'string', pattern: '^\\d+$', description: '档案数据 ID(arc_dangan 拆解前半段)' },
27
+ formId: { type: 'string', pattern: '^\\d+$', description: '档案所属表单 ID(arc_dangan 拆解后半段)' },
28
+ }, { description: '查询档案基本信息;arcDangan 与 dataId+formId 至少提供一组' }),
29
+ handler: async (args, { host }) => {
30
+ let pair;
31
+ if (args.arcDangan !== undefined) {
32
+ pair = splitArcId(args.arcDangan, 'arcDangan');
33
+ }
34
+ else {
35
+ const dataId = args.dataId;
36
+ const formId = args.formId;
37
+ if (dataId === undefined || dataId === null || dataId === '' || formId === undefined || formId === null || formId === '') {
38
+ throw archiveValidationError('id_pair_required', 'arcDangan 或 dataId+formId 必填一组');
39
+ }
40
+ if (!/^\d+$/.test(String(dataId)) || !/^\d+$/.test(String(formId))) {
41
+ throw archiveValidationError('id_pair_invalid', 'dataId/formId 必须是数字 ID');
42
+ }
43
+ pair = { dataId: String(dataId), formId: String(formId) };
44
+ }
45
+ const response = await host.request({
46
+ method: 'POST',
47
+ path: '/api/archive/core/borrow/getBorrowDetails',
48
+ body: { dataId: pair.dataId, formId: pair.formId },
49
+ });
50
+ const data = unwrapData(response);
51
+ const rows = Array.isArray(data) ? data : [];
52
+ return archiveSuccess('archive.info.get', rows, { count: rows.length });
53
+ },
54
+ };
55
+ export const archiveInfoOperations = [archiveInfoGet];