@absolutejs/voice 0.0.22-beta.15 → 0.0.22-beta.16

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/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { createVoiceAgent, createVoiceAgentSquad, createVoiceAgentTool } from '.
4
4
  export { createStoredVoiceCallReviewArtifact, createStoredVoiceExternalObjectMap, createStoredVoiceIntegrationEvent, createStoredVoiceOpsTask, createVoiceFileExternalObjectMapStore, createVoiceFileAssistantMemoryStore, createVoiceFileIntegrationEventStore, createVoiceFileReviewStore, createVoiceFileRuntimeStorage, createVoiceFileSessionStore, createVoiceFileTaskStore, createVoiceFileTraceSinkDeliveryStore, createVoiceFileTraceEventStore } from './fileStore';
5
5
  export { createVoiceAssistantMemoryHandle, createVoiceAssistantMemoryRecord, createVoiceMemoryAssistantMemoryStore, resolveVoiceAssistantMemoryNamespace } from './assistantMemory';
6
6
  export { createAnthropicVoiceAssistantModel, createGeminiVoiceAssistantModel, createJSONVoiceAssistantModel, createOpenAIVoiceAssistantModel, createVoiceProviderRouter } from './modelAdapters';
7
- export { renderVoiceProviderHealthHTML, summarizeVoiceProviderHealth } from './providerHealth';
7
+ export { createVoiceProviderHealthHTMLHandler, createVoiceProviderHealthJSONHandler, createVoiceProviderHealthRoutes, renderVoiceProviderHealthHTML, summarizeVoiceProviderHealth } from './providerHealth';
8
8
  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';
9
9
  export { createVoiceSQLiteExternalObjectMapStore, createVoiceSQLiteIntegrationEventStore, createVoiceSQLiteReviewStore, createVoiceSQLiteRuntimeStorage, createVoiceSQLiteSessionStore, createVoiceSQLiteTaskStore, createVoiceSQLiteTraceSinkDeliveryStore, createVoiceSQLiteTraceEventStore } from './sqliteStore';
10
10
  export { createVoicePostgresExternalObjectMapStore, createVoicePostgresIntegrationEventStore, createVoicePostgresReviewStore, createVoicePostgresRuntimeStorage, createVoicePostgresSessionStore, createVoicePostgresTaskStore, createVoicePostgresTraceSinkDeliveryStore, createVoicePostgresTraceEventStore } from './postgresStore';
package/dist/index.js CHANGED
@@ -7856,6 +7856,7 @@ var createGeminiVoiceAssistantModel = (options) => {
7856
7856
  };
7857
7857
  };
7858
7858
  // src/providerHealth.ts
7859
+ import { Elysia as Elysia2 } from "elysia";
7859
7860
  var getString = (value) => typeof value === "string" ? value : undefined;
7860
7861
  var getNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
7861
7862
  var isProviderStatus = (value) => value === "success" || value === "fallback" || value === "error";
@@ -8015,6 +8016,29 @@ var renderVoiceProviderHealthHTML = (providers) => providers.length === 0 ? '<p
8015
8016
  }),
8016
8017
  "</div>"
8017
8018
  ].join("");
8019
+ var createVoiceProviderHealthJSONHandler = (options) => async () => summarizeVoiceProviderHealth(options);
8020
+ var createVoiceProviderHealthHTMLHandler = (options) => async () => {
8021
+ const providers = await summarizeVoiceProviderHealth(options);
8022
+ const render = options.render ?? renderVoiceProviderHealthHTML;
8023
+ const body = await render(providers);
8024
+ return new Response(body, {
8025
+ headers: {
8026
+ "Content-Type": "text/html; charset=utf-8",
8027
+ ...options.headers
8028
+ }
8029
+ });
8030
+ };
8031
+ var createVoiceProviderHealthRoutes = (options) => {
8032
+ const path = options.path ?? "/api/provider-status";
8033
+ const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
8034
+ const routes = new Elysia2({
8035
+ name: options.name ?? "absolutejs-voice-provider-health"
8036
+ }).get(path, createVoiceProviderHealthJSONHandler(options));
8037
+ if (htmlPath) {
8038
+ routes.get(htmlPath, createVoiceProviderHealthHTMLHandler(options));
8039
+ }
8040
+ return routes;
8041
+ };
8018
8042
  // src/sqliteStore.ts
