@absolutejs/voice 0.0.22-beta.360 → 0.0.22-beta.361
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 +166 -0
- package/dist/profileSwitchRecommendation.d.ts +107 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -31,8 +31,8 @@ export { assertVoiceCompetitiveCoverage, buildVoiceCompetitiveCoverageReport, cr
|
|
|
31
31
|
export type { VoiceCompetitiveCoverageAssertionInput, VoiceCompetitiveCoverageAssertionReport, VoiceCompetitiveCoverageIssue, VoiceCompetitiveCoverageLevel, VoiceCompetitiveCoverageReport, VoiceCompetitiveCoverageReportInput, VoiceCompetitiveCoverageRoutesOptions, VoiceCompetitiveCoverageStatus, VoiceCompetitiveCoverageSummary, VoiceCompetitiveDepthLevel, VoiceCompetitiveEvidence, VoiceCompetitiveSurface } from './competitiveCoverage';
|
|
32
32
|
export type { VoicePlatformCoverageAssertionInput, VoicePlatformCoverageAssertionReport, VoicePlatformCoverageEvidence, VoicePlatformCoverageRoutesOptions, VoicePlatformCoverageStatus, VoicePlatformCoverageSummary, VoicePlatformCoverageSummaryInput, VoicePlatformCoverageSurface } from './platformCoverage';
|
|
33
33
|
export { assertVoiceProofTrendEvidence, buildEmptyVoiceProofTrendReport, buildVoiceProofTrendProfileSummaries, buildVoiceProofTrendRecommendationReport, buildVoiceProofTrendReportFromRealCallProfiles, buildVoiceProofTrendReport, buildVoiceRealCallProfileDefaults, buildVoiceRealCallProfileHistoryReport, createVoiceProofTrendRecommendationRoutes, createVoiceProofTrendRoutes, createVoiceRealCallProfileHistoryRoutes, DEFAULT_VOICE_PROOF_TREND_PROFILE_DEFINITIONS, DEFAULT_VOICE_PROOF_TRENDS_MAX_AGE_MS, evaluateVoiceProofTrendEvidence, formatVoiceProofTrendAge, normalizeVoiceProofTrendReport, readVoiceProofTrendReportFile, renderVoiceProofTrendRecommendationHTML, renderVoiceProofTrendRecommendationMarkdown, renderVoiceRealCallProfileHistoryHTML, renderVoiceRealCallProfileHistoryMarkdown, resolveVoiceRealCallProfileProviderRoute } from './proofTrends';
|
|
34
|
-
export { applyVoiceProfileSwitchGuard, createVoiceProfileSwitchPolicyProofRoutes, recommendVoiceProfileSwitch, renderVoiceProfileSwitchPolicyProofHTML, runVoiceProfileSwitchPolicyProof } from './profileSwitchRecommendation';
|
|
35
|
-
export type { VoiceProfileSwitchGuardAction, VoiceProfileSwitchGuardDecision, VoiceProfileSwitchGuardMode, VoiceProfileSwitchGuardOptions, VoiceProfileSwitchObservedSignals, VoiceProfileSwitchPolicyProofCase, VoiceProfileSwitchPolicyProofCaseResult, VoiceProfileSwitchPolicyProofOptions, VoiceProfileSwitchPolicyProofReport, VoiceProfileSwitchPolicyProofRoutesOptions, VoiceProfileSwitchRecommendation, VoiceProfileSwitchRecommendationOptions } from './profileSwitchRecommendation';
|
|
34
|
+
export { applyVoiceProfileSwitchGuard, buildVoiceProfileSwitchLiveDecisionReport, createVoiceProfileSwitchLiveDecisionRoutes, createVoiceProfileSwitchPolicyProofRoutes, recommendVoiceProfileSwitch, renderVoiceProfileSwitchLiveDecisionHTML, renderVoiceProfileSwitchPolicyProofHTML, runVoiceProfileSwitchPolicyProof } from './profileSwitchRecommendation';
|
|
35
|
+
export type { VoiceProfileSwitchGuardAction, VoiceProfileSwitchGuardDecision, VoiceProfileSwitchGuardMode, VoiceProfileSwitchGuardOptions, VoiceProfileSwitchObservedSignals, VoiceProfileSwitchLiveDecisionEvidence, VoiceProfileSwitchLiveDecisionReport, VoiceProfileSwitchLiveDecisionReportOptions, VoiceProfileSwitchLiveDecisionRoutesOptions, VoiceProfileSwitchLiveDecisionSession, VoiceProfileSwitchPolicyProofCase, VoiceProfileSwitchPolicyProofCaseResult, VoiceProfileSwitchPolicyProofOptions, VoiceProfileSwitchPolicyProofReport, VoiceProfileSwitchPolicyProofRoutesOptions, VoiceProfileSwitchRecommendation, VoiceProfileSwitchRecommendationOptions } from './profileSwitchRecommendation';
|
|
36
36
|
export { buildVoiceProviderDecisionTraceReport, createVoiceProviderDecisionTraceEvent, createVoiceProviderDecisionTraceRoutes, listVoiceProviderDecisionTraces, renderVoiceProviderDecisionTraceHTML, renderVoiceProviderDecisionTraceMarkdown } from './providerDecisionTraces';
|
|
37
37
|
export type { VoiceProviderDecisionStatus, VoiceProviderDecisionSurfaceReport, VoiceProviderDecisionTrace, VoiceProviderDecisionTraceInput, VoiceProviderDecisionTraceIssue, VoiceProviderDecisionTraceReport, VoiceProviderDecisionTraceReportOptions, VoiceProviderDecisionTraceRoutesOptions } from './providerDecisionTraces';
|
|
38
38
|
export type { VoiceProofTrendAssertionInput, VoiceProofTrendAssertionReport, VoiceProofTrendCycle, VoiceProofTrendProfileDefinition, VoiceProofTrendProfileRecommendation, VoiceProofTrendProfileSummaryOptions, VoiceProofTrendProfileSummary, VoiceProofTrendProviderRecommendation, VoiceProofTrendProviderSummary, VoiceProofTrendRecommendation, VoiceProofTrendRecommendationOptions, VoiceProofTrendRecommendationReport, VoiceProofTrendRecommendationRoutesOptions, VoiceProofTrendRecommendationStatus, VoiceProofTrendRecommendationSurface, VoiceProofTrendRealCallProfileEvidence, VoiceProofTrendRealCallProfileReportOptions, VoiceProofTrendReport, VoiceProofTrendReportInput, VoiceProofTrendRoutesOptions, VoiceProofTrendRuntimeChannelSummary, VoiceProofTrendStatus, VoiceProofTrendSummary, VoiceRealCallProfileDefault, VoiceRealCallProfileDefaultsOptions, VoiceRealCallProfileDefaultsReport, VoiceRealCallProfileHistoryOptions, VoiceRealCallProfileHistoryReport, VoiceRealCallProfileHistoryRoutesOptions, VoiceRealCallProfileProviderRouteOptions } from './proofTrends';
|
package/dist/index.js
CHANGED
|
@@ -5681,6 +5681,169 @@ var createVoiceProfileSwitchPolicyProofRoutes = (options) => {
|
|
|
5681
5681
|
}
|
|
5682
5682
|
return routes;
|
|
5683
5683
|
};
|
|
5684
|
+
var readStringField = (record, key) => typeof record?.[key] === "string" ? record[key] : undefined;
|
|
5685
|
+
var readNumberField = (record, key) => typeof record?.[key] === "number" && Number.isFinite(record[key]) ? record[key] : undefined;
|
|
5686
|
+
var readBooleanField = (record, key) => typeof record?.[key] === "boolean" ? record[key] : undefined;
|
|
5687
|
+
var auditEventToLiveDecision = (event) => {
|
|
5688
|
+
if (event.type !== "profile.switch" || !event.sessionId) {
|
|
5689
|
+
return;
|
|
5690
|
+
}
|
|
5691
|
+
const payload = event.payload;
|
|
5692
|
+
return {
|
|
5693
|
+
action: readStringField(payload, "action") ?? event.action.replace(/^profile\.switch\./, ""),
|
|
5694
|
+
at: event.at,
|
|
5695
|
+
auditEventId: event.id,
|
|
5696
|
+
autoApplied: readBooleanField(payload, "autoApplied"),
|
|
5697
|
+
autoSwitchCount: readNumberField(payload, "autoSwitchCount"),
|
|
5698
|
+
blockedByPolicy: readStringField(payload, "blockedByPolicy"),
|
|
5699
|
+
confidence: readNumberField(payload, "confidence"),
|
|
5700
|
+
maxAutoSwitchesPerSession: readNumberField(payload, "maxAutoSwitchesPerSession"),
|
|
5701
|
+
minConfidence: readNumberField(payload, "minConfidence"),
|
|
5702
|
+
mode: readStringField(payload, "mode"),
|
|
5703
|
+
outcome: event.outcome,
|
|
5704
|
+
previousProfileId: readStringField(payload, "previousProfileId"),
|
|
5705
|
+
recommendedProfileId: readStringField(payload, "recommendedProfileId"),
|
|
5706
|
+
selectedProfileId: readStringField(payload, "selectedProfileId") ?? event.resource?.id,
|
|
5707
|
+
sessionId: event.sessionId,
|
|
5708
|
+
source: "audit",
|
|
5709
|
+
status: readStringField(payload, "status"),
|
|
5710
|
+
traceId: event.traceId
|
|
5711
|
+
};
|
|
5712
|
+
};
|
|
5713
|
+
var traceEventToLiveDecision = (event) => {
|
|
5714
|
+
if (event.type !== "provider.decision" || event.metadata?.source !== "profile-switch-guard") {
|
|
5715
|
+
return;
|
|
5716
|
+
}
|
|
5717
|
+
const payload = event.payload;
|
|
5718
|
+
return {
|
|
5719
|
+
action: readStringField(payload, "action"),
|
|
5720
|
+
at: event.at,
|
|
5721
|
+
autoApplied: readBooleanField(payload, "autoApplied"),
|
|
5722
|
+
autoSwitchCount: readNumberField(payload, "autoSwitchCount"),
|
|
5723
|
+
blockedByPolicy: readStringField(payload, "blockedByPolicy"),
|
|
5724
|
+
confidence: readNumberField(payload, "confidence"),
|
|
5725
|
+
maxAutoSwitchesPerSession: readNumberField(payload, "maxAutoSwitchesPerSession"),
|
|
5726
|
+
minConfidence: readNumberField(payload, "minConfidence"),
|
|
5727
|
+
mode: readStringField(payload, "mode"),
|
|
5728
|
+
previousProfileId: readStringField(payload, "previousProfileId"),
|
|
5729
|
+
reason: readStringField(payload, "reason"),
|
|
5730
|
+
recommendedProfileId: readStringField(payload, "recommendedProfileId"),
|
|
5731
|
+
scenarioId: event.scenarioId,
|
|
5732
|
+
selectedProfileId: readStringField(payload, "selectedProfileId"),
|
|
5733
|
+
sessionId: event.sessionId,
|
|
5734
|
+
source: "trace",
|
|
5735
|
+
status: readStringField(payload, "status"),
|
|
5736
|
+
traceEventId: event.id,
|
|
5737
|
+
traceId: event.traceId
|
|
5738
|
+
};
|
|
5739
|
+
};
|
|
5740
|
+
var buildVoiceProfileSwitchLiveDecisionReport = async (options) => {
|
|
5741
|
+
const [auditEvents, traceEvents] = await Promise.all([
|
|
5742
|
+
options.audit?.list({
|
|
5743
|
+
limit: options.limit,
|
|
5744
|
+
sessionId: options.sessionId,
|
|
5745
|
+
type: "profile.switch"
|
|
5746
|
+
}) ?? [],
|
|
5747
|
+
options.trace?.list({
|
|
5748
|
+
limit: options.limit,
|
|
5749
|
+
sessionId: options.sessionId,
|
|
5750
|
+
type: "provider.decision"
|
|
5751
|
+
}) ?? []
|
|
5752
|
+
]);
|
|
5753
|
+
const decisions = [
|
|
5754
|
+
...auditEvents.map(auditEventToLiveDecision).filter((decision) => Boolean(decision)),
|
|
5755
|
+
...traceEvents.map(traceEventToLiveDecision).filter((decision) => Boolean(decision))
|
|
5756
|
+
].sort((left, right) => right.at - left.at).slice(0, options.limit);
|
|
5757
|
+
const sessions = Array.from(decisions.reduce((map, decision) => {
|
|
5758
|
+
const existing = map.get(decision.sessionId) ?? {
|
|
5759
|
+
actionCounts: {},
|
|
5760
|
+
actions: [],
|
|
5761
|
+
autoApplied: 0,
|
|
5762
|
+
blockedByPolicy: [],
|
|
5763
|
+
decisions: [],
|
|
5764
|
+
firstSeenAt: decision.at,
|
|
5765
|
+
lastSeenAt: decision.at,
|
|
5766
|
+
sessionId: decision.sessionId
|
|
5767
|
+
};
|
|
5768
|
+
existing.decisions.push(decision);
|
|
5769
|
+
existing.firstSeenAt = Math.min(existing.firstSeenAt, decision.at);
|
|
5770
|
+
existing.lastSeenAt = Math.max(existing.lastSeenAt, decision.at);
|
|
5771
|
+
if (decision.action) {
|
|
5772
|
+
existing.actionCounts[decision.action] = (existing.actionCounts[decision.action] ?? 0) + 1;
|
|
5773
|
+
}
|
|
5774
|
+
if (decision.autoApplied) {
|
|
5775
|
+
existing.autoApplied += 1;
|
|
5776
|
+
}
|
|
5777
|
+
if (decision.blockedByPolicy && !existing.blockedByPolicy.includes(decision.blockedByPolicy)) {
|
|
5778
|
+
existing.blockedByPolicy.push(decision.blockedByPolicy);
|
|
5779
|
+
}
|
|
5780
|
+
map.set(decision.sessionId, existing);
|
|
5781
|
+
return map;
|
|
5782
|
+
}, new Map)).map(([, session]) => ({
|
|
5783
|
+
...session,
|
|
5784
|
+
actions: Object.keys(session.actionCounts).sort(),
|
|
5785
|
+
decisions: session.decisions.sort((left, right) => right.at - left.at),
|
|
5786
|
+
lastDecision: session.decisions.sort((left, right) => right.at - left.at)[0]
|
|
5787
|
+
}));
|
|
5788
|
+
const actionCount = (action) => decisions.filter((decision) => decision.action === action).length;
|
|
5789
|
+
return {
|
|
5790
|
+
generatedAt: new Date().toISOString(),
|
|
5791
|
+
ok: decisions.length > 0,
|
|
5792
|
+
sessions: sessions.sort((left, right) => right.lastSeenAt - left.lastSeenAt),
|
|
5793
|
+
summary: {
|
|
5794
|
+
auditEvents: auditEvents.length,
|
|
5795
|
+
autoApplied: decisions.filter((decision) => decision.autoApplied).length,
|
|
5796
|
+
blocked: actionCount("blocked"),
|
|
5797
|
+
decisions: decisions.length,
|
|
5798
|
+
recommendations: actionCount("recommend"),
|
|
5799
|
+
sessions: sessions.length,
|
|
5800
|
+
switches: actionCount("switch"),
|
|
5801
|
+
traceEvents: traceEvents.length
|
|
5802
|
+
}
|
|
5803
|
+
};
|
|
5804
|
+
};
|
|
5805
|
+
var renderVoiceProfileSwitchLiveDecisionHTML = (report, options = {}) => {
|
|
5806
|
+
const title = options.title ?? "Voice Profile Switch Live Decisions";
|
|
5807
|
+
const rows = report.sessions.flatMap((session) => session.decisions.map((decision) => `<tr>
|
|
5808
|
+
<td><strong>${escapeHtml3(decision.sessionId)}</strong><p>${escapeHtml3(new Date(decision.at).toISOString())}</p></td>
|
|
5809
|
+
<td>${escapeHtml3(decision.source)}</td>
|
|
5810
|
+
<td>${escapeHtml3(decision.action ?? "unknown")}</td>
|
|
5811
|
+
<td>${escapeHtml3(decision.selectedProfileId ?? "none")}</td>
|
|
5812
|
+
<td>${escapeHtml3(decision.blockedByPolicy ?? "none")}</td>
|
|
5813
|
+
<td>${typeof decision.confidence === "number" ? `${Math.round(decision.confidence * 100)}%` : "n/a"}</td>
|
|
5814
|
+
<td>${escapeHtml3(decision.reason ?? decision.outcome ?? "recorded")}</td>
|
|
5815
|
+
</tr>`)).join("");
|
|
5816
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>${escapeHtml3(title)}</title><style>:root{color-scheme:dark;background:#11100b;color:#fff7ed;font-family:ui-sans-serif,system-ui,sans-serif}body{margin:0;padding:32px;background:radial-gradient(circle at top right,rgba(251,146,60,.18),transparent 34%),#11100b}main{max-width:1180px;margin:0 auto}.hero,.card{border:1px solid rgba(251,191,36,.24);border-radius:24px;background:rgba(28,25,23,.78);box-shadow:0 24px 90px rgba(0,0,0,.24);padding:24px;margin-bottom:18px}.metric-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}.metric{border:1px solid rgba(251,191,36,.22);border-radius:18px;padding:16px;background:rgba(120,53,15,.26)}.metric span{display:block;color:#fed7aa;font-size:.75rem;text-transform:uppercase;letter-spacing:.08em}.metric strong{display:block;margin-top:8px;font-size:1.7rem}table{width:100%;border-collapse:collapse}th,td{padding:13px;text-align:left;border-bottom:1px solid rgba(251,191,36,.18);vertical-align:top}th{color:#fde68a;text-transform:uppercase;font-size:.74rem;letter-spacing:.08em}td p{margin:.35rem 0 0;color:#fdba74}pre{white-space:pre-wrap;overflow:auto;border-radius:18px;background:#020617;padding:18px;color:#ffedd5}.empty{color:#fdba74}</style></head><body><main><section class="hero"><h1>${escapeHtml3(title)}</h1><p>This page summarizes real profile switch guard evidence from audit and trace stores. Use it beside policy proof to show bounded policy plus actual session decisions.</p><div class="metric-grid"><div class="metric"><span>Sessions</span><strong>${String(report.summary.sessions)}</strong></div><div class="metric"><span>Decisions</span><strong>${String(report.summary.decisions)}</strong></div><div class="metric"><span>Switches</span><strong>${String(report.summary.switches)}</strong></div><div class="metric"><span>Blocked</span><strong>${String(report.summary.blocked)}</strong></div><div class="metric"><span>Auto applied</span><strong>${String(report.summary.autoApplied)}</strong></div></div></section><section class="card"><h2>Live Guard Decisions</h2>${rows ? `<table><thead><tr><th>Session</th><th>Source</th><th>Action</th><th>Selected</th><th>Blocked by</th><th>Confidence</th><th>Reason</th></tr></thead><tbody>${rows}</tbody></table>` : '<p class="empty">No profile switch guard decisions recorded yet. Start a voice session with profileSwitchGuard enabled.</p>'}</section><section class="card"><h2>Raw Report</h2><pre>${stringifyForHtml(report)}</pre></section></main></body></html>`;
|
|
5817
|
+
};
|
|
5818
|
+
var createVoiceProfileSwitchLiveDecisionRoutes = (options) => {
|
|
5819
|
+
const path = options.path ?? "/api/voice/profile-switch-live-decisions";
|
|
5820
|
+
const htmlPath = options.htmlPath === undefined ? "/voice/profile-switch-live-decisions" : options.htmlPath;
|
|
5821
|
+
const routes = new Elysia({
|
|
5822
|
+
name: options.name ?? "absolutejs-voice-profile-switch-live-decisions"
|
|
5823
|
+
}).get(path, async ({ query }) => buildVoiceProfileSwitchLiveDecisionReport({
|
|
5824
|
+
audit: options.audit,
|
|
5825
|
+
limit: typeof query.limit === "string" && Number.isFinite(Number(query.limit)) ? Number(query.limit) : options.limit,
|
|
5826
|
+
sessionId: typeof query.sessionId === "string" && query.sessionId.trim() ? query.sessionId.trim() : options.sessionId,
|
|
5827
|
+
trace: options.trace
|
|
5828
|
+
}));
|
|
5829
|
+
if (htmlPath) {
|
|
5830
|
+
routes.get(htmlPath, async ({ query }) => {
|
|
5831
|
+
const report = await buildVoiceProfileSwitchLiveDecisionReport({
|
|
5832
|
+
audit: options.audit,
|
|
5833
|
+
limit: typeof query.limit === "string" && Number.isFinite(Number(query.limit)) ? Number(query.limit) : options.limit,
|
|
5834
|
+
sessionId: typeof query.sessionId === "string" && query.sessionId.trim() ? query.sessionId.trim() : options.sessionId,
|
|
5835
|
+
trace: options.trace
|
|
5836
|
+
});
|
|
5837
|
+
const render = options.render ?? ((input) => renderVoiceProfileSwitchLiveDecisionHTML(input, {
|
|
5838
|
+
title: options.title
|
|
5839
|
+
}));
|
|
5840
|
+
return new Response(await render(report), {
|
|
5841
|
+
headers: { "Content-Type": "text/html; charset=utf-8" }
|
|
5842
|
+
});
|
|
5843
|
+
});
|
|
5844
|
+
}
|
|
5845
|
+
return routes;
|
|
5846
|
+
};
|
|
5684
5847
|
|
|
5685
5848
|
// src/plugin.ts
|
|
5686
5849
|
var resolveQueryScenario = (query) => {
|
|
@@ -37662,6 +37825,7 @@ export {
|
|
|
37662
37825
|
renderVoiceProofTrendRecommendationMarkdown,
|
|
37663
37826
|
renderVoiceProofTrendRecommendationHTML,
|
|
37664
37827
|
renderVoiceProfileSwitchPolicyProofHTML,
|
|
37828
|
+
renderVoiceProfileSwitchLiveDecisionHTML,
|
|
37665
37829
|
renderVoiceProductionReadinessHTML,
|
|
37666
37830
|
renderVoicePostCallAnalysisMarkdown,
|
|
37667
37831
|
renderVoicePhoneAgentProductionSmokeHTML,
|
|
@@ -37916,6 +38080,7 @@ export {
|
|
|
37916
38080
|
createVoiceProofTrendRoutes,
|
|
37917
38081
|
createVoiceProofTrendRecommendationRoutes,
|
|
37918
38082
|
createVoiceProfileSwitchPolicyProofRoutes,
|
|
38083
|
+
createVoiceProfileSwitchLiveDecisionRoutes,
|
|
37919
38084
|
createVoiceProductionReadinessRoutes,
|
|
37920
38085
|
createVoicePostgresTraceSinkDeliveryStore,
|
|
37921
38086
|
createVoicePostgresTraceEventStore,
|
|
@@ -38116,6 +38281,7 @@ export {
|
|
|
38116
38281
|
buildVoiceProofTrendReport,
|
|
38117
38282
|
buildVoiceProofTrendRecommendationReport,
|
|
38118
38283
|
buildVoiceProofTrendProfileSummaries,
|
|
38284
|
+
buildVoiceProfileSwitchLiveDecisionReport,
|
|
38119
38285
|
buildVoiceProductionReadinessReport,
|
|
38120
38286
|
buildVoiceProductionReadinessGate,
|
|
38121
38287
|
buildVoicePostCallAnalysisReport,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
2
|
import type { VoiceRealCallProfileDefault, VoiceRealCallProfileDefaultsReport, VoiceRealCallProfileHistoryReport } from './proofTrends';
|
|
3
3
|
import { type StoredVoiceAuditEvent, type VoiceAuditActor, type VoiceAuditEventStore } from './audit';
|
|
4
|
+
import type { VoiceTraceEventStore } from './trace';
|
|
4
5
|
export type VoiceProfileSwitchObservedSignals = {
|
|
5
6
|
currentProfileId?: string;
|
|
6
7
|
fallbackUsed?: boolean;
|
|
@@ -110,6 +111,68 @@ export type VoiceProfileSwitchPolicyProofRoutesOptions = VoiceProfileSwitchPolic
|
|
|
110
111
|
path?: string;
|
|
111
112
|
render?: (report: VoiceProfileSwitchPolicyProofReport) => string | Promise<string>;
|
|
112
113
|
};
|
|
114
|
+
export type VoiceProfileSwitchLiveDecisionEvidence = {
|
|
115
|
+
action?: VoiceProfileSwitchGuardAction | string;
|
|
116
|
+
at: number;
|
|
117
|
+
auditEventId?: string;
|
|
118
|
+
autoApplied?: boolean;
|
|
119
|
+
autoSwitchCount?: number;
|
|
120
|
+
blockedByPolicy?: string;
|
|
121
|
+
confidence?: number;
|
|
122
|
+
maxAutoSwitchesPerSession?: number;
|
|
123
|
+
minConfidence?: number;
|
|
124
|
+
mode?: VoiceProfileSwitchGuardMode | string;
|
|
125
|
+
outcome?: string;
|
|
126
|
+
previousProfileId?: string;
|
|
127
|
+
reason?: string;
|
|
128
|
+
recommendedProfileId?: string;
|
|
129
|
+
scenarioId?: string;
|
|
130
|
+
selectedProfileId?: string;
|
|
131
|
+
sessionId: string;
|
|
132
|
+
source: 'audit' | 'trace';
|
|
133
|
+
status?: string;
|
|
134
|
+
traceEventId?: string;
|
|
135
|
+
traceId?: string;
|
|
136
|
+
};
|
|
137
|
+
export type VoiceProfileSwitchLiveDecisionSession = {
|
|
138
|
+
actionCounts: Record<string, number>;
|
|
139
|
+
actions: string[];
|
|
140
|
+
autoApplied: number;
|
|
141
|
+
blockedByPolicy: string[];
|
|
142
|
+
decisions: VoiceProfileSwitchLiveDecisionEvidence[];
|
|
143
|
+
firstSeenAt: number;
|
|
144
|
+
lastDecision?: VoiceProfileSwitchLiveDecisionEvidence;
|
|
145
|
+
lastSeenAt: number;
|
|
146
|
+
sessionId: string;
|
|
147
|
+
};
|
|
148
|
+
export type VoiceProfileSwitchLiveDecisionReport = {
|
|
149
|
+
generatedAt: string;
|
|
150
|
+
ok: boolean;
|
|
151
|
+
sessions: VoiceProfileSwitchLiveDecisionSession[];
|
|
152
|
+
summary: {
|
|
153
|
+
auditEvents: number;
|
|
154
|
+
autoApplied: number;
|
|
155
|
+
blocked: number;
|
|
156
|
+
decisions: number;
|
|
157
|
+
recommendations: number;
|
|
158
|
+
sessions: number;
|
|
159
|
+
switches: number;
|
|
160
|
+
traceEvents: number;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
export type VoiceProfileSwitchLiveDecisionReportOptions = {
|
|
164
|
+
audit?: VoiceAuditEventStore;
|
|
165
|
+
limit?: number;
|
|
166
|
+
sessionId?: string;
|
|
167
|
+
trace?: VoiceTraceEventStore;
|
|
168
|
+
};
|
|
169
|
+
export type VoiceProfileSwitchLiveDecisionRoutesOptions = VoiceProfileSwitchLiveDecisionReportOptions & {
|
|
170
|
+
htmlPath?: false | string;
|
|
171
|
+
name?: string;
|
|
172
|
+
path?: string;
|
|
173
|
+
render?: (report: VoiceProfileSwitchLiveDecisionReport) => string | Promise<string>;
|
|
174
|
+
title?: string;
|
|
175
|
+
};
|
|
113
176
|
export declare const recommendVoiceProfileSwitch: (options: VoiceProfileSwitchRecommendationOptions) => VoiceProfileSwitchRecommendation;
|
|
114
177
|
export declare const applyVoiceProfileSwitchGuard: (options: VoiceProfileSwitchGuardOptions) => Promise<VoiceProfileSwitchGuardDecision>;
|
|
115
178
|
export declare const runVoiceProfileSwitchPolicyProof: (options: VoiceProfileSwitchPolicyProofOptions) => Promise<VoiceProfileSwitchPolicyProofReport>;
|
|
@@ -156,3 +219,47 @@ export declare const createVoiceProfileSwitchPolicyProofRoutes: (options: VoiceP
|
|
|
156
219
|
standaloneSchema: {};
|
|
157
220
|
response: {};
|
|
158
221
|
}>;
|
|
222
|
+
export declare const buildVoiceProfileSwitchLiveDecisionReport: (options: VoiceProfileSwitchLiveDecisionReportOptions) => Promise<VoiceProfileSwitchLiveDecisionReport>;
|
|
223
|
+
export declare const renderVoiceProfileSwitchLiveDecisionHTML: (report: VoiceProfileSwitchLiveDecisionReport, options?: {
|
|
224
|
+
title?: string;
|
|
225
|
+
}) => string;
|
|
226
|
+
export declare const createVoiceProfileSwitchLiveDecisionRoutes: (options: VoiceProfileSwitchLiveDecisionRoutesOptions) => Elysia<"", {
|
|
227
|
+
decorator: {};
|
|
228
|
+
store: {};
|
|
229
|
+
derive: {};
|
|
230
|
+
resolve: {};
|
|
231
|
+
}, {
|
|
232
|
+
typebox: {};
|
|
233
|
+
error: {};
|
|
234
|
+
}, {
|
|
235
|
+
schema: {};
|
|
236
|
+
standaloneSchema: {};
|
|
237
|
+
macro: {};
|
|
238
|
+
macroFn: {};
|
|
239
|
+
parser: {};
|
|
240
|
+
response: {};
|
|
241
|
+
}, {
|
|
242
|
+
[x: string]: {
|
|
243
|
+
get: {
|
|
244
|
+
body: unknown;
|
|
245
|
+
params: {};
|
|
246
|
+
query: unknown;
|
|
247
|
+
headers: unknown;
|
|
248
|
+
response: {
|
|
249
|
+
200: VoiceProfileSwitchLiveDecisionReport;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
}, {
|
|
254
|
+
derive: {};
|
|
255
|
+
resolve: {};
|
|
256
|
+
schema: {};
|
|
257
|
+
standaloneSchema: {};
|
|
258
|
+
response: {};
|
|
259
|
+
}, {
|
|
260
|
+
derive: {};
|
|
261
|
+
resolve: {};
|
|
262
|
+
schema: {};
|
|
263
|
+
standaloneSchema: {};
|
|
264
|
+
response: {};
|
|
265
|
+
}>;
|