@absolutejs/voice 0.0.22-beta.259 → 0.0.22-beta.260
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.d.ts +2 -2
- package/dist/index.js +103 -8
- package/dist/phoneAgent.d.ts +40 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export { assertVoiceLatencySLOGate, buildVoiceLatencySLOGate, renderVoiceLatency
|
|
|
41
41
|
export { createVoiceTurnQualityHTMLHandler, createVoiceTurnQualityJSONHandler, createVoiceTurnQualityRoutes, renderVoiceTurnQualityHTML, summarizeVoiceTurnQuality } from './turnQuality';
|
|
42
42
|
export { assertVoiceOutcomeContractEvidence, createVoiceOutcomeContractHTMLHandler, createVoiceOutcomeContractJSONHandler, createVoiceOutcomeContractRoutes, evaluateVoiceOutcomeContractEvidence, renderVoiceOutcomeContractHTML, runVoiceOutcomeContractSuite } from './outcomeContract';
|
|
43
43
|
export { applyVoiceTelephonyOutcome, createMemoryVoiceTelephonyWebhookIdempotencyStore, createVoiceTelephonyOutcomePolicy, createVoiceTelephonyWebhookHandler, createVoiceTelephonyWebhookRoutes, parseVoiceTelephonyWebhookEvent, resolveVoiceTelephonyOutcome, signVoiceTwilioWebhook, verifyVoiceTwilioWebhookSignature, voiceTelephonyOutcomeToRouteResult } from './telephonyOutcome';
|
|
44
|
-
export { createVoicePhoneAgent } from './phoneAgent';
|
|
44
|
+
export { assertVoicePhoneAssistantEvidence, createVoicePhoneAgent, evaluateVoicePhoneAssistantEvidence } from './phoneAgent';
|
|
45
45
|
export { createStoredVoiceCallReviewArtifact, createStoredVoiceExternalObjectMap, createStoredVoiceIntegrationEvent, createStoredVoiceOpsTask, createVoiceFileIncidentBundleStore, createVoiceFileExternalObjectMapStore, createVoiceFileAssistantMemoryStore, createVoiceFileAuditEventStore, createVoiceFileAuditSinkDeliveryStore, createVoiceFileCampaignStore, createVoiceFileIntegrationEventStore, createVoiceFileReviewStore, createVoiceFileRuntimeStorage, createVoiceFileSessionStore, createVoiceFileTaskStore, createVoiceFileTraceSinkDeliveryStore, createVoiceFileTraceEventStore } from './fileStore';
|
|
46
46
|
export { createVoiceAssistantMemoryHandle, createVoiceAssistantMemoryRecord, createVoiceMemoryAssistantMemoryStore, resolveVoiceAssistantMemoryNamespace } from './assistantMemory';
|
|
47
47
|
export { createAnthropicVoiceAssistantModel, createGeminiVoiceAssistantModel, createJSONVoiceAssistantModel, createOpenAIVoiceAssistantModel, resolveVoiceProviderRoutingPolicyPreset, createVoiceProviderRouter } from './modelAdapters';
|
|
@@ -116,7 +116,7 @@ export type { VoiceLatencySLOBudget, VoiceLatencySLOGateError, VoiceLatencySLOGa
|
|
|
116
116
|
export type { VoiceTurnQualityHTMLHandlerOptions, VoiceTurnQualityItem, VoiceTurnQualityOptions, VoiceTurnQualityReport, VoiceTurnQualityRoutesOptions, VoiceTurnQualityStatus } from './turnQuality';
|
|
117
117
|
export type { VoiceOutcomeContractAssertionInput, VoiceOutcomeContractAssertionReport, VoiceOutcomeContractDefinition, VoiceOutcomeContractHTMLHandlerOptions, VoiceOutcomeContractIssue, VoiceOutcomeContractOptions, VoiceOutcomeContractReport, VoiceOutcomeContractRoutesOptions, VoiceOutcomeContractStatus, VoiceOutcomeContractSuiteReport } from './outcomeContract';
|
|
118
118
|
export type { VoiceTelephonyOutcomeAction, VoiceTelephonyOutcomeDecision, VoiceTelephonyOutcomePolicy, VoiceTelephonyOutcomeProviderEvent, VoiceTelephonyOutcomeRouteResult, VoiceTelephonyOutcomeStatusDecision, VoiceTelephonyWebhookDecision, VoiceTelephonyWebhookHandlerOptions, VoiceTelephonyWebhookIdempotencyStore, VoiceTelephonyWebhookParseInput, VoiceTelephonyWebhookProvider, VoiceTelephonyWebhookRoutesOptions, VoiceTelephonyWebhookVerificationResult, StoredVoiceTelephonyWebhookDecision } from './telephonyOutcome';
|
|
119
|
-
export type { VoicePhoneAgentCarrier, VoicePhoneAgentCarrierSummary, VoicePhoneAgentLifecycleStage, VoicePhoneAgentPlivoCarrier, VoicePhoneAgentRoutes, VoicePhoneAgentRoutesOptions, VoicePhoneAgentSetupReport, VoicePhoneAgentTelnyxCarrier, VoicePhoneAgentTwilioCarrier } from './phoneAgent';
|
|
119
|
+
export type { VoicePhoneAgentCarrier, VoicePhoneAgentCarrierSummary, VoicePhoneAssistantEvidenceInput, VoicePhoneAssistantEvidenceReport, VoicePhoneAgentLifecycleStage, VoicePhoneAgentPlivoCarrier, VoicePhoneAgentRoutes, VoicePhoneAgentRoutesOptions, VoicePhoneAgentSetupReport, VoicePhoneAgentTelnyxCarrier, VoicePhoneAgentTwilioCarrier } from './phoneAgent';
|
|
120
120
|
export type { VoicePhoneAgentProductionSmokeIssue, VoicePhoneAgentProductionSmokeHandlerOptions, VoicePhoneAgentProductionSmokeHTMLHandlerOptions, VoicePhoneAgentProductionSmokeOptions, VoicePhoneAgentProductionSmokeReport, VoicePhoneAgentProductionSmokeRoutesOptions, VoicePhoneAgentProductionSmokeRequirement } from './phoneAgentProductionSmoke';
|
|
121
121
|
export type { VoiceOpsConsoleLink, VoiceOpsConsoleReport, VoiceOpsConsoleRoutesOptions } from './opsConsoleRoutes';
|
|
122
122
|
export type { VoiceOpsStatus, VoiceOpsStatusLink, VoiceOpsStatusOptions, VoiceOpsStatusReport, VoiceOpsStatusRoutesOptions } from './opsStatus';
|
package/dist/index.js
CHANGED
|
@@ -19875,6 +19875,99 @@ var loadCarrierMatrixInputs = async (input) => {
|
|
|
19875
19875
|
};
|
|
19876
19876
|
var carrierAnswerLabel = (provider) => provider === "telnyx" ? "TeXML URL" : provider === "plivo" ? "Answer URL" : "TwiML URL";
|
|
19877
19877
|
var findCarrierMatrixEntry = (matrix, carrier) => matrix?.entries.find((candidate) => candidate.provider === carrier.provider && (candidate.name === carrier.name || candidate.name === (carrier.name ?? carrier.provider)));
|
|
19878
|
+
var uniqueSorted2 = (values) => Array.from(new Set(values)).sort();
|
|
19879
|
+
var findMissing2 = (values, required) => {
|
|
19880
|
+
if (!required?.length) {
|
|
19881
|
+
return [];
|
|
19882
|
+
}
|
|
19883
|
+
const valueSet = new Set(values);
|
|
19884
|
+
return required.filter((value) => !valueSet.has(value));
|
|
19885
|
+
};
|
|
19886
|
+
var evaluateVoicePhoneAssistantEvidence = (report, input = {}) => {
|
|
19887
|
+
const issues = [];
|
|
19888
|
+
const providers = uniqueSorted2(report.carriers.map((carrier) => carrier.provider));
|
|
19889
|
+
const lifecycleStages = uniqueSorted2(report.lifecycleStages);
|
|
19890
|
+
const carrierSummary = report.matrix?.summary;
|
|
19891
|
+
const carrierFailures = carrierSummary?.failing ?? 0;
|
|
19892
|
+
const carrierWarnings = carrierSummary?.warnings ?? 0;
|
|
19893
|
+
const readyCarriers = carrierSummary?.ready ?? report.carriers.filter((carrier) => findCarrierMatrixEntry(report.matrix, carrier)?.ready).length;
|
|
19894
|
+
const smokePassing = carrierSummary?.smokePassing ?? 0;
|
|
19895
|
+
const requireCarrierMatrix = input.requireCarrierMatrix ?? true;
|
|
19896
|
+
const requireMatrixPass = input.requireMatrixPass ?? true;
|
|
19897
|
+
const requireReady = input.requireReady ?? true;
|
|
19898
|
+
const requireSetupPath = input.requireSetupPath ?? true;
|
|
19899
|
+
if (requireSetupPath && !report.setupPath) {
|
|
19900
|
+
issues.push("Expected phone assistant setup path to be configured.");
|
|
19901
|
+
}
|
|
19902
|
+
if (input.requireProductionSmokePath && !report.productionSmokePath) {
|
|
19903
|
+
issues.push("Expected phone assistant production smoke path to be configured.");
|
|
19904
|
+
}
|
|
19905
|
+
if (requireReady && !report.ready) {
|
|
19906
|
+
issues.push("Expected phone assistant setup report to be ready.");
|
|
19907
|
+
}
|
|
19908
|
+
if (requireCarrierMatrix && !report.matrix) {
|
|
19909
|
+
issues.push("Expected phone assistant carrier matrix to be present.");
|
|
19910
|
+
}
|
|
19911
|
+
if (report.matrix && requireMatrixPass && !report.matrix.pass) {
|
|
19912
|
+
issues.push("Expected phone assistant carrier matrix to pass.");
|
|
19913
|
+
}
|
|
19914
|
+
if (input.minCarriers !== undefined && report.carriers.length < input.minCarriers) {
|
|
19915
|
+
issues.push(`Expected at least ${String(input.minCarriers)} phone carrier(s), found ${String(report.carriers.length)}.`);
|
|
19916
|
+
}
|
|
19917
|
+
if (input.minReadyCarriers !== undefined && readyCarriers < input.minReadyCarriers) {
|
|
19918
|
+
issues.push(`Expected at least ${String(input.minReadyCarriers)} ready phone carrier(s), found ${String(readyCarriers)}.`);
|
|
19919
|
+
}
|
|
19920
|
+
if (input.minSmokePassing !== undefined && smokePassing < input.minSmokePassing) {
|
|
19921
|
+
issues.push(`Expected at least ${String(input.minSmokePassing)} passing phone carrier smoke report(s), found ${String(smokePassing)}.`);
|
|
19922
|
+
}
|
|
19923
|
+
if (input.maxCarrierFailures !== undefined && carrierFailures > input.maxCarrierFailures) {
|
|
19924
|
+
issues.push(`Expected at most ${String(input.maxCarrierFailures)} failing phone carrier(s), found ${String(carrierFailures)}.`);
|
|
19925
|
+
}
|
|
19926
|
+
if (input.maxCarrierWarnings !== undefined && carrierWarnings > input.maxCarrierWarnings) {
|
|
19927
|
+
issues.push(`Expected at most ${String(input.maxCarrierWarnings)} phone carrier warning(s), found ${String(carrierWarnings)}.`);
|
|
19928
|
+
}
|
|
19929
|
+
for (const provider of findMissing2(providers, input.requiredProviders)) {
|
|
19930
|
+
issues.push(`Missing phone carrier provider: ${provider}.`);
|
|
19931
|
+
}
|
|
19932
|
+
for (const stage of findMissing2(lifecycleStages, input.requiredLifecycleStages)) {
|
|
19933
|
+
issues.push(`Missing phone lifecycle stage: ${stage}.`);
|
|
19934
|
+
}
|
|
19935
|
+
const dialer = input.dialerProof ? evaluateVoiceCampaignDialerProofEvidence(input.dialerProof, {
|
|
19936
|
+
maxFailedProviders: input.maxFailedDialerProviders,
|
|
19937
|
+
minCarrierRequests: input.minDialerCarrierRequests,
|
|
19938
|
+
minSuccessfulOutcomes: input.minSuccessfulDialerOutcomes,
|
|
19939
|
+
requiredProviders: input.requiredDialerProviders
|
|
19940
|
+
}) : undefined;
|
|
19941
|
+
if (input.requireDialerProof && !input.dialerProof) {
|
|
19942
|
+
issues.push("Expected campaign dialer proof to be present.");
|
|
19943
|
+
}
|
|
19944
|
+
if (dialer && !dialer.ok) {
|
|
19945
|
+
issues.push(...dialer.issues);
|
|
19946
|
+
}
|
|
19947
|
+
return {
|
|
19948
|
+
carrierFailures,
|
|
19949
|
+
carrierWarnings,
|
|
19950
|
+
carriers: report.carriers.length,
|
|
19951
|
+
dialer,
|
|
19952
|
+
issues,
|
|
19953
|
+
lifecycleStages,
|
|
19954
|
+
matrixPass: report.matrix?.pass,
|
|
19955
|
+
ok: issues.length === 0,
|
|
19956
|
+
productionSmokePath: report.productionSmokePath,
|
|
19957
|
+
providers,
|
|
19958
|
+
ready: report.ready,
|
|
19959
|
+
readyCarriers,
|
|
19960
|
+
setupPath: report.setupPath,
|
|
19961
|
+
smokePassing
|
|
19962
|
+
};
|
|
19963
|
+
};
|
|
19964
|
+
var assertVoicePhoneAssistantEvidence = (report, input = {}) => {
|
|
19965
|
+
const assertion = evaluateVoicePhoneAssistantEvidence(report, input);
|
|
19966
|
+
if (!assertion.ok) {
|
|
19967
|
+
throw new Error(`Voice phone assistant evidence assertion failed: ${assertion.issues.join(" ")}`);
|
|
19968
|
+
}
|
|
19969
|
+
return assertion;
|
|
19970
|
+
};
|
|
19878
19971
|
var buildVoicePhoneAgentSetupInstructions = (input) => input.carriers.map((carrier) => {
|
|
19879
19972
|
const entry = findCarrierMatrixEntry(input.matrix, carrier);
|
|
19880
19973
|
const urls = entry?.setup.urls;
|
|
@@ -22807,7 +22900,7 @@ var statusRank = {
|
|
|
22807
22900
|
var escapeHtml36 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
22808
22901
|
var roundMetric3 = (value) => Math.round(value * 1e4) / 1e4;
|
|
22809
22902
|
var rate3 = (count, total) => count / Math.max(1, total);
|
|
22810
|
-
var
|
|
22903
|
+
var uniqueSorted3 = (values) => [
|
|
22811
22904
|
...new Set(values.filter((value) => typeof value === "string"))
|
|
22812
22905
|
].sort();
|
|
22813
22906
|
var percentile3 = (values, rank) => {
|
|
@@ -22990,7 +23083,7 @@ var buildVoiceProviderSloReport = async (options = {}) => {
|
|
|
22990
23083
|
var evaluateVoiceProviderSloEvidence = (report, input = {}) => {
|
|
22991
23084
|
const issues = [];
|
|
22992
23085
|
const kindReports = Object.values(report.kinds);
|
|
22993
|
-
const providers =
|
|
23086
|
+
const providers = uniqueSorted3(kindReports.flatMap((kind) => kind.providers));
|
|
22994
23087
|
const kinds = providerKinds.filter((kind) => report.kinds[kind].events > 0);
|
|
22995
23088
|
const fallbacks = kindReports.reduce((total, kind) => total + kind.fallbacks, 0);
|
|
22996
23089
|
const timeouts = kindReports.reduce((total, kind) => total + kind.timeouts, 0);
|
|
@@ -23711,7 +23804,7 @@ var hasPayloadValue = (payload, key, values) => {
|
|
|
23711
23804
|
return typeof value === "string" && values.has(value);
|
|
23712
23805
|
};
|
|
23713
23806
|
var countIntegrationDeliveryStatus = (events, status) => events.filter((event) => event.deliveryStatus === status).length;
|
|
23714
|
-
var
|
|
23807
|
+
var uniqueSorted4 = (values) => [
|
|
23715
23808
|
...new Set(values.filter((value) => typeof value === "string"))
|
|
23716
23809
|
].sort();
|
|
23717
23810
|
var pushMissingValuesIssue = (input) => {
|
|
@@ -23890,11 +23983,11 @@ var buildVoiceOperationsRecord = async (options) => {
|
|
|
23890
23983
|
var evaluateVoiceOperationsRecordGuardrails = (record, input = {}) => {
|
|
23891
23984
|
const issues = [];
|
|
23892
23985
|
const decisions = record.guardrails.decisions;
|
|
23893
|
-
const proofs =
|
|
23894
|
-
const ruleIds =
|
|
23895
|
-
const stages =
|
|
23896
|
-
const statuses =
|
|
23897
|
-
const toolNames =
|
|
23986
|
+
const proofs = uniqueSorted4(decisions.map((decision) => decision.proof));
|
|
23987
|
+
const ruleIds = uniqueSorted4(decisions.flatMap((decision) => decision.findings.map((finding) => finding.ruleId)));
|
|
23988
|
+
const stages = uniqueSorted4(decisions.map((decision) => decision.stage));
|
|
23989
|
+
const statuses = uniqueSorted4(decisions.map((decision) => decision.status));
|
|
23990
|
+
const toolNames = uniqueSorted4(decisions.map((decision) => decision.toolName));
|
|
23898
23991
|
const minDecisions = input.minDecisions ?? 1;
|
|
23899
23992
|
if (record.guardrails.total < minDecisions) {
|
|
23900
23993
|
issues.push(`Expected at least ${String(minDecisions)} guardrail decisions, found ${String(record.guardrails.total)}.`);
|
|
@@ -31142,6 +31235,7 @@ export {
|
|
|
31142
31235
|
evaluateVoiceProofTrendEvidence,
|
|
31143
31236
|
evaluateVoiceProductionReadinessEvidence,
|
|
31144
31237
|
evaluateVoicePlatformCoverage,
|
|
31238
|
+
evaluateVoicePhoneAssistantEvidence,
|
|
31145
31239
|
evaluateVoiceOutcomeContractEvidence,
|
|
31146
31240
|
evaluateVoiceOperationsRecordGuardrails,
|
|
31147
31241
|
evaluateVoiceObservabilityExportReplayEvidence,
|
|
@@ -31472,6 +31566,7 @@ export {
|
|
|
31472
31566
|
assertVoiceProofTrendEvidence,
|
|
31473
31567
|
assertVoiceProductionReadinessEvidence,
|
|
31474
31568
|
assertVoicePlatformCoverage,
|
|
31569
|
+
assertVoicePhoneAssistantEvidence,
|
|
31475
31570
|
assertVoiceOutcomeContractEvidence,
|
|
31476
31571
|
assertVoiceOperationsRecordGuardrails,
|
|
31477
31572
|
assertVoiceObservabilityExportSchema,
|
package/dist/phoneAgent.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { type TelnyxVoiceRoutesOptions } from './telephony/telnyx';
|
|
|
4
4
|
import { type TwilioVoiceRoutesOptions } from './telephony/twilio';
|
|
5
5
|
import { type VoiceTelephonyCarrierMatrix, type VoiceTelephonyCarrierMatrixRoutesOptions } from './telephony/matrix';
|
|
6
6
|
import { type VoicePhoneAgentProductionSmokeRoutesOptions } from './phoneAgentProductionSmoke';
|
|
7
|
+
import { type VoiceCampaignDialerProofAssertionReport, type VoiceCampaignDialerProofProvider, type VoiceCampaignDialerProofReport } from './campaignDialers';
|
|
8
|
+
import type { VoiceTelephonyProvider } from './telephony/contract';
|
|
7
9
|
import type { VoiceSessionRecord } from './types';
|
|
8
10
|
export type VoicePhoneAgentLifecycleStage = 'ringing' | 'answered' | 'media-started' | 'transcript' | 'assistant-response' | 'transfer' | 'voicemail' | 'no-answer' | 'completed' | 'failed';
|
|
9
11
|
type VoicePhoneAgentCarrierBase = {
|
|
@@ -72,5 +74,43 @@ export type VoicePhoneAgentSetupReport = {
|
|
|
72
74
|
setupPath?: string;
|
|
73
75
|
title: string;
|
|
74
76
|
};
|
|
77
|
+
export type VoicePhoneAssistantEvidenceInput = {
|
|
78
|
+
dialerProof?: VoiceCampaignDialerProofReport;
|
|
79
|
+
maxCarrierFailures?: number;
|
|
80
|
+
maxCarrierWarnings?: number;
|
|
81
|
+
maxFailedDialerProviders?: number;
|
|
82
|
+
minCarriers?: number;
|
|
83
|
+
minDialerCarrierRequests?: number;
|
|
84
|
+
minReadyCarriers?: number;
|
|
85
|
+
minSmokePassing?: number;
|
|
86
|
+
minSuccessfulDialerOutcomes?: number;
|
|
87
|
+
requiredDialerProviders?: VoiceCampaignDialerProofProvider[];
|
|
88
|
+
requiredLifecycleStages?: VoicePhoneAgentLifecycleStage[];
|
|
89
|
+
requiredProviders?: VoiceTelephonyProvider[];
|
|
90
|
+
requireCarrierMatrix?: boolean;
|
|
91
|
+
requireDialerProof?: boolean;
|
|
92
|
+
requireMatrixPass?: boolean;
|
|
93
|
+
requireProductionSmokePath?: boolean;
|
|
94
|
+
requireReady?: boolean;
|
|
95
|
+
requireSetupPath?: boolean;
|
|
96
|
+
};
|
|
97
|
+
export type VoicePhoneAssistantEvidenceReport = {
|
|
98
|
+
carrierFailures: number;
|
|
99
|
+
carrierWarnings: number;
|
|
100
|
+
carriers: number;
|
|
101
|
+
dialer?: VoiceCampaignDialerProofAssertionReport;
|
|
102
|
+
issues: string[];
|
|
103
|
+
lifecycleStages: VoicePhoneAgentLifecycleStage[];
|
|
104
|
+
matrixPass?: boolean;
|
|
105
|
+
ok: boolean;
|
|
106
|
+
productionSmokePath?: string;
|
|
107
|
+
providers: VoiceTelephonyProvider[];
|
|
108
|
+
ready: boolean;
|
|
109
|
+
readyCarriers: number;
|
|
110
|
+
setupPath?: string;
|
|
111
|
+
smokePassing: number;
|
|
112
|
+
};
|
|
113
|
+
export declare const evaluateVoicePhoneAssistantEvidence: (report: VoicePhoneAgentSetupReport, input?: VoicePhoneAssistantEvidenceInput) => VoicePhoneAssistantEvidenceReport;
|
|
114
|
+
export declare const assertVoicePhoneAssistantEvidence: (report: VoicePhoneAgentSetupReport, input?: VoicePhoneAssistantEvidenceInput) => VoicePhoneAssistantEvidenceReport;
|
|
75
115
|
export declare const createVoicePhoneAgent: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options: VoicePhoneAgentRoutesOptions<TContext, TSession, TResult>) => VoicePhoneAgentRoutes;
|
|
76
116
|
export {};
|