8019
8043
  import { Database } from "bun:sqlite";
8020
8044
  var normalizeTableNameSegment = (value) => value.trim().replace(/[^a-zA-Z0-9_]+/g, "_").replace(/^_+|_+$/g, "") || "voice";
@@ -10545,6 +10569,9 @@ export {
10545
10569
  createVoiceRedisTaskLeaseCoordinator,
10546
10570
  createVoiceRedisIdempotencyStore,
10547
10571
  createVoiceProviderRouter,
10572
+ createVoiceProviderHealthRoutes,
10573
+ createVoiceProviderHealthJSONHandler,
10574
+ createVoiceProviderHealthHTMLHandler,
10548
10575
  createVoicePostgresTraceSinkDeliveryStore,
10549
10576
  createVoicePostgresTraceEventStore,
10550
10577
  createVoicePostgresTaskStore,
@@ -1,3 +1,4 @@
1
+ import { Elysia } from 'elysia';
1
2
  import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from './trace';
2
3
  export type VoiceProviderHealthStatus = 'healthy' | 'idle' | 'rate-limited' | 'degraded' | 'recoverable' | 'suppressed';
3
4
  export type VoiceProviderHealthSummary<TProvider extends string = string> = {
@@ -21,5 +22,57 @@ export type VoiceProviderHealthSummaryOptions<TProvider extends string = string>
21
22
  providers?: readonly TProvider[];
22
23
  store?: VoiceTraceEventStore;
23
24
  };
25
+ export type VoiceProviderHealthHandlerOptions<TProvider extends string = string> = VoiceProviderHealthSummaryOptions<TProvider>;
26
+ export type VoiceProviderHealthHTMLHandlerOptions<TProvider extends string = string> = VoiceProviderHealthHandlerOptions<TProvider> & {
27
+ headers?: HeadersInit;
28
+ render?: (providers: VoiceProviderHealthSummary<TProvider>[]) => string | Promise<string>;
29
+ };
30
+ export type VoiceProviderHealthRoutesOptions<TProvider extends string = string> = VoiceProviderHealthHTMLHandlerOptions<TProvider> & {
31
+ htmlPath?: false | string;
32
+ name?: string;
33
+ path?: string;
34
+ };
24
35
  export declare const summarizeVoiceProviderHealth: <TProvider extends string = string>(input: StoredVoiceTraceEvent[] | VoiceProviderHealthSummaryOptions<TProvider>) => Promise<VoiceProviderHealthSummary<TProvider>[]>;
25
36
  export declare const renderVoiceProviderHealthHTML: (providers: VoiceProviderHealthSummary[]) => string;
37
+ export declare const createVoiceProviderHealthJSONHandler: <TProvider extends string = string>(options: VoiceProviderHealthHandlerOptions<TProvider>) => () => Promise<VoiceProviderHealthSummary<TProvider>[]>;
38
+ export declare const createVoiceProviderHealthHTMLHandler: <TProvider extends string = string>(options: VoiceProviderHealthHTMLHandlerOptions<TProvider>) => () => Promise<Response>;
39
+ export declare const createVoiceProviderHealthRoutes: <TProvider extends string = string>(options: VoiceProviderHealthRoutesOptions<TProvider>) => Elysia<"", {
40
+ decorator: {};
41
+ store: {};
42
+ derive: {};
43
+ resolve: {};
44
+ }, {
45
+ typebox: {};
46
+ error: {};
47
+ }, {
48
+ schema: {};
49
+ standaloneSchema: {};
50
+ macro: {};
51
+ macroFn: {};
52
+ parser: {};
53
+ response: {};
54
+ }, {
55
+ [x: string]: {
56
+ get: {
57
+ body: unknown;
58
+ params: {};
59
+ query: unknown;
60
+ headers: unknown;
61
+ response: {
62
+ 200: VoiceProviderHealthSummary<TProvider>[];
63
+ };
64
+ };
65
+ };
66
+ }, {
67
+ derive: {};
68
+ resolve: {};
69
+ schema: {};
70
+ standaloneSchema: {};
71
+ response: {};
72
+ }, {
73
+ derive: {};
74
+ resolve: {};
75
+ schema: {};
76
+ standaloneSchema: {};
77
+ response: {};
78
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.15",
3
+ "version": "0.0.22-beta.16",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",