@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.
package/README.md CHANGED
@@ -690,6 +690,21 @@ export function OperatorPanel() {
690
690
  }
691
691
  ```
692
692
 
693
+ Mount `createVoiceOpsActionAuditRoutes(...)` to make every action-center click auditable. The client posts successful and failed action results to `/api/voice/ops-actions/audit` by default, and the route records both `operator.action` audit events and `operator.action` trace events.
694
+
695
+ ```ts
696
+ import { createVoiceOpsActionAuditRoutes } from '@absolutejs/voice';
697
+
698
+ app.use(
699
+ createVoiceOpsActionAuditRoutes({
700
+ audit: runtimeStorage.audit,
701
+ trace: runtimeStorage.traces
702
+ })
703
+ );
704
+ ```
705
+
706
+ The same route exposes `GET /api/voice/ops-actions/history` and `/voice/ops-actions` so apps can show recent operator actions beside the action center. For HTML or HTMX pages, use `mountVoiceOpsActionHistory(...)` from `@absolutejs/voice/client`.
707
+
693
708
  For HTML or HTMX pages:
694
709
 
695
710
  ```html
@@ -197,6 +197,23 @@ let _VoiceOpsStatusService = VoiceOpsStatusService;
197
197
  import { computed as computed2, Injectable as Injectable2, signal as signal2 } from "@angular/core";
198
198
 
199
199
  // src/client/opsActionCenter.ts
