weaver-work-cli 0.1.78 → 0.1.81
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/README.md +3 -1
- package/dist/chunks/{archive-ENBSUMHV.js → archive-KVV4SM7J.js} +3 -3
- package/dist/chunks/{archive-oa-7BFPQ6M5.js → archive-oa-VRSPNLY4.js} +3 -3
- package/dist/chunks/{asset-V5SUD3PW.js → asset-JZ5MN6OL.js} +306 -10
- package/dist/chunks/{asset-idle-3CEL7WFX.js → asset-idle-B4SAL43V.js} +3 -3
- package/dist/chunks/{attachment-content-TFOC3Y3X.js → attachment-content-7W4XQTA7.js} +3 -3
- package/dist/chunks/{blog-FLI4SS3P.js → blog-XCBM467O.js} +3 -3
- package/dist/chunks/{caizhilian-7WCTKCCP.js → caizhilian-NZVUKCZD.js} +5 -5
- package/dist/chunks/{calendar-G726HUUH.js → calendar-OVM2SGYJ.js} +3 -3
- package/dist/chunks/{chunk-XNN5PZTI.js → chunk-3WZMDOI3.js} +1 -1
- package/dist/chunks/{chunk-FAC4IFGQ.js → chunk-56F2GGE4.js} +5 -5
- package/dist/chunks/{chunk-LCM5SSGJ.js → chunk-5MM2IZ27.js} +423 -36
- package/dist/chunks/{chunk-BWFCTE43.js → chunk-5NQZO3CO.js} +48 -5
- package/dist/chunks/{chunk-ZOTXXGUM.js → chunk-5RIK6OLF.js} +7 -7
- package/dist/chunks/{chunk-5E2FDXBU.js → chunk-64RYQOXA.js} +1 -1
- package/dist/chunks/{chunk-Z44YFIN6.js → chunk-7BP3HU74.js} +2 -2
- package/dist/chunks/{chunk-3Q5F4C5B.js → chunk-AW3HQUOC.js} +5 -5
- package/dist/chunks/{chunk-7M5OYRK2.js → chunk-BD3M2YVN.js} +3 -3
- package/dist/chunks/{chunk-JEQHNNSS.js → chunk-BFVUBCYO.js} +14 -0
- package/dist/chunks/{chunk-PAWXVT6H.js → chunk-CLVEXDEJ.js} +4 -5
- package/dist/chunks/{chunk-TBCKK6LH.js → chunk-DWCMKEMO.js} +2 -2
- package/dist/chunks/{chunk-USYFVIUR.js → chunk-E3XUYWYA.js} +4 -4
- package/dist/chunks/{chunk-E2EY3DMS.js → chunk-FIPTUAOW.js} +2 -2
- package/dist/chunks/{chunk-IBTGXLOT.js → chunk-GQEIHXY5.js} +6 -6
- package/dist/chunks/{chunk-TD5IOEGN.js → chunk-JUPKXW4P.js} +1 -1
- package/dist/chunks/{chunk-UZ2E3VNI.js → chunk-KZ3JR3GE.js} +3 -3
- package/dist/chunks/{chunk-4PBN7NJY.js → chunk-L2PKMZIU.js} +1 -1
- package/dist/chunks/{chunk-DACQKJ6O.js → chunk-LXWWOHM6.js} +4 -4
- package/dist/chunks/{chunk-7DE3VMZD.js → chunk-LYFPWZBD.js} +6 -1
- package/dist/chunks/{chunk-2UV4IZIT.js → chunk-MTIV6JEN.js} +2 -2
- package/dist/chunks/{chunk-5VQ7JHV4.js → chunk-MWFKLXVU.js} +68 -46
- package/dist/chunks/{chunk-PMRNIGKZ.js → chunk-RVVRTW4P.js} +2 -2
- package/dist/chunks/{chunk-FPWCCRKT.js → chunk-UASZW22U.js} +3 -3
- package/dist/chunks/{chunk-RVEKGVZU.js → chunk-VMUVVTT4.js} +2 -2
- package/dist/chunks/{chunk-7SQN5IZR.js → chunk-W4BGNYKR.js} +12 -2
- package/dist/chunks/{chunk-OVTCWLNQ.js → chunk-W4R3SXJV.js} +15 -7
- package/dist/chunks/{chunk-UDBQJLQF.js → chunk-WF5G5SV3.js} +2 -2
- package/dist/chunks/{chunk-VNEU7OUN.js → chunk-WM5ZE67G.js} +1 -1
- package/dist/chunks/{chunk-QVKRNL7L.js → chunk-WQ4ZHAEZ.js} +10 -2
- package/dist/chunks/{chunk-SWFTWNWL.js → chunk-X7OZKI6F.js} +12 -12
- package/dist/chunks/{chunk-WNFDR5PC.js → chunk-Y6HRTEDD.js} +21 -11
- package/dist/chunks/{chunk-2KW7AI6P.js → chunk-YFDKTTYX.js} +8 -5
- package/dist/chunks/{chunk-BP7BONZO.js → chunk-YLPGCOAM.js} +76 -69
- package/dist/chunks/{chunk-LQLIXBJF.js → chunk-YXIPZFMX.js} +1 -1
- package/dist/chunks/{cli-WA7FOQKC.js → cli-VCQIDBDQ.js} +37 -37
- package/dist/chunks/{commands-J52MJ6NF.js → commands-THGXVOEL.js} +9 -5
- package/dist/chunks/{conflict-D4GVAURN.js → conflict-T7URCNS6.js} +2 -2
- package/dist/chunks/{contract-GW7US3UF.js → contract-ZLGLQ45G.js} +3 -3
- package/dist/chunks/{cowork-GZDODGKF.js → cowork-2MBNOUYS.js} +21 -8
- package/dist/chunks/{create-flow-ERDGW3FZ.js → create-flow-OFZC36MV.js} +6 -6
- package/dist/chunks/{data-HTQZRPPI.js → data-6O7ANJVT.js} +3 -3
- package/dist/chunks/{ebuilder-form-GHNIZ7ET.js → ebuilder-form-OJ3KJVQI.js} +4 -4
- package/dist/chunks/{ehr-P6T7OAAV.js → ehr-NWMI5Q7S.js} +8 -32
- package/dist/chunks/{employee-QX57HEWS.js → employee-O2EPUYIH.js} +2 -2
- package/dist/chunks/{entry-mode-SQU5WTX6.js → entry-mode-TVACGU7K.js} +3 -3
- package/dist/chunks/{env-DASBNSEM.js → env-EWG4ZAWP.js} +2 -2
- package/dist/chunks/{esb-ATRKVHCD.js → esb-56FV2PIA.js} +5 -5
- package/dist/chunks/{factory-A3NAKZAA.js → factory-GQSEJRDY.js} +1 -1
- package/dist/chunks/{fna-IKYI3SST.js → fna-YLA3RKRW.js} +3 -3
- package/dist/chunks/{group-chat-7SEAVAJR.js → group-chat-5R6L3LCG.js} +3 -3
- package/dist/chunks/{host-UY4LQPN4.js → host-42MLO4KX.js} +4 -4
- package/dist/chunks/{host-XXGDQM7D.js → host-J72VEDW5.js} +4 -4
- package/dist/chunks/{host-EJSJSLVK.js → host-QKCRQS2C.js} +4 -4
- package/dist/chunks/{host-EYNLB6S4.js → host-W3BVEATN.js} +4 -4
- package/dist/chunks/{host-OT4KNR3G.js → host-YJINI5GG.js} +4 -4
- package/dist/chunks/{host-6UOXYOOY.js → host-ZVGBZOHY.js} +4 -4
- package/dist/chunks/{hrm-5JQ7QZ6A.js → hrm-3JFZNB42.js} +66 -26
- package/dist/chunks/{im-2YJW3EI5.js → im-HKIRPCGD.js} +5 -5
- package/dist/chunks/{invoice-37HR6L3W.js → invoice-4PREIOTG.js} +185 -49
- package/dist/chunks/{jiuchuanhui-KBWUZ7WT.js → jiuchuanhui-K3PLNENZ.js} +3 -3
- package/dist/chunks/{lazy-dispatch-ZDKLS5MR.js → lazy-dispatch-MKGEWZNM.js} +8 -8
- package/dist/chunks/{mail-YBKUM6HM.js → mail-6QPVWKXM.js} +3 -3
- package/dist/chunks/{meeting-7AEQGBAT.js → meeting-QPPEPBSN.js} +20 -16
- package/dist/chunks/{minute-doc-REI6RUE4.js → minute-doc-JMIDZK5D.js} +1 -1
- package/dist/chunks/{okr-HW7IULIR.js → okr-67C5LQYD.js} +3 -3
- package/dist/chunks/{operations-4P2UYVLH.js → operations-YLKRNAPI.js} +5 -5
- package/dist/chunks/{org-MWWIFNAO.js → org-L5XDM2RQ.js} +2 -2
- package/dist/chunks/{performance-PM2G6L3E.js → performance-33QZZR4I.js} +3 -3
- package/dist/chunks/{plan-3YYGZ7ZM.js → plan-W4BPONRL.js} +3 -3
- package/dist/chunks/{project-6PRGBLO2.js → project-OKSEH6AF.js} +3 -3
- package/dist/chunks/{reception-7G3J2MA6.js → reception-H5M7SPHT.js} +3 -3
- package/dist/chunks/{recruit-stage-TLZJUFHD.js → recruit-stage-O2JGNVMO.js} +16 -86
- package/dist/chunks/{registry-4S3RXXWS.js → registry-45VEUYTC.js} +4 -4
- package/dist/chunks/{registry-3VTB3KLV.js → registry-BMTQ55G5.js} +5 -5
- package/dist/chunks/{registry-KQ4TNUWO.js → registry-PYONXFUF.js} +3 -3
- package/dist/chunks/{registry-UVTI323K.js → registry-SAMJ4VH2.js} +14 -14
- package/dist/chunks/{registry-AC33ZZVH.js → registry-YY62OFKQ.js} +1 -1
- package/dist/chunks/{room-recommend-ELEJUYBN.js → room-recommend-NRLAZJCI.js} +4 -4
- package/dist/chunks/{schedule-XBKY7VEA.js → schedule-LNBOCBP5.js} +4 -4
- package/dist/chunks/{smart-extract-T5Z4AULN.js → smart-extract-JOTX6UZC.js} +3 -3
- package/dist/chunks/{update-77ZUIYSG.js → update-BERR64TI.js} +3 -3
- package/dist/chunks/{workflow-SYCBS5XD.js → workflow-ZDQY3TI7.js} +5 -5
- package/dist/core/runtime-agent.js +19 -3
- package/dist/index.js +4 -4
- package/dist/internal/e10/auth/agent-host-key.js +10 -1
- package/dist/internal/e10/auth/commands.js +20 -4
- package/dist/internal/e10/auth/xiaoe.js +15 -3
- package/dist/shortcuts/asset/host.js +39 -1
- package/dist/shortcuts/asset/index.js +16 -2
- package/dist/shortcuts/asset/manifest.js +115 -1
- package/dist/shortcuts/asset/operations/audit-report.js +144 -0
- package/dist/shortcuts/asset/operations/registry.js +4 -0
- package/dist/shortcuts/asset/operations/write.js +7 -1
- package/dist/shortcuts/cowork/operations/read.js +13 -6
- package/dist/shortcuts/cowork/operations/shared.js +15 -0
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +1 -14
- package/dist/shortcuts/ehr/operations/recruit-write.js +4 -24
- package/dist/shortcuts/ehr/operations/recruit.js +23 -13
- package/dist/shortcuts/hrm/host.js +51 -4
- package/dist/shortcuts/hrm/index.js +45 -26
- package/dist/shortcuts/hrm/manifest.js +17 -0
- package/dist/shortcuts/hrm/operations/employee.js +3 -7
- package/dist/shortcuts/hrm/operations/org.js +2 -4
- package/dist/shortcuts/hrm/operations/position.js +2 -4
- package/dist/shortcuts/hrm/operations/shared.js +21 -0
- package/dist/shortcuts/hrm/operations.js +34 -0
- package/dist/shortcuts/im/constants.js +163 -0
- package/dist/shortcuts/im/host.js +12 -5
- package/dist/shortcuts/im/operations/at-mention.js +4 -2
- package/dist/shortcuts/im/operations/file-user.js +3 -1
- package/dist/shortcuts/im/operations/msg-sync.js +219 -2
- package/dist/shortcuts/im/operations/msg-write.js +70 -30
- package/dist/shortcuts/invoice/invoice-record.js +20 -1
- package/dist/shortcuts/invoice/manifest.js +13 -7
- package/dist/shortcuts/invoice/operations/reim-auto.js +94 -36
- package/dist/shortcuts/invoice/projection.js +7 -3
- package/dist/shortcuts/invoice/read-enrichment.js +78 -8
- package/dist/shortcuts/meeting/host.js +4 -0
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +45 -5
- package/dist/shortcuts/meeting/operations/env.js +15 -1
- package/dist/shortcuts/meeting/operations/rooms.js +7 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +3 -22
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +1 -5
- package/dist/shortcuts/recruit-stage/operations/list.js +3 -2
- package/dist/shortcuts/recruit-stage/operations/profile.js +3 -2
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +8 -55
- package/dist/shortcuts/recruit-stage/operations/search.js +2 -2
- package/dist/shortcuts/recruit-stage/operations/shortlist.js +3 -2
- package/dist/shortcuts/recruit-stage/operations/tag.js +5 -0
- package/dist/shortcuts/recruit-stage/shared.js +3 -11
- package/dist/shortcuts/workflow/operations/form.js +2 -1
- package/docs/agent-invoice.md +26 -8
- package/docs/e10-auth.md +14 -1
- package/docs/hrm.md +5 -1
- package/docs/invoice.md +28 -8
- package/docs/operation-manual.md +6 -4
- package/docs/ziguanjia.md +5 -1
- package/package.json +1 -1
- package/scripts/package-skill.mjs +14 -2
- package/skill-template/business-info.json +6 -1
- package/skill-template/domains/hrm.md +1 -1
- package/skill-template/domains/yepiaotong.md +29 -11
- package/skill-template/domains/ziguanjia.md +7 -2
- package/skills/weaver-e10-caizhilian/references/source-manifest.json +3 -3
- package/skills/weaver-e10-cowork/SKILL.md +13 -1
- package/skills/weaver-e10-hrm/SKILL.md +16 -2
- package/skills/weaver-e10-hrm/references/org.md +1 -1
- package/skills/weaver-e10-jucailin/SKILL.md +11 -12
- package/skills/weaver-e10-jucailin/agents/openai.yaml +4 -4
- package/skills/weaver-e10-jucailin/references/recruit-implement-consult-sop.md +1 -1
- package/skills/weaver-e10-jucailin/references/recruit-implement-kb-data-update-channels.md +1 -1
- package/skills/weaver-e10-jucailin/references/recruit-implement-kb-talent-base-form.md +1 -1
- package/skills/weaver-e10-jucailin/references/recruit-output-links.md +1 -2
- package/skills/weaver-e10-jucailin/references/recruit-read.md +5 -27
- package/skills/weaver-e10-jucailin/references/recruit-write.md +19 -21
- package/skills/weaver-e10-jucailin/references/safety-boundaries.md +2 -2
- package/skills/weaver-e10-mail/SKILL.md +11 -3
- package/skills/weaver-e10-mail/references/mail-agent-entry.md +1 -1
- package/skills/weaver-e10-meeting/SKILL.md +39 -1
- package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
- package/skills/weaver-e10-plan/references/source-manifest.json +3 -3
- package/skills/weaver-e10-recruit-stage/SKILL.md +57 -42
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +27 -22
- package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +1 -1
- package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +20 -5
- package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +96 -22
- package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +8 -3
- package/skills/weaver-e10-recruit-stage/lib/report-attachment.mjs +7 -6
- package/skills/weaver-e10-recruit-stage/lib/resume-import-once.mjs +308 -0
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +6 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +5 -5
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +4 -5
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +2 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +0 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +1 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +7 -5
- package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +3 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +20 -21
- package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +12 -7
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +2 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +1 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +75 -52
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +11 -17
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +3 -4
- package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +456 -93
- package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +2 -2
- package/skills/weaver-e10-recruit-stage/templates/match-report.html +1 -1
- package/skills/weaver-e10-shared/SKILL.md +1 -1
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +1 -1
- package/skills/weaver-e10-shared-report.html +874 -0
- package/skills/weaver-e10-shijingran/references/source-manifest.json +3 -3
- package/skills/weaver-e10-skill-maker/references/post-generation-install.md +6 -0
- package/skills/weaver-e10-workflow/SKILL.md +4 -4
- package/skills/weaver-e10-workflow/aiDeepRead/config.json +138 -142
- package/skills/weaver-e10-workflow/references/workflow-deep-read.md +7 -7
- package/skills/weaver-e10-yepiaotong/SKILL.md +33 -21
- package/skills/weaver-e10-yepiaotong/references/invoice-add.md +2 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-agent-entry.md +5 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +3 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +2 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +30 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +8 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/name-fuzzy-search.md +3 -3
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +19 -9
- package/skills/weaver-e10-yepiaotong/references/reim-customer-search.md +25 -32
- package/skills/weaver-e10-yepiaotong/references/reim-eligibility-rules.md +70 -21
- package/skills/weaver-e10-yepiaotong/references/reim-fill-validation.md +23 -12
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +52 -17
- package/skills/weaver-e10-yepiaotong/references/reim-preapproval-rules.md +23 -19
- package/skills/weaver-e10-yepiaotong/references/reim-travel-invoice-matching.md +6 -4
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +127 -63
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +89 -71
- package/skills/weaver-e10-yepiaotong/references/travel-application-fill.md +2 -2
- package/skills/weaver-e10-yepiaotong/references/workflow-direct-fill.md +28 -20
- package/skills/weaver-e10-yepiaotong.zip +0 -0
- package/skills/weaver-e10-yimiaoban/SKILL.md +12 -9
- package/skills/weaver-e10-yimiaoban/references/constants.md +291 -0
- package/skills/weaver-e10-yimiaoban/references/ding-write.md +1 -0
- package/skills/weaver-e10-yimiaoban/references/group-read.md +1 -0
- package/skills/weaver-e10-yimiaoban/references/group-write.md +1 -0
- package/skills/weaver-e10-yimiaoban/references/msg-read.md +10 -1
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +3 -1
- package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +1 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +175 -36
- package/skills/weaver-e10-ziguanjia/SKILL.md +26 -6
- package/skills/weaver-e10-ziguanjia/references/source-manifest.json +1373 -96
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-audit.md +63 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-disabled-capabilities.md +5 -1
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-idle.md +52 -0
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-report.md +59 -0
- package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
- package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
- package/scripts/pysite/__pycache__/sitecustomize.cpython-314.pyc +0 -0
- package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +0 -89
|
@@ -476,10 +476,12 @@ export function createImHost(ctx, dependencies = {}) {
|
|
|
476
476
|
params.set('weappAuthStr', weappAuthStr);
|
|
477
477
|
return `${(sessionContext?.baseUrl || '').replace(/\/+$/, '')}/api/file/preview?${params.toString()}`;
|
|
478
478
|
}
|
|
479
|
-
/**
|
|
479
|
+
/** 构造媒体/文件下载 URL(/api/file/remotedownload/{fileId}/im/true;绝对地址)。
|
|
480
|
+
* 🔴 kind='file' 走原文下载语义:**不带 type=imgs / imgFormat**(这两项是图片预览参数,
|
|
481
|
+
* 会让部分环境(如 e-cology)返回 HTML 图片预览页而非文件原文);图片/视频沿用媒体参数不变。 */
|
|
480
482
|
async function buildDownloadUrl(options) {
|
|
481
483
|
await ensureSession();
|
|
482
|
-
const kind = options.kind
|
|
484
|
+
const kind = options.kind ?? 'img';
|
|
483
485
|
const payload = { tag: kind === 'video' ? '1' : '0', msgid: String(options.msgid) };
|
|
484
486
|
if (options.groupId !== undefined && options.groupId !== null && String(options.groupId) !== '') {
|
|
485
487
|
payload.flag = 1;
|
|
@@ -491,9 +493,14 @@ export function createImHost(ctx, dependencies = {}) {
|
|
|
491
493
|
}
|
|
492
494
|
const weappAuthStr = Buffer.from(JSON.stringify(payload), 'utf-8').toString('base64');
|
|
493
495
|
const params = new URLSearchParams();
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
496
|
+
if (kind === 'file') {
|
|
497
|
+
// 文件原文下载:不设 type / imgFormat(e-cology 等环境带 type=imgs 会返回图片预览页)
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
params.set('type', kind === 'video' ? 'video' : 'imgs');
|
|
501
|
+
if (kind !== 'video')
|
|
502
|
+
params.set('imgFormat', options.imgFormat || 'small');
|
|
503
|
+
}
|
|
497
504
|
params.set('authModule', 'im');
|
|
498
505
|
params.set('weappAuthStr', weappAuthStr);
|
|
499
506
|
return `${(sessionContext?.baseUrl || '').replace(/\/+$/, '')}/api/file/remotedownload/${String(options.fileId)}/im/true?${params.toString()}`;
|
|
@@ -108,13 +108,15 @@ export function buildAtText(text, entries) {
|
|
|
108
108
|
/** 组装 sendGroupMsg/sendSingleMsg 的 `msg` 字段值(完整原生 msg JSON 字符串)。 */
|
|
109
109
|
export function buildAtMsgJson(v, aus, self, extra = {},
|
|
110
110
|
/** txt 段附加字段(与 v 同级),如 markdown 的 `{ vt: '1' }`。 */
|
|
111
|
-
txtExtra = {}
|
|
111
|
+
txtExtra = {},
|
|
112
|
+
/** 追加到 dt 的媒体段({img:...} / {file:...}),用于 txt+媒体同发的 type=26 富文本消息。 */
|
|
113
|
+
mediaSegs = []) {
|
|
112
114
|
return JSON.stringify({
|
|
113
115
|
bgc: '',
|
|
114
116
|
cnt: '0',
|
|
115
117
|
dev: 5,
|
|
116
118
|
display: '',
|
|
117
|
-
dt: [{ txt: { aus, ft: 'china', next: '0', v, ...txtExtra } }],
|
|
119
|
+
dt: [{ txt: { aus, ft: 'china', next: '0', v, ...txtExtra } }, ...mediaSegs],
|
|
118
120
|
guid: '0',
|
|
119
121
|
idx: '0',
|
|
120
122
|
opb: ['received', 'reply'],
|
|
@@ -150,7 +150,9 @@ const fileDownload = {
|
|
|
150
150
|
const fileId = String(args.fileId ?? '');
|
|
151
151
|
const msgid = String(args.msgid ?? '');
|
|
152
152
|
const kindRaw = String(args.kind ?? 'img');
|
|
153
|
-
|
|
153
|
+
// kind='file' 必须保留(走文件原文下载 URL),不可折叠成 img——否则 URL 带 type=imgs/imgFormat,
|
|
154
|
+
// 部分环境(如 e-cology)会返回 HTML 图片预览页而非文件原文,导致无法取回/校验文件。
|
|
155
|
+
const kind = kindRaw === 'video' ? 'video' : kindRaw === 'file' ? 'file' : 'img';
|
|
154
156
|
const output = String(args.output ?? '').trim();
|
|
155
157
|
if (!output)
|
|
156
158
|
throw imValidationError('output_required', 'output 必须是明确的本地文件路径');
|
|
@@ -3,6 +3,7 @@ import { READ, schemaOf, imSuccess, } from './types.js';
|
|
|
3
3
|
import { assertImOk, clampTimeRangeTo7Days, compact, DEFAULT_PAGE_SIZE, formatFullTime, makeMinMaxIdByTm, paginationMeta, parseMsg, parseTimeToSec, pullPaged, rangeShrinkMeta, resolveAuthUid, sortMessagesNewestFirst, str, todayRange, unwrapInner, } from './shared.js';
|
|
4
4
|
import { collapseNewlines, collectI18nIds, collectPersonIds, extractFiles, extractImgs, extractVideos, parseContent, senderName, } from './msg-parse.js';
|
|
5
5
|
import { extractQuoteSummary } from './quote-mention.js';
|
|
6
|
+
import { MSG_KIND_NAME, mkindToKindList } from '../constants.js';
|
|
6
7
|
const MAX_MSG_ID = String((1n << 63n) - 1n);
|
|
7
8
|
/**
|
|
8
9
|
* 时间/最新/显式 id 计算 start/end(与源 skill 一致):
|
|
@@ -141,11 +142,11 @@ async function enrichMessages(rawRows, host, options = {}) {
|
|
|
141
142
|
fileId: f.fileId,
|
|
142
143
|
name: f.name,
|
|
143
144
|
size: f.size,
|
|
145
|
+
// 文件原文下载:kind='file'(不带 type=imgs/imgFormat),否则 e-cology 等环境会返回图片预览页而非原文
|
|
144
146
|
downloadUrl: await host.buildDownloadUrl({
|
|
145
147
|
fileId: f.fileId,
|
|
146
148
|
msgid: String(row.ser_msgid ?? ''),
|
|
147
|
-
kind: '
|
|
148
|
-
imgFormat: imgFormat,
|
|
149
|
+
kind: 'file',
|
|
149
150
|
...(options.groupId ? { groupId: options.groupId } : {}),
|
|
150
151
|
...(options.user ? { user: options.user } : {}),
|
|
151
152
|
}),
|
|
@@ -171,6 +172,12 @@ async function enrichMessages(rawRows, host, options = {}) {
|
|
|
171
172
|
must: parsed.must,
|
|
172
173
|
fileName: parsed.fileName,
|
|
173
174
|
media,
|
|
175
|
+
...(row.kind !== undefined && row.kind !== null && Number(row.kind) > 0
|
|
176
|
+
? { kind: Number(row.kind), kindName: MSG_KIND_NAME[Number(row.kind)] }
|
|
177
|
+
: {}),
|
|
178
|
+
...(row.mkind !== undefined && row.mkind !== null && Number(row.mkind) > 0
|
|
179
|
+
? { mkind: Number(row.mkind), mkindKinds: mkindToKindList(Number(row.mkind)).map((k) => ({ kind: k, name: MSG_KIND_NAME[k] })) }
|
|
180
|
+
: {}),
|
|
174
181
|
...(msgObj ? { msg: msgObj } : {}),
|
|
175
182
|
});
|
|
176
183
|
}
|
|
@@ -338,6 +345,214 @@ const msgSyncGroup = {
|
|
|
338
345
|
});
|
|
339
346
|
},
|
|
340
347
|
};
|
|
348
|
+
/**
|
|
349
|
+
* 按 kind 过滤拉取群消息(服务端 /group/syncGroupMsgByKind)。
|
|
350
|
+
*
|
|
351
|
+
* 🔴 kind 是单值(如 2001 图片、4001 文件、1001 文本),不是 mkind 掩码;
|
|
352
|
+
* 转换表见 references/constants.md。响应每条消息带 kind/mkind,已在此透出。
|
|
353
|
+
* 🔴 该接口依赖消息落库时的 mkind;若发送端未带 kind/mKind 导致落库 mkind=0,
|
|
354
|
+
* 按非文本 kind 过滤可能拿不到数据(服务端 ParseMsgMkind 解析为空)。
|
|
355
|
+
*/
|
|
356
|
+
const msgSyncGroupByKind = {
|
|
357
|
+
name: 'im.msg.sync.groupByKind',
|
|
358
|
+
resource: 'msg',
|
|
359
|
+
method: 'msg.sync.groupByKind',
|
|
360
|
+
action: 'im.msg.sync.groupByKind',
|
|
361
|
+
summary: '按消息 kind 过滤拉取某群消息(如图片/文件/文本;服务端按 kind 过滤,响应带 kind/mkind)',
|
|
362
|
+
capability: 'msg',
|
|
363
|
+
risk: READ,
|
|
364
|
+
inputSchema: schemaOf({
|
|
365
|
+
groupId: { type: 'string', pattern: '^\\d+$', description: '群 id(必填)' },
|
|
366
|
+
kind: { type: 'integer', minimum: 1, description: '消息 kind 单值(必填),如 1001 文本/2001 图片/4001 文件/6001 视频;见 constants.md' },
|
|
367
|
+
num: { type: 'integer', minimum: 1, maximum: 50, description: '每页数量(默认 50,最多 50)' },
|
|
368
|
+
latest: { type: 'boolean', description: '拉最新不限日期(无界区间,只拉一页)' },
|
|
369
|
+
from: { type: 'string', description: '起始时间;跨度 > 7 天自动收敛为该范围最后 7 天' },
|
|
370
|
+
to: { type: 'string', description: '结束时间(同上)' },
|
|
371
|
+
startId: { type: 'string', description: '显式起始消息 id(最高优先)' },
|
|
372
|
+
endId: { type: 'string', description: '显式结束消息 id' },
|
|
373
|
+
imgFormat: { type: 'string', enum: ['small', 'large', 'original'], description: '预览规格(默认 small)' },
|
|
374
|
+
}, { required: ['groupId', 'kind'], description: '按 kind 过滤拉取群消息' }),
|
|
375
|
+
handler: async (args, { host }) => {
|
|
376
|
+
const groupId = String(args.groupId);
|
|
377
|
+
if (!groupId || groupId === '0')
|
|
378
|
+
throw imValidationError('id_invalid', 'groupId 必须非 0');
|
|
379
|
+
const kind = Number(args.kind);
|
|
380
|
+
if (!Number.isInteger(kind) || kind <= 0)
|
|
381
|
+
throw imValidationError('kind_invalid', 'kind 必须是正整数(如 2001 图片)');
|
|
382
|
+
const { start, end, scope, shrink } = resolveRange(args, { start: 'startId', end: 'endId' });
|
|
383
|
+
const num = pageSizeOf(args);
|
|
384
|
+
const autoLoop = end !== '0';
|
|
385
|
+
let actCode = 0;
|
|
386
|
+
const pulled = await pullPaged({
|
|
387
|
+
num,
|
|
388
|
+
start,
|
|
389
|
+
end,
|
|
390
|
+
autoLoop,
|
|
391
|
+
requestOnePage: async (pageStart, pageEnd, maxNum) => {
|
|
392
|
+
// 群 ByKind 走 proto 下划线字段;type/group_id 必传(对应 SyncKindGroupMsgRequest)
|
|
393
|
+
const body = {
|
|
394
|
+
trans_id: 0,
|
|
395
|
+
dev: 4,
|
|
396
|
+
type: 0,
|
|
397
|
+
enc_type: 0,
|
|
398
|
+
group_id: groupId,
|
|
399
|
+
start: pageStart,
|
|
400
|
+
end: pageEnd,
|
|
401
|
+
max_num: maxNum,
|
|
402
|
+
kind,
|
|
403
|
+
history: false,
|
|
404
|
+
};
|
|
405
|
+
const res = await host.request({
|
|
406
|
+
method: 'POST',
|
|
407
|
+
path: '/api/em/msg/executeIm/group/syncGroupMsgByKind',
|
|
408
|
+
body,
|
|
409
|
+
operation: 'im.msg.sync.groupByKind',
|
|
410
|
+
});
|
|
411
|
+
actCode = Number(res?.data?.actionMsg?.code ?? -1);
|
|
412
|
+
if (actCode === 1303)
|
|
413
|
+
return [];
|
|
414
|
+
assertImOk(res, '按 kind 拉取群消息');
|
|
415
|
+
const inner = unwrapInner(res);
|
|
416
|
+
// ByKind 响应 datas 为扁平数组;兼容嵌套 datas/datas 两层
|
|
417
|
+
const flat = inner?.datas;
|
|
418
|
+
if (Array.isArray(flat)) {
|
|
419
|
+
// 若元素是含 datas 的分组则展开,否则直接是消息行
|
|
420
|
+
if (flat.length && Array.isArray(flat[0]?.datas))
|
|
421
|
+
return flat.flatMap((g) => g.datas ?? []);
|
|
422
|
+
return flat;
|
|
423
|
+
}
|
|
424
|
+
const outerDatas = inner?.data?.datas ?? [];
|
|
425
|
+
const rows = [];
|
|
426
|
+
for (const g of outerDatas) {
|
|
427
|
+
const list = g?.datas ?? g?.data ?? [];
|
|
428
|
+
if (Array.isArray(list))
|
|
429
|
+
rows.push(...list);
|
|
430
|
+
}
|
|
431
|
+
return rows;
|
|
432
|
+
},
|
|
433
|
+
});
|
|
434
|
+
const authUid = await resolveAuthUid(host);
|
|
435
|
+
const messages = await enrichMessages(pulled.rows, host, {
|
|
436
|
+
authUid,
|
|
437
|
+
groupId,
|
|
438
|
+
imgFormat: args.imgFormat,
|
|
439
|
+
});
|
|
440
|
+
sortMessagesNewestFirst(messages);
|
|
441
|
+
return imSuccess('im.msg.sync.groupByKind', {
|
|
442
|
+
groupId,
|
|
443
|
+
kind,
|
|
444
|
+
kindName: MSG_KIND_NAME[kind],
|
|
445
|
+
total: messages.length,
|
|
446
|
+
messages,
|
|
447
|
+
range: { from: args.from, to: args.to, start, end, scope, autoPaged: autoLoop },
|
|
448
|
+
...paginationMeta(pulled, num),
|
|
449
|
+
...(shrink ? { rangeShrink: rangeShrinkMeta(shrink) } : {}),
|
|
450
|
+
...(actCode === 1303 ? { empty: true, emptyReason: emptyPageNote(args) } : {}),
|
|
451
|
+
});
|
|
452
|
+
},
|
|
453
|
+
};
|
|
454
|
+
/**
|
|
455
|
+
* 按 kind 过滤拉取单聊消息(服务端 /single/syncSingleMsgByKind)。
|
|
456
|
+
*
|
|
457
|
+
* 🔴 对方字段为 tuser({cid,uid});操作者由 header eteamsid 注入,不传 body。
|
|
458
|
+
* 🔴 kind 为单值(非 mkind 掩码),见 references/constants.md。
|
|
459
|
+
*/
|
|
460
|
+
const msgSyncSingleByKind = {
|
|
461
|
+
name: 'im.msg.sync.singleByKind',
|
|
462
|
+
resource: 'msg',
|
|
463
|
+
method: 'msg.sync.singleByKind',
|
|
464
|
+
action: 'im.msg.sync.singleByKind',
|
|
465
|
+
summary: '按消息 kind 过滤拉取与某人的单聊消息(如图片/文件/文本;响应带 kind/mkind)',
|
|
466
|
+
capability: 'msg',
|
|
467
|
+
risk: READ,
|
|
468
|
+
inputSchema: schemaOf({
|
|
469
|
+
fromUid: { type: 'string', pattern: '^\\d+$', description: '对方 uid(必填)' },
|
|
470
|
+
fromCid: { type: 'string', pattern: '^\\d+$', description: '对方 cid(必填)' },
|
|
471
|
+
kind: { type: 'integer', minimum: 1, description: '消息 kind 单值(必填),如 1001 文本/2001 图片/4001 文件/6001 视频;见 constants.md' },
|
|
472
|
+
num: { type: 'integer', minimum: 1, maximum: 50, description: '每页数量(默认 50,最多 50)' },
|
|
473
|
+
latest: { type: 'boolean', description: '拉最新不限日期(无界区间,只拉一页)' },
|
|
474
|
+
from: { type: 'string', description: '起始时间;跨度 > 7 天自动收敛为该范围最后 7 天' },
|
|
475
|
+
to: { type: 'string', description: '结束时间(同上)' },
|
|
476
|
+
start: { type: 'string', description: '显式起始消息 id(最高优先)' },
|
|
477
|
+
end: { type: 'string', description: '显式结束消息 id' },
|
|
478
|
+
imgFormat: { type: 'string', enum: ['small', 'large', 'original'], description: '预览规格(默认 small)' },
|
|
479
|
+
}, { required: ['fromUid', 'fromCid', 'kind'], description: '按 kind 过滤拉取单聊消息' }),
|
|
480
|
+
handler: async (args, { host }) => {
|
|
481
|
+
const fromUid = String(args.fromUid);
|
|
482
|
+
const fromCid = String(args.fromCid);
|
|
483
|
+
if (!fromUid || !fromCid || fromUid === '0' || fromCid === '0') {
|
|
484
|
+
throw imValidationError('id_invalid', 'fromUid/fromCid 必须非 0');
|
|
485
|
+
}
|
|
486
|
+
const kind = Number(args.kind);
|
|
487
|
+
if (!Number.isInteger(kind) || kind <= 0)
|
|
488
|
+
throw imValidationError('kind_invalid', 'kind 必须是正整数(如 2001 图片)');
|
|
489
|
+
const { start, end, scope, shrink } = resolveRange(args);
|
|
490
|
+
const num = pageSizeOf(args);
|
|
491
|
+
const autoLoop = end !== '0';
|
|
492
|
+
let actCode = 0;
|
|
493
|
+
const pulled = await pullPaged({
|
|
494
|
+
num,
|
|
495
|
+
start,
|
|
496
|
+
end,
|
|
497
|
+
autoLoop,
|
|
498
|
+
requestOnePage: async (pageStart, pageEnd, maxNum) => {
|
|
499
|
+
// 单聊 ByKind model 用驼峰字段:tuser/start/end/kind/maxNum/encType(对方=tuser,操作者走 header)
|
|
500
|
+
const body = {
|
|
501
|
+
trans_id: 0,
|
|
502
|
+
dev: 4,
|
|
503
|
+
tuser: { cid: fromCid, uid: fromUid },
|
|
504
|
+
start: pageStart,
|
|
505
|
+
end: pageEnd,
|
|
506
|
+
kind,
|
|
507
|
+
maxNum: maxNum,
|
|
508
|
+
encType: 0,
|
|
509
|
+
};
|
|
510
|
+
const res = await host.request({
|
|
511
|
+
method: 'POST',
|
|
512
|
+
path: '/api/em/msg/executeIm/single/syncSingleMsgByKind',
|
|
513
|
+
body,
|
|
514
|
+
operation: 'im.msg.sync.singleByKind',
|
|
515
|
+
});
|
|
516
|
+
actCode = Number(res?.data?.actionMsg?.code ?? -1);
|
|
517
|
+
if (actCode === 1303)
|
|
518
|
+
return [];
|
|
519
|
+
assertImOk(res, '按 kind 拉取单聊消息');
|
|
520
|
+
const inner = unwrapInner(res);
|
|
521
|
+
const flat = inner?.datas;
|
|
522
|
+
if (Array.isArray(flat)) {
|
|
523
|
+
if (flat.length && Array.isArray(flat[0]?.datas))
|
|
524
|
+
return flat.flatMap((g) => g.datas ?? []);
|
|
525
|
+
return flat;
|
|
526
|
+
}
|
|
527
|
+
const outerDatas = inner?.data?.datas ?? [];
|
|
528
|
+
const rows = [];
|
|
529
|
+
for (const g of outerDatas) {
|
|
530
|
+
const list = g?.datas ?? g?.data ?? [];
|
|
531
|
+
if (Array.isArray(list))
|
|
532
|
+
rows.push(...list);
|
|
533
|
+
}
|
|
534
|
+
return rows;
|
|
535
|
+
},
|
|
536
|
+
});
|
|
537
|
+
const authUid = await resolveAuthUid(host);
|
|
538
|
+
const messages = await enrichMessages(pulled.rows, host, {
|
|
539
|
+
authUid,
|
|
540
|
+
user: { cid: fromCid, uid: fromUid },
|
|
541
|
+
imgFormat: args.imgFormat,
|
|
542
|
+
});
|
|
543
|
+
sortMessagesNewestFirst(messages);
|
|
544
|
+
return imSuccess('im.msg.sync.singleByKind', {
|
|
545
|
+
total: messages.length,
|
|
546
|
+
kind,
|
|
547
|
+
kindName: MSG_KIND_NAME[kind],
|
|
548
|
+
messages,
|
|
549
|
+
range: { from: args.from, to: args.to, start, end, scope, autoPaged: autoLoop },
|
|
550
|
+
...paginationMeta(pulled, num),
|
|
551
|
+
...(shrink ? { rangeShrink: rangeShrinkMeta(shrink) } : {}),
|
|
552
|
+
...(actCode === 1303 ? { empty: true, emptyReason: emptyPageNote(args) } : {}),
|
|
553
|
+
});
|
|
554
|
+
},
|
|
555
|
+
};
|
|
341
556
|
/** 群置顶消息同步。 */
|
|
342
557
|
const msgTopSync = {
|
|
343
558
|
name: 'im.msg.top.sync',
|
|
@@ -541,6 +756,8 @@ const msgReadGroupDetail = {
|
|
|
541
756
|
export const msgReadOperations = [
|
|
542
757
|
msgSyncSingle,
|
|
543
758
|
msgSyncGroup,
|
|
759
|
+
msgSyncGroupByKind,
|
|
760
|
+
msgSyncSingleByKind,
|
|
544
761
|
msgTopSync,
|
|
545
762
|
msgReadSingle,
|
|
546
763
|
msgReadGroup,
|
|
@@ -6,6 +6,7 @@ import { assertImOk, compact, extractGroupMembers, str } from './shared.js';
|
|
|
6
6
|
import { buildAtMsgJson, buildAtText, hasAtInput, resolveAtMentions } from './at-mention.js';
|
|
7
7
|
import { hasQuoteInput, resolveQuotedRef } from './quote-mention.js';
|
|
8
8
|
import { fileObjToFile, fileObjToImg, makeWritePair } from './write-util.js';
|
|
9
|
+
import { DING_SOURCE_DEFAULT, DING_SOURCE_TYPE, MKIND } from '../constants.js';
|
|
9
10
|
/** 校验本地文件存在,返回绝对路径。 */
|
|
10
11
|
function assertLocalFile(pathValue, field) {
|
|
11
12
|
const abs = resolve(String(pathValue ?? ''));
|
|
@@ -17,6 +18,8 @@ function assertLocalFile(pathValue, field) {
|
|
|
17
18
|
* 单聊/群聊发送内容归一化:txt / img / file 至少一种。
|
|
18
19
|
* 🔴 全空白文本(空格 / 换行)不算内容,禁止发送空白消息。
|
|
19
20
|
* markdown:true 表示 txt 是 markdown 原文(发送时外层 type=26 且 txt 段带 vt=1,客户端仅对 type=26 按 markdown 解析),仅支持纯文本消息。
|
|
21
|
+
* txt 与 img/file 可同时提供:发送时组装 type=26 富文本 msg JSON(dt 含 txt 段 + 媒体段),避免服务端 sendSingleMsg/sendGroupMsg
|
|
22
|
+
* 收到 txt 后整条按文本处理、静默丢弃媒体(旧行为 sent:true 但落库 type=1、媒体为空)。markdown 与媒体互斥(markdown_txt_only)。
|
|
20
23
|
*/
|
|
21
24
|
function normalizeContent(args) {
|
|
22
25
|
const txtRaw = args.txt !== undefined && args.txt !== null ? String(args.txt) : '';
|
|
@@ -59,6 +62,7 @@ const sendSinglePair = makeWritePair({
|
|
|
59
62
|
if (quote && !content.txt) {
|
|
60
63
|
throw imValidationError('quote_requires_txt', 'quoteMsgId 仅支持文本消息(txt)');
|
|
61
64
|
}
|
|
65
|
+
const richCombo = Boolean(content.txt) && Boolean(content.imgPath || content.filePath) && !content.markdown;
|
|
62
66
|
const summary = {
|
|
63
67
|
action: '发送单聊消息',
|
|
64
68
|
toUid,
|
|
@@ -67,6 +71,7 @@ const sendSinglePair = makeWritePair({
|
|
|
67
71
|
hasImg: Boolean(content.imgPath),
|
|
68
72
|
hasFile: Boolean(content.filePath),
|
|
69
73
|
...(content.markdown ? { contentFormat: 'markdown' } : {}),
|
|
74
|
+
...(richCombo ? { contentType: 'rich', note: '文本+媒体将以 type=26 富文本一条发出(dt 含 txt 段与媒体段)' } : {}),
|
|
70
75
|
};
|
|
71
76
|
const snapshot = { toUid, toCid };
|
|
72
77
|
if (content.txt) {
|
|
@@ -97,7 +102,23 @@ const sendSinglePair = makeWritePair({
|
|
|
97
102
|
const txtExtra = plan.markdown ? { vt: '1' } : {};
|
|
98
103
|
// markdown 约束:客户端仅对最外层 type=26 的消息按 markdown 解析,故 markdown 发送时 msg JSON 的 type 必须为 '26'
|
|
99
104
|
const markdownTypeExtra = plan.markdown ? { type: '26' } : {};
|
|
100
|
-
|
|
105
|
+
// txt + 媒体同发:服务端 sendSingleMsg 收到 txt 会整条按文本处理、静默丢弃 img/file,
|
|
106
|
+
// 故组装 type=26 富文本 msg JSON,dt 同时含 txt 段与媒体段(客户端按富文本多段渲染,解析侧亦按 dt.map 还原)。
|
|
107
|
+
const richCombo = plan.txt !== undefined && (plan.imgPath || plan.filePath) && !plan.markdown;
|
|
108
|
+
if (richCombo) {
|
|
109
|
+
const self = await env.host.getSelfIdentity();
|
|
110
|
+
const mediaSegs = [];
|
|
111
|
+
if (plan.imgPath) {
|
|
112
|
+
const fileObj = await env.host.uploadFile(plan.imgPath, { shareUsers: plan.toUid });
|
|
113
|
+
mediaSegs.push({ img: fileObjToImg(fileObj) });
|
|
114
|
+
}
|
|
115
|
+
if (plan.filePath) {
|
|
116
|
+
const fileObj = await env.host.uploadFile(plan.filePath, { shareUsers: plan.toUid });
|
|
117
|
+
mediaSegs.push({ file: fileObjToFile(fileObj) });
|
|
118
|
+
}
|
|
119
|
+
body.msg = buildAtMsgJson(String(plan.txt), [], self, { ...(quoteRef ? { ref: quoteRef } : {}), type: '26' }, {}, mediaSegs);
|
|
120
|
+
}
|
|
121
|
+
else if (quoteRef) {
|
|
101
122
|
// 引用:完整原生 msg JSON 走 msg 字段(与群聊同款承载方式,实测单聊同样生效)
|
|
102
123
|
const self = await env.host.getSelfIdentity();
|
|
103
124
|
body.msg = buildAtMsgJson(String(plan.txt ?? ''), [], self, { ref: quoteRef, ...markdownTypeExtra }, txtExtra);
|
|
@@ -112,13 +133,15 @@ const sendSinglePair = makeWritePair({
|
|
|
112
133
|
body.txt = plan.txt;
|
|
113
134
|
}
|
|
114
135
|
}
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
136
|
+
if (!richCombo) {
|
|
137
|
+
if (plan.imgPath) {
|
|
138
|
+
const fileObj = await env.host.uploadFile(plan.imgPath, { shareUsers: plan.toUid });
|
|
139
|
+
body.img = fileObjToImg(fileObj);
|
|
140
|
+
}
|
|
141
|
+
if (plan.filePath) {
|
|
142
|
+
const fileObj = await env.host.uploadFile(plan.filePath, { shareUsers: plan.toUid });
|
|
143
|
+
body.file = fileObjToFile(fileObj);
|
|
144
|
+
}
|
|
122
145
|
}
|
|
123
146
|
const res = await env.host.request({
|
|
124
147
|
method: 'POST',
|
|
@@ -127,7 +150,7 @@ const sendSinglePair = makeWritePair({
|
|
|
127
150
|
operation: 'im.msg.send.single',
|
|
128
151
|
});
|
|
129
152
|
assertImOk(res, '发送单聊消息');
|
|
130
|
-
return { toUid: plan.toUid, toCid: plan.toCid, sent: true };
|
|
153
|
+
return { toUid: plan.toUid, toCid: plan.toCid, sent: true, contentType: richCombo ? 'rich' : undefined };
|
|
131
154
|
},
|
|
132
155
|
});
|
|
133
156
|
// ── 发群聊 ──
|
|
@@ -148,7 +171,8 @@ const sendGroupPair = makeWritePair({
|
|
|
148
171
|
if (quote && !content.txt) {
|
|
149
172
|
throw imValidationError('quote_requires_txt', 'quoteMsgId/replyMsgId 仅支持文本消息(txt)');
|
|
150
173
|
}
|
|
151
|
-
const
|
|
174
|
+
const richCombo = Boolean(content.txt) && Boolean(content.imgPath || content.filePath) && !content.markdown;
|
|
175
|
+
const summary = { action: '发送群聊消息', groupId, hasTxt: Boolean(content.txt), hasImg: Boolean(content.imgPath), hasFile: Boolean(content.filePath), ...(content.markdown ? { contentFormat: 'markdown' } : {}), ...(richCombo ? { contentType: 'rich', note: '文本+媒体将以 type=26 富文本一条发出(dt 含 txt 段与媒体段)' } : {}) };
|
|
152
176
|
const snapshot = { groupId };
|
|
153
177
|
if (content.txt) {
|
|
154
178
|
snapshot.txt = content.txt;
|
|
@@ -183,7 +207,24 @@ const sendGroupPair = makeWritePair({
|
|
|
183
207
|
const txtExtra = plan.markdown ? { vt: '1' } : {};
|
|
184
208
|
// markdown 约束:客户端仅对最外层 type=26 的消息按 markdown 解析,故 markdown 发送时 msg JSON 的 type 必须为 '26'
|
|
185
209
|
const markdownTypeExtra = plan.markdown ? { type: '26' } : {};
|
|
186
|
-
|
|
210
|
+
// txt + 媒体同发:服务端 sendGroupMsg 收到 txt 会整条按文本处理、静默丢弃 img/file,
|
|
211
|
+
// 故组装 type=26 富文本 msg JSON,dt 同时含 txt 段与媒体段(可与 @ / 引用叠加,aus/ref 仍在 txt 段)。
|
|
212
|
+
const richCombo = plan.txt !== undefined && (plan.imgPath || plan.filePath) && !plan.markdown;
|
|
213
|
+
if (richCombo) {
|
|
214
|
+
const { v, aus } = buildAtText(String(plan.txt), atEntries);
|
|
215
|
+
const self = await env.host.getSelfIdentity();
|
|
216
|
+
const mediaSegs = [];
|
|
217
|
+
if (plan.imgPath) {
|
|
218
|
+
const fileObj = await env.host.uploadFile(plan.imgPath, { shareGroups: plan.groupId });
|
|
219
|
+
mediaSegs.push({ img: fileObjToImg(fileObj) });
|
|
220
|
+
}
|
|
221
|
+
if (plan.filePath) {
|
|
222
|
+
const fileObj = await env.host.uploadFile(plan.filePath, { shareGroups: plan.groupId });
|
|
223
|
+
mediaSegs.push({ file: fileObjToFile(fileObj) });
|
|
224
|
+
}
|
|
225
|
+
body.msg = buildAtMsgJson(v, aus, self, { ...(quoteRef ? { [plan.quoteKind === 'reply' ? 'rmsg' : 'ref']: quoteRef } : {}), type: '26' }, {}, mediaSegs);
|
|
226
|
+
}
|
|
227
|
+
else if (atEntries.length || quoteRef) {
|
|
187
228
|
// @ / 引用 / 回复:完整原生 msg JSON 走 msg 字段(txt 字段无法携带 aus/ref,实测会被当纯文本展示)
|
|
188
229
|
const { v, aus } = buildAtText(String(plan.txt ?? ''), atEntries);
|
|
189
230
|
const self = await env.host.getSelfIdentity();
|
|
@@ -199,13 +240,15 @@ const sendGroupPair = makeWritePair({
|
|
|
199
240
|
body.txt = plan.txt;
|
|
200
241
|
}
|
|
201
242
|
}
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
243
|
+
if (!richCombo) {
|
|
244
|
+
if (plan.imgPath) {
|
|
245
|
+
const fileObj = await env.host.uploadFile(plan.imgPath, { shareGroups: plan.groupId });
|
|
246
|
+
body.img = fileObjToImg(fileObj);
|
|
247
|
+
}
|
|
248
|
+
if (plan.filePath) {
|
|
249
|
+
const fileObj = await env.host.uploadFile(plan.filePath, { shareGroups: plan.groupId });
|
|
250
|
+
body.file = fileObjToFile(fileObj);
|
|
251
|
+
}
|
|
209
252
|
}
|
|
210
253
|
const res = await env.host.request({
|
|
211
254
|
method: 'POST',
|
|
@@ -214,7 +257,7 @@ const sendGroupPair = makeWritePair({
|
|
|
214
257
|
operation: 'im.msg.send.group',
|
|
215
258
|
});
|
|
216
259
|
assertImOk(res, '发送群聊消息');
|
|
217
|
-
return { groupId: plan.groupId, sent: true };
|
|
260
|
+
return { groupId: plan.groupId, sent: true, contentType: richCombo ? 'rich' : undefined };
|
|
218
261
|
},
|
|
219
262
|
});
|
|
220
263
|
// ── 撤回消息 ──
|
|
@@ -307,7 +350,7 @@ const withdrawPair = makeWritePair({
|
|
|
307
350
|
const timeOut = findWithdrawTimeOut(res);
|
|
308
351
|
const interval = timeOut !== null ? formatWithdrawInterval(timeOut) : '';
|
|
309
352
|
if (actCode === 1505) {
|
|
310
|
-
throw imValidationError('withdraw_timeout', `撤销超时${interval ? `(撤回时限 ${interval})` : '
|
|
353
|
+
throw imValidationError('withdraw_timeout', `撤销超时${interval ? `(撤回时限 ${interval})` : ''}:消息发送已超过可撤回时限,无法撤回(时限因环境而异,以正常撤回时回包 withdrawInterval 为准)`, { code: 1505, details: interval ? { withdrawInterval: interval } : undefined });
|
|
311
354
|
}
|
|
312
355
|
if (actCode === 1506)
|
|
313
356
|
throw imValidationError('withdraw_not_owner', '消息不是自己发送的,无法撤回', { code: 1506 });
|
|
@@ -524,31 +567,28 @@ const dingSendPair = makeWritePair({
|
|
|
524
567
|
let tag;
|
|
525
568
|
let titleDt;
|
|
526
569
|
const nm = msgObj.dt?.[0]?.file?.nm || msgObj.dt?.[0]?.img?.nm || msgObj.dt?.[0]?.media?.nm || '';
|
|
570
|
+
// mkind/tag 按源消息体 type 取值(具名常量,语义见 constants.md / DING_SOURCE_TYPE):
|
|
571
|
+
// 文件 512/tag2、图片 64/tag0、视频 2048/tag1;其余落文本兜底 mkind=1/tag3(与源脚本 sendDing.js 一致)。
|
|
572
|
+
const src = DING_SOURCE_TYPE[mtype] || DING_SOURCE_DEFAULT;
|
|
573
|
+
mkind = src.mkind;
|
|
574
|
+
tag = src.tag;
|
|
527
575
|
if (mtype === 4) {
|
|
528
|
-
tag = '2';
|
|
529
576
|
content = `[文件]${nm}`;
|
|
530
|
-
mkind = 512;
|
|
531
577
|
titleDt = [{ txt: { v: nm } }];
|
|
532
578
|
fileIds = String(msgObj.dt?.[0]?.file?.id || '');
|
|
533
579
|
}
|
|
534
580
|
else if (mtype === 2) {
|
|
535
|
-
tag = '0';
|
|
536
581
|
content = '[图片]';
|
|
537
|
-
mkind = 64;
|
|
538
582
|
titleDt = [];
|
|
539
583
|
fileIds = String(msgObj.dt?.[0]?.img?.src || msgObj.dt?.[0]?.img?.id || '');
|
|
540
584
|
}
|
|
541
585
|
else if (mtype === 7) {
|
|
542
|
-
tag = '1';
|
|
543
586
|
content = '[视频]';
|
|
544
|
-
mkind = 2048;
|
|
545
587
|
titleDt = [];
|
|
546
588
|
fileIds = String(msgObj.dt?.[0]?.media?.src || msgObj.dt?.[0]?.media?.id || '');
|
|
547
589
|
}
|
|
548
590
|
else {
|
|
549
|
-
tag = '3';
|
|
550
591
|
content = msgObj.dt?.[0]?.txt?.v || '';
|
|
551
|
-
mkind = 1;
|
|
552
592
|
titleDt = [{ txt: { v: content } }];
|
|
553
593
|
}
|
|
554
594
|
msgEntity = JSON.stringify({ ...msgObj, tf: '1' });
|
|
@@ -559,7 +599,7 @@ const dingSendPair = makeWritePair({
|
|
|
559
599
|
// 普通必达(markdown 时外层 type='26' 且 txt 段带 vt=1,与客户端 markdown 消息格式一致;
|
|
560
600
|
// 客户端仅对最外层 type=26 的消息按 markdown 解析)
|
|
561
601
|
content = plan.txt;
|
|
562
|
-
mkind =
|
|
602
|
+
mkind = MKIND.TXT_NORMAL;
|
|
563
603
|
const mdType = plan.markdown ? '26' : '1';
|
|
564
604
|
const txtSeg = plan.markdown
|
|
565
605
|
? { v: plan.txt, vt: '1', next: '0', ft: 'china' }
|
|
@@ -673,7 +713,7 @@ const msgWriteOps = [
|
|
|
673
713
|
img: { type: 'string', description: '本地图片路径' },
|
|
674
714
|
file: { type: 'string', description: '本地文件路径' },
|
|
675
715
|
}, sendGroupPair, { required: ['groupId'], requiredAny: ['txt', 'img', 'file'] }),
|
|
676
|
-
...buildMsgWriteDefinition('im.msg.withdraw', 'msg.withdraw', '
|
|
716
|
+
...buildMsgWriteDefinition('im.msg.withdraw', 'msg.withdraw', '撤回消息(单聊/群聊,仅限本人消息,时限以回包 withdrawInterval 为准)', {
|
|
677
717
|
type: { type: 'string', enum: ['single', 'group'], description: 'single 或 group' },
|
|
678
718
|
msgid: { type: 'string', pattern: '^\\d+$', description: '消息 id(ser_msgid)' },
|
|
679
719
|
toUid: { type: 'string', pattern: '^\\d+$', description: '单聊:对方 uid' },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 发票记录、票面扩展信息 `ext` 与通行费票据汇总单文件名的语义提取。
|
|
3
3
|
*
|
|
4
4
|
* `ext` 是**字符串化的 JSON**。费用说明、城市、备注(常写出差地、订单行程)、起止地、上下车站点
|
|
5
5
|
* 及乘车人身份信息在这里提取。列表 / 详情的完整输出(`extInfo`)、summary / detail 视图
|
|
@@ -50,6 +50,25 @@ export function invoiceRecordOf(item) {
|
|
|
50
50
|
const hasOwnInvoiceFields = record.comm_info !== undefined || record.fid !== undefined || record.number !== undefined;
|
|
51
51
|
return !hasOwnInvoiceFields && Object.keys(inner).length ? inner : record;
|
|
52
52
|
}
|
|
53
|
+
/** 通行费票的票据汇总单文件名;其他票种不返回该字段,通行费票无匹配项时返回 []。 */
|
|
54
|
+
export function invoiceTollSummaryNames(item) {
|
|
55
|
+
const record = invoiceRecordOf(item);
|
|
56
|
+
const pro = asRecord(asRecord(record.comm_info).pro);
|
|
57
|
+
if (typeof pro.cname !== 'string' || pro.cname.trim() !== '电子发票(通行费)')
|
|
58
|
+
return undefined;
|
|
59
|
+
// 保留 CLI 详情补读的结果,包括补读失败时的 [],不再从列表快照重新推断。
|
|
60
|
+
if (Array.isArray(record.tollSummaryNames) && record.tollSummaryNames.every((name) => typeof name === 'string')) {
|
|
61
|
+
return record.tollSummaryNames;
|
|
62
|
+
}
|
|
63
|
+
const files = Array.isArray(record.flist) ? record.flist : [];
|
|
64
|
+
return files.flatMap((file) => {
|
|
65
|
+
const attachment = asRecord(file);
|
|
66
|
+
if (attachment.del === 1 || attachment.del === '1' || attachment.del === true)
|
|
67
|
+
return [];
|
|
68
|
+
const name = attachment.name;
|
|
69
|
+
return typeof name === 'string' && name.includes('票据汇总单') ? [name] : [];
|
|
70
|
+
});
|
|
71
|
+
}
|
|
53
72
|
/** 解析失败按空对象处理,不让脏数据打断输出。已是对象时直接使用。 */
|
|
54
73
|
export function parseInvoiceExt(value) {
|
|
55
74
|
if (value && typeof value === 'object')
|