@urun-sh/openai 0.6.31 → 0.6.33
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/dist/chunk-7D2HMQFC.js +2 -0
- package/dist/chunk-CAR4AEQJ.js +1 -0
- package/dist/{chunk-76BZLCGT.js → chunk-GL7EWL3V.js} +1 -1
- package/dist/chunk-GR3UAW6P.js +60 -0
- package/dist/chunk-L6HTHDVV.js +1 -0
- package/dist/chunk-LM4E5YM2.js +19 -0
- package/dist/chunk-NL3UBLXV.js +6 -0
- package/dist/chunk-NN6TQQUG.js +1 -0
- package/dist/chunk-OOCRI7ZM.js +6 -0
- package/dist/chunk-PAYCMH5F.js +1 -0
- package/dist/chunk-PBKCUSTI.js +17 -0
- package/dist/{responses-turn-DXrwiPJh.d.cts → composite-CwfOOT0b.d.cts} +548 -309
- package/dist/{responses-turn-BGb_XPOa.d.ts → composite-D9VDruCV.d.ts} +127 -83
- package/dist/gemini-live.cjs +2 -2
- package/dist/gemini-live.d.cts +85 -105
- package/dist/gemini-live.d.ts +48 -48
- package/dist/gemini-live.js +1 -1
- package/dist/hosted/bin.cjs +56 -42
- package/dist/hosted/bin.js +4 -22
- package/dist/hosted/index.cjs +52 -38
- package/dist/hosted/index.d.cts +243 -19
- package/dist/hosted/index.d.ts +120 -4
- package/dist/hosted/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{models-DUdx_Y6X.d.cts → models-D7F0bLJ3.d.cts} +14 -0
- package/dist/{models-DUdx_Y6X.d.ts → models-D7F0bLJ3.d.ts} +6 -0
- package/dist/pi-extension/index.cjs +6 -6
- package/dist/pi-extension/index.js +1 -1
- package/dist/pi-extension/standalone.cjs +33 -33
- package/dist/pooler/bin.cjs +335 -0
- package/dist/pooler/bin.js +316 -0
- package/dist/proxy/cli.cjs +58 -53
- package/dist/proxy/cli.js +1 -1
- package/dist/proxy/conformance-probe.cjs +1 -0
- package/dist/proxy/conformance-probe.js +1 -0
- package/dist/proxy/index.cjs +31 -28
- package/dist/proxy/index.d.cts +315 -167
- package/dist/proxy/index.d.ts +85 -53
- package/dist/proxy/index.js +1 -1
- package/package.json +14 -4
- package/dist/chunk-4MI2TNQS.js +0 -62
- package/dist/chunk-7SAW4IL4.js +0 -2
- package/dist/chunk-7V2JKPIG.js +0 -1
- package/dist/chunk-CUDFHFNX.js +0 -4
- package/dist/chunk-HZC2SKKI.js +0 -8
- package/dist/chunk-K23AZPI4.js +0 -1
package/dist/proxy/index.d.ts
CHANGED
|
@@ -1,59 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as ProxyHandlerOptions,
|
|
3
|
-
export { D as DialObserver, a as DialReport, g as ProxyIdentity, h as ProxyVideoOutLane, S as SessionGoneError, U as UnknownModelError } from '../
|
|
1
|
+
import { IncomingMessage, Server } from 'node:http';
|
|
2
|
+
import { P as ProxyClients, f as ProxyHandlerOptions, R as RealtimeCompanionsFor } from '../composite-D9VDruCV.js';
|
|
3
|
+
export { D as DialObserver, a as DialReport, g as ProxyIdentity, h as ProxyVideoOutLane, S as SessionGoneError, U as UnknownModelError } from '../composite-D9VDruCV.js';
|
|
4
4
|
export { h as GEMINI_LIVE_PATH, V as VIDEO_OUT_SETUP_KEY } from '../translator-Ddd65sXR.js';
|
|
5
5
|
import { WebSocket } from 'ws';
|
|
6
|
-
import '../models-
|
|
6
|
+
import '../models-D7F0bLJ3.js';
|
|
7
7
|
import '../video-out-Cawtm7SF.js';
|
|
8
8
|
import '../types-CHPtJx6d.js';
|
|
9
9
|
|
|
10
|
-
interface OpenAIProxyOptions extends ProxyHandlerOptions {
|
|
11
|
-
clients: ProxyClients;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare function createOpenAIProxy(options: OpenAIProxyOptions): Server;
|
|
15
|
-
|
|
16
|
-
type GeminiLiveClients = Pick<ProxyClients, 'createResponse' | 'openAudio' | 'openVideo' | 'openVideoOut' | 'sessionHandle' | 'onSessionEnd'>;
|
|
17
|
-
interface LiveSnapshot {
|
|
18
|
-
model: string;
|
|
19
|
-
|
|
20
|
-
proxyHandle: string;
|
|
21
|
-
|
|
22
|
-
transcript: Array<Record<string, unknown>>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
declare class ResumptionRegistry {
|
|
26
|
-
private readonly snapshots;
|
|
27
|
-
store(scope: string, handle: string, snapshot: LiveSnapshot): void;
|
|
28
|
-
get(scope: string, handle: string): LiveSnapshot | undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface GeminiLiveCall {
|
|
32
|
-
clients: GeminiLiveClients;
|
|
33
|
-
|
|
34
|
-
scope: string;
|
|
35
|
-
|
|
36
|
-
onBindResumeHandle?: (handle: string) => void;
|
|
37
|
-
|
|
38
|
-
clientsForResume?: (resumeHandle: string) => Promise<GeminiLiveClients>;
|
|
39
|
-
|
|
40
|
-
release?: () => Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
type GeminiLiveAuthenticate = (credential: string, req: IncomingMessage) => Promise<GeminiLiveCall>;
|
|
44
|
-
interface GeminiLiveOptions {
|
|
45
|
-
|
|
46
|
-
clients?: GeminiLiveClients;
|
|
47
|
-
|
|
48
|
-
apiKey?: string;
|
|
49
|
-
|
|
50
|
-
authenticate?: GeminiLiveAuthenticate;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
declare function attachGeminiLive(server: Server, options: GeminiLiveOptions): () => Promise<void>;
|
|
54
|
-
|
|
55
|
-
declare function serveGeminiLiveSocket(ws: WebSocket, call: GeminiLiveCall, registry?: ResumptionRegistry): void;
|
|
56
|
-
|
|
57
10
|
declare const OPENAI_REALTIME_PATH = "/v1/realtime";
|
|
58
11
|
|
|
59
12
|
type OpenAIRealtimeResolver<S = unknown> = ((req: IncomingMessage, signal?: AbortSignal) => Promise<RealtimeBinding<S>>) | {
|
|
@@ -92,21 +45,78 @@ interface RealtimeBinding<S = unknown> {
|
|
|
92
45
|
startMs?: number;
|
|
93
46
|
}>;
|
|
94
47
|
|
|
48
|
+
composite?: true;
|
|
49
|
+
|
|
50
|
+
cancelActiveTurn?: () => void;
|
|
51
|
+
|
|
95
52
|
release?: () => Promise<void> | void;
|
|
96
53
|
}
|
|
97
54
|
interface OpenAIRealtimeOptions<S = unknown> {
|
|
98
55
|
resolver: OpenAIRealtimeResolver<S>;
|
|
99
56
|
|
|
100
57
|
log?: (line: string) => void;
|
|
58
|
+
|
|
59
|
+
operatorLog?: (line: string) => void;
|
|
101
60
|
}
|
|
102
61
|
|
|
103
62
|
declare function attachOpenAIRealtime<S = unknown>(server: Server, options: OpenAIRealtimeOptions<S>): () => Promise<void>;
|
|
104
63
|
|
|
64
|
+
interface OpenAIProxyOptions extends ProxyHandlerOptions {
|
|
65
|
+
clients: ProxyClients;
|
|
66
|
+
|
|
67
|
+
realtimeCompanions?: RealtimeCompanionsFor;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare function createOpenAIProxy(options: OpenAIProxyOptions): Server;
|
|
71
|
+
|
|
72
|
+
type GeminiLiveClients = Pick<ProxyClients, 'createResponse' | 'openAudio' | 'openVideo' | 'openVideoOut' | 'sessionHandle' | 'onSessionEnd'>;
|
|
73
|
+
interface LiveSnapshot {
|
|
74
|
+
model: string;
|
|
75
|
+
|
|
76
|
+
proxyHandle: string;
|
|
77
|
+
|
|
78
|
+
transcript: Array<Record<string, unknown>>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare class ResumptionRegistry {
|
|
82
|
+
private readonly snapshots;
|
|
83
|
+
store(scope: string, handle: string, snapshot: LiveSnapshot): void;
|
|
84
|
+
get(scope: string, handle: string): LiveSnapshot | undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface GeminiLiveCall {
|
|
88
|
+
clients: GeminiLiveClients;
|
|
89
|
+
|
|
90
|
+
scope: string;
|
|
91
|
+
|
|
92
|
+
onBindResumeHandle?: (handle: string) => void;
|
|
93
|
+
|
|
94
|
+
clientsForResume?: (resumeHandle: string) => Promise<GeminiLiveClients>;
|
|
95
|
+
|
|
96
|
+
release?: () => Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
type GeminiLiveAuthenticate = (credential: string, req: IncomingMessage) => Promise<GeminiLiveCall>;
|
|
100
|
+
interface GeminiLiveOptions {
|
|
101
|
+
|
|
102
|
+
clients?: GeminiLiveClients;
|
|
103
|
+
|
|
104
|
+
apiKey?: string;
|
|
105
|
+
|
|
106
|
+
authenticate?: GeminiLiveAuthenticate;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare function attachGeminiLive(server: Server, options: GeminiLiveOptions): () => Promise<void>;
|
|
110
|
+
|
|
111
|
+
declare function serveGeminiLiveSocket(ws: WebSocket, call: GeminiLiveCall, registry?: ResumptionRegistry): void;
|
|
112
|
+
|
|
105
113
|
declare class OpenAIRealtimeConnection<S = unknown> {
|
|
106
114
|
readonly id: string;
|
|
107
115
|
private readonly ws;
|
|
108
116
|
private readonly binding;
|
|
109
117
|
private readonly onClosed?;
|
|
118
|
+
|
|
119
|
+
private readonly operatorLog;
|
|
110
120
|
private config;
|
|
111
121
|
private readonly sessionId;
|
|
112
122
|
private readonly conversationId;
|
|
@@ -121,6 +131,8 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
121
131
|
|
|
122
132
|
private responseFlushed;
|
|
123
133
|
private cancelled;
|
|
134
|
+
|
|
135
|
+
private pendingTranscriptSettled;
|
|
124
136
|
private voiceClaimed;
|
|
125
137
|
private audioLaneOwner;
|
|
126
138
|
private audioUnsubscribe;
|
|
@@ -146,16 +158,26 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
146
158
|
onClosed?: (conn: OpenAIRealtimeConnection<S>, info: {
|
|
147
159
|
reason: string;
|
|
148
160
|
}) => void;
|
|
161
|
+
|
|
162
|
+
operatorLog?: (line: string) => void;
|
|
149
163
|
});
|
|
150
164
|
|
|
151
165
|
private startTurnLane;
|
|
152
166
|
|
|
153
167
|
private isTranscriptionSession;
|
|
154
168
|
|
|
169
|
+
private liveSttIn;
|
|
170
|
+
|
|
155
171
|
private transcriptionEventsOn;
|
|
156
172
|
|
|
157
173
|
private completePendingTranscription;
|
|
158
174
|
|
|
175
|
+
private failPendingTranscription;
|
|
176
|
+
|
|
177
|
+
private writeItemTranscript;
|
|
178
|
+
|
|
179
|
+
private emitItemDone;
|
|
180
|
+
|
|
159
181
|
private onTurnEvent;
|
|
160
182
|
|
|
161
183
|
private takeTurnTranscript;
|
|
@@ -171,11 +193,19 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
171
193
|
private upstreamStream;
|
|
172
194
|
private startResponse;
|
|
173
195
|
|
|
196
|
+
private compositeTurnAsk;
|
|
197
|
+
|
|
174
198
|
private onOutputAudioFrame;
|
|
175
199
|
|
|
176
200
|
private messageItemAdded;
|
|
177
201
|
|
|
178
202
|
private messageItemOpenForAudio;
|
|
203
|
+
|
|
204
|
+
private turnLastAnnouncedItemId;
|
|
205
|
+
|
|
206
|
+
private turnOutputIsAudio;
|
|
207
|
+
|
|
208
|
+
private emitAssistantItemAdded;
|
|
179
209
|
private beginMessageItem;
|
|
180
210
|
private beginAudioMessageItem;
|
|
181
211
|
|
|
@@ -195,6 +225,8 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
195
225
|
private pushItem;
|
|
196
226
|
private itemToProtocol;
|
|
197
227
|
private send;
|
|
228
|
+
|
|
229
|
+
private callerLine;
|
|
198
230
|
private fail;
|
|
199
231
|
|
|
200
232
|
private teardown;
|
|
@@ -202,9 +234,9 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
202
234
|
|
|
203
235
|
declare function realtimeModelOf(req: IncomingMessage): string | undefined;
|
|
204
236
|
|
|
205
|
-
declare function realtimeBindingFor(clients: Pick<ProxyClients, 'sessionHandle' | 'createResponseOn'> & Partial<Pick<ProxyClients, 'supportsAudio' | 'openAudioOn' | 'supportsTranscription' | 'openTurnsOn' | 'transcriptStreamFor'>>, model: string | undefined, signal?: AbortSignal, intent?: string): Promise<RealtimeBinding<ProxyClients>>;
|
|
237
|
+
declare function realtimeBindingFor(clients: Pick<ProxyClients, 'sessionHandle' | 'createResponseOn'> & Partial<Pick<ProxyClients, 'supportsAudio' | 'openAudioOn' | 'supportsTranscription' | 'openTurnsOn' | 'transcriptStreamFor' | 'realtimeCompanionsFor' | 'releaseSessionHandle'>>, model: string | undefined, signal?: AbortSignal, intent?: string): Promise<RealtimeBinding<ProxyClients>>;
|
|
206
238
|
|
|
207
|
-
declare function fixedClientsResolver(clients: ProxyClients, apiKey?: string): {
|
|
239
|
+
declare function fixedClientsResolver(clients: ProxyClients, apiKey?: string, realtimeCompanions?: RealtimeCompanionsFor): {
|
|
208
240
|
resolve(req: IncomingMessage, signal?: AbortSignal): Promise<RealtimeBinding<ProxyClients>>;
|
|
209
241
|
};
|
|
210
242
|
|
package/dist/proxy/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{E as I,a as n,b as p,c as m,l,m as a,n as x,p as s,r as O,s as f}from"../chunk-GR3UAW6P.js";import{a as o,h as t}from"../chunk-3JWYIKHM.js";import"../chunk-6M5JK4YC.js";import"../chunk-NL3UBLXV.js";import{h as r,i}from"../chunk-OOCRI7ZM.js";import{c as e}from"../chunk-YSFSRI3D.js";e();export{o as GEMINI_LIVE_PATH,a as OPENAI_REALTIME_PATH,l as OpenAIRealtimeConnection,n as ResumptionRegistry,i as SessionGoneError,r as UnknownModelError,t as VIDEO_OUT_SETUP_KEY,p as attachGeminiLive,x as attachOpenAIRealtime,I as createOpenAIProxy,f as fixedClientsResolver,O as realtimeBindingFor,s as realtimeModelOf,m as serveGeminiLiveSocket};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urun-sh/openai",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.33",
|
|
4
4
|
"description": "OpenAI-compatible Realtime + Responses SDK over uRun session primitives (not websockets).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -74,8 +74,14 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@prometheus-io/client": "^0.16.1",
|
|
77
|
+
"bullmq": "5.81.3",
|
|
78
|
+
"ioredis": "5.11.1",
|
|
79
|
+
"lib0": "^0.2.102",
|
|
80
|
+
"lodash.debounce": "^4.0.8",
|
|
77
81
|
"openai": "4.104.0",
|
|
78
|
-
"ws": "^8.18.0"
|
|
82
|
+
"ws": "^8.18.0",
|
|
83
|
+
"y-protocols": "^1.0.6",
|
|
84
|
+
"yjs": "^13.6.31"
|
|
79
85
|
},
|
|
80
86
|
"optionalDependencies": {
|
|
81
87
|
"@roamhq/wrtc": "^0.8.0",
|
|
@@ -90,18 +96,22 @@
|
|
|
90
96
|
"ajv": "^8.17.1",
|
|
91
97
|
"ajv-formats": "^3.0.1",
|
|
92
98
|
"esbuild": "^0.28.1",
|
|
99
|
+
"fengari": "^0.1.5",
|
|
93
100
|
"happy-dom": "^20.9.0",
|
|
94
101
|
"opusscript": "^0.1.1",
|
|
95
102
|
"reflect-metadata": "^0.2.2",
|
|
96
103
|
"tsup": "^8.5.0",
|
|
97
104
|
"typescript": "^5.3.0",
|
|
98
105
|
"vitest": "^4.1.11",
|
|
99
|
-
"werift": "^0.23.0"
|
|
106
|
+
"werift": "^0.23.0",
|
|
107
|
+
"y-websocket": "3.0.0"
|
|
100
108
|
},
|
|
101
109
|
"publishConfig": {
|
|
102
110
|
"access": "public"
|
|
103
111
|
},
|
|
104
112
|
"bin": {
|
|
105
|
-
"urun-
|
|
113
|
+
"urun-pooler": "./dist/pooler/bin.js",
|
|
114
|
+
"urun-openai": "./dist/proxy/cli.cjs",
|
|
115
|
+
"urun-inference-probe": "./dist/proxy/conformance-probe.cjs"
|
|
106
116
|
}
|
|
107
117
|
}
|