@ikonai/sdk 1.0.43 → 1.0.45
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/assets/{audio-capture-worker-Dmgg-yWd.js → audio-capture-worker-BnmgtUMV.js} +1 -1
- package/assets/{audio-playback-worker-MsPNs6k4.js → audio-playback-worker-os3j8TEw.js} +102 -102
- package/assets/{index-Cns_7uAI.js → index-Ca9sTcGt.js} +1 -1
- package/assets/{index-D2GAzJKe.js → index-D_vz6N3U.js} +165 -29
- package/assets/{libopus-BEPFPIM_.js → libopus-ChbDZJKA.js} +3 -3
- package/assets/{protocol-worker-4bSKGT40.js → protocol-worker-CMTcdGdm.js} +307 -262
- package/assets/{video-capture-worker-Bitll1TI.js → video-capture-worker-CUqzL0P7.js} +181 -181
- package/assets/{video-playback-worker-BQSKswID.js → video-playback-worker-BoE6foO2.js} +188 -188
- package/channel/channel-manager.d.ts +15 -0
- package/client/endpoint-selector.d.ts +7 -0
- package/client/ikon-client-config.d.ts +4 -2
- package/client/ikon-client.d.ts +6 -3
- package/connection/urls.d.ts +5 -3
- package/functions/function-registry.d.ts +16 -1
- package/functions/index.d.ts +1 -1
- package/functions/types.d.ts +2 -1
- package/index.d.ts +5 -3
- package/index.js +2377 -2009
- package/login/index.d.ts +4 -0
- package/login/login-error-interceptor.d.ts +13 -0
- package/login/login-store.d.ts +17 -0
- package/login/reprovision.d.ts +22 -0
- package/media/ikon-image-capture.d.ts +5 -0
- package/media/ikon-video-capture.d.ts +4 -0
- package/package.json +1 -1
- package/utils/query-params.d.ts +6 -0
- package/webrtc/index.d.ts +1 -1
- package/webrtc/webrtc-config.d.ts +0 -1
- package/webrtc/webrtc-connection.d.ts +1 -0
- package/webrtc/webrtc-signaling.d.ts +5 -0
|
@@ -33,6 +33,12 @@ export interface ChannelManagerConfig {
|
|
|
33
33
|
* Useful for worker environments where localStorage might be unavailable.
|
|
34
34
|
*/
|
|
35
35
|
orderedEndpointTypes?: EntrypointType[];
|
|
36
|
+
/**
|
|
37
|
+
* True when the user has explicitly constrained the allowed transports via
|
|
38
|
+
* `proxy`, `websocket`, or `webtransport` settings. When set, unstable types
|
|
39
|
+
* are not demoted on reconnect — the user's transport choice is respected.
|
|
40
|
+
*/
|
|
41
|
+
hasTransportConstraint?: boolean;
|
|
36
42
|
/**
|
|
37
43
|
* Called when a working endpoint type is discovered.
|
|
38
44
|
* Typically used by the host to persist endpoint preference.
|
|
@@ -55,6 +61,15 @@ export interface ChannelManagerConfig {
|
|
|
55
61
|
* WebRTC-type entrypoints are filtered out (they are signal-only, not real channels).
|
|
56
62
|
*/
|
|
57
63
|
webRtcEnabled?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Called during transport fallback when a partial connection occurred.
|
|
66
|
+
* Returns fresh entrypoints from a new /connect call so the next transport
|
|
67
|
+
* type uses a clean server session with no stale channel state.
|
|
68
|
+
*/
|
|
69
|
+
onRefreshEntrypoints?: () => Promise<{
|
|
70
|
+
entrypoints: Entrypoint[];
|
|
71
|
+
sessionId: number;
|
|
72
|
+
}>;
|
|
58
73
|
}
|
|
59
74
|
/**
|
|
60
75
|
* ChannelManager orchestrates multiple channels to an Ikon server.
|
|
@@ -29,6 +29,13 @@ export declare class EndpointSelector {
|
|
|
29
29
|
});
|
|
30
30
|
get proxyMode(): ProxyMode;
|
|
31
31
|
get proxyPreferred(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* True when the user has explicitly narrowed the set of allowed transports
|
|
34
|
+
* via `proxy`, `websocket`, or `webtransport` settings. In that case the SDK
|
|
35
|
+
* should respect the user's choice rather than silently reordering types
|
|
36
|
+
* (e.g. demoting an "unstable" type on transient failure).
|
|
37
|
+
*/
|
|
38
|
+
get hasTransportConstraint(): boolean;
|
|
32
39
|
/**
|
|
33
40
|
* Mark proxy as preferred and persist to localStorage.
|
|
34
41
|
* Called by IkonClient when auth-level proxy fallback succeeds in auto mode.
|
|
@@ -177,7 +177,7 @@ export interface TimeoutConfig {
|
|
|
177
177
|
slowConnectionThresholdMs?: number;
|
|
178
178
|
/**
|
|
179
179
|
* Duration in milliseconds before giving up and showing offline.
|
|
180
|
-
* Default:
|
|
180
|
+
* Default: 180000 (3 minutes)
|
|
181
181
|
*/
|
|
182
182
|
connectionTimeoutMs?: number;
|
|
183
183
|
/**
|
|
@@ -252,6 +252,8 @@ export interface VideoConfig {
|
|
|
252
252
|
export interface WebRtcConfig {
|
|
253
253
|
/** Enable WebRTC for audio and video. Default: true */
|
|
254
254
|
enabled?: boolean;
|
|
255
|
+
/** ICE servers (TURN/STUN) for WebRTC. Server-provided ICE servers take precedence. */
|
|
256
|
+
iceServers?: RTCIceServer[];
|
|
255
257
|
}
|
|
256
258
|
/**
|
|
257
259
|
* Configuration for IkonClient.
|
|
@@ -349,7 +351,7 @@ export interface IkonClientConfig {
|
|
|
349
351
|
proxy?: boolean;
|
|
350
352
|
}
|
|
351
353
|
export declare const DEFAULT_SLOW_CONNECTION_THRESHOLD_MS = 5000;
|
|
352
|
-
export declare const DEFAULT_CONNECTION_TIMEOUT_MS =
|
|
354
|
+
export declare const DEFAULT_CONNECTION_TIMEOUT_MS = 180000;
|
|
353
355
|
export declare const DEFAULT_KEEPALIVE_TIMEOUT_MS = 15000;
|
|
354
356
|
export declare const DEFAULT_RECONNECT_BACKOFF_MS = 2000;
|
|
355
357
|
export declare const DEFAULT_MAX_RECONNECT_ATTEMPTS = 2;
|
package/client/ikon-client.d.ts
CHANGED
|
@@ -90,8 +90,10 @@ export type StateHandler = (state: ConnectionState) => void;
|
|
|
90
90
|
export declare class IkonClient {
|
|
91
91
|
private channelManager;
|
|
92
92
|
private protocolWorker;
|
|
93
|
+
private preloadedWorker;
|
|
93
94
|
private workerManagerState;
|
|
94
95
|
private authResponse;
|
|
96
|
+
private _connectUrl;
|
|
95
97
|
private currentState;
|
|
96
98
|
private slowConnectionTimer;
|
|
97
99
|
private connectionTimer;
|
|
@@ -119,6 +121,7 @@ export declare class IkonClient {
|
|
|
119
121
|
private unregisterBrowserFunctions;
|
|
120
122
|
private unregisterMediaCaptureFunctions;
|
|
121
123
|
private unregisterSoundFunctions;
|
|
124
|
+
private unregisterLoginInterceptor;
|
|
122
125
|
private nextProtocolPortId;
|
|
123
126
|
private nextProtocolSendPortId;
|
|
124
127
|
private readonly _audioEnabled;
|
|
@@ -130,6 +133,7 @@ export declare class IkonClient {
|
|
|
130
133
|
private _webRtcAudioStreams;
|
|
131
134
|
private _webRtcVideoStreams;
|
|
132
135
|
private _webRtcTrackMap;
|
|
136
|
+
private _pendingActiveAudioTracks;
|
|
133
137
|
private _keepaliveLockAbort;
|
|
134
138
|
private _fullReauthAttempted;
|
|
135
139
|
private _softReconnectAttempted;
|
|
@@ -310,10 +314,9 @@ export declare class IkonClient {
|
|
|
310
314
|
private setupWebRtcSignaling;
|
|
311
315
|
private _webRtcAudioUnlockHandler;
|
|
312
316
|
private readonly _webRtcMediaSession;
|
|
313
|
-
private
|
|
314
|
-
private
|
|
317
|
+
private createWebRtcAudioElement;
|
|
318
|
+
private destroyWebRtcAudioElement;
|
|
315
319
|
private ensureWebRtcAudioUnlockHandler;
|
|
316
|
-
private stopWebRtcAudioTrack;
|
|
317
320
|
private setupWebRtcMediaSession;
|
|
318
321
|
private removeWebRtcAudioUnlockHandler;
|
|
319
322
|
private connectProtocolOnMainThread;
|
package/connection/urls.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare const IKON_AUTH_URL_DEV = "https://auth.dev.ikonai.com";
|
|
|
15
15
|
export declare const IKON_AUTH_BASE_URL = "https://auth.ikonai.com";
|
|
16
16
|
/**
|
|
17
17
|
* Get backend URL from BackendType.
|
|
18
|
+
* Honors ?ikon-api=true by routing through the same-origin /ikon/api path.
|
|
18
19
|
*/
|
|
19
20
|
export declare function getBackendUrl(backendType?: BackendType): string;
|
|
20
21
|
/**
|
|
@@ -22,9 +23,10 @@ export declare function getBackendUrl(backendType?: BackendType): string;
|
|
|
22
23
|
* Priority:
|
|
23
24
|
* 1. Explicit override (e.g. from config)
|
|
24
25
|
* 2. VITE_IKON_BACKEND_URL env var (set by .NET server during local dev)
|
|
25
|
-
* 3.
|
|
26
|
-
* 4.
|
|
27
|
-
* 5.
|
|
26
|
+
* 3. ikon-api=true query param → same-origin /ikon/api
|
|
27
|
+
* 4. Local environment (localhost, LAN IPs) → IKON_BACKEND_URL_DEV
|
|
28
|
+
* 5. Hostname contains '.dev.' → IKON_BACKEND_URL_DEV
|
|
29
|
+
* 6. Default → IKON_BACKEND_URL_PROD
|
|
28
30
|
*/
|
|
29
31
|
export declare function deriveBackendUrl(override?: string): string;
|
|
30
32
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProtocolMessage, ActionFunctionRegister, GlobalState } from '../../../../shared/protocol/src/index.ts';
|
|
2
|
-
import { FunctionDefinition, FunctionHandler, NormalizedFunction } from './types';
|
|
2
|
+
import { FunctionCallError, FunctionDefinition, FunctionHandler, NormalizedFunction } from './types';
|
|
3
3
|
export interface RemoteFunction {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
@@ -11,6 +11,15 @@ export interface RemoteFunction {
|
|
|
11
11
|
llmCallOnlyOnce: boolean;
|
|
12
12
|
requiresInstance: boolean;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* An error interceptor can observe and optionally handle function call errors.
|
|
16
|
+
* Return a Promise to take over resolution of the original call (e.g. retry after login).
|
|
17
|
+
* Return null to let the error propagate normally.
|
|
18
|
+
*/
|
|
19
|
+
export type ErrorInterceptor = (error: FunctionCallError, callInfo: {
|
|
20
|
+
functionName: string;
|
|
21
|
+
args: unknown[];
|
|
22
|
+
}) => Promise<unknown> | null;
|
|
14
23
|
export interface FunctionRegistryConfig {
|
|
15
24
|
sendProtocolMessage: (message: ProtocolMessage) => void;
|
|
16
25
|
sessionId: number;
|
|
@@ -19,6 +28,7 @@ export declare class FunctionRegistry {
|
|
|
19
28
|
private readonly functions;
|
|
20
29
|
private readonly remoteFunctions;
|
|
21
30
|
private readonly pendingCalls;
|
|
31
|
+
private readonly errorInterceptors;
|
|
22
32
|
private config;
|
|
23
33
|
private isConnected;
|
|
24
34
|
/**
|
|
@@ -30,6 +40,11 @@ export declare class FunctionRegistry {
|
|
|
30
40
|
* Detach from the client (on disconnect).
|
|
31
41
|
*/
|
|
32
42
|
detach(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Add an error interceptor that can handle or transform function call errors.
|
|
45
|
+
* Returns an unregister function.
|
|
46
|
+
*/
|
|
47
|
+
addErrorInterceptor(interceptor: ErrorInterceptor): () => void;
|
|
33
48
|
/**
|
|
34
49
|
* Register a function with the registry.
|
|
35
50
|
* If already connected, sends registration to server immediately.
|
package/functions/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ValueDescriptor, NormalizedValueDescriptor, PrimitiveValueKind, FunctionParameterDefinition, FunctionDefinition, FunctionHandler, FunctionResultWithData } from './types';
|
|
2
2
|
export { withResultData, FunctionCallError } from './types';
|
|
3
|
-
export { FunctionRegistry, type FunctionRegistryConfig } from './function-registry';
|
|
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';
|
package/functions/types.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ export interface NormalizedFunction {
|
|
|
67
67
|
export declare class FunctionCallError extends Error {
|
|
68
68
|
readonly remoteErrorType: string;
|
|
69
69
|
readonly remoteStackTrace: string;
|
|
70
|
-
|
|
70
|
+
readonly code: string;
|
|
71
|
+
constructor(message: string, remoteErrorType: string, remoteStackTrace: string, code?: string);
|
|
71
72
|
}
|
|
72
73
|
export {};
|
package/index.d.ts
CHANGED
|
@@ -14,17 +14,19 @@ export { setLogLevel, setLogSink, getLogLevel, getLogSink, createLogger, LogLeve
|
|
|
14
14
|
export type { LogEntry, LogSink, Logger, LogEventListener, LogEventSubscriptionOptions } from './utils/logger';
|
|
15
15
|
export { initializeDebugMode, isDebugModeEnabled } from './utils/debug-mode';
|
|
16
16
|
export { initializeInspectMode, isInspectModeEnabled, enableInspectMode } from './utils/inspect-mode';
|
|
17
|
-
export { getLangParam, getProxyParam, getWebSocketParam, getWebTransportParam, getDebugParam, getServerUrlParam, getAudioParam, getVideoParam, getWebRtcParam, getInspectParam, setSdkUrlParam, IKON_PARAM_PROXY, IKON_PARAM_WEBSOCKET, IKON_PARAM_WEBTRANSPORT, IKON_PARAM_DEBUG, IKON_PARAM_LANG, IKON_PARAM_SERVER_URL, IKON_PARAM_GIT_SOURCE, IKON_PARAM_GIT_BRANCH, IKON_PARAM_AUDIO, IKON_PARAM_VIDEO, IKON_PARAM_WEBRTC, IKON_PARAM_INSPECT } from './utils/query-params';
|
|
17
|
+
export { getLangParam, getProxyParam, getWebSocketParam, getWebTransportParam, getDebugParam, getServerUrlParam, getAudioParam, getVideoParam, getWebRtcParam, getInspectParam, getRetryParam, setSdkUrlParam, IKON_PARAM_PROXY, IKON_PARAM_WEBSOCKET, IKON_PARAM_WEBTRANSPORT, IKON_PARAM_DEBUG, IKON_PARAM_LANG, IKON_PARAM_SERVER_URL, IKON_PARAM_GIT_SOURCE, IKON_PARAM_GIT_BRANCH, IKON_PARAM_AUDIO, IKON_PARAM_VIDEO, IKON_PARAM_WEBRTC, IKON_PARAM_INSPECT, IKON_PARAM_RETRY } from './utils/query-params';
|
|
18
18
|
export { getOpcodeName } from './utils/opcode-names';
|
|
19
19
|
export { initializeLogSink, setSendLogsCallback, getBufferedLogs, takeBufferedLogs, flushLogs, clearLogBuffer, getLogBufferSize } from './utils/log-sink';
|
|
20
20
|
export type { LogSinkConfig } from './utils/log-sink';
|
|
21
21
|
export { startLogSender, stopLogSender } from './utils/log-sender';
|
|
22
|
-
export { FunctionRegistry, registerBrowserFunctions, isBrowserEnvironment, FunctionCallError, type FunctionRegistryConfig } from './functions';
|
|
22
|
+
export { FunctionRegistry, registerBrowserFunctions, isBrowserEnvironment, FunctionCallError, type FunctionRegistryConfig, type ErrorInterceptor } from './functions';
|
|
23
23
|
export { withResultData } from './functions';
|
|
24
24
|
export type { ValueDescriptor, NormalizedValueDescriptor, PrimitiveValueKind, FunctionParameterDefinition, FunctionDefinition, FunctionHandler, FunctionResultWithData } from './functions';
|
|
25
|
+
export { loginErrorInterceptor, reprovisionAfterLogin, consumeLoginHandoff, getLoginPromptState, clearLoginPrompt, subscribe as subscribeLoginPrompt, consumeLoginPendingCall } from './login';
|
|
26
|
+
export type { LoginPromptState, LoginPendingCall } from './login';
|
|
25
27
|
export { IKON_AUTH_BASE_URL, IKON_AUTH_URL_PROD, IKON_AUTH_URL_DEV, IKON_BACKEND_URL_PROD, IKON_BACKEND_URL_DEV, deriveAuthUrl, deriveBackendUrl, deriveBackendType, parseUrlParams, clearSessionParamsFromUrl, isCloudEnvironment, type UrlParams } from './connection/urls';
|
|
26
28
|
export { getOrCreateDeviceId, clearDeviceId, extractUserIdFromToken } from './storage';
|
|
27
29
|
export { IkonMedia, IkonAudioPlayback, IkonVideoPlayback, isSharedArrayBufferSupported, isAudioWorkletSupported, IkonMediaCapture, IkonVideoCapture, IkonAudioCapture, IkonImageCapture } from './media';
|
|
28
30
|
export type { IkonMediaConfig, IkonAudioPlaybackConfig, IkonVideoPlaybackConfig, IkonVideoCaptureHandle, IkonVideoCaptureRequest, IkonVideoCaptureOptions, VideoCaptureSource, IkonAudioCaptureHandle, IkonAudioCaptureRequest, IkonAudioCaptureOptions, IkonImageCaptureRequest, IkonImageCaptureResult } from './media';
|
|
29
|
-
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,
|
|
31
|
+
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';
|
|
30
32
|
export type { WebRTCConnectionConfig, WebRTCConnectionState, WebRTCSignalingConfig } from './webrtc';
|