@absolutejs/voice 0.0.22-beta.154 → 0.0.22-beta.156

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,99 @@
1
+ import { Elysia } from 'elysia';
2
+ import { type StoredVoiceAuditEvent, type VoiceAuditEventStore } from './audit';
3
+ import { type VoiceTraceEventStore } from './trace';
4
+ export type VoiceOpsActionAuditRecord = {
5
+ actionId: string;
6
+ body?: unknown;
7
+ error?: string;
8
+ ok: boolean;
9
+ ranAt: number;
10
+ status: number;
11
+ };
12
+ export type VoiceOpsActionAuditRoutesOptions = {
13
+ audit?: VoiceAuditEventStore;
14
+ historyHtmlPath?: false | string;
15
+ historyPath?: false | string;
16
+ name?: string;
17
+ path?: string;
18
+ trace?: VoiceTraceEventStore;
19
+ };
20
+ export type VoiceOpsActionHistoryEntry = {
21
+ actionId: string;
22
+ at: number;
23
+ error?: string;
24
+ eventId: string;
25
+ ok: boolean;
26
+ status?: number;
27
+ traceId?: string;
28
+ };
29
+ export type VoiceOpsActionHistoryReport = {
30
+ checkedAt: number;
31
+ entries: VoiceOpsActionHistoryEntry[];
32
+ failed: number;
33
+ passed: number;
34
+ total: number;
35
+ };
36
+ export declare const recordVoiceOpsActionAudit: (record: VoiceOpsActionAuditRecord, options: Pick<VoiceOpsActionAuditRoutesOptions, "audit" | "trace">) => Promise<{
37
+ audit: StoredVoiceAuditEvent<Record<string, unknown>> | (Omit<import("./audit").VoiceAuditEvent<Record<string, unknown>>, "at" | "id"> & {
38
+ at: number;
39
+ id: string;
40
+ }) | undefined;
41
+ ok: boolean;
42
+ trace: (import("./trace").VoiceTraceEvent<Record<string, unknown>> & {
43
+ id: string;
44
+ }) | undefined;
45
+ }>;
46
+ export declare const createVoiceOpsActionAuditRoutes: (options: VoiceOpsActionAuditRoutesOptions) => Elysia<"", {
47
+ decorator: {};
48
+ store: {};
49
+ derive: {};
50
+ resolve: {};
51
+ }, {
52
+ typebox: {};
53
+ error: {};
54
+ }, {
55
+ schema: {};
56
+ standaloneSchema: {};
57
+ macro: {};
58
+ macroFn: {};
59
+ parser: {};
60
+ response: {};
61
+ }, {
62
+ [x: string]: {
63
+ post: {
64
+ body: unknown;
65
+ params: {};
66
+ query: unknown;
67
+ headers: unknown;
68
+ response: {
69
+ 200: {
70
+ audit: StoredVoiceAuditEvent<Record<string, unknown>> | (Omit<import("./audit").VoiceAuditEvent<Record<string, unknown>>, "at" | "id"> & {
71
+ at: number;
72
+ id: string;
73
+ }) | undefined;
74
+ ok: boolean;
75
+ trace: (import("./trace").VoiceTraceEvent<Record<string, unknown>> & {
76
+ id: string;
77
+ }) | undefined;
78
+ } | {
79
+ error: string;
80
+ ok: boolean;
81
+ };
82
+ };
83
+ };
84
+ };
85
+ }, {
86
+ derive: {};
87
+ resolve: {};
88
+ schema: {};
89
+ standaloneSchema: {};
90
+ response: {};
91
+ }, {
92
+ derive: {};
93
+ resolve: {};
94
+ schema: {};
95
+ standaloneSchema: {};
96
+ response: {};
97
+ }>;
98
+ export declare const buildVoiceOpsActionHistoryReport: (options: Pick<VoiceOpsActionAuditRoutesOptions, "audit">) => Promise<VoiceOpsActionHistoryReport>;
99
+ export declare const renderVoiceOpsActionHistoryHTML: (report: VoiceOpsActionHistoryReport) => string;
@@ -388,6 +388,23 @@ var VoiceOpsStatus = ({
388
388
  }, undefined, true, undefined, this);
389
389
  };
390
390
  // src/client/opsActionCenter.ts
