weaver-work-cli 0.1.80 → 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.
Files changed (186) hide show
  1. package/README.md +3 -1
  2. package/dist/chunks/{archive-ENBSUMHV.js → archive-KVV4SM7J.js} +3 -3
  3. package/dist/chunks/{archive-oa-7BFPQ6M5.js → archive-oa-VRSPNLY4.js} +3 -3
  4. package/dist/chunks/{asset-V5SUD3PW.js → asset-JZ5MN6OL.js} +306 -10
  5. package/dist/chunks/{asset-idle-3CEL7WFX.js → asset-idle-B4SAL43V.js} +3 -3
  6. package/dist/chunks/{attachment-content-SHXZUE3N.js → attachment-content-7W4XQTA7.js} +3 -3
  7. package/dist/chunks/{blog-FLI4SS3P.js → blog-XCBM467O.js} +3 -3
  8. package/dist/chunks/{caizhilian-7WCTKCCP.js → caizhilian-NZVUKCZD.js} +5 -5
  9. package/dist/chunks/{calendar-G726HUUH.js → calendar-OVM2SGYJ.js} +3 -3
  10. package/dist/chunks/{chunk-XNN5PZTI.js → chunk-3WZMDOI3.js} +1 -1
  11. package/dist/chunks/{chunk-TM2G7DNT.js → chunk-56F2GGE4.js} +5 -5
  12. package/dist/chunks/{chunk-LCM5SSGJ.js → chunk-5MM2IZ27.js} +423 -36
  13. package/dist/chunks/{chunk-BWFCTE43.js → chunk-5NQZO3CO.js} +48 -5
  14. package/dist/chunks/{chunk-KVCDZ2FX.js → chunk-5RIK6OLF.js} +7 -7
  15. package/dist/chunks/{chunk-5E2FDXBU.js → chunk-64RYQOXA.js} +1 -1
  16. package/dist/chunks/{chunk-44ZWNC7A.js → chunk-7BP3HU74.js} +2 -2
  17. package/dist/chunks/{chunk-3Q5F4C5B.js → chunk-AW3HQUOC.js} +5 -5
  18. package/dist/chunks/{chunk-7M5OYRK2.js → chunk-BD3M2YVN.js} +3 -3
  19. package/dist/chunks/{chunk-JEQHNNSS.js → chunk-BFVUBCYO.js} +14 -0
  20. package/dist/chunks/{chunk-PAWXVT6H.js → chunk-CLVEXDEJ.js} +4 -5
  21. package/dist/chunks/{chunk-TBCKK6LH.js → chunk-DWCMKEMO.js} +2 -2
  22. package/dist/chunks/{chunk-AVDEZLEB.js → chunk-E3XUYWYA.js} +4 -4
  23. package/dist/chunks/{chunk-3IX6L74V.js → chunk-FIPTUAOW.js} +2 -2
  24. package/dist/chunks/{chunk-4MAQALTM.js → chunk-GQEIHXY5.js} +6 -6
  25. package/dist/chunks/{chunk-TD5IOEGN.js → chunk-JUPKXW4P.js} +1 -1
  26. package/dist/chunks/{chunk-HYNOKFYJ.js → chunk-KZ3JR3GE.js} +3 -3
  27. package/dist/chunks/{chunk-4PBN7NJY.js → chunk-L2PKMZIU.js} +1 -1
  28. package/dist/chunks/{chunk-DACQKJ6O.js → chunk-LXWWOHM6.js} +4 -4
  29. package/dist/chunks/{chunk-7DE3VMZD.js → chunk-LYFPWZBD.js} +6 -1
  30. package/dist/chunks/{chunk-2UV4IZIT.js → chunk-MTIV6JEN.js} +2 -2
  31. package/dist/chunks/{chunk-WXV5FIKA.js → chunk-MWFKLXVU.js} +38 -38
  32. package/dist/chunks/{chunk-PMRNIGKZ.js → chunk-RVVRTW4P.js} +2 -2
  33. package/dist/chunks/{chunk-FPWCCRKT.js → chunk-UASZW22U.js} +3 -3
  34. package/dist/chunks/{chunk-RVEKGVZU.js → chunk-VMUVVTT4.js} +2 -2
  35. package/dist/chunks/{chunk-JQPKSQAK.js → chunk-W4BGNYKR.js} +1 -1
  36. package/dist/chunks/{chunk-OVTCWLNQ.js → chunk-W4R3SXJV.js} +15 -7
  37. package/dist/chunks/{chunk-UDBQJLQF.js → chunk-WF5G5SV3.js} +2 -2
  38. package/dist/chunks/{chunk-EGHRA2E3.js → chunk-WM5ZE67G.js} +1 -1
  39. package/dist/chunks/{chunk-QVKRNL7L.js → chunk-WQ4ZHAEZ.js} +10 -2
  40. package/dist/chunks/{chunk-JFZM3ZRU.js → chunk-X7OZKI6F.js} +12 -12
  41. package/dist/chunks/{chunk-YKTVK6XM.js → chunk-Y6HRTEDD.js} +1 -1
  42. package/dist/chunks/{chunk-2KW7AI6P.js → chunk-YFDKTTYX.js} +8 -5
  43. package/dist/chunks/{chunk-HKW5FYZR.js → chunk-YLPGCOAM.js} +76 -69
  44. package/dist/chunks/{chunk-LQLIXBJF.js → chunk-YXIPZFMX.js} +1 -1
  45. package/dist/chunks/{cli-JDTWQDDR.js → cli-VCQIDBDQ.js} +37 -37
  46. package/dist/chunks/{commands-J52MJ6NF.js → commands-THGXVOEL.js} +9 -5
  47. package/dist/chunks/{conflict-O4FXUTIX.js → conflict-T7URCNS6.js} +2 -2
  48. package/dist/chunks/{contract-GW7US3UF.js → contract-ZLGLQ45G.js} +3 -3
  49. package/dist/chunks/{cowork-GZDODGKF.js → cowork-2MBNOUYS.js} +21 -8
  50. package/dist/chunks/{create-flow-YIFMKM2C.js → create-flow-OFZC36MV.js} +6 -6
  51. package/dist/chunks/{data-HTQZRPPI.js → data-6O7ANJVT.js} +3 -3
  52. package/dist/chunks/{ebuilder-form-GHNIZ7ET.js → ebuilder-form-OJ3KJVQI.js} +4 -4
  53. package/dist/chunks/{ehr-7TGZTZR3.js → ehr-NWMI5Q7S.js} +4 -4
  54. package/dist/chunks/{employee-QX57HEWS.js → employee-O2EPUYIH.js} +2 -2
  55. package/dist/chunks/{entry-mode-X3KKRN36.js → entry-mode-TVACGU7K.js} +3 -3
  56. package/dist/chunks/{env-MCVDVISU.js → env-EWG4ZAWP.js} +2 -2
  57. package/dist/chunks/{esb-ATRKVHCD.js → esb-56FV2PIA.js} +5 -5
  58. package/dist/chunks/{factory-ALB7DMVY.js → factory-GQSEJRDY.js} +1 -1
  59. package/dist/chunks/{fna-IKYI3SST.js → fna-YLA3RKRW.js} +3 -3
  60. package/dist/chunks/{group-chat-GGPL2EBF.js → group-chat-5R6L3LCG.js} +3 -3
  61. package/dist/chunks/{host-UY4LQPN4.js → host-42MLO4KX.js} +4 -4
  62. package/dist/chunks/{host-XXGDQM7D.js → host-J72VEDW5.js} +4 -4
  63. package/dist/chunks/{host-EJSJSLVK.js → host-QKCRQS2C.js} +4 -4
  64. package/dist/chunks/{host-EYNLB6S4.js → host-W3BVEATN.js} +4 -4
  65. package/dist/chunks/{host-OT4KNR3G.js → host-YJINI5GG.js} +4 -4
  66. package/dist/chunks/{host-6UOXYOOY.js → host-ZVGBZOHY.js} +4 -4
  67. package/dist/chunks/{hrm-5JQ7QZ6A.js → hrm-3JFZNB42.js} +66 -26
  68. package/dist/chunks/{im-2YJW3EI5.js → im-HKIRPCGD.js} +5 -5
  69. package/dist/chunks/{invoice-36BCXKOX.js → invoice-4PREIOTG.js} +80 -17
  70. package/dist/chunks/{jiuchuanhui-KBWUZ7WT.js → jiuchuanhui-K3PLNENZ.js} +3 -3
  71. package/dist/chunks/{lazy-dispatch-ZDKLS5MR.js → lazy-dispatch-MKGEWZNM.js} +8 -8
  72. package/dist/chunks/{mail-YBKUM6HM.js → mail-6QPVWKXM.js} +3 -3
  73. package/dist/chunks/{meeting-MU3RHAEX.js → meeting-QPPEPBSN.js} +15 -15
  74. package/dist/chunks/{minute-doc-NHIEZEHU.js → minute-doc-JMIDZK5D.js} +1 -1
  75. package/dist/chunks/{okr-HW7IULIR.js → okr-67C5LQYD.js} +3 -3
  76. package/dist/chunks/{operations-4P2UYVLH.js → operations-YLKRNAPI.js} +5 -5
  77. package/dist/chunks/{org-MWWIFNAO.js → org-L5XDM2RQ.js} +2 -2
  78. package/dist/chunks/{performance-PM2G6L3E.js → performance-33QZZR4I.js} +3 -3
  79. package/dist/chunks/{plan-3YYGZ7ZM.js → plan-W4BPONRL.js} +3 -3
  80. package/dist/chunks/{project-6PRGBLO2.js → project-OKSEH6AF.js} +3 -3
  81. package/dist/chunks/{reception-7G3J2MA6.js → reception-H5M7SPHT.js} +3 -3
  82. package/dist/chunks/{recruit-stage-5KK7R37U.js → recruit-stage-O2JGNVMO.js} +12 -8
  83. package/dist/chunks/{registry-4S3RXXWS.js → registry-45VEUYTC.js} +4 -4
  84. package/dist/chunks/{registry-3VTB3KLV.js → registry-BMTQ55G5.js} +5 -5
  85. package/dist/chunks/{registry-KQ4TNUWO.js → registry-PYONXFUF.js} +3 -3
  86. package/dist/chunks/{registry-HWUNNXDU.js → registry-SAMJ4VH2.js} +14 -14
  87. package/dist/chunks/{registry-AC33ZZVH.js → registry-YY62OFKQ.js} +1 -1
  88. package/dist/chunks/{room-recommend-V4BSHR2M.js → room-recommend-NRLAZJCI.js} +4 -4
  89. package/dist/chunks/{schedule-T7W357TN.js → schedule-LNBOCBP5.js} +4 -4
  90. package/dist/chunks/{smart-extract-T5Z4AULN.js → smart-extract-JOTX6UZC.js} +3 -3
  91. package/dist/chunks/{update-77ZUIYSG.js → update-BERR64TI.js} +3 -3
  92. package/dist/chunks/{workflow-SYCBS5XD.js → workflow-ZDQY3TI7.js} +5 -5
  93. package/dist/core/runtime-agent.js +19 -3
  94. package/dist/index.js +4 -4
  95. package/dist/internal/e10/auth/agent-host-key.js +10 -1
  96. package/dist/internal/e10/auth/commands.js +20 -4
  97. package/dist/internal/e10/auth/xiaoe.js +15 -3
  98. package/dist/shortcuts/asset/host.js +39 -1
  99. package/dist/shortcuts/asset/index.js +16 -2
  100. package/dist/shortcuts/asset/manifest.js +115 -1
  101. package/dist/shortcuts/asset/operations/audit-report.js +144 -0
  102. package/dist/shortcuts/asset/operations/registry.js +4 -0
  103. package/dist/shortcuts/asset/operations/write.js +7 -1
  104. package/dist/shortcuts/cowork/operations/read.js +13 -6
  105. package/dist/shortcuts/cowork/operations/shared.js +15 -0
  106. package/dist/shortcuts/hrm/host.js +51 -4
  107. package/dist/shortcuts/hrm/index.js +45 -26
  108. package/dist/shortcuts/hrm/manifest.js +17 -0
  109. package/dist/shortcuts/hrm/operations/employee.js +3 -7
  110. package/dist/shortcuts/hrm/operations/org.js +2 -4
  111. package/dist/shortcuts/hrm/operations/position.js +2 -4
  112. package/dist/shortcuts/hrm/operations/shared.js +21 -0
  113. package/dist/shortcuts/hrm/operations.js +34 -0
  114. package/dist/shortcuts/im/constants.js +163 -0
  115. package/dist/shortcuts/im/host.js +12 -5
  116. package/dist/shortcuts/im/operations/at-mention.js +4 -2
  117. package/dist/shortcuts/im/operations/file-user.js +3 -1
  118. package/dist/shortcuts/im/operations/msg-sync.js +219 -2
  119. package/dist/shortcuts/im/operations/msg-write.js +70 -30
  120. package/dist/shortcuts/invoice/invoice-record.js +4 -0
  121. package/dist/shortcuts/invoice/manifest.js +1 -1
  122. package/dist/shortcuts/invoice/operations/reim-auto.js +10 -7
  123. package/dist/shortcuts/invoice/read-enrichment.js +74 -7
  124. package/dist/shortcuts/meeting/operations/eb/create-flow.js +1 -1
  125. package/dist/shortcuts/meeting/operations/rooms.js +7 -0
  126. package/dist/shortcuts/recruit-stage/operations/list.js +3 -2
  127. package/dist/shortcuts/recruit-stage/operations/profile.js +3 -2
  128. package/dist/shortcuts/recruit-stage/operations/search.js +2 -2
  129. package/dist/shortcuts/recruit-stage/operations/shortlist.js +3 -2
  130. package/dist/shortcuts/recruit-stage/operations/tag.js +5 -0
  131. package/dist/shortcuts/workflow/operations/form.js +2 -1
  132. package/docs/agent-invoice.md +1 -1
  133. package/docs/e10-auth.md +14 -1
  134. package/docs/hrm.md +5 -1
  135. package/docs/invoice.md +1 -1
  136. package/docs/ziguanjia.md +5 -1
  137. package/package.json +1 -1
  138. package/skill-template/business-info.json +6 -1
  139. package/skill-template/domains/hrm.md +1 -1
  140. package/skill-template/domains/yepiaotong.md +1 -1
  141. package/skill-template/domains/ziguanjia.md +7 -2
  142. package/skills/weaver-e10-cowork/SKILL.md +13 -1
  143. package/skills/weaver-e10-hrm/SKILL.md +16 -2
  144. package/skills/weaver-e10-hrm/references/org.md +1 -1
  145. package/skills/weaver-e10-meeting/SKILL.md +1 -1
  146. package/skills/weaver-e10-recruit-stage/SKILL.md +24 -15
  147. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +14 -7
  148. package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +12 -1
  149. package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +18 -1
  150. package/skills/weaver-e10-recruit-stage/lib/resume-import-once.mjs +308 -0
  151. package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +9 -4
  152. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +54 -15
  153. package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +456 -93
  154. package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +2 -2
  155. package/skills/weaver-e10-shared/SKILL.md +1 -1
  156. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +1 -1
  157. package/skills/weaver-e10-shared-report.html +874 -0
  158. package/skills/weaver-e10-workflow/SKILL.md +4 -4
  159. package/skills/weaver-e10-workflow/aiDeepRead/config.json +138 -142
  160. package/skills/weaver-e10-workflow/references/workflow-deep-read.md +7 -7
  161. package/skills/weaver-e10-yepiaotong/SKILL.md +2 -2
  162. package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +1 -1
  163. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +1 -1
  164. package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +5 -3
  165. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +1 -1
  166. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +1 -1
  167. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +34 -32
  168. package/skills/weaver-e10-yepiaotong.zip +0 -0
  169. package/skills/weaver-e10-yimiaoban/SKILL.md +12 -9
  170. package/skills/weaver-e10-yimiaoban/references/constants.md +291 -0
  171. package/skills/weaver-e10-yimiaoban/references/ding-write.md +1 -0
  172. package/skills/weaver-e10-yimiaoban/references/group-read.md +1 -0
  173. package/skills/weaver-e10-yimiaoban/references/group-write.md +1 -0
  174. package/skills/weaver-e10-yimiaoban/references/msg-read.md +10 -1
  175. package/skills/weaver-e10-yimiaoban/references/msg-write.md +3 -1
  176. package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +1 -0
  177. package/skills/weaver-e10-yimiaoban/references/source-manifest.json +175 -36
  178. package/skills/weaver-e10-ziguanjia/SKILL.md +26 -6
  179. package/skills/weaver-e10-ziguanjia/references/source-manifest.json +1373 -96
  180. package/skills/weaver-e10-ziguanjia/references/ziguanjia-audit.md +63 -0
  181. package/skills/weaver-e10-ziguanjia/references/ziguanjia-disabled-capabilities.md +5 -1
  182. package/skills/weaver-e10-ziguanjia/references/ziguanjia-idle.md +52 -0
  183. package/skills/weaver-e10-ziguanjia/references/ziguanjia-report.md +59 -0
  184. package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
  185. package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
  186. package/scripts/pysite/__pycache__/sitecustomize.cpython-314.pyc +0 -0
