@absolutejs/voice 0.0.22-beta.45 → 0.0.22-beta.46
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/evalRoutes.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +164 -0
- package/dist/trace.d.ts +1 -1
- package/dist/workflowContract.d.ts +85 -0
- package/package.json +1 -1
package/dist/evalRoutes.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export type VoiceScenarioEvalDefinition = {
|
|
|
75
75
|
requiredLifecycleTypes?: string[];
|
|
76
76
|
requiredPayloadPaths?: string[];
|
|
77
77
|
requiredTranscriptIncludes?: string[];
|
|
78
|
+
requiredWorkflowContracts?: string[];
|
|
78
79
|
scenarioId?: string;
|
|
79
80
|
};
|
|
80
81
|
export type VoiceScenarioEvalSessionResult = {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { createVoiceAssistant, createVoiceExperiment, summarizeVoiceAssistantRun
|
|
|
3
3
|
export { createVoiceAssistantHealthHTMLHandler, createVoiceAssistantHealthJSONHandler, createVoiceAssistantHealthRoutes, renderVoiceAssistantHealthHTML, summarizeVoiceAssistantHealth } from './assistantHealth';
|
|
4
4
|
export { buildVoiceDiagnosticsMarkdown, createVoiceDiagnosticsRoutes, resolveVoiceDiagnosticsTraceFilter } from './diagnosticsRoutes';
|
|
5
5
|
export { compareVoiceEvalBaseline, createVoiceFileEvalBaselineStore, createVoiceFileScenarioFixtureStore, createVoiceEvalRoutes, renderVoiceEvalBaselineHTML, renderVoiceEvalHTML, renderVoiceScenarioEvalHTML, renderVoiceScenarioFixtureEvalHTML, runVoiceScenarioEvals, runVoiceScenarioFixtureEvals, runVoiceSessionEvals } from './evalRoutes';
|
|
6
|
+
export { createVoiceWorkflowContract, createVoiceWorkflowContractHandler, createVoiceWorkflowScenario, recordVoiceWorkflowContractTrace, validateVoiceWorkflowRouteResult } from './workflowContract';
|
|
6
7
|
export { createVoiceSessionListRoutes, createVoiceSessionReplayHTMLHandler, createVoiceSessionReplayJSONHandler, createVoiceSessionReplayRoutes, createVoiceSessionsHTMLHandler, createVoiceSessionsJSONHandler, renderVoiceSessionsHTML, summarizeVoiceSessions, summarizeVoiceSessionReplay } from './sessionReplay';
|
|
7
8
|
export { createVoiceAgent, createVoiceAgentSquad, createVoiceAgentTool } from './agent';
|
|
8
9
|
export { createStoredVoiceCallReviewArtifact, createStoredVoiceExternalObjectMap, createStoredVoiceIntegrationEvent, createStoredVoiceOpsTask, createVoiceFileExternalObjectMapStore, createVoiceFileAssistantMemoryStore, createVoiceFileIntegrationEventStore, createVoiceFileReviewStore, createVoiceFileRuntimeStorage, createVoiceFileSessionStore, createVoiceFileTaskStore, createVoiceFileTraceSinkDeliveryStore, createVoiceFileTraceEventStore } from './fileStore';
|
|
@@ -41,6 +42,7 @@ export type { VoiceAssistantHealthFailure, VoiceAssistantHealthHTMLHandlerOption
|
|
|
41
42
|
export type { VoiceAssistantMemoryBinding, VoiceAssistantMemoryHandle, VoiceAssistantMemoryOptions, VoiceAssistantMemoryRecord, VoiceAssistantMemoryStore } from './assistantMemory';
|
|
42
43
|
export type { VoiceDiagnosticsRoutesOptions } from './diagnosticsRoutes';
|
|
43
44
|
export type { VoiceEvalBaselineComparison, VoiceEvalBaselineComparisonOptions, VoiceEvalBaselineStore, VoiceEvalBaselineSummary, VoiceEvalLink, VoiceEvalReport, VoiceEvalRoutesOptions, VoiceEvalSessionReport, VoiceEvalStatus, VoiceEvalTrendBucket, VoiceScenarioEvalDefinition, VoiceScenarioEvalReport, VoiceScenarioEvalResult, VoiceScenarioEvalSessionResult, VoiceScenarioFixture, VoiceScenarioFixtureEvalReport, VoiceScenarioFixtureEvalResult, VoiceScenarioFixtureStore } from './evalRoutes';
|
|
45
|
+
export type { VoiceWorkflowContract, VoiceWorkflowContractDefinition, VoiceWorkflowContractField, VoiceWorkflowContractFieldMatch, VoiceWorkflowContractTracePayload, VoiceWorkflowContractValidation, VoiceWorkflowContractValidationIssue, VoiceWorkflowOutcome } from './workflowContract';
|
|
44
46
|
export type { VoiceSessionListHTMLHandlerOptions, VoiceSessionListItem, VoiceSessionListOptions, VoiceSessionListRoutesOptions, VoiceSessionListStatus, VoiceSessionReplay, VoiceSessionReplayHTMLHandlerOptions, VoiceSessionReplayOptions, VoiceSessionReplayRoutesOptions, VoiceSessionReplayTurn } from './sessionReplay';
|
|
45
47
|
export type { AnthropicVoiceAssistantModelOptions, GeminiVoiceAssistantModelOptions, OpenAIVoiceAssistantModelOptions, VoiceProviderRouterEvent, VoiceProviderRouterFallbackMode, VoiceProviderRouterHealthOptions, VoiceProviderRouterOptions, VoiceProviderRouterPolicy, VoiceProviderRouterProviderHealth, VoiceProviderRouterProviderProfile, VoiceJSONAssistantModelHandler, VoiceJSONAssistantModelOptions } from './modelAdapters';
|
|
46
48
|
export type { VoiceProviderHealthStatus, VoiceProviderHealthSummary, VoiceProviderHealthSummaryOptions } from './providerHealth';
|
package/dist/index.js
CHANGED
|
@@ -8078,6 +8078,7 @@ var evaluateScenarioSession = (scenario, sessionId, events) => {
|
|
|
8078
8078
|
const turnCount = events.filter((event) => event.type === "turn.committed").length;
|
|
8079
8079
|
const sessionErrorCount = events.filter((event) => event.type === "session.error").length;
|
|
8080
8080
|
const providerErrorCount = countProviderErrors(events);
|
|
8081
|
+
const workflowContractEvents = events.filter((event) => event.type === "workflow.contract");
|
|
8081
8082
|
for (const missing of includesAll(committedText, scenario.requiredTranscriptIncludes ?? [])) {
|
|
8082
8083
|
issues.push(`Missing transcript text: ${missing}`);
|
|
8083
8084
|
}
|
|
@@ -8121,6 +8122,16 @@ var evaluateScenarioSession = (scenario, sessionId, events) => {
|
|
|
8121
8122
|
issues.push(`Missing payload path: ${path}`);
|
|
8122
8123
|
}
|
|
8123
8124
|
}
|
|
8125
|
+
for (const contractId of scenario.requiredWorkflowContracts ?? []) {
|
|
8126
|
+
const matching = workflowContractEvents.filter((event) => getString6(event.payload.contractId) === contractId);
|
|
8127
|
+
if (matching.length === 0) {
|
|
8128
|
+
issues.push(`Missing workflow contract: ${contractId}`);
|
|
8129
|
+
continue;
|
|
8130
|
+
}
|
|
8131
|
+
if (matching.some((event) => getString6(event.payload.status) !== "pass")) {
|
|
8132
|
+
issues.push(`Workflow contract failed: ${contractId}`);
|
|
8133
|
+
}
|
|
8134
|
+
}
|
|
8124
8135
|
return {
|
|
8125
8136
|
eventCount: events.length,
|
|
8126
8137
|
issues,
|
|
@@ -8443,6 +8454,154 @@ var createVoiceEvalRoutes = (options) => {
|
|
|
8443
8454
|
});
|
|
8444
8455
|
return routes;
|
|
8445
8456
|
};
|
|
8457
|
+
// src/workflowContract.ts
|
|
8458
|
+
var getObject2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
8459
|
+
var getPathValue2 = (value, path) => {
|
|
8460
|
+
let current = value;
|
|
8461
|
+
for (const part of path.split(".").filter(Boolean)) {
|
|
8462
|
+
const record = getObject2(current);
|
|
8463
|
+
if (!record || !(part in record)) {
|
|
8464
|
+
return;
|
|
8465
|
+
}
|
|
8466
|
+
current = record[part];
|
|
8467
|
+
}
|
|
8468
|
+
return current;
|
|
8469
|
+
};
|
|
8470
|
+
var hasValue = (value, match) => {
|
|
8471
|
+
switch (match) {
|
|
8472
|
+
case "boolean":
|
|
8473
|
+
return typeof value === "boolean";
|
|
8474
|
+
case "number":
|
|
8475
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
8476
|
+
case "string":
|
|
8477
|
+
return typeof value === "string";
|
|
8478
|
+
case "truthy":
|
|
8479
|
+
return Boolean(value);
|
|
8480
|
+
case "non-empty":
|
|
8481
|
+
default:
|
|
8482
|
+
return Array.isArray(value) ? value.length > 0 : typeof value === "string" ? value.trim().length > 0 : value !== undefined && value !== null;
|
|
8483
|
+
}
|
|
8484
|
+
};
|
|
8485
|
+
var resolveOutcome2 = (routeResult) => {
|
|
8486
|
+
if (routeResult.complete)
|
|
8487
|
+
return "complete";
|
|
8488
|
+
if (routeResult.transfer)
|
|
8489
|
+
return "transfer";
|
|
8490
|
+
if (routeResult.escalate)
|
|
8491
|
+
return "escalate";
|
|
8492
|
+
if (routeResult.voicemail)
|
|
8493
|
+
return "voicemail";
|
|
8494
|
+
if (routeResult.noAnswer)
|
|
8495
|
+
return "no-answer";
|
|
8496
|
+
return;
|
|
8497
|
+
};
|
|
8498
|
+
var validateVoiceWorkflowRouteResult = (definition, routeResult) => {
|
|
8499
|
+
const issues = [];
|
|
8500
|
+
const requiredFields = (definition.fields ?? []).filter((field) => field.required !== false).map((field) => field.path);
|
|
8501
|
+
const missingFields = [];
|
|
8502
|
+
const outcome = resolveOutcome2(routeResult);
|
|
8503
|
+
if (definition.outcome && outcome !== definition.outcome) {
|
|
8504
|
+
issues.push({
|
|
8505
|
+
code: "workflow.outcome_mismatch",
|
|
8506
|
+
message: `Expected workflow outcome ${definition.outcome}, saw ${outcome ?? "none"}.`
|
|
8507
|
+
});
|
|
8508
|
+
}
|
|
8509
|
+
for (const field of definition.fields ?? []) {
|
|
8510
|
+
if (field.required === false)
|
|
8511
|
+
continue;
|
|
8512
|
+
const paths = [field.path, ...field.aliases ?? []];
|
|
8513
|
+
const present = paths.some((path) => hasValue(getPathValue2(routeResult.result, path), field.match ?? "non-empty"));
|
|
8514
|
+
if (!present) {
|
|
8515
|
+
missingFields.push(field.path);
|
|
8516
|
+
issues.push({
|
|
8517
|
+
code: "workflow.missing_field",
|
|
8518
|
+
field: field.path,
|
|
8519
|
+
message: `Missing required workflow field: ${field.label ?? field.path}.`
|
|
8520
|
+
});
|
|
8521
|
+
}
|
|
8522
|
+
}
|
|
8523
|
+
issues.push(...definition.validate?.({
|
|
8524
|
+
result: routeResult.result,
|
|
8525
|
+
routeResult
|
|
8526
|
+
}) ?? []);
|
|
8527
|
+
return {
|
|
8528
|
+
contractId: definition.id,
|
|
8529
|
+
issues,
|
|
8530
|
+
missingFields,
|
|
8531
|
+
outcome,
|
|
8532
|
+
pass: issues.length === 0,
|
|
8533
|
+
requiredFields
|
|
8534
|
+
};
|
|
8535
|
+
};
|
|
8536
|
+
var createVoiceWorkflowScenario = (definition, overrides = {}) => ({
|
|
8537
|
+
description: definition.description,
|
|
8538
|
+
forbiddenHandoffActions: definition.forbiddenHandoffActions,
|
|
8539
|
+
id: definition.id,
|
|
8540
|
+
label: definition.label,
|
|
8541
|
+
maxProviderErrors: definition.maxProviderErrors,
|
|
8542
|
+
maxSessionErrors: definition.maxSessionErrors,
|
|
8543
|
+
minSessions: definition.minSessions,
|
|
8544
|
+
minTurns: definition.minTurns,
|
|
8545
|
+
requiredAssistantIncludes: definition.requiredAssistantIncludes,
|
|
8546
|
+
requiredDisposition: definition.requiredDisposition,
|
|
8547
|
+
requiredHandoffActions: definition.requiredHandoffActions,
|
|
8548
|
+
requiredLifecycleTypes: definition.requiredLifecycleTypes,
|
|
8549
|
+
requiredTranscriptIncludes: definition.requiredTranscriptIncludes,
|
|
8550
|
+
requiredWorkflowContracts: [definition.id],
|
|
8551
|
+
scenarioId: definition.scenarioId,
|
|
8552
|
+
...overrides
|
|
8553
|
+
});
|
|
8554
|
+
var createVoiceWorkflowContract = (definition) => ({
|
|
8555
|
+
assertRouteResult: (routeResult) => {
|
|
8556
|
+
const validation = validateVoiceWorkflowRouteResult(definition, routeResult);
|
|
8557
|
+
if (!validation.pass) {
|
|
8558
|
+
throw new Error(`Voice workflow contract ${definition.id} failed: ${validation.issues.map((issue) => issue.message).join(" ")}`);
|
|
8559
|
+
}
|
|
8560
|
+
},
|
|
8561
|
+
definition,
|
|
8562
|
+
toScenarioEval: (overrides) => createVoiceWorkflowScenario(definition, overrides),
|
|
8563
|
+
validateRouteResult: (routeResult) => validateVoiceWorkflowRouteResult(definition, routeResult)
|
|
8564
|
+
});
|
|
8565
|
+
var recordVoiceWorkflowContractTrace = async (input) => input.store.append({
|
|
8566
|
+
at: input.at ?? Date.now(),
|
|
8567
|
+
payload: {
|
|
8568
|
+
contractId: input.contractId ?? input.validation.contractId,
|
|
8569
|
+
issues: input.validation.issues,
|
|
8570
|
+
missingFields: input.validation.missingFields,
|
|
8571
|
+
outcome: input.validation.outcome,
|
|
8572
|
+
requiredFields: input.validation.requiredFields,
|
|
8573
|
+
status: input.validation.pass ? "pass" : "fail"
|
|
8574
|
+
},
|
|
8575
|
+
scenarioId: input.scenarioId,
|
|
8576
|
+
sessionId: input.sessionId,
|
|
8577
|
+
traceId: input.traceId,
|
|
8578
|
+
turnId: input.turnId,
|
|
8579
|
+
type: "workflow.contract"
|
|
8580
|
+
});
|
|
8581
|
+
var createVoiceWorkflowContractHandler = (input) => {
|
|
8582
|
+
return async (session, turn, api, context) => {
|
|
8583
|
+
const legacyHandler = input.handler;
|
|
8584
|
+
const objectHandler = input.handler;
|
|
8585
|
+
const result = input.handler.length >= 4 ? await legacyHandler(session, turn, api, context) : await objectHandler({ api, context, session, turn });
|
|
8586
|
+
if (!result)
|
|
8587
|
+
return result;
|
|
8588
|
+
const resolved = input.resolveContract?.({ context, result, session, turn }) ?? input.contract;
|
|
8589
|
+
if (!resolved)
|
|
8590
|
+
return result;
|
|
8591
|
+
const contract = "validateRouteResult" in resolved ? resolved : createVoiceWorkflowContract(resolved);
|
|
8592
|
+
const validation = contract.validateRouteResult(result);
|
|
8593
|
+
if (input.store) {
|
|
8594
|
+
await recordVoiceWorkflowContractTrace({
|
|
8595
|
+
scenarioId: session.scenarioId,
|
|
8596
|
+
sessionId: session.id,
|
|
8597
|
+
store: input.store,
|
|
8598
|
+
turnId: turn.id,
|
|
8599
|
+
validation
|
|
8600
|
+
});
|
|
8601
|
+
}
|
|
8602
|
+
return result;
|
|
8603
|
+
};
|
|
8604
|
+
};
|
|
8446
8605
|
// src/sessionReplay.ts
|
|
8447
8606
|
import { Elysia as Elysia8 } from "elysia";
|
|
8448
8607
|
var getString7 = (value) => typeof value === "string" ? value : undefined;
|
|
@@ -13368,6 +13527,7 @@ export {
|
|
|
13368
13527
|
withVoiceIntegrationEventId,
|
|
13369
13528
|
voice,
|
|
13370
13529
|
verifyVoiceOpsWebhookSignature,
|
|
13530
|
+
validateVoiceWorkflowRouteResult,
|
|
13371
13531
|
transcodeTwilioInboundPayloadToPCM16,
|
|
13372
13532
|
transcodePCMToTwilioOutboundPayload,
|
|
13373
13533
|
summarizeVoiceTraceSinkDeliveries,
|
|
@@ -13421,6 +13581,7 @@ export {
|
|
|
13421
13581
|
redactVoiceTraceText,
|
|
13422
13582
|
redactVoiceTraceEvents,
|
|
13423
13583
|
redactVoiceTraceEvent,
|
|
13584
|
+
recordVoiceWorkflowContractTrace,
|
|
13424
13585
|
recordVoiceRuntimeOps,
|
|
13425
13586
|
pruneVoiceTraceEvents,
|
|
13426
13587
|
matchesVoiceOpsTaskAssignmentRule,
|
|
@@ -13446,6 +13607,9 @@ export {
|
|
|
13446
13607
|
createVoiceZendeskTicketUpdateSink,
|
|
13447
13608
|
createVoiceZendeskTicketSyncSinks,
|
|
13448
13609
|
createVoiceZendeskTicketSink,
|
|
13610
|
+
createVoiceWorkflowScenario,
|
|
13611
|
+
createVoiceWorkflowContractHandler,
|
|
13612
|
+
createVoiceWorkflowContract,
|
|
13449
13613
|
createVoiceWebhookHandoffAdapter,
|
|
13450
13614
|
createVoiceWebhookDeliveryWorkerLoop,
|
|
13451
13615
|
createVoiceWebhookDeliveryWorker,
|
package/dist/trace.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type VoiceTraceEventType = 'assistant.guardrail' | 'assistant.memory' | 'assistant.run' | 'agent.handoff' | 'agent.model' | 'agent.result' | 'agent.tool' | 'call.handoff' | 'call.lifecycle' | 'session.error' | 'turn.assistant' | 'turn.committed' | 'turn.cost' | 'turn.transcript';
|
|
1
|
+
export type VoiceTraceEventType = 'assistant.guardrail' | 'assistant.memory' | 'assistant.run' | 'agent.handoff' | 'agent.model' | 'agent.result' | 'agent.tool' | 'call.handoff' | 'call.lifecycle' | 'session.error' | 'turn.assistant' | 'turn.committed' | 'turn.cost' | 'turn.transcript' | 'workflow.contract';
|
|
2
2
|
export type VoiceTraceEvent<TPayload extends Record<string, unknown> = Record<string, unknown>> = {
|
|
3
3
|
at: number;
|
|
4
4
|
id?: string;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { VoiceScenarioEvalDefinition } from './evalRoutes';
|
|
2
|
+
import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from './trace';
|
|
3
|
+
import type { VoiceOnTurnHandler, VoiceRouteResult, VoiceSessionRecord, VoiceTurnRecord } from './types';
|
|
4
|
+
export type VoiceWorkflowOutcome = 'complete' | 'transfer' | 'escalate' | 'voicemail' | 'no-answer';
|
|
5
|
+
export type VoiceWorkflowContractFieldMatch = 'boolean' | 'non-empty' | 'number' | 'string' | 'truthy';
|
|
6
|
+
export type VoiceWorkflowContractField = {
|
|
7
|
+
aliases?: string[];
|
|
8
|
+
label?: string;
|
|
9
|
+
match?: VoiceWorkflowContractFieldMatch;
|
|
10
|
+
path: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type VoiceWorkflowContractDefinition<TResult = unknown> = {
|
|
14
|
+
description?: string;
|
|
15
|
+
fields?: VoiceWorkflowContractField[];
|
|
16
|
+
forbiddenHandoffActions?: string[];
|
|
17
|
+
id: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
maxProviderErrors?: number;
|
|
20
|
+
maxSessionErrors?: number;
|
|
21
|
+
minSessions?: number;
|
|
22
|
+
minTurns?: number;
|
|
23
|
+
outcome?: VoiceWorkflowOutcome;
|
|
24
|
+
requiredAssistantIncludes?: string[];
|
|
25
|
+
requiredDisposition?: string;
|
|
26
|
+
requiredHandoffActions?: string[];
|
|
27
|
+
requiredLifecycleTypes?: string[];
|
|
28
|
+
requiredTranscriptIncludes?: string[];
|
|
29
|
+
scenarioId?: string;
|
|
30
|
+
validate?: (input: {
|
|
31
|
+
result: TResult | undefined;
|
|
32
|
+
routeResult: VoiceRouteResult<TResult>;
|
|
33
|
+
}) => VoiceWorkflowContractValidationIssue[];
|
|
34
|
+
};
|
|
35
|
+
export type VoiceWorkflowContractValidationIssue = {
|
|
36
|
+
code: string;
|
|
37
|
+
field?: string;
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
export type VoiceWorkflowContractValidation = {
|
|
41
|
+
contractId: string;
|
|
42
|
+
issues: VoiceWorkflowContractValidationIssue[];
|
|
43
|
+
missingFields: string[];
|
|
44
|
+
outcome?: VoiceWorkflowOutcome;
|
|
45
|
+
pass: boolean;
|
|
46
|
+
requiredFields: string[];
|
|
47
|
+
};
|
|
48
|
+
export type VoiceWorkflowContract<TResult = unknown> = {
|
|
49
|
+
assertRouteResult: (routeResult: VoiceRouteResult<TResult>) => void;
|
|
50
|
+
definition: VoiceWorkflowContractDefinition<TResult>;
|
|
51
|
+
toScenarioEval: (overrides?: Partial<VoiceScenarioEvalDefinition>) => VoiceScenarioEvalDefinition;
|
|
52
|
+
validateRouteResult: (routeResult: VoiceRouteResult<TResult>) => VoiceWorkflowContractValidation;
|
|
53
|
+
};
|
|
54
|
+
export type VoiceWorkflowContractTracePayload = {
|
|
55
|
+
contractId: string;
|
|
56
|
+
issues: VoiceWorkflowContractValidationIssue[];
|
|
57
|
+
missingFields: string[];
|
|
58
|
+
outcome?: VoiceWorkflowOutcome;
|
|
59
|
+
requiredFields: string[];
|
|
60
|
+
status: 'pass' | 'fail';
|
|
61
|
+
};
|
|
62
|
+
export declare const validateVoiceWorkflowRouteResult: <TResult = unknown>(definition: VoiceWorkflowContractDefinition<TResult>, routeResult: VoiceRouteResult<TResult>) => VoiceWorkflowContractValidation;
|
|
63
|
+
export declare const createVoiceWorkflowScenario: <TResult = unknown>(definition: VoiceWorkflowContractDefinition<TResult>, overrides?: Partial<VoiceScenarioEvalDefinition>) => VoiceScenarioEvalDefinition;
|
|
64
|
+
export declare const createVoiceWorkflowContract: <TResult = unknown>(definition: VoiceWorkflowContractDefinition<TResult>) => VoiceWorkflowContract<TResult>;
|
|
65
|
+
export declare const recordVoiceWorkflowContractTrace: (input: {
|
|
66
|
+
at?: number;
|
|
67
|
+
contractId?: string;
|
|
68
|
+
scenarioId?: string;
|
|
69
|
+
sessionId: string;
|
|
70
|
+
store: VoiceTraceEventStore;
|
|
71
|
+
traceId?: string;
|
|
72
|
+
turnId?: string;
|
|
73
|
+
validation: VoiceWorkflowContractValidation;
|
|
74
|
+
}) => Promise<StoredVoiceTraceEvent<VoiceWorkflowContractTracePayload>>;
|
|
75
|
+
export declare const createVoiceWorkflowContractHandler: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(input: {
|
|
76
|
+
contract?: VoiceWorkflowContract<TResult> | VoiceWorkflowContractDefinition<TResult>;
|
|
77
|
+
handler: VoiceOnTurnHandler<TContext, TSession, TResult>;
|
|
78
|
+
resolveContract?: (args: {
|
|
79
|
+
context: TContext;
|
|
80
|
+
result: VoiceRouteResult<TResult>;
|
|
81
|
+
session: TSession;
|
|
82
|
+
turn: VoiceTurnRecord;
|
|
83
|
+
}) => VoiceWorkflowContract<TResult> | VoiceWorkflowContractDefinition<TResult> | undefined;
|
|
84
|
+
store?: VoiceTraceEventStore;
|
|
85
|
+
}) => VoiceOnTurnHandler<TContext, TSession, TResult>;
|