@absolutejs/voice 0.0.22-beta.501 → 0.0.22-beta.503

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.
@@ -0,0 +1,28 @@
1
+ export type VoiceHTMXPollingAttributes = {
2
+ /** Set true to emit hx-get/hx-trigger when refreshUrl is also provided. */
3
+ poll?: boolean;
4
+ /** Polling cadence. Default 5_000ms. Clamped to >= 1_000ms. */
5
+ pollIntervalMs?: number;
6
+ /** Extra HTMX attributes to splice in. Keys without the 'hx-' prefix have it added. */
7
+ pushAttributes?: Record<string, string>;
8
+ /** URL hx-get fires against. Without it, polling is skipped. */
9
+ refreshUrl?: string;
10
+ /** hx-swap value. Default 'outerHTML'. */
11
+ swap?: string;
12
+ /** Optional hx-target selector. */
13
+ target?: string;
14
+ };
15
+ export declare const buildVoiceHTMXAttributes: (attrs: VoiceHTMXPollingAttributes | undefined) => string;
16
+ /**
17
+ * Injects HTMX polling attributes into the first opening tag of an HTML string.
18
+ * Returns the original HTML unchanged when attrs produce no attributes.
19
+ */
20
+ export declare const wrapVoiceHTMLWithHTMXPolling: (html: string, attrs: VoiceHTMXPollingAttributes | undefined) => string;
21
+ /**
22
+ * Wraps arbitrary HTML in a self-refreshing div that polls refreshUrl.
23
+ * Use this when the inner HTML doesn't have a stable root element to mutate.
24
+ */
25
+ export declare const wrapVoiceHTMLInHTMXContainer: (html: string, attrs: VoiceHTMXPollingAttributes & {
26
+ className?: string;
27
+ elementTag?: string;
28
+ }) => string;
@@ -0,0 +1,72 @@
1
+ import type { StoredVoiceTraceEvent } from "../trace";
2
+ import type { VoiceCallReviewArtifact } from "../testing/review";
3
+ import { type VoiceCostDashboardBucket, type VoiceCostDashboardOptions, type VoiceCostDashboardReport } from "./costDashboard";
4
+ import { type LiveCallViewState, type LiveCallViewer } from "./liveCallViewer";
5
+ import { type ReplayTimelineReport } from "./replayTimeline";
6
+ import { type VoiceHTMXPollingAttributes } from "./htmxAttributes";
7
+ export type VoiceDashboardHTMXAttributes = VoiceHTMXPollingAttributes;
8
+ export type VoiceCostDashboardHTMXInput = {
9
+ attributes?: VoiceDashboardHTMXAttributes;
10
+ currency?: string;
11
+ emptyMessage?: string;
12
+ report: VoiceCostDashboardReport;
13
+ title?: string;
14
+ };
15
+ export type VoiceCostDashboardRenderer = (input: VoiceCostDashboardHTMXInput) => string;
16
+ export type VoiceCostDashboardCellRenderer = (bucket: VoiceCostDashboardBucket, currency: string, isTotal: boolean) => string;
17
+ export type VoiceReplayTimelineHTMXInput = {
18
+ attributes?: VoiceDashboardHTMXAttributes;
19
+ emptyMessage?: string;
20
+ report: ReplayTimelineReport;
21
+ title?: string;
22
+ };
23
+ export type VoiceReplayTimelineRenderer = (input: VoiceReplayTimelineHTMXInput) => string;
24
+ export type VoiceLiveCallViewerHTMXInput = {
25
+ attributes?: VoiceDashboardHTMXAttributes;
26
+ state: LiveCallViewState;
27
+ title?: string;
28
+ };
29
+ export type VoiceLiveCallViewerRenderer = (input: VoiceLiveCallViewerHTMXInput) => string;
30
+ export type VoiceDashboardHTMXRendererConfig = {
31
+ costDashboard?: VoiceCostDashboardRenderer;
32
+ liveCallViewer?: VoiceLiveCallViewerRenderer;
33
+ replayTimeline?: VoiceReplayTimelineRenderer;
34
+ };
35
+ export type ResolvedVoiceDashboardRenderers = Required<VoiceDashboardHTMXRendererConfig>;
36
+ export declare const resolveVoiceDashboardRenderers: (custom?: VoiceDashboardHTMXRendererConfig) => ResolvedVoiceDashboardRenderers;
37
+ export declare const renderVoiceCostDashboardHTMX: (input: VoiceCostDashboardHTMXInput & {
38
+ custom?: VoiceCostDashboardRenderer;
39
+ }) => string;
40
+ export declare const renderVoiceReplayTimelineHTMX: (input: VoiceReplayTimelineHTMXInput & {
41
+ custom?: VoiceReplayTimelineRenderer;
42
+ }) => string;
43
+ export declare const renderVoiceLiveCallViewerHTMX: (input: VoiceLiveCallViewerHTMXInput & {
44
+ custom?: VoiceLiveCallViewerRenderer;
45
+ }) => string;
46
+ export declare const renderVoiceCostDashboardFromEvents: (input: {
47
+ attributes?: VoiceDashboardHTMXAttributes;
48
+ currency?: string;
49
+ events: ReadonlyArray<StoredVoiceTraceEvent>;
50
+ options?: Omit<VoiceCostDashboardOptions, "events">;
51
+ renderer?: VoiceCostDashboardRenderer;
52
+ title?: string;
53
+ }) => string;
54
+ export declare const renderVoiceReplayTimelineFromArtifact: (input: {
55
+ artifact: VoiceCallReviewArtifact;
56
+ attributes?: VoiceDashboardHTMXAttributes;
57
+ renderer?: VoiceReplayTimelineRenderer;
58
+ title?: string;
59
+ }) => string;
60
+ export declare const renderVoiceLiveCallViewerFromViewer: (input: {
61
+ attributes?: VoiceDashboardHTMXAttributes;
62
+ renderer?: VoiceLiveCallViewerRenderer;
63
+ title?: string;
64
+ viewer: LiveCallViewer;
65
+ }) => string;
66
+ export declare const renderVoiceLiveCallViewerFromState: (input: {
67
+ attributes?: VoiceDashboardHTMXAttributes;
68
+ renderer?: VoiceLiveCallViewerRenderer;
69
+ state: LiveCallViewState;
70
+ title?: string;
71
+ }) => string;
72
+ export declare const createLiveCallViewerFromOptions: (options: import("./liveCallViewer").CreateLiveCallViewerOptions) => LiveCallViewer;
@@ -0,0 +1,249 @@
1
+ import { Elysia } from "elysia";
2
+ import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from "./trace";
3
+ import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "./testing/review";
4
+ import type { LiveCallViewer } from "./client/liveCallViewer";
5
+ import { type VoiceDashboardHTMXRendererConfig } from "./client/htmxDashboardRenderers";
6
+ import type { VoiceCostDashboardOptions } from "./client/costDashboard";
7
+ export type VoiceHTMXDashboardRoutesShared = {
8
+ name?: string;
9
+ render?: VoiceDashboardHTMXRendererConfig;
10
+ };
11
+ export type VoiceHTMXCostDashboardRoutesOptions = VoiceHTMXDashboardRoutesShared & {
12
+ bucketBy?: VoiceCostDashboardOptions["bucketBy"];
13
+ currency?: string;
14
+ fromMs?: () => number | undefined;
15
+ path?: string;
16
+ pollIntervalMs?: number;
17
+ resolveEvents: () => Promise<ReadonlyArray<StoredVoiceTraceEvent>> | ReadonlyArray<StoredVoiceTraceEvent>;
18
+ title?: string;
19
+ toMs?: () => number | undefined;
20
+ };
21
+ export declare const createVoiceCostDashboardHTMXRoute: (options: VoiceHTMXCostDashboardRoutesOptions) => Elysia<"", {
22
+ decorator: {};
23
+ store: {};
24
+ derive: {};
25
+ resolve: {};
26
+ }, {
27
+ typebox: {};
28
+ error: {};
29
+ }, {
30
+ schema: {};
31
+ standaloneSchema: {};
32
+ macro: {};
33
+ macroFn: {};
34
+ parser: {};
35
+ response: {};
36
+ }, {
37
+ [x: string]: {
38
+ get: {
39
+ body: unknown;
40
+ params: {};
41
+ query: unknown;
42
+ headers: unknown;
43
+ response: {
44
+ 200: Response;
45
+ };
46
+ };
47
+ };
48
+ }, {
49
+ derive: {};
50
+ resolve: {};
51
+ schema: {};
52
+ standaloneSchema: {};
53
+ response: {};
54
+ }, {
55
+ derive: {};
56
+ resolve: {};
57
+ schema: {};
58
+ standaloneSchema: {};
59
+ response: {};
60
+ }>;
61
+ export type VoiceHTMXReplayTimelineRoutesOptions = VoiceHTMXDashboardRoutesShared & {
62
+ /** The HTML route mounts at `${path}/:artifactId`. */
63
+ path?: string;
64
+ resolveArtifact: (artifactId: string) => Promise<StoredVoiceCallReviewArtifact | undefined> | StoredVoiceCallReviewArtifact | undefined;
65
+ title?: string;
66
+ };
67
+ export declare const createVoiceReplayTimelineHTMXRoute: (options: VoiceHTMXReplayTimelineRoutesOptions) => Elysia<"", {
68
+ decorator: {};
69
+ store: {};
70
+ derive: {};
71
+ resolve: {};
72
+ }, {
73
+ typebox: {};
74
+ error: {};
75
+ }, {
76
+ schema: {};
77
+ standaloneSchema: {};
78
+ macro: {};
79
+ macroFn: {};
80
+ parser: {};
81
+ response: {};
82
+ }, {
83
+ [x: string]: {
84
+ ":artifactId": {
85
+ get: {
86
+ body: unknown;
87
+ params: {
88
+ artifactId: string;
89
+ } & {};
90
+ query: unknown;
91
+ headers: unknown;
92
+ response: {
93
+ 200: Response;
94
+ 422: {
95
+ type: "validation";
96
+ on: string;
97
+ summary?: string;
98
+ message?: string;
99
+ found?: unknown;
100
+ property?: string;
101
+ expected?: string;
102
+ };
103
+ };
104
+ };
105
+ };
106
+ };
107
+ }, {
108
+ derive: {};
109
+ resolve: {};
110
+ schema: {};
111
+ standaloneSchema: {};
112
+ response: {};
113
+ }, {
114
+ derive: {};
115
+ resolve: {};
116
+ schema: {};
117
+ standaloneSchema: {};
118
+ response: {};
119
+ }>;
120
+ export type VoiceHTMXLiveCallViewerRoutesOptions = VoiceHTMXDashboardRoutesShared & {
121
+ /** Route mounts at `${path}/:sessionId`. */
122
+ path?: string;
123
+ pollIntervalMs?: number;
124
+ resolveViewer: (sessionId: string) => Promise<LiveCallViewer | undefined> | LiveCallViewer | undefined;
125
+ title?: string;
126
+ };
127
+ export declare const createVoiceLiveCallViewerHTMXRoute: (options: VoiceHTMXLiveCallViewerRoutesOptions) => Elysia<"", {
128
+ decorator: {};
129
+ store: {};
130
+ derive: {};
131
+ resolve: {};
132
+ }, {
133
+ typebox: {};
134
+ error: {};
135
+ }, {
136
+ schema: {};
137
+ standaloneSchema: {};
138
+ macro: {};
139
+ macroFn: {};
140
+ parser: {};
141
+ response: {};
142
+ }, {
143
+ [x: string]: {
144
+ ":sessionId": {
145
+ get: {
146
+ body: unknown;
147
+ params: {
148
+ sessionId: string;
149
+ } & {};
150
+ query: unknown;
151
+ headers: unknown;
152
+ response: {
153
+ 200: Response;
154
+ 422: {
155
+ type: "validation";
156
+ on: string;
157
+ summary?: string;
158
+ message?: string;
159
+ found?: unknown;
160
+ property?: string;
161
+ expected?: string;
162
+ };
163
+ };
164
+ };
165
+ };
166
+ };
167
+ }, {
168
+ derive: {};
169
+ resolve: {};
170
+ schema: {};
171
+ standaloneSchema: {};
172
+ response: {};
173
+ }, {
174
+ derive: {};
175
+ resolve: {};
176
+ schema: {};
177
+ standaloneSchema: {};
178
+ response: {};
179
+ }>;
180
+ export type VoiceHTMXDashboardRoutesOptions = {
181
+ cost?: Omit<VoiceHTMXCostDashboardRoutesOptions, keyof VoiceHTMXDashboardRoutesShared>;
182
+ liveCall?: Omit<VoiceHTMXLiveCallViewerRoutesOptions, keyof VoiceHTMXDashboardRoutesShared>;
183
+ name?: string;
184
+ render?: VoiceDashboardHTMXRendererConfig;
185
+ replay?: Omit<VoiceHTMXReplayTimelineRoutesOptions, keyof VoiceHTMXDashboardRoutesShared>;
186
+ };
187
+ export declare const createVoiceHTMXDashboardRoutes: (options: VoiceHTMXDashboardRoutesOptions) => Elysia<"", {
188
+ decorator: {};
189
+ store: {};
190
+ derive: {};
191
+ resolve: {};
192
+ }, {
193
+ typebox: {};
194
+ error: {};
195
+ }, {
196
+ schema: {};
197
+ standaloneSchema: {};
198
+ macro: {};
199
+ macroFn: {};
200
+ parser: {};
201
+ response: {};
202
+ }, {}, {
203
+ derive: {};
204
+ resolve: {};
205
+ schema: {};
206
+ standaloneSchema: {};
207
+ response: {};
208
+ }, {
209
+ derive: {};
210
+ resolve: {};
211
+ schema: {};
212
+ standaloneSchema: {};
213
+ response: {};
214
+ }>;
215
+ export type CreateVoiceHTMXDashboardRoutesFromStoresOptions = {
216
+ liveViewerByCallId?: (sessionId: string) => Promise<LiveCallViewer | undefined> | LiveCallViewer | undefined;
217
+ pollIntervalMs?: number;
218
+ render?: VoiceDashboardHTMXRendererConfig;
219
+ reviewStore?: VoiceCallReviewStore;
220
+ traceStore?: VoiceTraceEventStore;
221
+ };
222
+ export declare const createVoiceHTMXDashboardRoutesFromStores: (options: CreateVoiceHTMXDashboardRoutesFromStoresOptions) => Elysia<"", {
223
+ decorator: {};
224
+ store: {};
225
+ derive: {};
226
+ resolve: {};
227
+ }, {
228
+ typebox: {};
229
+ error: {};
230
+ }, {
231
+ schema: {};
232
+ standaloneSchema: {};
233
+ macro: {};
234
+ macroFn: {};
235
+ parser: {};
236
+ response: {};
237
+ }, {}, {
238
+ derive: {};
239
+ resolve: {};
240
+ schema: {};
241
+ standaloneSchema: {};
242
+ response: {};
243
+ }, {
244
+ derive: {};
245
+ resolve: {};
246
+ schema: {};
247
+ standaloneSchema: {};
248
+ response: {};
249
+ }>;
package/dist/index.d.ts CHANGED
@@ -110,6 +110,12 @@ export { createInMemoryVoiceCallQuota } from "./callQuota";
110
110
  export type { CreateInMemoryVoiceCallQuotaOptions, VoiceCallQuota, VoiceCallQuotaRejection, VoiceCallQuotaResult, VoiceCallQuotaTier, VoiceCallReservation, } from "./callQuota";