@@ -1585,6 +1585,179 @@ function extractQuoteSummary(msgObj) {
1585
1585
  };
1586
1586
  }
1587
1587
 
1588
+ // src/shortcuts/im/constants.ts
1589
+ var MSG_KIND = {
1590
+ TXT_NORMAL: 1001,
1591
+ TXT_LINK: 1002,
1592
+ TXT_AT: 1003,
1593
+ HISTORY: 1004,
1594
+ TXT_GRAY: 1005,
1595
+ ANNOUNCE: 1006,
1596
+ PIC: 2001,
1597
+ EMOJI: 2002,
1598
+ VOICE: 3001,
1599
+ FILE: 4001,
1600
+ LOCAL: 5001,
1601
+ VIDEO: 6001,
1602
+ TOPIC: 6002,
1603
+ BIDA: 6003,
1604
+ NOTICE: 7e3,
1605
+ ITEM: 8e3,
1606
+ IMG_TXT: 9e3,
1607
+ SEQUENCE: 9001,
1608
+ RICH_TXT: 9002
1609
+ };
1610
+ var MSG_KIND_NAME = {
1611
+ 1001: "\u6587\u5B57",
1612
+ 1002: "\u94FE\u63A5",
1613
+ 1003: "@\u6D88\u606F",
1614
+ 1004: "\u804A\u5929\u8BB0\u5F55",
1615
+ 1005: "\u7070\u8272\u6D88\u606F",
1616
+ 1006: "\u516C\u544A",
1617
+ 2001: "\u56FE\u7247",
1618
+ 2002: "\u8868\u60C5",
1619
+ 3001: "\u8BED\u97F3",
1620
+ 4001: "\u6587\u4EF6",
1621
+ 5001: "\u4F4D\u7F6E",
1622
+ 6001: "\u89C6\u9891",
1623
+ 6002: "\u8BDD\u9898",
1624
+ 6003: "\u5FC5\u8FBE",
1625
+ 7e3: "\u901A\u77E5\u63D0\u9192",
1626
+ 8e3: "\u4E8B\u9879",
1627
+ 9e3: "\u56FE\u6587\u94FE\u63A5",
1628
+ 9001: "\u7FA4\u63A5\u9F99",
1629
+ 9002: "\u5BCC\u6587\u672C"
1630
+ };
1631
+ var MKIND = {
1632
+ TXT_NORMAL: 1,
1633
+ // 1<<0
1634
+ TXT_LINK: 2,
1635
+ // 1<<1
1636
+ TXT_AT: 4,
1637
+ // 1<<2
1638
+ HISTORY: 8,
1639
+ // 1<<3
1640
+ TXT_GRAY: 16,
1641
+ // 1<<4
1642
+ ANNOUNCE: 32,
1643
+ // 1<<5
1644
+ PIC: 64,
1645
+ // 1<<6
1646
+ EMOJI: 128,
1647
+ // 1<<7
1648
+ VOICE: 256,
1649
+ // 1<<8
1650
+ FILE: 512,
1651
+ // 1<<9
1652
+ LOCAL: 1024,
1653
+ // 1<<10
1654
+ VIDEO: 2048,
1655
+ // 1<<11
1656
+ TOPIC: 4096,
1657
+ // 1<<12
1658
+ BIDA: 8192,
1659
+ // 1<<13
1660
+ NOTICE: 16384,
1661
+ // 1<<14
1662
+ ITEM: 32768,
1663
+ // 1<<15
1664
+ IMG_TXT: 65536,
1665
+ // 1<<16
1666
+ SEQUENCE: 131072,
1667
+ // 1<<17
1668
+ RICH_TXT: 262144
1669
+ // 1<<18
1670
+ };
1671
+ var MKIND_TO_KIND = [
1672
+ [MKIND.TXT_NORMAL, MSG_KIND.TXT_NORMAL],
1673
+ [MKIND.TXT_LINK, MSG_KIND.TXT_LINK],
1674
+ [MKIND.TXT_AT, MSG_KIND.TXT_AT],
1675
+ [MKIND.HISTORY, MSG_KIND.HISTORY],
1676
+ [MKIND.TXT_GRAY, MSG_KIND.TXT_GRAY],
1677
+ [MKIND.ANNOUNCE, MSG_KIND.ANNOUNCE],
1678
+ [MKIND.PIC, MSG_KIND.PIC],
1679
+ [MKIND.EMOJI, MSG_KIND.EMOJI],
1680
+ [MKIND.VOICE, MSG_KIND.VOICE],
1681
+ [MKIND.FILE, MSG_KIND.FILE],
1682
+ [MKIND.LOCAL, MSG_KIND.LOCAL],
1683
+ [MKIND.VIDEO, MSG_KIND.VIDEO],
1684
+ [MKIND.TOPIC, MSG_KIND.TOPIC],
1685
+ [MKIND.BIDA, MSG_KIND.BIDA],
1686
+ [MKIND.NOTICE, MSG_KIND.NOTICE],
1687
+ [MKIND.ITEM, MSG_KIND.ITEM],
1688
+ [MKIND.IMG_TXT, MSG_KIND.IMG_TXT],
1689
+ [MKIND.SEQUENCE, MSG_KIND.SEQUENCE],
1690
+ [MKIND.RICH_TXT, MSG_KIND.RICH_TXT]
1691
+ ];
1692
+ function mkindToKindList(mkind) {
1693
+ const out = [];
1694
+ if (!mkind) return out;
1695
+ for (const [mask, kind] of MKIND_TO_KIND) {
1696
+ if ((mkind & mask) === mask) out.push(kind);
1697
+ }
1698
+ return out;
1699
+ }
1700
+ var DING_SOURCE_TYPE = {
1701
+ 4: { mkind: MKIND.FILE, tag: "2" },
1702
+ // 文件
1703
+ 2: { mkind: MKIND.PIC, tag: "0" },
1704
+ // 图片
1705
+ 7: { mkind: MKIND.VIDEO, tag: "1" }
1706
+ // 视频
1707
+ };
1708
+ var DING_SOURCE_DEFAULT = { mkind: MKIND.TXT_NORMAL, tag: "3" };
1709
+ var SYSMSG_GROUP_BITS = {
1710
+ groupName: 1 << 1,
1711
+ imgid: 1 << 3,
1712
+ ext: 1 << 8,
1713
+ i18nName: 1 << 11,
1714
+ enable: 1 << 12,
1715
+ top: 1 << 13,
1716
+ remind: 1 << 14,
1717
+ clear: 1 << 15,
1718
+ unread: 1 << 16,
1719
+ sunread: 1 << 18,
1720
+ action: 1 << 19,
1721
+ describe: 1 << 20,
1722
+ link: 1 << 21,
1723
+ terminal: 1 << 22,
1724
+ subscript: 1 << 23,
1725
+ ssource: 1 << 24,
1726
+ saddr: 1 << 25,
1727
+ scycle: 1 << 26,
1728
+ sshow: 1 << 27,
1729
+ mark: 1 << 28,
1730
+ defmark: 1 << 29,
1731
+ id18nDesc: 1 << 30,
1732
+ application: 1 << 31,
1733
+ markSeq: 1 << 32,
1734
+ pcLink: 1 << 33,
1735
+ pageOpen: 1 << 34,
1736
+ viewScope: 1 << 35,
1737
+ order: 1 << 36,
1738
+ ignore: 1 << 37,
1739
+ jumpAll: 1 << 38,
1740
+ showType: 1 << 39,
1741
+ moduleTag: 1 << 40,
1742
+ delSession: 1 << 44,
1743
+ initSession: 1 << 45,
1744
+ location: 1 << 46,
1745
+ locInfo: 1 << 47,
1746
+ pcLocInfo: 1 << 48,
1747
+ hideSender: 1 << 49
1748
+ };
1749
+ var SYSMSG_TYPE_BITS = {
1750
+ typeName: 1 << 1,
1751
+ imgid: 1 << 2,
1752
+ lt: 1 << 3,
1753
+ lu: 1 << 4,
1754
+ ht: 1 << 5,
1755
+ url: 1 << 6,
1756
+ ext: 1 << 7,
1757
+ i18nName: 1 << 8,
1758
+ tab: 1 << 9
1759
+ };
1760
+
1588
1761
  // src/shortcuts/im/operations/msg-sync.ts
