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.
- package/dist/chunks/{archive-VUTREF3P.js → archive-THZV4ND4.js} +22 -5
- package/dist/chunks/{archive-oa-VXXO4RTB.js → archive-oa-PQ23OLEV.js} +17 -5
- package/dist/chunks/{asset-45U6TY7I.js → asset-RGPROZYH.js} +22 -5
- package/dist/chunks/{asset-idle-YCRBMTIT.js → asset-idle-Z2PDX7NA.js} +15 -5
- package/dist/chunks/{attachment-content-DMU7KNZ7.js → attachment-content-R3RPVOYE.js} +3 -3
- package/dist/chunks/{blog-5AML4WMG.js → blog-7U3QZPIF.js} +25 -5
- package/dist/chunks/{caizhilian-3P7BUNHT.js → caizhilian-3AB42GCV.js} +22 -8
- package/dist/chunks/{calendar-2HUXM3CZ.js → calendar-KINM64E4.js} +15 -5
- package/dist/chunks/{chunk-EHH363SP.js → chunk-2CHGUYMG.js} +4 -4
- package/dist/chunks/{chunk-GWM5TLIK.js → chunk-2XED2FKY.js} +34 -34
- package/dist/chunks/{chunk-DVFA3ODS.js → chunk-35A56FJ7.js} +12 -0
- package/dist/chunks/{chunk-QYDSTYGG.js → chunk-4BXR6CNB.js} +3 -3
- package/dist/chunks/{chunk-KDOJW5LH.js → chunk-4I26YMBY.js} +1 -1
- package/dist/chunks/{chunk-X6PMJQGO.js → chunk-4YXAK6OA.js} +19 -8
- package/dist/chunks/{chunk-HG6INLH6.js → chunk-54ST55IJ.js} +28 -7
- package/dist/chunks/{chunk-DSBV4GRK.js → chunk-6HT73VOI.js} +3 -3
- package/dist/chunks/{chunk-4W6BSNIL.js → chunk-7QFVXP2X.js} +6 -6
- package/dist/chunks/{chunk-I5XB4MZT.js → chunk-AMAPQVBT.js} +95 -65
- package/dist/chunks/{chunk-L2A3COWV.js → chunk-BWYVS62Z.js} +4 -4
- package/dist/chunks/{chunk-UPVAQJKS.js → chunk-DRUND2PJ.js} +130 -79
- package/dist/chunks/{chunk-LJE7RZNC.js → chunk-F4HM25K4.js} +1 -1
- package/dist/chunks/{chunk-T24EBWAZ.js → chunk-GAMGDNTF.js} +48 -21
- package/dist/chunks/{chunk-H2NRTGZR.js → chunk-GWJLAF6B.js} +3 -3
- package/dist/chunks/{chunk-XIBMZEDB.js → chunk-IBSJJGXL.js} +2 -2
- package/dist/chunks/{chunk-VZUH3LKI.js → chunk-ICP53R52.js} +167 -157
- package/dist/chunks/{chunk-LRKKKO5A.js → chunk-IU6UB2TD.js} +3 -4
- package/dist/chunks/{chunk-GTAFCAVP.js → chunk-IZCQU5D5.js} +1 -1
- package/dist/chunks/{chunk-727VKJQK.js → chunk-JMJBPP4B.js} +2 -2
- package/dist/chunks/{chunk-UVWW5ABZ.js → chunk-L7TYG5SN.js} +3 -3
- package/dist/chunks/{chunk-HAORST2G.js → chunk-LLCMOZ5L.js} +11 -11
- package/dist/chunks/{chunk-U3OO3IZF.js → chunk-NUP4RYZK.js} +20 -7
- package/dist/chunks/{chunk-IVCOZCAW.js → chunk-PAFOLIYQ.js} +1 -1
- package/dist/chunks/{chunk-LSVA7QA6.js → chunk-R3MK2RBN.js} +3 -1
- package/dist/chunks/{chunk-GFOFUH6O.js → chunk-TV46Q4NY.js} +52 -51
- package/dist/chunks/chunk-WM33BSIL.js +136 -0
- package/dist/chunks/{chunk-7CINV2BU.js → chunk-XZBYRYWX.js} +2 -2
- package/dist/chunks/{chunk-E7VWE2XI.js → chunk-ZWLWXHJC.js} +3 -3
- package/dist/chunks/{conflict-YW5BULJ3.js → conflict-VPAR7E6F.js} +2 -2
- package/dist/chunks/{contract-3PMHUASH.js → contract-DDXAO2DZ.js} +48 -5
- package/dist/chunks/{cowork-FZBTTBYX.js → cowork-34QCHMDD.js} +37 -8
- package/dist/chunks/{create-flow-5OBS3B3V.js → create-flow-52PU2OBI.js} +6 -6
- package/dist/chunks/{data-2YZ6A6TL.js → data-CLQ62QGD.js} +99 -184
- package/dist/chunks/{ebuilder-form-AWPTMZBZ.js → ebuilder-form-W5R7Q22S.js} +17 -7
- package/dist/chunks/{ehr-MNPR4TE5.js → ehr-LCNAVMK5.js} +67 -17
- package/dist/chunks/{entry-mode-L65OWPFM.js → entry-mode-6Z3ZV3DE.js} +3 -3
- package/dist/chunks/{env-XW7LYIME.js → env-RDKWAARB.js} +2 -2
- package/dist/chunks/{esb-GSB5QCEX.js → esb-ANKPUU65.js} +17 -7
- package/dist/chunks/{factory-MHFZZAGH.js → factory-434B7RAT.js} +1 -1
- package/dist/chunks/{fna-XBSNUS2V.js → fna-AKBSG5HI.js} +15 -5
- package/dist/chunks/{group-chat-EEOLO5NM.js → group-chat-PROTW22R.js} +3 -3
- package/dist/chunks/{host-NVDG3NC6.js → host-5R2SNFWD.js} +4 -4
- package/dist/chunks/{host-2UMNXX5H.js → host-7FJW4E7R.js} +4 -4
- package/dist/chunks/{host-XVWBOSEN.js → host-CGXUFQO4.js} +4 -4
- package/dist/chunks/{host-R7BP3CTI.js → host-PDJAKCT7.js} +6 -4
- package/dist/chunks/{host-SYPCA63D.js → host-WO4L5G5I.js} +4 -4
- package/dist/chunks/{host-BD44ASOD.js → host-XIYG4F4B.js} +4 -4
- package/dist/chunks/{hrm-FZUDJAND.js → hrm-WGODDTEH.js} +15 -6
- package/dist/chunks/{im-F5NENPD7.js → im-YKTKAJU3.js} +16 -6
- package/dist/chunks/{invoice-DS6FLU55.js → invoice-PVYCCCVM.js} +27 -6
- package/dist/chunks/{jiuchuanhui-JCBUR563.js → jiuchuanhui-RKOQW7BY.js} +19 -6
- package/dist/chunks/{lazy-dispatch-F6O2EPGR.js → lazy-dispatch-DW45AFQ5.js} +6 -6
- package/dist/chunks/{mail-ZEOSANEJ.js → mail-BNB5S4NW.js} +116 -97
- package/dist/chunks/{meeting-PCD5EPBF.js → meeting-O2KDJH66.js} +29 -16
- package/dist/chunks/{minute-doc-WTZJVCHG.js → minute-doc-JUCG56GY.js} +4 -4
- package/dist/chunks/{okr-OZUMTMCL.js → okr-LWFGWOE7.js} +15 -5
- package/dist/chunks/{operations-LQY3FTPH.js → operations-2WHIF5WV.js} +1 -1
- package/dist/chunks/{operations-UTUWFJTX.js → operations-532PN5OB.js} +5 -5
- package/dist/chunks/{performance-SMVTPK6T.js → performance-7W5COCFU.js} +92 -7
- package/dist/chunks/{plan-C2NENH42.js → plan-ZVY3IYTL.js} +15 -5
- package/dist/chunks/{project-FAJ2P3UR.js → project-SA62B7MH.js} +18 -5
- package/dist/chunks/{reception-NH6MJFPR.js → reception-NGIONPQ3.js} +128 -49
- package/dist/chunks/{recruit-stage-DPEFHLSE.js → recruit-stage-WOSN6MGP.js} +1264 -197
- package/dist/chunks/{registry-FTPUUHWC.js → registry-N7P3W2RD.js} +5 -5
- package/dist/chunks/{registry-3B3OAJYX.js → registry-R72GWXOG.js} +4 -4
- package/dist/chunks/{registry-ZQ7OONCB.js → registry-RIQ67ZT7.js} +12 -12
- package/dist/chunks/{room-recommend-73NBN3RU.js → room-recommend-KCGIVUFR.js} +4 -4
- package/dist/chunks/{schedule-SDBOBBUQ.js → schedule-6UP27HQ4.js} +4 -4
- package/dist/chunks/{smart-extract-GTYKF5TJ.js → smart-extract-DDOQSPRB.js} +19 -6
- package/dist/chunks/{workflow-OWHWLAOX.js → workflow-V5ALD6QZ.js} +22 -8
- package/dist/cmd/auth/index.js +23 -0
- package/dist/cmd/e10/index.js +2 -1
- package/dist/cmd/index.js +2 -0
- package/dist/core/manifest-view.js +207 -0
- package/dist/core/output.js +42 -8
- package/dist/index.js +35 -35
- package/dist/internal/e10/auth/crypto.js +18 -8
- package/dist/internal/e10/auth/error-log.js +1 -2
- package/dist/internal/e10/auth/messages.js +2 -3
- package/dist/internal/e10/auth/xiaoe.js +1 -1
- package/dist/internal/e10/tls-policy.js +61 -13
- package/dist/shortcuts/archive/index.js +11 -2
- package/dist/shortcuts/archive/operations/download.js +1 -0
- package/dist/shortcuts/archive/operations/flow-url.js +3 -0
- package/dist/shortcuts/archive/operations/prelib.js +2 -0
- package/dist/shortcuts/archive/operations/upload.js +1 -0
- package/dist/shortcuts/archive-oa/index.js +11 -2
- package/dist/shortcuts/archive-oa/operations/borrow-car.js +2 -0
- package/dist/shortcuts/asset/index.js +11 -2
- package/dist/shortcuts/asset/manifest.js +7 -0
- package/dist/shortcuts/asset-idle/index.js +11 -2
- package/dist/shortcuts/blog/index.js +11 -2
- package/dist/shortcuts/blog/manifest.js +10 -0
- package/dist/shortcuts/caizhilian/host.js +20 -4
- package/dist/shortcuts/caizhilian/index.js +12 -2
- package/dist/shortcuts/caizhilian/manifest.js +4 -25
- package/dist/shortcuts/caizhilian/operations/handlers/search.js +34 -0
- package/dist/shortcuts/caizhilian/operations/registry.js +25 -1
- package/dist/shortcuts/calendar/index.js +11 -2
- package/dist/shortcuts/contract/index.js +11 -2
- package/dist/shortcuts/contract/manifest.js +32 -0
- package/dist/shortcuts/contract/operations/write.js +3 -0
- package/dist/shortcuts/cowork/index.js +21 -5
- package/dist/shortcuts/cowork/manifest.js +3 -0
- package/dist/shortcuts/cowork/operations/discuss-write.js +2 -0
- package/dist/shortcuts/cowork/operations/item-write.js +3 -0
- package/dist/shortcuts/cowork/operations/member-write.js +2 -0
- package/dist/shortcuts/cowork/operations/permission-write.js +2 -0
- package/dist/shortcuts/cowork/operations/review-write.js +1 -0
- package/dist/shortcuts/data/errors.js +16 -29
- package/dist/shortcuts/data/host.js +16 -7
- package/dist/shortcuts/data/index.js +12 -41
- package/dist/shortcuts/data/manifest.js +5 -44
- package/dist/shortcuts/data/operations/attend.js +2 -2
- package/dist/shortcuts/data/operations/conf.js +0 -88
- package/dist/shortcuts/data/operations/ds.js +4 -4
- package/dist/shortcuts/data/operations/index.js +1 -5
- package/dist/shortcuts/data/operations/module.js +40 -14
- package/dist/shortcuts/data/operations/query.js +2 -2
- package/dist/shortcuts/ebuilder-form/index.js +11 -2
- package/dist/shortcuts/ebuilder-form/manifest.js +12 -0
- package/dist/shortcuts/ehr/index.js +11 -2
- package/dist/shortcuts/ehr/operations/attend-write.js +51 -8
- package/dist/shortcuts/ehr/operations/recruit-position.js +4 -3
- package/dist/shortcuts/ehr/operations/recruit-short-cache.js +6 -2
- package/dist/shortcuts/ehr/operations/recruit-write.js +3 -3
- package/dist/shortcuts/ehr/operations/recruit.js +206 -82
- package/dist/shortcuts/ehr/operations/shared.js +31 -0
- package/dist/shortcuts/esb/index.js +11 -2
- package/dist/shortcuts/esb/manifest.js +2 -0
- package/dist/shortcuts/fna/index.js +11 -2
- package/dist/shortcuts/hrm/index.js +11 -1
- package/dist/shortcuts/im/index.js +11 -2
- package/dist/shortcuts/invoice/index.js +11 -2
- package/dist/shortcuts/invoice/manifest.js +8 -0
- package/dist/shortcuts/jiuchuanhui/index.js +15 -1
- package/dist/shortcuts/jiuchuanhui/manifest.js +2 -0
- package/dist/shortcuts/mail/errors.js +14 -0
- package/dist/shortcuts/mail/index.js +23 -6
- package/dist/shortcuts/mail/manifest.js +11 -4
- package/dist/shortcuts/mail/operations/mail-blacklist.js +6 -6
- package/dist/shortcuts/mail/operations/mail-contacts.js +10 -10
- package/dist/shortcuts/mail/operations/mail-manage.js +15 -14
- package/dist/shortcuts/mail/operations/mail-read.js +7 -25
- package/dist/shortcuts/mail/operations/mail-send.js +12 -12
- package/dist/shortcuts/mail/operations/mail-sign.js +10 -10
- package/dist/shortcuts/mail/operations/mail-template.js +10 -10
- package/dist/shortcuts/meeting/index.js +11 -2
- package/dist/shortcuts/meeting/operations/invitation-publish.js +1 -0
- package/dist/shortcuts/okr/index.js +11 -2
- package/dist/shortcuts/performance/index.js +62 -3
- package/dist/shortcuts/performance/scheme-validate.js +7 -0
- package/dist/shortcuts/performance/shared.js +40 -2
- package/dist/shortcuts/plan/index.js +11 -2
- package/dist/shortcuts/project/index.js +11 -2
- package/dist/shortcuts/project/operations/write.js +3 -0
- package/dist/shortcuts/reception/constants.js +22 -0
- package/dist/shortcuts/reception/index.js +15 -2
- package/dist/shortcuts/reception/manifest.js +17 -3
- package/dist/shortcuts/reception/operations/ask.js +3 -0
- package/dist/shortcuts/reception/operations/doc.js +24 -11
- package/dist/shortcuts/reception/operations/docrender.js +18 -1
- package/dist/shortcuts/reception/operations/render-assets.js +93 -22
- package/dist/shortcuts/recruit-stage/context.js +12 -6
- package/dist/shortcuts/recruit-stage/index.js +22 -3
- package/dist/shortcuts/recruit-stage/manifest.js +2 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +19 -10
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +487 -38
- package/dist/shortcuts/recruit-stage/operations/list.js +72 -1
- package/dist/shortcuts/recruit-stage/operations/profile.js +194 -0
- package/dist/shortcuts/recruit-stage/operations/registry.js +20 -2
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +258 -63
- package/dist/shortcuts/recruit-stage/operations/search.js +226 -27
- package/dist/shortcuts/recruit-stage/operations/shortlist.js +122 -0
- package/dist/shortcuts/recruit-stage/operations/tag.js +17 -3
- package/dist/shortcuts/recruit-stage/shared.js +158 -4
- package/dist/shortcuts/smart-extract/index.js +11 -2
- package/dist/shortcuts/smart-extract/manifest.js +1 -0
- package/dist/shortcuts/smart-extract/operations/save.js +2 -0
- package/dist/shortcuts/workflow/index.js +21 -1
- package/dist/shortcuts/workflow/operations/form.js +36 -2
- package/dist/shortcuts/workflow/operations/read.js +2 -2
- package/dist/shortcuts/workflow/operations/write.js +1 -1
- package/docs/caizhilian.md +1 -1
- package/docs/contract.md +1 -0
- package/docs/data.md +22 -22
- package/docs/e10-auth.md +41 -33
- package/docs/ehr.md +2 -0
- package/docs/reception.md +4 -3
- package/package.json +1 -1
- package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
- package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
- package/scripts/pysite/sitecustomize.py +41 -0
- package/skill-template/domains/data.md +4 -4
- package/skills/weaver-e10-caizhilian/SKILL.md +1 -1
- package/skills/weaver-e10-caizhilian/references/org-browser.md +1 -0
- package/skills/weaver-e10-cowork/SKILL.md +3 -1
- package/skills/weaver-e10-data/SKILL.md +12 -16
- package/skills/weaver-e10-data/references/config-center.md +6 -7
- package/skills/weaver-e10-data/references/datasource.md +1 -1
- package/skills/weaver-e10-data/references/scene-and-misc.md +2 -2
- package/skills/weaver-e10-jiuchuanhui/SKILL.md +6 -4
- package/skills/weaver-e10-jiuchuanhui/references/clue.md +2 -2
- package/skills/weaver-e10-jiuchuanhui/references/customer.md +18 -8
- package/skills/weaver-e10-jiuchuanhui/references/sale.md +2 -2
- package/skills/weaver-e10-jucailin/SKILL.md +7 -3
- package/skills/weaver-e10-jucailin/references/attend-write.md +1 -1
- package/skills/weaver-e10-jucailin/references/recruit-output-links.md +33 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -0
- package/skills/weaver-e10-mail/SKILL.md +4 -1
- package/skills/weaver-e10-mail/references/mail-read.md +4 -2
- package/skills/weaver-e10-mail/references/safety-boundaries.md +1 -0
- package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
- package/skills/weaver-e10-performance/SKILL.md +8 -6
- package/skills/weaver-e10-reception-flow/SKILL.md +97 -41
- package/skills/weaver-e10-reception-flow/references/guide.md +3 -1
- package/skills/weaver-e10-recruit-stage/SKILL.md +557 -75
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +67 -44
- package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +279 -0
- package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +198 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +697 -0
- package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +507 -0
- package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +87 -0
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +19 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +19 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +15 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +37 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +64 -28
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +43 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +41 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +25 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +51 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +63 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +58 -33
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +4 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +5 -5
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +11 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
- package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +106 -0
- package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +325 -0
- package/skills/weaver-e10-recruit-stage/templates/match-report.html +265 -0
- package/skills/weaver-e10-shared/SKILL.md +22 -1
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +2 -2
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
- 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
|
-
.
|
|
242
|
-
|
|
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
|
-
.
|
|
149
|
-
|
|
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 {
|
|
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
|
|
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
|
-
|
|
88
|
-
|
|
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
|
-
.
|
|
101
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
67
|
+
throw mailConfirmationError('mail.blacklist.operate.apply');
|
|
68
68
|
if (!args.continuation)
|
|
69
|
-
throw
|
|
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
|
|
22
|
+
throw mailValidationError('user_name_required', 'mailUserName(姓名)必填');
|
|
23
23
|
if (!address)
|
|
24
|
-
throw
|
|
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
|
|
77
|
+
throw mailConfirmationError('mail.contacts.save.apply');
|
|
78
78
|
if (!args.continuation)
|
|
79
|
-
throw
|
|
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
|
|
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
|
|
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
|
|
160
|
+
throw mailConfirmationError('mail.contacts.group.save.apply');
|
|
161
161
|
if (!args.continuation)
|
|
162
|
-
throw
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
148
|
+
throw mailValidationError('id_required', 'id(邮件 id)必填');
|
|
148
149
|
if (!folder)
|
|
149
|
-
throw
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
];
|