@absolutejs/voice 0.0.22-beta.204 → 0.0.22-beta.206
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 +398 -1
- package/dist/angular/index.d.ts +1 -0
- package/dist/angular/index.js +150 -31
- package/dist/angular/voice-agent-squad-status.service.d.ts +12 -0
- package/dist/client/agentSquadStatus.d.ts +37 -0
- package/dist/client/agentSquadStatusWidget.d.ts +24 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.js +170 -0
- package/dist/index.js +46 -7
- package/dist/phoneAgent.d.ts +14 -0
- package/dist/react/VoiceAgentSquadStatus.d.ts +5 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +349 -97
- package/dist/react/useVoiceAgentSquadStatus.d.ts +8 -0
- package/dist/svelte/createVoiceAgentSquadStatus.d.ts +9 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +211 -33
- package/dist/traceTimeline.d.ts +1 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +255 -145
- package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -2803,9 +2803,259 @@ var VoiceTraceTimeline = ({
|
|
|
2803
2803
|
]
|
|
2804
2804
|
}, undefined, true, undefined, this);
|
|
2805
2805
|
};
|
|
2806
|
-
// src/react/
|
|
2806
|
+
// src/react/useVoiceAgentSquadStatus.tsx
|
|
2807
2807
|
import { useEffect as useEffect10, useRef as useRef10, useSyncExternalStore as useSyncExternalStore10 } from "react";
|
|
2808
2808
|
|
|
2809
|
+
// src/client/agentSquadStatus.ts
|
|
2810
|
+
var getString = (value) => typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
2811
|
+
var getPayloadString = (event, key) => getString(event.payload?.[key]);
|
|
2812
|
+
var eventStatus = (event) => {
|
|
2813
|
+
const status = getPayloadString(event, "status");
|
|
2814
|
+
if (status === "blocked")
|
|
2815
|
+
return "blocked";
|
|
2816
|
+
if (status === "unknown-target")
|
|
2817
|
+
return "unknown-target";
|
|
2818
|
+
if (status === "allowed")
|
|
2819
|
+
return "handoff";
|
|
2820
|
+
return event.type === "agent.result" ? "active" : "handoff";
|
|
2821
|
+
};
|
|
2822
|
+
var deriveSessionSpecialist = (session) => {
|
|
2823
|
+
const events = [...session.events].sort((left, right) => left.at - right.at);
|
|
2824
|
+
const agentEvents = events.filter((event) => event.type === "agent.handoff" || event.type === "agent.context" || event.type === "agent.result" || event.type === "agent.model");
|
|
2825
|
+
const latest = agentEvents.at(-1);
|
|
2826
|
+
if (!latest) {
|
|
2827
|
+
return {
|
|
2828
|
+
lastEventAt: session.lastEventAt,
|
|
2829
|
+
sessionId: session.sessionId,
|
|
2830
|
+
status: "idle"
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2833
|
+
const handoffEvents = events.filter((event) => event.type === "agent.handoff");
|
|
2834
|
+
const lastHandoff = handoffEvents.at(-1);
|
|
2835
|
+
const latestAgentId = getPayloadString(latest, "agentId");
|
|
2836
|
+
const handoffStatus = lastHandoff ? eventStatus(lastHandoff) : undefined;
|
|
2837
|
+
const currentTarget = handoffStatus === "blocked" || handoffStatus === "unknown-target" ? getPayloadString(lastHandoff, "fromAgentId") ?? latestAgentId : getPayloadString(lastHandoff ?? latest, "targetAgentId") ?? latestAgentId;
|
|
2838
|
+
return {
|
|
2839
|
+
fromAgentId: getPayloadString(lastHandoff ?? latest, "fromAgentId"),
|
|
2840
|
+
lastEventAt: latest.at,
|
|
2841
|
+
reason: getPayloadString(lastHandoff ?? latest, "reason") ?? getPayloadString(latest, "handoffTarget"),
|
|
2842
|
+
sessionId: session.sessionId,
|
|
2843
|
+
status: lastHandoff ? eventStatus(lastHandoff) : "active",
|
|
2844
|
+
summary: getPayloadString(lastHandoff ?? latest, "summary"),
|
|
2845
|
+
targetAgentId: currentTarget,
|
|
2846
|
+
turnId: latest.turnId
|
|
2847
|
+
};
|
|
2848
|
+
};
|
|
2849
|
+
var buildVoiceAgentSquadStatusReport = (timeline, options = {}) => {
|
|
2850
|
+
const sessions = (timeline?.sessions ?? []).filter((session) => !options.sessionId || session.sessionId === options.sessionId).map(deriveSessionSpecialist).sort((left, right) => (right.lastEventAt ?? 0) - (left.lastEventAt ?? 0));
|
|
2851
|
+
const active = sessions.filter((session) => session.status !== "idle");
|
|
2852
|
+
return {
|
|
2853
|
+
active,
|
|
2854
|
+
checkedAt: timeline?.checkedAt,
|
|
2855
|
+
current: active[0] ?? sessions[0],
|
|
2856
|
+
sessionCount: sessions.length,
|
|
2857
|
+
sessions
|
|
2858
|
+
};
|
|
2859
|
+
};
|
|
2860
|
+
var createVoiceAgentSquadStatusStore = (path = "/api/voice-traces", options = {}) => {
|
|
2861
|
+
const timelineStore = createVoiceTraceTimelineStore(path, options);
|
|
2862
|
+
const getReport = () => buildVoiceAgentSquadStatusReport(timelineStore.getSnapshot().report, {
|
|
2863
|
+
sessionId: options.sessionId
|
|
2864
|
+
});
|
|
2865
|
+
const getSnapshot = () => {
|
|
2866
|
+
const snapshot = timelineStore.getSnapshot();
|
|
2867
|
+
return {
|
|
2868
|
+
error: snapshot.error,
|
|
2869
|
+
isLoading: snapshot.isLoading,
|
|
2870
|
+
report: getReport(),
|
|
2871
|
+
updatedAt: snapshot.updatedAt
|
|
2872
|
+
};
|
|
2873
|
+
};
|
|
2874
|
+
return {
|
|
2875
|
+
close: timelineStore.close,
|
|
2876
|
+
getServerSnapshot: getSnapshot,
|
|
2877
|
+
getSnapshot,
|
|
2878
|
+
refresh: timelineStore.refresh,
|
|
2879
|
+
subscribe: timelineStore.subscribe
|
|
2880
|
+
};
|
|
2881
|
+
};
|
|
2882
|
+
|
|
2883
|
+
// src/react/useVoiceAgentSquadStatus.tsx
|
|
2884
|
+
var useVoiceAgentSquadStatus = (path = "/api/voice-traces", options = {}) => {
|
|
2885
|
+
const storeRef = useRef10(null);
|
|
2886
|
+
if (!storeRef.current) {
|
|
2887
|
+
storeRef.current = createVoiceAgentSquadStatusStore(path, options);
|
|
2888
|
+
}
|
|
2889
|
+
const store = storeRef.current;
|
|
2890
|
+
useEffect10(() => {
|
|
2891
|
+
store.refresh().catch(() => {});
|
|
2892
|
+
return () => store.close();
|
|
2893
|
+
}, [store]);
|
|
2894
|
+
return {
|
|
2895
|
+
...useSyncExternalStore10(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
2896
|
+
refresh: store.refresh
|
|
2897
|
+
};
|
|
2898
|
+
};
|
|
2899
|
+
|
|
2900
|
+
// src/client/agentSquadStatusWidget.ts
|
|
2901
|
+
var DEFAULT_TITLE9 = "Voice Agent Squad";
|
|
2902
|
+
var DEFAULT_DESCRIPTION9 = "Current specialist and recent handoffs from your self-hosted voice traces.";
|
|
2903
|
+
var escapeHtml10 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
2904
|
+
var labelFor = (current) => {
|
|
2905
|
+
if (!current)
|
|
2906
|
+
return "Waiting for specialist activity";
|
|
2907
|
+
if (current.status === "blocked")
|
|
2908
|
+
return "Handoff blocked";
|
|
2909
|
+
if (current.status === "unknown-target")
|
|
2910
|
+
return "Unknown specialist";
|
|
2911
|
+
if (current.targetAgentId)
|
|
2912
|
+
return `Current: ${current.targetAgentId}`;
|
|
2913
|
+
return "Specialist active";
|
|
2914
|
+
};
|
|
2915
|
+
var createVoiceAgentSquadStatusViewModel = (snapshot, options = {}) => ({
|
|
2916
|
+
current: snapshot.report.current,
|
|
2917
|
+
description: options.description ?? DEFAULT_DESCRIPTION9,
|
|
2918
|
+
error: snapshot.error,
|
|
2919
|
+
isLoading: snapshot.isLoading,
|
|
2920
|
+
label: snapshot.error ? "Unavailable" : labelFor(snapshot.report.current),
|
|
2921
|
+
sessionCount: snapshot.report.sessionCount,
|
|
2922
|
+
sessions: snapshot.report.sessions,
|
|
2923
|
+
title: options.title ?? DEFAULT_TITLE9,
|
|
2924
|
+
updatedAt: snapshot.updatedAt
|
|
2925
|
+
});
|
|
2926
|
+
var renderVoiceAgentSquadStatusHTML = (snapshot, options = {}) => {
|
|
2927
|
+
const model = createVoiceAgentSquadStatusViewModel(snapshot, options);
|
|
2928
|
+
const current = model.current;
|
|
2929
|
+
const rows = model.sessions.length ? model.sessions.slice(0, 5).map((session) => `<li>
|
|
2930
|
+
<span>${escapeHtml10(session.sessionId)}</span>
|
|
2931
|
+
<strong>${escapeHtml10(session.targetAgentId ?? "none")}</strong>
|
|
2932
|
+
<em>${escapeHtml10(session.status)}</em>
|
|
2933
|
+
${session.summary || session.reason ? `<p>${escapeHtml10(session.summary ?? session.reason ?? "")}</p>` : ""}
|
|
2934
|
+
</li>`).join("") : "<li><span>No squad traces yet.</span><strong>Waiting</strong></li>";
|
|
2935
|
+
return `<section class="absolute-voice-agent-squad-status">
|
|
2936
|
+
<header>
|
|
2937
|
+
<span>${escapeHtml10(model.title)}</span>
|
|
2938
|
+
<strong>${escapeHtml10(model.label)}</strong>
|
|
2939
|
+
</header>
|
|
2940
|
+
<p>${escapeHtml10(model.description)}</p>
|
|
2941
|
+
<div>
|
|
2942
|
+
<span>Session</span><strong>${escapeHtml10(current?.sessionId ?? "n/a")}</strong>
|
|
2943
|
+
<span>From</span><strong>${escapeHtml10(current?.fromAgentId ?? "n/a")}</strong>
|
|
2944
|
+
<span>Status</span><strong>${escapeHtml10(current?.status ?? "idle")}</strong>
|
|
2945
|
+
</div>
|
|
2946
|
+
<ul>${rows}</ul>
|
|
2947
|
+
${model.error ? `<p class="absolute-voice-agent-squad-status__error">${escapeHtml10(model.error)}</p>` : ""}
|
|
2948
|
+
</section>`;
|
|
2949
|
+
};
|
|
2950
|
+
var getVoiceAgentSquadStatusCSS = () => `.absolute-voice-agent-squad-status{border:1px solid #38bdf866;border-radius:20px;background:#0f172a;color:#f8fafc;padding:18px;font-family:inherit}.absolute-voice-agent-squad-status header{display:grid;gap:4px}.absolute-voice-agent-squad-status header span{color:#7dd3fc;font-size:12px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-agent-squad-status header strong{font-size:20px}.absolute-voice-agent-squad-status p{color:#cbd5e1}.absolute-voice-agent-squad-status div{display:grid;gap:6px;grid-template-columns:max-content 1fr;margin:14px 0}.absolute-voice-agent-squad-status div span{color:#94a3b8}.absolute-voice-agent-squad-status ul{display:grid;gap:8px;list-style:none;margin:0;padding:0}.absolute-voice-agent-squad-status li{background:#020617;border:1px solid #1e293b;border-radius:14px;padding:10px}.absolute-voice-agent-squad-status li span{color:#94a3b8;display:block;font-size:12px}.absolute-voice-agent-squad-status li strong{display:block}.absolute-voice-agent-squad-status li em{color:#7dd3fc;font-style:normal}.absolute-voice-agent-squad-status__error{color:#fecaca;font-weight:800}`;
|
|
2951
|
+
var mountVoiceAgentSquadStatus = (element, path = "/api/voice-traces", options = {}) => {
|
|
2952
|
+
if (!element) {
|
|
2953
|
+
throw new Error("mountVoiceAgentSquadStatus requires an element.");
|
|
2954
|
+
}
|
|
2955
|
+
const store = createVoiceAgentSquadStatusStore(path, options);
|
|
2956
|
+
const render = () => {
|
|
2957
|
+
element.innerHTML = `<style>${getVoiceAgentSquadStatusCSS()}</style>${renderVoiceAgentSquadStatusHTML(store.getSnapshot(), options)}`;
|
|
2958
|
+
};
|
|
2959
|
+
const unsubscribe = store.subscribe(render);
|
|
2960
|
+
render();
|
|
2961
|
+
store.refresh().catch(() => {});
|
|
2962
|
+
return {
|
|
2963
|
+
close: () => {
|
|
2964
|
+
unsubscribe();
|
|
2965
|
+
store.close();
|
|
2966
|
+
},
|
|
2967
|
+
refresh: store.refresh
|
|
2968
|
+
};
|
|
2969
|
+
};
|
|
2970
|
+
var defineVoiceAgentSquadStatusElement = (tagName = "absolute-voice-agent-squad-status", options = {}) => {
|
|
2971
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
2972
|
+
return;
|
|
2973
|
+
}
|
|
2974
|
+
customElements.define(tagName, class AbsoluteVoiceAgentSquadStatusElement extends HTMLElement {
|
|
2975
|
+
mounted;
|
|
2976
|
+
connectedCallback() {
|
|
2977
|
+
this.mounted = mountVoiceAgentSquadStatus(this, this.getAttribute("path") ?? "/api/voice-traces", {
|
|
2978
|
+
...options,
|
|
2979
|
+
description: this.getAttribute("description") ?? options.description,
|
|
2980
|
+
sessionId: this.getAttribute("session-id") ?? options.sessionId,
|
|
2981
|
+
title: this.getAttribute("title") ?? options.title
|
|
2982
|
+
});
|
|
2983
|
+
}
|
|
2984
|
+
disconnectedCallback() {
|
|
2985
|
+
this.mounted?.close();
|
|
2986
|
+
this.mounted = undefined;
|
|
2987
|
+
}
|
|
2988
|
+
});
|
|
2989
|
+
};
|
|
2990
|
+
|
|
2991
|
+
// src/react/VoiceAgentSquadStatus.tsx
|
|
2992
|
+
import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
|
|
2993
|
+
function VoiceAgentSquadStatus({
|
|
2994
|
+
path = "/api/voice-traces",
|
|
2995
|
+
...options
|
|
2996
|
+
}) {
|
|
2997
|
+
const snapshot = useVoiceAgentSquadStatus(path, options);
|
|
2998
|
+
const model = createVoiceAgentSquadStatusViewModel(snapshot, options);
|
|
2999
|
+
const current = model.current;
|
|
3000
|
+
return /* @__PURE__ */ jsxDEV10("section", {
|
|
3001
|
+
className: "absolute-voice-agent-squad-status",
|
|
3002
|
+
children: [
|
|
3003
|
+
/* @__PURE__ */ jsxDEV10("header", {
|
|
3004
|
+
children: [
|
|
3005
|
+
/* @__PURE__ */ jsxDEV10("span", {
|
|
3006
|
+
children: model.title
|
|
3007
|
+
}, undefined, false, undefined, this),
|
|
3008
|
+
/* @__PURE__ */ jsxDEV10("strong", {
|
|
3009
|
+
children: model.label
|
|
3010
|
+
}, undefined, false, undefined, this)
|
|
3011
|
+
]
|
|
3012
|
+
}, undefined, true, undefined, this),
|
|
3013
|
+
/* @__PURE__ */ jsxDEV10("p", {
|
|
3014
|
+
children: model.description
|
|
3015
|
+
}, undefined, false, undefined, this),
|
|
3016
|
+
/* @__PURE__ */ jsxDEV10("dl", {
|
|
3017
|
+
children: [
|
|
3018
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
3019
|
+
children: [
|
|
3020
|
+
/* @__PURE__ */ jsxDEV10("dt", {
|
|
3021
|
+
children: "Session"
|
|
3022
|
+
}, undefined, false, undefined, this),
|
|
3023
|
+
/* @__PURE__ */ jsxDEV10("dd", {
|
|
3024
|
+
children: current?.sessionId ?? "n/a"
|
|
3025
|
+
}, undefined, false, undefined, this)
|
|
3026
|
+
]
|
|
3027
|
+
}, undefined, true, undefined, this),
|
|
3028
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
3029
|
+
children: [
|
|
3030
|
+
/* @__PURE__ */ jsxDEV10("dt", {
|
|
3031
|
+
children: "Current specialist"
|
|
3032
|
+
}, undefined, false, undefined, this),
|
|
3033
|
+
/* @__PURE__ */ jsxDEV10("dd", {
|
|
3034
|
+
children: current?.targetAgentId ?? "none"
|
|
3035
|
+
}, undefined, false, undefined, this)
|
|
3036
|
+
]
|
|
3037
|
+
}, undefined, true, undefined, this),
|
|
3038
|
+
/* @__PURE__ */ jsxDEV10("div", {
|
|
3039
|
+
children: [
|
|
3040
|
+
/* @__PURE__ */ jsxDEV10("dt", {
|
|
3041
|
+
children: "Status"
|
|
3042
|
+
}, undefined, false, undefined, this),
|
|
3043
|
+
/* @__PURE__ */ jsxDEV10("dd", {
|
|
3044
|
+
children: current?.status ?? "idle"
|
|
3045
|
+
}, undefined, false, undefined, this)
|
|
3046
|
+
]
|
|
3047
|
+
}, undefined, true, undefined, this)
|
|
3048
|
+
]
|
|
3049
|
+
}, undefined, true, undefined, this),
|
|
3050
|
+
model.error ? /* @__PURE__ */ jsxDEV10("p", {
|
|
3051
|
+
children: model.error
|
|
3052
|
+
}, undefined, false, undefined, this) : null
|
|
3053
|
+
]
|
|
3054
|
+
}, undefined, true, undefined, this);
|
|
3055
|
+
}
|
|
3056
|
+
// src/react/useVoiceTurnLatency.tsx
|
|
3057
|
+
import { useEffect as useEffect11, useRef as useRef11, useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
3058
|
+
|
|
2809
3059
|
// src/client/turnLatency.ts
|
|
2810
3060
|
var fetchVoiceTurnLatency = async (path = "/api/turn-latency", options = {}) => {
|
|
2811
3061
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
@@ -2911,27 +3161,27 @@ var createVoiceTurnLatencyStore = (path = "/api/turn-latency", options = {}) =>
|
|
|
2911
3161
|
|
|
2912
3162
|
// src/react/useVoiceTurnLatency.tsx
|
|
2913
3163
|
var useVoiceTurnLatency = (path = "/api/turn-latency", options = {}) => {
|
|
2914
|
-
const storeRef =
|
|
3164
|
+
const storeRef = useRef11(null);
|
|
2915
3165
|
if (!storeRef.current) {
|
|
2916
3166
|
storeRef.current = createVoiceTurnLatencyStore(path, options);
|
|
2917
3167
|
}
|
|
2918
3168
|
const store = storeRef.current;
|
|
2919
|
-
|
|
3169
|
+
useEffect11(() => {
|
|
2920
3170
|
store.refresh().catch(() => {});
|
|
2921
3171
|
return () => store.close();
|
|
2922
3172
|
}, [store]);
|
|
2923
3173
|
return {
|
|
2924
|
-
...
|
|
3174
|
+
...useSyncExternalStore11(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
2925
3175
|
refresh: store.refresh,
|
|
2926
3176
|
runProof: store.runProof
|
|
2927
3177
|
};
|
|
2928
3178
|
};
|
|
2929
3179
|
|
|
2930
3180
|
// src/client/turnLatencyWidget.ts
|
|
2931
|
-
var
|
|
2932
|
-
var
|
|
3181
|
+
var DEFAULT_TITLE10 = "Turn Latency";
|
|
3182
|
+
var DEFAULT_DESCRIPTION10 = "Per-turn timing from first transcript to commit and assistant response start.";
|
|
2933
3183
|
var DEFAULT_PROOF_LABEL = "Run latency proof";
|
|
2934
|
-
var
|
|
3184
|
+
var escapeHtml11 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
2935
3185
|
var formatMs2 = (value) => typeof value === "number" ? `${Math.round(value)}ms` : "n/a";
|
|
2936
3186
|
var createVoiceTurnLatencyViewModel = (snapshot, options = {}) => {
|
|
2937
3187
|
const turns = (snapshot.report?.turns ?? []).map((turn) => ({
|
|
@@ -2945,39 +3195,39 @@ var createVoiceTurnLatencyViewModel = (snapshot, options = {}) => {
|
|
|
2945
3195
|
const warningCount = snapshot.report?.warnings ?? turns.filter((turn) => turn.status === "warn").length;
|
|
2946
3196
|
const failedCount = snapshot.report?.failed ?? turns.filter((turn) => turn.status === "fail").length;
|
|
2947
3197
|
return {
|
|
2948
|
-
description: options.description ??
|
|
3198
|
+
description: options.description ?? DEFAULT_DESCRIPTION10,
|
|
2949
3199
|
error: snapshot.error,
|
|
2950
3200
|
isLoading: snapshot.isLoading,
|
|
2951
3201
|
label: snapshot.error ? "Unavailable" : turns.length ? failedCount > 0 ? `${failedCount} slow` : warningCount > 0 ? `${warningCount} warnings` : `avg ${formatMs2(snapshot.report?.averageTotalMs)}` : snapshot.isLoading ? "Checking" : "No turns",
|
|
2952
3202
|
proofLabel: options.proofPath ? options.proofLabel ?? DEFAULT_PROOF_LABEL : undefined,
|
|
2953
3203
|
showProofAction: Boolean(options.proofPath),
|
|
2954
3204
|
status: snapshot.error ? "error" : turns.length ? failedCount > 0 || warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
2955
|
-
title: options.title ??
|
|
3205
|
+
title: options.title ?? DEFAULT_TITLE10,
|
|
2956
3206
|
turns,
|
|
2957
3207
|
updatedAt: snapshot.updatedAt
|
|
2958
3208
|
};
|
|
2959
3209
|
};
|
|
2960
3210
|
var renderVoiceTurnLatencyHTML = (snapshot, options = {}) => {
|
|
2961
3211
|
const model = createVoiceTurnLatencyViewModel(snapshot, options);
|
|
2962
|
-
const turns = model.turns.length ? `<div class="absolute-voice-turn-latency__turns">${model.turns.map((turn) => `<article class="absolute-voice-turn-latency__turn absolute-voice-turn-latency__turn--${
|
|
3212
|
+
const turns = model.turns.length ? `<div class="absolute-voice-turn-latency__turns">${model.turns.map((turn) => `<article class="absolute-voice-turn-latency__turn absolute-voice-turn-latency__turn--${escapeHtml11(turn.status)}">
|
|
2963
3213
|
<header>
|
|
2964
|
-
<strong>${
|
|
2965
|
-
<span>${
|
|
3214
|
+
<strong>${escapeHtml11(turn.label)}</strong>
|
|
3215
|
+
<span>${escapeHtml11(turn.status)}</span>
|
|
2966
3216
|
</header>
|
|
2967
3217
|
<dl>${turn.rows.map((row) => `<div>
|
|
2968
|
-
<dt>${
|
|
2969
|
-
<dd>${
|
|
3218
|
+
<dt>${escapeHtml11(row.label)}</dt>
|
|
3219
|
+
<dd>${escapeHtml11(row.value)}</dd>
|
|
2970
3220
|
</div>`).join("")}</dl>
|
|
2971
3221
|
</article>`).join("")}</div>` : '<p class="absolute-voice-turn-latency__empty">Complete a voice turn to see latency diagnostics.</p>';
|
|
2972
|
-
return `<section class="absolute-voice-turn-latency absolute-voice-turn-latency--${
|
|
3222
|
+
return `<section class="absolute-voice-turn-latency absolute-voice-turn-latency--${escapeHtml11(model.status)}">
|
|
2973
3223
|
<header class="absolute-voice-turn-latency__header">
|
|
2974
|
-
<span class="absolute-voice-turn-latency__eyebrow">${
|
|
2975
|
-
<strong class="absolute-voice-turn-latency__label">${
|
|
3224
|
+
<span class="absolute-voice-turn-latency__eyebrow">${escapeHtml11(model.title)}</span>
|
|
3225
|
+
<strong class="absolute-voice-turn-latency__label">${escapeHtml11(model.label)}</strong>
|
|
2976
3226
|
</header>
|
|
2977
|
-
<p class="absolute-voice-turn-latency__description">${
|
|
2978
|
-
${model.showProofAction ? `<button class="absolute-voice-turn-latency__proof" data-absolute-voice-turn-latency-proof type="button">${
|
|
3227
|
+
<p class="absolute-voice-turn-latency__description">${escapeHtml11(model.description)}</p>
|
|
3228
|
+
${model.showProofAction ? `<button class="absolute-voice-turn-latency__proof" data-absolute-voice-turn-latency-proof type="button">${escapeHtml11(model.proofLabel ?? DEFAULT_PROOF_LABEL)}</button>` : ""}
|
|
2979
3229
|
${turns}
|
|
2980
|
-
${model.error ? `<p class="absolute-voice-turn-latency__error">${
|
|
3230
|
+
${model.error ? `<p class="absolute-voice-turn-latency__error">${escapeHtml11(model.error)}</p>` : ""}
|
|
2981
3231
|
</section>`;
|
|
2982
3232
|
};
|
|
2983
3233
|
var mountVoiceTurnLatency = (element, path = "/api/turn-latency", options = {}) => {
|
|
@@ -3028,7 +3278,7 @@ var defineVoiceTurnLatencyElement = (tagName = "absolute-voice-turn-latency") =>
|
|
|
3028
3278
|
};
|
|
3029
3279
|
|
|
3030
3280
|
// src/react/VoiceTurnLatency.tsx
|
|
3031
|
-
import { jsxDEV as
|
|
3281
|
+
import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
|
|
3032
3282
|
var VoiceTurnLatency = ({
|
|
3033
3283
|
className,
|
|
3034
3284
|
path = "/api/turn-latency",
|
|
@@ -3036,31 +3286,31 @@ var VoiceTurnLatency = ({
|
|
|
3036
3286
|
}) => {
|
|
3037
3287
|
const latency = useVoiceTurnLatency(path, options);
|
|
3038
3288
|
const model = createVoiceTurnLatencyViewModel(latency, options);
|
|
3039
|
-
return /* @__PURE__ */
|
|
3289
|
+
return /* @__PURE__ */ jsxDEV11("section", {
|
|
3040
3290
|
className: [
|
|
3041
3291
|
"absolute-voice-turn-latency",
|
|
3042
3292
|
`absolute-voice-turn-latency--${model.status}`,
|
|
3043
3293
|
className
|
|
3044
3294
|
].filter(Boolean).join(" "),
|
|
3045
3295
|
children: [
|
|
3046
|
-
/* @__PURE__ */
|
|
3296
|
+
/* @__PURE__ */ jsxDEV11("header", {
|
|
3047
3297
|
className: "absolute-voice-turn-latency__header",
|
|
3048
3298
|
children: [
|
|
3049
|
-
/* @__PURE__ */
|
|
3299
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
3050
3300
|
className: "absolute-voice-turn-latency__eyebrow",
|
|
3051
3301
|
children: model.title
|
|
3052
3302
|
}, undefined, false, undefined, this),
|
|
3053
|
-
/* @__PURE__ */
|
|
3303
|
+
/* @__PURE__ */ jsxDEV11("strong", {
|
|
3054
3304
|
className: "absolute-voice-turn-latency__label",
|
|
3055
3305
|
children: model.label
|
|
3056
3306
|
}, undefined, false, undefined, this)
|
|
3057
3307
|
]
|
|
3058
3308
|
}, undefined, true, undefined, this),
|
|
3059
|
-
/* @__PURE__ */
|
|
3309
|
+
/* @__PURE__ */ jsxDEV11("p", {
|
|
3060
3310
|
className: "absolute-voice-turn-latency__description",
|
|
3061
3311
|
children: model.description
|
|
3062
3312
|
}, undefined, false, undefined, this),
|
|
3063
|
-
model.showProofAction ? /* @__PURE__ */
|
|
3313
|
+
model.showProofAction ? /* @__PURE__ */ jsxDEV11("button", {
|
|
3064
3314
|
className: "absolute-voice-turn-latency__proof",
|
|
3065
3315
|
onClick: () => {
|
|
3066
3316
|
latency.runProof().catch(() => {});
|
|
@@ -3068,31 +3318,31 @@ var VoiceTurnLatency = ({
|
|
|
3068
3318
|
type: "button",
|
|
3069
3319
|
children: model.proofLabel
|
|
3070
3320
|
}, undefined, false, undefined, this) : null,
|
|
3071
|
-
model.turns.length ? /* @__PURE__ */
|
|
3321
|
+
model.turns.length ? /* @__PURE__ */ jsxDEV11("div", {
|
|
3072
3322
|
className: "absolute-voice-turn-latency__turns",
|
|
3073
|
-
children: model.turns.map((turn) => /* @__PURE__ */
|
|
3323
|
+
children: model.turns.map((turn) => /* @__PURE__ */ jsxDEV11("article", {
|
|
3074
3324
|
className: [
|
|
3075
3325
|
"absolute-voice-turn-latency__turn",
|
|
3076
3326
|
`absolute-voice-turn-latency__turn--${turn.status}`
|
|
3077
3327
|
].join(" "),
|
|
3078
3328
|
children: [
|
|
3079
|
-
/* @__PURE__ */
|
|
3329
|
+
/* @__PURE__ */ jsxDEV11("header", {
|
|
3080
3330
|
children: [
|
|
3081
|
-
/* @__PURE__ */
|
|
3331
|
+
/* @__PURE__ */ jsxDEV11("strong", {
|
|
3082
3332
|
children: turn.label
|
|
3083
3333
|
}, undefined, false, undefined, this),
|
|
3084
|
-
/* @__PURE__ */
|
|
3334
|
+
/* @__PURE__ */ jsxDEV11("span", {
|
|
3085
3335
|
children: turn.status
|
|
3086
3336
|
}, undefined, false, undefined, this)
|
|
3087
3337
|
]
|
|
3088
3338
|
}, undefined, true, undefined, this),
|
|
3089
|
-
/* @__PURE__ */
|
|
3090
|
-
children: turn.rows.map((row) => /* @__PURE__ */
|
|
3339
|
+
/* @__PURE__ */ jsxDEV11("dl", {
|
|
3340
|
+
children: turn.rows.map((row) => /* @__PURE__ */ jsxDEV11("div", {
|
|
3091
3341
|
children: [
|
|
3092
|
-
/* @__PURE__ */
|
|
3342
|
+
/* @__PURE__ */ jsxDEV11("dt", {
|
|
3093
3343
|
children: row.label
|
|
3094
3344
|
}, undefined, false, undefined, this),
|
|
3095
|
-
/* @__PURE__ */
|
|
3345
|
+
/* @__PURE__ */ jsxDEV11("dd", {
|
|
3096
3346
|
children: row.value
|
|
3097
3347
|
}, undefined, false, undefined, this)
|
|
3098
3348
|
]
|
|
@@ -3100,11 +3350,11 @@ var VoiceTurnLatency = ({
|
|
|
3100
3350
|
}, undefined, false, undefined, this)
|
|
3101
3351
|
]
|
|
3102
3352
|
}, `${turn.sessionId}:${turn.turnId}`, true, undefined, this))
|
|
3103
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
3353
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV11("p", {
|
|
3104
3354
|
className: "absolute-voice-turn-latency__empty",
|
|
3105
3355
|
children: "Complete a voice turn to see latency diagnostics."
|
|
3106
3356
|
}, undefined, false, undefined, this),
|
|
3107
|
-
model.error ? /* @__PURE__ */
|
|
3357
|
+
model.error ? /* @__PURE__ */ jsxDEV11("p", {
|
|
3108
3358
|
className: "absolute-voice-turn-latency__error",
|
|
3109
3359
|
children: model.error
|
|
3110
3360
|
}, undefined, false, undefined, this) : null
|
|
@@ -3112,7 +3362,7 @@ var VoiceTurnLatency = ({
|
|
|
3112
3362
|
}, undefined, true, undefined, this);
|
|
3113
3363
|
};
|
|
3114
3364
|
// src/react/useVoiceTurnQuality.tsx
|
|
3115
|
-
import { useEffect as
|
|
3365
|
+
import { useEffect as useEffect12, useRef as useRef12, useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
3116
3366
|
|
|
3117
3367
|
// src/client/turnQuality.ts
|
|
3118
3368
|
var fetchVoiceTurnQuality = async (path = "/api/turn-quality", options = {}) => {
|
|
@@ -3195,25 +3445,25 @@ var createVoiceTurnQualityStore = (path = "/api/turn-quality", options = {}) =>
|
|
|
3195
3445
|
|
|
3196
3446
|
// src/react/useVoiceTurnQuality.tsx
|
|
3197
3447
|
var useVoiceTurnQuality = (path = "/api/turn-quality", options = {}) => {
|
|
3198
|
-
const storeRef =
|
|
3448
|
+
const storeRef = useRef12(null);
|
|
3199
3449
|
if (!storeRef.current) {
|
|
3200
3450
|
storeRef.current = createVoiceTurnQualityStore(path, options);
|
|
3201
3451
|
}
|
|
3202
3452
|
const store = storeRef.current;
|
|
3203
|
-
|
|
3453
|
+
useEffect12(() => {
|
|
3204
3454
|
store.refresh().catch(() => {});
|
|
3205
3455
|
return () => store.close();
|
|
3206
3456
|
}, [store]);
|
|
3207
3457
|
return {
|
|
3208
|
-
...
|
|
3458
|
+
...useSyncExternalStore12(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
3209
3459
|
refresh: store.refresh
|
|
3210
3460
|
};
|
|
3211
3461
|
};
|
|
3212
3462
|
|
|
3213
3463
|
// src/client/turnQualityWidget.ts
|
|
3214
|
-
var
|
|
3215
|
-
var
|
|
3216
|
-
var
|
|
3464
|
+
var DEFAULT_TITLE11 = "Turn Quality";
|
|
3465
|
+
var DEFAULT_DESCRIPTION11 = "Per-turn STT confidence, fallback selection, corrections, and transcript coverage.";
|
|
3466
|
+
var escapeHtml12 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
3217
3467
|
var formatConfidence = (value) => typeof value === "number" ? `${Math.round(value * 100)}%` : "n/a";
|
|
3218
3468
|
var formatMaybe = (value) => value === undefined || value === "" ? "n/a" : String(value);
|
|
3219
3469
|
var getTurnDetail = (turn) => {
|
|
@@ -3251,37 +3501,37 @@ var createVoiceTurnQualityViewModel = (snapshot, options = {}) => {
|
|
|
3251
3501
|
const warningCount = snapshot.report?.warnings ?? turns.filter((turn) => turn.status === "warn").length;
|
|
3252
3502
|
const failedCount = snapshot.report?.failed ?? turns.filter((turn) => turn.status === "fail").length;
|
|
3253
3503
|
return {
|
|
3254
|
-
description: options.description ??
|
|
3504
|
+
description: options.description ?? DEFAULT_DESCRIPTION11,
|
|
3255
3505
|
error: snapshot.error,
|
|
3256
3506
|
isLoading: snapshot.isLoading,
|
|
3257
3507
|
label: snapshot.error ? "Unavailable" : turns.length ? failedCount > 0 ? `${failedCount} failed` : warningCount > 0 ? `${warningCount} warnings` : `${turns.length} healthy` : snapshot.isLoading ? "Checking" : "No turns",
|
|
3258
3508
|
status: snapshot.error ? "error" : turns.length ? failedCount > 0 || warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
3259
|
-
title: options.title ??
|
|
3509
|
+
title: options.title ?? DEFAULT_TITLE11,
|
|
3260
3510
|
turns,
|
|
3261
3511
|
updatedAt: snapshot.updatedAt
|
|
3262
3512
|
};
|
|
3263
3513
|
};
|
|
3264
3514
|
var renderVoiceTurnQualityHTML = (snapshot, options = {}) => {
|
|
3265
3515
|
const model = createVoiceTurnQualityViewModel(snapshot, options);
|
|
3266
|
-
const turns = model.turns.length ? `<div class="absolute-voice-turn-quality__turns">${model.turns.map((turn) => `<article class="absolute-voice-turn-quality__turn absolute-voice-turn-quality__turn--${
|
|
3516
|
+
const turns = model.turns.length ? `<div class="absolute-voice-turn-quality__turns">${model.turns.map((turn) => `<article class="absolute-voice-turn-quality__turn absolute-voice-turn-quality__turn--${escapeHtml12(turn.status)}">
|
|
3267
3517
|
<header>
|
|
3268
|
-
<strong>${
|
|
3269
|
-
<span>${
|
|
3518
|
+
<strong>${escapeHtml12(turn.label)}</strong>
|
|
3519
|
+
<span>${escapeHtml12(turn.status)}</span>
|
|
3270
3520
|
</header>
|
|
3271
|
-
<p>${
|
|
3521
|
+
<p>${escapeHtml12(turn.detail)}</p>
|
|
3272
3522
|
<dl>${turn.rows.map((row) => `<div>
|
|
3273
|
-
<dt>${
|
|
3274
|
-
<dd>${
|
|
3523
|
+
<dt>${escapeHtml12(row.label)}</dt>
|
|
3524
|
+
<dd>${escapeHtml12(row.value)}</dd>
|
|
3275
3525
|
</div>`).join("")}</dl>
|
|
3276
3526
|
</article>`).join("")}</div>` : '<p class="absolute-voice-turn-quality__empty">Complete a voice turn to see STT quality diagnostics.</p>';
|
|
3277
|
-
return `<section class="absolute-voice-turn-quality absolute-voice-turn-quality--${
|
|
3527
|
+
return `<section class="absolute-voice-turn-quality absolute-voice-turn-quality--${escapeHtml12(model.status)}">
|
|
3278
3528
|
<header class="absolute-voice-turn-quality__header">
|
|
3279
|
-
<span class="absolute-voice-turn-quality__eyebrow">${
|
|
3280
|
-
<strong class="absolute-voice-turn-quality__label">${
|
|
3529
|
+
<span class="absolute-voice-turn-quality__eyebrow">${escapeHtml12(model.title)}</span>
|
|
3530
|
+
<strong class="absolute-voice-turn-quality__label">${escapeHtml12(model.label)}</strong>
|
|
3281
3531
|
</header>
|
|
3282
|
-
<p class="absolute-voice-turn-quality__description">${
|
|
3532
|
+
<p class="absolute-voice-turn-quality__description">${escapeHtml12(model.description)}</p>
|
|
3283
3533
|
${turns}
|
|
3284
|
-
${model.error ? `<p class="absolute-voice-turn-quality__error">${
|
|
3534
|
+
${model.error ? `<p class="absolute-voice-turn-quality__error">${escapeHtml12(model.error)}</p>` : ""}
|
|
3285
3535
|
</section>`;
|
|
3286
3536
|
};
|
|
3287
3537
|
var getVoiceTurnQualityCSS = () => `.absolute-voice-turn-quality{border:1px solid #e4d1a3;border-radius:20px;background:#fff9eb;color:#17120a;padding:18px;box-shadow:0 18px 40px rgba(73,48,14,.12);font-family:inherit}.absolute-voice-turn-quality--error,.absolute-voice-turn-quality--warning{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-turn-quality__header,.absolute-voice-turn-quality__turn header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-turn-quality__eyebrow{color:#8a5a0a;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-turn-quality__label{font-size:24px;line-height:1}.absolute-voice-turn-quality__description,.absolute-voice-turn-quality__turn p,.absolute-voice-turn-quality__turn dt,.absolute-voice-turn-quality__empty{color:#5a4930}.absolute-voice-turn-quality__turns{display:grid;gap:12px;margin-top:14px}.absolute-voice-turn-quality__turn{background:#fff;border:1px solid #f0dfba;border-radius:16px;padding:14px}.absolute-voice-turn-quality__turn--pass{border-color:#86efac}.absolute-voice-turn-quality__turn--warn,.absolute-voice-turn-quality__turn--unknown{border-color:#fbbf24}.absolute-voice-turn-quality__turn--fail{border-color:#f2a7a7}.absolute-voice-turn-quality__turn p{margin:10px 0}.absolute-voice-turn-quality__turn dl{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr));margin:0}.absolute-voice-turn-quality__turn div{background:#fff9eb;border:1px solid #f0dfba;border-radius:12px;padding:8px}.absolute-voice-turn-quality__turn dt{font-size:12px}.absolute-voice-turn-quality__turn dd{font-weight:800;margin:4px 0 0}.absolute-voice-turn-quality__empty{margin:14px 0 0}.absolute-voice-turn-quality__error{color:#9f1239;font-weight:700}`;
|
|
@@ -3323,7 +3573,7 @@ var defineVoiceTurnQualityElement = (tagName = "absolute-voice-turn-quality") =>
|
|
|
3323
3573
|
};
|
|
3324
3574
|
|
|
3325
3575
|
// src/react/VoiceTurnQuality.tsx
|
|
3326
|
-
import { jsxDEV as
|
|
3576
|
+
import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
|
|
3327
3577
|
var VoiceTurnQuality = ({
|
|
3328
3578
|
className,
|
|
3329
3579
|
path = "/api/turn-quality",
|
|
@@ -3331,58 +3581,58 @@ var VoiceTurnQuality = ({
|
|
|
3331
3581
|
}) => {
|
|
3332
3582
|
const snapshot = useVoiceTurnQuality(path, options);
|
|
3333
3583
|
const model = createVoiceTurnQualityViewModel(snapshot, options);
|
|
3334
|
-
return /* @__PURE__ */
|
|
3584
|
+
return /* @__PURE__ */ jsxDEV12("section", {
|
|
3335
3585
|
className: [
|
|
3336
3586
|
"absolute-voice-turn-quality",
|
|
3337
3587
|
`absolute-voice-turn-quality--${model.status}`,
|
|
3338
3588
|
className
|
|
3339
3589
|
].filter(Boolean).join(" "),
|
|
3340
3590
|
children: [
|
|
3341
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsxDEV12("header", {
|
|
3342
3592
|
className: "absolute-voice-turn-quality__header",
|
|
3343
3593
|
children: [
|
|
3344
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsxDEV12("span", {
|
|
3345
3595
|
className: "absolute-voice-turn-quality__eyebrow",
|
|
3346
3596
|
children: model.title
|
|
3347
3597
|
}, undefined, false, undefined, this),
|
|
3348
|
-
/* @__PURE__ */
|
|
3598
|
+
/* @__PURE__ */ jsxDEV12("strong", {
|
|
3349
3599
|
className: "absolute-voice-turn-quality__label",
|
|
3350
3600
|
children: model.label
|
|
3351
3601
|
}, undefined, false, undefined, this)
|
|
3352
3602
|
]
|
|
3353
3603
|
}, undefined, true, undefined, this),
|
|
3354
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsxDEV12("p", {
|
|
3355
3605
|
className: "absolute-voice-turn-quality__description",
|
|
3356
3606
|
children: model.description
|
|
3357
3607
|
}, undefined, false, undefined, this),
|
|
3358
|
-
model.turns.length ? /* @__PURE__ */
|
|
3608
|
+
model.turns.length ? /* @__PURE__ */ jsxDEV12("div", {
|
|
3359
3609
|
className: "absolute-voice-turn-quality__turns",
|
|
3360
|
-
children: model.turns.map((turn) => /* @__PURE__ */
|
|
3610
|
+
children: model.turns.map((turn) => /* @__PURE__ */ jsxDEV12("article", {
|
|
3361
3611
|
className: [
|
|
3362
3612
|
"absolute-voice-turn-quality__turn",
|
|
3363
3613
|
`absolute-voice-turn-quality__turn--${turn.status}`
|
|
3364
3614
|
].join(" "),
|
|
3365
3615
|
children: [
|
|
3366
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ jsxDEV12("header", {
|
|
3367
3617
|
children: [
|
|
3368
|
-
/* @__PURE__ */
|
|
3618
|
+
/* @__PURE__ */ jsxDEV12("strong", {
|
|
3369
3619
|
children: turn.label
|
|
3370
3620
|
}, undefined, false, undefined, this),
|
|
3371
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsxDEV12("span", {
|
|
3372
3622
|
children: turn.status
|
|
3373
3623
|
}, undefined, false, undefined, this)
|
|
3374
3624
|
]
|
|
3375
3625
|
}, undefined, true, undefined, this),
|
|
3376
|
-
/* @__PURE__ */
|
|
3626
|
+
/* @__PURE__ */ jsxDEV12("p", {
|
|
3377
3627
|
children: turn.detail
|
|
3378
3628
|
}, undefined, false, undefined, this),
|
|
3379
|
-
/* @__PURE__ */
|
|
3380
|
-
children: turn.rows.map((row) => /* @__PURE__ */
|
|
3629
|
+
/* @__PURE__ */ jsxDEV12("dl", {
|
|
3630
|
+
children: turn.rows.map((row) => /* @__PURE__ */ jsxDEV12("div", {
|
|
3381
3631
|
children: [
|
|
3382
|
-
/* @__PURE__ */
|
|
3632
|
+
/* @__PURE__ */ jsxDEV12("dt", {
|
|
3383
3633
|
children: row.label
|
|
3384
3634
|
}, undefined, false, undefined, this),
|
|
3385
|
-
/* @__PURE__ */
|
|
3635
|
+
/* @__PURE__ */ jsxDEV12("dd", {
|
|
3386
3636
|
children: row.value
|
|
3387
3637
|
}, undefined, false, undefined, this)
|
|
3388
3638
|
]
|
|
@@ -3390,11 +3640,11 @@ var VoiceTurnQuality = ({
|
|
|
3390
3640
|
}, undefined, false, undefined, this)
|
|
3391
3641
|
]
|
|
3392
3642
|
}, `${turn.sessionId}:${turn.turnId}`, true, undefined, this))
|
|
3393
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
3643
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV12("p", {
|
|
3394
3644
|
className: "absolute-voice-turn-quality__empty",
|
|
3395
3645
|
children: "Complete a voice turn to see STT quality diagnostics."
|
|
3396
3646
|
}, undefined, false, undefined, this),
|
|
3397
|
-
model.error ? /* @__PURE__ */
|
|
3647
|
+
model.error ? /* @__PURE__ */ jsxDEV12("p", {
|
|
3398
3648
|
className: "absolute-voice-turn-quality__error",
|
|
3399
3649
|
children: model.error
|
|
3400
3650
|
}, undefined, false, undefined, this) : null
|
|
@@ -3402,7 +3652,7 @@ var VoiceTurnQuality = ({
|
|
|
3402
3652
|
}, undefined, true, undefined, this);
|
|
3403
3653
|
};
|
|
3404
3654
|
// src/react/useVoiceLiveOps.tsx
|
|
3405
|
-
import { useEffect as
|
|
3655
|
+
import { useEffect as useEffect13, useRef as useRef13, useSyncExternalStore as useSyncExternalStore13 } from "react";
|
|
3406
3656
|
|
|
3407
3657
|
// src/client/liveOps.ts
|
|
3408
3658
|
var postVoiceLiveOpsAction = async (input, options = {}) => {
|
|
@@ -3492,19 +3742,19 @@ var createVoiceLiveOpsStore = (options = {}) => {
|
|
|
3492
3742
|
|
|
3493
3743
|
// src/react/useVoiceLiveOps.tsx
|
|
3494
3744
|
var useVoiceLiveOps = (options = {}) => {
|
|
3495
|
-
const storeRef =
|
|
3745
|
+
const storeRef = useRef13(null);
|
|
3496
3746
|
if (!storeRef.current) {
|
|
3497
3747
|
storeRef.current = createVoiceLiveOpsStore(options);
|
|
3498
3748
|
}
|
|
3499
3749
|
const store = storeRef.current;
|
|
3500
|
-
|
|
3750
|
+
useEffect13(() => () => store.close(), [store]);
|
|
3501
3751
|
return {
|
|
3502
|
-
...
|
|
3752
|
+
...useSyncExternalStore13(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
3503
3753
|
run: store.run
|
|
3504
3754
|
};
|
|
3505
3755
|
};
|
|
3506
3756
|
// src/react/useVoiceCampaignDialerProof.tsx
|
|
3507
|
-
import { useEffect as
|
|
3757
|
+
import { useEffect as useEffect14, useRef as useRef14, useSyncExternalStore as useSyncExternalStore14 } from "react";
|
|
3508
3758
|
|
|
3509
3759
|
// src/client/campaignDialerProof.ts
|
|
3510
3760
|
var fetchVoiceCampaignDialerProofStatus = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
@@ -3626,23 +3876,23 @@ var createVoiceCampaignDialerProofStore = (path = "/api/voice/campaigns/dialer-p
|
|
|
3626
3876
|
|
|
3627
3877
|
// src/react/useVoiceCampaignDialerProof.tsx
|
|
3628
3878
|
var useVoiceCampaignDialerProof = (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
3629
|
-
const storeRef =
|
|
3879
|
+
const storeRef = useRef14(null);
|
|
3630
3880
|
if (!storeRef.current) {
|
|
3631
3881
|
storeRef.current = createVoiceCampaignDialerProofStore(path, options);
|
|
3632
3882
|
}
|
|
3633
3883
|
const store = storeRef.current;
|
|
3634
|
-
|
|
3884
|
+
useEffect14(() => {
|
|
3635
3885
|
store.refresh().catch(() => {});
|
|
3636
3886
|
return () => store.close();
|
|
3637
3887
|
}, [store]);
|
|
3638
3888
|
return {
|
|
3639
|
-
...
|
|
3889
|
+
...useSyncExternalStore14(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
3640
3890
|
refresh: store.refresh,
|
|
3641
3891
|
runProof: store.runProof
|
|
3642
3892
|
};
|
|
3643
3893
|
};
|
|
3644
3894
|
// src/react/useVoiceStream.tsx
|
|
3645
|
-
import { useEffect as
|
|
3895
|
+
import { useEffect as useEffect15, useRef as useRef15, useSyncExternalStore as useSyncExternalStore15 } from "react";
|
|
3646
3896
|
|
|
3647
3897
|
// src/client/actions.ts
|
|
3648
3898
|
var normalizeErrorMessage = (value) => {
|
|
@@ -4302,13 +4552,13 @@ var EMPTY_SNAPSHOT = {
|
|
|
4302
4552
|
turns: []
|
|
4303
4553
|
};
|
|
4304
4554
|
var useVoiceStream = (path, options = {}) => {
|
|
4305
|
-
const streamRef =
|
|
4555
|
+
const streamRef = useRef15(null);
|
|
4306
4556
|
if (!streamRef.current) {
|
|
4307
4557
|
streamRef.current = createVoiceStream(path, options);
|
|
4308
4558
|
}
|
|
4309
4559
|
const stream = streamRef.current;
|
|
4310
|
-
|
|
4311
|
-
const snapshot =
|
|
4560
|
+
useEffect15(() => () => stream.close(), [stream]);
|
|
4561
|
+
const snapshot = useSyncExternalStore15(stream.subscribe, stream.getSnapshot, stream.getServerSnapshot) ?? EMPTY_SNAPSHOT;
|
|
4312
4562
|
return {
|
|
4313
4563
|
...snapshot,
|
|
4314
4564
|
callControl: (message) => stream.callControl(message),
|
|
@@ -4318,7 +4568,7 @@ var useVoiceStream = (path, options = {}) => {
|
|
|
4318
4568
|
};
|
|
4319
4569
|
};
|
|
4320
4570
|
// src/react/useVoiceController.tsx
|
|
4321
|
-
import { useEffect as
|
|
4571
|
+
import { useEffect as useEffect16, useRef as useRef16, useSyncExternalStore as useSyncExternalStore16 } from "react";
|
|
4322
4572
|
|
|
4323
4573
|
// src/client/htmx.ts
|
|
4324
4574
|
var DEFAULT_EVENT_NAME = "voice-refresh";
|
|
@@ -4981,13 +5231,13 @@ var EMPTY_SNAPSHOT2 = {
|
|
|
4981
5231
|
turns: []
|
|
4982
5232
|
};
|
|
4983
5233
|
var useVoiceController = (path, options = {}) => {
|
|
4984
|
-
const controllerRef =
|
|
5234
|
+
const controllerRef = useRef16(null);
|
|
4985
5235
|
if (!controllerRef.current) {
|
|
4986
5236
|
controllerRef.current = createVoiceController(path, options);
|
|
4987
5237
|
}
|
|
4988
5238
|
const controller = controllerRef.current;
|
|
4989
|
-
|
|
4990
|
-
const snapshot =
|
|
5239
|
+
useEffect16(() => () => controller.close(), [controller]);
|
|
5240
|
+
const snapshot = useSyncExternalStore16(controller.subscribe, controller.getSnapshot, controller.getServerSnapshot) ?? EMPTY_SNAPSHOT2;
|
|
4991
5241
|
return {
|
|
4992
5242
|
...snapshot,
|
|
4993
5243
|
bindHTMX: controller.bindHTMX,
|
|
@@ -5001,7 +5251,7 @@ var useVoiceController = (path, options = {}) => {
|
|
|
5001
5251
|
};
|
|
5002
5252
|
};
|
|
5003
5253
|
// src/react/useVoiceWorkflowStatus.tsx
|
|
5004
|
-
import { useEffect as
|
|
5254
|
+
import { useEffect as useEffect17, useRef as useRef17, useSyncExternalStore as useSyncExternalStore17 } from "react";
|
|
5005
5255
|
|
|
5006
5256
|
// src/client/workflowStatus.ts
|
|
5007
5257
|
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
@@ -5084,17 +5334,17 @@ var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options =
|
|
|
5084
5334
|
|
|
5085
5335
|
// src/react/useVoiceWorkflowStatus.tsx
|
|
5086
5336
|
var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
|
|
5087
|
-
const storeRef =
|
|
5337
|
+
const storeRef = useRef17(null);
|
|
5088
5338
|
if (!storeRef.current) {
|
|
5089
5339
|
storeRef.current = createVoiceWorkflowStatusStore(path, options);
|
|
5090
5340
|
}
|
|
5091
5341
|
const store = storeRef.current;
|
|
5092
|
-
|
|
5342
|
+
useEffect17(() => {
|
|
5093
5343
|
store.refresh().catch(() => {});
|
|
5094
5344
|
return () => store.close();
|
|
5095
5345
|
}, [store]);
|
|
5096
5346
|
return {
|
|
5097
|
-
...
|
|
5347
|
+
...useSyncExternalStore17(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
5098
5348
|
refresh: store.refresh
|
|
5099
5349
|
};
|
|
5100
5350
|
};
|
|
@@ -5115,6 +5365,7 @@ export {
|
|
|
5115
5365
|
useVoiceDeliveryRuntime,
|
|
5116
5366
|
useVoiceController,
|
|
5117
5367
|
useVoiceCampaignDialerProof,
|
|
5368
|
+
useVoiceAgentSquadStatus,
|
|
5118
5369
|
VoiceTurnQuality,
|
|
5119
5370
|
VoiceTurnLatency,
|
|
5120
5371
|
VoiceTraceTimeline,
|
|
@@ -5125,5 +5376,6 @@ export {
|
|
|
5125
5376
|
VoiceProviderCapabilities,
|
|
5126
5377
|
VoiceOpsStatus,
|
|
5127
5378
|
VoiceOpsActionCenter,
|
|
5128
|
-
VoiceDeliveryRuntime
|
|
5379
|
+
VoiceDeliveryRuntime,
|
|
5380
|
+
VoiceAgentSquadStatus
|
|
5129
5381
|
};
|