k2-im 0.1.6 → 0.1.8

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-GTRMHOHX.js';import'./chunk-MHIB4PGT.js';import'./chunk-WOT6VMZA.js';
1
+ export{A as createLazyBrowserApiProtocolClient}from'./chunk-6QR5GVQ3.js';import'./chunk-BO5YFCS4.js';import'./chunk-WOT6VMZA.js';
@@ -2120,6 +2120,69 @@ type ImEvent = {
2120
2120
  callId: string;
2121
2121
  peerId: string;
2122
2122
  reason: ImDirectCallFailReason;
2123
+ }
2124
+ /** 群会议来电;`expired` 为 true 时已过 30s,不得振铃。 */
2125
+ | {
2126
+ type: 'group-call:incoming';
2127
+ conversation: ConversationRef<'group'>;
2128
+ callId: string;
2129
+ groupId: string;
2130
+ inviterId: string;
2131
+ inviteIds: readonly string[];
2132
+ createdAt: number;
2133
+ expired: boolean;
2134
+ }
2135
+ /** 有人响应群会议邀请。 */
2136
+ | {
2137
+ type: 'group-call:answered';
2138
+ conversation: ConversationRef<'group'>;
2139
+ callId: string;
2140
+ groupId: string;
2141
+ userId: string;
2142
+ agreed: boolean;
2143
+ }
2144
+ /** 有人加入群会议;会中再邀时 `isInvite` 为 true。 */
2145
+ | {
2146
+ type: 'group-call:joined';
2147
+ conversation: ConversationRef<'group'>;
2148
+ callId: string;
2149
+ groupId: string;
2150
+ userId: string;
2151
+ inviteIds: readonly string[];
2152
+ isInvite: boolean;
2153
+ }
2154
+ /** 有人退出群会议,会议本身可能仍在进行。 */
2155
+ | {
2156
+ type: 'group-call:left';
2157
+ conversation: ConversationRef<'group'>;
2158
+ callId: string;
2159
+ groupId: string;
2160
+ userId: string;
2161
+ }
2162
+ /** 整场群会议结束。 */
2163
+ | {
2164
+ type: 'group-call:finished';
2165
+ conversation: ConversationRef<'group'>;
2166
+ callId: string;
2167
+ groupId: string;
2168
+ userId: string;
2169
+ }
2170
+ /** 被邀人忙线。 */
2171
+ | {
2172
+ type: 'group-call:busy';
2173
+ conversation: ConversationRef<'group'>;
2174
+ callId: string;
2175
+ groupId: string;
2176
+ userId: string;
2177
+ hintUserId: string;
2178
+ }
2179
+ /** 主叫 createRoom ACK 失败。 */
2180
+ | {
2181
+ type: 'group-call:failed';
2182
+ conversation: ConversationRef<'group'>;
2183
+ callId: string;
2184
+ groupId: string;
2185
+ reason: 'ack-error';
2123
2186
  } | {
2124
2187
  type: 'notification';
2125
2188
  cmdId: number;
@@ -2148,7 +2211,7 @@ type ImDiagnosticLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace';
2148
2211
  /** 诊断产生层;同一 operation 可跨层复用 traceId/operationId。 */
2149
2212
  type ImDiagnosticLayer = 'sdk' | 'core' | 'chat-kit' | 'pinia' | 'worker';
2150
2213
  /** 稳定诊断分类。分类用于构造 payload 前过滤,不能作为业务状态分支。 */
2151
- type ImDiagnosticCategory = 'session' | 'connection' | 'protocol' | 'sync' | 'conversation' | 'history' | 'message' | 'outbox' | 'draft' | 'search' | 'media' | 'profile' | 'storage' | 'crypto';
2214
+ type ImDiagnosticCategory = 'session' | 'connection' | 'protocol' | 'sync' | 'conversation' | 'history' | 'message' | 'outbox' | 'draft' | 'search' | 'media' | 'profile' | 'storage' | 'crypto' | 'call';
2152
2215
  /** 经过安全过滤的错误快照;不会保留原始 cause 引用。 */
2153
2216
  interface ImDiagnosticError {
2154
2217
  name?: string;
@@ -2195,6 +2258,19 @@ interface ImDiagnosticWriter$1<TMessage = ImMessage> {
2195
2258
  record: (level: ImDiagnosticLevel, layer: ImDiagnosticLayer, category: ImDiagnosticCategory, event: string, context?: () => ImDiagnosticRecordContext<TMessage>) => void;
2196
2259
  }
2197
2260
 
2261
+ type ImGroupCallMemberStatus = 'ringing' | 'in-call';
2262
+ interface ImGroupCallMember {
2263
+ readonly userId: string;
2264
+ readonly status: ImGroupCallMemberStatus;
2265
+ }
2266
+ interface ImGroupCallMeetingSnapshot {
2267
+ readonly groupId: string;
2268
+ readonly callId: string;
2269
+ readonly inviterId: string;
2270
+ readonly members: readonly ImGroupCallMember[];
2271
+ readonly createdAt: number;
2272
+ }
2273
+
2198
2274
  type EditFailReason = 'not-found' | 'not-own' | 'not-sent' | 'recalled' | 'deleted' | 'expired' | 'unsupported' | 'empty' | 'restricted' | 'unsupported-content' | 'no-key' | 'encrypt-failed' | 'timeout' | 'failed' | 'disconnected';
2199
2275
 
2200
2276
  type RecallFailReason = 'not-found' | 'not-own' | 'not-sent' | 'expired' | 'unsupported' | 'timeout' | 'server-expired' | 'failed' | 'disconnected';
@@ -4606,6 +4682,55 @@ interface ImProductEventMap {
4606
4682
  peerId: string;
4607
4683
  reason: 'peer-offline' | 'ack-error';
4608
4684
  }>;
4685
+ 'group-call:incoming': Readonly<{
4686
+ ref: ConversationRef<'group'>;
4687
+ callId: string;
4688
+ groupId: string;
4689
+ inviterId: string;
4690
+ inviteIds: readonly string[];
4691
+ createdAt: number;
4692
+ expired: boolean;
4693
+ }>;
4694
+ 'group-call:answered': Readonly<{
4695
+ ref: ConversationRef<'group'>;
4696
+ callId: string;
4697
+ groupId: string;
4698
+ userId: string;
4699
+ agreed: boolean;
4700
+ }>;
4701
+ 'group-call:joined': Readonly<{
4702
+ ref: ConversationRef<'group'>;
4703
+ callId: string;
4704
+ groupId: string;
4705
+ userId: string;
4706
+ inviteIds: readonly string[];
4707
+ isInvite: boolean;
4708
+ }>;
4709
+ 'group-call:left': Readonly<{
4710
+ ref: ConversationRef<'group'>;
4711
+ callId: string;
4712
+ groupId: string;
4713
+ userId: string;
4714
+ }>;
4715
+ 'group-call:finished': Readonly<{
4716
+ ref: ConversationRef<'group'>;
4717
+ callId: string;
4718
+ groupId: string;
4719
+ userId: string;
4720
+ }>;
4721
+ 'group-call:busy': Readonly<{
4722
+ ref: ConversationRef<'group'>;
4723
+ callId: string;
4724
+ groupId: string;
4725
+ userId: string;
4726
+ hintUserId: string;
4727
+ }>;
4728
+ 'group-call:failed': Readonly<{
4729
+ ref: ConversationRef<'group'>;
4730
+ callId: string;
4731
+ groupId: string;
4732
+ reason: 'ack-error';
4733
+ }>;
4609
4734
  }
4610
4735
  /** 从产品事件表推导的全量可判别联合。 */
4611
4736
  type ImProductEvent = {
@@ -4627,6 +4752,50 @@ interface ImEventsApi {
4627
4752
  on: <TType extends keyof ImProductEventMap>(type: TType, listener: (payload: ImProductEventMap[TType]) => void) => () => void;
4628
4753
  }
4629
4754
 
4755
+ interface ImGroupCallCreateInput {
4756
+ groupId: string;
4757
+ callId: string;
4758
+ inviteIds: readonly string[];
4759
+ }
4760
+ interface ImGroupCallJoinInput {
4761
+ groupId: string;
4762
+ callId: string;
4763
+ inviteIds: readonly string[];
4764
+ isInvite: boolean;
4765
+ }
4766
+ interface ImGroupCallTargetInput {
4767
+ groupId: string;
4768
+ callId: string;
4769
+ }
4770
+ interface ImGroupCallAnswerInput extends ImGroupCallTargetInput {
4771
+ agreed: boolean;
4772
+ }
4773
+ interface ImGroupCallStatusInput extends ImGroupCallTargetInput {
4774
+ isMute: boolean;
4775
+ status: boolean;
4776
+ }
4777
+ interface ImGroupCallBusyInput extends ImGroupCallTargetInput {
4778
+ hintUserId: string;
4779
+ }
4780
+ interface ImGroupCallsApi {
4781
+ /** 发起群会议 (0x4101) */
4782
+ createRoom: (input: ImGroupCallCreateInput) => void;
4783
+ /** 加入群会议 (0x4109) */
4784
+ joinRoom: (input: ImGroupCallJoinInput) => void;
4785
+ /** 响应群会议邀请 (0x4105) */
4786
+ answer: (input: ImGroupCallAnswerInput) => void;
4787
+ /** 退出群会议 (0x410d) */
4788
+ hangup: (input: ImGroupCallTargetInput) => void;
4789
+ /** 结束整场群会议 (0x4111) */
4790
+ finish: (input: ImGroupCallTargetInput) => void;
4791
+ /** 修改状态 (0x4115) */
4792
+ setStatus: (input: ImGroupCallStatusInput) => void;
4793
+ /** 忙线 (0x411d) */
4794
+ busy: (input: ImGroupCallBusyInput) => void;
4795
+ /** 当前群的进行中会议;没有则 null。 */
4796
+ inspectMeeting: (groupId: string) => ImGroupCallMeetingSnapshot | null;
4797
+ }
4798
+
4630
4799
  /**
4631
4800
  * 当前 prefix/account 本地数据的分类查询和明确清理动作。
4632
4801
  * API 区分可重建缓存与整账号 purge,严格按 namespace factory 定位;不存在无边界 `clearAll`。
@@ -5282,6 +5451,8 @@ interface ImProductClient {
5282
5451
  interface ImClient extends Omit<ImProductClient, 'capabilities' | 'channels' | 'contacts' | 'conversations' | 'groups'> {
5283
5452
  /** internal/testing 与高级宿主使用的单聊音视频信令;稳定 default 产品门面不暴露此能力。 */
5284
5453
  readonly calls: ImDirectCallsApi;
5454
+ /** internal/testing 群通话门面。 */
5455
+ readonly groupCalls: ImGroupCallsApi;
5285
5456
  /**
5286
5457
  * 打开一个拥有独立连续窗口与生命周期的 direct、GROUP 或 CHANNEL 会话句柄。
5287
5458
  *
@@ -6349,6 +6520,7 @@ interface ImExpressionStoreActions {
6349
6520
  loadRecent: (kind: RecentKind) => Promise<ImExpressionOperationResult>;
6350
6521
  reportRecent: (input: ImExpressionRecentInput) => Promise<ImExpressionOperationResult>;
6351
6522
  rememberEmoji: (entry: ImEmojiRecentEntry) => Promise<ImExpressionOperationResult>;
6523
+ rememberEmojis: (entries: readonly ImEmojiRecentEntry[]) => Promise<ImExpressionOperationResult>;
6352
6524
  toggleRecentSelection: (kind: RecentKind, recordId: string, selected?: boolean) => void;
6353
6525
  deleteSelectedRecent: (kind: RecentKind) => Promise<ImExpressionOperationResult>;
6354
6526
  loadGiphyTrending: () => Promise<ImExpressionOperationResult>;