@charivo/realtime 0.7.0 → 0.7.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.
- package/README.md +7 -0
- package/dist/{chunk-RRXU3IC5.mjs → chunk-E656Y2PO.mjs} +5 -44
- package/dist/chunk-E656Y2PO.mjs.map +1 -0
- package/dist/{chunk-LOHYIBEP.mjs → chunk-FRTYFCPV.mjs} +4 -3
- package/dist/chunk-FRTYFCPV.mjs.map +1 -0
- package/dist/{chunk-M7TPQNHF.mjs → chunk-GJ2NA3ZT.mjs} +4 -3
- package/dist/chunk-GJ2NA3ZT.mjs.map +1 -0
- package/dist/chunk-X6YRHDTW.mjs +93 -0
- package/dist/chunk-X6YRHDTW.mjs.map +1 -0
- package/dist/index.d.mts +11 -21
- package/dist/index.d.ts +11 -21
- package/dist/index.js +452 -276
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +450 -275
- package/dist/index.mjs.map +1 -1
- package/dist/openai/index.mjs +3 -3
- package/dist/openai-agents/index.js +2 -3
- package/dist/openai-agents/index.js.map +1 -1
- package/dist/openai-agents/index.mjs +3 -3
- package/dist/remote/index.js +2 -3
- package/dist/remote/index.js.map +1 -1
- package/dist/remote/index.mjs +4 -4
- package/package.json +1 -1
- package/dist/chunk-LBKX5PJ6.mjs +0 -54
- package/dist/chunk-LBKX5PJ6.mjs.map +0 -1
- package/dist/chunk-LOHYIBEP.mjs.map +0 -1
- package/dist/chunk-M7TPQNHF.mjs.map +0 -1
- package/dist/chunk-RRXU3IC5.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { R as RealtimeTransportClient } from './types-BRya38bF.js';
|
|
2
2
|
export { b as RealtimeClient, a as RealtimeTransportEvent } from './types-BRya38bF.js';
|
|
3
|
-
import { RealtimeSessionConfig, RealtimeToolRegistration,
|
|
3
|
+
import { EventMap, RealtimeSessionConfig, RealtimeToolRegistration, RealtimeManager, CharivoEventEmitter, Character, RealtimeTool, RealtimeState } from '@charivo/core';
|
|
4
4
|
export { Character, CharivoEventEmitter, RealtimeConnectionState, RealtimeManager, RealtimeProvider, RealtimeReconnectCause, RealtimeResponseStatus, RealtimeSessionBootstrap, RealtimeSessionConfig, RealtimeSessionRequest, RealtimeSessionStatus, RealtimeSessionTransitionReason, RealtimeState, RealtimeTool, RealtimeToolChoice, RealtimeToolContext, RealtimeToolHandler, RealtimeToolRegistration, RealtimeTransportKind, RealtimeUsageEvent } from '@charivo/core';
|
|
5
5
|
|
|
6
|
+
interface RealtimeToolResultProjectorContext {
|
|
7
|
+
name: string;
|
|
8
|
+
output: Record<string, unknown>;
|
|
9
|
+
callId?: string;
|
|
10
|
+
emit<K extends keyof EventMap>(event: K, payload: EventMap[K]): void;
|
|
11
|
+
}
|
|
12
|
+
type RealtimeToolResultProjector = (context: RealtimeToolResultProjectorContext) => void;
|
|
13
|
+
|
|
6
14
|
interface RealtimeManagerOptions {
|
|
7
15
|
defaultSessionConfig?: Omit<RealtimeSessionConfig, "tools">;
|
|
8
16
|
tools?: RealtimeToolRegistration[];
|
|
@@ -16,13 +24,6 @@ interface RealtimeLogger {
|
|
|
16
24
|
warn?(message: string, context?: Record<string, unknown>): void;
|
|
17
25
|
error?(message: string, context?: Record<string, unknown>): void;
|
|
18
26
|
}
|
|
19
|
-
interface RealtimeToolResultProjectorContext {
|
|
20
|
-
name: string;
|
|
21
|
-
output: Record<string, unknown>;
|
|
22
|
-
callId?: string;
|
|
23
|
-
emit<K extends keyof EventMap>(event: K, payload: EventMap[K]): void;
|
|
24
|
-
}
|
|
25
|
-
type RealtimeToolResultProjector = (context: RealtimeToolResultProjectorContext) => void;
|
|
26
27
|
/**
|
|
27
28
|
* Provider-agnostic realtime manager.
|
|
28
29
|
*
|
|
@@ -38,17 +39,16 @@ declare class RealtimeManagerImpl implements RealtimeManager {
|
|
|
38
39
|
private isStoppingSession;
|
|
39
40
|
private isRefreshingSession;
|
|
40
41
|
private isRecoveringConnection;
|
|
41
|
-
private isAudioPlaybackActive;
|
|
42
42
|
private sessionBaseConfig?;
|
|
43
43
|
private refreshInFlight;
|
|
44
44
|
private reconnectInFlight;
|
|
45
45
|
private hasQueuedRefresh;
|
|
46
46
|
private stopRequestedDuringRefresh;
|
|
47
47
|
private reconnectToken;
|
|
48
|
-
private wakeLockSentinel;
|
|
49
|
-
private teardownBrowserLifecycle?;
|
|
50
48
|
private sessionId?;
|
|
51
49
|
private readonly toolRegistry;
|
|
50
|
+
private readonly audioOutput;
|
|
51
|
+
private readonly browserLifecycle;
|
|
52
52
|
private state;
|
|
53
53
|
constructor(client: RealtimeTransportClient, options?: RealtimeManagerOptions);
|
|
54
54
|
setEventEmitter(eventEmitter: CharivoEventEmitter): void;
|
|
@@ -64,11 +64,6 @@ declare class RealtimeManagerImpl implements RealtimeManager {
|
|
|
64
64
|
sendAudioChunk(audio: ArrayBuffer): Promise<void>;
|
|
65
65
|
interrupt(): Promise<void>;
|
|
66
66
|
private handleClientEvent;
|
|
67
|
-
private executeToolCall;
|
|
68
|
-
private runToolHandler;
|
|
69
|
-
private handleToolExecutionFailure;
|
|
70
|
-
private projectToolResult;
|
|
71
|
-
private emitToolError;
|
|
72
67
|
private ensureResponseStarted;
|
|
73
68
|
private beginReconnect;
|
|
74
69
|
private runReconnectLoop;
|
|
@@ -76,11 +71,6 @@ declare class RealtimeManagerImpl implements RealtimeManager {
|
|
|
76
71
|
private isReconnectTokenActive;
|
|
77
72
|
private emitState;
|
|
78
73
|
private applyError;
|
|
79
|
-
private emitAudioStart;
|
|
80
|
-
private emitAudioEnd;
|
|
81
|
-
private installBrowserLifecycleListeners;
|
|
82
|
-
private requestWakeLock;
|
|
83
|
-
private releaseWakeLock;
|
|
84
74
|
private resolveNextSessionBaseConfig;
|
|
85
75
|
private buildEffectiveSessionConfig;
|
|
86
76
|
private commitActiveSession;
|