realtime-voice-agents 2.4.0 → 2.5.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 +30 -11
- package/dist/{BaseRealtimeProvider-CWJ81HIt.d.mts → BaseRealtimeProvider-BJQO-hpu.d.mts} +44 -1
- package/dist/{BaseRealtimeProvider-BL75_HHh.d.cts → BaseRealtimeProvider-CO9N8jt-.d.cts} +44 -1
- package/dist/{BaseRealtimeProvider-C9C3s8jx.mjs → BaseRealtimeProvider-Cj6JWR2k.mjs} +1 -1
- package/dist/{BaseRealtimeProvider-C2mRn1V_.cjs → BaseRealtimeProvider-ZfFzijdr.cjs} +1 -1
- package/dist/{GeminiLiveProvider-Cc1dkxW6.d.cts → GeminiLiveProvider-C_LQCTX5.d.mts} +1 -1
- package/dist/{GeminiLiveProvider-TvY_cQQZ.d.mts → GeminiLiveProvider-DM-GwD0w.d.cts} +1 -1
- package/dist/{InMemorySessionStore-CRBmmCA6.d.cts → InMemorySessionStore-BlsyPnIp.d.cts} +2 -0
- package/dist/{InMemorySessionStore-CRBmmCA6.d.mts → InMemorySessionStore-BlsyPnIp.d.mts} +2 -0
- package/dist/{OpenAICompatibleProvider-D-2OOVBU.mjs → OpenAICompatibleProvider-Dqje-boq.mjs} +3 -3
- package/dist/{OpenAICompatibleProvider-Mp0Mefbh.cjs → OpenAICompatibleProvider-j2Nza2q2.cjs} +8 -2
- package/dist/{events-BylBSBW-.mjs → events-D-pvCH_F.mjs} +2 -1
- package/dist/{events-BxDTIKKq.cjs → events-DWX9535M.cjs} +2 -1
- package/dist/gemini.cjs +1 -1
- package/dist/gemini.d.cts +2 -2
- package/dist/gemini.d.mts +2 -2
- package/dist/gemini.mjs +1 -1
- package/dist/gpt-live.cjs +954 -0
- package/dist/gpt-live.d.cts +261 -0
- package/dist/gpt-live.d.mts +261 -0
- package/dist/gpt-live.mjs +936 -0
- package/dist/index.cjs +116 -19
- package/dist/index.d.cts +7 -3
- package/dist/index.d.mts +7 -3
- package/dist/index.mjs +116 -19
- package/dist/openai.cjs +2 -2
- package/dist/openai.d.cts +1 -1
- package/dist/openai.d.mts +1 -1
- package/dist/openai.mjs +2 -2
- package/dist/{rest-BYqiVOhe.mjs → rest-D-DWWVIj.mjs} +1 -1
- package/dist/{rest-BvUKut_k.cjs → rest-OR4VhEif.cjs} +1 -1
- package/dist/{session-config-CbifLlkV.mjs → session-config-C31WZESg.mjs} +1 -1
- package/dist/{session-config-CqJm2Kxz.cjs → session-config-CYjxBqpF.cjs} +1 -1
- package/dist/store.d.cts +1 -1
- package/dist/store.d.mts +1 -1
- package/dist/testing.cjs +376 -0
- package/dist/testing.d.cts +119 -2
- package/dist/testing.d.mts +119 -2
- package/dist/testing.mjs +374 -2
- package/dist/twilio.cjs +1 -1
- package/dist/twilio.mjs +1 -1
- package/dist/xai.cjs +3 -3
- package/dist/xai.d.cts +1 -1
- package/dist/xai.d.mts +1 -1
- package/dist/xai.mjs +3 -3
- package/package.json +14 -2
package/dist/testing.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as base64ByteLength } from "./mulaw--cwU2c9L.mjs";
|
|
1
|
+
import { i as base64ByteLength, l as pcm16ToMulaw } from "./mulaw--cwU2c9L.mjs";
|
|
2
2
|
import { WebSocketServer } from "ws";
|
|
3
3
|
import { setTimeout } from "node:timers/promises";
|
|
4
4
|
//#region src/testing/FakeTwilioMediaStream.ts
|
|
@@ -562,4 +562,376 @@ var FakeGeminiLive = class {
|
|
|
562
562
|
}
|
|
563
563
|
};
|
|
564
564
|
//#endregion
|
|
565
|
-
|
|
565
|
+
//#region src/testing/FakeGptLiveServer.ts
|
|
566
|
+
let sessionCounter = 0;
|
|
567
|
+
let callCounter = 0;
|
|
568
|
+
/** `ms` of base64 μ-law digital silence, in 100 ms deltas like the real stream. */
|
|
569
|
+
function mulawSilenceDeltas(ms) {
|
|
570
|
+
const deltas = [];
|
|
571
|
+
for (let sent = 0; sent < ms; sent += 100) {
|
|
572
|
+
const len = Math.min(100, ms - sent) * 8;
|
|
573
|
+
deltas.push(Buffer.alloc(len, 255).toString("base64"));
|
|
574
|
+
}
|
|
575
|
+
return deltas;
|
|
576
|
+
}
|
|
577
|
+
/** `ms` of a 440 Hz tone at ≈ −20 dBFS as one base64 μ-law delta (reads as speech to the gate). */
|
|
578
|
+
function mulawToneBase64(ms, amplitude = 3200) {
|
|
579
|
+
const samples = ms * 8;
|
|
580
|
+
const pcm = new Int16Array(samples);
|
|
581
|
+
for (let i = 0; i < samples; i++) pcm[i] = Math.round(amplitude * Math.sin(2 * Math.PI * 440 * i / 8e3));
|
|
582
|
+
return Buffer.from(pcm16ToMulaw(pcm)).toString("base64");
|
|
583
|
+
}
|
|
584
|
+
var FakeGptLiveConnection = class {
|
|
585
|
+
socket;
|
|
586
|
+
/** Every parsed client → server frame, in order. */
|
|
587
|
+
received = [];
|
|
588
|
+
upgradeHeaders;
|
|
589
|
+
/** The resolved session sent back in `session.started`. */
|
|
590
|
+
session = null;
|
|
591
|
+
/** Running session-timeline position for scripted speech / transcripts. */
|
|
592
|
+
timelineMs = 0;
|
|
593
|
+
server;
|
|
594
|
+
constructor(server, socket, upgradeHeaders = {}) {
|
|
595
|
+
this.server = server;
|
|
596
|
+
this.socket = socket;
|
|
597
|
+
this.upgradeHeaders = upgradeHeaders;
|
|
598
|
+
}
|
|
599
|
+
/** The `session` object of the client's `session.start`, once received. */
|
|
600
|
+
get startFrame() {
|
|
601
|
+
return this.received.find((f) => f.type === "session.start");
|
|
602
|
+
}
|
|
603
|
+
/** Base64 payloads from `session.input_audio.append` frames. */
|
|
604
|
+
get appendedAudio() {
|
|
605
|
+
return this.received.filter((f) => f.type === "session.input_audio.append").map((f) => f.audio);
|
|
606
|
+
}
|
|
607
|
+
/** Text appends (instructions / thinking / commentary), in order. */
|
|
608
|
+
get appends() {
|
|
609
|
+
return this.received.filter((f) => /^session\.(instructions|thinking|commentary)\.append$/.test(f.type)).map((f) => ({
|
|
610
|
+
type: f.type,
|
|
611
|
+
content: f.content,
|
|
612
|
+
delegation_id: f.delegation_id ?? null
|
|
613
|
+
}));
|
|
614
|
+
}
|
|
615
|
+
eventsOfType(type) {
|
|
616
|
+
return this.received.filter((f) => f.type === type);
|
|
617
|
+
}
|
|
618
|
+
async waitForEvent(predicate, timeoutMs = 2e3) {
|
|
619
|
+
const matches = typeof predicate === "string" ? (frame) => frame.type === predicate : predicate;
|
|
620
|
+
const deadline = Date.now() + timeoutMs;
|
|
621
|
+
let seen = 0;
|
|
622
|
+
while (Date.now() < deadline) {
|
|
623
|
+
for (; seen < this.received.length; seen++) {
|
|
624
|
+
const frame = this.received[seen];
|
|
625
|
+
if (matches(frame)) return frame;
|
|
626
|
+
}
|
|
627
|
+
await setTimeout(5);
|
|
628
|
+
}
|
|
629
|
+
throw new Error(`timed out waiting for client event; got: ${this.received.map((f) => f.type).join(", ")}`);
|
|
630
|
+
}
|
|
631
|
+
send(frame) {
|
|
632
|
+
if (this.socket.readyState === this.socket.OPEN) this.socket.send(JSON.stringify(frame));
|
|
633
|
+
}
|
|
634
|
+
/** Stream one utterance: speech chunks, then silence that closes the gate, then its transcript. */
|
|
635
|
+
sendSpeech(options) {
|
|
636
|
+
const startMs = options.startMs ?? this.timelineMs;
|
|
637
|
+
let cursor = startMs;
|
|
638
|
+
for (const chunk of options.chunks) {
|
|
639
|
+
this.send({
|
|
640
|
+
type: "session.output_audio.delta",
|
|
641
|
+
event_id: `evt_${Date.now()}`,
|
|
642
|
+
delta: chunk
|
|
643
|
+
});
|
|
644
|
+
cursor += Buffer.from(chunk, "base64").length / 8 | 0;
|
|
645
|
+
}
|
|
646
|
+
const endMs = cursor;
|
|
647
|
+
for (const chunk of mulawSilenceDeltas(options.silenceMs ?? 1e3)) this.send({
|
|
648
|
+
type: "session.output_audio.delta",
|
|
649
|
+
event_id: `evt_${Date.now()}`,
|
|
650
|
+
delta: chunk
|
|
651
|
+
});
|
|
652
|
+
this.timelineMs = cursor + (options.silenceMs ?? 1e3);
|
|
653
|
+
if (options.transcript) this.sendOutputTranscript(options.transcript, {
|
|
654
|
+
startMs,
|
|
655
|
+
endMs
|
|
656
|
+
});
|
|
657
|
+
return {
|
|
658
|
+
startMs,
|
|
659
|
+
endMs
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
/** Continuous idle output: `ms` of digital silence (what the real stream sends while quiet). */
|
|
663
|
+
sendSilence(ms) {
|
|
664
|
+
for (const chunk of mulawSilenceDeltas(ms)) this.send({
|
|
665
|
+
type: "session.output_audio.delta",
|
|
666
|
+
event_id: `evt_${Date.now()}`,
|
|
667
|
+
delta: chunk
|
|
668
|
+
});
|
|
669
|
+
this.timelineMs += ms;
|
|
670
|
+
}
|
|
671
|
+
/** Caller transcript, one fragment per word across [startMs, endMs] on the session timeline. */
|
|
672
|
+
sendInputTranscript(text, range = {}) {
|
|
673
|
+
this.sendFragments("session.input_transcript.delta", text, range);
|
|
674
|
+
}
|
|
675
|
+
sendOutputTranscript(text, range = {}) {
|
|
676
|
+
this.sendFragments("session.output_transcript.delta", text, range);
|
|
677
|
+
}
|
|
678
|
+
/** A backend function call: delegation created, then the call in a `response.event` envelope. */
|
|
679
|
+
sendFunctionCall(options) {
|
|
680
|
+
const callId = options.callId ?? `call_${++callCounter}`;
|
|
681
|
+
const delegationId = options.delegationId ?? `item_${callCounter}`;
|
|
682
|
+
this.send({
|
|
683
|
+
type: "session.delegation.created",
|
|
684
|
+
event_id: `evt_${Date.now()}`,
|
|
685
|
+
offset_ms: this.timelineMs,
|
|
686
|
+
delegation: {
|
|
687
|
+
id: delegationId,
|
|
688
|
+
type: "delegation",
|
|
689
|
+
target: "responses",
|
|
690
|
+
response_id: `resp_${callCounter}`
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
this.send({
|
|
694
|
+
type: "response.event",
|
|
695
|
+
event_id: `evt_${Date.now()}`,
|
|
696
|
+
delegation_id: delegationId,
|
|
697
|
+
event: {
|
|
698
|
+
type: "response.output_item.done",
|
|
699
|
+
output_index: 0,
|
|
700
|
+
item: {
|
|
701
|
+
type: "function_call",
|
|
702
|
+
id: `fc_${callCounter}`,
|
|
703
|
+
call_id: callId,
|
|
704
|
+
name: options.name,
|
|
705
|
+
arguments: options.argumentsJson ?? "{}",
|
|
706
|
+
status: "completed"
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
return callId;
|
|
711
|
+
}
|
|
712
|
+
/** The backend finished a response (carries token usage). */
|
|
713
|
+
sendBackendCompleted(options = {}) {
|
|
714
|
+
this.send({
|
|
715
|
+
type: "response.event",
|
|
716
|
+
event_id: `evt_${Date.now()}`,
|
|
717
|
+
delegation_id: options.delegationId ?? null,
|
|
718
|
+
event: {
|
|
719
|
+
type: "response.completed",
|
|
720
|
+
response: {
|
|
721
|
+
id: `resp_${Date.now()}`,
|
|
722
|
+
status: "completed",
|
|
723
|
+
usage: options.usage ?? {
|
|
724
|
+
input_tokens: 100,
|
|
725
|
+
output_tokens: 10,
|
|
726
|
+
total_tokens: 110
|
|
727
|
+
},
|
|
728
|
+
output: options.text ? [{
|
|
729
|
+
type: "message",
|
|
730
|
+
content: [{
|
|
731
|
+
type: "output_text",
|
|
732
|
+
text: options.text
|
|
733
|
+
}]
|
|
734
|
+
}] : []
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
/** Cumulative session seconds, like the real 15 s ticks. */
|
|
740
|
+
sendUsage(seconds, contextRatio = .01) {
|
|
741
|
+
this.send({
|
|
742
|
+
type: "session.usage.updated",
|
|
743
|
+
event_id: `evt_${Date.now()}`,
|
|
744
|
+
usage: { seconds },
|
|
745
|
+
context_window: { usage_ratio: contextRatio }
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
sendError(error) {
|
|
749
|
+
this.send({
|
|
750
|
+
type: "error",
|
|
751
|
+
event_id: `evt_${Date.now()}`,
|
|
752
|
+
error
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
/** Server-side session end (`expired`, `content`…): session.closed then the socket. */
|
|
756
|
+
closeSession(reason, usageSeconds = 0) {
|
|
757
|
+
this.send({
|
|
758
|
+
type: "session.closed",
|
|
759
|
+
event_id: `evt_${Date.now()}`,
|
|
760
|
+
reason,
|
|
761
|
+
usage: { seconds: usageSeconds },
|
|
762
|
+
session: this.session
|
|
763
|
+
});
|
|
764
|
+
this.socket.close(1e3, reason);
|
|
765
|
+
}
|
|
766
|
+
drop(code = 1011, reason = "fake server drop") {
|
|
767
|
+
this.socket.close(code, reason);
|
|
768
|
+
}
|
|
769
|
+
sendFragments(type, text, range) {
|
|
770
|
+
const words = text.split(/(\s+)/).filter((w) => w.length > 0);
|
|
771
|
+
const startMs = range.startMs ?? this.timelineMs;
|
|
772
|
+
const endMs = range.endMs ?? startMs + Math.max(200, words.length * 200);
|
|
773
|
+
const step = words.length > 0 ? (endMs - startMs) / words.length : 0;
|
|
774
|
+
words.forEach((word, index) => {
|
|
775
|
+
const s = Math.round(startMs + index * step);
|
|
776
|
+
const e = Math.round(index === words.length - 1 ? endMs : startMs + (index + 1) * step);
|
|
777
|
+
this.send({
|
|
778
|
+
type,
|
|
779
|
+
event_id: `evt_${Date.now()}_${index}`,
|
|
780
|
+
delta: word,
|
|
781
|
+
start_ms: s,
|
|
782
|
+
end_ms: e
|
|
783
|
+
});
|
|
784
|
+
});
|
|
785
|
+
if (range.startMs === void 0) this.timelineMs = Math.max(this.timelineMs, endMs);
|
|
786
|
+
}
|
|
787
|
+
/** @internal server plumbing */
|
|
788
|
+
handleClientFrame(frame) {
|
|
789
|
+
this.received.push(frame);
|
|
790
|
+
const options = this.server.options;
|
|
791
|
+
if (frame.type === "session.start") {
|
|
792
|
+
if (options.rejectStart) {
|
|
793
|
+
this.send({
|
|
794
|
+
type: "error",
|
|
795
|
+
event_id: `evt_${Date.now()}`,
|
|
796
|
+
error: {
|
|
797
|
+
type: "invalid_request_error",
|
|
798
|
+
...options.rejectStart,
|
|
799
|
+
client_event_id: frame.event_id
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
this.session = {
|
|
805
|
+
id: `live_fake_${++sessionCounter}`,
|
|
806
|
+
expires_at: Math.floor(Date.now() / 1e3) + (options.sessionTtlSeconds ?? 7200),
|
|
807
|
+
...frame.session
|
|
808
|
+
};
|
|
809
|
+
this.send({
|
|
810
|
+
type: "session.started",
|
|
811
|
+
event_id: `evt_${Date.now()}`,
|
|
812
|
+
client_event_id: frame.event_id,
|
|
813
|
+
session: this.session
|
|
814
|
+
});
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
if (frame.type === "session.close") {
|
|
818
|
+
this.send({
|
|
819
|
+
type: "session.closed",
|
|
820
|
+
event_id: `evt_${Date.now()}`,
|
|
821
|
+
client_event_id: frame.event_id,
|
|
822
|
+
reason: "close_requested",
|
|
823
|
+
usage: { seconds: Math.round(this.timelineMs / 1e3) },
|
|
824
|
+
session: this.session
|
|
825
|
+
});
|
|
826
|
+
this.socket.close(1e3, "close_requested");
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
if (options.autoAck === false) return;
|
|
830
|
+
const ackType = {
|
|
831
|
+
"session.instructions.append": "session.instructions.appended",
|
|
832
|
+
"session.thinking.append": "session.thinking.appended",
|
|
833
|
+
"session.commentary.append": "session.commentary.appended",
|
|
834
|
+
"session.update": "session.updated",
|
|
835
|
+
"session.input_audio.mute": "session.input_audio.muted",
|
|
836
|
+
"session.input_audio.unmute": "session.input_audio.unmuted"
|
|
837
|
+
}[frame.type];
|
|
838
|
+
if (!ackType) return;
|
|
839
|
+
const ack = {
|
|
840
|
+
type: ackType,
|
|
841
|
+
event_id: `evt_${Date.now()}`,
|
|
842
|
+
client_event_id: frame.event_id
|
|
843
|
+
};
|
|
844
|
+
if (ackType.endsWith("appended")) {
|
|
845
|
+
ack.start_ms = this.timelineMs;
|
|
846
|
+
ack.end_ms = this.timelineMs + 200;
|
|
847
|
+
}
|
|
848
|
+
if (ackType === "session.updated") ack.session = {
|
|
849
|
+
...this.session,
|
|
850
|
+
...frame.session
|
|
851
|
+
};
|
|
852
|
+
this.send(ack);
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
var FakeGptLiveServer = class FakeGptLiveServer {
|
|
856
|
+
connections = [];
|
|
857
|
+
refuseConnections;
|
|
858
|
+
refusedConnections = 0;
|
|
859
|
+
rejectUpgrade;
|
|
860
|
+
rejectedUpgrades = 0;
|
|
861
|
+
url;
|
|
862
|
+
/** @internal */
|
|
863
|
+
options;
|
|
864
|
+
wss;
|
|
865
|
+
constructor(wss, url, options) {
|
|
866
|
+
this.wss = wss;
|
|
867
|
+
this.url = url;
|
|
868
|
+
this.options = options;
|
|
869
|
+
this.refuseConnections = options.refuseConnections ?? false;
|
|
870
|
+
this.rejectUpgrade = options.rejectUpgrade ?? null;
|
|
871
|
+
wss.on("connection", (socket, request) => {
|
|
872
|
+
if (this.refuseConnections) {
|
|
873
|
+
this.refusedConnections++;
|
|
874
|
+
socket.close(1011, "fake server refusing sessions");
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
const connection = new FakeGptLiveConnection(this, socket, request.headers);
|
|
878
|
+
this.connections.push(connection);
|
|
879
|
+
socket.on("message", (raw) => {
|
|
880
|
+
let frame;
|
|
881
|
+
try {
|
|
882
|
+
frame = JSON.parse(raw.toString());
|
|
883
|
+
} catch {
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
connection.handleClientFrame(frame);
|
|
887
|
+
});
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
static async start(options = {}) {
|
|
891
|
+
const holder = {};
|
|
892
|
+
const wss = new WebSocketServer({
|
|
893
|
+
port: 0,
|
|
894
|
+
host: "127.0.0.1",
|
|
895
|
+
verifyClient: (_info, done) => {
|
|
896
|
+
const reject = holder.server?.rejectUpgrade;
|
|
897
|
+
if (reject) {
|
|
898
|
+
holder.server.rejectedUpgrades++;
|
|
899
|
+
done(false, reject.status, reject.body ?? "rejected by fake server");
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
done(true);
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
await new Promise((resolve, reject) => {
|
|
906
|
+
wss.once("listening", resolve);
|
|
907
|
+
wss.once("error", reject);
|
|
908
|
+
});
|
|
909
|
+
const address = wss.address();
|
|
910
|
+
if (typeof address === "string" || address === null) throw new Error("no server address");
|
|
911
|
+
const server = new FakeGptLiveServer(wss, `ws://127.0.0.1:${address.port}`, options);
|
|
912
|
+
holder.server = server;
|
|
913
|
+
return server;
|
|
914
|
+
}
|
|
915
|
+
get latest() {
|
|
916
|
+
const connection = this.connections[this.connections.length - 1];
|
|
917
|
+
if (!connection) throw new Error("no connections yet");
|
|
918
|
+
return connection;
|
|
919
|
+
}
|
|
920
|
+
async waitForConnection(timeoutMs = 2e3) {
|
|
921
|
+
const count = this.connections.length;
|
|
922
|
+
const deadline = Date.now() + timeoutMs;
|
|
923
|
+
while (Date.now() < deadline) {
|
|
924
|
+
if (this.connections.length > count) return this.connections[this.connections.length - 1];
|
|
925
|
+
await setTimeout(5);
|
|
926
|
+
}
|
|
927
|
+
throw new Error("timed out waiting for a provider connection");
|
|
928
|
+
}
|
|
929
|
+
async close() {
|
|
930
|
+
for (const connection of this.connections) try {
|
|
931
|
+
connection.socket.terminate();
|
|
932
|
+
} catch {}
|
|
933
|
+
await new Promise((resolve) => this.wss.close(() => resolve()));
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
//#endregion
|
|
937
|
+
export { FakeGeminiLive, FakeGeminiSession, FakeGptLiveConnection, FakeGptLiveServer, FakeOpenAIConnection, FakeOpenAIServer, FakeTwilioMediaStream, mulawSilenceBase64, mulawSilenceDeltas, mulawToneBase64 };
|
package/dist/twilio.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rest = require("./rest-
|
|
2
|
+
const require_rest = require("./rest-OR4VhEif.cjs");
|
|
3
3
|
exports.TwilioMediaTransport = require_rest.TwilioMediaTransport;
|
|
4
4
|
exports.TwilioRestClient = require_rest.TwilioRestClient;
|
|
5
5
|
exports.assertValidPhoneNumber = require_rest.assertValidPhoneNumber;
|
package/dist/twilio.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TwilioMediaTransport, i as escapeXml, n as assertValidPhoneNumber, o as parseTwilioMessage, r as connectStreamTwiml, t as TwilioRestClient } from "./rest-
|
|
1
|
+
import { a as TwilioMediaTransport, i as escapeXml, n as assertValidPhoneNumber, o as parseTwilioMessage, r as connectStreamTwiml, t as TwilioRestClient } from "./rest-D-DWWVIj.mjs";
|
|
2
2
|
export { TwilioMediaTransport, TwilioRestClient, assertValidPhoneNumber, connectStreamTwiml, escapeXml, parseTwilioMessage };
|
package/dist/xai.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_BaseRealtimeProvider = require("./BaseRealtimeProvider-
|
|
3
|
-
const require_session_config = require("./session-config-
|
|
2
|
+
const require_BaseRealtimeProvider = require("./BaseRealtimeProvider-ZfFzijdr.cjs");
|
|
3
|
+
const require_session_config = require("./session-config-CYjxBqpF.cjs");
|
|
4
4
|
const require_env = require("./env-DSnGaERV.cjs");
|
|
5
|
-
const require_OpenAICompatibleProvider = require("./OpenAICompatibleProvider-
|
|
5
|
+
const require_OpenAICompatibleProvider = require("./OpenAICompatibleProvider-j2Nza2q2.cjs");
|
|
6
6
|
//#region src/xai.ts
|
|
7
7
|
/**
|
|
8
8
|
* xAI Grok Voice Agent provider — `realtime-voice-agents/xai`.
|
package/dist/xai.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as ProviderSessionInit, n as ProviderFactory, u as VadConfig } from "./BaseRealtimeProvider-CO9N8jt-.cjs";
|
|
2
2
|
//#region src/xai.d.ts
|
|
3
3
|
declare const XAI_BASE_URL = "wss://api.x.ai/v1/realtime";
|
|
4
4
|
/** Env vars checked (in order) when no explicit apiKey is passed. */
|
package/dist/xai.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as ProviderSessionInit, n as ProviderFactory, u as VadConfig } from "./BaseRealtimeProvider-BJQO-hpu.mjs";
|
|
2
2
|
//#region src/xai.d.ts
|
|
3
3
|
declare const XAI_BASE_URL = "wss://api.x.ai/v1/realtime";
|
|
4
4
|
/** Env vars checked (in order) when no explicit apiKey is passed. */
|
package/dist/xai.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as deepMerge } from "./BaseRealtimeProvider-
|
|
2
|
-
import { n as buildTurnDetection } from "./session-config-
|
|
1
|
+
import { n as deepMerge } from "./BaseRealtimeProvider-Cj6JWR2k.mjs";
|
|
2
|
+
import { n as buildTurnDetection } from "./session-config-C31WZESg.mjs";
|
|
3
3
|
import { t as resolveApiKey } from "./env-DUwUWTsg.mjs";
|
|
4
|
-
import { t as OpenAICompatibleProvider } from "./OpenAICompatibleProvider-
|
|
4
|
+
import { t as OpenAICompatibleProvider } from "./OpenAICompatibleProvider-Dqje-boq.mjs";
|
|
5
5
|
//#region src/xai.ts
|
|
6
6
|
/**
|
|
7
7
|
* xAI Grok Voice Agent provider — `realtime-voice-agents/xai`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "realtime-voice-agents",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Provider-agnostic bridge between Twilio Media Streams and realtime speech-to-speech AI APIs (OpenAI Realtime, xAI Grok Voice, Gemini Live). Multi-agent handoffs, Zod tools with execution strategies, mark-based playback tracking, interruption guards, and hold audio — for Node.js voice agents over the phone.",
|
|
3
|
+
"version": "2.5.0",
|
|
4
|
+
"description": "Provider-agnostic bridge between Twilio Media Streams and realtime speech-to-speech AI APIs (OpenAI Realtime, OpenAI GPT-Live full-duplex, xAI Grok Voice, Gemini Live). Multi-agent handoffs, Zod tools with execution strategies, mark-based playback tracking, interruption guards, and hold audio — for Node.js voice agents over the phone.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"twilio",
|
|
7
7
|
"twilio-media-streams",
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
"speech-to-speech",
|
|
14
14
|
"openai",
|
|
15
15
|
"openai-realtime",
|
|
16
|
+
"full-duplex",
|
|
17
|
+
"gpt-live",
|
|
16
18
|
"gemini",
|
|
17
19
|
"gemini-live",
|
|
18
20
|
"xai",
|
|
@@ -77,6 +79,16 @@
|
|
|
77
79
|
"default": "./dist/gemini.cjs"
|
|
78
80
|
}
|
|
79
81
|
},
|
|
82
|
+
"./gpt-live": {
|
|
83
|
+
"import": {
|
|
84
|
+
"types": "./dist/gpt-live.d.mts",
|
|
85
|
+
"default": "./dist/gpt-live.mjs"
|
|
86
|
+
},
|
|
87
|
+
"require": {
|
|
88
|
+
"types": "./dist/gpt-live.d.cts",
|
|
89
|
+
"default": "./dist/gpt-live.cjs"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
80
92
|
"./twilio": {
|
|
81
93
|
"import": {
|
|
82
94
|
"types": "./dist/twilio.d.mts",
|