k2-im 0.1.37 → 0.1.39

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.js CHANGED
@@ -1 +1 @@
1
- export{Ta as canCopyImageToClipboard,Ua as copyImageToClipboard,B as createLazyBrowserApiProtocolClient}from'./chunk-HUSCO5JM.js';import'./chunk-75GNCLQQ.js';import'./chunk-WOT6VMZA.js';
1
+ export{Ta as canCopyImageToClipboard,Ua as copyImageToClipboard,B as createLazyBrowserApiProtocolClient}from'./chunk-SRMSBFOP.js';import'./chunk-54HSPG2Z.js';import'./chunk-WOT6VMZA.js';
@@ -713,7 +713,7 @@ interface MediaTaskUpdate {
713
713
  * upload 任务子阶段。
714
714
  *
715
715
  * `waiting-upload-slot` 与 `state: 'queued'` 同时出现,表示还没开始传字节(在生成缩略图或在等上传槽位),
716
- * 此时 percent 恒为 0;`transferring` 正在传字节;`finalizing` 是等待远端 URL 最终确认。
716
+ * 首发 percent 为 0,断点恢复时保留已有进度;`transferring` 正在传字节;`finalizing` 是等待远端 URL 最终确认。
717
717
  */
718
718
  phase?: 'waiting-upload-slot' | 'waiting-retry' | 'transferring' | 'finalizing';
719
719
  /** 当前发送意图的尝试序号与总上限。 */
@@ -722,6 +722,18 @@ interface MediaTaskUpdate {
722
722
  /** 已传与总字节数,供共享展示层估算速度。 */
723
723
  bytesTransferred?: number;
724
724
  bytesTotal?: number;
725
+ /** 上传合集的逐项真实字节快照;整组发送仍由外层任务控制,不为每格创建独立发送。 */
726
+ items?: readonly Readonly<{
727
+ /** 从零开始的合集位置。 */
728
+ itemIndex: number;
729
+ /** 本项实际上传字节与源文件总字节。 */
730
+ bytesTransferred: number;
731
+ bytesTotal: number;
732
+ /** 远端资源确认完成前最多 99%。 */
733
+ percent: number;
734
+ /** 本项状态;已完成项不随兄弟项取消或失败回退。 */
735
+ state: 'queued' | 'running' | 'completed' | 'failed' | 'canceled';
736
+ }>[];
725
737
  /** 跨刷新恢复可用性;缺省尚未建立恢复记录。 */
726
738
  recovery?: 'available' | 'session-only';
727
739
  recoveryReason?: string;
@@ -1860,6 +1872,8 @@ interface MediaAssetCacheStrategy {
1860
1872
  softMaxBytes: number;
1861
1873
  maxEntries: number;
1862
1874
  maxEntryBytes: number;
1875
+ /** 完整媒体副本允许连续未访问的最长毫秒数;省略时不按时间过期,仍执行容量限制。 */
1876
+ maxIdleMs?: number;
1863
1877
  }
1864
1878
  /** 精确按 kind 解析策略;未注册返回 undefined,不提供默认策略。 */
1865
1879
  interface MediaAssetCacheStrategyRegistry {
@@ -1873,8 +1887,12 @@ interface MediaAssetCacheStrategyRegistry {
1873
1887
  */
1874
1888
  interface MediaAssetCachePort {
1875
1889
  get: (key: MediaAssetCacheKey) => Promise<MediaAssetCacheEntry | null>;
1890
+ /** 按输入顺序检查完整资源是否存在且未过期;不读取 Blob、不延长闲置期限,存储故障必须抛出。 */
1891
+ hasMany?: (keys: readonly MediaAssetCacheKey[]) => Promise<readonly boolean[]>;
1876
1892
  put: (entry: MediaAssetCacheEntry) => Promise<'stored' | 'skipped'>;
1877
1893
  clear: () => Promise<void>;
1894
+ /** 删除超过闲置期限的完整持久副本;不撤销已经返回的 Blob 或宿主持有的播放地址。 */
1895
+ prune?: () => Promise<void>;
1878
1896
  }
1879
1897
 
1880
1898
  interface ImProfilePort {
@@ -2419,6 +2437,11 @@ type ImEvent = {
2419
2437
  | {
2420
2438
  type: 'receiving:changed';
2421
2439
  receiving: boolean;
2440
+ }
2441
+ /** 全局会话与离线消息同步;不包含当前会话的打开或历史分页。 */
2442
+ | {
2443
+ type: 'syncing:changed';
2444
+ syncing: boolean;
2422
2445
  } | {
2423
2446
  type: 'auth:invalid';
2424
2447
  issue: ImAuthIssue;
@@ -2978,8 +3001,8 @@ interface IndexedDbStorageAdapterOptions {
2978
3001
  maxPendingWriteBytes?: number;
2979
3002
  };
2980
3003
  }
2981
- /** 官方浏览器 adapter 始终提供背景和最近历史缓存;可选只存在于通用 `ImStoragePort` 兼容边界。 */
2982
- type IndexedDbStorageAdapter = ImStoragePort & MediaAssetCachePort & Required<Pick<ImStoragePort, 'getConversationBackground' | 'recentHistoryCache' | 'saveConversationBackground' | 'deleteConversationBackground' | 'getDefaultConversationBackground' | 'saveDefaultConversationBackground' | 'deleteDefaultConversationBackground'>>;
3004
+ /** 官方浏览器 adapter 始终提供背景、最近历史和媒体缓存维护;通用端口为其它实现保留可选能力。 */
3005
+ type IndexedDbStorageAdapter = ImStoragePort & MediaAssetCachePort & Required<Pick<MediaAssetCachePort, 'prune' | 'hasMany'>> & Required<Pick<ImStoragePort, 'getConversationBackground' | 'recentHistoryCache' | 'saveConversationBackground' | 'deleteConversationBackground' | 'getDefaultConversationBackground' | 'saveDefaultConversationBackground' | 'deleteDefaultConversationBackground'>>;
2983
3006
  /**
2984
3007
  * 创建 IndexedDB 存储 adapter(实现 ImStoragePort)。
2985
3008
  * 生命周期:先 `open({ namespace })`(幂等,跑 schema 迁移),再读写;`close()` 释放句柄。
@@ -3901,6 +3924,8 @@ interface ImLifecycleSnapshot {
3901
3924
  authenticated: boolean;
3902
3925
  /** 会话同步或前台内容读取仍在进行;不包含后台预取、媒体下载和写操作,也不代表同步成功。 */
3903
3926
  receiving: boolean;
3927
+ /** 全局会话与离线消息同步仍在进行;前台会话读取由 receiving 和窗口 loading 表示。 */
3928
+ syncing: boolean;
3904
3929
  }
3905
3930
  /** logout 的本地数据与在途消息策略。 */
3906
3931
  interface ImLogoutOptions {
@@ -5071,17 +5096,19 @@ interface ConversationHandle<TType extends ProductHandleConversationType = Produ
5071
5096
  resolveMessage: (messageId: string) => Promise<ImMessageView | null>;
5072
5097
  history: {
5073
5098
  loadLatest: () => Promise<void>;
5074
- /** 有限加载进入时冻结边界;成功才替换窗口,不可定位返回 false,网络失败抛错并保留数量。 */
5075
- loadEntryUnread: () => Promise<boolean>;
5099
+ /** 读取进入时冻结边界;signal 取消会停止查询且不替换窗口,可重新发起。不可定位返回 false,失败抛错。 */
5100
+ loadEntryUnread: (options?: {
5101
+ signal?: AbortSignal;
5102
+ }) => Promise<boolean>;
5076
5103
  loadOlder: () => Promise<void>;
5077
5104
  /** 历史定位窗口向更新方向连续翻页;接回最新端后 `hasNewer` 变为 false。 */
5078
5105
  loadNewer: () => Promise<void>;
5079
5106
  /**
5080
5107
  * 按稳定消息 id 打开目标附近的连续历史窗口。
5081
5108
  *
5082
- * @remarks 冷启动时允许使用同一复合会话的完整置顶预览或短期搜索结果作为只读锚点;二者都不会因此写入
5083
- * 普通消息 Store,partial 置顶、过期搜索结果仍因缺少可信排序信息而明确拒绝定位。
5084
- * @throws 目标不在本机历史或不属于当前复合会话时,抛出稳定 `IM_SDK_MESSAGE_NOT_FOUND`
5109
+ * @remarks GROUP 完整置顶预览可按消息时间定位;CHANNEL 置顶未缓存时先按 ID 取回正式历史记录,
5110
+ * 以服务端游标继续双向分页。短期搜索结果只作为只读锚点;partial 置顶和过期搜索结果明确拒绝定位。
5111
+ * @throws 没有可用锚点、远端确认缺失或目标不属于当前复合会话时,抛出稳定 `IM_SDK_MESSAGE_NOT_FOUND`
5085
5112
  * (`category: 'state'`、`retryable: false`、`details.messageId`)。这是常见产品结果而非链路异常,
5086
5113
  * 调用方应据此与真正的存储/协议失败区分反馈,不要解析错误文案。
5087
5114
  */
@@ -5217,6 +5244,8 @@ interface ImMediaTask {
5217
5244
  * 上传任务不带下标:一条合集整体只有一条上传进度(所有项都传完才算这条消息发出去)。
5218
5245
  */
5219
5246
  itemIndex?: number;
5247
+ /** 合集各项的真实上传快照;控制动作仍作用于整条消息,不包含资源或传输凭据。 */
5248
+ items?: MediaTaskUpdate['items'];
5220
5249
  /** upload 来自发送链路,download 来自本产品 API。 */
5221
5250
  direction: 'upload' | 'download';
5222
5251
  /** 终态 completed/failed/canceled 不会被同一尝试的迟到 progress 回退。 */
@@ -5262,6 +5291,20 @@ interface ImMediaTask {
5262
5291
  * ```
5263
5292
  */
5264
5293
  interface ImMediaTasksApi {
5294
+ /** 清除当前账号完整媒体缓存及下载断点;保留消息、草稿、上传源和已交付的播放资源,在途下载仍可完成。 */
5295
+ clearCache: () => Promise<void>;
5296
+ /**
5297
+ * 按输入顺序查询完整本机媒体是否可用;不下载、不读取 Blob、不续缓存期限或创建任务。
5298
+ * 仅支持图片/视频(含媒体合集);未配置持久缓存时只检查内存。
5299
+ * @throws 不支持轻量查询或存储读取失败时明确拒绝,不伪装成未命中。
5300
+ * @example const [available] = await client.media.probeCached([messageRef])
5301
+ */
5302
+ probeCached: (messages: readonly ImMessageRef[]) => Promise<readonly boolean[]>;
5303
+ /**
5304
+ * 缓存写入、清理或过期后通知消费者重新查询;账号销毁后自动退订。
5305
+ * @example const stop = client.media.subscribeCacheChanges(() => refreshVisibleMedia())
5306
+ */
5307
+ subscribeCacheChanges: (listener: () => void) => () => void;
5265
5308
  /**
5266
5309
  * 返回当前账号全部活跃任务与近期终态任务的冻结快照;总量超过 128 时只淘汰终态,极端并发活跃可暂时超过上限。
5267
5310
  * @throws runtime 已 logout/dispose 时抛 `IM_SDK_MEDIA_RUNTIME_INACTIVE`。
@@ -5276,7 +5319,10 @@ interface ImMediaTasksApi {
5276
5319
  * 取消 queued/running 任务;上传委托 core,下载中止当前 AbortController。
5277
5320
  * @throws 未知任务、非法状态或底层未受理时以稳定 `IM_SDK_MEDIA_TASK_*` 错误拒绝。
5278
5321
  */
5279
- cancel: (taskId: string) => Promise<void>;
5322
+ cancel: (taskId: string, options?: {
5323
+ /** 取消发送但保留已确认上传分片与原文件,只有用户显式重试才继续。默认取消仍清理。 */
5324
+ retainCheckpoint?: boolean;
5325
+ }) => Promise<void>;
5280
5326
  /** 暂停上传,等待请求收尾后返回;下载不支持暂停。 */
5281
5327
  pause: (taskId: string) => Promise<void>;
5282
5328
  /** 恢复已暂停上传,复用同一原文件与消息。 */
@@ -5294,19 +5340,28 @@ interface ImMediaTasksApi {
5294
5340
  /**
5295
5341
  * 重试 failed/canceled 任务;上传复用保留原文件,下载重新解析同一精确消息引用。
5296
5342
  * 续传不可用或清理未确认时,必须先征得用户同意重新上传,再传 restartUpload:true。
5297
- * 用户取消后的重发始终重新上传尚未完成的资源;成功的合集项仍可复用。
5343
+ * 保留式取消后的重发复用已确认分片和原密钥;默认清理式取消不保证保有原文件。
5298
5344
  * 下载取消已受理后即可创建新尝试,不复用旧取消 Promise;旧 loader 结束前仍占用并发槽,但不能覆盖新任务。
5299
5345
  * @throws 原文件已淘汰、任务仍在途或消息/下载 capability 不可用时显式拒绝。
5300
5346
  */
5301
5347
  retry: (taskId: string, options?: {
5302
5348
  /** 用户已确认放弃旧进度并重新上传;仅上传任务接受,清理失败时仍停止。 */
5303
5349
  restartUpload?: boolean;
5350
+ /** 下载断点已失效或超出缓存预算时,用户确认从头下载。 */
5351
+ restartDownload?: boolean;
5304
5352
  }) => Promise<void>;
5305
5353
  /**
5306
5354
  * 下载并按消息正文合同解密,同一消息并发调用复用同一 Promise,成功返回 Blob。
5307
5355
  * @throws 消息不存在/非媒体/无远端 URL/未装配 capability、传输失败、取消或 teardown 均以稳定错误拒绝,不返回空 Blob。
5308
5356
  */
5309
5357
  download: (message: ImMessageRef) => Promise<Blob>;
5358
+ /**
5359
+ * 将最近预览的精确媒体项设为最高下载优先级,不新建或取消任务。
5360
+ * 下一空闲任务/分片请求名额优先给该项;已发请求不中断,关闭播放器不撤销优先级。
5361
+ * 后续调用替换上一个目标;账号退出后不可调用。
5362
+ * @example client.media.prioritizeDownload({ conversation, messageId, itemIndex: 1 })
5363
+ */
5364
+ prioritizeDownload: (message: ImMessageRef) => void;
5310
5365
  /**
5311
5366
  * 仅读取当前账号内存或持久媒体资产缓存;命中返回 Blob,未缓存或类型未注册返回 `null`。
5312
5367
  *
@@ -5516,6 +5571,10 @@ interface ImProductEventMap {
5516
5571
  'receiving:changed': Readonly<{
5517
5572
  receiving: boolean;
5518
5573
  }>;
5574
+ /** 全局同步所有支路的汇总状态;不包含打开会话、历史分页或后台预取。 */
5575
+ 'syncing:changed': Readonly<{
5576
+ syncing: boolean;
5577
+ }>;
5519
5578
  /** `lastLoginTime` 为服务端记录的上次登录时间(毫秒),仅被踢且走登录 ACK 的路径才有值。 */
5520
5579
  'auth:invalid': Readonly<{
5521
5580
  code: string;
@@ -5832,7 +5891,18 @@ interface ProductMessageSearchResult<TContent extends MessageContentType = Messa
5832
5891
  createdAt: number;
5833
5892
  contentType: TContent;
5834
5893
  preview: string;
5894
+ /** 展示用片段;正文/配文携带提及信息,文件名等业务字段保持普通文本。拼接后与 preview 相同。 */
5895
+ previewParts: readonly ProductMessageSearchPreviewPart[];
5835
5896
  }
5897
+ /** 搜索摘要的最小内容投影;不携带完整消息、媒体资源或协议字段。 */
5898
+ type ProductMessageSearchPreviewPart = {
5899
+ kind: 'plain';
5900
+ text: string;
5901
+ } | {
5902
+ kind: 'rich-text';
5903
+ text: string;
5904
+ mention?: ImMessageMention;
5905
+ };
5836
5906
  /** 产品消息搜索页;底层 `beforeSortKey` 仅存在于账号 runtime token registry。 */
5837
5907
  interface ProductMessageSearchPage<TContent extends MessageContentType = MessageContentType> {
5838
5908
  items: readonly ProductMessageSearchResult<TContent>[];
@@ -6097,6 +6167,7 @@ interface ImClientOptions {
6097
6167
  /** 显式开启视频/文件跨刷新续传。最多 3 条、24 小时,保存加密密钥但不保存文件副本;注销清除。 */
6098
6168
  uploadRecovery?: {
6099
6169
  enabled: boolean;
6170
+ retainFailedUploads?: boolean;
6100
6171
  };
6101
6172
  }
6102
6173
  /**
@@ -6713,6 +6784,7 @@ interface ChatRuntimeHostDeps {
6713
6784
  /** 显式启用账号隔离的跨刷新恢复记录;保存密钥、不保存原文件,注销清除。 */
6714
6785
  uploadRecovery?: {
6715
6786
  enabled: boolean;
6787
+ retainFailedUploads?: boolean;
6716
6788
  };
6717
6789
  /** 获取 GIF provider 配置;API key 只留在宿主闭包与 SDK adapter,不进入共享 Store。 */
6718
6790
  getExpressionOptions?: () => ImExpressionOptions | undefined;
@@ -6990,7 +7062,11 @@ interface ChatRuntime {
6990
7062
  resolveMediaPreviewToRemote: (ref: ChatMediaMessageRef, contentType: 'image' | 'video' | 'sticker', byteSize?: number) => void;
6991
7063
  /** 为指定消息取得本地媒体播放租约;没有本地缓存时返回 `undefined`,调用方应改用远端资源。 */
6992
7064
  acquireMediaBlob: (ref: ChatMediaMessageRef) => MediaObjectUrlLease | undefined;
7065
+ /** 只读检查完整本地媒体是否可用,不取得租约、不改变缓存淘汰顺序。 */
7066
+ hasMediaBlob: (ref: ChatMediaMessageRef) => boolean;
6993
7067
  /** 撤销当前账号创建的全部媒体预览地址并释放 Blob 内存,切账号、退出或销毁时调用。 */
7068
+ /** 清理当前账号完整媒体缓存和下载断点;上传源保留,正在使用的播放地址在释放后才撤销。 */
7069
+ clearMediaCache: () => Promise<void>;
6994
7070
  cleanupLocalMediaBlobs: () => void;
6995
7071
  /** 删除会话时释放该会话绑定的本地媒体预览/播放缓存。 */
6996
7072
  cleanupConversationMediaBlobs: (conversation: ConversationRef<'direct' | 'group' | 'channel' | 'robot'>) => void;
@@ -7655,11 +7731,18 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7655
7731
  uploadWaiting: any;
7656
7732
  uploadFinalizing: any;
7657
7733
  replacementRequest: any;
7734
+ cacheAvailability: any;
7735
+ cachedAvailability: (message: ImMessageView, itemIndex?: number) => boolean | undefined;
7736
+ cacheProbePending: any;
7737
+ cacheAvailabilityPending: (message: ImMessageView, itemIndex?: number) => boolean;
7658
7738
  start: () => void;
7659
7739
  reset: () => void;
7660
- cancel: (taskId: string) => Promise<ImMediaOperationResult>;
7740
+ cancel: (taskId: string, options?: {
7741
+ retainCheckpoint?: boolean;
7742
+ }) => Promise<ImMediaOperationResult>;
7661
7743
  retry: (taskId: string, options?: {
7662
7744
  restartUpload?: boolean;
7745
+ restartDownload?: boolean;
7663
7746
  }) => Promise<ImMediaOperationResult>;
7664
7747
  pause: (taskId: string) => Promise<ImMediaOperationResult>;
7665
7748
  resume: (taskId: string) => Promise<ImMediaOperationResult>;
@@ -7671,7 +7754,9 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7671
7754
  resumeUpload: (message: ImMessageRef, input: {
7672
7755
  file: Blob;
7673
7756
  }) => Promise<ImMediaOperationResult>;
7674
- cancelUpload: (messageId: string) => Promise<ImMediaOperationResult>;
7757
+ cancelUpload: (messageId: string, options?: {
7758
+ retainCheckpoint?: boolean;
7759
+ }) => Promise<ImMediaOperationResult>;
7675
7760
  cancelDownload: (message: string | ImMessageRef, itemIndex?: number) => Promise<ImMediaOperationResult>;
7676
7761
  requestReplacement: (message: ImMessageView) => boolean;
7677
7762
  takeReplacementRequest: () => ImMediaReplacementRequest | null;
@@ -7687,11 +7772,18 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7687
7772
  uploadWaiting: any;
7688
7773
  uploadFinalizing: any;
7689
7774
  replacementRequest: any;
7775
+ cacheAvailability: any;
7776
+ cachedAvailability: (message: ImMessageView, itemIndex?: number) => boolean | undefined;
7777
+ cacheProbePending: any;
7778
+ cacheAvailabilityPending: (message: ImMessageView, itemIndex?: number) => boolean;
7690
7779
  start: () => void;
7691
7780
  reset: () => void;
7692
- cancel: (taskId: string) => Promise<ImMediaOperationResult>;
7781
+ cancel: (taskId: string, options?: {
7782
+ retainCheckpoint?: boolean;
7783
+ }) => Promise<ImMediaOperationResult>;
7693
7784
  retry: (taskId: string, options?: {
7694
7785
  restartUpload?: boolean;
7786
+ restartDownload?: boolean;
7695
7787
  }) => Promise<ImMediaOperationResult>;
7696
7788
  pause: (taskId: string) => Promise<ImMediaOperationResult>;
7697
7789
  resume: (taskId: string) => Promise<ImMediaOperationResult>;
@@ -7703,7 +7795,9 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7703
7795
  resumeUpload: (message: ImMessageRef, input: {
7704
7796
  file: Blob;
7705
7797
  }) => Promise<ImMediaOperationResult>;
7706
- cancelUpload: (messageId: string) => Promise<ImMediaOperationResult>;
7798
+ cancelUpload: (messageId: string, options?: {
7799
+ retainCheckpoint?: boolean;
7800
+ }) => Promise<ImMediaOperationResult>;
7707
7801
  cancelDownload: (message: string | ImMessageRef, itemIndex?: number) => Promise<ImMediaOperationResult>;
7708
7802
  requestReplacement: (message: ImMessageView) => boolean;
7709
7803
  takeReplacementRequest: () => ImMediaReplacementRequest | null;
@@ -7719,11 +7813,18 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7719
7813
  uploadWaiting: any;
7720
7814
  uploadFinalizing: any;
7721
7815
  replacementRequest: any;
7816
+ cacheAvailability: any;
7817
+ cachedAvailability: (message: ImMessageView, itemIndex?: number) => boolean | undefined;
7818
+ cacheProbePending: any;
7819
+ cacheAvailabilityPending: (message: ImMessageView, itemIndex?: number) => boolean;
7722
7820
  start: () => void;
7723
7821
  reset: () => void;
7724
- cancel: (taskId: string) => Promise<ImMediaOperationResult>;
7822
+ cancel: (taskId: string, options?: {
7823
+ retainCheckpoint?: boolean;
7824
+ }) => Promise<ImMediaOperationResult>;
7725
7825
  retry: (taskId: string, options?: {
7726
7826
  restartUpload?: boolean;
7827
+ restartDownload?: boolean;
7727
7828
  }) => Promise<ImMediaOperationResult>;
7728
7829
  pause: (taskId: string) => Promise<ImMediaOperationResult>;
7729
7830
  resume: (taskId: string) => Promise<ImMediaOperationResult>;
@@ -7735,7 +7836,9 @@ declare function defineImMediaStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-
7735
7836
  resumeUpload: (message: ImMessageRef, input: {
7736
7837
  file: Blob;
7737
7838
  }) => Promise<ImMediaOperationResult>;
7738
- cancelUpload: (messageId: string) => Promise<ImMediaOperationResult>;
7839
+ cancelUpload: (messageId: string, options?: {
7840
+ retainCheckpoint?: boolean;
7841
+ }) => Promise<ImMediaOperationResult>;
7739
7842
  cancelDownload: (message: string | ImMessageRef, itemIndex?: number) => Promise<ImMediaOperationResult>;
7740
7843
  requestReplacement: (message: ImMessageView) => boolean;
7741
7844
  takeReplacementRequest: () => ImMediaReplacementRequest | null;
@@ -8881,7 +8984,7 @@ interface ImQuotedMessageStoreActions {
8881
8984
  * 声明当前这一屏需要哪些被引原消息,并按需解析尚未解析的部分。
8882
8985
  *
8883
8986
  * 幂等且可以高频调用:已有结论的(解析成功、确认缺失、解析失败)都不会重复查询,窗口内已有的
8884
- * 消息也不占用回源额度。同一时刻只允许一批解析在跑,连续翻页产生的多次调用会自动合并,
8987
+ * 消息也不占用回源额度。同一活动线程只允许一批解析在跑,连续翻页产生的多次调用会自动合并,
8885
8988
  * 所以在消息列表变化时无脑调一次就行,不需要宿主自己做防抖。
8886
8989
  *
8887
8990
  * 传入顺序就是解析顺序。默认按窗口顺序传即可;如果宿主能判断用户正在看哪一段,把那段的 id 放
@@ -8955,6 +9058,96 @@ type ImReactionStore = Store<'k2-im-reaction', ImReactionStoreState, Record<stri
8955
9058
  /** 取得当前 Vue setup 或显式 Pinia 的 Reaction Store;不持有菜单、Toast 或 Reaction 领域快照。 */
8956
9059
  declare function useImReactionStore(pinia?: Pinia): ImReactionStore;
8957
9060
 
9061
+ /**
9062
+ * 为聊天主区域管理唯一一个“用户当前正在查看的消息线程”。
9063
+ *
9064
+ * 【页面得到什么】
9065
+ * Store 用 SDK 会话句柄打开一个明确的单聊、普通群或社群,并把该线程的一次完整更新转换成
9066
+ * `activeRef`、消息列表、已保存草稿、加载/就绪/过期状态、能否继续向前后翻页和错误。消息与草稿仍由
9067
+ * SDK 和本机存储维护;只供资料页使用的隐藏系统消息不会显示在聊天时间线,但原数据不会被删除。
9068
+ *
9069
+ * 【提供的能力】
9070
+ * - `open` / `close`:打开或关闭当前会话;打开新会话会停止旧会话页面订阅。
9071
+ * - `closeActiveConversation`:只关闭精确活动会话,保留正在打开的其他会话意图。
9072
+ * - `loadLatest` / `loadOlder` / `loadNewer`:加载最新一屏、向上翻更早消息或向下补更新消息。
9073
+ * - `loadAround`:为搜索定位加载目标消息附近窗口。
9074
+ * - `resolveMessage`:解析当前窗口之外但属于同一会话的本地消息。
9075
+ * - `retainHandle`:让已经开始的发送或上传在用户切会话后仍能安全完成,再关闭旧句柄。
9076
+ * - `reset` / `dispose`:切账号或销毁时作废订阅、分页结果并关闭全部会话句柄。
9077
+ *
9078
+ * 【并发与资源所有权】
9079
+ * 同一 Store 同时只有一个活动会话句柄。异步结果必须同时匹配最新操作序号、当前账号版本号、当前句柄
9080
+ * 和会话类型 + ID 才能更新页面;同 ID 的不同会话类型不会串线。句柄、订阅函数和“仍在使用”计数只在
9081
+ * 闭包中,不进入 `$state`。
9082
+ *
9083
+ * 【明确不负责】
9084
+ * Composer 输入、消息菜单、多选、DOM 滚动、路由和 toast 分别由其他共享 Store 或宿主平台层负责。
9085
+ */
9086
+
9087
+ type ProductConversationHandle = ConversationHandle<ProductHandleConversationType>;
9088
+ /** Thread Store 中由 Pinia 管理的当前窗口投影;句柄、订阅和租约留在闭包中。 */
9089
+ interface ImThreadStoreState {
9090
+ activeRef: ConversationRef<ProductHandleConversationType> | null;
9091
+ /** SDK 已校验的活动聊天展示资料;不依赖该聊天是否已进入会话列表。 */
9092
+ display: ConversationHandleSnapshot['display'] | null;
9093
+ messages: readonly ImMessageView[];
9094
+ entryUnread: ConversationEntryUnreadSnapshot;
9095
+ /** 本次进入前的数量与定位状态;列表清零后仍保留。 */
9096
+ entryUnreadNavigation: ConversationHandleSnapshot['entryUnreadNavigation'];
9097
+ draft: ConversationDraft | null;
9098
+ loading: boolean;
9099
+ ready: boolean;
9100
+ stale: boolean;
9101
+ hasOlder: boolean;
9102
+ hasNewer: boolean;
9103
+ error: ImSdkErrorShape | null;
9104
+ /** 当前活动会话待 Surface 消费的实时对端消息版本。 */
9105
+ activeRemoteMessageRevision: number;
9106
+ }
9107
+ /** Thread Store 的稳定公共动作;DOM 滚动、路由和反馈仍由宿主负责。 */
9108
+ interface ImThreadStoreActions {
9109
+ open: (ref: ConversationRef<ProductHandleConversationType>) => Promise<ProductConversationHandle | undefined>;
9110
+ invalidatePendingOpen: () => void;
9111
+ loadLatest: () => Promise<boolean>;
9112
+ /** 读取本次进入时冻结的首未读窗口;signal 取消时不替换当前窗口。 */
9113
+ loadEntryUnread: (options?: {
9114
+ signal?: AbortSignal;
9115
+ }) => Promise<boolean>;
9116
+ /** 页面确认可阅读后结算整会话;不会自动扩大可见消息回执。 */
9117
+ markConversationRead: () => Promise<void>;
9118
+ /** 只上报当前线程实际显示的消息集合。 */
9119
+ markVisibleMessages: (messageIds: readonly string[]) => Promise<void>;
9120
+ /** 明确业务离开;账号销毁和页面卸载仍使用无副作用的 close/reset。 */
9121
+ leave: () => void;
9122
+ loadOlder: () => Promise<boolean>;
9123
+ loadNewer: () => Promise<boolean>;
9124
+ loadAround: (messageId: string) => Promise<boolean>;
9125
+ resolveMessage: (messageId: string) => Promise<ImMessageView | null>;
9126
+ retainHandle: (handle?: ProductConversationHandle) => () => void;
9127
+ retainCurrentHandle: () => () => void;
9128
+ close: () => void;
9129
+ closeActiveConversation: (ref: ConversationRef<ProductHandleConversationType>) => boolean;
9130
+ reset: () => void;
9131
+ dispose: () => void;
9132
+ getHandle: () => ProductConversationHandle | undefined;
9133
+ /** 原子取走当前活动会话尚未被 Surface 消费的实时对端消息 id。 */
9134
+ drainActiveRemoteMessageIds: () => readonly string[];
9135
+ }
9136
+ /** 宿主从 `useImThreadStore` 获得的完整 Pinia Store 公共类型。 */
9137
+ type ImThreadStore = Store<'k2-im-thread', ImThreadStoreState, Record<string, never>, ImThreadStoreActions>;
9138
+ /** 取得当前 Vue setup 或显式 Pinia 的消息线程 Store;每个实例只管理一个当前会话。 */
9139
+ declare function useImThreadStore(pinia?: Pinia): ImThreadStore;
9140
+
9141
+ /** 搜索行的发送者投影;非 ready 状态不提供伪造姓名,由宿主翻译状态文案。 */
9142
+ interface ImSearchSenderPresentation {
9143
+ /** ready 表示已有名称;self/system 由宿主翻译;其余状态明确区分等待、缺失和请求失败。 */
9144
+ status: 'ready' | 'self' | 'system' | 'loading' | 'unavailable' | 'failed';
9145
+ /** 仅使用资料中的真实名称;没有名称时为空,数字昵称仍原样保留。 */
9146
+ name: string;
9147
+ /** 来自同一份共享资料缓存;缺失头像时为空。 */
9148
+ avatarUrl: string;
9149
+ }
9150
+
8958
9151
  /**
8959
9152
  * 读取当前会话的消息搜索结果和分类媒体列表。
8960
9153
  *
@@ -8984,6 +9177,9 @@ type ImSearchOperationResult = Readonly<{
8984
9177
  declare function defineImSearchStore(pinia: Pinia): pinia.StoreDefinition<"k2-im-search", Pick<{
8985
9178
  keyword: any;
8986
9179
  results: any;
9180
+ senderFor: (row: ProductMessageSearchResult) => ImSearchSenderPresentation;
9181
+ hasRetryableSenderProfiles: any;
9182
+ retrySenderProfiles: () => Promise<void>;
8987
9183
  searching: any;
8988
9184
  hasMore: any;
8989
9185
  category: any;
@@ -9003,6 +9199,9 @@ declare function defineImSearchStore(pinia: Pinia): pinia.StoreDefinition<"k2-im
9003
9199
  }, any>, Pick<{
9004
9200
  keyword: any;
9005
9201
  results: any;
9202
+ senderFor: (row: ProductMessageSearchResult) => ImSearchSenderPresentation;
9203
+ hasRetryableSenderProfiles: any;
9204
+ retrySenderProfiles: () => Promise<void>;
9006
9205
  searching: any;
9007
9206
  hasMore: any;
9008
9207
  category: any;
@@ -9022,6 +9221,9 @@ declare function defineImSearchStore(pinia: Pinia): pinia.StoreDefinition<"k2-im
9022
9221
  }, any>, Pick<{
9023
9222
  keyword: any;
9024
9223
  results: any;
9224
+ senderFor: (row: ProductMessageSearchResult) => ImSearchSenderPresentation;
9225
+ hasRetryableSenderProfiles: any;
9226
+ retrySenderProfiles: () => Promise<void>;
9025
9227
  searching: any;
9026
9228
  hasMore: any;
9027
9229
  category: any;
@@ -9107,6 +9309,8 @@ interface ImSessionStore {
9107
9309
  readonly connectionState: ImConnectionState;
9108
9310
  /** SDK 正在同步会话、离线消息或读取前台会话内容;连接异常提示仍应优先展示。 */
9109
9311
  readonly receiving: boolean;
9312
+ /** SDK 全局会话与离线消息同步;列表标题使用此状态,避免前台读取引起闪动。 */
9313
+ readonly syncing: boolean;
9110
9314
  readonly generation: number;
9111
9315
  readonly phase: ImSessionPhase;
9112
9316
  readonly errorKey: string;
@@ -9124,6 +9328,7 @@ declare function defineImSessionStore(pinia: Pinia): pinia.StoreDefinition<"k2-i
9124
9328
  accountId: any;
9125
9329
  connectionState: any;
9126
9330
  receiving: any;
9331
+ syncing: any;
9127
9332
  generation: any;
9128
9333
  phase: any;
9129
9334
  errorKey: any;
@@ -9141,6 +9346,7 @@ declare function defineImSessionStore(pinia: Pinia): pinia.StoreDefinition<"k2-i
9141
9346
  accountId: any;
9142
9347
  connectionState: any;
9143
9348
  receiving: any;
9349
+ syncing: any;
9144
9350
  generation: any;
9145
9351
  phase: any;
9146
9352
  errorKey: any;
@@ -9158,6 +9364,7 @@ declare function defineImSessionStore(pinia: Pinia): pinia.StoreDefinition<"k2-i
9158
9364
  accountId: any;
9159
9365
  connectionState: any;
9160
9366
  receiving: any;
9367
+ syncing: any;
9161
9368
  generation: any;
9162
9369
  phase: any;
9163
9370
  errorKey: any;
@@ -9224,84 +9431,6 @@ interface ImThreadReturnToLatestCoordinator {
9224
9431
  */
9225
9432
  declare function useImThreadReturnToLatestCoordinator(pinia?: Pinia): ImThreadReturnToLatestCoordinator;
9226
9433
 
9227
- /**
9228
- * 为聊天主区域管理唯一一个“用户当前正在查看的消息线程”。
9229
- *
9230
- * 【页面得到什么】
9231
- * Store 用 SDK 会话句柄打开一个明确的单聊、普通群或社群,并把该线程的一次完整更新转换成
9232
- * `activeRef`、消息列表、已保存草稿、加载/就绪/过期状态、能否继续向前后翻页和错误。消息与草稿仍由
9233
- * SDK 和本机存储维护;只供资料页使用的隐藏系统消息不会显示在聊天时间线,但原数据不会被删除。
9234
- *
9235
- * 【提供的能力】
9236
- * - `open` / `close`:打开或关闭当前会话;打开新会话会停止旧会话页面订阅。
9237
- * - `closeActiveConversation`:只关闭精确活动会话,保留正在打开的其他会话意图。
9238
- * - `loadLatest` / `loadOlder` / `loadNewer`:加载最新一屏、向上翻更早消息或向下补更新消息。
9239
- * - `loadAround`:为搜索定位加载目标消息附近窗口。
9240
- * - `resolveMessage`:解析当前窗口之外但属于同一会话的本地消息。
9241
- * - `retainHandle`:让已经开始的发送或上传在用户切会话后仍能安全完成,再关闭旧句柄。
9242
- * - `reset` / `dispose`:切账号或销毁时作废订阅、分页结果并关闭全部会话句柄。
9243
- *
9244
- * 【并发与资源所有权】
9245
- * 同一 Store 同时只有一个活动会话句柄。异步结果必须同时匹配最新操作序号、当前账号版本号、当前句柄
9246
- * 和会话类型 + ID 才能更新页面;同 ID 的不同会话类型不会串线。句柄、订阅函数和“仍在使用”计数只在
9247
- * 闭包中,不进入 `$state`。
9248
- *
9249
- * 【明确不负责】
9250
- * Composer 输入、消息菜单、多选、DOM 滚动、路由和 toast 分别由其他共享 Store 或宿主平台层负责。
9251
- */
9252
-
9253
- type ProductConversationHandle = ConversationHandle<ProductHandleConversationType>;
9254
- /** Thread Store 中由 Pinia 管理的当前窗口投影;句柄、订阅和租约留在闭包中。 */
9255
- interface ImThreadStoreState {
9256
- activeRef: ConversationRef<ProductHandleConversationType> | null;
9257
- /** SDK 已校验的活动聊天展示资料;不依赖该聊天是否已进入会话列表。 */
9258
- display: ConversationHandleSnapshot['display'] | null;
9259
- messages: readonly ImMessageView[];
9260
- entryUnread: ConversationEntryUnreadSnapshot;
9261
- /** 本次进入前的数量与定位状态;列表清零后仍保留。 */
9262
- entryUnreadNavigation: ConversationHandleSnapshot['entryUnreadNavigation'];
9263
- draft: ConversationDraft | null;
9264
- loading: boolean;
9265
- ready: boolean;
9266
- stale: boolean;
9267
- hasOlder: boolean;
9268
- hasNewer: boolean;
9269
- error: ImSdkErrorShape | null;
9270
- /** 当前活动会话待 Surface 消费的实时对端消息版本。 */
9271
- activeRemoteMessageRevision: number;
9272
- }
9273
- /** Thread Store 的稳定公共动作;DOM 滚动、路由和反馈仍由宿主负责。 */
9274
- interface ImThreadStoreActions {
9275
- open: (ref: ConversationRef<ProductHandleConversationType>) => Promise<ProductConversationHandle | undefined>;
9276
- invalidatePendingOpen: () => void;
9277
- loadLatest: () => Promise<boolean>;
9278
- /** 读取本次进入时冻结的首未读窗口。 */
9279
- loadEntryUnread: () => Promise<boolean>;
9280
- /** 页面确认可阅读后结算整会话;不会自动扩大可见消息回执。 */
9281
- markConversationRead: () => Promise<void>;
9282
- /** 只上报当前线程实际显示的消息集合。 */
9283
- markVisibleMessages: (messageIds: readonly string[]) => Promise<void>;
9284
- /** 明确业务离开;账号销毁和页面卸载仍使用无副作用的 close/reset。 */
9285
- leave: () => void;
9286
- loadOlder: () => Promise<boolean>;
9287
- loadNewer: () => Promise<boolean>;
9288
- loadAround: (messageId: string) => Promise<boolean>;
9289
- resolveMessage: (messageId: string) => Promise<ImMessageView | null>;
9290
- retainHandle: (handle?: ProductConversationHandle) => () => void;
9291
- retainCurrentHandle: () => () => void;
9292
- close: () => void;
9293
- closeActiveConversation: (ref: ConversationRef<ProductHandleConversationType>) => boolean;
9294
- reset: () => void;
9295
- dispose: () => void;
9296
- getHandle: () => ProductConversationHandle | undefined;
9297
- /** 原子取走当前活动会话尚未被 Surface 消费的实时对端消息 id。 */
9298
- drainActiveRemoteMessageIds: () => readonly string[];
9299
- }
9300
- /** 宿主从 `useImThreadStore` 获得的完整 Pinia Store 公共类型。 */
9301
- type ImThreadStore = Store<'k2-im-thread', ImThreadStoreState, Record<string, never>, ImThreadStoreActions>;
9302
- /** 取得当前 Vue setup 或显式 Pinia 的消息线程 Store;每个实例只管理一个当前会话。 */
9303
- declare function useImThreadStore(pinia?: Pinia): ImThreadStore;
9304
-
9305
9434
  /** 新消息提醒所需的领域与宿主事实;本模块不读取浏览器、路由或全局设置。 */
9306
9435
  interface MessageNotificationInput {
9307
9436
  source: 'live' | 'offline';
@@ -9323,4 +9452,4 @@ type MessageNotificationDecision = {
9323
9452
  declare function resolveMessageNotificationDecision(input: MessageNotificationInput): MessageNotificationDecision;
9324
9453
 
9325
9454
  export { applicationKey, createAndInstallImChatKit, createImChatKitContext, disposeImChatKit, ensureImChatKitSelfProfile, getImChatKitContext, imMediaDownloadKey, installImChatKit, resolveMessageNotificationDecision, useImApplicationsStore, useImCapabilitiesStore, useImComposerStore, useImConversationActivationCoordinator, useImConversationDeletionCoordinator, useImConversationListStore, useImExpressionStore, useImHistoryReturnAfterSendCoordinator, useImMediaStore, useImMessageOperationsStore, useImProfileDirectoryStore, useImQuotedMessageStore, useImReactionStore, useImSearchStore, useImSessionFavoritesStore, useImSessionStore, useImThreadPagingStore, useImThreadReturnToLatestCoordinator, useImThreadStore };
9326
- export type { ApplyImSessionInput, ChatRuntimeFactories, ChatRuntimeHostDeps, ImApplicationDomainCounts, ImApplicationReviewOperation, ImApplicationReviewResult, ImApplicationsReloadResult, ImApplicationsStoreError, ImCapabilitiesStore, ImChannelManagementMemberTarget, ImChannelMemberManagementOperation, ImChannelMemberManagementResult, ImChannelMemberManagementResultFor, ImChannelProfileActionResult, ImChannelProfileActionResultFor, ImChannelProfileOperation, ImChatKitContext, ImChatKitInstallation, ImComposerStore, ImComposerStoreActions, ImComposerStoreState, ImComposerSubmitResult, ImConversationActivationCoordinator, ImConversationActivationError, ImConversationActivationResult, ImConversationDeletionCoordinator, ImConversationDeletionError, ImConversationDeletionResult, ImConversationListActionError, ImConversationListMutationOperation, ImConversationListMutationResult, ImConversationListRefreshResult, ImConversationListStore, ImDirectContactActionResult, ImDirectContactActionResultFor, ImDirectContactOperation, ImDirectoryState, ImEmojiPanelRecentEntry, ImEmojiRecentEntry, ImExpressionLoadStatus, ImExpressionOperation, ImExpressionOperationResult, ImExpressionRecentPersistencePort, ImExpressionRecentPersistenceSnapshot, ImExpressionRecentViewItem, ImExpressionResetOptions, ImExpressionSendResult, ImExpressionStore, ImExpressionStoreActions, ImExpressionStoreError, ImExpressionStoreGetters, ImExpressionStoreState, ImForwardPreparationResult, ImGameRecentEntry, ImGroupMemberManagementOperation, ImGroupMemberManagementResult, ImGroupMemberManagementResultFor, ImGroupProfileActionResult, ImGroupProfileActionResultFor, ImGroupProfileOperation, ImHistoryReturnAfterSendCoordinator, ImHistoryReturnError, ImHistoryReturnExecution, ImHistoryReturnResult, ImMediaOperationResult, ImMediaReplacementRequest, ImMediaStore, ImMediaStoreError, ImMediaTaskPresentation, ImMembershipJoinActionResult, ImMembershipJoinOperation, ImMessageOperationsStore, ImMessageOperationsStoreActions, ImMessageOperationsStoreState, ImMessageSelectionResult, ImPersistedEmojiPanelRecentEntry, ImPersistedEmojiRecentEntry, ImPersistedExpressionAssetRecentEntry, ImPersistedGameRecentEntry, ImProfileAccessDestination, ImProfileAccessResult, ImProfileDirectoryResult, ImQuotedMessageState, ImQuotedMessageStore, ImQuotedMessageStoreActions, ImQuotedMessageStoreState, ImReactionOperationResult, ImReactionStore, ImReactionStoreActions, ImReactionStoreError, ImReactionStoreState, ImSearchOperationResult, ImSearchStore, ImSessionFavoritesReloadResult, ImSessionFavoritesStoreError, ImSessionFavoritesWriteResult, ImSessionPhase, ImSessionStore, ImThreadPagingActions, ImThreadPagingState, ImThreadPagingStore, ImThreadReturnToLatestCoordinator, ImThreadStore, ImThreadStoreActions, ImThreadStoreState };
9455
+ export type { ApplyImSessionInput, ChatRuntimeFactories, ChatRuntimeHostDeps, ImApplicationDomainCounts, ImApplicationReviewOperation, ImApplicationReviewResult, ImApplicationsReloadResult, ImApplicationsStoreError, ImCapabilitiesStore, ImChannelManagementMemberTarget, ImChannelMemberManagementOperation, ImChannelMemberManagementResult, ImChannelMemberManagementResultFor, ImChannelProfileActionResult, ImChannelProfileActionResultFor, ImChannelProfileOperation, ImChatKitContext, ImChatKitInstallation, ImComposerStore, ImComposerStoreActions, ImComposerStoreState, ImComposerSubmitResult, ImConversationActivationCoordinator, ImConversationActivationError, ImConversationActivationResult, ImConversationDeletionCoordinator, ImConversationDeletionError, ImConversationDeletionResult, ImConversationListActionError, ImConversationListMutationOperation, ImConversationListMutationResult, ImConversationListRefreshResult, ImConversationListStore, ImDirectContactActionResult, ImDirectContactActionResultFor, ImDirectContactOperation, ImDirectoryState, ImEmojiPanelRecentEntry, ImEmojiRecentEntry, ImExpressionLoadStatus, ImExpressionOperation, ImExpressionOperationResult, ImExpressionRecentPersistencePort, ImExpressionRecentPersistenceSnapshot, ImExpressionRecentViewItem, ImExpressionResetOptions, ImExpressionSendResult, ImExpressionStore, ImExpressionStoreActions, ImExpressionStoreError, ImExpressionStoreGetters, ImExpressionStoreState, ImForwardPreparationResult, ImGameRecentEntry, ImGroupMemberManagementOperation, ImGroupMemberManagementResult, ImGroupMemberManagementResultFor, ImGroupProfileActionResult, ImGroupProfileActionResultFor, ImGroupProfileOperation, ImHistoryReturnAfterSendCoordinator, ImHistoryReturnError, ImHistoryReturnExecution, ImHistoryReturnResult, ImMediaOperationResult, ImMediaReplacementRequest, ImMediaStore, ImMediaStoreError, ImMediaTaskPresentation, ImMembershipJoinActionResult, ImMembershipJoinOperation, ImMessageOperationsStore, ImMessageOperationsStoreActions, ImMessageOperationsStoreState, ImMessageSelectionResult, ImPersistedEmojiPanelRecentEntry, ImPersistedEmojiRecentEntry, ImPersistedExpressionAssetRecentEntry, ImPersistedGameRecentEntry, ImProfileAccessDestination, ImProfileAccessResult, ImProfileDirectoryResult, ImQuotedMessageState, ImQuotedMessageStore, ImQuotedMessageStoreActions, ImQuotedMessageStoreState, ImReactionOperationResult, ImReactionStore, ImReactionStoreActions, ImReactionStoreError, ImReactionStoreState, ImSearchOperationResult, ImSearchSenderPresentation, ImSearchStore, ImSessionFavoritesReloadResult, ImSessionFavoritesStoreError, ImSessionFavoritesWriteResult, ImSessionPhase, ImSessionStore, ImThreadPagingActions, ImThreadPagingState, ImThreadPagingStore, ImThreadReturnToLatestCoordinator, ImThreadStore, ImThreadStoreActions, ImThreadStoreState };