@absolutejs/voice 0.0.22-beta.255 → 0.0.22-beta.257
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 +6 -6
- package/dist/index.js +216 -0
- package/dist/outcomeContract.d.ts +31 -0
- package/dist/simulationSuite.d.ts +22 -0
- package/dist/toolContract.d.ts +28 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -28,18 +28,18 @@ export type { VoiceDeliverySinkDescriptor, VoiceDeliverySinkDescriptorInput, Voi
|
|
|
28
28
|
export type { VoiceOpsActionAuditRecord, VoiceOpsActionAuditRoutesOptions, VoiceOpsActionHistoryEntry, VoiceOpsActionHistoryReport } from './opsActionAuditRoutes';
|
|
29
29
|
export type { VoiceDeliveryRuntime, VoiceDeliveryRuntimeAuditConfig, VoiceDeliveryRuntimeConfig, VoiceDeliveryRuntimeFilePresetOptions, VoiceDeliveryRuntimePresetLeaseConfig, VoiceDeliveryRuntimePresetMode, VoiceDeliveryRuntimePresetOptions, VoiceDeliveryRuntimeReport, VoiceDeliveryRuntimeRoutesOptions, VoiceDeliveryRuntimeS3PresetOptions, VoiceDeliveryRuntimeSummary, VoiceDeliveryRuntimeTickResult, VoiceDeliveryRuntimeTraceConfig, VoiceDeliveryRuntimeWebhookPresetOptions } from './deliveryRuntime';
|
|
30
30
|
export { compareVoiceEvalBaseline, createVoiceFileEvalBaselineStore, createVoiceFileScenarioFixtureStore, createVoiceEvalRoutes, renderVoiceEvalBaselineHTML, renderVoiceEvalHTML, renderVoiceScenarioEvalHTML, renderVoiceScenarioFixtureEvalHTML, runVoiceScenarioEvals, runVoiceScenarioFixtureEvals, runVoiceSessionEvals } from './evalRoutes';
|
|
31
|
-
export { createVoiceSimulationSuiteRoutes, renderVoiceSimulationSuiteHTML, runVoiceSimulationSuite } from './simulationSuite';
|
|
31
|
+
export { assertVoiceSimulationSuiteEvidence, createVoiceSimulationSuiteRoutes, evaluateVoiceSimulationSuiteEvidence, renderVoiceSimulationSuiteHTML, runVoiceSimulationSuite } from './simulationSuite';
|
|
32
32
|
export { createVoiceWorkflowContract, createVoiceWorkflowContractHandler, createVoiceWorkflowContractPreset, createVoiceWorkflowScenario, recordVoiceWorkflowContractTrace, validateVoiceWorkflowRouteResult } from './workflowContract';
|
|
33
33
|
export { createVoiceSessionListRoutes, createVoiceSessionReplayHTMLHandler, createVoiceSessionReplayJSONHandler, createVoiceSessionReplayRoutes, createVoiceSessionsHTMLHandler, createVoiceSessionsJSONHandler, renderVoiceSessionsHTML, summarizeVoiceProviderFallbackRecovery, summarizeVoiceSessions, summarizeVoiceSessionReplay } from './sessionReplay';
|
|
34
34
|
export { createVoiceAgent, createVoiceAgentSquad, createVoiceAgentTool } from './agent';
|
|
35
35
|
export { assertVoiceAgentSquadContractEvidence, assertVoiceAgentSquadContract, evaluateVoiceAgentSquadContractEvidence, runVoiceAgentSquadContract } from './agentSquadContract';
|
|
36
36
|
export { createVoiceToolIdempotencyKey, createVoiceToolRuntime } from './toolRuntime';
|
|
37
|
-
export { createVoiceToolContract, createVoiceToolContractHTMLHandler, createVoiceToolContractJSONHandler, createVoiceToolContractRoutes, createVoiceToolRuntimeContractDefaults, renderVoiceToolContractHTML, runVoiceToolContractSuite, runVoiceToolContract } from './toolContract';
|
|
37
|
+
export { assertVoiceToolContractEvidence, createVoiceToolContract, createVoiceToolContractHTMLHandler, createVoiceToolContractJSONHandler, createVoiceToolContractRoutes, createVoiceToolRuntimeContractDefaults, evaluateVoiceToolContractEvidence, renderVoiceToolContractHTML, runVoiceToolContractSuite, runVoiceToolContract } from './toolContract';
|
|
38
38
|
export { createVoiceTurnLatencyHTMLHandler, createVoiceTurnLatencyJSONHandler, createVoiceTurnLatencyRoutes, renderVoiceTurnLatencyHTML, summarizeVoiceTurnLatency } from './turnLatency';
|
|
39
39
|
export { createVoiceLiveLatencyRoutes, renderVoiceLiveLatencyHTML, summarizeVoiceLiveLatency } from './liveLatency';
|
|
40
40
|
export { assertVoiceLatencySLOGate, buildVoiceLatencySLOGate, renderVoiceLatencySLOMarkdown } from './latencySlo';
|
|
41
41
|
export { createVoiceTurnQualityHTMLHandler, createVoiceTurnQualityJSONHandler, createVoiceTurnQualityRoutes, renderVoiceTurnQualityHTML, summarizeVoiceTurnQuality } from './turnQuality';
|
|
42
|
-
export { createVoiceOutcomeContractHTMLHandler, createVoiceOutcomeContractJSONHandler, createVoiceOutcomeContractRoutes, renderVoiceOutcomeContractHTML, runVoiceOutcomeContractSuite } from './outcomeContract';
|
|
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
44
|
export { createVoicePhoneAgent } from './phoneAgent';
|
|
45
45
|
export { createStoredVoiceCallReviewArtifact, createStoredVoiceExternalObjectMap, createStoredVoiceIntegrationEvent, createStoredVoiceOpsTask, createVoiceFileIncidentBundleStore, createVoiceFileExternalObjectMapStore, createVoiceFileAssistantMemoryStore, createVoiceFileAuditEventStore, createVoiceFileAuditSinkDeliveryStore, createVoiceFileCampaignStore, createVoiceFileIntegrationEventStore, createVoiceFileReviewStore, createVoiceFileRuntimeStorage, createVoiceFileSessionStore, createVoiceFileTaskStore, createVoiceFileTraceSinkDeliveryStore, createVoiceFileTraceEventStore } from './fileStore';
|
|
@@ -100,7 +100,7 @@ export type { VoiceAssistantHealthFailure, VoiceAssistantHealthHTMLHandlerOption
|
|
|
100
100
|
export type { VoiceAssistantMemoryBinding, VoiceAssistantMemoryHandle, VoiceAssistantMemoryOptions, VoiceAssistantMemoryRecord, VoiceAssistantMemoryStore } from './assistantMemory';
|
|
101
101
|
export type { VoiceDiagnosticsRoutesOptions } from './diagnosticsRoutes';
|
|
102
102
|
export type { VoiceEvalBaselineComparison, VoiceEvalBaselineComparisonOptions, VoiceEvalBaselineStore, VoiceEvalBaselineSummary, VoiceEvalLink, VoiceEvalReport, VoiceEvalRoutesOptions, VoiceEvalSessionReport, VoiceEvalStatus, VoiceEvalTrendBucket, VoiceScenarioEvalDefinition, VoiceScenarioEvalReport, VoiceScenarioEvalResult, VoiceScenarioEvalSessionResult, VoiceScenarioFixture, VoiceScenarioFixtureEvalReport, VoiceScenarioFixtureEvalResult, VoiceScenarioFixtureStore } from './evalRoutes';
|
|
103
|
-
export type { VoiceSimulationSuiteEvalRoutesOptions, VoiceSimulationSuiteOptions, VoiceSimulationSuiteReport, VoiceSimulationSuiteRoutesOptions, VoiceSimulationSuiteSectionSummary, VoiceSimulationSuiteStatus } from './simulationSuite';
|
|
103
|
+
export type { VoiceSimulationSuiteAssertionInput, VoiceSimulationSuiteAssertionReport, VoiceSimulationSuiteEvalRoutesOptions, VoiceSimulationSuiteOptions, VoiceSimulationSuiteReport, VoiceSimulationSuiteRoutesOptions, VoiceSimulationSuiteSection, VoiceSimulationSuiteSectionSummary, VoiceSimulationSuiteStatus } from './simulationSuite';
|
|
104
104
|
export type { VoiceWorkflowContract, VoiceWorkflowContractDefinition, VoiceWorkflowContractField, VoiceWorkflowContractFieldMatch, VoiceWorkflowContractPresetName, VoiceWorkflowContractPresetOptions, VoiceWorkflowContractTracePayload, VoiceWorkflowContractValidation, VoiceWorkflowContractValidationIssue, VoiceWorkflowOutcome } from './workflowContract';
|
|
105
105
|
export type { VoiceSessionListHTMLHandlerOptions, VoiceSessionListItem, VoiceSessionListOptions, VoiceSessionListRoutesOptions, VoiceSessionListStatus, VoiceProviderFallbackRecoverySummary, VoiceSessionReplay, VoiceSessionReplayHTMLHandlerOptions, VoiceSessionReplayOptions, VoiceSessionReplayRoutesOptions, VoiceSessionReplayTurn } from './sessionReplay';
|
|
106
106
|
export type { AnthropicVoiceAssistantModelOptions, GeminiVoiceAssistantModelOptions, OpenAIVoiceAssistantModelOptions, VoiceProviderRouterEvent, VoiceProviderRouterFallbackMode, VoiceProviderRouterHealthOptions, VoiceProviderRouterOptions, VoiceProviderRouterPolicy, VoiceProviderRouterPolicyPreset, VoiceProviderRouterPolicyWeights, VoiceProviderRouterProviderHealth, VoiceProviderRouterProviderProfile, VoiceProviderRouterStrategy, VoiceJSONAssistantModelHandler, VoiceJSONAssistantModelOptions } from './modelAdapters';
|
|
@@ -114,7 +114,7 @@ export type { VoiceTurnLatencyHTMLHandlerOptions, VoiceTurnLatencyItem, VoiceTur
|
|
|
114
114
|
export type { VoiceLiveLatencyOptions, VoiceLiveLatencyReport, VoiceLiveLatencyRoutesOptions, VoiceLiveLatencySample, VoiceLiveLatencyStatus } from './liveLatency';
|
|
115
115
|
export type { VoiceLatencySLOBudget, VoiceLatencySLOGateError, VoiceLatencySLOGateOptions, VoiceLatencySLOGateReport, VoiceLatencySLOMeasurement, VoiceLatencySLOStage, VoiceLatencySLOStageSummary, VoiceLatencySLOStatus } from './latencySlo';
|
|
116
116
|
export type { VoiceTurnQualityHTMLHandlerOptions, VoiceTurnQualityItem, VoiceTurnQualityOptions, VoiceTurnQualityReport, VoiceTurnQualityRoutesOptions, VoiceTurnQualityStatus } from './turnQuality';
|
|
117
|
-
export type { VoiceOutcomeContractDefinition, VoiceOutcomeContractHTMLHandlerOptions, VoiceOutcomeContractIssue, VoiceOutcomeContractOptions, VoiceOutcomeContractReport, VoiceOutcomeContractRoutesOptions, VoiceOutcomeContractStatus, VoiceOutcomeContractSuiteReport } from './outcomeContract';
|
|
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
119
|
export type { VoicePhoneAgentCarrier, VoicePhoneAgentCarrierSummary, VoicePhoneAgentLifecycleStage, VoicePhoneAgentPlivoCarrier, VoicePhoneAgentRoutes, VoicePhoneAgentRoutesOptions, VoicePhoneAgentSetupReport, VoicePhoneAgentTelnyxCarrier, VoicePhoneAgentTwilioCarrier } from './phoneAgent';
|
|
120
120
|
export type { VoicePhoneAgentProductionSmokeIssue, VoicePhoneAgentProductionSmokeHandlerOptions, VoicePhoneAgentProductionSmokeHTMLHandlerOptions, VoicePhoneAgentProductionSmokeOptions, VoicePhoneAgentProductionSmokeReport, VoicePhoneAgentProductionSmokeRoutesOptions, VoicePhoneAgentProductionSmokeRequirement } from './phoneAgentProductionSmoke';
|
|
@@ -133,7 +133,7 @@ export type { VoiceIOProviderRouterEvent, VoiceIOProviderRouterOptions, VoiceIOP
|
|
|
133
133
|
export type { VoiceAgent, VoiceAgentMessage, VoiceAgentMessageRole, VoiceAgentModel, VoiceAgentModelInput, VoiceAgentModelOutput, VoiceAgentOptions, VoiceAgentRunResult, VoiceAgentSquadContextPolicyResult, VoiceAgentSquadHandoffPolicyResult, VoiceAgentSquadHandoffStatus, VoiceAgentSquadOptions, VoiceAgentSquadState, VoiceAgentSquadStateHandoff, VoiceAgentTool, VoiceAgentToolCall, VoiceAgentToolResult } from './agent';
|
|
134
134
|
export type { VoiceAgentSquadContractAssertionInput, VoiceAgentSquadContractAssertionReport, VoiceAgentSquadContractDefinition, VoiceAgentSquadContractIssue, VoiceAgentSquadContractOutcome, VoiceAgentSquadContractReport, VoiceAgentSquadContractRunOptions, VoiceAgentSquadContractTurn, VoiceAgentSquadContractTurnReport, VoiceAgentSquadHandoffExpectation, VoiceAgentSquadTurnExpectation } from './agentSquadContract';
|
|
135
135
|
export type { VoiceToolRetryDelay, VoiceToolRuntime, VoiceToolRuntimeExecuteInput, VoiceToolRuntimeOptions, VoiceToolRuntimeResult } from './toolRuntime';
|
|
136
|
-
export type { VoiceToolContractCase, VoiceToolContractCaseReport, VoiceToolContractDefinition, VoiceToolContractExpectation, VoiceToolContractHandlerOptions, VoiceToolContractHTMLHandlerOptions, VoiceToolContractIssue, VoiceToolContractReport, VoiceToolContractRoutesOptions, VoiceToolContractSuiteReport } from './toolContract';
|
|
136
|
+
export type { VoiceToolContractAssertionInput, VoiceToolContractAssertionReport, VoiceToolContractCase, VoiceToolContractCaseReport, VoiceToolContractDefinition, VoiceToolContractExpectation, VoiceToolContractHandlerOptions, VoiceToolContractHTMLHandlerOptions, VoiceToolContractIssue, VoiceToolContractReport, VoiceToolContractRoutesOptions, VoiceToolContractSuiteReport } from './toolContract';
|
|
137
137
|
export type { VoiceOpsRuntime, VoiceOpsRuntimeConfig, VoiceOpsRuntimeSummary, VoiceOpsRuntimeSinkWorkerConfig, VoiceOpsRuntimeTaskWorkerConfig, VoiceOpsRuntimeTickResult, VoiceOpsRuntimeWebhookWorkerConfig } from './opsRuntime';
|
|
138
138
|
export type { VoiceOpsPresetName, VoiceOpsPresetOverrides, VoiceResolvedOpsPreset } from './opsPresets';
|
|
139
139
|
export type { VoiceOutcomeRecipe, VoiceOutcomeRecipeName, VoiceOutcomeRecipeOptions } from './outcomeRecipes';
|
package/dist/index.js
CHANGED
|
@@ -14476,6 +14476,89 @@ var runVoiceOutcomeContractSuite = async (options) => {
|
|
|
14476
14476
|
total: contracts.length
|
|
14477
14477
|
};
|
|
14478
14478
|
};
|
|
14479
|
+
var evaluateVoiceOutcomeContractEvidence = (report, input = {}) => {
|
|
14480
|
+
const issues = [];
|
|
14481
|
+
const maxFailed = input.maxFailed ?? 0;
|
|
14482
|
+
const maxIssues = input.maxIssues ?? 0;
|
|
14483
|
+
const contractIds = [
|
|
14484
|
+
...new Set(report.contracts.map((contract) => contract.contractId))
|
|
14485
|
+
].sort();
|
|
14486
|
+
const issueCount = report.contracts.reduce((total, contract) => total + contract.issues.length, 0);
|
|
14487
|
+
const totals = report.contracts.reduce((result, contract) => ({
|
|
14488
|
+
handoffs: result.handoffs + contract.matched.handoffs,
|
|
14489
|
+
integrationEvents: result.integrationEvents + contract.matched.integrationEvents,
|
|
14490
|
+
operationsRecordHrefs: result.operationsRecordHrefs + contract.operationsRecordHrefs.length,
|
|
14491
|
+
reviews: result.reviews + contract.matched.reviews,
|
|
14492
|
+
sessions: result.sessions + contract.matched.sessions,
|
|
14493
|
+
tasks: result.tasks + contract.matched.tasks
|
|
14494
|
+
}), {
|
|
14495
|
+
handoffs: 0,
|
|
14496
|
+
integrationEvents: 0,
|
|
14497
|
+
operationsRecordHrefs: 0,
|
|
14498
|
+
reviews: 0,
|
|
14499
|
+
sessions: 0,
|
|
14500
|
+
tasks: 0
|
|
14501
|
+
});
|
|
14502
|
+
const contractsMissingOperationRecordHrefs = report.contracts.filter((contract) => contract.operationsRecordHrefs.length === 0).length;
|
|
14503
|
+
if (input.minContracts !== undefined && report.total < input.minContracts) {
|
|
14504
|
+
issues.push(`Expected at least ${String(input.minContracts)} outcome contract(s), found ${String(report.total)}.`);
|
|
14505
|
+
}
|
|
14506
|
+
if (report.failed > maxFailed) {
|
|
14507
|
+
issues.push(`Expected at most ${String(maxFailed)} failing outcome contract(s), found ${String(report.failed)}.`);
|
|
14508
|
+
}
|
|
14509
|
+
if (issueCount > maxIssues) {
|
|
14510
|
+
issues.push(`Expected at most ${String(maxIssues)} outcome contract issue(s), found ${String(issueCount)}.`);
|
|
14511
|
+
}
|
|
14512
|
+
if (input.minSessions !== undefined && totals.sessions < input.minSessions) {
|
|
14513
|
+
issues.push(`Expected at least ${String(input.minSessions)} matched outcome session(s), found ${String(totals.sessions)}.`);
|
|
14514
|
+
}
|
|
14515
|
+
if (input.minReviews !== undefined && totals.reviews < input.minReviews) {
|
|
14516
|
+
issues.push(`Expected at least ${String(input.minReviews)} matched outcome review(s), found ${String(totals.reviews)}.`);
|
|
14517
|
+
}
|
|
14518
|
+
if (input.minTasks !== undefined && totals.tasks < input.minTasks) {
|
|
14519
|
+
issues.push(`Expected at least ${String(input.minTasks)} matched outcome task(s), found ${String(totals.tasks)}.`);
|
|
14520
|
+
}
|
|
14521
|
+
if (input.minHandoffs !== undefined && totals.handoffs < input.minHandoffs) {
|
|
14522
|
+
issues.push(`Expected at least ${String(input.minHandoffs)} matched outcome handoff(s), found ${String(totals.handoffs)}.`);
|
|
14523
|
+
}
|
|
14524
|
+
if (input.minIntegrationEvents !== undefined && totals.integrationEvents < input.minIntegrationEvents) {
|
|
14525
|
+
issues.push(`Expected at least ${String(input.minIntegrationEvents)} matched outcome integration event(s), found ${String(totals.integrationEvents)}.`);
|
|
14526
|
+
}
|
|
14527
|
+
if (input.minOperationsRecordHrefs !== undefined && totals.operationsRecordHrefs < input.minOperationsRecordHrefs) {
|
|
14528
|
+
issues.push(`Expected at least ${String(input.minOperationsRecordHrefs)} outcome operations record href(s), found ${String(totals.operationsRecordHrefs)}.`);
|
|
14529
|
+
}
|
|
14530
|
+
if ((input.requireOperationRecordHrefs ?? false) && contractsMissingOperationRecordHrefs > 0) {
|
|
14531
|
+
issues.push(`Expected every outcome contract to include operations record hrefs; ${String(contractsMissingOperationRecordHrefs)} contract(s) missing.`);
|
|
14532
|
+
}
|
|
14533
|
+
for (const contractId of input.requiredContractIds ?? []) {
|
|
14534
|
+
if (!contractIds.includes(contractId)) {
|
|
14535
|
+
issues.push(`Missing outcome contract: ${contractId}.`);
|
|
14536
|
+
}
|
|
14537
|
+
}
|
|
14538
|
+
return {
|
|
14539
|
+
contractIds,
|
|
14540
|
+
failed: report.failed,
|
|
14541
|
+
handoffs: totals.handoffs,
|
|
14542
|
+
integrationEvents: totals.integrationEvents,
|
|
14543
|
+
issues,
|
|
14544
|
+
issueCount,
|
|
14545
|
+
ok: issues.length === 0,
|
|
14546
|
+
operationsRecordHrefs: totals.operationsRecordHrefs,
|
|
14547
|
+
passed: report.passed,
|
|
14548
|
+
reviews: totals.reviews,
|
|
14549
|
+
sessions: totals.sessions,
|
|
14550
|
+
status: report.status,
|
|
14551
|
+
tasks: totals.tasks,
|
|
14552
|
+
total: report.total
|
|
14553
|
+
};
|
|
14554
|
+
};
|
|
14555
|
+
var assertVoiceOutcomeContractEvidence = (report, input = {}) => {
|
|
14556
|
+
const assertion = evaluateVoiceOutcomeContractEvidence(report, input);
|
|
14557
|
+
if (!assertion.ok) {
|
|
14558
|
+
throw new Error(`Voice outcome contract evidence assertion failed: ${assertion.issues.join(" ")}`);
|
|
14559
|
+
}
|
|
14560
|
+
return assertion;
|
|
14561
|
+
};
|
|
14479
14562
|
var renderVoiceOutcomeContractHTML = (report, options = {}) => {
|
|
14480
14563
|
const title = options.title ?? "Voice Outcome Contracts";
|
|
14481
14564
|
const contracts = report.contracts.map((contract) => {
|
|
@@ -14910,6 +14993,78 @@ var runVoiceToolContractSuite = async (options) => {
|
|
|
14910
14993
|
total: contracts.length
|
|
14911
14994
|
};
|
|
14912
14995
|
};
|
|
14996
|
+
var evaluateVoiceToolContractEvidence = (report, input = {}) => {
|
|
14997
|
+
const issues = [];
|
|
14998
|
+
const maxFailed = input.maxFailed ?? 0;
|
|
14999
|
+
const maxIssues = input.maxIssues ?? 0;
|
|
15000
|
+
const maxTimedOut = input.maxTimedOut ?? Infinity;
|
|
15001
|
+
const cases = report.contracts.flatMap((contract) => contract.cases);
|
|
15002
|
+
const contractIds = [
|
|
15003
|
+
...new Set(report.contracts.map((contract) => contract.contractId))
|
|
15004
|
+
].sort();
|
|
15005
|
+
const toolNames = [
|
|
15006
|
+
...new Set(report.contracts.map((contract) => contract.toolName))
|
|
15007
|
+
].sort();
|
|
15008
|
+
const caseStatuses = [...new Set(cases.map((testCase) => testCase.status))].sort();
|
|
15009
|
+
const issueCount = report.contracts.reduce((total, contract) => total + contract.issues.length, 0);
|
|
15010
|
+
const timedOut = cases.filter((testCase) => testCase.timedOut).length;
|
|
15011
|
+
const missingOperationsRecordHrefs = cases.filter((testCase) => !testCase.operationsRecordHref).length;
|
|
15012
|
+
if (input.minContracts !== undefined && report.total < input.minContracts) {
|
|
15013
|
+
issues.push(`Expected at least ${String(input.minContracts)} tool contract(s), found ${String(report.total)}.`);
|
|
15014
|
+
}
|
|
15015
|
+
if (input.minCases !== undefined && cases.length < input.minCases) {
|
|
15016
|
+
issues.push(`Expected at least ${String(input.minCases)} tool contract case(s), found ${String(cases.length)}.`);
|
|
15017
|
+
}
|
|
15018
|
+
if (report.failed > maxFailed) {
|
|
15019
|
+
issues.push(`Expected at most ${String(maxFailed)} failing tool contract(s), found ${String(report.failed)}.`);
|
|
15020
|
+
}
|
|
15021
|
+
if (issueCount > maxIssues) {
|
|
15022
|
+
issues.push(`Expected at most ${String(maxIssues)} tool contract issue(s), found ${String(issueCount)}.`);
|
|
15023
|
+
}
|
|
15024
|
+
if (timedOut > maxTimedOut) {
|
|
15025
|
+
issues.push(`Expected at most ${String(maxTimedOut)} timed out tool contract case(s), found ${String(timedOut)}.`);
|
|
15026
|
+
}
|
|
15027
|
+
if ((input.requireOperationRecordHrefs ?? false) && missingOperationsRecordHrefs > 0) {
|
|
15028
|
+
issues.push(`Expected every tool contract case to include an operations record href; ${String(missingOperationsRecordHrefs)} missing.`);
|
|
15029
|
+
}
|
|
15030
|
+
for (const contractId of input.requiredContractIds ?? []) {
|
|
15031
|
+
if (!contractIds.includes(contractId)) {
|
|
15032
|
+
issues.push(`Missing tool contract: ${contractId}.`);
|
|
15033
|
+
}
|
|
15034
|
+
}
|
|
15035
|
+
for (const toolName of input.requiredToolNames ?? []) {
|
|
15036
|
+
if (!toolNames.includes(toolName)) {
|
|
15037
|
+
issues.push(`Missing tool contract tool: ${toolName}.`);
|
|
15038
|
+
}
|
|
15039
|
+
}
|
|
15040
|
+
for (const status of input.requiredCaseStatuses ?? []) {
|
|
15041
|
+
if (!caseStatuses.includes(status)) {
|
|
15042
|
+
issues.push(`Missing tool contract case status: ${status}.`);
|
|
15043
|
+
}
|
|
15044
|
+
}
|
|
15045
|
+
return {
|
|
15046
|
+
caseStatuses,
|
|
15047
|
+
cases: cases.length,
|
|
15048
|
+
contractIds,
|
|
15049
|
+
failed: report.failed,
|
|
15050
|
+
issues,
|
|
15051
|
+
issueCount,
|
|
15052
|
+
missingOperationsRecordHrefs,
|
|
15053
|
+
ok: issues.length === 0,
|
|
15054
|
+
passed: report.passed,
|
|
15055
|
+
status: report.status,
|
|
15056
|
+
timedOut,
|
|
15057
|
+
toolNames,
|
|
15058
|
+
total: report.total
|
|
15059
|
+
};
|
|
15060
|
+
};
|
|
15061
|
+
var assertVoiceToolContractEvidence = (report, input = {}) => {
|
|
15062
|
+
const assertion = evaluateVoiceToolContractEvidence(report, input);
|
|
15063
|
+
if (!assertion.ok) {
|
|
15064
|
+
throw new Error(`Voice tool contract evidence assertion failed: ${assertion.issues.join(" ")}`);
|
|
15065
|
+
}
|
|
15066
|
+
return assertion;
|
|
15067
|
+
};
|
|
14913
15068
|
var renderVoiceToolContractHTML = (report, options = {}) => {
|
|
14914
15069
|
const title = options.title ?? "Voice Tool Contracts";
|
|
14915
15070
|
const snippet = escapeHtml22(`app.use(
|
|
@@ -15125,6 +15280,61 @@ var runVoiceSimulationSuite = async (options) => {
|
|
|
15125
15280
|
total: sections.length
|
|
15126
15281
|
};
|
|
15127
15282
|
};
|
|
15283
|
+
var simulationSectionNames = [
|
|
15284
|
+
"fixtures",
|
|
15285
|
+
"outcomes",
|
|
15286
|
+
"scenarios",
|
|
15287
|
+
"sessions",
|
|
15288
|
+
"tools"
|
|
15289
|
+
];
|
|
15290
|
+
var evaluateVoiceSimulationSuiteEvidence = (report, input = {}) => {
|
|
15291
|
+
const issues = [];
|
|
15292
|
+
const maxFailed = input.maxFailed ?? 0;
|
|
15293
|
+
const maxActions = input.maxActions ?? 0;
|
|
15294
|
+
const sections = simulationSectionNames.filter((section) => report.summary[section] !== undefined);
|
|
15295
|
+
const sectionTotals = Object.fromEntries(sections.map((section) => [section, report.summary[section]?.total ?? 0]));
|
|
15296
|
+
if (report.failed > maxFailed) {
|
|
15297
|
+
issues.push(`Expected at most ${String(maxFailed)} failing simulation section(s), found ${String(report.failed)}.`);
|
|
15298
|
+
}
|
|
15299
|
+
if (report.actions.length > maxActions) {
|
|
15300
|
+
issues.push(`Expected at most ${String(maxActions)} simulation action(s), found ${String(report.actions.length)}.`);
|
|
15301
|
+
}
|
|
15302
|
+
if (input.minSections !== undefined && report.total < input.minSections) {
|
|
15303
|
+
issues.push(`Expected at least ${String(input.minSections)} simulation section(s), found ${String(report.total)}.`);
|
|
15304
|
+
}
|
|
15305
|
+
if (input.minPassed !== undefined && report.passed < input.minPassed) {
|
|
15306
|
+
issues.push(`Expected at least ${String(input.minPassed)} passing simulation section(s), found ${String(report.passed)}.`);
|
|
15307
|
+
}
|
|
15308
|
+
for (const section of input.requiredSections ?? []) {
|
|
15309
|
+
if (!sections.includes(section)) {
|
|
15310
|
+
issues.push(`Missing simulation section: ${section}.`);
|
|
15311
|
+
}
|
|
15312
|
+
}
|
|
15313
|
+
for (const [section, minimum] of Object.entries(input.sectionMinimums ?? {})) {
|
|
15314
|
+
const total = sectionTotals[section] ?? 0;
|
|
15315
|
+
if (total < minimum) {
|
|
15316
|
+
issues.push(`Expected simulation section ${section} to include at least ${String(minimum)} item(s), found ${String(total)}.`);
|
|
15317
|
+
}
|
|
15318
|
+
}
|
|
15319
|
+
return {
|
|
15320
|
+
actions: report.actions.length,
|
|
15321
|
+
failed: report.failed,
|
|
15322
|
+
issues,
|
|
15323
|
+
ok: issues.length === 0,
|
|
15324
|
+
passed: report.passed,
|
|
15325
|
+
sections,
|
|
15326
|
+
sectionTotals,
|
|
15327
|
+
status: report.status,
|
|
15328
|
+
total: report.total
|
|
15329
|
+
};
|
|
15330
|
+
};
|
|
15331
|
+
var assertVoiceSimulationSuiteEvidence = (report, input = {}) => {
|
|
15332
|
+
const assertion = evaluateVoiceSimulationSuiteEvidence(report, input);
|
|
15333
|
+
if (!assertion.ok) {
|
|
15334
|
+
throw new Error(`Voice simulation suite evidence assertion failed: ${assertion.issues.join(" ")}`);
|
|
15335
|
+
}
|
|
15336
|
+
return assertion;
|
|
15337
|
+
};
|
|
15128
15338
|
var renderSection = (label, summary) => {
|
|
15129
15339
|
if (!summary) {
|
|
15130
15340
|
return "";
|
|
@@ -30695,7 +30905,9 @@ export {
|
|
|
30695
30905
|
exportVoiceTrace,
|
|
30696
30906
|
exportVoiceAuditTrail,
|
|
30697
30907
|
evaluateVoiceTrace,
|
|
30908
|
+
evaluateVoiceToolContractEvidence,
|
|
30698
30909
|
evaluateVoiceTelephonyContract,
|
|
30910
|
+
evaluateVoiceSimulationSuiteEvidence,
|
|
30699
30911
|
evaluateVoiceQuality,
|
|
30700
30912
|
evaluateVoiceProviderStackGaps,
|
|
30701
30913
|
evaluateVoiceProviderStackEvidence,
|
|
@@ -30705,6 +30917,7 @@ export {
|
|
|
30705
30917
|
evaluateVoiceProofTrendEvidence,
|
|
30706
30918
|
evaluateVoiceProductionReadinessEvidence,
|
|
30707
30919
|
evaluateVoicePlatformCoverage,
|
|
30920
|
+
evaluateVoiceOutcomeContractEvidence,
|
|
30708
30921
|
evaluateVoiceOperationsRecordGuardrails,
|
|
30709
30922
|
evaluateVoiceObservabilityExportReplayEvidence,
|
|
30710
30923
|
evaluateVoiceObservabilityExportDeliveryEvidence,
|
|
@@ -31021,6 +31234,8 @@ export {
|
|
|
31021
31234
|
buildVoiceAuditDeliveryReport,
|
|
31022
31235
|
buildEmptyVoiceProofTrendReport,
|
|
31023
31236
|
assignVoiceOpsTask,
|
|
31237
|
+
assertVoiceToolContractEvidence,
|
|
31238
|
+
assertVoiceSimulationSuiteEvidence,
|
|
31024
31239
|
assertVoiceProviderStackEvidence,
|
|
31025
31240
|
assertVoiceProviderSloEvidence,
|
|
31026
31241
|
assertVoiceProviderRoutingContractEvidence,
|
|
@@ -31029,6 +31244,7 @@ export {
|
|
|
31029
31244
|
assertVoiceProofTrendEvidence,
|
|
31030
31245
|
assertVoiceProductionReadinessEvidence,
|
|
31031
31246
|
assertVoicePlatformCoverage,
|
|
31247
|
+
assertVoiceOutcomeContractEvidence,
|
|
31032
31248
|
assertVoiceOperationsRecordGuardrails,
|
|
31033
31249
|
assertVoiceObservabilityExportSchema,
|
|
31034
31250
|
assertVoiceObservabilityExportReplayEvidence,
|
|
@@ -44,6 +44,35 @@ export type VoiceOutcomeContractSuiteReport = {
|
|
|
44
44
|
status: VoiceOutcomeContractStatus;
|
|
45
45
|
total: number;
|
|
46
46
|
};
|
|
47
|
+
export type VoiceOutcomeContractAssertionInput = {
|
|
48
|
+
maxFailed?: number;
|
|
49
|
+
maxIssues?: number;
|
|
50
|
+
minContracts?: number;
|
|
51
|
+
minHandoffs?: number;
|
|
52
|
+
minIntegrationEvents?: number;
|
|
53
|
+
minOperationsRecordHrefs?: number;
|
|
54
|
+
minReviews?: number;
|
|
55
|
+
minSessions?: number;
|
|
56
|
+
minTasks?: number;
|
|
57
|
+
requiredContractIds?: string[];
|
|
58
|
+
requireOperationRecordHrefs?: boolean;
|
|
59
|
+
};
|
|
60
|
+
export type VoiceOutcomeContractAssertionReport = {
|
|
61
|
+
contractIds: string[];
|
|
62
|
+
failed: number;
|
|
63
|
+
handoffs: number;
|
|
64
|
+
integrationEvents: number;
|
|
65
|
+
issues: string[];
|
|
66
|
+
issueCount: number;
|
|
67
|
+
ok: boolean;
|
|
68
|
+
operationsRecordHrefs: number;
|
|
69
|
+
passed: number;
|
|
70
|
+
reviews: number;
|
|
71
|
+
sessions: number;
|
|
72
|
+
status: VoiceOutcomeContractStatus;
|
|
73
|
+
tasks: number;
|
|
74
|
+
total: number;
|
|
75
|
+
};
|
|
47
76
|
type ListStore<T> = {
|
|
48
77
|
list: () => Promise<T[]> | T[];
|
|
49
78
|
};
|
|
@@ -67,6 +96,8 @@ export type VoiceOutcomeContractRoutesOptions<TSession extends VoiceSessionRecor
|
|
|
67
96
|
path?: string;
|
|
68
97
|
};
|
|
69
98
|
export declare const runVoiceOutcomeContractSuite: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceOutcomeContractOptions<TSession>) => Promise<VoiceOutcomeContractSuiteReport>;
|
|
99
|
+
export declare const evaluateVoiceOutcomeContractEvidence: (report: VoiceOutcomeContractSuiteReport, input?: VoiceOutcomeContractAssertionInput) => VoiceOutcomeContractAssertionReport;
|
|
100
|
+
export declare const assertVoiceOutcomeContractEvidence: (report: VoiceOutcomeContractSuiteReport, input?: VoiceOutcomeContractAssertionInput) => VoiceOutcomeContractAssertionReport;
|
|
70
101
|
export declare const renderVoiceOutcomeContractHTML: (report: VoiceOutcomeContractSuiteReport, options?: {
|
|
71
102
|
title?: string;
|
|
72
103
|
}) => string;
|
|
@@ -39,6 +39,26 @@ export type VoiceSimulationSuiteSectionSummary = {
|
|
|
39
39
|
status: VoiceSimulationSuiteStatus;
|
|
40
40
|
total: number;
|
|
41
41
|
};
|
|
42
|
+
export type VoiceSimulationSuiteSection = 'fixtures' | 'outcomes' | 'scenarios' | 'sessions' | 'tools';
|
|
43
|
+
export type VoiceSimulationSuiteAssertionInput = {
|
|
44
|
+
maxActions?: number;
|
|
45
|
+
maxFailed?: number;
|
|
46
|
+
minPassed?: number;
|
|
47
|
+
minSections?: number;
|
|
48
|
+
requiredSections?: VoiceSimulationSuiteSection[];
|
|
49
|
+
sectionMinimums?: Partial<Record<VoiceSimulationSuiteSection, number>>;
|
|
50
|
+
};
|
|
51
|
+
export type VoiceSimulationSuiteAssertionReport = {
|
|
52
|
+
actions: number;
|
|
53
|
+
failed: number;
|
|
54
|
+
issues: string[];
|
|
55
|
+
ok: boolean;
|
|
56
|
+
passed: number;
|
|
57
|
+
sections: VoiceSimulationSuiteSection[];
|
|
58
|
+
sectionTotals: Partial<Record<VoiceSimulationSuiteSection, number>>;
|
|
59
|
+
status: VoiceSimulationSuiteStatus;
|
|
60
|
+
total: number;
|
|
61
|
+
};
|
|
42
62
|
export type VoiceSimulationSuiteOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = {
|
|
43
63
|
actionLinks?: {
|
|
44
64
|
fixtures?: string;
|
|
@@ -75,6 +95,8 @@ export type VoiceSimulationSuiteRoutesOptions<TSession extends VoiceSessionRecor
|
|
|
75
95
|
title?: string;
|
|
76
96
|
};
|
|
77
97
|
export declare const runVoiceSimulationSuite: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceSimulationSuiteOptions<TSession>) => Promise<VoiceSimulationSuiteReport>;
|
|
98
|
+
export declare const evaluateVoiceSimulationSuiteEvidence: (report: VoiceSimulationSuiteReport, input?: VoiceSimulationSuiteAssertionInput) => VoiceSimulationSuiteAssertionReport;
|
|
99
|
+
export declare const assertVoiceSimulationSuiteEvidence: (report: VoiceSimulationSuiteReport, input?: VoiceSimulationSuiteAssertionInput) => VoiceSimulationSuiteAssertionReport;
|
|
78
100
|
export declare const renderVoiceSimulationSuiteHTML: (report: VoiceSimulationSuiteReport, options?: {
|
|
79
101
|
title?: string;
|
|
80
102
|
}) => string;
|
package/dist/toolContract.d.ts
CHANGED
|
@@ -64,6 +64,32 @@ export type VoiceToolContractSuiteReport = {
|
|
|
64
64
|
status: 'fail' | 'pass';
|
|
65
65
|
total: number;
|
|
66
66
|
};
|
|
67
|
+
export type VoiceToolContractAssertionInput = {
|
|
68
|
+
maxFailed?: number;
|
|
69
|
+
maxIssues?: number;
|
|
70
|
+
maxTimedOut?: number;
|
|
71
|
+
minCases?: number;
|
|
72
|
+
minContracts?: number;
|
|
73
|
+
requireOperationRecordHrefs?: boolean;
|
|
74
|
+
requiredCaseStatuses?: Array<'error' | 'ok'>;
|
|
75
|
+
requiredContractIds?: string[];
|
|
76
|
+
requiredToolNames?: string[];
|
|
77
|
+
};
|
|
78
|
+
export type VoiceToolContractAssertionReport = {
|
|
79
|
+
caseStatuses: Array<'error' | 'ok'>;
|
|
80
|
+
cases: number;
|
|
81
|
+
contractIds: string[];
|
|
82
|
+
failed: number;
|
|
83
|
+
issues: string[];
|
|
84
|
+
issueCount: number;
|
|
85
|
+
missingOperationsRecordHrefs: number;
|
|
86
|
+
ok: boolean;
|
|
87
|
+
passed: number;
|
|
88
|
+
status: VoiceToolContractSuiteReport['status'];
|
|
89
|
+
timedOut: number;
|
|
90
|
+
toolNames: string[];
|
|
91
|
+
total: number;
|
|
92
|
+
};
|
|
67
93
|
export type VoiceToolContractHandlerOptions = {
|
|
68
94
|
contracts: VoiceToolContractDefinition[];
|
|
69
95
|
operationsRecordHref?: false | string | ((sessionId: string) => string);
|
|
@@ -86,6 +112,8 @@ export declare const createVoiceToolContract: <TContext = unknown, TSession exte
|
|
|
86
112
|
};
|
|
87
113
|
export declare const createVoiceToolRuntimeContractDefaults: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TRouteResult = unknown>() => VoiceToolRuntimeOptions<TContext, TSession, TRouteResult>;
|
|
88
114
|
export declare const runVoiceToolContractSuite: (options: VoiceToolContractHandlerOptions) => Promise<VoiceToolContractSuiteReport>;
|
|
115
|
+
export declare const evaluateVoiceToolContractEvidence: (report: VoiceToolContractSuiteReport, input?: VoiceToolContractAssertionInput) => VoiceToolContractAssertionReport;
|
|
116
|
+
export declare const assertVoiceToolContractEvidence: (report: VoiceToolContractSuiteReport, input?: VoiceToolContractAssertionInput) => VoiceToolContractAssertionReport;
|
|
89
117
|
export declare const renderVoiceToolContractHTML: (report: VoiceToolContractSuiteReport, options?: {
|
|
90
118
|
title?: string;
|
|
91
119
|
}) => string;
|