@absolutejs/voice 0.0.22-beta.189 → 0.0.22-beta.190

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.js CHANGED
@@ -11768,8 +11768,195 @@ var renderVoiceOpsActionHistoryHTML = (report) => {
11768
11768
  const rows = report.entries.map((entry) => `<article class="${entry.ok ? "ok" : "fail"}"><span>${escapeHtml15(entry.ok ? "success" : "error")}</span><strong>${escapeHtml15(entry.actionId)}</strong><p>${escapeHtml15(new Date(entry.at).toLocaleString())}${entry.status ? ` \xB7 HTTP ${String(entry.status)}` : ""}</p>${entry.error ? `<p>${escapeHtml15(entry.error)}</p>` : ""}</article>`).join("");
11769
11769
  return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>Voice Ops Action History</title><style>body{background:#11140f;color:#f7f1df;font-family:ui-sans-serif,system-ui,sans-serif;margin:0}main{margin:auto;max-width:980px;padding:32px}.hero,article{background:#181d15;border:1px solid #2c3327;border-radius:24px;padding:20px}.hero{margin-bottom:16px}h1{font-size:clamp(2rem,6vw,4rem);line-height:.95}section{display:grid;gap:12px}article.ok{border-color:rgba(34,197,94,.55)}article.fail{border-color:rgba(239,68,68,.75)}span{color:#facc15;font-weight:900;text-transform:uppercase}p{color:#c8ccb8}</style></head><body><main><section class="hero"><span>Operator proof</span><h1>Voice Ops Action History</h1><p>${String(report.total)} action(s), ${String(report.failed)} failed.</p></section><section>${rows || "<p>No operator actions have been recorded.</p>"}</section></main></body></html>`;
11770
11770
  };
11771
- // src/deliveryRuntime.ts
11771
+ // src/liveOps.ts
11772
11772
  import { Elysia as Elysia13 } from "elysia";
11773
+ var VOICE_LIVE_OPS_ACTIONS = [
11774
+ "assign",
11775
+ "create-task",
11776
+ "escalate",
11777
+ "force-handoff",
11778
+ "inject-instruction",
11779
+ "operator-takeover",
11780
+ "pause-assistant",
11781
+ "resume-assistant",
11782
+ "tag"
11783
+ ];
11784
+ var isVoiceLiveOpsAction = (value) => typeof value === "string" && VOICE_LIVE_OPS_ACTIONS.includes(value);
11785
+ var toStringValue = (value) => typeof value === "string" && value.trim() ? value.trim() : undefined;
11786
+ var createVoiceMemoryLiveOpsControlStore = () => {
11787
+ const states = new Map;
11788
+ return {
11789
+ get: (sessionId) => states.get(sessionId),
11790
+ set: (sessionId, state) => {
11791
+ states.set(sessionId, state);
11792
+ }
11793
+ };
11794
+ };
11795
+ var getVoiceLiveOpsControlStatus = (action) => {
11796
+ switch (action) {
11797
+ case "force-handoff":
11798
+ return "handoff-forced";
11799
+ case "inject-instruction":
11800
+ return "instruction-injected";
11801
+ case "operator-takeover":
11802
+ return "operator-takeover";
11803
+ case "pause-assistant":
11804
+ return "assistant-paused";
11805
+ case "resume-assistant":
11806
+ return "assistant-resumed";
11807
+ default:
11808
+ return "recorded";
11809
+ }
11810
+ };
11811
+ var buildVoiceLiveOpsControlState = (input) => ({
11812
+ assistantPaused: input.action === "pause-assistant" || input.action === "operator-takeover" || input.action === "force-handoff" ? true : input.action === "resume-assistant" ? false : input.previous?.assistantPaused ?? false,
11813
+ handoffTarget: input.action === "force-handoff" ? input.tag : input.previous?.handoffTarget,
11814
+ injectedInstruction: input.action === "inject-instruction" ? input.detail : input.previous?.injectedInstruction,
11815
+ lastAction: input.action,
11816
+ lastUpdatedAt: input.at ?? Date.now(),
11817
+ operator: input.assignee,
11818
+ operatorTakeover: input.action === "operator-takeover" ? true : input.action === "resume-assistant" ? false : input.previous?.operatorTakeover ?? false,
11819
+ status: getVoiceLiveOpsControlStatus(input.action),
11820
+ tag: input.tag
11821
+ });
11822
+ var createVoiceLiveOpsController = (options = {}) => {
11823
+ const store = options.store ?? createVoiceMemoryLiveOpsControlStore();
11824
+ const perform = async (input) => {
11825
+ if (!input.sessionId) {
11826
+ throw new Error("Voice live ops action requires sessionId.");
11827
+ }
11828
+ if (!isVoiceLiveOpsAction(input.action)) {
11829
+ throw new Error("Voice live ops action is not supported.");
11830
+ }
11831
+ const at = Date.now();
11832
+ const assignee = input.assignee ?? options.defaultAssignee ?? "operator";
11833
+ const tag = input.tag ?? options.defaultTag ?? "live-ops";
11834
+ const detail = input.detail ?? options.defaultDetail ?? input.action;
11835
+ const previous = await store.get(input.sessionId);
11836
+ const control = buildVoiceLiveOpsControlState({
11837
+ ...input,
11838
+ assignee,
11839
+ at,
11840
+ detail,
11841
+ previous,
11842
+ tag
11843
+ });
11844
+ await store.set(input.sessionId, control);
11845
+ const traceId = `voice-live-ops:${input.sessionId}:${input.action}:${at}`;
11846
+ await Promise.all([
11847
+ options.audit?.append(createVoiceAuditEvent({
11848
+ action: `voice.live_ops.${input.action}`,
11849
+ actor: {
11850
+ id: assignee,
11851
+ kind: "operator",
11852
+ name: assignee
11853
+ },
11854
+ at,
11855
+ metadata: {
11856
+ source: "voice-live-ops",
11857
+ tag
11858
+ },
11859
+ outcome: "success",
11860
+ payload: {
11861
+ action: input.action,
11862
+ assignee,
11863
+ control,
11864
+ detail,
11865
+ tag
11866
+ },
11867
+ resource: {
11868
+ id: input.sessionId,
11869
+ type: "voice.session"
11870
+ },
11871
+ sessionId: input.sessionId,
11872
+ traceId,
11873
+ type: "operator.action"
11874
+ })),
11875
+ options.trace?.append(createVoiceTraceEvent({
11876
+ at,
11877
+ metadata: {
11878
+ source: "voice-live-ops",
11879
+ tag
11880
+ },
11881
+ payload: {
11882
+ action: input.action,
11883
+ assignee,
11884
+ control,
11885
+ detail,
11886
+ status: "success",
11887
+ tag
11888
+ },
11889
+ sessionId: input.sessionId,
11890
+ traceId,
11891
+ type: "operator.action"
11892
+ }))
11893
+ ]);
11894
+ const result = {
11895
+ action: input.action,
11896
+ control,
11897
+ ok: true,
11898
+ sessionId: input.sessionId
11899
+ };
11900
+ await options.onAction?.({
11901
+ ...result,
11902
+ assignee,
11903
+ detail,
11904
+ tag
11905
+ });
11906
+ return result;
11907
+ };
11908
+ return {
11909
+ get: (sessionId) => store.get(sessionId),
11910
+ perform,
11911
+ store
11912
+ };
11913
+ };
11914
+ var readVoiceLiveOpsActionInput = async (request) => {
11915
+ const body = await request.json().catch(() => null);
11916
+ if (!body || typeof body !== "object") {
11917
+ throw new Error("Voice live ops action requires a JSON body.");
11918
+ }
11919
+ const record = body;
11920
+ const action = record.action;
11921
+ const sessionId = toStringValue(record.sessionId);
11922
+ if (!sessionId || !isVoiceLiveOpsAction(action)) {
11923
+ throw new Error("Voice live ops action requires valid sessionId and action.");
11924
+ }
11925
+ return {
11926
+ action,
11927
+ assignee: toStringValue(record.assignee),
11928
+ detail: toStringValue(record.detail),
11929
+ sessionId,
11930
+ tag: toStringValue(record.tag)
11931
+ };
11932
+ };
11933
+ var createVoiceLiveOpsRoutes = (options = {}) => {
11934
+ const controller = createVoiceLiveOpsController(options);
11935
+ const path = options.path ?? "/api/voice/live-ops/action";
11936
+ const controlPath = options.controlPath ?? "/api/voice/live-ops/control/:sessionId";
11937
+ return new Elysia13({
11938
+ name: options.name ?? "absolutejs-voice-live-ops"
11939
+ }).post(path, async ({ request, set }) => {
11940
+ try {
11941
+ return await controller.perform(await readVoiceLiveOpsActionInput(request));
11942
+ } catch (error) {
11943
+ set.status = 400;
11944
+ return {
11945
+ error: error instanceof Error ? error.message : String(error),
11946
+ ok: false
11947
+ };
11948
+ }
11949
+ }).get(controlPath, async ({ params }) => {
11950
+ const sessionId = params.sessionId;
11951
+ return {
11952
+ control: await controller.get(sessionId),
11953
+ ok: true,
11954
+ sessionId
11955
+ };
11956
+ });
11957
+ };
11958
+ // src/deliveryRuntime.ts
11959
+ import { Elysia as Elysia14 } from "elysia";
11773
11960
  import { mkdir } from "fs/promises";
11774
11961
  import { dirname, join } from "path";
11775
11962
  var escapeHtml16 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
@@ -12023,7 +12210,7 @@ var createVoiceDeliveryRuntimeRoutes = (options) => {
12023
12210
  const htmlPath = options.htmlPath === undefined ? "/delivery-runtime" : options.htmlPath;
12024
12211
  const tickPath = options.tickPath === undefined ? "/api/voice-delivery-runtime/tick" : options.tickPath;
12025
12212
  const requeueDeadLettersPath = options.requeueDeadLettersPath === undefined ? "/api/voice-delivery-runtime/requeue-dead-letters" : options.requeueDeadLettersPath;
12026
- const routes = new Elysia13({
12213
+ const routes = new Elysia14({
12027
12214
  name: options.name ?? "absolutejs-voice-delivery-runtime"
12028
12215
  }).get(path, () => buildVoiceDeliveryRuntimeReport(options.runtime));
12029
12216
  if (tickPath !== false) {
@@ -12273,15 +12460,15 @@ var applyVoiceDataRetentionPolicy = async (options) => {
12273
12460
  };
12274
12461
  var buildVoiceDataRetentionPlan = (options) => applyVoiceDataRetentionPolicy({ ...options, dryRun: true });
12275
12462
  // src/evalRoutes.ts
12276
- import { Elysia as Elysia16 } from "elysia";
12463
+ import { Elysia as Elysia17 } from "elysia";
12277
12464
  import { mkdir as mkdir2 } from "fs/promises";
12278
12465
  import { dirname as dirname2 } from "path";
12279
12466
 
12280
12467
  // src/qualityRoutes.ts
12281
- import { Elysia as Elysia15 } from "elysia";
12468
+ import { Elysia as Elysia16 } from "elysia";
12282
12469
 
12283
12470
  // src/handoffHealth.ts
12284
- import { Elysia as Elysia14 } from "elysia";
12471
+ import { Elysia as Elysia15 } from "elysia";
12285
12472
  var escapeHtml17 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
12286
12473
  var getString6 = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
12287
12474
  var isStatus = (value) => value === "delivered" || value === "failed" || value === "skipped";
@@ -12464,7 +12651,7 @@ var createVoiceHandoffHealthHTMLHandler = (options = {}) => async ({ query }) =>
12464
12651
  var createVoiceHandoffHealthRoutes = (options = {}) => {
12465
12652
  const path = options.path ?? "/api/voice-handoffs";
12466
12653
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
12467
- const routes = new Elysia14({
12654
+ const routes = new Elysia15({
12468
12655
  name: options.name ?? "absolutejs-voice-handoff-health"
12469
12656
  }).get(path, createVoiceHandoffHealthJSONHandler(options));
12470
12657
  if (htmlPath) {
@@ -12595,7 +12782,7 @@ var renderVoiceQualityHTML = (report, options = {}) => {
12595
12782
  };
12596
12783
  var createVoiceQualityRoutes = (options) => {
12597
12784
  const path = options.path ?? "/quality";
12598
- const routes = new Elysia15({
12785
+ const routes = new Elysia16({
12599
12786
  name: options.name ?? "absolutejs-voice-quality"
12600
12787
  });
12601
12788
  const getReport = () => evaluateVoiceQuality({
@@ -12990,7 +13177,7 @@ var renderVoiceScenarioFixtureEvalHTML = (report, options = {}) => {
12990
13177
  };
12991
13178
  var createVoiceEvalRoutes = (options) => {
12992
13179
  const path = options.path ?? "/evals";
12993
- const routes = new Elysia16({
13180
+ const routes = new Elysia17({
12994
13181
  name: options.name ?? "absolutejs-voice-evals"
12995
13182
  });
12996
13183
  const getReport = () => runVoiceSessionEvals({
@@ -13124,10 +13311,10 @@ var createVoiceEvalRoutes = (options) => {
13124
13311
  return routes;
13125
13312
  };
13126
13313
  // src/simulationSuite.ts
13127
- import { Elysia as Elysia19 } from "elysia";
13314
+ import { Elysia as Elysia20 } from "elysia";
13128
13315
 
13129
13316
  // src/outcomeContract.ts
13130
- import { Elysia as Elysia17 } from "elysia";
13317
+ import { Elysia as Elysia18 } from "elysia";
13131
13318
  var escapeHtml20 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
13132
13319
  var getPayloadString = (event, key) => typeof event.payload[key] === "string" ? event.payload[key] : undefined;
13133
13320
  var toList = async (input) => Array.isArray(input) ? input : await input?.list() ?? [];
@@ -13267,7 +13454,7 @@ var createVoiceOutcomeContractHTMLHandler = (options) => async () => {
13267
13454
  var createVoiceOutcomeContractRoutes = (options) => {
13268
13455
  const path = options.path ?? "/api/outcome-contracts";
13269
13456
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
13270
- const routes = new Elysia17({
13457
+ const routes = new Elysia18({
13271
13458
  name: options.name ?? "absolutejs-voice-outcome-contracts"
13272
13459
  }).get(path, createVoiceOutcomeContractJSONHandler(options));
13273
13460
  if (htmlPath) {
@@ -13277,7 +13464,7 @@ var createVoiceOutcomeContractRoutes = (options) => {
13277
13464
  };
13278
13465
 
13279
13466
  // src/toolContract.ts
13280
- import { Elysia as Elysia18 } from "elysia";
13467
+ import { Elysia as Elysia19 } from "elysia";
13281
13468
 
13282
13469
  // src/toolRuntime.ts
13283
13470
  var toErrorMessage4 = (error) => error instanceof Error ? error.message : String(error);
@@ -13715,7 +13902,7 @@ var createVoiceToolContractHTMLHandler = (options) => async () => {
13715
13902
  var createVoiceToolContractRoutes = (options) => {
13716
13903
  const path = options.path ?? "/api/tool-contracts";
13717
13904
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
13718
- const routes = new Elysia18({
13905
+ const routes = new Elysia19({
13719
13906
  name: options.name ?? "absolutejs-voice-tool-contracts"
13720
13907
  }).get(path, createVoiceToolContractJSONHandler(options));
13721
13908
  if (htmlPath) {
@@ -13907,7 +14094,7 @@ app.use(
13907
14094
  var createVoiceSimulationSuiteRoutes = (options) => {
13908
14095
  const path = options.path ?? "/api/voice/simulations";
13909
14096
  const htmlPath = options.htmlPath === undefined ? "/voice/simulations" : options.htmlPath;
13910
- const app = new Elysia19({
14097
+ const app = new Elysia20({
13911
14098
  name: options.name ?? "absolutejs-voice-simulation-suite"
13912
14099
  }).get(path, () => runVoiceSimulationSuite(options));
13913
14100
  if (htmlPath) {
@@ -14219,7 +14406,7 @@ var createVoiceWorkflowContractHandler = (input) => {
14219
14406
  };
14220
14407
  };
14221
14408
  // src/sessionReplay.ts
14222
- import { Elysia as Elysia20 } from "elysia";
14409
+ import { Elysia as Elysia21 } from "elysia";
14223
14410
  var getString9 = (value) => typeof value === "string" ? value : undefined;
14224
14411
  var escapeHtml23 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
14225
14412
  var increment4 = (record, key) => {
@@ -14445,7 +14632,7 @@ var createVoiceSessionsHTMLHandler = (options = {}) => async ({ query }) => {
14445
14632
  var createVoiceSessionListRoutes = (options = {}) => {
14446
14633
  const path = options.path ?? "/api/voice-sessions";
14447
14634
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
14448
- const routes = new Elysia20({
14635
+ const routes = new Elysia21({
14449
14636
  name: options.name ?? "absolutejs-voice-session-list"
14450
14637
  }).get(path, createVoiceSessionsJSONHandler(options));
14451
14638
  if (htmlPath) {
@@ -14473,7 +14660,7 @@ var createVoiceSessionReplayHTMLHandler = (options) => async ({ params }) => {
14473
14660
  var createVoiceSessionReplayRoutes = (options) => {
14474
14661
  const path = options.path ?? "/api/voice-sessions/:sessionId/replay";
14475
14662
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
14476
- const routes = new Elysia20({
14663
+ const routes = new Elysia21({
14477
14664
  name: options.name ?? "absolutejs-voice-session-replay"
14478
14665
  }).get(path, createVoiceSessionReplayJSONHandler(options));
14479
14666
  if (htmlPath) {
@@ -14702,7 +14889,7 @@ var assertVoiceAgentSquadContract = async (options) => {
14702
14889
  return report;
14703
14890
  };
14704
14891
  // src/turnLatency.ts
14705
- import { Elysia as Elysia21 } from "elysia";
14892
+ import { Elysia as Elysia22 } from "elysia";
14706
14893
  var DEFAULT_WARN_AFTER_MS = 1800;
14707
14894
  var DEFAULT_FAIL_AFTER_MS = 3200;
14708
14895
  var escapeHtml24 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
@@ -14858,7 +15045,7 @@ var createVoiceTurnLatencyHTMLHandler = (options) => async () => {
14858
15045
  var createVoiceTurnLatencyRoutes = (options) => {
14859
15046
  const path = options.path ?? "/api/turn-latency";
14860
15047
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
14861
- const routes = new Elysia21({
15048
+ const routes = new Elysia22({
14862
15049
  name: options.name ?? "absolutejs-voice-turn-latency"
14863
15050
  }).get(path, createVoiceTurnLatencyJSONHandler(options));
14864
15051
  if (htmlPath) {
@@ -14867,7 +15054,7 @@ var createVoiceTurnLatencyRoutes = (options) => {
14867
15054
  return routes;
14868
15055
  };
14869
15056
  // src/liveLatency.ts
14870
- import { Elysia as Elysia22 } from "elysia";
15057
+ import { Elysia as Elysia23 } from "elysia";
14871
15058
  var escapeHtml25 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
14872
15059
  var percentile = (values, percentileValue) => {
14873
15060
  if (values.length === 0) {
@@ -14941,7 +15128,7 @@ await traceStore.append({
14941
15128
  var createVoiceLiveLatencyRoutes = (options) => {
14942
15129
  const path = options.path ?? "/api/live-latency";
14943
15130
  const htmlPath = options.htmlPath === undefined ? "/live-latency" : options.htmlPath;
14944
- const routes = new Elysia22({
15131
+ const routes = new Elysia23({
14945
15132
  name: options.name ?? "absolutejs-voice-live-latency"
14946
15133
  }).get(path, () => summarizeVoiceLiveLatency(options));
14947
15134
  if (htmlPath) {
@@ -14958,7 +15145,7 @@ var createVoiceLiveLatencyRoutes = (options) => {
14958
15145
  return routes;
14959
15146
  };
14960
15147
  // src/turnQuality.ts
14961
- import { Elysia as Elysia23 } from "elysia";
15148
+ import { Elysia as Elysia24 } from "elysia";
14962
15149
  var DEFAULT_CONFIDENCE_WARN_THRESHOLD = 0.72;
14963
15150
  var escapeHtml26 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
14964
15151
  var getTurnLatencyMs = (turn) => {
@@ -15065,7 +15252,7 @@ var createVoiceTurnQualityHTMLHandler = (options) => async () => {
15065
15252
  var createVoiceTurnQualityRoutes = (options) => {
15066
15253
  const path = options.path ?? "/api/turn-quality";
15067
15254
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
15068
- const routes = new Elysia23({
15255
+ const routes = new Elysia24({
15069
15256
  name: options.name ?? "absolutejs-voice-turn-quality"
15070
15257
  }).get(path, createVoiceTurnQualityJSONHandler(options));
15071
15258
  if (htmlPath) {
@@ -15074,7 +15261,7 @@ var createVoiceTurnQualityRoutes = (options) => {
15074
15261
  return routes;
15075
15262
  };
15076
15263
  // src/telephonyOutcome.ts
15077
- import { Elysia as Elysia24 } from "elysia";
15264
+ import { Elysia as Elysia25 } from "elysia";
15078
15265
  var DEFAULT_COMPLETED_STATUSES = [
15079
15266
  "answered",
15080
15267
  "completed",
@@ -15724,7 +15911,7 @@ var createVoiceTelephonyWebhookHandler = (options = {}) => async (input) => {
15724
15911
  var createVoiceTelephonyWebhookRoutes = (options = {}) => {
15725
15912
  const path = options.path ?? "/api/voice/telephony/webhook";
15726
15913
  const handler = createVoiceTelephonyWebhookHandler(options);
15727
- return new Elysia24({
15914
+ return new Elysia25({
15728
15915
  name: options.name ?? "absolutejs-voice-telephony-webhooks"
15729
15916
  }).post(path, async ({ query, request }) => {
15730
15917
  try {
@@ -15745,11 +15932,11 @@ var createVoiceTelephonyWebhookRoutes = (options = {}) => {
15745
15932
  });
15746
15933
  };
15747
15934
  // src/phoneAgent.ts
15748
- import { Elysia as Elysia30 } from "elysia";
15935
+ import { Elysia as Elysia31 } from "elysia";
15749
15936
 
15750
15937
  // src/telephony/plivo.ts
15751
15938
  import { Buffer as Buffer5 } from "buffer";
15752
- import { Elysia as Elysia26 } from "elysia";
15939
+ import { Elysia as Elysia27 } from "elysia";
15753
15940
 
15754
15941
  // src/telephony/contract.ts
15755
15942
  var DEFAULT_REQUIREMENTS = [
@@ -15833,7 +16020,7 @@ var evaluateVoiceTelephonyContract = (input) => {
15833
16020
 
15834
16021
  // src/telephony/twilio.ts
15835
16022
  import { Buffer as Buffer4 } from "buffer";
15836
- import { Elysia as Elysia25 } from "elysia";
16023
+ import { Elysia as Elysia26 } from "elysia";
15837
16024
  var TWILIO_MULAW_SAMPLE_RATE = 8000;
15838
16025
  var VOICE_PCM_SAMPLE_RATE = 16000;
15839
16026
  var escapeXml2 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&apos;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
@@ -16406,7 +16593,7 @@ var createTwilioVoiceRoutes = (options) => {
16406
16593
  const smokePath = options.smoke?.path === false ? false : options.smoke?.path ?? "/api/voice/twilio/smoke";
16407
16594
  const bridges = new WeakMap;
16408
16595
  const webhookPolicy = options.webhook?.policy ?? options.outcomePolicy ?? createVoiceTelephonyOutcomePolicy();
16409
- const app = new Elysia25({
16596
+ const app = new Elysia26({
16410
16597
  name: options.name ?? "absolutejs-voice-twilio"
16411
16598
  }).get(twimlPath, async ({ query, request }) => {
16412
16599
  const streamUrl = await resolveTwilioStreamUrl(options, {
@@ -16903,7 +17090,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
16903
17090
  request: input.request
16904
17091
  }) : verificationUrl ?? input.request.url
16905
17092
  }) : undefined);
16906
- const app = new Elysia26({
17093
+ const app = new Elysia27({
16907
17094
  name: options.name ?? "absolutejs-voice-plivo"
16908
17095
  }).get(answerPath, async ({ query, request }) => {
16909
17096
  const streamUrl = await resolvePlivoStreamUrl(options, {
@@ -17014,7 +17201,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
17014
17201
 
17015
17202
  // src/telephony/telnyx.ts
17016
17203
  import { Buffer as Buffer6 } from "buffer";
17017
- import { Elysia as Elysia27 } from "elysia";
17204
+ import { Elysia as Elysia28 } from "elysia";
17018
17205
  var escapeXml4 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&apos;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
17019
17206
  var escapeHtml29 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&#39;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
17020
17207
  var joinUrlPath4 = (origin, path) => `${origin.replace(/\/$/, "")}${path.startsWith("/") ? path : `/${path}`}`;
@@ -17325,7 +17512,7 @@ var createTelnyxVoiceRoutes = (options = {}) => {
17325
17512
  publicKey: options.webhook?.publicKey,
17326
17513
  toleranceSeconds: options.webhook?.toleranceSeconds
17327
17514
  }) : undefined);
17328
- const app = new Elysia27({
17515
+ const app = new Elysia28({
17329
17516
  name: options.name ?? "absolutejs-voice-telnyx"
17330
17517
  }).get(texmlPath, async ({ query, request }) => {
17331
17518
  const streamUrl = await resolveTelnyxStreamUrl(options, {
@@ -17435,7 +17622,7 @@ var createTelnyxVoiceRoutes = (options = {}) => {
17435
17622
  };
17436
17623
 
17437
17624
  // src/telephony/matrix.ts
17438
- import { Elysia as Elysia28 } from "elysia";
17625
+ import { Elysia as Elysia29 } from "elysia";
17439
17626
  var escapeHtml30 = (value) => value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&#39;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
17440
17627
  var labelForProvider = (provider) => provider.split("-").map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`).join(" ");
17441
17628
  var resolveEntryStatus = (contract, setup, smoke) => {
@@ -17519,7 +17706,7 @@ ${entry.issues.length ? `<ul style="margin:12px 0 0; padding-left:18px;">${entry
17519
17706
  </main>`;
17520
17707
  var createVoiceTelephonyCarrierMatrixRoutes = (options) => {
17521
17708
  const path = options.path ?? "/api/voice/telephony/carriers";
17522
- return new Elysia28({
17709
+ return new Elysia29({
17523
17710
  name: options.name ?? "absolutejs-voice-telephony-carrier-matrix"
17524
17711
  }).get(path, async ({ query, request }) => {
17525
17712
  const providers = await options.load({ query, request });
@@ -17541,7 +17728,7 @@ var createVoiceTelephonyCarrierMatrixRoutes = (options) => {
17541
17728
  };
17542
17729
 
17543
17730
  // src/phoneAgentProductionSmoke.ts
17544
- import { Elysia as Elysia29 } from "elysia";
17731
+ import { Elysia as Elysia30 } from "elysia";
17545
17732
  var defaultRequirements = [
17546
17733
  "media-started",
17547
17734
  "transcript",
@@ -17684,7 +17871,7 @@ var createVoicePhoneAgentProductionSmokeHTMLHandler = (options) => async ({
17684
17871
  var createVoicePhoneAgentProductionSmokeRoutes = (options) => {
17685
17872
  const path = options.path ?? "/api/voice/phone/smoke-contract";
17686
17873
  const htmlPath = options.htmlPath === undefined ? "/voice/phone/smoke-contract" : options.htmlPath;
17687
- const routes = new Elysia29({
17874
+ const routes = new Elysia30({
17688
17875
  name: options.name ?? "absolutejs-voice-phone-smoke-contract"
17689
17876
  }).get(path, createVoicePhoneAgentProductionSmokeJSONHandler(options));
17690
17877
  if (htmlPath) {
@@ -17839,7 +18026,7 @@ var createVoicePhoneAgent = (options) => {
17839
18026
  setupPath: resolveSetupPath(carrier),
17840
18027
  smokePath: resolveSmokePath(carrier)
17841
18028
  }));
17842
- const app = new Elysia30({
18029
+ const app = new Elysia31({
17843
18030
  name: options.name ?? "absolutejs-voice-phone-agent"
17844
18031
  });
17845
18032
  for (const carrier of options.carriers) {
@@ -19893,7 +20080,7 @@ var createOpenAIVoiceTTS = (options) => {
19893
20080
  };
19894
20081
  };
19895
20082
  // src/providerCapabilities.ts
19896
- import { Elysia as Elysia31 } from "elysia";
20083
+ import { Elysia as Elysia32 } from "elysia";
19897
20084
  var escapeHtml33 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
19898
20085
  var fromProviderList = (kind, providers, options) => (providers ?? []).map((provider) => ({
19899
20086
  configured: true,
@@ -19994,7 +20181,7 @@ var createVoiceProviderCapabilityHTMLHandler = (options) => async () => {
19994
20181
  var createVoiceProviderCapabilityRoutes = (options) => {
19995
20182
  const path = options.path ?? "/api/provider-capabilities";
19996
20183
  const htmlPath = options.htmlPath === undefined ? `${path}/htmx` : options.htmlPath;
19997
- const routes = new Elysia31({
20184
+ const routes = new Elysia32({
19998
20185
  name: options.name ?? "absolutejs-voice-provider-capabilities"
19999
20186
  }).get(path, createVoiceProviderCapabilityJSONHandler(options));
20000
20187
  if (htmlPath) {
@@ -20003,7 +20190,7 @@ var createVoiceProviderCapabilityRoutes = (options) => {
20003
20190
  return routes;
20004
20191
  };
20005
20192
  // src/resilienceRoutes.ts
20006
- import { Elysia as Elysia32 } from "elysia";
20193
+ import { Elysia as Elysia33 } from "elysia";
20007
20194
  var escapeHtml34 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
20008
20195
  var getString11 = (value) => typeof value === "string" ? value : undefined;
20009
20196
  var getNumber6 = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
@@ -20446,7 +20633,7 @@ var registerSimulationRoutes = (routes, simulation, defaultPathPrefix) => {
20446
20633
  };
20447
20634
  var createVoiceResilienceRoutes = (options) => {
20448
20635
  const path = options.path ?? "/resilience";
20449
- const routes = new Elysia32({
20636
+ const routes = new Elysia33({
20450
20637
  name: options.name ?? "absolutejs-voice-resilience"
20451
20638
  }).get(path, async () => {
20452
20639
  const events = await options.store.list();
@@ -20524,7 +20711,7 @@ var assertVoiceProviderRoutingContract = async (options) => {
20524
20711
  return report;
20525
20712
  };
20526
20713
  // src/productionReadiness.ts
20527
- import { Elysia as Elysia33 } from "elysia";
20714
+ import { Elysia as Elysia34 } from "elysia";
20528
20715
  var escapeHtml35 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
20529
20716
  var rollupStatus2 = (checks) => checks.some((check) => check.status === "fail") ? "fail" : checks.some((check) => check.status === "warn") ? "warn" : "pass";
20530
20717
  var readinessGateCodes = {
@@ -21478,7 +21665,7 @@ var createVoiceProductionReadinessRoutes = (options) => {
21478
21665
  const path = options.path ?? "/api/production-readiness";
21479
21666
  const gatePath = options.gatePath === undefined ? "/api/production-readiness/gate" : options.gatePath;
21480
21667
  const htmlPath = options.htmlPath ?? "/production-readiness";
21481
- const routes = new Elysia33({
21668
+ const routes = new Elysia34({
21482
21669
  name: options.name ?? "absolutejs-voice-production-readiness"
21483
21670
  });
21484
21671
  routes.get(path, async ({ query, request }) => buildVoiceProductionReadinessReport(options, { query, request }));
@@ -21831,7 +22018,7 @@ var recommendVoiceReadinessProfile = (options) => {
21831
22018
  };
21832
22019
  };
21833
22020
  // src/providerStackRecommendations.ts
21834
- import { Elysia as Elysia34 } from "elysia";
22021
+ import { Elysia as Elysia35 } from "elysia";
21835
22022
  var escapeHtml36 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
21836
22023
  var profileProviderPriorities = {
21837
22024
  "meeting-recorder": {
@@ -22121,7 +22308,7 @@ var createVoiceProviderContractMatrixHTMLHandler = (options) => async () => {
22121
22308
  var createVoiceProviderContractMatrixRoutes = (options) => {
22122
22309
  const path = options.path ?? "/api/provider-contracts";
22123
22310
  const htmlPath = options.htmlPath ?? "/provider-contracts";
22124
- const routes = new Elysia34({
22311
+ const routes = new Elysia35({
22125
22312
  name: options.name ?? "absolutejs-voice-provider-contract-matrix"
22126
22313
  });
22127
22314
  const jsonHandler = createVoiceProviderContractMatrixJSONHandler(options.matrix);
@@ -22180,7 +22367,7 @@ var evaluateVoiceProviderStackGaps = (input) => {
22180
22367
  };
22181
22368
  };
22182
22369
  // src/opsConsoleRoutes.ts
22183
- import { Elysia as Elysia35 } from "elysia";
22370
+ import { Elysia as Elysia36 } from "elysia";
22184
22371
  var DEFAULT_LINKS = [
22185
22372
  {
22186
22373
  description: "Quality gates for CI, deploy checks, and production readiness.",
@@ -22297,7 +22484,7 @@ var renderVoiceOpsConsoleHTML = (report, options = {}) => {
22297
22484
  };
22298
22485
  var createVoiceOpsConsoleRoutes = (options) => {
22299
22486
  const path = options.path ?? "/ops-console";
22300
- const routes = new Elysia35({
22487
+ const routes = new Elysia36({
22301
22488
  name: options.name ?? "absolutejs-voice-ops-console"
22302
22489
  });
22303
22490
  const getReport = () => buildVoiceOpsConsoleReport(options);
@@ -22314,10 +22501,10 @@ var createVoiceOpsConsoleRoutes = (options) => {
22314
22501
  return routes;
22315
22502
  };
22316
22503
  // src/operationsRecord.ts
22317
- import { Elysia as Elysia37 } from "elysia";
22504
+ import { Elysia as Elysia38 } from "elysia";
22318
22505
 
22319
22506
  // src/traceTimeline.ts
22320
- import { Elysia as Elysia36 } from "elysia";
22507
+ import { Elysia as Elysia37 } from "elysia";
22321
22508
  var escapeHtml38 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
22322
22509
  var getString13 = (value) => typeof value === "string" && value.trim() ? value : undefined;
22323
22510
  var getNumber8 = (value) => typeof value === "number" && Number.isFinite(value) ? value : undefined;
@@ -22527,7 +22714,7 @@ var createVoiceTraceTimelineRoutes = (options) => {
22527
22714
  const path = options.path ?? "/api/voice-traces";
22528
22715
  const htmlPath = options.htmlPath ?? "/traces";
22529
22716
  const title = options.title ?? "AbsoluteJS Voice Trace Timelines";
22530
- const routes = new Elysia36({
22717
+ const routes = new Elysia37({
22531
22718
  name: options.name ?? "absolutejs-voice-trace-timelines"
22532
22719
  });
22533
22720
  const buildReport = async () => summarizeVoiceTraceTimeline(await options.store.list(), {
@@ -22669,7 +22856,7 @@ var renderVoiceOperationsRecordHTML = (record, options = {}) => {
22669
22856
  var createVoiceOperationsRecordRoutes = (options) => {
22670
22857
  const path = options.path ?? "/api/voice-operations/:sessionId";
22671
22858
  const htmlPath = options.htmlPath === undefined ? "/voice-operations/:sessionId" : options.htmlPath;
22672
- const routes = new Elysia37({
22859
+ const routes = new Elysia38({
22673
22860
  name: options.name ?? "absolutejs-voice-operations-record"
22674
22861
  });
22675
22862
  const buildRecord = (sessionId) => buildVoiceOperationsRecord({
@@ -22699,7 +22886,7 @@ var createVoiceOperationsRecordRoutes = (options) => {
22699
22886
  return routes;
22700
22887
  };
22701
22888
  // src/incidentBundle.ts
22702
- import { Elysia as Elysia38 } from "elysia";
22889
+ import { Elysia as Elysia39 } from "elysia";
22703
22890
  var filterIncidentBundleArtifacts = (artifacts, filter = {}) => artifacts.filter((artifact) => {
22704
22891
  if (filter.sessionId && artifact.sessionId !== filter.sessionId) {
22705
22892
  return false;
@@ -22898,7 +23085,7 @@ var buildVoiceIncidentBundle = async (options) => {
22898
23085
  var createVoiceIncidentBundleRoutes = (options) => {
22899
23086
  const path = options.path ?? "/api/voice-incidents/:sessionId";
22900
23087
  const markdownPath = options.markdownPath === undefined ? "/voice-incidents/:sessionId/markdown" : options.markdownPath;
22901
- const routes = new Elysia38({
23088
+ const routes = new Elysia39({
22902
23089
  name: options.name ?? "absolutejs-voice-incident-bundle"
22903
23090
  });
22904
23091
  const getSessionId = (params) => params.sessionId ?? "";
@@ -23099,7 +23286,7 @@ var summarizeVoiceOpsStatus = async (options) => {
23099
23286
  };
23100
23287
  };
23101
23288
  // src/opsStatusRoutes.ts
23102
- import { Elysia as Elysia39 } from "elysia";
23289
+ import { Elysia as Elysia40 } from "elysia";
23103
23290
  var escapeHtml40 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
23104
23291
  var renderVoiceOpsStatusHTML = (report, options = {}) => {
23105
23292
  const title = options.title ?? "AbsoluteJS Voice Ops Status";
@@ -23111,7 +23298,7 @@ var renderVoiceOpsStatusHTML = (report, options = {}) => {
23111
23298
  };
23112
23299
  var createVoiceOpsStatusRoutes = (options) => {
23113
23300
  const path = options.path ?? "/api/voice/ops-status";
23114
- const routes = new Elysia39({
23301
+ const routes = new Elysia40({
23115
23302
  name: options.name ?? "absolutejs-voice-ops-status"
23116
23303
  });
23117
23304
  routes.get(path, async () => summarizeVoiceOpsStatus(options));
@@ -23544,7 +23731,7 @@ var createVoiceTTSProviderRouter = (options) => {
23544
23731
  };
23545
23732
  };
23546
23733
  // src/traceDeliveryRoutes.ts
23547
- import { Elysia as Elysia40 } from "elysia";
23734
+ import { Elysia as Elysia41 } from "elysia";
23548
23735
  var escapeHtml41 = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
23549
23736
  var getString15 = (value) => typeof value === "string" && value.trim() ? value.trim() : undefined;
23550
23737
  var getNumber10 = (value) => {
@@ -23653,7 +23840,7 @@ var createVoiceTraceDeliveryRoutes = (options) => {
23653
23840
  const path = options.path ?? "/api/voice-trace-deliveries";
23654
23841
  const htmlPath = options.htmlPath === undefined ? "/traces/deliveries" : options.htmlPath;
23655
23842
  const workerPath = options.workerPath === undefined ? `${path}/drain` : options.workerPath;
23656
- const routes = new Elysia40({
23843
+ const routes = new Elysia41({
23657
23844
  name: options.name ?? "absolutejs-voice-trace-deliveries"
23658
23845
  }).get(path, createVoiceTraceDeliveryJSONHandler(options));
23659
23846
  if (htmlPath !== false) {
@@ -24277,7 +24464,7 @@ var createVoiceMemoryStore = () => {
24277
24464
  return { get, getOrCreate, list, remove, set };
24278
24465
  };
24279
24466
  // src/opsWebhook.ts
24280
- import { Elysia as Elysia41 } from "elysia";
24467
+ import { Elysia as Elysia42 } from "elysia";
24281
24468
  var toHex6 = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
24282
24469
  var signVoiceOpsWebhookBody = async (input) => {
24283
24470
  const encoder = new TextEncoder;
@@ -24407,7 +24594,7 @@ var verifyVoiceOpsWebhookSignature = async (input) => {
24407
24594
  };
24408
24595
  var createVoiceOpsWebhookReceiverRoutes = (options = {}) => {
24409
24596
  const path = options.path ?? "/api/voice-ops/webhook";
24410
- return new Elysia41().post(path, async ({ body, request, set }) => {
24597
+ return new Elysia42().post(path, async ({ body, request, set }) => {
24411
24598
  const bodyText = typeof body === "string" ? body : JSON.stringify(body);
24412
24599
  if (options.signingSecret) {
24413
24600
  const verification = await verifyVoiceOpsWebhookSignature({
@@ -25394,6 +25581,7 @@ export {
25394
25581
  isVoiceOpsTaskOverdue,
25395
25582
  heartbeatVoiceOpsTask,
25396
25583
  hasVoiceOpsTaskSLABreach,
25584
+ getVoiceLiveOpsControlStatus,
25397
25585
  getVoiceCampaignDialerProofStatus,
25398
25586
  filterVoiceTraceEvents,
25399
25587
  filterVoiceAuditEvents,
@@ -25544,12 +25732,15 @@ export {
25544
25732
  createVoiceMemoryTraceSinkDeliveryStore,
25545
25733
  createVoiceMemoryTraceEventStore,
25546
25734
  createVoiceMemoryStore,
25735
+ createVoiceMemoryLiveOpsControlStore,
25547
25736
  createVoiceMemoryIncidentBundleStore,
25548
25737
  createVoiceMemoryHandoffDeliveryStore,
25549
25738
  createVoiceMemoryCampaignStore,
25550
25739
  createVoiceMemoryAuditSinkDeliveryStore,
25551
25740
  createVoiceMemoryAuditEventStore,
25552
25741
  createVoiceMemoryAssistantMemoryStore,
25742
+ createVoiceLiveOpsRoutes,
25743
+ createVoiceLiveOpsController,
25553
25744
  createVoiceLiveLatencyRoutes,
25554
25745
  createVoiceLinearIssueUpdateSink,
25555
25746
  createVoiceLinearIssueSyncSinks,
@@ -25670,6 +25861,7 @@ export {
25670
25861
  buildVoiceOpsConsoleReport,
25671
25862
  buildVoiceOpsActionHistoryReport,
25672
25863
  buildVoiceOperationsRecord,
25864
+ buildVoiceLiveOpsControlState,
25673
25865
  buildVoiceIncidentBundle,
25674
25866
  buildVoiceDiagnosticsMarkdown,
25675
25867
  buildVoiceDemoReadyReport,
@@ -25691,5 +25883,6 @@ export {
25691
25883
  applyVoiceCampaignTelephonyOutcome,
25692
25884
  applyRiskTieredPhraseHintCorrections,
25693
25885
  applyPhraseHintCorrections,
25886
+ VOICE_LIVE_OPS_ACTIONS,
25694
25887
  TURN_PROFILE_DEFAULTS
25695
25888
  };