@absolutejs/voice 0.0.22-beta.254 → 0.0.22-beta.255
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agentSquadContract.d.ts +29 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +193 -0
- package/dist/providerRoutingContract.d.ts +33 -0
- package/package.json +1 -1
|
@@ -65,5 +65,34 @@ export type VoiceAgentSquadContractRunOptions<TContext = unknown, TSession exten
|
|
|
65
65
|
squad: VoiceAgent<TContext, TSession, TResult>;
|
|
66
66
|
trace?: VoiceTraceEventStore;
|
|
67
67
|
};
|
|
68
|
+
export type VoiceAgentSquadContractAssertionInput = {
|
|
69
|
+
maxBlockedHandoffs?: number;
|
|
70
|
+
maxFailed?: number;
|
|
71
|
+
maxIssues?: number;
|
|
72
|
+
minContracts?: number;
|
|
73
|
+
minHandoffs?: number;
|
|
74
|
+
requiredContractIds?: string[];
|
|
75
|
+
requiredFinalAgentIds?: string[];
|
|
76
|
+
requiredHandoffStatuses?: VoiceAgentSquadHandoffStatus[];
|
|
77
|
+
requiredHandoffTargets?: string[];
|
|
78
|
+
requiredScenarioIds?: string[];
|
|
79
|
+
};
|
|
80
|
+
export type VoiceAgentSquadContractAssertionReport = {
|
|
81
|
+
blockedHandoffs: number;
|
|
82
|
+
contractIds: string[];
|
|
83
|
+
failed: number;
|
|
84
|
+
finalAgentIds: string[];
|
|
85
|
+
handoffStatuses: VoiceAgentSquadHandoffStatus[];
|
|
86
|
+
handoffTargets: string[];
|
|
87
|
+
handoffs: number;
|
|
88
|
+
issues: string[];
|
|
89
|
+
issueCount: number;
|
|
90
|
+
ok: boolean;
|
|
91
|
+
passed: number;
|
|
92
|
+
scenarioIds: string[];
|
|
93
|
+
total: number;
|
|
94
|
+
};
|
|
68
95
|
export declare const runVoiceAgentSquadContract: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options: VoiceAgentSquadContractRunOptions<TContext, TSession, TResult>) => Promise<VoiceAgentSquadContractReport<TResult>>;
|
|
69
96
|
export declare const assertVoiceAgentSquadContract: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options: VoiceAgentSquadContractRunOptions<TContext, TSession, TResult>) => Promise<VoiceAgentSquadContractReport<TResult>>;
|
|
97
|
+
export declare const evaluateVoiceAgentSquadContractEvidence: (reports: readonly VoiceAgentSquadContractReport[], input?: VoiceAgentSquadContractAssertionInput) => VoiceAgentSquadContractAssertionReport;
|
|
98
|
+
export declare const assertVoiceAgentSquadContractEvidence: (reports: readonly VoiceAgentSquadContractReport[], input?: VoiceAgentSquadContractAssertionInput) => VoiceAgentSquadContractAssertionReport;
|
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export { createVoiceSimulationSuiteRoutes, renderVoiceSimulationSuiteHTML, runVo
|
|
|
32
32
|
export { createVoiceWorkflowContract, createVoiceWorkflowContractHandler, createVoiceWorkflowContractPreset, createVoiceWorkflowScenario, recordVoiceWorkflowContractTrace, validateVoiceWorkflowRouteResult } from './workflowContract';
|
|
33
33
|
export { createVoiceSessionListRoutes, createVoiceSessionReplayHTMLHandler, createVoiceSessionReplayJSONHandler, createVoiceSessionReplayRoutes, createVoiceSessionsHTMLHandler, createVoiceSessionsJSONHandler, renderVoiceSessionsHTML, summarizeVoiceProviderFallbackRecovery, summarizeVoiceSessions, summarizeVoiceSessionReplay } from './sessionReplay';
|
|
34
34
|
export { createVoiceAgent, createVoiceAgentSquad, createVoiceAgentTool } from './agent';
|
|
35
|
-
export { assertVoiceAgentSquadContract, runVoiceAgentSquadContract } from './agentSquadContract';
|
|
35
|
+
export { assertVoiceAgentSquadContractEvidence, assertVoiceAgentSquadContract, evaluateVoiceAgentSquadContractEvidence, runVoiceAgentSquadContract } from './agentSquadContract';
|
|
36
36
|
export { createVoiceToolIdempotencyKey, createVoiceToolRuntime } from './toolRuntime';
|
|
37
37
|
export { createVoiceToolContract, createVoiceToolContractHTMLHandler, createVoiceToolContractJSONHandler, createVoiceToolContractRoutes, createVoiceToolRuntimeContractDefaults, renderVoiceToolContractHTML, runVoiceToolContractSuite, runVoiceToolContract } from './toolContract';
|
|
38
38
|
export { createVoiceTurnLatencyHTMLHandler, createVoiceTurnLatencyJSONHandler, createVoiceTurnLatencyRoutes, renderVoiceTurnLatencyHTML, summarizeVoiceTurnLatency } from './turnLatency';
|
|
@@ -49,7 +49,7 @@ export { createOpenAIRealtimeAdapter } from './openaiRealtime';
|
|
|
49
49
|
export { createOpenAIVoiceTTS } from './openaiTTS';
|
|
50
50
|
export { createVoiceProviderHealthHTMLHandler, createVoiceProviderHealthJSONHandler, createVoiceProviderHealthRoutes, renderVoiceProviderHealthHTML, summarizeVoiceProviderHealth } from './providerHealth';
|
|
51
51
|
export { createVoiceProviderCapabilityHTMLHandler, createVoiceProviderCapabilityJSONHandler, createVoiceProviderCapabilityRoutes, renderVoiceProviderCapabilityHTML, summarizeVoiceProviderCapabilities } from './providerCapabilities';
|
|
52
|
-
export { assertVoiceProviderRoutingContract, runVoiceProviderRoutingContract } from './providerRoutingContract';
|
|
52
|
+
export { assertVoiceProviderRoutingContractEvidence, assertVoiceProviderRoutingContract, evaluateVoiceProviderRoutingContractEvidence, runVoiceProviderRoutingContract } from './providerRoutingContract';
|
|
53
53
|
export { assertVoiceProviderSloEvidence, buildVoiceProviderSloReport, createVoiceProviderSloRoutes, evaluateVoiceProviderSloEvidence, renderVoiceProviderSloHTML, renderVoiceProviderSloMarkdown } from './providerSlo';
|
|
54
54
|
export { createVoicePhoneAgentProductionSmokeHTMLHandler, createVoicePhoneAgentProductionSmokeJSONHandler, createVoicePhoneAgentProductionSmokeRoutes, renderVoicePhoneAgentProductionSmokeHTML, runVoicePhoneAgentProductionSmokeContract } from './phoneAgentProductionSmoke';
|
|
55
55
|
export { assertVoiceProductionReadinessEvidence, buildVoiceProductionReadinessGate, buildVoiceProductionReadinessReport, createVoiceProductionReadinessRoutes, evaluateVoiceProductionReadinessEvidence, renderVoiceProductionReadinessHTML, summarizeVoiceProductionReadinessGate } from './productionReadiness';
|
|
@@ -108,7 +108,7 @@ export type { OpenAIVoiceTTSOptions, OpenAIVoiceTTSVoice } from './openaiTTS';
|
|
|
108
108
|
export type { OpenAIRealtimeAdapterOptions, OpenAIRealtimeModel, OpenAIRealtimeNoiseReduction, OpenAIRealtimeResponseMode, OpenAIRealtimeTranscriptionModel, OpenAIRealtimeVoice } from './openaiRealtime';
|
|
109
109
|
export type { VoiceProviderHealthStatus, VoiceProviderHealthSummary, VoiceProviderHealthSummaryOptions } from './providerHealth';
|
|
110
110
|
export type { VoiceProviderCapabilityDefinition, VoiceProviderCapabilityHandlerOptions, VoiceProviderCapabilityHTMLHandlerOptions, VoiceProviderCapabilityKind, VoiceProviderCapabilityOptions, VoiceProviderCapabilityReport, VoiceProviderCapabilityRoutesOptions, VoiceProviderCapabilitySummary } from './providerCapabilities';
|
|
111
|
-
export type { VoiceProviderRoutingContractDefinition, VoiceProviderRoutingContractIssue, VoiceProviderRoutingContractReport, VoiceProviderRoutingContractRunOptions, VoiceProviderRoutingExpectation, VoiceProviderRoutingStatus } from './providerRoutingContract';
|
|
111
|
+
export type { VoiceProviderRoutingContractAssertionInput, VoiceProviderRoutingContractAssertionReport, VoiceProviderRoutingContractDefinition, VoiceProviderRoutingContractIssue, VoiceProviderRoutingContractReport, VoiceProviderRoutingContractRunOptions, VoiceProviderRoutingExpectation, VoiceProviderRoutingStatus } from './providerRoutingContract';
|
|
112
112
|
export type { VoiceProviderSloAssertionInput, VoiceProviderSloAssertionReport, VoiceProviderSloIssue, VoiceProviderSloKindReport, VoiceProviderSloMetric, VoiceProviderSloReport, VoiceProviderSloReportOptions, VoiceProviderSloRoutesOptions, VoiceProviderSloSessionReport, VoiceProviderSloStatus, VoiceProviderSloThresholdConfig, VoiceProviderSloThresholds } from './providerSlo';
|
|
113
113
|
export type { VoiceTurnLatencyHTMLHandlerOptions, VoiceTurnLatencyItem, VoiceTurnLatencyOptions, VoiceTurnLatencyReport, VoiceTurnLatencyRoutesOptions, VoiceTurnLatencyStage, VoiceTurnLatencyStatus } from './turnLatency';
|
|
114
114
|
export type { VoiceLiveLatencyOptions, VoiceLiveLatencyReport, VoiceLiveLatencyRoutesOptions, VoiceLiveLatencySample, VoiceLiveLatencyStatus } from './liveLatency';
|
|
@@ -131,7 +131,7 @@ export type { VoiceQualityLink, VoiceQualityMetric, VoiceQualityReport, VoiceQua
|
|
|
131
131
|
export type { VoiceResilienceIOSimulator, VoiceResilienceLink, VoiceResiliencePageData, VoiceResilienceRoutesOptions, VoiceResilienceSimulationProvider, VoiceRoutingKindSummary, VoiceRoutingDecisionSummary, VoiceRoutingDecisionSummaryOptions, VoiceRoutingEvent, VoiceRoutingEventKind, VoiceRoutingSessionSummary, VoiceRoutingSessionSummaryOptions } from './resilienceRoutes';
|
|
132
132
|
export type { VoiceIOProviderRouterEvent, VoiceIOProviderRouterOptions, VoiceIOProviderRouterPolicy, VoiceIOProviderRouterPolicyConfig, VoiceSTTProviderRouterOptions, VoiceTTSProviderRouterOptions } from './providerAdapters';
|
|
133
133
|
export type { VoiceAgent, VoiceAgentMessage, VoiceAgentMessageRole, VoiceAgentModel, VoiceAgentModelInput, VoiceAgentModelOutput, VoiceAgentOptions, VoiceAgentRunResult, VoiceAgentSquadContextPolicyResult, VoiceAgentSquadHandoffPolicyResult, VoiceAgentSquadHandoffStatus, VoiceAgentSquadOptions, VoiceAgentSquadState, VoiceAgentSquadStateHandoff, VoiceAgentTool, VoiceAgentToolCall, VoiceAgentToolResult } from './agent';
|
|
134
|
-
export type { VoiceAgentSquadContractDefinition, VoiceAgentSquadContractIssue, VoiceAgentSquadContractOutcome, VoiceAgentSquadContractReport, VoiceAgentSquadContractRunOptions, VoiceAgentSquadContractTurn, VoiceAgentSquadContractTurnReport, VoiceAgentSquadHandoffExpectation, VoiceAgentSquadTurnExpectation } from './agentSquadContract';
|
|
134
|
+
export type { VoiceAgentSquadContractAssertionInput, VoiceAgentSquadContractAssertionReport, VoiceAgentSquadContractDefinition, VoiceAgentSquadContractIssue, VoiceAgentSquadContractOutcome, VoiceAgentSquadContractReport, VoiceAgentSquadContractRunOptions, VoiceAgentSquadContractTurn, VoiceAgentSquadContractTurnReport, VoiceAgentSquadHandoffExpectation, VoiceAgentSquadTurnExpectation } from './agentSquadContract';
|
|
135
135
|
export type { VoiceToolRetryDelay, VoiceToolRuntime, VoiceToolRuntimeExecuteInput, VoiceToolRuntimeOptions, VoiceToolRuntimeResult } from './toolRuntime';
|
|
136
136
|
export type { VoiceToolContractCase, VoiceToolContractCaseReport, VoiceToolContractDefinition, VoiceToolContractExpectation, VoiceToolContractHandlerOptions, VoiceToolContractHTMLHandlerOptions, VoiceToolContractIssue, VoiceToolContractReport, VoiceToolContractRoutesOptions, VoiceToolContractSuiteReport } from './toolContract';
|
|
137
137
|
export type { VoiceOpsRuntime, VoiceOpsRuntimeConfig, VoiceOpsRuntimeSummary, VoiceOpsRuntimeSinkWorkerConfig, VoiceOpsRuntimeTaskWorkerConfig, VoiceOpsRuntimeTickResult, VoiceOpsRuntimeWebhookWorkerConfig } from './opsRuntime';
|
package/dist/index.js
CHANGED
|
@@ -15983,6 +15983,91 @@ var assertVoiceAgentSquadContract = async (options) => {
|
|
|
15983
15983
|
}
|
|
15984
15984
|
return report;
|
|
15985
15985
|
};
|
|
15986
|
+
var evaluateVoiceAgentSquadContractEvidence = (reports, input = {}) => {
|
|
15987
|
+
const issues = [];
|
|
15988
|
+
const maxFailed = input.maxFailed ?? 0;
|
|
15989
|
+
const maxIssues = input.maxIssues ?? 0;
|
|
15990
|
+
const maxBlockedHandoffs = input.maxBlockedHandoffs ?? Infinity;
|
|
15991
|
+
const allHandoffs = reports.flatMap((report) => report.turns.flatMap((turn) => turn.handoffs));
|
|
15992
|
+
const contractIds = [...new Set(reports.map((report) => report.contractId))].sort();
|
|
15993
|
+
const scenarioIds = [
|
|
15994
|
+
...new Set(reports.map((report) => report.scenarioId).filter((scenarioId) => Boolean(scenarioId)))
|
|
15995
|
+
].sort();
|
|
15996
|
+
const finalAgentIds = [
|
|
15997
|
+
...new Set(reports.flatMap((report) => report.turns.map((turn) => turn.agentId)))
|
|
15998
|
+
].sort();
|
|
15999
|
+
const handoffTargets = [
|
|
16000
|
+
...new Set(allHandoffs.map((handoff) => handoff.targetAgentId).filter((target) => Boolean(target)))
|
|
16001
|
+
].sort();
|
|
16002
|
+
const handoffStatuses = [
|
|
16003
|
+
...new Set(allHandoffs.map((handoff) => handoff.status).filter((status) => status !== undefined))
|
|
16004
|
+
].sort();
|
|
16005
|
+
const failed = reports.filter((report) => !report.pass).length;
|
|
16006
|
+
const issueCount = reports.reduce((total, report) => total + report.issues.length, 0);
|
|
16007
|
+
const blockedHandoffs = allHandoffs.filter((handoff) => handoff.status === "blocked").length;
|
|
16008
|
+
if (input.minContracts !== undefined && reports.length < input.minContracts) {
|
|
16009
|
+
issues.push(`Expected at least ${String(input.minContracts)} agent squad contract(s), found ${String(reports.length)}.`);
|
|
16010
|
+
}
|
|
16011
|
+
if (failed > maxFailed) {
|
|
16012
|
+
issues.push(`Expected at most ${String(maxFailed)} failing agent squad contract(s), found ${String(failed)}.`);
|
|
16013
|
+
}
|
|
16014
|
+
if (issueCount > maxIssues) {
|
|
16015
|
+
issues.push(`Expected at most ${String(maxIssues)} agent squad contract issue(s), found ${String(issueCount)}.`);
|
|
16016
|
+
}
|
|
16017
|
+
if (input.minHandoffs !== undefined && allHandoffs.length < input.minHandoffs) {
|
|
16018
|
+
issues.push(`Expected at least ${String(input.minHandoffs)} agent squad handoff(s), found ${String(allHandoffs.length)}.`);
|
|
16019
|
+
}
|
|
16020
|
+
if (blockedHandoffs > maxBlockedHandoffs) {
|
|
16021
|
+
issues.push(`Expected at most ${String(maxBlockedHandoffs)} blocked agent squad handoff(s), found ${String(blockedHandoffs)}.`);
|
|
16022
|
+
}
|
|
16023
|
+
for (const contractId of input.requiredContractIds ?? []) {
|
|
16024
|
+
if (!contractIds.includes(contractId)) {
|
|
16025
|
+
issues.push(`Missing agent squad contract: ${contractId}.`);
|
|
16026
|
+
}
|
|
16027
|
+
}
|
|
16028
|
+
for (const scenarioId of input.requiredScenarioIds ?? []) {
|
|
16029
|
+
if (!scenarioIds.includes(scenarioId)) {
|
|
16030
|
+
issues.push(`Missing agent squad scenario: ${scenarioId}.`);
|
|
16031
|
+
}
|
|
16032
|
+
}
|
|
16033
|
+
for (const agentId of input.requiredFinalAgentIds ?? []) {
|
|
16034
|
+
if (!finalAgentIds.includes(agentId)) {
|
|
16035
|
+
issues.push(`Missing final agent: ${agentId}.`);
|
|
16036
|
+
}
|
|
16037
|
+
}
|
|
16038
|
+
for (const target of input.requiredHandoffTargets ?? []) {
|
|
16039
|
+
if (!handoffTargets.includes(target)) {
|
|
16040
|
+
issues.push(`Missing agent squad handoff target: ${target}.`);
|
|
16041
|
+
}
|
|
16042
|
+
}
|
|
16043
|
+
for (const status of input.requiredHandoffStatuses ?? []) {
|
|
16044
|
+
if (!handoffStatuses.includes(status)) {
|
|
16045
|
+
issues.push(`Missing agent squad handoff status: ${status}.`);
|
|
16046
|
+
}
|
|
16047
|
+
}
|
|
16048
|
+
return {
|
|
16049
|
+
blockedHandoffs,
|
|
16050
|
+
contractIds,
|
|
16051
|
+
failed,
|
|
16052
|
+
finalAgentIds,
|
|
16053
|
+
handoffStatuses,
|
|
16054
|
+
handoffTargets,
|
|
16055
|
+
handoffs: allHandoffs.length,
|
|
16056
|
+
issues,
|
|
16057
|
+
issueCount,
|
|
16058
|
+
ok: issues.length === 0,
|
|
16059
|
+
passed: reports.length - failed,
|
|
16060
|
+
scenarioIds,
|
|
16061
|
+
total: reports.length
|
|
16062
|
+
};
|
|
16063
|
+
};
|
|
16064
|
+
var assertVoiceAgentSquadContractEvidence = (reports, input = {}) => {
|
|
16065
|
+
const report = evaluateVoiceAgentSquadContractEvidence(reports, input);
|
|
16066
|
+
if (!report.ok) {
|
|
16067
|
+
throw new Error(`Voice agent squad contract evidence assertion failed: ${report.issues.join(" ")}`);
|
|
16068
|
+
}
|
|
16069
|
+
return report;
|
|
16070
|
+
};
|
|
15986
16071
|
// src/turnLatency.ts
|
|
15987
16072
|
import { Elysia as Elysia25 } from "elysia";
|
|
15988
16073
|
var DEFAULT_WARN_AFTER_MS = 1800;
|
|
@@ -22146,6 +22231,110 @@ var assertVoiceProviderRoutingContract = async (options) => {
|
|
|
22146
22231
|
}
|
|
22147
22232
|
return report;
|
|
22148
22233
|
};
|
|
22234
|
+
var evaluateVoiceProviderRoutingContractEvidence = (reports, input = {}) => {
|
|
22235
|
+
const issues = [];
|
|
22236
|
+
const maxFailed = input.maxFailed ?? 0;
|
|
22237
|
+
const maxIssues = input.maxIssues ?? 0;
|
|
22238
|
+
const events = reports.flatMap((report) => report.events);
|
|
22239
|
+
const contractIds = [...new Set(reports.map((report) => report.contractId))].sort();
|
|
22240
|
+
const scenarioIds = [
|
|
22241
|
+
...new Set(reports.map((report) => report.scenarioId).filter((scenarioId) => Boolean(scenarioId)))
|
|
22242
|
+
].sort();
|
|
22243
|
+
const kinds = [...new Set(events.map((event) => event.kind))].sort();
|
|
22244
|
+
const operations = [
|
|
22245
|
+
...new Set(events.map((event) => event.operation).filter((operation) => Boolean(operation)))
|
|
22246
|
+
].sort();
|
|
22247
|
+
const providers = [
|
|
22248
|
+
...new Set(events.map((event) => event.provider).filter((provider) => Boolean(provider)))
|
|
22249
|
+
].sort();
|
|
22250
|
+
const selectedProviders = [
|
|
22251
|
+
...new Set(events.map((event) => event.selectedProvider).filter((provider) => Boolean(provider)))
|
|
22252
|
+
].sort();
|
|
22253
|
+
const fallbackProviders = [
|
|
22254
|
+
...new Set(events.map((event) => event.fallbackProvider).filter((provider) => Boolean(provider)))
|
|
22255
|
+
].sort();
|
|
22256
|
+
const statuses = [
|
|
22257
|
+
...new Set(events.map((event) => event.status).filter((status) => status !== undefined))
|
|
22258
|
+
].sort();
|
|
22259
|
+
const failed = reports.filter((report) => !report.pass).length;
|
|
22260
|
+
const issueCount = reports.reduce((total, report) => total + report.issues.length, 0);
|
|
22261
|
+
if (input.minContracts !== undefined && reports.length < input.minContracts) {
|
|
22262
|
+
issues.push(`Expected at least ${String(input.minContracts)} provider routing contract(s), found ${String(reports.length)}.`);
|
|
22263
|
+
}
|
|
22264
|
+
if (failed > maxFailed) {
|
|
22265
|
+
issues.push(`Expected at most ${String(maxFailed)} failing provider routing contract(s), found ${String(failed)}.`);
|
|
22266
|
+
}
|
|
22267
|
+
if (issueCount > maxIssues) {
|
|
22268
|
+
issues.push(`Expected at most ${String(maxIssues)} provider routing contract issue(s), found ${String(issueCount)}.`);
|
|
22269
|
+
}
|
|
22270
|
+
if (input.minEvents !== undefined && events.length < input.minEvents) {
|
|
22271
|
+
issues.push(`Expected at least ${String(input.minEvents)} provider routing event(s), found ${String(events.length)}.`);
|
|
22272
|
+
}
|
|
22273
|
+
for (const contractId of input.requiredContractIds ?? []) {
|
|
22274
|
+
if (!contractIds.includes(contractId)) {
|
|
22275
|
+
issues.push(`Missing provider routing contract: ${contractId}.`);
|
|
22276
|
+
}
|
|
22277
|
+
}
|
|
22278
|
+
for (const scenarioId of input.requiredScenarioIds ?? []) {
|
|
22279
|
+
if (!scenarioIds.includes(scenarioId)) {
|
|
22280
|
+
issues.push(`Missing provider routing scenario: ${scenarioId}.`);
|
|
22281
|
+
}
|
|
22282
|
+
}
|
|
22283
|
+
for (const kind of input.requiredKinds ?? []) {
|
|
22284
|
+
if (!kinds.includes(kind)) {
|
|
22285
|
+
issues.push(`Missing provider routing kind: ${kind}.`);
|
|
22286
|
+
}
|
|
22287
|
+
}
|
|
22288
|
+
for (const operation of input.requiredOperations ?? []) {
|
|
22289
|
+
if (!operations.includes(operation)) {
|
|
22290
|
+
issues.push(`Missing provider routing operation: ${operation}.`);
|
|
22291
|
+
}
|
|
22292
|
+
}
|
|
22293
|
+
for (const provider of input.requiredProviders ?? []) {
|
|
22294
|
+
if (!providers.includes(provider)) {
|
|
22295
|
+
issues.push(`Missing provider routing provider: ${provider}.`);
|
|
22296
|
+
}
|
|
22297
|
+
}
|
|
22298
|
+
for (const provider of input.requiredSelectedProviders ?? []) {
|
|
22299
|
+
if (!selectedProviders.includes(provider)) {
|
|
22300
|
+
issues.push(`Missing selected provider: ${provider}.`);
|
|
22301
|
+
}
|
|
22302
|
+
}
|
|
22303
|
+
for (const provider of input.requiredFallbackProviders ?? []) {
|
|
22304
|
+
if (!fallbackProviders.includes(provider)) {
|
|
22305
|
+
issues.push(`Missing fallback provider: ${provider}.`);
|
|
22306
|
+
}
|
|
22307
|
+
}
|
|
22308
|
+
for (const status of input.requiredStatuses ?? []) {
|
|
22309
|
+
if (!statuses.includes(status)) {
|
|
22310
|
+
issues.push(`Missing provider routing status: ${status}.`);
|
|
22311
|
+
}
|
|
22312
|
+
}
|
|
22313
|
+
return {
|
|
22314
|
+
contractIds,
|
|
22315
|
+
events: events.length,
|
|
22316
|
+
failed,
|
|
22317
|
+
fallbackProviders,
|
|
22318
|
+
issues,
|
|
22319
|
+
issueCount,
|
|
22320
|
+
kinds,
|
|
22321
|
+
ok: issues.length === 0,
|
|
22322
|
+
operations,
|
|
22323
|
+
passed: reports.length - failed,
|
|
22324
|
+
providers,
|
|
22325
|
+
scenarioIds,
|
|
22326
|
+
selectedProviders,
|
|
22327
|
+
statuses,
|
|
22328
|
+
total: reports.length
|
|
22329
|
+
};
|
|
22330
|
+
};
|
|
22331
|
+
var assertVoiceProviderRoutingContractEvidence = (reports, input = {}) => {
|
|
22332
|
+
const report = evaluateVoiceProviderRoutingContractEvidence(reports, input);
|
|
22333
|
+
if (!report.ok) {
|
|
22334
|
+
throw new Error(`Voice provider routing contract evidence assertion failed: ${report.issues.join(" ")}`);
|
|
22335
|
+
}
|
|
22336
|
+
return report;
|
|
22337
|
+
};
|
|
22149
22338
|
// src/providerSlo.ts
|
|
22150
22339
|
import { Elysia as Elysia37 } from "elysia";
|
|
22151
22340
|
var defaultThresholds = {
|
|
@@ -30511,6 +30700,7 @@ export {
|
|
|
30511
30700
|
evaluateVoiceProviderStackGaps,
|
|
30512
30701
|
evaluateVoiceProviderStackEvidence,
|
|
30513
30702
|
evaluateVoiceProviderSloEvidence,
|
|
30703
|
+
evaluateVoiceProviderRoutingContractEvidence,
|
|
30514
30704
|
evaluateVoiceProviderContractMatrixEvidence,
|
|
30515
30705
|
evaluateVoiceProofTrendEvidence,
|
|
30516
30706
|
evaluateVoiceProductionReadinessEvidence,
|
|
@@ -30519,6 +30709,7 @@ export {
|
|
|
30519
30709
|
evaluateVoiceObservabilityExportReplayEvidence,
|
|
30520
30710
|
evaluateVoiceObservabilityExportDeliveryEvidence,
|
|
30521
30711
|
evaluateVoiceGuardrailPolicy,
|
|
30712
|
+
evaluateVoiceAgentSquadContractEvidence,
|
|
30522
30713
|
encodeTwilioMulawBase64,
|
|
30523
30714
|
deliverVoiceTraceEventsToSinks,
|
|
30524
30715
|
deliverVoiceObservabilityExport,
|
|
@@ -30832,6 +31023,7 @@ export {
|
|
|
30832
31023
|
assignVoiceOpsTask,
|
|
30833
31024
|
assertVoiceProviderStackEvidence,
|
|
30834
31025
|
assertVoiceProviderSloEvidence,
|
|
31026
|
+
assertVoiceProviderRoutingContractEvidence,
|
|
30835
31027
|
assertVoiceProviderRoutingContract,
|
|
30836
31028
|
assertVoiceProviderContractMatrixEvidence,
|
|
30837
31029
|
assertVoiceProofTrendEvidence,
|
|
@@ -30843,6 +31035,7 @@ export {
|
|
|
30843
31035
|
assertVoiceObservabilityExportRecord,
|
|
30844
31036
|
assertVoiceObservabilityExportDeliveryEvidence,
|
|
30845
31037
|
assertVoiceLatencySLOGate,
|
|
31038
|
+
assertVoiceAgentSquadContractEvidence,
|
|
30846
31039
|
assertVoiceAgentSquadContract,
|
|
30847
31040
|
applyVoiceTelephonyOutcome,
|
|
30848
31041
|
applyVoiceOpsTaskPolicy,
|
|
@@ -34,5 +34,38 @@ export type VoiceProviderRoutingContractRunOptions = {
|
|
|
34
34
|
events?: StoredVoiceTraceEvent[] | VoiceRoutingEvent[];
|
|
35
35
|
store?: VoiceTraceEventStore;
|
|
36
36
|
};
|
|
37
|
+
export type VoiceProviderRoutingContractAssertionInput = {
|
|
38
|
+
maxFailed?: number;
|
|
39
|
+
maxIssues?: number;
|
|
40
|
+
minContracts?: number;
|
|
41
|
+
minEvents?: number;
|
|
42
|
+
requiredContractIds?: string[];
|
|
43
|
+
requiredFallbackProviders?: string[];
|
|
44
|
+
requiredKinds?: VoiceRoutingEventKind[];
|
|
45
|
+
requiredOperations?: string[];
|
|
46
|
+
requiredProviders?: string[];
|
|
47
|
+
requiredScenarioIds?: string[];
|
|
48
|
+
requiredSelectedProviders?: string[];
|
|
49
|
+
requiredStatuses?: VoiceProviderRoutingStatus[];
|
|
50
|
+
};
|
|
51
|
+
export type VoiceProviderRoutingContractAssertionReport = {
|
|
52
|
+
contractIds: string[];
|
|
53
|
+
events: number;
|
|
54
|
+
failed: number;
|
|
55
|
+
fallbackProviders: string[];
|
|
56
|
+
issues: string[];
|
|
57
|
+
issueCount: number;
|
|
58
|
+
kinds: VoiceRoutingEventKind[];
|
|
59
|
+
ok: boolean;
|
|
60
|
+
operations: string[];
|
|
61
|
+
passed: number;
|
|
62
|
+
providers: string[];
|
|
63
|
+
scenarioIds: string[];
|
|
64
|
+
selectedProviders: string[];
|
|
65
|
+
statuses: VoiceProviderRoutingStatus[];
|
|
66
|
+
total: number;
|
|
67
|
+
};
|
|
37
68
|
export declare const runVoiceProviderRoutingContract: (options: VoiceProviderRoutingContractRunOptions) => Promise<VoiceProviderRoutingContractReport>;
|
|
38
69
|
export declare const assertVoiceProviderRoutingContract: (options: VoiceProviderRoutingContractRunOptions) => Promise<VoiceProviderRoutingContractReport>;
|
|
70
|
+
export declare const evaluateVoiceProviderRoutingContractEvidence: (reports: readonly VoiceProviderRoutingContractReport[], input?: VoiceProviderRoutingContractAssertionInput) => VoiceProviderRoutingContractAssertionReport;
|
|
71
|
+
export declare const assertVoiceProviderRoutingContractEvidence: (reports: readonly VoiceProviderRoutingContractReport[], input?: VoiceProviderRoutingContractAssertionInput) => VoiceProviderRoutingContractAssertionReport;
|