@absolutejs/voice 0.0.22-beta.151 → 0.0.22-beta.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/angular/index.d.ts +2 -0
- package/dist/angular/index.js +604 -124
- package/dist/angular/voice-delivery-runtime.component.d.ts +17 -0
- package/dist/angular/voice-delivery-runtime.service.d.ts +16 -0
- package/dist/client/deliveryRuntime.d.ts +34 -0
- package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.js +371 -100
- package/dist/deliveryRuntime.d.ts +14 -2
- package/dist/index.js +44 -1
- package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +632 -256
- package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
- package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +394 -114
- package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +649 -261
- package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -387,6 +387,380 @@ var VoiceOpsStatus = ({
|
|
|
387
387
|
]
|
|
388
388
|
}, undefined, true, undefined, this);
|
|
389
389
|
};
|
|
390
|
+
// src/client/deliveryRuntime.ts
|
|
391
|
+
var getDefaultActionPath = (path, action, options) => {
|
|
392
|
+
if (action === "tick") {
|
|
393
|
+
return options.tickPath ?? `${path.replace(/\/$/, "")}/tick`;
|
|
394
|
+
}
|
|
395
|
+
return options.requeueDeadLettersPath ?? `${path.replace(/\/$/, "")}/requeue-dead-letters`;
|
|
396
|
+
};
|
|
397
|
+
var fetchVoiceDeliveryRuntime = async (path = "/api/voice-delivery-runtime", options = {}) => {
|
|
398
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
399
|
+
const response = await fetchImpl(path);
|
|
400
|
+
if (!response.ok) {
|
|
401
|
+
throw new Error(`Voice delivery runtime failed: HTTP ${response.status}`);
|
|
402
|
+
}
|
|
403
|
+
return await response.json();
|
|
404
|
+
};
|
|
405
|
+
var runVoiceDeliveryRuntimeAction = async (action, path = "/api/voice-delivery-runtime", options = {}) => {
|
|
406
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
407
|
+
const response = await fetchImpl(getDefaultActionPath(path, action, options), {
|
|
408
|
+
method: "POST"
|
|
409
|
+
});
|
|
410
|
+
if (!response.ok) {
|
|
411
|
+
throw new Error(`Voice delivery runtime ${action} failed: HTTP ${response.status}`);
|
|
412
|
+
}
|
|
413
|
+
const body = await response.json();
|
|
414
|
+
return {
|
|
415
|
+
action,
|
|
416
|
+
result: body.result,
|
|
417
|
+
summary: body.summary,
|
|
418
|
+
updatedAt: Date.now()
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
var createVoiceDeliveryRuntimeStore = (path = "/api/voice-delivery-runtime", options = {}) => {
|
|
422
|
+
const listeners = new Set;
|
|
423
|
+
let closed = false;
|
|
424
|
+
let timer;
|
|
425
|
+
let snapshot = {
|
|
426
|
+
actionError: null,
|
|
427
|
+
actionStatus: "idle",
|
|
428
|
+
error: null,
|
|
429
|
+
isLoading: false
|
|
430
|
+
};
|
|
431
|
+
const emit = () => {
|
|
432
|
+
for (const listener of listeners) {
|
|
433
|
+
listener();
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
const refresh = async () => {
|
|
437
|
+
if (closed) {
|
|
438
|
+
return snapshot.report;
|
|
439
|
+
}
|
|
440
|
+
snapshot = {
|
|
441
|
+
...snapshot,
|
|
442
|
+
error: null,
|
|
443
|
+
isLoading: true
|
|
444
|
+
};
|
|
445
|
+
emit();
|
|
446
|
+
try {
|
|
447
|
+
const report = await fetchVoiceDeliveryRuntime(path, options);
|
|
448
|
+
snapshot = {
|
|
449
|
+
...snapshot,
|
|
450
|
+
error: null,
|
|
451
|
+
isLoading: false,
|
|
452
|
+
report,
|
|
453
|
+
updatedAt: Date.now()
|
|
454
|
+
};
|
|
455
|
+
emit();
|
|
456
|
+
return report;
|
|
457
|
+
} catch (error) {
|
|
458
|
+
snapshot = {
|
|
459
|
+
...snapshot,
|
|
460
|
+
error: error instanceof Error ? error.message : String(error),
|
|
461
|
+
isLoading: false
|
|
462
|
+
};
|
|
463
|
+
emit();
|
|
464
|
+
throw error;
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
const runAction = async (action) => {
|
|
468
|
+
if (closed) {
|
|
469
|
+
return snapshot.lastAction;
|
|
470
|
+
}
|
|
471
|
+
snapshot = {
|
|
472
|
+
...snapshot,
|
|
473
|
+
actionError: null,
|
|
474
|
+
actionStatus: "running"
|
|
475
|
+
};
|
|
476
|
+
emit();
|
|
477
|
+
try {
|
|
478
|
+
const result = await runVoiceDeliveryRuntimeAction(action, path, options);
|
|
479
|
+
snapshot = {
|
|
480
|
+
...snapshot,
|
|
481
|
+
actionError: null,
|
|
482
|
+
actionStatus: "completed",
|
|
483
|
+
lastAction: result
|
|
484
|
+
};
|
|
485
|
+
emit();
|
|
486
|
+
await refresh();
|
|
487
|
+
return result;
|
|
488
|
+
} catch (error) {
|
|
489
|
+
snapshot = {
|
|
490
|
+
...snapshot,
|
|
491
|
+
actionError: error instanceof Error ? error.message : String(error),
|
|
492
|
+
actionStatus: "failed"
|
|
493
|
+
};
|
|
494
|
+
emit();
|
|
495
|
+
throw error;
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
const close = () => {
|
|
499
|
+
closed = true;
|
|
500
|
+
if (timer) {
|
|
501
|
+
clearInterval(timer);
|
|
502
|
+
timer = undefined;
|
|
503
|
+
}
|
|
504
|
+
listeners.clear();
|
|
505
|
+
};
|
|
506
|
+
if (typeof window !== "undefined" && options.intervalMs && options.intervalMs > 0) {
|
|
507
|
+
timer = setInterval(() => {
|
|
508
|
+
refresh().catch(() => {});
|
|
509
|
+
}, options.intervalMs);
|
|
510
|
+
}
|
|
511
|
+
return {
|
|
512
|
+
close,
|
|
513
|
+
getServerSnapshot: () => snapshot,
|
|
514
|
+
getSnapshot: () => snapshot,
|
|
515
|
+
requeueDeadLetters: () => runAction("requeue-dead-letters"),
|
|
516
|
+
refresh,
|
|
517
|
+
tick: () => runAction("tick"),
|
|
518
|
+
subscribe: (listener) => {
|
|
519
|
+
listeners.add(listener);
|
|
520
|
+
return () => {
|
|
521
|
+
listeners.delete(listener);
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
// src/client/deliveryRuntimeWidget.ts
|
|
528
|
+
var DEFAULT_TITLE2 = "Voice Delivery Runtime";
|
|
529
|
+
var DEFAULT_DESCRIPTION2 = "Audit and trace delivery worker health from your AbsoluteJS voice app.";
|
|
530
|
+
var escapeHtml2 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
531
|
+
var createSurface = (id, summary) => {
|
|
532
|
+
if (!summary) {
|
|
533
|
+
return {
|
|
534
|
+
deadLettered: 0,
|
|
535
|
+
detail: "Worker disabled",
|
|
536
|
+
failed: 0,
|
|
537
|
+
id,
|
|
538
|
+
label: id === "audit" ? "Audit delivery" : "Trace delivery",
|
|
539
|
+
pending: 0,
|
|
540
|
+
status: "disabled",
|
|
541
|
+
total: 0
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
const blocked = summary.failed + summary.deadLettered;
|
|
545
|
+
return {
|
|
546
|
+
deadLettered: summary.deadLettered,
|
|
547
|
+
detail: `${summary.delivered}/${summary.total} delivered, ${summary.pending} pending`,
|
|
548
|
+
failed: summary.failed,
|
|
549
|
+
id,
|
|
550
|
+
label: id === "audit" ? "Audit delivery" : "Trace delivery",
|
|
551
|
+
pending: summary.pending,
|
|
552
|
+
status: blocked > 0 ? "warn" : "pass",
|
|
553
|
+
total: summary.total
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
var createVoiceDeliveryRuntimeViewModel = (snapshot, options = {}) => {
|
|
557
|
+
const report = snapshot.report;
|
|
558
|
+
const surfaces = [
|
|
559
|
+
createSurface("audit", report?.summary.audit),
|
|
560
|
+
createSurface("trace", report?.summary.trace)
|
|
561
|
+
];
|
|
562
|
+
const hasWarnings = surfaces.some((surface) => surface.status === "warn");
|
|
563
|
+
return {
|
|
564
|
+
description: options.description ?? DEFAULT_DESCRIPTION2,
|
|
565
|
+
error: snapshot.error,
|
|
566
|
+
actionError: snapshot.actionError,
|
|
567
|
+
actionStatus: snapshot.actionStatus,
|
|
568
|
+
isLoading: snapshot.isLoading,
|
|
569
|
+
isRunning: Boolean(report?.isRunning),
|
|
570
|
+
label: snapshot.error ? "Unavailable" : report ? report.isRunning ? "Running" : "Stopped" : "Checking",
|
|
571
|
+
status: snapshot.error ? "error" : report ? hasWarnings ? "warn" : "pass" : "loading",
|
|
572
|
+
surfaces,
|
|
573
|
+
title: options.title ?? DEFAULT_TITLE2,
|
|
574
|
+
updatedAt: snapshot.updatedAt
|
|
575
|
+
};
|
|
576
|
+
};
|
|
577
|
+
var renderVoiceDeliveryRuntimeHTML = (snapshot, options = {}) => {
|
|
578
|
+
const model = createVoiceDeliveryRuntimeViewModel(snapshot, options);
|
|
579
|
+
const surfaces = model.surfaces.map((surface) => `<li class="absolute-voice-delivery-runtime__surface absolute-voice-delivery-runtime__surface--${escapeHtml2(surface.status)}">
|
|
580
|
+
<span>${escapeHtml2(surface.label)}</span>
|
|
581
|
+
<strong>${escapeHtml2(surface.detail)}</strong>
|
|
582
|
+
<small>${String(surface.failed)} failed · ${String(surface.deadLettered)} dead-lettered</small>
|
|
583
|
+
</li>`).join("");
|
|
584
|
+
const actions = options.includeActions === false ? "" : `<div class="absolute-voice-delivery-runtime__actions">
|
|
585
|
+
<button type="button" data-absolute-voice-delivery-runtime-action="tick">${model.actionStatus === "running" ? "Working..." : "Tick workers"}</button>
|
|
586
|
+
<button type="button" data-absolute-voice-delivery-runtime-action="requeue-dead-letters"${model.surfaces.some((surface) => surface.deadLettered > 0) ? "" : " disabled"}>Requeue dead letters</button>
|
|
587
|
+
</div>`;
|
|
588
|
+
const actionError = model.actionError ? `<p class="absolute-voice-delivery-runtime__error">${escapeHtml2(model.actionError)}</p>` : "";
|
|
589
|
+
return `<section class="absolute-voice-delivery-runtime absolute-voice-delivery-runtime--${escapeHtml2(model.status)}">
|
|
590
|
+
<header class="absolute-voice-delivery-runtime__header">
|
|
591
|
+
<span class="absolute-voice-delivery-runtime__eyebrow">${escapeHtml2(model.title)}</span>
|
|
592
|
+
<strong class="absolute-voice-delivery-runtime__label">${escapeHtml2(model.label)}</strong>
|
|
593
|
+
</header>
|
|
594
|
+
<p class="absolute-voice-delivery-runtime__description">${escapeHtml2(model.description)}</p>
|
|
595
|
+
<ul class="absolute-voice-delivery-runtime__surfaces">${surfaces}</ul>
|
|
596
|
+
${actions}
|
|
597
|
+
${actionError}
|
|
598
|
+
${model.error ? `<p class="absolute-voice-delivery-runtime__error">${escapeHtml2(model.error)}</p>` : ""}
|
|
599
|
+
</section>`;
|
|
600
|
+
};
|
|
601
|
+
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__actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.absolute-voice-delivery-runtime__actions button{background:#134e2d;border:0;border-radius:999px;color:#f6fff9;cursor:pointer;font:inherit;font-weight:800;padding:8px 12px}.absolute-voice-delivery-runtime__actions button:disabled{cursor:not-allowed;opacity:.48}.absolute-voice-delivery-runtime__error{color:#9f1239;font-weight:700}`;
|
|
602
|
+
var mountVoiceDeliveryRuntime = (element, path = "/api/voice-delivery-runtime", options = {}) => {
|
|
603
|
+
const store = createVoiceDeliveryRuntimeStore(path, options);
|
|
604
|
+
const render = () => {
|
|
605
|
+
element.innerHTML = renderVoiceDeliveryRuntimeHTML(store.getSnapshot(), options);
|
|
606
|
+
};
|
|
607
|
+
const unsubscribe = store.subscribe(render);
|
|
608
|
+
const handleClick = (event) => {
|
|
609
|
+
const target = event.target;
|
|
610
|
+
if (!(target instanceof Element)) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
const action = target.closest("[data-absolute-voice-delivery-runtime-action]");
|
|
614
|
+
const actionName = action?.getAttribute("data-absolute-voice-delivery-runtime-action");
|
|
615
|
+
if (actionName === "tick") {
|
|
616
|
+
store.tick().catch(() => {});
|
|
617
|
+
}
|
|
618
|
+
if (actionName === "requeue-dead-letters") {
|
|
619
|
+
store.requeueDeadLetters().catch(() => {});
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
element.addEventListener?.("click", handleClick);
|
|
623
|
+
render();
|
|
624
|
+
store.refresh().catch(() => {});
|
|
625
|
+
return {
|
|
626
|
+
close: () => {
|
|
627
|
+
element.removeEventListener?.("click", handleClick);
|
|
628
|
+
unsubscribe();
|
|
629
|
+
store.close();
|
|
630
|
+
},
|
|
631
|
+
refresh: store.refresh
|
|
632
|
+
};
|
|
633
|
+
};
|
|
634
|
+
var defineVoiceDeliveryRuntimeElement = (tagName = "absolute-voice-delivery-runtime") => {
|
|
635
|
+
if (typeof window === "undefined" || typeof customElements === "undefined" || customElements.get(tagName)) {
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
customElements.define(tagName, class AbsoluteVoiceDeliveryRuntimeElement extends HTMLElement {
|
|
639
|
+
mounted;
|
|
640
|
+
connectedCallback() {
|
|
641
|
+
const intervalMs = Number(this.getAttribute("interval-ms") ?? 5000);
|
|
642
|
+
this.mounted = mountVoiceDeliveryRuntime(this, this.getAttribute("path") ?? "/api/voice-delivery-runtime", {
|
|
643
|
+
description: this.getAttribute("description") ?? undefined,
|
|
644
|
+
intervalMs: Number.isFinite(intervalMs) ? intervalMs : 5000,
|
|
645
|
+
title: this.getAttribute("title") ?? undefined
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
disconnectedCallback() {
|
|
649
|
+
this.mounted?.close();
|
|
650
|
+
this.mounted = undefined;
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
// src/react/useVoiceDeliveryRuntime.tsx
|
|
656
|
+
import { useEffect as useEffect2, useRef as useRef2, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
657
|
+
var useVoiceDeliveryRuntime = (path = "/api/voice-delivery-runtime", options = {}) => {
|
|
658
|
+
const storeRef = useRef2(null);
|
|
659
|
+
if (!storeRef.current) {
|
|
660
|
+
storeRef.current = createVoiceDeliveryRuntimeStore(path, options);
|
|
661
|
+
}
|
|
662
|
+
const store = storeRef.current;
|
|
663
|
+
useEffect2(() => {
|
|
664
|
+
store.refresh().catch(() => {});
|
|
665
|
+
return () => store.close();
|
|
666
|
+
}, [store]);
|
|
667
|
+
return {
|
|
668
|
+
...useSyncExternalStore2(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
669
|
+
requeueDeadLetters: store.requeueDeadLetters,
|
|
670
|
+
refresh: store.refresh,
|
|
671
|
+
tick: store.tick
|
|
672
|
+
};
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
// src/react/VoiceDeliveryRuntime.tsx
|
|
676
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
677
|
+
var VoiceDeliveryRuntime = ({
|
|
678
|
+
className,
|
|
679
|
+
includeActions = true,
|
|
680
|
+
path = "/api/voice-delivery-runtime",
|
|
681
|
+
...options
|
|
682
|
+
}) => {
|
|
683
|
+
const snapshot = useVoiceDeliveryRuntime(path, options);
|
|
684
|
+
const model = createVoiceDeliveryRuntimeViewModel(snapshot, options);
|
|
685
|
+
const hasDeadLetters = model.surfaces.some((surface) => surface.deadLettered > 0);
|
|
686
|
+
return /* @__PURE__ */ jsxDEV2("section", {
|
|
687
|
+
className: [
|
|
688
|
+
"absolute-voice-delivery-runtime",
|
|
689
|
+
`absolute-voice-delivery-runtime--${model.status}`,
|
|
690
|
+
className
|
|
691
|
+
].filter(Boolean).join(" "),
|
|
692
|
+
children: [
|
|
693
|
+
/* @__PURE__ */ jsxDEV2("header", {
|
|
694
|
+
className: "absolute-voice-delivery-runtime__header",
|
|
695
|
+
children: [
|
|
696
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
697
|
+
className: "absolute-voice-delivery-runtime__eyebrow",
|
|
698
|
+
children: model.title
|
|
699
|
+
}, undefined, false, undefined, this),
|
|
700
|
+
/* @__PURE__ */ jsxDEV2("strong", {
|
|
701
|
+
className: "absolute-voice-delivery-runtime__label",
|
|
702
|
+
children: model.label
|
|
703
|
+
}, undefined, false, undefined, this)
|
|
704
|
+
]
|
|
705
|
+
}, undefined, true, undefined, this),
|
|
706
|
+
/* @__PURE__ */ jsxDEV2("p", {
|
|
707
|
+
className: "absolute-voice-delivery-runtime__description",
|
|
708
|
+
children: model.description
|
|
709
|
+
}, undefined, false, undefined, this),
|
|
710
|
+
/* @__PURE__ */ jsxDEV2("ul", {
|
|
711
|
+
className: "absolute-voice-delivery-runtime__surfaces",
|
|
712
|
+
children: model.surfaces.map((surface) => /* @__PURE__ */ jsxDEV2("li", {
|
|
713
|
+
className: `absolute-voice-delivery-runtime__surface absolute-voice-delivery-runtime__surface--${surface.status}`,
|
|
714
|
+
children: [
|
|
715
|
+
/* @__PURE__ */ jsxDEV2("span", {
|
|
716
|
+
children: surface.label
|
|
717
|
+
}, undefined, false, undefined, this),
|
|
718
|
+
/* @__PURE__ */ jsxDEV2("strong", {
|
|
719
|
+
children: surface.detail
|
|
720
|
+
}, undefined, false, undefined, this),
|
|
721
|
+
/* @__PURE__ */ jsxDEV2("small", {
|
|
722
|
+
children: [
|
|
723
|
+
surface.failed,
|
|
724
|
+
" failed / ",
|
|
725
|
+
surface.deadLettered,
|
|
726
|
+
" dead-lettered"
|
|
727
|
+
]
|
|
728
|
+
}, undefined, true, undefined, this)
|
|
729
|
+
]
|
|
730
|
+
}, surface.id, true, undefined, this))
|
|
731
|
+
}, undefined, false, undefined, this),
|
|
732
|
+
includeActions ? /* @__PURE__ */ jsxDEV2("div", {
|
|
733
|
+
className: "absolute-voice-delivery-runtime__actions",
|
|
734
|
+
children: [
|
|
735
|
+
/* @__PURE__ */ jsxDEV2("button", {
|
|
736
|
+
disabled: model.actionStatus === "running",
|
|
737
|
+
onClick: () => {
|
|
738
|
+
snapshot.tick().catch(() => {});
|
|
739
|
+
},
|
|
740
|
+
type: "button",
|
|
741
|
+
children: model.actionStatus === "running" ? "Working..." : "Tick workers"
|
|
742
|
+
}, undefined, false, undefined, this),
|
|
743
|
+
/* @__PURE__ */ jsxDEV2("button", {
|
|
744
|
+
disabled: model.actionStatus === "running" || !hasDeadLetters,
|
|
745
|
+
onClick: () => {
|
|
746
|
+
snapshot.requeueDeadLetters().catch(() => {});
|
|
747
|
+
},
|
|
748
|
+
type: "button",
|
|
749
|
+
children: "Requeue dead letters"
|
|
750
|
+
}, undefined, false, undefined, this)
|
|
751
|
+
]
|
|
752
|
+
}, undefined, true, undefined, this) : null,
|
|
753
|
+
model.actionError ? /* @__PURE__ */ jsxDEV2("p", {
|
|
754
|
+
className: "absolute-voice-delivery-runtime__error",
|
|
755
|
+
children: model.actionError
|
|
756
|
+
}, undefined, false, undefined, this) : null,
|
|
757
|
+
model.error ? /* @__PURE__ */ jsxDEV2("p", {
|
|
758
|
+
className: "absolute-voice-delivery-runtime__error",
|
|
759
|
+
children: model.error
|
|
760
|
+
}, undefined, false, undefined, this) : null
|
|
761
|
+
]
|
|
762
|
+
}, undefined, true, undefined, this);
|
|
763
|
+
};
|
|
390
764
|
// src/client/providerSimulationControls.ts
|
|
391
765
|
var postSimulation = async (pathPrefix, mode, provider, fetchImpl) => {
|
|
392
766
|
const response = await fetchImpl(`${pathPrefix}/${mode}?provider=${encodeURIComponent(provider)}`, { method: "POST" });
|
|
@@ -467,7 +841,7 @@ var createVoiceProviderSimulationControlsStore = (options) => {
|
|
|
467
841
|
};
|
|
468
842
|
|
|
469
843
|
// src/client/providerSimulationControlsWidget.ts
|
|
470
|
-
var
|
|
844
|
+
var escapeHtml3 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
471
845
|
var formatKind = (kind) => (kind ?? "stt").toUpperCase();
|
|
472
846
|
var createVoiceProviderSimulationControlsViewModel = (snapshot, options) => {
|
|
473
847
|
const configuredProviders = options.providers.filter((provider) => provider.configured !== false);
|
|
@@ -487,18 +861,18 @@ var createVoiceProviderSimulationControlsViewModel = (snapshot, options) => {
|
|
|
487
861
|
};
|
|
488
862
|
var renderVoiceProviderSimulationControlsHTML = (snapshot, options) => {
|
|
489
863
|
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="${
|
|
864
|
+
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("");
|
|
865
|
+
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
866
|
return `<section class="absolute-voice-provider-simulation absolute-voice-provider-simulation--${snapshot.error ? "error" : snapshot.isRunning ? "running" : "ready"}">
|
|
493
867
|
<header class="absolute-voice-provider-simulation__header">
|
|
494
|
-
<span class="absolute-voice-provider-simulation__eyebrow">${
|
|
495
|
-
<strong class="absolute-voice-provider-simulation__label">${
|
|
868
|
+
<span class="absolute-voice-provider-simulation__eyebrow">${escapeHtml3(model.title)}</span>
|
|
869
|
+
<strong class="absolute-voice-provider-simulation__label">${escapeHtml3(model.label)}</strong>
|
|
496
870
|
</header>
|
|
497
|
-
<p class="absolute-voice-provider-simulation__description">${
|
|
498
|
-
${model.canSimulateFailure ? "" : `<p class="absolute-voice-provider-simulation__empty">${
|
|
871
|
+
<p class="absolute-voice-provider-simulation__description">${escapeHtml3(model.description)}</p>
|
|
872
|
+
${model.canSimulateFailure ? "" : `<p class="absolute-voice-provider-simulation__empty">${escapeHtml3(options.fallbackRequiredMessage ?? "Configure fallback providers before simulating failure.")}</p>`}
|
|
499
873
|
<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">${
|
|
874
|
+
${snapshot.error ? `<p class="absolute-voice-provider-simulation__error">${escapeHtml3(snapshot.error)}</p>` : ""}
|
|
875
|
+
${model.resultText ? `<pre class="absolute-voice-provider-simulation__result">${escapeHtml3(model.resultText)}</pre>` : ""}
|
|
502
876
|
</section>`;
|
|
503
877
|
};
|
|
504
878
|
var bindVoiceProviderSimulationControls = (element, store) => {
|
|
@@ -564,22 +938,22 @@ var defineVoiceProviderSimulationControlsElement = (tagName = "absolute-voice-pr
|
|
|
564
938
|
};
|
|
565
939
|
|
|
566
940
|
// src/react/useVoiceProviderSimulationControls.tsx
|
|
567
|
-
import { useEffect as
|
|
941
|
+
import { useEffect as useEffect3, useRef as useRef3, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
568
942
|
var useVoiceProviderSimulationControls = (options) => {
|
|
569
|
-
const storeRef =
|
|
943
|
+
const storeRef = useRef3(null);
|
|
570
944
|
if (!storeRef.current) {
|
|
571
945
|
storeRef.current = createVoiceProviderSimulationControlsStore(options);
|
|
572
946
|
}
|
|
573
947
|
const store = storeRef.current;
|
|
574
|
-
|
|
948
|
+
useEffect3(() => () => store.close(), [store]);
|
|
575
949
|
return {
|
|
576
|
-
...
|
|
950
|
+
...useSyncExternalStore3(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
577
951
|
run: store.run
|
|
578
952
|
};
|
|
579
953
|
};
|
|
580
954
|
|
|
581
955
|
// src/react/VoiceProviderSimulationControls.tsx
|
|
582
|
-
import { jsxDEV as
|
|
956
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
583
957
|
var VoiceProviderSimulationControls = ({
|
|
584
958
|
className,
|
|
585
959
|
...options
|
|
@@ -589,38 +963,38 @@ var VoiceProviderSimulationControls = ({
|
|
|
589
963
|
const run = (provider, mode) => {
|
|
590
964
|
snapshot.run(provider, mode).catch(() => {});
|
|
591
965
|
};
|
|
592
|
-
return /* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ jsxDEV3("section", {
|
|
593
967
|
className: [
|
|
594
968
|
"absolute-voice-provider-simulation",
|
|
595
969
|
`absolute-voice-provider-simulation--${snapshot.error ? "error" : snapshot.isRunning ? "running" : "ready"}`,
|
|
596
970
|
className
|
|
597
971
|
].filter(Boolean).join(" "),
|
|
598
972
|
children: [
|
|
599
|
-
/* @__PURE__ */
|
|
973
|
+
/* @__PURE__ */ jsxDEV3("header", {
|
|
600
974
|
className: "absolute-voice-provider-simulation__header",
|
|
601
975
|
children: [
|
|
602
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ jsxDEV3("span", {
|
|
603
977
|
className: "absolute-voice-provider-simulation__eyebrow",
|
|
604
978
|
children: model.title
|
|
605
979
|
}, undefined, false, undefined, this),
|
|
606
|
-
/* @__PURE__ */
|
|
980
|
+
/* @__PURE__ */ jsxDEV3("strong", {
|
|
607
981
|
className: "absolute-voice-provider-simulation__label",
|
|
608
982
|
children: model.label
|
|
609
983
|
}, undefined, false, undefined, this)
|
|
610
984
|
]
|
|
611
985
|
}, undefined, true, undefined, this),
|
|
612
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ jsxDEV3("p", {
|
|
613
987
|
className: "absolute-voice-provider-simulation__description",
|
|
614
988
|
children: model.description
|
|
615
989
|
}, undefined, false, undefined, this),
|
|
616
|
-
model.canSimulateFailure ? null : /* @__PURE__ */
|
|
990
|
+
model.canSimulateFailure ? null : /* @__PURE__ */ jsxDEV3("p", {
|
|
617
991
|
className: "absolute-voice-provider-simulation__empty",
|
|
618
992
|
children: options.fallbackRequiredMessage ?? "Configure fallback providers before simulating failure."
|
|
619
993
|
}, undefined, false, undefined, this),
|
|
620
|
-
/* @__PURE__ */
|
|
994
|
+
/* @__PURE__ */ jsxDEV3("div", {
|
|
621
995
|
className: "absolute-voice-provider-simulation__actions",
|
|
622
996
|
children: [
|
|
623
|
-
model.failureProviders.map((provider) => /* @__PURE__ */
|
|
997
|
+
model.failureProviders.map((provider) => /* @__PURE__ */ jsxDEV3("button", {
|
|
624
998
|
disabled: !model.canSimulateFailure || snapshot.isRunning,
|
|
625
999
|
onClick: () => run(provider.provider, "failure"),
|
|
626
1000
|
type: "button",
|
|
@@ -633,7 +1007,7 @@ var VoiceProviderSimulationControls = ({
|
|
|
633
1007
|
"failure"
|
|
634
1008
|
]
|
|
635
1009
|
}, `fail-${provider.provider}`, true, undefined, this)),
|
|
636
|
-
model.providers.map((provider) => /* @__PURE__ */
|
|
1010
|
+
model.providers.map((provider) => /* @__PURE__ */ jsxDEV3("button", {
|
|
637
1011
|
disabled: snapshot.isRunning,
|
|
638
1012
|
onClick: () => run(provider.provider, "recovery"),
|
|
639
1013
|
type: "button",
|
|
@@ -645,11 +1019,11 @@ var VoiceProviderSimulationControls = ({
|
|
|
645
1019
|
}, `recover-${provider.provider}`, true, undefined, this))
|
|
646
1020
|
]
|
|
647
1021
|
}, undefined, true, undefined, this),
|
|
648
|
-
snapshot.error ? /* @__PURE__ */
|
|
1022
|
+
snapshot.error ? /* @__PURE__ */ jsxDEV3("p", {
|
|
649
1023
|
className: "absolute-voice-provider-simulation__error",
|
|
650
1024
|
children: snapshot.error
|
|
651
1025
|
}, undefined, false, undefined, this) : null,
|
|
652
|
-
model.resultText ? /* @__PURE__ */
|
|
1026
|
+
model.resultText ? /* @__PURE__ */ jsxDEV3("pre", {
|
|
653
1027
|
className: "absolute-voice-provider-simulation__result",
|
|
654
1028
|
children: model.resultText
|
|
655
1029
|
}, undefined, false, undefined, this) : null
|
|
@@ -657,7 +1031,7 @@ var VoiceProviderSimulationControls = ({
|
|
|
657
1031
|
}, undefined, true, undefined, this);
|
|
658
1032
|
};
|
|
659
1033
|
// src/react/useVoiceProviderCapabilities.tsx
|
|
660
|
-
import { useEffect as
|
|
1034
|
+
import { useEffect as useEffect4, useRef as useRef4, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
661
1035
|
|
|
662
1036
|
// src/client/providerCapabilities.ts
|
|
663
1037
|
var fetchVoiceProviderCapabilities = async (path = "/api/provider-capabilities", options = {}) => {
|
|
@@ -740,25 +1114,25 @@ var createVoiceProviderCapabilitiesStore = (path = "/api/provider-capabilities",
|
|
|
740
1114
|
|
|
741
1115
|
// src/react/useVoiceProviderCapabilities.tsx
|
|
742
1116
|
var useVoiceProviderCapabilities = (path = "/api/provider-capabilities", options = {}) => {
|
|
743
|
-
const storeRef =
|
|
1117
|
+
const storeRef = useRef4(null);
|
|
744
1118
|
if (!storeRef.current) {
|
|
745
1119
|
storeRef.current = createVoiceProviderCapabilitiesStore(path, options);
|
|
746
1120
|
}
|
|
747
1121
|
const store = storeRef.current;
|
|
748
|
-
|
|
1122
|
+
useEffect4(() => {
|
|
749
1123
|
store.refresh().catch(() => {});
|
|
750
1124
|
return () => store.close();
|
|
751
1125
|
}, [store]);
|
|
752
1126
|
return {
|
|
753
|
-
...
|
|
1127
|
+
...useSyncExternalStore4(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
754
1128
|
refresh: store.refresh
|
|
755
1129
|
};
|
|
756
1130
|
};
|
|
757
1131
|
|
|
758
1132
|
// src/client/providerCapabilitiesWidget.ts
|
|
759
|
-
var
|
|
760
|
-
var
|
|
761
|
-
var
|
|
1133
|
+
var DEFAULT_TITLE3 = "Provider Capabilities";
|
|
1134
|
+
var DEFAULT_DESCRIPTION3 = "Configured, selected, and healthy voice providers for this deployment.";
|
|
1135
|
+
var escapeHtml4 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
762
1136
|
var formatProvider = (provider) => provider.split(/[-_\s]+/).filter(Boolean).map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ") || provider;
|
|
763
1137
|
var formatKind2 = (kind) => kind.toUpperCase();
|
|
764
1138
|
var formatStatus = (status) => status.split("-").map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
|
|
@@ -802,36 +1176,36 @@ var createVoiceProviderCapabilitiesViewModel = (snapshot, options = {}) => {
|
|
|
802
1176
|
const selectedCount = snapshot.report?.selected ?? capabilities.filter((capability) => capability.selected).length;
|
|
803
1177
|
return {
|
|
804
1178
|
capabilities,
|
|
805
|
-
description: options.description ??
|
|
1179
|
+
description: options.description ?? DEFAULT_DESCRIPTION3,
|
|
806
1180
|
error: snapshot.error,
|
|
807
1181
|
isLoading: snapshot.isLoading,
|
|
808
1182
|
label: snapshot.error ? "Unavailable" : capabilities.length ? warningCount > 0 ? `${warningCount} needs attention` : `${selectedCount} selected` : snapshot.isLoading ? "Checking" : "No capabilities",
|
|
809
1183
|
status: snapshot.error ? "error" : capabilities.length ? warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
810
|
-
title: options.title ??
|
|
1184
|
+
title: options.title ?? DEFAULT_TITLE3,
|
|
811
1185
|
updatedAt: snapshot.updatedAt
|
|
812
1186
|
};
|
|
813
1187
|
};
|
|
814
1188
|
var renderVoiceProviderCapabilitiesHTML = (snapshot, options = {}) => {
|
|
815
1189
|
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--${
|
|
1190
|
+
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
1191
|
<header>
|
|
818
|
-
<strong>${
|
|
819
|
-
<span>${
|
|
1192
|
+
<strong>${escapeHtml4(capability.label)}</strong>
|
|
1193
|
+
<span>${escapeHtml4(formatStatus(capability.status))}</span>
|
|
820
1194
|
</header>
|
|
821
|
-
<p>${
|
|
1195
|
+
<p>${escapeHtml4(capability.detail)}</p>
|
|
822
1196
|
<dl>${capability.rows.map((row) => `<div>
|
|
823
|
-
<dt>${
|
|
824
|
-
<dd>${
|
|
1197
|
+
<dt>${escapeHtml4(row.label)}</dt>
|
|
1198
|
+
<dd>${escapeHtml4(row.value)}</dd>
|
|
825
1199
|
</div>`).join("")}</dl>
|
|
826
1200
|
</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--${
|
|
1201
|
+
return `<section class="absolute-voice-provider-capabilities absolute-voice-provider-capabilities--${escapeHtml4(model.status)}">
|
|
828
1202
|
<header class="absolute-voice-provider-capabilities__header">
|
|
829
|
-
<span class="absolute-voice-provider-capabilities__eyebrow">${
|
|
830
|
-
<strong class="absolute-voice-provider-capabilities__label">${
|
|
1203
|
+
<span class="absolute-voice-provider-capabilities__eyebrow">${escapeHtml4(model.title)}</span>
|
|
1204
|
+
<strong class="absolute-voice-provider-capabilities__label">${escapeHtml4(model.label)}</strong>
|
|
831
1205
|
</header>
|
|
832
|
-
<p class="absolute-voice-provider-capabilities__description">${
|
|
1206
|
+
<p class="absolute-voice-provider-capabilities__description">${escapeHtml4(model.description)}</p>
|
|
833
1207
|
${capabilities}
|
|
834
|
-
${model.error ? `<p class="absolute-voice-provider-capabilities__error">${
|
|
1208
|
+
${model.error ? `<p class="absolute-voice-provider-capabilities__error">${escapeHtml4(model.error)}</p>` : ""}
|
|
835
1209
|
</section>`;
|
|
836
1210
|
};
|
|
837
1211
|
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 +1247,7 @@ var defineVoiceProviderCapabilitiesElement = (tagName = "absolute-voice-provider
|
|
|
873
1247
|
};
|
|
874
1248
|
|
|
875
1249
|
// src/react/VoiceProviderCapabilities.tsx
|
|
876
|
-
import { jsxDEV as
|
|
1250
|
+
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
877
1251
|
var VoiceProviderCapabilities = ({
|
|
878
1252
|
className,
|
|
879
1253
|
path = "/api/provider-capabilities",
|
|
@@ -881,58 +1255,58 @@ var VoiceProviderCapabilities = ({
|
|
|
881
1255
|
}) => {
|
|
882
1256
|
const snapshot = useVoiceProviderCapabilities(path, options);
|
|
883
1257
|
const model = createVoiceProviderCapabilitiesViewModel(snapshot, options);
|
|
884
|
-
return /* @__PURE__ */
|
|
1258
|
+
return /* @__PURE__ */ jsxDEV4("section", {
|
|
885
1259
|
className: [
|
|
886
1260
|
"absolute-voice-provider-capabilities",
|
|
887
1261
|
`absolute-voice-provider-capabilities--${model.status}`,
|
|
888
1262
|
className
|
|
889
1263
|
].filter(Boolean).join(" "),
|
|
890
1264
|
children: [
|
|
891
|
-
/* @__PURE__ */
|
|
1265
|
+
/* @__PURE__ */ jsxDEV4("header", {
|
|
892
1266
|
className: "absolute-voice-provider-capabilities__header",
|
|
893
1267
|
children: [
|
|
894
|
-
/* @__PURE__ */
|
|
1268
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
895
1269
|
className: "absolute-voice-provider-capabilities__eyebrow",
|
|
896
1270
|
children: model.title
|
|
897
1271
|
}, undefined, false, undefined, this),
|
|
898
|
-
/* @__PURE__ */
|
|
1272
|
+
/* @__PURE__ */ jsxDEV4("strong", {
|
|
899
1273
|
className: "absolute-voice-provider-capabilities__label",
|
|
900
1274
|
children: model.label
|
|
901
1275
|
}, undefined, false, undefined, this)
|
|
902
1276
|
]
|
|
903
1277
|
}, undefined, true, undefined, this),
|
|
904
|
-
/* @__PURE__ */
|
|
1278
|
+
/* @__PURE__ */ jsxDEV4("p", {
|
|
905
1279
|
className: "absolute-voice-provider-capabilities__description",
|
|
906
1280
|
children: model.description
|
|
907
1281
|
}, undefined, false, undefined, this),
|
|
908
|
-
model.capabilities.length ? /* @__PURE__ */
|
|
1282
|
+
model.capabilities.length ? /* @__PURE__ */ jsxDEV4("div", {
|
|
909
1283
|
className: "absolute-voice-provider-capabilities__providers",
|
|
910
|
-
children: model.capabilities.map((capability) => /* @__PURE__ */
|
|
1284
|
+
children: model.capabilities.map((capability) => /* @__PURE__ */ jsxDEV4("article", {
|
|
911
1285
|
className: [
|
|
912
1286
|
"absolute-voice-provider-capabilities__provider",
|
|
913
1287
|
`absolute-voice-provider-capabilities__provider--${capability.status}`
|
|
914
1288
|
].join(" "),
|
|
915
1289
|
children: [
|
|
916
|
-
/* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ jsxDEV4("header", {
|
|
917
1291
|
children: [
|
|
918
|
-
/* @__PURE__ */
|
|
1292
|
+
/* @__PURE__ */ jsxDEV4("strong", {
|
|
919
1293
|
children: capability.label
|
|
920
1294
|
}, undefined, false, undefined, this),
|
|
921
|
-
/* @__PURE__ */
|
|
1295
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
922
1296
|
children: capability.status
|
|
923
1297
|
}, undefined, false, undefined, this)
|
|
924
1298
|
]
|
|
925
1299
|
}, undefined, true, undefined, this),
|
|
926
|
-
/* @__PURE__ */
|
|
1300
|
+
/* @__PURE__ */ jsxDEV4("p", {
|
|
927
1301
|
children: capability.detail
|
|
928
1302
|
}, undefined, false, undefined, this),
|
|
929
|
-
/* @__PURE__ */
|
|
930
|
-
children: capability.rows.map((row) => /* @__PURE__ */
|
|
1303
|
+
/* @__PURE__ */ jsxDEV4("dl", {
|
|
1304
|
+
children: capability.rows.map((row) => /* @__PURE__ */ jsxDEV4("div", {
|
|
931
1305
|
children: [
|
|
932
|
-
/* @__PURE__ */
|
|
1306
|
+
/* @__PURE__ */ jsxDEV4("dt", {
|
|
933
1307
|
children: row.label
|
|
934
1308
|
}, undefined, false, undefined, this),
|
|
935
|
-
/* @__PURE__ */
|
|
1309
|
+
/* @__PURE__ */ jsxDEV4("dd", {
|
|
936
1310
|
children: row.value
|
|
937
1311
|
}, undefined, false, undefined, this)
|
|
938
1312
|
]
|
|
@@ -940,11 +1314,11 @@ var VoiceProviderCapabilities = ({
|
|
|
940
1314
|
}, undefined, false, undefined, this)
|
|
941
1315
|
]
|
|
942
1316
|
}, `${capability.kind}:${capability.provider}`, true, undefined, this))
|
|
943
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
1317
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV4("p", {
|
|
944
1318
|
className: "absolute-voice-provider-capabilities__empty",
|
|
945
1319
|
children: "Configure provider capabilities to see deployment coverage."
|
|
946
1320
|
}, undefined, false, undefined, this),
|
|
947
|
-
model.error ? /* @__PURE__ */
|
|
1321
|
+
model.error ? /* @__PURE__ */ jsxDEV4("p", {
|
|
948
1322
|
className: "absolute-voice-provider-capabilities__error",
|
|
949
1323
|
children: model.error
|
|
950
1324
|
}, undefined, false, undefined, this) : null
|
|
@@ -952,7 +1326,7 @@ var VoiceProviderCapabilities = ({
|
|
|
952
1326
|
}, undefined, true, undefined, this);
|
|
953
1327
|
};
|
|
954
1328
|
// src/react/useVoiceProviderStatus.tsx
|
|
955
|
-
import { useEffect as
|
|
1329
|
+
import { useEffect as useEffect5, useRef as useRef5, useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
956
1330
|
|
|
957
1331
|
// src/client/providerStatus.ts
|
|
958
1332
|
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
@@ -1036,25 +1410,25 @@ var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {
|
|
|
1036
1410
|
|
|
1037
1411
|
// src/react/useVoiceProviderStatus.tsx
|
|
1038
1412
|
var useVoiceProviderStatus = (path = "/api/provider-status", options = {}) => {
|
|
1039
|
-
const storeRef =
|
|
1413
|
+
const storeRef = useRef5(null);
|
|
1040
1414
|
if (!storeRef.current) {
|
|
1041
1415
|
storeRef.current = createVoiceProviderStatusStore(path, options);
|
|
1042
1416
|
}
|
|
1043
1417
|
const store = storeRef.current;
|
|
1044
|
-
|
|
1418
|
+
useEffect5(() => {
|
|
1045
1419
|
store.refresh().catch(() => {});
|
|
1046
1420
|
return () => store.close();
|
|
1047
1421
|
}, [store]);
|
|
1048
1422
|
return {
|
|
1049
|
-
...
|
|
1423
|
+
...useSyncExternalStore5(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
1050
1424
|
refresh: store.refresh
|
|
1051
1425
|
};
|
|
1052
1426
|
};
|
|
1053
1427
|
|
|
1054
1428
|
// src/client/providerStatusWidget.ts
|
|
1055
|
-
var
|
|
1056
|
-
var
|
|
1057
|
-
var
|
|
1429
|
+
var DEFAULT_TITLE4 = "Voice Providers";
|
|
1430
|
+
var DEFAULT_DESCRIPTION4 = "Live provider health, fallback counts, latency, and suppression state from your self-hosted trace store.";
|
|
1431
|
+
var escapeHtml5 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1058
1432
|
var formatProvider2 = (provider) => provider.split(/[-_\s]+/).filter(Boolean).map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ") || provider;
|
|
1059
1433
|
var formatStatus2 = (status) => status.split("-").map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
|
|
1060
1434
|
var formatLatency = (value) => typeof value === "number" ? `${value}ms` : "No samples";
|
|
@@ -1098,37 +1472,37 @@ var createVoiceProviderStatusViewModel = (snapshot, options = {}) => {
|
|
|
1098
1472
|
const warningCount = providers.filter((provider) => isWarningStatus2(provider.status)).length;
|
|
1099
1473
|
const healthyCount = providers.filter((provider) => provider.status === "healthy").length;
|
|
1100
1474
|
return {
|
|
1101
|
-
description: options.description ??
|
|
1475
|
+
description: options.description ?? DEFAULT_DESCRIPTION4,
|
|
1102
1476
|
error: snapshot.error,
|
|
1103
1477
|
isLoading: snapshot.isLoading,
|
|
1104
1478
|
label: snapshot.error ? "Unavailable" : providers.length ? warningCount > 0 ? `${warningCount} needs attention` : `${healthyCount} healthy` : snapshot.isLoading ? "Checking" : "No provider traffic",
|
|
1105
1479
|
providers,
|
|
1106
1480
|
status: snapshot.error ? "error" : providers.length ? warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
1107
|
-
title: options.title ??
|
|
1481
|
+
title: options.title ?? DEFAULT_TITLE4,
|
|
1108
1482
|
updatedAt: snapshot.updatedAt
|
|
1109
1483
|
};
|
|
1110
1484
|
};
|
|
1111
1485
|
var renderVoiceProviderStatusHTML = (snapshot, options = {}) => {
|
|
1112
1486
|
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--${
|
|
1487
|
+
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
1488
|
<header>
|
|
1115
|
-
<strong>${
|
|
1116
|
-
<span>${
|
|
1489
|
+
<strong>${escapeHtml5(provider.label)}</strong>
|
|
1490
|
+
<span>${escapeHtml5(formatStatus2(provider.status))}</span>
|
|
1117
1491
|
</header>
|
|
1118
|
-
<p>${
|
|
1492
|
+
<p>${escapeHtml5(provider.detail)}</p>
|
|
1119
1493
|
<dl>${provider.rows.map((row) => `<div>
|
|
1120
|
-
<dt>${
|
|
1121
|
-
<dd>${
|
|
1494
|
+
<dt>${escapeHtml5(row.label)}</dt>
|
|
1495
|
+
<dd>${escapeHtml5(row.value)}</dd>
|
|
1122
1496
|
</div>`).join("")}</dl>
|
|
1123
1497
|
</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--${
|
|
1498
|
+
return `<section class="absolute-voice-provider-status absolute-voice-provider-status--${escapeHtml5(model.status)}">
|
|
1125
1499
|
<header class="absolute-voice-provider-status__header">
|
|
1126
|
-
<span class="absolute-voice-provider-status__eyebrow">${
|
|
1127
|
-
<strong class="absolute-voice-provider-status__label">${
|
|
1500
|
+
<span class="absolute-voice-provider-status__eyebrow">${escapeHtml5(model.title)}</span>
|
|
1501
|
+
<strong class="absolute-voice-provider-status__label">${escapeHtml5(model.label)}</strong>
|
|
1128
1502
|
</header>
|
|
1129
|
-
<p class="absolute-voice-provider-status__description">${
|
|
1503
|
+
<p class="absolute-voice-provider-status__description">${escapeHtml5(model.description)}</p>
|
|
1130
1504
|
${providers}
|
|
1131
|
-
${model.error ? `<p class="absolute-voice-provider-status__error">${
|
|
1505
|
+
${model.error ? `<p class="absolute-voice-provider-status__error">${escapeHtml5(model.error)}</p>` : ""}
|
|
1132
1506
|
</section>`;
|
|
1133
1507
|
};
|
|
1134
1508
|
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 +1544,7 @@ var defineVoiceProviderStatusElement = (tagName = "absolute-voice-provider-statu
|
|
|
1170
1544
|
};
|
|
1171
1545
|
|
|
1172
1546
|
// src/react/VoiceProviderStatus.tsx
|
|
1173
|
-
import { jsxDEV as
|
|
1547
|
+
import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
|
|
1174
1548
|
var VoiceProviderStatus = ({
|
|
1175
1549
|
className,
|
|
1176
1550
|
path = "/api/provider-status",
|
|
@@ -1178,58 +1552,58 @@ var VoiceProviderStatus = ({
|
|
|
1178
1552
|
}) => {
|
|
1179
1553
|
const snapshot = useVoiceProviderStatus(path, options);
|
|
1180
1554
|
const model = createVoiceProviderStatusViewModel(snapshot, options);
|
|
1181
|
-
return /* @__PURE__ */
|
|
1555
|
+
return /* @__PURE__ */ jsxDEV5("section", {
|
|
1182
1556
|
className: [
|
|
1183
1557
|
"absolute-voice-provider-status",
|
|
1184
1558
|
`absolute-voice-provider-status--${model.status}`,
|
|
1185
1559
|
className
|
|
1186
1560
|
].filter(Boolean).join(" "),
|
|
1187
1561
|
children: [
|
|
1188
|
-
/* @__PURE__ */
|
|
1562
|
+
/* @__PURE__ */ jsxDEV5("header", {
|
|
1189
1563
|
className: "absolute-voice-provider-status__header",
|
|
1190
1564
|
children: [
|
|
1191
|
-
/* @__PURE__ */
|
|
1565
|
+
/* @__PURE__ */ jsxDEV5("span", {
|
|
1192
1566
|
className: "absolute-voice-provider-status__eyebrow",
|
|
1193
1567
|
children: model.title
|
|
1194
1568
|
}, undefined, false, undefined, this),
|
|
1195
|
-
/* @__PURE__ */
|
|
1569
|
+
/* @__PURE__ */ jsxDEV5("strong", {
|
|
1196
1570
|
className: "absolute-voice-provider-status__label",
|
|
1197
1571
|
children: model.label
|
|
1198
1572
|
}, undefined, false, undefined, this)
|
|
1199
1573
|
]
|
|
1200
1574
|
}, undefined, true, undefined, this),
|
|
1201
|
-
/* @__PURE__ */
|
|
1575
|
+
/* @__PURE__ */ jsxDEV5("p", {
|
|
1202
1576
|
className: "absolute-voice-provider-status__description",
|
|
1203
1577
|
children: model.description
|
|
1204
1578
|
}, undefined, false, undefined, this),
|
|
1205
|
-
model.providers.length ? /* @__PURE__ */
|
|
1579
|
+
model.providers.length ? /* @__PURE__ */ jsxDEV5("div", {
|
|
1206
1580
|
className: "absolute-voice-provider-status__providers",
|
|
1207
|
-
children: model.providers.map((provider) => /* @__PURE__ */
|
|
1581
|
+
children: model.providers.map((provider) => /* @__PURE__ */ jsxDEV5("article", {
|
|
1208
1582
|
className: [
|
|
1209
1583
|
"absolute-voice-provider-status__provider",
|
|
1210
1584
|
`absolute-voice-provider-status__provider--${provider.status}`
|
|
1211
1585
|
].join(" "),
|
|
1212
1586
|
children: [
|
|
1213
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ jsxDEV5("header", {
|
|
1214
1588
|
children: [
|
|
1215
|
-
/* @__PURE__ */
|
|
1589
|
+
/* @__PURE__ */ jsxDEV5("strong", {
|
|
1216
1590
|
children: provider.label
|
|
1217
1591
|
}, undefined, false, undefined, this),
|
|
1218
|
-
/* @__PURE__ */
|
|
1592
|
+
/* @__PURE__ */ jsxDEV5("span", {
|
|
1219
1593
|
children: provider.status
|
|
1220
1594
|
}, undefined, false, undefined, this)
|
|
1221
1595
|
]
|
|
1222
1596
|
}, undefined, true, undefined, this),
|
|
1223
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ jsxDEV5("p", {
|
|
1224
1598
|
children: provider.detail
|
|
1225
1599
|
}, undefined, false, undefined, this),
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
-
children: provider.rows.map((row) => /* @__PURE__ */
|
|
1600
|
+
/* @__PURE__ */ jsxDEV5("dl", {
|
|
1601
|
+
children: provider.rows.map((row) => /* @__PURE__ */ jsxDEV5("div", {
|
|
1228
1602
|
children: [
|
|
1229
|
-
/* @__PURE__ */
|
|
1603
|
+
/* @__PURE__ */ jsxDEV5("dt", {
|
|
1230
1604
|
children: row.label
|
|
1231
1605
|
}, undefined, false, undefined, this),
|
|
1232
|
-
/* @__PURE__ */
|
|
1606
|
+
/* @__PURE__ */ jsxDEV5("dd", {
|
|
1233
1607
|
children: row.value
|
|
1234
1608
|
}, undefined, false, undefined, this)
|
|
1235
1609
|
]
|
|
@@ -1237,11 +1611,11 @@ var VoiceProviderStatus = ({
|
|
|
1237
1611
|
}, undefined, false, undefined, this)
|
|
1238
1612
|
]
|
|
1239
1613
|
}, provider.provider, true, undefined, this))
|
|
1240
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
1614
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV5("p", {
|
|
1241
1615
|
className: "absolute-voice-provider-status__empty",
|
|
1242
1616
|
children: "Run voice traffic to see provider health."
|
|
1243
1617
|
}, undefined, false, undefined, this),
|
|
1244
|
-
model.error ? /* @__PURE__ */
|
|
1618
|
+
model.error ? /* @__PURE__ */ jsxDEV5("p", {
|
|
1245
1619
|
className: "absolute-voice-provider-status__error",
|
|
1246
1620
|
children: model.error
|
|
1247
1621
|
}, undefined, false, undefined, this) : null
|
|
@@ -1249,7 +1623,7 @@ var VoiceProviderStatus = ({
|
|
|
1249
1623
|
}, undefined, true, undefined, this);
|
|
1250
1624
|
};
|
|
1251
1625
|
// src/react/useVoiceRoutingStatus.tsx
|
|
1252
|
-
import { useEffect as
|
|
1626
|
+
import { useEffect as useEffect6, useRef as useRef6, useSyncExternalStore as useSyncExternalStore6 } from "react";
|
|
1253
1627
|
|
|
1254
1628
|
// src/client/routingStatus.ts
|
|
1255
1629
|
var fetchVoiceRoutingStatus = async (path = "/api/routing/latest", options = {}) => {
|
|
@@ -1333,25 +1707,25 @@ var createVoiceRoutingStatusStore = (path = "/api/routing/latest", options = {})
|
|
|
1333
1707
|
|
|
1334
1708
|
// src/react/useVoiceRoutingStatus.tsx
|
|
1335
1709
|
var useVoiceRoutingStatus = (path = "/api/routing/latest", options = {}) => {
|
|
1336
|
-
const storeRef =
|
|
1710
|
+
const storeRef = useRef6(null);
|
|
1337
1711
|
if (!storeRef.current) {
|
|
1338
1712
|
storeRef.current = createVoiceRoutingStatusStore(path, options);
|
|
1339
1713
|
}
|
|
1340
1714
|
const store = storeRef.current;
|
|
1341
|
-
|
|
1715
|
+
useEffect6(() => {
|
|
1342
1716
|
store.refresh().catch(() => {});
|
|
1343
1717
|
return () => store.close();
|
|
1344
1718
|
}, [store]);
|
|
1345
1719
|
return {
|
|
1346
|
-
...
|
|
1720
|
+
...useSyncExternalStore6(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
1347
1721
|
refresh: store.refresh
|
|
1348
1722
|
};
|
|
1349
1723
|
};
|
|
1350
1724
|
|
|
1351
1725
|
// src/client/routingStatusWidget.ts
|
|
1352
|
-
var
|
|
1353
|
-
var
|
|
1354
|
-
var
|
|
1726
|
+
var DEFAULT_TITLE5 = "Voice Routing";
|
|
1727
|
+
var DEFAULT_DESCRIPTION5 = "Latest provider routing decision from the self-hosted trace store.";
|
|
1728
|
+
var escapeHtml6 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1355
1729
|
var formatValue = (value, fallback = "None") => typeof value === "string" && value.trim() ? value : typeof value === "number" && Number.isFinite(value) ? String(value) : fallback;
|
|
1356
1730
|
var createVoiceRoutingStatusViewModel = (snapshot, options = {}) => {
|
|
1357
1731
|
const decision = snapshot.decision;
|
|
@@ -1375,30 +1749,30 @@ var createVoiceRoutingStatusViewModel = (snapshot, options = {}) => {
|
|
|
1375
1749
|
] : [];
|
|
1376
1750
|
return {
|
|
1377
1751
|
decision,
|
|
1378
|
-
description: options.description ??
|
|
1752
|
+
description: options.description ?? DEFAULT_DESCRIPTION5,
|
|
1379
1753
|
error: snapshot.error,
|
|
1380
1754
|
isLoading: snapshot.isLoading,
|
|
1381
1755
|
label: snapshot.error ? "Unavailable" : decision ? `${formatValue(decision.kind).toUpperCase()} ${formatValue(decision.status, "unknown")}` : snapshot.isLoading ? "Checking" : "No routing yet",
|
|
1382
1756
|
rows,
|
|
1383
1757
|
status: snapshot.error ? "error" : decision ? "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
1384
|
-
title: options.title ??
|
|
1758
|
+
title: options.title ?? DEFAULT_TITLE5,
|
|
1385
1759
|
updatedAt: snapshot.updatedAt
|
|
1386
1760
|
};
|
|
1387
1761
|
};
|
|
1388
1762
|
var renderVoiceRoutingStatusHTML = (snapshot, options = {}) => {
|
|
1389
1763
|
const model = createVoiceRoutingStatusViewModel(snapshot, options);
|
|
1390
1764
|
const rows = model.rows.length ? `<div class="absolute-voice-routing-status__grid">${model.rows.map((row) => `<div>
|
|
1391
|
-
<span>${
|
|
1392
|
-
<strong>${
|
|
1765
|
+
<span>${escapeHtml6(row.label)}</span>
|
|
1766
|
+
<strong>${escapeHtml6(row.value)}</strong>
|
|
1393
1767
|
</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--${
|
|
1768
|
+
return `<section class="absolute-voice-routing-status absolute-voice-routing-status--${escapeHtml6(model.status)}">
|
|
1395
1769
|
<header class="absolute-voice-routing-status__header">
|
|
1396
|
-
<span class="absolute-voice-routing-status__eyebrow">${
|
|
1397
|
-
<strong class="absolute-voice-routing-status__label">${
|
|
1770
|
+
<span class="absolute-voice-routing-status__eyebrow">${escapeHtml6(model.title)}</span>
|
|
1771
|
+
<strong class="absolute-voice-routing-status__label">${escapeHtml6(model.label)}</strong>
|
|
1398
1772
|
</header>
|
|
1399
|
-
<p class="absolute-voice-routing-status__description">${
|
|
1773
|
+
<p class="absolute-voice-routing-status__description">${escapeHtml6(model.description)}</p>
|
|
1400
1774
|
${rows}
|
|
1401
|
-
${model.error ? `<p class="absolute-voice-routing-status__error">${
|
|
1775
|
+
${model.error ? `<p class="absolute-voice-routing-status__error">${escapeHtml6(model.error)}</p>` : ""}
|
|
1402
1776
|
</section>`;
|
|
1403
1777
|
};
|
|
1404
1778
|
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 +1814,7 @@ var defineVoiceRoutingStatusElement = (tagName = "absolute-voice-routing-status"
|
|
|
1440
1814
|
};
|
|
1441
1815
|
|
|
1442
1816
|
// src/react/VoiceRoutingStatus.tsx
|
|
1443
|
-
import { jsxDEV as
|
|
1817
|
+
import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
|
|
1444
1818
|
var VoiceRoutingStatus = ({
|
|
1445
1819
|
className,
|
|
1446
1820
|
path = "/api/routing/latest",
|
|
@@ -1448,47 +1822,47 @@ var VoiceRoutingStatus = ({
|
|
|
1448
1822
|
}) => {
|
|
1449
1823
|
const snapshot = useVoiceRoutingStatus(path, options);
|
|
1450
1824
|
const model = createVoiceRoutingStatusViewModel(snapshot, options);
|
|
1451
|
-
return /* @__PURE__ */
|
|
1825
|
+
return /* @__PURE__ */ jsxDEV6("section", {
|
|
1452
1826
|
className: [
|
|
1453
1827
|
"absolute-voice-routing-status",
|
|
1454
1828
|
`absolute-voice-routing-status--${model.status}`,
|
|
1455
1829
|
className
|
|
1456
1830
|
].filter(Boolean).join(" "),
|
|
1457
1831
|
children: [
|
|
1458
|
-
/* @__PURE__ */
|
|
1832
|
+
/* @__PURE__ */ jsxDEV6("header", {
|
|
1459
1833
|
className: "absolute-voice-routing-status__header",
|
|
1460
1834
|
children: [
|
|
1461
|
-
/* @__PURE__ */
|
|
1835
|
+
/* @__PURE__ */ jsxDEV6("span", {
|
|
1462
1836
|
className: "absolute-voice-routing-status__eyebrow",
|
|
1463
1837
|
children: model.title
|
|
1464
1838
|
}, undefined, false, undefined, this),
|
|
1465
|
-
/* @__PURE__ */
|
|
1839
|
+
/* @__PURE__ */ jsxDEV6("strong", {
|
|
1466
1840
|
className: "absolute-voice-routing-status__label",
|
|
1467
1841
|
children: model.label
|
|
1468
1842
|
}, undefined, false, undefined, this)
|
|
1469
1843
|
]
|
|
1470
1844
|
}, undefined, true, undefined, this),
|
|
1471
|
-
/* @__PURE__ */
|
|
1845
|
+
/* @__PURE__ */ jsxDEV6("p", {
|
|
1472
1846
|
className: "absolute-voice-routing-status__description",
|
|
1473
1847
|
children: model.description
|
|
1474
1848
|
}, undefined, false, undefined, this),
|
|
1475
|
-
model.rows.length ? /* @__PURE__ */
|
|
1849
|
+
model.rows.length ? /* @__PURE__ */ jsxDEV6("div", {
|
|
1476
1850
|
className: "absolute-voice-routing-status__grid",
|
|
1477
|
-
children: model.rows.map((row) => /* @__PURE__ */
|
|
1851
|
+
children: model.rows.map((row) => /* @__PURE__ */ jsxDEV6("div", {
|
|
1478
1852
|
children: [
|
|
1479
|
-
/* @__PURE__ */
|
|
1853
|
+
/* @__PURE__ */ jsxDEV6("span", {
|
|
1480
1854
|
children: row.label
|
|
1481
1855
|
}, undefined, false, undefined, this),
|
|
1482
|
-
/* @__PURE__ */
|
|
1856
|
+
/* @__PURE__ */ jsxDEV6("strong", {
|
|
1483
1857
|
children: row.value
|
|
1484
1858
|
}, undefined, false, undefined, this)
|
|
1485
1859
|
]
|
|
1486
1860
|
}, row.label, true, undefined, this))
|
|
1487
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
1861
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV6("p", {
|
|
1488
1862
|
className: "absolute-voice-routing-status__empty",
|
|
1489
1863
|
children: "Start a voice session to see the selected provider."
|
|
1490
1864
|
}, undefined, false, undefined, this),
|
|
1491
|
-
model.error ? /* @__PURE__ */
|
|
1865
|
+
model.error ? /* @__PURE__ */ jsxDEV6("p", {
|
|
1492
1866
|
className: "absolute-voice-routing-status__error",
|
|
1493
1867
|
children: model.error
|
|
1494
1868
|
}, undefined, false, undefined, this) : null
|
|
@@ -1576,9 +1950,9 @@ var createVoiceTraceTimelineStore = (path = "/api/voice-traces", options = {}) =
|
|
|
1576
1950
|
};
|
|
1577
1951
|
|
|
1578
1952
|
// src/client/traceTimelineWidget.ts
|
|
1579
|
-
var
|
|
1580
|
-
var
|
|
1581
|
-
var
|
|
1953
|
+
var DEFAULT_TITLE6 = "Voice Traces";
|
|
1954
|
+
var DEFAULT_DESCRIPTION6 = "Latest call timelines with provider latency, fallbacks, handoffs, and errors from your self-hosted trace store.";
|
|
1955
|
+
var escapeHtml7 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1582
1956
|
var formatMs = (value) => typeof value === "number" ? `${value}ms` : "n/a";
|
|
1583
1957
|
var formatProviders = (session) => session.providers.length ? session.providers.map((provider) => provider.provider).join(", ") : "No providers";
|
|
1584
1958
|
var createVoiceTraceTimelineViewModel = (snapshot, options = {}) => {
|
|
@@ -1592,34 +1966,34 @@ var createVoiceTraceTimelineViewModel = (snapshot, options = {}) => {
|
|
|
1592
1966
|
const failed = sessions.filter((session) => session.status === "failed").length;
|
|
1593
1967
|
const warnings = sessions.filter((session) => session.status === "warning").length;
|
|
1594
1968
|
return {
|
|
1595
|
-
description: options.description ??
|
|
1969
|
+
description: options.description ?? DEFAULT_DESCRIPTION6,
|
|
1596
1970
|
error: snapshot.error,
|
|
1597
1971
|
isLoading: snapshot.isLoading,
|
|
1598
1972
|
label: snapshot.error ? "Unavailable" : failed > 0 ? `${failed} failed` : warnings > 0 ? `${warnings} warning` : sessions.length ? `${sessions.length} recent` : snapshot.isLoading ? "Checking" : "No traces yet",
|
|
1599
1973
|
sessions,
|
|
1600
1974
|
status: snapshot.error ? "error" : failed > 0 ? "failed" : warnings > 0 ? "warning" : sessions.length ? "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
1601
|
-
title: options.title ??
|
|
1975
|
+
title: options.title ?? DEFAULT_TITLE6,
|
|
1602
1976
|
updatedAt: snapshot.updatedAt
|
|
1603
1977
|
};
|
|
1604
1978
|
};
|
|
1605
1979
|
var renderVoiceTraceTimelineWidgetHTML = (snapshot, options = {}) => {
|
|
1606
1980
|
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--${
|
|
1981
|
+
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
1982
|
<header>
|
|
1609
|
-
<strong>${
|
|
1610
|
-
<span>${
|
|
1983
|
+
<strong>${escapeHtml7(session.sessionId)}</strong>
|
|
1984
|
+
<span>${escapeHtml7(session.status)}</span>
|
|
1611
1985
|
</header>
|
|
1612
|
-
<p>${
|
|
1613
|
-
<a href="${
|
|
1986
|
+
<p>${escapeHtml7(session.label)} \xB7 ${escapeHtml7(session.durationLabel)} \xB7 ${escapeHtml7(session.providerLabel)}</p>
|
|
1987
|
+
<a href="${escapeHtml7(session.detailHref)}">Open timeline</a>
|
|
1614
1988
|
</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--${
|
|
1989
|
+
return `<section class="absolute-voice-trace-timeline absolute-voice-trace-timeline--${escapeHtml7(model.status)}">
|
|
1616
1990
|
<header class="absolute-voice-trace-timeline__header">
|
|
1617
|
-
<span class="absolute-voice-trace-timeline__eyebrow">${
|
|
1618
|
-
<strong class="absolute-voice-trace-timeline__label">${
|
|
1991
|
+
<span class="absolute-voice-trace-timeline__eyebrow">${escapeHtml7(model.title)}</span>
|
|
1992
|
+
<strong class="absolute-voice-trace-timeline__label">${escapeHtml7(model.label)}</strong>
|
|
1619
1993
|
</header>
|
|
1620
|
-
<p class="absolute-voice-trace-timeline__description">${
|
|
1994
|
+
<p class="absolute-voice-trace-timeline__description">${escapeHtml7(model.description)}</p>
|
|
1621
1995
|
${sessions}
|
|
1622
|
-
${model.error ? `<p class="absolute-voice-trace-timeline__error">${
|
|
1996
|
+
${model.error ? `<p class="absolute-voice-trace-timeline__error">${escapeHtml7(model.error)}</p>` : ""}
|
|
1623
1997
|
</section>`;
|
|
1624
1998
|
};
|
|
1625
1999
|
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 +2038,25 @@ var defineVoiceTraceTimelineElement = (tagName = "absolute-voice-trace-timeline"
|
|
|
1664
2038
|
};
|
|
1665
2039
|
|
|
1666
2040
|
// src/react/useVoiceTraceTimeline.tsx
|
|
1667
|
-
import { useEffect as
|
|
2041
|
+
import { useEffect as useEffect7, useRef as useRef7, useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
1668
2042
|
var useVoiceTraceTimeline = (path = "/api/voice-traces", options = {}) => {
|
|
1669
|
-
const storeRef =
|
|
2043
|
+
const storeRef = useRef7(null);
|
|
1670
2044
|
if (!storeRef.current) {
|
|
1671
2045
|
storeRef.current = createVoiceTraceTimelineStore(path, options);
|
|
1672
2046
|
}
|
|
1673
2047
|
const store = storeRef.current;
|
|
1674
|
-
|
|
2048
|
+
useEffect7(() => {
|
|
1675
2049
|
store.refresh().catch(() => {});
|
|
1676
2050
|
return () => store.close();
|
|
1677
2051
|
}, [store]);
|
|
1678
2052
|
return {
|
|
1679
|
-
...
|
|
2053
|
+
...useSyncExternalStore7(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
1680
2054
|
refresh: store.refresh
|
|
1681
2055
|
};
|
|
1682
2056
|
};
|
|
1683
2057
|
|
|
1684
2058
|
// src/react/VoiceTraceTimeline.tsx
|
|
1685
|
-
import { jsxDEV as
|
|
2059
|
+
import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
|
|
1686
2060
|
var VoiceTraceTimeline = ({
|
|
1687
2061
|
className,
|
|
1688
2062
|
path = "/api/voice-traces",
|
|
@@ -1690,49 +2064,49 @@ var VoiceTraceTimeline = ({
|
|
|
1690
2064
|
}) => {
|
|
1691
2065
|
const snapshot = useVoiceTraceTimeline(path, options);
|
|
1692
2066
|
const model = createVoiceTraceTimelineViewModel(snapshot, options);
|
|
1693
|
-
return /* @__PURE__ */
|
|
2067
|
+
return /* @__PURE__ */ jsxDEV7("section", {
|
|
1694
2068
|
className: [
|
|
1695
2069
|
"absolute-voice-trace-timeline",
|
|
1696
2070
|
`absolute-voice-trace-timeline--${model.status}`,
|
|
1697
2071
|
className
|
|
1698
2072
|
].filter(Boolean).join(" "),
|
|
1699
2073
|
children: [
|
|
1700
|
-
/* @__PURE__ */
|
|
2074
|
+
/* @__PURE__ */ jsxDEV7("header", {
|
|
1701
2075
|
className: "absolute-voice-trace-timeline__header",
|
|
1702
2076
|
children: [
|
|
1703
|
-
/* @__PURE__ */
|
|
2077
|
+
/* @__PURE__ */ jsxDEV7("span", {
|
|
1704
2078
|
className: "absolute-voice-trace-timeline__eyebrow",
|
|
1705
2079
|
children: model.title
|
|
1706
2080
|
}, undefined, false, undefined, this),
|
|
1707
|
-
/* @__PURE__ */
|
|
2081
|
+
/* @__PURE__ */ jsxDEV7("strong", {
|
|
1708
2082
|
className: "absolute-voice-trace-timeline__label",
|
|
1709
2083
|
children: model.label
|
|
1710
2084
|
}, undefined, false, undefined, this)
|
|
1711
2085
|
]
|
|
1712
2086
|
}, undefined, true, undefined, this),
|
|
1713
|
-
/* @__PURE__ */
|
|
2087
|
+
/* @__PURE__ */ jsxDEV7("p", {
|
|
1714
2088
|
className: "absolute-voice-trace-timeline__description",
|
|
1715
2089
|
children: model.description
|
|
1716
2090
|
}, undefined, false, undefined, this),
|
|
1717
|
-
model.sessions.length ? /* @__PURE__ */
|
|
2091
|
+
model.sessions.length ? /* @__PURE__ */ jsxDEV7("div", {
|
|
1718
2092
|
className: "absolute-voice-trace-timeline__sessions",
|
|
1719
|
-
children: model.sessions.map((session) => /* @__PURE__ */
|
|
2093
|
+
children: model.sessions.map((session) => /* @__PURE__ */ jsxDEV7("article", {
|
|
1720
2094
|
className: [
|
|
1721
2095
|
"absolute-voice-trace-timeline__session",
|
|
1722
2096
|
`absolute-voice-trace-timeline__session--${session.status}`
|
|
1723
2097
|
].join(" "),
|
|
1724
2098
|
children: [
|
|
1725
|
-
/* @__PURE__ */
|
|
2099
|
+
/* @__PURE__ */ jsxDEV7("header", {
|
|
1726
2100
|
children: [
|
|
1727
|
-
/* @__PURE__ */
|
|
2101
|
+
/* @__PURE__ */ jsxDEV7("strong", {
|
|
1728
2102
|
children: session.sessionId
|
|
1729
2103
|
}, undefined, false, undefined, this),
|
|
1730
|
-
/* @__PURE__ */
|
|
2104
|
+
/* @__PURE__ */ jsxDEV7("span", {
|
|
1731
2105
|
children: session.status
|
|
1732
2106
|
}, undefined, false, undefined, this)
|
|
1733
2107
|
]
|
|
1734
2108
|
}, undefined, true, undefined, this),
|
|
1735
|
-
/* @__PURE__ */
|
|
2109
|
+
/* @__PURE__ */ jsxDEV7("p", {
|
|
1736
2110
|
children: [
|
|
1737
2111
|
session.label,
|
|
1738
2112
|
" \xB7 ",
|
|
@@ -1742,17 +2116,17 @@ var VoiceTraceTimeline = ({
|
|
|
1742
2116
|
session.providerLabel
|
|
1743
2117
|
]
|
|
1744
2118
|
}, undefined, true, undefined, this),
|
|
1745
|
-
/* @__PURE__ */
|
|
2119
|
+
/* @__PURE__ */ jsxDEV7("a", {
|
|
1746
2120
|
href: session.detailHref,
|
|
1747
2121
|
children: "Open timeline"
|
|
1748
2122
|
}, undefined, false, undefined, this)
|
|
1749
2123
|
]
|
|
1750
2124
|
}, session.sessionId, true, undefined, this))
|
|
1751
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
2125
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV7("p", {
|
|
1752
2126
|
className: "absolute-voice-trace-timeline__empty",
|
|
1753
2127
|
children: "Run a voice session to see call timelines."
|
|
1754
2128
|
}, undefined, false, undefined, this),
|
|
1755
|
-
model.error ? /* @__PURE__ */
|
|
2129
|
+
model.error ? /* @__PURE__ */ jsxDEV7("p", {
|
|
1756
2130
|
className: "absolute-voice-trace-timeline__error",
|
|
1757
2131
|
children: model.error
|
|
1758
2132
|
}, undefined, false, undefined, this) : null
|
|
@@ -1760,7 +2134,7 @@ var VoiceTraceTimeline = ({
|
|
|
1760
2134
|
}, undefined, true, undefined, this);
|
|
1761
2135
|
};
|
|
1762
2136
|
// src/react/useVoiceTurnLatency.tsx
|
|
1763
|
-
import { useEffect as
|
|
2137
|
+
import { useEffect as useEffect8, useRef as useRef8, useSyncExternalStore as useSyncExternalStore8 } from "react";
|
|
1764
2138
|
|
|
1765
2139
|
// src/client/turnLatency.ts
|
|
1766
2140
|
var fetchVoiceTurnLatency = async (path = "/api/turn-latency", options = {}) => {
|
|
@@ -1867,27 +2241,27 @@ var createVoiceTurnLatencyStore = (path = "/api/turn-latency", options = {}) =>
|
|
|
1867
2241
|
|
|
1868
2242
|
// src/react/useVoiceTurnLatency.tsx
|
|
1869
2243
|
var useVoiceTurnLatency = (path = "/api/turn-latency", options = {}) => {
|
|
1870
|
-
const storeRef =
|
|
2244
|
+
const storeRef = useRef8(null);
|
|
1871
2245
|
if (!storeRef.current) {
|
|
1872
2246
|
storeRef.current = createVoiceTurnLatencyStore(path, options);
|
|
1873
2247
|
}
|
|
1874
2248
|
const store = storeRef.current;
|
|
1875
|
-
|
|
2249
|
+
useEffect8(() => {
|
|
1876
2250
|
store.refresh().catch(() => {});
|
|
1877
2251
|
return () => store.close();
|
|
1878
2252
|
}, [store]);
|
|
1879
2253
|
return {
|
|
1880
|
-
...
|
|
2254
|
+
...useSyncExternalStore8(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
1881
2255
|
refresh: store.refresh,
|
|
1882
2256
|
runProof: store.runProof
|
|
1883
2257
|
};
|
|
1884
2258
|
};
|
|
1885
2259
|
|
|
1886
2260
|
// src/client/turnLatencyWidget.ts
|
|
1887
|
-
var
|
|
1888
|
-
var
|
|
2261
|
+
var DEFAULT_TITLE7 = "Turn Latency";
|
|
2262
|
+
var DEFAULT_DESCRIPTION7 = "Per-turn timing from first transcript to commit and assistant response start.";
|
|
1889
2263
|
var DEFAULT_PROOF_LABEL = "Run latency proof";
|
|
1890
|
-
var
|
|
2264
|
+
var escapeHtml8 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1891
2265
|
var formatMs2 = (value) => typeof value === "number" ? `${Math.round(value)}ms` : "n/a";
|
|
1892
2266
|
var createVoiceTurnLatencyViewModel = (snapshot, options = {}) => {
|
|
1893
2267
|
const turns = (snapshot.report?.turns ?? []).map((turn) => ({
|
|
@@ -1901,39 +2275,39 @@ var createVoiceTurnLatencyViewModel = (snapshot, options = {}) => {
|
|
|
1901
2275
|
const warningCount = snapshot.report?.warnings ?? turns.filter((turn) => turn.status === "warn").length;
|
|
1902
2276
|
const failedCount = snapshot.report?.failed ?? turns.filter((turn) => turn.status === "fail").length;
|
|
1903
2277
|
return {
|
|
1904
|
-
description: options.description ??
|
|
2278
|
+
description: options.description ?? DEFAULT_DESCRIPTION7,
|
|
1905
2279
|
error: snapshot.error,
|
|
1906
2280
|
isLoading: snapshot.isLoading,
|
|
1907
2281
|
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
2282
|
proofLabel: options.proofPath ? options.proofLabel ?? DEFAULT_PROOF_LABEL : undefined,
|
|
1909
2283
|
showProofAction: Boolean(options.proofPath),
|
|
1910
2284
|
status: snapshot.error ? "error" : turns.length ? failedCount > 0 || warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
1911
|
-
title: options.title ??
|
|
2285
|
+
title: options.title ?? DEFAULT_TITLE7,
|
|
1912
2286
|
turns,
|
|
1913
2287
|
updatedAt: snapshot.updatedAt
|
|
1914
2288
|
};
|
|
1915
2289
|
};
|
|
1916
2290
|
var renderVoiceTurnLatencyHTML = (snapshot, options = {}) => {
|
|
1917
2291
|
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--${
|
|
2292
|
+
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
2293
|
<header>
|
|
1920
|
-
<strong>${
|
|
1921
|
-
<span>${
|
|
2294
|
+
<strong>${escapeHtml8(turn.label)}</strong>
|
|
2295
|
+
<span>${escapeHtml8(turn.status)}</span>
|
|
1922
2296
|
</header>
|
|
1923
2297
|
<dl>${turn.rows.map((row) => `<div>
|
|
1924
|
-
<dt>${
|
|
1925
|
-
<dd>${
|
|
2298
|
+
<dt>${escapeHtml8(row.label)}</dt>
|
|
2299
|
+
<dd>${escapeHtml8(row.value)}</dd>
|
|
1926
2300
|
</div>`).join("")}</dl>
|
|
1927
2301
|
</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--${
|
|
2302
|
+
return `<section class="absolute-voice-turn-latency absolute-voice-turn-latency--${escapeHtml8(model.status)}">
|
|
1929
2303
|
<header class="absolute-voice-turn-latency__header">
|
|
1930
|
-
<span class="absolute-voice-turn-latency__eyebrow">${
|
|
1931
|
-
<strong class="absolute-voice-turn-latency__label">${
|
|
2304
|
+
<span class="absolute-voice-turn-latency__eyebrow">${escapeHtml8(model.title)}</span>
|
|
2305
|
+
<strong class="absolute-voice-turn-latency__label">${escapeHtml8(model.label)}</strong>
|
|
1932
2306
|
</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">${
|
|
2307
|
+
<p class="absolute-voice-turn-latency__description">${escapeHtml8(model.description)}</p>
|
|
2308
|
+
${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
2309
|
${turns}
|
|
1936
|
-
${model.error ? `<p class="absolute-voice-turn-latency__error">${
|
|
2310
|
+
${model.error ? `<p class="absolute-voice-turn-latency__error">${escapeHtml8(model.error)}</p>` : ""}
|
|
1937
2311
|
</section>`;
|
|
1938
2312
|
};
|
|
1939
2313
|
var mountVoiceTurnLatency = (element, path = "/api/turn-latency", options = {}) => {
|
|
@@ -1984,7 +2358,7 @@ var defineVoiceTurnLatencyElement = (tagName = "absolute-voice-turn-latency") =>
|
|
|
1984
2358
|
};
|
|
1985
2359
|
|
|
1986
2360
|
// src/react/VoiceTurnLatency.tsx
|
|
1987
|
-
import { jsxDEV as
|
|
2361
|
+
import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
|
|
1988
2362
|
var VoiceTurnLatency = ({
|
|
1989
2363
|
className,
|
|
1990
2364
|
path = "/api/turn-latency",
|
|
@@ -1992,31 +2366,31 @@ var VoiceTurnLatency = ({
|
|
|
1992
2366
|
}) => {
|
|
1993
2367
|
const latency = useVoiceTurnLatency(path, options);
|
|
1994
2368
|
const model = createVoiceTurnLatencyViewModel(latency, options);
|
|
1995
|
-
return /* @__PURE__ */
|
|
2369
|
+
return /* @__PURE__ */ jsxDEV8("section", {
|
|
1996
2370
|
className: [
|
|
1997
2371
|
"absolute-voice-turn-latency",
|
|
1998
2372
|
`absolute-voice-turn-latency--${model.status}`,
|
|
1999
2373
|
className
|
|
2000
2374
|
].filter(Boolean).join(" "),
|
|
2001
2375
|
children: [
|
|
2002
|
-
/* @__PURE__ */
|
|
2376
|
+
/* @__PURE__ */ jsxDEV8("header", {
|
|
2003
2377
|
className: "absolute-voice-turn-latency__header",
|
|
2004
2378
|
children: [
|
|
2005
|
-
/* @__PURE__ */
|
|
2379
|
+
/* @__PURE__ */ jsxDEV8("span", {
|
|
2006
2380
|
className: "absolute-voice-turn-latency__eyebrow",
|
|
2007
2381
|
children: model.title
|
|
2008
2382
|
}, undefined, false, undefined, this),
|
|
2009
|
-
/* @__PURE__ */
|
|
2383
|
+
/* @__PURE__ */ jsxDEV8("strong", {
|
|
2010
2384
|
className: "absolute-voice-turn-latency__label",
|
|
2011
2385
|
children: model.label
|
|
2012
2386
|
}, undefined, false, undefined, this)
|
|
2013
2387
|
]
|
|
2014
2388
|
}, undefined, true, undefined, this),
|
|
2015
|
-
/* @__PURE__ */
|
|
2389
|
+
/* @__PURE__ */ jsxDEV8("p", {
|
|
2016
2390
|
className: "absolute-voice-turn-latency__description",
|
|
2017
2391
|
children: model.description
|
|
2018
2392
|
}, undefined, false, undefined, this),
|
|
2019
|
-
model.showProofAction ? /* @__PURE__ */
|
|
2393
|
+
model.showProofAction ? /* @__PURE__ */ jsxDEV8("button", {
|
|
2020
2394
|
className: "absolute-voice-turn-latency__proof",
|
|
2021
2395
|
onClick: () => {
|
|
2022
2396
|
latency.runProof().catch(() => {});
|
|
@@ -2024,31 +2398,31 @@ var VoiceTurnLatency = ({
|
|
|
2024
2398
|
type: "button",
|
|
2025
2399
|
children: model.proofLabel
|
|
2026
2400
|
}, undefined, false, undefined, this) : null,
|
|
2027
|
-
model.turns.length ? /* @__PURE__ */
|
|
2401
|
+
model.turns.length ? /* @__PURE__ */ jsxDEV8("div", {
|
|
2028
2402
|
className: "absolute-voice-turn-latency__turns",
|
|
2029
|
-
children: model.turns.map((turn) => /* @__PURE__ */
|
|
2403
|
+
children: model.turns.map((turn) => /* @__PURE__ */ jsxDEV8("article", {
|
|
2030
2404
|
className: [
|
|
2031
2405
|
"absolute-voice-turn-latency__turn",
|
|
2032
2406
|
`absolute-voice-turn-latency__turn--${turn.status}`
|
|
2033
2407
|
].join(" "),
|
|
2034
2408
|
children: [
|
|
2035
|
-
/* @__PURE__ */
|
|
2409
|
+
/* @__PURE__ */ jsxDEV8("header", {
|
|
2036
2410
|
children: [
|
|
2037
|
-
/* @__PURE__ */
|
|
2411
|
+
/* @__PURE__ */ jsxDEV8("strong", {
|
|
2038
2412
|
children: turn.label
|
|
2039
2413
|
}, undefined, false, undefined, this),
|
|
2040
|
-
/* @__PURE__ */
|
|
2414
|
+
/* @__PURE__ */ jsxDEV8("span", {
|
|
2041
2415
|
children: turn.status
|
|
2042
2416
|
}, undefined, false, undefined, this)
|
|
2043
2417
|
]
|
|
2044
2418
|
}, undefined, true, undefined, this),
|
|
2045
|
-
/* @__PURE__ */
|
|
2046
|
-
children: turn.rows.map((row) => /* @__PURE__ */
|
|
2419
|
+
/* @__PURE__ */ jsxDEV8("dl", {
|
|
2420
|
+
children: turn.rows.map((row) => /* @__PURE__ */ jsxDEV8("div", {
|
|
2047
2421
|
children: [
|
|
2048
|
-
/* @__PURE__ */
|
|
2422
|
+
/* @__PURE__ */ jsxDEV8("dt", {
|
|
2049
2423
|
children: row.label
|
|
2050
2424
|
}, undefined, false, undefined, this),
|
|
2051
|
-
/* @__PURE__ */
|
|
2425
|
+
/* @__PURE__ */ jsxDEV8("dd", {
|
|
2052
2426
|
children: row.value
|
|
2053
2427
|
}, undefined, false, undefined, this)
|
|
2054
2428
|
]
|
|
@@ -2056,11 +2430,11 @@ var VoiceTurnLatency = ({
|
|
|
2056
2430
|
}, undefined, false, undefined, this)
|
|
2057
2431
|
]
|
|
2058
2432
|
}, `${turn.sessionId}:${turn.turnId}`, true, undefined, this))
|
|
2059
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
2433
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV8("p", {
|
|
2060
2434
|
className: "absolute-voice-turn-latency__empty",
|
|
2061
2435
|
children: "Complete a voice turn to see latency diagnostics."
|
|
2062
2436
|
}, undefined, false, undefined, this),
|
|
2063
|
-
model.error ? /* @__PURE__ */
|
|
2437
|
+
model.error ? /* @__PURE__ */ jsxDEV8("p", {
|
|
2064
2438
|
className: "absolute-voice-turn-latency__error",
|
|
2065
2439
|
children: model.error
|
|
2066
2440
|
}, undefined, false, undefined, this) : null
|
|
@@ -2068,7 +2442,7 @@ var VoiceTurnLatency = ({
|
|
|
2068
2442
|
}, undefined, true, undefined, this);
|
|
2069
2443
|
};
|
|
2070
2444
|
// src/react/useVoiceTurnQuality.tsx
|
|
2071
|
-
import { useEffect as
|
|
2445
|
+
import { useEffect as useEffect9, useRef as useRef9, useSyncExternalStore as useSyncExternalStore9 } from "react";
|
|
2072
2446
|
|
|
2073
2447
|
// src/client/turnQuality.ts
|
|
2074
2448
|
var fetchVoiceTurnQuality = async (path = "/api/turn-quality", options = {}) => {
|
|
@@ -2151,25 +2525,25 @@ var createVoiceTurnQualityStore = (path = "/api/turn-quality", options = {}) =>
|
|
|
2151
2525
|
|
|
2152
2526
|
// src/react/useVoiceTurnQuality.tsx
|
|
2153
2527
|
var useVoiceTurnQuality = (path = "/api/turn-quality", options = {}) => {
|
|
2154
|
-
const storeRef =
|
|
2528
|
+
const storeRef = useRef9(null);
|
|
2155
2529
|
if (!storeRef.current) {
|
|
2156
2530
|
storeRef.current = createVoiceTurnQualityStore(path, options);
|
|
2157
2531
|
}
|
|
2158
2532
|
const store = storeRef.current;
|
|
2159
|
-
|
|
2533
|
+
useEffect9(() => {
|
|
2160
2534
|
store.refresh().catch(() => {});
|
|
2161
2535
|
return () => store.close();
|
|
2162
2536
|
}, [store]);
|
|
2163
2537
|
return {
|
|
2164
|
-
...
|
|
2538
|
+
...useSyncExternalStore9(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
2165
2539
|
refresh: store.refresh
|
|
2166
2540
|
};
|
|
2167
2541
|
};
|
|
2168
2542
|
|
|
2169
2543
|
// src/client/turnQualityWidget.ts
|
|
2170
|
-
var
|
|
2171
|
-
var
|
|
2172
|
-
var
|
|
2544
|
+
var DEFAULT_TITLE8 = "Turn Quality";
|
|
2545
|
+
var DEFAULT_DESCRIPTION8 = "Per-turn STT confidence, fallback selection, corrections, and transcript coverage.";
|
|
2546
|
+
var escapeHtml9 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
2173
2547
|
var formatConfidence = (value) => typeof value === "number" ? `${Math.round(value * 100)}%` : "n/a";
|
|
2174
2548
|
var formatMaybe = (value) => value === undefined || value === "" ? "n/a" : String(value);
|
|
2175
2549
|
var getTurnDetail = (turn) => {
|
|
@@ -2207,37 +2581,37 @@ var createVoiceTurnQualityViewModel = (snapshot, options = {}) => {
|
|
|
2207
2581
|
const warningCount = snapshot.report?.warnings ?? turns.filter((turn) => turn.status === "warn").length;
|
|
2208
2582
|
const failedCount = snapshot.report?.failed ?? turns.filter((turn) => turn.status === "fail").length;
|
|
2209
2583
|
return {
|
|
2210
|
-
description: options.description ??
|
|
2584
|
+
description: options.description ?? DEFAULT_DESCRIPTION8,
|
|
2211
2585
|
error: snapshot.error,
|
|
2212
2586
|
isLoading: snapshot.isLoading,
|
|
2213
2587
|
label: snapshot.error ? "Unavailable" : turns.length ? failedCount > 0 ? `${failedCount} failed` : warningCount > 0 ? `${warningCount} warnings` : `${turns.length} healthy` : snapshot.isLoading ? "Checking" : "No turns",
|
|
2214
2588
|
status: snapshot.error ? "error" : turns.length ? failedCount > 0 || warningCount > 0 ? "warning" : "ready" : snapshot.isLoading ? "loading" : "empty",
|
|
2215
|
-
title: options.title ??
|
|
2589
|
+
title: options.title ?? DEFAULT_TITLE8,
|
|
2216
2590
|
turns,
|
|
2217
2591
|
updatedAt: snapshot.updatedAt
|
|
2218
2592
|
};
|
|
2219
2593
|
};
|
|
2220
2594
|
var renderVoiceTurnQualityHTML = (snapshot, options = {}) => {
|
|
2221
2595
|
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--${
|
|
2596
|
+
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
2597
|
<header>
|
|
2224
|
-
<strong>${
|
|
2225
|
-
<span>${
|
|
2598
|
+
<strong>${escapeHtml9(turn.label)}</strong>
|
|
2599
|
+
<span>${escapeHtml9(turn.status)}</span>
|
|
2226
2600
|
</header>
|
|
2227
|
-
<p>${
|
|
2601
|
+
<p>${escapeHtml9(turn.detail)}</p>
|
|
2228
2602
|
<dl>${turn.rows.map((row) => `<div>
|
|
2229
|
-
<dt>${
|
|
2230
|
-
<dd>${
|
|
2603
|
+
<dt>${escapeHtml9(row.label)}</dt>
|
|
2604
|
+
<dd>${escapeHtml9(row.value)}</dd>
|
|
2231
2605
|
</div>`).join("")}</dl>
|
|
2232
2606
|
</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--${
|
|
2607
|
+
return `<section class="absolute-voice-turn-quality absolute-voice-turn-quality--${escapeHtml9(model.status)}">
|
|
2234
2608
|
<header class="absolute-voice-turn-quality__header">
|
|
2235
|
-
<span class="absolute-voice-turn-quality__eyebrow">${
|
|
2236
|
-
<strong class="absolute-voice-turn-quality__label">${
|
|
2609
|
+
<span class="absolute-voice-turn-quality__eyebrow">${escapeHtml9(model.title)}</span>
|
|
2610
|
+
<strong class="absolute-voice-turn-quality__label">${escapeHtml9(model.label)}</strong>
|
|
2237
2611
|
</header>
|
|
2238
|
-
<p class="absolute-voice-turn-quality__description">${
|
|
2612
|
+
<p class="absolute-voice-turn-quality__description">${escapeHtml9(model.description)}</p>
|
|
2239
2613
|
${turns}
|
|
2240
|
-
${model.error ? `<p class="absolute-voice-turn-quality__error">${
|
|
2614
|
+
${model.error ? `<p class="absolute-voice-turn-quality__error">${escapeHtml9(model.error)}</p>` : ""}
|
|
2241
2615
|
</section>`;
|
|
2242
2616
|
};
|
|
2243
2617
|
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 +2653,7 @@ var defineVoiceTurnQualityElement = (tagName = "absolute-voice-turn-quality") =>
|
|
|
2279
2653
|
};
|
|
2280
2654
|
|
|
2281
2655
|
// src/react/VoiceTurnQuality.tsx
|
|
2282
|
-
import { jsxDEV as
|
|
2656
|
+
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
2283
2657
|
var VoiceTurnQuality = ({
|
|
2284
2658
|
className,
|
|
2285
2659
|
path = "/api/turn-quality",
|
|
@@ -2287,58 +2661,58 @@ var VoiceTurnQuality = ({
|
|
|
2287
2661
|
}) => {
|
|
2288
2662
|
const snapshot = useVoiceTurnQuality(path, options);
|
|
2289
2663
|
const model = createVoiceTurnQualityViewModel(snapshot, options);
|
|
2290
|
-
return /* @__PURE__ */
|
|
2664
|
+
return /* @__PURE__ */ jsxDEV9("section", {
|
|
2291
2665
|
className: [
|
|
2292
2666
|
"absolute-voice-turn-quality",
|
|
2293
2667
|
`absolute-voice-turn-quality--${model.status}`,
|
|
2294
2668
|
className
|
|
2295
2669
|
].filter(Boolean).join(" "),
|
|
2296
2670
|
children: [
|
|
2297
|
-
/* @__PURE__ */
|
|
2671
|
+
/* @__PURE__ */ jsxDEV9("header", {
|
|
2298
2672
|
className: "absolute-voice-turn-quality__header",
|
|
2299
2673
|
children: [
|
|
2300
|
-
/* @__PURE__ */
|
|
2674
|
+
/* @__PURE__ */ jsxDEV9("span", {
|
|
2301
2675
|
className: "absolute-voice-turn-quality__eyebrow",
|
|
2302
2676
|
children: model.title
|
|
2303
2677
|
}, undefined, false, undefined, this),
|
|
2304
|
-
/* @__PURE__ */
|
|
2678
|
+
/* @__PURE__ */ jsxDEV9("strong", {
|
|
2305
2679
|
className: "absolute-voice-turn-quality__label",
|
|
2306
2680
|
children: model.label
|
|
2307
2681
|
}, undefined, false, undefined, this)
|
|
2308
2682
|
]
|
|
2309
2683
|
}, undefined, true, undefined, this),
|
|
2310
|
-
/* @__PURE__ */
|
|
2684
|
+
/* @__PURE__ */ jsxDEV9("p", {
|
|
2311
2685
|
className: "absolute-voice-turn-quality__description",
|
|
2312
2686
|
children: model.description
|
|
2313
2687
|
}, undefined, false, undefined, this),
|
|
2314
|
-
model.turns.length ? /* @__PURE__ */
|
|
2688
|
+
model.turns.length ? /* @__PURE__ */ jsxDEV9("div", {
|
|
2315
2689
|
className: "absolute-voice-turn-quality__turns",
|
|
2316
|
-
children: model.turns.map((turn) => /* @__PURE__ */
|
|
2690
|
+
children: model.turns.map((turn) => /* @__PURE__ */ jsxDEV9("article", {
|
|
2317
2691
|
className: [
|
|
2318
2692
|
"absolute-voice-turn-quality__turn",
|
|
2319
2693
|
`absolute-voice-turn-quality__turn--${turn.status}`
|
|
2320
2694
|
].join(" "),
|
|
2321
2695
|
children: [
|
|
2322
|
-
/* @__PURE__ */
|
|
2696
|
+
/* @__PURE__ */ jsxDEV9("header", {
|
|
2323
2697
|
children: [
|
|
2324
|
-
/* @__PURE__ */
|
|
2698
|
+
/* @__PURE__ */ jsxDEV9("strong", {
|
|
2325
2699
|
children: turn.label
|
|
2326
2700
|
}, undefined, false, undefined, this),
|
|
2327
|
-
/* @__PURE__ */
|
|
2701
|
+
/* @__PURE__ */ jsxDEV9("span", {
|
|
2328
2702
|
children: turn.status
|
|
2329
2703
|
}, undefined, false, undefined, this)
|
|
2330
2704
|
]
|
|
2331
2705
|
}, undefined, true, undefined, this),
|
|
2332
|
-
/* @__PURE__ */
|
|
2706
|
+
/* @__PURE__ */ jsxDEV9("p", {
|
|
2333
2707
|
children: turn.detail
|
|
2334
2708
|
}, undefined, false, undefined, this),
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
children: turn.rows.map((row) => /* @__PURE__ */
|
|
2709
|
+
/* @__PURE__ */ jsxDEV9("dl", {
|
|
2710
|
+
children: turn.rows.map((row) => /* @__PURE__ */ jsxDEV9("div", {
|
|
2337
2711
|
children: [
|
|
2338
|
-
/* @__PURE__ */
|
|
2712
|
+
/* @__PURE__ */ jsxDEV9("dt", {
|
|
2339
2713
|
children: row.label
|
|
2340
2714
|
}, undefined, false, undefined, this),
|
|
2341
|
-
/* @__PURE__ */
|
|
2715
|
+
/* @__PURE__ */ jsxDEV9("dd", {
|
|
2342
2716
|
children: row.value
|
|
2343
2717
|
}, undefined, false, undefined, this)
|
|
2344
2718
|
]
|
|
@@ -2346,11 +2720,11 @@ var VoiceTurnQuality = ({
|
|
|
2346
2720
|
}, undefined, false, undefined, this)
|
|
2347
2721
|
]
|
|
2348
2722
|
}, `${turn.sessionId}:${turn.turnId}`, true, undefined, this))
|
|
2349
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
2723
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV9("p", {
|
|
2350
2724
|
className: "absolute-voice-turn-quality__empty",
|
|
2351
2725
|
children: "Complete a voice turn to see STT quality diagnostics."
|
|
2352
2726
|
}, undefined, false, undefined, this),
|
|
2353
|
-
model.error ? /* @__PURE__ */
|
|
2727
|
+
model.error ? /* @__PURE__ */ jsxDEV9("p", {
|
|
2354
2728
|
className: "absolute-voice-turn-quality__error",
|
|
2355
2729
|
children: model.error
|
|
2356
2730
|
}, undefined, false, undefined, this) : null
|
|
@@ -2358,7 +2732,7 @@ var VoiceTurnQuality = ({
|
|
|
2358
2732
|
}, undefined, true, undefined, this);
|
|
2359
2733
|
};
|
|
2360
2734
|
// src/react/useVoiceCampaignDialerProof.tsx
|
|
2361
|
-
import { useEffect as
|
|
2735
|
+
import { useEffect as useEffect10, useRef as useRef10, useSyncExternalStore as useSyncExternalStore10 } from "react";
|
|
2362
2736
|
|
|
2363
2737
|
// src/client/campaignDialerProof.ts
|
|
2364
2738
|
var fetchVoiceCampaignDialerProofStatus = async (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
@@ -2480,23 +2854,23 @@ var createVoiceCampaignDialerProofStore = (path = "/api/voice/campaigns/dialer-p
|
|
|
2480
2854
|
|
|
2481
2855
|
// src/react/useVoiceCampaignDialerProof.tsx
|
|
2482
2856
|
var useVoiceCampaignDialerProof = (path = "/api/voice/campaigns/dialer-proof", options = {}) => {
|
|
2483
|
-
const storeRef =
|
|
2857
|
+
const storeRef = useRef10(null);
|
|
2484
2858
|
if (!storeRef.current) {
|
|
2485
2859
|
storeRef.current = createVoiceCampaignDialerProofStore(path, options);
|
|
2486
2860
|
}
|
|
2487
2861
|
const store = storeRef.current;
|
|
2488
|
-
|
|
2862
|
+
useEffect10(() => {
|
|
2489
2863
|
store.refresh().catch(() => {});
|
|
2490
2864
|
return () => store.close();
|
|
2491
2865
|
}, [store]);
|
|
2492
2866
|
return {
|
|
2493
|
-
...
|
|
2867
|
+
...useSyncExternalStore10(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
2494
2868
|
refresh: store.refresh,
|
|
2495
2869
|
runProof: store.runProof
|
|
2496
2870
|
};
|
|
2497
2871
|
};
|
|
2498
2872
|
// src/react/useVoiceStream.tsx
|
|
2499
|
-
import { useEffect as
|
|
2873
|
+
import { useEffect as useEffect11, useRef as useRef11, useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
2500
2874
|
|
|
2501
2875
|
// src/client/actions.ts
|
|
2502
2876
|
var normalizeErrorMessage = (value) => {
|
|
@@ -3156,13 +3530,13 @@ var EMPTY_SNAPSHOT = {
|
|
|
3156
3530
|
turns: []
|
|
3157
3531
|
};
|
|
3158
3532
|
var useVoiceStream = (path, options = {}) => {
|
|
3159
|
-
const streamRef =
|
|
3533
|
+
const streamRef = useRef11(null);
|
|
3160
3534
|
if (!streamRef.current) {
|
|
3161
3535
|
streamRef.current = createVoiceStream(path, options);
|
|
3162
3536
|
}
|
|
3163
3537
|
const stream = streamRef.current;
|
|
3164
|
-
|
|
3165
|
-
const snapshot =
|
|
3538
|
+
useEffect11(() => () => stream.close(), [stream]);
|
|
3539
|
+
const snapshot = useSyncExternalStore11(stream.subscribe, stream.getSnapshot, stream.getServerSnapshot) ?? EMPTY_SNAPSHOT;
|
|
3166
3540
|
return {
|
|
3167
3541
|
...snapshot,
|
|
3168
3542
|
callControl: (message) => stream.callControl(message),
|
|
@@ -3172,7 +3546,7 @@ var useVoiceStream = (path, options = {}) => {
|
|
|
3172
3546
|
};
|
|
3173
3547
|
};
|
|
3174
3548
|
// src/react/useVoiceController.tsx
|
|
3175
|
-
import { useEffect as
|
|
3549
|
+
import { useEffect as useEffect12, useRef as useRef12, useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
3176
3550
|
|
|
3177
3551
|
// src/client/htmx.ts
|
|
3178
3552
|
var DEFAULT_EVENT_NAME = "voice-refresh";
|
|
@@ -3835,13 +4209,13 @@ var EMPTY_SNAPSHOT2 = {
|
|
|
3835
4209
|
turns: []
|
|
3836
4210
|
};
|
|
3837
4211
|
var useVoiceController = (path, options = {}) => {
|
|
3838
|
-
const controllerRef =
|
|
4212
|
+
const controllerRef = useRef12(null);
|
|
3839
4213
|
if (!controllerRef.current) {
|
|
3840
4214
|
controllerRef.current = createVoiceController(path, options);
|
|
3841
4215
|
}
|
|
3842
4216
|
const controller = controllerRef.current;
|
|
3843
|
-
|
|
3844
|
-
const snapshot =
|
|
4217
|
+
useEffect12(() => () => controller.close(), [controller]);
|
|
4218
|
+
const snapshot = useSyncExternalStore12(controller.subscribe, controller.getSnapshot, controller.getServerSnapshot) ?? EMPTY_SNAPSHOT2;
|
|
3845
4219
|
return {
|
|
3846
4220
|
...snapshot,
|
|
3847
4221
|
bindHTMX: controller.bindHTMX,
|
|
@@ -3855,7 +4229,7 @@ var useVoiceController = (path, options = {}) => {
|
|
|
3855
4229
|
};
|
|
3856
4230
|
};
|
|
3857
4231
|
// src/react/useVoiceWorkflowStatus.tsx
|
|
3858
|
-
import { useEffect as
|
|
4232
|
+
import { useEffect as useEffect13, useRef as useRef13, useSyncExternalStore as useSyncExternalStore13 } from "react";
|
|
3859
4233
|
|
|
3860
4234
|
// src/client/workflowStatus.ts
|
|
3861
4235
|
var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options = {}) => {
|
|
@@ -3938,17 +4312,17 @@ var createVoiceWorkflowStatusStore = (path = "/evals/scenarios/json", options =
|
|
|
3938
4312
|
|
|
3939
4313
|
// src/react/useVoiceWorkflowStatus.tsx
|
|
3940
4314
|
var useVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => {
|
|
3941
|
-
const storeRef =
|
|
4315
|
+
const storeRef = useRef13(null);
|
|
3942
4316
|
if (!storeRef.current) {
|
|
3943
4317
|
storeRef.current = createVoiceWorkflowStatusStore(path, options);
|
|
3944
4318
|
}
|
|
3945
4319
|
const store = storeRef.current;
|
|
3946
|
-
|
|
4320
|
+
useEffect13(() => {
|
|
3947
4321
|
store.refresh().catch(() => {});
|
|
3948
4322
|
return () => store.close();
|
|
3949
4323
|
}, [store]);
|
|
3950
4324
|
return {
|
|
3951
|
-
...
|
|
4325
|
+
...useSyncExternalStore13(store.subscribe, store.getSnapshot, store.getServerSnapshot),
|
|
3952
4326
|
refresh: store.refresh
|
|
3953
4327
|
};
|
|
3954
4328
|
};
|
|
@@ -3963,6 +4337,7 @@ export {
|
|
|
3963
4337
|
useVoiceProviderSimulationControls,
|
|
3964
4338
|
useVoiceProviderCapabilities,
|
|
3965
4339
|
useVoiceOpsStatus,
|
|
4340
|
+
useVoiceDeliveryRuntime,
|
|
3966
4341
|
useVoiceController,
|
|
3967
4342
|
useVoiceCampaignDialerProof,
|
|
3968
4343
|
VoiceTurnQuality,
|
|
@@ -3972,5 +4347,6 @@ export {
|
|
|
3972
4347
|
VoiceProviderStatus,
|
|
3973
4348
|
VoiceProviderSimulationControls,
|
|
3974
4349
|
VoiceProviderCapabilities,
|
|
3975
|
-
VoiceOpsStatus
|
|
4350
|
+
VoiceOpsStatus,
|
|
4351
|
+
VoiceDeliveryRuntime
|
|
3976
4352
|
};
|