k2-im 0.1.32 → 0.1.34

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/browser.d.ts CHANGED
@@ -382,5 +382,27 @@ interface CreateBrowserApiProtocolClientInput extends Omit<ApiProtocolClientDepe
382
382
  */
383
383
  declare function createLazyBrowserApiProtocolClient(input: CreateBrowserApiProtocolClientInput, createClient?: (input: CreateBrowserApiProtocolClientInput) => Promise<ApiProtocolClient>): ApiProtocolClient;
384
384
 
385
- export { createLazyBrowserApiProtocolClient };
386
- export type { ApiProtocolClient };
385
+ /** 浏览器图片复制的数据来源;消息读取由 Chat Kit 提供,页面生命周期由宿主提供。 */
386
+ interface ImageClipboardSource {
387
+ /** 返回高清图片的明文 Blob。 */
388
+ loadOriginal: () => Promise<Blob>;
389
+ /** 高清读取或转码失败时,返回当前图片的缩略图。 */
390
+ loadThumbnail: () => Promise<Blob>;
391
+ /** 每个异步步骤完成后检查账号、会话及当前操作是否仍有效。 */
392
+ isCurrent: () => boolean;
393
+ }
394
+ /** 只检查 API 是否存在;浏览器权限拒绝仍由实际复制 Promise 报错。 */
395
+ declare function canCopyImageToClipboard(): boolean;
396
+ /**
397
+ * 在用户点击的同步调用栈内启动图片复制,返回最终复制的是高清图还是缩略图。
398
+ * 高清下载、解密或转码失败时,在同一个 ClipboardItem Promise 内尝试缩略图;两者失败则拒绝。
399
+ * 图片写入失败时再尝试一次缩略图;权限、安全或用户激活拒绝立即交由宿主提示。
400
+ * 传入非空 text 时复制高清图片和文字,图文失败改为只写文字,返回 text;失效取消不触发降级。
401
+ * 宿主必须直接调用,不能先 await 下载;账号切换或关闭页面应让 isCurrent 返回 false。
402
+ * @example
403
+ * await copyImageToClipboard({ loadOriginal, loadThumbnail, isCurrent });
404
+ */
405
+ declare function copyImageToClipboard(source: ImageClipboardSource, text?: string): Promise<'original' | 'thumbnail' | 'text'>;
406
+
407
+ export { canCopyImageToClipboard, copyImageToClipboard, createLazyBrowserApiProtocolClient };
408
+ export type { ApiProtocolClient, ImageClipboardSource };
package/dist/browser.js CHANGED
@@ -1 +1 @@
1
- export{B as createLazyBrowserApiProtocolClient}from'./chunk-GAAHNTJM.js';import'./chunk-QQ23QYWK.js';import'./chunk-WOT6VMZA.js';
1
+ export{Ta as canCopyImageToClipboard,Ua as copyImageToClipboard,B as createLazyBrowserApiProtocolClient}from'./chunk-IEFK5A7T.js';import'./chunk-PJ2PW42T.js';import'./chunk-WOT6VMZA.js';
@@ -43,7 +43,7 @@ interface ConversationDraft$1 {
43
43
  updatedAt: number;
44
44
  }
45
45
  /** 消息内容类型。sticker=表情/贴图(BMessage contentType=7);call=单聊通话记录(contentType=10);transfer=转账(contentType=16);gift=礼品/刮刮卡(contentType=17);robot=机器人卡片(contentType=18);miniProgram=小程序分享卡(contentType=22);redPacket=红包卡(contentType=25);game=小游戏(contentType=27);未知 wire 正文统一归一为 unknown。 */
46
- type MessageContentType = 'text' | 'system' | 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'contact' | 'miniProgram' | 'game' | 'transfer' | 'gift' | 'call' | 'redPacket' | 'mediaAlbum' | 'robot' | 'unknown';
46
+ type MessageContentType = 'text' | 'system' | 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'contact' | 'miniProgram' | 'game' | 'transfer' | 'gift' | 'call' | 'redPacket' | 'mediaAlbum' | 'filesAlbum' | 'robot' | 'unknown';
47
47
  /**
48
48
  * 发送态(客户端态):消息从本地创建到服务端确认的生命周期。
49
49
  * `uploading` 仅媒体消息使用:文件上传阶段(uploading→pending→sending→sent);
@@ -125,6 +125,12 @@ type LastMessageSummary = {
125
125
  kind: 'voice';
126
126
  durationMs?: number;
127
127
  }
128
+ /** 文件合集的有序文件数量与可选配文,文案由 i18n 决定。 */
129
+ | {
130
+ kind: 'filesAlbum';
131
+ count: number;
132
+ caption?: string;
133
+ }
128
134
  /**
129
135
  * 媒体合集(contentType 28)。
130
136
  *
@@ -217,6 +223,13 @@ interface ImVideoBody {
217
223
  /** 文件加密类型:1=不加密,3=完整 TEA(BMessage.fileEncryptType;视频与图片同体系走完整 TEA)。 */
