@absolutejs/voice 0.0.22-beta.42 → 0.0.22-beta.421
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 +3690 -55
- package/dist/agent.d.ts +62 -0
- package/dist/agentSquadContract.d.ts +98 -0
- package/dist/angular/index.d.ts +19 -0
- package/dist/angular/index.js +4647 -1140
- package/dist/angular/voice-agent-squad-status.service.d.ts +12 -0
- package/dist/angular/voice-call-debugger.service.d.ts +12 -0
- package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
- package/dist/angular/voice-controller.service.d.ts +1 -0
- package/dist/angular/voice-delivery-runtime.component.d.ts +17 -0
- package/dist/angular/voice-delivery-runtime.service.d.ts +16 -0
- package/dist/angular/voice-live-ops.service.d.ts +11 -0
- package/dist/angular/voice-ops-action-center.service.d.ts +13 -0
- package/dist/angular/voice-ops-status.component.d.ts +15 -0
- package/dist/angular/voice-ops-status.service.d.ts +12 -0
- package/dist/angular/voice-platform-coverage.service.d.ts +12 -0
- package/dist/angular/voice-profile-comparison.service.d.ts +12 -0
- package/dist/angular/voice-proof-trends.service.d.ts +12 -0
- package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
- package/dist/angular/voice-provider-contracts.service.d.ts +12 -0
- package/dist/angular/voice-readiness-failures.service.d.ts +13 -0
- package/dist/angular/voice-routing-status.service.d.ts +11 -0
- package/dist/angular/voice-session-snapshot.service.d.ts +13 -0
- package/dist/angular/voice-stream.service.d.ts +2 -0
- package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
- package/dist/angular/voice-turn-latency.service.d.ts +13 -0
- package/dist/angular/voice-turn-quality.service.d.ts +12 -0
- package/dist/angular/voice-workflow-status.service.d.ts +12 -0
- package/dist/audit.d.ts +130 -0
- package/dist/auditDeliveryRoutes.d.ts +85 -0
- package/dist/auditExport.d.ts +34 -0
- package/dist/auditRoutes.d.ts +66 -0
- package/dist/auditSinks.d.ts +151 -0
- package/dist/bargeInRoutes.d.ts +56 -0
- package/dist/browserCallProfiles.d.ts +120 -0
- package/dist/browserMediaRoutes.d.ts +62 -0
- package/dist/callDebugger.d.ts +66 -0
- package/dist/campaign.d.ts +794 -0
- package/dist/campaignDialers.d.ts +111 -0
- package/dist/client/actions.d.ts +94 -0
- package/dist/client/agentSquadStatus.d.ts +37 -0
- package/dist/client/agentSquadStatusWidget.d.ts +24 -0
- package/dist/client/bargeInMonitor.d.ts +7 -0
- package/dist/client/browserMedia.d.ts +8 -0
- package/dist/client/callDebugger.d.ts +19 -0
- package/dist/client/callDebuggerWidget.d.ts +30 -0
- package/dist/client/campaignDialerProof.d.ts +23 -0
- package/dist/client/deliveryRuntime.d.ts +34 -0
- package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
- package/dist/client/duplex.d.ts +1 -1
- package/dist/client/htmxBootstrap.js +950 -14
- package/dist/client/index.d.ts +87 -0
- package/dist/client/index.js +9890 -52
- package/dist/client/liveOps.d.ts +22 -0
- package/dist/client/liveOpsWidget.d.ts +23 -0
- package/dist/client/liveTurnLatency.d.ts +41 -0
- package/dist/client/opsActionCenter.d.ts +54 -0
- package/dist/client/opsActionCenterWidget.d.ts +29 -0
- package/dist/client/opsActionHistory.d.ts +19 -0
- package/dist/client/opsActionHistoryWidget.d.ts +11 -0
- package/dist/client/opsStatus.d.ts +19 -0
- package/dist/client/opsStatusWidget.d.ts +40 -0
- package/dist/client/platformCoverage.d.ts +19 -0
- package/dist/client/platformCoverageWidget.d.ts +37 -0
- package/dist/client/profileComparison.d.ts +19 -0
- package/dist/client/profileComparisonWidget.d.ts +41 -0
- package/dist/client/profileSwitchRecommendation.d.ts +19 -0
- package/dist/client/profileSwitchRecommendationWidget.d.ts +12 -0
- package/dist/client/proofTrends.d.ts +19 -0
- package/dist/client/proofTrendsWidget.d.ts +37 -0
- package/dist/client/providerCapabilities.d.ts +19 -0
- package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
- package/dist/client/providerContracts.d.ts +19 -0
- package/dist/client/providerContractsWidget.d.ts +37 -0
- package/dist/client/providerSimulationControls.d.ts +33 -0
- package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
- package/dist/client/providerStatusWidget.d.ts +32 -0
- package/dist/client/readinessFailures.d.ts +19 -0
- package/dist/client/readinessFailuresWidget.d.ts +42 -0
- package/dist/client/routingStatus.d.ts +19 -0
- package/dist/client/routingStatusWidget.d.ts +32 -0
- package/dist/client/sessionSnapshot.d.ts +21 -0
- package/dist/client/sessionSnapshotWidget.d.ts +33 -0
- package/dist/client/traceTimeline.d.ts +19 -0
- package/dist/client/traceTimelineWidget.d.ts +36 -0
- package/dist/client/turnLatency.d.ts +22 -0
- package/dist/client/turnLatencyWidget.d.ts +33 -0
- package/dist/client/turnQuality.d.ts +19 -0
- package/dist/client/turnQualityWidget.d.ts +32 -0
- package/dist/client/workflowStatus.d.ts +19 -0
- package/dist/competitiveCoverage.d.ts +141 -0
- package/dist/dataControl.d.ts +180 -0
- package/dist/deliveryRuntime.d.ts +158 -0
- package/dist/deliverySinkRoutes.d.ts +117 -0
- package/dist/demoReadyRoutes.d.ts +98 -0
- package/dist/evalRoutes.d.ts +136 -0
- package/dist/fileStore.d.ts +14 -2
- package/dist/guardrails.d.ts +128 -0
- package/dist/incidentBundle.d.ts +116 -0
- package/dist/index.d.ts +159 -18
- package/dist/index.js +34712 -6662
- package/dist/latencySlo.d.ts +56 -0
- package/dist/liveLatency.d.ts +78 -0
- package/dist/liveOps.d.ts +190 -0
- package/dist/mediaPipelineRoutes.d.ts +117 -0
- package/dist/modelAdapters.d.ts +54 -2
- package/dist/observabilityExport.d.ts +490 -0
- package/dist/openaiTTS.d.ts +18 -0
- package/dist/operationsRecord.d.ts +351 -0
- package/dist/opsActionAuditRoutes.d.ts +99 -0
- package/dist/opsConsoleRoutes.d.ts +3 -0
- package/dist/opsRecovery.d.ts +137 -0
- package/dist/opsStatus.d.ts +76 -0
- package/dist/opsStatusRoutes.d.ts +33 -0
- package/dist/outcomeContract.d.ts +146 -0
- package/dist/phoneAgent.d.ts +139 -0
- package/dist/phoneAgentProductionSmoke.d.ts +115 -0
- package/dist/platformCoverage.d.ts +91 -0
- package/dist/postCallAnalysis.d.ts +98 -0
- package/dist/postgresStore.d.ts +13 -2
- package/dist/productionReadiness.d.ts +698 -0
- package/dist/profileSwitchRecommendation.d.ts +350 -0
- package/dist/proofAssertions.d.ts +32 -0
- package/dist/proofPack.d.ts +206 -0
- package/dist/proofRunner.d.ts +79 -0
- package/dist/proofTrends.d.ts +715 -0
- package/dist/providerAdapters.d.ts +12 -1
- package/dist/providerCapabilities.d.ts +92 -0
- package/dist/providerDecisionTraces.d.ts +130 -0
- package/dist/providerOrchestration.d.ts +109 -0
- package/dist/providerRouterTraces.d.ts +35 -0
- package/dist/providerRoutingContract.d.ts +71 -0
- package/dist/providerSlo.d.ts +142 -0
- package/dist/providerStackRecommendations.d.ts +187 -0
- package/dist/queue.d.ts +9 -0
- package/dist/react/VoiceAgentSquadStatus.d.ts +5 -0
- package/dist/react/VoiceCallDebuggerLaunch.d.ts +6 -0
- package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
- package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
- package/dist/react/VoiceOpsStatus.d.ts +6 -0
- package/dist/react/VoicePlatformCoverage.d.ts +6 -0
- package/dist/react/VoiceProfileComparison.d.ts +6 -0
- package/dist/react/VoiceProfileSwitchRecommendation.d.ts +6 -0
- package/dist/react/VoiceProofTrends.d.ts +6 -0
- package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
- package/dist/react/VoiceProviderContracts.d.ts +6 -0
- package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
- package/dist/react/VoiceProviderStatus.d.ts +6 -0
- package/dist/react/VoiceReadinessFailures.d.ts +6 -0
- package/dist/react/VoiceRoutingStatus.d.ts +6 -0
- package/dist/react/VoiceSessionSnapshot.d.ts +6 -0
- package/dist/react/VoiceTraceTimeline.d.ts +6 -0
- package/dist/react/VoiceTurnLatency.d.ts +6 -0
- package/dist/react/VoiceTurnQuality.d.ts +6 -0
- package/dist/react/index.d.ts +40 -0
- package/dist/react/index.js +10624 -31
- package/dist/react/useVoiceAgentSquadStatus.d.ts +8 -0
- package/dist/react/useVoiceCallDebugger.d.ts +8 -0
- package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
- package/dist/react/useVoiceController.d.ts +2 -0
- package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
- package/dist/react/useVoiceLiveOps.d.ts +9 -0
- package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
- package/dist/react/useVoiceOpsStatus.d.ts +8 -0
- package/dist/react/useVoicePlatformCoverage.d.ts +8 -0
- package/dist/react/useVoiceProfileComparison.d.ts +8 -0
- package/dist/react/useVoiceProfileSwitchRecommendation.d.ts +8 -0
- package/dist/react/useVoiceProofTrends.d.ts +8 -0
- package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
- package/dist/react/useVoiceProviderContracts.d.ts +8 -0
- package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
- package/dist/react/useVoiceReadinessFailures.d.ts +8 -0
- package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/react/useVoiceSessionSnapshot.d.ts +9 -0
- package/dist/react/useVoiceStream.d.ts +2 -0
- package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
- package/dist/react/useVoiceTurnLatency.d.ts +9 -0
- package/dist/react/useVoiceTurnQuality.d.ts +8 -0
- package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
- package/dist/readinessProfiles.d.ts +38 -0
- package/dist/realtimeChannel.d.ts +136 -0
- package/dist/realtimeProviderContracts.d.ts +133 -0
- package/dist/reconnectContract.d.ts +88 -0
- package/dist/resilienceRoutes.d.ts +40 -0
- package/dist/sessionReplay.d.ts +12 -0
- package/dist/sessionSnapshot.d.ts +109 -0
- package/dist/simulationSuite.d.ts +143 -0
- package/dist/sloCalibration.d.ts +185 -0
- package/dist/sqliteStore.d.ts +13 -2
- package/dist/svelte/createVoiceAgentSquadStatus.d.ts +9 -0
- package/dist/svelte/createVoiceCallDebugger.d.ts +12 -0
- package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
- package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
- package/dist/svelte/createVoiceLiveOps.d.ts +13 -0
- package/dist/svelte/createVoiceOpsActionCenter.d.ts +10 -0
- package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
- package/dist/svelte/createVoicePlatformCoverage.d.ts +7 -0
- package/dist/svelte/createVoiceProfileComparison.d.ts +7 -0
- package/dist/svelte/createVoiceProofTrends.d.ts +7 -0
- package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
- package/dist/svelte/createVoiceProviderContracts.d.ts +10 -0
- package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
- package/dist/svelte/createVoiceProviderStatus.d.ts +4 -2
- package/dist/svelte/createVoiceReadinessFailures.d.ts +7 -0
- package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
- package/dist/svelte/createVoiceSessionSnapshot.d.ts +13 -0
- package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
- package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
- package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
- package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
- package/dist/svelte/index.d.ts +20 -0
- package/dist/svelte/index.js +6403 -460
- package/dist/telephony/contract.d.ts +61 -0
- package/dist/telephony/matrix.d.ts +97 -0
- package/dist/telephony/plivo.d.ts +303 -0
- package/dist/telephony/security.d.ts +182 -0
- package/dist/telephony/telnyx.d.ts +291 -0
- package/dist/telephony/twilio.d.ts +136 -2
- package/dist/telephonyMediaRoutes.d.ts +72 -0
- package/dist/telephonyOutcome.d.ts +273 -0
- package/dist/testing/index.js +5363 -163
- package/dist/testing/telephony.d.ts +25 -0
- package/dist/toolContract.d.ts +161 -0
- package/dist/toolRuntime.d.ts +50 -0
- package/dist/trace.d.ts +39 -1
- package/dist/traceDeliveryRoutes.d.ts +86 -0
- package/dist/traceTimeline.d.ts +97 -0
- package/dist/turnLatency.d.ts +95 -0
- package/dist/turnQuality.d.ts +94 -0
- package/dist/types.d.ts +157 -3
- package/dist/voiceMonitoring.d.ts +444 -0
- package/dist/vue/VoiceCallDebuggerLaunch.d.ts +68 -0
- package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
- package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
- package/dist/vue/VoiceOpsStatus.d.ts +30 -0
- package/dist/vue/VoicePlatformCoverage.d.ts +23 -0
- package/dist/vue/VoiceProofTrends.d.ts +21 -0
- package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
- package/dist/vue/VoiceProviderContracts.d.ts +21 -0
- package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
- package/dist/vue/VoiceProviderStatus.d.ts +51 -0
- package/dist/vue/VoiceReadinessFailures.d.ts +21 -0
- package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
- package/dist/vue/VoiceSessionSnapshot.d.ts +68 -0
- package/dist/vue/VoiceTurnLatency.d.ts +69 -0
- package/dist/vue/VoiceTurnQuality.d.ts +51 -0
- package/dist/vue/index.d.ts +35 -0
- package/dist/vue/index.js +10069 -56
- package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
- package/dist/vue/useVoiceCallDebugger.d.ts +10 -0
- package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
- package/dist/vue/useVoiceController.d.ts +2 -1
- package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
- package/dist/vue/useVoiceLiveOps.d.ts +9 -0
- package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
- package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
- package/dist/vue/useVoicePlatformCoverage.d.ts +9 -0
- package/dist/vue/useVoiceProfileComparison.d.ts +9 -0
- package/dist/vue/useVoiceProofTrends.d.ts +9 -0
- package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
- package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
- package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
- package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
- package/dist/vue/useVoiceReadinessFailures.d.ts +899 -0
- package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
- package/dist/vue/useVoiceSessionSnapshot.d.ts +10 -0
- package/dist/vue/useVoiceStream.d.ts +3 -1
- package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
- package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
- package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
- package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
- package/dist/workflowContract.d.ts +91 -0
- package/package.json +4 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type VoiceOperationsRecord } from '../operationsRecord';
|
|
2
|
+
import { type VoiceTraceEventStore } from '../trace';
|
|
1
3
|
export type VoiceTelephonyBenchmarkScenario = {
|
|
2
4
|
expectClear: boolean;
|
|
3
5
|
expectMark: boolean;
|
|
@@ -40,9 +42,32 @@ export type VoiceTelephonyBenchmarkReport = {
|
|
|
40
42
|
generatedAt: number;
|
|
41
43
|
summary: VoiceTelephonyBenchmarkSummary;
|
|
42
44
|
};
|
|
45
|
+
export type VoiceTelephonyMediaOperationsSmokeOptions = {
|
|
46
|
+
callSid?: string;
|
|
47
|
+
operationsRecordHref?: string | ((input: {
|
|
48
|
+
sessionId: string;
|
|
49
|
+
streamSid: string;
|
|
50
|
+
}) => string);
|
|
51
|
+
scenarioId?: string;
|
|
52
|
+
sessionId?: string;
|
|
53
|
+
store?: VoiceTraceEventStore;
|
|
54
|
+
streamSid?: string;
|
|
55
|
+
timeoutMs?: number;
|
|
56
|
+
};
|
|
57
|
+
export type VoiceTelephonyMediaOperationsSmokeReport = {
|
|
58
|
+
issues: string[];
|
|
59
|
+
ok: boolean;
|
|
60
|
+
operationsRecord: VoiceOperationsRecord;
|
|
61
|
+
operationsRecordHref?: string;
|
|
62
|
+
sentEvents: string[];
|
|
63
|
+
sessionId: string;
|
|
64
|
+
streamSid: string;
|
|
65
|
+
telephonyMedia: VoiceOperationsRecord['telephonyMedia'];
|
|
66
|
+
};
|
|
43
67
|
type VoiceTelephonyBenchmarkOptions = {
|
|
44
68
|
timeoutMs?: number;
|
|
45
69
|
};
|
|
70
|
+
export declare const runVoiceTelephonyMediaOperationsSmoke: (options?: VoiceTelephonyMediaOperationsSmokeOptions) => Promise<VoiceTelephonyMediaOperationsSmokeReport>;
|
|
46
71
|
export declare const getDefaultVoiceTelephonyBenchmarkScenarios: () => {
|
|
47
72
|
expectClear: boolean;
|
|
48
73
|
expectMark: boolean;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { VoiceAgentTool } from './agent';
|
|
3
|
+
import { type VoiceToolRuntimeOptions } from './toolRuntime';
|
|
4
|
+
import type { VoiceSessionRecord, VoiceTurnRecord } from './types';
|
|
5
|
+
export type VoiceToolContractExpectation = {
|
|
6
|
+
expectedAttempts?: number;
|
|
7
|
+
expectedErrorIncludes?: string;
|
|
8
|
+
expectedResult?: unknown;
|
|
9
|
+
expectIdempotent?: boolean;
|
|
10
|
+
expectStatus?: 'error' | 'ok';
|
|
11
|
+
expectTimedOut?: boolean;
|
|
12
|
+
maxElapsedMs?: number;
|
|
13
|
+
};
|
|
14
|
+
export type VoiceToolContractCase<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TArgs = Record<string, unknown>, TToolResult = unknown, TRouteResult = unknown> = {
|
|
15
|
+
args: TArgs;
|
|
16
|
+
context?: TContext;
|
|
17
|
+
expect?: VoiceToolContractExpectation;
|
|
18
|
+
id: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
runtime?: VoiceToolRuntimeOptions<TContext, TSession, TRouteResult>;
|
|
21
|
+
session?: TSession;
|
|
22
|
+
toolCallId?: string;
|
|
23
|
+
turn?: VoiceTurnRecord;
|
|
24
|
+
};
|
|
25
|
+
export type VoiceToolContractDefinition<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TArgs = Record<string, unknown>, TToolResult = unknown, TRouteResult = unknown> = {
|
|
26
|
+
cases: Array<VoiceToolContractCase<TContext, TSession, TArgs, TToolResult, TRouteResult>>;
|
|
27
|
+
defaultRuntime?: VoiceToolRuntimeOptions<TContext, TSession, TRouteResult>;
|
|
28
|
+
description?: string;
|
|
29
|
+
id: string;
|
|
30
|
+
label?: string;
|
|
31
|
+
tool: VoiceAgentTool<TContext, TSession, TArgs, TToolResult, TRouteResult>;
|
|
32
|
+
};
|
|
33
|
+
export type VoiceToolContractIssue = {
|
|
34
|
+
caseId: string;
|
|
35
|
+
code: string;
|
|
36
|
+
message: string;
|
|
37
|
+
};
|
|
38
|
+
export type VoiceToolContractCaseReport = {
|
|
39
|
+
attempts: number;
|
|
40
|
+
caseId: string;
|
|
41
|
+
elapsedMs: number;
|
|
42
|
+
error?: string;
|
|
43
|
+
issues: VoiceToolContractIssue[];
|
|
44
|
+
label?: string;
|
|
45
|
+
operationsRecordHref?: string;
|
|
46
|
+
pass: boolean;
|
|
47
|
+
sessionId: string;
|
|
48
|
+
status: 'error' | 'ok';
|
|
49
|
+
timedOut: boolean;
|
|
50
|
+
};
|
|
51
|
+
export type VoiceToolContractReport = {
|
|
52
|
+
cases: VoiceToolContractCaseReport[];
|
|
53
|
+
contractId: string;
|
|
54
|
+
label?: string;
|
|
55
|
+
issues: VoiceToolContractIssue[];
|
|
56
|
+
pass: boolean;
|
|
57
|
+
toolName: string;
|
|
58
|
+
};
|
|
59
|
+
export type VoiceToolContractSuiteReport = {
|
|
60
|
+
checkedAt: number;
|
|
61
|
+
contracts: VoiceToolContractReport[];
|
|
62
|
+
failed: number;
|
|
63
|
+
passed: number;
|
|
64
|
+
status: 'fail' | 'pass';
|
|
65
|
+
total: number;
|
|
66
|
+
};
|
|
67
|
+
export type VoiceToolContractAssertionInput = {
|
|
68
|
+
maxFailed?: number;
|
|
69
|
+
maxIssues?: number;
|
|
70
|
+
maxTimedOut?: number;
|
|
71
|
+
minCases?: number;
|
|
72
|
+
minContracts?: number;
|
|
73
|
+
requireOperationRecordHrefs?: boolean;
|
|
74
|
+
requiredCaseStatuses?: Array<'error' | 'ok'>;
|
|
75
|
+
requiredContractIds?: string[];
|
|
76
|
+
requiredToolNames?: string[];
|
|
77
|
+
};
|
|
78
|
+
export type VoiceToolContractAssertionReport = {
|
|
79
|
+
caseStatuses: Array<'error' | 'ok'>;
|
|
80
|
+
cases: number;
|
|
81
|
+
contractIds: string[];
|
|
82
|
+
failed: number;
|
|
83
|
+
issues: string[];
|
|
84
|
+
issueCount: number;
|
|
85
|
+
missingOperationsRecordHrefs: number;
|
|
86
|
+
ok: boolean;
|
|
87
|
+
passed: number;
|
|
88
|
+
status: VoiceToolContractSuiteReport['status'];
|
|
89
|
+
timedOut: number;
|
|
90
|
+
toolNames: string[];
|
|
91
|
+
total: number;
|
|
92
|
+
};
|
|
93
|
+
export type VoiceToolContractHandlerOptions = {
|
|
94
|
+
contracts: VoiceToolContractDefinition[];
|
|
95
|
+
operationsRecordHref?: false | string | ((sessionId: string) => string);
|
|
96
|
+
};
|
|
97
|
+
export type VoiceToolContractHTMLHandlerOptions = VoiceToolContractHandlerOptions & {
|
|
98
|
+
headers?: HeadersInit;
|
|
99
|
+
render?: (report: VoiceToolContractSuiteReport) => string | Promise<string>;
|
|
100
|
+
title?: string;
|
|
101
|
+
};
|
|
102
|
+
export type VoiceToolContractRoutesOptions = VoiceToolContractHTMLHandlerOptions & {
|
|
103
|
+
htmlPath?: false | string;
|
|
104
|
+
name?: string;
|
|
105
|
+
path?: string;
|
|
106
|
+
};
|
|
107
|
+
export declare const runVoiceToolContract: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TArgs = Record<string, unknown>, TToolResult = unknown, TRouteResult = unknown>(definition: VoiceToolContractDefinition<TContext, TSession, TArgs, TToolResult, TRouteResult>, options?: Pick<VoiceToolContractHandlerOptions, "operationsRecordHref">) => Promise<VoiceToolContractReport>;
|
|
108
|
+
export declare const createVoiceToolContract: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TArgs = Record<string, unknown>, TToolResult = unknown, TRouteResult = unknown>(definition: VoiceToolContractDefinition<TContext, TSession, TArgs, TToolResult, TRouteResult>) => {
|
|
109
|
+
assert: () => Promise<VoiceToolContractReport>;
|
|
110
|
+
definition: VoiceToolContractDefinition<TContext, TSession, TArgs, TToolResult, TRouteResult>;
|
|
111
|
+
run: () => Promise<VoiceToolContractReport>;
|
|
112
|
+
};
|
|
113
|
+
export declare const createVoiceToolRuntimeContractDefaults: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRouteResult = unknown>() => VoiceToolRuntimeOptions<TContext, TSession, TRouteResult>;
|
|
114
|
+
export declare const runVoiceToolContractSuite: (options: VoiceToolContractHandlerOptions) => Promise<VoiceToolContractSuiteReport>;
|
|
115
|
+
export declare const evaluateVoiceToolContractEvidence: (report: VoiceToolContractSuiteReport, input?: VoiceToolContractAssertionInput) => VoiceToolContractAssertionReport;
|
|
116
|
+
export declare const assertVoiceToolContractEvidence: (report: VoiceToolContractSuiteReport, input?: VoiceToolContractAssertionInput) => VoiceToolContractAssertionReport;
|
|
117
|
+
export declare const renderVoiceToolContractHTML: (report: VoiceToolContractSuiteReport, options?: {
|
|
118
|
+
title?: string;
|
|
119
|
+
}) => string;
|
|
120
|
+
export declare const createVoiceToolContractJSONHandler: (options: VoiceToolContractHandlerOptions) => () => Promise<VoiceToolContractSuiteReport>;
|
|
121
|
+
export declare const createVoiceToolContractHTMLHandler: (options: VoiceToolContractHTMLHandlerOptions) => () => Promise<Response>;
|
|
122
|
+
export declare const createVoiceToolContractRoutes: (options: VoiceToolContractRoutesOptions) => Elysia<"", {
|
|
123
|
+
decorator: {};
|
|
124
|
+
store: {};
|
|
125
|
+
derive: {};
|
|
126
|
+
resolve: {};
|
|
127
|
+
}, {
|
|
128
|
+
typebox: {};
|
|
129
|
+
error: {};
|
|
130
|
+
}, {
|
|
131
|
+
schema: {};
|
|
132
|
+
standaloneSchema: {};
|
|
133
|
+
macro: {};
|
|
134
|
+
macroFn: {};
|
|
135
|
+
parser: {};
|
|
136
|
+
response: {};
|
|
137
|
+
}, {
|
|
138
|
+
[x: string]: {
|
|
139
|
+
get: {
|
|
140
|
+
body: unknown;
|
|
141
|
+
params: {};
|
|
142
|
+
query: unknown;
|
|
143
|
+
headers: unknown;
|
|
144
|
+
response: {
|
|
145
|
+
200: VoiceToolContractSuiteReport;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
}, {
|
|
150
|
+
derive: {};
|
|
151
|
+
resolve: {};
|
|
152
|
+
schema: {};
|
|
153
|
+
standaloneSchema: {};
|
|
154
|
+
response: {};
|
|
155
|
+
}, {
|
|
156
|
+
derive: {};
|
|
157
|
+
resolve: {};
|
|
158
|
+
schema: {};
|
|
159
|
+
standaloneSchema: {};
|
|
160
|
+
response: {};
|
|
161
|
+
}>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { VoiceAgentTool, VoiceAgentToolResult } from './agent';
|
|
2
|
+
import type { VoiceSessionHandle, VoiceSessionRecord, VoiceTurnRecord } from './types';
|
|
3
|
+
import type { VoiceTraceEventStore } from './trace';
|
|
4
|
+
export type VoiceToolRetryDelay = number | ((input: {
|
|
5
|
+
attempt: number;
|
|
6
|
+
error: unknown;
|
|
7
|
+
toolName: string;
|
|
8
|
+
}) => number);
|
|
9
|
+
export type VoiceToolRuntimeOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRouteResult = unknown> = {
|
|
10
|
+
idempotencyKey?: (input: {
|
|
11
|
+
args: unknown;
|
|
12
|
+
context: TContext;
|
|
13
|
+
session: TSession;
|
|
14
|
+
toolCallId?: string;
|
|
15
|
+
toolName: string;
|
|
16
|
+
turn: VoiceTurnRecord;
|
|
17
|
+
}) => string | undefined;
|
|
18
|
+
idempotencyTtlMs?: number;
|
|
19
|
+
maxRetries?: number;
|
|
20
|
+
retryDelayMs?: VoiceToolRetryDelay;
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
trace?: VoiceTraceEventStore;
|
|
23
|
+
};
|
|
24
|
+
export type VoiceToolRuntimeExecuteInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TArgs = Record<string, unknown>, TToolResult = unknown, TRouteResult = unknown> = {
|
|
25
|
+
api: VoiceSessionHandle<TContext, TSession, TRouteResult>;
|
|
26
|
+
args: TArgs;
|
|
27
|
+
context: TContext;
|
|
28
|
+
session: TSession;
|
|
29
|
+
tool: VoiceAgentTool<TContext, TSession, TArgs, TToolResult, TRouteResult>;
|
|
30
|
+
toolCallId?: string;
|
|
31
|
+
turn: VoiceTurnRecord;
|
|
32
|
+
};
|
|
33
|
+
export type VoiceToolRuntimeResult<TToolResult = unknown> = VoiceAgentToolResult<TToolResult> & {
|
|
34
|
+
attempts: number;
|
|
35
|
+
elapsedMs: number;
|
|
36
|
+
idempotencyKey?: string;
|
|
37
|
+
timedOut: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type VoiceToolRuntime<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRouteResult = unknown> = {
|
|
40
|
+
execute: <TArgs = Record<string, unknown>, TToolResult = unknown>(input: VoiceToolRuntimeExecuteInput<TContext, TSession, TArgs, TToolResult, TRouteResult>) => Promise<VoiceToolRuntimeResult<TToolResult>>;
|
|
41
|
+
wrapTool: <TArgs = Record<string, unknown>, TToolResult = unknown>(tool: VoiceAgentTool<TContext, TSession, TArgs, TToolResult, TRouteResult>) => VoiceAgentTool<TContext, TSession, TArgs, TToolResult, TRouteResult>;
|
|
42
|
+
};
|
|
43
|
+
export declare const createVoiceToolRuntime: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRouteResult = unknown>(options?: VoiceToolRuntimeOptions<TContext, TSession, TRouteResult>) => VoiceToolRuntime<TContext, TSession, TRouteResult>;
|
|
44
|
+
export declare const createVoiceToolIdempotencyKey: (input: {
|
|
45
|
+
args: unknown;
|
|
46
|
+
sessionId: string;
|
|
47
|
+
toolCallId?: string;
|
|
48
|
+
toolName: string;
|
|
49
|
+
turnId: string;
|
|
50
|
+
}) => string;
|
package/dist/trace.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { S3Client, S3Options } from 'bun';
|
|
2
|
+
export type VoiceTraceEventType = 'assistant.guardrail' | 'assistant.memory' | 'assistant.run' | 'agent.context' | 'agent.handoff' | 'agent.model' | 'agent.result' | 'agent.tool' | 'call.handoff' | 'call.lifecycle' | 'client.barge_in' | 'client.browser_media' | 'client.live_latency' | 'client.reconnect' | 'client.telephony_media' | 'operator.action' | 'provider.decision' | 'session.error' | 'turn.assistant' | 'turn.committed' | 'turn.cost' | 'turn_latency.stage' | 'turn.transcript' | 'workflow.contract';
|
|
2
3
|
export type VoiceTraceEvent<TPayload extends Record<string, unknown> = Record<string, unknown>> = {
|
|
3
4
|
at: number;
|
|
4
5
|
id?: string;
|
|
@@ -27,6 +28,12 @@ export type VoiceTraceEventStore<TEvent extends StoredVoiceTraceEvent = StoredVo
|
|
|
27
28
|
list: (filter?: VoiceTraceEventFilter) => Promise<TEvent[]>;
|
|
28
29
|
remove: (id: string) => Promise<void>;
|
|
29
30
|
};
|
|
31
|
+
export type VoiceScopedTraceEventStoreOptions = VoiceTraceEventFilter;
|
|
32
|
+
export type VoiceProofTraceStoreOptions<TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent> = {
|
|
33
|
+
mirrorStore?: VoiceTraceEventStore<TEvent>;
|
|
34
|
+
proofStore?: VoiceTraceEventStore<TEvent>;
|
|
35
|
+
scope?: VoiceScopedTraceEventStoreOptions;
|
|
36
|
+
};
|
|
30
37
|
export type VoiceTracePruneFilter = Omit<VoiceTraceEventFilter, 'limit'>;
|
|
31
38
|
export type VoiceTracePruneOptions = {
|
|
32
39
|
before?: number;
|
|
@@ -101,6 +108,22 @@ export type VoiceTraceHTTPSinkOptions<TBody extends Record<string, unknown> = Re
|
|
|
101
108
|
timeoutMs?: number;
|
|
102
109
|
url: string;
|
|
103
110
|
};
|
|
111
|
+
export type VoiceS3TraceSinkFile = {
|
|
112
|
+
write: (data: string, options?: BlobPropertyBag) => Promise<number> | number;
|
|
113
|
+
};
|
|
114
|
+
export type VoiceS3TraceSinkClient = Pick<S3Client, 'file'>;
|
|
115
|
+
export type VoiceTraceS3SinkOptions<TBody extends Record<string, unknown> = Record<string, unknown>> = S3Options & {
|
|
116
|
+
body?: (input: {
|
|
117
|
+
events: StoredVoiceTraceEvent[];
|
|
118
|
+
key: string;
|
|
119
|
+
}) => Promise<TBody> | TBody;
|
|
120
|
+
client?: VoiceS3TraceSinkClient;
|
|
121
|
+
contentType?: string;
|
|
122
|
+
eventTypes?: VoiceTraceEventType[];
|
|
123
|
+
id: string;
|
|
124
|
+
keyPrefix?: string;
|
|
125
|
+
kind?: string;
|
|
126
|
+
};
|
|
104
127
|
export type VoiceTraceSinkStoreOptions<TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent> = {
|
|
105
128
|
awaitDelivery?: boolean;
|
|
106
129
|
deliveryQueue?: VoiceTraceSinkDeliveryStore;
|
|
@@ -110,6 +133,17 @@ export type VoiceTraceSinkStoreOptions<TEvent extends StoredVoiceTraceEvent = St
|
|
|
110
133
|
sinks: VoiceTraceSink[];
|
|
111
134
|
store: VoiceTraceEventStore<TEvent>;
|
|
112
135
|
};
|
|
136
|
+
export type VoiceProfileTraceTaggerProfile = {
|
|
137
|
+
description?: string;
|
|
138
|
+
id: string;
|
|
139
|
+
label?: string;
|
|
140
|
+
};
|
|
141
|
+
export type VoiceProfileTraceTaggerOptions<TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent> = {
|
|
142
|
+
defaultProfile?: VoiceProfileTraceTaggerProfile | string;
|
|
143
|
+
profiles?: readonly VoiceProfileTraceTaggerProfile[];
|
|
144
|
+
resolveProfile?: (event: VoiceTraceEvent | TEvent) => Promise<VoiceProfileTraceTaggerProfile | string | undefined> | VoiceProfileTraceTaggerProfile | string | undefined;
|
|
145
|
+
store: VoiceTraceEventStore<TEvent>;
|
|
146
|
+
};
|
|
113
147
|
export type VoiceTraceSummary = {
|
|
114
148
|
assistantReplyCount: number;
|
|
115
149
|
callDurationMs?: number;
|
|
@@ -184,15 +218,19 @@ export declare const createVoiceTraceSinkDeliveryRecord: (input: {
|
|
|
184
218
|
id?: string;
|
|
185
219
|
} & Partial<Omit<VoiceTraceSinkDeliveryRecord, "createdAt" | "events" | "id">>) => VoiceTraceSinkDeliveryRecord;
|
|
186
220
|
export declare const filterVoiceTraceEvents: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(events: TEvent[], filter?: VoiceTraceEventFilter) => TEvent[];
|
|
221
|
+
export declare const createVoiceScopedTraceEventStore: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(store: VoiceTraceEventStore<TEvent>, scope: VoiceScopedTraceEventStoreOptions) => VoiceTraceEventStore<TEvent>;
|
|
222
|
+
export declare const createVoiceProofTraceStore: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(options?: VoiceProofTraceStoreOptions<TEvent>) => VoiceTraceEventStore<TEvent>;
|
|
187
223
|
export declare const selectVoiceTraceEventsForPrune: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(events: TEvent[], options?: Omit<VoiceTracePruneOptions, "store">) => TEvent[];
|
|
188
224
|
export declare const pruneVoiceTraceEvents: (options: VoiceTracePruneOptions) => Promise<VoiceTracePruneResult>;
|
|
189
225
|
export declare const createVoiceTraceHTTPSink: <TBody extends Record<string, unknown> = Record<string, unknown>>(options: VoiceTraceHTTPSinkOptions<TBody>) => VoiceTraceSink;
|
|
226
|
+
export declare const createVoiceTraceS3Sink: <TBody extends Record<string, unknown> = Record<string, unknown>>(options: VoiceTraceS3SinkOptions<TBody>) => VoiceTraceSink;
|
|
190
227
|
export declare const deliverVoiceTraceEventsToSinks: (input: {
|
|
191
228
|
events: StoredVoiceTraceEvent[];
|
|
192
229
|
redact?: VoiceTraceRedactionConfig;
|
|
193
230
|
sinks: VoiceTraceSink[];
|
|
194
231
|
}) => Promise<VoiceTraceSinkFanoutResult>;
|
|
195
232
|
export declare const createVoiceTraceSinkStore: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(options: VoiceTraceSinkStoreOptions<TEvent>) => VoiceTraceEventStore<TEvent>;
|
|
233
|
+
export declare const createVoiceProfileTraceTagger: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(options: VoiceProfileTraceTaggerOptions<TEvent>) => VoiceTraceEventStore<TEvent>;
|
|
196
234
|
export declare const createVoiceMemoryTraceSinkDeliveryStore: <TDelivery extends VoiceTraceSinkDeliveryRecord = VoiceTraceSinkDeliveryRecord>() => VoiceTraceSinkDeliveryStore<TDelivery>;
|
|
197
235
|
export declare const createVoiceMemoryTraceEventStore: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>() => VoiceTraceEventStore<TEvent>;
|
|
198
236
|
export declare const exportVoiceTrace: (input: {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import { type VoiceTraceSinkDeliveryQueueSummary, type VoiceTraceSinkDeliveryWorkerResult } from './queue';
|
|
3
|
+
import type { VoiceTraceSinkDeliveryQueueStatus, VoiceTraceSinkDeliveryRecord, VoiceTraceSinkDeliveryStore } from './trace';
|
|
4
|
+
export type VoiceTraceDeliveryReport = {
|
|
5
|
+
checkedAt: number;
|
|
6
|
+
deliveries: VoiceTraceSinkDeliveryRecord[];
|
|
7
|
+
filter: VoiceTraceDeliveryFilter;
|
|
8
|
+
summary: VoiceTraceSinkDeliveryQueueSummary;
|
|
9
|
+
};
|
|
10
|
+
export type VoiceTraceDeliveryDrainWorker = {
|
|
11
|
+
drain: () => Promise<VoiceTraceSinkDeliveryWorkerResult> | VoiceTraceSinkDeliveryWorkerResult;
|
|
12
|
+
};
|
|
13
|
+
export type VoiceTraceDeliveryDrainReport = VoiceTraceSinkDeliveryWorkerResult & {
|
|
14
|
+
drainedAt: number;
|
|
15
|
+
};
|
|
16
|
+
export type VoiceTraceDeliveryFilter = {
|
|
17
|
+
limit?: number;
|
|
18
|
+
q?: string;
|
|
19
|
+
status?: VoiceTraceSinkDeliveryQueueStatus | 'all';
|
|
20
|
+
};
|
|
21
|
+
export type VoiceTraceDeliveryRoutesOptions = {
|
|
22
|
+
deadLetters?: VoiceTraceSinkDeliveryStore;
|
|
23
|
+
filter?: VoiceTraceDeliveryFilter;
|
|
24
|
+
headers?: HeadersInit;
|
|
25
|
+
htmlPath?: false | string;
|
|
26
|
+
limit?: number;
|
|
27
|
+
name?: string;
|
|
28
|
+
path?: string;
|
|
29
|
+
render?: (report: VoiceTraceDeliveryReport) => string | Promise<string>;
|
|
30
|
+
store: VoiceTraceSinkDeliveryStore;
|
|
31
|
+
title?: string;
|
|
32
|
+
worker?: VoiceTraceDeliveryDrainWorker;
|
|
33
|
+
workerPath?: false | string;
|
|
34
|
+
};
|
|
35
|
+
export declare const resolveVoiceTraceDeliveryFilter: (query?: Record<string, unknown>, base?: VoiceTraceDeliveryFilter) => VoiceTraceDeliveryFilter;
|
|
36
|
+
export declare const buildVoiceTraceDeliveryReport: (options: VoiceTraceDeliveryRoutesOptions, filter?: VoiceTraceDeliveryFilter) => Promise<VoiceTraceDeliveryReport>;
|
|
37
|
+
export declare const renderVoiceTraceDeliveryHTML: (report: VoiceTraceDeliveryReport, options?: {
|
|
38
|
+
title?: string;
|
|
39
|
+
workerPath?: false | string;
|
|
40
|
+
}) => string;
|
|
41
|
+
export declare const createVoiceTraceDeliveryJSONHandler: (options: VoiceTraceDeliveryRoutesOptions) => ({ query }: {
|
|
42
|
+
query?: Record<string, string | undefined>;
|
|
43
|
+
}) => Promise<VoiceTraceDeliveryReport>;
|
|
44
|
+
export declare const createVoiceTraceDeliveryHTMLHandler: (options: VoiceTraceDeliveryRoutesOptions) => ({ query }: {
|
|
45
|
+
query?: Record<string, string | undefined>;
|
|
46
|
+
}) => Promise<Response>;
|
|
47
|
+
export declare const createVoiceTraceDeliveryRoutes: (options: VoiceTraceDeliveryRoutesOptions) => Elysia<"", {
|
|
48
|
+
decorator: {};
|
|
49
|
+
store: {};
|
|
50
|
+
derive: {};
|
|
51
|
+
resolve: {};
|
|
52
|
+
}, {
|
|
53
|
+
typebox: {};
|
|
54
|
+
error: {};
|
|
55
|
+
}, {
|
|
56
|
+
schema: {};
|
|
57
|
+
standaloneSchema: {};
|
|
58
|
+
macro: {};
|
|
59
|
+
macroFn: {};
|
|
60
|
+
parser: {};
|
|
61
|
+
response: {};
|
|
62
|
+
}, {
|
|
63
|
+
[x: string]: {
|
|
64
|
+
get: {
|
|
65
|
+
body: unknown;
|
|
66
|
+
params: {};
|
|
67
|
+
query: unknown;
|
|
68
|
+
headers: unknown;
|
|
69
|
+
response: {
|
|
70
|
+
200: VoiceTraceDeliveryReport;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
}, {
|
|
75
|
+
derive: {};
|
|
76
|
+
resolve: {};
|
|
77
|
+
schema: {};
|
|
78
|
+
standaloneSchema: {};
|
|
79
|
+
response: {};
|
|
80
|
+
}, {
|
|
81
|
+
derive: {};
|
|
82
|
+
resolve: {};
|
|
83
|
+
schema: {};
|
|
84
|
+
standaloneSchema: {};
|
|
85
|
+
response: {};
|
|
86
|
+
}>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import { evaluateVoiceTrace, type StoredVoiceTraceEvent, type VoiceTraceEvaluationOptions, type VoiceTraceEventStore, type VoiceTraceRedactionConfig, type VoiceTraceSummary } from './trace';
|
|
3
|
+
export type VoiceTraceTimelineEvent = {
|
|
4
|
+
at: number;
|
|
5
|
+
elapsedMs?: number;
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
offsetMs: number;
|
|
9
|
+
payload: Record<string, unknown>;
|
|
10
|
+
provider?: string;
|
|
11
|
+
status?: string;
|
|
12
|
+
turnId?: string;
|
|
13
|
+
type: StoredVoiceTraceEvent['type'];
|
|
14
|
+
};
|
|
15
|
+
export type VoiceTraceTimelineProviderSummary = {
|
|
16
|
+
averageElapsedMs?: number;
|
|
17
|
+
errorCount: number;
|
|
18
|
+
eventCount: number;
|
|
19
|
+
fallbackCount: number;
|
|
20
|
+
maxElapsedMs?: number;
|
|
21
|
+
provider: string;
|
|
22
|
+
successCount: number;
|
|
23
|
+
timeoutCount: number;
|
|
24
|
+
};
|
|
25
|
+
export type VoiceTraceTimelineSession = {
|
|
26
|
+
endedAt?: number;
|
|
27
|
+
evaluation: ReturnType<typeof evaluateVoiceTrace>;
|
|
28
|
+
events: VoiceTraceTimelineEvent[];
|
|
29
|
+
lastEventAt?: number;
|
|
30
|
+
operationsRecordHref?: string;
|
|
31
|
+
providers: VoiceTraceTimelineProviderSummary[];
|
|
32
|
+
sessionId: string;
|
|
33
|
+
startedAt?: number;
|
|
34
|
+
status: 'failed' | 'healthy' | 'warning';
|
|
35
|
+
summary: VoiceTraceSummary;
|
|
36
|
+
};
|
|
37
|
+
export type VoiceTraceTimelineReport = {
|
|
38
|
+
checkedAt: number;
|
|
39
|
+
failed: number;
|
|
40
|
+
sessions: VoiceTraceTimelineSession[];
|
|
41
|
+
total: number;
|
|
42
|
+
warnings: number;
|
|
43
|
+
};
|
|
44
|
+
export type VoiceTraceTimelineRoutesOptions = {
|
|
45
|
+
evaluation?: VoiceTraceEvaluationOptions;
|
|
46
|
+
headers?: HeadersInit;
|
|
47
|
+
htmlPath?: string;
|
|
48
|
+
limit?: number;
|
|
49
|
+
name?: string;
|
|
50
|
+
operationsRecordHref?: false | string | ((sessionId: string) => string);
|
|
51
|
+
path?: string;
|
|
52
|
+
redact?: VoiceTraceRedactionConfig;
|
|
53
|
+
render?: (report: VoiceTraceTimelineReport) => string | Promise<string>;
|
|
54
|
+
renderSession?: (session: VoiceTraceTimelineSession) => string | Promise<string>;
|
|
55
|
+
store: VoiceTraceEventStore;
|
|
56
|
+
title?: string;
|
|
57
|
+
};
|
|
58
|
+
export declare const summarizeVoiceTraceTimeline: (events: StoredVoiceTraceEvent[], options?: {
|
|
59
|
+
evaluation?: VoiceTraceEvaluationOptions;
|
|
60
|
+
limit?: number;
|
|
61
|
+
operationsRecordHref?: false | string | ((sessionId: string) => string);
|
|
62
|
+
redact?: VoiceTraceRedactionConfig;
|
|
63
|
+
}) => VoiceTraceTimelineReport;
|
|
64
|
+
export declare const renderVoiceTraceTimelineSessionHTML: (session: VoiceTraceTimelineSession, options?: {
|
|
65
|
+
title?: string;
|
|
66
|
+
}) => string;
|
|
67
|
+
export declare const renderVoiceTraceTimelineHTML: (report: VoiceTraceTimelineReport, options?: {
|
|
68
|
+
title?: string;
|
|
69
|
+
}) => string;
|
|
70
|
+
export declare const createVoiceTraceTimelineRoutes: (options: VoiceTraceTimelineRoutesOptions) => Elysia<"", {
|
|
71
|
+
decorator: {};
|
|
72
|
+
store: {};
|
|
73
|
+
derive: {};
|
|
74
|
+
resolve: {};
|
|
75
|
+
}, {
|
|
76
|
+
typebox: {};
|
|
77
|
+
error: {};
|
|
78
|
+
}, {
|
|
79
|
+
schema: {};
|
|
80
|
+
standaloneSchema: {};
|
|
81
|
+
macro: {};
|
|
82
|
+
macroFn: {};
|
|
83
|
+
parser: {};
|
|
84
|
+
response: {};
|
|
85
|
+
}, {}, {
|
|
86
|
+
derive: {};
|
|
87
|
+
resolve: {};
|
|
88
|
+
schema: {};
|
|
89
|
+
standaloneSchema: {};
|
|
90
|
+
response: {};
|
|
91
|
+
}, {
|
|
92
|
+
derive: {};
|
|
93
|
+
resolve: {};
|
|
94
|
+
schema: {};
|
|
95
|
+
standaloneSchema: {};
|
|
96
|
+
response: {};
|
|
97
|
+
}>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { VoiceTraceEventStore } from './trace';
|
|
3
|
+
import type { VoiceSessionRecord, VoiceSessionStore } from './types';
|
|
4
|
+
export type VoiceTurnLatencyStatus = 'pass' | 'warn' | 'fail' | 'empty';
|
|
5
|
+
export type VoiceTurnLatencyStage = {
|
|
6
|
+
label: string;
|
|
7
|
+
valueMs?: number;
|
|
8
|
+
};
|
|
9
|
+
export type VoiceTurnLatencyItem = {
|
|
10
|
+
assistantTextStartedAt?: number;
|
|
11
|
+
committedAt: number;
|
|
12
|
+
finalTranscriptAt?: number;
|
|
13
|
+
firstTranscriptAt?: number;
|
|
14
|
+
sessionId: string;
|
|
15
|
+
stages: VoiceTurnLatencyStage[];
|
|
16
|
+
status: VoiceTurnLatencyStatus;
|
|
17
|
+
text: string;
|
|
18
|
+
totalMs?: number;
|
|
19
|
+
turnId: string;
|
|
20
|
+
};
|
|
21
|
+
export type VoiceTurnLatencyReport = {
|
|
22
|
+
averageTotalMs?: number;
|
|
23
|
+
checkedAt: number;
|
|
24
|
+
failed: number;
|
|
25
|
+
sessions: number;
|
|
26
|
+
status: VoiceTurnLatencyStatus;
|
|
27
|
+
total: number;
|
|
28
|
+
turns: VoiceTurnLatencyItem[];
|
|
29
|
+
warnings: number;
|
|
30
|
+
};
|
|
31
|
+
export type VoiceTurnLatencyOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = {
|
|
32
|
+
limit?: number;
|
|
33
|
+
sessionIds?: string[];
|
|
34
|
+
sessions?: TSession[];
|
|
35
|
+
store?: VoiceSessionStore<TSession>;
|
|
36
|
+
traceStore?: VoiceTraceEventStore;
|
|
37
|
+
warnAfterMs?: number;
|
|
38
|
+
failAfterMs?: number;
|
|
39
|
+
};
|
|
40
|
+
export type VoiceTurnLatencyHTMLHandlerOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = VoiceTurnLatencyOptions<TSession> & {
|
|
41
|
+
headers?: HeadersInit;
|
|
42
|
+
render?: (report: VoiceTurnLatencyReport) => string | Promise<string>;
|
|
43
|
+
title?: string;
|
|
44
|
+
};
|
|
45
|
+
export type VoiceTurnLatencyRoutesOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = VoiceTurnLatencyHTMLHandlerOptions<TSession> & {
|
|
46
|
+
htmlPath?: false | string;
|
|
47
|
+
name?: string;
|
|
48
|
+
path?: string;
|
|
49
|
+
};
|
|
50
|
+
export declare const summarizeVoiceTurnLatency: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnLatencyOptions<TSession>) => Promise<VoiceTurnLatencyReport>;
|
|
51
|
+
export declare const renderVoiceTurnLatencyHTML: (report: VoiceTurnLatencyReport, options?: {
|
|
52
|
+
title?: string;
|
|
53
|
+
}) => string;
|
|
54
|
+
export declare const createVoiceTurnLatencyJSONHandler: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnLatencyOptions<TSession>) => () => Promise<VoiceTurnLatencyReport>;
|
|
55
|
+
export declare const createVoiceTurnLatencyHTMLHandler: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnLatencyHTMLHandlerOptions<TSession>) => () => Promise<Response>;
|
|
56
|
+
export declare const createVoiceTurnLatencyRoutes: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnLatencyRoutesOptions<TSession>) => Elysia<"", {
|
|
57
|
+
decorator: {};
|
|
58
|
+
store: {};
|
|
59
|
+
derive: {};
|
|
60
|
+
resolve: {};
|
|
61
|
+
}, {
|
|
62
|
+
typebox: {};
|
|
63
|
+
error: {};
|
|
64
|
+
}, {
|
|
65
|
+
schema: {};
|
|
66
|
+
standaloneSchema: {};
|
|
67
|
+
macro: {};
|
|
68
|
+
macroFn: {};
|
|
69
|
+
parser: {};
|
|
70
|
+
response: {};
|
|
71
|
+
}, {
|
|
72
|
+
[x: string]: {
|
|
73
|
+
get: {
|
|
74
|
+
body: unknown;
|
|
75
|
+
params: {};
|
|
76
|
+
query: unknown;
|
|
77
|
+
headers: unknown;
|
|
78
|
+
response: {
|
|
79
|
+
200: VoiceTurnLatencyReport;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}, {
|
|
84
|
+
derive: {};
|
|
85
|
+
resolve: {};
|
|
86
|
+
schema: {};
|
|
87
|
+
standaloneSchema: {};
|
|
88
|
+
response: {};
|
|
89
|
+
}, {
|
|
90
|
+
derive: {};
|
|
91
|
+
resolve: {};
|
|
92
|
+
schema: {};
|
|
93
|
+
standaloneSchema: {};
|
|
94
|
+
response: {};
|
|
95
|
+
}>;
|