@absolutejs/voice 0.0.22-beta.662 → 0.0.22-beta.663
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/core/types.d.ts +7 -0
- package/dist/index.js +13 -0
- package/dist/testing/index.js +1 -0
- package/package.json +1 -1
package/dist/core/types.d.ts
CHANGED
|
@@ -905,6 +905,10 @@ export type VoicePluginConfig<TContext = unknown, TSession extends VoiceSessionR
|
|
|
905
905
|
}) => string | Promise<string>);
|
|
906
906
|
stuckCallClose?: {
|
|
907
907
|
afterMs: number;
|
|
908
|
+
/** Whether this fault-driven close invokes the route completion hook.
|
|
909
|
+
* Defaults to true for backward compatibility. Set false when an
|
|
910
|
+
* interrupted conversation must remain resumable. */
|
|
911
|
+
invokeOnComplete?: boolean;
|
|
908
912
|
line?: string | ((input: {
|
|
909
913
|
session: TSession;
|
|
910
914
|
}) => string | Promise<string>);
|
|
@@ -1091,6 +1095,9 @@ export type CreateVoiceSessionOptions<TContext = unknown, TSession extends Voice
|
|
|
1091
1095
|
* assistant's own speech, so STT recovery re-prompts can't defer it forever. */
|
|
1092
1096
|
stuckCallClose?: {
|
|
1093
1097
|
afterMs: number;
|
|
1098
|
+
/** Whether this fault-driven close invokes the route completion hook.
|
|
1099
|
+
* Defaults to true for backward compatibility. */
|
|
1100
|
+
invokeOnComplete?: boolean;
|
|
1094
1101
|
line?: string | ((input: {
|
|
1095
1102
|
session: TSession;
|
|
1096
1103
|
}) => string | Promise<string>);
|
package/dist/index.js
CHANGED
|
@@ -4452,6 +4452,7 @@ var createVoiceSession = (options) => {
|
|
|
4452
4452
|
}
|
|
4453
4453
|
await completeInternal(undefined, {
|
|
4454
4454
|
disposition: "completed",
|
|
4455
|
+
invokeOnComplete: stuckCloseConfig?.invokeOnComplete,
|
|
4455
4456
|
reason: stuckCloseConfig?.reason ?? "stuck-call-close"
|
|
4456
4457
|
});
|
|
4457
4458
|
});
|
|
@@ -40713,6 +40714,18 @@ var voice = (config) => {
|
|
|
40713
40714
|
if (message.action === "resume") {
|
|
40714
40715
|
await current.resume();
|
|
40715
40716
|
}
|
|
40717
|
+
if (message.action === "pause" || message.action === "resume") {
|
|
40718
|
+
const snapshot = await current.snapshot();
|
|
40719
|
+
ws.send(JSON.stringify({
|
|
40720
|
+
pauseExpiresAt: snapshot.pause?.expiresAt,
|
|
40721
|
+
paused: Boolean(snapshot.pause),
|
|
40722
|
+
sessionId: snapshot.id,
|
|
40723
|
+
status: snapshot.status,
|
|
40724
|
+
sessionMetadata: snapshot.metadata,
|
|
40725
|
+
scenarioId: snapshot.scenarioId,
|
|
40726
|
+
type: "session"
|
|
40727
|
+
}));
|
|
40728
|
+
}
|
|
40716
40729
|
acknowledge(true);
|
|
40717
40730
|
} catch (error) {
|
|
40718
40731
|
acknowledge(false, error instanceof Error ? error.message : String(error));
|
package/dist/testing/index.js
CHANGED
|
@@ -7404,6 +7404,7 @@ var createVoiceSession = (options) => {
|
|
|
7404
7404
|
}
|
|
7405
7405
|
await completeInternal(undefined, {
|
|
7406
7406
|
disposition: "completed",
|
|
7407
|
+
invokeOnComplete: stuckCloseConfig?.invokeOnComplete,
|
|
7407
7408
|
reason: stuckCloseConfig?.reason ?? "stuck-call-close"
|
|
7408
7409
|
});
|
|
7409
7410
|
});
|