weaver-work-cli 0.1.2 → 0.1.5

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 (405) hide show
  1. package/README.md +176 -78
  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 +159 -54
  7. package/dist/internal/e10/auth/xiaoe.js +268 -0
  8. package/dist/internal/e10/context.js +16 -2
  9. package/dist/internal/e10/index.js +1 -0
  10. package/dist/internal/e10/request-runtime.js +345 -0
  11. package/dist/internal/skills/install.js +48 -6
  12. package/dist/internal/skills/reader.js +27 -0
  13. package/dist/shortcuts/archive/continuation.js +70 -0
  14. package/dist/shortcuts/archive/errors.js +53 -0
  15. package/dist/shortcuts/archive/host.js +197 -0
  16. package/dist/shortcuts/archive/index.js +363 -0
  17. package/dist/shortcuts/archive/manifest.js +45 -0
  18. package/dist/shortcuts/archive/operations/archive-info.js +55 -0
  19. package/dist/shortcuts/archive/operations/borrow-car.js +146 -0
  20. package/dist/shortcuts/archive/operations/borrow-list.js +200 -0
  21. package/dist/shortcuts/archive/operations/confirm.js +46 -0
  22. package/dist/shortcuts/archive/operations/download.js +238 -0
  23. package/dist/shortcuts/archive/operations/flow-url.js +240 -0
  24. package/dist/shortcuts/archive/operations/fonds.js +95 -0
  25. package/dist/shortcuts/archive/operations/getPageUrl.js +137 -0
  26. package/dist/shortcuts/archive/operations/registry.js +43 -0
  27. package/dist/shortcuts/archive/operations/search.js +88 -0
  28. package/dist/shortcuts/archive/operations/shared.js +120 -0
  29. package/dist/shortcuts/archive/operations/types.js +23 -0
  30. package/dist/shortcuts/archive/operations/upload.js +182 -0
  31. package/dist/shortcuts/archive/operations.js +13 -0
  32. package/dist/shortcuts/archive/render/search-format.js +276 -0
  33. package/dist/shortcuts/archive/render/search-view.js +125 -0
  34. package/dist/shortcuts/asset/continuation.js +70 -0
  35. package/dist/shortcuts/asset/errors.js +67 -0
  36. package/dist/shortcuts/asset/host.js +438 -0
  37. package/dist/shortcuts/asset/index.js +255 -0
  38. package/dist/shortcuts/asset/manifest.js +471 -0
  39. package/dist/shortcuts/asset/operations/query.js +249 -0
  40. package/dist/shortcuts/asset/operations/registry.js +85 -0
  41. package/dist/shortcuts/asset/operations/shared.js +100 -0
  42. package/dist/shortcuts/asset/operations/type-cache.js +49 -0
  43. package/dist/shortcuts/asset/operations/types.js +1 -0
  44. package/dist/shortcuts/asset/operations/viewlink.js +117 -0
  45. package/dist/shortcuts/asset/operations/write.js +435 -0
  46. package/dist/shortcuts/asset/operations.js +9 -0
  47. package/dist/shortcuts/calendar/continuation.js +70 -0
  48. package/dist/shortcuts/calendar/errors.js +53 -0
  49. package/dist/shortcuts/calendar/host.js +148 -0
  50. package/dist/shortcuts/calendar/index.js +125 -0
  51. package/dist/shortcuts/calendar/manifest.js +26 -0
  52. package/dist/shortcuts/calendar/operations/read.js +259 -0
  53. package/dist/shortcuts/calendar/operations/registry.js +31 -0
  54. package/dist/shortcuts/calendar/operations/shared.js +132 -0
  55. package/dist/shortcuts/calendar/operations/types.js +25 -0
  56. package/dist/shortcuts/calendar/operations/write.js +439 -0
  57. package/dist/shortcuts/calendar/operations.js +8 -0
  58. package/dist/shortcuts/ehr/continuation.js +70 -0
  59. package/dist/shortcuts/ehr/errors.js +53 -0
  60. package/dist/shortcuts/ehr/host.js +213 -0
  61. package/dist/shortcuts/ehr/index.js +205 -0
  62. package/dist/shortcuts/ehr/manifest.js +47 -0
  63. package/dist/shortcuts/ehr/operations/attend-read.js +373 -0
  64. package/dist/shortcuts/ehr/operations/attend-write.js +514 -0
  65. package/dist/shortcuts/ehr/operations/hr-contact.js +363 -0
  66. package/dist/shortcuts/ehr/operations/hr-ds.js +298 -0
  67. package/dist/shortcuts/ehr/operations/hr-report.js +386 -0
  68. package/dist/shortcuts/ehr/operations/recruit-write.js +1629 -0
  69. package/dist/shortcuts/ehr/operations/recruit.js +803 -0
  70. package/dist/shortcuts/ehr/operations/registry.js +43 -0
  71. package/dist/shortcuts/ehr/operations/salary.js +319 -0
  72. package/dist/shortcuts/ehr/operations/shared.js +246 -0
  73. package/dist/shortcuts/ehr/operations/types.js +25 -0
  74. package/dist/shortcuts/ehr/operations.js +25 -0
  75. package/dist/shortcuts/esb/continuation.js +70 -0
  76. package/dist/shortcuts/esb/errors.js +65 -0
  77. package/dist/shortcuts/esb/host.js +187 -0
  78. package/dist/shortcuts/esb/index.js +112 -0
  79. package/dist/shortcuts/esb/manifest.js +91 -0
  80. package/dist/shortcuts/esb/operations/input-format.js +31 -0
  81. package/dist/shortcuts/esb/operations/registry.js +48 -0
  82. package/dist/shortcuts/esb/operations/shared.js +152 -0
  83. package/dist/shortcuts/esb/operations/trigger.js +76 -0
  84. package/dist/shortcuts/esb/operations/types.js +21 -0
  85. package/dist/shortcuts/esb/operations.js +15 -0
  86. package/dist/shortcuts/fna/continuation.js +70 -0
  87. package/dist/shortcuts/fna/errors.js +59 -0
  88. package/dist/shortcuts/fna/host.js +146 -0
  89. package/dist/shortcuts/fna/index.js +111 -0
  90. package/dist/shortcuts/fna/manifest.js +41 -0
  91. package/dist/shortcuts/fna/operations/budget.js +124 -0
  92. package/dist/shortcuts/fna/operations/expense-center.js +148 -0
  93. package/dist/shortcuts/fna/operations/invoice-writeoff.js +212 -0
  94. package/dist/shortcuts/fna/operations/loan.js +195 -0
  95. package/dist/shortcuts/fna/operations/registry.js +35 -0
  96. package/dist/shortcuts/fna/operations/shared.js +210 -0
  97. package/dist/shortcuts/fna/operations/types.js +25 -0
  98. package/dist/shortcuts/fna/operations.js +19 -0
  99. package/dist/shortcuts/hrm/errors.js +38 -0
  100. package/dist/shortcuts/hrm/host.js +156 -0
  101. package/dist/shortcuts/hrm/index.js +111 -0
  102. package/dist/shortcuts/hrm/manifest.js +32 -0
  103. package/dist/shortcuts/hrm/operations/employee.js +338 -0
  104. package/dist/shortcuts/hrm/operations/org.js +110 -0
  105. package/dist/shortcuts/hrm/operations/position.js +176 -0
  106. package/dist/shortcuts/hrm/operations/registry.js +33 -0
  107. package/dist/shortcuts/hrm/operations/shared.js +143 -0
  108. package/dist/shortcuts/hrm/operations/types.js +23 -0
  109. package/dist/shortcuts/hrm/operations.js +19 -0
  110. package/dist/shortcuts/index.js +24 -0
  111. package/dist/shortcuts/invoice/host.js +99 -94
  112. package/dist/shortcuts/invoice/index.js +58 -59
  113. package/dist/shortcuts/invoice/manifest.js +200 -3
  114. package/dist/shortcuts/invoice/operations/browse-field.js +17 -0
  115. package/dist/shortcuts/invoice/operations/issuing.js +198 -0
  116. package/dist/shortcuts/invoice/operations/registry.js +17 -0
  117. package/dist/shortcuts/invoice/operations/reim.js +401 -0
  118. package/dist/shortcuts/invoice/operations/shared.js +247 -0
  119. package/dist/shortcuts/jiuchuanhui/cache.js +441 -0
  120. package/dist/shortcuts/jiuchuanhui/continuation.js +70 -0
  121. package/dist/shortcuts/jiuchuanhui/errors.js +59 -0
  122. package/dist/shortcuts/jiuchuanhui/host.js +159 -0
  123. package/dist/shortcuts/jiuchuanhui/index.js +109 -0
  124. package/dist/shortcuts/jiuchuanhui/manifest.js +469 -0
  125. package/dist/shortcuts/jiuchuanhui/operations/datajson.js +214 -0
  126. package/dist/shortcuts/jiuchuanhui/operations/esb.js +157 -0
  127. package/dist/shortcuts/jiuchuanhui/operations/generic.js +146 -0
  128. package/dist/shortcuts/jiuchuanhui/operations/registry.js +133 -0
  129. package/dist/shortcuts/jiuchuanhui/operations/shared.js +158 -0
  130. package/dist/shortcuts/jiuchuanhui/operations/types.js +1 -0
  131. package/dist/shortcuts/jiuchuanhui/operations.js +8 -0
  132. package/dist/shortcuts/mail/continuation.js +70 -0
  133. package/dist/shortcuts/mail/errors.js +53 -0
  134. package/dist/shortcuts/mail/host.js +182 -0
  135. package/dist/shortcuts/mail/index.js +519 -0
  136. package/dist/shortcuts/mail/manifest.js +38 -0
  137. package/dist/shortcuts/mail/operations/mail-blacklist.js +79 -0
  138. package/dist/shortcuts/mail/operations/mail-contacts.js +195 -0
  139. package/dist/shortcuts/mail/operations/mail-manage.js +335 -0
  140. package/dist/shortcuts/mail/operations/mail-read.js +508 -0
  141. package/dist/shortcuts/mail/operations/mail-send.js +474 -0
  142. package/dist/shortcuts/mail/operations/mail-sign.js +203 -0
  143. package/dist/shortcuts/mail/operations/mail-template.js +170 -0
  144. package/dist/shortcuts/mail/operations/registry.js +41 -0
  145. package/dist/shortcuts/mail/operations/shared.js +64 -0
  146. package/dist/shortcuts/mail/operations/types.js +27 -0
  147. package/dist/shortcuts/mail/operations.js +19 -0
  148. package/dist/shortcuts/meeting/continuation.js +70 -0
  149. package/dist/shortcuts/meeting/errors.js +63 -0
  150. package/dist/shortcuts/meeting/host.js +167 -0
  151. package/dist/shortcuts/meeting/index.js +123 -0
  152. package/dist/shortcuts/meeting/manifest.js +64 -0
  153. package/dist/shortcuts/meeting/operations/catalogs.js +58 -0
  154. package/dist/shortcuts/meeting/operations/change.js +242 -0
  155. package/dist/shortcuts/meeting/operations/conflicts.js +142 -0
  156. package/dist/shortcuts/meeting/operations/create.js +349 -0
  157. package/dist/shortcuts/meeting/operations/env.js +191 -0
  158. package/dist/shortcuts/meeting/operations/lifecycle.js +139 -0
  159. package/dist/shortcuts/meeting/operations/meetings.js +73 -0
  160. package/dist/shortcuts/meeting/operations/receipts.js +195 -0
  161. package/dist/shortcuts/meeting/operations/registry.js +47 -0
  162. package/dist/shortcuts/meeting/operations/rooms.js +132 -0
  163. package/dist/shortcuts/meeting/operations/shared.js +112 -0
  164. package/dist/shortcuts/meeting/operations/signs.js +41 -0
  165. package/dist/shortcuts/meeting/operations/types.js +25 -0
  166. package/dist/shortcuts/meeting/operations.js +19 -0
  167. package/dist/shortcuts/plan/continuation.js +70 -0
  168. package/dist/shortcuts/plan/errors.js +70 -0
  169. package/dist/shortcuts/plan/host.js +180 -0
  170. package/dist/shortcuts/plan/index.js +150 -0
  171. package/dist/shortcuts/plan/manifest.js +53 -0
  172. package/dist/shortcuts/plan/operations/link.js +256 -0
  173. package/dist/shortcuts/plan/operations/read.js +259 -0
  174. package/dist/shortcuts/plan/operations/registry.js +33 -0
  175. package/dist/shortcuts/plan/operations/shared.js +246 -0
  176. package/dist/shortcuts/plan/operations/types.js +49 -0
  177. package/dist/shortcuts/plan/operations/version.js +49 -0
  178. package/dist/shortcuts/plan/operations/write.js +710 -0
  179. package/dist/shortcuts/plan/operations.js +8 -0
  180. package/dist/shortcuts/yimiaoban/continuation.js +70 -0
  181. package/dist/shortcuts/yimiaoban/errors.js +61 -0
  182. package/dist/shortcuts/yimiaoban/host.js +469 -0
  183. package/dist/shortcuts/yimiaoban/index.js +271 -0
  184. package/dist/shortcuts/yimiaoban/manifest.js +28 -0
  185. package/dist/shortcuts/yimiaoban/operations/file-user.js +288 -0
  186. package/dist/shortcuts/yimiaoban/operations/group-read.js +477 -0
  187. package/dist/shortcuts/yimiaoban/operations/group-write.js +591 -0
  188. package/dist/shortcuts/yimiaoban/operations/msg-parse.js +429 -0
  189. package/dist/shortcuts/yimiaoban/operations/msg-sync.js +519 -0
  190. package/dist/shortcuts/yimiaoban/operations/msg-write.js +593 -0
  191. package/dist/shortcuts/yimiaoban/operations/person.js +102 -0
  192. package/dist/shortcuts/yimiaoban/operations/registry.js +38 -0
  193. package/dist/shortcuts/yimiaoban/operations/session.js +437 -0
  194. package/dist/shortcuts/yimiaoban/operations/shared.js +236 -0
  195. package/dist/shortcuts/yimiaoban/operations/types.js +27 -0
  196. package/dist/shortcuts/yimiaoban/operations/write-util.js +78 -0
  197. package/dist/shortcuts/yimiaoban/operations.js +8 -0
  198. package/docs/SKILL.md +11 -7
  199. package/docs/_catalog.md +28 -5
  200. package/docs/agent-invoice.md +19 -9
  201. package/docs/agent-skill-install.md +141 -22
  202. package/docs/calendar.md +87 -0
  203. package/docs/e10-auth.md +28 -9
  204. package/docs/ehr.md +186 -0
  205. package/docs/esb.md +64 -0
  206. package/docs/fna.md +72 -0
  207. package/docs/hrm.md +89 -0
  208. package/docs/invoice.md +61 -20
  209. package/docs/jiuchuanhui.md +131 -0
  210. package/docs/meeting.md +48 -0
  211. package/docs/operation-manual.md +443 -0
  212. package/docs/plan.md +82 -0
  213. package/docs/wenshuding.md +129 -0
  214. package/docs/yimiaoban.md +86 -0
  215. package/docs/ziguanjia.md +89 -0
  216. package/package.json +4 -4
  217. package/scripts/package-skill.mjs +127 -34
  218. package/scripts/postbuild.mjs +13 -0
  219. package/skill-template/business-info.json +16 -2
  220. package/skill-template/domains/calendar.md +15 -0
  221. package/skill-template/domains/esb.md +13 -0
  222. package/skill-template/domains/hrm.md +16 -0
  223. package/skill-template/domains/jiuchuanhui.md +23 -0
  224. package/skill-template/domains/jucailin.md +22 -0
  225. package/skill-template/domains/mail.md +21 -0
  226. package/skill-template/domains/meeting.md +3 -0
  227. package/skill-template/domains/plan.md +17 -0
  228. package/skill-template/domains/qiyecheng.md +17 -0
  229. package/skill-template/domains/shared.md +5 -3
  230. package/skill-template/domains/skill-maker.md +10 -0
  231. package/skill-template/domains/wenshuding.md +22 -0
  232. package/skill-template/domains/{invoice.md → yepiaotong.md} +4 -0
  233. package/skill-template/domains/yimiaoban.md +21 -0
  234. package/skill-template/domains/ziguanjia.md +21 -0
  235. package/skill-template/master-skill-template.md +12 -6
  236. package/skill-template/skill-template.md +26 -10
  237. package/skills/weaver-e10-calendar/SKILL.md +102 -0
  238. package/skills/weaver-e10-calendar/product.json +8 -0
  239. package/skills/weaver-e10-calendar/references/calendar-app-check.md +65 -0
  240. package/skills/weaver-e10-calendar/references/calendar-dict.md +55 -0
  241. package/skills/weaver-e10-calendar/references/calendar-query.md +70 -0
  242. package/skills/weaver-e10-calendar/references/calendar-write.md +97 -0
  243. package/skills/weaver-e10-calendar/references/source-manifest.json +54 -0
  244. package/skills/weaver-e10-esb/SKILL.md +103 -0
  245. package/skills/weaver-e10-esb/product.json +8 -0
  246. package/skills/weaver-e10-esb/references/input-format.md +52 -0
  247. package/skills/weaver-e10-esb/references/source-manifest.json +242 -0
  248. package/skills/weaver-e10-esb/references/trigger.md +99 -0
  249. package/skills/weaver-e10-hrm/SKILL.md +88 -0
  250. package/skills/weaver-e10-hrm/product.json +8 -0
  251. package/skills/weaver-e10-hrm/references/employee.md +109 -0
  252. package/skills/weaver-e10-hrm/references/org.md +95 -0
  253. package/skills/weaver-e10-hrm/references/position.md +95 -0
  254. package/skills/weaver-e10-hrm/references/source-manifest.json +121 -0
  255. package/skills/weaver-e10-jiuchuanhui/SKILL.md +175 -0
  256. package/skills/weaver-e10-jiuchuanhui/product.json +8 -0
  257. package/skills/weaver-e10-jiuchuanhui/references/cache.md +110 -0
  258. package/skills/weaver-e10-jiuchuanhui/references/clue.md +61 -0
  259. package/skills/weaver-e10-jiuchuanhui/references/contact-plan.md +56 -0
  260. package/skills/weaver-e10-jiuchuanhui/references/contact-records.md +48 -0
  261. package/skills/weaver-e10-jiuchuanhui/references/contact.md +56 -0
  262. package/skills/weaver-e10-jiuchuanhui/references/customer.md +69 -0
  263. package/skills/weaver-e10-jiuchuanhui/references/disabled-capabilities.md +24 -0
  264. package/skills/weaver-e10-jiuchuanhui/references/discovery-config.md +60 -0
  265. package/skills/weaver-e10-jiuchuanhui/references/general-helpers.md +59 -0
  266. package/skills/weaver-e10-jiuchuanhui/references/jiuchuanhui-entry.md +60 -0
  267. package/skills/weaver-e10-jiuchuanhui/references/sale.md +72 -0
  268. package/skills/weaver-e10-jiuchuanhui/references/source-manifest.json +2632 -0
  269. package/skills/weaver-e10-jucailin/SKILL.md +102 -0
  270. package/skills/weaver-e10-jucailin/product.json +8 -0
  271. package/skills/weaver-e10-jucailin/references/attend-read.md +73 -0
  272. package/skills/weaver-e10-jucailin/references/attend-write.md +82 -0
  273. package/skills/weaver-e10-jucailin/references/hr-contact.md +92 -0
  274. package/skills/weaver-e10-jucailin/references/hr-datasource.md +104 -0
  275. package/skills/weaver-e10-jucailin/references/hr-report.md +76 -0
  276. package/skills/weaver-e10-jucailin/references/recruit-read.md +76 -0
  277. package/skills/weaver-e10-jucailin/references/recruit-write.md +70 -0
  278. package/skills/weaver-e10-jucailin/references/safety-boundaries.md +35 -0
  279. package/skills/weaver-e10-jucailin/references/salary.md +110 -0
  280. package/skills/weaver-e10-jucailin/references/source-manifest.json +152 -0
  281. package/skills/weaver-e10-mail/SKILL.md +152 -0
  282. package/skills/weaver-e10-mail/product.json +8 -0
  283. package/skills/weaver-e10-mail/references/mail-agent-entry.md +47 -0
  284. package/skills/weaver-e10-mail/references/mail-attachment.md +30 -0
  285. package/skills/weaver-e10-mail/references/mail-blacklist.md +27 -0
  286. package/skills/weaver-e10-mail/references/mail-contacts.md +33 -0
  287. package/skills/weaver-e10-mail/references/mail-manage.md +44 -0
  288. package/skills/weaver-e10-mail/references/mail-read.md +76 -0
  289. package/skills/weaver-e10-mail/references/mail-send.md +43 -0
  290. package/skills/weaver-e10-mail/references/mail-sign.md +33 -0
  291. package/skills/weaver-e10-mail/references/mail-template.md +31 -0
  292. package/skills/weaver-e10-mail/references/safety-boundaries.md +32 -0
  293. package/skills/weaver-e10-meeting/SKILL.md +106 -0
  294. package/skills/weaver-e10-meeting/product.json +8 -0
  295. package/skills/weaver-e10-meeting/references/meeting-change.md +67 -0
  296. package/skills/weaver-e10-meeting/references/meeting-create.md +52 -0
  297. package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +57 -0
  298. package/skills/weaver-e10-meeting/references/meeting-queries.md +61 -0
  299. package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +48 -0
  300. package/skills/weaver-e10-meeting/references/meeting-update.md +7 -0
  301. package/skills/weaver-e10-meeting/references/source-manifest.json +50 -0
  302. package/skills/weaver-e10-plan/SKILL.md +140 -0
  303. package/skills/weaver-e10-plan/product.json +8 -0
  304. package/skills/weaver-e10-plan/references/plan-collect-and-compose.md +123 -0
  305. package/skills/weaver-e10-plan/references/plan-overview-and-routing.md +138 -0
  306. package/skills/weaver-e10-plan/references/plan-report-query.md +154 -0
  307. package/skills/weaver-e10-plan/references/plan-report-remind.md +104 -0
  308. package/skills/weaver-e10-plan/references/plan-report-write.md +162 -0
  309. package/skills/weaver-e10-plan/references/source-manifest.json +858 -0
  310. package/skills/weaver-e10-qiyecheng/SKILL.md +119 -0
  311. package/skills/weaver-e10-qiyecheng/product.json +8 -0
  312. package/skills/weaver-e10-qiyecheng/references/budget.md +65 -0
  313. package/skills/weaver-e10-qiyecheng/references/catalog.md +56 -0
  314. package/skills/weaver-e10-qiyecheng/references/expense-center.md +51 -0
  315. package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +57 -0
  316. package/skills/weaver-e10-qiyecheng/references/loan-management.md +59 -0
  317. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +698 -0
  318. package/skills/weaver-e10-shared/SKILL.md +90 -0
  319. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +127 -0
  320. package/skills/{weaver-work-cli-shared → weaver-e10-shared}/references/json-output-contract.md +34 -0
  321. package/skills/weaver-e10-shared/references/weaver-e10-installation.md +110 -0
  322. package/skills/weaver-e10-skill-maker/SKILL.md +78 -0
  323. package/skills/weaver-e10-skill-maker/product.json +8 -0
  324. package/skills/weaver-e10-skill-maker/references/business-skill-generation.md +124 -0
  325. package/skills/weaver-e10-skill-maker/references/detector-validation.md +101 -0
  326. package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +230 -0
  327. package/skills/weaver-e10-skill-maker/references/post-generation-install.md +105 -0
  328. package/skills/weaver-e10-skill-maker/references/source-update-detection.md +261 -0
  329. package/skills/weaver-e10-skill-maker/references/weaver-skill-style.md +141 -0
  330. package/skills/weaver-e10-wenshuding/SKILL.md +158 -0
  331. package/skills/weaver-e10-wenshuding/product.json +8 -0
  332. package/skills/weaver-e10-wenshuding/references/archive-agent-entry.md +63 -0
  333. package/skills/weaver-e10-wenshuding/references/archive-borrow-car.md +52 -0
  334. package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +52 -0
  335. package/skills/weaver-e10-wenshuding/references/archive-disabled-capabilities.md +22 -0
  336. package/skills/weaver-e10-wenshuding/references/archive-download.md +48 -0
  337. package/skills/weaver-e10-wenshuding/references/archive-flow.md +46 -0
  338. package/skills/weaver-e10-wenshuding/references/archive-fonds.md +34 -0
  339. package/skills/weaver-e10-wenshuding/references/archive-info.md +33 -0
  340. package/skills/weaver-e10-wenshuding/references/archive-search.md +52 -0
  341. package/skills/weaver-e10-wenshuding/references/archive-upload.md +41 -0
  342. package/skills/weaver-e10-wenshuding/references/source-manifest.json +517 -0
  343. package/skills/weaver-e10-yepiaotong/SKILL.md +184 -0
  344. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-add.md +1 -1
  345. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-agent-entry.md +16 -9
  346. package/skills/weaver-e10-yepiaotong/references/invoice-browse-field-data.md +204 -0
  347. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-delete.md +1 -1
  348. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-detail.md +13 -5
  349. package/skills/weaver-e10-yepiaotong/references/invoice-disabled-capabilities.md +28 -0
  350. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-download.md +9 -2
  351. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-enterprise-list.md +12 -4
  352. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-file-upload.md +9 -2
  353. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-import.md +16 -7
  354. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-examples.md +120 -0
  355. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-field-rules.md +161 -0
  356. package/skills/weaver-e10-yepiaotong/references/invoice-issuing.md +99 -0
  357. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-ocr-preview.md +12 -4
  358. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-personal-list.md +12 -4
  359. package/skills/weaver-e10-yepiaotong/references/invoice-red.md +261 -0
  360. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +97 -0
  361. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-update.md +1 -1
  362. package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/references/invoice-validation-preview.md +9 -2
  363. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +1340 -0
  364. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +845 -0
  365. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +94 -0
  366. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +449 -0
  367. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +266 -0
  368. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +494 -0
  369. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +1103 -0
  370. package/skills/weaver-e10-yimiaoban/SKILL.md +104 -0
  371. package/skills/weaver-e10-yimiaoban/product.json +8 -0
  372. package/skills/weaver-e10-yimiaoban/references/ding-write.md +68 -0
  373. package/skills/weaver-e10-yimiaoban/references/error-codes.md +85 -0
  374. package/skills/weaver-e10-yimiaoban/references/field-resolution.md +46 -0
  375. package/skills/weaver-e10-yimiaoban/references/file-user-i18n.md +54 -0
  376. package/skills/weaver-e10-yimiaoban/references/group-read.md +55 -0
  377. package/skills/weaver-e10-yimiaoban/references/group-write.md +72 -0
  378. package/skills/weaver-e10-yimiaoban/references/msg-read.md +59 -0
  379. package/skills/weaver-e10-yimiaoban/references/msg-write.md +64 -0
  380. package/skills/weaver-e10-yimiaoban/references/person.md +44 -0
  381. package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +61 -0
  382. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +47 -0
  383. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +485 -0
  384. package/skills/weaver-e10-ziguanjia/SKILL.md +163 -0
  385. package/skills/weaver-e10-ziguanjia/product.json +8 -0
  386. package/skills/weaver-e10-ziguanjia/references/source-manifest.json +147 -0
  387. package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +65 -0
  388. package/skills/weaver-e10-ziguanjia/references/ziguanjia-create.md +45 -0
  389. package/skills/weaver-e10-ziguanjia/references/ziguanjia-depre.md +48 -0
  390. package/skills/weaver-e10-ziguanjia/references/ziguanjia-disabled-capabilities.md +22 -0
  391. package/skills/weaver-e10-ziguanjia/references/ziguanjia-purch.md +57 -0
  392. package/skills/weaver-e10-ziguanjia/references/ziguanjia-query.md +62 -0
  393. package/skills/weaver-e10-ziguanjia/references/ziguanjia-repair.md +83 -0
  394. package/skills/weaver-e10-ziguanjia/references/ziguanjia-resolve.md +49 -0
  395. package/skills/weaver-e10-ziguanjia/references/ziguanjia-return.md +70 -0
  396. package/skills/weaver-e10-ziguanjia/references/ziguanjia-update.md +45 -0
  397. package/skills/weaver-e10-ziguanjia/references/ziguanjia-use.md +60 -0
  398. package/skills/weaver-e10-ziguanjia/references/ziguanjia-viewlink.md +81 -0
  399. package/skills/weaver-work-cli-invoice/SKILL.md +0 -122
  400. package/skills/weaver-work-cli-invoice/references/invoice-disabled-capabilities.md +0 -26
  401. package/skills/weaver-work-cli-shared/SKILL.md +0 -63
  402. package/skills/weaver-work-cli-shared/references/e10-auth-and-session.md +0 -90
  403. package/skills/weaver-work-cli-shared/references/weaver-work-cli-installation.md +0 -73
  404. /package/skills/{weaver-work-cli-shared → weaver-e10-shared}/references/high-risk-write.md +0 -0
  405. /package/skills/{weaver-work-cli-invoice → weaver-e10-yepiaotong}/product.json +0 -0
