@absolutejs/voice 0.0.22-beta.150 → 0.0.22-beta.152
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 +151 -0
- package/dist/angular/index.d.ts +2 -0
- package/dist/angular/index.js +479 -124
- package/dist/angular/voice-delivery-runtime.component.d.ts +14 -0
- package/dist/angular/voice-delivery-runtime.service.d.ts +12 -0
- package/dist/client/deliveryRuntime.d.ts +19 -0
- package/dist/client/deliveryRuntimeWidget.d.ts +34 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.js +287 -100
- package/dist/deliveryRuntime.d.ts +1 -1
- package/dist/react/VoiceDeliveryRuntime.d.ts +6 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +520 -256
- package/dist/react/useVoiceDeliveryRuntime.d.ts +8 -0
- package/dist/svelte/createVoiceDeliveryRuntime.d.ts +9 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +309 -114
- package/dist/vue/VoiceDeliveryRuntime.d.ts +21 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +534 -261
- package/dist/vue/useVoiceDeliveryRuntime.d.ts +9 -0
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -387,6 +387,268 @@ var VoiceOpsStatus = ({
|
|
|
387
387
|
]
|
|
388
388
|
}, undefined, true, undefined, this);
|
|
389
389
|
};
|
|
390
|
+
// src/client/deliveryRuntime.ts
|
|
391
|
+
var fetchVoiceDeliveryRuntime = async (path = "/api/voice-delivery-runtime", options = {}) => {
|
|
392
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
393
|
+
const response = await fetchImpl(path);
|
|
394
|
+
if (!response.ok) {
|
|
395
|
+
throw new Error(`Voice delivery runtime failed: HTTP ${response.status}`);
|
|
396
|
+
}
|
|
397
|
+
return await response.json();
|
|
398
|
+
};
|
|
399
|
+
var createVoiceDeliveryRuntimeStore = (path = "/api/voice-delivery-runtime", options = {}) => {
|
|
400
|
+
const listeners = new Set;
|
|
401
|
+
let closed = false;
|
|
402
|
+
let timer;
|
|
403
|
+
let snapshot = {
|
|
404
|
+
error: null,
|
|
405
|
+
isLoading: false
|
|
406
|
+
};
|
|
407
|
+
const emit = () => {
|
|
408
|
+
for (const listener of listeners) {
|
|
409
|
+
listener();
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
const refresh = async () => {
|
|
413
|
+
if (closed) {
|
|
414
|
+
return snapshot.report;
|
|
415
|
+
}
|
|
416
|
+
snapshot = {
|
|
417
|
+
...snapshot,
|
|
418
|
+
error: null,
|
|
419
|
+
isLoading: true
|
|
420
|
+
};
|
|
421
|
+
emit();
|
|
422
|
+
try {
|
|
423
|
+
const report = await fetchVoiceDeliveryRuntime(path, options);
|
|
424
|
+
snapshot = {
|
|
425
|
+
error: null,
|
|
426
|
+
isLoading: false,
|
|
427
|
+
report,
|
|
428
|
+
updatedAt: Date.now()
|
|
429
|
+
};
|
|
430
|
+
emit();
|
|
431
|
+
return report;
|
|
432
|
+
} catch (error) {
|
|
433
|
+
snapshot = {
|
|
434
|
+
...snapshot,
|
|
435
|
+
error: error instanceof Error ? error.message : String(error),
|
|
436
|
+
isLoading: false
|
|
437
|
+
};
|
|
438
|
+
emit();
|
|
439
|
+
throw error;
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
const close = () => {
|
|
443
|
+
closed = true;
|
|
444
|
+
if (timer) {
|
|
445
|
+
clearInterval(timer);
|
|
446
|
+
timer = undefined;
|
|
447
|
+
}
|
|
448
|
+
listeners.clear();
|
|
449
|
+
};
|
|
450
|
+
if (typeof window !== "undefined" && options.intervalMs && options.intervalMs > 0) {
|
|
451
|
+
timer = setInterval(() => {
|
|
452
|
+
refresh().catch(() => {});
|
|
453
|
+
}, options.intervalMs);
|
|
454
|
+
}
|
|
455
|
+
return {
|
|
456
|
+
close,
|
|
457
|
+
getServerSnapshot: () => snapshot,
|
|
458
|
+
getSnapshot: () => snapshot,
|
|
459
|
+
refresh,
|
|
460
|
+
subscribe: (listener) => {
|
|
461
|
+
listeners.add(listener);
|
|
462
|
+
return () => {
|
|
463
|
+
listeners.delete(listener);
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
// src/client/deliveryRuntimeWidget.ts
|
|
470
|
+
var DEFAULT_TITLE2 = "Voice Delivery Runtime";
|
|
471
|
+
var DEFAULT_DESCRIPTION2 = "Audit and trace delivery worker health from your AbsoluteJS voice app.";
|
|
472
|
+
var escapeHtml2 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
473
|
+
var createSurface = (id, summary) => {
|
|
474
|
+
if (!summary) {
|
|
475
|
+
return {
|
|
476
|
+
deadLettered: 0,
|
|
477
|
+
detail: "Worker disabled",
|
|
478
|
+
failed: 0,
|
|
479
|
+
id,
|
|
480
|
+
label: id === "audit" ? "Audit delivery" : "Trace delivery",
|
|
481
|
+
pending: 0,
|
|
482
|
+
status: "disabled",
|
|
483
|
+
total: 0
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
const blocked = summary.failed + summary.deadLettered;
|
|
487
|
+
return {
|
|
488
|
+
deadLettered: summary.deadLettered,
|
|
489
|
+
detail: `${summary.delivered}/${summary.total} delivered, ${summary.pending} pending`,
|
|
490
|
+
failed: summary.failed,
|
|
491
|
+
id,
|
|
492
|
+
label: id === "audit" ? "Audit delivery" : "Trace delivery",
|
|
493
|
+
pending: summary.pending,
|
|
494
|
+
status: blocked > 0 ? "warn" : "pass",
|
|
495
|
+
total: summary.total
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
var createVoiceDeliveryRuntimeViewModel = (snapshot, options = {}) => {
|
|
499
|
+
const report = snapshot.report;
|
|
500
|
+
const surfaces = [
|
|
501
|
+
createSurface("audit", report?.summary.audit),
|
|
502
|
+
createSurface("trace", report?.summary.trace)
|
|
503
|
+
];
|
|
504
|
+
const hasWarnings = surfaces.some((surface) => surface.status === "warn");
|
|
505
|
+
return {
|
|
506
|
+
description: options.description ?? DEFAULT_DESCRIPTION2,
|
|
507
|
+
error: snapshot.error,
|
|
508
|
+
isLoading: snapshot.isLoading,
|
|
509
|
+
isRunning: Boolean(report?.isRunning),
|
|
510
|
+
label: snapshot.error ? "Unavailable" : report ? report.isRunning ? "Running" : "Stopped" : "Checking",
|
|
511
|
+
status: snapshot.error ? "error" : report ? hasWarnings ? "warn" : "pass" : "loading",
|
|
512
|
+
surfaces,
|
|
513
|
+
title: options.title ?? DEFAULT_TITLE2,
|
|
514
|
+
updatedAt: snapshot.updatedAt
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
var renderVoiceDeliveryRuntimeHTML = (snapshot, options = {}) => {
|
|
518
|
+
const model = createVoiceDeliveryRuntimeViewModel(snapshot, options);
|
|
519
|
+
const surfaces = model.surfaces.map((surface) => `<li class="absolute-voice-delivery-runtime__surface absolute-voice-delivery-runtime__surface--${escapeHtml2(surface.status)}">
|
|
520
|
+
<span>${escapeHtml2(surface.label)}</span>
|
|
521
|
+
<strong>${escapeHtml2(surface.detail)}</strong>
|
|
522
|
+
<small>${String(surface.failed)} failed · ${String(surface.deadLettered)} dead-lettered</small>
|
|
523
|
+
</li>`).join("");
|
|
524
|
+
return `<section class="absolute-voice-delivery-runtime absolute-voice-delivery-runtime--${escapeHtml2(model.status)}">
|
|
525
|
+
<header class="absolute-voice-delivery-runtime__header">
|
|
526
|
+
<span class="absolute-voice-delivery-runtime__eyebrow">${escapeHtml2(model.title)}</span>
|
|
527
|
+
<strong class="absolute-voice-delivery-runtime__label">${escapeHtml2(model.label)}</strong>
|
|
528
|
+
</header>
|
|
529
|
+
<p class="absolute-voice-delivery-runtime__description">${escapeHtml2(model.description)}</p>
|
|
530
|
+
<ul class="absolute-voice-delivery-runtime__surfaces">${surfaces}</ul>
|
|
531
|
+
${model.error ? `<p class="absolute-voice-delivery-runtime__error">${escapeHtml2(model.error)}</p>` : ""}
|
|
532
|
+
</section>`;
|
|
533
|
+
};
|
|
534
|
+
var getVoiceDeliveryRuntimeCSS = () => `.absolute-voice-delivery-runtime{border:1px solid #c9d8cf;border-radius:20px;background:#f6fff9;color:#0d1b12;padding:18px;box-shadow:0 18px 40px rgba(19,55,35,.12);font-family:inherit}.absolute-voice-delivery-runtime--warn,.absolute-voice-delivery-runtime--error{border-color:#f2b56b;background:#fff9ed}.absolute-voice-delivery-runtime__header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-delivery-runtime__eyebrow{color:#4e6b59;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-delivery-runtime__label{font-size:28px;line-height:1}.absolute-voice-delivery-runtime__description{color:#33483b;margin:12px 0 0}.absolute-voice-delivery-runtime__surfaces{display:grid;gap:8px;list-style:none;margin:16px 0 0;padding:0}.absolute-voice-delivery-runtime__surface{background:#fff;border:1px solid #d9eadf;border-radius:14px;display:grid;gap:4px;padding:10px 12px}.absolute-voice-delivery-runtime__surface--warn{border-color:#f2b56b}.absolute-voice-delivery-runtime__surface--disabled{opacity:.72}.absolute-voice-delivery-runtime__surface span,.absolute-voice-delivery-runtime__surface small{color:#587063}.absolute-voice-delivery-runtime__error{color:#9f1239;font-weight:700}`;
|
|
535
|
+
var mountVoiceDeliveryRuntime = (element, path = "/api/voice-delivery-runtime", options = {}) => {
|
|
536
|
+
const store = createVoiceDeliveryRuntimeStore(path, options);
|
|
537
|
+
const render = () => {
|
|
538
|
+
element.innerHTML = renderVoiceDeliveryRuntimeHTML(store.getSnapshot(), options);
|
|
539
|
+
};
|
|
540
|
+
const unsubscribe = store.subscribe(render);
|
|
541
|
+
render();
|
|
542
|
+
store.refresh().catch(() => {});
|
|
543
|
+
return {
|
|
544
|
+
close: () => {
|
|
545
|
+
unsubscribe();
|
|
546
|
+
store.close();
|
|
547
|
+
},
|
|
548
|
+
refresh: store.refresh
|
|
549
|
+
};
|
|
550
|
+
};
|
|
551
|
+
var defineVoiceDeliveryRuntimeElement = (tagName = "absolute-voice-delivery-runtime") => {
|
|
552
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
customElements.define(tagName, class AbsoluteVoiceDeliveryRuntimeElement extends HTMLElement {
|
|
556
|
+
mounted;
|
|
557
|
+
connectedCallback() {
|
|
558
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
559
|
+
this.mounted = mountVoiceDeliveryRuntime(this, this.getAttribute("path") ?? "/api/voice-delivery-runtime", {
|
|
560
|
+
description: this.getAttribute("description") ?? undefined,
|
|
561
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
562
|
+
title: this.getAttribute("title") ?? undefined
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
disconnectedCallback() {
|
|
566
|
+
this.mounted?.close();
|
|
567
|
+
this.mounted = undefined;
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
// src/react/useVoiceDeliveryRuntime.tsx
|
|
573
|
+
import { useEffect as useEffect2, useRef as useRef2, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
574
|
+
var useVoiceDeliveryRuntime = (path = "/api/voice-delivery-runtime", options = {}) => {
|
|
575
|
+
const storeRef = useRef2(null);
|
|
576
|
+
if (!storeRef.current) {
|
|
577
|
+
storeRef.current = createVoiceDeliveryRuntimeStore(path, options);
|
|
578
|
+
}
|
|
579
|
+
const store = storeRef.current;
|
|
580
|
+
useEffect2(() => {
|
|
581
|
+
store.refresh().catch(() => {});
|
|
582
|
+
return () => store.close();
|
|
583
|
+
}, [store]);
|
|
584
|
+
return {
|
|
585
|
+
...useSyncExternalStore2(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
586
|
+
refresh: store.refresh
|
|
587
|
+
};
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
// src/react/VoiceDeliveryRuntime.tsx
|
|
591
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
592
|
+
var VoiceDeliveryRuntime = ({
|
|
593
|
+
className,
|
|
594
|
+
path = "/api/voice-delivery-runtime",
|
|
595
|
+
...options
|
|
596
|
+
}) => {
|
|
597
|
+
const snapshot = useVoiceDeliveryRuntime(path, options);
|
|
598
|
+
const model = createVoiceDeliveryRuntimeViewModel(snapshot, options);
|
|
599
|
+
return /* @__PURE__ */ jsxDEV2("section", {
|
|
600
|
+
className: [
|
|
601
|
+
"absolute-voice-delivery-runtime",
|
|
602
|
+
`absolute-voice-delivery-runtime--${model.status}`,
|
|
603
|
+
className
|
|
604
|
+
].filter(Boolean).join(" "),
|
|
605
|
+
children: [
|
|
606
|
+
/* @__PURE__ */ jsxDEV2("header", {
|
|
607
|
+
className: "absolute-voice-delivery-runtime__header",
|
|
608
|
+
children: [
|
|
609
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
610
|
+
className: "absolute-voice-delivery-runtime__eyebrow",
|
|
611
|
+
children: model.title
|
|
612
|
+
}, undefined, false, undefined, this),
|
|
613
|
+
/* @__PURE__ */ jsxDEV2("strong", {
|
|
614
|
+
className: "absolute-voice-delivery-runtime__label",
|
|
615
|
+
children: model.label
|
|
616
|
+
}, undefined, false, undefined, this)
|
|
617
|
+
]
|
|
618
|
+
}, undefined, true, undefined, this),
|
|
619
|
+
/* @__PURE__ */ jsxDEV2("p", {
|
|
620
|
+
className: "absolute-voice-delivery-runtime__description",
|
|
621
|
+
children: model.description
|
|
622
|
+
}, undefined, false, undefined, this),
|
|
623
|
+
/* @__PURE__ */ jsxDEV2("ul", {
|
|
624
|
+
className: "absolute-voice-delivery-runtime__surfaces",
|
|
625
|
+
children: model.surfaces.map((surface) => /* @__PURE__ */ jsxDEV2("li", {
|
|
626
|
+
className: `absolute-voice-delivery-runtime__surface absolute-voice-delivery-runtime__surface--${surface.status}`,
|
|
627
|
+
children: [
|
|
628
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
629
|
+
children: surface.label
|
|
630
|
+
}, undefined, false, undefined, this),
|
|
631
|
+
/* @__PURE__ */ jsxDEV2("strong", {
|
|
632
|
+
children: surface.detail
|
|
633
|
+
}, undefined, false, undefined, this),
|
|
634
|
+
/* @__PURE__ */ jsxDEV2("small", {
|
|
635
|
+
children: [
|
|
636
|
+
surface.failed,
|
|
637
|
+
" failed / ",
|
|
638
|
+
surface.deadLettered,
|
|
639
|
+
" dead-lettered"
|
|
640
|
+
]
|
|
641
|
+
}, undefined, true, undefined, this)
|
|
642
|
+
]
|
|
643
|
+
}, surface.id, true, undefined, this))
|
|
644
|
+
}, undefined, false, undefined, this),
|
|
645
|
+
model.error ? /* @__PURE__ */ jsxDEV2("p", {
|
|
646
|
+
className: "absolute-voice-delivery-runtime__error",
|
|
647
|
+
children: model.error
|
|
648
|
+
}, undefined, false, undefined, this) : null
|
|
649
|
+
]
|
|
650
|
+
}, undefined, true, undefined, this);
|
|
651
|
+
};
|
|
390
652
|
// src/client/providerSimulationControls.ts
|
|
391
653
|
var postSimulation = async (pathPrefix, mode, provider, fetchImpl) => {
|
|
392
654
|
const response = await fetchImpl(`${pathPrefix}/${mode}?provider=${encodeURIComponent(provider)}`, { method: "POST" });
|
|
@@ -467,7 +729,7 @@ var createVoiceProviderSimulationControlsStore = (options) => {
|
|
|
467
729
|
};
|
|
468
730
|
|
|
469
731
|
// src/client/providerSimulationControlsWidget.ts
|
|
470
|
-
var
|
|
732
|
+
var escapeHtml3 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
471
733
|
var formatKind = (kind) => (kind ?? "stt").toUpperCase();
|
|
472
734
|
var createVoiceProviderSimulationControlsViewModel = (snapshot, options) => {
|
|
473
735
|
const configuredProviders = options.providers.filter((provider) => provider.configured !== false);
|
|
@@ -487,18 +749,18 @@ var createVoiceProviderSimulationControlsViewModel = (snapshot, options) => {
|
|
|
487
749
|
};
|
|
488
750
|
var renderVoiceProviderSimulationControlsHTML = (snapshot, options) => {
|
|
489
751
|
const model = createVoiceProviderSimulationControlsViewModel(snapshot, options);
|
|
490
|
-
const failureButtons = model.failureProviders.map((provider) => `<button type="button" data-voice-provider-fail="${
|
|
491
|
-
const recoveryButtons = model.providers.map((provider) => `<button type="button" data-voice-provider-recover="${
|
|
752
|
+
const failureButtons = model.failureProviders.map((provider) => `<button type="button" data-voice-provider-fail="${escapeHtml3(provider.provider)}"${!model.canSimulateFailure || snapshot.isRunning ? " disabled" : ""}>Simulate ${escapeHtml3(provider.provider)} ${escapeHtml3(formatKind(options.kind))} failure</button>`).join("");
|
|
753
|
+
const recoveryButtons = model.providers.map((provider) => `<button type="button" data-voice-provider-recover="${escapeHtml3(provider.provider)}"${snapshot.isRunning ? " disabled" : ""}>Mark ${escapeHtml3(provider.provider)} recovered</button>`).join("");
|
|
492
754
|
return `<section class="absolute-voice-provider-simulation absolute-voice-provider-simulation--${snapshot.error ? "error" : snapshot.isRunning ? "running" : "ready"}">
|
|
493
755
|
<header class="absolute-voice-provider-simulation__header">
|
|
494
|
-
<span class="absolute-voice-provider-simulation__eyebrow">${
|
|
495
|
-
<strong class="absolute-voice-provider-simulation__label">${
|
|
756
|
+
<span class="absolute-voice-provider-simulation__eyebrow">${escapeHtml3(model.title)}</span>
|
|
757
|
+
<strong class="absolute-voice-provider-simulation__label">${escapeHtml3(model.label)}</strong>
|
|
496
758
|
</header>
|
|
497
|
-
<p class="absolute-voice-provider-simulation__description">${
|
|
498
|
-
${model.canSimulateFailure ? "" : `<p class="absolute-voice-provider-simulation__empty">${
|
|
759
|
+
<p class="absolute-voice-provider-simulation__description">${escapeHtml3(model.description)}</p>
|
|
760
|
+
${model.canSimulateFailure ? "" : `<p class="absolute-voice-provider-simulation__empty">${escapeHtml3(options.fallbackRequiredMessage ?? "Configure fallback providers before simulating failure.")}</p>`}
|
|
499
761
|
<div class="absolute-voice-provider-simulation__actions">${failureButtons}${recoveryButtons}</div>
|
|
500
|
-
${snapshot.error ? `<p class="absolute-voice-provider-simulation__error">${
|
|
501
|
-
${model.resultText ? `<pre class="absolute-voice-provider-simulation__result">${
|
|
762
|
+
${snapshot.error ? `<p class="absolute-voice-provider-simulation__error">${escapeHtml3(snapshot.error)}</p>` : ""}
|
|
763
|
+
${model.resultText ? `<pre class="absolute-voice-provider-simulation__result">${escapeHtml3(model.resultText)}</pre>` : ""}
|
|
502
764
|
</section>`;
|
|
503
765
|
};
|
|
504
766
|
var bindVoiceProviderSimulationControls = (element, store) => {
|
|
@@ -564,22 +826,22 @@ var defineVoiceProviderSimulationControlsElement = (tagName = "absolute-voice-pr
|
|
|
564
826
|
};
|
|
565
827
|
|
|
566
828
|
// src/react/useVoiceProviderSimulationControls.tsx
|
|
567
|
-
import { useEffect as
|
|
829
|
+
import { useEffect as useEffect3, useRef as useRef3, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
568
830
|
var useVoiceProviderSimulationControls = (options) => {
|
|
569
|
-
const storeRef =
|
|
831
|
+
const storeRef = useRef3(null);
|
|
570
832
|
if (!storeRef.current) {
|
|
571
833
|
storeRef.current = createVoiceProviderSimulationControlsStore(options);
|
|
572
834
|
}
|
|
573
835
|
const store = storeRef.current;
|
|
574
|
-
|
|
836
|
+
useEffect3(() => () => store.close(), [store]);
|
|
575
837
|
return {
|
|
576
|
-
...
|
|
838
|
+
...useSyncExternalStore3(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
577
839
|
run: store.run
|
|
578
840
|
};
|
|
579
841
|
};
|
|
580
842
|
|
|
581
843
|
// src/react/VoiceProviderSimulationControls.tsx
|
|
582
|
-
import { jsxDEV as
|
|
844
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
583
845
|
var VoiceProviderSimulationControls = ({
|
|
584
846
|
className,
|
|
585
847
|
...options
|
|
@@ -589,38 +851,38 @@ var VoiceProviderSimulationControls = ({
|
|
|
589
851
|
const run = (provider, mode) => {
|
|
590
852
|
snapshot.run(provider, mode).catch(() => {});
|
|
591
853
|
};
|
|
592
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ jsxDEV3("section", {
|
|
593
855
|
className: [
|
|
594
856
|
"absolute-voice-provider-simulation",
|
|
595
857
|
`absolute-voice-provider-simulation--${snapshot.error ? "error" : snapshot.isRunning ? "running" : "ready"}`,
|
|
596
858
|
className
|
|
597
859
|
].filter(Boolean).join(" "),
|
|
598
860
|
children: [
|
|
599
|
-
/* @__PURE__ */
|
|
861
|
+
/* @__PURE__ */ jsxDEV3("header", {
|
|
600
862
|
className: "absolute-voice-provider-simulation__header",
|
|
601
863
|
children: [
|
|
602
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
603
865
|
className: "absolute-voice-provider-simulation__eyebrow",
|
|
604
866
|
children: model.title
|
|
605
867
|
}, undefined, false, undefined, this),
|
|
606
|
-
/* @__PURE__ */
|
|
868
|
+
/* @__PURE__ */ jsxDEV3("strong", {
|
|
607
869
|
className: "absolute-voice-provider-simulation__label",
|
|
608
870
|
children: model.label
|
|
609
871
|
}, undefined, false, undefined, this)
|
|
610
872
|
]
|
|
611
873
|
}, undefined, true, undefined, this),
|
|
612
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ jsxDEV3("p", {
|
|
613
875
|
className: "absolute-voice-provider-simulation__description",
|
|
614
876
|
children: model.description
|
|
615
877
|
}, undefined, false, undefined, this),
|
|
616
|
-
model.canSimulateFailure ? null : /* @__PURE__ */
|
|
878
|
+
model.canSimulateFailure ? null : /* @__PURE__ */ jsxDEV3("p", {
|
|
617
879
|
className: "absolute-voice-provider-simulation__empty",
|
|
618
880
|
children: options.fallbackRequiredMessage ?? "Configure fallback providers before simulating failure."
|
|
619
881
|
}, undefined, false, undefined, this),
|
|
620
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
621
883
|
className: "absolute-voice-provider-simulation__actions",
|
|
622
884
|
children: [
|
|
623
|
-
model.failureProviders.map((provider) => /* @__PURE__ */
|
|
885
|
+
model.failureProviders.map((provider) => /* @__PURE__ */ jsxDEV3("button", {
|
|
624
886
|
disabled: !model.canSimulateFailure || snapshot.isRunning,
|
|
625
887
|
onClick: () => run(provider.provider, "failure"),
|
|
626
888
|
type: "button",
|
|
@@ -633,7 +895,7 @@ var VoiceProviderSimulationControls = ({
|
|
|
633
895
|
"failure"
|
|
634
896
|
]
|
|
635
897
|
}, `fail-${provider.provider}`, true, undefined, this)),
|
|
636
|
-
model.providers.map((provider) => /* @__PURE__ */
|
|
898
|
+
model.providers.map((provider) => /* @__PURE__ */ jsxDEV3("button", {
|
|
637
899
|
disabled: snapshot.isRunning,
|
|
638
900
|
onClick: () => run(provider.provider, "recovery"),
|
|
639
901
|
type: "button",
|
|
@@ -645,11 +907,11 @@ var VoiceProviderSimulationControls = ({
|
|
|
645
907
|
}, `recover-${provider.provider}`, true, undefined, this))
|
|
646
908
|
]
|
|
647
909
|
}, undefined, true, undefined, this),
|
|
648
|
-
snapshot.error ? /* @__PURE__ */
|
|
910
|
+
snapshot.error ? /* @__PURE__ */ jsxDEV3("p", {
|
|
649
911
|
className: "absolute-voice-provider-simulation__error",
|
|
650
912
|
children: snapshot.error
|
|
651
913
|
}, undefined, false, undefined, this) : null,
|
|
652
|
-
model.resultText ? /* @__PURE__ */
|
|
914
|
+
model.resultText ? /* @__PURE__ */ jsxDEV3("pre", {
|
|
653
915
|
className: "absolute-voice-provider-simulation__result",
|
|
654
916
|
children: model.resultText
|
|
655
917
|
}, undefined, false, undefined, this) : null
|
|
@@ -657,7 +919,7 @@ var VoiceProviderSimulationControls = ({
|
|
|
657
919
|
}, undefined, true, undefined, this);
|
|
658
920
|
};
|
|
659
921
|
// src/react/useVoiceProviderCapabilities.tsx
|
|
660
|
-
import { useEffect as
|
|
922
|
+
import { useEffect as useEffect4, useRef as useRef4, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
661
923
|
|
|
662
924
|
// src/client/providerCapabilities.ts
|
|
663
925
|
var fetchVoiceProviderCapabilities = async (path = "/api/provider-capabilities", options = {}) => {
|
|
@@ -740,25 +1002,25 @@ var createVoiceProviderCapabilitiesStore = (path = "/api/provider-capabilities",
|
|
|
740
1002
|
|
|
741
1003
|
// src/react/useVoiceProviderCapabilities.tsx
|
|
742
1004
|
var useVoiceProviderCapabilities = (path = "/api/provider-capabilities", options = {}) => {
|
|
743
|
-
const storeRef =
|
|
1005
|
+
const storeRef = useRef4(null);
|
|
744
1006
|
if (!storeRef.current) {
|
|
745
1007
|
storeRef.current = createVoiceProviderCapabilitiesStore(path, options);
|
|
746
1008
|
}
|
|
747
1009
|
const store = storeRef.current;
|
|
748
|
-
|
|
1010
|
+
useEffect4(() => {
|
|
749
1011
|
store.refresh().catch(() => {});
|
|
750
1012
|
return () => store.close();
|
|
751
1013
|
}, [store]);
|
|
752
1014
|
return {
|
|
753
|
-
...
|
|
1015
|
+
...useSyncExternalStore4(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
754
1016
|
refresh: store.refresh
|
|
755
1017
|
};
|
|
756
1018
|
};
|
|
757
1019
|
|
|
758
1020
|
// src/client/providerCapabilitiesWidget.ts
|
|
759
|
-
var
|
|
760
|
-
var
|
|
761
|
-
var
|
|
1021
|
+
var DEFAULT_TITLE3 = "Provider Capabilities";
|
|
1022
|
+
var DEFAULT_DESCRIPTION3 = "Configured, selected, and healthy voice providers for this deployment.";
|
|
1023
|
+
var escapeHtml4 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
762
1024
|
var formatProvider = (provider) => provider.split(/[-_\s]+/).filter(Boolean).map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ") || provider;
|
|
763
1025
|
var formatKind2 = (kind) => kind.toUpperCase();
|
|
764
1026
|
var formatStatus = (status) => status.split("-").map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
|
|
@@ -802,36 +1064,36 @@ var createVoiceProviderCapabilitiesViewModel = (snapshot, options = {}) => {
|
|
|
802
1064
|
const selectedCount = snapshot.report?.selected ?? capabilities.filter((capability) => capability.selected).length;
|
|
803
1065
|
return {
|
|
804
1066
|
capabilities,
|
|
805
|
-
description: options.description ??
|
|
1067
|
+
description: options.description ?? DEFAULT_DESCRIPTION3,
|
|
806
1068
|
error: snapshot.error,
|
|
807
1069
|
isLoading: snapshot.isLoading,
|
|
808
1070
|
label: snapshot.error ? "Unavailable" : capabilities.length ? warningCount > 0 ? `${warningCount} needs attention` : `${selectedCount} selected` : snapshot.isLoading ? "Checking" : "No capabilities",
|
|
809
1071
|
status: snapshot.error ? "error" : capabilities.length ? warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
810
|
-
title: options.title ??
|
|
1072
|
+
title: options.title ?? DEFAULT_TITLE3,
|
|
811
1073
|
updatedAt: snapshot.updatedAt
|
|
812
1074
|
};
|
|
813
1075
|
};
|
|
814
1076
|
var renderVoiceProviderCapabilitiesHTML = (snapshot, options = {}) => {
|
|
815
1077
|
const model = createVoiceProviderCapabilitiesViewModel(snapshot, options);
|
|
816
|
-
const capabilities = model.capabilities.length ? `<div class="absolute-voice-provider-capabilities__providers">${model.capabilities.map((capability) => `<article class="absolute-voice-provider-capabilities__provider absolute-voice-provider-capabilities__provider--${
|
|
1078
|
+
const capabilities = model.capabilities.length ? `<div class="absolute-voice-provider-capabilities__providers">${model.capabilities.map((capability) => `<article class="absolute-voice-provider-capabilities__provider absolute-voice-provider-capabilities__provider--${escapeHtml4(capability.status)}">
|
|
817
1079
|
<header>
|
|
818
|
-
<strong>${
|
|
819
|
-
<span>${
|
|
1080
|
+
<strong>${escapeHtml4(capability.label)}</strong>
|
|
1081
|
+
<span>${escapeHtml4(formatStatus(capability.status))}</span>
|
|
820
1082
|
</header>
|
|
821
|
-
<p>${
|
|
1083
|
+
<p>${escapeHtml4(capability.detail)}</p>
|
|
822
1084
|
<dl>${capability.rows.map((row) => `<div>
|
|
823
|
-
<dt>${
|
|
824
|
-
<dd>${
|
|
1085
|
+
<dt>${escapeHtml4(row.label)}</dt>
|
|
1086
|
+
<dd>${escapeHtml4(row.value)}</dd>
|
|
825
1087
|
</div>`).join("")}</dl>
|
|
826
1088
|
</article>`).join("")}</div>` : '<p class="absolute-voice-provider-capabilities__empty">Configure provider capabilities to see deployment coverage.</p>';
|
|
827
|
-
return `<section class="absolute-voice-provider-capabilities absolute-voice-provider-capabilities--${
|
|
1089
|
+
return `<section class="absolute-voice-provider-capabilities absolute-voice-provider-capabilities--${escapeHtml4(model.status)}">
|
|
828
1090
|
<header class="absolute-voice-provider-capabilities__header">
|
|
829
|
-
<span class="absolute-voice-provider-capabilities__eyebrow">${
|
|
830
|
-
<strong class="absolute-voice-provider-capabilities__label">${
|
|
1091
|
+
<span class="absolute-voice-provider-capabilities__eyebrow">${escapeHtml4(model.title)}</span>
|
|
1092
|
+
<strong class="absolute-voice-provider-capabilities__label">${escapeHtml4(model.label)}</strong>
|
|
831
1093
|
</header>
|
|
832
|
-
<p class="absolute-voice-provider-capabilities__description">${
|
|
1094
|
+
<p class="absolute-voice-provider-capabilities__description">${escapeHtml4(model.description)}</p>
|
|
833
1095
|
${capabilities}
|
|
834
|
-
${model.error ? `<p class="absolute-voice-provider-capabilities__error">${
|
|
1096
|
+
${model.error ? `<p class="absolute-voice-provider-capabilities__error">${escapeHtml4(model.error)}</p>` : ""}
|
|
835
1097
|
</section>`;
|
|
836
1098
|
};
|
|
837
1099
|
var getVoiceProviderCapabilitiesCSS = () => `.absolute-voice-provider-capabilities{border:1px solid #bfd7ea;border-radius:20px;background:#f6fbff;color:#08131f;padding:18px;box-shadow:0 18px 40px rgba(14,51,78,.12);font-family:inherit}.absolute-voice-provider-capabilities--error,.absolute-voice-provider-capabilities--warning{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-provider-capabilities__header,.absolute-voice-provider-capabilities__provider header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-provider-capabilities__eyebrow{color:#255f85;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-provider-capabilities__label{font-size:24px;line-height:1}.absolute-voice-provider-capabilities__description,.absolute-voice-provider-capabilities__provider p,.absolute-voice-provider-capabilities__provider dt,.absolute-voice-provider-capabilities__empty{color:#405467}.absolute-voice-provider-capabilities__providers{display:grid;gap:12px;margin-top:14px}.absolute-voice-provider-capabilities__provider{background:#fff;border:1px solid #d7e7f3;border-radius:16px;padding:14px}.absolute-voice-provider-capabilities__provider--selected,.absolute-voice-provider-capabilities__provider--healthy{border-color:#86efac}.absolute-voice-provider-capabilities__provider--degraded,.absolute-voice-provider-capabilities__provider--rate-limited,.absolute-voice-provider-capabilities__provider--suppressed,.absolute-voice-provider-capabilities__provider--unconfigured{border-color:#f2a7a7}.absolute-voice-provider-capabilities__provider p{margin:10px 0}.absolute-voice-provider-capabilities__provider dl{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr));margin:0}.absolute-voice-provider-capabilities__provider div{background:#f6fbff;border:1px solid #d7e7f3;border-radius:12px;padding:8px}.absolute-voice-provider-capabilities__provider dt{font-size:12px}.absolute-voice-provider-capabilities__provider dd{font-weight:800;margin:4px 0 0}.absolute-voice-provider-capabilities__empty{margin:14px 0 0}.absolute-voice-provider-capabilities__error{color:#9f1239;font-weight:700}`;
|
|
@@ -873,7 +1135,7 @@ var defineVoiceProviderCapabilitiesElement = (tagName = "absolute-voice-provider
|
|
|
873
1135
|
};
|
|
874
1136
|
|
|
875
1137
|
// src/react/VoiceProviderCapabilities.tsx
|
|
876
|
-
import { jsxDEV as
|
|
1138
|
+
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
877
1139
|
var VoiceProviderCapabilities = ({
|
|
878
1140
|
className,
|
|
879
1141
|
path = "/api/provider-capabilities",
|
|
@@ -881,58 +1143,58 @@ var VoiceProviderCapabilities = ({
|
|
|
881
1143
|
}) => {
|
|
882
1144
|
const snapshot = useVoiceProviderCapabilities(path, options);
|
|
883
1145
|
const model = createVoiceProviderCapabilitiesViewModel(snapshot, options);
|
|
884
|
-
return /* @__PURE__ */
|
|
1146
|
+
return /* @__PURE__ */ jsxDEV4("section", {
|
|
885
1147
|
className: [
|
|
886
1148
|
"absolute-voice-provider-capabilities",
|
|
887
1149
|
`absolute-voice-provider-capabilities--${model.status}`,
|
|
888
1150
|
className
|
|
889
1151
|
].filter(Boolean).join(" "),
|
|
890
1152
|
children: [
|
|
891
|
-
/* @__PURE__ */
|
|
1153
|
+
/* @__PURE__ */ jsxDEV4("header", {
|
|
892
1154
|
className: "absolute-voice-provider-capabilities__header",
|
|
893
1155
|
children: [
|
|
894
|
-
/* @__PURE__ */
|
|
1156
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
895
1157
|
className: "absolute-voice-provider-capabilities__eyebrow",
|
|
896
1158
|
children: model.title
|
|
897
1159
|
}, undefined, false, undefined, this),
|
|
898
|
-
/* @__PURE__ */
|
|
1160
|
+
/* @__PURE__ */ jsxDEV4("strong", {
|
|
899
1161
|
className: "absolute-voice-provider-capabilities__label",
|
|
900
1162
|
children: model.label
|
|
901
1163
|
}, undefined, false, undefined, this)
|
|
902
1164
|
]
|
|
903
1165
|
}, undefined, true, undefined, this),
|
|
904
|
-
/* @__PURE__ */
|
|
1166
|
+
/* @__PURE__ */ jsxDEV4("p", {
|
|
905
1167
|
className: "absolute-voice-provider-capabilities__description",
|
|
906
1168
|
children: model.description
|
|
907
1169
|
}, undefined, false, undefined, this),
|
|
908
|
-
model.capabilities.length ? /* @__PURE__ */
|
|
1170
|
+
model.capabilities.length ? /* @__PURE__ */ jsxDEV4("div", {
|
|
909
1171
|
className: "absolute-voice-provider-capabilities__providers",
|
|
910
|
-
children: model.capabilities.map((capability) => /* @__PURE__ */
|
|
1172
|
+
children: model.capabilities.map((capability) => /* @__PURE__ */ jsxDEV4("article", {
|
|
911
1173
|
className: [
|
|
912
1174
|
"absolute-voice-provider-capabilities__provider",
|
|
913
1175
|
`absolute-voice-provider-capabilities__provider--${capability.status}`
|
|
914
1176
|
].join(" "),
|
|
915
1177
|
children: [
|
|
916
|
-
/* @__PURE__ */
|
|
1178
|
+
/* @__PURE__ */ jsxDEV4("header", {
|
|
917
1179
|
children: [
|
|
918
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__PURE__ */ jsxDEV4("strong", {
|
|
919
1181
|
children: capability.label
|
|
920
1182
|
}, undefined, false, undefined, this),
|
|
921
|
-
/* @__PURE__ */
|
|
1183
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
922
1184
|
children: capability.status
|
|
923
1185
|
}, undefined, false, undefined, this)
|
|
924
1186
|
]
|
|
925
1187
|
}, undefined, true, undefined, this),
|
|
926
|
-
/* @__PURE__ */
|
|
1188
|
+
/* @__PURE__ */ jsxDEV4("p", {
|
|
927
1189
|
children: capability.detail
|
|
928
1190
|
}, undefined, false, undefined, this),
|
|
929
|
-
/* @__PURE__ */
|
|
930
|
-
children: capability.rows.map((row) => /* @__PURE__ */
|
|
1191
|
+
/* @__PURE__ */ jsxDEV4("dl", {
|
|
1192
|
+
children: capability.rows.map((row) => /* @__PURE__ */ jsxDEV4("div", {
|
|
931
1193
|
children: [
|
|
932
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ jsxDEV4("dt", {
|
|
933
1195
|
children: row.label
|
|
934
1196
|
}, undefined, false, undefined, this),
|
|
935
|
-
/* @__PURE__ */
|
|
1197
|
+
/* @__PURE__ */ jsxDEV4("dd", {
|
|
936
1198
|
children: row.value
|
|
937
1199
|
}, undefined, false, undefined, this)
|
|
938
1200
|
]
|
|
@@ -940,11 +1202,11 @@ var VoiceProviderCapabilities = ({
|
|
|
940
1202
|
}, undefined, false, undefined, this)
|
|
941
1203
|
]
|
|
942
1204
|
}, `${capability.kind}:${capability.provider}`, true, undefined, this))
|
|
943
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
1205
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV4("p", {
|
|
944
1206
|
className: "absolute-voice-provider-capabilities__empty",
|
|
945
1207
|
children: "Configure provider capabilities to see deployment coverage."
|
|
946
1208
|
}, undefined, false, undefined, this),
|
|
947
|
-
model.error ? /* @__PURE__ */
|
|
1209
|
+
model.error ? /* @__PURE__ */ jsxDEV4("p", {
|
|
948
1210
|
className: "absolute-voice-provider-capabilities__error",
|
|
949
1211
|
children: model.error
|
|
950
1212
|
}, undefined, false, undefined, this) : null
|
|
@@ -952,7 +1214,7 @@ var VoiceProviderCapabilities = ({
|
|
|
952
1214
|
}, undefined, true, undefined, this);
|
|
953
1215
|
};
|
|
954
1216
|
// src/react/useVoiceProviderStatus.tsx
|
|
955
|
-
import { useEffect as
|
|
1217
|
+
import { useEffect as useEffect5, useRef as useRef5, useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
956
1218
|
|
|
957
1219
|
// src/client/providerStatus.ts
|
|
958
1220
|
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
@@ -1036,25 +1298,25 @@ var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {
|
|
|
1036
1298
|
|
|
1037
1299
|
// src/react/useVoiceProviderStatus.tsx
|
|
1038
1300
|
var useVoiceProviderStatus = (path = "/api/provider-status", options = {}) => {
|
|
1039
|
-
const storeRef =
|
|
1301
|
+
const storeRef = useRef5(null);
|
|
1040
1302
|
if (!storeRef.current) {
|
|
1041
1303
|
storeRef.current = createVoiceProviderStatusStore(path, options);
|
|
1042
1304
|
}
|
|
1043
1305
|
const store = storeRef.current;
|
|
1044
|
-
|
|
1306
|
+
useEffect5(() => {
|
|
1045
1307
|
store.refresh().catch(() => {});
|
|
1046
1308
|
return () => store.close();
|
|
1047
1309
|
}, [store]);
|
|
1048
1310
|
return {
|
|
1049
|
-
...
|
|
1311
|
+
...useSyncExternalStore5(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
1050
1312
|
refresh: store.refresh
|
|
1051
1313
|
};
|
|
1052
1314
|
};
|
|
1053
1315
|
|
|
1054
1316
|
// src/client/providerStatusWidget.ts
|
|
1055
|
-
var
|
|
1056
|
-
var
|
|
1057
|
-
var
|
|
1317
|
+
var DEFAULT_TITLE4 = "Voice Providers";
|
|
1318
|
+
var DEFAULT_DESCRIPTION4 = "Live provider health, fallback counts, latency, and suppression state from your self-hosted trace store.";
|
|
1319
|
+
var escapeHtml5 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1058
1320
|
var formatProvider2 = (provider) => provider.split(/[-_\s]+/).filter(Boolean).map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ") || provider;
|
|
1059
1321
|
var formatStatus2 = (status) => status.split("-").map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
|
|
1060
1322
|
var formatLatency = (value) => typeof value === "number" ? `${value}ms` : "No samples";
|
|
@@ -1098,37 +1360,37 @@ var createVoiceProviderStatusViewModel = (snapshot, options = {}) => {
|
|
|
1098
1360
|
const warningCount = providers.filter((provider) => isWarningStatus2(provider.status)).length;
|
|
1099
1361
|
const healthyCount = providers.filter((provider) => provider.status === "healthy").length;
|
|
1100
1362
|
return {
|
|
1101
|
-
description: options.description ??
|
|
1363
|
+
description: options.description ?? DEFAULT_DESCRIPTION4,
|
|
1102
1364
|
error: snapshot.error,
|
|
1103
1365
|
isLoading: snapshot.isLoading,
|
|
1104
1366
|
label: snapshot.error ? "Unavailable" : providers.length ? warningCount > 0 ? `${warningCount} needs attention` : `${healthyCount} healthy` : snapshot.isLoading ? "Checking" : "No provider traffic",
|
|
1105
1367
|
providers,
|
|
1106
1368
|
status: snapshot.error ? "error" : providers.length ? warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
1107
|
-
title: options.title ??
|
|
1369
|
+
title: options.title ?? DEFAULT_TITLE4,
|
|
1108
1370
|
updatedAt: snapshot.updatedAt
|
|
1109
1371
|
};
|
|
1110
1372
|
};
|
|
1111
1373
|
var renderVoiceProviderStatusHTML = (snapshot, options = {}) => {
|
|
1112
1374
|
const model = createVoiceProviderStatusViewModel(snapshot, options);
|
|
1113
|
-
const providers = model.providers.length ? `<div class="absolute-voice-provider-status__providers">${model.providers.map((provider) => `<article class="absolute-voice-provider-status__provider absolute-voice-provider-status__provider--${
|
|
1375
|
+
const providers = model.providers.length ? `<div class="absolute-voice-provider-status__providers">${model.providers.map((provider) => `<article class="absolute-voice-provider-status__provider absolute-voice-provider-status__provider--${escapeHtml5(provider.status)}">
|
|
1114
1376
|
<header>
|
|
1115
|
-
<strong>${
|
|
1116
|
-
<span>${
|
|
1377
|
+
<strong>${escapeHtml5(provider.label)}</strong>
|
|
1378
|
+
<span>${escapeHtml5(formatStatus2(provider.status))}</span>
|
|
1117
1379
|
</header>
|
|
1118
|
-
<p>${
|
|
1380
|
+
<p>${escapeHtml5(provider.detail)}</p>
|
|
1119
1381
|
<dl>${provider.rows.map((row) => `<div>
|
|
1120
|
-
<dt>${
|
|
1121
|
-
<dd>${
|
|
1382
|
+
<dt>${escapeHtml5(row.label)}</dt>
|
|
1383
|
+
<dd>${escapeHtml5(row.value)}</dd>
|
|
1122
1384
|
</div>`).join("")}</dl>
|
|
1123
1385
|
</article>`).join("")}</div>` : '<p class="absolute-voice-provider-status__empty">Run voice traffic to see provider health.</p>';
|
|
1124
|
-
return `<section class="absolute-voice-provider-status absolute-voice-provider-status--${
|
|
1386
|
+
return `<section class="absolute-voice-provider-status absolute-voice-provider-status--${escapeHtml5(model.status)}">
|
|
1125
1387
|
<header class="absolute-voice-provider-status__header">
|
|
1126
|
-
<span class="absolute-voice-provider-status__eyebrow">${
|
|
1127
|
-
<strong class="absolute-voice-provider-status__label">${
|
|
1388
|
+
<span class="absolute-voice-provider-status__eyebrow">${escapeHtml5(model.title)}</span>
|
|
1389
|
+
<strong class="absolute-voice-provider-status__label">${escapeHtml5(model.label)}</strong>
|
|
1128
1390
|
</header>
|
|
1129
|
-
<p class="absolute-voice-provider-status__description">${
|
|
1391
|
+
<p class="absolute-voice-provider-status__description">${escapeHtml5(model.description)}</p>
|
|
1130
1392
|
${providers}
|
|
1131
|
-
${model.error ? `<p class="absolute-voice-provider-status__error">${
|
|
1393
|
+
${model.error ? `<p class="absolute-voice-provider-status__error">${escapeHtml5(model.error)}</p>` : ""}
|
|
1132
1394
|
</section>`;
|
|
1133
1395
|
};
|
|
1134
1396
|
var getVoiceProviderStatusCSS = () => `.absolute-voice-provider-status{border:1px solid #d8d2c4;border-radius:20px;background:#fffaf0;color:#16130d;padding:18px;box-shadow:0 18px 40px rgba(47,37,18,.12);font-family:inherit}.absolute-voice-provider-status--error,.absolute-voice-provider-status--warning{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-provider-status__header,.absolute-voice-provider-status__provider header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-provider-status__eyebrow{color:#73664f;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-provider-status__label{font-size:24px;line-height:1}.absolute-voice-provider-status__description,.absolute-voice-provider-status__provider p,.absolute-voice-provider-status__provider dt,.absolute-voice-provider-status__empty{color:#514733}.absolute-voice-provider-status__providers{display:grid;gap:12px;margin-top:14px}.absolute-voice-provider-status__provider{background:#fff;border:1px solid #eee4d2;border-radius:16px;padding:14px}.absolute-voice-provider-status__provider--degraded,.absolute-voice-provider-status__provider--rate-limited,.absolute-voice-provider-status__provider--suppressed{border-color:#f2a7a7}.absolute-voice-provider-status__provider--recoverable{border-color:#fbbf24}.absolute-voice-provider-status__provider p{margin:10px 0}.absolute-voice-provider-status__provider dl{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr));margin:0}.absolute-voice-provider-status__provider div{background:#fffaf0;border:1px solid #eee4d2;border-radius:12px;padding:8px}.absolute-voice-provider-status__provider dt{font-size:12px}.absolute-voice-provider-status__provider dd{font-weight:800;margin:4px 0 0}.absolute-voice-provider-status__empty{margin:14px 0 0}.absolute-voice-provider-status__error{color:#9f1239;font-weight:700}`;
|
|
@@ -1170,7 +1432,7 @@ var defineVoiceProviderStatusElement = (tagName = "absolute-voice-provider-statu
|
|
|
1170
1432
|
};
|
|
1171
1433
|
|
|
1172
1434
|
// src/react/VoiceProviderStatus.tsx
|
|
1173
|
-
import { jsxDEV as
|
|
1435
|
+
import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
|
|
1174
1436
|
var VoiceProviderStatus = ({
|
|
1175
1437
|
className,
|
|
1176
1438
|
path = "/api/provider-status",
|
|
@@ -1178,58 +1440,58 @@ var VoiceProviderStatus = ({
|
|
|
1178
1440
|
}) => {
|
|
1179
1441
|
const snapshot = useVoiceProviderStatus(path, options);
|
|
1180
1442
|
const model = createVoiceProviderStatusViewModel(snapshot, options);
|
|
1181
|
-
return /* @__PURE__ */
|
|
1443
|
+
return /* @__PURE__ */ jsxDEV5("section", {
|
|
1182
1444
|
className: [
|
|
1183
1445
|
"absolute-voice-provider-status",
|
|
1184
1446
|
`absolute-voice-provider-status--${model.status}`,
|
|
1185
1447
|
className
|
|
1186
1448
|
].filter(Boolean).join(" "),
|
|
1187
1449
|
children: [
|
|
1188
|
-
/* @__PURE__ */
|
|
1450
|
+
/* @__PURE__ */ jsxDEV5("header", {
|
|
1189
1451
|
className: "absolute-voice-provider-status__header",
|
|
1190
1452
|
children: [
|
|
1191
|
-
/* @__PURE__ */
|
|
1453
|
+
/* @__PURE__ */ jsxDEV5("span", {
|
|
1192
1454
|
className: "absolute-voice-provider-status__eyebrow",
|
|
1193
1455
|
children: model.title
|
|
1194
1456
|
}, undefined, false, undefined, this),
|
|
1195
|
-
/* @__PURE__ */
|
|
1457
|
+
/* @__PURE__ */ jsxDEV5("strong", {
|
|
1196
1458
|
className: "absolute-voice-provider-status__label",
|
|
1197
1459
|
children: model.label
|
|
1198
1460
|
}, undefined, false, undefined, this)
|
|
1199
1461
|
]
|
|
1200
1462
|
}, undefined, true, undefined, this),
|
|
1201
|
-
/* @__PURE__ */
|
|
1463
|
+
/* @__PURE__ */ jsxDEV5("p", {
|
|
1202
1464
|
className: "absolute-voice-provider-status__description",
|
|
1203
1465
|
children: model.description
|
|
1204
1466
|
}, undefined, false, undefined, this),
|
|
1205
|
-
model.providers.length ? /* @__PURE__ */
|
|
1467
|
+
model.providers.length ? /* @__PURE__ */ jsxDEV5("div", {
|
|
1206
1468
|
className: "absolute-voice-provider-status__providers",
|
|
1207
|
-
children: model.providers.map((provider) => /* @__PURE__ */
|
|
1469
|
+
children: model.providers.map((provider) => /* @__PURE__ */ jsxDEV5("article", {
|
|
1208
1470
|
className: [
|
|
1209
1471
|
"absolute-voice-provider-status__provider",
|
|
1210
1472
|
`absolute-voice-provider-status__provider--${provider.status}`
|
|
1211
1473
|
].join(" "),
|
|
1212
1474
|
children: [
|
|
1213
|
-
/* @__PURE__ */
|
|
1475
|
+
/* @__PURE__ */ jsxDEV5("header", {
|
|
1214
1476
|
children: [
|
|
1215
|
-
/* @__PURE__ */
|
|
1477
|
+
/* @__PURE__ */ jsxDEV5("strong", {
|
|
1216
1478
|
children: provider.label
|
|
1217
1479
|
}, undefined, false, undefined, this),
|
|
1218
|
-
/* @__PURE__ */
|
|
1480
|
+
/* @__PURE__ */ jsxDEV5("span", {
|
|
1219
1481
|
children: provider.status
|
|
1220
1482
|
}, undefined, false, undefined, this)
|
|
1221
1483
|
]
|
|
1222
1484
|
}, undefined, true, undefined, this),
|
|
1223
|
-
/* @__PURE__ */
|
|
1485
|
+
/* @__PURE__ */ jsxDEV5("p", {
|
|
1224
1486
|
children: provider.detail
|
|
1225
1487
|
}, undefined, false, undefined, this),
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
-
children: provider.rows.map((row) => /* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ jsxDEV5("dl", {
|
|
1489
|
+
children: provider.rows.map((row) => /* @__PURE__ */ jsxDEV5("div", {
|
|
1228
1490
|
children: [
|
|
1229
|
-
/* @__PURE__ */
|
|
1491
|
+
/* @__PURE__ */ jsxDEV5("dt", {
|
|
1230
1492
|
children: row.label
|
|
1231
1493
|
}, undefined, false, undefined, this),
|
|
1232
|
-
/* @__PURE__ */
|
|
1494
|
+
/* @__PURE__ */ jsxDEV5("dd", {
|
|
1233
1495
|
children: row.value
|
|
1234
1496
|
}, undefined, false, undefined, this)
|
|
1235
1497
|
]
|
|
@@ -1237,11 +1499,11 @@ var VoiceProviderStatus = ({
|
|
|
1237
1499
|
}, undefined, false, undefined, this)
|
|
1238
1500
|
]
|
|
1239
1501
|
}, provider.provider, true, undefined, this))
|
|
1240
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
1502
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV5("p", {
|
|
1241
1503
|
className: "absolute-voice-provider-status__empty",
|
|
1242
1504
|
children: "Run voice traffic to see provider health."
|
|
1243
1505
|
}, undefined, false, undefined, this),
|
|
1244
|
-
model.error ? /* @__PURE__ */
|
|
1506
|
+
model.error ? /* @__PURE__ */ jsxDEV5("p", {
|
|
1245
1507
|
className: "absolute-voice-provider-status__error",
|
|
1246
1508
|
children: model.error
|
|
1247
1509
|
}, undefined, false, undefined, this) : null
|
|
@@ -1249,7 +1511,7 @@ var VoiceProviderStatus = ({
|
|
|
1249
1511
|
}, undefined, true, undefined, this);
|
|
1250
1512
|
};
|
|
1251
1513
|
// src/react/useVoiceRoutingStatus.tsx
|
|
1252
|
-
import { useEffect as
|
|
1514
|
+
import { useEffect as useEffect6, useRef as useRef6, useSyncExternalStore as useSyncExternalStore6 } from "react";
|
|
1253
1515
|
|
|
1254
1516
|
// src/client/routingStatus.ts
|
|
1255
1517
|
var fetchVoiceRoutingStatus = async (path = "/api/routing/latest", options = {}) => {
|
|
@@ -1333,25 +1595,25 @@ var createVoiceRoutingStatusStore = (path = "/api/routing/latest", options = {})
|
|
|
1333
1595
|
|
|
1334
1596
|
// src/react/useVoiceRoutingStatus.tsx
|
|
1335
1597
|
var useVoiceRoutingStatus = (path = "/api/routing/latest", options = {}) => {
|
|
1336
|
-
const storeRef =
|
|
1598
|
+
const storeRef = useRef6(null);
|
|
1337
1599
|
if (!storeRef.current) {
|
|
1338
1600
|
storeRef.current = createVoiceRoutingStatusStore(path, options);
|
|
1339
1601
|
}
|
|
1340
1602
|
const store = storeRef.current;
|
|
1341
|
-
|
|
1603
|
+
useEffect6(() => {
|
|
1342
1604
|
store.refresh().catch(() => {});
|
|
1343
1605
|
return () => store.close();
|
|
1344
1606
|
}, [store]);
|
|
1345
1607
|
return {
|
|
1346
|
-
...
|
|
1608
|
+
...useSyncExternalStore6(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
1347
1609
|
refresh: store.refresh
|
|
1348
1610
|
};
|
|
1349
1611
|
};
|
|
1350
1612
|
|
|
1351
1613
|
// src/client/routingStatusWidget.ts
|
|
1352
|
-
var
|
|
1353
|
-
var
|
|
1354
|
-
var
|
|
1614
|
+
var DEFAULT_TITLE5 = "Voice Routing";
|
|
1615
|
+
var DEFAULT_DESCRIPTION5 = "Latest provider routing decision from the self-hosted trace store.";
|
|
1616
|
+
var escapeHtml6 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1355
1617
|
var formatValue = (value, fallback = "None") => typeof value === "string" && value.trim() ? value : typeof value === "number" && Number.isFinite(value) ? String(value) : fallback;
|
|
1356
1618
|
var createVoiceRoutingStatusViewModel = (snapshot, options = {}) => {
|
|
1357
1619
|
const decision = snapshot.decision;
|
|
@@ -1375,30 +1637,30 @@ var createVoiceRoutingStatusViewModel = (snapshot, options = {}) => {
|
|
|
1375
1637
|
] : [];
|
|
1376
1638
|
return {
|
|
1377
1639
|
decision,
|
|
1378
|
-
description: options.description ??
|
|
1640
|
+
description: options.description ?? DEFAULT_DESCRIPTION5,
|
|
1379
1641
|
error: snapshot.error,
|
|
1380
1642
|
isLoading: snapshot.isLoading,
|
|
1381
1643
|
label: snapshot.error ? "Unavailable" : decision ? `${formatValue(decision.kind).toUpperCase()} ${formatValue(decision.status, "unknown")}` : snapshot.isLoading ? "Checking" : "No routing yet",
|
|
1382
1644
|
rows,
|
|
1383
1645
|
status: snapshot.error ? "error" : decision ? "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
1384
|
-
title: options.title ??
|
|
1646
|
+
title: options.title ?? DEFAULT_TITLE5,
|
|
1385
1647
|
updatedAt: snapshot.updatedAt
|
|
1386
1648
|
};
|
|
1387
1649
|
};
|
|
1388
1650
|
var renderVoiceRoutingStatusHTML = (snapshot, options = {}) => {
|
|
1389
1651
|
const model = createVoiceRoutingStatusViewModel(snapshot, options);
|
|
1390
1652
|
const rows = model.rows.length ? `<div class="absolute-voice-routing-status__grid">${model.rows.map((row) => `<div>
|
|
1391
|
-
<span>${
|
|
1392
|
-
<strong>${
|
|
1653
|
+
<span>${escapeHtml6(row.label)}</span>
|
|
1654
|
+
<strong>${escapeHtml6(row.value)}</strong>
|
|
1393
1655
|
</div>`).join("")}</div>` : '<p class="absolute-voice-routing-status__empty">Start a voice session to see the selected provider.</p>';
|
|
1394
|
-
return `<section class="absolute-voice-routing-status absolute-voice-routing-status--${
|
|
1656
|
+
return `<section class="absolute-voice-routing-status absolute-voice-routing-status--${escapeHtml6(model.status)}">
|
|
1395
1657
|
<header class="absolute-voice-routing-status__header">
|
|
1396
|
-
<span class="absolute-voice-routing-status__eyebrow">${
|
|
1397
|
-
<strong class="absolute-voice-routing-status__label">${
|
|
1658
|
+
<span class="absolute-voice-routing-status__eyebrow">${escapeHtml6(model.title)}</span>
|
|
1659
|
+
<strong class="absolute-voice-routing-status__label">${escapeHtml6(model.label)}</strong>
|
|
1398
1660
|
</header>
|
|
1399
|
-
<p class="absolute-voice-routing-status__description">${
|
|
1661
|
+
<p class="absolute-voice-routing-status__description">${escapeHtml6(model.description)}</p>
|
|
1400
1662
|
${rows}
|
|
1401
|
-
${model.error ? `<p class="absolute-voice-routing-status__error">${
|
|
1663
|
+
${model.error ? `<p class="absolute-voice-routing-status__error">${escapeHtml6(model.error)}</p>` : ""}
|
|
1402
1664
|
</section>`;
|
|
1403
1665
|
};
|
|
1404
1666
|
var getVoiceRoutingStatusCSS = () => `.absolute-voice-routing-status{border:1px solid #d8d2c4;border-radius:20px;background:#fffaf0;color:#16130d;padding:18px;box-shadow:0 18px 40px rgba(47,37,18,.12);font-family:inherit}.absolute-voice-routing-status--error{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-routing-status__header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-routing-status__eyebrow{color:#73664f;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-routing-status__label{font-size:24px;line-height:1}.absolute-voice-routing-status__description{color:#514733;margin:12px 0 0}.absolute-voice-routing-status__grid{display:grid;gap:8px;grid-template-columns:repeat(2,minmax(0,1fr));margin-top:14px}.absolute-voice-routing-status__grid div{background:#fff;border:1px solid #eee4d2;border-radius:14px;padding:10px 12px}.absolute-voice-routing-status__grid span{color:#655944;display:block;font-size:12px;margin-bottom:4px}.absolute-voice-routing-status__grid strong{overflow-wrap:anywhere}.absolute-voice-routing-status__empty{color:#655944;margin:14px 0 0}.absolute-voice-routing-status__error{color:#9f1239;font-weight:700}`;
|
|
@@ -1440,7 +1702,7 @@ var defineVoiceRoutingStatusElement = (tagName = "absolute-voice-routing-status"
|
|
|
1440
1702
|
};
|
|
1441
1703
|
|
|
1442
1704
|
// src/react/VoiceRoutingStatus.tsx
|
|
1443
|
-
import { jsxDEV as
|
|
1705
|
+
import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
|
|
1444
1706
|
var VoiceRoutingStatus = ({
|
|
1445
1707
|
className,
|
|
1446
1708
|
path = "/api/routing/latest",
|
|
@@ -1448,47 +1710,47 @@ var VoiceRoutingStatus = ({
|
|
|
1448
1710
|
}) => {
|
|
1449
1711
|
const snapshot = useVoiceRoutingStatus(path, options);
|
|
1450
1712
|
const model = createVoiceRoutingStatusViewModel(snapshot, options);
|
|
1451
|
-
return /* @__PURE__ */
|
|
1713
|
+
return /* @__PURE__ */ jsxDEV6("section", {
|
|
1452
1714
|
className: [
|
|
1453
1715
|
"absolute-voice-routing-status",
|
|
1454
1716
|
`absolute-voice-routing-status--${model.status}`,
|
|
1455
1717
|
className
|
|
1456
1718
|
].filter(Boolean).join(" "),
|
|
1457
1719
|
children: [
|
|
1458
|
-
/* @__PURE__ */
|
|
1720
|
+
/* @__PURE__ */ jsxDEV6("header", {
|
|
1459
1721
|
className: "absolute-voice-routing-status__header",
|
|
1460
1722
|
children: [
|
|
1461
|
-
/* @__PURE__ */
|
|
1723
|
+
/* @__PURE__ */ jsxDEV6("span", {
|
|
1462
1724
|
className: "absolute-voice-routing-status__eyebrow",
|
|
1463
1725
|
children: model.title
|
|
1464
1726
|
}, undefined, false, undefined, this),
|
|
1465
|
-
/* @__PURE__ */
|
|
1727
|
+
/* @__PURE__ */ jsxDEV6("strong", {
|
|
1466
1728
|
className: "absolute-voice-routing-status__label",
|
|
1467
1729
|
children: model.label
|
|
1468
1730
|
}, undefined, false, undefined, this)
|
|
1469
1731
|
]
|
|
1470
1732
|
}, undefined, true, undefined, this),
|
|
1471
|
-
/* @__PURE__ */
|
|
1733
|
+
/* @__PURE__ */ jsxDEV6("p", {
|
|
1472
1734
|
className: "absolute-voice-routing-status__description",
|
|
1473
1735
|
children: model.description
|
|
1474
1736
|
}, undefined, false, undefined, this),
|
|
1475
|
-
model.rows.length ? /* @__PURE__ */
|
|
1737
|
+
model.rows.length ? /* @__PURE__ */ jsxDEV6("div", {
|
|
1476
1738
|
className: "absolute-voice-routing-status__grid",
|
|
1477
|
-
children: model.rows.map((row) => /* @__PURE__ */
|
|
1739
|
+
children: model.rows.map((row) => /* @__PURE__ */ jsxDEV6("div", {
|
|
1478
1740
|
children: [
|
|
1479
|
-
/* @__PURE__ */
|
|
1741
|
+
/* @__PURE__ */ jsxDEV6("span", {
|
|
1480
1742
|
children: row.label
|
|
1481
1743
|
}, undefined, false, undefined, this),
|
|
1482
|
-
/* @__PURE__ */
|
|
1744
|
+
/* @__PURE__ */ jsxDEV6("strong", {
|
|
1483
1745
|
children: row.value
|
|
1484
1746
|
}, undefined, false, undefined, this)
|
|
1485
1747
|
]
|
|
1486
1748
|
}, row.label, true, undefined, this))
|
|
1487
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
1749
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV6("p", {
|
|
1488
1750
|
className: "absolute-voice-routing-status__empty",
|
|
1489
1751
|
children: "Start a voice session to see the selected provider."
|
|
1490
1752
|
}, undefined, false, undefined, this),
|
|
1491
|
-
model.error ? /* @__PURE__ */
|
|
1753
|
+
model.error ? /* @__PURE__ */ jsxDEV6("p", {
|
|
1492
1754
|
className: "absolute-voice-routing-status__error",
|
|
1493
1755
|
children: model.error
|
|
1494
1756
|
}, undefined, false, undefined, this) : null
|
|
@@ -1576,9 +1838,9 @@ var createVoiceTraceTimelineStore = (path = "/api/voice-traces", options = {}) =
|
|
|
1576
1838
|
};
|
|
1577
1839
|
|
|
1578
1840
|
// src/client/traceTimelineWidget.ts
|
|
1579
|
-
var
|
|
1580
|
-
var
|
|
1581
|
-
var
|
|
1841
|
+
var DEFAULT_TITLE6 = "Voice Traces";
|
|
1842
|
+
var DEFAULT_DESCRIPTION6 = "Latest call timelines with provider latency, fallbacks, handoffs, and errors from your self-hosted trace store.";
|
|
1843
|
+
var escapeHtml7 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1582
1844
|
var formatMs = (value) => typeof value === "number" ? `${value}ms` : "n/a";
|
|
1583
1845
|
var formatProviders = (session) => session.providers.length ? session.providers.map((provider) => provider.provider).join(", ") : "No providers";
|
|
1584
1846
|
var createVoiceTraceTimelineViewModel = (snapshot, options = {}) => {
|
|
@@ -1592,34 +1854,34 @@ var createVoiceTraceTimelineViewModel = (snapshot, options = {}) => {
|
|
|
1592
1854
|
const failed = sessions.filter((session) => session.status === "failed").length;
|
|
1593
1855
|
const warnings = sessions.filter((session) => session.status === "warning").length;
|
|
1594
1856
|
return {
|
|
1595
|
-
description: options.description ??
|
|
1857
|
+
description: options.description ?? DEFAULT_DESCRIPTION6,
|
|
1596
1858
|
error: snapshot.error,
|
|
1597
1859
|
isLoading: snapshot.isLoading,
|
|
1598
1860
|
label: snapshot.error ? "Unavailable" : failed > 0 ? `${failed} failed` : warnings > 0 ? `${warnings} warning` : sessions.length ? `${sessions.length} recent` : snapshot.isLoading ? "Checking" : "No traces yet",
|
|
1599
1861
|
sessions,
|
|
1600
1862
|
status: snapshot.error ? "error" : failed > 0 ? "failed" : warnings > 0 ? "warning" : sessions.length ? "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
1601
|
-
title: options.title ??
|
|
1863
|
+
title: options.title ?? DEFAULT_TITLE6,
|
|
1602
1864
|
updatedAt: snapshot.updatedAt
|
|
1603
1865
|
};
|
|
1604
1866
|
};
|
|
1605
1867
|
var renderVoiceTraceTimelineWidgetHTML = (snapshot, options = {}) => {
|
|
1606
1868
|
const model = createVoiceTraceTimelineViewModel(snapshot, options);
|
|
1607
|
-
const sessions = model.sessions.length ? `<div class="absolute-voice-trace-timeline__sessions">${model.sessions.map((session) => `<article class="absolute-voice-trace-timeline__session absolute-voice-trace-timeline__session--${
|
|
1869
|
+
const sessions = model.sessions.length ? `<div class="absolute-voice-trace-timeline__sessions">${model.sessions.map((session) => `<article class="absolute-voice-trace-timeline__session absolute-voice-trace-timeline__session--${escapeHtml7(session.status)}">
|
|
1608
1870
|
<header>
|
|
1609
|
-
<strong>${
|
|
1610
|
-
<span>${
|
|
1871
|
+
<strong>${escapeHtml7(session.sessionId)}</strong>
|
|
1872
|
+
<span>${escapeHtml7(session.status)}</span>
|
|
1611
1873
|
</header>
|
|
1612
|
-
<p>${
|
|
1613
|
-
<a href="${
|
|
1874
|
+
<p>${escapeHtml7(session.label)} \xB7 ${escapeHtml7(session.durationLabel)} \xB7 ${escapeHtml7(session.providerLabel)}</p>
|
|
1875
|
+
<a href="${escapeHtml7(session.detailHref)}">Open timeline</a>
|
|
1614
1876
|
</article>`).join("")}</div>` : '<p class="absolute-voice-trace-timeline__empty">Run a voice session to see call timelines.</p>';
|
|
1615
|
-
return `<section class="absolute-voice-trace-timeline absolute-voice-trace-timeline--${
|
|
1877
|
+
return `<section class="absolute-voice-trace-timeline absolute-voice-trace-timeline--${escapeHtml7(model.status)}">
|
|
1616
1878
|
<header class="absolute-voice-trace-timeline__header">
|
|
1617
|
-
<span class="absolute-voice-trace-timeline__eyebrow">${
|
|
1618
|
-
<strong class="absolute-voice-trace-timeline__label">${
|
|
1879
|
+
<span class="absolute-voice-trace-timeline__eyebrow">${escapeHtml7(model.title)}</span>
|
|
1880
|
+
<strong class="absolute-voice-trace-timeline__label">${escapeHtml7(model.label)}</strong>
|
|
1619
1881
|
</header>
|
|
1620
|
-
<p class="absolute-voice-trace-timeline__description">${
|
|
1882
|
+
<p class="absolute-voice-trace-timeline__description">${escapeHtml7(model.description)}</p>
|
|
1621
1883
|
${sessions}
|
|
1622
|
-
${model.error ? `<p class="absolute-voice-trace-timeline__error">${
|
|
1884
|
+
${model.error ? `<p class="absolute-voice-trace-timeline__error">${escapeHtml7(model.error)}</p>` : ""}
|
|
1623
1885
|
</section>`;
|
|
1624
1886
|
};
|
|
1625
1887
|
var getVoiceTraceTimelineCSS = () => `.absolute-voice-trace-timeline{border:1px solid #bad7d3;border-radius:20px;background:#f3fffb;color:#09201c;padding:18px;box-shadow:0 18px 40px rgba(9,32,28,.12);font-family:inherit}.absolute-voice-trace-timeline--error,.absolute-voice-trace-timeline--failed{border-color:#f2a7a7;background:#fff5f3}.absolute-voice-trace-timeline--warning{border-color:#fbbf24;background:#fffaf0}.absolute-voice-trace-timeline__header,.absolute-voice-trace-timeline__session header{align-items:start;display:flex;gap:12px;justify-content:space-between}.absolute-voice-trace-timeline__eyebrow{color:#17665b;font-size:12px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.absolute-voice-trace-timeline__label{font-size:24px;line-height:1}.absolute-voice-trace-timeline__description,.absolute-voice-trace-timeline__session p,.absolute-voice-trace-timeline__empty{color:#35544f}.absolute-voice-trace-timeline__sessions{display:grid;gap:12px;margin-top:14px}.absolute-voice-trace-timeline__session{background:#fff;border:1px solid #cfe7e2;border-radius:16px;padding:14px}.absolute-voice-trace-timeline__session--failed{border-color:#f2a7a7}.absolute-voice-trace-timeline__session--warning{border-color:#fbbf24}.absolute-voice-trace-timeline__session p{margin:10px 0}.absolute-voice-trace-timeline__session a{color:#0f766e;font-weight:800}.absolute-voice-trace-timeline__empty{margin:14px 0 0}.absolute-voice-trace-timeline__error{color:#9f1239;font-weight:700}`;
|
|
@@ -1664,25 +1926,25 @@ var defineVoiceTraceTimelineElement = (tagName = "absolute-voice-trace-timeline"
|
|
|
1664
1926
|
};
|
|
1665
1927
|
|
|
1666
1928
|
// src/react/useVoiceTraceTimeline.tsx
|
|
1667
|
-
import { useEffect as
|
|
1929
|
+
import { useEffect as useEffect7, useRef as useRef7, useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
1668
1930
|
var useVoiceTraceTimeline = (path = "/api/voice-traces", options = {}) => {
|
|
1669
|
-
const storeRef =
|
|
1931
|
+
const storeRef = useRef7(null);
|
|
1670
1932
|
if (!storeRef.current) {
|
|
1671
1933
|
storeRef.current = createVoiceTraceTimelineStore(path, options);
|
|
1672
1934
|
}
|
|
1673
1935
|
const store = storeRef.current;
|
|
1674
|
-
|
|
1936
|
+
useEffect7(() => {
|
|
1675
1937
|
store.refresh().catch(() => {});
|
|
1676
1938
|
return () => store.close();
|
|
1677
1939
|
}, [store]);
|
|
1678
1940
|
return {
|
|
1679
|
-
...
|
|
1941
|
+
...useSyncExternalStore7(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
1680
1942
|
refresh: store.refresh
|
|
1681
1943
|
};
|
|
1682
1944
|
};
|
|
1683
1945
|
|
|
1684
1946
|
// src/react/VoiceTraceTimeline.tsx
|
|
1685
|
-
import { jsxDEV as
|
|
1947
|
+
import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
|
|
1686
1948
|
var VoiceTraceTimeline = ({
|
|
1687
1949
|
className,
|
|
1688
1950
|
path = "/api/voice-traces",
|
|
@@ -1690,49 +1952,49 @@ var VoiceTraceTimeline = ({
|
|
|
1690
1952
|
}) => {
|
|
1691
1953
|
const snapshot = useVoiceTraceTimeline(path, options);
|
|
1692
1954
|
const model = createVoiceTraceTimelineViewModel(snapshot, options);
|
|
1693
|
-
return /* @__PURE__ */
|
|
1955
|
+
return /* @__PURE__ */ jsxDEV7("section", {
|
|
1694
1956
|
className: [
|
|
1695
1957
|
"absolute-voice-trace-timeline",
|
|
1696
1958
|
`absolute-voice-trace-timeline--${model.status}`,
|
|
1697
1959
|
className
|
|
1698
1960
|
].filter(Boolean).join(" "),
|
|
1699
1961
|
children: [
|
|
1700
|
-
/* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ jsxDEV7("header", {
|
|
1701
1963
|
className: "absolute-voice-trace-timeline__header",
|
|
1702
1964
|
children: [
|
|
1703
|
-
/* @__PURE__ */
|
|
1965
|
+
/* @__PURE__ */ jsxDEV7("span", {
|
|
1704
1966
|
className: "absolute-voice-trace-timeline__eyebrow",
|
|
1705
1967
|
children: model.title
|
|
1706
1968
|
}, undefined, false, undefined, this),
|
|
1707
|
-
/* @__PURE__ */
|
|
1969
|
+
/* @__PURE__ */ jsxDEV7("strong", {
|
|
1708
1970
|
className: "absolute-voice-trace-timeline__label",
|
|
1709
1971
|
children: model.label
|
|
1710
1972
|
}, undefined, false, undefined, this)
|
|
1711
1973
|
]
|
|
1712
1974
|
}, undefined, true, undefined, this),
|
|
1713
|
-
/* @__PURE__ */
|
|
1975
|
+
/* @__PURE__ */ jsxDEV7("p", {
|
|
1714
1976
|
className: "absolute-voice-trace-timeline__description",
|
|
1715
1977
|
children: model.description
|
|
1716
1978
|
}, undefined, false, undefined, this),
|
|
1717
|
-
model.sessions.length ? /* @__PURE__ */
|
|
1979
|
+
model.sessions.length ? /* @__PURE__ */ jsxDEV7("div", {
|
|
1718
1980
|
className: "absolute-voice-trace-timeline__sessions",
|
|
1719
|
-
children: model.sessions.map((session) => /* @__PURE__ */
|
|
1981
|
+
children: model.sessions.map((session) => /* @__PURE__ */ jsxDEV7("article", {
|
|
1720
1982
|
className: [
|
|
1721
1983
|
"absolute-voice-trace-timeline__session",
|
|
1722
1984
|
`absolute-voice-trace-timeline__session--${session.status}`
|
|
1723
1985
|
].join(" "),
|
|
1724
1986
|
children: [
|
|
1725
|
-
/* @__PURE__ */
|
|
1987
|
+
/* @__PURE__ */ jsxDEV7("header", {
|
|
1726
1988
|
children: [
|
|
1727
|
-
/* @__PURE__ */
|
|
1989
|
+
/* @__PURE__ */ jsxDEV7("strong", {
|
|
1728
1990
|
children: session.sessionId
|
|
1729
1991
|
}, undefined, false, undefined, this),
|
|
1730
|
-
/* @__PURE__ */
|
|
1992
|
+
/* @__PURE__ */ jsxDEV7("span", {
|
|
1731
1993
|
children: session.status
|
|
1732
1994
|
}, undefined, false, undefined, this)
|
|
1733
1995
|
]
|
|
1734
1996
|
}, undefined, true, undefined, this),
|
|
1735
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ jsxDEV7("p", {
|
|
1736
1998
|
children: [
|
|
1737
1999
|
session.label,
|
|
1738
2000
|
" \xB7 ",
|
|
@@ -1742,17 +2004,17 @@ var VoiceTraceTimeline = ({
|
|
|
1742
2004
|
session.providerLabel
|
|
1743
2005
|
]
|
|
1744
2006
|
}, undefined, true, undefined, this),
|
|
1745
|
-
/* @__PURE__ */
|
|
2007
|
+
/* @__PURE__ */ jsxDEV7("a", {
|
|
1746
2008
|
href: session.detailHref,
|
|
1747
2009
|
children: "Open timeline"
|
|
1748
2010
|
}, undefined, false, undefined, this)
|
|
1749
2011
|
]
|
|
1750
2012
|
}, session.sessionId, true, undefined, this))
|
|
1751
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
2013
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV7("p", {
|
|
1752
2014
|
className: "absolute-voice-trace-timeline__empty",
|
|
1753
2015
|
children: "Run a voice session to see call timelines."
|
|
1754
2016
|
}, undefined, false, undefined, this),
|
|
1755
|
-
model.error ? /* @__PURE__ */
|
|
2017
|
+
model.error ? /* @__PURE__ */ jsxDEV7("p", {
|
|
1756
2018
|
className: "absolute-voice-trace-timeline__error",
|
|
1757
2019
|
children: model.error
|
|
1758
2020
|
}, undefined, false, undefined, this) : null
|
|
@@ -1760,7 +2022,7 @@ var VoiceTraceTimeline = ({
|
|
|
1760
2022
|
}, undefined, true, undefined, this);
|
|
1761
2023
|
};
|
|
1762
2024
|
// src/react/useVoiceTurnLatency.tsx
|
|
1763
|
-
import { useEffect as
|
|
2025
|
+
import { useEffect as useEffect8, useRef as useRef8, useSyncExternalStore as useSyncExternalStore8 } from "react";
|
|
1764
2026
|
|
|
1765
2027
|
// src/client/turnLatency.ts
|
|
1766
2028
|
var fetchVoiceTurnLatency = async (path = "/api/turn-latency", options = {}) => {
|
|
@@ -1867,27 +2129,27 @@ var createVoiceTurnLatencyStore = (path = "/api/turn-latency", options = {}) =>
|
|
|
1867
2129
|
|
|
1868
2130
|
// src/react/useVoiceTurnLatency.tsx
|
|
1869
2131
|
var useVoiceTurnLatency = (path = "/api/turn-latency", options = {}) => {
|
|
1870
|
-
const storeRef =
|
|
2132
|
+
const storeRef = useRef8(null);
|
|
1871
2133
|
if (!storeRef.current) {
|
|
1872
2134
|
storeRef.current = createVoiceTurnLatencyStore(path, options);
|
|
1873
2135
|
}
|
|
1874
2136
|
const store = storeRef.current;
|
|
1875
|
-
|
|
2137
|
+
useEffect8(() => {
|
|
1876
2138
|
store.refresh().catch(() => {});
|
|
1877
2139
|
return () => store.close();
|
|
1878
2140
|
}, [store]);
|
|
1879
2141
|
return {
|
|
1880
|
-
...
|
|
2142
|
+
...useSyncExternalStore8(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
1881
2143
|
refresh: store.refresh,
|
|
1882
2144
|
runProof: store.runProof
|
|
1883
2145
|
};
|
|
1884
2146
|
};
|
|
1885
2147
|
|
|
1886
2148
|
// src/client/turnLatencyWidget.ts
|
|
1887
|
-
var
|
|
1888
|
-
var
|
|
2149
|
+
var DEFAULT_TITLE7 = "Turn Latency";
|
|
2150
|
+
var DEFAULT_DESCRIPTION7 = "Per-turn timing from first transcript to commit and assistant response start.";
|
|
1889
2151
|
var DEFAULT_PROOF_LABEL = "Run latency proof";
|
|
1890
|
-
var
|
|
2152
|
+
var escapeHtml8 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1891
2153
|
var formatMs2 = (value) => typeof value === "number" ? `${Math.round(value)}ms` : "n/a";
|
|
1892
2154
|
var createVoiceTurnLatencyViewModel = (snapshot, options = {}) => {
|
|
1893
2155
|
const turns = (snapshot.report?.turns ?? []).map((turn) => ({
|
|
@@ -1901,39 +2163,39 @@ var createVoiceTurnLatencyViewModel = (snapshot, options = {}) => {
|
|
|
1901
2163
|
const warningCount = snapshot.report?.warnings ?? turns.filter((turn) => turn.status === "warn").length;
|
|
1902
2164
|
const failedCount = snapshot.report?.failed ?? turns.filter((turn) => turn.status === "fail").length;
|
|
1903
2165
|
return {
|
|
1904
|
-
description: options.description ??
|
|
2166
|
+
description: options.description ?? DEFAULT_DESCRIPTION7,
|
|
1905
2167
|
error: snapshot.error,
|
|
1906
2168
|
isLoading: snapshot.isLoading,
|
|
1907
2169
|
label: snapshot.error ? "Unavailable" : turns.length ? failedCount > 0 ? `${failedCount} slow` : warningCount > 0 ? `${warningCount} warnings` : `avg ${formatMs2(snapshot.report?.averageTotalMs)}` : snapshot.isLoading ? "Checking" : "No turns",
|
|
1908
2170
|
proofLabel: options.proofPath ? options.proofLabel ?? DEFAULT_PROOF_LABEL : undefined,
|
|
1909
2171
|
showProofAction: Boolean(options.proofPath),
|
|
1910
2172
|
status: snapshot.error ? "error" : turns.length ? failedCount > 0 || warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
1911
|
-
title: options.title ??
|
|
2173
|
+
title: options.title ?? DEFAULT_TITLE7,
|
|
1912
2174
|
turns,
|
|
1913
2175
|
updatedAt: snapshot.updatedAt
|
|
1914
2176
|
};
|
|
1915
2177
|
};
|
|
1916
2178
|
var renderVoiceTurnLatencyHTML = (snapshot, options = {}) => {
|
|
1917
2179
|
const model = createVoiceTurnLatencyViewModel(snapshot, options);
|
|
1918
|
-
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--${
|
|
2180
|
+
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--${escapeHtml8(turn.status)}">
|
|
1919
2181
|
<header>
|
|
1920
|
-
<strong>${
|
|
1921
|
-
<span>${
|
|
2182
|
+
<strong>${escapeHtml8(turn.label)}</strong>
|
|
2183
|
+
<span>${escapeHtml8(turn.status)}</span>
|
|
1922
2184
|
</header>
|
|
1923
2185
|
<dl>${turn.rows.map((row) => `<div>
|
|
1924
|
-
<dt>${
|
|
1925
|
-
<dd>${
|
|
2186
|
+
<dt>${escapeHtml8(row.label)}</dt>
|
|
2187
|
+
<dd>${escapeHtml8(row.value)}</dd>
|
|
1926
2188
|
</div>`).join("")}</dl>
|
|
1927
2189
|
</article>`).join("")}</div>` : '<p class="absolute-voice-turn-latency__empty">Complete a voice turn to see latency diagnostics.</p>';
|
|
1928
|
-
return `<section class="absolute-voice-turn-latency absolute-voice-turn-latency--${
|
|
2190
|
+
return `<section class="absolute-voice-turn-latency absolute-voice-turn-latency--${escapeHtml8(model.status)}">
|
|
1929
2191
|
<header class="absolute-voice-turn-latency__header">
|
|
1930
|
-
<span class="absolute-voice-turn-latency__eyebrow">${
|
|
1931
|
-
<strong class="absolute-voice-turn-latency__label">${
|
|
2192
|
+
<span class="absolute-voice-turn-latency__eyebrow">${escapeHtml8(model.title)}</span>
|
|
2193
|
+
<strong class="absolute-voice-turn-latency__label">${escapeHtml8(model.label)}</strong>
|
|
1932
2194
|
</header>
|
|
1933
|
-
<p class="absolute-voice-turn-latency__description">${
|
|
1934
|
-
${model.showProofAction ? `<button class="absolute-voice-turn-latency__proof" data-absolute-voice-turn-latency-proof type="button">${
|
|
2195
|
+
<p class="absolute-voice-turn-latency__description">${escapeHtml8(model.description)}</p>
|
|
2196
|
+
${model.showProofAction ? `<button class="absolute-voice-turn-latency__proof" data-absolute-voice-turn-latency-proof type="button">${escapeHtml8(model.proofLabel ?? DEFAULT_PROOF_LABEL)}</button>` : ""}
|
|
1935
2197
|
${turns}
|
|
1936
|
-
${model.error ? `<p class="absolute-voice-turn-latency__error">${
|
|
2198
|
+
${model.error ? `<p class="absolute-voice-turn-latency__error">${escapeHtml8(model.error)}</p>` : ""}
|
|
1937
2199
|
</section>`;
|
|
1938
2200
|
};
|
|
1939
2201
|
var mountVoiceTurnLatency = (element, path = "/api/turn-latency", options = {}) => {
|
|
@@ -1984,7 +2246,7 @@ var defineVoiceTurnLatencyElement = (tagName = "absolute-voice-turn-latency") =>
|
|
|
1984
2246
|
};
|
|
1985
2247
|
|
|
1986
2248
|
// src/react/VoiceTurnLatency.tsx
|
|
1987
|
-
import { jsxDEV as
|
|
2249
|
+
import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
|
|
1988
2250
|
var VoiceTurnLatency = ({
|
|
1989
2251
|
className,
|
|
1990
2252
|
path = "/api/turn-latency",
|
|
@@ -1992,31 +2254,31 @@ var VoiceTurnLatency = ({
|
|
|
1992
2254
|
}) => {
|
|
1993
2255
|
const latency = useVoiceTurnLatency(path, options);
|
|
1994
2256
|
const model = createVoiceTurnLatencyViewModel(latency, options);
|
|
1995
|
-
return /* @__PURE__ */
|
|
2257
|
+
return /* @__PURE__ */ jsxDEV8("section", {
|
|
1996
2258
|
className: [
|
|
1997
2259
|
"absolute-voice-turn-latency",
|
|
1998
2260
|
`absolute-voice-turn-latency--${model.status}`,
|
|
1999
2261
|
className
|
|
2000
2262
|
].filter(Boolean).join(" "),
|
|
2001
2263
|
children: [
|
|
2002
|
-
/* @__PURE__ */
|
|
2264
|
+
/* @__PURE__ */ jsxDEV8("header", {
|
|
2003
2265
|
className: "absolute-voice-turn-latency__header",
|
|
2004
2266
|
children: [
|
|
2005
|
-
/* @__PURE__ */
|
|
2267
|
+
/* @__PURE__ */ jsxDEV8("span", {
|
|
2006
2268
|
className: "absolute-voice-turn-latency__eyebrow",
|
|
2007
2269
|
children: model.title
|
|
2008
2270
|
}, undefined, false, undefined, this),
|
|
2009
|
-
/* @__PURE__ */
|
|
2271
|
+
/* @__PURE__ */ jsxDEV8("strong", {
|
|
2010
2272
|
className: "absolute-voice-turn-latency__label",
|
|
2011
2273
|
children: model.label
|
|
2012
2274
|
}, undefined, false, undefined, this)
|
|
2013
2275
|
]
|
|
2014
2276
|
}, undefined, true, undefined, this),
|
|
2015
|
-
/* @__PURE__ */
|
|
2277
|
+
/* @__PURE__ */ jsxDEV8("p", {
|
|
2016
2278
|
className: "absolute-voice-turn-latency__description",
|
|
2017
2279
|
children: model.description
|
|
2018
2280
|
}, undefined, false, undefined, this),
|
|
2019
|
-
model.showProofAction ? /* @__PURE__ */
|
|
2281
|
+
model.showProofAction ? /* @__PURE__ */ jsxDEV8("button", {
|
|
2020
2282
|
className: "absolute-voice-turn-latency__proof",
|
|
2021
2283
|
onClick: () => {
|
|
2022
2284
|
latency.runProof().catch(() => {});
|
|
@@ -2024,31 +2286,31 @@ var VoiceTurnLatency = ({
|
|
|
2024
2286
|
type: "button",
|
|
2025
2287
|
children: model.proofLabel
|
|
2026
2288
|
}, undefined, false, undefined, this) : null,
|
|
2027
|
-
model.turns.length ? /* @__PURE__ */
|
|
2289
|
+
model.turns.length ? /* @__PURE__ */ jsxDEV8("div", {
|
|
2028
2290
|
className: "absolute-voice-turn-latency__turns",
|
|
2029
|
-
children: model.turns.map((turn) => /* @__PURE__ */
|
|
2291
|
+
children: model.turns.map((turn) => /* @__PURE__ */ jsxDEV8("article", {
|
|
2030
2292
|
className: [
|
|
2031
2293
|
"absolute-voice-turn-latency__turn",
|
|
2032
2294
|
`absolute-voice-turn-latency__turn--${turn.status}`
|
|
2033
2295
|
].join(" "),
|
|
2034
2296
|
children: [
|
|
2035
|
-
/* @__PURE__ */
|
|
2297
|
+
/* @__PURE__ */ jsxDEV8("header", {
|
|
2036
2298
|
children: [
|
|
2037
|
-
/* @__PURE__ */
|
|
2299
|
+
/* @__PURE__ */ jsxDEV8("strong", {
|
|
2038
2300
|
children: turn.label
|
|
2039
2301
|
}, undefined, false, undefined, this),
|
|
2040
|
-
/* @__PURE__ */
|
|
2302
|
+
/* @__PURE__ */ jsxDEV8("span", {
|
|
2041
2303
|
children: turn.status
|
|
2042
2304
|
}, undefined, false, undefined, this)
|
|
2043
2305
|
]
|
|
2044
2306
|
}, undefined, true, undefined, this),
|
|
2045
|
-
/* @__PURE__ */
|
|
2046
|
-
children: turn.rows.map((row) => /* @__PURE__ */
|
|
2307
|
+
/* @__PURE__ */ jsxDEV8("dl", {
|
|
2308
|
+
children: turn.rows.map((row) => /* @__PURE__ */ jsxDEV8("div", {
|
|
2047
2309
|
children: [
|
|
2048
|
-
/* @__PURE__ */
|
|
2310
|
+
/* @__PURE__ */ jsxDEV8("dt", {
|
|
2049
2311
|
children: row.label
|
|
2050
2312
|
}, undefined, false, undefined, this),
|
|
2051
|
-
/* @__PURE__ */
|
|
2313
|
+
/* @__PURE__ */ jsxDEV8("dd", {
|
|
2052
2314
|
children: row.value
|
|
2053
2315
|
}, undefined, false, undefined, this)
|
|
2054
2316
|
]
|
|
@@ -2056,11 +2318,11 @@ var VoiceTurnLatency = ({
|
|
|
2056
2318
|
}, undefined, false, undefined, this)
|
|
2057
2319
|
]
|
|
2058
2320
|
}, `${turn.sessionId}:${turn.turnId}`, true, undefined, this))
|
|
2059
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
2321
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV8("p", {
|
|
2060
2322
|
className: "absolute-voice-turn-latency__empty",
|
|
2061
2323
|
children: "Complete a voice turn to see latency diagnostics."
|
|
2062
2324
|
}, undefined, false, undefined, this),
|
|
2063
|
-
model.error ? /* @__PURE__ */
|
|
2325
|
+
model.error ? /* @__PURE__ */ jsxDEV8("p", {
|
|
2064
2326
|
className: "absolute-voice-turn-latency__error",
|
|
2065
2327
|
children: model.error
|
|
2066
2328
|
}, undefined, false, undefined, this) : null
|
|
@@ -2068,7 +2330,7 @@ var VoiceTurnLatency = ({
|
|
|
2068
2330
|
}, undefined, true, undefined, this);
|
|
2069
2331
|
};
|
|
2070
2332
|
// src/react/useVoiceTurnQuality.tsx
|
|
2071
|
-
import { useEffect as
|
|
2333
|
+
import { useEffect as useEffect9, useRef as useRef9, useSyncExternalStore as useSyncExternalStore9 } from "react";
|
|
2072
2334
|
|
|
2073
2335
|
// src/client/turnQuality.ts
|
|
2074
2336
|
var fetchVoiceTurnQuality = async (path = "/api/turn-quality", options = {}) => {
|
|
@@ -2151,25 +2413,25 @@ var createVoiceTurnQualityStore = (path = "/api/turn-quality", options = {}) =>
|
|
|
2151
2413
|
|
|
2152
2414
|
// src/react/useVoiceTurnQuality.tsx
|
|
2153
2415
|
var useVoiceTurnQuality = (path = "/api/turn-quality", options = {}) => {
|
|
2154
|
-
const storeRef =
|
|
2416
|
+
const storeRef = useRef9(null);
|
|
2155
2417
|
if (!storeRef.current) {
|
|
2156
2418
|
storeRef.current = createVoiceTurnQualityStore(path, options);
|
|
2157
2419
|
}
|
|
2158
2420
|
const store = storeRef.current;
|
|
2159
|
-
|
|
2421
|
+
useEffect9(() => {
|
|
2160
2422
|
store.refresh().catch(() => {});
|
|
2161
2423
|
return () => store.close();
|
|
2162
2424
|
}, [store]);
|
|
2163
2425
|
return {
|
|
2164
|
-
...
|
|
2426
|
+
...useSyncExternalStore9(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
2165
2427
|
refresh: store.refresh
|
|
2166
2428
|
};
|
|
2167
2429
|
};
|
|
2168
2430
|
|
|
2169
2431
|
// src/client/turnQualityWidget.ts
|
|
2170
|
-
var
|
|
2171
|
-
var
|
|
2172
|
-
var
|
|
2432
|
+
var DEFAULT_TITLE8 = "Turn Quality";
|
|
2433
|
+
var DEFAULT_DESCRIPTION8 = "Per-turn STT confidence, fallback selection, corrections, and transcript coverage.";
|
|
2434
|
+
var escapeHtml9 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
2173
2435
|
var formatConfidence = (value) => typeof value === "number" ? `${Math.round(value * 100)}%` : "n/a";
|
|
2174
2436
|
var formatMaybe = (value) => value === undefined || value === "" ? "n/a" : String(value);
|
|
2175
2437
|
var getTurnDetail = (turn) => {
|
|
@@ -2207,37 +2469,37 @@ var createVoiceTurnQualityViewModel = (snapshot, options = {}) => {
|
|
|
2207
2469
|
const warningCount = snapshot.report?.warnings ?? turns.filter((turn) => turn.status === "warn").length;
|
|
2208
2470
|
const failedCount = snapshot.report?.failed ?? turns.filter((turn) => turn.status === "fail").length;
|
|
2209
2471
|
return {
|
|
2210
|
-
description: options.description ??
|
|
2472
|
+
description: options.description ?? DEFAULT_DESCRIPTION8,
|
|
2211
2473
|
error: snapshot.error,
|
|
2212
2474
|
isLoading: snapshot.isLoading,
|
|
2213
2475
|
label: snapshot.error ? "Unavailable" : turns.length ? failedCount > 0 ? `${failedCount} failed` : warningCount > 0 ? `${warningCount} warnings` : `${turns.length} healthy` : snapshot.isLoading ? "Checking" : "No turns",
|
|
2214
2476
|
status: snapshot.error ? "error" : turns.length ? failedCount > 0 || warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
2215
|
-
title: options.title ??
|
|
2477
|
+
title: options.title ?? DEFAULT_TITLE8,
|
|
2216
2478
|
turns,
|
|
2217
2479
|
updatedAt: snapshot.updatedAt
|
|
2218
2480
|
};
|
|
2219
2481
|
};
|
|
2220
2482
|
var renderVoiceTurnQualityHTML = (snapshot, options = {}) => {
|
|
2221
2483
|
const model = createVoiceTurnQualityViewModel(snapshot, options);
|
|
2222
|
-
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--${
|
|
2484
|
+
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--${escapeHtml9(turn.status)}">
|
|
2223
2485
|
<header>
|
|
2224
|
-
<strong>${
|
|
2225
|
-
<span>${
|
|
2486
|
+
<strong>${escapeHtml9(turn.label)}</strong>
|
|
2487
|
+
<span>${escapeHtml9(turn.status)}</span>
|
|
2226
2488
|
</header>
|
|
2227
|
-
<p>${
|
|
2489
|
+
<p>${escapeHtml9(turn.detail)}</p>
|
|
2228
2490
|
<dl>${turn.rows.map((row) => `<div>
|
|
2229
|
-
<dt>${
|
|
2230
|
-
<dd>${
|
|
2491
|
+
<dt>${escapeHtml9(row.label)}</dt>
|
|
2492
|
+
<dd>${escapeHtml9(row.value)}</dd>
|
|
2231
2493
|
</div>`).join("")}</dl>
|
|
2232
2494
|
</article>`).join("")}</div>` : '<p class="absolute-voice-turn-quality__empty">Complete a voice turn to see STT quality diagnostics.</p>';
|
|
2233
|
-
return `<section class="absolute-voice-turn-quality absolute-voice-turn-quality--${
|
|
2495
|
+
return `<section class="absolute-voice-turn-quality absolute-voice-turn-quality--${escapeHtml9(model.status)}">
|
|
2234
2496
|
<header class="absolute-voice-turn-quality__header">
|
|
2235
|
-
<span class="absolute-voice-turn-quality__eyebrow">${
|
|
2236
|
-
<strong class="absolute-voice-turn-quality__label">${
|
|
2497
|
+
<span class="absolute-voice-turn-quality__eyebrow">${escapeHtml9(model.title)}</span>
|
|
2498
|
+
<strong class="absolute-voice-turn-quality__label">${escapeHtml9(model.label)}</strong>
|
|
2237
2499
|
</header>
|
|
2238
|
-
<p class="absolute-voice-turn-quality__description">${
|
|
2500
|
+
<p class="absolute-voice-turn-quality__description">${escapeHtml9(model.description)}</p>
|
|
2239
2501
|
${turns}
|
|
2240
|
-
${model.error ? `<p class="absolute-voice-turn-quality__error">${
|
|
2502
|
+
${model.error ? `<p class="absolute-voice-turn-quality__error">${escapeHtml9(model.error)}</p>` : ""}
|
|
2241
2503
|
</section>`;
|
|
2242
2504
|
};
|
|
2243
2505
|
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}`;
|
|
@@ -2279,7 +2541,7 @@ var defineVoiceTurnQualityElement = (tagName = "absolute-voice-turn-quality") =>
|
|
|
2279
2541
|
};
|
|
2280
2542
|
|
|
2281
2543
|
// src/react/VoiceTurnQuality.tsx
|
|
2282
|
-
import { jsxDEV as
|
|
2544
|
+
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
2283
2545
|
var VoiceTurnQuality = ({
|
|
2284
2546
|
className,
|
|
2285
2547
|
path = "/api/turn-quality",
|
|
@@ -2287,58 +2549,58 @@ var VoiceTurnQuality = ({
|
|
|
2287
2549
|
}) => {
|
|
2288
2550
|
const snapshot = useVoiceTurnQuality(path, options);
|
|
2289
2551
|
const model = createVoiceTurnQualityViewModel(snapshot, options);
|
|
2290
|
-
return /* @__PURE__ */
|
|
2552
|
+
return /* @__PURE__ */ jsxDEV9("section", {
|
|
2291
2553
|
className: [
|
|
2292
2554
|
"absolute-voice-turn-quality",
|
|
2293
2555
|
`absolute-voice-turn-quality--${model.status}`,
|
|
2294
2556
|
className
|
|
2295
2557
|
].filter(Boolean).join(" "),
|
|
2296
2558
|
children: [
|
|
2297
|
-
/* @__PURE__ */
|
|
2559
|
+
/* @__PURE__ */ jsxDEV9("header", {
|
|
2298
2560
|
className: "absolute-voice-turn-quality__header",
|
|
2299
2561
|
children: [
|
|
2300
|
-
/* @__PURE__ */
|
|
2562
|
+
/* @__PURE__ */ jsxDEV9("span", {
|
|
2301
2563
|
className: "absolute-voice-turn-quality__eyebrow",
|
|
2302
2564
|
children: model.title
|
|
2303
2565
|
}, undefined, false, undefined, this),
|
|
2304
|
-
/* @__PURE__ */
|
|
2566
|
+
/* @__PURE__ */ jsxDEV9("strong", {
|
|
2305
2567
|
className: "absolute-voice-turn-quality__label",
|
|
2306
2568
|
children: model.label
|
|
2307
2569
|
}, undefined, false, undefined, this)
|
|
2308
2570
|
]
|
|
2309
2571
|
}, undefined, true, undefined, this),
|
|
2310
|
-
/* @__PURE__ */
|
|
2572
|
+
/* @__PURE__ */ jsxDEV9("p", {
|
|
2311
2573
|
className: "absolute-voice-turn-quality__description",
|
|
2312
2574
|
children: model.description
|
|
2313
2575
|
}, undefined, false, undefined, this),
|
|
2314
|
-
model.turns.length ? /* @__PURE__ */
|
|
2576
|
+
model.turns.length ? /* @__PURE__ */ jsxDEV9("div", {
|
|
2315
2577
|
className: "absolute-voice-turn-quality__turns",
|
|
2316
|
-
children: model.turns.map((turn) => /* @__PURE__ */
|
|
2578
|
+
children: model.turns.map((turn) => /* @__PURE__ */ jsxDEV9("article", {
|
|
2317
2579
|
className: [
|
|
2318
2580
|
"absolute-voice-turn-quality__turn",
|
|
2319
2581
|
`absolute-voice-turn-quality__turn--${turn.status}`
|
|
2320
2582
|
].join(" "),
|
|
2321
2583
|
children: [
|
|
2322
|
-
/* @__PURE__ */
|
|
2584
|
+
/* @__PURE__ */ jsxDEV9("header", {
|
|
2323
2585
|
children: [
|
|
2324
|
-
/* @__PURE__ */
|
|
2586
|
+
/* @__PURE__ */ jsxDEV9("strong", {
|
|
2325
2587
|
children: turn.label
|
|
2326
2588
|
}, undefined, false, undefined, this),
|
|
2327
|
-
/* @__PURE__ */
|
|
2589
|
+
/* @__PURE__ */ jsxDEV9("span", {
|
|
2328
2590
|
children: turn.status
|
|
2329
2591
|
}, undefined, false, undefined, this)
|
|
2330
2592
|
]
|
|
2331
2593
|
}, undefined, true, undefined, this),
|
|
2332
|
-
/* @__PURE__ */
|
|
2594
|
+
/* @__PURE__ */ jsxDEV9("p", {
|
|
2333
2595
|
children: turn.detail
|
|
2334
2596
|
}, undefined, false, undefined, this),
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
children: turn.rows.map((row) => /* @__PURE__ */
|
|
2597
|
+
/* @__PURE__ */ jsxDEV9("dl", {
|
|
2598
|
+
children: turn.rows.map((row) => /* @__PURE__ */ jsxDEV9("div", {
|
|
2337
2599
|
children: [
|
|
2338
|
-
/* @__PURE__ */
|
|
2600
|
+
/* @__PURE__ */ jsxDEV9("dt", {
|
|
2339
2601
|
children: row.label
|
|
2340
2602
|
}, undefined, false, undefined, this),
|
|
2341
|
-
/* @__PURE__ */
|
|
2603
|
+
/* @__PURE__ */ jsxDEV9("dd", {
|
|
2342
2604
|
children: row.value
|
|
2343
2605
|
}, undefined, false, undefined, this)
|
|
2344
2606
|
]
|
|
@@ -2346,11 +2608,11 @@ var VoiceTurnQuality = ({
|
|
|
2346
2608
|
}, undefined, false, undefined, this)
|
|
2347
2609
|
]
|
|
2348
2610
|
}, `${turn.sessionId}:${turn.turnId}`, true, undefined, this))
|
|
2349
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
2611
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV9("p", {
|
|
2350
2612
|
className: "absolute-voice-turn-quality__empty",
|
|
2351
2613
|
children: "Complete a voice turn to see STT quality diagnostics."
|
|
2352
2614
|
}, undefined, false, undefined, this),
|
|
2353
|
-
model.error ? /* @__PURE__ */
|
|
2615
|
+
model.error ? /* @__PURE__ */ jsxDEV9("p", {
|
|
2354
2616
|
className: "absolute-voice-turn-quality__error",
|
|
2355
2617
|
children: model.error
|
|
2356
2618
|
}, undefined, false, undefined, this) : null
|
|
@@ -2358,7 +2620,7 @@ var VoiceTurnQuality = ({
|
|
|
2358
2620
|
}, undefined, true, undefined, this);
|
|
2359
2621
|
};
|
|
2360
2622
|
// src/react/useVoiceCampaignDialerProof.tsx
|
|
2361
|
-
import { useEffect as
|
|
2623
|
+
import { useEffect as useEffect10, useRef as useRef10, useSyncExternalStore as useSyncExternalStore10 } from "react";
|
|
2362
2624
|
|
|
2363
2625
|
// src/client/campaignDialerProof.ts
|
|
2364
2626
|
var fetchVoiceCampaignDialerProofStatus = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
@@ -2480,23 +2742,23 @@ var createVoiceCampaignDialerProofStore = (path = "/api/voice/campaigns/dialer-p
|
|
|
2480
2742
|
|
|
2481
2743
|
// src/react/useVoiceCampaignDialerProof.tsx
|
|
2482
2744
|
var useVoiceCampaignDialerProof = (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
2483
|
-
const storeRef =
|
|
2745
|
+
const storeRef = useRef10(null);
|
|
2484
2746
|
if (!storeRef.current) {
|
|
2485
2747
|
storeRef.current = createVoiceCampaignDialerProofStore(path, options);
|
|
2486
2748
|
}
|
|
2487
2749
|
const store = storeRef.current;
|
|
2488
|
-
|
|
2750
|
+
useEffect10(() => {
|
|
2489
2751
|
store.refresh().catch(() => {});
|
|
2490
2752
|
return () => store.close();
|
|
2491
2753
|
}, [store]);
|
|
2492
2754
|
return {
|
|
2493
|
-
...
|
|
2755
|
+
...useSyncExternalStore10(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
2494
2756
|
refresh: store.refresh,
|
|
2495
2757
|
runProof: store.runProof
|
|
2496
2758
|
};
|
|
2497
2759
|
};
|
|
2498
2760
|
// src/react/useVoiceStream.tsx
|
|
2499
|
-
import { useEffect as
|
|
2761
|
+
import { useEffect as useEffect11, useRef as useRef11, useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
2500
2762
|
|
|
2501
2763
|
// src/client/actions.ts
|
|
2502
2764
|
var normalizeErrorMessage = (value) => {
|
|
@@ -3156,13 +3418,13 @@ var EMPTY_SNAPSHOT = {
|
|
|
3156
3418
|
turns: []
|
|
3157
3419
|
};
|
|
3158
3420
|
var useVoiceStream = (path, options = {}) => {
|
|
3159
|
-
const streamRef =
|
|
3421
|
+
const streamRef = useRef11(null);
|
|
3160
3422
|
if (!streamRef.current) {
|
|
3161
3423
|
streamRef.current = createVoiceStream(path, options);
|
|
3162
3424
|
}
|
|
3163
3425
|
const stream = streamRef.current;
|
|
3164
|
-
|
|
3165
|
-
const snapshot =
|
|
3426
|
+
useEffect11(() => () => stream.close(), [stream]);
|
|
3427
|
+
const snapshot = useSyncExternalStore11(stream.subscribe, stream.getSnapshot, stream.getServerSnapshot) ?? EMPTY_SNAPSHOT;
|
|
3166
3428
|
return {
|
|
3167
3429
|
...snapshot,
|
|
3168
3430
|
callControl: (message) => stream.callControl(message),
|
|
@@ -3172,7 +3434,7 @@ var useVoiceStream = (path, options = {}) => {
|
|
|
3172
3434
|
};
|
|
3173
3435
|
};
|
|
3174
3436
|
// src/react/useVoiceController.tsx
|
|
3175
|
-
import { useEffect as
|
|
3437
|
+
import { useEffect as useEffect12, useRef as useRef12, useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
3176
3438
|
|
|
3177
3439
|
// src/client/htmx.ts
|
|
3178
3440
|
var DEFAULT_EVENT_NAME = "voice-refresh";
|
|
@@ -3835,13 +4097,13 @@ var EMPTY_SNAPSHOT2 = {
|
|
|
3835
4097
|
turns: []
|
|
3836
4098
|
};
|
|
3837
4099
|
var useVoiceController = (path, options = {}) => {
|
|
3838
|
-
const controllerRef =
|
|
4100
|
+
const controllerRef = useRef12(null);
|
|
3839
4101
|
if (!controllerRef.current) {
|
|
3840
4102
|
controllerRef.current = createVoiceController(path, options);
|
|
3841
4103
|
}
|
|
3842
4104
|
const controller = controllerRef.current;
|
|
3843
|
-
|
|
3844
|
-
const snapshot =
|
|
4105
|
+
useEffect12(() => () => controller.close(), [controller]);
|
|
4106
|
+
const snapshot = useSyncExternalStore12(controller.subscribe, controller.getSnapshot, controller.getServerSnapshot) ?? EMPTY_SNAPSHOT2;
|
|
3845
4107
|
return {
|
|
3846
4108
|
...snapshot,
|
|
3847
4109
|
bindHTMX: controller.bindHTMX,
|
|
@@ -3855,7 +4117,7 @@ var useVoiceController = (path, options = {}) => {
|
|
|
3855
4117
|
};
|
|
3856
4118
|
};
|
|
3857
4119
|
// src/react/useVoiceWorkflowStatus.tsx
|
|
3858
|
-
import { useEffect as
|
|
4120
|
+
import { useEffect as useEffect13, useRef as useRef13, useSyncExternalStore as useSyncExternalStore13 } from "react";
|
|
3859
4121
|
|
|
3860
4122
|
// src/client/workflowStatus.ts
|
|
3861
4123
|
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
@@ -3938,17 +4200,17 @@ var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options =
|
|
|
3938
4200
|
|
|
3939
4201
|
// src/react/useVoiceWorkflowStatus.tsx
|
|
3940
4202
|
var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
|
|
3941
|
-
const storeRef =
|
|
4203
|
+
const storeRef = useRef13(null);
|
|
3942
4204
|
if (!storeRef.current) {
|
|
3943
4205
|
storeRef.current = createVoiceWorkflowStatusStore(path, options);
|
|
3944
4206
|
}
|
|
3945
4207
|
const store = storeRef.current;
|
|
3946
|
-
|
|
4208
|
+
useEffect13(() => {
|
|
3947
4209
|
store.refresh().catch(() => {});
|
|
3948
4210
|
return () => store.close();
|
|
3949
4211
|
}, [store]);
|
|
3950
4212
|
return {
|
|
3951
|
-
...
|
|
4213
|
+
...useSyncExternalStore13(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
3952
4214
|
refresh: store.refresh
|
|
3953
4215
|
};
|
|
3954
4216
|
};
|
|
@@ -3963,6 +4225,7 @@ export {
|
|
|
3963
4225
|
useVoiceProviderSimulationControls,
|
|
3964
4226
|
useVoiceProviderCapabilities,
|
|
3965
4227
|
useVoiceOpsStatus,
|
|
4228
|
+
useVoiceDeliveryRuntime,
|
|
3966
4229
|
useVoiceController,
|
|
3967
4230
|
useVoiceCampaignDialerProof,
|
|
3968
4231
|
VoiceTurnQuality,
|
|
@@ -3972,5 +4235,6 @@ export {
|
|
|
3972
4235
|
VoiceProviderStatus,
|
|
3973
4236
|
VoiceProviderSimulationControls,
|
|
3974
4237
|
VoiceProviderCapabilities,
|
|
3975
|
-
VoiceOpsStatus
|
|
4238
|
+
VoiceOpsStatus,
|
|
4239
|
+
VoiceDeliveryRuntime
|
|
3976
4240
|
};
|