@opencxh/domain 1.170.0 → 1.172.1

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.
Files changed (41) hide show
  1. package/dist/entities/ai-budget/types.d.ts +7 -3
  2. package/dist/entities/ai-profile/types.d.ts +7 -5
  3. package/dist/entities/analytics/dashboard.d.ts +1 -1
  4. package/dist/entities/artifact/types.d.ts +1 -1
  5. package/dist/entities/calendar-event/types.d.ts +1 -1
  6. package/dist/entities/communication/message-template.d.ts +1 -1
  7. package/dist/entities/company/types.d.ts +1 -1
  8. package/dist/entities/contact/provider.d.ts +2 -1
  9. package/dist/entities/contact/types.d.ts +1 -10
  10. package/dist/entities/live-lens/types.d.ts +1 -1
  11. package/dist/entities/memory/ingest.d.ts +14 -1
  12. package/dist/entities/memory/kind.d.ts +1 -1
  13. package/dist/entities/playbook/actor.d.ts +3 -2
  14. package/dist/entities/playbook/types.d.ts +1 -1
  15. package/dist/entities/scope/actor.d.ts +16 -0
  16. package/dist/entities/{note → scope}/index.d.ts +1 -0
  17. package/dist/entities/scope/scope.test.d.ts +1 -0
  18. package/dist/entities/scope/types.d.ts +53 -0
  19. package/dist/entities/task/types.d.ts +1 -1
  20. package/dist/entities/time-entry/types.d.ts +1 -1
  21. package/dist/entities/topic/types.d.ts +7 -5
  22. package/dist/entities/work/types.d.ts +1 -1
  23. package/dist/index.cjs +6 -6
  24. package/dist/index.d.ts +2 -6
  25. package/dist/index.js +493 -473
  26. package/dist/platform/api.d.ts +3 -1
  27. package/dist/platform/call-lines.d.ts +74 -0
  28. package/dist/platform/call-lines.test.d.ts +1 -0
  29. package/dist/platform/communication.d.ts +16 -0
  30. package/dist/platform/provider.d.ts +0 -61
  31. package/dist/platform/scope.d.ts +1 -1
  32. package/dist/platform/settings.d.ts +0 -14
  33. package/dist/platform/storage.d.ts +1 -1
  34. package/package.json +1 -4
  35. package/dist/entities/note/types.d.ts +0 -14
  36. package/dist/entities/shopify/index.d.ts +0 -1
  37. package/dist/entities/shopify/types.d.ts +0 -79
  38. package/dist/platform/lifecycle.d.ts +0 -13
  39. package/dist/platform/reactive.d.ts +0 -13
  40. package/dist/platform/sdk.d.ts +0 -172
  41. package/dist/platform/service-registry.d.ts +0 -13
@@ -18,7 +18,9 @@ export interface InvokeOptions {
18
18
  * mutatie liep gewoon door — de composer maakte zichzelf leeg en de gebruiker dacht dat
19
19
  * het bericht verstuurd was. Elke `error:`-handler in de app was daarmee dode code.
20
20
  *
21
- * Voorlopig opt-in zodat apps één voor één om kunnen; comms gaat als eerste.
21
+ * **Dit staat sinds 2026-08-20 aan als default.** Zet hem op `false` om één aanroep
22
+ * bewust stil te houden — dat is dan een keuze die in de code staat, niet de
23
+ * standaardstand waar iedereen in loopt.
22
24
  */
23
25
  throwOnError?: boolean;
24
26
  }
