@voicelayer/sdk 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -9
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -10858,25 +10858,32 @@ function resolveRoute(config, key) {
|
|
|
10858
10858
|
if (!config) return void 0;
|
|
10859
10859
|
return config.routes?.[key] ?? config.fallback;
|
|
10860
10860
|
}
|
|
10861
|
-
async function
|
|
10861
|
+
async function sayFixed(deps, text) {
|
|
10862
10862
|
try {
|
|
10863
|
-
|
|
10863
|
+
const session = deps.session;
|
|
10864
|
+
const handle = session.say?.(text, { allowInterruptions: false });
|
|
10865
|
+
if (handle?.waitForPlayout) await handle.waitForPlayout();
|
|
10864
10866
|
} catch (err) {
|
|
10865
10867
|
console.warn("[handoff] announcement failed", err);
|
|
10866
10868
|
}
|
|
10867
10869
|
}
|
|
10870
|
+
async function quiesce(deps) {
|
|
10871
|
+
try {
|
|
10872
|
+
await deps.session.interrupt?.();
|
|
10873
|
+
} catch {
|
|
10874
|
+
}
|
|
10875
|
+
}
|
|
10868
10876
|
async function executeHandoff(args, config, deps) {
|
|
10869
10877
|
const briefing = args.briefing ?? await buildBriefing(config, deps) ?? `Handoff to ${args.to}`;
|
|
10870
10878
|
const mode = args.mode ?? config?.mode ?? "warm";
|
|
10871
10879
|
const sipOps = deps.sipOps ?? buildDefaultSipOps();
|
|
10872
10880
|
if (mode === "warm" && sipOps && sipOps.canConference) {
|
|
10873
10881
|
try {
|
|
10874
|
-
await
|
|
10882
|
+
await sayFixed(deps, "One moment \u2014 I'm bringing our on-call engineer onto the line now. Stay with me.");
|
|
10875
10883
|
await sipOps.addParticipant(deps.roomName, normalizeSipTarget(args.to));
|
|
10876
|
-
await
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
);
|
|
10884
|
+
await sayFixed(deps, briefing);
|
|
10885
|
+
await sayFixed(deps, "You're both connected now \u2014 I'll drop off.");
|
|
10886
|
+
await quiesce(deps);
|
|
10880
10887
|
await deps.disconnect();
|
|
10881
10888
|
return { ok: true, via: "conference", target: args.to };
|
|
10882
10889
|
} catch (err) {
|
|
@@ -10885,7 +10892,7 @@ async function executeHandoff(args, config, deps) {
|
|
|
10885
10892
|
}
|
|
10886
10893
|
if (sipOps) {
|
|
10887
10894
|
if (mode === "warm") {
|
|
10888
|
-
await
|
|
10895
|
+
await sayFixed(deps, "I'm transferring you now \u2014 one moment.");
|
|
10889
10896
|
}
|
|
10890
10897
|
try {
|
|
10891
10898
|
await sipOps.refer(deps.roomName, deps.callerIdentity, normalizeSipTarget(args.to));
|
|
@@ -10935,7 +10942,8 @@ function buildDefaultSipOps() {
|
|
|
10935
10942
|
const identity = `xfer-${target.replace(/[^0-9+]/g, "")}`;
|
|
10936
10943
|
await client.createSipParticipant(trunkId, target.replace(/^tel:/, ""), roomName, {
|
|
10937
10944
|
participantIdentity: identity,
|
|
10938
|
-
playDialtone: false
|
|
10945
|
+
playDialtone: false,
|
|
10946
|
+
waitUntilAnswered: true
|
|
10939
10947
|
});
|
|
10940
10948
|
return { identity };
|
|
10941
10949
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voicelayer/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Official SDK for VoiceLayer — define, run, and orchestrate voice AI agents on the VoiceLayer control plane.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "VoiceLayer",
|
|
@@ -79,16 +79,16 @@
|
|
|
79
79
|
"tsup": "^8.5.1",
|
|
80
80
|
"typescript": "^5.6.0",
|
|
81
81
|
"vitest": "^4.1.5",
|
|
82
|
-
"@voicelayer/contracts": "0.1.0",
|
|
83
82
|
"@voicelayer/observability": "0.1.0",
|
|
84
83
|
"@voicelayer/primitive-audio-experience": "0.1.0",
|
|
85
|
-
"@voicelayer/
|
|
84
|
+
"@voicelayer/contracts": "0.1.0",
|
|
86
85
|
"@voicelayer/primitive-audio-routing": "0.1.0",
|
|
86
|
+
"@voicelayer/primitive-process-schema": "0.1.0",
|
|
87
|
+
"@voicelayer/primitive-security": "0.1.0",
|
|
87
88
|
"@voicelayer/agents-plugin-deepgram": "1.0.0",
|
|
88
89
|
"@voicelayer/agents-plugin-livekit": "1.0.0",
|
|
89
|
-
"@voicelayer/
|
|
90
|
-
"@voicelayer/agents-plugin-openai": "1.0.0"
|
|
91
|
-
"@voicelayer/agents-plugin-silero": "1.0.0"
|
|
90
|
+
"@voicelayer/agents-plugin-silero": "1.0.0",
|
|
91
|
+
"@voicelayer/agents-plugin-openai": "1.0.0"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"typecheck": "tsc -b --pretty false",
|