391
+ var recordVoiceOpsActionResult = async (result, options = {}) => {
392
+ if (options.auditPath === false) {
393
+ return;
394
+ }
395
+ const path = options.auditPath ?? "/api/voice/ops-actions/audit";
396
+ const fetchImpl = options.fetch ?? globalThis.fetch;
397
+ const response = await fetchImpl(path, {
398
+ body: JSON.stringify(result),
399
+ headers: {
400
+ "Content-Type": "application/json"
401
+ },
402
+ method: "POST"
403
+ });
404
+ if (!response.ok) {
405
+ throw new Error(`Voice ops action audit failed: HTTP ${response.status}`);
406
+ }
407
+ };
391
408
  var createVoiceOpsActionCenterActions = (options = {}) => {
392
409
  const deliveryRuntimePath = options.deliveryRuntimePath ?? "/api/voice-delivery-runtime";
393
410
  const actions = [];
@@ -500,6 +517,8 @@ var createVoiceOpsActionCenterStore = (options = {}) => {
500
517
  emit();
501
518
  try {
502
519
  const result = await runVoiceOpsAction(action, options);
520
+ await options.onActionResult?.(result);
521
+ await recordVoiceOpsActionResult(result, options);
503
522
  snapshot = {
504
523
  ...snapshot,
505
524
  error: null,
@@ -511,6 +530,16 @@ var createVoiceOpsActionCenterStore = (options = {}) => {
511
530
  emit();
512
531
  return result;
513
532
  } catch (error) {
533
+ const result = {
534
+ actionId: action.id,
535
+ body: null,
536
+ error: error instanceof Error ? error.message : String(error),
537
+ ok: false,
538
+ ranAt: Date.now(),
539
+ status: 0
540
+ };
541
+ await options.onActionResult?.(result);
542
+ await recordVoiceOpsActionResult(result, options).catch(() => {});
514
543
  snapshot = {
515
544
  ...snapshot,
516
545
  error: error instanceof Error ? error.message : String(error),
@@ -469,6 +469,23 @@ var createVoiceDeliveryRuntime = (path = "/api/voice-delivery-runtime", options
469
469
  };
470
470
  };
471
471
  // src/client/opsActionCenter.ts
472
+ var recordVoiceOpsActionResult = async (result, options = {}) => {
473
+ if (options.auditPath === false) {
474
+ return;
475
+ }
476
+ const path = options.auditPath ?? "/api/voice/ops-actions/audit";
477
+ const fetchImpl = options.fetch ?? globalThis.fetch;
478
+ const response = await fetchImpl(path, {
479
+ body: JSON.stringify(result),
480
+ headers: {
481
+ "Content-Type": "application/json"
482
+ },
483
+ method: "POST"
484
+ });
485
+ if (!response.ok) {
486
+ throw new Error(`Voice ops action audit failed: HTTP ${response.status}`);
487
+ }
488
+ };
472
489
  var createVoiceOpsActionCenterActions = (options = {}) => {
473
490
  const deliveryRuntimePath = options.deliveryRuntimePath ?? "/api/voice-delivery-runtime";
474
491
  const actions = [];
@@ -581,6 +598,8 @@ var createVoiceOpsActionCenterStore = (options = {}) => {
581
598
  emit();
582
599
  try {
583
600
  const result = await runVoiceOpsAction(action, options);
601
+ await options.onActionResult?.(result);
602
+ await recordVoiceOpsActionResult(result, options);
584
603
  snapshot = {
585
604
  ...snapshot,
586
605
  error: null,
@@ -592,6 +611,16 @@ var createVoiceOpsActionCenterStore = (options = {}) => {
592
611
  emit();
593
612
  return result;
594
613
  } catch (error) {
614
+ const result = {
615
+ actionId: action.id,
616
+ body: null,
617
+ error: error instanceof Error ? error.message : String(error),
618
+ ok: false,
619
+ ranAt: Date.now(),
620
+ status: 0
621
+ };
622
+ await options.onActionResult?.(result);
623
+ await recordVoiceOpsActionResult(result, options).catch(() => {});
595
624
  snapshot = {
596
625
  ...snapshot,
597
626
  error: error instanceof Error ? error.message : String(error),
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.handoff' | 'agent.model' | 'agent.result' | 'agent.tool' | 'call.handoff' | 'call.lifecycle' | 'client.barge_in' | 'client.live_latency' | 'client.reconnect' | '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.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';
3
3
  export type VoiceTraceEvent<TPayload extends Record<string, unknown> = Record<string, unknown>> = {
4
4
  at: number;
5
5
  id?: string;
package/dist/vue/index.js CHANGED
@@ -378,6 +378,23 @@ var VoiceOpsStatus = defineComponent({
378
378
  import { defineComponent as defineComponent2, h as h2 } from "vue";
379
379
 
380
380
  // src/client/opsActionCenter.ts
381
+ var recordVoiceOpsActionResult = async (result, options = {}) => {
382
+ if (options.auditPath === false) {
383
+ return;
384
+ }
385
+ const path = options.auditPath ?? "/api/voice/ops-actions/audit";
386
+ const fetchImpl = options.fetch ?? globalThis.fetch;
387
+ const response = await fetchImpl(path, {
388
+ body: JSON.stringify(result),
389
+ headers: {
390
+ "Content-Type": "application/json"
391
+ },
392
+ method: "POST"
393
+ });
394
+ if (!response.ok) {
395
+ throw new Error(`Voice ops action audit failed: HTTP ${response.status}`);
396
+ }
397
+ };
381
398
  var createVoiceOpsActionCenterActions = (options = {}) => {
382
399
  const deliveryRuntimePath = options.deliveryRuntimePath ?? "/api/voice-delivery-runtime";
383
400
  const actions = [];
@@ -490,6 +507,8 @@ var createVoiceOpsActionCenterStore = (options = {}) => {
490
507
  emit();
491
508
  try {
492
509
  const result = await runVoiceOpsAction(action, options);
510
+ await options.onActionResult?.(result);
511
+ await recordVoiceOpsActionResult(result, options);
493
512
  snapshot = {
494
513
  ...snapshot,
495
514
  error: null,
@@ -501,6 +520,16 @@ var createVoiceOpsActionCenterStore = (options = {}) => {
501
520
  emit();
502
521
  return result;
503
522
  } catch (error) {
523
+ const result = {
524
+ actionId: action.id,
525
+ body: null,
526
+ error: error instanceof Error ? error.message : String(error),
527
+ ok: false,
528
+ ranAt: Date.now(),
529
+ status: 0
530
+ };
531
+ await options.onActionResult?.(result);
532
+ await recordVoiceOpsActionResult(result, options).catch(() => {});
504
533
  snapshot = {
505
534
  ...snapshot,
506
535
  error: error instanceof Error ? error.message : String(error),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.154",
3
+ "version": "0.0.22-beta.156",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",