@@ -0,0 +1,74 @@
1
+ import { SessionState } from './communication';
2
+ /**
3
+ * Multi-line rules: which calls step aside when a new one takes the line.
4
+ *
5
+ * Kept pure and provider-agnostic because "one call has your ear at a time" is a
6
+ * platform rule, not a SIP rule. A phone with two live calls is a bug in any
7
+ * transport, and the answer must not live inside one provider's `invite`.
8
+ */
9
+ /** The part of a `Session` this decision needs. */
10
+ export interface LineSession {
11
+ id: string;
12
+ providerId: string;
13
+ state: SessionState;
14
+ }
15
+ export interface HoldOthersInput<T extends LineSession> {
16
+ sessions: T[];
17
+ /** The call taking the line — itself never held. */
18
+ exceptSessionId?: string;
19
+ /** Whether that provider actually carries out `session.hold`. */
20
+ canHold: (providerId: string) => boolean;
21
+ }
22
+ /**
23
+ * The calls to put on hold before a new one takes the line.
24
+ *
25
+ * Only `connected` calls qualify, and that is a substantive rule rather than a
26
+ * filter for tidiness:
27
+ * - `ringing` / `connecting` has no established dialog, so a re-INVITE (SIP) has
28
+ * nothing to renegotiate — holding it would throw, not hold.
29
+ * - `on_hold` is already where we want it; re-holding it would send a needless
30
+ * re-INVITE and, worse, unhold-all later would have no way to tell which calls
31
+ * the user had parked themselves.
32
+ * - `ended` / `failed` / `idle` have no media to step aside.
33
+ *
34
+ * Sessions from a provider that does not carry out hold are left out entirely:
35
+ * dispatching hold at a provider whose `dispatch` has no case for it returns
36
+ * quietly, and we would then show a call as parked while the caller can still
37
+ * hear the room.
38
+ */
39
+ export declare function sessionsToHold<T extends LineSession>(input: HoldOthersInput<T>): T[];
40
+ /**
41
+ * Calls that a new line will leave live because their provider cannot hold.
42
+ *
43
+ * Split out from `sessionsToHold` so the caller can say so out loud instead of
44
+ * quietly ending up with two live calls — the situation that started this.
45
+ */
46
+ export declare function sessionsHoldCannotReach<T extends LineSession>(input: HoldOthersInput<T>): T[];
47
+ /** Whether an incoming call may ring, and if not, what to tell the caller. */
48
+ export type IncomingCallDecision = {
49
+ admit: true;
50
+ } | {
51
+ admit: false;
52
+ reason: "busy";
53
+ };
54
+ /**
55
+ * Whether an incoming call may ring while the user already has a call.
56
+ *
57
+ * **"In gesprek" means an established call — `connected` or `on_hold`.** Both of
58
+ * those are a conversation you are in: a parked caller is still yours, and taking
59
+ * a new call means abandoning them. `connecting` and `ringing` are deliberately
60
+ * *not* busy, for two reasons. A call that is merely ringing is not yet a
61
+ * conversation, so rejecting on it would turn two near-simultaneous inbound calls
62
+ * into one — a queue decision that is not ours to make. And it keeps the blast
63
+ * radius small: were `ringing` to count, a single session that failed to clean up
64
+ * would silently reject every inbound call from then on.
65
+ *
66
+ * The caller gets a real busy answer rather than silence, so the PBX can roll the
67
+ * call to the next agent or to voicemail — see the provider that maps this to a
68
+ * SIP status code.
69
+ */
70
+ export declare function decideIncomingCall<T extends LineSession>(input: {
71
+ sessions: T[];
72
+ /** The incoming call itself, when the provider already created a session. */
73
+ exceptSessionId?: string;
74
+ }): IncomingCallDecision;
@@ -0,0 +1 @@
1
+ export {};
@@ -53,6 +53,20 @@ export interface CommsAccount<T = any> {
53
53
  }
