@absolutejs/voice 0.0.22-beta.293 → 0.0.22-beta.295

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.
@@ -45,10 +45,12 @@ export type VoiceOperationsRecordProviderDecision = {
45
45
  elapsedMs?: number;
46
46
  error?: string;
47
47
  fallbackProvider?: string;
48
+ kind?: string;
48
49
  provider?: string;
49
50
  reason?: string;
50
51
  selectedProvider?: string;
51
52
  status?: string;
53
+ surface?: string;
52
54
  type: StoredVoiceTraceEvent['type'];
53
55
  turnId?: string;
54
56
  };
@@ -0,0 +1,122 @@
1
+ import { Elysia } from 'elysia';
2
+ import { type VoiceRoutingEventKind } from './resilienceRoutes';
3
+ import type { StoredVoiceTraceEvent, VoiceTraceEvent, VoiceTraceEventStore } from './trace';
4
+ export type VoiceProviderDecisionStatus = 'error' | 'fallback' | 'selected' | 'skipped' | 'success';
5
+ export type VoiceProviderDecisionTrace = {
6
+ at: number;
7
+ elapsedMs?: number;
8
+ error?: string;
9
+ fallbackProvider?: string;
10
+ kind?: VoiceRoutingEventKind;
11
+ latencyBudgetMs?: number;
12
+ provider: string;
13
+ reason: string;
14
+ scenarioId?: string;
15
+ selectedProvider?: string;
16
+ sessionId: string;
17
+ status: VoiceProviderDecisionStatus;
18
+ surface: string;
19
+ turnId?: string;
20
+ };
21
+ export type VoiceProviderDecisionTraceInput = Omit<VoiceProviderDecisionTrace, 'at' | 'reason' | 'sessionId' | 'surface'> & {
22
+ at?: number;
23
+ reason?: string;
24
+ sessionId?: string;
25
+ surface?: string;
26
+ };
27
+ export type VoiceProviderDecisionTraceIssue = {
28
+ code: string;
29
+ message: string;
30
+ status: 'fail' | 'warn';
31
+ surface?: string;
32
+ };
33
+ export type VoiceProviderDecisionSurfaceReport = {
34
+ decisions: number;
35
+ errors: number;
36
+ fallbacks: number;
37
+ issues: VoiceProviderDecisionTraceIssue[];
38
+ latestAt?: number;
39
+ providers: string[];
40
+ reasons: string[];
41
+ selected: number;
42
+ status: 'fail' | 'pass' | 'warn';
43
+ surface: string;
44
+ };
45
+ export type VoiceProviderDecisionTraceReport = {
46
+ checkedAt: number;
47
+ decisions: VoiceProviderDecisionTrace[];
48
+ issues: VoiceProviderDecisionTraceIssue[];
49
+ status: 'fail' | 'pass' | 'warn';
50
+ summary: {
51
+ decisions: number;
52
+ errors: number;
53
+ fallbacks: number;
54
+ providers: number;
55
+ selected: number;
56
+ surfaces: number;
57
+ };
58
+ surfaces: VoiceProviderDecisionSurfaceReport[];
59
+ };
60
+ export type VoiceProviderDecisionTraceReportOptions = {
61
+ events?: StoredVoiceTraceEvent[] | VoiceProviderDecisionTrace[];
62
+ maxAgeMs?: number;
63
+ minDecisions?: number;
64
+ now?: number;
65
+ requiredSurfaces?: readonly string[];
66
+ sessionId?: string;
67
+ store?: VoiceTraceEventStore;
68
+ };
69
+ export type VoiceProviderDecisionTraceRoutesOptions = VoiceProviderDecisionTraceReportOptions & {
70
+ headers?: HeadersInit;
71
+ htmlPath?: false | string;
72
+ markdownPath?: false | string;
73
+ name?: string;
74
+ path?: string;
75
+ render?: (report: VoiceProviderDecisionTraceReport) => string | Promise<string>;
76
+ title?: string;
77
+ };
78
+ export declare const createVoiceProviderDecisionTraceEvent: (input: VoiceProviderDecisionTraceInput) => VoiceTraceEvent;
79
+ export declare const listVoiceProviderDecisionTraces: (events: StoredVoiceTraceEvent[] | VoiceProviderDecisionTrace[]) => VoiceProviderDecisionTrace[];
80
+ export declare const buildVoiceProviderDecisionTraceReport: (options: VoiceProviderDecisionTraceReportOptions) => Promise<VoiceProviderDecisionTraceReport>;
81
+ export declare const renderVoiceProviderDecisionTraceMarkdown: (report: VoiceProviderDecisionTraceReport) => string;
82
+ export declare const renderVoiceProviderDecisionTraceHTML: (report: VoiceProviderDecisionTraceReport, title?: string) => string;
83
+ export declare const createVoiceProviderDecisionTraceRoutes: (options: VoiceProviderDecisionTraceRoutesOptions) => Elysia<"", {
84
+ decorator: {};
85
+ store: {};
86
+ derive: {};
87
+ resolve: {};
88
+ }, {
89
+ typebox: {};
90
+ error: {};
91
+ }, {
92
+ schema: {};
93
+ standaloneSchema: {};
94
+ macro: {};
95
+ macroFn: {};
96
+ parser: {};
97
+ response: {};
98
+ }, {
99
+ [x: string]: {
100
+ get: {
101
+ body: unknown;
102
+ params: {};
103
+ query: unknown;
104
+ headers: unknown;
105
+ response: {
106
+ 200: Response;
107
+ };
108
+ };
109
+ };
110
+ }, {
111
+ derive: {};
112
+ resolve: {};
113
+ schema: {};
114
+ standaloneSchema: {};
115
+ response: {};
116
+ }, {
117
+ derive: {};
118
+ resolve: {};
119
+ schema: {};
120
+ standaloneSchema: {};
121
+ response: {};
122
+ }>;
package/dist/trace.d.ts CHANGED
@@ -1,5 +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.live_latency' | 'client.reconnect' | 'operator.action' | 'session.error' | 'turn.assistant' | 'turn.committed' | 'turn.cost' | 'turn_latency.stage' | 'turn.transcript' | 'workflow.contract';
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.live_latency' | 'client.reconnect' | 'operator.action' | 'provider.decision' | 'session.error' | 'turn.assistant' | 'turn.committed' | 'turn.cost' | 'turn_latency.stage' | 'turn.transcript' | 'workflow.contract';
3
3
  export type VoiceTraceEvent<TPayload extends Record<string, unknown> = Record<string, unknown>> = {
4
4
  at: number;
5
5
  id?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.293",
3
+ "version": "0.0.22-beta.295",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",