218
224
  fileEncryptType?: number;
219
225
  }
226
+ /** 文件合集正文;接收保留所有有序文件项,首次发送每条只包含一个文件。 */
227
+ interface ImFilesAlbumBody {
228
+ /** 文件下方的配文;无配文时省略。 */
229
+ caption?: string;
230
+ /** 文件元数据与独立解密参数;本地上传占位允许 URL 暂为空。 */
231
+ items: readonly ImFileBody[];
232
+ }
220
233
  /**
221
234
  * 文件(附件)消息内容体(contentType==='file')。领域友好类型(string/number),协议 BMessage 的 bytes/bigint 字段在 mapping 层互转。
222
235
  * 对齐 Android IMFileMsgBody / BMessage 文件字段(见 outputs/architecture/subagent-read-docs/研究Android文件上传实现.md):
@@ -628,6 +641,8 @@ interface ImMessageBody {
628
641
  redPacket?: ImRedPacketBody;
629
642
  /** contentType==='mediaAlbum' 时的媒体合集正文(配文 + 1~9 个图片/视频项)。 */
630
643
  mediaAlbum?: ImMediaAlbumBody;
644
+ /** 文件合集(协议 29),与图片/视频合集独立。 */
645
+ filesAlbum?: ImFilesAlbumBody;
631
646
  /** contentType==='robot' 时的机器人卡片。 */
632
647
  robot?: ImRobotBody;
633
648
  /** contentType==='unknown' 时的稳定未知正文,不含原始 wire type。 */
@@ -664,7 +679,7 @@ type ImMessageFailureReason = 'timeout' | 'rejected' | 'encrypt_failed' | 'netwo
664
679
  * 失败**展示语义**码(强类型枚举,非裸串):供 im-i18n 按 locale 渲染失败气泡文案。
665
680
  * 由 `reason` / `SendMediaFailReason` / ACK errcode 穷尽映射而来,与 im-i18n failure catalog 键一一对应(media.* 带 mediaKind 参数)。
666
681
  */
