k2-im 0.1.28 → 0.1.30

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/index.js CHANGED
@@ -1 +1 @@
1
- import'./chunk-IDECJJXC.js';import'./chunk-SXY56EVC.js';export{p as DEFAULT_LOADING_MINIMUM_VISIBLE_MS,o as DEFAULT_LOADING_SHOW_DELAY_MS,d as MINI_PROGRAM_LANG_NUMBERS,H as SPIKE_STEP,D as calculateMediaBox,s as canPromoteMediaPresentationSource,u as captureRuntimeClientOperation,t as captureRuntimeOperation,m as channelMiniProgramRelKey,q as createDelayedLoadingIndicator,B as createLinkMatcher,e as csvIncludes,c as decideChannelMiniProgramRelOpen,F as formatFileSize,E as formatMediaDuration,G as getFileExtension,A as hasLinkCandidate,y as highlightSegments,v as mediaService,z as normalizeLinkHref,K as placeholderWaveform,w as readService,J as resampleWaveform,r as resolveBestMediaPresentationSource,g as resolveChannelMiniProgramRelIcon,f as resolveChannelMiniProgramRelName,i as resolveChannelMiniProgramRelOpenSurface,h as resolveChannelMiniProgramRelUrl,j as resolveChannelPinnedGameCopy,n as resolveConversationListPresentation,C as resolveMediaPresentation,b as resolveMiniProgramFloatLinkUrl,a as resolveMiniProgramOpenUrl,x as resolveQuotedMessagePresentation,l as resolveVisibleChannelMiniProgramRels,k as sortChannelMiniProgramFloatingItems,I as spikeCountForDuration}from'./chunk-D2FFU7J5.js';export{j as DEFAULT_EMOJI_ASSET_BASE,i as EMOJI_CATALOG,c as EMOJI_GAME_DICE_STABLE_KEY,b as EMOJI_GAME_RPS_STABLE_KEY,m as EMOJI_TOKEN_RE,L as MAX_BATCH_FILES,a as MAX_RECENT_EMOJI_COUNT,g as UNICODE_EMOJI_CATALOG,K as blockReasonForChannelSession,J as blockReasonForChannelState,R as blockReasonForGroupState,U as blockReasonForSession,E as canEditMessage,u as canPinChannelMessage,t as canPinGroupMessage,v as canPinMessage,D as canRecallMessage,ba as cancelMediaUpload,P as classifyGifFile,O as classifyMediaFile,s as createChatRuntime,p as createEmojiMatcher,G as decideConversationAction,I as decideMemberTargetAction,H as decideMessageAction,l as emojiAssetUrl,n as emojiUrlByCode,Ba as fetchConversationFileBatch,Ca as fetchConversationImageBatch,za as fetchConversationMessageBatch,Da as fetchConversationVideoBatch,Ea as fetchConversationVoiceBatch,Fa as fetchNextConversationSearchBatch,ea as forwardService,o as hasEmojiCandidate,Q as isGifFile,w as isPinnedMessageProtected,Y as isVoiceStorageConfigured,M as mediaBatchBudgetBytes,ja as messageService,e as parseUnicodeEmojiCode,oa as pinnedMessageService,d as prependRecentEmoji,ya as profileService,X as replaceInterruptedMediaFile,S as requiresConversationEncryption,z as resolveChannelMemberAvatarUrl,y as resolveChannelMemberDisplayName,k as resolveEmojiToken,C as resolveFriendDisplayName,pa as resolveImProfileAccessDestination,x as resolveMemberDisplayName,r as resolveMessageNotificationDecision,B as resolvePublicNickname,A as resolveSenderAvatarUrl,q as resolveStandaloneEmojiMessage,h as resolveUnicodeEmoji,ca as retryMessage,N as runMediaSendBatch,aa as sendAsFilesBatch,F as sendBlockReasonForDecision,_ as sendMediaAlbum,W as sendMediaFile,$ as sendMediaFilesBatch,V as sendText,Z as sendVoice,T as supportsConversationMention,f as unicodeEmojiTextFromCode}from'./chunk-H7AM5DTT.js';export{C as createNewMessageBadgeController,i as createThreadItems,f as formatChatDateSeparator,e as formatConversationDisplayTime,c as getLocalDayKey,l as isMessageLocateScrollProtected,v as isMessageTailChangeFromOlderWindowTrim,k as isMessageViewportMeasurable,B as isMessageVisibleForNewMessageBadge,x as loadOlderUntilBoundary,p as refreshPrependMessageAnchorPosition,j as resolveCenteredMessageScrollTop,a as resolveDisplayTimestamp,g as resolveImThreadActiveDate,h as resolveMessageBodyKind,b as resolveMessageTimelineTimestamp,n as resolvePrependMessageAnchor,q as resolvePrependMessageAnchorAdjustment,o as resolvePrependMessageAnchorPosition,s as resolveSurvivingMessageAnchorAdjustment,r as resolveVisibleMessageAnchorPositions,t as shouldCompleteInitialViewport,y as shouldFillInitialHistoryViewport,u as shouldFollowIncomingMessage,z as shouldLoadNewerHistoryPage,m as shouldPrefetchOlderHistory,w as shouldRestoreMessageViewportFocus,d as shouldShowChatDateSeparator,A as shouldTrackRemoteMessageForBadge}from'./chunk-YUPKU2L7.js';export{a as DEFAULT_LOCALE,k as createImI18n,f as formatFailure,h as formatLastMessageSummary,i as formatMediaPlaceholder,j as formatMentionAll,l as formatServiceText,g as formatSystemMessage,c as getImTimeCatalog,b as normalizeImLocale,d as registerImCatalogOverrides,e as resetImCatalogOverrides}from'./chunk-BIFDS3MH.js';export{e as IMAGE_MESSAGE_ACCEPT,n as IM_CHAT_FONT_SCALES,g as IM_DIAGNOSTIC_CATEGORIES,j as IM_EMOJI_CATALOG,c as ImPinnedMessageOperationError,m as buildSessionFavoritePlainBody,d as createFaceToFaceGroupQrPayload,o as createImClient,h as createImConsoleDiagnosticSink,r as createImDiagnosticMemoryBuffer,i as createSdkDiagnosticWriter,f as isSupportedImageFile,a as migrateImCachePrefix,k as resolveImEmojiToken,l as resolveSessionFavoriteKindFromMessage}from'./chunk-DVQGXZ6S.js';export{Ra as MediaTransferError,$a as createVoicePlayer,ab as createVoiceRecordingSession,Za as detectVoiceCapabilities,Sa as mediaTransferErrorCodeOf,Ta as normalizeMediaUploadCredentials,_a as voiceErrorCodeOf}from'./chunk-FQJBDSXT.js';export{na as EDIT_WINDOW_MS,o as MEDIA_ALBUM_CAPTION_MAX_LENGTH,p as MEDIA_ALBUM_MAX_ITEMS,va as REACTION_SUPPORTED_CONTENT_TYPES,wa as canReactToMessage,ra as canTransmit,pa as canTransmitByType,qa as canTransmitContent,s as classifyStickerImageType,ca as createImTextSearchMatcher,aa as extractSearchText,ba as getImTextSearchInitial,ob as parseSessionFavoriteAlbumItems,oa as requiresForwardTypeConfirmation,ya as resolveChannelAccess,q as resolveMediaAlbumSendContentType,pb as resolveSessionFavoriteAlbumCaption,nb as resolveSessionFavoriteAlbumItemPreviewUrl,ha as resolveTextSegments,Fa as sortSessions,Ga as sumSessionsUnread}from'./chunk-O7GQQMEW.js';import'./chunk-WOT6VMZA.js';
1
+ import'./chunk-IDECJJXC.js';import'./chunk-SXY56EVC.js';export{p as DEFAULT_LOADING_MINIMUM_VISIBLE_MS,o as DEFAULT_LOADING_SHOW_DELAY_MS,d as MINI_PROGRAM_LANG_NUMBERS,I as SPIKE_STEP,E as calculateMediaBox,s as canPromoteMediaPresentationSource,v as captureRuntimeClientOperation,u as captureRuntimeOperation,m as channelMiniProgramRelKey,t as createConversationPrefetchController,q as createDelayedLoadingIndicator,C as createLinkMatcher,e as csvIncludes,c as decideChannelMiniProgramRelOpen,G as formatFileSize,F as formatMediaDuration,H as getFileExtension,B as hasLinkCandidate,z as highlightSegments,w as mediaService,A as normalizeLinkHref,L as placeholderWaveform,x as readService,K as resampleWaveform,r as resolveBestMediaPresentationSource,g as resolveChannelMiniProgramRelIcon,f as resolveChannelMiniProgramRelName,i as resolveChannelMiniProgramRelOpenSurface,h as resolveChannelMiniProgramRelUrl,j as resolveChannelPinnedGameCopy,n as resolveConversationListPresentation,D as resolveMediaPresentation,b as resolveMiniProgramFloatLinkUrl,a as resolveMiniProgramOpenUrl,y as resolveQuotedMessagePresentation,l as resolveVisibleChannelMiniProgramRels,k as sortChannelMiniProgramFloatingItems,J as spikeCountForDuration}from'./chunk-XA4W5PWT.js';export{j as DEFAULT_EMOJI_ASSET_BASE,i as EMOJI_CATALOG,c as EMOJI_GAME_DICE_STABLE_KEY,b as EMOJI_GAME_RPS_STABLE_KEY,m as EMOJI_TOKEN_RE,N as MAX_BATCH_FILES,a as MAX_RECENT_EMOJI_COUNT,g as UNICODE_EMOJI_CATALOG,M as blockReasonForChannelSession,L as blockReasonForChannelState,T as blockReasonForGroupState,W as blockReasonForSession,G as canEditMessage,w as canPinChannelMessage,v as canPinGroupMessage,x as canPinMessage,F as canRecallMessage,da as cancelMediaUpload,R as classifyGifFile,Q as classifyMediaFile,s as countUnreadConversations,u as createChatRuntime,p as createEmojiMatcher,I as decideConversationAction,K as decideMemberTargetAction,J as decideMessageAction,l as emojiAssetUrl,n as emojiUrlByCode,Da as fetchConversationFileBatch,Ea as fetchConversationImageBatch,Ba as fetchConversationMessageBatch,Fa as fetchConversationVideoBatch,Ga as fetchConversationVoiceBatch,Ha as fetchNextConversationSearchBatch,r as formatConversationUnreadBadge,ga as forwardService,o as hasEmojiCandidate,S as isGifFile,y as isPinnedMessageProtected,_ as isVoiceStorageConfigured,O as mediaBatchBudgetBytes,la as messageService,e as parseUnicodeEmojiCode,qa as pinnedMessageService,d as prependRecentEmoji,Aa as profileService,Z as replaceInterruptedMediaFile,U as requiresConversationEncryption,B as resolveChannelMemberAvatarUrl,A as resolveChannelMemberDisplayName,k as resolveEmojiToken,E as resolveFriendDisplayName,ra as resolveImProfileAccessDestination,z as resolveMemberDisplayName,t as resolveMessageNotificationDecision,D as resolvePublicNickname,C as resolveSenderAvatarUrl,q as resolveStandaloneEmojiMessage,h as resolveUnicodeEmoji,ea as retryMessage,P as runMediaSendBatch,ca as sendAsFilesBatch,H as sendBlockReasonForDecision,aa as sendMediaAlbum,Y as sendMediaFile,ba as sendMediaFilesBatch,X as sendText,$ as sendVoice,V as supportsConversationMention,f as unicodeEmojiTextFromCode}from'./chunk-VRGWQLDM.js';export{C as createNewMessageBadgeController,i as createThreadItems,f as formatChatDateSeparator,e as formatConversationDisplayTime,c as getLocalDayKey,l as isMessageLocateScrollProtected,v as isMessageTailChangeFromOlderWindowTrim,k as isMessageViewportMeasurable,B as isMessageVisibleForNewMessageBadge,x as loadOlderUntilBoundary,p as refreshPrependMessageAnchorPosition,j as resolveCenteredMessageScrollTop,a as resolveDisplayTimestamp,g as resolveImThreadActiveDate,h as resolveMessageBodyKind,b as resolveMessageTimelineTimestamp,n as resolvePrependMessageAnchor,q as resolvePrependMessageAnchorAdjustment,o as resolvePrependMessageAnchorPosition,s as resolveSurvivingMessageAnchorAdjustment,r as resolveVisibleMessageAnchorPositions,t as shouldCompleteInitialViewport,y as shouldFillInitialHistoryViewport,u as shouldFollowIncomingMessage,z as shouldLoadNewerHistoryPage,m as shouldPrefetchOlderHistory,w as shouldRestoreMessageViewportFocus,d as shouldShowChatDateSeparator,A as shouldTrackRemoteMessageForBadge}from'./chunk-SLFKCTEX.js';export{a as DEFAULT_LOCALE,k as createImI18n,f as formatFailure,h as formatLastMessageSummary,i as formatMediaPlaceholder,j as formatMentionAll,l as formatServiceText,g as formatSystemMessage,c as getImTimeCatalog,b as normalizeImLocale,d as registerImCatalogOverrides,e as resetImCatalogOverrides}from'./chunk-37HOEWMF.js';export{e as IMAGE_MESSAGE_ACCEPT,n as IM_CHAT_FONT_SCALES,g as IM_DIAGNOSTIC_CATEGORIES,j as IM_EMOJI_CATALOG,c as ImPinnedMessageOperationError,m as buildSessionFavoritePlainBody,d as createFaceToFaceGroupQrPayload,o as createImClient,h as createImConsoleDiagnosticSink,r as createImDiagnosticMemoryBuffer,s as createImResourceUploader,i as createSdkDiagnosticWriter,f as isSupportedImageFile,a as migrateImCachePrefix,k as resolveImEmojiToken,l as resolveSessionFavoriteKindFromMessage}from'./chunk-MNWNUGIV.js';export{Sa as MediaTransferError,bb as createVoicePlayer,cb as createVoiceRecordingSession,$a as detectVoiceCapabilities,Ta as mediaTransferErrorCodeOf,Ua as normalizeMediaUploadCredentials,ab as voiceErrorCodeOf}from'./chunk-GHZUH7RB.js';export{pa as EDIT_WINDOW_MS,o as MEDIA_ALBUM_CAPTION_MAX_LENGTH,p as MEDIA_ALBUM_MAX_ITEMS,xa as REACTION_SUPPORTED_CONTENT_TYPES,ya as canReactToMessage,ta as canTransmit,ra as canTransmitByType,sa as canTransmitContent,s as classifyStickerImageType,ea as createImTextSearchMatcher,ca as extractSearchText,da as getImTextSearchInitial,qb as parseSessionFavoriteAlbumItems,qa as requiresForwardTypeConfirmation,Aa as resolveChannelAccess,q as resolveMediaAlbumSendContentType,rb as resolveSessionFavoriteAlbumCaption,pb as resolveSessionFavoriteAlbumItemPreviewUrl,ja as resolveTextSegments,Ha as sortSessions,Ia as sumSessionsUnread}from'./chunk-4KPJTXQN.js';import'./chunk-WOT6VMZA.js';
package/dist/sdk.d.ts CHANGED
@@ -1,5 +1,13 @@
1
1
  /** 媒体业务类型:实现据此选对象存储逻辑桶;sticker 对应 app-sticker。 */