111
111
  export { createVoiceBearerAuthVerifier, createVoiceHMACAuthVerifier, createVoiceRouteAuth, } from "./routeAuth";
112
112
  export type { VoiceRouteAuthDecision, VoiceRouteAuthInput, VoiceRouteAuthOptions, VoiceRouteAuthVerifier, } from "./routeAuth";
113
+ export { buildVoiceHTMXAttributes, wrapVoiceHTMLInHTMXContainer, wrapVoiceHTMLWithHTMXPolling, } from "./client/htmxAttributes";
114
+ export type { VoiceHTMXPollingAttributes } from "./client/htmxAttributes";
115
+ export { createLiveCallViewerFromOptions, renderVoiceCostDashboardFromEvents, renderVoiceCostDashboardHTMX, renderVoiceLiveCallViewerFromState, renderVoiceLiveCallViewerFromViewer, renderVoiceLiveCallViewerHTMX, renderVoiceReplayTimelineFromArtifact, renderVoiceReplayTimelineHTMX, resolveVoiceDashboardRenderers, } from "./client/htmxDashboardRenderers";
116
+ export type { ResolvedVoiceDashboardRenderers, VoiceCostDashboardHTMXInput, VoiceCostDashboardRenderer, VoiceDashboardHTMXAttributes, VoiceDashboardHTMXRendererConfig, VoiceLiveCallViewerHTMXInput, VoiceLiveCallViewerRenderer, VoiceReplayTimelineHTMXInput, VoiceReplayTimelineRenderer, } from "./client/htmxDashboardRenderers";
117
+ export { createVoiceCostDashboardHTMXRoute, createVoiceHTMXDashboardRoutes, createVoiceHTMXDashboardRoutesFromStores, createVoiceLiveCallViewerHTMXRoute, createVoiceReplayTimelineHTMXRoute, } from "./htmxDashboardRoutes";
118
+ export type { CreateVoiceHTMXDashboardRoutesFromStoresOptions, VoiceHTMXCostDashboardRoutesOptions, VoiceHTMXDashboardRoutesOptions, VoiceHTMXLiveCallViewerRoutesOptions, VoiceHTMXReplayTimelineRoutesOptions, } from "./htmxDashboardRoutes";
113
119
  export { buildVoiceCostDashboardReport } from "./client/costDashboard";
114
120
  export type { VoiceCostDashboardBucket, VoiceCostDashboardOptions, VoiceCostDashboardReport, } from "./client/costDashboard";
115
121
  export { createLiveCallViewer } from "./client/liveCallViewer";