@ikonai/sdk 1.7.0 → 1.10.0
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/app-messaging.d.ts +11 -1
- package/assets/audio-playback-worker-D9_GcJw4.js +1 -0
- package/assets/protocol-worker-DA6wieqV.js +3 -0
- package/assets/video-capture-worker-DLndrZf8.js +1 -0
- package/assets/video-playback-worker-DAAVfeBm.js +1 -0
- package/assets/viseme-worker-Bfd95xP6.js +1 -0
- package/capabilities-lcsAlVUh.js +1146 -0
- package/channel/channel-manager.d.ts +1 -0
- package/client/ikon-client-config.d.ts +3 -0
- package/client/ikon-client.d.ts +37 -28
- package/functions/download-functions.d.ts +8 -0
- package/functions/index.d.ts +1 -0
- package/index.d.ts +5 -4
- package/index.js +5179 -2534
- package/media/ikon-audio-capture.d.ts +22 -0
- package/media/ikon-audio-playback.d.ts +1 -0
- package/media/ikon-video-capture.d.ts +8 -0
- package/media/index.d.ts +2 -0
- package/media/media-permission.d.ts +47 -0
- package/package.json +5 -2
- package/storage.d.ts +1 -1
- package/transport/http-stream-transport.d.ts +2 -1
- package/transport/keepalive-watchdog.d.ts +28 -0
- package/transport/transport.d.ts +7 -0
- package/transport/web-socket-transport.d.ts +2 -1
- package/transport/web-transport-transport.d.ts +2 -4
- package/utils/boot-signal.d.ts +14 -0
- package/utils/browser-compat.d.ts +17 -0
- package/utils/browser-support.d.ts +15 -10
- package/utils/client-identity.d.ts +13 -0
- package/utils/parent-log-forward.d.ts +22 -0
- package/utils/query-params.d.ts +18 -0
- package/webrtc/webrtc-signaling.d.ts +7 -0
- package/assets/audio-playback-worker-BXZR_9iK.js +0 -1
- package/assets/protocol-worker-CW7oSQmQ.js +0 -3
- package/assets/video-capture-worker-mvwKyjOn.js +0 -1
- package/assets/video-playback-worker-DqNjooZJ.js +0 -1
- package/assets/viseme-worker-D0AKWUTO.js +0 -1
- package/capabilities-xDnE0vqq.js +0 -105
- package/ikon-media-CdIF9gbL.js +0 -3154
|
@@ -394,6 +394,9 @@ export interface IkonClientConfig {
|
|
|
394
394
|
*/
|
|
395
395
|
interceptInternalLinks?: boolean;
|
|
396
396
|
}
|
|
397
|
+
/** Where a local dev server listens when nothing says otherwise; the vite template bakes the same pair. */
|
|
398
|
+
export declare const DEFAULT_LOCAL_SERVER_HOST = "localhost";
|
|
399
|
+
export declare const DEFAULT_LOCAL_SERVER_PORT = 8443;
|
|
397
400
|
export declare const DEFAULT_SLOW_CONNECTION_THRESHOLD_MS = 5000;
|
|
398
401
|
export declare const DEFAULT_CONNECTION_TIMEOUT_MS = 180000;
|
|
399
402
|
export declare const PROTOCOL_WORKER_CONNECT_TIMEOUT_MS = 30000;
|
package/client/ikon-client.d.ts
CHANGED
|
@@ -62,44 +62,29 @@ export interface ProtocolMessageSubscriptionOptions {
|
|
|
62
62
|
* State handler callback type for state subscribers.
|
|
63
63
|
*/
|
|
64
64
|
export type StateHandler = (state: ConnectionState) => void;
|
|
65
|
+
/** How a dispatched UI action should be treated when the server refuses it. */
|
|
66
|
+
export interface SendActionCallOptions {
|
|
67
|
+
/**
|
|
68
|
+
* The dispatch is a component's own bookkeeping rather than something a person did, so a refusal
|
|
69
|
+
* is not worth a person's attention: a controlled overlay reports itself closed as it unmounts,
|
|
70
|
+
* and when the whole subtree is going away the server has already retired that action. Such a
|
|
71
|
+
* failure is logged at debug instead of error.
|
|
72
|
+
*/
|
|
73
|
+
bestEffort?: boolean;
|
|
74
|
+
}
|
|
65
75
|
/** The server-side outcome of a dispatched UI action (see {@link IkonClient.sendActionCallWithResult}). */
|
|
66
76
|
export interface ActionOutcome {
|
|
67
77
|
success: boolean;
|
|
78
|
+
/** Empty: the server keeps the exception in its own log, so a failure carries no reason here. */
|
|
68
79
|
errorMessage: string;
|
|
69
80
|
}
|
|
70
|
-
/**
|
|
71
|
-
* IkonClient is the main entry point for connecting to an Ikon server.
|
|
72
|
-
*
|
|
73
|
-
* Features:
|
|
74
|
-
* - Manages connection lifecycle
|
|
75
|
-
* - Provides UI-friendly connection states (waitingForExternalConnectUrl, connecting, connected, reconnecting, offline)
|
|
76
|
-
* - Handles timeouts for connection establishment
|
|
77
|
-
* - Passes protocol messages to application via callback
|
|
78
|
-
* - Multi-channel support (core, audio, video on separate connections)
|
|
79
|
-
* - Smart endpoint selection (WT → WS → WTProxy → WSProxy)
|
|
80
|
-
*
|
|
81
|
-
* Usage:
|
|
82
|
-
* ```typescript
|
|
83
|
-
* const client = new IkonClient({
|
|
84
|
-
* local: { host: 'localhost', httpsPort: 8443 },
|
|
85
|
-
* onProtocolMessage: (message) => {
|
|
86
|
-
* const opcode = getOpcode(message)
|
|
87
|
-
* // Handle protocol messages
|
|
88
|
-
* },
|
|
89
|
-
* onConnectionStateChange: (state) => {
|
|
90
|
-
* // Update UI based on state
|
|
91
|
-
* }
|
|
92
|
-
* })
|
|
93
|
-
*
|
|
94
|
-
* await client.connect()
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
81
|
export declare class IkonClient {
|
|
98
82
|
private channelManager;
|
|
99
83
|
private protocolWorker;
|
|
100
84
|
private preloadedWorker;
|
|
101
85
|
private workerManagerState;
|
|
102
86
|
private authResponse;
|
|
87
|
+
private _resumedSession;
|
|
103
88
|
private _connectUrl;
|
|
104
89
|
private _brandingRequired;
|
|
105
90
|
private currentState;
|
|
@@ -128,6 +113,7 @@ export declare class IkonClient {
|
|
|
128
113
|
private readonly _pendingActionAcks;
|
|
129
114
|
private _ackRttMs;
|
|
130
115
|
private readonly _actionIdByCallId;
|
|
116
|
+
private readonly _bestEffortCallIds;
|
|
131
117
|
private readonly _pendingActionResults;
|
|
132
118
|
private readonly endpointSelector;
|
|
133
119
|
private readonly _webRtcReachability;
|
|
@@ -155,8 +141,10 @@ export declare class IkonClient {
|
|
|
155
141
|
private unregisterBrowserFunctions;
|
|
156
142
|
private unregisterMediaCaptureFunctions;
|
|
157
143
|
private unregisterSoundFunctions;
|
|
144
|
+
private unregisterDownloadFunctions;
|
|
158
145
|
private unregisterLoginInterceptor;
|
|
159
146
|
private nextProtocolPortId;
|
|
147
|
+
private _deliveringViaDataChannel;
|
|
160
148
|
private nextProtocolSendPortId;
|
|
161
149
|
private readonly _audioEnabled;
|
|
162
150
|
private readonly _videoEnabled;
|
|
@@ -187,6 +175,7 @@ export declare class IkonClient {
|
|
|
187
175
|
private _reconnectTimer;
|
|
188
176
|
private _joinWatchdogTimer;
|
|
189
177
|
private _serverStopped;
|
|
178
|
+
private _credentialRejected;
|
|
190
179
|
private _hasBeenConnected;
|
|
191
180
|
private _waitForExternalConnectUrl;
|
|
192
181
|
private _externalConnectUrlCleanup;
|
|
@@ -309,6 +298,12 @@ export declare class IkonClient {
|
|
|
309
298
|
* Returns undefined if not connected.
|
|
310
299
|
*/
|
|
311
300
|
get sessionId(): number | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* True when this client joined a session another connection opened (a `window.__IKON_RESUME__`
|
|
303
|
+
* hand-off) rather than authenticating one of its own. Such a client starts with no UI tree: the stream
|
|
304
|
+
* began before it arrived, so it has to ask the app for a full snapshot.
|
|
305
|
+
*/
|
|
306
|
+
get resumedSession(): boolean;
|
|
312
307
|
/**
|
|
313
308
|
* The Ikon server instance serving this connection. Stable across soft reconnects (cached
|
|
314
309
|
* entrypoints, same instance); changes when a full re-authentication lands on a different
|
|
@@ -423,7 +418,7 @@ export declare class IkonClient {
|
|
|
423
418
|
* Disconnect from the server.
|
|
424
419
|
*/
|
|
425
420
|
disconnect(): void;
|
|
426
|
-
sendActionCall(actionId: string, payload?: string): void;
|
|
421
|
+
sendActionCall(actionId: string, payload?: string, options?: SendActionCallOptions): void;
|
|
427
422
|
/**
|
|
428
423
|
* Dispatch a UI action and resolve with the server handler's actual outcome — the
|
|
429
424
|
* ActionResult the server emits when the handler finishes (the ActionCallAck is only a
|
|
@@ -466,6 +461,14 @@ export declare class IkonClient {
|
|
|
466
461
|
* Routes to appropriate channel based on the message's opcode group.
|
|
467
462
|
*/
|
|
468
463
|
sendProtocolMessage(message: ProtocolMessage): void;
|
|
464
|
+
/**
|
|
465
|
+
* Hand an error to the app's onError callback.
|
|
466
|
+
*
|
|
467
|
+
* For SDK subsystems (media playback, capture) whose failure leaves the connection itself
|
|
468
|
+
* intact: the client stays connected, so this callback is the only place the app can learn
|
|
469
|
+
* that a session went silent or blind.
|
|
470
|
+
*/
|
|
471
|
+
reportError(error: Error): void;
|
|
469
472
|
/**
|
|
470
473
|
* Send a client context update to the server.
|
|
471
474
|
* This notifies the server of changes to viewport size, theme, or timezone.
|
|
@@ -562,6 +565,10 @@ export declare class IkonClient {
|
|
|
562
565
|
*/
|
|
563
566
|
private setErrorState;
|
|
564
567
|
private connectProtocol;
|
|
568
|
+
/** Media setup that must follow EVERY successful protocol connect. It used to live only on the
|
|
569
|
+
* worker path's tail, so the two no-Worker fallbacks connected without audio, video or WebRTC —
|
|
570
|
+
* a silent client on exactly the browsers that already lack workers. */
|
|
571
|
+
private finishMediaSetup;
|
|
565
572
|
private ensureVisemeTracker;
|
|
566
573
|
/**
|
|
567
574
|
* Builds and enables the custom (non-WebRTC) playback pipeline. This is the
|
|
@@ -612,6 +619,7 @@ export declare class IkonClient {
|
|
|
612
619
|
private connectProtocolOnMainThread;
|
|
613
620
|
private disconnectProtocol;
|
|
614
621
|
private getServerKeepaliveTimeoutMs;
|
|
622
|
+
private getSoftRetryWindowMs;
|
|
615
623
|
private groupEntrypointsByType;
|
|
616
624
|
/**
|
|
617
625
|
* Tell the developer — and through them, whoever runs the network — that this session is on the
|
|
@@ -677,6 +685,7 @@ export declare class IkonClient {
|
|
|
677
685
|
private requestExternalConnectUrl;
|
|
678
686
|
private attemptReconnectOnVisible;
|
|
679
687
|
private handleBrowserOffline;
|
|
688
|
+
private forceReconnectAfterOffline;
|
|
680
689
|
/**
|
|
681
690
|
* Clear all timers.
|
|
682
691
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionRegistry } from './function-registry';
|
|
2
|
+
export declare const DownloadFunctionNames: {
|
|
3
|
+
readonly DownloadFile: "ikon.client.downloadFile";
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Register download functions with a registry. Returns an unregister function.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerDownloadFunctions(registry: FunctionRegistry): () => void;
|
package/functions/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { withResultData, FunctionCallError } from './types';
|
|
|
3
3
|
export { FunctionRegistry, type FunctionRegistryConfig, type ErrorInterceptor } from './function-registry';
|
|
4
4
|
export { registerBrowserFunctions, isBrowserEnvironment } from './browser-functions';
|
|
5
5
|
export { registerSoundFunctions, SoundFunctionNames } from './sound-functions';
|
|
6
|
+
export { registerDownloadFunctions, DownloadFunctionNames } from './download-functions';
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { IkonClient, type ActionOutcome, type ProtocolMessageHandler, type StateHandler, type ProtocolMessageSubscriptionOptions, type ProtocolMessagePort, type ProtocolSendPort, type WebRTCTrackMapInfo } from './client/ikon-client';
|
|
1
|
+
export { IkonClient, type ActionOutcome, type SendActionCallOptions, type ProtocolMessageHandler, type StateHandler, type ProtocolMessageSubscriptionOptions, type ProtocolMessagePort, type ProtocolSendPort, type WebRTCTrackMapInfo } from './client/ikon-client';
|
|
2
2
|
export { AppMessaging, appMessaging, type AppMessageType, type AppMessageSubscription } from './app-messaging';
|
|
3
3
|
export type { IkonClientConfig, LocalConfig, ApiKeyConfig, SessionTokenConfig, CloudConnectionConfig, CommonConnectionConfig, TimeoutConfig, BackendType, AudioConfig, VideoConfig, MediaSessionConfig, WebRtcConfig } from './client/ikon-client-config';
|
|
4
|
+
export { DEFAULT_LOCAL_SERVER_HOST, DEFAULT_LOCAL_SERVER_PORT, DEFAULT_SLOW_CONNECTION_THRESHOLD_MS } from './client/ikon-client-config';
|
|
4
5
|
export type { ConnectionState } from './client/connection-state';
|
|
5
6
|
export { isConnecting, isConnected, isOffline, isError } from './client/connection-state';
|
|
6
7
|
export { ChannelManager, type ChannelManagerConfig, type ChannelManagerState } from './channel/channel-manager';
|
|
@@ -20,7 +21,7 @@ export { abortSignalTimeout, abortSignalAny } from './utils/abort-signal';
|
|
|
20
21
|
export { createPkceChallenge, takePkceVerifier, restorePkceVerifier, isPkceSupported } from './utils/pkce';
|
|
21
22
|
export { isEmbedded, startEmbeddedOAuthSignIn, adoptPkceVerifierFromUrl, onEmbeddedOAuthResult, type EmbeddedOAuthResult } from './utils/embedded-oauth';
|
|
22
23
|
export { initializeInspectMode, isInspectModeEnabled, enableInspectMode, IKON_INSPECT_MODE_CHANGED_EVENT } from './utils/inspect-mode';
|
|
23
|
-
export { getProxyTierParam, getTransportParam, getConnectParam, getSessionParam, getSameOriginParam, getDebugParam, getDebugOverlayParam, getInspectParam, getLangParam, getAudioParam, getVideoParam, getWebRtcParam, getIceTransportPolicyParam, getRetryParam, getSnapshotParam, getSignedOutParam, setSdkUrlParam, IKON_PARAM_PROXY, IKON_PARAM_TRANSPORT, IKON_PARAM_CONNECT, IKON_PARAM_SESSION, IKON_PARAM_SAME_ORIGIN, IKON_PARAM_DEBUG, IKON_PARAM_DEBUG_OVERLAY, IKON_PARAM_INSPECT, IKON_PARAM_LANG, IKON_PARAM_AUDIO, IKON_PARAM_VIDEO, IKON_PARAM_WEBRTC, IKON_PARAM_ICE_TRANSPORT, IKON_PARAM_RETRY, IKON_PARAM_SNAPSHOT, IKON_PARAM_SIGNED_OUT, IKON_PARAM_OAUTH_TOKEN, IKON_PARAM_OAUTH_CODE, IKON_PARAM_OAUTH_PROVIDER, IKON_PARAM_OAUTH_PKCE, type TransportFamily, type PinnedTransport, } from './utils/query-params';
|
|
24
|
+
export { getProxyTierParam, getTransportParam, getConnectParam, getResumeHandoff, getSessionParam, getSameOriginParam, getDebugParam, getDebugOverlayParam, getInspectParam, getLangParam, getAudioParam, getVideoParam, getWebRtcParam, getIceTransportPolicyParam, getRetryParam, getSnapshotParam, getSignedOutParam, setSdkUrlParam, IKON_PARAM_PROXY, IKON_PARAM_TRANSPORT, IKON_PARAM_CONNECT, IKON_PARAM_SESSION, IKON_PARAM_SAME_ORIGIN, IKON_PARAM_DEBUG, IKON_PARAM_DEBUG_OVERLAY, IKON_PARAM_INSPECT, IKON_PARAM_LANG, IKON_PARAM_AUDIO, IKON_PARAM_VIDEO, IKON_PARAM_WEBRTC, IKON_PARAM_ICE_TRANSPORT, IKON_PARAM_RETRY, IKON_PARAM_SNAPSHOT, IKON_PARAM_SIGNED_OUT, IKON_PARAM_OAUTH_TOKEN, IKON_PARAM_OAUTH_CODE, IKON_PARAM_OAUTH_PROVIDER, IKON_PARAM_OAUTH_PKCE, type TransportFamily, type PinnedTransport, } from './utils/query-params';
|
|
24
25
|
export type { HttpStreamMode } from './transport/transport';
|
|
25
26
|
export { getOpcodeName } from './utils/opcode-names';
|
|
26
27
|
export { initializeLogSink, setSendLogsCallback, getBufferedLogs, takeBufferedLogs, flushLogs, clearLogBuffer, getLogBufferSize } from './utils/log-sink';
|
|
@@ -34,7 +35,7 @@ export { loginErrorInterceptor, reprovisionAfterLogin, consumeLoginHandoff, getL
|
|
|
34
35
|
export type { LoginPromptState, LoginPendingCall } from './login';
|
|
35
36
|
export { IKON_AUTH_BASE_URL, IKON_AUTH_URL_PROD, IKON_AUTH_URL_DEV, IKON_BACKEND_URL_PROD, IKON_BACKEND_URL_DEV, deriveAuthUrl, deriveCrossOriginAuthUrl, getSameOriginAuthUrl, deriveBackendUrl, deriveBackendType, parseUrlParams, isCloudEnvironment, getUrlWithoutSession, type UrlParams } from './connection/urls';
|
|
36
37
|
export { getOrCreateDeviceId, clearDeviceId, extractUserIdFromToken } from './storage';
|
|
37
|
-
export { IkonMedia, IkonAudioPlayback, IkonVideoPlayback, VisemeTracker, isSharedArrayBufferSupported, isAudioWorkletSupported, IkonMediaCapture, IkonVideoCapture, IkonAudioCapture, IkonImageCapture, isMobileBrowserLikely } from './media';
|
|
38
|
-
export type { IkonMediaConfig, IkonAudioPlaybackConfig, IkonVideoPlaybackConfig, IkonVideoCaptureHandle, IkonVideoCaptureRequest, IkonVideoCaptureOptions, VideoCaptureSource, IkonAudioCaptureHandle, IkonAudioCaptureRequest, IkonAudioCaptureOptions, IkonImageCaptureRequest, IkonImageCaptureResult, IkonNativeCameraCaptureRequest, IkonNativeCameraFacing } from './media';
|
|
38
|
+
export { IkonMedia, IkonAudioPlayback, IkonVideoPlayback, VisemeTracker, isSharedArrayBufferSupported, isAudioWorkletSupported, IkonMediaCapture, IkonVideoCapture, IkonAudioCapture, IkonImageCapture, isMobileBrowserLikely, queryMediaPermission, requestMediaPermission, watchMediaPermission } from './media';
|
|
39
|
+
export type { IkonMediaConfig, IkonAudioPlaybackConfig, IkonVideoPlaybackConfig, IkonVideoCaptureHandle, IkonVideoCaptureRequest, IkonVideoCaptureOptions, VideoCaptureSource, IkonAudioCaptureHandle, IkonAudioCaptureRequest, IkonAudioCaptureOptions, IkonImageCaptureRequest, IkonImageCaptureResult, IkonNativeCameraCaptureRequest, IkonNativeCameraFacing, MediaPermissionState, MediaPermissionKind } from './media';
|
|
39
40
|
export { WebRTCConnection, WebRTCSignaling, WEBRTC_AUDIO_CODEC, WEBRTC_AUDIO_SAMPLE_RATE, WEBRTC_AUDIO_CHANNELS, WEBRTC_AUDIO_BITRATE, WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS, WEBRTC_VIDEO_CODEC, WEBRTC_VIDEO_MAX_BITRATE, WEBRTC_VIDEO_MAX_FRAMERATE, WEBRTC_BUNDLE_POLICY, WEBRTC_RTCP_MUX_POLICY, WEBRTC_DATA_CHANNEL_LABEL, WEBRTC_DATA_CHANNEL_ORDERED, WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS, WEBRTC_MAX_AUDIO_TRACKS, WEBRTC_MAX_VIDEO_TRACKS } from './webrtc';
|
|
40
41
|
export type { WebRTCConnectionConfig, WebRTCConnectionState, WebRTCSignalingConfig } from './webrtc';
|