@@ -0,0 +1,477 @@
1
+ import { ymbValidationError } from '../errors.js';
2
+ import { READ, schemaOf, ymbSuccess, } from './types.js';
3
+ import { assertImOk, compact, extractGroupMembers, formatFullTime, splitIds, str, toPositiveInt, toUint, unwrapInner, } from './shared.js';
4
+ const SEARCH_TYPE_MASK = {
5
+ type: 1,
6
+ key: 2,
7
+ members: 8,
8
+ precise: 16,
9
+ owners: 32,
10
+ creators: 64,
11
+ create: 256,
12
+ };
13
+ function requireCidUid(cid, uid) {
14
+ const c = String(cid ?? '');
15
+ const u = String(uid ?? '');
16
+ if (!c || !u || c === '0' || u === '0') {
17
+ throw ymbValidationError('self_identity_missing', '该查询需要当前登录人的 cid/uid(非 0),请确认登录态完整');
18
+ }
19
+ return { cid: c, uid: u };
20
+ }
21
+ /** 群 id 必填校验(非 0 数字,按字符串传输)。 */
22
+ function requireGroupId(value) {
23
+ const text = String(value ?? '').trim();
24
+ if (!/^\d+$/.test(text) || text === '0') {
25
+ throw ymbValidationError('id_invalid', `groupId 必须是非 0 数字 ID(收到:${text || '(空)'})`);
26
+ }
27
+ return text;
28
+ }
29
+ function dayRangeShanghai(offsetDay) {
30
+ const now = new Date();
31
+ const tzMs = 8 * 3600 * 1000;
32
+ const local = new Date(now.getTime() + tzMs);
33
+ const dayStart = Date.UTC(local.getUTCFullYear(), local.getUTCMonth(), local.getUTCDate() + offsetDay);
34
+ return { begin: Math.floor((dayStart - tzMs) / 1000), end: Math.floor((dayStart + 86400_000 - tzMs) / 1000) - 1 };
35
+ }
36
+ function maskTypeName(mask) {
37
+ const names = [
38
+ [1, '全员群'], [2, '部门群'], [4, '外部群'], [8, '事项群'], [16, '话题群'],
39
+ ];
40
+ const hit = names.filter(([bit]) => (mask & bit) !== 0).map(([, name]) => name);
41
+ return hit.length ? hit.join('|') : String(mask);
42
+ }
43
+ function stateName(state) {
44
+ if (state === 1)
45
+ return '正常';
46
+ if (state === 0)
47
+ return '已销毁';
48
+ return `状态${state}`;
49
+ }
50
+ /** 群搜索。 */
51
+ const groupSearch = {
52
+ name: 'yimiaoban.group.search',
53
+ resource: 'group',
54
+ method: 'group.search',
55
+ action: 'yimiaoban.group.search',
56
+ summary: '按条件搜索群(cond+mask 全服务端过滤,禁止本地过滤)',
57
+ capability: 'group',
58
+ risk: READ,
59
+ inputSchema: schemaOf({
60
+ name: { type: 'string', description: '群名关键字' },
61
+ precise: { type: 'boolean', description: '精确匹配名称' },
62
+ type: { type: 'integer', description: '群类型筛选(1 普通/6 部门/7 全员等)' },
63
+ members: { type: 'boolean', description: '我所在的群' },
64
+ owner: { type: 'boolean', description: '我是群主的群' },
65
+ creator: { type: 'boolean', description: '我创建的群' },
66
+ today: { type: 'boolean', description: '今天创建的群' },
67
+ yesterday: { type: 'boolean', description: '昨天创建的群' },
68
+ createBegin: { type: 'integer', description: '创建时间下界(unix 秒)' },
69
+ createEnd: { type: 'integer', description: '创建时间上界(unix 秒)' },
70
+ pageSize: { type: 'integer', minimum: 1, maximum: 200, description: '每页大小(默认 100)' },
71
+ }, { description: '至少提供一个搜索条件' }),
72
+ handler: async (args, { host }) => {
73
+ const cond = {};
74
+ let mask = 0;
75
+ if (args.type !== undefined) {
76
+ mask |= SEARCH_TYPE_MASK.type;
77
+ cond.type = toUint(args.type, 'type');
78
+ }
79
+ if (args.name !== undefined && args.name !== '') {
80
+ mask |= SEARCH_TYPE_MASK.key;
81
+ cond.key = String(args.name);
82
+ }
83
+ if (args.members === true) {
84
+ // 成员身份必须是 IM cid + IM uid(cid 来自 teamsCheck 的 imCid,不能用登录 userId 顶替)
85
+ const self = await host.getSelfIdentity();
86
+ const { cid, uid } = requireCidUid(self.cid, self.uid);
87
+ mask |= SEARCH_TYPE_MASK.members;
88
+ cond.members = [{ cid, uid }];
89
+ }
90
+ if (args.precise === true) {
91
+ mask |= SEARCH_TYPE_MASK.precise;
92
+ cond.precise = 1;
93
+ }
94
+ if (args.owner === true) {
95
+ const self = await host.getSelfIdentity();
96
+ mask |= SEARCH_TYPE_MASK.owners;
97
+ cond.owners = [{ cid: self.cid, uid: self.uid }];
98
+ }
99
+ if (args.creator === true) {
100
+ const self = await host.getSelfIdentity();
101
+ mask |= SEARCH_TYPE_MASK.creators;
102
+ cond.creators = [{ cid: self.cid, uid: self.uid }];
103
+ }
104
+ let create;
105
+ if (args.today === true)
106
+ create = dayRangeShanghai(0);
107
+ else if (args.yesterday === true)
108
+ create = dayRangeShanghai(-1);
109
+ else if (args.createBegin !== undefined || args.createEnd !== undefined) {
110
+ create = { begin: Number(args.createBegin ?? 0), end: Number(args.createEnd ?? 0) };
111
+ }
112
+ if (create) {
113
+ mask |= SEARCH_TYPE_MASK.create;
114
+ cond.create = create;
115
+ }
116
+ if (mask === 0)
117
+ throw ymbValidationError('cond_required', '至少提供一个搜索条件(name/type/members/owner/creator/today/yesterday/create*)');
118
+ cond.mask = mask;
119
+ const pageSize = Math.min(toPositiveInt(args.pageSize, 'pageSize') ?? 100, 200);
120
+ const body = { page: { size: pageSize, num: 1 }, cond };
121
+ const res = await host.request({
122
+ method: 'POST',
123
+ path: '/api/em/msg/executeIm/group/searchGroup',
124
+ body,
125
+ operation: 'yimiaoban.group.search',
126
+ });
127
+ assertImOk(res, '搜索群');
128
+ const inner = unwrapInner(res);
129
+ const datas = inner?.datas || [];
130
+ return ymbSuccess('yimiaoban.group.search', {
131
+ total: inner?.total ?? datas.length,
132
+ groups: datas.map((g) => ({
133
+ id: str(g.id),
134
+ name: g.name ?? '',
135
+ type: g.type,
136
+ num: g.num,
137
+ createTime: formatFullTime(g.create),
138
+ })),
139
+ });
140
+ },
141
+ };
142
+ /** 群基础信息(支持多群)。 */
143
+ const groupInfo = {
144
+ name: 'yimiaoban.group.info',
145
+ resource: 'group',
146
+ method: 'group.info',
147
+ action: 'yimiaoban.group.info',
148
+ summary: '按群 id 查基础信息(支持批量;类型位组合 + 状态展示)',
149
+ capability: 'group',
150
+ risk: READ,
151
+ inputSchema: schemaOf({
152
+ groupIds: { type: 'array', items: { type: 'string' }, description: '群 id 列表(逗号串或数组)' },
153
+ groupId: { type: 'string', description: '单群 id(groupIds 的便捷形式)' },
154
+ }, { description: 'groupIds / groupId 至少其一' }),
155
+ handler: async (args, { host }) => {
156
+ let ids = [];
157
+ if (Array.isArray(args.groupIds))
158
+ ids = args.groupIds.map((x) => String(x));
159
+ else if (args.groupIds)
160
+ ids = splitIds(args.groupIds, 'groupIds');
161
+ if (args.groupId)
162
+ ids.push(String(args.groupId));
163
+ ids = [...new Set(ids)];
164
+ if (ids.length === 0)
165
+ throw ymbValidationError('group_ids_required', 'groupIds / groupId 至少其一');
166
+ for (const id of ids) {
167
+ if (!/^\d+$/.test(id) || id === '0')
168
+ throw ymbValidationError('id_invalid', `群 id 必须非 0 数字:${id}`);
169
+ }
170
+ const body = { trans_id: 0, type: 0, mask: 0, group_id: ids, flag: 0 };
171
+ const res = await host.request({
172
+ method: 'POST',
173
+ path: '/api/em/msg/executeIm/group/queryGroupInfo',
174
+ body,
175
+ operation: 'yimiaoban.group.info',
176
+ });
177
+ assertImOk(res, '查询群信息');
178
+ const inner = unwrapInner(res);
179
+ const datas = inner?.datas || [];
180
+ const groups = datas.map((g) => ({
181
+ groupId: str(g.group_id ?? g.id),
182
+ name: g.name ?? '',
183
+ mask: Number(g.mask ?? 0),
184
+ maskName: maskTypeName(Number(g.mask ?? 0)),
185
+ userNum: g.user_num,
186
+ maxNum: g.max_num,
187
+ hostUid: str(g.host_uid ?? g.hostUid ?? ''),
188
+ state: Number(g.state ?? -1),
189
+ stateName: stateName(Number(g.state ?? -1)),
190
+ createTime: formatFullTime(g.create_time ?? g.createTime),
191
+ }));
192
+ return ymbSuccess('yimiaoban.group.info', { total: groups.length, groups });
193
+ },
194
+ };
195
+ /** 群成员列表。 */
196
+ const groupUsers = {
197
+ name: 'yimiaoban.group.users',
198
+ resource: 'group',
199
+ method: 'group.users',
200
+ action: 'yimiaoban.group.users',
201
+ summary: '拉取群成员列表(姓名一律走 hrm,默认 mask 不含 name 位)',
202
+ capability: 'group',
203
+ risk: READ,
204
+ inputSchema: schemaOf({
205
+ groupId: { type: 'string', pattern: '^\\d+$', description: '群 id' },
206
+ mask: { type: 'integer', description: 'member_mask(默认 142=cid|uid|role|add_time)' },
207
+ syncType: { type: 'integer', enum: [0, 1], description: '0 全量(默认)/1 增量' },
208
+ clientUc: { type: 'string', description: '增量游标 server_uc' },
209
+ }, { required: ['groupId'], description: '拉取群成员' }),
210
+ handler: async (args, { host }) => {
211
+ const groupId = requireGroupId(args.groupId);
212
+ const memberMask = Number(args.mask ?? 142);
213
+ const body = compact({
214
+ group_id: groupId,
215
+ type: 0,
216
+ sync_type: Number(args.syncType ?? 0),
217
+ member_mask: memberMask,
218
+ client_uc: args.clientUc !== undefined ? String(args.clientUc) : '0',
219
+ });
220
+ const res = await host.request({
221
+ method: 'POST',
222
+ path: '/api/em/msg/executeIm/group/getGroupUsers',
223
+ body,
224
+ operation: 'yimiaoban.group.users',
225
+ });
226
+ assertImOk(res, '拉取群成员');
227
+ const inner = unwrapInner(res);
228
+ const members = extractGroupMembers(inner);
229
+ const hasRole = (memberMask & 8) !== 0;
230
+ const hasAddTime = (memberMask & 128) !== 0;
231
+ const hasCid = (memberMask & 2) !== 0;
232
+ const hasUid = (memberMask & 4) !== 0;
233
+ const roleNames = { 0: '不可用', 1: '普通成员', 2: '管理员', 3: '群主', 4: '客户', 5: '负责人', 6: '协助人员' };
234
+ const personIds = members.map((m) => String(m?.uid ?? '')).filter((x) => x && x !== '0');
235
+ // 姓名一律走 hrm 解析(不看 member_mask 的 name 位,也不使用 IM 返回的 name 字段)
236
+ const personMap = personIds.length ? await host.resolveUsersByIds([...new Set(personIds)]) : {};
237
+ const rows = members.map((m) => ({
238
+ uid: hasUid ? str(m.uid) : undefined,
239
+ cid: hasCid ? str(m.cid) : undefined,
240
+ name: personMap[str(m.uid)]?.name || str(m.uid),
241
+ role: hasRole ? Number(m.role_type ?? m.role ?? -1) : undefined,
242
+ roleName: hasRole ? roleNames[Number(m.role_type ?? m.role ?? -1)] ?? '-' : undefined,
243
+ addTime: hasAddTime ? formatFullTime(m.add_time ?? m.addTime) : undefined,
244
+ }));
245
+ return ymbSuccess('yimiaoban.group.users', {
246
+ groupId,
247
+ totalNum: inner?.total_num ?? rows.length,
248
+ endFlag: inner?.end_flag,
249
+ serverUc: str(inner?.server_uc ?? ''),
250
+ members: rows,
251
+ });
252
+ },
253
+ };
254
+ /** 批量查群管理员/群主。 */
255
+ const groupAdmins = {
256
+ name: 'yimiaoban.group.admins',
257
+ resource: 'group',
258
+ method: 'group.admins',
259
+ action: 'yimiaoban.group.admins',
260
+ summary: '批量获取群主/管理员(mask 位 1=群主/负责人 2=管理员,默认 3)',
261
+ capability: 'group',
262
+ risk: READ,
263
+ inputSchema: schemaOf({
264
+ groupIds: { type: 'array', items: { type: 'string' }, description: '群 id 列表' },
265
+ mask: { type: 'integer', description: '角色位掩码(默认 3)' },
266
+ }, { required: ['groupIds'], description: '批量查询群管理员' }),
267
+ handler: async (args, { host }) => {
268
+ const ids = Array.isArray(args.groupIds) ? args.groupIds.map((x) => String(x)) : splitIds(args.groupIds, 'groupIds');
269
+ const body = { group_ids: ids, mask: Number(args.mask ?? 3) };
270
+ const res = await host.request({
271
+ method: 'POST',
272
+ path: '/api/em/msg/executeIm/group/getGroupAdminBatch',
273
+ body,
274
+ operation: 'yimiaoban.group.admins',
275
+ });
276
+ assertImOk(res, '查询群管理员');
277
+ const inner = unwrapInner(res);
278
+ const datas = inner?.datas || [];
279
+ const roleNames = { 3: '群主', 2: '管理员' };
280
+ const allUids = new Set();
281
+ for (const g of datas) {
282
+ for (const it of g?.datas || []) {
283
+ if (it?.user?.uid)
284
+ allUids.add(String(it.user.uid));
285
+ }
286
+ }
287
+ const personMap = await host.resolveUsersByIds([...allUids]);
288
+ const groups = datas.map((g) => ({
289
+ groupId: str(g.group_id),
290
+ admins: (g?.datas || []).map((it) => ({
291
+ name: personMap[str(it.user?.uid)]?.name || str(it.user?.uid),
292
+ uid: str(it.user?.uid),
293
+ cid: str(it.user?.cid),
294
+ role: Number(it.role ?? -1),
295
+ roleName: roleNames[Number(it.role ?? -1)] ?? '-',
296
+ })),
297
+ }));
298
+ return ymbSuccess('yimiaoban.group.admins', { total: groups.length, groups });
299
+ },
300
+ };
301
+ /** 批量判断群是否存在。 */
302
+ const groupExist = {
303
+ name: 'yimiaoban.group.exist',
304
+ resource: 'group',
305
+ method: 'group.exist',
306
+ action: 'yimiaoban.group.exist',
307
+ summary: '批量判断群是否存在(ret=0 存在;1209 不存在)',
308
+ capability: 'group',
309
+ risk: READ,
310
+ inputSchema: schemaOf({
311
+ groupIds: { type: 'array', items: { type: 'string' }, description: '群 id 列表' },
312
+ }, { required: ['groupIds'], description: '批量判断群是否存在' }),
313
+ handler: async (args, { host }) => {
314
+ const ids = Array.isArray(args.groupIds) ? args.groupIds.map((x) => String(x)) : splitIds(args.groupIds, 'groupIds');
315
+ for (const id of ids) {
316
+ if (!/^\d+$/.test(id) || id === '0')
317
+ throw ymbValidationError('id_invalid', `群 id 必须非 0 数字:${id || '(空)'}`);
318
+ }
319
+ const body = { groupIds: ids };
320
+ const res = await host.request({
321
+ method: 'POST',
322
+ path: '/api/em/msg/executeIm/group/checkGroupExist',
323
+ body,
324
+ operation: 'yimiaoban.group.exist',
325
+ });
326
+ assertImOk(res, '检查群是否存在');
327
+ const inner = unwrapInner(res);
328
+ const results = inner?.results || [];
329
+ return ymbSuccess('yimiaoban.group.exist', {
330
+ groups: results.map((r) => ({
331
+ groupId: str(r.group_id),
332
+ exists: Number(r.ret) === 0,
333
+ ret: r.ret,
334
+ })),
335
+ });
336
+ },
337
+ };
338
+ /** 检查用户是否在某群内。 */
339
+ const groupUserExist = {
340
+ name: 'yimiaoban.group.userExist',
341
+ resource: 'group',
342
+ method: 'group.userExist',
343
+ action: 'yimiaoban.group.userExist',
344
+ summary: '检查用户是否在某群内(tenantKey 自动注入)',
345
+ capability: 'group',
346
+ risk: READ,
347
+ inputSchema: schemaOf({
348
+ groupId: { type: 'string', pattern: '^\\d+$', description: '群 id' },
349
+ users: { type: 'array', items: { type: 'string' }, description: '待检查 uid 列表' },
350
+ }, { required: ['groupId', 'users'], description: '检查用户是否在群内' }),
351
+ handler: async (args, { host }) => {
352
+ const groupId = requireGroupId(args.groupId);
353
+ const users = Array.isArray(args.users) ? args.users.map((x) => String(x)) : splitIds(args.users, 'users');
354
+ const session = await host.getSession();
355
+ if (!session.tenantKey)
356
+ throw ymbValidationError('tenant_key_missing', '登录态缺少 tenantKey,请重新登录');
357
+ const body = { tenantKey: session.tenantKey, groupId, users };
358
+ const res = await host.request({
359
+ method: 'POST',
360
+ path: '/api/em/msg/executeIm/group/checkGroupUserExist',
361
+ body,
362
+ operation: 'yimiaoban.group.userExist',
363
+ });
364
+ assertImOk(res, '检查群成员');
365
+ const inner = unwrapInner(res);
366
+ const inGroup = Array.isArray(inner?.users) ? inner.users.map((x) => String(x)) : [];
367
+ const inSet = new Set(inGroup);
368
+ const personMap = await host.resolveUsersByIds(users);
369
+ const rows = users.map((uid) => ({
370
+ uid,
371
+ name: personMap[uid]?.name || uid,
372
+ inGroup: inSet.has(uid),
373
+ }));
374
+ return ymbSuccess('yimiaoban.group.userExist', { groupId, total: rows.length, users: rows });
375
+ },
376
+ };
377
+ /** 群公告:获取单条。 */
378
+ const groupAnnounceGet = {
379
+ name: 'yimiaoban.group.announce.get',
380
+ resource: 'group',
381
+ method: 'group.announce.get',
382
+ action: 'yimiaoban.group.announce.get',
383
+ summary: '获取群公告(aid=0/不传=最新公告)',
384
+ capability: 'group',
385
+ risk: READ,
386
+ inputSchema: schemaOf({
387
+ groupId: { type: 'string', pattern: '^\\d+$', description: '群 id' },
388
+ aid: { type: 'string', description: '公告 id(默认 0=最新)' },
389
+ }, { required: ['groupId'], description: '获取群公告' }),
390
+ handler: async (args, { host }) => {
391
+ const body = { groupId: requireGroupId(args.groupId), aid: args.aid !== undefined ? String(args.aid) : '0' };
392
+ const res = await host.request({
393
+ method: 'POST',
394
+ path: '/api/em/msg/executeIm/group/getAnnouce',
395
+ body,
396
+ operation: 'yimiaoban.group.announce.get',
397
+ });
398
+ assertImOk(res, '获取群公告');
399
+ const inner = unwrapInner(res);
400
+ // 公告主体位于 data.data.data(兼容 data.data 直挂 annouce 的形态)
401
+ const data = inner && typeof inner === 'object' && inner.data && typeof inner.data === 'object' ? inner.data : inner;
402
+ if (!data || (data.aid === undefined && data.annouce === undefined)) {
403
+ return ymbSuccess('yimiaoban.group.announce.get', { found: false });
404
+ }
405
+ const personMap = await host.resolveUsersByIds(data?.add_user?.uid ? [String(data.add_user.uid)] : []);
406
+ return ymbSuccess('yimiaoban.group.announce.get', {
407
+ found: true,
408
+ aid: str(data.aid),
409
+ annouce: data.annouce ?? '',
410
+ addUserName: personMap[str(data.add_user?.uid)]?.name || str(data.add_user?.uid),
411
+ time: formatFullTime(data.time),
412
+ updateTime: formatFullTime(data.update_tm ?? data.update_time),
413
+ fmark: Number(data.fmark ?? 0),
414
+ mustRead: Number(data.fmark ?? 0) === 1,
415
+ related: str(data.related ?? ''),
416
+ });
417
+ },
418
+ };
419
+ /** 群公告列表。 */
420
+ const groupAnnounceList = {
421
+ name: 'yimiaoban.group.announce.list',
422
+ resource: 'group',
423
+ method: 'group.announce.list',
424
+ action: 'yimiaoban.group.announce.list',
425
+ summary: '群公告列表(按 id 降序,end_flag=1 还有下一页)',
426
+ capability: 'group',
427
+ risk: READ,
428
+ inputSchema: schemaOf({
429
+ groupId: { type: 'string', pattern: '^\\d+$', description: '群 id' },
430
+ aid: { type: 'string', description: '分页起始公告 id(默认 0)' },
431
+ pageSize: { type: 'integer', description: '分页大小(默认服务端最大)' },
432
+ }, { required: ['groupId'], description: '群公告列表' }),
433
+ handler: async (args, { host }) => {
434
+ const body = compact({
435
+ groupId: requireGroupId(args.groupId),
436
+ aid: args.aid !== undefined ? String(args.aid) : '0',
437
+ pageSize: args.pageSize !== undefined ? toUint(args.pageSize, 'pageSize') : undefined,
438
+ });
439
+ const res = await host.request({
440
+ method: 'POST',
441
+ path: '/api/em/msg/executeIm/group/getAnnouceList',
442
+ body,
443
+ operation: 'yimiaoban.group.announce.list',
444
+ });
445
+ assertImOk(res, '获取公告列表');
446
+ const inner = unwrapInner(res);
447
+ const datas = inner?.datas || inner?.list || [];
448
+ const personIds = datas.map((d) => String(d?.add_user?.uid ?? '')).filter((x) => x && x !== '0');
449
+ const personMap = await host.resolveUsersByIds([...new Set(personIds)]);
450
+ const rows = datas.map((d) => ({
451
+ aid: str(d.aid),
452
+ annouce: d.annouce ?? '',
453
+ deleted: d.annouce === undefined || d.annouce === null || d.annouce === '',
454
+ addUserName: personMap[str(d.add_user?.uid)]?.name || str(d.add_user?.uid),
455
+ time: formatFullTime(d.time),
456
+ updateTime: formatFullTime(d.update_tm ?? d.update_time),
457
+ mustRead: Number(d.fmark ?? 0) === 1,
458
+ related: str(d.related ?? ''),
459
+ }));
460
+ return ymbSuccess('yimiaoban.group.announce.list', {
461
+ total: rows.length,
462
+ endFlag: inner?.end_flag,
463
+ hasMore: Number(inner?.end_flag) === 1,
464
+ announcements: rows,
465
+ });
466
+ },
467
+ };
468
+ export const groupReadOperations = [
469
+ groupSearch,
470
+ groupInfo,
471
+ groupUsers,
472
+ groupAdmins,
473
+ groupExist,
474
+ groupUserExist,
475
+ groupAnnounceGet,
476
+ groupAnnounceList,
477
+ ];