@absolutejs/voice 0.0.22-beta.193 → 0.0.22-beta.195
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 +58 -0
- package/dist/agent.d.ts +15 -0
- package/dist/client/index.js +2 -0
- package/dist/dataControl.d.ts +92 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +591 -280
- package/dist/svelte/index.js +2 -0
- package/dist/trace.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1045,6 +1045,19 @@ const frontDesk = createVoiceAgentSquad({
|
|
|
1045
1045
|
id: 'front-desk',
|
|
1046
1046
|
defaultAgentId: 'support',
|
|
1047
1047
|
agents: [supportAgent, billingAgent],
|
|
1048
|
+
contextPolicy: ({ summaryMessage, turn }) => ({
|
|
1049
|
+
messages: [
|
|
1050
|
+
summaryMessage,
|
|
1051
|
+
{
|
|
1052
|
+
content: turn.text,
|
|
1053
|
+
role: 'user'
|
|
1054
|
+
}
|
|
1055
|
+
],
|
|
1056
|
+
metadata: {
|
|
1057
|
+
contextPolicy: 'handoff-summary-and-current-turn'
|
|
1058
|
+
},
|
|
1059
|
+
system: 'Use only the handoff summary and current caller turn.'
|
|
1060
|
+
}),
|
|
1048
1061
|
handoffPolicy: ({ handoff }) => {
|
|
1049
1062
|
if (handoff.targetAgentId === 'billing') {
|
|
1050
1063
|
return {
|
|
@@ -1074,6 +1087,10 @@ voice({
|
|
|
1074
1087
|
|
|
1075
1088
|
For production call centers, pass `handoffPolicy` to keep routing code-owned instead of dashboard-owned. The policy can allow a handoff, reroute it to a different specialist, merge handoff metadata, summarize the reason for the target agent, or block the handoff and return an escalation. Squad traces mark each handoff as `allowed`, `blocked`, `unknown-target`, or `max-exceeded`, so support teams can audit why a caller moved between specialists.
|
|
1076
1089
|
|
|
1090
|
+
Pass `contextPolicy` when a specialist should receive a controlled context window. The default behavior preserves the accumulated conversation plus a system handoff summary. A context policy can trim that to a handoff summary and current turn, add a specialist-specific system prompt, or attach metadata that appears in the returned squad state. This is the code-owned equivalent of Vapi Squads context controls: the app decides what each specialist sees, and `agent.context` traces show whether default or custom context was applied.
|
|
1091
|
+
|
|
1092
|
+
Each specialist owns its own `tools`, so tool permissions stay explicit per agent. For example, support can have `lookup_order`, billing can have `refund_invoice`, and scheduling can have `book_appointment`. The squad only routes; it does not give every specialist every tool by default.
|
|
1093
|
+
|
|
1077
1094
|
Use `runVoiceAgentSquadContract(...)` in tests or readiness checks when you need proof that a specialist graph still routes correctly:
|
|
1078
1095
|
|
|
1079
1096
|
```ts
|
|
@@ -1292,6 +1309,47 @@ await applyVoiceDataRetentionPolicy({
|
|
|
1292
1309
|
});
|
|
1293
1310
|
```
|
|
1294
1311
|
|
|
1312
|
+
For a compliance-facing control surface, mount `createVoiceDataControlRoutes(...)`. It packages the same primitives into a self-hosted report for customer-owned storage, retention dry-runs, guarded deletion, redacted audit export, zero-retention mode, and provider-key handling.
|
|
1313
|
+
|
|
1314
|
+
```ts
|
|
1315
|
+
import {
|
|
1316
|
+
createVoiceDataControlRoutes,
|
|
1317
|
+
createVoiceZeroRetentionPolicy,
|
|
1318
|
+
voiceComplianceRedactionDefaults
|
|
1319
|
+
} from '@absolutejs/voice';
|
|
1320
|
+
|
|
1321
|
+
app.use(
|
|
1322
|
+
createVoiceDataControlRoutes({
|
|
1323
|
+
...runtimeStorage,
|
|
1324
|
+
audit: runtimeStorage.audit,
|
|
1325
|
+
auditDeliveries: runtimeStorage.auditDeliveries,
|
|
1326
|
+
path: '/data-control',
|
|
1327
|
+
redact: voiceComplianceRedactionDefaults,
|
|
1328
|
+
traceDeliveries: runtimeStorage.traceDeliveries
|
|
1329
|
+
})
|
|
1330
|
+
);
|
|
1331
|
+
|
|
1332
|
+
const zeroRetentionPlan = await buildVoiceDataRetentionPlan(
|
|
1333
|
+
createVoiceZeroRetentionPolicy({
|
|
1334
|
+
...runtimeStorage,
|
|
1335
|
+
audit: runtimeStorage.audit,
|
|
1336
|
+
auditDeliveries: runtimeStorage.auditDeliveries,
|
|
1337
|
+
traceDeliveries: runtimeStorage.traceDeliveries
|
|
1338
|
+
})
|
|
1339
|
+
);
|
|
1340
|
+
```
|
|
1341
|
+
|
|
1342
|
+
Mounted routes:
|
|
1343
|
+
|
|
1344
|
+
- `GET /data-control`: HTML compliance/data-control report.
|
|
1345
|
+
- `GET /data-control.json`: JSON report with redaction, storage, retention plan, audit export, and provider-key recommendations.
|
|
1346
|
+
- `GET /data-control.md`: Markdown report for release/security reviews.
|
|
1347
|
+
- `POST /data-control/retention/plan`: dry-run deletion proof from a JSON policy body.
|
|
1348
|
+
- `POST /data-control/retention/apply`: applies retention only when the body includes `confirm: "apply-retention-policy"`.
|
|
1349
|
+
- `GET /data-control/audit.json`, `/data-control/audit.md`, `/data-control/audit.html`: redacted audit exports.
|
|
1350
|
+
|
|
1351
|
+
`createVoiceZeroRetentionPolicy(...)` intentionally defaults to `dryRun: true`; callers must explicitly apply the generated policy after reviewing the deletion proof. This gives compliance-sensitive deployments a concrete zero-retention recipe without making accidental deletion easy.
|
|
1352
|
+
|
|
1295
1353
|
Use `createVoiceAuditLogger(...)` when you need append-only compliance evidence outside call traces. The logger records provider calls, tool calls, handoffs, retention runs, and operator actions into `runtimeStorage.audit`, so self-hosted teams can prove who changed what, which provider ran, which tool fired, and what data-control policy deleted.
|
|
1296
1354
|
|
|
1297
1355
|
Pass `audit` directly to `createVoiceAgent(...)` to record model calls as provider-call audit events and tool executions as tool-call audit events. Pass it to `createVoiceAgentSquad(...)` to record squad handoffs automatically. Use `auditProvider` and `auditModel` on agents when you want readiness and compliance reports to show the actual model provider instead of the agent id.
|
package/dist/agent.d.ts
CHANGED
|
@@ -95,6 +95,11 @@ export type VoiceAgentSquadHandoffPolicyResult<TResult = unknown> = {
|
|
|
95
95
|
summary?: string;
|
|
96
96
|
targetAgentId?: string;
|
|
97
97
|
};
|
|
98
|
+
export type VoiceAgentSquadContextPolicyResult = {
|
|
99
|
+
messages?: VoiceAgentMessage[];
|
|
100
|
+
metadata?: Record<string, unknown>;
|
|
101
|
+
system?: string;
|
|
102
|
+
};
|
|
98
103
|
export type VoiceAgent<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
99
104
|
id: string;
|
|
100
105
|
onTurn: VoiceOnTurnObjectHandler<TContext, TSession, TResult>;
|
|
@@ -136,6 +141,16 @@ export type VoiceAgentSquadOptions<TContext = unknown, TSession extends VoiceSes
|
|
|
136
141
|
targetAgent?: VoiceAgent<TContext, TSession, TResult>;
|
|
137
142
|
turn: VoiceTurnRecord;
|
|
138
143
|
}) => Promise<VoiceAgentSquadHandoffPolicyResult<TResult> | void> | VoiceAgentSquadHandoffPolicyResult<TResult> | void;
|
|
144
|
+
contextPolicy?: (input: {
|
|
145
|
+
context: TContext;
|
|
146
|
+
fromAgentId: string;
|
|
147
|
+
handoff: VoiceAgentSquadStateHandoff;
|
|
148
|
+
messages: VoiceAgentMessage[];
|
|
149
|
+
session: TSession;
|
|
150
|
+
summaryMessage: VoiceAgentMessage;
|
|
151
|
+
targetAgent: VoiceAgent<TContext, TSession, TResult>;
|
|
152
|
+
turn: VoiceTurnRecord;
|
|
153
|
+
}) => Promise<VoiceAgentSquadContextPolicyResult | void> | VoiceAgentSquadContextPolicyResult | void;
|
|
139
154
|
id: string;
|
|
140
155
|
maxHandoffsPerTurn?: number;
|
|
141
156
|
onHandoff?: (input: {
|
package/dist/client/index.js
CHANGED
|
@@ -3533,6 +3533,8 @@ var renderTraceEventMarkdown = (event, startedAt) => {
|
|
|
3533
3533
|
return event.payload.text ? `${label} assistant "${formatTraceValue(event.payload.text)}"` : `${label} ${formatTraceValue(event.payload.status)}`;
|
|
3534
3534
|
case "agent.tool":
|
|
3535
3535
|
return `${label} ${formatTraceValue(event.payload.toolName)} ${formatTraceValue(event.payload.status)}`;
|
|
3536
|
+
case "agent.context":
|
|
3537
|
+
return `${label} ${formatTraceValue(event.payload.fromAgentId)} -> ${formatTraceValue(event.payload.targetAgentId)} ${formatTraceValue(event.payload.status)}`;
|
|
3536
3538
|
case "agent.handoff":
|
|
3537
3539
|
return `${label} ${formatTraceValue(event.payload.fromAgentId)} -> ${formatTraceValue(event.payload.targetAgentId)}`;
|
|
3538
3540
|
case "session.error":
|
package/dist/dataControl.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { VoiceCampaignStore } from './campaign';
|
|
2
|
-
import {
|
|
2
|
+
import { Elysia } from 'elysia';
|
|
3
|
+
import { type VoiceAuditActor, type VoiceAuditEventFilter, type VoiceAuditEventStore } from './audit';
|
|
4
|
+
import { exportVoiceAuditTrail } from './auditExport';
|
|
3
5
|
import type { VoiceAuditSinkDeliveryStore } from './auditSinks';
|
|
4
6
|
import type { VoiceIntegrationEventStore, VoiceOpsTaskStore } from './ops';
|
|
5
7
|
import type { VoiceIncidentBundleStore } from './incidentBundle';
|
|
6
8
|
import type { VoiceCallReviewStore } from './testing/review';
|
|
7
9
|
import type { VoiceTraceEventStore, VoiceTracePruneFilter, VoiceTraceSinkDeliveryStore } from './trace';
|
|
8
10
|
import type { VoiceSessionStore } from './types';
|
|
11
|
+
export declare const voiceComplianceRedactionDefaults: {
|
|
12
|
+
keys: string[];
|
|
13
|
+
redactEmails: true;
|
|
14
|
+
redactPhoneNumbers: true;
|
|
15
|
+
};
|
|
9
16
|
export type VoiceDataRetentionScope = 'auditDeliveries' | 'campaigns' | 'events' | 'incidentBundles' | 'reviews' | 'sessions' | 'tasks' | 'traceDeliveries' | 'traces';
|
|
10
17
|
export type VoiceDataRetentionStores = {
|
|
11
18
|
campaigns?: VoiceCampaignStore;
|
|
@@ -45,5 +52,89 @@ export type VoiceDataRetentionReport = {
|
|
|
45
52
|
dryRun: boolean;
|
|
46
53
|
scopes: VoiceDataRetentionScopeReport[];
|
|
47
54
|
};
|
|
55
|
+
export type VoiceDataControlStorageSurface = {
|
|
56
|
+
configured: boolean;
|
|
57
|
+
control: 'audit' | 'artifact' | 'queue' | 'session' | 'workflow';
|
|
58
|
+
name: string;
|
|
59
|
+
selfHosted: boolean;
|
|
60
|
+
};
|
|
61
|
+
export type VoiceDataControlProviderKeySurface = {
|
|
62
|
+
env?: string;
|
|
63
|
+
name: string;
|
|
64
|
+
recommendation: string;
|
|
65
|
+
required: boolean;
|
|
66
|
+
};
|
|
67
|
+
export type VoiceDataControlReport = {
|
|
68
|
+
auditExport?: Awaited<ReturnType<typeof exportVoiceAuditTrail>>;
|
|
69
|
+
checkedAt: number;
|
|
70
|
+
deletionProof?: VoiceDataRetentionReport;
|
|
71
|
+
redaction: {
|
|
72
|
+
defaults: typeof voiceComplianceRedactionDefaults;
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
};
|
|
75
|
+
retentionPlan: VoiceDataRetentionReport;
|
|
76
|
+
storage: VoiceDataControlStorageSurface[];
|
|
77
|
+
providerKeys: VoiceDataControlProviderKeySurface[];
|
|
78
|
+
zeroRetentionAvailable: boolean;
|
|
79
|
+
};
|
|
80
|
+
export type VoiceDataControlRoutesOptions = VoiceDataRetentionStores & {
|
|
81
|
+
audit?: VoiceAuditEventStore;
|
|
82
|
+
auditActor?: VoiceAuditActor;
|
|
83
|
+
auditDeliveries?: VoiceAuditSinkDeliveryStore;
|
|
84
|
+
headers?: HeadersInit;
|
|
85
|
+
name?: string;
|
|
86
|
+
path?: string;
|
|
87
|
+
providerKeys?: VoiceDataControlProviderKeySurface[];
|
|
88
|
+
redact?: import('./trace').VoiceTraceRedactionConfig | boolean;
|
|
89
|
+
title?: string;
|
|
90
|
+
traceDeliveries?: VoiceTraceSinkDeliveryStore;
|
|
91
|
+
};
|
|
48
92
|
export declare const applyVoiceDataRetentionPolicy: (options: VoiceDataRetentionPolicy) => Promise<VoiceDataRetentionReport>;
|
|
49
93
|
export declare const buildVoiceDataRetentionPlan: (options: Omit<VoiceDataRetentionPolicy, "dryRun">) => Promise<VoiceDataRetentionReport>;
|
|
94
|
+
export declare const createVoiceZeroRetentionPolicy: (options: VoiceDataRetentionStores & {
|
|
95
|
+
audit?: VoiceAuditEventStore;
|
|
96
|
+
auditActor?: VoiceAuditActor;
|
|
97
|
+
auditDeliveries?: VoiceAuditSinkDeliveryStore;
|
|
98
|
+
beforeOrAt?: number;
|
|
99
|
+
dryRun?: boolean;
|
|
100
|
+
scopes?: VoiceDataRetentionScope[];
|
|
101
|
+
traceDeliveries?: VoiceTraceSinkDeliveryStore;
|
|
102
|
+
}) => VoiceDataRetentionPolicy;
|
|
103
|
+
export declare const buildVoiceDataControlReport: (options: VoiceDataControlRoutesOptions & {
|
|
104
|
+
auditFilter?: VoiceAuditEventFilter;
|
|
105
|
+
retention?: Omit<VoiceDataRetentionPolicy, "dryRun">;
|
|
106
|
+
}) => Promise<VoiceDataControlReport>;
|
|
107
|
+
export declare const renderVoiceDataControlHTML: (report: VoiceDataControlReport, options?: {
|
|
108
|
+
title?: string;
|
|
109
|
+
}) => string;
|
|
110
|
+
export declare const renderVoiceDataControlMarkdown: (report: VoiceDataControlReport, options?: {
|
|
111
|
+
title?: string;
|
|
112
|
+
}) => string;
|
|
113
|
+
export declare const createVoiceDataControlRoutes: (options: VoiceDataControlRoutesOptions) => Elysia<"", {
|
|
114
|
+
decorator: {};
|
|
115
|
+
store: {};
|
|
116
|
+
derive: {};
|
|
117
|
+
resolve: {};
|
|
118
|
+
}, {
|
|
119
|
+
typebox: {};
|
|
120
|
+
error: {};
|
|
121
|
+
}, {
|
|
122
|
+
schema: {};
|
|
123
|
+
standaloneSchema: {};
|
|
124
|
+
macro: {};
|
|
125
|
+
macroFn: {};
|
|
126
|
+
parser: {};
|
|
127
|
+
response: {};
|
|
128
|
+
}, {}, {
|
|
129
|
+
derive: {};
|
|
130
|
+
resolve: {};
|
|
131
|
+
schema: {};
|
|
132
|
+
standaloneSchema: {};
|
|
133
|
+
response: {};
|
|
134
|
+
}, {
|
|
135
|
+
derive: {};
|
|
136
|
+
resolve: {};
|
|
137
|
+
schema: {};
|
|
138
|
+
standaloneSchema: {};
|
|
139
|
+
response: {};
|
|
140
|
+
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ export { buildVoiceOpsActionHistoryReport, createVoiceOpsActionAuditRoutes, reco
|
|
|
17
17
|
export { buildVoiceLiveOpsControlState, createVoiceLiveOpsController, createVoiceLiveOpsRoutes, createVoiceMemoryLiveOpsControlStore, getVoiceLiveOpsControlStatus, VOICE_LIVE_OPS_ACTIONS } from './liveOps';
|
|
18
18
|
export type { VoiceLiveOpsAction, VoiceLiveOpsActionInput, VoiceLiveOpsActionResult, VoiceLiveOpsControllerOptions, VoiceLiveOpsControlState, VoiceLiveOpsControlStatus, VoiceLiveOpsControlStore, VoiceLiveOpsRoutesOptions } from './liveOps';
|
|
19
19
|
export { buildVoiceDeliveryRuntimeReport, createVoiceDeliveryRuntime, createVoiceDeliveryRuntimePresetConfig, createVoiceDeliveryRuntimeRoutes, renderVoiceDeliveryRuntimeHTML } from './deliveryRuntime';
|
|
20
|
-
export { applyVoiceDataRetentionPolicy, buildVoiceDataRetentionPlan } from './dataControl';
|
|
21
|
-
export type { VoiceDataRetentionPolicy, VoiceDataRetentionReport, VoiceDataRetentionScope, VoiceDataRetentionScopeReport, VoiceDataRetentionStores } from './dataControl';
|
|
20
|
+
export { applyVoiceDataRetentionPolicy, buildVoiceDataControlReport, buildVoiceDataRetentionPlan, createVoiceDataControlRoutes, createVoiceZeroRetentionPolicy, renderVoiceDataControlHTML, renderVoiceDataControlMarkdown, voiceComplianceRedactionDefaults } from './dataControl';
|
|
21
|
+
export type { VoiceDataControlProviderKeySurface, VoiceDataControlReport, VoiceDataControlRoutesOptions, VoiceDataControlStorageSurface, VoiceDataRetentionPolicy, VoiceDataRetentionReport, VoiceDataRetentionScope, VoiceDataRetentionScopeReport, VoiceDataRetentionStores } from './dataControl';
|
|
22
22
|
export type { VoiceDemoReadyReport, VoiceDemoReadyRoutesOptions, VoiceDemoReadySection, VoiceDemoReadyStatus } from './demoReadyRoutes';
|
|
23
23
|
export type { VoiceDeliverySinkDescriptor, VoiceDeliverySinkDescriptorInput, VoiceDeliverySinkKind, VoiceDeliverySinkPairOptions, VoiceDeliverySinkReport, VoiceDeliverySinkRoutesOptions, VoiceTraceDeliverySinkSurface } from './deliverySinkRoutes';
|
|
24
24
|
export type { VoiceOpsActionAuditRecord, VoiceOpsActionAuditRoutesOptions, VoiceOpsActionHistoryEntry, VoiceOpsActionHistoryReport } from './opsActionAuditRoutes';
|
|
@@ -118,7 +118,7 @@ export type { StoredVoiceIncidentBundleArtifact, VoiceIncidentBundle, VoiceIncid
|
|
|
118
118
|
export type { VoiceQualityLink, VoiceQualityMetric, VoiceQualityReport, VoiceQualityRoutesOptions, VoiceQualityStatus, VoiceQualityThresholds } from './qualityRoutes';
|
|
119
119
|
export type { VoiceResilienceIOSimulator, VoiceResilienceLink, VoiceResiliencePageData, VoiceResilienceRoutesOptions, VoiceResilienceSimulationProvider, VoiceRoutingKindSummary, VoiceRoutingDecisionSummary, VoiceRoutingDecisionSummaryOptions, VoiceRoutingEvent, VoiceRoutingEventKind, VoiceRoutingSessionSummary, VoiceRoutingSessionSummaryOptions } from './resilienceRoutes';
|
|
120
120
|
export type { VoiceIOProviderRouterEvent, VoiceIOProviderRouterOptions, VoiceIOProviderRouterPolicy, VoiceIOProviderRouterPolicyConfig, VoiceSTTProviderRouterOptions, VoiceTTSProviderRouterOptions } from './providerAdapters';
|
|
121
|
-
export type { VoiceAgent, VoiceAgentMessage, VoiceAgentMessageRole, VoiceAgentModel, VoiceAgentModelInput, VoiceAgentModelOutput, VoiceAgentOptions, VoiceAgentRunResult, VoiceAgentSquadHandoffPolicyResult, VoiceAgentSquadHandoffStatus, VoiceAgentSquadOptions, VoiceAgentSquadState, VoiceAgentSquadStateHandoff, VoiceAgentTool, VoiceAgentToolCall, VoiceAgentToolResult } from './agent';
|
|
121
|
+
export type { VoiceAgent, VoiceAgentMessage, VoiceAgentMessageRole, VoiceAgentModel, VoiceAgentModelInput, VoiceAgentModelOutput, VoiceAgentOptions, VoiceAgentRunResult, VoiceAgentSquadContextPolicyResult, VoiceAgentSquadHandoffPolicyResult, VoiceAgentSquadHandoffStatus, VoiceAgentSquadOptions, VoiceAgentSquadState, VoiceAgentSquadStateHandoff, VoiceAgentTool, VoiceAgentToolCall, VoiceAgentToolResult } from './agent';
|
|
122
122
|
export type { VoiceAgentSquadContractDefinition, VoiceAgentSquadContractIssue, VoiceAgentSquadContractOutcome, VoiceAgentSquadContractReport, VoiceAgentSquadContractRunOptions, VoiceAgentSquadContractTurn, VoiceAgentSquadContractTurnReport, VoiceAgentSquadHandoffExpectation, VoiceAgentSquadTurnExpectation } from './agentSquadContract';
|
|
123
123
|
export type { VoiceToolRetryDelay, VoiceToolRuntime, VoiceToolRuntimeExecuteInput, VoiceToolRuntimeOptions, VoiceToolRuntimeResult } from './toolRuntime';
|
|
124
124
|
export type { VoiceToolContractCase, VoiceToolContractCaseReport, VoiceToolContractDefinition, VoiceToolContractExpectation, VoiceToolContractHandlerOptions, VoiceToolContractHTMLHandlerOptions, VoiceToolContractIssue, VoiceToolContractReport, VoiceToolContractRoutesOptions, VoiceToolContractSuiteReport } from './toolContract';
|