@absolutejs/voice 0.0.22-beta.290 → 0.0.22-beta.292
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 +53 -0
- package/dist/angular/index.d.ts +1 -0
- package/dist/angular/index.js +303 -181
- package/dist/angular/voice-readiness-failures.service.d.ts +13 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.js +367 -183
- package/dist/client/readinessFailures.d.ts +19 -0
- package/dist/client/readinessFailuresWidget.d.ts +42 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +90 -14
- package/dist/modelAdapters.d.ts +37 -0
- package/dist/react/VoiceReadinessFailures.d.ts +6 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +635 -345
- package/dist/react/useVoiceReadinessFailures.d.ts +8 -0
- package/dist/svelte/createVoiceReadinessFailures.d.ts +7 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +86 -0
- package/dist/testing/index.js +87 -12
- package/dist/vue/VoiceReadinessFailures.d.ts +21 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +540 -262
- package/dist/vue/useVoiceReadinessFailures.d.ts +755 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { VoiceProductionReadinessReport } from '../productionReadiness';
|
|
2
|
+
export type VoiceReadinessFailuresClientOptions = {
|
|
3
|
+
fetch?: typeof fetch;
|
|
4
|
+
intervalMs?: number;
|
|
5
|
+
};
|
|
6
|
+
export type VoiceReadinessFailuresSnapshot = {
|
|
7
|
+
error: string | null;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
report?: VoiceProductionReadinessReport;
|
|
10
|
+
updatedAt?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const fetchVoiceReadinessFailures: (path?: string, options?: Pick<VoiceReadinessFailuresClientOptions, "fetch">) => Promise<VoiceProductionReadinessReport>;
|
|
13
|
+
export declare const createVoiceReadinessFailuresStore: (path?: string, options?: VoiceReadinessFailuresClientOptions) => {
|
|
14
|
+
close: () => void;
|
|
15
|
+
getServerSnapshot: () => VoiceReadinessFailuresSnapshot;
|
|
16
|
+
getSnapshot: () => VoiceReadinessFailuresSnapshot;
|
|
17
|
+
refresh: () => Promise<VoiceProductionReadinessReport | undefined>;
|
|
18
|
+
subscribe: (listener: () => void) => () => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { VoiceProductionReadinessCheck } from '../productionReadiness';
|
|
2
|
+
import { type VoiceReadinessFailuresClientOptions, type VoiceReadinessFailuresSnapshot } from './readinessFailures';
|
|
3
|
+
export type VoiceReadinessFailureView = {
|
|
4
|
+
evidenceHref?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
observed: string;
|
|
7
|
+
remediation: string;
|
|
8
|
+
sourceHref?: string;
|
|
9
|
+
status: VoiceProductionReadinessCheck['status'];
|
|
10
|
+
threshold: string;
|
|
11
|
+
thresholdLabel: string;
|
|
12
|
+
};
|
|
13
|
+
export type VoiceReadinessFailuresViewModel = {
|
|
14
|
+
description: string;
|
|
15
|
+
error: string | null;
|
|
16
|
+
failures: VoiceReadinessFailureView[];
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
label: string;
|
|
19
|
+
links: Array<{
|
|
20
|
+
href: string;
|
|
21
|
+
label: string;
|
|
22
|
+
}>;
|
|
23
|
+
status: 'empty' | 'error' | 'loading' | 'ready' | 'warning';
|
|
24
|
+
title: string;
|
|
25
|
+
updatedAt?: number;
|
|
26
|
+
};
|
|
27
|
+
export type VoiceReadinessFailuresWidgetOptions = VoiceReadinessFailuresClientOptions & {
|
|
28
|
+
description?: string;
|
|
29
|
+
links?: Array<{
|
|
30
|
+
href: string;
|
|
31
|
+
label: string;
|
|
32
|
+
}>;
|
|
33
|
+
title?: string;
|
|
34
|
+
};
|
|
35
|
+
export declare const createVoiceReadinessFailuresViewModel: (snapshot: VoiceReadinessFailuresSnapshot, options?: VoiceReadinessFailuresWidgetOptions) => VoiceReadinessFailuresViewModel;
|
|
36
|
+
export declare const renderVoiceReadinessFailuresHTML: (snapshot: VoiceReadinessFailuresSnapshot, options?: VoiceReadinessFailuresWidgetOptions) => string;
|
|
37
|
+
export declare const getVoiceReadinessFailuresCSS: () => string;
|
|
38
|
+
export declare const mountVoiceReadinessFailures: (element: Element, path?: string, options?: VoiceReadinessFailuresWidgetOptions) => {
|
|
39
|
+
close: () => void;
|
|
40
|
+
refresh: () => Promise<import("..").VoiceProductionReadinessReport | undefined>;
|
|
41
|
+
};
|
|
42
|
+
export declare const defineVoiceReadinessFailuresElement: (tagName?: string) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export { applyVoiceTelephonyOutcome, assertVoiceTelephonyWebhookNormalizationEvi
|
|
|
46
46
|
export { assertVoicePhoneCallControlEvidence, assertVoicePhoneAssistantEvidence, createVoicePhoneAgent, evaluateVoicePhoneCallControlEvidence, evaluateVoicePhoneAssistantEvidence } from './phoneAgent';
|
|
47
47
|
export { createStoredVoiceCallReviewArtifact, createStoredVoiceExternalObjectMap, createStoredVoiceIntegrationEvent, createStoredVoiceOpsTask, createVoiceFileIncidentBundleStore, createVoiceFileExternalObjectMapStore, createVoiceFileAssistantMemoryStore, createVoiceFileAuditEventStore, createVoiceFileAuditSinkDeliveryStore, createVoiceFileCampaignStore, createVoiceFileIntegrationEventStore, createVoiceFileReviewStore, createVoiceFileRuntimeStorage, createVoiceFileSessionStore, createVoiceFileTaskStore, createVoiceFileTraceSinkDeliveryStore, createVoiceFileTraceEventStore } from './fileStore';
|
|
48
48
|
export { createVoiceAssistantMemoryHandle, createVoiceAssistantMemoryRecord, createVoiceMemoryAssistantMemoryStore, resolveVoiceAssistantMemoryNamespace } from './assistantMemory';
|
|
49
|
-
export { createAnthropicVoiceAssistantModel, createGeminiVoiceAssistantModel, createJSONVoiceAssistantModel, createOpenAIVoiceAssistantModel, resolveVoiceProviderRoutingPolicyPreset, createVoiceProviderRouter } from './modelAdapters';
|
|
49
|
+
export { createAnthropicVoiceAssistantModel, createGeminiVoiceAssistantModel, createJSONVoiceAssistantModel, createOpenAIVoiceAssistantModel, createVoiceProviderOrchestrationProfile, resolveVoiceProviderRoutingPolicyPreset, createVoiceProviderRouter } from './modelAdapters';
|
|
50
50
|
export { createOpenAIRealtimeAdapter } from './openaiRealtime';
|
|
51
51
|
export { createOpenAIVoiceTTS } from './openaiTTS';
|
|
52
52
|
export { createVoiceProviderHealthHTMLHandler, createVoiceProviderHealthJSONHandler, createVoiceProviderHealthRoutes, renderVoiceProviderHealthHTML, summarizeVoiceProviderHealth } from './providerHealth';
|
|
@@ -106,7 +106,7 @@ export type { VoiceEvalBaselineComparison, VoiceEvalBaselineComparisonOptions, V
|
|
|
106
106
|
export type { VoiceSimulationSuiteAssertionInput, VoiceSimulationSuiteAssertionReport, VoiceSimulationSuiteEvalRoutesOptions, VoiceSimulationSuiteOptions, VoiceSimulationSuiteReport, VoiceSimulationSuiteRoutesOptions, VoiceSimulationSuiteSection, VoiceSimulationSuiteSectionSummary, VoiceSimulationSuiteStatus } from './simulationSuite';
|
|
107
107
|
export type { VoiceWorkflowContract, VoiceWorkflowContractDefinition, VoiceWorkflowContractField, VoiceWorkflowContractFieldMatch, VoiceWorkflowContractPresetName, VoiceWorkflowContractPresetOptions, VoiceWorkflowContractTracePayload, VoiceWorkflowContractValidation, VoiceWorkflowContractValidationIssue, VoiceWorkflowOutcome } from './workflowContract';
|
|
108
108
|
export type { VoiceSessionListHTMLHandlerOptions, VoiceSessionListItem, VoiceSessionListOptions, VoiceSessionListRoutesOptions, VoiceSessionListStatus, VoiceProviderFallbackRecoverySummary, VoiceSessionReplay, VoiceSessionReplayHTMLHandlerOptions, VoiceSessionReplayOptions, VoiceSessionReplayRoutesOptions, VoiceSessionReplayTurn } from './sessionReplay';
|
|
109
|
-
export type { AnthropicVoiceAssistantModelOptions, GeminiVoiceAssistantModelOptions, OpenAIVoiceAssistantModelOptions, VoiceProviderRouterEvent, VoiceProviderRouterFallbackMode, VoiceProviderRouterHealthOptions, VoiceProviderRouterOptions, VoiceProviderRouterPolicy, VoiceProviderRouterPolicyPreset, VoiceProviderRouterPolicyWeights, VoiceProviderRouterProviderHealth, VoiceProviderRouterProviderProfile, VoiceProviderRouterStrategy, VoiceJSONAssistantModelHandler, VoiceJSONAssistantModelOptions } from './modelAdapters';
|
|
109
|
+
export type { AnthropicVoiceAssistantModelOptions, GeminiVoiceAssistantModelOptions, OpenAIVoiceAssistantModelOptions, VoiceProviderRouterEvent, VoiceProviderRouterFallbackMode, VoiceProviderRouterHealthOptions, VoiceProviderRouterOptions, VoiceProviderOrchestrationProfile, VoiceProviderOrchestrationProfileOptions, VoiceProviderOrchestrationResolvedSurface, VoiceProviderOrchestrationSurface, VoiceProviderRouterPolicy, VoiceProviderRouterPolicyPreset, VoiceProviderRouterPolicyWeights, VoiceProviderRouterProviderHealth, VoiceProviderRouterProviderProfile, VoiceProviderRouterStrategy, VoiceJSONAssistantModelHandler, VoiceJSONAssistantModelOptions } from './modelAdapters';
|
|
110
110
|
export type { OpenAIVoiceTTSOptions, OpenAIVoiceTTSVoice } from './openaiTTS';
|
|
111
111
|
export type { OpenAIRealtimeAdapterOptions, OpenAIRealtimeModel, OpenAIRealtimeNoiseReduction, OpenAIRealtimeResponseMode, OpenAIRealtimeTranscriptionModel, OpenAIRealtimeVoice } from './openaiRealtime';
|
|
112
112
|
export type { VoiceProviderHealthStatus, VoiceProviderHealthSummary, VoiceProviderHealthSummaryOptions } from './providerHealth';
|
|
@@ -123,7 +123,7 @@ export type { VoicePhoneAgentCarrier, VoicePhoneAgentCarrierSummary, VoicePhoneA
|
|
|
123
123
|
export type { VoicePhoneAgentProductionSmokeIssue, VoicePhoneAgentProductionSmokeHandlerOptions, VoicePhoneAgentProductionSmokeHTMLHandlerOptions, VoicePhoneAgentProductionSmokeOptions, VoicePhoneAgentProductionSmokeReport, VoicePhoneAgentProductionSmokeRoutesOptions, VoicePhoneAgentProductionSmokeRequirement } from './phoneAgentProductionSmoke';
|
|
124
124
|
export type { VoiceOpsConsoleLink, VoiceOpsConsoleReport, VoiceOpsConsoleRoutesOptions } from './opsConsoleRoutes';
|
|
125
125
|
export type { VoiceOpsStatus, VoiceOpsStatusLink, VoiceOpsStatusOptions, VoiceOpsStatusReport, VoiceOpsStatusRoutesOptions } from './opsStatus';
|
|
126
|
-
export type { VoiceProductionReadinessAction, VoiceProductionReadinessAuditOptions, VoiceProductionReadinessAuditRequirement, VoiceProductionReadinessAuditSummary, VoiceProductionReadinessAssertionInput, VoiceProductionReadinessAssertionReport, VoiceProductionReadinessCheck, VoiceProductionReadinessGateIssue, VoiceProductionReadinessGateOptions, VoiceProductionReadinessGateProfile, VoiceProductionReadinessGateProfileSurface, VoiceProductionReadinessGateReport, VoiceProductionReadinessOpsActionHistoryOptions, VoiceProductionReadinessOpsActionHistorySummary, VoiceProductionReadinessOperationsRecordLink, VoiceProductionReadinessOperationsRecordLinks, VoiceProductionReadinessProfileExplanation, VoiceProductionReadinessProfileSurface, VoiceProductionReadinessProofSource, VoiceProductionReadinessReport, VoiceProductionReadinessRouteInput, VoiceProductionReadinessRoutesOptions, VoiceProductionReadinessTraceDeliverySummary, VoiceProductionReadinessAuditDeliveryOptions, VoiceProductionReadinessAuditDeliverySummary, VoiceProductionReadinessTraceDeliveryOptions, VoiceProductionReadinessStatus } from './productionReadiness';
|
|
126
|
+
export type { VoiceProductionReadinessAction, VoiceProductionReadinessAuditOptions, VoiceProductionReadinessAuditRequirement, VoiceProductionReadinessAuditSummary, VoiceProductionReadinessAssertionInput, VoiceProductionReadinessAssertionReport, VoiceProductionReadinessCheck, VoiceProductionReadinessGateExplanation, VoiceProductionReadinessGateIssue, VoiceProductionReadinessGateOptions, VoiceProductionReadinessGateProfile, VoiceProductionReadinessGateProfileSurface, VoiceProductionReadinessGateReport, VoiceProductionReadinessOpsActionHistoryOptions, VoiceProductionReadinessOpsActionHistorySummary, VoiceProductionReadinessOperationsRecordLink, VoiceProductionReadinessOperationsRecordLinks, VoiceProductionReadinessProfileExplanation, VoiceProductionReadinessProfileSurface, VoiceProductionReadinessProofSource, VoiceProductionReadinessReport, VoiceProductionReadinessRouteInput, VoiceProductionReadinessRoutesOptions, VoiceProductionReadinessTraceDeliverySummary, VoiceProductionReadinessAuditDeliveryOptions, VoiceProductionReadinessAuditDeliverySummary, VoiceProductionReadinessTraceDeliveryOptions, VoiceProductionReadinessStatus } from './productionReadiness';
|
|
127
127
|
export type { VoiceMonitorDefinition, VoiceMonitorEvaluation, VoiceMonitorEvaluationInput, VoiceMonitorIssue, VoiceMonitorIssueStatus, VoiceMonitorIssueStore, VoiceMonitorNotifier, VoiceMonitorNotifierDeliveryInput, VoiceMonitorNotifierDeliveryOptions, VoiceMonitorNotifierDeliveryReceipt, VoiceMonitorNotifierDeliveryReceiptStore, VoiceMonitorNotifierDeliveryReport, VoiceMonitorNotifierDeliveryResult, VoiceMonitorRoutesOptions, VoiceMonitorRun, VoiceMonitorRunOptions, VoiceMonitorRunReport, VoiceMonitorRunner, VoiceMonitorRunnerOptions, VoiceMonitorRunnerRoutesOptions, VoiceMonitorRunnerTickResult, VoiceMonitorSeverity, VoiceMonitorStatus, VoiceMonitorWebhookNotifierOptions } from './voiceMonitoring';
|
|
128
128
|
export type { VoiceReadinessProfileName, VoiceReadinessProfileOptions, VoiceReadinessProfileRecommendation, VoiceReadinessProfileRecommendationScore, VoiceReadinessProfileRoutesOptions } from './readinessProfiles';
|
|
129
129
|
export type { VoiceProviderStackChoice, VoiceProviderStackCapabilities, VoiceProviderStackCapabilityGap, VoiceProviderStackCapabilityGapInput, VoiceProviderStackCapabilityGapReport, VoiceProviderContractCheck, VoiceProviderContractCheckStatus, VoiceProviderContractDefinition, VoiceProviderContractMatrixAssertionInput, VoiceProviderContractMatrixAssertionReport, VoiceProviderContractMatrixHandlerOptions, VoiceProviderContractMatrixHTMLHandlerOptions, VoiceProviderContractMatrixInput, VoiceProviderContractMatrixPresetOptions, VoiceProviderContractMatrixReport, VoiceProviderContractMatrixRoutesOptions, VoiceProviderContractMatrixRow, VoiceProviderStackAssertionInput, VoiceProviderStackAssertionReport, VoiceProviderStackInput, VoiceProviderStackKind, VoiceProviderStackRecommendation } from './providerStackRecommendations';
|
package/dist/index.js
CHANGED
|
@@ -21650,6 +21650,7 @@ var createStoredVoiceExternalObjectMap = (mapping) => createVoiceExternalObjectM
|
|
|
21650
21650
|
sourceType: mapping.sourceType
|
|
21651
21651
|
});
|
|
21652
21652
|
// src/modelAdapters.ts
|
|
21653
|
+
var isVoiceProviderRoutingPolicyPreset = (value) => value === "balanced" || value === "cost-cap" || value === "cost-first" || value === "latency-first" || value === "quality-first";
|
|
21653
21654
|
var resolveVoiceProviderRoutingPolicyPreset = (preset, options = {}) => {
|
|
21654
21655
|
switch (preset) {
|
|
21655
21656
|
case "balanced":
|
|
@@ -21691,6 +21692,75 @@ var resolveVoiceProviderRoutingPolicyPreset = (preset, options = {}) => {
|
|
|
21691
21692
|
};
|
|
21692
21693
|
}
|
|
21693
21694
|
};
|
|
21695
|
+
var resolveVoiceProviderRoutingPolicy = (policy) => {
|
|
21696
|
+
if (!policy) {
|
|
21697
|
+
return;
|
|
21698
|
+
}
|
|
21699
|
+
if (typeof policy === "string") {
|
|
21700
|
+
return isVoiceProviderRoutingPolicyPreset(policy) ? resolveVoiceProviderRoutingPolicyPreset(policy) : {
|
|
21701
|
+
strategy: policy
|
|
21702
|
+
};
|
|
21703
|
+
}
|
|
21704
|
+
return policy;
|
|
21705
|
+
};
|
|
21706
|
+
var mergeDefinedProviderPolicyFields = (base, surface) => {
|
|
21707
|
+
const next = {
|
|
21708
|
+
...base ?? {}
|
|
21709
|
+
};
|
|
21710
|
+
if (surface.allowProviders !== undefined) {
|
|
21711
|
+
next.allowProviders = surface.allowProviders;
|
|
21712
|
+
}
|
|
21713
|
+
if (surface.fallbackMode !== undefined) {
|
|
21714
|
+
next.fallbackMode = surface.fallbackMode;
|
|
21715
|
+
}
|
|
21716
|
+
if (surface.maxCost !== undefined) {
|
|
21717
|
+
next.maxCost = surface.maxCost;
|
|
21718
|
+
}
|
|
21719
|
+
if (surface.maxLatencyMs !== undefined) {
|
|
21720
|
+
next.maxLatencyMs = surface.maxLatencyMs;
|
|
21721
|
+
}
|
|
21722
|
+
if (surface.minQuality !== undefined) {
|
|
21723
|
+
next.minQuality = surface.minQuality;
|
|
21724
|
+
}
|
|
21725
|
+
if (surface.strategy !== undefined) {
|
|
21726
|
+
next.strategy = surface.strategy;
|
|
21727
|
+
}
|
|
21728
|
+
if (surface.weights !== undefined) {
|
|
21729
|
+
next.weights = {
|
|
21730
|
+
...base?.weights ?? {},
|
|
21731
|
+
...surface.weights
|
|
21732
|
+
};
|
|
21733
|
+
}
|
|
21734
|
+
return next;
|
|
21735
|
+
};
|
|
21736
|
+
var createVoiceProviderOrchestrationProfile = (options) => {
|
|
21737
|
+
const surfaceNames = Object.keys(options.surfaces);
|
|
21738
|
+
const defaultSurface = options.defaultSurface ?? surfaceNames[0];
|
|
21739
|
+
if (!defaultSurface || !options.surfaces[defaultSurface]) {
|
|
21740
|
+
throw new Error("Voice provider orchestration profile has no surfaces.");
|
|
21741
|
+
}
|
|
21742
|
+
return {
|
|
21743
|
+
defaultSurface,
|
|
21744
|
+
id: options.id,
|
|
21745
|
+
resolve: (surface = defaultSurface) => {
|
|
21746
|
+
const config = options.surfaces[surface];
|
|
21747
|
+
if (!config) {
|
|
21748
|
+
throw new Error(`Voice provider orchestration profile ${options.id} has no surface "${surface}".`);
|
|
21749
|
+
}
|
|
21750
|
+
const policy = mergeDefinedProviderPolicyFields(resolveVoiceProviderRoutingPolicy(config.policy), config);
|
|
21751
|
+
return {
|
|
21752
|
+
allowProviders: config.allowProviders,
|
|
21753
|
+
fallback: config.fallback,
|
|
21754
|
+
fallbackMode: config.fallbackMode,
|
|
21755
|
+
policy,
|
|
21756
|
+
providerHealth: config.providerHealth,
|
|
21757
|
+
providerProfiles: config.providerProfiles,
|
|
21758
|
+
timeoutMs: config.timeoutMs
|
|
21759
|
+
};
|
|
21760
|
+
},
|
|
21761
|
+
surfaces: options.surfaces
|
|
21762
|
+
};
|
|
21763
|
+
};
|
|
21694
21764
|
var OUTPUT_SCHEMA = {
|
|
21695
21765
|
additionalProperties: false,
|
|
21696
21766
|
properties: {
|
|
@@ -21858,19 +21928,23 @@ var createJSONVoiceAssistantModel = (options) => ({
|
|
|
21858
21928
|
var createVoiceProviderRouter = (options) => {
|
|
21859
21929
|
const providerIds = Object.keys(options.providers);
|
|
21860
21930
|
const firstProvider = providerIds[0];
|
|
21861
|
-
const
|
|
21862
|
-
|
|
21863
|
-
} : options.policy;
|
|
21931
|
+
const orchestrationSurface = options.orchestrationProfile?.resolve(options.orchestrationSurface);
|
|
21932
|
+
const policy = resolveVoiceProviderRoutingPolicy(options.policy) ?? resolveVoiceProviderRoutingPolicy(orchestrationSurface?.policy);
|
|
21864
21933
|
const strategy = policy?.strategy ?? "prefer-selected";
|
|
21865
|
-
const fallbackMode = policy?.fallbackMode ?? options.fallbackMode ?? "provider-error";
|
|
21866
|
-
const
|
|
21934
|
+
const fallbackMode = policy?.fallbackMode ?? options.fallbackMode ?? orchestrationSurface?.fallbackMode ?? "provider-error";
|
|
21935
|
+
const providerProfiles = {
|
|
21936
|
+
...orchestrationSurface?.providerProfiles ?? {},
|
|
21937
|
+
...options.providerProfiles ?? {}
|
|
21938
|
+
};
|
|
21939
|
+
const providerHealthOption = options.providerHealth ?? orchestrationSurface?.providerHealth;
|
|
21940
|
+
const healthOptions = typeof providerHealthOption === "object" ? providerHealthOption : providerHealthOption ? {} : undefined;
|
|
21867
21941
|
const healthState = new Map;
|
|
21868
21942
|
const now = () => healthOptions?.now?.() ?? Date.now();
|
|
21869
21943
|
const failureThreshold = Math.max(1, healthOptions?.failureThreshold ?? 1);
|
|
21870
21944
|
const cooldownMs = Math.max(0, healthOptions?.cooldownMs ?? 30000);
|
|
21871
21945
|
const rateLimitCooldownMs = Math.max(0, healthOptions?.rateLimitCooldownMs ?? 60000);
|
|
21872
21946
|
const getProviderTimeoutMs = (provider) => {
|
|
21873
|
-
const timeoutMs =
|
|
21947
|
+
const timeoutMs = providerProfiles[provider]?.timeoutMs ?? options.timeoutMs ?? orchestrationSurface?.timeoutMs;
|
|
21874
21948
|
return typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : undefined;
|
|
21875
21949
|
};
|
|
21876
21950
|
const getHealth = (provider) => {
|
|
@@ -21936,12 +22010,12 @@ var createVoiceProviderRouter = (options) => {
|
|
|
21936
22010
|
return cloneHealth(provider);
|
|
21937
22011
|
};
|
|
21938
22012
|
const resolveAllowedProviders = async (input) => {
|
|
21939
|
-
const allowProviders = policy?.allowProviders ?? options.allowProviders;
|
|
22013
|
+
const allowProviders = policy?.allowProviders ?? options.allowProviders ?? orchestrationSurface?.allowProviders;
|
|
21940
22014
|
const allowed = typeof allowProviders === "function" ? await allowProviders(input) : allowProviders;
|
|
21941
22015
|
return new Set(allowed ?? providerIds);
|
|
21942
22016
|
};
|
|
21943
22017
|
const passesBudgetFilters = (provider) => {
|
|
21944
|
-
const profile =
|
|
22018
|
+
const profile = providerProfiles[provider];
|
|
21945
22019
|
if (typeof policy?.maxCost === "number" && typeof profile?.cost === "number" && profile.cost > policy.maxCost) {
|
|
21946
22020
|
return false;
|
|
21947
22021
|
}
|
|
@@ -21954,7 +22028,7 @@ var createVoiceProviderRouter = (options) => {
|
|
|
21954
22028
|
return true;
|
|
21955
22029
|
};
|
|
21956
22030
|
const getBalancedScore = (provider) => {
|
|
21957
|
-
const profile =
|
|
22031
|
+
const profile = providerProfiles[provider];
|
|
21958
22032
|
if (policy?.scoreProvider) {
|
|
21959
22033
|
return policy.scoreProvider(provider, profile);
|
|
21960
22034
|
}
|
|
@@ -21966,8 +22040,8 @@ var createVoiceProviderRouter = (options) => {
|
|
|
21966
22040
|
return providers;
|
|
21967
22041
|
}
|
|
21968
22042
|
return [...providers].sort((left, right) => {
|
|
21969
|
-
const leftProfile =
|
|
21970
|
-
const rightProfile =
|
|
22043
|
+
const leftProfile = providerProfiles[left];
|
|
22044
|
+
const rightProfile = providerProfiles[right];
|
|
21971
22045
|
if (strategy === "quality-first") {
|
|
21972
22046
|
return (rightProfile?.quality ?? Number.MIN_SAFE_INTEGER) - (leftProfile?.quality ?? Number.MIN_SAFE_INTEGER) || (leftProfile?.priority ?? Number.MAX_SAFE_INTEGER) - (rightProfile?.priority ?? Number.MAX_SAFE_INTEGER) || (leftProfile?.latencyMs ?? Number.MAX_SAFE_INTEGER) - (rightProfile?.latencyMs ?? Number.MAX_SAFE_INTEGER) || (leftProfile?.cost ?? Number.MAX_SAFE_INTEGER) - (rightProfile?.cost ?? Number.MAX_SAFE_INTEGER);
|
|
21973
22047
|
}
|
|
@@ -21982,7 +22056,8 @@ var createVoiceProviderRouter = (options) => {
|
|
|
21982
22056
|
const resolveOrder = async (input) => {
|
|
21983
22057
|
const selectedProvider = await options.selectProvider?.(input);
|
|
21984
22058
|
const allowedProviders = await resolveAllowedProviders(input);
|
|
21985
|
-
const
|
|
22059
|
+
const fallbackSource = options.fallback ?? orchestrationSurface?.fallback;
|
|
22060
|
+
const fallbackOrder = typeof fallbackSource === "function" ? await fallbackSource(input) : fallbackSource;
|
|
21986
22061
|
const allowedRankedProviders = sortProviders([
|
|
21987
22062
|
...fallbackOrder ?? providerIds
|
|
21988
22063
|
]).filter((provider) => allowedProviders.has(provider));
|
|
@@ -30823,11 +30898,11 @@ var withTimeout2 = async (input) => {
|
|
|
30823
30898
|
}
|
|
30824
30899
|
}
|
|
30825
30900
|
};
|
|
30826
|
-
var
|
|
30901
|
+
var isVoiceProviderRoutingPolicyPreset2 = (policy) => policy === "balanced" || policy === "cost-cap" || policy === "cost-first" || policy === "latency-first" || policy === "quality-first";
|
|
30827
30902
|
var createResolver = (options) => {
|
|
30828
30903
|
const providerIds = Object.keys(options.adapters);
|
|
30829
30904
|
const firstProvider = providerIds[0];
|
|
30830
|
-
const policy = typeof options.policy === "string" ?
|
|
30905
|
+
const policy = typeof options.policy === "string" ? isVoiceProviderRoutingPolicyPreset2(options.policy) ? resolveVoiceProviderRoutingPolicyPreset(options.policy) : {
|
|
30831
30906
|
strategy: options.policy
|
|
30832
30907
|
} : options.policy;
|
|
30833
30908
|
const strategy = policy?.strategy ?? "prefer-selected";
|
|
@@ -33231,6 +33306,7 @@ export {
|
|
|
33231
33306
|
createVoiceQualityRoutes,
|
|
33232
33307
|
createVoiceProviderSloRoutes,
|
|
33233
33308
|
createVoiceProviderRouter,
|
|
33309
|
+
createVoiceProviderOrchestrationProfile,
|
|
33234
33310
|
createVoiceProviderHealthRoutes,
|
|
33235
33311
|
createVoiceProviderHealthJSONHandler,
|
|
33236
33312
|
createVoiceProviderHealthHTMLHandler,
|
package/dist/modelAdapters.d.ts
CHANGED
|
@@ -92,6 +92,41 @@ export type VoiceProviderRouterProviderHealth<TProvider extends string = string>
|
|
|
92
92
|
status: 'healthy' | 'suppressed';
|
|
93
93
|
suppressedUntil?: number;
|
|
94
94
|
};
|
|
95
|
+
export type VoiceProviderOrchestrationSurface<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TProvider extends string = string> = {
|
|
96
|
+
allowProviders?: readonly TProvider[] | ((input: VoiceAgentModelInput<TContext, TSession>) => readonly TProvider[] | Promise<readonly TProvider[]>);
|
|
97
|
+
fallback?: readonly TProvider[] | ((input: VoiceAgentModelInput<TContext, TSession>) => readonly TProvider[] | Promise<readonly TProvider[]>);
|
|
98
|
+
fallbackMode?: VoiceProviderRouterFallbackMode;
|
|
99
|
+
maxCost?: number;
|
|
100
|
+
maxLatencyMs?: number;
|
|
101
|
+
minQuality?: number;
|
|
102
|
+
policy?: VoiceProviderRouterPolicy<TContext, TSession, TProvider>;
|
|
103
|
+
providerHealth?: boolean | VoiceProviderRouterHealthOptions;
|
|
104
|
+
providerProfiles?: Partial<Record<TProvider, VoiceProviderRouterProviderProfile>>;
|
|
105
|
+
strategy?: VoiceProviderRouterStrategy;
|
|
106
|
+
timeoutMs?: number;
|
|
107
|
+
weights?: VoiceProviderRouterPolicyWeights;
|
|
108
|
+
};
|
|
109
|
+
export type VoiceProviderOrchestrationProfile<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TProvider extends string = string, TSurface extends string = string> = {
|
|
110
|
+
defaultSurface?: TSurface;
|
|
111
|
+
id: string;
|
|
112
|
+
resolve: (surface?: TSurface) => VoiceProviderOrchestrationResolvedSurface<TContext, TSession, TProvider>;
|
|
113
|
+
surfaces: Record<TSurface, VoiceProviderOrchestrationSurface<TContext, TSession, TProvider>>;
|
|
114
|
+
};
|
|
115
|
+
export type VoiceProviderOrchestrationProfileOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TProvider extends string = string, TSurface extends string = string> = {
|
|
116
|
+
defaultSurface?: TSurface;
|
|
117
|
+
id: string;
|
|
118
|
+
surfaces: Record<TSurface, VoiceProviderOrchestrationSurface<TContext, TSession, TProvider>>;
|
|
119
|
+
};
|
|
120
|
+
export type VoiceProviderOrchestrationResolvedSurface<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TProvider extends string = string> = {
|
|
121
|
+
allowProviders?: VoiceProviderOrchestrationSurface<TContext, TSession, TProvider>['allowProviders'];
|
|
122
|
+
fallback?: VoiceProviderOrchestrationSurface<TContext, TSession, TProvider>['fallback'];
|
|
123
|
+
fallbackMode?: VoiceProviderRouterFallbackMode;
|
|
124
|
+
policy?: VoiceProviderRouterPolicy<TContext, TSession, TProvider>;
|
|
125
|
+
providerHealth?: boolean | VoiceProviderRouterHealthOptions;
|
|
126
|
+
providerProfiles?: Partial<Record<TProvider, VoiceProviderRouterProviderProfile>>;
|
|
127
|
+
timeoutMs?: number;
|
|
128
|
+
};
|
|
129
|
+
export declare const createVoiceProviderOrchestrationProfile: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TProvider extends string = string, TSurface extends string = string>(options: VoiceProviderOrchestrationProfileOptions<TContext, TSession, TProvider, TSurface>) => VoiceProviderOrchestrationProfile<TContext, TSession, TProvider, TSurface>;
|
|
95
130
|
export type VoiceProviderRouterOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown, TProvider extends string = string> = {
|
|
96
131
|
allowProviders?: readonly TProvider[] | ((input: VoiceAgentModelInput<TContext, TSession>) => readonly TProvider[] | Promise<readonly TProvider[]>);
|
|
97
132
|
fallback?: TProvider[] | ((input: VoiceAgentModelInput<TContext, TSession>) => readonly TProvider[] | Promise<readonly TProvider[]>);
|
|
@@ -100,6 +135,8 @@ export type VoiceProviderRouterOptions<TContext = unknown, TSession extends Voic
|
|
|
100
135
|
isRateLimitError?: (error: unknown, provider: TProvider) => boolean;
|
|
101
136
|
isTimeoutError?: (error: unknown, provider: TProvider) => boolean;
|
|
102
137
|
onProviderEvent?: (event: VoiceProviderRouterEvent<TProvider>, input: VoiceAgentModelInput<TContext, TSession>) => Promise<void> | void;
|
|
138
|
+
orchestrationProfile?: VoiceProviderOrchestrationProfile<TContext, TSession, TProvider>;
|
|
139
|
+
orchestrationSurface?: string;
|
|
103
140
|
policy?: VoiceProviderRouterPolicy<TContext, TSession, TProvider>;
|
|
104
141
|
providerHealth?: boolean | VoiceProviderRouterHealthOptions;
|
|
105
142
|
providerProfiles?: Partial<Record<TProvider, VoiceProviderRouterProviderProfile>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type VoiceReadinessFailuresWidgetOptions } from '../client/readinessFailuresWidget';
|
|
2
|
+
export type VoiceReadinessFailuresProps = VoiceReadinessFailuresWidgetOptions & {
|
|
3
|
+
className?: string;
|
|
4
|
+
path?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const VoiceReadinessFailures: ({ className, path, ...options }: VoiceReadinessFailuresProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { VoiceOpsActionCenter } from './VoiceOpsActionCenter';
|
|
|
3
3
|
export { VoiceDeliveryRuntime } from './VoiceDeliveryRuntime';
|
|
4
4
|
export { VoicePlatformCoverage } from './VoicePlatformCoverage';
|
|
5
5
|
export { VoiceProofTrends } from './VoiceProofTrends';
|
|
6
|
+
export { VoiceReadinessFailures } from './VoiceReadinessFailures';
|
|
6
7
|
export { VoiceProviderSimulationControls } from './VoiceProviderSimulationControls';
|
|
7
8
|
export { VoiceProviderCapabilities } from './VoiceProviderCapabilities';
|
|
8
9
|
export { VoiceProviderContracts } from './VoiceProviderContracts';
|
|
@@ -15,6 +16,7 @@ export { VoiceTurnQuality } from './VoiceTurnQuality';
|
|
|
15
16
|
export { useVoiceOpsStatus } from './useVoiceOpsStatus';
|
|
16
17
|
export { useVoicePlatformCoverage } from './useVoicePlatformCoverage';
|
|
17
18
|
export { useVoiceProofTrends } from './useVoiceProofTrends';
|
|
19
|
+
export { useVoiceReadinessFailures } from './useVoiceReadinessFailures';
|
|
18
20
|
export { useVoiceOpsActionCenter } from './useVoiceOpsActionCenter';
|
|
19
21
|
export { useVoiceLiveOps } from './useVoiceLiveOps';
|
|
20
22
|
export { useVoiceDeliveryRuntime } from './useVoiceDeliveryRuntime';
|