@absolutejs/voice 0.0.22-beta.2 → 0.0.22-beta.21
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/angular/index.d.ts +1 -0
- package/dist/angular/index.js +124 -0
- package/dist/angular/voice-provider-status.service.d.ts +12 -0
- package/dist/assistant.d.ts +44 -0
- package/dist/assistantHealth.d.ts +81 -0
- package/dist/assistantMemory.d.ts +63 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +81 -0
- package/dist/client/providerStatus.d.ts +19 -0
- package/dist/fileStore.d.ts +5 -2
- package/dist/index.d.ts +13 -3
- package/dist/index.js +1626 -28
- package/dist/modelAdapters.d.ts +93 -0
- package/dist/providerHealth.d.ts +78 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +100 -0
- package/dist/react/useVoiceProviderStatus.d.ts +8 -0
- package/dist/sessionReplay.d.ts +94 -0
- package/dist/svelte/createVoiceProviderStatus.d.ts +8 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +83 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +878 -0
- package/dist/testing/providerSimulator.d.ts +36 -0
- package/dist/trace.d.ts +1 -1
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +113 -0
- package/dist/vue/useVoiceProviderStatus.d.ts +9 -0
- package/package.json +1 -1
package/dist/angular/index.d.ts
CHANGED
package/dist/angular/index.js
CHANGED
|
@@ -1288,7 +1288,131 @@ VoiceControllerService = __decorateElement(_init, 0, "VoiceControllerService", _
|
|
|
1288
1288
|
__runInitializers(_init, 1, VoiceControllerService);
|
|
1289
1289
|
__decoratorMetadata(_init, VoiceControllerService);
|
|
1290
1290
|
let _VoiceControllerService = VoiceControllerService;
|
|
1291
|
+
// src/angular/voice-provider-status.service.ts
|
|
1292
|
+
import { computed as computed3, Injectable as Injectable3, signal as signal3 } from "@angular/core";
|
|
1293
|
+
|
|
1294
|
+
// src/client/providerStatus.ts
|
|
1295
|
+
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
1296
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1297
|
+
const response = await fetchImpl(path);
|
|
1298
|
+
if (!response.ok) {
|
|
1299
|
+
throw new Error(`Voice provider status failed: HTTP ${response.status}`);
|
|
1300
|
+
}
|
|
1301
|
+
return await response.json();
|
|
1302
|
+
};
|
|
1303
|
+
var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {}) => {
|
|
1304
|
+
const listeners = new Set;
|
|
1305
|
+
let closed = false;
|
|
1306
|
+
let timer;
|
|
1307
|
+
let snapshot = {
|
|
1308
|
+
error: null,
|
|
1309
|
+
isLoading: false,
|
|
1310
|
+
providers: []
|
|
1311
|
+
};
|
|
1312
|
+
const emit = () => {
|
|
1313
|
+
for (const listener of listeners) {
|
|
1314
|
+
listener();
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
const refresh = async () => {
|
|
1318
|
+
if (closed) {
|
|
1319
|
+
return snapshot.providers;
|
|
1320
|
+
}
|
|
1321
|
+
snapshot = {
|
|
1322
|
+
...snapshot,
|
|
1323
|
+
error: null,
|
|
1324
|
+
isLoading: true
|
|
1325
|
+
};
|
|
1326
|
+
emit();
|
|
1327
|
+
try {
|
|
1328
|
+
const providers = await fetchVoiceProviderStatus(path, options);
|
|
1329
|
+
snapshot = {
|
|
1330
|
+
error: null,
|
|
1331
|
+
isLoading: false,
|
|
1332
|
+
providers,
|
|
1333
|
+
updatedAt: Date.now()
|
|
1334
|
+
};
|
|
1335
|
+
emit();
|
|
1336
|
+
return providers;
|
|
1337
|
+
} catch (error) {
|
|
1338
|
+
snapshot = {
|
|
1339
|
+
...snapshot,
|
|
1340
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1341
|
+
isLoading: false
|
|
1342
|
+
};
|
|
1343
|
+
emit();
|
|
1344
|
+
throw error;
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
const close = () => {
|
|
1348
|
+
closed = true;
|
|
1349
|
+
if (timer) {
|
|
1350
|
+
clearInterval(timer);
|
|
1351
|
+
timer = undefined;
|
|
1352
|
+
}
|
|
1353
|
+
listeners.clear();
|
|
1354
|
+
};
|
|
1355
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
1356
|
+
timer = setInterval(() => {
|
|
1357
|
+
refresh().catch(() => {});
|
|
1358
|
+
}, options.intervalMs);
|
|
1359
|
+
}
|
|
1360
|
+
return {
|
|
1361
|
+
close,
|
|
1362
|
+
getServerSnapshot: () => snapshot,
|
|
1363
|
+
getSnapshot: () => snapshot,
|
|
1364
|
+
refresh,
|
|
1365
|
+
subscribe: (listener) => {
|
|
1366
|
+
listeners.add(listener);
|
|
1367
|
+
return () => {
|
|
1368
|
+
listeners.delete(listener);
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
// src/angular/voice-provider-status.service.ts
|
|
1375
|
+
var _dec = [
|
|
1376
|
+
Injectable3({ providedIn: "root" })
|
|
1377
|
+
];
|
|
1378
|
+
var _init = __decoratorStart(undefined);
|
|
1379
|
+
|
|
1380
|
+
class VoiceProviderStatusService {
|
|
1381
|
+
connect(path = "/api/provider-status", options = {}) {
|
|
1382
|
+
const store = createVoiceProviderStatusStore(path, options);
|
|
1383
|
+
const errorSignal = signal3(null);
|
|
1384
|
+
const isLoadingSignal = signal3(false);
|
|
1385
|
+
const providersSignal = signal3([]);
|
|
1386
|
+
const updatedAtSignal = signal3(undefined);
|
|
1387
|
+
const sync = () => {
|
|
1388
|
+
const snapshot = store.getSnapshot();
|
|
1389
|
+
errorSignal.set(snapshot.error);
|
|
1390
|
+
isLoadingSignal.set(snapshot.isLoading);
|
|
1391
|
+
providersSignal.set([...snapshot.providers]);
|
|
1392
|
+
updatedAtSignal.set(snapshot.updatedAt);
|
|
1393
|
+
};
|
|
1394
|
+
const unsubscribe = store.subscribe(sync);
|
|
1395
|
+
sync();
|
|
1396
|
+
store.refresh().catch(() => {});
|
|
1397
|
+
return {
|
|
1398
|
+
close: () => {
|
|
1399
|
+
unsubscribe();
|
|
1400
|
+
store.close();
|
|
1401
|
+
},
|
|
1402
|
+
error: computed3(() => errorSignal()),
|
|
1403
|
+
isLoading: computed3(() => isLoadingSignal()),
|
|
1404
|
+
providers: computed3(() => providersSignal()),
|
|
1405
|
+
refresh: store.refresh,
|
|
1406
|
+
updatedAt: computed3(() => updatedAtSignal())
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
VoiceProviderStatusService = __decorateElement(_init, 0, "VoiceProviderStatusService", _dec, VoiceProviderStatusService);
|
|
1411
|
+
__runInitializers(_init, 1, VoiceProviderStatusService);
|
|
1412
|
+
__decoratorMetadata(_init, VoiceProviderStatusService);
|
|
1413
|
+
let _VoiceProviderStatusService = VoiceProviderStatusService;
|
|
1291
1414
|
export {
|
|
1292
1415
|
VoiceStreamService,
|
|
1416
|
+
VoiceProviderStatusService,
|
|
1293
1417
|
VoiceControllerService
|
|
1294
1418
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type VoiceProviderStatusClientOptions } from '../client/providerStatus';
|
|
2
|
+
import type { VoiceProviderHealthSummary } from '../providerHealth';
|
|
3
|
+
export declare class VoiceProviderStatusService {
|
|
4
|
+
connect<TProvider extends string = string>(path?: string, options?: VoiceProviderStatusClientOptions): {
|
|
5
|
+
close: () => void;
|
|
6
|
+
error: import("@angular/core").Signal<string | null>;
|
|
7
|
+
isLoading: import("@angular/core").Signal<boolean>;
|
|
8
|
+
providers: import("@angular/core").Signal<VoiceProviderHealthSummary<TProvider>[]>;
|
|
9
|
+
refresh: () => Promise<VoiceProviderHealthSummary<TProvider>[]>;
|
|
10
|
+
updatedAt: import("@angular/core").Signal<number | undefined>;
|
|
11
|
+
};
|
|
12
|
+
}
|
package/dist/assistant.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type VoiceAgent, type VoiceAgentModel, type VoiceAgentOptions, type VoiceAgentSquadOptions, type VoiceAgentTool } from './agent';
|
|
2
2
|
import { type VoiceOutcomeRecipeName, type VoiceOutcomeRecipeOptions } from './outcomeRecipes';
|
|
3
|
+
import { type VoiceAssistantMemoryHandle, type VoiceAssistantMemoryOptions } from './assistantMemory';
|
|
3
4
|
import type { VoiceNormalizedRouteConfig, VoiceOnTurnObjectHandler, VoiceRouteConfig, VoiceRouteResult, VoiceRuntimeOpsConfig, VoiceSessionRecord } from './types';
|
|
5
|
+
import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from './trace';
|
|
4
6
|
export type VoiceAssistantPreset = VoiceOutcomeRecipeName;
|
|
5
7
|
export type VoiceAssistantArtifactPlan<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
6
8
|
ops?: VoiceRuntimeOpsConfig<TContext, TSession, TResult>;
|
|
@@ -11,6 +13,7 @@ export type VoiceAssistantArtifactPlan<TContext = unknown, TSession extends Voic
|
|
|
11
13
|
};
|
|
12
14
|
export type VoiceAssistantGuardrailInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Parameters<VoiceOnTurnObjectHandler<TContext, TSession, TResult>>[0] & {
|
|
13
15
|
assistantId: string;
|
|
16
|
+
memory?: VoiceAssistantMemoryHandle;
|
|
14
17
|
};
|
|
15
18
|
export type VoiceAssistantOutputGuardrailInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = VoiceAssistantGuardrailInput<TContext, TSession, TResult> & {
|
|
16
19
|
result: VoiceRouteResult<TResult>;
|
|
@@ -28,6 +31,16 @@ export type VoiceAssistantVariant<TContext = unknown, TSession extends VoiceSess
|
|
|
28
31
|
tools?: Array<VoiceAgentTool<TContext, TSession, Record<string, unknown>, unknown, TResult>>;
|
|
29
32
|
weight?: number;
|
|
30
33
|
};
|
|
34
|
+
export type VoiceAssistantMemoryLifecycleInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Parameters<VoiceOnTurnObjectHandler<TContext, TSession, TResult>>[0] & {
|
|
35
|
+
assistantId: string;
|
|
36
|
+
memory: VoiceAssistantMemoryHandle;
|
|
37
|
+
};
|
|
38
|
+
export type VoiceAssistantMemoryLifecycle<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
39
|
+
afterTurn?: (input: VoiceAssistantMemoryLifecycleInput<TContext, TSession, TResult> & {
|
|
40
|
+
result: VoiceRouteResult<TResult>;
|
|
41
|
+
}) => Promise<void> | void;
|
|
42
|
+
beforeTurn?: (input: VoiceAssistantMemoryLifecycleInput<TContext, TSession, TResult>) => Promise<void> | void;
|
|
43
|
+
};
|
|
31
44
|
export type VoiceAssistantExperimentResolverInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord> = {
|
|
32
45
|
assistantId: string;
|
|
33
46
|
context: TContext;
|
|
@@ -82,6 +95,8 @@ export type VoiceAssistantOptions<TContext = unknown, TSession extends VoiceSess
|
|
|
82
95
|
experiment?: VoiceAssistantExperiment<TContext, TSession, TResult>;
|
|
83
96
|
guardrails?: VoiceAssistantGuardrails<TContext, TSession, TResult>;
|
|
84
97
|
id: string;
|
|
98
|
+
memory?: VoiceAssistantMemoryOptions<TContext, TSession>;
|
|
99
|
+
memoryLifecycle?: VoiceAssistantMemoryLifecycle<TContext, TSession, TResult>;
|
|
85
100
|
ops?: VoiceRuntimeOpsConfig<TContext, TSession, TResult>;
|
|
86
101
|
trace?: VoiceAgentOptions<TContext, TSession, TResult>['trace'];
|
|
87
102
|
};
|
|
@@ -94,6 +109,35 @@ export type VoiceAssistant<TContext = unknown, TSession extends VoiceSessionReco
|
|
|
94
109
|
onComplete?: VoiceRouteConfig<TContext, TSession, TResult>['onComplete'];
|
|
95
110
|
}) => VoiceNormalizedRouteConfig<TContext, TSession, TResult>;
|
|
96
111
|
};
|
|
112
|
+
export type VoiceAssistantRunSummary = {
|
|
113
|
+
assistantId: string;
|
|
114
|
+
artifactPlans: Record<string, number>;
|
|
115
|
+
averageElapsedMs?: number;
|
|
116
|
+
blockedGuardrailCount: number;
|
|
117
|
+
escalationCount: number;
|
|
118
|
+
experiments: Record<string, number>;
|
|
119
|
+
guardrailCount: number;
|
|
120
|
+
outcomes: Record<string, number>;
|
|
121
|
+
runCount: number;
|
|
122
|
+
sessions: number;
|
|
123
|
+
toolCalls: Record<string, number>;
|
|
124
|
+
transferCount: number;
|
|
125
|
+
variants: Record<string, number>;
|
|
126
|
+
memory: {
|
|
127
|
+
deletes: number;
|
|
128
|
+
gets: number;
|
|
129
|
+
lists: number;
|
|
130
|
+
sets: number;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
export type VoiceAssistantRunsSummary = {
|
|
134
|
+
assistants: VoiceAssistantRunSummary[];
|
|
135
|
+
totalRuns: number;
|
|
136
|
+
};
|
|
97
137
|
export declare const createVoiceExperiment: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options: VoiceAssistantExperimentOptions<TContext, TSession, TResult>) => VoiceAssistantExperiment<TContext, TSession, TResult>;
|
|
98
138
|
export declare const createVoiceAssistant: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options: VoiceAssistantOptions<TContext, TSession, TResult>) => VoiceAssistant<TContext, TSession, TResult>;
|
|
139
|
+
export declare const summarizeVoiceAssistantRuns: (input: StoredVoiceTraceEvent[] | {
|
|
140
|
+
events?: StoredVoiceTraceEvent[];
|
|
141
|
+
store?: VoiceTraceEventStore;
|
|
142
|
+
}) => Promise<VoiceAssistantRunsSummary>;
|
|
99
143
|
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import { type VoiceAssistantRunsSummary } from './assistant';
|
|
3
|
+
import { type VoiceProviderHealthSummary } from './providerHealth';
|
|
4
|
+
import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from './trace';
|
|
5
|
+
export type VoiceAssistantHealthFailure = {
|
|
6
|
+
at: number;
|
|
7
|
+
assistantId?: string;
|
|
8
|
+
error?: string;
|
|
9
|
+
provider?: string;
|
|
10
|
+
rateLimited?: boolean;
|
|
11
|
+
replayHref?: string;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
status?: string;
|
|
14
|
+
turnId?: string;
|
|
15
|
+
type: StoredVoiceTraceEvent['type'];
|
|
16
|
+
};
|
|
17
|
+
export type VoiceAssistantHealthSummary<TProvider extends string = string> = {
|
|
18
|
+
assistantRuns: VoiceAssistantRunsSummary;
|
|
19
|
+
providerHealth: VoiceProviderHealthSummary<TProvider>[];
|
|
20
|
+
recentFailures: VoiceAssistantHealthFailure[];
|
|
21
|
+
};
|
|
22
|
+
export type VoiceAssistantHealthSummaryOptions<TProvider extends string = string> = {
|
|
23
|
+
events?: StoredVoiceTraceEvent[];
|
|
24
|
+
maxFailures?: number;
|
|
25
|
+
providers?: readonly TProvider[];
|
|
26
|
+
replayHref?: false | string | ((failure: Omit<VoiceAssistantHealthFailure, 'replayHref'>) => string);
|
|
27
|
+
store?: VoiceTraceEventStore;
|
|
28
|
+
};
|
|
29
|
+
export type VoiceAssistantHealthHTMLHandlerOptions<TProvider extends string = string> = VoiceAssistantHealthSummaryOptions<TProvider> & {
|
|
30
|
+
headers?: HeadersInit;
|
|
31
|
+
render?: (summary: VoiceAssistantHealthSummary<TProvider>) => string | Promise<string>;
|
|
32
|
+
};
|
|
33
|
+
export type VoiceAssistantHealthRoutesOptions<TProvider extends string = string> = VoiceAssistantHealthHTMLHandlerOptions<TProvider> & {
|
|
34
|
+
htmlPath?: false | string;
|
|
35
|
+
name?: string;
|
|
36
|
+
path?: string;
|
|
37
|
+
};
|
|
38
|
+
export declare const summarizeVoiceAssistantHealth: <TProvider extends string = string>(options: VoiceAssistantHealthSummaryOptions<TProvider>) => Promise<VoiceAssistantHealthSummary<TProvider>>;
|
|
39
|
+
export declare const renderVoiceAssistantHealthHTML: <TProvider extends string = string>(summary: VoiceAssistantHealthSummary<TProvider>) => string;
|
|
40
|
+
export declare const createVoiceAssistantHealthJSONHandler: <TProvider extends string = string>(options: VoiceAssistantHealthSummaryOptions<TProvider>) => () => Promise<VoiceAssistantHealthSummary<TProvider>>;
|
|
41
|
+
export declare const createVoiceAssistantHealthHTMLHandler: <TProvider extends string = string>(options: VoiceAssistantHealthHTMLHandlerOptions<TProvider>) => () => Promise<Response>;
|
|
42
|
+
export declare const createVoiceAssistantHealthRoutes: <TProvider extends string = string>(options: VoiceAssistantHealthRoutesOptions<TProvider>) => Elysia<"", {
|
|
43
|
+
decorator: {};
|
|
44
|
+
store: {};
|
|
45
|
+
derive: {};
|
|
46
|
+
resolve: {};
|
|
47
|
+
}, {
|
|
48
|
+
typebox: {};
|
|
49
|
+
error: {};
|
|
50
|
+
}, {
|
|
51
|
+
schema: {};
|
|
52
|
+
standaloneSchema: {};
|
|
53
|
+
macro: {};
|
|
54
|
+
macroFn: {};
|
|
55
|
+
parser: {};
|
|
56
|
+
response: {};
|
|
57
|
+
}, {
|
|
58
|
+
[x: string]: {
|
|
59
|
+
get: {
|
|
60
|
+
body: unknown;
|
|
61
|
+
params: {};
|
|
62
|
+
query: unknown;
|
|
63
|
+
headers: unknown;
|
|
64
|
+
response: {
|
|
65
|
+
200: VoiceAssistantHealthSummary<TProvider>;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
}, {
|
|
70
|
+
derive: {};
|
|
71
|
+
resolve: {};
|
|
72
|
+
schema: {};
|
|
73
|
+
standaloneSchema: {};
|
|
74
|
+
response: {};
|
|
75
|
+
}, {
|
|
76
|
+
derive: {};
|
|
77
|
+
resolve: {};
|
|
78
|
+
schema: {};
|
|
79
|
+
standaloneSchema: {};
|
|
80
|
+
response: {};
|
|
81
|
+
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { VoiceSessionRecord } from './types';
|
|
2
|
+
import type { VoiceTraceEventStore } from './trace';
|
|
3
|
+
export type VoiceAssistantMemoryRecord<TValue = unknown, TMetadata extends Record<string, unknown> = Record<string, unknown>> = {
|
|
4
|
+
assistantId: string;
|
|
5
|
+
createdAt: number;
|
|
6
|
+
key: string;
|
|
7
|
+
metadata?: TMetadata;
|
|
8
|
+
namespace: string;
|
|
9
|
+
updatedAt: number;
|
|
10
|
+
value: TValue;
|
|
11
|
+
};
|
|
12
|
+
export type VoiceAssistantMemoryStore<TRecord extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord> = {
|
|
13
|
+
delete: (input: {
|
|
14
|
+
assistantId: string;
|
|
15
|
+
key: string;
|
|
16
|
+
namespace: string;
|
|
17
|
+
}) => Promise<void>;
|
|
18
|
+
get: (input: {
|
|
19
|
+
assistantId: string;
|
|
20
|
+
key: string;
|
|
21
|
+
namespace: string;
|
|
22
|
+
}) => Promise<TRecord | undefined>;
|
|
23
|
+
list: (input: {
|
|
24
|
+
assistantId: string;
|
|
25
|
+
namespace?: string;
|
|
26
|
+
}) => Promise<TRecord[]>;
|
|
27
|
+
set: (input: Omit<TRecord, 'createdAt' | 'updatedAt'> & {
|
|
28
|
+
createdAt?: number;
|
|
29
|
+
updatedAt?: number;
|
|
30
|
+
}) => Promise<TRecord>;
|
|
31
|
+
};
|
|
32
|
+
export type VoiceAssistantMemoryNamespaceInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord> = {
|
|
33
|
+
assistantId: string;
|
|
34
|
+
context: TContext;
|
|
35
|
+
session: TSession;
|
|
36
|
+
};
|
|
37
|
+
export type VoiceAssistantMemoryOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRecord extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord> = {
|
|
38
|
+
namespace: string | ((input: VoiceAssistantMemoryNamespaceInput<TContext, TSession>) => Promise<string> | string);
|
|
39
|
+
store: VoiceAssistantMemoryStore<TRecord>;
|
|
40
|
+
};
|
|
41
|
+
export type VoiceAssistantMemoryBinding<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRecord extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord> = VoiceAssistantMemoryOptions<TContext, TSession, TRecord>;
|
|
42
|
+
export type VoiceAssistantMemoryHandle<TRecord extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord> = {
|
|
43
|
+
delete: (key: string) => Promise<void>;
|
|
44
|
+
get: <TValue = unknown>(key: string) => Promise<TValue | undefined>;
|
|
45
|
+
list: () => Promise<TRecord[]>;
|
|
46
|
+
namespace: string;
|
|
47
|
+
set: <TValue = unknown>(key: string, value: TValue, metadata?: Record<string, unknown>) => Promise<TRecord>;
|
|
48
|
+
};
|
|
49
|
+
export declare const createVoiceAssistantMemoryRecord: <TValue = unknown, TMetadata extends Record<string, unknown> = Record<string, unknown>>(input: Omit<VoiceAssistantMemoryRecord<TValue, TMetadata>, "createdAt" | "updatedAt"> & {
|
|
50
|
+
createdAt?: number;
|
|
51
|
+
updatedAt?: number;
|
|
52
|
+
}) => VoiceAssistantMemoryRecord<TValue, TMetadata>;
|
|
53
|
+
export declare const createVoiceMemoryAssistantMemoryStore: <TRecord extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord>() => VoiceAssistantMemoryStore<TRecord>;
|
|
54
|
+
export declare const resolveVoiceAssistantMemoryNamespace: <TContext, TSession extends VoiceSessionRecord>(input: VoiceAssistantMemoryNamespaceInput<TContext, TSession> & {
|
|
55
|
+
memory: VoiceAssistantMemoryOptions<TContext, TSession>;
|
|
56
|
+
}) => Promise<string>;
|
|
57
|
+
export declare const createVoiceAssistantMemoryHandle: <TContext, TSession extends VoiceSessionRecord, TRecord extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord>(input: {
|
|
58
|
+
assistantId: string;
|
|
59
|
+
context: TContext;
|
|
60
|
+
memory: VoiceAssistantMemoryOptions<TContext, TSession, TRecord>;
|
|
61
|
+
session: TSession;
|
|
62
|
+
trace?: VoiceTraceEventStore;
|
|
63
|
+
}) => Promise<VoiceAssistantMemoryHandle<TRecord>>;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -5,3 +5,5 @@ export { createVoiceController } from './controller';
|
|
|
5
5
|
export { bindVoiceBargeIn, createVoiceDuplexController } from './duplex';
|
|
6
6
|
export { bindVoiceHTMX } from './htmx';
|
|
7
7
|
export { createMicrophoneCapture } from './microphone';
|
|
8
|
+
export { createVoiceProviderStatusStore, fetchVoiceProviderStatus } from './providerStatus';
|
|
9
|
+
export type { VoiceProviderStatusClientOptions, VoiceProviderStatusSnapshot } from './providerStatus';
|
package/dist/client/index.js
CHANGED
|
@@ -1581,9 +1581,90 @@ var createVoiceDuplexController = (path, options = {}) => {
|
|
|
1581
1581
|
}
|
|
1582
1582
|
};
|
|
1583
1583
|
};
|
|
1584
|
+
// src/client/providerStatus.ts
|
|
1585
|
+
var fetchVoiceProviderStatus = async (path = "/api/provider-status", options = {}) => {
|
|
1586
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
1587
|
+
const response = await fetchImpl(path);
|
|
1588
|
+
if (!response.ok) {
|
|
1589
|
+
throw new Error(`Voice provider status failed: HTTP ${response.status}`);
|
|
1590
|
+
}
|
|
1591
|
+
return await response.json();
|
|
1592
|
+
};
|
|
1593
|
+
var createVoiceProviderStatusStore = (path = "/api/provider-status", options = {}) => {
|
|
1594
|
+
const listeners = new Set;
|
|
1595
|
+
let closed = false;
|
|
1596
|
+
let timer;
|
|
1597
|
+
let snapshot = {
|
|
1598
|
+
error: null,
|
|
1599
|
+
isLoading: false,
|
|
1600
|
+
providers: []
|
|
1601
|
+
};
|
|
1602
|
+
const emit = () => {
|
|
1603
|
+
for (const listener of listeners) {
|
|
1604
|
+
listener();
|
|
1605
|
+
}
|
|
1606
|
+
};
|
|
1607
|
+
const refresh = async () => {
|
|
1608
|
+
if (closed) {
|
|
1609
|
+
return snapshot.providers;
|
|
1610
|
+
}
|
|
1611
|
+
snapshot = {
|
|
1612
|
+
...snapshot,
|
|
1613
|
+
error: null,
|
|
1614
|
+
isLoading: true
|
|
1615
|
+
};
|
|
1616
|
+
emit();
|
|
1617
|
+
try {
|
|
1618
|
+
const providers = await fetchVoiceProviderStatus(path, options);
|
|
1619
|
+
snapshot = {
|
|
1620
|
+
error: null,
|
|
1621
|
+
isLoading: false,
|
|
1622
|
+
providers,
|
|
1623
|
+
updatedAt: Date.now()
|
|
1624
|
+
};
|
|
1625
|
+
emit();
|
|
1626
|
+
return providers;
|
|
1627
|
+
} catch (error) {
|
|
1628
|
+
snapshot = {
|
|
1629
|
+
...snapshot,
|
|
1630
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1631
|
+
isLoading: false
|
|
1632
|
+
};
|
|
1633
|
+
emit();
|
|
1634
|
+
throw error;
|
|
1635
|
+
}
|
|
1636
|
+
};
|
|
1637
|
+
const close = () => {
|
|
1638
|
+
closed = true;
|
|
1639
|
+
if (timer) {
|
|
1640
|
+
clearInterval(timer);
|
|
1641
|
+
timer = undefined;
|
|
1642
|
+
}
|
|
1643
|
+
listeners.clear();
|
|
1644
|
+
};
|
|
1645
|
+
if (options.intervalMs && options.intervalMs > 0) {
|
|
1646
|
+
timer = setInterval(() => {
|
|
1647
|
+
refresh().catch(() => {});
|
|
1648
|
+
}, options.intervalMs);
|
|
1649
|
+
}
|
|
1650
|
+
return {
|
|
1651
|
+
close,
|
|
1652
|
+
getServerSnapshot: () => snapshot,
|
|
1653
|
+
getSnapshot: () => snapshot,
|
|
1654
|
+
refresh,
|
|
1655
|
+
subscribe: (listener) => {
|
|
1656
|
+
listeners.add(listener);
|
|
1657
|
+
return () => {
|
|
1658
|
+
listeners.delete(listener);
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1661
|
+
};
|
|
1662
|
+
};
|
|
1584
1663
|
export {
|
|
1664
|
+
fetchVoiceProviderStatus,
|
|
1585
1665
|
decodeVoiceAudioChunk,
|
|
1586
1666
|
createVoiceStream,
|
|
1667
|
+
createVoiceProviderStatusStore,
|
|
1587
1668
|
createVoiceDuplexController,
|
|
1588
1669
|
createVoiceController,
|
|
1589
1670
|
createVoiceConnection,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { VoiceProviderHealthSummary } from '../providerHealth';
|
|
2
|
+
export type VoiceProviderStatusClientOptions = {
|
|
3
|
+
fetch?: typeof fetch;
|
|
4
|
+
intervalMs?: number;
|
|
5
|
+
};
|
|
6
|
+
export type VoiceProviderStatusSnapshot<TProvider extends string = string> = {
|
|
7
|
+
error: string | null;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
providers: VoiceProviderHealthSummary<TProvider>[];
|
|
10
|
+
updatedAt?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const fetchVoiceProviderStatus: <TProvider extends string = string>(path?: string, options?: Pick<VoiceProviderStatusClientOptions, "fetch">) => Promise<VoiceProviderHealthSummary<TProvider>[]>;
|
|
13
|
+
export declare const createVoiceProviderStatusStore: <TProvider extends string = string>(path?: string, options?: VoiceProviderStatusClientOptions) => {
|
|
14
|
+
close: () => void;
|
|
15
|
+
getServerSnapshot: () => VoiceProviderStatusSnapshot<TProvider>;
|
|
16
|
+
getSnapshot: () => VoiceProviderStatusSnapshot<TProvider>;
|
|
17
|
+
refresh: () => Promise<VoiceProviderHealthSummary<TProvider>[]>;
|
|
18
|
+
subscribe: (listener: () => void) => () => void;
|
|
19
|
+
};
|
package/dist/fileStore.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type VoiceAssistantMemoryRecord, type VoiceAssistantMemoryStore } from './assistantMemory';
|
|
1
2
|
import { type StoredVoiceTraceEvent, type VoiceTraceSinkDeliveryRecord, type VoiceTraceSinkDeliveryStore, type VoiceTraceEventStore } from './trace';
|
|
2
3
|
import type { StoredVoiceIntegrationEvent, StoredVoiceExternalObjectMap, StoredVoiceOpsTask, VoiceExternalObjectMap, VoiceExternalObjectMapStore, VoiceIntegrationEvent, VoiceIntegrationEventStore, VoiceOpsTask, VoiceOpsTaskStore } from './ops';
|
|
3
4
|
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact, VoiceCallReviewStore } from './testing/review';
|
|
@@ -6,9 +7,10 @@ export type VoiceFileStoreOptions = {
|
|
|
6
7
|
directory: string;
|
|
7
8
|
pretty?: boolean;
|
|
8
9
|
};
|
|
9
|
-
export type VoiceFileRuntimeStorage<TSession extends VoiceSessionRecord = VoiceSessionRecord, TReview extends StoredVoiceCallReviewArtifact = StoredVoiceCallReviewArtifact, TTask extends StoredVoiceOpsTask = StoredVoiceOpsTask, TEvent extends StoredVoiceIntegrationEvent = StoredVoiceIntegrationEvent, TMapping extends StoredVoiceExternalObjectMap = StoredVoiceExternalObjectMap, TTrace extends StoredVoiceTraceEvent = StoredVoiceTraceEvent, TTraceDelivery extends VoiceTraceSinkDeliveryRecord = VoiceTraceSinkDeliveryRecord> = {
|
|
10
|
+
export type VoiceFileRuntimeStorage<TSession extends VoiceSessionRecord = VoiceSessionRecord, TReview extends StoredVoiceCallReviewArtifact = StoredVoiceCallReviewArtifact, TTask extends StoredVoiceOpsTask = StoredVoiceOpsTask, TEvent extends StoredVoiceIntegrationEvent = StoredVoiceIntegrationEvent, TMapping extends StoredVoiceExternalObjectMap = StoredVoiceExternalObjectMap, TTrace extends StoredVoiceTraceEvent = StoredVoiceTraceEvent, TTraceDelivery extends VoiceTraceSinkDeliveryRecord = VoiceTraceSinkDeliveryRecord, TMemory extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord> = {
|
|
10
11
|
events: VoiceIntegrationEventStore<TEvent>;
|
|
11
12
|
externalObjects: VoiceExternalObjectMapStore<TMapping>;
|
|
13
|
+
memories: VoiceAssistantMemoryStore<TMemory>;
|
|
12
14
|
reviews: VoiceCallReviewStore<TReview>;
|
|
13
15
|
session: VoiceSessionStore<TSession>;
|
|
14
16
|
tasks: VoiceOpsTaskStore<TTask>;
|
|
@@ -22,7 +24,8 @@ export declare const createVoiceFileIntegrationEventStore: <TEvent extends Store
|
|
|
22
24
|
export declare const createVoiceFileExternalObjectMapStore: <TMapping extends StoredVoiceExternalObjectMap = StoredVoiceExternalObjectMap>(options: VoiceFileStoreOptions) => VoiceExternalObjectMapStore<TMapping>;
|
|
23
25
|
export declare const createVoiceFileTraceEventStore: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(options: VoiceFileStoreOptions) => VoiceTraceEventStore<TEvent>;
|
|
24
26
|
export declare const createVoiceFileTraceSinkDeliveryStore: <TDelivery extends VoiceTraceSinkDeliveryRecord = VoiceTraceSinkDeliveryRecord>(options: VoiceFileStoreOptions) => VoiceTraceSinkDeliveryStore<TDelivery>;
|
|
25
|
-
export declare const
|
|
27
|
+
export declare const createVoiceFileAssistantMemoryStore: <TRecord extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord>(options: VoiceFileStoreOptions) => VoiceAssistantMemoryStore<TRecord>;
|
|
28
|
+
export declare const createVoiceFileRuntimeStorage: <TSession extends VoiceSessionRecord = VoiceSessionRecord, TReview extends StoredVoiceCallReviewArtifact = StoredVoiceCallReviewArtifact, TTask extends StoredVoiceOpsTask = StoredVoiceOpsTask, TEvent extends StoredVoiceIntegrationEvent = StoredVoiceIntegrationEvent, TMapping extends StoredVoiceExternalObjectMap = StoredVoiceExternalObjectMap, TTrace extends StoredVoiceTraceEvent = StoredVoiceTraceEvent, TTraceDelivery extends VoiceTraceSinkDeliveryRecord = VoiceTraceSinkDeliveryRecord, TMemory extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord>(options: VoiceFileStoreOptions) => VoiceFileRuntimeStorage<TSession, TReview, TTask, TEvent, TMapping, TTrace, TTraceDelivery, TMemory>;
|
|
26
29
|
export declare const createStoredVoiceCallReviewArtifact: <TArtifact extends VoiceCallReviewArtifact = VoiceCallReviewArtifact>(id: string, artifact: TArtifact) => TArtifact & {
|
|
27
30
|
id: string;
|
|
28
31
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export { voice } from './plugin';
|
|
2
|
-
export { createVoiceAssistant, createVoiceExperiment } from './assistant';
|
|
2
|
+
export { createVoiceAssistant, createVoiceExperiment, summarizeVoiceAssistantRuns } from './assistant';
|
|
3
|
+
export { createVoiceAssistantHealthHTMLHandler, createVoiceAssistantHealthJSONHandler, createVoiceAssistantHealthRoutes, renderVoiceAssistantHealthHTML, summarizeVoiceAssistantHealth } from './assistantHealth';
|
|
4
|
+
export { createVoiceSessionReplayHTMLHandler, createVoiceSessionReplayJSONHandler, createVoiceSessionReplayRoutes, summarizeVoiceSessionReplay } from './sessionReplay';
|
|
3
5
|
export { createVoiceAgent, createVoiceAgentSquad, createVoiceAgentTool } from './agent';
|
|
4
|
-
export { createStoredVoiceCallReviewArtifact, createStoredVoiceExternalObjectMap, createStoredVoiceIntegrationEvent, createStoredVoiceOpsTask, createVoiceFileExternalObjectMapStore, createVoiceFileIntegrationEventStore, createVoiceFileReviewStore, createVoiceFileRuntimeStorage, createVoiceFileSessionStore, createVoiceFileTaskStore, createVoiceFileTraceSinkDeliveryStore, createVoiceFileTraceEventStore } from './fileStore';
|
|
6
|
+
export { createStoredVoiceCallReviewArtifact, createStoredVoiceExternalObjectMap, createStoredVoiceIntegrationEvent, createStoredVoiceOpsTask, createVoiceFileExternalObjectMapStore, createVoiceFileAssistantMemoryStore, createVoiceFileIntegrationEventStore, createVoiceFileReviewStore, createVoiceFileRuntimeStorage, createVoiceFileSessionStore, createVoiceFileTaskStore, createVoiceFileTraceSinkDeliveryStore, createVoiceFileTraceEventStore } from './fileStore';
|
|
7
|
+
export { createVoiceAssistantMemoryHandle, createVoiceAssistantMemoryRecord, createVoiceMemoryAssistantMemoryStore, resolveVoiceAssistantMemoryNamespace } from './assistantMemory';
|
|
8
|
+
export { createAnthropicVoiceAssistantModel, createGeminiVoiceAssistantModel, createJSONVoiceAssistantModel, createOpenAIVoiceAssistantModel, createVoiceProviderRouter } from './modelAdapters';
|
|
9
|
+
export { createVoiceProviderHealthHTMLHandler, createVoiceProviderHealthJSONHandler, createVoiceProviderHealthRoutes, renderVoiceProviderHealthHTML, summarizeVoiceProviderHealth } from './providerHealth';
|
|
5
10
|
export { buildVoiceTraceReplay, createVoiceMemoryTraceSinkDeliveryStore, createVoiceTraceHTTPSink, createVoiceMemoryTraceEventStore, createVoiceTraceSinkDeliveryId, createVoiceTraceSinkDeliveryRecord, createVoiceTraceSinkStore, createVoiceTraceEvent, createVoiceTraceEventId, deliverVoiceTraceEventsToSinks, evaluateVoiceTrace, exportVoiceTrace, filterVoiceTraceEvents, pruneVoiceTraceEvents, redactVoiceTraceEvent, redactVoiceTraceEvents, redactVoiceTraceText, renderVoiceTraceHTML, renderVoiceTraceMarkdown, resolveVoiceTraceRedactionOptions, selectVoiceTraceEventsForPrune, summarizeVoiceTrace } from './trace';
|
|
6
11
|
export { createVoiceSQLiteExternalObjectMapStore, createVoiceSQLiteIntegrationEventStore, createVoiceSQLiteReviewStore, createVoiceSQLiteRuntimeStorage, createVoiceSQLiteSessionStore, createVoiceSQLiteTaskStore, createVoiceSQLiteTraceSinkDeliveryStore, createVoiceSQLiteTraceEventStore } from './sqliteStore';
|
|
7
12
|
export { createVoicePostgresExternalObjectMapStore, createVoicePostgresIntegrationEventStore, createVoicePostgresReviewStore, createVoicePostgresRuntimeStorage, createVoicePostgresSessionStore, createVoicePostgresTaskStore, createVoicePostgresTraceSinkDeliveryStore, createVoicePostgresTraceEventStore } from './postgresStore';
|
|
@@ -22,7 +27,12 @@ export { conditionAudioChunk, resolveAudioConditioningConfig } from './audioCond
|
|
|
22
27
|
export { resolveVoiceRuntimePreset } from './presets';
|
|
23
28
|
export { resolveTurnDetectionConfig, TURN_PROFILE_DEFAULTS } from './turnProfiles';
|
|
24
29
|
export { createVoiceCallReviewFromLiveTelephonyReport, createVoiceCallReviewRecorder, renderVoiceCallReviewHTML, renderVoiceCallReviewMarkdown } from './testing/review';
|
|
25
|
-
export type { VoiceAssistant, VoiceAssistantArtifactPlan, VoiceAssistantExperiment, VoiceAssistantExperimentOptions, VoiceAssistantGuardrailInput, VoiceAssistantGuardrails, VoiceAssistantOptions, VoiceAssistantOutputGuardrailInput, VoiceAssistantPreset, VoiceAssistantVariant } from './assistant';
|
|
30
|
+
export type { VoiceAssistant, VoiceAssistantArtifactPlan, VoiceAssistantExperiment, VoiceAssistantExperimentOptions, VoiceAssistantGuardrailInput, VoiceAssistantGuardrails, VoiceAssistantMemoryLifecycle, VoiceAssistantMemoryLifecycleInput, VoiceAssistantOptions, VoiceAssistantOutputGuardrailInput, VoiceAssistantPreset, VoiceAssistantRunsSummary, VoiceAssistantRunSummary, VoiceAssistantVariant } from './assistant';
|
|
31
|
+
export type { VoiceAssistantHealthFailure, VoiceAssistantHealthHTMLHandlerOptions, VoiceAssistantHealthRoutesOptions, VoiceAssistantHealthSummary, VoiceAssistantHealthSummaryOptions } from './assistantHealth';
|
|
32
|
+
export type { VoiceAssistantMemoryBinding, VoiceAssistantMemoryHandle, VoiceAssistantMemoryOptions, VoiceAssistantMemoryRecord, VoiceAssistantMemoryStore } from './assistantMemory';
|
|
33
|
+
export type { VoiceSessionReplay, VoiceSessionReplayHTMLHandlerOptions, VoiceSessionReplayOptions, VoiceSessionReplayRoutesOptions, VoiceSessionReplayTurn } from './sessionReplay';
|
|
34
|
+
export type { AnthropicVoiceAssistantModelOptions, GeminiVoiceAssistantModelOptions, OpenAIVoiceAssistantModelOptions, VoiceProviderRouterEvent, VoiceProviderRouterFallbackMode, VoiceProviderRouterHealthOptions, VoiceProviderRouterOptions, VoiceProviderRouterPolicy, VoiceProviderRouterProviderHealth, VoiceProviderRouterProviderProfile, VoiceJSONAssistantModelHandler, VoiceJSONAssistantModelOptions } from './modelAdapters';
|
|
35
|
+
export type { VoiceProviderHealthStatus, VoiceProviderHealthSummary, VoiceProviderHealthSummaryOptions } from './providerHealth';
|
|
26
36
|
export type { VoiceAgent, VoiceAgentMessage, VoiceAgentMessageRole, VoiceAgentModel, VoiceAgentModelInput, VoiceAgentModelOutput, VoiceAgentOptions, VoiceAgentRunResult, VoiceAgentSquadOptions, VoiceAgentTool, VoiceAgentToolCall, VoiceAgentToolResult } from './agent';
|
|
27
37
|
export type { VoiceOpsRuntime, VoiceOpsRuntimeConfig, VoiceOpsRuntimeSummary, VoiceOpsRuntimeSinkWorkerConfig, VoiceOpsRuntimeTaskWorkerConfig, VoiceOpsRuntimeTickResult, VoiceOpsRuntimeWebhookWorkerConfig } from './opsRuntime';
|
|
28
38
|
export type { VoiceOpsPresetName, VoiceOpsPresetOverrides, VoiceResolvedOpsPreset } from './opsPresets';
|