@absolutejs/voice 0.0.22-beta.108 → 0.0.22-beta.109
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/campaign.d.ts +17 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +69 -0
- package/package.json +1 -1
package/dist/campaign.d.ts
CHANGED
|
@@ -91,6 +91,22 @@ export type VoiceCampaignTickResult = {
|
|
|
91
91
|
}>;
|
|
92
92
|
started: VoiceCampaignAttempt[];
|
|
93
93
|
};
|
|
94
|
+
export type VoiceCampaignProofOptions = {
|
|
95
|
+
campaign?: VoiceCampaignCreateInput;
|
|
96
|
+
completeAttempts?: boolean;
|
|
97
|
+
recipients?: VoiceCampaignRecipientInput[];
|
|
98
|
+
runtime?: VoiceCampaignRuntime;
|
|
99
|
+
store?: VoiceCampaignStore;
|
|
100
|
+
};
|
|
101
|
+
export type VoiceCampaignProofReport = {
|
|
102
|
+
campaign: VoiceCampaignRecord;
|
|
103
|
+
created: VoiceCampaignRecord;
|
|
104
|
+
final: VoiceCampaignRecord;
|
|
105
|
+
proof: 'voice-campaign';
|
|
106
|
+
recipients: VoiceCampaignRecord;
|
|
107
|
+
summary: VoiceCampaignSummary;
|
|
108
|
+
tick: VoiceCampaignTickResult;
|
|
109
|
+
};
|
|
94
110
|
export type VoiceCampaignSummary = {
|
|
95
111
|
attempts: {
|
|
96
112
|
failed: number;
|
|
@@ -144,6 +160,7 @@ export type VoiceCampaignRoutesOptions = VoiceCampaignRuntimeOptions & {
|
|
|
144
160
|
export declare const createVoiceMemoryCampaignStore: () => VoiceCampaignStore;
|
|
145
161
|
export declare const summarizeVoiceCampaigns: (records: VoiceCampaignRecord[]) => VoiceCampaignSummary;
|
|
146
162
|
export declare const createVoiceCampaign: (options: VoiceCampaignRuntimeOptions) => VoiceCampaignRuntime;
|
|
163
|
+
export declare const runVoiceCampaignProof: (options?: VoiceCampaignProofOptions) => Promise<VoiceCampaignProofReport>;
|
|
147
164
|
export declare const renderVoiceCampaignsHTML: (records: VoiceCampaignRecord[], options?: {
|
|
148
165
|
title?: string;
|
|
149
166
|
}) => string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { voice } from './plugin';
|
|
2
2
|
export { createVoiceAppKit, createVoiceAppKitRoutes, summarizeVoiceAppKitStatus } from './appKit';
|
|
3
|
-
export { createVoiceCampaign, createVoiceCampaignRoutes, createVoiceMemoryCampaignStore, renderVoiceCampaignsHTML, summarizeVoiceCampaigns } from './campaign';
|
|
3
|
+
export { createVoiceCampaign, createVoiceCampaignRoutes, createVoiceMemoryCampaignStore, renderVoiceCampaignsHTML, runVoiceCampaignProof, summarizeVoiceCampaigns } from './campaign';
|
|
4
4
|
export { createVoiceAssistant, createVoiceExperiment, summarizeVoiceAssistantRuns } from './assistant';
|
|
5
5
|
export { createVoiceAssistantHealthHTMLHandler, createVoiceAssistantHealthJSONHandler, createVoiceAssistantHealthRoutes, renderVoiceAssistantHealthHTML, summarizeVoiceAssistantHealth } from './assistantHealth';
|
|
6
6
|
export { createVoiceBargeInRoutes, renderVoiceBargeInHTML, summarizeVoiceBargeIn } from './bargeInRoutes';
|
|
@@ -54,7 +54,7 @@ export { resolveVoiceRuntimePreset } from './presets';
|
|
|
54
54
|
export { resolveTurnDetectionConfig, TURN_PROFILE_DEFAULTS } from './turnProfiles';
|
|
55
55
|
export { createVoiceCallReviewFromLiveTelephonyReport, createVoiceCallReviewRecorder, renderVoiceCallReviewHTML, renderVoiceCallReviewMarkdown } from './testing/review';
|
|
56
56
|
export type { VoiceAppKitLink, VoiceAppKitRoutes, VoiceAppKitRoutesOptions, VoiceAppKitStatus, VoiceAppKitStatusOptions, VoiceAppKitStatusReport, VoiceAppKitSurface } from './appKit';
|
|
57
|
-
export type { VoiceCampaign, VoiceCampaignAttempt, VoiceCampaignAttemptResultInput, VoiceCampaignAttemptStatus, VoiceCampaignCreateInput, VoiceCampaignDialer, VoiceCampaignDialerInput, VoiceCampaignDialerResult, VoiceCampaignRecipient, VoiceCampaignRecipientInput, VoiceCampaignRecipientStatus, VoiceCampaignRecord, VoiceCampaignRoutesOptions, VoiceCampaignRuntime, VoiceCampaignRuntimeOptions, VoiceCampaignStatus, VoiceCampaignStore, VoiceCampaignSummary, VoiceCampaignTickResult } from './campaign';
|
|
57
|
+
export type { VoiceCampaign, VoiceCampaignAttempt, VoiceCampaignAttemptResultInput, VoiceCampaignAttemptStatus, VoiceCampaignCreateInput, VoiceCampaignDialer, VoiceCampaignDialerInput, VoiceCampaignDialerResult, VoiceCampaignProofOptions, VoiceCampaignProofReport, VoiceCampaignRecipient, VoiceCampaignRecipientInput, VoiceCampaignRecipientStatus, VoiceCampaignRecord, VoiceCampaignRoutesOptions, VoiceCampaignRuntime, VoiceCampaignRuntimeOptions, VoiceCampaignStatus, VoiceCampaignStore, VoiceCampaignSummary, VoiceCampaignTickResult } from './campaign';
|
|
58
58
|
export type { VoiceBargeInReport, VoiceBargeInRoutesOptions } from './bargeInRoutes';
|
|
59
59
|
export type { VoiceAssistant, VoiceAssistantArtifactPlan, VoiceAssistantExperiment, VoiceAssistantExperimentOptions, VoiceAssistantGuardrailInput, VoiceAssistantGuardrails, VoiceAssistantMemoryLifecycle, VoiceAssistantMemoryLifecycleInput, VoiceAssistantOptions, VoiceAssistantOutputGuardrailInput, VoiceAssistantPreset, VoiceAssistantRunsSummary, VoiceAssistantRunSummary, VoiceAssistantVariant } from './assistant';
|
|
60
60
|
export type { VoiceAssistantHealthFailure, VoiceAssistantHealthHTMLHandlerOptions, VoiceAssistantHealthRoutesOptions, VoiceAssistantHealthSummary, VoiceAssistantHealthSummaryOptions } from './assistantHealth';
|
package/dist/index.js
CHANGED
|
@@ -10794,6 +10794,74 @@ var createVoiceCampaign = (options) => {
|
|
|
10794
10794
|
}
|
|
10795
10795
|
};
|
|
10796
10796
|
};
|
|
10797
|
+
var defaultProofRecipients = () => [
|
|
10798
|
+
{
|
|
10799
|
+
id: "campaign-proof-recipient-1",
|
|
10800
|
+
name: "Proof Recipient One",
|
|
10801
|
+
phone: "+15550001001",
|
|
10802
|
+
variables: {
|
|
10803
|
+
firstName: "Ari",
|
|
10804
|
+
reason: "demo"
|
|
10805
|
+
}
|
|
10806
|
+
},
|
|
10807
|
+
{
|
|
10808
|
+
id: "campaign-proof-recipient-2",
|
|
10809
|
+
name: "Proof Recipient Two",
|
|
10810
|
+
phone: "+15550001002",
|
|
10811
|
+
variables: {
|
|
10812
|
+
firstName: "Sam",
|
|
10813
|
+
reason: "follow-up"
|
|
10814
|
+
}
|
|
10815
|
+
}
|
|
10816
|
+
];
|
|
10817
|
+
var runVoiceCampaignProof = async (options = {}) => {
|
|
10818
|
+
const runtime = options.runtime ?? createVoiceCampaign({
|
|
10819
|
+
dialer: ({ attempt, recipient }) => ({
|
|
10820
|
+
externalCallId: `proof-call-${attempt.id}`,
|
|
10821
|
+
metadata: {
|
|
10822
|
+
mode: "simulation",
|
|
10823
|
+
phone: recipient.phone
|
|
10824
|
+
},
|
|
10825
|
+
status: "running"
|
|
10826
|
+
}),
|
|
10827
|
+
store: options.store ?? createVoiceMemoryCampaignStore()
|
|
10828
|
+
});
|
|
10829
|
+
const created = await runtime.create({
|
|
10830
|
+
description: "Synthetic outbound campaign proof.",
|
|
10831
|
+
id: `campaign-proof-${crypto.randomUUID()}`,
|
|
10832
|
+
maxAttempts: 1,
|
|
10833
|
+
maxConcurrentAttempts: 10,
|
|
10834
|
+
name: "AbsoluteJS Voice Campaign Proof",
|
|
10835
|
+
...options.campaign
|
|
10836
|
+
});
|
|
10837
|
+
const recipients = await runtime.addRecipients(created.campaign.id, options.recipients ?? defaultProofRecipients());
|
|
10838
|
+
const campaign = await runtime.enqueue(recipients.campaign.id);
|
|
10839
|
+
const tick = await runtime.tick(campaign.campaign.id);
|
|
10840
|
+
if (options.completeAttempts !== false) {
|
|
10841
|
+
for (const attempt of tick.started) {
|
|
10842
|
+
await runtime.completeAttempt(campaign.campaign.id, attempt.id, {
|
|
10843
|
+
externalCallId: attempt.externalCallId,
|
|
10844
|
+
metadata: {
|
|
10845
|
+
proof: true
|
|
10846
|
+
},
|
|
10847
|
+
status: "succeeded"
|
|
10848
|
+
});
|
|
10849
|
+
}
|
|
10850
|
+
}
|
|
10851
|
+
const final = await runtime.get(campaign.campaign.id);
|
|
10852
|
+
if (!final) {
|
|
10853
|
+
throw new Error("Campaign proof did not persist the final campaign record.");
|
|
10854
|
+
}
|
|
10855
|
+
return {
|
|
10856
|
+
campaign,
|
|
10857
|
+
created,
|
|
10858
|
+
final,
|
|
10859
|
+
proof: "voice-campaign",
|
|
10860
|
+
recipients,
|
|
10861
|
+
summary: await runtime.summarize(),
|
|
10862
|
+
tick
|
|
10863
|
+
};
|
|
10864
|
+
};
|
|
10797
10865
|
var escapeHtml18 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
10798
10866
|
var renderVoiceCampaignsHTML = (records, options = {}) => {
|
|
10799
10867
|
const title = options.title ?? "Voice Campaigns";
|
|
@@ -18784,6 +18852,7 @@ export {
|
|
|
18784
18852
|
runVoiceScenarioFixtureEvals,
|
|
18785
18853
|
runVoiceScenarioEvals,
|
|
18786
18854
|
runVoiceOutcomeContractSuite,
|
|
18855
|
+
runVoiceCampaignProof,
|
|
18787
18856
|
resolveVoiceTraceRedactionOptions,
|
|
18788
18857
|
resolveVoiceTelephonyOutcome,
|
|
18789
18858
|
resolveVoiceSTTRoutingStrategy,
|