1589
1762
  var MAX_MSG_ID = String((1n << 63n) - 1n);
1590
1763
  function resolveRange(args, idKeys = { start: "start", end: "end" }) {
@@ -1708,11 +1881,11 @@ async function enrichMessages(rawRows, host, options = {}) {
1708
1881
  fileId: f.fileId,
1709
1882
  name: f.name,
1710
1883
  size: f.size,
1884
+ // 文件原文下载:kind='file'(不带 type=imgs/imgFormat),否则 e-cology 等环境会返回图片预览页而非原文
1711
1885
  downloadUrl: await host.buildDownloadUrl({
1712
1886
  fileId: f.fileId,
1713
1887
  msgid: String(row.ser_msgid ?? ""),
1714
- kind: "img",
1715
- imgFormat,
1888
+ kind: "file",
1716
1889
  ...options.groupId ? { groupId: options.groupId } : {},
1717
1890
  ...options.user ? { user: options.user } : {}
1718
1891
  })
@@ -1736,6 +1909,8 @@ async function enrichMessages(rawRows, host, options = {}) {
1736
1909
  must: parsed.must,
1737
1910
  fileName: parsed.fileName,
1738
1911
  media,
1912
+ ...row.kind !== void 0 && row.kind !== null && Number(row.kind) > 0 ? { kind: Number(row.kind), kindName: MSG_KIND_NAME[Number(row.kind)] } : {},
1913
+ ...row.mkind !== void 0 && row.mkind !== null && Number(row.mkind) > 0 ? { mkind: Number(row.mkind), mkindKinds: mkindToKindList(Number(row.mkind)).map((k) => ({ kind: k, name: MSG_KIND_NAME[k] })) } : {},
1739
1914
  ...msgObj ? { msg: msgObj } : {}
1740
1915
  });
1741
1916
  }