200
+ var recordVoiceOpsActionResult = async (result, options = {}) => {
201
+ if (options.auditPath === false) {
202
+ return;
203
+ }
204
+ const path = options.auditPath ?? "/api/voice/ops-actions/audit";
205
+ const fetchImpl = options.fetch ?? globalThis.fetch;
206
+ const response = await fetchImpl(path, {
207
+ body: JSON.stringify(result),
208
+ headers: {
209
+ "Content-Type": "application/json"
210
+ },
211
+ method: "POST"
212
+ });
213
+ if (!response.ok) {
214
+ throw new Error(`Voice ops action audit failed: HTTP ${response.status}`);
215
+ }
216
+ };
200
217
  var createVoiceOpsActionCenterActions = (options = {}) => {
201
218
  const deliveryRuntimePath = options.deliveryRuntimePath ?? "/api/voice-delivery-runtime";
202
219
  const actions = [];
@@ -309,6 +326,8 @@ var createVoiceOpsActionCenterStore = (options = {}) => {
309
326
  emit();
310
327
  try {
311
328
  const result = await runVoiceOpsAction(action, options);
329
+ await options.onActionResult?.(result);
330
+ await recordVoiceOpsActionResult(result, options);
312
331
  snapshot = {
313
332
  ...snapshot,
314
333
  error: null,
@@ -320,6 +339,16 @@ var createVoiceOpsActionCenterStore = (options = {}) => {
320
339
  emit();
321
340
  return result;
322
341
  } catch (error) {
342
+ const result = {
343
+ actionId: action.id,
344
+ body: null,
345
+ error: error instanceof Error ? error.message : String(error),
346
+ ok: false,
347
+ ranAt: Date.now(),
348
+ status: 0
349
+ };
350
+ await options.onActionResult?.(result);
351
+ await recordVoiceOpsActionResult(result, options).catch(() => {});
323
352
  snapshot = {
324
353
  ...snapshot,
325
354
  error: error instanceof Error ? error.message : String(error),
@@ -8,10 +8,12 @@ export { createMicrophoneCapture } from './microphone';
8
8
  export { createVoiceBargeInMonitor } from './bargeInMonitor';
9
9
  export { createVoiceLiveTurnLatencyMonitor } from './liveTurnLatency';
10
10
  export { createVoiceOpsStatusStore, fetchVoiceOpsStatus } from './opsStatus';
11
- export { createVoiceOpsActionCenterActions, createVoiceOpsActionCenterStore, runVoiceOpsAction } from './opsActionCenter';
11
+ export { createVoiceOpsActionCenterActions, createVoiceOpsActionCenterStore, recordVoiceOpsActionResult, runVoiceOpsAction } from './opsActionCenter';
12
+ export { createVoiceOpsActionHistoryStore, fetchVoiceOpsActionHistory } from './opsActionHistory';
12
13
  export { createVoiceDeliveryRuntimeStore, fetchVoiceDeliveryRuntime, runVoiceDeliveryRuntimeAction } from './deliveryRuntime';
13
14
  export { createVoiceOpsStatusViewModel, defineVoiceOpsStatusElement, getVoiceOpsStatusCSS, getVoiceOpsStatusLabel, mountVoiceOpsStatus, renderVoiceOpsStatusHTML } from './opsStatusWidget';
14
15
  export { createVoiceOpsActionCenterViewModel, defineVoiceOpsActionCenterElement, getVoiceOpsActionCenterCSS, mountVoiceOpsActionCenter, renderVoiceOpsActionCenterHTML } from './opsActionCenterWidget';
16
+ export { getVoiceOpsActionHistoryCSS, mountVoiceOpsActionHistory, renderVoiceOpsActionHistoryWidgetHTML } from './opsActionHistoryWidget';
15
17
  export { createVoiceDeliveryRuntimeViewModel, defineVoiceDeliveryRuntimeElement, getVoiceDeliveryRuntimeCSS, mountVoiceDeliveryRuntime, renderVoiceDeliveryRuntimeHTML } from './deliveryRuntimeWidget';
16
18
  export { createVoiceRoutingStatusStore, fetchVoiceRoutingStatus } from './routingStatus';
17
19
  export { createVoiceRoutingStatusViewModel, defineVoiceRoutingStatusElement, getVoiceRoutingStatusCSS, mountVoiceRoutingStatus, renderVoiceRoutingStatusHTML } from './routingStatusWidget';
@@ -31,11 +33,13 @@ export { createVoiceTraceTimelineViewModel, defineVoiceTraceTimelineElement, get
31
33
  export { createVoiceWorkflowStatusStore, fetchVoiceWorkflowStatus } from './workflowStatus';
32
34
  export type { VoiceOpsStatusClientOptions, VoiceOpsStatusSnapshot } from './opsStatus';
33
35
  export type { VoiceOpsActionCenterClientOptions, VoiceOpsActionCenterPresetOptions, VoiceOpsActionCenterSnapshot, VoiceOpsActionDescriptor, VoiceOpsActionMethod, VoiceOpsActionRunResult } from './opsActionCenter';
36
+ export type { VoiceOpsActionHistoryClientOptions, VoiceOpsActionHistorySnapshot } from './opsActionHistory';
34
37
  export type { VoiceDeliveryRuntimeClientOptions, VoiceDeliveryRuntimeAction, VoiceDeliveryRuntimeActionResult, VoiceDeliveryRuntimeSnapshot } from './deliveryRuntime';
35
38
  export type { VoiceBargeInMonitorOptions } from './bargeInMonitor';
36
39
  export type { VoiceLiveTurnLatencyEvent, VoiceLiveTurnLatencyMonitorOptions, VoiceLiveTurnLatencySnapshot, VoiceLiveTurnLatencyStatus } from './liveTurnLatency';
37
40
  export type { VoiceOpsStatusSurfaceView, VoiceOpsStatusViewModel, VoiceOpsStatusWidgetOptions } from './opsStatusWidget';
38
41
  export type { VoiceOpsActionCenterViewModel, VoiceOpsActionCenterWidgetOptions } from './opsActionCenterWidget';
42
+ export type { VoiceOpsActionHistoryWidgetOptions } from './opsActionHistoryWidget';
39
43
  export type { VoiceDeliveryRuntimeSurfaceView, VoiceDeliveryRuntimeViewModel, VoiceDeliveryRuntimeWidgetOptions } from './deliveryRuntimeWidget';
40
44
  export type { VoiceRoutingStatusClientOptions, VoiceRoutingStatusSnapshot } from './routingStatus';
41
45
  export type { VoiceRoutingStatusViewModel, VoiceRoutingStatusWidgetOptions } from './routingStatusWidget';