667
- type ImFailureDisplayCode = 'media.empty' | 'media.noCrypto' | 'media.previewFailed' | 'media.encryptFailed' | 'media.uploadFailed' | 'media.cancelled' | 'media.invalidDuration' | 'media.uploadInterrupted' | 'media.contentTooLarge' | 'contactRequired' | 'messageRefused' | 'forbiddenOrLeft' | 'contentRejected' | 'groupDismissed' | 'groupUnavailable' | 'channelDismissed' | 'channelMuted' | 'channelNotMember' | 'channelAdminRequired' | 'conversationUnsupported' | 'sendCanceled' | 'sessionLoggedOut' | 'timeout' | 'network' | 'unknown';
682
+ type ImFailureDisplayCode = 'media.empty' | 'media.noCrypto' | 'media.previewFailed' | 'media.encryptFailed' | 'media.resumeUnavailable' | 'media.cleanupUnconfirmed' | 'media.uploadFailed' | 'media.uploadTimeout' | 'media.cancelled' | 'media.invalidDuration' | 'media.uploadInterrupted' | 'media.contentTooLarge' | 'contactRequired' | 'messageRefused' | 'forbiddenOrLeft' | 'contentRejected' | 'groupDismissed' | 'groupUnavailable' | 'channelDismissed' | 'channelMuted' | 'channelNotMember' | 'channelAdminRequired' | 'conversationUnsupported' | 'sendCanceled' | 'sessionLoggedOut' | 'timeout' | 'network' | 'unknown';
668
683
  interface ImMessageFailure {
669
684
  /** 归一后的错误码(来自 MESChatAck.errcode 或本地失败码,本地码用负值)。 */
670
685
  code: number;
@@ -690,7 +705,7 @@ interface MediaTaskUpdate {
690
705
  messageId: string;
691
706
  ref: ConversationRef;
692
707
  direction: 'upload' | 'download';
693
- state: 'queued' | 'running' | 'completed' | 'failed' | 'canceled';
708
+ state: 'queued' | 'running' | 'paused' | 'completed' | 'failed' | 'canceled';
694
709
  percent: number;
695
710
  /**
696
711
  * upload 任务子阶段。
@@ -698,7 +713,16 @@ interface MediaTaskUpdate {
698
713
  * `waiting-upload-slot` 与 `state: 'queued'` 同时出现,表示还没开始传字节(在生成缩略图或在等上传槽位),
699
714
  * 此时 percent 恒为 0;`transferring` 正在传字节;`finalizing` 是等待远端 URL 最终确认。
700
715
  */
701
- phase?: 'waiting-upload-slot' | 'transferring' | 'finalizing';
716
+ phase?: 'waiting-upload-slot' | 'waiting-retry' | 'transferring' | 'finalizing';
717
+ /** 当前发送意图的尝试序号与总上限。 */
718
+ attempt?: number;
719
+ maxAttempts?: number;
720
+ /** 已传与总字节数,供共享展示层估算速度。 */
721
+ bytesTransferred?: number;
722
+ bytesTotal?: number;
723
+ /** 跨刷新恢复可用性;缺省尚未建立恢复记录。 */
724
+ recovery?: 'available' | 'session-only';
725
+ recoveryReason?: string;
702
726
  failure?: ImMessageFailure;
703
727
  }
704
728
  interface ImMessageEncryption {
@@ -2371,6 +2395,11 @@ type ImEvent = {
2371
2395
  } | {
2372
2396
  type: 'sync:complete';
2373
2397
  conversations: ConversationRef[];
2398
+ }
2399
+ /** SDK 会话同步或前台内容读取的汇总状态;结束不代表所有请求成功。 */
2400
+ | {
2401
+ type: 'receiving:changed';
2402
+ receiving: boolean;
2374
2403
  } | {
2375
2404
  type: 'auth:invalid';
2376
2405
  issue: ImAuthIssue;
@@ -3037,12 +3066,17 @@ interface ImMessageReactions {
3037
3066
  aggregates: readonly ImMessageReactionAggregate[];
3038
3067
  }
3039
3068
  /** 可渲染媒体正文;密钥和底层文件加密策略只允许留在 SDK/Core。 */
3040
- interface ImMessageViewBody extends Omit<ImMessageBody, 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'mediaAlbum'> {
3069
+ interface ImMessageViewBody extends Omit<ImMessageBody, 'image' | 'video' | 'voice' | 'file' | 'sticker' | 'mediaAlbum' | 'filesAlbum'> {
3041
3070
  image?: Readonly<Omit<NonNullable<ImMessageBody['image']>, 'teaKey' | 'fileEncryptType'>>;
3042
3071
  video?: Readonly<Omit<NonNullable<ImMessageBody['video']>, 'teaKey' | 'fileEncryptType'>>;
3043
3072
  voice?: Readonly<Omit<NonNullable<ImMessageBody['voice']>, 'teaKey' | 'fileEncryptType'>>;
3044
3073
  file?: Readonly<Omit<NonNullable<ImMessageBody['file']>, 'teaKey' | 'fileEncryptType'>>;
3045
3074
  sticker?: Readonly<NonNullable<ImMessageBody['sticker']>>;
3075
+ /** 文件合集产品视图不包含逐项密钥,下载只接受消息引用与下标。 */
3076
+ filesAlbum?: Readonly<{
3077
+ caption?: string;
3078
+ items: readonly Readonly<Omit<NonNullable<ImMessageBody['file']>, 'teaKey' | 'fileEncryptType'>>[];
3079
+ }>;
3046
3080
  /** 合集的每一项都带自己的密钥材料,逐项剥离后才交给产品层;按项下载走 SDK handle,不需要这些字段。 */
3047
3081
  mediaAlbum?: Readonly<Omit<NonNullable<ImMessageBody['mediaAlbum']>, 'items'> & {
3048
3082
  items: readonly Readonly<Omit<ImMediaAlbumItem, 'teaKey' | 'fileEncryptType'>>[];
@@ -3205,10 +3239,13 @@ interface VoiceMessageMetadata {
3205
3239
  /**
3206
3240
  * 文件发送附加数据。
3207
3241
  *
3208
- * @remarks 传 `Blob` 时必须提供 `fileName`;传 `File` 时默认读取其 name。当前协议无文件 caption,非空值显式 unsupported。
3242
+ * @remarks 传 `Blob` 时必须提供 `fileName`;传 `File` 时默认读取其 name。非空 caption 使用协议 29,无配文默认保持 11。
3209
3243
  */
3210
3244
  interface FileMessageOptions {
3245
+ /** 文件卡下方配文,最长 1024 字符。 */
3211
3246
  caption?: string;
3247
+ /** 同一带配文批次的前序文件使用 29,即使自身没有配文。 */
3248
+ filesAlbum?: boolean;
3212
3249
  fileName?: string;
3213
3250
  replyToMessageId?: string;
3214
3251
  }
@@ -3843,6 +3880,8 @@ interface ImLifecycleSnapshot {
3843
3880
  prepared: boolean;
3844
3881
  connectionDesired: boolean;
3845
3882
  authenticated: boolean;
3883
+ /** 会话同步或前台内容读取仍在进行;不包含后台预取、媒体下载和写操作,也不代表同步成功。 */
3884
+ receiving: boolean;
3846
3885
  }
3847
3886
  /** logout 的本地数据与在途消息策略。 */
3848
3887
  interface ImLogoutOptions {
@@ -4248,6 +4287,12 @@ type ConversationLastMessageSummary = {
4248
4287
  kind: 'voice';
4249
4288
  durationMs?: number;
4250
4289
  }
4290
+ /** 文件合集的文件数量与可选配文,供列表生成摘要。 */
4291
+ | {
4292
+ kind: 'filesAlbum';
4293
+ count: number;
4294
+ caption?: string;
4295
+ }
4251
4296
  /**
4252
4297
  * 媒体合集(一条消息内 1~9 个图片/视频 + 可选配文)。
4253
4298
  *
@@ -4783,9 +4828,9 @@ interface ConversationMessageApi {
4783
4828
  /** 显式添加/替换或移除,供参与者详情等不能用 toggle 猜动作的产品交互。 */
4784
4829
  setReaction: (messageId: string, emoji: string, action: ImReactionChangeAction) => Promise<ImReactionChangeResult>;
4785
4830
  /**
4786
- * 为刷新后上传中断的视频重新选择源文件,并原地替换同一条消息。
4831
+ * 为源文件已释放的视频重新选择源文件,并原地替换同一条消息。
4787
4832
  *
4788
- * @remarks 只接受当前 handle 中 `media.uploadInterrupted` 的失败视频。SDK 复用原消息 id 与排序时间,
4833
+ * @remarks 只接受上传中断、已取消或超时耗尽后的失败视频;必须重新选择文件。SDK 复用原消息 id 与排序时间,
4789
4834
  * 不清理当前 Composer 草稿;重新上传失败仍更新同一条消息。
4790
4835
  * @example
4791
4836
  * ```ts
@@ -4794,9 +4839,9 @@ interface ConversationMessageApi {
4794
4839
  */
4795
4840
  replaceInterruptedVideo: (messageId: string, file: File | Blob, options?: VideoMessageOptions) => Promise<SendMessageResult>;
4796
4841
  /**
4797
- * 为刷新后上传中断的文件重新选择源文件,并原地替换同一条消息。
4842
+ * 为源文件已释放的文件重新选择源文件,并原地替换同一条消息。
4798
4843
  *
4799
- * @remarks 只接受当前 handle 中 `media.uploadInterrupted` 的失败文件。SDK 复用原消息 id 与排序时间,
4844
+ * @remarks 只接受上传中断、已取消或超时耗尽后的失败文件或单项 filesAlbum;保留原配文。SDK 复用原消息 id 与排序时间,
4800
4845
  * 不清理当前 Composer 草稿;Blob 没有 name 时仍必须传 `fileName`。
4801
4846
  * @example
4802
4847
  * ```ts
@@ -4940,7 +4985,8 @@ interface ChannelConversationMessageApi extends ConversationMessageApi {
4940
4985
  * 由社群管理员或社群主删除一条全员可见消息。
4941
4986
  *
4942
4987
  * @remarks 不受本人撤回时间窗限制;权限由 CHANNEL profile 预检并由服务端最终校验。成功后消息进入
4943
- * `deletedForEveryone` 终态,所有端显示“管理员删除了一条消息”。该方法不用于本机删除,也不适用于普通群。
4988
+ * `deletedForEveryone` 终态;Chat Kit 时间线仅向社群群主和管理员显示删除提示,普通成员隐藏该项。
4989
+ * 该方法不用于本机删除,也不适用于普通群。
4944
4990
  * @example
4945
4991
  * ```ts
4946
4992
  * const channel = await client.openConversation({ conversationType: 'channel', conversationId: '9001' })
@@ -5123,7 +5169,7 @@ interface ImMediaTask {
5123
5169
  /** upload 来自发送链路,download 来自本产品 API。 */
5124
5170
  direction: 'upload' | 'download';
5125
5171
  /** 终态 completed/failed/canceled 不会被同一尝试的迟到 progress 回退。 */
5126
- state: 'queued' | 'running' | 'completed' | 'failed' | 'canceled';
5172
+ state: 'queued' | 'running' | 'paused' | 'completed' | 'failed' | 'canceled';
5127
5173
  /** 0-100 的归一化整数。 */
5128
5174
  percent: number;
5129
5175
  /**
@@ -5133,7 +5179,16 @@ interface ImMediaTask {
5133
5179
  * 等上传槽位),此时 `percent` 恒为 0——宿主应显示「等待中」而不是把 0 当成停住的进度。
5134
5180
  * `transferring` 是正在传字节,`finalizing` 是字节已传完、在等对象存储确认。
5135
5181
  */
5136
- phase?: 'waiting-upload-slot' | 'transferring' | 'finalizing';
5182
+ phase?: 'waiting-upload-slot' | 'waiting-retry' | 'transferring' | 'finalizing';
5183
+ /** 当前发送意图的尝试序号与总上限。 */
5184
+ attempt?: number;
5185
+ maxAttempts?: number;
5186
+ /** 已传与总字节数,供共享展示层估算速度。 */
5187
+ bytesTransferred?: number;
5188
+ bytesTotal?: number;
5189
+ /** 跨刷新恢复可用性;缺省尚未建立恢复记录。 */
5190
+ recovery?: 'available' | 'session-only';
5191
+ recoveryReason?: string;
5137
5192
  /** 可供产品按 code/category 决策的稳定错误;不含底层 URL、密钥或响应正文。 */
5138
5193
  error?: ImSdkErrorShape;
5139
5194
  }
@@ -5171,11 +5226,31 @@ interface ImMediaTasksApi {
5171
5226
  * @throws 未知任务、非法状态或底层未受理时以稳定 `IM_SDK_MEDIA_TASK_*` 错误拒绝。
5172
5227
  */
5173
5228
  cancel: (taskId: string) => Promise<void>;
5229
+ /** 暂停上传,等待请求收尾后返回;下载不支持暂停。 */
5230
+ pause: (taskId: string) => Promise<void>;
5231
+ /** 恢复已暂停上传,复用同一原文件与消息。 */
5232
+ resume: (taskId: string) => Promise<void>;
5233
+ /** 只暴露恢复可用性,不返回文件密钥或远端分片凭据。 */
5234
+ getUploadRecovery: (message: ImMessageRef) => Promise<{
5235
+ available: boolean;
5236
+ reason?: string;
5237
+ expiresAt?: number;
5238
+ }>;
5239
+ /** 用户重选原文件并通过完整内容校验后恢复原消息。 */
5240
+ resumeUpload: (message: ImMessageRef, input: {
5241
+ file: Blob;
5242
+ }) => Promise<void>;
5174
5243
  /**
5175
5244
  * 重试 failed/canceled 任务;上传复用保留原文件,下载重新解析同一精确消息引用。
5245
+ * 续传不可用或清理未确认时,必须先征得用户同意重新上传,再传 restartUpload:true。
5246
+ * 用户取消后的重发始终重新上传尚未完成的资源;成功的合集项仍可复用。
5247
+ * 下载取消已受理后即可创建新尝试,不复用旧取消 Promise;旧 loader 结束前仍占用并发槽,但不能覆盖新任务。
5176
5248
  * @throws 原文件已淘汰、任务仍在途或消息/下载 capability 不可用时显式拒绝。
5177
5249
  */
5178
- retry: (taskId: string) => Promise<void>;
5250
+ retry: (taskId: string, options?: {
5251
+ /** 用户已确认放弃旧进度并重新上传;仅上传任务接受,清理失败时仍停止。 */
5252
+ restartUpload?: boolean;
5253
+ }) => Promise<void>;
5179
5254
  /**
5180
5255
  * 下载并按消息正文合同解密,同一消息并发调用复用同一 Promise,成功返回 Blob。
5181
5256
  * @throws 消息不存在/非媒体/无远端 URL/未装配 capability、传输失败、取消或 teardown 均以稳定错误拒绝,不返回空 Blob。
@@ -5386,6 +5461,10 @@ interface ImProductEventMap {
5386
5461
  'sync:complete': Readonly<{
5387
5462
  conversations: readonly ConversationRef<ProductConversationListType>[];
5388
5463
  }>;
5464
+ /** 当前账号仍有会话同步或前台内容读取;false 仅表示读取结束,错误仍走 error 事件。 */
5465
+ 'receiving:changed': Readonly<{
5466
+ receiving: boolean;
5467
+ }>;
5389
5468
  /** `lastLoginTime` 为服务端记录的上次登录时间(毫秒),仅被踢且走登录 ACK 的路径才有值。 */
5390
5469
  'auth:invalid': Readonly<{
5391
5470
  code: string;
@@ -5964,6 +6043,10 @@ interface ImClientOptions {
5964
6043
  * 缺省则**不装配媒体传输端口** → `sendImage`/`sendVideo`/`loadImage`/`loadVideo` 显式不可用(connection 层 reject,非静默);预览(Canvas 缩略图/封面)不依赖此配置、恒可用。
5965
6044
  */
5966
6045
  media?: ImMediaConfig;
6046
+ /** 显式开启视频/文件跨刷新续传。最多 3 条、24 小时,保存加密密钥但不保存文件副本;注销清除。 */
6047
+ uploadRecovery?: {
6048
+ enabled: boolean;
6049
+ };
5967
6050
  }
5968
6051
  /**
5969
6052
  * 官方 UI Kit、调试工具与高级宿主的装配参数。
@@ -6576,6 +6659,10 @@ interface ChatRuntimeHostDeps {
6576
6659
  clientType: number;
6577
6660
  /** 获取当前环境的媒体上传下载配置;未启用媒体能力时返回 `undefined`。 */
6578
6661
  getMediaConfig: () => ImMediaConfig | undefined;
6662
+ /** 显式启用账号隔离的跨刷新恢复记录;保存密钥、不保存原文件,注销清除。 */
6663
+ uploadRecovery?: {
6664
+ enabled: boolean;
6665
+ };
6579
6666
  /** 获取 GIF provider 配置;API key 只留在宿主闭包与 SDK adapter,不进入共享 Store。 */
6580
6667
  getExpressionOptions?: () => ImExpressionOptions | undefined;
6581
6668
  }
@@ -7470,10 +7557,16 @@ interface ImHistoryReturnAfterSendCoordinator {
7470
7557
  */
7471
7558
  declare function useImHistoryReturnAfterSendCoordinator(pinia?: Pinia): ImHistoryReturnAfterSendCoordinator;
7472
7559
 
7560
+ /** 展示层估算,不表示服务端确认进度或最终处理耗时。 */
7561
+ interface MediaTransferEstimate {
7562
+ readonly bytesPerSecond: number;
7563
+ readonly estimatedRemainingMs: number;
7564
+ }
7565
+
7473
7566
  /** 页面可保存和判断的媒体错误;底层响应、异常对象和详情只进入统一诊断,不进入 Pinia。 */
7474
7567
  type ImMediaStoreError = Readonly<Omit<ImSdkErrorShape, 'cause' | 'details'>>;
7475
7568
  /** 页面可展示的只读媒体任务;不含文件字节、本地地址、密钥、中止控制器或传输对象。 */
7476
- type ImMediaTaskPresentation = Readonly<Omit<ImMediaTask, 'error'> & {
7569
+ type ImMediaTaskPresentation = Readonly<Omit<ImMediaTask, 'error'> & Partial<MediaTransferEstimate> & {
7477
7570
  error?: ImMediaStoreError;
7478
7571
  }>;
7479
7572
  /** 刷新页面导致上传源丢失后,通知宿主重新打开文件选择器所需的信息;File 本身不进入 Store。 */
@@ -7483,14 +7576,14 @@ interface ImMediaReplacementRequest {
7483
7576
  conversationType: ProductHandleConversationType;
7484
7577
  kind: 'video' | 'file';
7485
7578
  }
7486
- /** 取消/重试结果;`stale` 表示期间已切账号,宿主不应显示旧任务反馈。 */
7579
+ /** 媒体控制结果;`stale` 表示期间已切账号,宿主不应显示旧任务反馈。 */
7487
7580
  type ImMediaOperationResult = Readonly<{
7488
7581
  ok: true;
7489
- operation: 'cancel' | 'retry';
7582
+ operation: 'cancel' | 'retry' | 'pause' | 'resume' | 'resumeUpload';
7490
7583
  } | {
7491
7584
  ok: false;
7492
- operation: 'cancel' | 'retry';
7493
- reason: 'not-ready' | 'not-found' | 'failed' | 'stale';
7585
+ operation: 'cancel' | 'retry' | 'pause' | 'resume' | 'resumeUpload';
7586
+ reason: 'not-ready' | 'not-found' | 'ambiguous' | 'failed' | 'stale';
7494
7587
  error?: ImMediaStoreError;
7495
7588
  }>;
7496
7589
  /**
@@ -7505,6 +7598,7 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7505
7598
  tasks: any;
7506
7599
  error: any;
7507
7600
  uploadProgress: any;
7601
+ uploadTasks: any;
7508
7602
  downloadTasks: any;
7509
7603
  downloadProgress: any;
7510
7604
  uploadWaiting: any;
@@ -7513,9 +7607,21 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7513
7607
  start: () => void;
7514
7608
  reset: () => void;
7515
7609
  cancel: (taskId: string) => Promise<ImMediaOperationResult>;
7516
- retry: (taskId: string) => Promise<ImMediaOperationResult>;
7610
+ retry: (taskId: string, options?: {
7611
+ restartUpload?: boolean;
7612
+ }) => Promise<ImMediaOperationResult>;
7613
+ pause: (taskId: string) => Promise<ImMediaOperationResult>;
7614
+ resume: (taskId: string) => Promise<ImMediaOperationResult>;
7615
+ getUploadRecovery: (message: ImMessageRef) => Promise<{
7616
+ available: boolean;
7617
+ reason?: string;
7618
+ expiresAt?: number;
7619
+ }>;
7620
+ resumeUpload: (message: ImMessageRef, input: {
7621
+ file: Blob;
7622
+ }) => Promise<ImMediaOperationResult>;
7517
7623
  cancelUpload: (messageId: string) => Promise<ImMediaOperationResult>;
7518
- cancelDownload: (messageId: string, itemIndex?: number) => Promise<ImMediaOperationResult>;
7624
+ cancelDownload: (message: string | ImMessageRef, itemIndex?: number) => Promise<ImMediaOperationResult>;
7519
7625
  requestReplacement: (message: ImMessageView) => boolean;
7520
7626
  takeReplacementRequest: () => ImMediaReplacementRequest | null;
7521
7627
  clearReplacementRequest: () => void;
@@ -7524,6 +7630,7 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7524
7630
  tasks: any;
7525
7631
  error: any;
7526
7632
  uploadProgress: any;
7633
+ uploadTasks: any;
7527
7634
  downloadTasks: any;
7528
7635
  downloadProgress: any;
7529
7636
  uploadWaiting: any;
@@ -7532,9 +7639,21 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7532
7639
  start: () => void;
7533
7640
  reset: () => void;
7534
7641
  cancel: (taskId: string) => Promise<ImMediaOperationResult>;
7535
- retry: (taskId: string) => Promise<ImMediaOperationResult>;
7642
+ retry: (taskId: string, options?: {
7643
+ restartUpload?: boolean;
7644
+ }) => Promise<ImMediaOperationResult>;
7645
+ pause: (taskId: string) => Promise<ImMediaOperationResult>;
7646
+ resume: (taskId: string) => Promise<ImMediaOperationResult>;
7647
+ getUploadRecovery: (message: ImMessageRef) => Promise<{
7648
+ available: boolean;
7649
+ reason?: string;
7650
+ expiresAt?: number;
7651
+ }>;
7652
+ resumeUpload: (message: ImMessageRef, input: {
7653
+ file: Blob;
7654
+ }) => Promise<ImMediaOperationResult>;
7536
7655
  cancelUpload: (messageId: string) => Promise<ImMediaOperationResult>;
7537
- cancelDownload: (messageId: string, itemIndex?: number) => Promise<ImMediaOperationResult>;
7656
+ cancelDownload: (message: string | ImMessageRef, itemIndex?: number) => Promise<ImMediaOperationResult>;
7538
7657
  requestReplacement: (message: ImMessageView) => boolean;
7539
7658
  takeReplacementRequest: () => ImMediaReplacementRequest | null;
7540
7659
  clearReplacementRequest: () => void;
@@ -7543,6 +7662,7 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7543
7662
  tasks: any;
7544
7663
  error: any;
7545
7664
  uploadProgress: any;
7665
+ uploadTasks: any;
7546
7666
  downloadTasks: any;
7547
7667
  downloadProgress: any;
7548
7668
  uploadWaiting: any;
@@ -7551,9 +7671,21 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7551
7671
  start: () => void;
7552
7672
  reset: () => void;
7553
7673
  cancel: (taskId: string) => Promise<ImMediaOperationResult>;
7554
- retry: (taskId: string) => Promise<ImMediaOperationResult>;
7674
+ retry: (taskId: string, options?: {
7675
+ restartUpload?: boolean;
7676
+ }) => Promise<ImMediaOperationResult>;
7677
+ pause: (taskId: string) => Promise<ImMediaOperationResult>;
7678
+ resume: (taskId: string) => Promise<ImMediaOperationResult>;
7679
+ getUploadRecovery: (message: ImMessageRef) => Promise<{
7680
+ available: boolean;
7681
+ reason?: string;
7682
+ expiresAt?: number;
7683
+ }>;
7684
+ resumeUpload: (message: ImMessageRef, input: {
7685
+ file: Blob;
7686
+ }) => Promise<ImMediaOperationResult>;
7555
7687
  cancelUpload: (messageId: string) => Promise<ImMediaOperationResult>;
7556
- cancelDownload: (messageId: string, itemIndex?: number) => Promise<ImMediaOperationResult>;
7688
+ cancelDownload: (message: string | ImMessageRef, itemIndex?: number) => Promise<ImMediaOperationResult>;
7557
7689
  requestReplacement: (message: ImMessageView) => boolean;
7558
7690
  takeReplacementRequest: () => ImMediaReplacementRequest | null;
7559
7691
  clearReplacementRequest: () => void;
@@ -7683,7 +7815,10 @@ interface ImMessageOperationsStoreActions {
7683
7815
  recall: (message: ImMessageView) => Promise<ImMessageActionResult>;
7684
7816
  deleteLocal: (message: ImMessageView) => Promise<ImMessageActionResult>;
7685
7817
  deleteForEveryone: (message: ImMessageView) => Promise<ImMessageActionResult>;
7686
- retry: (messageId: string) => Promise<ImMessageActionResult>;
7818
+ /** 完整重传需由宿主先取得用户确认,普通重发不传 options。 */
7819
+ retry: (messageId: string, options?: {
7820
+ restartUpload?: boolean;
7821
+ }) => Promise<ImMessageActionResult>;
7687
7822
  pin: (message: ImMessageView) => Promise<ImPinnedMessageActionResult>;
7688
7823
  unpin: () => Promise<ImPinnedMessageActionResult>;
7689
7824
  syncPinned: () => Promise<ImPinnedMessageActionResult>;
@@ -8199,7 +8334,10 @@ declare function defineImProfileDirectoryStore(pinia: Pinia): pinia.StoreDefinit
8199
8334
  forceRefresh?: boolean;
8200
8335
  }) => Promise<ImProfileDirectoryResult>;
8201
8336
  requestMembershipJoin: (ref: ConversationRef<"group" | "channel">, options?: {
8337
+ /** 指定邀请码时走邀请码加入流程,不提交申请说明。 */
8202
8338
  inviteCode?: string;
8339
+ /** 申请加入时附带给管理员的说明,原样交给对应群类型的 SDK API。 */
8340
+ remarks?: string;
8203
8341
  }) => Promise<ImMembershipJoinActionResult>;
8204
8342
  updateChannelName: (ref: ConversationRef<"channel">, name: string) => Promise<ImChannelProfileActionResultFor<"update-name">>;
8205
8343
  updateChannelDescription: (ref: ConversationRef<"channel">, description: string) => Promise<ImChannelProfileActionResultFor<"update-description">>;
@@ -8373,7 +8511,10 @@ declare function defineImProfileDirectoryStore(pinia: Pinia): pinia.StoreDefinit
8373
8511
  forceRefresh?: boolean;
8374
8512
  }) => Promise<ImProfileDirectoryResult>;
8375
8513
  requestMembershipJoin: (ref: ConversationRef<"group" | "channel">, options?: {
8514
+ /** 指定邀请码时走邀请码加入流程,不提交申请说明。 */
8376
8515
  inviteCode?: string;
8516
+ /** 申请加入时附带给管理员的说明,原样交给对应群类型的 SDK API。 */
8517
+ remarks?: string;
8377
8518
  }) => Promise<ImMembershipJoinActionResult>;
8378
8519
  updateChannelName: (ref: ConversationRef<"channel">, name: string) => Promise<ImChannelProfileActionResultFor<"update-name">>;
8379
8520
  updateChannelDescription: (ref: ConversationRef<"channel">, description: string) => Promise<ImChannelProfileActionResultFor<"update-description">>;
@@ -8547,7 +8688,10 @@ declare function defineImProfileDirectoryStore(pinia: Pinia): pinia.StoreDefinit
8547
8688
  forceRefresh?: boolean;
8548
8689
  }) => Promise<ImProfileDirectoryResult>;
8549
8690
  requestMembershipJoin: (ref: ConversationRef<"group" | "channel">, options?: {
8691
+ /** 指定邀请码时走邀请码加入流程,不提交申请说明。 */
8550
8692
  inviteCode?: string;
8693
+ /** 申请加入时附带给管理员的说明,原样交给对应群类型的 SDK API。 */
8694
+ remarks?: string;
8551
8695
  }) => Promise<ImMembershipJoinActionResult>;
8552
8696
  updateChannelName: (ref: ConversationRef<"channel">, name: string) => Promise<ImChannelProfileActionResultFor<"update-name">>;
8553
8697
  updateChannelDescription: (ref: ConversationRef<"channel">, description: string) => Promise<ImChannelProfileActionResultFor<"update-description">>;
@@ -8910,6 +9054,8 @@ interface ApplyImSessionInput {
8910
9054
  interface ImSessionStore {
8911
9055
  readonly accountId: string;
8912
9056
  readonly connectionState: ImConnectionState;
9057
+ /** SDK 正在同步会话、离线消息或读取前台会话内容;连接异常提示仍应优先展示。 */
9058
+ readonly receiving: boolean;
8913
9059
  readonly generation: number;
8914
9060
  readonly phase: ImSessionPhase;
8915
9061
  readonly errorKey: string;
@@ -8926,6 +9072,7 @@ interface ImSessionStore {
8926
9072
  declare function defineImSessionStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-session", Pick<{
8927
9073
  accountId: any;
8928
9074
  connectionState: any;
9075
+ receiving: any;
8929
9076
  generation: any;
8930
9077
  phase: any;
8931
9078
  errorKey: any;
@@ -8942,6 +9089,7 @@ declare function defineImSessionStore(pinia: Pinia): pinia.StoreDefinition<"k2-i
8942
9089
  }, any>, Pick<{
8943
9090
  accountId: any;
8944
9091
  connectionState: any;
9092
+ receiving: any;
8945
9093
  generation: any;
8946
9094
  phase: any;
8947
9095
  errorKey: any;
@@ -8958,6 +9106,7 @@ declare function defineImSessionStore(pinia: Pinia): pinia.StoreDefinition<"k2-i
8958
9106
  }, any>, Pick<{
8959
9107
  accountId: any;
8960
9108
  connectionState: any;
9109
+ receiving: any;
8961
9110
  generation: any;
8962
9111
  phase: any;
8963
9112
  errorKey: any;