@opencxh/domain 1.19.0 → 1.23.2

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.
@@ -1,5 +1,4 @@
1
1
  import { AIMessageInput, AIMessageOutput } from '../ai-message/types';
2
- import { Transcript } from '../transcript/types';
3
2
  export type CallStatus = "new" | "connecting" | "ringing" | "connected" | "held" | "ended" | "failed";
4
3
  export type CallDirection = "inbound" | "outbound";
5
4
  export type CallType = "audio" | "video" | "data" | "screen-share";
@@ -111,8 +110,17 @@ export type ChatEventPayload = {
111
110
  initiator?: ChatMember;
112
111
  raw?: any;
113
112
  };
113
+ export type TranscriptAddedSegment = {
114
+ speaker: 'local' | 'remote';
115
+ speakerLabel?: string;
116
+ text: string;
117
+ startedAt: number;
118
+ endedAt: number;
119
+ };
114
120
  export type TranscriptAddedPayload = {
115
- transcript: Transcript;
121
+ text: string;
122
+ segments?: TranscriptAddedSegment[];
123
+ finalized: boolean;
116
124
  };
117
125
  export type MeetingPayload = {
118
126
  title: string;
@@ -63,10 +63,14 @@ export declare enum CommunicationScheme {
63
63
  * - `protocol` only: pick the first registered account with this protocol
64
64
  * (acceptable when there is one UA per provider per tenant)
65
65
  * - `accountId` set: pin to a specific account (multi-trunk / multi-tenant)
66
+ * - `matcherId` set: defer to a client-registered matcher fn that picks the
67
+ * account based on dynamic context (channel, accounts). Lookup by string
68
+ * keeps the wire format JSON; fn lives in the runtime registry.
66
69
  */
67
70
  export interface AccountSelector {
68
71
  protocol: string;
69
72
  accountId?: string;
73
+ matcherId?: string;
70
74
  }
71
75
  export type TransportConfig = {
72
76
  kind: "compose";
@@ -1,8 +1,40 @@
1
- export interface AudioChunk {
1
+ export type Speaker = 'local' | 'remote';
2
+ export interface AudioSegment {
2
3
  sessionId: string;
4
+ speaker: Speaker;
5
+ speakerId?: string;
3
6
  buffer: Float32Array;
4
7
  sampleRate: number;
5
- avgRMS?: number;
8
+ startedAt: number;
9
+ endedAt: number;
10
+ avgRMS: number;
11
+ isFinal: boolean;
12
+ }
13
+ export interface TranscriptWord {
14
+ text: string;
15
+ startedAt: number;
16
+ endedAt: number;
17
+ }
18
+ export interface TranscriptSegment {
19
+ sessionId: string;
20
+ speaker: Speaker;
21
+ speakerId?: string;
22
+ speakerLabel?: string;
23
+ text: string;
24
+ words?: TranscriptWord[];
25
+ partial: boolean;
26
+ startedAt: number;
27
+ endedAt: number;
28
+ language?: string;
29
+ confidence?: number;
30
+ }
31
+ export interface AudioPipelineOptions {
32
+ silenceThreshold: number;
33
+ minRMS: number;
34
+ speechFrameRatio: number;
35
+ silenceDurationMs: number;
36
+ maxSpeechDurationMs: number;
37
+ overlapMs: number;
6
38
  }
7
39
  export type MediaPermissionKind = "microphone" | "camera";
8
40
  export type MediaPermissionState = "granted" | "denied" | "prompt" | "unsupported";
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
2
2
  import { InvokeOptions, SSEMessage } from './api';
3
3
  import { CommsAccount, Session } from './communication';
4
4
  import { PlatformConfig, PlatformContext } from './kernel';
5
- import { AudioChunk, MediaPermissionKind, MediaPermissionState, MediaPermissionStatus } from './media';
5
+ import { AudioPipelineOptions, AudioSegment, MediaPermissionKind, MediaPermissionState, MediaPermissionStatus, TranscriptSegment } from './media';
6
6
  import { ServiceCallOptions, ServiceMap } from './services';
7
7
  import { DeepPartial, DeviceList, UserSettings } from './settings';
8
8
  import { ExtensionConfig, ToastConfig } from './ui';
@@ -55,13 +55,26 @@ export interface InternalSDK<LocalServices extends ServiceMap = {}, TranslationK
55
55
  setActiveSession(sessionId: string): Promise<void>;
56
56
  registerAccount(organizationId: string, userId: string, providerId: string, config: any): Promise<CommsAccount>;
57
57
  handleSessionAction(sessionId: string, actionId: string, ...args: any[]): Promise<void>;
58
+ transcripts: {
59
+ ingest(segments: TranscriptSegment[]): void;
60
+ byCallSession$(sessionId: string): Observable<TranscriptSegment[]>;
61
+ deltas$(sessionId: string): Observable<TranscriptSegment[]>;
62
+ partials$(sessionId: string): Observable<TranscriptSegment>;
63
+ persist(sessionId: string): Promise<void>;
64
+ clear(sessionId: string): void;
65
+ setPersister(fn: (sessionId: string, segments: TranscriptSegment[], opts: {
66
+ finalize: boolean;
67
+ }) => Promise<void>): void;
68
+ };
58
69
  };
59
70
  readonly media: {
60
71
  localStream$: Observable<MediaStream | null>;
61
- audioChunks$: Observable<AudioChunk>;
72
+ audioSegments$: Observable<AudioSegment>;
62
73
  devices$: Observable<DeviceList>;
63
74
  permissions$: Observable<MediaPermissionStatus>;
64
- emitAudioChunk(chunk: AudioChunk): void;
75
+ emitAudioSegment(segment: AudioSegment): void;
76
+ configureAudioPipeline(opts: Partial<AudioPipelineOptions>): void;
77
+ setAudioPipelineEnabled(enabled: boolean): void;
65
78
  setInputDevice(deviceId: string): Promise<void>;
66
79
  toggleMute(mute?: boolean): void;
67
80
  attachProviderStream(sessionId: string, stream: MediaStream): void;
@@ -20,6 +20,7 @@ export interface ToastConfig {
20
20
  onClick: () => void;
21
21
  }[];
22
22
  }
23
+ export type ExtensionContext = 'global' | 'call' | 'interaction';
23
24
  export interface ExtensionConfig {
24
25
  id: string;
25
26
  slot: string;
@@ -27,6 +28,7 @@ export interface ExtensionConfig {
27
28
  resource: string;
28
29
  icon?: string;
29
30
  priority?: number;
31
+ contexts?: ExtensionContext[];
30
32
  conditions?: {
31
33
  [key: string]: any;
32
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.19.0",
3
+ "version": "1.23.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",