@absolutejs/voice 0.0.22-beta.124 → 0.0.22-beta.125

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
@@ -9831,6 +9831,12 @@ var resolveCarriers = async (options, input) => {
9831
9831
  providers: [...providers]
9832
9832
  });
9833
9833
  };
9834
+ var resolveAgentSquadContracts = async (options, input) => {
9835
+ if (options.agentSquadContracts === false || options.agentSquadContracts === undefined) {
9836
+ return;
9837
+ }
9838
+ return typeof options.agentSquadContracts === "function" ? await options.agentSquadContracts(input) : options.agentSquadContracts;
9839
+ };
9834
9840
  var summarizeLiveLatency = (events, options) => {
9835
9841
  const warnAfterMs = options.liveLatencyWarnAfterMs ?? 1800;
9836
9842
  const failAfterMs = options.liveLatencyFailAfterMs ?? 3200;
@@ -9853,7 +9859,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
9853
9859
  const routingEvents = listVoiceRoutingEvents(events);
9854
9860
  const routingSessions = summarizeVoiceRoutingSessions(routingEvents);
9855
9861
  const liveLatency = summarizeLiveLatency(events, options);
9856
- const [quality, providers, sessions, handoffs, carriers] = await Promise.all([
9862
+ const [quality, providers, sessions, handoffs, carriers, agentSquadContracts] = await Promise.all([
9857
9863
  evaluateVoiceQuality({ events }),
9858
9864
  Promise.all([
9859
9865
  summarizeVoiceProviderHealth({
@@ -9871,7 +9877,8 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
9871
9877
  ]).then((groups) => groups.flat()),
9872
9878
  summarizeVoiceSessions({ events, status: "all" }),
9873
9879
  summarizeVoiceHandoffHealth({ events }),
9874
- resolveCarriers(options, { query, request })
9880
+ resolveCarriers(options, { query, request }),
9881
+ resolveAgentSquadContracts(options, { query, request })
9875
9882
  ]);
9876
9883
  const degradedProviders = providers.filter((provider) => provider.status === "degraded" || provider.status === "rate-limited" || provider.status === "suppressed").length;
9877
9884
  const failedSessions = sessions.filter((session) => session.status === "failed").length;
@@ -9980,6 +9987,28 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
9980
9987
  status: carrierStatus(carriers),
9981
9988
  warnings: carriers.summary.warnings
9982
9989
  } : undefined;
9990
+ const agentSquadContractSummary = agentSquadContracts ? {
9991
+ failed: agentSquadContracts.filter((report) => !report.pass).length,
9992
+ passed: agentSquadContracts.filter((report) => report.pass).length,
9993
+ status: agentSquadContracts.some((report) => !report.pass) ? "fail" : agentSquadContracts.length === 0 ? "warn" : "pass",
9994
+ total: agentSquadContracts.length
9995
+ } : undefined;
9996
+ if (agentSquadContractSummary) {
9997
+ checks.push({
9998
+ detail: agentSquadContractSummary.status === "pass" ? `${agentSquadContractSummary.passed} agent squad contract(s) are passing.` : agentSquadContractSummary.total === 0 ? "No agent squad contracts are configured." : `${agentSquadContractSummary.failed} agent squad contract(s) failed.`,
9999
+ href: options.links?.agentSquadContracts ?? "/agent-squad-contract",
10000
+ label: "Agent squad contracts",
10001
+ status: agentSquadContractSummary.status,
10002
+ value: `${agentSquadContractSummary.passed}/${agentSquadContractSummary.total}`,
10003
+ actions: agentSquadContractSummary.status === "pass" ? [] : [
10004
+ {
10005
+ description: "Open the specialist routing contract report and inspect failing handoff paths.",
10006
+ href: options.links?.agentSquadContracts ?? "/agent-squad-contract",
10007
+ label: "Open squad contracts"
10008
+ }
10009
+ ]
10010
+ });
10011
+ }
9983
10012
  if (carriers && carrierSummary) {
9984
10013
  checks.push({
9985
10014
  detail: carrierSummary.status === "pass" ? "Configured carrier setup and contract checks are passing." : `${carrierSummary.failing} carrier(s) failing, ${carrierSummary.warnings} warning(s).`,
@@ -10000,6 +10029,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
10000
10029
  checkedAt: Date.now(),
10001
10030
  checks,
10002
10031
  links: {
10032
+ agentSquadContracts: "/agent-squad-contract",
10003
10033
  carriers: "/carriers",
10004
10034
  handoffs: "/handoffs",
10005
10035
  handoffRetry: "/api/voice-handoffs/retry",
@@ -10011,6 +10041,7 @@ var buildVoiceProductionReadinessReport = async (options, input = {}) => {
10011
10041
  },
10012
10042
  status: rollupStatus(checks),
10013
10043
  summary: {
10044
+ agentSquadContracts: agentSquadContractSummary,
10014
10045
  carriers: carrierSummary,
10015
10046
  handoffs: {
10016
10047
  failed: handoffs.failed,
@@ -1,6 +1,7 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import { type VoiceTelephonyCarrierMatrixInput } from './telephony/matrix';
3
3
  import type { VoiceTraceEventStore } from './trace';
4
+ import type { VoiceAgentSquadContractReport } from './agentSquadContract';
4
5
  export type VoiceProductionReadinessStatus = 'fail' | 'pass' | 'warn';
5
6
  export type VoiceProductionReadinessAction = {
6
7
  description?: string;
@@ -20,6 +21,7 @@ export type VoiceProductionReadinessReport = {
20
21
  checkedAt: number;
21
22
  checks: VoiceProductionReadinessCheck[];
22
23
  links: {
24
+ agentSquadContracts?: string;
23
25
  carriers?: string;
24
26
  handoffs?: string;
25
27
  handoffRetry?: string;
@@ -30,6 +32,12 @@ export type VoiceProductionReadinessReport = {
30
32
  };
31
33
  status: VoiceProductionReadinessStatus;
32
34
  summary: {
35
+ agentSquadContracts?: {
36
+ failed: number;
37
+ passed: number;
38
+ status: VoiceProductionReadinessStatus;
39
+ total: number;
40
+ };
33
41
  carriers?: {
34
42
  failing: number;
35
43
  providers: number;
@@ -66,6 +74,10 @@ export type VoiceProductionReadinessReport = {
66
74
  };
67
75
  };
68
76
  export type VoiceProductionReadinessRoutesOptions = {
77
+ agentSquadContracts?: false | readonly VoiceAgentSquadContractReport[] | ((input: {
78
+ query: Record<string, unknown>;
79
+ request: Request;
80
+ }) => Promise<readonly VoiceAgentSquadContractReport[]> | readonly VoiceAgentSquadContractReport[]);
69
81
  carriers?: false | readonly VoiceTelephonyCarrierMatrixInput[] | ((input: {
70
82
  query: Record<string, unknown>;
71
83
  request: Request;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.124",
3
+ "version": "0.0.22-beta.125",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",