@@ -1893,6 +2068,187 @@ var msgSyncGroup = {
1893
2068
  });
1894
2069
  }
1895
2070
  };
2071
+ var msgSyncGroupByKind = {
2072
+ name: "im.msg.sync.groupByKind",
2073
+ resource: "msg",
2074
+ method: "msg.sync.groupByKind",
2075
+ action: "im.msg.sync.groupByKind",
2076
+ summary: "\u6309\u6D88\u606F kind \u8FC7\u6EE4\u62C9\u53D6\u67D0\u7FA4\u6D88\u606F\uFF08\u5982\u56FE\u7247/\u6587\u4EF6/\u6587\u672C\uFF1B\u670D\u52A1\u7AEF\u6309 kind \u8FC7\u6EE4\uFF0C\u54CD\u5E94\u5E26 kind/mkind\uFF09",
2077
+ capability: "msg",
2078
+ risk: READ,
2079
+ inputSchema: schemaOf({
2080
+ groupId: { type: "string", pattern: "^\\d+$", description: "\u7FA4 id\uFF08\u5FC5\u586B\uFF09" },
2081
+ kind: { type: "integer", minimum: 1, description: "\u6D88\u606F kind \u5355\u503C\uFF08\u5FC5\u586B\uFF09\uFF0C\u5982 1001 \u6587\u672C/2001 \u56FE\u7247/4001 \u6587\u4EF6/6001 \u89C6\u9891\uFF1B\u89C1 constants.md" },
2082
+ num: { type: "integer", minimum: 1, maximum: 50, description: "\u6BCF\u9875\u6570\u91CF\uFF08\u9ED8\u8BA4 50\uFF0C\u6700\u591A 50\uFF09" },
2083
+ latest: { type: "boolean", description: "\u62C9\u6700\u65B0\u4E0D\u9650\u65E5\u671F\uFF08\u65E0\u754C\u533A\u95F4\uFF0C\u53EA\u62C9\u4E00\u9875\uFF09" },
2084
+ from: { type: "string", description: "\u8D77\u59CB\u65F6\u95F4\uFF1B\u8DE8\u5EA6 > 7 \u5929\u81EA\u52A8\u6536\u655B\u4E3A\u8BE5\u8303\u56F4\u6700\u540E 7 \u5929" },
2085
+ to: { type: "string", description: "\u7ED3\u675F\u65F6\u95F4\uFF08\u540C\u4E0A\uFF09" },
2086
+ startId: { type: "string", description: "\u663E\u5F0F\u8D77\u59CB\u6D88\u606F id\uFF08\u6700\u9AD8\u4F18\u5148\uFF09" },
2087
+ endId: { type: "string", description: "\u663E\u5F0F\u7ED3\u675F\u6D88\u606F id" },
2088
+ imgFormat: { type: "string", enum: ["small", "large", "original"], description: "\u9884\u89C8\u89C4\u683C\uFF08\u9ED8\u8BA4 small\uFF09" }
2089
+ }, { required: ["groupId", "kind"], description: "\u6309 kind \u8FC7\u6EE4\u62C9\u53D6\u7FA4\u6D88\u606F" }),
2090
+ handler: async (args, { host }) => {
2091
+ const groupId = String(args.groupId);
2092
+ if (!groupId || groupId === "0") throw imValidationError("id_invalid", "groupId \u5FC5\u987B\u975E 0");
2093
+ const kind = Number(args.kind);
2094
+ if (!Number.isInteger(kind) || kind <= 0) throw imValidationError("kind_invalid", "kind \u5FC5\u987B\u662F\u6B63\u6574\u6570\uFF08\u5982 2001 \u56FE\u7247\uFF09");
2095
+ const { start, end, scope, shrink } = resolveRange(args, { start: "startId", end: "endId" });
2096
+ const num = pageSizeOf(args);
2097
+ const autoLoop = end !== "0";
2098
+ let actCode = 0;
2099
+ const pulled = await pullPaged({
2100
+ num,
2101
+ start,
2102
+ end,
2103
+ autoLoop,
2104
+ requestOnePage: async (pageStart, pageEnd, maxNum) => {
2105
+ const body = {
2106
+ trans_id: 0,
2107
+ dev: 4,
2108
+ type: 0,
2109
+ enc_type: 0,
2110
+ group_id: groupId,
2111
+ start: pageStart,
2112
+ end: pageEnd,
2113
+ max_num: maxNum,
2114
+ kind,
2115
+ history: false
2116
+ };
2117
+ const res = await host.request({
2118
+ method: "POST",
2119
+ path: "/api/em/msg/executeIm/group/syncGroupMsgByKind",
2120
+ body,
2121
+ operation: "im.msg.sync.groupByKind"
2122
+ });
2123
+ actCode = Number(res?.data?.actionMsg?.code ?? -1);
2124
+ if (actCode === 1303) return [];
2125
+ assertImOk(res, "\u6309 kind \u62C9\u53D6\u7FA4\u6D88\u606F");
2126
+ const inner = unwrapInner(res);
2127
+ const flat = inner?.datas;
2128
+ if (Array.isArray(flat)) {
2129
+ if (flat.length && Array.isArray(flat[0]?.datas)) return flat.flatMap((g) => g.datas ?? []);
2130
+ return flat;
2131
+ }
2132
+ const outerDatas = inner?.data?.datas ?? [];
2133
+ const rows = [];
2134
+ for (const g of outerDatas) {
2135
+ const list = g?.datas ?? g?.data ?? [];
2136
+ if (Array.isArray(list)) rows.push(...list);
2137
+ }
2138
+ return rows;
2139
+ }
2140
+ });
2141
+ const authUid = await resolveAuthUid(host);
2142
+ const messages = await enrichMessages(pulled.rows, host, {
2143
+ authUid,
2144
+ groupId,
2145
+ imgFormat: args.imgFormat
2146
+ });
2147
+ sortMessagesNewestFirst(messages);
2148
+ return imSuccess("im.msg.sync.groupByKind", {
2149
+ groupId,
2150
+ kind,
2151
+ kindName: MSG_KIND_NAME[kind],
2152
+ total: messages.length,
2153
+ messages,
2154
+ range: { from: args.from, to: args.to, start, end, scope, autoPaged: autoLoop },
2155
+ ...paginationMeta(pulled, num),
2156
+ ...shrink ? { rangeShrink: rangeShrinkMeta(shrink) } : {},
2157
+ ...actCode === 1303 ? { empty: true, emptyReason: emptyPageNote(args) } : {}
2158
+ });
2159
+ }
2160
+ };
2161
+ var msgSyncSingleByKind = {
2162
+ name: "im.msg.sync.singleByKind",
2163
+ resource: "msg",
2164
+ method: "msg.sync.singleByKind",
2165
+ action: "im.msg.sync.singleByKind",
2166
+ summary: "\u6309\u6D88\u606F kind \u8FC7\u6EE4\u62C9\u53D6\u4E0E\u67D0\u4EBA\u7684\u5355\u804A\u6D88\u606F\uFF08\u5982\u56FE\u7247/\u6587\u4EF6/\u6587\u672C\uFF1B\u54CD\u5E94\u5E26 kind/mkind\uFF09",
2167
+ capability: "msg",
2168
+ risk: READ,
2169
+ inputSchema: schemaOf({
2170
+ fromUid: { type: "string", pattern: "^\\d+$", description: "\u5BF9\u65B9 uid\uFF08\u5FC5\u586B\uFF09" },
2171
+ fromCid: { type: "string", pattern: "^\\d+$", description: "\u5BF9\u65B9 cid\uFF08\u5FC5\u586B\uFF09" },
2172
+ kind: { type: "integer", minimum: 1, description: "\u6D88\u606F kind \u5355\u503C\uFF08\u5FC5\u586B\uFF09\uFF0C\u5982 1001 \u6587\u672C/2001 \u56FE\u7247/4001 \u6587\u4EF6/6001 \u89C6\u9891\uFF1B\u89C1 constants.md" },
2173
+ num: { type: "integer", minimum: 1, maximum: 50, description: "\u6BCF\u9875\u6570\u91CF\uFF08\u9ED8\u8BA4 50\uFF0C\u6700\u591A 50\uFF09" },
2174
+ latest: { type: "boolean", description: "\u62C9\u6700\u65B0\u4E0D\u9650\u65E5\u671F\uFF08\u65E0\u754C\u533A\u95F4\uFF0C\u53EA\u62C9\u4E00\u9875\uFF09" },
2175
+ from: { type: "string", description: "\u8D77\u59CB\u65F6\u95F4\uFF1B\u8DE8\u5EA6 > 7 \u5929\u81EA\u52A8\u6536\u655B\u4E3A\u8BE5\u8303\u56F4\u6700\u540E 7 \u5929" },
2176
+ to: { type: "string", description: "\u7ED3\u675F\u65F6\u95F4\uFF08\u540C\u4E0A\uFF09" },
2177
+ start: { type: "string", description: "\u663E\u5F0F\u8D77\u59CB\u6D88\u606F id\uFF08\u6700\u9AD8\u4F18\u5148\uFF09" },
2178
+ end: { type: "string", description: "\u663E\u5F0F\u7ED3\u675F\u6D88\u606F id" },
2179
+ imgFormat: { type: "string", enum: ["small", "large", "original"], description: "\u9884\u89C8\u89C4\u683C\uFF08\u9ED8\u8BA4 small\uFF09" }
2180
+ }, { required: ["fromUid", "fromCid", "kind"], description: "\u6309 kind \u8FC7\u6EE4\u62C9\u53D6\u5355\u804A\u6D88\u606F" }),
2181
+ handler: async (args, { host }) => {
2182
+ const fromUid = String(args.fromUid);
2183
+ const fromCid = String(args.fromCid);
2184
+ if (!fromUid || !fromCid || fromUid === "0" || fromCid === "0") {
2185
+ throw imValidationError("id_invalid", "fromUid/fromCid \u5FC5\u987B\u975E 0");
2186
+ }
2187
+ const kind = Number(args.kind);
2188
+ if (!Number.isInteger(kind) || kind <= 0) throw imValidationError("kind_invalid", "kind \u5FC5\u987B\u662F\u6B63\u6574\u6570\uFF08\u5982 2001 \u56FE\u7247\uFF09");
2189
+ const { start, end, scope, shrink } = resolveRange(args);
2190
+ const num = pageSizeOf(args);
2191
+ const autoLoop = end !== "0";
2192
+ let actCode = 0;
2193
+ const pulled = await pullPaged({
2194
+ num,
2195
+ start,
2196
+ end,
2197
+ autoLoop,
2198
+ requestOnePage: async (pageStart, pageEnd, maxNum) => {
2199
+ const body = {
2200
+ trans_id: 0,
2201
+ dev: 4,
2202
+ tuser: { cid: fromCid, uid: fromUid },
2203
+ start: pageStart,
2204
+ end: pageEnd,
2205
+ kind,
2206
+ maxNum,
2207
+ encType: 0
2208
+ };
2209
+ const res = await host.request({
2210
+ method: "POST",
2211
+ path: "/api/em/msg/executeIm/single/syncSingleMsgByKind",
2212
+ body,
2213
+ operation: "im.msg.sync.singleByKind"
2214
+ });
2215
+ actCode = Number(res?.data?.actionMsg?.code ?? -1);
2216
+ if (actCode === 1303) return [];
2217
+ assertImOk(res, "\u6309 kind \u62C9\u53D6\u5355\u804A\u6D88\u606F");
2218
+ const inner = unwrapInner(res);
2219
+ const flat = inner?.datas;
2220
+ if (Array.isArray(flat)) {
2221
+ if (flat.length && Array.isArray(flat[0]?.datas)) return flat.flatMap((g) => g.datas ?? []);
2222
+ return flat;
2223
+ }
2224
+ const outerDatas = inner?.data?.datas ?? [];
2225
+ const rows = [];
2226
+ for (const g of outerDatas) {
2227
+ const list = g?.datas ?? g?.data ?? [];
2228
+ if (Array.isArray(list)) rows.push(...list);
2229
+ }
2230
+ return rows;
2231
+ }
2232
+ });
2233
+ const authUid = await resolveAuthUid(host);
2234
+ const messages = await enrichMessages(pulled.rows, host, {
2235
+ authUid,
2236
+ user: { cid: fromCid, uid: fromUid },
2237
+ imgFormat: args.imgFormat
2238
+ });
2239
+ sortMessagesNewestFirst(messages);
2240
+ return imSuccess("im.msg.sync.singleByKind", {
2241
+ total: messages.length,
2242
+ kind,
2243
+ kindName: MSG_KIND_NAME[kind],
2244
+ messages,
2245
+ range: { from: args.from, to: args.to, start, end, scope, autoPaged: autoLoop },
2246
+ ...paginationMeta(pulled, num),
2247
+ ...shrink ? { rangeShrink: rangeShrinkMeta(shrink) } : {},
2248
+ ...actCode === 1303 ? { empty: true, emptyReason: emptyPageNote(args) } : {}
2249
+ });
2250
+ }
2251
+ };
1896
2252
  var msgTopSync = {
1897
2253
  name: "im.msg.top.sync",
1898
2254
  resource: "msg",
@@ -2087,6 +2443,8 @@ var msgReadGroupDetail = {
2087
2443
  var msgReadOperations = [
2088
2444
  msgSyncSingle,
2089
2445
  msgSyncGroup,
2446
+ msgSyncGroupByKind,
2447
+ msgSyncSingleByKind,
2090
2448
  msgTopSync,
2091
2449
  msgReadSingle,
2092
2450
  msgReadGroup,
@@ -2177,13 +2535,13 @@ function buildAtText(text, entries) {
2177
2535
  const aus = [...used, ...rest];
2178
2536
  return { v, aus };
2179
2537
  }
2180
- function buildAtMsgJson(v, aus, self, extra = {}, txtExtra = {}) {
2538
+ function buildAtMsgJson(v, aus, self, extra = {}, txtExtra = {}, mediaSegs = []) {
2181
2539
  return JSON.stringify({
2182
2540
  bgc: "",
2183
2541
  cnt: "0",
2184
2542
  dev: 5,
2185
2543
  display: "",
2186
- dt: [{ txt: { aus, ft: "china", next: "0", v, ...txtExtra } }],
2544
+ dt: [{ txt: { aus, ft: "china", next: "0", v, ...txtExtra } }, ...mediaSegs],
2187
2545
  guid: "0",
2188
2546
  idx: "0",
2189
2547
  opb: ["received", "reply"],
@@ -2243,6 +2601,7 @@ var sendSinglePair = makeWritePair({
2243
2601
  if (quote && !content.txt) {
2244
2602
  throw imValidationError("quote_requires_txt", "quoteMsgId \u4EC5\u652F\u6301\u6587\u672C\u6D88\u606F\uFF08txt\uFF09");
2245
2603
  }
2604
+ const richCombo = Boolean(content.txt) && Boolean(content.imgPath || content.filePath) && !content.markdown;
2246
2605
  const summary = {
2247
2606
  action: "\u53D1\u9001\u5355\u804A\u6D88\u606F",
2248
2607
  toUid,
@@ -2250,7 +2609,8 @@ var sendSinglePair = makeWritePair({
2250
2609
  hasTxt: Boolean(content.txt),
2251
2610
  hasImg: Boolean(content.imgPath),
2252
2611
  hasFile: Boolean(content.filePath),
2253
- ...content.markdown ? { contentFormat: "markdown" } : {}
2612
+ ...content.markdown ? { contentFormat: "markdown" } : {},
2613
+ ...richCombo ? { contentType: "rich", note: "\u6587\u672C+\u5A92\u4F53\u5C06\u4EE5 type=26 \u5BCC\u6587\u672C\u4E00\u6761\u53D1\u51FA\uFF08dt \u542B txt \u6BB5\u4E0E\u5A92\u4F53\u6BB5\uFF09" } : {}
2254
2614
  };
2255
2615
  const snapshot = { toUid, toCid };
2256
2616
  if (content.txt) {
@@ -2280,7 +2640,20 @@ var sendSinglePair = makeWritePair({
2280
2640
  const quoteRef = plan.quoteRef ?? null;
2281
2641
  const txtExtra = plan.markdown ? { vt: "1" } : {};
2282
2642
  const markdownTypeExtra = plan.markdown ? { type: "26" } : {};
2283
- if (quoteRef) {
2643
+ const richCombo = plan.txt !== void 0 && (plan.imgPath || plan.filePath) && !plan.markdown;
2644
+ if (richCombo) {
2645
+ const self = await env.host.getSelfIdentity();
2646
+ const mediaSegs = [];
2647
+ if (plan.imgPath) {
2648
+ const fileObj = await env.host.uploadFile(plan.imgPath, { shareUsers: plan.toUid });
2649
+ mediaSegs.push({ img: fileObjToImg(fileObj) });
2650
+ }
2651
+ if (plan.filePath) {
2652
+ const fileObj = await env.host.uploadFile(plan.filePath, { shareUsers: plan.toUid });
2653
+ mediaSegs.push({ file: fileObjToFile(fileObj) });
2654
+ }
2655
+ body.msg = buildAtMsgJson(String(plan.txt), [], self, { ...quoteRef ? { ref: quoteRef } : {}, type: "26" }, {}, mediaSegs);
2656
+ } else if (quoteRef) {
2284
2657
  const self = await env.host.getSelfIdentity();
2285
2658
  body.msg = buildAtMsgJson(String(plan.txt ?? ""), [], self, { ref: quoteRef, ...markdownTypeExtra }, txtExtra);
2286
2659
  } else if (plan.txt !== void 0) {
@@ -2291,13 +2664,15 @@ var sendSinglePair = makeWritePair({
2291
2664
  body.txt = plan.txt;
2292
2665
  }
2293
2666
  }
2294
- if (plan.imgPath) {
2295
- const fileObj = await env.host.uploadFile(plan.imgPath, { shareUsers: plan.toUid });
2296
- body.img = fileObjToImg(fileObj);
2297
- }
2298
- if (plan.filePath) {
2299
- const fileObj = await env.host.uploadFile(plan.filePath, { shareUsers: plan.toUid });
2300
- body.file = fileObjToFile(fileObj);
2667
+ if (!richCombo) {
2668
+ if (plan.imgPath) {
2669
+ const fileObj = await env.host.uploadFile(plan.imgPath, { shareUsers: plan.toUid });
2670
+ body.img = fileObjToImg(fileObj);
2671
+ }
2672
+ if (plan.filePath) {
2673
+ const fileObj = await env.host.uploadFile(plan.filePath, { shareUsers: plan.toUid });
2674
+ body.file = fileObjToFile(fileObj);
2675
+ }
2301
2676
  }
2302
2677
  const res = await env.host.request({
2303
2678
  method: "POST",
@@ -2306,7 +2681,7 @@ var sendSinglePair = makeWritePair({
2306
2681
  operation: "im.msg.send.single"
2307
2682
  });
2308
2683
  assertImOk(res, "\u53D1\u9001\u5355\u804A\u6D88\u606F");
2309
- return { toUid: plan.toUid, toCid: plan.toCid, sent: true };
2684
+ return { toUid: plan.toUid, toCid: plan.toCid, sent: true, contentType: richCombo ? "rich" : void 0 };
2310
2685
  }
2311
2686
  });
2312
2687
  var sendGroupPair = makeWritePair({
@@ -2323,7 +2698,8 @@ var sendGroupPair = makeWritePair({
2323
2698
  if (quote && !content.txt) {
2324
2699
  throw imValidationError("quote_requires_txt", "quoteMsgId/replyMsgId \u4EC5\u652F\u6301\u6587\u672C\u6D88\u606F\uFF08txt\uFF09");
2325
2700
  }
2326
- const summary = { action: "\u53D1\u9001\u7FA4\u804A\u6D88\u606F", groupId, hasTxt: Boolean(content.txt), hasImg: Boolean(content.imgPath), hasFile: Boolean(content.filePath), ...content.markdown ? { contentFormat: "markdown" } : {} };
2701
+ const richCombo = Boolean(content.txt) && Boolean(content.imgPath || content.filePath) && !content.markdown;
2702
+ const summary = { action: "\u53D1\u9001\u7FA4\u804A\u6D88\u606F", groupId, hasTxt: Boolean(content.txt), hasImg: Boolean(content.imgPath), hasFile: Boolean(content.filePath), ...content.markdown ? { contentFormat: "markdown" } : {}, ...richCombo ? { contentType: "rich", note: "\u6587\u672C+\u5A92\u4F53\u5C06\u4EE5 type=26 \u5BCC\u6587\u672C\u4E00\u6761\u53D1\u51FA\uFF08dt \u542B txt \u6BB5\u4E0E\u5A92\u4F53\u6BB5\uFF09" } : {} };
2327
2703
  const snapshot = { groupId };
2328
2704
  if (content.txt) {
2329
2705
  snapshot.txt = content.txt;
@@ -2357,7 +2733,21 @@ var sendGroupPair = makeWritePair({
2357
2733
  const quoteRef = plan.quoteRef ?? null;
2358
2734
  const txtExtra = plan.markdown ? { vt: "1" } : {};
2359
2735
  const markdownTypeExtra = plan.markdown ? { type: "26" } : {};
2360
- if (atEntries.length || quoteRef) {
2736
+ const richCombo = plan.txt !== void 0 && (plan.imgPath || plan.filePath) && !plan.markdown;
2737
+ if (richCombo) {
2738
+ const { v, aus } = buildAtText(String(plan.txt), atEntries);
2739
+ const self = await env.host.getSelfIdentity();
2740
+ const mediaSegs = [];
2741
+ if (plan.imgPath) {
2742
+ const fileObj = await env.host.uploadFile(plan.imgPath, { shareGroups: plan.groupId });
2743
+ mediaSegs.push({ img: fileObjToImg(fileObj) });
2744
+ }
2745
+ if (plan.filePath) {
2746
+ const fileObj = await env.host.uploadFile(plan.filePath, { shareGroups: plan.groupId });
2747
+ mediaSegs.push({ file: fileObjToFile(fileObj) });
2748
+ }
2749
+ body.msg = buildAtMsgJson(v, aus, self, { ...quoteRef ? { [plan.quoteKind === "reply" ? "rmsg" : "ref"]: quoteRef } : {}, type: "26" }, {}, mediaSegs);
2750
+ } else if (atEntries.length || quoteRef) {
2361
2751
  const { v, aus } = buildAtText(String(plan.txt ?? ""), atEntries);
2362
2752
  const self = await env.host.getSelfIdentity();
2363
2753
  body.msg = buildAtMsgJson(v, aus, self, { ...quoteRef ? { [plan.quoteKind === "reply" ? "rmsg" : "ref"]: quoteRef } : {}, ...markdownTypeExtra }, txtExtra);
@@ -2369,13 +2759,15 @@ var sendGroupPair = makeWritePair({
2369
2759
  body.txt = plan.txt;
2370
2760
  }
2371
2761
  }
2372
- if (plan.imgPath) {
2373
- const fileObj = await env.host.uploadFile(plan.imgPath, { shareGroups: plan.groupId });
2374
- body.img = fileObjToImg(fileObj);
2375
- }
2376
- if (plan.filePath) {
2377
- const fileObj = await env.host.uploadFile(plan.filePath, { shareGroups: plan.groupId });
2378
- body.file = fileObjToFile(fileObj);
2762
+ if (!richCombo) {
2763
+ if (plan.imgPath) {
2764
+ const fileObj = await env.host.uploadFile(plan.imgPath, { shareGroups: plan.groupId });
2765
+ body.img = fileObjToImg(fileObj);
2766
+ }
2767
+ if (plan.filePath) {
2768
+ const fileObj = await env.host.uploadFile(plan.filePath, { shareGroups: plan.groupId });
2769
+ body.file = fileObjToFile(fileObj);
2770
+ }
2379
2771
  }
2380
2772
  const res = await env.host.request({
2381
2773
  method: "POST",
@@ -2384,7 +2776,7 @@ var sendGroupPair = makeWritePair({
2384
2776
  operation: "im.msg.send.group"
2385
2777
  });
2386
2778
  assertImOk(res, "\u53D1\u9001\u7FA4\u804A\u6D88\u606F");
2387
- return { groupId: plan.groupId, sent: true };
2779
+ return { groupId: plan.groupId, sent: true, contentType: richCombo ? "rich" : void 0 };
2388
2780
  }
2389
2781
  });
2390
2782
  function findWithdrawTimeOut(value) {
@@ -2466,7 +2858,7 @@ var withdrawPair = makeWritePair({
2466
2858
  if (actCode === 1505) {
2467
2859
  throw imValidationError(
2468
2860
  "withdraw_timeout",
2469
- `\u64A4\u9500\u8D85\u65F6${interval ? `\uFF08\u64A4\u56DE\u65F6\u9650 ${interval}\uFF09` : "\uFF08\u53D1\u51FA\u8D85\u8FC7\u7EA6 2 \u5206\u949F\uFF09"}\uFF1A\u6D88\u606F\u53D1\u9001\u5DF2\u8D85\u8FC7\u53EF\u64A4\u56DE\u65F6\u9650\uFF0C\u65E0\u6CD5\u64A4\u56DE`,
2861
+ `\u64A4\u9500\u8D85\u65F6${interval ? `\uFF08\u64A4\u56DE\u65F6\u9650 ${interval}\uFF09` : ""}\uFF1A\u6D88\u606F\u53D1\u9001\u5DF2\u8D85\u8FC7\u53EF\u64A4\u56DE\u65F6\u9650\uFF0C\u65E0\u6CD5\u64A4\u56DE\uFF08\u65F6\u9650\u56E0\u73AF\u5883\u800C\u5F02\uFF0C\u4EE5\u6B63\u5E38\u64A4\u56DE\u65F6\u56DE\u5305 withdrawInterval \u4E3A\u51C6\uFF09`,
2470
2862
  { code: 1505, details: interval ? { withdrawInterval: interval } : void 0 }
2471
2863
  );
2472
2864
  }
@@ -2661,28 +3053,23 @@ var dingSendPair = makeWritePair({
2661
3053
  let tag;
2662
3054
  let titleDt;
2663
3055
  const nm = msgObj.dt?.[0]?.file?.nm || msgObj.dt?.[0]?.img?.nm || msgObj.dt?.[0]?.media?.nm || "";
3056
+ const src = DING_SOURCE_TYPE[mtype] || DING_SOURCE_DEFAULT;
3057
+ mkind = src.mkind;
3058
+ tag = src.tag;
2664
3059
  if (mtype === 4) {
2665
- tag = "2";
2666
3060
  content = `[\u6587\u4EF6]${nm}`;
2667
- mkind = 512;
2668
3061
  titleDt = [{ txt: { v: nm } }];
2669
3062
  fileIds = String(msgObj.dt?.[0]?.file?.id || "");
2670
3063
  } else if (mtype === 2) {
2671
- tag = "0";
2672
3064
  content = "[\u56FE\u7247]";
2673
- mkind = 64;
2674
3065
  titleDt = [];
2675
3066
  fileIds = String(msgObj.dt?.[0]?.img?.src || msgObj.dt?.[0]?.img?.id || "");
2676
3067
  } else if (mtype === 7) {
2677
- tag = "1";
2678
3068
  content = "[\u89C6\u9891]";
2679
- mkind = 2048;
2680
3069
  titleDt = [];
2681
3070
  fileIds = String(msgObj.dt?.[0]?.media?.src || msgObj.dt?.[0]?.media?.id || "");
2682
3071
  } else {
2683
- tag = "3";
2684
3072
  content = msgObj.dt?.[0]?.txt?.v || "";
2685
- mkind = 1;
2686
3073
  titleDt = [{ txt: { v: content } }];
2687
3074
  }
2688
3075
  msgEntity = JSON.stringify({ ...msgObj, tf: "1" });
@@ -2690,7 +3077,7 @@ var dingSendPair = makeWritePair({
2690
3077
  extraInfo = JSON.stringify({ msgSource: { source: { tag, msgid: String(plan.convertMsgid), flag: plan.groupId ? 1 : 0, ...plan.groupId ? { group_id: plan.groupId } : { user: { cid: plan.toCid, uid: plan.toUid } } } } });
2691
3078
  } else {
2692
3079
  content = plan.txt;
2693
- mkind = 1;
3080
+ mkind = MKIND.TXT_NORMAL;
2694
3081
  const mdType = plan.markdown ? "26" : "1";
2695
3082
  const txtSeg = plan.markdown ? { v: plan.txt, vt: "1", next: "0", ft: "china" } : { v: plan.txt, next: "0", ft: "china" };
2696
3083
  msgEntity = JSON.stringify({
@@ -2810,7 +3197,7 @@ var msgWriteOps = [
2810
3197
  img: { type: "string", description: "\u672C\u5730\u56FE\u7247\u8DEF\u5F84" },
2811
3198
  file: { type: "string", description: "\u672C\u5730\u6587\u4EF6\u8DEF\u5F84" }
2812
3199
  }, sendGroupPair, { required: ["groupId"], requiredAny: ["txt", "img", "file"] }),
2813
- ...buildMsgWriteDefinition("im.msg.withdraw", "msg.withdraw", "\u64A4\u56DE\u6D88\u606F\uFF08\u5355\u804A/\u7FA4\u804A\uFF0C\u9650\u672C\u4EBA 2 \u5206\u949F\u5185\uFF09", {
3200
+ ...buildMsgWriteDefinition("im.msg.withdraw", "msg.withdraw", "\u64A4\u56DE\u6D88\u606F\uFF08\u5355\u804A/\u7FA4\u804A\uFF0C\u4EC5\u9650\u672C\u4EBA\u6D88\u606F\uFF0C\u65F6\u9650\u4EE5\u56DE\u5305 withdrawInterval \u4E3A\u51C6\uFF09", {
2814
3201
  type: { type: "string", enum: ["single", "group"], description: "single \u6216 group" },
2815
3202
  msgid: { type: "string", pattern: "^\\d+$", description: "\u6D88\u606F id\uFF08ser_msgid\uFF09" },
2816
3203
  toUid: { type: "string", pattern: "^\\d+$", description: "\u5355\u804A\uFF1A\u5BF9\u65B9 uid" },
@@ -3447,7 +3834,7 @@ var fileDownload = {
3447
3834
  const fileId = String(args.fileId ?? "");
3448
3835
  const msgid = String(args.msgid ?? "");
3449
3836
  const kindRaw = String(args.kind ?? "img");
3450
- const kind = kindRaw === "video" ? "video" : "img";
3837
+ const kind = kindRaw === "video" ? "video" : kindRaw === "file" ? "file" : "img";
3451
3838
  const output = String(args.output ?? "").trim();
3452
3839
  if (!output) throw imValidationError("output_required", "output \u5FC5\u987B\u662F\u660E\u786E\u7684\u672C\u5730\u6587\u4EF6\u8DEF\u5F84");
3453
3840
  const groupId = args.groupId !== void 0 && args.groupId !== "" ? String(args.groupId) : void 0;