weaver-work-cli 0.1.70 → 0.1.73

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 (263) hide show
  1. package/dist/chunks/{archive-VUTREF3P.js → archive-THZV4ND4.js} +22 -5
  2. package/dist/chunks/{archive-oa-VXXO4RTB.js → archive-oa-PQ23OLEV.js} +17 -5
  3. package/dist/chunks/{asset-45U6TY7I.js → asset-RGPROZYH.js} +22 -5
  4. package/dist/chunks/{asset-idle-YCRBMTIT.js → asset-idle-Z2PDX7NA.js} +15 -5
  5. package/dist/chunks/{attachment-content-DMU7KNZ7.js → attachment-content-R3RPVOYE.js} +3 -3
  6. package/dist/chunks/{blog-5AML4WMG.js → blog-7U3QZPIF.js} +25 -5
  7. package/dist/chunks/{caizhilian-3P7BUNHT.js → caizhilian-3AB42GCV.js} +22 -8
  8. package/dist/chunks/{calendar-2HUXM3CZ.js → calendar-KINM64E4.js} +15 -5
  9. package/dist/chunks/{chunk-EHH363SP.js → chunk-2CHGUYMG.js} +4 -4
  10. package/dist/chunks/{chunk-GWM5TLIK.js → chunk-2XED2FKY.js} +34 -34
  11. package/dist/chunks/{chunk-DVFA3ODS.js → chunk-35A56FJ7.js} +12 -0
  12. package/dist/chunks/{chunk-QYDSTYGG.js → chunk-4BXR6CNB.js} +3 -3
  13. package/dist/chunks/{chunk-KDOJW5LH.js → chunk-4I26YMBY.js} +1 -1
  14. package/dist/chunks/{chunk-X6PMJQGO.js → chunk-4YXAK6OA.js} +19 -8
  15. package/dist/chunks/{chunk-HG6INLH6.js → chunk-54ST55IJ.js} +28 -7
  16. package/dist/chunks/{chunk-DSBV4GRK.js → chunk-6HT73VOI.js} +3 -3
  17. package/dist/chunks/{chunk-4W6BSNIL.js → chunk-7QFVXP2X.js} +6 -6
  18. package/dist/chunks/{chunk-I5XB4MZT.js → chunk-AMAPQVBT.js} +95 -65
  19. package/dist/chunks/{chunk-L2A3COWV.js → chunk-BWYVS62Z.js} +4 -4
  20. package/dist/chunks/{chunk-UPVAQJKS.js → chunk-DRUND2PJ.js} +130 -79
  21. package/dist/chunks/{chunk-LJE7RZNC.js → chunk-F4HM25K4.js} +1 -1
  22. package/dist/chunks/{chunk-T24EBWAZ.js → chunk-GAMGDNTF.js} +48 -21
  23. package/dist/chunks/{chunk-H2NRTGZR.js → chunk-GWJLAF6B.js} +3 -3
  24. package/dist/chunks/{chunk-XIBMZEDB.js → chunk-IBSJJGXL.js} +2 -2
  25. package/dist/chunks/{chunk-VZUH3LKI.js → chunk-ICP53R52.js} +167 -157
  26. package/dist/chunks/{chunk-LRKKKO5A.js → chunk-IU6UB2TD.js} +3 -4
  27. package/dist/chunks/{chunk-GTAFCAVP.js → chunk-IZCQU5D5.js} +1 -1
  28. package/dist/chunks/{chunk-727VKJQK.js → chunk-JMJBPP4B.js} +2 -2
  29. package/dist/chunks/{chunk-UVWW5ABZ.js → chunk-L7TYG5SN.js} +3 -3
  30. package/dist/chunks/{chunk-HAORST2G.js → chunk-LLCMOZ5L.js} +11 -11
  31. package/dist/chunks/{chunk-U3OO3IZF.js → chunk-NUP4RYZK.js} +20 -7
  32. package/dist/chunks/{chunk-IVCOZCAW.js → chunk-PAFOLIYQ.js} +1 -1
  33. package/dist/chunks/{chunk-LSVA7QA6.js → chunk-R3MK2RBN.js} +3 -1
  34. package/dist/chunks/{chunk-GFOFUH6O.js → chunk-TV46Q4NY.js} +52 -51
  35. package/dist/chunks/chunk-WM33BSIL.js +136 -0
  36. package/dist/chunks/{chunk-7CINV2BU.js → chunk-XZBYRYWX.js} +2 -2
  37. package/dist/chunks/{chunk-E7VWE2XI.js → chunk-ZWLWXHJC.js} +3 -3
  38. package/dist/chunks/{conflict-YW5BULJ3.js → conflict-VPAR7E6F.js} +2 -2
  39. package/dist/chunks/{contract-3PMHUASH.js → contract-DDXAO2DZ.js} +48 -5
  40. package/dist/chunks/{cowork-FZBTTBYX.js → cowork-34QCHMDD.js} +37 -8
  41. package/dist/chunks/{create-flow-5OBS3B3V.js → create-flow-52PU2OBI.js} +6 -6
  42. package/dist/chunks/{data-2YZ6A6TL.js → data-CLQ62QGD.js} +99 -184
  43. package/dist/chunks/{ebuilder-form-AWPTMZBZ.js → ebuilder-form-W5R7Q22S.js} +17 -7
  44. package/dist/chunks/{ehr-MNPR4TE5.js → ehr-LCNAVMK5.js} +67 -17
  45. package/dist/chunks/{entry-mode-L65OWPFM.js → entry-mode-6Z3ZV3DE.js} +3 -3
  46. package/dist/chunks/{env-XW7LYIME.js → env-RDKWAARB.js} +2 -2
  47. package/dist/chunks/{esb-GSB5QCEX.js → esb-ANKPUU65.js} +17 -7
  48. package/dist/chunks/{factory-MHFZZAGH.js → factory-434B7RAT.js} +1 -1
  49. package/dist/chunks/{fna-XBSNUS2V.js → fna-AKBSG5HI.js} +15 -5
  50. package/dist/chunks/{group-chat-EEOLO5NM.js → group-chat-PROTW22R.js} +3 -3
  51. package/dist/chunks/{host-NVDG3NC6.js → host-5R2SNFWD.js} +4 -4
  52. package/dist/chunks/{host-2UMNXX5H.js → host-7FJW4E7R.js} +4 -4
  53. package/dist/chunks/{host-XVWBOSEN.js → host-CGXUFQO4.js} +4 -4
  54. package/dist/chunks/{host-R7BP3CTI.js → host-PDJAKCT7.js} +6 -4
  55. package/dist/chunks/{host-SYPCA63D.js → host-WO4L5G5I.js} +4 -4
  56. package/dist/chunks/{host-BD44ASOD.js → host-XIYG4F4B.js} +4 -4
  57. package/dist/chunks/{hrm-FZUDJAND.js → hrm-WGODDTEH.js} +15 -6
  58. package/dist/chunks/{im-F5NENPD7.js → im-YKTKAJU3.js} +16 -6
  59. package/dist/chunks/{invoice-DS6FLU55.js → invoice-PVYCCCVM.js} +27 -6
  60. package/dist/chunks/{jiuchuanhui-JCBUR563.js → jiuchuanhui-RKOQW7BY.js} +19 -6
  61. package/dist/chunks/{lazy-dispatch-F6O2EPGR.js → lazy-dispatch-DW45AFQ5.js} +6 -6
  62. package/dist/chunks/{mail-ZEOSANEJ.js → mail-BNB5S4NW.js} +116 -97
  63. package/dist/chunks/{meeting-PCD5EPBF.js → meeting-O2KDJH66.js} +29 -16
  64. package/dist/chunks/{minute-doc-WTZJVCHG.js → minute-doc-JUCG56GY.js} +4 -4
  65. package/dist/chunks/{okr-OZUMTMCL.js → okr-LWFGWOE7.js} +15 -5
  66. package/dist/chunks/{operations-LQY3FTPH.js → operations-2WHIF5WV.js} +1 -1
  67. package/dist/chunks/{operations-UTUWFJTX.js → operations-532PN5OB.js} +5 -5
  68. package/dist/chunks/{performance-SMVTPK6T.js → performance-7W5COCFU.js} +92 -7
  69. package/dist/chunks/{plan-C2NENH42.js → plan-ZVY3IYTL.js} +15 -5
  70. package/dist/chunks/{project-FAJ2P3UR.js → project-SA62B7MH.js} +18 -5
  71. package/dist/chunks/{reception-NH6MJFPR.js → reception-NGIONPQ3.js} +128 -49
  72. package/dist/chunks/{recruit-stage-DPEFHLSE.js → recruit-stage-WOSN6MGP.js} +1264 -197
  73. package/dist/chunks/{registry-FTPUUHWC.js → registry-N7P3W2RD.js} +5 -5
  74. package/dist/chunks/{registry-3B3OAJYX.js → registry-R72GWXOG.js} +4 -4
  75. package/dist/chunks/{registry-ZQ7OONCB.js → registry-RIQ67ZT7.js} +12 -12
  76. package/dist/chunks/{room-recommend-73NBN3RU.js → room-recommend-KCGIVUFR.js} +4 -4
  77. package/dist/chunks/{schedule-SDBOBBUQ.js → schedule-6UP27HQ4.js} +4 -4
  78. package/dist/chunks/{smart-extract-GTYKF5TJ.js → smart-extract-DDOQSPRB.js} +19 -6
  79. package/dist/chunks/{workflow-OWHWLAOX.js → workflow-V5ALD6QZ.js} +22 -8
  80. package/dist/cmd/auth/index.js +23 -0
  81. package/dist/cmd/e10/index.js +2 -1
  82. package/dist/cmd/index.js +2 -0
  83. package/dist/core/manifest-view.js +207 -0
  84. package/dist/core/output.js +42 -8
  85. package/dist/index.js +35 -35
  86. package/dist/internal/e10/auth/crypto.js +18 -8
  87. package/dist/internal/e10/auth/error-log.js +1 -2
  88. package/dist/internal/e10/auth/messages.js +2 -3
  89. package/dist/internal/e10/auth/xiaoe.js +1 -1
  90. package/dist/internal/e10/tls-policy.js +61 -13
  91. package/dist/shortcuts/archive/index.js +11 -2
  92. package/dist/shortcuts/archive/operations/download.js +1 -0
  93. package/dist/shortcuts/archive/operations/flow-url.js +3 -0
  94. package/dist/shortcuts/archive/operations/prelib.js +2 -0
  95. package/dist/shortcuts/archive/operations/upload.js +1 -0
  96. package/dist/shortcuts/archive-oa/index.js +11 -2
  97. package/dist/shortcuts/archive-oa/operations/borrow-car.js +2 -0
  98. package/dist/shortcuts/asset/index.js +11 -2
  99. package/dist/shortcuts/asset/manifest.js +7 -0
  100. package/dist/shortcuts/asset-idle/index.js +11 -2
  101. package/dist/shortcuts/blog/index.js +11 -2
  102. package/dist/shortcuts/blog/manifest.js +10 -0
  103. package/dist/shortcuts/caizhilian/host.js +20 -4
  104. package/dist/shortcuts/caizhilian/index.js +12 -2
  105. package/dist/shortcuts/caizhilian/manifest.js +4 -25
  106. package/dist/shortcuts/caizhilian/operations/handlers/search.js +34 -0
  107. package/dist/shortcuts/caizhilian/operations/registry.js +25 -1
  108. package/dist/shortcuts/calendar/index.js +11 -2
  109. package/dist/shortcuts/contract/index.js +11 -2
  110. package/dist/shortcuts/contract/manifest.js +32 -0
  111. package/dist/shortcuts/contract/operations/write.js +3 -0
  112. package/dist/shortcuts/cowork/index.js +21 -5
  113. package/dist/shortcuts/cowork/manifest.js +3 -0
  114. package/dist/shortcuts/cowork/operations/discuss-write.js +2 -0
  115. package/dist/shortcuts/cowork/operations/item-write.js +3 -0
  116. package/dist/shortcuts/cowork/operations/member-write.js +2 -0
  117. package/dist/shortcuts/cowork/operations/permission-write.js +2 -0
  118. package/dist/shortcuts/cowork/operations/review-write.js +1 -0
  119. package/dist/shortcuts/data/errors.js +16 -29
  120. package/dist/shortcuts/data/host.js +16 -7
  121. package/dist/shortcuts/data/index.js +12 -41
  122. package/dist/shortcuts/data/manifest.js +5 -44
  123. package/dist/shortcuts/data/operations/attend.js +2 -2
  124. package/dist/shortcuts/data/operations/conf.js +0 -88
  125. package/dist/shortcuts/data/operations/ds.js +4 -4
  126. package/dist/shortcuts/data/operations/index.js +1 -5
  127. package/dist/shortcuts/data/operations/module.js +40 -14
  128. package/dist/shortcuts/data/operations/query.js +2 -2
  129. package/dist/shortcuts/ebuilder-form/index.js +11 -2
  130. package/dist/shortcuts/ebuilder-form/manifest.js +12 -0
  131. package/dist/shortcuts/ehr/index.js +11 -2
  132. package/dist/shortcuts/ehr/operations/attend-write.js +51 -8
  133. package/dist/shortcuts/ehr/operations/recruit-position.js +4 -3
  134. package/dist/shortcuts/ehr/operations/recruit-short-cache.js +6 -2
  135. package/dist/shortcuts/ehr/operations/recruit-write.js +3 -3
  136. package/dist/shortcuts/ehr/operations/recruit.js +206 -82
  137. package/dist/shortcuts/ehr/operations/shared.js +31 -0
  138. package/dist/shortcuts/esb/index.js +11 -2
  139. package/dist/shortcuts/esb/manifest.js +2 -0
  140. package/dist/shortcuts/fna/index.js +11 -2
  141. package/dist/shortcuts/hrm/index.js +11 -1
  142. package/dist/shortcuts/im/index.js +11 -2
  143. package/dist/shortcuts/invoice/index.js +11 -2
  144. package/dist/shortcuts/invoice/manifest.js +8 -0
  145. package/dist/shortcuts/jiuchuanhui/index.js +15 -1
  146. package/dist/shortcuts/jiuchuanhui/manifest.js +2 -0
  147. package/dist/shortcuts/mail/errors.js +14 -0
  148. package/dist/shortcuts/mail/index.js +23 -6
  149. package/dist/shortcuts/mail/manifest.js +11 -4
  150. package/dist/shortcuts/mail/operations/mail-blacklist.js +6 -6
  151. package/dist/shortcuts/mail/operations/mail-contacts.js +10 -10
  152. package/dist/shortcuts/mail/operations/mail-manage.js +15 -14
  153. package/dist/shortcuts/mail/operations/mail-read.js +7 -25
  154. package/dist/shortcuts/mail/operations/mail-send.js +12 -12
  155. package/dist/shortcuts/mail/operations/mail-sign.js +10 -10
  156. package/dist/shortcuts/mail/operations/mail-template.js +10 -10
  157. package/dist/shortcuts/meeting/index.js +11 -2
  158. package/dist/shortcuts/meeting/operations/invitation-publish.js +1 -0
  159. package/dist/shortcuts/okr/index.js +11 -2
  160. package/dist/shortcuts/performance/index.js +62 -3
  161. package/dist/shortcuts/performance/scheme-validate.js +7 -0
  162. package/dist/shortcuts/performance/shared.js +40 -2
  163. package/dist/shortcuts/plan/index.js +11 -2
  164. package/dist/shortcuts/project/index.js +11 -2
  165. package/dist/shortcuts/project/operations/write.js +3 -0
  166. package/dist/shortcuts/reception/constants.js +22 -0
  167. package/dist/shortcuts/reception/index.js +15 -2
  168. package/dist/shortcuts/reception/manifest.js +17 -3
  169. package/dist/shortcuts/reception/operations/ask.js +3 -0
  170. package/dist/shortcuts/reception/operations/doc.js +24 -11
  171. package/dist/shortcuts/reception/operations/docrender.js +18 -1
  172. package/dist/shortcuts/reception/operations/render-assets.js +93 -22
  173. package/dist/shortcuts/recruit-stage/context.js +12 -6
  174. package/dist/shortcuts/recruit-stage/index.js +22 -3
  175. package/dist/shortcuts/recruit-stage/manifest.js +2 -0
  176. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +19 -10
  177. package/dist/shortcuts/recruit-stage/operations/jd-create.js +487 -38
  178. package/dist/shortcuts/recruit-stage/operations/list.js +72 -1
  179. package/dist/shortcuts/recruit-stage/operations/profile.js +194 -0
  180. package/dist/shortcuts/recruit-stage/operations/registry.js +20 -2
  181. package/dist/shortcuts/recruit-stage/operations/resume-import.js +258 -63
  182. package/dist/shortcuts/recruit-stage/operations/search.js +226 -27
  183. package/dist/shortcuts/recruit-stage/operations/shortlist.js +122 -0
  184. package/dist/shortcuts/recruit-stage/operations/tag.js +17 -3
  185. package/dist/shortcuts/recruit-stage/shared.js +158 -4
  186. package/dist/shortcuts/smart-extract/index.js +11 -2
  187. package/dist/shortcuts/smart-extract/manifest.js +1 -0
  188. package/dist/shortcuts/smart-extract/operations/save.js +2 -0
  189. package/dist/shortcuts/workflow/index.js +21 -1
  190. package/dist/shortcuts/workflow/operations/form.js +36 -2
  191. package/dist/shortcuts/workflow/operations/read.js +2 -2
  192. package/dist/shortcuts/workflow/operations/write.js +1 -1
  193. package/docs/caizhilian.md +1 -1
  194. package/docs/contract.md +1 -0
  195. package/docs/data.md +22 -22
  196. package/docs/e10-auth.md +41 -33
  197. package/docs/ehr.md +2 -0
  198. package/docs/reception.md +4 -3
  199. package/package.json +1 -1
  200. package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
  201. package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
  202. package/scripts/pysite/sitecustomize.py +41 -0
  203. package/skill-template/domains/data.md +4 -4
  204. package/skills/weaver-e10-caizhilian/SKILL.md +1 -1
  205. package/skills/weaver-e10-caizhilian/references/org-browser.md +1 -0
  206. package/skills/weaver-e10-cowork/SKILL.md +3 -1
  207. package/skills/weaver-e10-data/SKILL.md +12 -16
  208. package/skills/weaver-e10-data/references/config-center.md +6 -7
  209. package/skills/weaver-e10-data/references/datasource.md +1 -1
  210. package/skills/weaver-e10-data/references/scene-and-misc.md +2 -2
  211. package/skills/weaver-e10-jiuchuanhui/SKILL.md +6 -4
  212. package/skills/weaver-e10-jiuchuanhui/references/clue.md +2 -2
  213. package/skills/weaver-e10-jiuchuanhui/references/customer.md +18 -8
  214. package/skills/weaver-e10-jiuchuanhui/references/sale.md +2 -2
  215. package/skills/weaver-e10-jucailin/SKILL.md +7 -3
  216. package/skills/weaver-e10-jucailin/references/attend-write.md +1 -1
  217. package/skills/weaver-e10-jucailin/references/recruit-output-links.md +33 -0
  218. package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -0
  219. package/skills/weaver-e10-mail/SKILL.md +4 -1
  220. package/skills/weaver-e10-mail/references/mail-read.md +4 -2
  221. package/skills/weaver-e10-mail/references/safety-boundaries.md +1 -0
  222. package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
  223. package/skills/weaver-e10-performance/SKILL.md +8 -6
  224. package/skills/weaver-e10-reception-flow/SKILL.md +97 -41
  225. package/skills/weaver-e10-reception-flow/references/guide.md +3 -1
  226. package/skills/weaver-e10-recruit-stage/SKILL.md +557 -75
  227. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +67 -44
  228. package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +279 -0
  229. package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +198 -0
  230. package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +697 -0
  231. package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +507 -0
  232. package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +87 -0
  233. package/skills/weaver-e10-recruit-stage/references/position-templates.md +19 -18
  234. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +19 -18
  235. package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +1 -1
  236. package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +1 -1
  237. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +15 -2
  238. package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +37 -0
  239. package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +4 -4
  240. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +64 -28
  241. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +43 -2
  242. package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +41 -0
  243. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +4 -4
  244. package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +2 -2
  245. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +25 -7
  246. package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +51 -0
  247. package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +63 -0
  248. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +4 -4
  249. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +2 -2
  250. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +58 -33
  251. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +4 -4
  252. package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +5 -5
  253. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +2 -2
  254. package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +11 -10
  255. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +2 -2
  256. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
  257. package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +106 -0
  258. package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +325 -0
  259. package/skills/weaver-e10-recruit-stage/templates/match-report.html +265 -0
  260. package/skills/weaver-e10-shared/SKILL.md +22 -1
  261. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +2 -2
  262. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
  263. package/skills/weaver-e10-jucailin/references/source-manifest.json +0 -152
