@genex-ai/embed-sdk 0.37.0 → 0.38.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/README.md +118 -2
- package/dist/{chunk-5VDV25LF.js → chunk-M2KOZMPE.js} +764 -47
- package/dist/{chunk-WQJM5MJL.js → chunk-YQY2WLAJ.js} +111 -0
- package/dist/development.d.ts +1 -1
- package/dist/development.js +1 -1
- package/dist/index.d.ts +220 -3
- package/dist/index.js +12 -2
- package/dist/{runtime-generation-D4RMgsvn.d.ts → runtime-generation-DhyQ9taA.d.ts} +246 -2
- package/dist/sentry.js +2 -2
- package/package.json +1 -1
|
@@ -1,3 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VOICE on the player-funded lane: a game hears its player and speaks back.
|
|
3
|
+
*
|
|
4
|
+
* Two calls under a standing budget whose approved terms carry `voice`, each
|
|
5
|
+
* billed as used on the budget's meter like every other call it admits:
|
|
6
|
+
*
|
|
7
|
+
* transcription `POST /api/runtime/grants/:id/transcriptions`
|
|
8
|
+
* body: one WAV file (PCM 16-bit), at most
|
|
9
|
+
* `limits.maxSeconds` long; answers the words as JSON.
|
|
10
|
+
* speech `POST /api/runtime/grants/:id/speech`
|
|
11
|
+
* body: JSON text + a voice of the catalog; answers
|
|
12
|
+
* `text/event-stream` — one `start`, raw PCM in `audio`
|
|
13
|
+
* events as it is made, one `done`.
|
|
14
|
+
*
|
|
15
|
+
* Served only where `GET /api/runtime/models` says `features.voice: true`;
|
|
16
|
+
* `GET /api/runtime/voice` is the catalog (models, voices, limits, prices).
|
|
17
|
+
* Genex stores no audio: a recording is forwarded to the speech provider and
|
|
18
|
+
* dropped, and spoken audio is streamed and never kept.
|
|
19
|
+
*
|
|
20
|
+
* This file is dependency-free and runs in a browser, in Node and in the
|
|
21
|
+
* practice helper: types, limits, the WAV helpers both ends share, and the
|
|
22
|
+
* stream's event parser.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** How good, and how dear, a spoken voice is. A game names a tier, never a vendor. */
|
|
26
|
+
declare const VoiceTier: {
|
|
27
|
+
readonly Premium: "premium";
|
|
28
|
+
readonly Standard: "standard";
|
|
29
|
+
readonly Economy: "economy";
|
|
30
|
+
};
|
|
31
|
+
type VoiceTier = (typeof VoiceTier)[keyof typeof VoiceTier];
|
|
32
|
+
/** The two kinds of voice call, as a call's `kind` and a row's `outputFormat`. */
|
|
33
|
+
declare const VoiceCallKind: {
|
|
34
|
+
readonly Transcription: "transcription";
|
|
35
|
+
readonly Speech: "speech";
|
|
36
|
+
};
|
|
37
|
+
type VoiceCallKind = (typeof VoiceCallKind)[keyof typeof VoiceCallKind];
|
|
38
|
+
/** Spoken audio as every tier streams it: 16-bit signed little-endian PCM, one channel. */
|
|
39
|
+
declare const VOICE_SPEECH_ENCODING = "pcm_s16le";
|
|
40
|
+
interface RuntimeSpeechModel {
|
|
41
|
+
id: string;
|
|
42
|
+
label: string;
|
|
43
|
+
tier: VoiceTier;
|
|
44
|
+
/** Who makes the audio (`ElevenLabs`, `Google`): named on the approval sheet. */
|
|
45
|
+
provider: string;
|
|
46
|
+
/** What a typical line costs before the fee, per million characters. A
|
|
47
|
+
* figure for estimates: a call is billed its real cost. */
|
|
48
|
+
estimatedUsdPerMillionCharacters: number;
|
|
49
|
+
/** Reads a `style` direction (`a tired whisper`). */
|
|
50
|
+
styles: boolean;
|
|
51
|
+
}
|
|
52
|
+
interface RuntimeTranscriptionModel {
|
|
53
|
+
id: string;
|
|
54
|
+
label: string;
|
|
55
|
+
provider: string;
|
|
56
|
+
usdPerMinute: number;
|
|
57
|
+
}
|
|
58
|
+
interface RuntimeVoice {
|
|
59
|
+
/** What a game sends as `voice`. */
|
|
60
|
+
id: string;
|
|
61
|
+
label: string;
|
|
62
|
+
/** One line a designer can cast from: age, manner, the roles it suits. */
|
|
63
|
+
description: string;
|
|
64
|
+
gender: 'female' | 'male' | 'neutral';
|
|
65
|
+
/** The tiers that can speak it. */
|
|
66
|
+
tiers: VoiceTier[];
|
|
67
|
+
}
|
|
68
|
+
interface RuntimeVoiceLimits {
|
|
69
|
+
speech: {
|
|
70
|
+
/** Characters of `text` in one call. */
|
|
71
|
+
maxCharacters: number;
|
|
72
|
+
maxStyleCharacters: number;
|
|
73
|
+
encoding: typeof VOICE_SPEECH_ENCODING;
|
|
74
|
+
sampleRate: number;
|
|
75
|
+
channels: number;
|
|
76
|
+
};
|
|
77
|
+
transcription: {
|
|
78
|
+
maxSeconds: number;
|
|
79
|
+
minSeconds: number;
|
|
80
|
+
maxBytes: number;
|
|
81
|
+
contentTypes: string[];
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** What `GET /api/runtime/voice` serves. A stand without voice answers 404. */
|
|
85
|
+
interface RuntimeVoiceCatalog {
|
|
86
|
+
enabled: true;
|
|
87
|
+
currency: RuntimeCurrency;
|
|
88
|
+
/** The fee a call is billed at over its real cost, in basis points. */
|
|
89
|
+
feeBps: number;
|
|
90
|
+
usdCentsPerCredit: number;
|
|
91
|
+
speech: {
|
|
92
|
+
models: RuntimeSpeechModel[];
|
|
93
|
+
voices: RuntimeVoice[];
|
|
94
|
+
};
|
|
95
|
+
transcription: {
|
|
96
|
+
models: RuntimeTranscriptionModel[];
|
|
97
|
+
};
|
|
98
|
+
limits: RuntimeVoiceLimits;
|
|
99
|
+
/** `practice`: the builder's local helper, never a stand's catalog. */
|
|
100
|
+
source?: 'practice';
|
|
101
|
+
}
|
|
102
|
+
/** What a game asks for beside its models when it requests a budget. */
|
|
103
|
+
interface RuntimeGrantVoiceRequest {
|
|
104
|
+
/** The game speaks. `tiers` are the ones it will call (default: `standard`);
|
|
105
|
+
* the estimate is the characters it expects to speak per disclosure period. */
|
|
106
|
+
speech?: {
|
|
107
|
+
tiers?: VoiceTier[];
|
|
108
|
+
estimatedCharactersPerPeriod: number;
|
|
109
|
+
};
|
|
110
|
+
/** The game listens. The estimate is seconds of recorded speech per period. */
|
|
111
|
+
transcription?: {
|
|
112
|
+
estimatedSecondsPerPeriod: number;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/** A budget's voice terms, frozen with it and shown on the approval sheet. */
|
|
116
|
+
interface RuntimeGrantVoiceTerms {
|
|
117
|
+
billingPolicy: 'metered-credits-v1';
|
|
118
|
+
/** Every company a recording or a line of text is sent to. */
|
|
119
|
+
providers: string[];
|
|
120
|
+
speech?: {
|
|
121
|
+
/** The model each approved tier speaks with. */
|
|
122
|
+
models: {
|
|
123
|
+
tier: VoiceTier;
|
|
124
|
+
modelId: string;
|
|
125
|
+
label: string;
|
|
126
|
+
provider: string;
|
|
127
|
+
}[];
|
|
128
|
+
estimatedCharactersPerPeriod: number;
|
|
129
|
+
/** The SERVER's figure for that estimate at the dearest approved tier, fee included. */
|
|
130
|
+
estimatedCreditsPerPeriod: number;
|
|
131
|
+
maxCharacters: number;
|
|
132
|
+
};
|
|
133
|
+
transcription?: {
|
|
134
|
+
/** In the order they are tried. */
|
|
135
|
+
models: {
|
|
136
|
+
modelId: string;
|
|
137
|
+
label: string;
|
|
138
|
+
provider: string;
|
|
139
|
+
}[];
|
|
140
|
+
estimatedSecondsPerPeriod: number;
|
|
141
|
+
estimatedCreditsPerPeriod: number;
|
|
142
|
+
maxSeconds: number;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/** What `POST /api/runtime/grants/:id/speech` accepts. */
|
|
146
|
+
interface RuntimeSpeechRequest {
|
|
147
|
+
/** Used once: a spoken line is never replayed, so a reused key is `idempotency_conflict`. */
|
|
148
|
+
idempotencyKey: string;
|
|
149
|
+
text: string;
|
|
150
|
+
/** A voice id of the catalog. */
|
|
151
|
+
voice: string;
|
|
152
|
+
/** One of the budget's approved tiers; its first when absent. */
|
|
153
|
+
tier?: VoiceTier;
|
|
154
|
+
/** How to say it, in a few words. Read by models whose `styles` is true, ignored by the rest. */
|
|
155
|
+
style?: string;
|
|
156
|
+
language?: string;
|
|
157
|
+
}
|
|
158
|
+
/** Where a voice call's money went: the budget's meter, as for the judge. */
|
|
159
|
+
interface RuntimeVoiceBilling {
|
|
160
|
+
billingPolicy: 'metered-credits-v1';
|
|
161
|
+
billingStatus: 'pending' | 'final';
|
|
162
|
+
/** A call under a budget charges no credit of its own — the meter does. A
|
|
163
|
+
* development call (the builder's own credits) is charged whole credits. */
|
|
164
|
+
chargedCredits: number;
|
|
165
|
+
/** USD pico-dollars as decimal strings: the call's real cost (null while
|
|
166
|
+
* unknown) and what it added to the meter, fee included. */
|
|
167
|
+
costUsdPicos: string | null;
|
|
168
|
+
chargedUsdPicos: string | null;
|
|
169
|
+
}
|
|
170
|
+
interface RuntimeVoiceGrantCounters {
|
|
171
|
+
status: RuntimeGrantStatus;
|
|
172
|
+
spentCredits: number;
|
|
173
|
+
heldCredits: number;
|
|
174
|
+
remainingCredits: number;
|
|
175
|
+
}
|
|
176
|
+
interface RuntimeVoiceCallView {
|
|
177
|
+
generationId: string;
|
|
178
|
+
grantId: string | null;
|
|
179
|
+
modelId: string;
|
|
180
|
+
/** `dispatching` only on a replay of a call still running. */
|
|
181
|
+
status: 'succeeded' | 'failed' | 'unknown' | 'canceled' | 'dispatching';
|
|
182
|
+
error?: string;
|
|
183
|
+
/** Set with `content_blocked`: which side the stand's content check refused. */
|
|
184
|
+
contentBlocked?: 'input' | 'output';
|
|
185
|
+
billing: RuntimeVoiceBilling;
|
|
186
|
+
grant?: RuntimeVoiceGrantCounters;
|
|
187
|
+
createdAt: string;
|
|
188
|
+
completedAt?: string;
|
|
189
|
+
/** `practice`: answered by the builder's local helper. Absent on every real answer. */
|
|
190
|
+
source?: 'practice';
|
|
191
|
+
}
|
|
192
|
+
/** The transcription door's answer. `text` is present on `succeeded`, and is
|
|
193
|
+
* empty when nobody spoke. */
|
|
194
|
+
interface RuntimeTranscriptionView extends RuntimeVoiceCallView {
|
|
195
|
+
kind: typeof VoiceCallKind.Transcription;
|
|
196
|
+
text?: string;
|
|
197
|
+
/** The language heard, as the provider names it (`en`, `eng`), when it says. */
|
|
198
|
+
language?: string;
|
|
199
|
+
/** The recording's length. */
|
|
200
|
+
durationMs: number;
|
|
201
|
+
}
|
|
202
|
+
/** The speech door's last event. The audio itself is the `audio` events before it. */
|
|
203
|
+
interface RuntimeSpeechView extends RuntimeVoiceCallView {
|
|
204
|
+
kind: typeof VoiceCallKind.Speech;
|
|
205
|
+
voice: string;
|
|
206
|
+
tier: VoiceTier;
|
|
207
|
+
characters: number;
|
|
208
|
+
/** Length of the audio that was made; absent when none was. */
|
|
209
|
+
durationMs?: number;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* What the speech door sends, as `text/event-stream`, in this order: one
|
|
213
|
+
* `start`, any number of `audio`, one `done`. `audio.data` is base64 of PCM in
|
|
214
|
+
* the format `start` names; pieces are whole samples and play in order. A
|
|
215
|
+
* stream that ends without `done` was cut: what arrived is all there is, and
|
|
216
|
+
* the call settles on the server either way.
|
|
217
|
+
*/
|
|
218
|
+
type RuntimeSpeechStreamEvent = {
|
|
219
|
+
event: 'start';
|
|
220
|
+
data: {
|
|
221
|
+
generationId: string;
|
|
222
|
+
encoding: string;
|
|
223
|
+
sampleRate: number;
|
|
224
|
+
channels: number;
|
|
225
|
+
};
|
|
226
|
+
} | {
|
|
227
|
+
event: 'audio';
|
|
228
|
+
data: {
|
|
229
|
+
data: string;
|
|
230
|
+
};
|
|
231
|
+
} | {
|
|
232
|
+
event: 'done';
|
|
233
|
+
data: RuntimeSpeechView;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/** Web-only generation bridge. This does not extend the native vocabulary. */
|
|
237
|
+
|
|
1
238
|
type RuntimeGenerationStatus = 'requires_confirmation' | 'queued' | 'dispatching' | 'awaiting_external' | 'succeeded' | 'failed' | 'unknown' | 'canceled' | 'expired';
|
|
2
239
|
/**
|
|
3
240
|
* Who pays. `credits` is the player's Genex credits — every quote and budget
|
|
@@ -257,7 +494,8 @@ interface RuntimeGenerationView extends RuntimeGenerationBilling, RuntimeConvers
|
|
|
257
494
|
/** Controls this call asked for that its funding cannot honour: a call
|
|
258
495
|
* answered on the player's own plan is run as one prompt and takes none. */
|
|
259
496
|
ignoredControls?: string[];
|
|
260
|
-
|
|
497
|
+
/** `transcription` and `speech` are voice calls (`runtime-voice.ts`). */
|
|
498
|
+
outputFormat: 'text' | 'json' | 'judge' | 'transcription' | 'speech';
|
|
261
499
|
schema?: Record<string, unknown>;
|
|
262
500
|
/** A judge call's questions. */
|
|
263
501
|
questions?: Record<string, RuntimeJudgeQuestion>;
|
|
@@ -442,6 +680,9 @@ interface RuntimeGrantTerms {
|
|
|
442
680
|
};
|
|
443
681
|
/** Present when the budget also admits the judge. */
|
|
444
682
|
judge?: RuntimeGrantJudgeTerms;
|
|
683
|
+
/** Present when the budget also admits voice calls: the game listens to
|
|
684
|
+
* the player's microphone, speaks, or both. The approval sheet says so. */
|
|
685
|
+
voice?: RuntimeGrantVoiceTerms;
|
|
445
686
|
/** The game's multiplayer server may also spend this budget, in a server-authoritative room its
|
|
446
687
|
* owner lends it to. Present, and `true`, only on a budget that was requested that way; the
|
|
447
688
|
* approval sheet says so. */
|
|
@@ -541,6 +782,9 @@ interface RuntimeGenerationFeatures {
|
|
|
541
782
|
/** A budget may be requested with `shareWithRooms` and lent to a
|
|
542
783
|
* server-authoritative room (`lendSpendGrantToRoom`). */
|
|
543
784
|
roomCalls?: boolean;
|
|
785
|
+
/** The stand serves voice (`runtime-voice.ts`): a budget may be requested
|
|
786
|
+
* with `voice`, and its calls may be transcribed and spoken. */
|
|
787
|
+
voice?: boolean;
|
|
544
788
|
}
|
|
545
789
|
interface RuntimeGenerationModels {
|
|
546
790
|
enabled: true;
|
|
@@ -665,4 +909,4 @@ type RuntimeGenerationStreamEvent = {
|
|
|
665
909
|
};
|
|
666
910
|
type RuntimeContentBlockedSide = 'input' | 'output';
|
|
667
911
|
|
|
668
|
-
export type
|
|
912
|
+
export { type RuntimeGrantVoiceTerms as A, type RuntimeJudgeCriterion as B, type RuntimeReasoningEffort as C, type RuntimeSpeechModel as D, type RuntimeSpeechRequest as E, type RuntimeSpeechStreamEvent as F, type RuntimeSpeechView as G, type RuntimeTranscriptionModel as H, type RuntimeTranscriptionView as I, type RuntimeVoice as J, type RuntimeVoiceGrantCounters as K, type RuntimeVoiceLimits as L, type RuntimeConversationFields as R, VoiceTier as V, type RuntimeControlFields as a, type RuntimeJudgeQuestion as b, type RuntimeWorkflowInput as c, type RuntimeGenerationView as d, type RuntimeJudgeAnswer as e, type RuntimeJudgmentView as f, type RuntimeGenerationBilling as g, type RuntimeGenerationFunding as h, type RuntimeGrantVoiceRequest as i, type RuntimeGrantView as j, type RuntimeMessage as k, type RuntimeGenerationModels as l, type RuntimeWorkflowOfferings as m, type RuntimeRoomLendView as n, type RuntimeVoiceBilling as o, type RuntimeVoiceCatalog as p, type RuntimeBillingPolicy as q, type RuntimeControl as r, type RuntimeCurrency as s, type RuntimeExternalProvider as t, type RuntimeGenerationFeatures as u, type RuntimeGenerationStatus as v, type RuntimeGenerationStreamEvent as w, type RuntimeGrantJudgeTerms as x, type RuntimeGrantStatus as y, type RuntimeGrantTerms as z };
|
package/dist/sentry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genex-ai/embed-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"description": "Player identity + durable game state for genex games \u2014 signed-in or guest play, per-player save slots, shared world state, soft-trust leaderboards, and shared collections and event streams.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|