k2-im 0.1.15 → 0.1.17

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{A as createLazyBrowserApiProtocolClient}from'./chunk-HN4N3I2C.js';import'./chunk-ZPQ3HWNX.js';import'./chunk-WOT6VMZA.js';
1
+ export{A as createLazyBrowserApiProtocolClient}from'./chunk-K6P5ZYHG.js';import'./chunk-KTWXKQ4J.js';import'./chunk-WOT6VMZA.js';
@@ -1313,6 +1313,13 @@ interface ImLoginContext {
1313
1313
  interface ImAuthIssue {
1314
1314
  code: number;
1315
1315
  reason: 'token_expired' | 'kicked' | 'banned' | 'unknown';
1316
+ /**
1317
+ * 服务端记录的账号上次登录时间(毫秒时间戳),用于宿主提示「你的账号于某时在其他设备登录」。
1318
+ *
1319
+ * 只有登录被拒的被踢路径(CMLoginAck.nLastLoginTime)能拿到该时间;运行期收到
1320
+ * CM_KICKOUT_NOTIFICATION 时协议不带时间,此处为 undefined,由宿主自行决定如何展示。
1321
+ */
1322
+ lastLoginTime?: number;
1316
1323
  }
1317
1324
  interface ImAuthProvider {
1318
1325
  /** 返回登录上下文;返回 null 表示当前不可登录(缺凭据)。 */
@@ -1645,6 +1652,45 @@ interface ImProfilePort {
1645
1652
  clearCache?: () => void;
1646
1653
  }
1647
1654
 
1655
+ /** 会话收藏可展示的内容类型;与 iOS `isSupportCollectionMsgType` 对齐。 */
1656
+ type ImSessionFavoriteKind = 'text' | 'image' | 'video' | 'voice' | 'location' | 'file';
1657
+ /** 服务端一条会话收藏快照;列表以 HTTP 为准,不回写原消息。 */
1658
+ interface ImSessionFavoriteItem$1 {
1659
+ readonly collectId: string;
1660
+ readonly msgId: string;
1661
+ readonly kind: ImSessionFavoriteKind;
1662
+ readonly senderId: string;
1663
+ readonly senderName: string;
1664
+ readonly avatarUrl: string;
1665
+ readonly createdAt: string;
1666
+ readonly text: string;
1667
+ readonly imageUrl: string;
1668
+ readonly fileName: string;
1669
+ readonly body: Readonly<Record<string, unknown>>;
1670
+ readonly conversation: ConversationRef | null;
1671
+ }
1672
+ /** 把一条会话消息写成收藏快照时所需的已校验字段。 */
1673
+ interface ImSessionFavoriteWriteInput {
1674
+ readonly messageId: string;
1675
+ readonly conversation: ConversationRef;
1676
+ readonly senderId: string;
1677
+ readonly createdAt: number;
1678
+ readonly kind: ImSessionFavoriteKind;
1679
+ readonly plainBody: Readonly<Record<string, unknown>>;
1680
+ readonly peerId: string;
1681
+ readonly hide?: boolean;
1682
+ }
1683
+ /**
1684
+ * 会话收藏 HTTP 端口。
1685
+ *
1686
+ * Browser adapter 负责 `/user/favorite/*`、收藏 TEA 和 DTO 映射;Core 不持有收藏列表副本。
1687
+ */
1688
+ interface ImSessionFavoritePort {
1689
+ list: () => Promise<readonly ImSessionFavoriteItem$1[]>;
1690
+ add: (input: ImSessionFavoriteWriteInput) => Promise<ImSessionFavoriteItem$1>;
1691
+ delete: (collectIds: readonly string[]) => Promise<void>;
1692
+ }
1693
+
1648
1694
  /** 迁移期存储会话入参;新代码使用 ref,string 仅兼容唯一命中的旧调用。 */
1649
1695
  type ImStorageConversation = ConversationRef | string;
1650
1696
  /** 打开账号库的选项。namespace = 账号隔离键(登录 userId)。 */
@@ -2063,6 +2109,10 @@ type ImEvent = {
2063
2109
  | {
2064
2110
  type: 'application:updated';
2065
2111
  application: ApplicationUpdate;
2112
+ }
2113
+ /** 其它端改了会话收藏;权威列表必须重新拉 HTTP,不携带收藏正文。 */
2114
+ | {
2115
+ type: 'session-favorites:changed';
2066
2116
  } | {
2067
2117
  type: 'sync:complete';
2068
2118
  conversations: ConversationRef[];
@@ -3872,22 +3922,38 @@ interface DirectConversationCapabilities {
3872
3922
  canUseMessageActions: CapabilityDecision;
3873
3923
  canManageRelationship: CapabilityDecision;
3874
3924
  }
3925
+ /**
3926
+ * 普通群能力快照。
3927
+ *
3928
+ * 普通群只有「群主」和「普通成员」两档身份,没有管理员:`ownerId` 是唯一的身份依据。
3929
+ * 因此这里的能力分两类:改群资料、踢人、置顶消息、转让、改入群验证只给群主;
3930
+ * 发消息、看成员、邀请新成员、退群只要求当前账号仍在群内。
3931
+ */
3875
3932
  interface GroupConversationCapabilities {
3933
+ /** 当前账号与该群的关系;`left`/`removed`/`dismissed` 会让写动作整体不可用。 */
3876
3934
  membership: NonNullable<ConversationListItem['groupState']> | 'unknown';
3935
+ /** 群主 userId;群资料尚未加载时为 undefined,此时群主专属能力是 `unknown`。 */
3877
3936
  ownerId?: string;
3937
+ /** 当前账号是否为群主。 */
3878
3938
  isOwner: boolean;
3879
3939
  canSendMessages: CapabilityDecision;
3880
3940
  canOpenProfile: CapabilityDecision;
3881
3941
  canReadHistory: CapabilityDecision;
3882
3942
  canUseMessageActions: CapabilityDecision;
3943
+ /** 看成员名单:在群即可,普通群没有「隐藏成员列表」开关。 */
3883
3944
  canViewMembers: CapabilityDecision;
3945
+ /** 改群名称、群头像:仅群主。 */
3884
3946
  canEditProfile: CapabilityDecision;
3947
+ /** 邀请新成员:在群即可,不限群主。 */
3885
3948
  canInviteMembers: CapabilityDecision;
3949
+ /** 踢人等成员治理:仅群主。 */
3886
3950
  canManageMembers: CapabilityDecision;
3887
3951
  canPinMessages: CapabilityDecision;
3888
3952
  canUnpinMessages: CapabilityDecision;
3953
+ /** 转让群主:仅群主。 */
3889
3954
  canTransferOwnership: CapabilityDecision;
3890
3955
  canLeave: CapabilityDecision;
3956
+ /** 修改入群验证方式:仅群主。 */
3891
3957
  canUpdateVerification: CapabilityDecision;
3892
3958
  }
3893
3959
  interface ChannelConversationCapabilities {
@@ -4051,6 +4117,36 @@ interface ImExpressionsApi {
4051
4117
  };
4052
4118
  }
4053
4119
 
4120
+ /** 回源失败的原因与能否重试。 */
4121
+ interface MessagesByIdFailure {
4122
+ /**
4123
+ * 能否稍后重试。
4124
+ *
4125
+ * 服务端错误、网络异常和登录过期都算可以重试;无权限(已退群或已退出频道)和参数错误是终态,
4126
+ * 再试多少次结果都一样,调用方应该停下来而不是反复打接口。
4127
+ */
4128
+ retryable: boolean;
4129
+ /** 原始错误,供诊断与上报。 */
4130
+ error: unknown;
4131
+ }
4132
+ /** 回源的汇总结果。三组 id 互不重叠,合起来覆盖调用方传入的全部有效 id。 */
4133
+ interface ImMessagesByIdResult<TMessage> {
4134
+ /** 成功取回的消息。已经进了本地历史,后续本地查询就能命中。 */
4135
+ readonly messages: readonly TMessage[];
4136
+ /**
4137
+ * 服务端确认没有这些消息:已被删除、超出保留期被清理,或对当前用户不可见。
4138
+ * 这是终态,调用方应记下来并停止重试。
4139
+ */
4140
+ readonly missingMessageIds: readonly string[];
4141
+ /**
4142
+ * 这次没取到、但不代表不存在的消息 id(请求失败了)。
4143
+ * 是否值得再试看 `failure.retryable`。
4144
+ */
4145
+ readonly unresolvedMessageIds: readonly string[];
4146
+ /** `unresolvedMessageIds` 非空时的失败原因;全部取到或全部确认缺失时不存在。 */
4147
+ readonly failure?: MessagesByIdFailure;
4148
+ }
4149
+
4054
4150
  /**
4055
4151
  * 绑定单个精确会话的产品句柄与独立连续消息窗口。
4056
4152
  * 句柄提供历史、消息、草稿、已读和免打扰动作;SDK/DomainState 仍拥有消息真相,关闭只释放窗口和订阅。
@@ -4235,6 +4331,40 @@ interface ConversationMessageApi {
4235
4331
  * ```
4236
4332
  */
4237
4333
  forward: (messageIds: readonly string[], targets: readonly ConversationRef<ProductHandleConversationType>[]) => Promise<ForwardMessagesResult>;
4334
+ /**
4335
+ * 按 id 向服务端取回本地没有的消息,并回填进本地历史。
4336
+ *
4337
+ * 用途:渲染引用回复时,被引原消息可能从没拉到过本机(没翻到那一页、清过缓存、换了设备或浏览器)。
4338
+ * 这时 `resolveMessage` 会返回 null,但服务端其实有这条消息,用本接口取回来。
4339
+ *
4340
+ * @remarks
4341
+ * 和 `resolveMessage` 的分工:`resolveMessage` 只读本机、不发请求,适合先快速试一遍;本接口才发请求。
4342
+ * 正确用法是先对每条 id 调 `resolveMessage`,把返回 null 的收集起来一次性交给本接口,不要逐条调用。
4343
+ *
4344
+ * 取回的消息只回填历史正文,不会改动会话列表最后一条摘要,也不会产生未读或 @我 红点,
4345
+ * 更不会推进已读游标或影响离线消息的投递进度——为了渲染引用而调用是安全的。
4346
+ *
4347
+ * 超出服务端单批上限的 id 会自动分片串行请求。部分失败不影响已成功的部分:能取到的照常返回,
4348
+ * 取不到的按「服务端确认没有」和「这次失败可重试」分开回报,调用方只需要对后者重试。
4349
+ * 已撤回的原消息会照常取回并带撤回终态,不会被当成不存在。
4350
+ *
4351
+ * `supergroup` 未实现,调用即抛错,不会退化成其它会话类型的端点。
4352
+ *
4353
+ * @param messageIds 要取回的消息 id,通常是被引消息的 `refMessageId`;允许重复和空串,内部会清理。
4354
+ * @returns 取回的消息、确认不存在的 id、以及本次没取到的 id 与失败原因。
4355
+ * @example
4356
+ * ```ts
4357
+ * const missing: string[] = []
4358
+ * for (const refId of referencedIds) {
4359
+ * if (await handle.resolveMessage(refId) === null) missing.push(refId)
4360
+ * }
4361
+ * const result = await handle.messages.fetchByIds(missing)
4362
+ * result.messages.forEach(renderQuote)
4363
+ * result.missingMessageIds.forEach(markQuoteGone)
4364
+ * if (result.failure?.retryable === true) scheduleRetry(result.unresolvedMessageIds)
4365
+ * ```
4366
+ */
4367
+ fetchByIds: (messageIds: readonly string[]) => Promise<ImMessagesByIdResult<ImMessageView>>;
4238
4368
  }
4239
4369
  /**
4240
4370
  * 产品层显式 Reaction 动作;协议数值枚举不会暴露给宿主。
@@ -4639,12 +4769,16 @@ interface ImProductEventMap {
4639
4769
  'application:updated': Readonly<{
4640
4770
  application: ImProductApplicationUpdate;
4641
4771
  }>;
4772
+ /** 其它端改了会话收藏;权威列表必须重新拉 HTTP。 */
4773
+ 'session-favorites:changed': Readonly<Record<never, never>>;
4642
4774
  'sync:complete': Readonly<{
4643
4775
  conversations: readonly ConversationRef<ProductConversationListType>[];
4644
4776
  }>;
4777
+ /** `lastLoginTime` 为服务端记录的上次登录时间(毫秒),仅被踢且走登录 ACK 的路径才有值。 */
4645
4778
  'auth:invalid': Readonly<{
4646
4779
  code: string;
4647
4780
  reason: ImProductAuthInvalidReason;
4781
+ lastLoginTime?: number;
4648
4782
  }>;
4649
4783
  'error': Readonly<{
4650
4784
  error: ImProductEventError;
@@ -4930,6 +5064,25 @@ interface ImSearchApi {
4930
5064
  readonly messages: ImMessageSearchApi;
4931
5065
  }
4932
5066
 
5067
+ /**
5068
+ * 会话收藏稳定产品门面。
5069
+ *
5070
+ * 本模块不缓存服务端列表;每次 list/add/delete 都以当前账号 provider 为准。
5071
+ * 收藏快照与原聊天消息解耦:原消息删除、撤回或编辑不会回写收藏。
5072
+ */
5073
+
5074
+ type ImSessionFavoriteItem = Readonly<ImSessionFavoriteItem$1>;
5075
+ /** 产品层会话收藏 API。 */
5076
+ interface ImSessionFavoritesApi {
5077
+ list: () => Promise<readonly ImSessionFavoriteItem[]>;
5078
+ addFromMessage: (input: {
5079
+ message: ImMessageView;
5080
+ conversation: ConversationRef;
5081
+ selfId: string;
5082
+ }) => Promise<ImSessionFavoriteItem>;
5083
+ delete: (collectIds: readonly string[]) => Promise<void>;
5084
+ }
5085
+
4933
5086
  /**
4934
5087
  * 当前账号的 IM 本地偏好产品域。
4935
5088
  *
@@ -5155,6 +5308,8 @@ interface ImAdvancedClientOptions extends ImClientOptions {
5155
5308
  coreClient?: ApiProtocolClient;
5156
5309
  /** 高级/测试入口可注入端口替身;default 始终使用 Browser adapter。 */
5157
5310
  expressionProvider?: ImExpressionPort;
5311
+ /** 高级/测试入口可注入会话收藏端口替身;default 始终使用 Browser adapter。 */
5312
+ sessionFavoriteProvider?: ImSessionFavoritePort;
5158
5313
  }
5159
5314
  /** 产品级账号与连接生命周期;adapter、transport 和连接状态机原子不进入该接口。 */
5160
5315
  interface ImSessionApi {
@@ -5430,6 +5585,7 @@ interface ImProductClient {
5430
5585
  readonly channels: ImChannelsApi;
5431
5586
  readonly applications: ImApplicationsApi;
5432
5587
  readonly expressions: ImExpressionsApi;
5588
+ readonly sessionFavorites: ImSessionFavoritesApi;
5433
5589
  readonly outbox: ImOutboxApi;
5434
5590
  readonly drafts: ImDraftsApi;
5435
5591
  readonly search: ImSearchApi;
@@ -6006,7 +6162,7 @@ type ImPinnedMessageActionResult = Readonly<{
6006
6162
  }>;
6007
6163
 
6008
6164
  type ConversationCapabilityAction = 'conversation.openProfile' | 'conversation.readHistory' | 'conversation.listPreferences' | 'composer.send' | 'composer.mentionAll' | 'profile.edit' | 'relationship.manage' | 'members.view' | 'members.manage' | 'members.invite' | 'members.remove' | 'members.setAdmin' | 'ownership.transfer' | 'conversation.leave' | 'channel.manageMute' | 'channel.setMemberPrivateChat' | 'channel.dismiss';
6009
- type MessageCapabilityAction = 'message.reply' | 'message.recall' | 'message.edit' | 'message.pin' | 'message.unpin' | 'message.deleteLocal' | 'message.deleteForEveryone' | 'message.forward' | 'message.multiSelect';
6165
+ type MessageCapabilityAction = 'message.reply' | 'message.recall' | 'message.edit' | 'message.pin' | 'message.unpin' | 'message.deleteLocal' | 'message.deleteForEveryone' | 'message.forward' | 'message.favorite' | 'message.multiSelect';
6010
6166
  type MemberTargetCapabilityAction = 'members.removeTarget' | 'members.editNicknameTarget' | 'members.setAdminTarget' | 'members.unsetAdminTarget';
6011
6167
  interface MemberTargetCapabilityInput {
6012
6168
  snapshot: ConversationCapabilitySnapshot;
@@ -7688,6 +7844,106 @@ type ImProfileDirectoryStore = ReturnType<ReturnType<typeof defineImProfileDirec
7688
7844
  /** 取得当前 Vue setup 或显式 Pinia 的资料与目录 Store;不同宿主实例的状态彼此隔离。 */
7689
7845
  declare function useImProfileDirectoryStore(pinia?: Pinia): ImProfileDirectoryStore;
7690
7846
 
7847
+ /**
7848
+ * 为 PC 与 H5 提供同一套「引用回复原文」解析入口。
7849
+ *
7850
+ * 要解决的问题:一条回复消息在协议上只带被引原消息的 id,没有原文快照。原消息可能就在当前窗口里,
7851
+ * 也可能只在本机历史深处,甚至根本没到过这台设备(没翻到那一页、清过缓存、换了浏览器)。
7852
+ *
7853
+ * 解析顺序固定三步,前两步不发请求:
7854
+ * 1. 当前窗口里有就直接用,这也是唯一能拿到最新撤回/编辑状态的来源;
7855
+ * 2. 调 SDK `resolveMessage` 查本机历史;
7856
+ * 3. 本机确实没有,才把这一屏缺失的 id 攒成批交给 SDK 回源(`messages.fetchByIds`)。
7857
+ *
7858
+ * 第三步是批量的:一屏引用可能几十条,逐条打接口会给服务端制造无谓压力。回源不会改会话摘要、
7859
+ * 不产生未读、不推进已读游标,所以为了渲染而调用是安全的。
7860
+ *
7861
+ * 本 Store 只保存解析状态缓存,不保存消息领域真相——消息本身由 SDK 唯一 DomainState 持有,回源
7862
+ * 取回的消息也已经回填进本机历史。切会话、切账号或原消息发生变化时缓存会失效重读。
7863
+ */
7864
+
7865
+ /**
7866
+ * 单条引用原文的解析状态。
7867
+ *
7868
+ * - `loading`:还在查,宿主应显示加载中占位,不要当成找不到。
7869
+ * - `ready`:拿到原文,可以渲染摘要。
7870
+ * - `missing`:服务端确认没有这条消息(已删除、超出保留期、对当前用户不可见)。终态,别再重试。
7871
+ * - `failed`:这次没取到,但不代表不存在。`retryable` 为 true 时值得再试(网络或服务端错误);
7872
+ * 为 false 时再试结果也一样(例如已经退出这个群,服务端不再让你看它的消息)。
7873
+ */
7874
+ type ImQuotedMessageState = Readonly<{
7875
+ status: 'loading';
7876
+ message: null;
7877
+ } | {
7878
+ status: 'ready';
7879
+ message: ImMessageView;
7880
+ } | {
7881
+ status: 'missing';
7882
+ message: null;
7883
+ } | {
7884
+ status: 'failed';
7885
+ message: null;
7886
+ retryable: boolean;
7887
+ }>;
7888
+ /**
7889
+ * 引用原文 Store 没有对外暴露的响应式字段。
7890
+ *
7891
+ * 解析状态通过 `lookup` 读取:它内部读的是 Store 的响应式缓存,所以在模板或 computed 里调用会
7892
+ * 正常追踪依赖,解析完成后使用它的地方会自动重新渲染。
7893
+ */
7894
+ type ImQuotedMessageStoreState = Record<string, never>;
7895
+ /** 引用原文 Store 的公共动作。 */
7896
+ interface ImQuotedMessageStoreActions {
7897
+ /**
7898
+ * 同步读取一条被引原消息的解析状态。
7899
+ *
7900
+ * 只读缓存和当前窗口,不发起任何请求,可以在渲染期放心调用。首次读到的是 `loading`,
7901
+ * 真正的解析由 `prefetch` 触发。在模板或 computed 里调用会正常追踪依赖,解析完成后自动重新求值。
7902
+ *
7903
+ * 每次调用都会返回一个新的状态对象,所以不要对返回值本身做引用比较或直接 `watch`;要监听变化
7904
+ * 请读里面的 `status` 或 `message`(同一条消息的 `message` 引用是稳定的)。
7905
+ */
7906
+ lookup: (messageId: string) => ImQuotedMessageState;
7907
+ /**
7908
+ * 声明当前这一屏需要哪些被引原消息,并按需解析尚未解析的部分。
7909
+ *
7910
+ * 幂等且可以高频调用:已有结论的(解析成功、确认缺失、解析失败)都不会重复查询,窗口内已有的
7911
+ * 消息也不占用回源额度。同一时刻只允许一批解析在跑,连续翻页产生的多次调用会自动合并,
7912
+ * 所以在消息列表变化时无脑调一次就行,不需要宿主自己做防抖。
7913
+ *
7914
+ * 传入顺序就是解析顺序。默认按窗口顺序传即可;如果宿主能判断用户正在看哪一段,把那段的 id 放
7915
+ * 前面能让它们先显示出来。只想解析视口附近的引用时,直接少传一些 id 即可,本 Store 不读 DOM。
7916
+ */
7917
+ prefetch: (messageIds: readonly string[]) => void;
7918
+ /**
7919
+ * 重试指定的引用;不传则重试当前所有可重试的失败项。
7920
+ *
7921
+ * 只会重试 `failed` 且 `retryable` 为 true 的条目,已确认缺失的不会被重新查询。
7922
+ *
7923
+ * 解析失败后不会跟着翻页自己重试——否则断网期间用户每次滑动都会再打一轮接口。两种情况会重试:
7924
+ * 连接恢复时 Store 自动调一次(覆盖最常见的断网失败),以及宿主主动调用这个动作(例如引用块上的
7925
+ * 重试按钮)。所以宿主不接重试按钮也不会让断网后的引用永久卡住。
7926
+ */
7927
+ retry: (messageIds?: readonly string[]) => void;
7928
+ /**
7929
+ * 丢掉指定消息的解析结果,让下一次 `prefetch` 重新解析。
7930
+ *
7931
+ * 窗口外的原消息被编辑、撤回或管理员删除时,SDK 只把新状态写进本机历史,不会回头修改这份缓存,
7932
+ * 需要宿主在收到消息变更事件时调用一次,否则引用块会一直显示旧正文。
7933
+ */
7934
+ invalidate: (messageIds: readonly string[]) => void;
7935
+ /** 清空缓存与在途解析;切账号时使用。 */
7936
+ reset: () => void;
7937
+ }
7938
+ /** 宿主从 `useImQuotedMessageStore` 获得的完整 Pinia Store 公共类型。 */
7939
+ type ImQuotedMessageStore = Store<'k2-im-quoted-message', ImQuotedMessageStoreState, Record<string, never>, ImQuotedMessageStoreActions>;
7940
+ /**
7941
+ * 取得当前 Vue setup 或显式 Pinia 的引用原文 Store。
7942
+ *
7943
+ * 只解析被引原消息并缓存解析状态;引用块的样式、文案、点击定位和重试交互仍由宿主负责。
7944
+ */
7945
+ declare function useImQuotedMessageStore(pinia?: Pinia): ImQuotedMessageStore;
7946
+
7691
7947
  /**
7692
7948
  * 为 PC 与 H5 提供同一套消息 Reaction 操作入口。
7693
7949
  *
@@ -7765,6 +8021,47 @@ type ImSearchOperationResult = Readonly<{
7765
8021
  /** 取得当前 Vue setup 或显式 Pinia 的搜索 Store;不同宿主实例不会共享查询或定位状态。 */
7766
8022
  declare function useImSearchStore(pinia?: Pinia): any;
7767
8023
 
8024
+ /**
8025
+ * 为 PC/H5 提供同一套会话收藏列表和已收藏标记。
8026
+ *
8027
+ * 【状态来源】
8028
+ * `items` 始终来自 SDK `client.sessionFavorites.list()`。4633 产品事件只唤醒重拉,不从通知拼造条目。
8029
+ * 已收藏标记由当前列表按 `msgId → collectId` 派生,不写回 ImMessage。
8030
+ *
8031
+ * 【明确不负责】
8032
+ * 页面、预览、Toast、路由和 i18n 属于宿主;HTTP、收藏 TEA 和协议通知属于 SDK。
8033
+ */
8034
+
8035
+ type ImSessionFavoritesStoreError = Readonly<Pick<ImSdkErrorShape, 'code' | 'category' | 'operation' | 'retryable'>>;
8036
+ type ImSessionFavoritesReloadResult = Readonly<{
8037
+ ok: true;
8038
+ operation: 'reload';
8039
+ } | {
8040
+ ok: false;
8041
+ operation: 'reload';
8042
+ reason: 'stale';
8043
+ } | {
8044
+ ok: false;
8045
+ operation: 'reload';
8046
+ reason: 'failed';
8047
+ error: ImSessionFavoritesStoreError;
8048
+ }>;
8049
+ type ImSessionFavoritesWriteResult = Readonly<{
8050
+ ok: true;
8051
+ operation: 'add' | 'delete';
8052
+ collectId: string;
8053
+ } | {
8054
+ ok: false;
8055
+ operation: 'add' | 'delete';
8056
+ reason: 'stale';
8057
+ } | {
8058
+ ok: false;
8059
+ operation: 'add' | 'delete';
8060
+ reason: 'failed';
8061
+ error: ImSessionFavoritesStoreError;
8062
+ }>;
8063
+ declare function useImSessionFavoritesStore(pinia?: Pinia): any;
8064
+
7768
8065
  /** 页面可展示的 IM 启动阶段:空闲、恢复本机数据、联网、可用、失败或永久销毁。 */
7769
8066
  type ImSessionPhase = 'idle' | 'preparing' | 'connecting' | 'ready' | 'error' | 'disposed';
7770
8067
  /** 宿主每次登录、退出或切账号时交给 `applySession` 的完整输入。 */
@@ -7966,5 +8263,5 @@ type ImThreadStore = Store<'k2-im-thread', ImThreadStoreState, Record<string, ne
7966
8263
  /** 取得当前 Vue setup 或显式 Pinia 的消息线程 Store;每个实例只管理一个当前会话。 */
7967
8264
  declare function useImThreadStore(pinia?: Pinia): ImThreadStore;
7968
8265
 
7969
- export { applicationKey, createAndInstallImChatKit, createImChatKitContext, disposeImChatKit, ensureImChatKitSelfProfile, getImChatKitContext, installImChatKit, useImApplicationsStore, useImCapabilitiesStore, useImComposerStore, useImConversationActivationCoordinator, useImConversationDeletionCoordinator, useImConversationListStore, useImExpressionStore, useImHistoryReturnAfterSendCoordinator, useImMediaStore, useImMessageOperationsStore, useImProfileDirectoryStore, useImReactionStore, useImSearchStore, useImSessionStore, useImThreadPagingStore, useImThreadReturnToLatestCoordinator, useImThreadStore };
7970
- 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, ImMediaStoreError, ImMediaTaskPresentation, ImMembershipJoinActionResult, ImMembershipJoinOperation, ImMessageOperationsStore, ImMessageOperationsStoreActions, ImMessageOperationsStoreState, ImMessageSelectionResult, ImPersistedEmojiPanelRecentEntry, ImPersistedEmojiRecentEntry, ImPersistedExpressionAssetRecentEntry, ImPersistedGameRecentEntry, ImProfileAccessDestination, ImProfileAccessResult, ImProfileDirectoryResult, ImReactionOperationResult, ImReactionStore, ImReactionStoreActions, ImReactionStoreError, ImReactionStoreState, ImSearchOperationResult, ImSessionPhase, ImSessionStore, ImThreadPagingActions, ImThreadPagingState, ImThreadPagingStore, ImThreadReturnToLatestCoordinator, ImThreadStore, ImThreadStoreActions, ImThreadStoreState };
8266
+ export { applicationKey, createAndInstallImChatKit, createImChatKitContext, disposeImChatKit, ensureImChatKitSelfProfile, getImChatKitContext, installImChatKit, useImApplicationsStore, useImCapabilitiesStore, useImComposerStore, useImConversationActivationCoordinator, useImConversationDeletionCoordinator, useImConversationListStore, useImExpressionStore, useImHistoryReturnAfterSendCoordinator, useImMediaStore, useImMessageOperationsStore, useImProfileDirectoryStore, useImQuotedMessageStore, useImReactionStore, useImSearchStore, useImSessionFavoritesStore, useImSessionStore, useImThreadPagingStore, useImThreadReturnToLatestCoordinator, useImThreadStore };
8267
+ 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, 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, ImSessionFavoritesReloadResult, ImSessionFavoritesStoreError, ImSessionFavoritesWriteResult, ImSessionPhase, ImSessionStore, ImThreadPagingActions, ImThreadPagingState, ImThreadPagingStore, ImThreadReturnToLatestCoordinator, ImThreadStore, ImThreadStoreActions, ImThreadStoreState };