@@ -1,5 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
3
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
3
4
  import { createImContinuationSigner } from './continuation.js';
4
5
  import { printImFailure, registerImTrace } from './diagnostics.js';
5
6
  import { imValidationError } from './errors.js';
@@ -238,8 +239,16 @@ export const imShortcut = {
238
239
  .option('--trace', '每个 E10 请求在 stderr 打一行 [trace](method/path/op/status/耗时,不含凭证)');
239
240
  im.command('schema')
240
241
  .description('Print im operation manifest for agents')
241
- .action(action((ctx) => {
242
- ctx.output.write(imManifest, { json: true });
242
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
243
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
244
+ .option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
245
+ .action(action((ctx, options) => {
246
+ const schema = schemaOptionsOf(options);
247
+ ctx.output.write(manifestView(imManifest, schema), {
248
+ json: true,
249
+ // 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
250
+ ...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
251
+ });
243
252
  }));
244
253
  withJsonInputOptions(im.command('run')
245
254
  .description('Run an im operation with JSON input')
@@ -2,6 +2,7 @@ import { readFile } from 'node:fs/promises';
2
2
  import { Option } from 'commander';
3
3
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
4
4
  import { reportPlatformError } from '../../core/error-codes.js';
5
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
5
6
  import { createInvoiceContinuationSigner } from './continuation.js';
6
7
  import { createInvoiceHost } from './host.js';
7
8
  import { invoiceManifest } from './manifest.js';
@@ -145,8 +146,16 @@ export const invoiceShortcut = {
145
146
  const invoice = program.command('invoice').description('E10 业票通发票管理');
146
147
  invoice.command('schema')
147
148
  .description('Print invoice operation manifest for agents')
148
- .action(action((ctx) => {
149
- ctx.output.write(invoiceManifest, { json: true });
149
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
150
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
151
+ .option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
152
+ .action(action((ctx, options) => {
153
+ const schema = schemaOptionsOf(options);
154
+ ctx.output.write(manifestView(invoiceManifest, schema), {
155
+ json: true,
156
+ // 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
157
+ ...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
158
+ });
150
159
  }));
151
160
  withInvoiceOptions(invoice.command('run')
152
161
  .description('Run an invoice operation with JSON input')
@@ -687,6 +687,7 @@ export const invoiceOperations = [
687
687
  {
688
688
  name: 'invoice.import.prepare',
689
689
  risk: 'read-before-write',
690
+ requiresConfirmation: true,
690
691
  inputSchema: {
691
692
  type: 'object',
692
693
  additionalProperties: false,
@@ -713,6 +714,7 @@ export const invoiceOperations = [
713
714
  {
714
715
  name: 'invoice.import.apply',
715
716
  risk: 'high-risk-write',
717
+ requiresConfirmation: true,
716
718
  inputSchema: {
717
719
  type: 'object',
718
720
  additionalProperties: false,
@@ -735,6 +737,7 @@ export const invoiceOperations = [
735
737
  {
736
738
  name: 'invoice.add.prepare',
737
739
  risk: 'read-before-write',
740
+ requiresConfirmation: true,
738
741
  inputSchema: {
739
742
  type: 'object',
740
743
  additionalProperties: false,
@@ -749,6 +752,7 @@ export const invoiceOperations = [
749
752
  {
750
753
  name: 'invoice.add.apply',
751
754
  risk: 'high-risk-write',
755
+ requiresConfirmation: true,
752
756
  inputSchema: {
753
757
  type: 'object',
754
758
  additionalProperties: false,
@@ -764,6 +768,7 @@ export const invoiceOperations = [
764
768
  {
765
769
  name: 'invoice.update.prepare',
766
770
  risk: 'read-before-write',
771
+ requiresConfirmation: true,
767
772
  inputSchema: {
768
773
  type: 'object',
769
774
  additionalProperties: false,
@@ -798,6 +803,7 @@ export const invoiceOperations = [
798
803
  {
799
804
  name: 'invoice.update.apply',
800
805
  risk: 'high-risk-write',
806
+ requiresConfirmation: true,
801
807
  inputSchema: {
802
808
  type: 'object',
803
809
  additionalProperties: false,
@@ -827,6 +833,7 @@ export const invoiceOperations = [
827
833
  {
828
834
  name: 'invoice.delete.prepare',
829
835
  risk: 'read-before-write',
836
+ requiresConfirmation: true,
830
837
  inputSchema: {
831
838
  type: 'object',
832
839
  additionalProperties: false,
@@ -841,6 +848,7 @@ export const invoiceOperations = [
841
848
  {
842
849
  name: 'invoice.delete.apply',
843
850
  risk: 'high-risk-write',
851
+ requiresConfirmation: true,
844
852
  inputSchema: {
845
853
  type: 'object',
846
854
  additionalProperties: false,
@@ -1,6 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
3
3
  import { reportPlatformError, shouldReportPlatformError, toPlatformError } from '../../core/error-codes.js';
4
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView } from '../../core/manifest-view.js';
4
5
  import { createJiuchuanhuiContinuationSigner } from './continuation.js';
5
6
  import { createJiuchuanhuiHost } from './host.js';
6
7
  import { getJiuchuanhuiOperationContract, jiuchuanhuiManifest } from './manifest.js';
@@ -123,16 +124,29 @@ export const jiuchuanhuiShortcut = {
123
124
  const jiuchuanhui = program.command('jiuchuanhui').description('泛微E10九氚汇营销管理');
124
125
  jiuchuanhui.command('schema')
125
126
  .description('Print jiuchuanhui operation manifest for agents')
127
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
128
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
126
129
  .option('--operation <name>', 'print the contract for one operation')
127
130
  .action(action((ctx, options) => {
128
- const { operation } = asOptions(options);
131
+ const { operation, list } = asOptions(options);
129
132
  if (operation === undefined) {
133
+ if (list === true) {
134
+ // 完整 manifest 有 73,937 字符,超过预算后 operations 只剩 20/90,入参定义几乎全丢。
135
+ ctx.output.write(manifestView(jiuchuanhuiManifest, { list: true }), {
136
+ json: true,
137
+ compactPaths: MANIFEST_LIST_COMPACT_PATHS,
138
+ });
139
+ return;
140
+ }
130
141
  ctx.output.write(jiuchuanhuiManifest, { json: true });
131
142
  return;
132
143
  }
133
144
  const contract = getJiuchuanhuiOperationContract(operation);
134
145
  if (!contract)
135
146
  throw jiuchuanhuiValidationError('operation_unknown', `九氚汇不支持操作:${operation}`);
147
+ // 保持原契约:这里输出**裸 contract 对象**(`jiuchuanhui-operations.test.ts` 用 deepEqual 锁定),
148
+ // 与 invoice/caizhilian/meeting 的 `{operation: ...}` 包裹结构不同,属于历史不一致,
149
+ // 铺开统一时再收敛,不在此处破坏既有断言。
136
150
  ctx.output.write(contract, { json: true });
137
151
  }));
138
152
  jiuchuanhui.command('run')
@@ -32,6 +32,7 @@ function writePair(baseName, title, props, required = [], fixed = {}, withPrepar
32
32
  list.push({
33
33
  name: `${baseName}.prepare`,
34
34
  risk: 'read-before-write',
35
+ requiresConfirmation: true,
35
36
  fixed: { ...fixed, stage: 'prepare' },
36
37
  inputSchema: {
37
38
  type: 'object',
@@ -51,6 +52,7 @@ function writePair(baseName, title, props, required = [], fixed = {}, withPrepar
51
52
  list.push({
52
53
  name: `${baseName}.apply`,
53
54
  risk: 'high-risk-write',
55
+ requiresConfirmation: true,
54
56
  fixed: { ...fixed, stage: 'apply' },
55
57
  inputSchema: {
56
58
  type: 'object',
@@ -38,6 +38,20 @@ export function mailNetworkError(subtype, message, options = {}) {
38
38
  exitCode: ExitCode.NetworkError,
39
39
  });
40
40
  }
41
+ /** 上游契约异常:调用通了但响应缺字段 / 响应体是业务失败(对应平台码 E-0004)。 */
42
+ export function mailUpstreamError(subtype, message, details) {
43
+ return new MailCliError('upstream', subtype, message, {
44
+ details,
45
+ exitCode: ExitCode.NetworkError,
46
+ });
47
+ }
48
+ /** 环境能力未开通 / 发送策略拦截(对应平台码 E-0005)。 */
49
+ export function mailRestrictedError(subtype, message, details) {
50
+ return new MailCliError('policy', subtype, message, {
51
+ details,
52
+ exitCode: ExitCode.PolicyError,
53
+ });
54
+ }
41
55
  export function mailConfirmationError(action, details) {
42
56
  return new MailCliError('confirmation', 'required', '该操作需要明确确认', {
43
57
  details: { action, ...details },
@@ -1,6 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { ExitCode, isCliError, toErrorEnvelope } from '../../core/errors.js';
3
- import { reportPlatformError } from '../../core/error-codes.js';
3
+ import { shouldReportPlatformError, toPlatformError } from '../../core/error-codes.js';
4
+ import { MANIFEST_LIST_COMPACT_PATHS, manifestView, schemaOptionsOf } from '../../core/manifest-view.js';
4
5
  import { createMailContinuationSigner } from './continuation.js';
5
6
  import { createMailHost } from './host.js';
6
7
  import { mailManifest } from './manifest.js';
@@ -47,7 +48,7 @@ function parseJsonInput(raw, label) {
47
48
  try {
48
49
  const parsed = JSON.parse(stripBom(raw));
49
50
  if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
50
- throw new Error('input must be an object');
51
+ throw mailValidationError('input_invalid', label + ' 必须是 JSON 对象');
51
52
  }
52
53
  return parsed;
53
54
  }
@@ -84,8 +85,16 @@ async function executeAndPrint(ctx, operation, input) {
84
85
  ctx.output.write(successEnvelope(operation, result), { json: true });
85
86
  }
86
87
  catch (error) {
87
- reportPlatformError(error);
88
- console.error(JSON.stringify(failureEnvelope(error), null, 2));
88
+ // 与 ehr 对齐(审计 G-06):单段 JSON、顶层带平台码,避免“先一行 JSON 再一段 JSON”
89
+ // 导致 stderr 无法一次解析,也避免多行 JSON 里根本没有 E-XXXX。
90
+ const env = failureEnvelope(error);
91
+ if (shouldReportPlatformError(error)) {
92
+ const pe = toPlatformError(error);
93
+ console.error(JSON.stringify({ ...env, code: pe.code, message: pe.message }, null, 2));
94
+ }
95
+ else {
96
+ console.error(JSON.stringify(env, null, 2));
97
+ }
89
98
  process.exitCode = isCliError(error) ? error.exitCode : ExitCode.GeneralError;
90
99
  }
91
100
  }
@@ -97,8 +106,16 @@ export const mailShortcut = {
97
106
  const mail = program.command('mail').description('泛微E10邮件管理(查询/发送/管理)');
98
107
  mail.command('schema')
99
108
  .description('Print mail operation manifest for agents')
100
- .action(action((ctx) => {
101
- ctx.output.write(mailManifest, { json: true });
109
+ .option('--list', '只列操作清单(name/summary/risk),全量不截断;判断"有没有某操作"用这个')
110
+ .option('--full', '打印完整 manifest(超 stdout 预算会落本地 ref,用 refs get 分页取)')
111
+ .option('--operation <name>', '只输出单个操作的完整契约(含 inputSchema,体积远低于预算)')
112
+ .action(action((ctx, options) => {
113
+ const schema = schemaOptionsOf(options);
114
+ ctx.output.write(manifestView(mailManifest, schema), {
115
+ json: true,
116
+ // 只有 --list 单行化:条目多、缩进空白能吃掉近一半体积,且对读模型无收益。
117
+ ...(schema.list === true ? { compactPaths: MANIFEST_LIST_COMPACT_PATHS } : {}),
118
+ });
102
119
  }));
103
120
  mail.command('run')
104
121
  .description('Run a mail operation with JSON input')
@@ -4,10 +4,17 @@ import { mailOperationDefinitions } from './operations/registry.js';
4
4
  * - mail.delete.batch:物理永久删除,不可逆、无法撤销,破坏性最强,暂缓实现。
5
5
  * - mail.resend:重发依赖「邮件发送日志 id」(mailRemindLogId),源技能未封装日志查询接口,
6
6
  * 无法获得该 id 时如实提示,不臆造;暂缓实现。
7
+ * - mail.clearlog.list:2026-11-27 审计实测本环境 `getEmailClearLogList` 返回 HTTP 404,
8
+ * E10 服务端接口不存在或未装配;调用必然失败的入口不下发给模型,待确认目标版本后恢复。
7
9
  * 其余读操作与写操作(发送/回复/转发/存草稿、标星、已读、待办、移动、逻辑删除、文件夹、
8
10
  * 联系人、分组、模板、签名、黑名单、附件上传/下载、撤回)均已可用。不得编造或绕过。
9
11
  */
10
- const MAIL_WITHHELD = ['mail.delete.batch', 'mail.resend'];
12
+ const MAIL_WITHHELD_REASONS = {
13
+ 'mail.delete.batch': '物理永久删除(deleteMailResourceBatch)不可逆、无法撤销,破坏性最强;如确需执行,请在确认风险后以单独授权方式处理,不在常规 CLI 提供。',
14
+ 'mail.resend': '重发邮件(resendMail)依赖「邮件发送日志 id」(mailRemindLogId),源技能未封装日志查询接口,无法获得该 id 时如实提示,不臆造;暂缓实现。',
15
+ 'mail.clearlog.list': '邮件清理日志接口(getEmailClearLogList)在本环境实测 HTTP 404,E10 服务端不存在或未装配;调用必然失败,暂不提供,待确认目标版本后恢复。',
16
+ };
17
+ const MAIL_WITHHELD = Object.keys(MAIL_WITHHELD_REASONS);
11
18
  function buildOperations() {
12
19
  return mailOperationDefinitions().map((definition) => ({
13
20
  name: definition.name,
@@ -29,10 +36,10 @@ export const mailManifest = {
29
36
  sourceSkill: 'weaver-e10-mail',
30
37
  capabilities: ['mail'],
31
38
  operations: buildOperations(),
39
+ // 2026-11-27 审计 MA-04 / G-10:首屏先给被扣下的能力总数,避免截断后模型误判"这里只有这些"。
40
+ withheldCount: MAIL_WITHHELD.length,
32
41
  withheldOperations: MAIL_WITHHELD.map((name) => ({
33
42
  name,
34
- reason: name === 'mail.delete.batch'
35
- ? '物理永久删除(deleteMailResourceBatch)不可逆、无法撤销,破坏性最强;如确需执行,请在确认风险后以单独授权方式处理,不在常规 CLI 提供。'
36
- : '重发邮件(resendMail)依赖「邮件发送日志 id」(mailRemindLogId),源技能未封装日志查询接口,无法获得该 id 时如实提示,不臆造;暂缓实现。',
43
+ reason: MAIL_WITHHELD_REASONS[name],
37
44
  })),
38
45
  };
@@ -1,5 +1,5 @@
1
1
  import { CONTINUATION_TTL_MS } from '../../../core/continuation-ttl.js';
2
- import { mailValidationError } from '../errors.js';
2
+ import { mailConfirmationError, mailValidationError } from '../errors.js';
3
3
  import { WRITE, mailSuccess, schemaOf, SCHEMA_STRING } from './types.js';
4
4
  const BLACKLIST_SCHEMA = schemaOf({
5
5
  operateType: { type: 'string', description: 'add / delete' },
@@ -11,18 +11,18 @@ const BLACKLIST_SCHEMA = schemaOf({
11
11
  function buildBlacklistBody(args) {
12
12
  const operateType = String(args.operateType || 'add').toLowerCase();
13
13
  if (operateType !== 'add' && operateType !== 'delete')
14
- throw new Error('operateType 必须是 add 或 delete');
14
+ throw mailValidationError('operate_type_invalid', 'operateType 必须是 add 或 delete');
15
15
  const body = { operateType };
16
16
  if (operateType === 'add') {
17
17
  const mailAddress = String(args.mailAddress || '').trim();
18
18
  if (!mailAddress)
19
- throw new Error('add 操作必须提供 mailAddress(邮箱地址)');
19
+ throw mailValidationError('mail_address_required', 'add 操作必须提供 mailAddress(邮箱地址)');
20
20
  body.mailAddress = mailAddress;
21
21
  }
22
22
  else {
23
23
  const id = String(args.id || '').trim();
24
24
  if (!id)
25
- throw new Error('delete 操作必须提供 id(黑名单记录 id)');
25
+ throw mailValidationError('id_required', 'delete 操作必须提供 id(黑名单记录 id)');
26
26
  body.id = id;
27
27
  }
28
28
  return body;
@@ -64,9 +64,9 @@ const opBlacklistOperateApply = {
64
64
  inputSchema: BLACKLIST_SCHEMA,
65
65
  async handler(args, env) {
66
66
  if (args.confirm !== true)
67
- throw new Error('mail.blacklist.operate.apply 必须传入 confirm=true 与 prepare 返回的 continuation');
67
+ throw mailConfirmationError('mail.blacklist.operate.apply');
68
68
  if (!args.continuation)
69
- throw new Error('mail.blacklist.operate.apply 必须传入 prepare 返回的 continuation');
69
+ throw mailValidationError('continuation_required', 'mail.blacklist.operate.apply 需要 prepare 返回的 continuation');
70
70
  const lease = await env.continuation.verify(String(args.continuation), 'mail.blacklist.operate.apply');
71
71
  const session = await env.host.getSession();
72
72
  if (lease.baseUrl !== session.baseUrl || lease.profile !== session.profile || lease.userId !== session.userId) {
@@ -1,5 +1,5 @@
1
1
  import { CONTINUATION_TTL_MS } from '../../../core/continuation-ttl.js';
2
- import { mailValidationError } from '../errors.js';
2
+ import { mailConfirmationError, mailValidationError } from '../errors.js';
3
3
  import { WRITE, mailSuccess, schemaOf, SCHEMA_STRING } from './types.js';
4
4
  // ---------------------------------------------------------------------------
5
5
  // 联系人 新增/编辑(prepare/apply)
@@ -19,9 +19,9 @@ function buildContactBody(args) {
19
19
  const name = String(args.mailUserName || '').trim();
20
20
  const address = String(args.mailAddress || '').trim();
21
21
  if (!name)
22
- throw new Error('mailUserName(姓名)必填');
22
+ throw mailValidationError('user_name_required', 'mailUserName(姓名)必填');
23
23
  if (!address)
24
- throw new Error('mailAddress(邮箱地址)必填');
24
+ throw mailValidationError('mail_address_required', 'mailAddress(邮箱地址)必填');
25
25
  const body = {
26
26
  mailUserName: name,
27
27
  mailAddress: address,
@@ -74,9 +74,9 @@ const opContactSaveApply = {
74
74
  inputSchema: CONTACT_SCHEMA,
75
75
  async handler(args, env) {
76
76
  if (args.confirm !== true)
77
- throw new Error('mail.contacts.save.apply 必须传入 confirm=true 与 prepare 返回的 continuation');
77
+ throw mailConfirmationError('mail.contacts.save.apply');
78
78
  if (!args.continuation)
79
- throw new Error('mail.contacts.save.apply 必须传入 prepare 返回的 continuation');
79
+ throw mailValidationError('continuation_required', 'mail.contacts.save.apply 需要 prepare 返回的 continuation');
80
80
  const lease = await env.continuation.verify(String(args.continuation), 'mail.contacts.save.apply');
81
81
  const session = await env.host.getSession();
82
82
  if (lease.baseUrl !== session.baseUrl || lease.profile !== session.profile || lease.userId !== session.userId) {
@@ -97,7 +97,7 @@ const opContactDelete = {
97
97
  async handler(args, env) {
98
98
  const id = String(args.id || '').trim();
99
99
  if (!id)
100
- throw new Error('id(联系人 id)必填');
100
+ throw mailValidationError('id_required', 'id(联系人 id)必填');
101
101
  const value = (await env.host.request({ path: '/api/mail/base/contacts/delContacts', method: 'POST', body: { ids: id } }));
102
102
  return mailSuccess('mail.contacts.delete', value?.data ?? true, { id });
103
103
  },
@@ -114,7 +114,7 @@ const GROUP_SCHEMA = schemaOf({
114
114
  function buildGroupBody(args) {
115
115
  const groupName = String(args.groupName || '').trim();
116
116
  if (!groupName)
117
- throw new Error('groupName(分组名)必填');
117
+ throw mailValidationError('group_name_required', 'groupName(分组名)必填');
118
118
  const body = { groupName };
119
119
  if (args.id)
120
120
  body.groupId = String(args.id);
@@ -157,9 +157,9 @@ const opGroupSaveApply = {
157
157
  inputSchema: GROUP_SCHEMA,
158
158
  async handler(args, env) {
159
159
  if (args.confirm !== true)
160
- throw new Error('mail.contacts.group.save.apply 必须传入 confirm=true 与 prepare 返回的 continuation');
160
+ throw mailConfirmationError('mail.contacts.group.save.apply');
161
161
  if (!args.continuation)
162
- throw new Error('mail.contacts.group.save.apply 必须传入 prepare 返回的 continuation');
162
+ throw mailValidationError('continuation_required', 'mail.contacts.group.save.apply 需要 prepare 返回的 continuation');
163
163
  const lease = await env.continuation.verify(String(args.continuation), 'mail.contacts.group.save.apply');
164
164
  const session = await env.host.getSession();
165
165
  if (lease.baseUrl !== session.baseUrl || lease.profile !== session.profile || lease.userId !== session.userId) {
@@ -180,7 +180,7 @@ const opGroupDelete = {
180
180
  async handler(args, env) {
181
181
  const id = String(args.id || '').trim();
182
182
  if (!id)
183
- throw new Error('id(分组 id)必填');
183
+ throw mailValidationError('id_required', 'id(分组 id)必填');
184
184
  const value = (await env.host.request({ path: '/api/mail/base/contacts/delContactsGroup', method: 'POST', body: { groupId: id } }));
185
185
  return mailSuccess('mail.contacts.group.delete', value?.data ?? true, { id });
186
186
  },
@@ -3,6 +3,7 @@ import { statSync, readFileSync } from 'node:fs';
3
3
  import { extname } from 'node:path';
4
4
  import { mailRandomKey } from '../host.js';
5
5
  import { WRITE, mailSuccess, schemaOf, SCHEMA_STRING } from './types.js';
6
+ import { mailValidationError, mailUpstreamError } from '../errors.js';
6
7
  const MIME_BY_EXT = {
7
8
  txt: 'text/plain',
8
9
  html: 'text/html',
@@ -48,7 +49,7 @@ const opStar = {
48
49
  const id = String(args.id || '').trim();
49
50
  const star = String(args.star ?? '1');
50
51
  if (!id)
51
- throw new Error('id(邮件 id)必填');
52
+ throw mailValidationError('id_required', 'id(邮件 id)必填');
52
53
  const value = (await env.host.request({
53
54
  path: '/api/mail/base/resource/starMail',
54
55
  method: 'POST',
@@ -69,7 +70,7 @@ const opReadStatus = {
69
70
  const id = String(args.id || '').trim();
70
71
  const read = String(args.read ?? '1');
71
72
  if (!id)
72
- throw new Error('id(邮件 id)必填');
73
+ throw mailValidationError('id_required', 'id(邮件 id)必填');
73
74
  const value = (await env.host.request({
74
75
  path: '/api/mail/base/resource/setMailReadStatus',
75
76
  method: 'POST',
@@ -114,7 +115,7 @@ const opWaitAdd = {
114
115
  async handler(args, env) {
115
116
  const id = String(args.id || '').trim();
116
117
  if (!id)
117
- throw new Error('id(邮件 id)必填');
118
+ throw mailValidationError('id_required', 'id(邮件 id)必填');
118
119
  const content = args.title ? String(args.title) : await fetchSubject(env, id);
119
120
  const processTime = args.endDate ? String(args.endDate) : '';
120
121
  const reminderTime = args.reminderTime ? String(args.reminderTime) : '';
@@ -144,9 +145,9 @@ const opMoveFolder = {
144
145
  const id = String(args.id || '').trim();
145
146
  const folder = String(args.folder || '').trim();
146
147
  if (!id)
147
- throw new Error('id(邮件 id)必填');
148
+ throw mailValidationError('id_required', 'id(邮件 id)必填');
148
149
  if (!folder)
149
- throw new Error('folder(目标文件夹 id)必填');
150
+ throw mailValidationError('folder_required', 'folder(目标文件夹 id)必填');
150
151
  const value = (await env.host.request({
151
152
  path: '/api/mail/base/resource/moveMailToFolder',
152
153
  method: 'POST',
@@ -166,7 +167,7 @@ const opDeleteMove = {
166
167
  async handler(args, env) {
167
168
  const id = String(args.id || '').trim();
168
169
  if (!id)
169
- throw new Error('id(邮件 id)必填');
170
+ throw mailValidationError('id_required', 'id(邮件 id)必填');
170
171
  const value = (await env.host.request({
171
172
  path: '/api/mail/base/resource/deleteMailResourceByMoveBatch',
172
173
  method: 'POST',
@@ -190,7 +191,7 @@ const opFolderCreate = {
190
191
  async handler(args, env) {
191
192
  const name = String(args.name || '').trim();
192
193
  if (!name)
193
- throw new Error('name(文件夹名)必填');
194
+ throw mailValidationError('folder_name_required', 'name(文件夹名)必填');
194
195
  const body = { name };
195
196
  if (args.id)
196
197
  body.id = String(args.id);
@@ -209,7 +210,7 @@ const opFolderDelete = {
209
210
  async handler(args, env) {
210
211
  const id = String(args.id || '').trim();
211
212
  if (!id)
212
- throw new Error('id(文件夹 id)必填');
213
+ throw mailValidationError('id_required', 'id(文件夹 id)必填');
213
214
  const value = (await env.host.request({ path: '/api/mail/base/setting/folder/deleteMailFolder', method: 'POST', body: { id } }));
214
215
  return mailSuccess('mail.folder.delete', value?.data ?? 'SUCCESS', { id });
215
216
  },
@@ -225,7 +226,7 @@ const opRecall = {
225
226
  async handler(args, env) {
226
227
  const id = String(args.id || '').trim();
227
228
  if (!id)
228
- throw new Error('id(邮件 id)必填');
229
+ throw mailValidationError('id_required', 'id(邮件 id)必填');
229
230
  const value = (await env.host.request({ path: '/api/mail/base/recallMail', method: 'POST', body: { mailResourceId: id, ids: id } }));
230
231
  const d = value?.data || {};
231
232
  return mailSuccess('mail.recall', { success: d.success === 1, msg: d.msg }, { id });
@@ -242,7 +243,7 @@ const opAttachmentUpload = {
242
243
  async handler(args, env) {
243
244
  const filePath = String(args.file || '').trim();
244
245
  if (!filePath)
245
- throw new Error('file(本地文件路径)必填');
246
+ throw mailValidationError('file_required', 'file(本地文件路径)必填');
246
247
  const name = args.name ? String(args.name) : filePath.split(/[\\/]/).pop() || 'attachment';
247
248
  let buffer;
248
249
  let size;
@@ -252,7 +253,7 @@ const opAttachmentUpload = {
252
253
  buffer = readFileSync(filePath);
253
254
  }
254
255
  catch {
255
- throw new Error('无法读取本地文件:' + filePath);
256
+ throw mailValidationError('file_unreadable', '无法读取本地文件:' + filePath);
256
257
  }
257
258
  const md5 = createHash('md5').update(buffer).digest('hex');
258
259
  const lastModified = Date.now();
@@ -275,7 +276,7 @@ const opAttachmentUpload = {
275
276
  }));
276
277
  const preUploadId = precheck?.data?.preUploadId;
277
278
  if (!preUploadId)
278
- throw new Error('附件预检未返回 preUploadId:' + JSON.stringify(precheck?.data).slice(0, 200));
279
+ throw mailUpstreamError('attachment_precheck_contract', '附件预检未返回 preUploadId:' + JSON.stringify(precheck?.data).slice(0, 200));
279
280
  const upload = (await env.host.request({
280
281
  path: '/api/file/module/upload',
281
282
  method: 'POST',
@@ -283,7 +284,7 @@ const opAttachmentUpload = {
283
284
  }));
284
285
  const fileid = upload?.data?.fileid;
285
286
  if (!fileid)
286
- throw new Error('附件上传未返回 fileid:' + JSON.stringify(upload?.data).slice(0, 200));
287
+ throw mailUpstreamError('attachment_upload_contract', '附件上传未返回 fileid:' + JSON.stringify(upload?.data).slice(0, 200));
287
288
  await env.host.request({
288
289
  path: '/api/mail/base/add/addPermissionFile',
289
290
  method: 'POST',
@@ -303,7 +304,7 @@ const opAttachmentDownload = {
303
304
  async handler(args, env) {
304
305
  const ids = String(args.ids || '').trim();
305
306
  if (!ids)
306
- throw new Error('ids(附件 id)必填');
307
+ throw mailValidationError('ids_required', 'ids(附件 id)必填');
307
308
  const value = (await env.host.request({
308
309
  path: '/api/mail/base/file/batchDownload',
309
310
  method: 'POST',
@@ -1,5 +1,6 @@
1
1
  import { mailRandomKey } from '../host.js';
2
2
  import { mailSuccess, READ, schemaOf, SCHEMA_STRING, SCHEMA_INTEGER, SCHEMA_BOOLEAN } from './types.js';
3
+ import { mailValidationError } from '../errors.js';
3
4
  const FOLDER_TEXT = {
4
5
  '-10': '全部',
5
6
  '0': '收件箱',
@@ -118,7 +119,7 @@ const opContactList = {
118
119
  async handler(args, env) {
119
120
  const name = String(args.name || '').trim();
120
121
  if (!name)
121
- throw new Error('name(人员姓名/工号)必填');
122
+ throw mailValidationError('name_required', 'name(人员姓名/工号)必填');
122
123
  const [inbox, sent] = await Promise.all([
123
124
  listMails(env, { ...args, size: args.size ?? 100 }, 0, { from: name }),
124
125
  listMails(env, { ...args, size: args.size ?? 100 }, -1, { to: name }),
@@ -142,7 +143,7 @@ const opViewInfo = {
142
143
  async handler(args, env) {
143
144
  const id = String(args.id || '').trim();
144
145
  if (!id)
145
- throw new Error('id(邮件 id)必填');
146
+ throw mailValidationError('id_required', 'id(邮件 id)必填');
146
147
  const rk = mailRandomKey();
147
148
  const [rkKey, rkVal] = rk.split('=');
148
149
  const value = (await env.host.request({
@@ -181,7 +182,7 @@ const opViewContent = {
181
182
  async handler(args, env) {
182
183
  const id = String(args.id || '').trim();
183
184
  if (!id)
184
- throw new Error('id(邮件 id)必填');
185
+ throw mailValidationError('id_required', 'id(邮件 id)必填');
185
186
  const rk = mailRandomKey();
186
187
  const [rkKey, rkVal] = rk.split('=');
187
188
  const value = (await env.host.request({
@@ -234,7 +235,7 @@ const opPersonSearch = {
234
235
  async handler(args, env) {
235
236
  const keyword = String(args.keyword || '').trim();
236
237
  if (!keyword)
237
- throw new Error('keyword(姓名/工号)必填');
238
+ throw mailValidationError('keyword_required', 'keyword(姓名/工号)必填');
238
239
  const value = (await env.host.request({
239
240
  path: '/api/mail/base/common/browser/complete/resource',
240
241
  method: 'POST',
@@ -322,7 +323,7 @@ const opAddressSearch = {
322
323
  async handler(args, env) {
323
324
  const keyword = String(args.keyword || '').trim();
324
325
  if (!keyword)
325
- throw new Error('keyword(邮箱关键字)必填');
326
+ throw mailValidationError('keyword_required', 'keyword(邮箱关键字)必填');
326
327
  const value = (await env.host.request({
327
328
  path: '/api/mail/base/add/addressFullsearch',
328
329
  method: 'POST',
@@ -384,7 +385,7 @@ const opGroupDetail = {
384
385
  async handler(args, env) {
385
386
  const id = String(args.id || '').trim();
386
387
  if (!id)
387
- throw new Error('id(分组 id)必填');
388
+ throw mailValidationError('id_required', 'id(分组 id)必填');
388
389
  const value = (await env.host.request({
389
390
  path: '/api/mail/base/contacts/getMailContactsGroupVosByGroupId',
390
391
  method: 'POST',
@@ -469,24 +470,6 @@ const opAttachmentCenter = {
469
470
  return mailSuccess('mail.attachment.center', value?.data || {});
470
471
  },
471
472
  };
472
- const opClearlogList = {
473
- name: 'mail.clearlog.list',
474
- resource: 'mail/base/setting/mailClear/getEmailClearLogList',
475
- method: 'POST',
476
- action: 'mail.clearlog.list',
477
- summary: '邮件清理日志列表',
478
- risk: READ,
479
- inputSchema: schemaOf({ page: SCHEMA_INTEGER, size: SCHEMA_INTEGER }, { description: '清理日志列表' }),
480
- async handler(args, env) {
481
- const body = { current: num(args.page, 1), pageSize: num(args.size, 20) };
482
- const value = (await env.host.request({
483
- path: '/api/mail/base/setting/mailClear/getEmailClearLogList',
484
- method: 'POST',
485
- body,
486
- }));
487
- return mailSuccess('mail.clearlog.list', value?.data || {});
488
- },
489
- };
490
473
  export const mailReadOperations = [
491
474
  opList,
492
475
  opContactList,
@@ -504,5 +487,4 @@ export const mailReadOperations = [
504
487
  opSignList,
505
488
  opBlacklistList,
506
489
  opAttachmentCenter,
507
- opClearlogList,
508
490
  ];