54
54
  export interface ITransportProvider {
55
55
  readonly id: string;
56
+ /**
57
+ * The ops this provider actually carries out, when it wants to say so.
58
+ *
59
+ * `dispatch` is a switch, so an op it has no case for returns quietly — the
60
+ * caller cannot tell "done" from "ignored". That is fine for a button the
61
+ * provider's own action tray never draws, but not for something the platform
62
+ * does on the user's behalf: auto-holding the previous call at a provider
63
+ * without hold would park a call that stays live.
64
+ *
65
+ * Undeclared means unknown, and unknown is tried anyway — that is the
66
+ * behaviour every provider had before this field existed. Declare it to be
67
+ * skipped rather than silently no-op'd.
68
+ */
69
+ readonly supportedOps?: readonly TransportOpKind[];
56
70
  subscribeSessions(callback: (sessions: Session[]) => void): () => void;
57
71
  subscribeAccounts(callback: (accounts: CommsAccount[]) => void): () => void;
58
72
  subscribeStreams(callback: (data: RemoteStreamEvent) => void): () => void;
@@ -685,6 +699,8 @@ export declare const UNSUPPORTED: ServerResult;
685
699
  * door de frontend via `ITransportProvider.dispatch`. Geen server-
686
700
  * roundtrip — directe controle over de lokale stack.
687
701
  */
702
+ /** The `kind` of a {@link TransportOp} — what a provider declares support for. */
703
+ export type TransportOpKind = TransportOp["kind"];
688
704
  export type TransportOp = {
689
705
  kind: "session.invite";
690
706
  accountId: string;
@@ -1,18 +1,6 @@
1
1
  import { Interaction } from '../entities/interaction';
2
2
  import { Uri } from './communication';
3
3
  import { TranscriptSegment } from './media';
4
- export interface ProviderTranscribeRequest {
5
- file: Float32Array;
6
- filename: string;
7
- mimeType: string;
8
- accountId?: string;
9
- /**
10
- * Vraag segment-niveau output op (timestamps/woorden per segment). Default false:
11
- * dan komt alleen `text` terug. Aan = provider levert ook `segments` als de
12
- * onderliggende STT-dienst dat ondersteunt.
13
- */
14
- segments?: boolean;
15
- }
16
4
  export interface ProviderTranscribeResponse {
17
5
  /** Volledige transcript-tekst (altijd aanwezig, backwards compatible). */
18
6
  text: string;
@@ -52,11 +40,6 @@ export interface ComposePayload {
52
40
  */
53
41
  extra?: Record<string, any>;
54
42
  }
55
- export interface ComposeResponse {
56
- messageId: string;
57
- type: string;
58
- payload: any;
59
- }
60
43
  export interface UpsertByExternalProviderIdPayload {
61
44
  providerId: string;
62
45
  externalIds: string[];
@@ -71,14 +54,6 @@ export interface SttSettings {
71
54
  providerId: string;
72
55
  providerAccountId?: string;
73
56
  }
74
- export interface TtsSettings {
75
- providerId: string;
76
- providerAccountId?: string;
77
- }
78
- export interface LlmSettings {
79
- providerId: string;
80
- providerAccountId?: string;
81
- }
82
57
  export interface FindByAddressPayload {
83
58
  addressUri: {
84
59
  scheme: string;
@@ -99,28 +74,6 @@ export interface FindActivityByExternalProviderIdPayload {
99
74
  * corresponding provider via these payloads.
100
75
  */
101
76
  export type ScheduleResponse = "accepted" | "declined" | "tentative";
102
- export interface SchedulePayload {
103
- channelId: string;
104
- /** Local CalendarEvent without storage-managed fields. */
105
- event: any;
106
- }
107
- export interface ScheduleUpdatePayload {
108
- channelId: string;
109
- externalId: string;
110
- patch: any;
111
- }
112
- export interface ScheduleCancelPayload {
113
- channelId: string;
114
- externalId: string;
115
- comment?: string;
116
- }
117
- export interface ScheduleRespondPayload {
118
- channelId: string;
119
- externalId: string;
120
- response: ScheduleResponse;
121
- comment?: string;
122
- sendResponse?: boolean;
123
- }
124
77
  export interface ScheduleResult {
125
78
  externalId?: string;
126
79
  /** Provider-side echo for caller persistence (e.g. Graph event id). */
@@ -142,9 +95,6 @@ export interface FileGetPayload {
142
95
  filename: string;
143
96
  path?: string;
144
97
  }
145
- export interface FileGetResponse {
146
- file: Uint8Array;
147
- }
148
98
  export interface FileDeletePayload {
149
99
  accountId?: string;
150
100
  filename: string;
@@ -153,28 +103,17 @@ export interface FileDeletePayload {
153
103
  export interface FileDeleteResponse {
154
104
  success: boolean;
155
105
  }
156
- export interface FileListPayload {
157
- accountId?: string;
158
- path?: string;
159
- }
160
106
  export interface File {
161
107
  name: string;
162
108
  size: number;
163
109
  lastModified: number;
164
110
  type: string;
165
111
  }
166
- export interface FileListResponse {
167
- files: File[];
168
- }
169
112
  export interface FolderCreatePayload {
170
113
  accountId?: string;
171
114
  name: string;
172
115
  path?: string;
173
116
  }
174
- export interface FolderCreateResponse {
175
- success: boolean;
176
- url: string;
177
- }
178
117
  export interface ListFilesPayload {
179
118
  mimeType?: string;
180
119
  name?: string;
@@ -1,4 +1,4 @@
1
- import { OwnerScope } from '../entities/contact/types';
1
+ import { OwnerScope } from '../entities/scope/types';
2
2
  import { ActingIdentity } from './identity';
3
3
  /** Access decision + whether the scope anchor is team-shared + the SSE audience. */
4
4
  export interface ScopeAuth {
@@ -1,4 +1,3 @@
1
- import { Observable } from 'rxjs';
2
1
  export interface UserSettings {
3
2
  audio: {
4
3
  selectedMicrophone: string;
@@ -30,16 +29,3 @@ export interface DeviceList {
30
29
  input: MediaDeviceInfo[];
31
30
  output: MediaDeviceInfo[];
32
31
  }
33
- export interface ISettingsManager {
34
- readonly settings$: Observable<UserSettings>;
35
- get(): UserSettings;
36
- update(partial: DeepPartial<UserSettings>): void;
37
- getIceServers(): RTCIceServer[];
38
- getAudioInputDeviceId(): string;
39
- setAudioInputDeviceId(deviceId: string): void;
40
- getAudioOutputDeviceId(): string;
41
- setAudioOutputDeviceId(deviceId: string): void;
42
- getVideoDeviceId(): string;
43
- setVideoDeviceId(deviceId: string): void;
44
- setIceServers(servers: RTCIceServer[]): void;
45
- }
@@ -1,4 +1,4 @@
1
- import { OwnerScope } from '../entities/contact/types';
1
+ import { OwnerScope } from '../entities/scope/types';
2
2
  /**
3
3
  * A virtual folder: a named, scoped root that binds to a storage backend
4
4
  * (a StorageAccount on a storage provider) at a base path. Its `ownerScope`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.170.0",
3
+ "version": "1.172.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -24,9 +24,6 @@
24
24
  "test:run": "vitest run",
25
25
  "test:watch": "vitest --watch"
26
26
  },
27
- "peerDependencies": {
28
- "rxjs": "^7.8.2"
29
- },
30
27
  "devDependencies": {
31
28
  "typescript": "6.0.3",
32
29
  "vite": "7.1.7",
@@ -1,14 +0,0 @@
1
- /**
2
- * Data model for a single Note.
3
- */
4
- export interface Note {
5
- id: string;
6
- organizationId: string;
7
- interactionId: string;
8
- serviceName: string;
9
- authorId: string;
10
- authorDisplayName: string;
11
- content: string;
12
- createdAt: Date;
13
- updatedAt: Date;
14
- }
@@ -1 +0,0 @@
1
- export * from './types';
@@ -1,79 +0,0 @@
1
- /**
2
- * Shopify DTO's — gedeeld tussen de shopify-server (mapping uit Admin API),
3
- * platform-api (typed client) en de frontend-tool. Geen Shopify-SDK-types
4
- * lekken naar consumers; dit is de smalle, stabiele contractlaag.
5
- */
6
- export interface ShopifyCustomer {
7
- id: string;
8
- firstName?: string;
9
- lastName?: string;
10
- email?: string;
11
- phone?: string;
12
- ordersCount?: number;
13
- totalSpent?: string;
14
- currency?: string;
15
- /** Klant sinds — ISO-datum uit Shopify. */
16
- createdAt?: string;
17
- /** Shopify-klantlabels ("wholesale", "net-30"): segment, betaaltermijn, wat de shop erin zet. */
18
- tags?: string[];
19
- defaultAddress?: ShopifyAddress;
20
- }
21
- export interface ShopifyLineItem {
22
- title: string;
23
- variantTitle?: string;
24
- quantity: number;
25
- price: string;
26
- }
27
- export interface ShopifyTracking {
28
- company?: string;
29
- number?: string;
30
- url?: string;
31
- }
32
- export interface ShopifyAddress {
33
- name?: string;
34
- address1?: string;
35
- address2?: string;
36
- zip?: string;
37
- city?: string;
38
- province?: string;
39
- country?: string;
40
- phone?: string;
41
- }
42
- export interface ShopifyOrder {
43
- id: string;
44
- /** Human order-name, bv. "#1001". */
45
- name: string;
46
- createdAt: string;
47
- financialStatus?: string;
48
- fulfillmentStatus?: string;
49
- totalPrice: string;
50
- /** Opsplitsing van het totaal. Optioneel: oudere orders leveren niet elk veld. */
51
- subtotalPrice?: string;
52
- totalShipping?: string;
53
- totalTax?: string;
54
- currency: string;
55
- lineItems: ShopifyLineItem[];
56
- shippingAddress?: ShopifyAddress;
57
- tracking: ShopifyTracking[];
58
- note?: string;
59
- /** Deep-link naar de order in de Shopify-admin (nieuw tabblad). */
60
- adminUrl: string;
61
- }
62
- export interface ShopifyOrderEvent {
63
- id: string;
64
- createdAt: string;
65
- /** Mensvriendelijke omschrijving van het event. */
66
- message: string;
67
- /** Shopify "verb" (bv. "confirmed", "fulfilled", "sale"). */
68
- verb?: string;
69
- }
70
- export interface ShopifyLookupResult {
71
- /** False = geen verbonden/enabled shop voor deze org (admin moet koppelen). */
72
- connected: boolean;
73
- /** De shop waar dit uit komt, bv. "leufgens-shop.myshopify.com". */
74
- shopDomain?: string;
75
- customer: ShopifyCustomer | null;
76
- /** Deep-link naar de klant in de Shopify-admin. */
77
- customerAdminUrl?: string;
78
- orders: ShopifyOrder[];
79
- }
@@ -1,13 +0,0 @@
1
- export interface AppLifecycle {
2
- /** * On-load: Registreer services, menu-items en andere metadata.
3
- * Wordt éénmalig uitgevoerd bij het laden van de JS.
4
- */
5
- setup: () => void;
6
- /** * On-mount: Render de UI in de meegeleverde container.
7
- * Wordt uitgevoerd wanneer de gebruiker naar de app navigeert.
8
- */
9
- mount: (container: HTMLElement, props?: any) => void;
10
- /** * On-unmount: Ruim eventuele listeners of DOM-elementen op.
11
- */
12
- unmount: (container: HTMLElement) => void;
13
- }
@@ -1,13 +0,0 @@
1
- export interface Subscriber<T> {
2
- next: (value?: T) => void;
3
- error?: (err: any) => void;
4
- complete?: () => void;
5
- }
6
- export interface Observable<T> {
7
- subscribe(subscriber: Subscriber<T>): () => void;
8
- }
9
- export interface Result<T> {
10
- success: boolean;
11
- value?: T;
12
- error?: any;
13
- }
@@ -1,172 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { InvokeOptions, SSEMessage } from './api';
3
- import { CommsAccount, Session } from './communication';
4
- import { PlatformConfig, PlatformContext } from './kernel';
5
- import { AudioPipelineOptions, AudioSegment, MediaPermissionKind, MediaPermissionState, MediaPermissionStatus, TranscriptSegment } from './media';
6
- import { ServiceCallOptions, ServiceMap } from './services';
7
- import { DeepPartial, DeviceList, UserSettings } from './settings';
8
- import { ExtensionConfig, ToastConfig } from './ui';
9
- type ServiceKey<S extends ServiceMap> = keyof S;
10
- export type ParamsOf<S extends ServiceMap, K extends ServiceKey<S>> = S[K]['params'];
11
- export type PayloadOf<S extends ServiceMap, K extends ServiceKey<S>> = S[K]['payload'];
12
- export type ResponseOf<S extends ServiceMap, K extends ServiceKey<S>> = S[K]['response'];
13
- export type SSEHandlerOf<S extends ServiceMap, K extends ServiceKey<S>> = (payload: SSEMessage<PayloadOf<S, K>>) => Promise<void>;
14
- export interface InternalSDK<LocalServices extends ServiceMap = {}, TranslationKeys extends string = string, ModalKeys extends string = string, ExtensionKeys extends string = string> {
15
- readonly context: PlatformContext;
16
- readonly config: PlatformConfig;
17
- readonly services: {
18
- execute<K extends ServiceKey<LocalServices>>(key: K, options: ServiceCallOptions<ParamsOf<LocalServices, K>, PayloadOf<LocalServices, K>>): Promise<ResponseOf<LocalServices, K>>;
19
- observe<K extends ServiceKey<LocalServices>>(key: K, options: ServiceCallOptions<ParamsOf<LocalServices, K>, PayloadOf<LocalServices, K>>): Observable<ResponseOf<LocalServices, K>>;
20
- };
21
- readonly http: {
22
- invoke<R = any>(options: InvokeOptions): Promise<R>;
23
- };
24
- readonly router: {
25
- /** Relative to the app's own `/apps/{appName}` prefix. */
26
- navigate(path: string, options?: any): void;
27
- /**
28
- * Straight to a shell path, no prefix.
29
- *
30
- * For the app's `public: true` routes: those hang off the manifest's
31
- * `publicBasePath` (`/help/…`), so the app prefix would point at a page
32
- * that does not exist.
33
- */
34
- navigateAbsolute(path: string, options?: any): void;
35
- /**
36
- * Terug naar de vorige pagina — de echte, inclusief die van een andere app.
37
- *
38
- * Waarom dit hier hoort en niet per app: elk detailscherm heeft een terugknop, en zonder
39
- * gedeelde vorm wordt dat overal een vaste route ("terug" = altijd de lijst) die liegt zodra
40
- * je van een bord of uit een gesprek komt.
41
- *
42
- * `fallback` is app-relatief, net als {@link navigate}, en geldt alleen als er geen vorige
43
- * pagina ín deze sessie is — dat is precies het geval bij een koud geopende deeplink. Geef je
44
- * er geen, dan gebeurt er niets: uit het product lopen is geen taak van een terugknop.
45
- */
46
- back(fallback?: string): void;
47
- /** Is er een vorige pagina in deze sessie? Voor een knop die zichzelf wil verbergen. */
48
- canGoBack(): boolean;
49
- currentPath(): string;
50
- path$: Observable<string>;
51
- };
52
- readonly resources: {
53
- get<T = any>(appName: string, resourceKey: string): Promise<T>;
54
- };
55
- readonly localization: {
56
- /**
57
- * Vertaal een sleutel.
58
- *
59
- * Zonder `:` is het een sleutel van deze app zelf. Mét `:` is hij al genamespaced
60
- * (`"helpdesk:ticket.added.text"`) en wordt hij ongewijzigd opgezocht — nodig om tekst
61
- * te tonen die een andere app meestuurde bij iets wat wij renderen.
62
- */
63
- t(key: TranslationKeys | `${string}:${string}`, params?: Record<string, any>): string;
64
- /**
65
- * De actieve taal ("nl" | "en").
66
- *
67
- * Nodig zodra een app zélf iets moet opmaken in plaats van een sleutel op te
68
- * zoeken: `Intl.ListFormat` voor een opsomming, `toLocaleTimeString` voor een
69
- * tijd. Zonder dit viel dat terug op `navigator.language`, die niet meebeweegt
70
- * als de gebruiker de taal in de app omzet.
71
- */
72
- readonly currentLocale: string;
73
- };
74
- readonly ui: {
75
- modals: {
76
- open(key: ModalKeys, props?: any): void;
77
- close(key: ModalKeys): void;
78
- };
79
- docks: {
80
- open(key: string, props?: any): void;
81
- close(key: string): void;
82
- minimize(key: string, minimized?: boolean): void;
83
- expand(key: string, expanded?: boolean): void;
84
- };
85
- settings: {
86
- open(initialPageId?: string): void;
87
- close(): void;
88
- };
89
- toasts: {
90
- show(config: ToastConfig): void;
91
- close(id: string): void;
92
- };
93
- extensions: {
94
- getForSlot(slot: string): Observable<ExtensionConfig[]>;
95
- };
96
- };
97
- readonly communication: {
98
- sessions$: Observable<Session[]>;
99
- accounts$: Observable<CommsAccount[]>;
100
- activeSession$: Observable<Session | null>;
101
- /**
102
- * Routeert een TransportOp naar de provider die de gegeven session bezit.
103
- * Vervangt de losse hangupSession/handleSessionAction APIs.
104
- */
105
- dispatchSessionOp(sessionId: string, op: import('./communication').TransportOp): Promise<void>;
106
- /**
107
- * Initieert een nieuwe outbound sessie via `session.invite`. Sugar
108
- * voor `dispatchSessionOp` op het juiste provider; sessieId bestaat
109
- * pas na invite.
110
- */
111
- invite(target: string, accountId: string): Promise<void>;
112
- interceptStream(sessionId: string, callback: (stream: MediaStream) => void): Promise<() => void>;
113
- setActiveSession(sessionId: string): Promise<void>;
114
- registerAccount(organizationId: string, userId: string, providerId: string, config: any): Promise<CommsAccount>;
115
- transcripts: {
116
- ingest(segments: TranscriptSegment[]): void;
117
- byCallSession$(sessionId: string): Observable<TranscriptSegment[]>;
118
- deltas$(sessionId: string): Observable<TranscriptSegment[]>;
119
- partials$(sessionId: string): Observable<TranscriptSegment>;
120
- persist(sessionId: string): Promise<void>;
121
- clear(sessionId: string): void;
122
- /**
123
- * `opts.from` is de index waar `segments` in het transcript begint: `0` is het hele
124
- * transcript, hoger maakt het een delta op wat de ontvanger al heeft. Zonder dat stuurde
125
- * elke flush (elke ~3s) de complete array opnieuw.
126
- */
127
- setPersister(fn: (sessionId: string, segments: TranscriptSegment[], opts: {
128
- finalize: boolean;
129
- from: number;
130
- }) => Promise<void>): void;
131
- };
132
- };
133
- readonly media: {
134
- localStream$: Observable<MediaStream | null>;
135
- audioSegments$: Observable<AudioSegment>;
136
- devices$: Observable<DeviceList>;
137
- permissions$: Observable<MediaPermissionStatus>;
138
- emitAudioSegment(segment: AudioSegment): void;
139
- configureAudioPipeline(opts: Partial<AudioPipelineOptions>): void;
140
- setAudioPipelineEnabled(enabled: boolean): void;
141
- setSessionAudioEnabled(sessionId: string, enabled: boolean): void;
142
- isSessionAudioPaused(sessionId: string): boolean;
143
- setInputDevice(deviceId: string): Promise<void>;
144
- acquireMicStream(deviceId?: string): Promise<MediaStream>;
145
- deviceChanges$: Observable<string>;
146
- toggleMute(mute?: boolean): void;
147
- attachProviderStream(sessionId: string, stream: MediaStream): void;
148
- detachStream(sessionId: string): void;
149
- setAudioOutput(deviceId: string): Promise<void>;
150
- getInputDevices(): MediaDeviceInfo[];
151
- getOutputDevices(): MediaDeviceInfo[];
152
- enumerateDevices(): Promise<void>;
153
- checkPermission(kind: MediaPermissionKind): Promise<MediaPermissionState>;
154
- requestPermission(kind: MediaPermissionKind): Promise<MediaPermissionState>;
155
- ensurePermission(kind: MediaPermissionKind): Promise<boolean>;
156
- refreshPermissions(): Promise<MediaPermissionStatus>;
157
- };
158
- readonly settings: {
159
- settings$: Observable<UserSettings>;
160
- get(): UserSettings;
161
- update(partial: DeepPartial<UserSettings>): void;
162
- getIceServers(): RTCIceServer[];
163
- getAudioInputDeviceId(): string;
164
- setAudioInputDeviceId(deviceId: string): void;
165
- getAudioOutputDeviceId(): string;
166
- setAudioOutputDeviceId(deviceId: string): void;
167
- getVideoDeviceId(): string;
168
- setVideoDeviceId(deviceId: string): void;
169
- setIceServers(servers: RTCIceServer[]): void;
170
- };
171
- }
172
- export {};
@@ -1,13 +0,0 @@
1
- import { Observable } from './reactive';
2
- export interface Command<TParams = any, TResponse = any> {
3
- params: TParams;
4
- response: TResponse;
5
- }
6
- export interface Query<TParams = any, TResponse = any> {
7
- params: TParams;
8
- response: TResponse;
9
- }
10
- export interface ServiceRegistry<TCommands extends Record<string, Command> = any, TQueries extends Record<string, Query> = any> {
11
- execute<K extends keyof TCommands>(name: K, params: TCommands[K]["params"]): Promise<TCommands[K]["response"]>;
12
- observe<K extends keyof TQueries>(name: K, params: TQueries[K]["params"]): Observable<TQueries[K]["response"]>;
13
- }