realtime-avatar 0.34.0 → 0.36.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 +33 -0
- package/dist/{chunk-OVW4N5NH.js → chunk-EVATXOT2.js} +1 -1
- package/dist/{chunk-GPGNAQZV.js → chunk-YHNBW3X6.js} +279 -136
- package/dist/express.d.ts +2 -2
- package/dist/express.js +2 -2
- package/dist/hono.d.ts +2 -2
- package/dist/hono.js +2 -2
- package/dist/index.d.ts +15 -3
- package/dist/index.js +1 -1
- package/dist/nextjs.d.ts +2 -2
- package/dist/nextjs.js +2 -2
- package/dist/react-native.js +27 -18
- package/dist/react.js +27 -18
- package/dist/server.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/tanstack-start.d.ts +2 -2
- package/dist/tanstack-start.js +2 -2
- package/dist/{types-Cg_i1jhk.d.ts → types-C_0GpIws.d.ts} +103 -63
- package/dist/{types-Cdi7KWWj.d.ts → types-aQOs22YE.d.ts} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -204,6 +204,36 @@ Two facts follow from that picture and drive everything else:
|
|
|
204
204
|
|
|
205
205
|
---
|
|
206
206
|
|
|
207
|
+
## Speech without a live call
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
const speech = await rta.createSpeech(voiceId, { text: "Hello!", format: "wav" }, { signal });
|
|
211
|
+
return new Response(speech.bytes, { headers: { "content-type": speech.contentType } });
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Available only from the server entries, `createSpeech` wraps the existing HTTP speech endpoint.
|
|
215
|
+
It returns completed audio, **not streaming audio**, and uses **no LiveKit** or live call.
|
|
216
|
+
It does not listen or provide full-duplex conversation; live calls remain full duplex.
|
|
217
|
+
|
|
218
|
+
The exported `createSpeechRequestSchema` owns `CreateSpeechInput`: text is trimmed and must
|
|
219
|
+
contain 1–2,000 characters; `format` defaults to `mp3` (or choose `wav`); optional `speed` is
|
|
220
|
+
0.5–2 and `language` is a BCP-47 tag. Unknown fields reject. Use a real workspace-accessible
|
|
221
|
+
`vce_…` or `voice_…` ID. `SpeechResult` contains `Uint8Array<ArrayBuffer>` bytes, validated
|
|
222
|
+
`audio/mpeg` or `audio/wav` content type, and nullable `billedBytes`, `billedCredits`, `requestId`.
|
|
223
|
+
Missing metadata stays null; invalid metadata, mismatched media, empty audio or more than
|
|
224
|
+
24 MiB rejects. Container signatures are checked, not the full audio codec.
|
|
225
|
+
|
|
226
|
+
Existing RTA authorization and billing apply: `speech:write`, a paid workspace or purchased
|
|
227
|
+
credits, and an accessible voice. Billing counts UTF-8 bytes of trimmed text (one credit per
|
|
228
|
+
90 bytes, rounded up, minimum one). The endpoint stores neither text nor audio; callers may
|
|
229
|
+
save and replay bytes. Limits are 20 requests per minute and one in progress per workspace.
|
|
230
|
+
|
|
231
|
+
**No automatic retries**, regardless of client `maxRetries`: the endpoint is not idempotent,
|
|
232
|
+
and an ambiguous failure may already be billed. `signal`, `timeoutMs` and `totalTimeoutMs`
|
|
233
|
+
cover the request and binary body; an abort does not guarantee that upstream billing stopped.
|
|
234
|
+
Caller aborts propagate, timeout aborts are `TimeoutError`, and HTTP errors use the existing
|
|
235
|
+
`RealtimeAvatarHttpError` class.
|
|
236
|
+
|
|
207
237
|
## Custom voice (webhook)
|
|
208
238
|
|
|
209
239
|
Speak a call in your own voice. Each sentence she is about to say is POSTed, signed, to an
|
|
@@ -423,6 +453,9 @@ rta.getRecording(recordingId)
|
|
|
423
453
|
rta.getRecordingAccess(recordingId)
|
|
424
454
|
rta.getConnectionHistory(sessionId) // bounded LiveKit observations; requires usage:read
|
|
425
455
|
|
|
456
|
+
// completed speech audio; server only, no LiveKit, never retried; requires speech:write
|
|
457
|
+
rta.createSpeech(voiceId, { text, format?, speed?, language? }, { signal? })
|
|
458
|
+
|
|
426
459
|
// pre-rendered video (MP4, no live call); server only, requires renders:write / renders:read
|
|
427
460
|
rta.createRender({ avatarId, voiceId? | voice?, lipGain?, shots }) // 202 queued; one Idempotency-Key across retries
|
|
428
461
|
rta.waitForRender(renderId) // block until ready | failed; RETURNS a failed render, throws only on timeout
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RealtimeAvatar, ROUTE_TIMEOUT_MS, proxyEndRequestSchema, proxyConnectRequestSchema, isQueued, RealtimeAvatarHttpError, RealtimeAvatarError } from './chunk-
|
|
1
|
+
import { RealtimeAvatar, ROUTE_TIMEOUT_MS, proxyEndRequestSchema, proxyConnectRequestSchema, isQueued, RealtimeAvatarHttpError, RealtimeAvatarError } from './chunk-YHNBW3X6.js';
|
|
2
2
|
|
|
3
3
|
// ../http-client/src/generated/error-semantics.ts
|
|
4
4
|
var ERROR_SEMANTICS = {
|
|
@@ -353,40 +353,50 @@ var schema27 = z.enum(["respond", "recovery", "initiative"]);
|
|
|
353
353
|
var schema32 = z.string().min(1).max(32);
|
|
354
354
|
var schema42 = z.union([schema27, schema32]);
|
|
355
355
|
var schema52 = z.enum(["draft", "accepted"]);
|
|
356
|
-
var schema62 = z.literal("
|
|
357
|
-
var schema72 = z.
|
|
358
|
-
"renderer": schema62
|
|
359
|
-
});
|
|
356
|
+
var schema62 = z.literal("speech_segments_v1");
|
|
357
|
+
var schema72 = z.literal("external");
|
|
360
358
|
var schema82 = z.object({
|
|
359
|
+
"renderer": schema72
|
|
360
|
+
});
|
|
361
|
+
var schema92 = z.object({
|
|
361
362
|
"session_id": schema02,
|
|
362
363
|
"generation_id": schema02,
|
|
363
364
|
"version": schema110,
|
|
364
365
|
"purpose": schema42,
|
|
365
366
|
"admission": schema52,
|
|
366
|
-
"
|
|
367
|
+
"text_output": schema62.optional(),
|
|
368
|
+
"visible_character": schema82.optional()
|
|
367
369
|
});
|
|
368
|
-
var
|
|
369
|
-
var
|
|
370
|
+
var schema102 = z.string().min(1).max(200);
|
|
371
|
+
var schema112 = z.object({
|
|
370
372
|
"generation_id": schema02,
|
|
371
|
-
"utterance_id":
|
|
373
|
+
"utterance_id": schema102
|
|
372
374
|
});
|
|
373
|
-
var
|
|
374
|
-
var
|
|
375
|
-
var
|
|
376
|
-
var schema142 = z.literal("unavailable");
|
|
375
|
+
var schema122 = z.literal("external_performance");
|
|
376
|
+
var schema132 = z.enum(["accepted", "dropped", "cancelled", "audio_released"]);
|
|
377
|
+
var schema142 = z.union([schema132, schema32]);
|
|
377
378
|
var schema152 = z.literal("unavailable");
|
|
378
|
-
var schema162 = z.
|
|
379
|
+
var schema162 = z.literal("unavailable");
|
|
380
|
+
var schema172 = z.object({
|
|
379
381
|
"session_id": schema02,
|
|
380
382
|
"generation_id": schema02,
|
|
381
|
-
"kind":
|
|
383
|
+
"kind": schema122,
|
|
382
384
|
"version": schema110,
|
|
383
|
-
"status":
|
|
384
|
-
"audible_checkpoint":
|
|
385
|
-
"audio_mapping":
|
|
385
|
+
"status": schema142,
|
|
386
|
+
"audible_checkpoint": schema152,
|
|
387
|
+
"audio_mapping": schema162
|
|
388
|
+
});
|
|
389
|
+
var schema182 = z.string().regex(new RegExp("^(?:[^\\uD800-\\uDFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF])*$")).min(1).max(5e3);
|
|
390
|
+
var schema192 = z.strictObject({
|
|
391
|
+
"version": schema110,
|
|
392
|
+
"generation_id": schema02,
|
|
393
|
+
"utterance_id": schema102,
|
|
394
|
+
"text": schema182
|
|
386
395
|
});
|
|
387
|
-
var externalTurnContextSchema =
|
|
388
|
-
var externalUtteranceSchema =
|
|
389
|
-
var externalPerformanceFrameSchema =
|
|
396
|
+
var externalTurnContextSchema = schema92;
|
|
397
|
+
var externalUtteranceSchema = schema112;
|
|
398
|
+
var externalPerformanceFrameSchema = schema172;
|
|
399
|
+
var externalSpeechSegmentSchema = schema192;
|
|
390
400
|
var schema03 = z.enum(["s1", "s2-pro", "s2.1-pro", "drama-3"]);
|
|
391
401
|
var schema111 = z.enum(["speech-1.6", "speech-1.5", "s1-mini"]);
|
|
392
402
|
var schema28 = z.union([schema03, schema111]);
|
|
@@ -822,6 +832,38 @@ var liveKitSessionReleaseReasonSchema = z.enum([
|
|
|
822
832
|
"manual",
|
|
823
833
|
"idle_timeout"
|
|
824
834
|
]);
|
|
835
|
+
var schema08 = z.string().min(1).max(2e3);
|
|
836
|
+
var schema117 = z.enum(["mp3", "wav"]);
|
|
837
|
+
var schema212 = z.number().min(0.5).max(2);
|
|
838
|
+
var schema37 = z.string().regex(new RegExp("^[A-Za-z0-9-]+$")).min(2).max(16);
|
|
839
|
+
var schema47 = z.strictObject({
|
|
840
|
+
"text": z.string().trim().pipe(schema08),
|
|
841
|
+
"format": schema117.optional(),
|
|
842
|
+
"speed": schema212.optional(),
|
|
843
|
+
"language": schema37.optional()
|
|
844
|
+
});
|
|
845
|
+
var schema56 = z.string().regex(new RegExp("^(vce|voice)_"));
|
|
846
|
+
var schema64 = z.number().min(0);
|
|
847
|
+
var schema74 = z.int().min(1);
|
|
848
|
+
var createSpeechRequestSchema = schema47.extend({
|
|
849
|
+
format: schema47.shape.format.unwrap().default("mp3")
|
|
850
|
+
});
|
|
851
|
+
var speechVoiceIdSchema = schema56;
|
|
852
|
+
var speechContentTypeSchema = z.enum(["audio/mpeg", "audio/wav"]);
|
|
853
|
+
var speechResponseHeadersSchema = z.strictObject({
|
|
854
|
+
"X-RTA-Billed-Credits": z.string().regex(/^(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$/).transform(Number).pipe(schema64).nullable(),
|
|
855
|
+
"X-RTA-Billed-Bytes": z.string().regex(/^(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$/).transform(Number).pipe(schema74).nullable()
|
|
856
|
+
});
|
|
857
|
+
function readSpeechHeaders(headers) {
|
|
858
|
+
const parsed = speechResponseHeadersSchema.parse({
|
|
859
|
+
"X-RTA-Billed-Credits": headers.get("X-RTA-Billed-Credits"),
|
|
860
|
+
"X-RTA-Billed-Bytes": headers.get("X-RTA-Billed-Bytes")
|
|
861
|
+
});
|
|
862
|
+
return {
|
|
863
|
+
billedCredits: parsed["X-RTA-Billed-Credits"],
|
|
864
|
+
billedBytes: parsed["X-RTA-Billed-Bytes"]
|
|
865
|
+
};
|
|
866
|
+
}
|
|
825
867
|
|
|
826
868
|
// ../http-client/src/retry.ts
|
|
827
869
|
var RETRYABLE_STATUS = /* @__PURE__ */ new Set([408, 500, 502, 503, 504]);
|
|
@@ -854,81 +896,81 @@ function isTransient(cause) {
|
|
|
854
896
|
const name = cause?.name;
|
|
855
897
|
return name === "TimeoutError" || name === "TypeError" || name === "FetchError";
|
|
856
898
|
}
|
|
857
|
-
var
|
|
858
|
-
var
|
|
859
|
-
var
|
|
860
|
-
var
|
|
861
|
-
var
|
|
862
|
-
var
|
|
863
|
-
var
|
|
864
|
-
var
|
|
899
|
+
var schema09 = z.string().min(1).max(160);
|
|
900
|
+
var schema118 = z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value));
|
|
901
|
+
var schema213 = z.enum(["cartesia", "fish"]);
|
|
902
|
+
var schema38 = z.string().min(1).max(240);
|
|
903
|
+
var schema48 = z.string().min(1).max(120);
|
|
904
|
+
var schema57 = z.number().min(0.5).max(2);
|
|
905
|
+
var schema65 = z.null();
|
|
906
|
+
var schema75 = z.union([schema57, schema65]);
|
|
865
907
|
var schema84 = z.string().min(1).max(80);
|
|
866
|
-
var schema94 = z.union([schema84,
|
|
908
|
+
var schema94 = z.union([schema84, schema65]);
|
|
867
909
|
var schema104 = z.string().min(2).max(16);
|
|
868
|
-
var
|
|
910
|
+
var schema119 = z.union([schema104, schema65]);
|
|
869
911
|
var schema124 = z.strictObject({
|
|
870
|
-
"provider":
|
|
871
|
-
"voice_id":
|
|
872
|
-
"model":
|
|
873
|
-
"speed":
|
|
912
|
+
"provider": schema213,
|
|
913
|
+
"voice_id": schema38,
|
|
914
|
+
"model": schema48.optional(),
|
|
915
|
+
"speed": schema75.optional(),
|
|
874
916
|
"emotion": schema94.optional(),
|
|
875
|
-
"language":
|
|
917
|
+
"language": schema119.optional()
|
|
876
918
|
});
|
|
877
919
|
var schema134 = z.string().min(8).max(80);
|
|
878
920
|
var schema144 = z.string();
|
|
879
921
|
var schema154 = z.enum(["video", "live2d"]);
|
|
880
922
|
var schema163 = z.enum(["image", "video"]);
|
|
881
|
-
var
|
|
882
|
-
var
|
|
883
|
-
var
|
|
884
|
-
var schema202 = z.union([schema144,
|
|
885
|
-
var
|
|
923
|
+
var schema173 = z.enum(["realtime-avatar-live-v1", "realtime-avatar-video-v1"]);
|
|
924
|
+
var schema183 = z.union([schema134, schema65]);
|
|
925
|
+
var schema193 = z.enum(["draft", "preprocessing", "ready", "failed", "disabled", "deleted"]);
|
|
926
|
+
var schema202 = z.union([schema144, schema65]);
|
|
927
|
+
var schema214 = z.enum(["none", "queued", "generating", "ready", "failed"]);
|
|
886
928
|
var schema222 = z.enum(["local", "gemini", "openai"]);
|
|
887
929
|
var schema232 = z.string().max(200);
|
|
888
|
-
var schema242 = z.union([schema232,
|
|
930
|
+
var schema242 = z.union([schema232, schema65]);
|
|
889
931
|
var schema252 = z.strictObject({
|
|
890
932
|
"provider": schema222,
|
|
891
933
|
"model": schema242.optional()
|
|
892
934
|
});
|
|
893
|
-
var schema262 = z.union([schema252,
|
|
935
|
+
var schema262 = z.union([schema252, schema65]);
|
|
894
936
|
var schema272 = z.strictObject({
|
|
895
937
|
"id": schema134,
|
|
896
938
|
"tenantId": schema134,
|
|
897
939
|
"displayName": schema144,
|
|
898
940
|
"renderer": schema154,
|
|
899
941
|
"sourceKind": schema163,
|
|
900
|
-
"modelId":
|
|
901
|
-
"sourceAssetId":
|
|
902
|
-
"status":
|
|
942
|
+
"modelId": schema173,
|
|
943
|
+
"sourceAssetId": schema183,
|
|
944
|
+
"status": schema193,
|
|
903
945
|
"error": schema202,
|
|
904
|
-
"idleVideoStatus":
|
|
946
|
+
"idleVideoStatus": schema214,
|
|
905
947
|
"defaultVoiceId": schema202,
|
|
906
948
|
"llm": schema262,
|
|
907
949
|
"createdAt": schema144,
|
|
908
950
|
"updatedAt": schema144
|
|
909
951
|
});
|
|
910
952
|
var createLive2dAvatarInputSchema = z.strictObject({
|
|
911
|
-
displayName:
|
|
912
|
-
settings:
|
|
913
|
-
metadata:
|
|
953
|
+
displayName: schema09,
|
|
954
|
+
settings: schema118.optional(),
|
|
955
|
+
metadata: schema118.optional(),
|
|
914
956
|
voice: schema124
|
|
915
957
|
});
|
|
916
958
|
var avatarResponseSchema = schema272;
|
|
917
|
-
var
|
|
918
|
-
var
|
|
919
|
-
var
|
|
920
|
-
var
|
|
921
|
-
var
|
|
922
|
-
var
|
|
923
|
-
var
|
|
924
|
-
"url":
|
|
925
|
-
"secret":
|
|
926
|
-
"voice_id":
|
|
927
|
-
"language":
|
|
928
|
-
"sample_rate":
|
|
929
|
-
"timeout_ms":
|
|
959
|
+
var schema010 = z.url().regex(new RegExp("^https:\\/\\/")).max(500);
|
|
960
|
+
var schema120 = z.string().min(16).max(200);
|
|
961
|
+
var schema215 = z.string().min(1).max(200);
|
|
962
|
+
var schema39 = z.string().min(2).max(35);
|
|
963
|
+
var schema49 = z.literal([8e3, 16e3, 22050, 24e3, 44100, 48e3]);
|
|
964
|
+
var schema58 = z.int().min(1e3).max(15e3);
|
|
965
|
+
var schema66 = z.strictObject({
|
|
966
|
+
"url": schema010,
|
|
967
|
+
"secret": schema120,
|
|
968
|
+
"voice_id": schema215.optional(),
|
|
969
|
+
"language": schema39.optional(),
|
|
970
|
+
"sample_rate": schema49.optional(),
|
|
971
|
+
"timeout_ms": schema58.optional()
|
|
930
972
|
});
|
|
931
|
-
var
|
|
973
|
+
var schema76 = z.literal("voice.synthesize");
|
|
932
974
|
var schema85 = z.literal(1);
|
|
933
975
|
var schema95 = z.string().min(1).max(200);
|
|
934
976
|
var schema105 = z.string().min(1).max(200);
|
|
@@ -941,32 +983,32 @@ var schema135 = z.string();
|
|
|
941
983
|
var schema145 = z.string().min(1).max(5e3);
|
|
942
984
|
var schema155 = z.string();
|
|
943
985
|
var schema164 = z.null();
|
|
944
|
-
var
|
|
945
|
-
var
|
|
946
|
-
var
|
|
986
|
+
var schema174 = z.union([schema155, schema164]);
|
|
987
|
+
var schema184 = z.string();
|
|
988
|
+
var schema194 = z.union([schema184, schema164]);
|
|
947
989
|
var schema203 = z.literal("pcm_s16le");
|
|
948
|
-
var
|
|
990
|
+
var schema216 = z.literal([8e3, 16e3, 22050, 24e3, 44100, 48e3]);
|
|
949
991
|
var schema223 = z.object({
|
|
950
992
|
"encoding": schema203,
|
|
951
|
-
"sample_rate":
|
|
993
|
+
"sample_rate": schema216,
|
|
952
994
|
"channels": schema85
|
|
953
995
|
});
|
|
954
996
|
var schema233 = z.string().min(1).max(64);
|
|
955
997
|
var schema243 = z.string().max(200);
|
|
956
998
|
var schema253 = z.record(schema233, schema243).refine((value) => Object.keys(value).length <= 16, { message: "Too many keys: at most 16" });
|
|
957
999
|
var schema263 = z.object({
|
|
958
|
-
"type":
|
|
1000
|
+
"type": schema76,
|
|
959
1001
|
"version": schema85,
|
|
960
1002
|
"performance": schema1110.optional(),
|
|
961
1003
|
"request_id": schema125,
|
|
962
1004
|
"session_id": schema135,
|
|
963
1005
|
"text": schema145,
|
|
964
|
-
"voice_id":
|
|
965
|
-
"language":
|
|
1006
|
+
"voice_id": schema174,
|
|
1007
|
+
"language": schema194,
|
|
966
1008
|
"output": schema223,
|
|
967
1009
|
"client_metadata": schema253
|
|
968
1010
|
});
|
|
969
|
-
var voiceWebhookWireSchema =
|
|
1011
|
+
var voiceWebhookWireSchema = schema66;
|
|
970
1012
|
var voiceWebhookOptionsSchema = z.strictObject({
|
|
971
1013
|
url: voiceWebhookWireSchema.shape.url,
|
|
972
1014
|
secret: voiceWebhookWireSchema.shape.secret,
|
|
@@ -987,42 +1029,56 @@ function voiceWebhookToWire(input) {
|
|
|
987
1029
|
};
|
|
988
1030
|
}
|
|
989
1031
|
var voiceWebhookRequestSchema = schema263;
|
|
990
|
-
var
|
|
991
|
-
var
|
|
992
|
-
var
|
|
993
|
-
var
|
|
994
|
-
var
|
|
995
|
-
"renderer":
|
|
1032
|
+
var schema011 = z.url().regex(new RegExp("^\\s*[Hh][Tt][Tt][Pp][Ss]:\\/\\/")).max(500);
|
|
1033
|
+
var schema121 = z.string().min(16).max(4096);
|
|
1034
|
+
var schema217 = z.boolean();
|
|
1035
|
+
var schema310 = z.literal("external");
|
|
1036
|
+
var schema410 = z.strictObject({
|
|
1037
|
+
"renderer": schema310
|
|
996
1038
|
});
|
|
997
|
-
var
|
|
998
|
-
var
|
|
999
|
-
var
|
|
1000
|
-
var schema86 = z.literal(
|
|
1001
|
-
var schema96 = z.
|
|
1002
|
-
|
|
1003
|
-
"
|
|
1039
|
+
var schema59 = z.literal("v1");
|
|
1040
|
+
var schema67 = z.literal("correlated_pcm_v1");
|
|
1041
|
+
var schema77 = z.literal("speech_segments_v1");
|
|
1042
|
+
var schema86 = z.literal("v1");
|
|
1043
|
+
var schema96 = z.literal(true);
|
|
1044
|
+
var schema106 = z.object({
|
|
1045
|
+
"performance": schema86,
|
|
1046
|
+
"fail_closed": schema96
|
|
1004
1047
|
});
|
|
1005
|
-
var
|
|
1006
|
-
|
|
1007
|
-
"
|
|
1008
|
-
"fail_closed":
|
|
1009
|
-
"
|
|
1010
|
-
|
|
1011
|
-
|
|
1048
|
+
var schema1111 = z.literal("correlated_pcm_v1");
|
|
1049
|
+
var schema126 = z.object({
|
|
1050
|
+
"performance": schema86,
|
|
1051
|
+
"fail_closed": schema96,
|
|
1052
|
+
"audio_output": schema1111
|
|
1053
|
+
});
|
|
1054
|
+
var schema136 = z.strictObject({
|
|
1055
|
+
"base_url": schema011,
|
|
1056
|
+
"token": schema121,
|
|
1057
|
+
"fail_closed": schema217.optional(),
|
|
1058
|
+
"visible_character": schema410.optional(),
|
|
1059
|
+
"performance": schema59.optional(),
|
|
1060
|
+
"audio_output": schema67.optional(),
|
|
1061
|
+
"text_output": schema77.optional()
|
|
1012
1062
|
}).superRefine((value, ctx) => {
|
|
1013
1063
|
if (value["audio_output"] !== void 0) {
|
|
1014
|
-
const result =
|
|
1064
|
+
const result = schema106.safeParse(value);
|
|
1065
|
+
if (!result.success) for (const issue of result.error.issues) ctx.addIssue({ code: "custom", message: issue.message, path: issue.path });
|
|
1066
|
+
}
|
|
1067
|
+
}).superRefine((value, ctx) => {
|
|
1068
|
+
if (value["text_output"] !== void 0) {
|
|
1069
|
+
const result = schema126.safeParse(value);
|
|
1015
1070
|
if (!result.success) for (const issue of result.error.issues) ctx.addIssue({ code: "custom", message: issue.message, path: issue.path });
|
|
1016
1071
|
}
|
|
1017
1072
|
});
|
|
1018
|
-
var externalLlmWireSchema =
|
|
1073
|
+
var externalLlmWireSchema = schema136;
|
|
1019
1074
|
var externalLlmOptionsSchema = z.strictObject({
|
|
1020
1075
|
baseUrl: externalLlmWireSchema.shape.base_url,
|
|
1021
1076
|
token: externalLlmWireSchema.shape.token,
|
|
1022
1077
|
failClosed: externalLlmWireSchema.shape.fail_closed,
|
|
1023
1078
|
visibleCharacter: externalLlmWireSchema.shape.visible_character,
|
|
1024
1079
|
performance: externalLlmWireSchema.shape.performance,
|
|
1025
|
-
audioOutput: externalLlmWireSchema.shape.audio_output
|
|
1080
|
+
audioOutput: externalLlmWireSchema.shape.audio_output,
|
|
1081
|
+
textOutput: externalLlmWireSchema.shape.text_output
|
|
1026
1082
|
});
|
|
1027
1083
|
function externalLlmToWire(input) {
|
|
1028
1084
|
const options = externalLlmOptionsSchema.parse(input);
|
|
@@ -1032,58 +1088,59 @@ function externalLlmToWire(input) {
|
|
|
1032
1088
|
...options.failClosed !== void 0 ? { fail_closed: options.failClosed } : {},
|
|
1033
1089
|
...options.visibleCharacter !== void 0 ? { visible_character: options.visibleCharacter } : {},
|
|
1034
1090
|
...options.performance !== void 0 ? { performance: options.performance } : {},
|
|
1035
|
-
...options.audioOutput !== void 0 ? { audio_output: options.audioOutput } : {}
|
|
1091
|
+
...options.audioOutput !== void 0 ? { audio_output: options.audioOutput } : {},
|
|
1092
|
+
...options.textOutput !== void 0 ? { text_output: options.textOutput } : {}
|
|
1036
1093
|
});
|
|
1037
1094
|
}
|
|
1038
|
-
var
|
|
1039
|
-
var
|
|
1040
|
-
var
|
|
1041
|
-
var
|
|
1042
|
-
var
|
|
1043
|
-
var
|
|
1044
|
-
var
|
|
1045
|
-
"count":
|
|
1046
|
-
"max":
|
|
1047
|
-
"p50":
|
|
1048
|
-
"p90":
|
|
1095
|
+
var schema012 = z.string().min(8).max(80);
|
|
1096
|
+
var schema127 = z.enum(["eou", "llm", "tts", "decision", "hold", "e2e"]);
|
|
1097
|
+
var schema218 = z.literal("interrupt_stop");
|
|
1098
|
+
var schema311 = z.union([schema127, schema218]);
|
|
1099
|
+
var schema411 = z.int().max(9007199254740991).gt(0);
|
|
1100
|
+
var schema510 = z.number().min(0);
|
|
1101
|
+
var schema68 = z.strictObject({
|
|
1102
|
+
"count": schema411,
|
|
1103
|
+
"max": schema510,
|
|
1104
|
+
"p50": schema510,
|
|
1105
|
+
"p90": schema510
|
|
1049
1106
|
});
|
|
1050
|
-
var
|
|
1107
|
+
var schema78 = z.partialRecord(schema311, schema68);
|
|
1051
1108
|
var schema87 = z.literal("available");
|
|
1052
1109
|
var schema97 = z.literal("dialogue");
|
|
1053
1110
|
var schema107 = z.string().regex(new RegExp("^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d))|(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?)$"));
|
|
1054
|
-
var
|
|
1055
|
-
var
|
|
1056
|
-
var
|
|
1111
|
+
var schema1112 = z.null();
|
|
1112
|
+
var schema128 = z.union([schema107, schema1112]);
|
|
1113
|
+
var schema137 = z.int().min(0).max(9007199254740991);
|
|
1057
1114
|
var schema146 = z.strictObject({
|
|
1058
|
-
"first_at":
|
|
1059
|
-
"last_at":
|
|
1060
|
-
"lines":
|
|
1115
|
+
"first_at": schema128,
|
|
1116
|
+
"last_at": schema128,
|
|
1117
|
+
"lines": schema137
|
|
1061
1118
|
});
|
|
1062
1119
|
var schema156 = z.strictObject({
|
|
1063
|
-
"latency_ms":
|
|
1120
|
+
"latency_ms": schema78,
|
|
1064
1121
|
"status": schema87,
|
|
1065
1122
|
"sourceRole": schema97,
|
|
1066
1123
|
"coverage": schema146
|
|
1067
1124
|
});
|
|
1068
1125
|
var schema165 = z.literal("unavailable");
|
|
1069
|
-
var
|
|
1070
|
-
var
|
|
1126
|
+
var schema175 = z.enum(["not_closed", "unconfigured", "missing", "invalid", "oversized", "unscorable", "no_measured_latency", "timeout", "aborted", "storage_unavailable"]);
|
|
1127
|
+
var schema185 = z.strictObject({
|
|
1071
1128
|
"status": schema165,
|
|
1072
|
-
"reason":
|
|
1129
|
+
"reason": schema175
|
|
1073
1130
|
});
|
|
1074
|
-
var
|
|
1131
|
+
var schema195 = z.union([schema156, schema185]);
|
|
1075
1132
|
var schema204 = z.string().min(1).max(200);
|
|
1076
|
-
var
|
|
1133
|
+
var schema219 = z.union([schema204, schema1112]);
|
|
1077
1134
|
var schema224 = z.string().regex(new RegExp("^[0-9a-f]{40}$"));
|
|
1078
|
-
var schema234 = z.union([schema224,
|
|
1135
|
+
var schema234 = z.union([schema224, schema1112]);
|
|
1079
1136
|
var schema244 = z.literal("cloudflare-worker-version");
|
|
1080
1137
|
var schema254 = z.literal("authenticated-worker-heartbeat");
|
|
1081
|
-
var schema264 = z.union([schema254,
|
|
1138
|
+
var schema264 = z.union([schema254, schema1112]);
|
|
1082
1139
|
var schema273 = z.string().min(1).max(160);
|
|
1083
|
-
var schema282 = z.union([schema273,
|
|
1084
|
-
var schema292 = z.union([
|
|
1140
|
+
var schema282 = z.union([schema273, schema1112]);
|
|
1141
|
+
var schema292 = z.union([schema137, schema1112]);
|
|
1085
1142
|
var schema30 = z.iso.datetime({ offset: true }).regex(new RegExp("^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"));
|
|
1086
|
-
var schema31 = z.union([schema30,
|
|
1143
|
+
var schema31 = z.union([schema30, schema1112]);
|
|
1087
1144
|
var schema322 = z.strictObject({
|
|
1088
1145
|
"deploymentSource": schema244,
|
|
1089
1146
|
"workerSource": schema264,
|
|
@@ -1092,18 +1149,18 @@ var schema322 = z.strictObject({
|
|
|
1092
1149
|
"workerObservedAt": schema31
|
|
1093
1150
|
});
|
|
1094
1151
|
var schema332 = z.strictObject({
|
|
1095
|
-
"deploymentId":
|
|
1152
|
+
"deploymentId": schema219,
|
|
1096
1153
|
"workerRevision": schema234,
|
|
1097
1154
|
"provenance": schema322
|
|
1098
1155
|
});
|
|
1099
1156
|
var schema342 = z.string();
|
|
1100
|
-
var schema352 = z.union([schema342,
|
|
1157
|
+
var schema352 = z.union([schema342, schema1112]);
|
|
1101
1158
|
var schema362 = z.enum(["reserved", "started", "released", "failed"]);
|
|
1102
|
-
var schema372 = z.union([
|
|
1159
|
+
var schema372 = z.union([schema510, schema1112]);
|
|
1103
1160
|
var schema382 = z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value));
|
|
1104
1161
|
var schema392 = z.strictObject({
|
|
1105
|
-
"sessionId":
|
|
1106
|
-
"speechDiagnostics":
|
|
1162
|
+
"sessionId": schema012,
|
|
1163
|
+
"speechDiagnostics": schema195.optional(),
|
|
1107
1164
|
"releaseIdentity": schema332.optional(),
|
|
1108
1165
|
"avatarId": schema352,
|
|
1109
1166
|
"avatarName": schema352,
|
|
@@ -1132,7 +1189,9 @@ function toSessionsPage(page) {
|
|
|
1132
1189
|
// ../http-client/src/client.ts
|
|
1133
1190
|
var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
|
|
1134
1191
|
var RENDER_MISMATCH = "Render response did not match the SDK contract";
|
|
1135
|
-
var
|
|
1192
|
+
var SPEECH_MISMATCH = "Speech response did not match the SDK contract";
|
|
1193
|
+
var MAX_SPEECH_RESPONSE_BYTES = 24 * 1024 * 1024;
|
|
1194
|
+
var SDK_VERSION = "0.36.0";
|
|
1136
1195
|
var RealtimeAvatar = class {
|
|
1137
1196
|
#apiKey;
|
|
1138
1197
|
#baseUrl;
|
|
@@ -1694,6 +1753,45 @@ var RealtimeAvatar = class {
|
|
|
1694
1753
|
async creditBalance() {
|
|
1695
1754
|
return await this.#json(await this.#request("GET", "/credits/balance"));
|
|
1696
1755
|
}
|
|
1756
|
+
/** Completed speech audio, without a call or LiveKit. Never automatically retried. */
|
|
1757
|
+
async createSpeech(voiceId, input, options = {}) {
|
|
1758
|
+
const id = speechVoiceIdSchema.parse(voiceId);
|
|
1759
|
+
const json = createSpeechRequestSchema.parse(input);
|
|
1760
|
+
const timeout = AbortSignal.timeout(Math.max(0, Math.min(this.#timeoutMs, this.#totalTimeoutMs ?? Infinity)));
|
|
1761
|
+
const signal = options.signal ? AbortSignal.any([options.signal, timeout]) : timeout;
|
|
1762
|
+
const response = await this.#request("POST", `/voices/${encodeURIComponent(id)}/speech`, {
|
|
1763
|
+
json,
|
|
1764
|
+
signal,
|
|
1765
|
+
maxRetries: 0
|
|
1766
|
+
});
|
|
1767
|
+
if (!response.ok) {
|
|
1768
|
+
try {
|
|
1769
|
+
await this.#json(response);
|
|
1770
|
+
} finally {
|
|
1771
|
+
signal.throwIfAborted();
|
|
1772
|
+
}
|
|
1773
|
+
throw new RealtimeAvatarError(SPEECH_MISMATCH);
|
|
1774
|
+
}
|
|
1775
|
+
let metadata;
|
|
1776
|
+
try {
|
|
1777
|
+
const contentType = speechContentTypeSchema.parse(response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase());
|
|
1778
|
+
const expected = { wav: "audio/wav", mp3: "audio/mpeg" };
|
|
1779
|
+
if (contentType !== expected[json.format]) throw new RealtimeAvatarError(SPEECH_MISMATCH);
|
|
1780
|
+
const requestId = response.headers.get("x-request-id");
|
|
1781
|
+
if (requestId !== null && !isRequestId(requestId)) throw new RealtimeAvatarError(SPEECH_MISMATCH);
|
|
1782
|
+
metadata = { contentType, ...readSpeechHeaders(response.headers), requestId };
|
|
1783
|
+
const length = response.headers.get("content-length");
|
|
1784
|
+
if (length !== null && (!/^[0-9]+$/.test(length) || Number(length) > MAX_SPEECH_RESPONSE_BYTES)) {
|
|
1785
|
+
throw new RealtimeAvatarError(SPEECH_MISMATCH);
|
|
1786
|
+
}
|
|
1787
|
+
} catch {
|
|
1788
|
+
await response.body?.cancel().catch(() => {
|
|
1789
|
+
});
|
|
1790
|
+
throw new RealtimeAvatarError(SPEECH_MISMATCH);
|
|
1791
|
+
}
|
|
1792
|
+
const bytes = await readSpeechBytes(response, signal, metadata.contentType);
|
|
1793
|
+
return { bytes, ...metadata };
|
|
1794
|
+
}
|
|
1697
1795
|
// ── internals ────────────────────────────────────────────────────────────
|
|
1698
1796
|
async #request(method, path, init = {}) {
|
|
1699
1797
|
const headers = {
|
|
@@ -1709,25 +1807,29 @@ var RealtimeAvatar = class {
|
|
|
1709
1807
|
body = JSON.stringify(init.json);
|
|
1710
1808
|
}
|
|
1711
1809
|
if (MUTATING.has(method)) headers["idempotency-key"] = newIdempotencyKey();
|
|
1810
|
+
const maxRetries = init.maxRetries ?? this.#maxRetries;
|
|
1712
1811
|
const deadline = this.#totalTimeoutMs === void 0 ? Infinity : Date.now() + this.#totalTimeoutMs;
|
|
1713
1812
|
let lastError;
|
|
1714
1813
|
for (let attempt = 0; ; attempt++) {
|
|
1715
1814
|
const startedAt = Date.now();
|
|
1716
1815
|
try {
|
|
1717
|
-
const
|
|
1816
|
+
const timeout = AbortSignal.timeout(Math.max(0, Math.min(this.#timeoutMs, deadline - startedAt)));
|
|
1817
|
+
const signal = init.signal ? AbortSignal.any([init.signal, timeout]) : timeout;
|
|
1818
|
+
signal.throwIfAborted();
|
|
1718
1819
|
const response = await this.#fetch(`${this.#baseUrl}${path}`, { method, headers, body, signal });
|
|
1719
|
-
if (attempt >=
|
|
1820
|
+
if (attempt >= maxRetries || !RETRYABLE_STATUS.has(response.status)) return response;
|
|
1720
1821
|
const wait = backoffMs(attempt, response.headers.get("retry-after"));
|
|
1721
1822
|
if (!retryFits(startedAt, wait, deadline)) return response;
|
|
1722
1823
|
await response.body?.cancel().catch(() => {
|
|
1723
1824
|
});
|
|
1724
1825
|
await sleep(wait);
|
|
1725
1826
|
} catch (cause) {
|
|
1827
|
+
init.signal?.throwIfAborted();
|
|
1726
1828
|
lastError = cause;
|
|
1727
1829
|
const wait = backoffMs(attempt, null);
|
|
1728
|
-
if (attempt >=
|
|
1830
|
+
if (attempt >= maxRetries || !isTransient(cause) || isStream(body) || !retryFits(startedAt, wait, deadline)) {
|
|
1729
1831
|
throw new RealtimeAvatarError(
|
|
1730
|
-
`${method} ${path} failed after ${attempt + 1} attempt(s): ${cause.message}`,
|
|
1832
|
+
`${method} ${path} failed after ${attempt + 1} attempt(s): ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
1731
1833
|
{ cause: lastError }
|
|
1732
1834
|
);
|
|
1733
1835
|
}
|
|
@@ -1763,6 +1865,47 @@ var RealtimeAvatar = class {
|
|
|
1763
1865
|
return parsed.data;
|
|
1764
1866
|
}
|
|
1765
1867
|
};
|
|
1868
|
+
async function readSpeechBytes(response, signal, contentType) {
|
|
1869
|
+
if (!response.body) throw new RealtimeAvatarError(SPEECH_MISMATCH);
|
|
1870
|
+
const reader = response.body.getReader();
|
|
1871
|
+
const cancel = () => {
|
|
1872
|
+
void reader.cancel().catch(() => {
|
|
1873
|
+
});
|
|
1874
|
+
};
|
|
1875
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
1876
|
+
const chunks = [];
|
|
1877
|
+
let size = 0;
|
|
1878
|
+
try {
|
|
1879
|
+
signal.throwIfAborted();
|
|
1880
|
+
for (; ; ) {
|
|
1881
|
+
const { done, value } = await reader.read();
|
|
1882
|
+
signal.throwIfAborted();
|
|
1883
|
+
if (done) break;
|
|
1884
|
+
size += value.byteLength;
|
|
1885
|
+
if (size > MAX_SPEECH_RESPONSE_BYTES) throw new RealtimeAvatarError(SPEECH_MISMATCH);
|
|
1886
|
+
chunks.push(value);
|
|
1887
|
+
}
|
|
1888
|
+
if (size === 0) throw new RealtimeAvatarError(SPEECH_MISMATCH);
|
|
1889
|
+
const bytes = new Uint8Array(size);
|
|
1890
|
+
let offset = 0;
|
|
1891
|
+
for (const chunk of chunks) {
|
|
1892
|
+
bytes.set(chunk, offset);
|
|
1893
|
+
offset += chunk.byteLength;
|
|
1894
|
+
}
|
|
1895
|
+
const matches = (offset2, text) => [...text].every((character, index) => bytes[offset2 + index] === character.charCodeAt(0));
|
|
1896
|
+
const valid = contentType === "audio/wav" ? size >= 44 && matches(0, "RIFF") && matches(8, "WAVE") : size >= 10 && matches(0, "ID3") || size >= 4 && bytes[0] === 255 && (bytes[1] & 224) === 224;
|
|
1897
|
+
if (!valid) throw new RealtimeAvatarError(SPEECH_MISMATCH);
|
|
1898
|
+
return bytes;
|
|
1899
|
+
} catch (error) {
|
|
1900
|
+
await reader.cancel().catch(() => {
|
|
1901
|
+
});
|
|
1902
|
+
signal.throwIfAborted();
|
|
1903
|
+
throw error;
|
|
1904
|
+
} finally {
|
|
1905
|
+
signal.removeEventListener("abort", cancel);
|
|
1906
|
+
reader.releaseLock();
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1766
1909
|
function isRecord(value) {
|
|
1767
1910
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1768
1911
|
}
|
|
@@ -1902,4 +2045,4 @@ var proxyEndRequestSchema = z.object({
|
|
|
1902
2045
|
message: "session_id or queue_ticket_id is required"
|
|
1903
2046
|
});
|
|
1904
2047
|
|
|
1905
|
-
export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, ROUTE_TIMEOUT_MS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook };
|
|
2048
|
+
export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, ROUTE_TIMEOUT_MS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, createSpeechRequestSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook };
|
package/dist/express.d.ts
CHANGED
package/dist/express.js
CHANGED
package/dist/hono.d.ts
CHANGED
package/dist/hono.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as CreateLive2dAvatarInput, R as RegisteredAvatar, c as AvatarUpdate, d as AvatarSourceSwap, e as ClipLibraryDeclaration, f as ClipLibraryUpdate, L as LoopRedirect, g as ClipLibrary, h as AssetKind, i as Asset, j as ListSessionsOptions, U as UsageSessionPage, k as UsageSession, l as ListRecordingsQuery, m as ListRecordingsResponse, n as RecordingArtifact, o as RecordingAccessResponse, p as CreateRenderInput, q as CreditBalance, T as TranscriptPayload, V as VoiceWebhookRequest } from './types-
|
|
2
|
-
export {
|
|
1
|
+
import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as CreateLive2dAvatarInput, R as RegisteredAvatar, c as AvatarUpdate, d as AvatarSourceSwap, e as ClipLibraryDeclaration, f as ClipLibraryUpdate, L as LoopRedirect, g as ClipLibrary, h as AssetKind, i as Asset, j as ListSessionsOptions, U as UsageSessionPage, k as UsageSession, l as ListRecordingsQuery, m as ListRecordingsResponse, n as RecordingArtifact, o as RecordingAccessResponse, p as CreateRenderInput, q as CreditBalance, r as operations, s as CreateSpeechInput, t as SpeechResult, T as TranscriptPayload, V as VoiceWebhookRequest } from './types-C_0GpIws.js';
|
|
2
|
+
export { u as AvatarClip, v as CallConnection, w as CallQueued, x as ClipDeclaration, y as ClipLibraryPlan, z as ClipSource, B as ContextMessage, D as EndCallReason, F as ExternalLlm, G as RecordingArtifactStatus, H as RecordingMode, I as RenderShot, J as VideoPolicy, K as VoiceWebhook, M as VoiceWebhookErrorCode, N as createSpeechRequestSchema, O as isQueued, P as listRecordingsResponseSchema, Q as recordingAccessResponseSchema, W as recordingArtifactSchema, X as recordingModeSchema } from './types-C_0GpIws.js';
|
|
3
3
|
import { ConnectionHistoryResponse } from './connection-history.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
@@ -470,6 +470,10 @@ declare class RealtimeAvatar {
|
|
|
470
470
|
/** Read one session's bounded LiveKit connection history. Requires `usage:read`. */
|
|
471
471
|
getConnectionHistory(sessionId: string): Promise<ConnectionHistoryResponse>;
|
|
472
472
|
creditBalance(): Promise<CreditBalance>;
|
|
473
|
+
/** Completed speech audio, without a call or LiveKit. Never automatically retried. */
|
|
474
|
+
createSpeech(voiceId: operations["createSpeech"]["parameters"]["path"]["voiceId"], input: CreateSpeechInput, options?: {
|
|
475
|
+
signal?: AbortSignal;
|
|
476
|
+
}): Promise<SpeechResult>;
|
|
473
477
|
}
|
|
474
478
|
|
|
475
479
|
/** Base for everything this SDK throws, so `catch (e) { if (e instanceof RealtimeAvatarError) }` works. */
|
|
@@ -585,6 +589,7 @@ declare const externalTurnContextSchema: z.ZodObject<{
|
|
|
585
589
|
draft: "draft";
|
|
586
590
|
accepted: "accepted";
|
|
587
591
|
}>;
|
|
592
|
+
text_output: z.ZodOptional<z.ZodLiteral<"speech_segments_v1">>;
|
|
588
593
|
visible_character: z.ZodOptional<z.ZodObject<{
|
|
589
594
|
renderer: z.ZodLiteral<"external">;
|
|
590
595
|
}, z.core.$strip>>;
|
|
@@ -595,6 +600,13 @@ declare const externalUtteranceSchema: z.ZodObject<{
|
|
|
595
600
|
utterance_id: z.ZodString;
|
|
596
601
|
}, z.core.$strip>;
|
|
597
602
|
type ExternalUtterance = z.infer<typeof externalUtteranceSchema>;
|
|
603
|
+
declare const externalSpeechSegmentSchema: z.ZodObject<{
|
|
604
|
+
version: z.ZodLiteral<1>;
|
|
605
|
+
generation_id: z.ZodString;
|
|
606
|
+
utterance_id: z.ZodString;
|
|
607
|
+
text: z.ZodString;
|
|
608
|
+
}, z.core.$strict>;
|
|
609
|
+
type ExternalSpeechSegment = z.infer<typeof externalSpeechSegmentSchema>;
|
|
598
610
|
|
|
599
611
|
declare const clipLibraryDeclarationSchema: z.ZodObject<{
|
|
600
612
|
idle: z.ZodOptional<z.ZodObject<{
|
|
@@ -941,4 +953,4 @@ declare const proxyEndRequestSchema: z.ZodObject<{
|
|
|
941
953
|
}>>>;
|
|
942
954
|
}, z.core.$strict>;
|
|
943
955
|
|
|
944
|
-
export { Asset, AssetKind, Avatar, AvatarSourceSwap, AvatarUpdate, CallMode, CallPolicy, ClipLibrary, ClipLibraryDeclaration, ClipLibraryUpdate, CreateLive2dAvatarInput, CreateRenderInput, CreditBalance, DEFAULT_FISH_TTS_MODEL, EndCallOptions, type ExternalTurnContext, type ExternalUtterance, FISH_DELIVERY_MODELS, type FishDelivery, type FishTtsModel, ListRecordingsQuery, ListRecordingsResponse, type ListRendersQuery, type ListRendersResponse, ListSessionsOptions, LoopRedirect, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, type RealtimeAvatarOptions, RealtimeAvatarWebhookError, RecordingAccessResponse, RecordingArtifact, RegisteredAvatar, type Render, type RenderAccessResponse, type RenderFailureCode, type RenderPlayback, type RenderStatus, type ShotTiming, type StartCallOptions, StartCallResult, TranscriptPayload, UsageSession, UsageSessionPage, VoiceWebhookRequest, type WebhookVerificationErrorCode, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook };
|
|
956
|
+
export { Asset, AssetKind, Avatar, AvatarSourceSwap, AvatarUpdate, CallMode, CallPolicy, ClipLibrary, ClipLibraryDeclaration, ClipLibraryUpdate, CreateLive2dAvatarInput, CreateRenderInput, CreateSpeechInput, CreditBalance, DEFAULT_FISH_TTS_MODEL, EndCallOptions, type ExternalSpeechSegment, type ExternalTurnContext, type ExternalUtterance, FISH_DELIVERY_MODELS, type FishDelivery, type FishTtsModel, ListRecordingsQuery, ListRecordingsResponse, type ListRendersQuery, type ListRendersResponse, ListSessionsOptions, LoopRedirect, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, type RealtimeAvatarOptions, RealtimeAvatarWebhookError, RecordingAccessResponse, RecordingArtifact, RegisteredAvatar, type Render, type RenderAccessResponse, type RenderFailureCode, type RenderPlayback, type RenderStatus, type ShotTiming, SpeechResult, type StartCallOptions, StartCallResult, TranscriptPayload, UsageSession, UsageSessionPage, VoiceWebhookRequest, type WebhookVerificationErrorCode, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import './chunk-6KQS7CTR.js';
|
|
2
|
-
export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-
|
|
2
|
+
export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, createSpeechRequestSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-YHNBW3X6.js';
|
|
3
3
|
import './chunk-MCIXU6XP.js';
|
package/dist/nextjs.d.ts
CHANGED
package/dist/nextjs.js
CHANGED
package/dist/react-native.js
CHANGED
|
@@ -1847,9 +1847,10 @@ var schema24 = z.enum(["respond", "recovery", "initiative"]);
|
|
|
1847
1847
|
var schema34 = z.string().min(1).max(32);
|
|
1848
1848
|
var schema44 = z.union([schema24, schema34]);
|
|
1849
1849
|
var schema53 = z.enum(["draft", "accepted"]);
|
|
1850
|
-
var schema62 = z.literal("
|
|
1851
|
-
var schema72 = z.
|
|
1852
|
-
|
|
1850
|
+
var schema62 = z.literal("speech_segments_v1");
|
|
1851
|
+
var schema72 = z.literal("external");
|
|
1852
|
+
var schema82 = z.object({
|
|
1853
|
+
"renderer": schema72
|
|
1853
1854
|
});
|
|
1854
1855
|
z.object({
|
|
1855
1856
|
"session_id": schema05,
|
|
@@ -1857,31 +1858,39 @@ z.object({
|
|
|
1857
1858
|
"version": schema16,
|
|
1858
1859
|
"purpose": schema44,
|
|
1859
1860
|
"admission": schema53,
|
|
1860
|
-
"
|
|
1861
|
+
"text_output": schema62.optional(),
|
|
1862
|
+
"visible_character": schema82.optional()
|
|
1861
1863
|
});
|
|
1862
|
-
var
|
|
1864
|
+
var schema102 = z.string().min(1).max(200);
|
|
1863
1865
|
z.object({
|
|
1864
1866
|
"generation_id": schema05,
|
|
1865
|
-
"utterance_id":
|
|
1867
|
+
"utterance_id": schema102
|
|
1866
1868
|
});
|
|
1867
|
-
var
|
|
1868
|
-
var
|
|
1869
|
-
var
|
|
1870
|
-
var schema142 = z.literal("unavailable");
|
|
1869
|
+
var schema123 = z.literal("external_performance");
|
|
1870
|
+
var schema133 = z.enum(["accepted", "dropped", "cancelled", "audio_released"]);
|
|
1871
|
+
var schema142 = z.union([schema133, schema34]);
|
|
1871
1872
|
var schema152 = z.literal("unavailable");
|
|
1872
|
-
var schema162 = z.
|
|
1873
|
+
var schema162 = z.literal("unavailable");
|
|
1874
|
+
var schema17 = z.object({
|
|
1873
1875
|
"session_id": schema05,
|
|
1874
1876
|
"generation_id": schema05,
|
|
1875
|
-
"kind":
|
|
1877
|
+
"kind": schema123,
|
|
1876
1878
|
"version": schema16,
|
|
1877
|
-
"status":
|
|
1878
|
-
"audible_checkpoint":
|
|
1879
|
-
"audio_mapping":
|
|
1879
|
+
"status": schema142,
|
|
1880
|
+
"audible_checkpoint": schema152,
|
|
1881
|
+
"audio_mapping": schema162
|
|
1880
1882
|
});
|
|
1881
|
-
var
|
|
1883
|
+
var schema18 = z.string().regex(new RegExp("^(?:[^\\uD800-\\uDFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF])*$")).min(1).max(5e3);
|
|
1884
|
+
z.strictObject({
|
|
1885
|
+
"version": schema16,
|
|
1886
|
+
"generation_id": schema05,
|
|
1887
|
+
"utterance_id": schema102,
|
|
1888
|
+
"text": schema18
|
|
1889
|
+
});
|
|
1890
|
+
var externalPerformanceFrameSchema = schema17;
|
|
1882
1891
|
var schema06 = z.enum(["s1", "s2-pro", "s2.1-pro", "drama-3"]);
|
|
1883
|
-
var
|
|
1884
|
-
var schema25 = z.union([schema06,
|
|
1892
|
+
var schema110 = z.enum(["speech-1.6", "speech-1.5", "s1-mini"]);
|
|
1893
|
+
var schema25 = z.union([schema06, schema110]);
|
|
1885
1894
|
var schema35 = z.enum(["whisper"]);
|
|
1886
1895
|
var schema45 = z.null();
|
|
1887
1896
|
var schema54 = z.union([schema35, schema45]);
|
package/dist/react.js
CHANGED
|
@@ -2419,9 +2419,10 @@ var schema24 = z.enum(["respond", "recovery", "initiative"]);
|
|
|
2419
2419
|
var schema34 = z.string().min(1).max(32);
|
|
2420
2420
|
var schema44 = z.union([schema24, schema34]);
|
|
2421
2421
|
var schema53 = z.enum(["draft", "accepted"]);
|
|
2422
|
-
var schema62 = z.literal("
|
|
2423
|
-
var schema72 = z.
|
|
2424
|
-
|
|
2422
|
+
var schema62 = z.literal("speech_segments_v1");
|
|
2423
|
+
var schema72 = z.literal("external");
|
|
2424
|
+
var schema82 = z.object({
|
|
2425
|
+
"renderer": schema72
|
|
2425
2426
|
});
|
|
2426
2427
|
z.object({
|
|
2427
2428
|
"session_id": schema05,
|
|
@@ -2429,31 +2430,39 @@ z.object({
|
|
|
2429
2430
|
"version": schema16,
|
|
2430
2431
|
"purpose": schema44,
|
|
2431
2432
|
"admission": schema53,
|
|
2432
|
-
"
|
|
2433
|
+
"text_output": schema62.optional(),
|
|
2434
|
+
"visible_character": schema82.optional()
|
|
2433
2435
|
});
|
|
2434
|
-
var
|
|
2436
|
+
var schema102 = z.string().min(1).max(200);
|
|
2435
2437
|
z.object({
|
|
2436
2438
|
"generation_id": schema05,
|
|
2437
|
-
"utterance_id":
|
|
2439
|
+
"utterance_id": schema102
|
|
2438
2440
|
});
|
|
2439
|
-
var
|
|
2440
|
-
var
|
|
2441
|
-
var
|
|
2442
|
-
var schema142 = z.literal("unavailable");
|
|
2441
|
+
var schema123 = z.literal("external_performance");
|
|
2442
|
+
var schema133 = z.enum(["accepted", "dropped", "cancelled", "audio_released"]);
|
|
2443
|
+
var schema142 = z.union([schema133, schema34]);
|
|
2443
2444
|
var schema152 = z.literal("unavailable");
|
|
2444
|
-
var schema162 = z.
|
|
2445
|
+
var schema162 = z.literal("unavailable");
|
|
2446
|
+
var schema17 = z.object({
|
|
2445
2447
|
"session_id": schema05,
|
|
2446
2448
|
"generation_id": schema05,
|
|
2447
|
-
"kind":
|
|
2449
|
+
"kind": schema123,
|
|
2448
2450
|
"version": schema16,
|
|
2449
|
-
"status":
|
|
2450
|
-
"audible_checkpoint":
|
|
2451
|
-
"audio_mapping":
|
|
2451
|
+
"status": schema142,
|
|
2452
|
+
"audible_checkpoint": schema152,
|
|
2453
|
+
"audio_mapping": schema162
|
|
2452
2454
|
});
|
|
2453
|
-
var
|
|
2455
|
+
var schema18 = z.string().regex(new RegExp("^(?:[^\\uD800-\\uDFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF])*$")).min(1).max(5e3);
|
|
2456
|
+
z.strictObject({
|
|
2457
|
+
"version": schema16,
|
|
2458
|
+
"generation_id": schema05,
|
|
2459
|
+
"utterance_id": schema102,
|
|
2460
|
+
"text": schema18
|
|
2461
|
+
});
|
|
2462
|
+
var externalPerformanceFrameSchema = schema17;
|
|
2454
2463
|
var schema06 = z.enum(["s1", "s2-pro", "s2.1-pro", "drama-3"]);
|
|
2455
|
-
var
|
|
2456
|
-
var schema25 = z.union([schema06,
|
|
2464
|
+
var schema110 = z.enum(["speech-1.6", "speech-1.5", "s1-mini"]);
|
|
2465
|
+
var schema25 = z.union([schema06, schema110]);
|
|
2457
2466
|
var schema35 = z.enum(["whisper"]);
|
|
2458
2467
|
var schema45 = z.null();
|
|
2459
2468
|
var schema54 = z.union([schema35, schema45]);
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_FISH_TTS_MODEL, ExternalTurnContext, ExternalUtterance, FISH_DELIVERY_MODELS, FishDelivery, FishTtsModel, ListRendersQuery, ListRendersResponse, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarOptions, RealtimeAvatarWebhookError, Render, RenderAccessResponse, RenderFailureCode, RenderPlayback, RenderStatus, ShotTiming, StartCallOptions, WebhookVerificationErrorCode, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './index.js';
|
|
2
|
-
export { i as Asset, h as AssetKind, A as Avatar,
|
|
1
|
+
export { DEFAULT_FISH_TTS_MODEL, ExternalSpeechSegment, ExternalTurnContext, ExternalUtterance, FISH_DELIVERY_MODELS, FishDelivery, FishTtsModel, ListRendersQuery, ListRendersResponse, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarOptions, RealtimeAvatarWebhookError, Render, RenderAccessResponse, RenderFailureCode, RenderPlayback, RenderStatus, ShotTiming, StartCallOptions, WebhookVerificationErrorCode, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './index.js';
|
|
2
|
+
export { i as Asset, h as AssetKind, A as Avatar, u as AvatarClip, d as AvatarSourceSwap, c as AvatarUpdate, v as CallConnection, C as CallMode, a as CallPolicy, w as CallQueued, x as ClipDeclaration, g as ClipLibrary, e as ClipLibraryDeclaration, y as ClipLibraryPlan, f as ClipLibraryUpdate, z as ClipSource, B as ContextMessage, b as CreateLive2dAvatarInput, p as CreateRenderInput, s as CreateSpeechInput, q as CreditBalance, E as EndCallOptions, D as EndCallReason, F as ExternalLlm, l as ListRecordingsQuery, m as ListRecordingsResponse, j as ListSessionsOptions, L as LoopRedirect, o as RecordingAccessResponse, n as RecordingArtifact, G as RecordingArtifactStatus, H as RecordingMode, R as RegisteredAvatar, I as RenderShot, t as SpeechResult, S as StartCallResult, T as TranscriptPayload, k as UsageSession, U as UsageSessionPage, J as VideoPolicy, K as VoiceWebhook, M as VoiceWebhookErrorCode, V as VoiceWebhookRequest, N as createSpeechRequestSchema, O as isQueued, P as listRecordingsResponseSchema, Q as recordingAccessResponseSchema, W as recordingArtifactSchema, X as recordingModeSchema } from './types-C_0GpIws.js';
|
|
3
3
|
import './connection-history.js';
|
|
4
4
|
import 'zod';
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import './chunk-6KQS7CTR.js';
|
|
2
|
-
export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-
|
|
2
|
+
export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, createSpeechRequestSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-YHNBW3X6.js';
|
|
3
3
|
import './chunk-MCIXU6XP.js';
|
package/dist/tanstack-start.d.ts
CHANGED
package/dist/tanstack-start.js
CHANGED
|
@@ -1,67 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
declare const createLive2dAvatarInputSchema: z.ZodObject<{
|
|
4
|
-
displayName: z.ZodString;
|
|
5
|
-
settings: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
6
|
-
metadata: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
7
|
-
voice: z.ZodObject<{
|
|
8
|
-
provider: z.ZodEnum<{
|
|
9
|
-
cartesia: "cartesia";
|
|
10
|
-
fish: "fish";
|
|
11
|
-
}>;
|
|
12
|
-
voice_id: z.ZodString;
|
|
13
|
-
model: z.ZodOptional<z.ZodString>;
|
|
14
|
-
speed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>;
|
|
15
|
-
emotion: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
16
|
-
language: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
17
|
-
}, z.core.$strict>;
|
|
18
|
-
}, z.core.$strict>;
|
|
19
|
-
declare const avatarResponseSchema: z.ZodObject<{
|
|
20
|
-
id: z.ZodString;
|
|
21
|
-
tenantId: z.ZodString;
|
|
22
|
-
displayName: z.ZodString;
|
|
23
|
-
renderer: z.ZodEnum<{
|
|
24
|
-
video: "video";
|
|
25
|
-
live2d: "live2d";
|
|
26
|
-
}>;
|
|
27
|
-
sourceKind: z.ZodEnum<{
|
|
28
|
-
video: "video";
|
|
29
|
-
image: "image";
|
|
30
|
-
}>;
|
|
31
|
-
modelId: z.ZodEnum<{
|
|
32
|
-
"realtime-avatar-live-v1": "realtime-avatar-live-v1";
|
|
33
|
-
"realtime-avatar-video-v1": "realtime-avatar-video-v1";
|
|
34
|
-
}>;
|
|
35
|
-
sourceAssetId: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
|
36
|
-
status: z.ZodEnum<{
|
|
37
|
-
ready: "ready";
|
|
38
|
-
failed: "failed";
|
|
39
|
-
draft: "draft";
|
|
40
|
-
preprocessing: "preprocessing";
|
|
41
|
-
disabled: "disabled";
|
|
42
|
-
deleted: "deleted";
|
|
43
|
-
}>;
|
|
44
|
-
error: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
|
45
|
-
idleVideoStatus: z.ZodEnum<{
|
|
46
|
-
ready: "ready";
|
|
47
|
-
failed: "failed";
|
|
48
|
-
none: "none";
|
|
49
|
-
queued: "queued";
|
|
50
|
-
generating: "generating";
|
|
51
|
-
}>;
|
|
52
|
-
defaultVoiceId: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
|
53
|
-
llm: z.ZodUnion<readonly [z.ZodObject<{
|
|
54
|
-
provider: z.ZodEnum<{
|
|
55
|
-
local: "local";
|
|
56
|
-
gemini: "gemini";
|
|
57
|
-
openai: "openai";
|
|
58
|
-
}>;
|
|
59
|
-
model: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
60
|
-
}, z.core.$strict>, z.ZodNull]>;
|
|
61
|
-
createdAt: z.ZodString;
|
|
62
|
-
updatedAt: z.ZodString;
|
|
63
|
-
}, z.core.$strict>;
|
|
64
|
-
|
|
65
3
|
interface components {
|
|
66
4
|
schemas: {
|
|
67
5
|
LiveKitSessionRequest: {
|
|
@@ -809,6 +747,8 @@ interface components {
|
|
|
809
747
|
purpose: ("respond" | "recovery" | "initiative") | string;
|
|
810
748
|
/** @enum {string} */
|
|
811
749
|
admission: "draft" | "accepted";
|
|
750
|
+
/** @constant */
|
|
751
|
+
text_output?: "speech_segments_v1";
|
|
812
752
|
visible_character?: {
|
|
813
753
|
/** @constant */
|
|
814
754
|
renderer: "external";
|
|
@@ -819,6 +759,15 @@ interface components {
|
|
|
819
759
|
/** @description Logical sentence identity, unchanged across HTTP retries; not request_id. */
|
|
820
760
|
utterance_id: string;
|
|
821
761
|
};
|
|
762
|
+
ExternalSpeechSegment: {
|
|
763
|
+
/** @constant */
|
|
764
|
+
version: 1;
|
|
765
|
+
generation_id: string;
|
|
766
|
+
/** @description Logical sentence identity, unchanged across HTTP retries; not request_id. */
|
|
767
|
+
utterance_id: string;
|
|
768
|
+
/** @description Complete committed speech, preserved verbatim; its utterance_id is reused by the signed voice callback and PCM stream. */
|
|
769
|
+
text: string;
|
|
770
|
+
};
|
|
822
771
|
ExternalPerformanceFrame: {
|
|
823
772
|
session_id: string;
|
|
824
773
|
generation_id: string;
|
|
@@ -3699,6 +3648,68 @@ interface operations {
|
|
|
3699
3648
|
};
|
|
3700
3649
|
}
|
|
3701
3650
|
|
|
3651
|
+
declare const createLive2dAvatarInputSchema: z.ZodObject<{
|
|
3652
|
+
displayName: z.ZodString;
|
|
3653
|
+
settings: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
3654
|
+
metadata: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
3655
|
+
voice: z.ZodObject<{
|
|
3656
|
+
provider: z.ZodEnum<{
|
|
3657
|
+
cartesia: "cartesia";
|
|
3658
|
+
fish: "fish";
|
|
3659
|
+
}>;
|
|
3660
|
+
voice_id: z.ZodString;
|
|
3661
|
+
model: z.ZodOptional<z.ZodString>;
|
|
3662
|
+
speed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>;
|
|
3663
|
+
emotion: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
3664
|
+
language: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
3665
|
+
}, z.core.$strict>;
|
|
3666
|
+
}, z.core.$strict>;
|
|
3667
|
+
declare const avatarResponseSchema: z.ZodObject<{
|
|
3668
|
+
id: z.ZodString;
|
|
3669
|
+
tenantId: z.ZodString;
|
|
3670
|
+
displayName: z.ZodString;
|
|
3671
|
+
renderer: z.ZodEnum<{
|
|
3672
|
+
video: "video";
|
|
3673
|
+
live2d: "live2d";
|
|
3674
|
+
}>;
|
|
3675
|
+
sourceKind: z.ZodEnum<{
|
|
3676
|
+
video: "video";
|
|
3677
|
+
image: "image";
|
|
3678
|
+
}>;
|
|
3679
|
+
modelId: z.ZodEnum<{
|
|
3680
|
+
"realtime-avatar-live-v1": "realtime-avatar-live-v1";
|
|
3681
|
+
"realtime-avatar-video-v1": "realtime-avatar-video-v1";
|
|
3682
|
+
}>;
|
|
3683
|
+
sourceAssetId: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
|
3684
|
+
status: z.ZodEnum<{
|
|
3685
|
+
ready: "ready";
|
|
3686
|
+
failed: "failed";
|
|
3687
|
+
draft: "draft";
|
|
3688
|
+
preprocessing: "preprocessing";
|
|
3689
|
+
disabled: "disabled";
|
|
3690
|
+
deleted: "deleted";
|
|
3691
|
+
}>;
|
|
3692
|
+
error: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
|
3693
|
+
idleVideoStatus: z.ZodEnum<{
|
|
3694
|
+
ready: "ready";
|
|
3695
|
+
failed: "failed";
|
|
3696
|
+
none: "none";
|
|
3697
|
+
queued: "queued";
|
|
3698
|
+
generating: "generating";
|
|
3699
|
+
}>;
|
|
3700
|
+
defaultVoiceId: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
|
|
3701
|
+
llm: z.ZodUnion<readonly [z.ZodObject<{
|
|
3702
|
+
provider: z.ZodEnum<{
|
|
3703
|
+
local: "local";
|
|
3704
|
+
gemini: "gemini";
|
|
3705
|
+
openai: "openai";
|
|
3706
|
+
}>;
|
|
3707
|
+
model: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
3708
|
+
}, z.core.$strict>, z.ZodNull]>;
|
|
3709
|
+
createdAt: z.ZodString;
|
|
3710
|
+
updatedAt: z.ZodString;
|
|
3711
|
+
}, z.core.$strict>;
|
|
3712
|
+
|
|
3702
3713
|
declare const listUsageSessionsResponseSchema: z.ZodObject<{
|
|
3703
3714
|
data: z.ZodArray<z.ZodObject<{
|
|
3704
3715
|
sessionId: z.ZodString;
|
|
@@ -4057,6 +4068,7 @@ declare const externalLlmWireSchema: z.ZodObject<{
|
|
|
4057
4068
|
}, z.core.$strict>>;
|
|
4058
4069
|
performance: z.ZodOptional<z.ZodLiteral<"v1">>;
|
|
4059
4070
|
audio_output: z.ZodOptional<z.ZodLiteral<"correlated_pcm_v1">>;
|
|
4071
|
+
text_output: z.ZodOptional<z.ZodLiteral<"speech_segments_v1">>;
|
|
4060
4072
|
}, z.core.$strict>;
|
|
4061
4073
|
declare const externalLlmOptionsSchema: z.ZodObject<{
|
|
4062
4074
|
baseUrl: z.ZodURL;
|
|
@@ -4067,9 +4079,30 @@ declare const externalLlmOptionsSchema: z.ZodObject<{
|
|
|
4067
4079
|
}, z.core.$strict>>;
|
|
4068
4080
|
performance: z.ZodOptional<z.ZodLiteral<"v1">>;
|
|
4069
4081
|
audioOutput: z.ZodOptional<z.ZodLiteral<"correlated_pcm_v1">>;
|
|
4082
|
+
textOutput: z.ZodOptional<z.ZodLiteral<"speech_segments_v1">>;
|
|
4070
4083
|
}, z.core.$strict>;
|
|
4071
4084
|
declare function externalLlmToWire(input: z.input<typeof externalLlmOptionsSchema>): z.output<typeof externalLlmWireSchema>;
|
|
4072
4085
|
|
|
4086
|
+
declare const createSpeechRequestSchema: z.ZodObject<{
|
|
4087
|
+
text: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
4088
|
+
speed: z.ZodOptional<z.ZodNumber>;
|
|
4089
|
+
language: z.ZodOptional<z.ZodString>;
|
|
4090
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
4091
|
+
mp3: "mp3";
|
|
4092
|
+
wav: "wav";
|
|
4093
|
+
}>>;
|
|
4094
|
+
}, z.core.$strict>;
|
|
4095
|
+
type CreateSpeechInput = z.input<typeof createSpeechRequestSchema>;
|
|
4096
|
+
declare const speechContentTypeSchema: z.ZodEnum<{
|
|
4097
|
+
"audio/mpeg": "audio/mpeg";
|
|
4098
|
+
"audio/wav": "audio/wav";
|
|
4099
|
+
}>;
|
|
4100
|
+
type SpeechContentType = z.infer<typeof speechContentTypeSchema>;
|
|
4101
|
+
declare function readSpeechHeaders(headers: Headers): {
|
|
4102
|
+
billedCredits: number | null;
|
|
4103
|
+
billedBytes: number | null;
|
|
4104
|
+
};
|
|
4105
|
+
|
|
4073
4106
|
/**
|
|
4074
4107
|
* The public shapes. Everything an integrator touches is here, in one file, on purpose:
|
|
4075
4108
|
* an agent reading this repo should be able to learn the whole surface without following
|
|
@@ -4100,6 +4133,13 @@ declare function externalLlmToWire(input: z.input<typeof externalLlmOptionsSchem
|
|
|
4100
4133
|
* Verified by mutation: renaming `participant_token` in the generated file fails the typecheck.
|
|
4101
4134
|
*/
|
|
4102
4135
|
|
|
4136
|
+
/** DERIVATION: binary bytes are SDK-owned; media types and billing derive from createSpeech's operation. */
|
|
4137
|
+
type SpeechResult = ReturnType<typeof readSpeechHeaders> & {
|
|
4138
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
4139
|
+
contentType: SpeechContentType;
|
|
4140
|
+
requestId: string | null;
|
|
4141
|
+
};
|
|
4142
|
+
|
|
4103
4143
|
/**
|
|
4104
4144
|
* The wire shapes, from the published contract at https://realtimeavatar.ai/openapi.json.
|
|
4105
4145
|
*
|
|
@@ -4567,4 +4607,4 @@ interface TranscriptPayload {
|
|
|
4567
4607
|
client_metadata: Record<string, string>;
|
|
4568
4608
|
}
|
|
4569
4609
|
|
|
4570
|
-
export { type Avatar as A, type
|
|
4610
|
+
export { type Avatar as A, type ContextMessage as B, type CallMode as C, type EndCallReason as D, type EndCallOptions as E, type ExternalLlm as F, type RecordingArtifactStatus as G, type RecordingMode as H, type RenderShot as I, type VideoPolicy as J, type VoiceWebhook as K, type LoopRedirect as L, type VoiceWebhookErrorCode as M, createSpeechRequestSchema as N, isQueued as O, listRecordingsResponseSchema as P, recordingAccessResponseSchema as Q, type RegisteredAvatar as R, type StartCallResult as S, type TranscriptPayload as T, type UsageSessionPage as U, type VoiceWebhookRequest as V, recordingArtifactSchema as W, recordingModeSchema as X, type CallPolicy as a, type CreateLive2dAvatarInput as b, type AvatarUpdate as c, type AvatarSourceSwap as d, type ClipLibraryDeclaration as e, type ClipLibraryUpdate as f, type ClipLibrary as g, type AssetKind as h, type Asset as i, type ListSessionsOptions as j, type UsageSession as k, type ListRecordingsQuery as l, type ListRecordingsResponse as m, type RecordingArtifact as n, type RecordingAccessResponse as o, type CreateRenderInput as p, type CreditBalance as q, type operations as r, type CreateSpeechInput as s, type SpeechResult as t, type AvatarClip as u, type CallConnection as v, type CallQueued as w, type ClipDeclaration as x, type ClipLibraryPlan as y, type ClipSource as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CallMode, a as CallPolicy } from './types-
|
|
1
|
+
import { C as CallMode, a as CallPolicy } from './types-C_0GpIws.js';
|
|
2
2
|
|
|
3
3
|
/** The three things a caller can ask the proxy to do. Gate on these, not on URLs. */
|
|
4
4
|
type ProxyOperation = "connect" | "end" | "avatars" | "credits";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "realtime-avatar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "Realtime Avatar SDK. `realtime-avatar` and the route adapters hold your API key and are server-only; `realtime-avatar/react`, `/browser` and `/tools` never can — importing a server entry into a browser build throws at bundle time.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "The Influence Company",
|