@inkibra/voice-sdk 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -35
- package/dist/client.d.ts +18 -0
- package/dist/control.d.ts +77 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +804 -538
- package/dist/participant.d.ts +75 -0
- package/dist/public.d.ts +36 -110
- package/dist/server.d.ts +63 -60
- package/dist/server.js +655 -300
- package/dist/session-protocol.d.ts +103 -0
- package/package.json +5 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export type LiveVoiceTaskStatus = "queued" | "running" | "cancel_requested" | "succeeded" | "failed" | "cancelled" | "unknown";
|
|
2
|
+
export type LiveVoiceTaskProgress = {
|
|
3
|
+
message?: string;
|
|
4
|
+
fraction?: number;
|
|
5
|
+
};
|
|
6
|
+
/** Task data is omitted after an operational restart when retaining it would violate zero data retention. */
|
|
7
|
+
export type LiveVoiceTask = {
|
|
8
|
+
taskId: string;
|
|
9
|
+
participantId: string;
|
|
10
|
+
sourceUserTurnId?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
input?: Record<string, unknown>;
|
|
13
|
+
status: LiveVoiceTaskStatus;
|
|
14
|
+
createdAt: number;
|
|
15
|
+
updatedAt: number;
|
|
16
|
+
progress?: LiveVoiceTaskProgress;
|
|
17
|
+
partial?: unknown;
|
|
18
|
+
output?: unknown;
|
|
19
|
+
error?: string;
|
|
20
|
+
};
|
|
21
|
+
export type LiveVoiceCanonicalTurn = {
|
|
22
|
+
id: string;
|
|
23
|
+
role: "user" | "assistant";
|
|
24
|
+
text: string;
|
|
25
|
+
truncated?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type LiveVoiceFloor = {
|
|
28
|
+
owner: "USER" | "ASSISTANT";
|
|
29
|
+
assistantAudible: boolean;
|
|
30
|
+
};
|
|
31
|
+
export type LiveVoiceSnapshot = {
|
|
32
|
+
sessionId: string;
|
|
33
|
+
participantId: string;
|
|
34
|
+
connectionId: string;
|
|
35
|
+
status: "created" | "running" | "suspended" | "stopped";
|
|
36
|
+
sequence: number;
|
|
37
|
+
transcript: {
|
|
38
|
+
turns: LiveVoiceCanonicalTurn[];
|
|
39
|
+
};
|
|
40
|
+
floor: LiveVoiceFloor;
|
|
41
|
+
phase?: string;
|
|
42
|
+
tasks: LiveVoiceTask[];
|
|
43
|
+
};
|
|
44
|
+
export type ToolContext = {
|
|
45
|
+
taskId: string;
|
|
46
|
+
sourceUserTurnId?: string;
|
|
47
|
+
signal: AbortSignal;
|
|
48
|
+
progress(update: LiveVoiceTaskProgress): Promise<void>;
|
|
49
|
+
partial(value: unknown): Promise<void>;
|
|
50
|
+
};
|
|
51
|
+
export type LiveVoiceTool<TInput extends Record<string, unknown> = Record<string, unknown>, TResult = unknown> = {
|
|
52
|
+
description: string;
|
|
53
|
+
parameters: Record<string, unknown>;
|
|
54
|
+
execute(input: TInput, context: ToolContext): TResult | Promise<TResult>;
|
|
55
|
+
};
|
|
56
|
+
export type LiveVoiceTools = Record<string, LiveVoiceTool>;
|
|
57
|
+
export type LiveVoiceFloorState = LiveVoiceFloor;
|
|
58
|
+
export type LiveVoicePhaseEvent = {
|
|
59
|
+
phase: string;
|
|
60
|
+
previousPhase?: string;
|
|
61
|
+
source: "initial" | "floor";
|
|
62
|
+
};
|
|
63
|
+
export type LiveVoicePlatformVoice = "eve" | "ara" | "rex" | "sal" | "leo";
|
|
64
|
+
export type LiveVoiceConversationOptions = {
|
|
65
|
+
prompt?: string;
|
|
66
|
+
starts?: "user" | "assistant";
|
|
67
|
+
phases?: {
|
|
68
|
+
initial: string;
|
|
69
|
+
prompt?: string;
|
|
70
|
+
definitions: Record<string, string>;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export type LiveVoiceEventMap = {
|
|
74
|
+
connection: {
|
|
75
|
+
state: "connecting" | "ready" | "live" | "closed" | "error";
|
|
76
|
+
detail?: string;
|
|
77
|
+
};
|
|
78
|
+
snapshot: LiveVoiceSnapshot;
|
|
79
|
+
"transcript.instantaneous": {
|
|
80
|
+
text: string;
|
|
81
|
+
};
|
|
82
|
+
"transcript.canonical": {
|
|
83
|
+
turns: LiveVoiceCanonicalTurn[];
|
|
84
|
+
};
|
|
85
|
+
floor: LiveVoiceFloor;
|
|
86
|
+
phase: LiveVoicePhaseEvent;
|
|
87
|
+
"quick-reaction": {
|
|
88
|
+
reaction: string;
|
|
89
|
+
status: "prepared" | "playing" | "completed" | "cancelled";
|
|
90
|
+
};
|
|
91
|
+
"task.update": LiveVoiceTask;
|
|
92
|
+
limit: {
|
|
93
|
+
reason: string;
|
|
94
|
+
durationSeconds?: number;
|
|
95
|
+
};
|
|
96
|
+
error: {
|
|
97
|
+
code: string;
|
|
98
|
+
message: string;
|
|
99
|
+
};
|
|
100
|
+
unknown: {
|
|
101
|
+
message: Record<string, unknown>;
|
|
102
|
+
};
|
|
103
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkibra/voice-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Browser and server SDK for Inkibra Live Voice",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": { "type": "git", "url": "git+https://github.com/inKibra/voice-sdk.git", "directory": "packages/voice-sdk" },
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"dist/index.js",
|
|
24
24
|
"dist/index.d.ts",
|
|
25
25
|
"dist/public.d.ts",
|
|
26
|
+
"dist/session-protocol.d.ts",
|
|
27
|
+
"dist/client.d.ts",
|
|
28
|
+
"dist/control.d.ts",
|
|
29
|
+
"dist/participant.d.ts",
|
|
26
30
|
"dist/server.js",
|
|
27
31
|
"dist/server.d.ts"
|
|
28
32
|
],
|