@absolutejs/voice 0.0.22-beta.512 → 0.0.22-beta.514
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/agentPerformanceReport.d.ts +40 -0
- package/dist/aiScorecard.d.ts +32 -0
- package/dist/callScorecard.d.ts +53 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +1291 -0
- package/dist/pathway.d.ts +94 -0
- package/dist/pathwayCompiler.d.ts +31 -0
- package/dist/pathwayRuntime.d.ts +57 -0
- package/dist/pathwaySlotCollector.d.ts +29 -0
- package/dist/pathwayVisualizer.d.ts +8 -0
- package/dist/qualityDriftDetector.d.ts +44 -0
- package/dist/scorecardCalibration.d.ts +31 -0
- package/dist/vue/VoiceCostDashboard.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export type VoicePathwaySlotType = "string" | "number" | "boolean" | "date" | "time" | "phone" | "email" | "currency" | "choice";
|
|
2
|
+
export type VoicePathwaySlot = {
|
|
3
|
+
id: string;
|
|
4
|
+
type: VoicePathwaySlotType;
|
|
5
|
+
prompt: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
choices?: string[];
|
|
8
|
+
description?: string;
|
|
9
|
+
validation?: {
|
|
10
|
+
minLength?: number;
|
|
11
|
+
maxLength?: number;
|
|
12
|
+
pattern?: string;
|
|
13
|
+
min?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type VoicePathwayCondition = {
|
|
18
|
+
kind: "slot-equals";
|
|
19
|
+
slotId: string;
|
|
20
|
+
value: string | number | boolean;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "slot-filled";
|
|
23
|
+
slotId: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: "slot-matches";
|
|
26
|
+
slotId: string;
|
|
27
|
+
pattern: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "always";
|
|
30
|
+
} | {
|
|
31
|
+
kind: "fallback";
|
|
32
|
+
};
|
|
33
|
+
export type VoicePathwayAction = {
|
|
34
|
+
kind: "say";
|
|
35
|
+
text: string;
|
|
36
|
+
} | {
|
|
37
|
+
kind: "collect-slot";
|
|
38
|
+
slotId: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "call-tool";
|
|
41
|
+
toolId: string;
|
|
42
|
+
argsFromSlots?: string[];
|
|
43
|
+
} | {
|
|
44
|
+
kind: "set-slot";
|
|
45
|
+
slotId: string;
|
|
46
|
+
valueExpression: string;
|
|
47
|
+
} | {
|
|
48
|
+
kind: "transfer";
|
|
49
|
+
destination: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "end-call";
|
|
52
|
+
reason?: string;
|
|
53
|
+
};
|
|
54
|
+
export type VoicePathwayTransition = {
|
|
55
|
+
to: string;
|
|
56
|
+
condition: VoicePathwayCondition;
|
|
57
|
+
description?: string;
|
|
58
|
+
};
|
|
59
|
+
export type VoicePathwayState = {
|
|
60
|
+
id: string;
|
|
61
|
+
label: string;
|
|
62
|
+
kind?: "entry" | "collect" | "branch" | "action" | "terminal";
|
|
63
|
+
description?: string;
|
|
64
|
+
systemNote?: string;
|
|
65
|
+
actions?: VoicePathwayAction[];
|
|
66
|
+
transitions: VoicePathwayTransition[];
|
|
67
|
+
};
|
|
68
|
+
export type VoicePathway = {
|
|
69
|
+
id: string;
|
|
70
|
+
label: string;
|
|
71
|
+
entryStateId: string;
|
|
72
|
+
states: VoicePathwayState[];
|
|
73
|
+
slots: VoicePathwaySlot[];
|
|
74
|
+
tools?: {
|
|
75
|
+
id: string;
|
|
76
|
+
description: string;
|
|
77
|
+
}[];
|
|
78
|
+
metadata?: Record<string, string>;
|
|
79
|
+
};
|
|
80
|
+
export type VoicePathwayValidationIssue = {
|
|
81
|
+
severity: "error" | "warning";
|
|
82
|
+
code: "duplicate-state" | "duplicate-slot" | "unknown-entry" | "unreachable-state" | "missing-transition-target" | "missing-slot-ref" | "no-terminal-reachable" | "fallback-not-last" | "duplicate-transition";
|
|
83
|
+
message: string;
|
|
84
|
+
stateId?: string;
|
|
85
|
+
slotId?: string;
|
|
86
|
+
};
|
|
87
|
+
export type VoicePathwayValidationReport = {
|
|
88
|
+
valid: boolean;
|
|
89
|
+
issues: VoicePathwayValidationIssue[];
|
|
90
|
+
reachableStates: string[];
|
|
91
|
+
};
|
|
92
|
+
export declare const validateVoicePathway: (pathway: VoicePathway) => VoicePathwayValidationReport;
|
|
93
|
+
export declare const findVoicePathwayState: (pathway: VoicePathway, id: string) => VoicePathwayState | null;
|
|
94
|
+
export declare const findVoicePathwaySlot: (pathway: VoicePathway, id: string) => VoicePathwaySlot | null;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type VoicePathway } from "./pathway";
|
|
2
|
+
export type VoicePathwayCompilerToolDefinition = {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: Record<string, {
|
|
8
|
+
type: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
enum?: string[];
|
|
11
|
+
}>;
|
|
12
|
+
required: string[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type VoicePathwayCompiledAssistant = {
|
|
16
|
+
systemPrompt: string;
|
|
17
|
+
tools: VoicePathwayCompilerToolDefinition[];
|
|
18
|
+
initialPrompt?: string;
|
|
19
|
+
metadata: {
|
|
20
|
+
pathwayId: string;
|
|
21
|
+
pathwayLabel: string;
|
|
22
|
+
entryStateId: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type CompileVoicePathwayOptions = {
|
|
26
|
+
pathway: VoicePathway;
|
|
27
|
+
introduction?: string;
|
|
28
|
+
fallbackBehavior?: "stay" | "end-call" | "transfer";
|
|
29
|
+
toolNamePrefix?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const compileVoicePathwayToAssistant: (options: CompileVoicePathwayOptions) => VoicePathwayCompiledAssistant;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type VoicePathway, type VoicePathwayAction } from "./pathway";
|
|
2
|
+
export type VoicePathwaySlotValue = string | number | boolean | null;
|
|
3
|
+
export type VoicePathwayRuntimeStatus = "ready" | "awaiting-slot" | "branching" | "ended" | "errored";
|
|
4
|
+
export type VoicePathwayRuntimeState = {
|
|
5
|
+
currentStateId: string;
|
|
6
|
+
status: VoicePathwayRuntimeStatus;
|
|
7
|
+
slots: Record<string, VoicePathwaySlotValue>;
|
|
8
|
+
awaitingSlotId: string | null;
|
|
9
|
+
history: {
|
|
10
|
+
stateId: string;
|
|
11
|
+
at: number;
|
|
12
|
+
}[];
|
|
13
|
+
pendingActions: VoicePathwayAction[];
|
|
14
|
+
lastError?: string;
|
|
15
|
+
endedReason?: string;
|
|
16
|
+
};
|
|
17
|
+
export type VoicePathwayToolCall = {
|
|
18
|
+
toolId: string;
|
|
19
|
+
args: Record<string, VoicePathwaySlotValue>;
|
|
20
|
+
};
|
|
21
|
+
export type VoicePathwayRuntimeEvent = {
|
|
22
|
+
type: "say";
|
|
23
|
+
text: string;
|
|
24
|
+
} | {
|
|
25
|
+
type: "ask-slot";
|
|
26
|
+
slotId: string;
|
|
27
|
+
prompt: string;
|
|
28
|
+
} | {
|
|
29
|
+
type: "tool-call";
|
|
30
|
+
call: VoicePathwayToolCall;
|
|
31
|
+
} | {
|
|
32
|
+
type: "transfer";
|
|
33
|
+
destination: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: "end-call";
|
|
36
|
+
reason?: string;
|
|
37
|
+
} | {
|
|
38
|
+
type: "state-entered";
|
|
39
|
+
stateId: string;
|
|
40
|
+
} | {
|
|
41
|
+
type: "errored";
|
|
42
|
+
message: string;
|
|
43
|
+
};
|
|
44
|
+
export type CreateVoicePathwayRuntimeOptions = {
|
|
45
|
+
pathway: VoicePathway;
|
|
46
|
+
initialSlots?: Record<string, VoicePathwaySlotValue>;
|
|
47
|
+
now?: () => number;
|
|
48
|
+
skipValidation?: boolean;
|
|
49
|
+
};
|
|
50
|
+
export declare const createVoicePathwayRuntime: (options: CreateVoicePathwayRuntimeOptions) => {
|
|
51
|
+
fillSlot: (slotId: string, value: VoicePathwaySlotValue) => void;
|
|
52
|
+
getState: () => VoicePathwayRuntimeState;
|
|
53
|
+
start: () => void;
|
|
54
|
+
subscribe(listener: (event: VoicePathwayRuntimeEvent) => void): () => void;
|
|
55
|
+
tryTransition: () => void;
|
|
56
|
+
};
|
|
57
|
+
export type VoicePathwayRuntime = ReturnType<typeof createVoicePathwayRuntime>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { VoicePathwaySlot, VoicePathwaySlotType } from "./pathway";
|
|
2
|
+
import type { VoicePathwaySlotValue } from "./pathwayRuntime";
|
|
3
|
+
export type VoicePathwaySlotParseResult = {
|
|
4
|
+
ok: true;
|
|
5
|
+
value: VoicePathwaySlotValue;
|
|
6
|
+
normalized: string;
|
|
7
|
+
} | {
|
|
8
|
+
ok: false;
|
|
9
|
+
reason: "empty" | "type-mismatch" | "out-of-range" | "no-match";
|
|
10
|
+
hint?: string;
|
|
11
|
+
};
|
|
12
|
+
export type VoicePathwaySlotParser = (raw: string, slot: VoicePathwaySlot) => VoicePathwaySlotParseResult;
|
|
13
|
+
export declare const DEFAULT_VOICE_PATHWAY_SLOT_PARSERS: Record<VoicePathwaySlotType, VoicePathwaySlotParser>;
|
|
14
|
+
export type CreateVoicePathwaySlotCollectorOptions = {
|
|
15
|
+
parsers?: Partial<Record<VoicePathwaySlotType, VoicePathwaySlotParser>>;
|
|
16
|
+
maxAttemptsPerSlot?: number;
|
|
17
|
+
};
|
|
18
|
+
export type VoicePathwaySlotCollectorAttempt = {
|
|
19
|
+
slotId: string;
|
|
20
|
+
raw: string;
|
|
21
|
+
result: VoicePathwaySlotParseResult;
|
|
22
|
+
attempt: number;
|
|
23
|
+
};
|
|
24
|
+
export declare const createVoicePathwaySlotCollector: (options?: CreateVoicePathwaySlotCollectorOptions) => {
|
|
25
|
+
attemptsExceeded: (slotId: string) => boolean;
|
|
26
|
+
interpret: (slot: VoicePathwaySlot, raw: string) => VoicePathwaySlotCollectorAttempt;
|
|
27
|
+
reset: (slotId?: string) => void;
|
|
28
|
+
};
|
|
29
|
+
export type VoicePathwaySlotCollector = ReturnType<typeof createVoicePathwaySlotCollector>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VoicePathway } from "./pathway";
|
|
2
|
+
export declare const renderVoicePathwayMermaid: (pathway: VoicePathway) => string;
|
|
3
|
+
export declare const renderVoicePathwayText: (pathway: VoicePathway) => string;
|
|
4
|
+
export type VoicePathwayVisualization = {
|
|
5
|
+
mermaid: string;
|
|
6
|
+
text: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const visualizeVoicePathway: (pathway: VoicePathway) => VoicePathwayVisualization;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { VoiceScorecard } from "./callScorecard";
|
|
2
|
+
export type VoiceQualityDriftSeverity = "ok" | "watch" | "regression";
|
|
3
|
+
export type VoiceQualityDriftCriterionAlert = {
|
|
4
|
+
criterionId: string;
|
|
5
|
+
baselineAverage: number;
|
|
6
|
+
currentAverage: number;
|
|
7
|
+
delta: number;
|
|
8
|
+
severity: VoiceQualityDriftSeverity;
|
|
9
|
+
};
|
|
10
|
+
export type VoiceQualityDriftReport = {
|
|
11
|
+
rubricId: string;
|
|
12
|
+
scope: {
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
};
|
|
16
|
+
baselineWindow: {
|
|
17
|
+
from: number;
|
|
18
|
+
to: number;
|
|
19
|
+
sampleSize: number;
|
|
20
|
+
};
|
|
21
|
+
currentWindow: {
|
|
22
|
+
from: number;
|
|
23
|
+
to: number;
|
|
24
|
+
sampleSize: number;
|
|
25
|
+
};
|
|
26
|
+
overall: {
|
|
27
|
+
baselineAverage: number;
|
|
28
|
+
currentAverage: number;
|
|
29
|
+
delta: number;
|
|
30
|
+
severity: VoiceQualityDriftSeverity;
|
|
31
|
+
};
|
|
32
|
+
criteria: VoiceQualityDriftCriterionAlert[];
|
|
33
|
+
alertCount: number;
|
|
34
|
+
};
|
|
35
|
+
export type DetectVoiceQualityDriftInput = {
|
|
36
|
+
rubricId: string;
|
|
37
|
+
scorecards: VoiceScorecard[];
|
|
38
|
+
baselineWindowMs?: number;
|
|
39
|
+
currentWindowMs?: number;
|
|
40
|
+
now?: () => number;
|
|
41
|
+
watchThreshold?: number;
|
|
42
|
+
regressionThreshold?: number;
|
|
43
|
+
};
|
|
44
|
+
export declare const detectVoiceQualityDrift: (input: DetectVoiceQualityDriftInput) => VoiceQualityDriftReport;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { VoiceScorecard } from "./callScorecard";
|
|
2
|
+
export type VoiceScorecardCalibrationPair = {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
human: VoiceScorecard;
|
|
5
|
+
llm: VoiceScorecard;
|
|
6
|
+
};
|
|
7
|
+
export type VoiceScorecardCalibrationDivergence = {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
criterionId: string;
|
|
10
|
+
humanScore: number;
|
|
11
|
+
llmScore: number;
|
|
12
|
+
normalizedGap: number;
|
|
13
|
+
};
|
|
14
|
+
export type VoiceScorecardCalibrationReport = {
|
|
15
|
+
pairsCompared: number;
|
|
16
|
+
meanAbsoluteError: number;
|
|
17
|
+
rootMeanSquareError: number;
|
|
18
|
+
weightedScoreCorrelation: number;
|
|
19
|
+
gradeAgreementRate: number;
|
|
20
|
+
perCriterion: {
|
|
21
|
+
criterionId: string;
|
|
22
|
+
meanAbsoluteError: number;
|
|
23
|
+
averageHumanScore: number;
|
|
24
|
+
averageLLMScore: number;
|
|
25
|
+
bias: number;
|
|
26
|
+
}[];
|
|
27
|
+
worstDivergences: VoiceScorecardCalibrationDivergence[];
|
|
28
|
+
};
|
|
29
|
+
export declare const computeVoiceScorecardCalibration: (pairs: VoiceScorecardCalibrationPair[], options?: {
|
|
30
|
+
topDivergences?: number;
|
|
31
|
+
}) => VoiceScorecardCalibrationReport;
|
|
@@ -53,5 +53,5 @@ export declare const VoiceCostDashboard: import("vue").DefineComponent<import("v
|
|
|
53
53
|
title: string;
|
|
54
54
|
currency: string;
|
|
55
55
|
emptyMessage: string;
|
|
56
|
-
bucketBy: "day" | "
|
|
56
|
+
bucketBy: "day" | "month" | "hour" | undefined;
|
|
57
57
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|