2
2
  type MediaKind = 'image' | 'video' | 'voice' | 'file' | 'sticker';
3
+ /** 传输进度(上传/下载共用)。percent=0-100 整数(UI 进度环);字节数供精确展示。 */
4
+ interface MediaTransferProgress {
5
+ percent: number;
6
+ bytesTransferred: number;
7
+ bytesTotal: number;
8
+ /** 上传专用阶段;finalizing 表示请求体已发完、正在等待对象存储成功响应。下载可省略。 */
9
+ phase?: 'transferring' | 'finalizing';
10
+ }
3
11
 
4
12
  /** 会话类型。P0 只用 direct / group。 */
5
13
  type ConversationType = 'direct' | 'group' | 'channel' | 'supergroup';
@@ -39,8 +47,8 @@ interface ConversationDraft$1 {
39
47
  attachments: readonly [];
40
48
  updatedAt: number;
41
49
  }
42
- /** 消息内容类型。sticker=表情/贴图(BMessage contentType=7);call=单聊通话记录(contentType=10);transfer=转账(contentType=16);miniProgram=小程序分享卡(contentType=22);redPacket=红包卡(contentType=25);game=小游戏(contentType=27);未知 wire 正文统一归一为 unknown。 */
43
- type MessageContentType = 'text' | 'system' | 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'contact' | 'miniProgram' | 'game' | 'transfer' | 'call' | 'redPacket' | 'mediaAlbum' | 'unknown';
50
+ /** 消息内容类型。sticker=表情/贴图(BMessage contentType=7);call=单聊通话记录(contentType=10);transfer=转账(contentType=16);robot=机器人卡片(contentType=18);miniProgram=小程序分享卡(contentType=22);redPacket=红包卡(contentType=25);game=小游戏(contentType=27);未知 wire 正文统一归一为 unknown。 */
51
+ type MessageContentType = 'text' | 'system' | 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'contact' | 'miniProgram' | 'game' | 'transfer' | 'call' | 'redPacket' | 'mediaAlbum' | 'robot' | 'unknown';
44
52
  /**
45
53
  * 发送态(客户端态):消息从本地创建到服务端确认的生命周期。
46
54
  * `uploading` 仅媒体消息使用:文件上传阶段(uploading→pending→sending→sent);
@@ -102,6 +110,8 @@ type LastMessageSummary = {
102
110
  kind: 'contact';
103
111
  } | {
104
112
  kind: 'miniProgram';
113
+ } | {
114
+ kind: 'robot';
105
115
  } | {
106
116
  kind: 'game';
107
117
  gameType: ImGameType;
@@ -136,6 +146,13 @@ type LastMessageSummary = {
136
146
  firstItemKind?: 'image' | 'video';
137
147
  } | {
138
148
  kind: 'encrypted';
149
+ }
150
+ /**
151
+ * 密文解密失败/缺密钥占位。必须独立于 `encrypted`:后者只表示「还是密文」,
152
+ * 前者要对齐 iOS 解密失败长文案,不能再伪装成「[加密消息]」。
153
+ */
154
+ | {
155
+ kind: 'decrypt-failed';
139
156
  } | {
140
157
  kind: 'recalled';
141
158
  by: string;
@@ -190,8 +207,12 @@ interface ImVideoBody {
190
207
  thumbData?: Uint8Array;
191
208
  /** 视频文件 MD5(BMessage.MD5;Android 当前未赋值,保留可选)。 */
192
209
  md5?: string;
193
- /** 文件大小(字节;协议 BMessage.fileLength 单位 KB,mapping 层换算)。 */
210
+ /** 已确认的视频大小(字节),来自本地文件或合集;历史单视频的大小单位不明确时省略,下载总量由 HTTP 响应确定。 */
194
211
  size?: number;
212
+ /** SDK 本地字节值标记,供持久化读取区分旧版本曾按 KB 换算的记录。 */
213
+ sizeUnit?: 'bytes';
214
+ /** 未确认单位的历史大小,十进制无符号整数;SDK 仅用于原样转发,宿主不得将它用于显示大小或规划下载。 */
215
+ unverifiedFileLength?: string;
195
216
  /** 视频描述(BMessage.describe,可选)。 */
196
217
  describe?: string;
197
218
  /** 文件解密 TEA key 原始字节(仅密文视频有;接收端解 BContent 后从 BMessage.teaKey 得,用于解下载到的原视频文件)。 */
@@ -326,6 +347,53 @@ interface ImMiniProgramBody {
326
347
  /** 多语言子游戏名 JSON 字符串,例如 `{"ch":"...","en":"..."}`。 */
327
348
  subGameName?: string;
328
349
  }
350
+ /**
351
+ * 机器人卡片文本模块(wire `section`)。
352
+ *
353
+ * `content` 保留原文,可含 Markdown 链接与裸 URL;宿主负责展示层解析,不在 Core 拆成富文本树。
354
+ */
355
+ interface ImRobotTextModule {
356
+ type: 'section';
357
+ textType: string;
358
+ content: string;
359
+ }
360
+ /** 机器人卡片图片组;`src` 是明文 http(s),不走消息 TEA 文件通道。 */
361
+ interface ImRobotImageGroupModule {
362
+ type: 'image-group';
363
+ images: readonly string[];
364
+ }
365
+ /**
366
+ * 机器人卡片倒计时。
367
+ *
368
+ * `endTimeMs` 已归一为 epoch 毫秒;wire 秒/毫秒混用只在 mapper 转换,宿主不要再猜单位。
369
+ */
370
+ interface ImRobotCountdownModule {
371
+ type: 'countdown';
372
+ endTimeMs: number;
373
+ }
374
+ type ImRobotModule = ImRobotTextModule | ImRobotImageGroupModule | ImRobotCountdownModule;
375
+ /** 机器人卡片底部指令;`miniProgram` 仅打开小程序时存在。 */
376
+ interface ImRobotCommand {
377
+ menuName: string;
378
+ menuId?: string;
379
+ /** wire `msg_type`;`2` 表示打开小程序,其它走固定话术。第一期宿主可只展示。 */
380
+ messageType?: string;
381
+ miniProgram?: {
382
+ path?: string;
383
+ appId?: string;
384
+ domain?: string;
385
+ };
386
+ }
387
+ /**
388
+ * 机器人卡片正文(contentType==='robot',协议 BMessage.contentType=18)。
389
+ *
390
+ * @remarks 排版数据在 `BMessage.content` JSON。解析失败仍保留 robot 类型与空模块,
391
+ * 不能退化成 unknown——iOS 此时仍画出卡片头。divider 与未识别 module 在 mapper 丢弃。
392
+ */
393
+ interface ImRobotBody {
394
+ modules: readonly ImRobotModule[];
395
+ commands: readonly (readonly ImRobotCommand[])[];
396
+ }
329
397
  /** 转账状态。0 待领取 / 1 已收款 / 2 已退还 / 3 已过期(对齐 iOS IMTranferBody,过期 3 以客户端为准)。 */
330
398
  type ImTransferStatus = 0 | 1 | 2 | 3;
331
399
  /** 转账会话类型。1 个人 / 2 群(BMessage.sessionType)。 */
@@ -520,6 +588,8 @@ interface ImMessageBody {
520
588
  redPacket?: ImRedPacketBody;
521
589
  /** contentType==='mediaAlbum' 时的媒体合集正文(配文 + 1~9 个图片/视频项)。 */
522
590
  mediaAlbum?: ImMediaAlbumBody;
591
+ /** contentType==='robot' 时的机器人卡片。 */
592
+ robot?: ImRobotBody;
523
593
  /** contentType==='unknown' 时的稳定未知正文,不含原始 wire type。 */
524
594
  unknown?: UnknownMessageBody;
525
595
  }
@@ -596,7 +666,7 @@ interface ImMessageEncryption {
596
666
  encrypted: boolean;
597
667
  /** 扩展:加密方案标识,默认 'rsa-tea'。 */
598
668
  scheme?: 'rsa-tea';
599
- /** true=密文但解密失败/缺密钥(占位,非真实空正文):供 UI 显式「无法解密」提示,与明文空消息区分。 */
669
+ /** true=密文但解密失败/缺密钥(占位,非真实空正文):供 UI 显式渲染解密失败提示,与明文空消息、普通密文区分。 */
600
670
  decryptFailed?: boolean;
601
671
  }
602
672
  /** 单条消息领域模型(§4.1)。主键为客户端生成的 id(无 serverId)。 */
@@ -1427,6 +1497,10 @@ interface ImSessionFavoriteItem$1 {
1427
1497
  type ImEvent = {
1428
1498
  type: 'connection:changed';
1429
1499
  state: ImConnectionState;
1500
+ }
1501
+ /** 同账号已由另一个浏览器页面接管;本页会话不可复用,但宿主登录仍有效。 */
1502
+ | {
1503
+ type: 'session:replaced';
1430
1504
  } | {
1431
1505
  type: 'message:received';
1432
1506
  message: ImMessage;
@@ -2232,24 +2306,32 @@ interface MediaTransferAdapterConfig {
2232
2306
  /** 是否启用 S3 Transfer Acceleration(默认 true;`cn-` 分区没有加速端点,会强制关闭)。 */
2233
2307
  useAccelerateEndpoint?: boolean;
2234
2308
  /**
2235
- * 是否允许超过分片阈值(16MiB)的上传使用 S3 分片上传(默认 true)。
2309
+ * 统一允许 S3 分片上传和 Range 分段下载,默认 false(单次 PUT / 普通 GET)。
2310
+ * 显式 true 后仍按 16MiB 阈值及已确认下载大小选择策略,小资源不分片。
2311
+ * 开启前各桶须支持分片请求方法,并暴露上传 ETag、下载 Content-Range 与强 ETag。
2312
+ * @example { multipartTransfer: true } 同时允许大资源分片上传、下载。
2313
+ */
2314
+ multipartTransfer?: boolean;
2315
+ /**
2316
+ * 总开关开启后,是否允许超过分片阈值(16MiB)的上传使用 S3 分片上传。
2236
2317
  *
2237
2318
  * 分片相比单次 PUT 需要各物理桶的 CORS 额外放行 POST(Create/CompleteMultipartUpload)、
2238
2319
  * DELETE(AbortMultipartUpload)并 `ExposeHeaders: ETag`;未配齐时分片会直接失败。
2239
- * 部署可置 false 立即退回全量单次 PutObject(大文件回到单连接与整包内存的旧行为),无需发版。
2320
+ * @deprecated 优先使用 multipartTransfer 统一控制;本字段 false 仅进一步关闭上传,true 不能单独开启。
2240
2321
  */
2241
2322
  multipartUpload?: boolean;
2242
2323
  /**
2243
- * 大于 16MiB 的明文/simple 文件是否尝试 Range 并发下载(默认 true)。
2324
+ * 总开关开启后,大于 16MiB 的明文/simple 文件是否尝试 Range 并发下载。
2244
2325
  * 需要下载域名支持 Range,并暴露 Content-Range 与强 ETag;返回 200 时消费完整响应并记录诊断。
2245
- * 置 false 使用单次 GET。此开关不改变上传或整文件 TEA 的行为。
2326
+ * @deprecated 优先使用 multipartTransfer 统一控制;本字段 false 仅进一步关闭下载,true 不能单独开启。
2246
2327
  */
2247
2328
  rangeDownload?: boolean;
2248
2329
  /**
2249
- * 媒体发送阶段的并发上限;由 im-core 消费,adapter 本身仍只负责单个上传任务。
2330
+ * 媒体发送阶段的并发上限;由 im-core 消费,限制媒体任务数而非分片请求数。
2250
2331
  *
2251
- * 并发按媒体体积分两档:图片与不超过分片阈值(16 MiB)的小文件走单次 PutObject、不占分片缓冲,
2252
- * 缺省 5;视频与超过阈值(或字节数未知)的文件走分片,每路各带分片缓冲,缺省 3。
2332
+ * 并发按媒体体积分两档:不超过分片阈值(16 MiB)的非视频媒体走小文件档,
2333
+ * 缺省 5;视频与超过阈值(或字节数未知)的内容走大文件档,缺省 3。
2334
+ * 分档只限制媒体任务数;实际 PUT/UploadPart 另受 adapter 的六路数据请求限制。
2253
2335
  * 两档都只接受 1-6 的整数,超出范围由 core 显式报错。
2254
2336
  * - 传一个数字:所有媒体共用这一个并发数,与分档前的语义一致。
2255
2337
  * - 传 `{ total, largeFiles }`:显式分档,`largeFiles` 不得超过 `total`。
@@ -2269,6 +2351,7 @@ interface MediaTransferAdapterConfig {
2269
2351
  * - `credentials-request-failed`:宿主取凭证失败(网络、鉴权或业务码非成功);`cause` 保留宿主原始错误。
2270
2352
  * - `credentials-invalid`:凭证回包缺少必要字段或字段非法,不允许用半份凭证去签名。
2271
2353
  * - `upload-source-invalid`:上传内容既不是 `Uint8Array` 也不是 `Blob`(纯 JS 宿主绕过类型时的 fail-fast)。
2354
+ * - `upload-size-exceeded`:超过单次 PUT 或当前固定分片策略的大小上限,申请凭据前拒绝。
2272
2355
  * - `multipart-etag-missing`:分片响应读不到 ETag,**桶 CORS 缺 `ExposeHeaders: ETag`**,不是网络问题。
2273
2356
  * - `multipart-abort-failed`:分片失败后的 `AbortMultipartUpload` 清理本身失败,已上传分片可能残留并计费。
2274
2357
  * - `multipart-upload-failed`:分片上传因其它原因失败;`cause` 保留原始错误,消息列出分片对 CORS 的额外要求。
@@ -2276,7 +2359,7 @@ interface MediaTransferAdapterConfig {
2276
2359
  * - `download-object-changed`:分段之间的强 ETag 或总长度改变,拒绝混合不同文件版本。
2277
2360
  * - `download-range-failed`:下载返回非成功 HTTP 状态。
2278
2361
  */
2279
- type MediaTransferErrorCode = 'bucket-unconfigured' | 'credentials-provider-missing' | 'credentials-request-failed' | 'credentials-invalid' | 'upload-source-invalid' | 'multipart-etag-missing' | 'multipart-abort-failed' | 'multipart-upload-failed' | 'download-range-invalid' | 'download-object-changed' | 'download-range-failed';
2362
+ type MediaTransferErrorCode = 'bucket-unconfigured' | 'credentials-provider-missing' | 'credentials-request-failed' | 'credentials-invalid' | 'upload-source-invalid' | 'upload-size-exceeded' | 'multipart-etag-missing' | 'multipart-abort-failed' | 'multipart-upload-failed' | 'download-range-invalid' | 'download-object-changed' | 'download-range-failed';
2280
2363
  /** 媒体传输统一错误:携带稳定业务码 + 可选底层 cause(诊断用,永不携带凭证明文)。 */
2281
2364
  declare class MediaTransferError extends Error {
2282
2365
  readonly code: MediaTransferErrorCode;
@@ -3052,6 +3135,21 @@ interface ImContactApi extends ImDirectoryApi<'individual'> {
3052
3135
  deleteFriendship: (userId: string) => Promise<void>;
3053
3136
  }
3054
3137
 
3138
+ /** 后台最近页预取的取消条件;取消不影响正在复用同一请求的前台会话。 */
3139
+ interface ConversationPrefetchOptions {
3140
+ signal?: AbortSignal;
3141
+ }
3142
+ /**
3143
+ * 单个会话的后台预取结果。ready 只在完整页面已写入当前账号缓存后返回。
3144
+ * skipped 表示当前类型、权限、存储或预算不允许预取;失败不改变正常打开会话的行为。
3145
+ */
3146
+ interface ConversationPrefetchResult {
3147
+ ref: ConversationRef<'direct' | 'group' | 'channel'>;
3148
+ status: 'ready' | 'skipped' | 'failed' | 'cancelled';
3149
+ reason?: 'unsupported' | 'unavailable' | 'storage-unavailable' | 'budget' | 'page-too-large' | 'decrypt-failed' | 'invalidated' | 'cancelled';
3150
+ error?: ImSdkErrorShape;
3151
+ }
3152
+
3055
3153
  /**
3056
3154
  * 当前账号草稿的产品 DTO、跨组件 API 与 handle 绑定门面。
3057
3155
  * 草稿按复合会话身份串行持久化,SDK DomainState 是唯一真相;附件尚未闭合时非空输入明确拒绝。
@@ -3141,6 +3239,8 @@ interface ImConversationsApi {
3141
3239
  pullOffline: () => Promise<ImMessage[]>;
3142
3240
  /** 运行 direct/GROUP/CHANNEL sibling 离线同步。 */
3143
3241
  sync: () => Promise<void>;
3242
+ /** 静默准备最近页;结果成功表示当前账号缓存事务已提交。 */
3243
+ prefetchRecent: (refs: readonly ImSupportedConversationRef[], options?: ConversationPrefetchOptions) => Promise<readonly ConversationPrefetchResult[]>;
3144
3244
  /** 聚合总未读;默认排除 muted 会话。 */
3145
3245
  getTotalUnread: (options?: {
3146
3246
  includeMuted?: boolean;
@@ -3761,6 +3861,8 @@ type ConversationLastMessageSummary = {
3761
3861
  kind: 'contact';
3762
3862
  } | {
3763
3863
  kind: 'miniProgram';
3864
+ } | {
3865
+ kind: 'robot';
3764
3866
  } | {
3765
3867
  kind: 'transfer';
3766
3868
  } | {
@@ -3791,6 +3893,10 @@ type ConversationLastMessageSummary = {
3791
3893
  firstItemKind?: 'image' | 'video';
3792
3894
  } | {
3793
3895
  kind: 'encrypted';
3896
+ }
3897
+ /** 密文解密失败占位;与 `encrypted` 分开,列表走独立 iOS 长文案。 */
3898
+ | {
3899
+ kind: 'decrypt-failed';
3794
3900
  } | {
3795
3901
  kind: 'recalled';
3796
3902
  by: string;
@@ -3872,6 +3978,8 @@ interface ImConversationListApi extends ImConversationBackgroundApi {
3872
3978
  subscribe: (listener: (snapshot: ImConversationListSnapshot) => void) => () => void;
3873
3979
  /** 显式运行 direct/GROUP/CHANNEL sibling 同步;失败抛稳定产品错误并进入 error 快照。 */
3874
3980
  refresh: () => Promise<void>;
3981
+ /** 静默预取各会话最近一页;不激活线程,ready 只表示持久缓存已完成。 */
3982
+ prefetchRecent: (refs: readonly ConversationRef<ProductConversationListType>[], options?: ConversationPrefetchOptions) => Promise<readonly ConversationPrefetchResult[]>;
3875
3983
  /** 读取总未读;默认排除 muted 会话。 */
3876
3984
  getTotalUnread: (options?: {
3877
3985
  includeMuted?: boolean;
@@ -4157,6 +4265,8 @@ type ConversationInitialPosition = 'latest' | 'first-unread';
4157
4265
  * @remarks 选项只影响初始连续窗口和 `entryUnread` 快照;发送、历史分页、已读和 close 语义保持不变。
4158
4266
  */
4159
4267
  interface ConversationOpenOptions {
4268
+ /** 取消尚未交付的会话打开及其历史请求;句柄交付后由 close 管理生命周期。 */
4269
+ signal?: AbortSignal;
4160
4270
  /**
4161
4271
  * 初始连续窗口位置。
4162
4272
  *
@@ -4795,6 +4905,8 @@ interface ImProductEventMap {
4795
4905
  'connection:changed': Readonly<{
4796
4906
  snapshot: ImLifecycleSnapshot;
4797
4907
  }>;
4908
+ /** 另一个页面接管聊天;宿主可提示刷新此页重新接管,不应退出业务登录。 */
4909
+ 'session:replaced': Readonly<Record<never, never>>;
4798
4910
  'message:received': Readonly<{
4799
4911
  ref: ConversationRef<ProductConversationListType>;
4800
4912
  message: ImProductMessage;
@@ -5309,15 +5421,16 @@ declare function resolveImEmojiToken(token: string): ImEmojiCatalogEntry | undef
5309
5421
  *
5310
5422
  * 形状 = im-browser `MediaTransferAdapterConfig`:必填 `getUploadCredentials`(按逻辑桶名向宿主自己的 BFF 申请
5311
5423
  * STS 临时凭证)+ 各 `MediaKind`(image/video/voice/file/sticker)的**逻辑桶名** + 可选 `channelBuckets`(社群会话
5312
- * 按类型覆盖)、`avatarBucket`、`useAccelerateEndpoint`、`multipartUpload`、`maxConcurrentUploads`。
5424
+ * 按类型覆盖)、`avatarBucket`、`useAccelerateEndpoint`、`multipartTransfer`、`maxConcurrentUploads`。
5313
5425
  *
5314
5426
  * 上传凭证由业务后端按登录态签发(与 iOS、prod H5 同一个接口),回包同时给出**物理桶**、区域、`key_prefix` 和
5315
5427
  * 公开访问域名;SDK 据此拼 object key 与消息体 URL,宿主 env 里配的只是申请凭证用的逻辑桶名。凭证缓存(本地
5316
5428
  * 1 小时、按服务端过期时间提前 5 分钟失效)、同桶单飞与失败重签由 SDK 负责,宿主只需提供「打一次接口」的纯函数。
5317
5429
  *
5318
- * ⚠ 各 bucket 需在对象存储侧配置 CORS 允许本站 origin 的 PUT + GET;超过 16MiB 的上传走 S3 分片,另需放行
5430
+ * 默认单次 PUT/GET;仅 multipartTransfer=true 才允许大资源分片上传、下载。
5431
+ * 各 bucket 需在对象存储侧配置 CORS 允许本站 origin 的 PUT + GET;开启分片后,超过 16MiB 的上传另需放行
5319
5432
  * POST(Create/CompleteMultipartUpload)、DELETE(AbortMultipartUpload)并 ExposeHeaders: ETag。CORS 未配齐时
5320
- * 可用 `multipartUpload: false` 退回全量单次 PutObject。
5433
+ * 下载还需暴露 Content-Range 与强 ETag;multipartTransfer=false 统一关闭分片上传和下载。
5321
5434
  * ⚠ 并发字段只由 SDK core 的媒体编排消费;adapter 会忽略该字段。高内存设备可设置 5-6,低内存设备建议 2-3。
5322
5435
  */
5323
5436
  type ImMediaConfig = MediaTransferAdapterConfig;
@@ -5858,5 +5971,64 @@ declare const IMAGE_MESSAGE_ACCEPT = "image/jpeg,image/png,image/webp";
5858
5971
  */
5859
5972
  declare function isSupportedImageFile(file: Blob): Promise<boolean>;
5860
5973
 
5861
- export { EDIT_WINDOW_MS, IMAGE_MESSAGE_ACCEPT, IM_CHAT_FONT_SCALES, IM_DIAGNOSTIC_CATEGORIES, IM_EMOJI_CATALOG, ImPinnedMessageOperationError, MEDIA_ALBUM_CAPTION_MAX_LENGTH, MEDIA_ALBUM_MAX_ITEMS, MediaTransferError, REACTION_SUPPORTED_CONTENT_TYPES, buildSessionFavoritePlainBody, canReactToMessage, canTransmit, canTransmitByType, canTransmitContent, classifyStickerImageType, createFaceToFaceGroupQrPayload, createImClient, createImConsoleDiagnosticSink, createImDiagnosticMemoryBuffer, createImTextSearchMatcher, createSdkDiagnosticWriter, createVoicePlayer, createVoiceRecordingSession, detectVoiceCapabilities, extractSearchText, getImTextSearchInitial, isSupportedImageFile, mediaTransferErrorCodeOf, migrateImCachePrefix, normalizeMediaUploadCredentials, parseSessionFavoriteAlbumItems, requiresForwardTypeConfirmation, resolveChannelAccess, resolveImEmojiToken, resolveMediaAlbumSendContentType, resolveSessionFavoriteAlbumCaption, resolveSessionFavoriteAlbumItemPreviewUrl, resolveSessionFavoriteKindFromMessage, resolveTextSegments, sortSessions, sumSessionsUnread, voiceErrorCodeOf };
5862
- export type { CapabilityAvailability, CapabilityDecision, CapabilityReason, ChannelAccessSnapshot, ChannelBaseSessionState, ChannelConversationCapabilities, ChannelConversationMessageApi, ChannelJoinApplication, ChannelJoinApplicationNotification, ChannelJoinApplicationPage, ChannelMember, ChannelMemberPage, ChannelMentionMember, ChannelMentionMemberPage, ChannelMiniProgramRel, ChannelMiniProgramRelConfigType, ChannelMuteReason, ChannelPermissionSet, ChannelProfile, ChannelRole, ChannelSessionState, ContactCardInput, ContactMessageOptions, ConversationBackgroundPreset, ConversationBackgroundSelection, ConversationCapabilitySnapshot, ConversationDraft, ConversationDraftApi, ConversationEntryUnreadSnapshot, ConversationHandle, ConversationHandleSnapshot, ConversationInitialPosition, ConversationLastMessageSummary, ConversationListItem, ConversationListMention, ConversationMessageApi, ConversationOpenOptions, ConversationRef, ConversationSearchPage, ConversationSearchResult, ConversationSystemSummary, ConversationType, DirectConversationCapabilities, DirectConversationMessageApi, DraftInput, EditTextOptions, ExpressionMessageOptions, FileMessageOptions, ForwardFailReason, ForwardItemStatus, ForwardMessageFailure, ForwardMessagesInput, ForwardMessagesResult, ForwardTarget, ForwardedMessageRef, GameMessageOptions, GifMessageOptions, GroupConversationCapabilities, GroupConversationMessageApi, GroupMemberItem, GroupProfile, ImAppearanceSettingsApi, ImApplicationItem, ImApplicationRef, ImApplicationsApi, ImAuthIssue, ImAuthProvider, ImCacheOptions, ImCachePrefixMigrationContext, ImCachePrefixMigrator, ImCallKind, ImCallOutcome, ImCallRecordBody, ImChannelConversationAccessSnapshot, ImChannelMentionApi, ImChannelMiniProgramRel, ImChannelPermissions, ImChannelPinnedMessage, ImChannelProfile, ImChannelRole, ImChannelState, ImChannelsApi, ImChatFontScale, ImClientOptions, ImConnectionState, ImContactBody, ImContactKind, ImContactProfile, ImContactRelationship, ImContactRemarkPhone, ImContactSearchResult, ImContactsApi, ImConversationBackgroundApi, ImConversationCapabilitiesApi, ImConversationListApi, ImConversationListSnapshot, ImConversationListState, ImConversationSearchApi, ImCoreApiOptions, ImCreateChannelInput, ImCreateChannelResult, ImCreateFaceToFaceGroupResult, ImCreateGroupInput, ImCreateGroupResult, ImCreatedChannel, ImCreatedGroup, ImDebugOptions, ImDiagnosticCategory, ImDiagnosticError, ImDiagnosticLayer, ImDiagnosticLevel, ImDiagnosticMemoryBuffer, ImDiagnosticMemoryBufferFilter, ImDiagnosticMemoryBufferOptions, ImDiagnosticMemoryBufferSnapshot, ImDiagnosticMessage, ImDiagnosticRecord, ImDiagnosticSink, ImDiagnosticWriter, ImDirectCallAnswerResult, ImDirectCallFailReason, ImDirectCallHangupInput, ImDirectCallHangupReason, ImDirectCallInviteInput, ImDirectCallNotifyAudioInput, ImDirectCallTargetInput, ImDirectCallsApi, ImDirectReadReceiptSettings, ImDirectoryApi, ImDirectoryFieldMatch, ImDirectoryItem, ImDirectoryKind, ImDirectoryPage, ImDirectorySearchApi, ImDirectorySearchItem, ImDirectorySearchResult, ImDraftsApi, ImEmojiCatalogEntry, ImEndpointProvider, ImEventsApi, ImExpressionAsset, ImExpressionAssetInput, ImExpressionEmojiRecentInput, ImExpressionFavoriteKind, ImExpressionOptions, ImExpressionRecentInput, ImExpressionRecentItem, ImExpressionRecentItemKind, ImExpressionsApi, ImFaceToFaceGroup, ImFileBody, ImFriendshipRequestResult, ImGameBody, ImGameType, ImGifAssetInput, ImGiphyAsset, ImGiphyPage, ImGiphyPageOptions, ImGroupCallAnswerInput, ImGroupCallBusyInput, ImGroupCallCreateInput, ImGroupCallJoinInput, ImGroupCallMeetingSnapshot, ImGroupCallMember, ImGroupCallMemberStatus, ImGroupCallStatusInput, ImGroupCallTargetInput, ImGroupCallsApi, ImGroupConversationState, ImGroupMentionApi, ImGroupPinnedMessage, ImGroupProfile, ImGroupsApi, ImImageBody, ImLifecycleSnapshot, ImLocalDataApi, ImLocalDataInfo, ImLogoutOptions, ImMediaAlbumBody, ImMediaAlbumItem, ImMediaConfig, ImMediaTask, ImMediaTasksApi, ImMembershipJoinResult, ImMessageMention, ImMessageReactionAggregate, ImMessageReactions, ImMessageRef, ImMessageSearchApi, ImMessageView, ImMessageViewBody, ImMessagesByIdResult, ImMiniProgramBody, ImMiniProgramShowType, ImOutboxApi, ImOutboxItem, ImPageToken, ImPinnedMessageErrorKind, ImPinnedMessageOperation, ImProductApplicationUpdate, ImProductAuthInvalidReason, ImProductClient, ImProductEvent, ImProductEventError, ImProductEventMap, ImProductMessage, ImPushApi, ImPushSnapshot, ImReactionChangeAction, ImReactionChangeResult, ImReadReceiptSettingsApi, ImRedPacketBody, ImRedPacketType, ImRequestError, ImRequestErrorHandler, ImSdkErrorCategory, ImSdkErrorShape, ImSearchApi, ImSessionApi, ImSessionFavoriteAlbumItem, ImSessionFavoriteItem, ImSessionFavoriteKind, ImSessionFavoritesApi, ImSessionLifecycleState, ImSettingsApi, ImStickerAssetInput, ImStickerBody, ImStickerPack, ImSupportedConversationRef, ImTextSearchMatch, ImTextSearchMatchOptions, ImTextSearchMatcher, ImTextSearchRange, ImTransferBody, ImTransferSessionType, ImTransferStatus, ImVideoBody, ImVoiceBody, ImWebPushSubscription, ImageMessageOptions, ImagePreviewMetadata, LocalConversationHistoryClearResult, LocalMessageDeletionResult, MediaAlbumItemInput, MediaAlbumMessageOptions, MediaTransferErrorCode, MediaUploadCredentials, MediaUploadCredentialsProvider, MediaUploadCredentialsRequest, MentionCandidate, MentionCandidatePage, MentionInput, MessageContentType, MessageWindowInfo, MessageWindowPage, MessagesByIdFailure, MigrateImCachePrefixInput, MiniProgramMessageOptions, ProductConversationListType, ProductHandleConversationType, ProductMessageSearchPage, ProductMessageSearchResult, ResolveTextOptions, ResolvedConversationBackground, SegmentMatch, SegmentMatcher, SendMessageResult, StickerAssetKind, TextMessageOptions, TextSegment, TransferMessageOptions, UnknownMessageBody, UserProfile, VideoMessageOptions, VideoPreviewMetadata, VoiceCapabilities, VoiceErrorCode, VoiceMessageMetadata, VoicePlayer, VoicePlayerOptions, VoicePlayerState, VoiceRecordingResult, VoiceRecordingSession, VoiceRecordingSessionOptions, VoiceRecordingState, VoiceToggleOptions };
5974
+ /** 通用资源类型,只决定使用哪个宿主逻辑桶,不包含消息或会话语义。 */
5975
+ type ImResourceKind = MediaKind;
5976
+ /** 上传进度;请求体传完后仍需等待对象存储确认,成功响应后才报告 100%。 */
5977
+ type ImResourceUploadProgress = Readonly<MediaTransferProgress>;
5978
+ /** 复用 IM 的普通媒体桶和凭证合同;不采用社群覆盖桶,不需要认证或连接运行时。 */
5979
+ type ImResourceUploaderConfig = Pick<MediaTransferAdapterConfig, 'buckets' | 'getUploadCredentials' | 'useAccelerateEndpoint' | 'multipartTransfer' | 'multipartUpload'>;
5980
+ /** 上传原始资源的参数。文件选择、压缩、转码和缩略图生成由宿主决定。 */
5981
+ interface ImResourceUploadInput {
5982
+ /** 原始 File/Blob;直接交给传输层,不预读整个文件,不执行消息加密。 */
5983
+ file: Blob;
5984
+ /** 资源类型;使用 config.buckets[kind],缺少桶配置时明确失败。 */
5985
+ kind: ImResourceKind;
5986
+ /** 可覆盖 File.name;Blob 没有文件名时可提供扩展名。对象名由 SDK 生成。 */
5987
+ filename?: string;
5988
+ /** 主动取消会中断请求并清理未完成分片;不提供跨调用或刷新续传。 */
5989
+ signal?: AbortSignal;
5990
+ /** 只在本次上传仍有效时通知;回调应保持同步、无异常。 */
5991
+ onProgress?: (progress: ImResourceUploadProgress) => void;
5992
+ }
5993
+ /** 对象存储确认上传成功后的资源,不包含签名凭证或私有分片状态。 */
5994
+ interface ImResourceUploadResult {
5995
+ /** 服务端凭证中公开域名对应的资源 URL,可交给动态、资料等宿主业务。 */
5996
+ url: string;
5997
+ }
5998
+ /** 独立资源上传器;不创建消息、Outbox 项或 client.media 任务。 */
5999
+ interface ImResourceUploader {
6000
+ /**
6001
+ * 上传原始文件。默认单次 PUT;multipartTransfer=true 且 >16 MiB 才允许分片,沿用既有凭证刷新策略。
6002
+ * 失败会清理未完成分片并保留错误,显式重试须再次调用 upload;不会退回旧 HTTP 上传接口。
6003
+ * @throws 取消为 AbortError;若取消后的分片清理失败,仍报告 multipart-abort-failed。
6004
+ * 配置、凭证、S3 或清理失败直接拒绝;dispose 后不可再使用。
6005
+ */
6006
+ upload: (input: ImResourceUploadInput) => Promise<ImResourceUploadResult>;
6007
+ /**
6008
+ * 幂等释放:立即禁止新上传,取消并等待所有在途上传结束。
6009
+ * 具体上传/分片清理错误仍交给各自 upload Promise,dispose 本身不重复拒绝。
6010
+ */
6011
+ dispose: () => Promise<void>;
6012
+ }
6013
+ /**
6014
+ * 创建与 IM 会话无关的浏览器 S3 上传器,复用普通媒体桶、凭证缓存及分片执行器。
6015
+ *
6016
+ * 宿主应按账号/页面持有实例,在退出或切账号时 dispose,并为凭证回调校验账号身份。
6017
+ * 该实例不会读取宿主登录态;桶配置在创建时复制,凭证仅保存在实例内存中。
6018
+ * 不限制动态条目数量或业务文件大小,不创建 DOM/object URL,也不删除已成功上传的对象。
6019
+ *
6020
+ * @example
6021
+ * ```ts
6022
+ * const uploader = createImResourceUploader(mediaConfig);
6023
+ * try {
6024
+ * const { url } = await uploader.upload({ file, kind: 'video', signal });
6025
+ * await savePost({ videoUrl: url });
6026
+ * } finally {
6027
+ * await uploader.dispose();
6028
+ * }
6029
+ * ```
6030
+ */
6031
+ declare function createImResourceUploader(config: ImResourceUploaderConfig): ImResourceUploader;
6032
+
6033
+ export { EDIT_WINDOW_MS, IMAGE_MESSAGE_ACCEPT, IM_CHAT_FONT_SCALES, IM_DIAGNOSTIC_CATEGORIES, IM_EMOJI_CATALOG, ImPinnedMessageOperationError, MEDIA_ALBUM_CAPTION_MAX_LENGTH, MEDIA_ALBUM_MAX_ITEMS, MediaTransferError, REACTION_SUPPORTED_CONTENT_TYPES, buildSessionFavoritePlainBody, canReactToMessage, canTransmit, canTransmitByType, canTransmitContent, classifyStickerImageType, createFaceToFaceGroupQrPayload, createImClient, createImConsoleDiagnosticSink, createImDiagnosticMemoryBuffer, createImResourceUploader, createImTextSearchMatcher, createSdkDiagnosticWriter, createVoicePlayer, createVoiceRecordingSession, detectVoiceCapabilities, extractSearchText, getImTextSearchInitial, isSupportedImageFile, mediaTransferErrorCodeOf, migrateImCachePrefix, normalizeMediaUploadCredentials, parseSessionFavoriteAlbumItems, requiresForwardTypeConfirmation, resolveChannelAccess, resolveImEmojiToken, resolveMediaAlbumSendContentType, resolveSessionFavoriteAlbumCaption, resolveSessionFavoriteAlbumItemPreviewUrl, resolveSessionFavoriteKindFromMessage, resolveTextSegments, sortSessions, sumSessionsUnread, voiceErrorCodeOf };
6034
+ export type { CapabilityAvailability, CapabilityDecision, CapabilityReason, ChannelAccessSnapshot, ChannelBaseSessionState, ChannelConversationCapabilities, ChannelConversationMessageApi, ChannelJoinApplication, ChannelJoinApplicationNotification, ChannelJoinApplicationPage, ChannelMember, ChannelMemberPage, ChannelMentionMember, ChannelMentionMemberPage, ChannelMiniProgramRel, ChannelMiniProgramRelConfigType, ChannelMuteReason, ChannelPermissionSet, ChannelProfile, ChannelRole, ChannelSessionState, ContactCardInput, ContactMessageOptions, ConversationBackgroundPreset, ConversationBackgroundSelection, ConversationCapabilitySnapshot, ConversationDraft, ConversationDraftApi, ConversationEntryUnreadSnapshot, ConversationHandle, ConversationHandleSnapshot, ConversationInitialPosition, ConversationLastMessageSummary, ConversationListItem, ConversationListMention, ConversationMessageApi, ConversationOpenOptions, ConversationPrefetchOptions, ConversationPrefetchResult, ConversationRef, ConversationSearchPage, ConversationSearchResult, ConversationSystemSummary, ConversationType, DirectConversationCapabilities, DirectConversationMessageApi, DraftInput, EditTextOptions, ExpressionMessageOptions, FileMessageOptions, ForwardFailReason, ForwardItemStatus, ForwardMessageFailure, ForwardMessagesInput, ForwardMessagesResult, ForwardTarget, ForwardedMessageRef, GameMessageOptions, GifMessageOptions, GroupConversationCapabilities, GroupConversationMessageApi, GroupMemberItem, GroupProfile, ImAppearanceSettingsApi, ImApplicationItem, ImApplicationRef, ImApplicationsApi, ImAuthIssue, ImAuthProvider, ImCacheOptions, ImCachePrefixMigrationContext, ImCachePrefixMigrator, ImCallKind, ImCallOutcome, ImCallRecordBody, ImChannelConversationAccessSnapshot, ImChannelMentionApi, ImChannelMiniProgramRel, ImChannelPermissions, ImChannelPinnedMessage, ImChannelProfile, ImChannelRole, ImChannelState, ImChannelsApi, ImChatFontScale, ImClientOptions, ImConnectionState, ImContactBody, ImContactKind, ImContactProfile, ImContactRelationship, ImContactRemarkPhone, ImContactSearchResult, ImContactsApi, ImConversationBackgroundApi, ImConversationCapabilitiesApi, ImConversationListApi, ImConversationListSnapshot, ImConversationListState, ImConversationSearchApi, ImCoreApiOptions, ImCreateChannelInput, ImCreateChannelResult, ImCreateFaceToFaceGroupResult, ImCreateGroupInput, ImCreateGroupResult, ImCreatedChannel, ImCreatedGroup, ImDebugOptions, ImDiagnosticCategory, ImDiagnosticError, ImDiagnosticLayer, ImDiagnosticLevel, ImDiagnosticMemoryBuffer, ImDiagnosticMemoryBufferFilter, ImDiagnosticMemoryBufferOptions, ImDiagnosticMemoryBufferSnapshot, ImDiagnosticMessage, ImDiagnosticRecord, ImDiagnosticSink, ImDiagnosticWriter, ImDirectCallAnswerResult, ImDirectCallFailReason, ImDirectCallHangupInput, ImDirectCallHangupReason, ImDirectCallInviteInput, ImDirectCallNotifyAudioInput, ImDirectCallTargetInput, ImDirectCallsApi, ImDirectReadReceiptSettings, ImDirectoryApi, ImDirectoryFieldMatch, ImDirectoryItem, ImDirectoryKind, ImDirectoryPage, ImDirectorySearchApi, ImDirectorySearchItem, ImDirectorySearchResult, ImDraftsApi, ImEmojiCatalogEntry, ImEndpointProvider, ImEventsApi, ImExpressionAsset, ImExpressionAssetInput, ImExpressionEmojiRecentInput, ImExpressionFavoriteKind, ImExpressionOptions, ImExpressionRecentInput, ImExpressionRecentItem, ImExpressionRecentItemKind, ImExpressionsApi, ImFaceToFaceGroup, ImFileBody, ImFriendshipRequestResult, ImGameBody, ImGameType, ImGifAssetInput, ImGiphyAsset, ImGiphyPage, ImGiphyPageOptions, ImGroupCallAnswerInput, ImGroupCallBusyInput, ImGroupCallCreateInput, ImGroupCallJoinInput, ImGroupCallMeetingSnapshot, ImGroupCallMember, ImGroupCallMemberStatus, ImGroupCallStatusInput, ImGroupCallTargetInput, ImGroupCallsApi, ImGroupConversationState, ImGroupMentionApi, ImGroupPinnedMessage, ImGroupProfile, ImGroupsApi, ImImageBody, ImLifecycleSnapshot, ImLocalDataApi, ImLocalDataInfo, ImLogoutOptions, ImMediaAlbumBody, ImMediaAlbumItem, ImMediaConfig, ImMediaTask, ImMediaTasksApi, ImMembershipJoinResult, ImMessageMention, ImMessageReactionAggregate, ImMessageReactions, ImMessageRef, ImMessageSearchApi, ImMessageView, ImMessageViewBody, ImMessagesByIdResult, ImMiniProgramBody, ImMiniProgramShowType, ImOutboxApi, ImOutboxItem, ImPageToken, ImPinnedMessageErrorKind, ImPinnedMessageOperation, ImProductApplicationUpdate, ImProductAuthInvalidReason, ImProductClient, ImProductEvent, ImProductEventError, ImProductEventMap, ImProductMessage, ImPushApi, ImPushSnapshot, ImReactionChangeAction, ImReactionChangeResult, ImReadReceiptSettingsApi, ImRedPacketBody, ImRedPacketType, ImRequestError, ImRequestErrorHandler, ImResourceKind, ImResourceUploadInput, ImResourceUploadProgress, ImResourceUploadResult, ImResourceUploader, ImResourceUploaderConfig, ImRobotBody, ImRobotCommand, ImRobotModule, ImSdkErrorCategory, ImSdkErrorShape, ImSearchApi, ImSessionApi, ImSessionFavoriteAlbumItem, ImSessionFavoriteItem, ImSessionFavoriteKind, ImSessionFavoritesApi, ImSessionLifecycleState, ImSettingsApi, ImStickerAssetInput, ImStickerBody, ImStickerPack, ImSupportedConversationRef, ImTextSearchMatch, ImTextSearchMatchOptions, ImTextSearchMatcher, ImTextSearchRange, ImTransferBody, ImTransferSessionType, ImTransferStatus, ImVideoBody, ImVoiceBody, ImWebPushSubscription, ImageMessageOptions, ImagePreviewMetadata, LocalConversationHistoryClearResult, LocalMessageDeletionResult, MediaAlbumItemInput, MediaAlbumMessageOptions, MediaTransferErrorCode, MediaUploadCredentials, MediaUploadCredentialsProvider, MediaUploadCredentialsRequest, MentionCandidate, MentionCandidatePage, MentionInput, MessageContentType, MessageWindowInfo, MessageWindowPage, MessagesByIdFailure, MigrateImCachePrefixInput, MiniProgramMessageOptions, ProductConversationListType, ProductHandleConversationType, ProductMessageSearchPage, ProductMessageSearchResult, ResolveTextOptions, ResolvedConversationBackground, SegmentMatch, SegmentMatcher, SendMessageResult, StickerAssetKind, TextMessageOptions, TextSegment, TransferMessageOptions, UnknownMessageBody, UserProfile, VideoMessageOptions, VideoPreviewMetadata, VoiceCapabilities, VoiceErrorCode, VoiceMessageMetadata, VoicePlayer, VoicePlayerOptions, VoicePlayerState, VoiceRecordingResult, VoiceRecordingSession, VoiceRecordingSessionOptions, VoiceRecordingState, VoiceToggleOptions };
package/dist/sdk.js CHANGED
@@ -1 +1 @@
1
- import'./chunk-IDECJJXC.js';export{e as IMAGE_MESSAGE_ACCEPT,n as IM_CHAT_FONT_SCALES,g as IM_DIAGNOSTIC_CATEGORIES,j as IM_EMOJI_CATALOG,c as ImPinnedMessageOperationError,m as buildSessionFavoritePlainBody,d as createFaceToFaceGroupQrPayload,o as createImClient,h as createImConsoleDiagnosticSink,r as createImDiagnosticMemoryBuffer,i as createSdkDiagnosticWriter,f as isSupportedImageFile,a as migrateImCachePrefix,k as resolveImEmojiToken,l as resolveSessionFavoriteKindFromMessage}from'./chunk-DVQGXZ6S.js';export{Ra as MediaTransferError,$a as createVoicePlayer,ab as createVoiceRecordingSession,Za as detectVoiceCapabilities,Sa as mediaTransferErrorCodeOf,Ta as normalizeMediaUploadCredentials,_a as voiceErrorCodeOf}from'./chunk-FQJBDSXT.js';export{na as EDIT_WINDOW_MS,o as MEDIA_ALBUM_CAPTION_MAX_LENGTH,p as MEDIA_ALBUM_MAX_ITEMS,va as REACTION_SUPPORTED_CONTENT_TYPES,wa as canReactToMessage,ra as canTransmit,pa as canTransmitByType,qa as canTransmitContent,s as classifyStickerImageType,ca as createImTextSearchMatcher,aa as extractSearchText,ba as getImTextSearchInitial,ob as parseSessionFavoriteAlbumItems,oa as requiresForwardTypeConfirmation,ya as resolveChannelAccess,q as resolveMediaAlbumSendContentType,pb as resolveSessionFavoriteAlbumCaption,nb as resolveSessionFavoriteAlbumItemPreviewUrl,ha as resolveTextSegments,Fa as sortSessions,Ga as sumSessionsUnread}from'./chunk-O7GQQMEW.js';import'./chunk-WOT6VMZA.js';
1
+ import'./chunk-IDECJJXC.js';export{e as IMAGE_MESSAGE_ACCEPT,n as IM_CHAT_FONT_SCALES,g as IM_DIAGNOSTIC_CATEGORIES,j as IM_EMOJI_CATALOG,c as ImPinnedMessageOperationError,m as buildSessionFavoritePlainBody,d as createFaceToFaceGroupQrPayload,o as createImClient,h as createImConsoleDiagnosticSink,r as createImDiagnosticMemoryBuffer,s as createImResourceUploader,i as createSdkDiagnosticWriter,f as isSupportedImageFile,a as migrateImCachePrefix,k as resolveImEmojiToken,l as resolveSessionFavoriteKindFromMessage}from'./chunk-MNWNUGIV.js';export{Sa as MediaTransferError,bb as createVoicePlayer,cb as createVoiceRecordingSession,$a as detectVoiceCapabilities,Ta as mediaTransferErrorCodeOf,Ua as normalizeMediaUploadCredentials,ab as voiceErrorCodeOf}from'./chunk-GHZUH7RB.js';export{pa as EDIT_WINDOW_MS,o as MEDIA_ALBUM_CAPTION_MAX_LENGTH,p as MEDIA_ALBUM_MAX_ITEMS,xa as REACTION_SUPPORTED_CONTENT_TYPES,ya as canReactToMessage,ta as canTransmit,ra as canTransmitByType,sa as canTransmitContent,s as classifyStickerImageType,ea as createImTextSearchMatcher,ca as extractSearchText,da as getImTextSearchInitial,qb as parseSessionFavoriteAlbumItems,qa as requiresForwardTypeConfirmation,Aa as resolveChannelAccess,q as resolveMediaAlbumSendContentType,rb as resolveSessionFavoriteAlbumCaption,pb as resolveSessionFavoriteAlbumItemPreviewUrl,ja as resolveTextSegments,Ha as sortSessions,Ia as sumSessionsUnread}from'./chunk-4KPJTXQN.js';import'./chunk-WOT6VMZA.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "k2-im",
3
3
  "type": "module",
4
- "version": "0.1.28",
4
+ "version": "0.1.30",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "publishConfig": {