@voicelayer/sdk 0.4.1 → 0.5.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 +45 -9
- package/dist/brain/index.d.ts +3 -47
- package/dist/brain/index.js +113 -5
- package/dist/index.d.ts +162 -742
- package/dist/index.js +1548 -291
- package/dist/runtime/text-session.d.ts +2 -1
- package/dist/runtime/text-session.js +1221 -180
- package/dist/{text-session-BB0dLLH2.d.ts → text-session-Bf4Jni7H.d.ts} +1038 -4
- package/dist/types-KqrAfY85.d.ts +47 -0
- package/package.json +4 -4
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
interface BrainMessage {
|
|
2
|
+
readonly role: 'system' | 'user' | 'assistant';
|
|
3
|
+
readonly content: string;
|
|
4
|
+
}
|
|
5
|
+
interface BrainCallMetadata {
|
|
6
|
+
readonly channel: 'voice' | 'text';
|
|
7
|
+
readonly callId?: string;
|
|
8
|
+
readonly projectId?: string;
|
|
9
|
+
}
|
|
10
|
+
interface BrainRequest {
|
|
11
|
+
readonly messages: readonly BrainMessage[];
|
|
12
|
+
/** Upstream model id / alias. Omitted → the brain's own default. */
|
|
13
|
+
readonly model?: string;
|
|
14
|
+
readonly temperature?: number;
|
|
15
|
+
readonly metadata: BrainCallMetadata;
|
|
16
|
+
}
|
|
17
|
+
/** One streamed piece of the brain's reply. */
|
|
18
|
+
interface BrainChunk {
|
|
19
|
+
readonly content?: string;
|
|
20
|
+
}
|
|
21
|
+
interface BrainCapabilities {
|
|
22
|
+
readonly reachable: boolean;
|
|
23
|
+
readonly streaming: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface BrainTransport {
|
|
26
|
+
readonly kind: 'callback' | 'http' | 'tunnel';
|
|
27
|
+
/** Stream the reply token-by-token (the voice path: first sentence → TTS ASAP). */
|
|
28
|
+
stream(req: BrainRequest, signal: AbortSignal): AsyncIterable<BrainChunk>;
|
|
29
|
+
/** Non-streaming convenience (the text path). */
|
|
30
|
+
complete(req: BrainRequest, signal: AbortSignal): Promise<string>;
|
|
31
|
+
}
|
|
32
|
+
/** Context handed to a customer's in-process `onQuery` brain. */
|
|
33
|
+
interface OnQueryContext {
|
|
34
|
+
/** Full conversation so far (system + prior turns + latest user message). */
|
|
35
|
+
readonly messages: readonly BrainMessage[];
|
|
36
|
+
/** Aborts when the caller barges in / the turn is cancelled. */
|
|
37
|
+
readonly signal: AbortSignal;
|
|
38
|
+
}
|
|
39
|
+
type OnQueryResult = string | AsyncIterable<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Bring-your-own brain, in-process. Receives the latest user utterance (and the
|
|
42
|
+
* full history via `ctx.messages`) and returns the reply — either a string or an
|
|
43
|
+
* async-iterable of string pieces for token streaming.
|
|
44
|
+
*/
|
|
45
|
+
type OnQuery = (text: string, ctx: OnQueryContext) => OnQueryResult | Promise<OnQueryResult>;
|
|
46
|
+
|
|
47
|
+
export type { BrainTransport as B, OnQuery as O, BrainCallMetadata as a, BrainCapabilities as b, BrainChunk as c, BrainMessage as d, BrainRequest as e, OnQueryContext as f, OnQueryResult as g };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voicelayer/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Official SDK for VoiceLayer — define, run, and orchestrate voice AI agents on the VoiceLayer control plane.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "VoiceLayer",
|
|
@@ -80,15 +80,15 @@
|
|
|
80
80
|
"vitest": "^4.1.5",
|
|
81
81
|
"@voicelayer/contracts": "0.1.0",
|
|
82
82
|
"@voicelayer/llm-client": "0.1.0",
|
|
83
|
+
"@voicelayer/primitive-audio-experience": "0.1.0",
|
|
83
84
|
"@voicelayer/observability": "0.1.0",
|
|
84
85
|
"@voicelayer/primitive-audio-routing": "0.1.0",
|
|
85
|
-
"@voicelayer/primitive-audio-experience": "0.1.0",
|
|
86
86
|
"@voicelayer/primitive-process-schema": "0.1.0",
|
|
87
87
|
"@voicelayer/primitive-security": "0.1.0",
|
|
88
88
|
"@voicelayer/agents-plugin-deepgram": "1.0.1",
|
|
89
|
-
"@voicelayer/agents-plugin-
|
|
89
|
+
"@voicelayer/agents-plugin-livekit": "1.0.1",
|
|
90
90
|
"@voicelayer/agents-plugin-silero": "1.0.1",
|
|
91
|
-
"@voicelayer/agents-plugin-
|
|
91
|
+
"@voicelayer/agents-plugin-openai": "1.0.1"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"typecheck": "tsc -b --pretty false",
|