@odin-ai/sdk 1.0.0 → 1.0.1
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 +106 -249
- package/dist/{src/BaseClient.d.ts → BaseClient.d.cts} +21 -2
- package/dist/BaseClient.d.ts +15 -1
- package/dist/BaseClient.d.ts.map +1 -1
- package/dist/{src/ChatSDK.d.ts → ChatSDK.d.cts} +52 -5
- package/dist/ChatSDK.d.ts +49 -3
- package/dist/ChatSDK.d.ts.map +1 -1
- package/dist/{src/SmartTablesSDK.d.ts → SmartTablesSDK.d.cts} +115 -9
- package/dist/SmartTablesSDK.d.ts +29 -7
- package/dist/SmartTablesSDK.d.ts.map +1 -1
- package/dist/VoiceSDK.d.cts +72 -0
- package/dist/VoiceSDK.d.ts +2 -2
- package/dist/VoiceSDK.d.ts.map +1 -1
- package/dist/{index.js → index.cjs} +651 -906
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +644 -900
- package/dist/index.esm.js.map +1 -1
- package/dist/react.cjs +1737 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +3 -0
- package/dist/react.d.ts +4 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.esm.js +1731 -0
- package/dist/react.esm.js.map +1 -0
- package/dist/resumableTurnStream.d.cts +57 -0
- package/dist/resumableTurnStream.d.ts +58 -0
- package/dist/resumableTurnStream.d.ts.map +1 -0
- package/dist/{src/types.d.ts → types.d.cts} +109 -111
- package/dist/types.d.ts +89 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/useVoiceConversation.d.cts +33 -0
- package/dist/useVoiceConversation.d.ts +5 -5
- package/dist/useVoiceConversation.d.ts.map +1 -1
- package/dist/voice-types.d.cts +168 -0
- package/dist/voice-types.d.ts +7 -7
- package/dist/voice-types.d.ts.map +1 -1
- package/package.json +53 -26
- package/LICENSE +0 -21
- package/dist/WorkflowSDK.d.ts +0 -188
- package/dist/WorkflowSDK.d.ts.map +0 -1
- package/dist/examples/basic-chat.d.ts +0 -2
- package/dist/examples/basic-chat.d.ts.map +0 -1
- package/dist/examples/react-integration.d.ts +0 -7
- package/dist/examples/react-integration.d.ts.map +0 -1
- package/dist/examples/smart-tables-basic.d.ts +0 -2
- package/dist/examples/smart-tables-basic.d.ts.map +0 -1
- package/dist/examples/smart-tables-comprehensive.d.ts +0 -2
- package/dist/examples/smart-tables-comprehensive.d.ts.map +0 -1
- package/dist/examples/smart-tables-demo.d.ts +0 -2
- package/dist/examples/smart-tables-demo.d.ts.map +0 -1
- package/dist/examples/smart-tables-import.d.ts +0 -2
- package/dist/examples/smart-tables-import.d.ts.map +0 -1
- package/dist/examples/streaming-chat.d.ts +0 -2
- package/dist/examples/streaming-chat.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/src/BaseClient.d.ts.map +0 -1
- package/dist/src/ChatSDK.d.ts.map +0 -1
- package/dist/src/SmartTablesSDK.d.ts.map +0 -1
- package/dist/src/components/MessageBubble.d.ts +0 -24
- package/dist/src/components/MessageBubble.d.ts.map +0 -1
- package/dist/src/components/MessageList.d.ts +0 -28
- package/dist/src/components/MessageList.d.ts.map +0 -1
- package/dist/src/components/index.d.ts +0 -4
- package/dist/src/components/index.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -10
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/workflow-types.d.ts +0 -431
- package/dist/workflow-types.d.ts.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseClientConfig } from
|
|
1
|
+
import { BaseClientConfig } from "./BaseClient.js";
|
|
2
2
|
/**
|
|
3
3
|
* Configuration for the Chat SDK
|
|
4
4
|
*
|
|
@@ -30,6 +30,10 @@ export interface Chat {
|
|
|
30
30
|
created_by: string;
|
|
31
31
|
/** Type of agent used in this chat */
|
|
32
32
|
agent_type?: string;
|
|
33
|
+
/** Whether a chat turn is running in this chat right now, from any client */
|
|
34
|
+
is_running?: boolean;
|
|
35
|
+
/** Message id of the turn running in this chat, when there is one */
|
|
36
|
+
running_message_id?: string | null;
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
39
|
* File metadata for uploaded files
|
|
@@ -110,6 +114,8 @@ export interface Message {
|
|
|
110
114
|
advanced_context_query_metadata?: {
|
|
111
115
|
intent?: string;
|
|
112
116
|
};
|
|
117
|
+
/** Request-scoped metadata persisted with this message. */
|
|
118
|
+
request_metadata?: Record<string, any>;
|
|
113
119
|
}
|
|
114
120
|
/**
|
|
115
121
|
* Options for sending a message
|
|
@@ -117,8 +123,16 @@ export interface Message {
|
|
|
117
123
|
export interface SendMessageOptions {
|
|
118
124
|
/** Chat ID to send the message to (if not provided, creates a new chat) */
|
|
119
125
|
chatId?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Idempotency key for this message. Sends with the same key from the same
|
|
128
|
+
* user (retries, or several tabs) all attach to the one turn the first
|
|
129
|
+
* started. Generated per call when omitted.
|
|
130
|
+
*/
|
|
131
|
+
clientTurnId?: string;
|
|
132
|
+
/** Target project ID to operate on (if different from the current project) */
|
|
133
|
+
targetProjectId?: string;
|
|
120
134
|
/** Type of agent to use */
|
|
121
|
-
agentType?:
|
|
135
|
+
agentType?: "chat_agent" | "document_agent" | "meeting_agent" | "app_builder_agent" | "data_view_agent";
|
|
122
136
|
/** Specific agent ID to use */
|
|
123
137
|
agentId?: string;
|
|
124
138
|
/** Document keys for knowledge base context */
|
|
@@ -145,11 +159,19 @@ export interface SendMessageOptions {
|
|
|
145
159
|
exampleJson?: string;
|
|
146
160
|
/** Whether to skip streaming */
|
|
147
161
|
skipStream?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Lifecycle environment to serve the agent from ("test" or "live").
|
|
164
|
+
* Defaults to "live" on the server. Set to "test" to run against the
|
|
165
|
+
* Test-pinned version (used by the agent editor's Test chat).
|
|
166
|
+
*/
|
|
167
|
+
environment?: string;
|
|
148
168
|
}
|
|
149
169
|
/**
|
|
150
170
|
* Callbacks for streaming message responses
|
|
151
171
|
*/
|
|
152
172
|
export interface StreamCallbacks {
|
|
173
|
+
/** Called once the HTTP response is accepted, before reading its body. */
|
|
174
|
+
onResponseAccepted?: () => void;
|
|
153
175
|
/** Called when streaming begins with the actual message ID */
|
|
154
176
|
onStart?: (messageId: string) => void;
|
|
155
177
|
/** Called when chat_id and message_id are provided via a dedicated streaming tag */
|
|
@@ -159,6 +181,12 @@ export interface StreamCallbacks {
|
|
|
159
181
|
}) => void;
|
|
160
182
|
/** Called when a text chunk is received */
|
|
161
183
|
onChunk?: (chunk: string) => void;
|
|
184
|
+
/**
|
|
185
|
+
* Called when streamed text is taken back: a model call failed partway and
|
|
186
|
+
* is being retried, so `text` (the tail of what onChunk delivered) must be
|
|
187
|
+
* removed before the retry's text arrives
|
|
188
|
+
*/
|
|
189
|
+
onDiscard?: (text: string) => void;
|
|
162
190
|
/** Called when a structured message object is received */
|
|
163
191
|
onMessageObject?: (messageObject: any) => void;
|
|
164
192
|
/** Called when the message is complete */
|
|
@@ -173,6 +201,52 @@ export interface StreamCallbacks {
|
|
|
173
201
|
onDocumentEventReceived?: (event: any) => void;
|
|
174
202
|
/** Called when the message ends (msmro signal) */
|
|
175
203
|
onMessageEnd?: () => void;
|
|
204
|
+
/**
|
|
205
|
+
* Called with how the turn ended: "completed", "failed", "cancelled", or
|
|
206
|
+
* "interrupted" (the server handling it went away before it finished).
|
|
207
|
+
* An interrupted turn the server resumes on its own carries `resumedBy`,
|
|
208
|
+
* the message id of the turn continuing it, which `resumeTurnStream` can
|
|
209
|
+
* attach to.
|
|
210
|
+
*/
|
|
211
|
+
onTurnStatus?: (status: string, details?: {
|
|
212
|
+
resumedBy?: string;
|
|
213
|
+
}) => void;
|
|
214
|
+
/** Called before each attempt to reconnect a dropped stream */
|
|
215
|
+
onReconnect?: (attempt: number, fromSeq: number) => void;
|
|
216
|
+
/**
|
|
217
|
+
* Called whenever anything arrives on the stream, including the keepalives
|
|
218
|
+
* the server sends every 15s while the model or a tool is still working
|
|
219
|
+
*/
|
|
220
|
+
onActivity?: () => void;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Status of a streamed chat turn (GET /v4/chat/message/{id}/turn)
|
|
224
|
+
*/
|
|
225
|
+
export interface TurnStatusResponse {
|
|
226
|
+
message_id: string;
|
|
227
|
+
chat_id: string | null;
|
|
228
|
+
status: "active" | "completed" | "failed" | "cancelled" | "interrupted";
|
|
229
|
+
last_seq: number;
|
|
230
|
+
started_at: number | null;
|
|
231
|
+
heartbeat_age_s: number | null;
|
|
232
|
+
/** Message id of the turn the server started to continue this one */
|
|
233
|
+
resumed_by?: string | null;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* A chat with a turn running right now (GET /v4/chat/turns/running)
|
|
237
|
+
*/
|
|
238
|
+
export interface RunningChat {
|
|
239
|
+
chat_id: string;
|
|
240
|
+
message_id: string;
|
|
241
|
+
status: "active" | "completed" | "failed" | "cancelled" | "interrupted";
|
|
242
|
+
started_at: number | null;
|
|
243
|
+
heartbeat_age_s: number | null;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Response from listing the chats with a running turn
|
|
247
|
+
*/
|
|
248
|
+
export interface ListRunningChatsResponse {
|
|
249
|
+
chats: RunningChat[];
|
|
176
250
|
}
|
|
177
251
|
/**
|
|
178
252
|
* Response from creating a chat
|
|
@@ -215,6 +289,17 @@ export interface ListChatsResponse {
|
|
|
215
289
|
/** Whether there are more chats to fetch */
|
|
216
290
|
has_more: boolean;
|
|
217
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Result of a revalidated chat-list request. `notModified` means the page the
|
|
294
|
+
* caller sent the ETag for is still current and there is no body to read.
|
|
295
|
+
*/
|
|
296
|
+
export type ChatListConditionalResult = {
|
|
297
|
+
notModified: true;
|
|
298
|
+
} | {
|
|
299
|
+
notModified: false;
|
|
300
|
+
data: ListChatsResponse;
|
|
301
|
+
etag: string | null;
|
|
302
|
+
};
|
|
218
303
|
/**
|
|
219
304
|
* Response from getting chat history
|
|
220
305
|
*/
|
|
@@ -254,9 +339,9 @@ export interface APIError {
|
|
|
254
339
|
/**
|
|
255
340
|
* Agent types supported by the system
|
|
256
341
|
*/
|
|
257
|
-
export type AgentType =
|
|
342
|
+
export type AgentType = "chat_agent" | "document_agent" | "meeting_agent" | "app_builder_agent" | "data_view_agent";
|
|
258
343
|
/**
|
|
259
344
|
* Model names supported by the system
|
|
260
345
|
*/
|
|
261
|
-
export type ModelName =
|
|
346
|
+
export type ModelName = "gpt-4o" | "gpt-4o-mini" | "gpt-4" | "gpt-3.5-turbo" | "claude-3-opus" | "claude-3-sonnet" | "claude-3-haiku";
|
|
262
347
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,WAAW,aAAc,SAAQ,gBAAgB;CAAG;AAE1D;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB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,EAAE,OAAO,EAAE,CAAC;IACrB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,mBAAmB,CAAC,EAAE,YAAY,EAAE,CAAC;IACrC,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,YAAY,GACZ,gBAAgB,GAChB,eAAe,GACf,mBAAmB,GACnB,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,aAAa,GACb,OAAO,GACP,eAAe,GACf,eAAe,GACf,iBAAiB,GACjB,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { VoiceHookOptions, VoiceConversationState, VoiceSessionConfig, VoiceSDKConfig } from "./voice-types.cjs";
|
|
2
|
+
import { VoiceSDK } from "./VoiceSDK.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Enhanced useVoiceConversation hook with our SDK's chat integration and session management
|
|
5
|
+
*/
|
|
6
|
+
export declare function useVoiceConversation(options?: VoiceHookOptions): {
|
|
7
|
+
startSession: (config?: VoiceSessionConfig & {
|
|
8
|
+
sdkConfig?: VoiceSDKConfig;
|
|
9
|
+
}) => Promise<string>;
|
|
10
|
+
endSession: () => Promise<void>;
|
|
11
|
+
setVolume: ({ volume }: {
|
|
12
|
+
volume: number;
|
|
13
|
+
}) => void;
|
|
14
|
+
getInputByteFrequencyData: () => Uint8Array<ArrayBuffer>;
|
|
15
|
+
getOutputByteFrequencyData: () => Uint8Array<ArrayBuffer>;
|
|
16
|
+
getInputVolume: () => number;
|
|
17
|
+
getOutputVolume: () => number;
|
|
18
|
+
sendContextualUpdate: (text: string) => void;
|
|
19
|
+
sendUserMessage: (text: string) => void;
|
|
20
|
+
sendUserActivity: () => void;
|
|
21
|
+
sendMCPToolApprovalResult: (toolCallId: string, isApproved: boolean) => void;
|
|
22
|
+
sendFeedback: (like: boolean) => void;
|
|
23
|
+
canSendFeedback: boolean;
|
|
24
|
+
status: import("@elevenlabs/react", { with: { "resolution-mode": "import" } }).Status;
|
|
25
|
+
micMuted: boolean;
|
|
26
|
+
isSpeaking: boolean;
|
|
27
|
+
getId: () => string | undefined;
|
|
28
|
+
currentSessionId: string;
|
|
29
|
+
conversationState: VoiceConversationState;
|
|
30
|
+
getConversationHistory: () => import("./voice-types.cjs").VoiceMessage[];
|
|
31
|
+
getVoiceState: () => VoiceConversationState;
|
|
32
|
+
voiceSDK: VoiceSDK;
|
|
33
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { VoiceHookOptions, VoiceConversationState, VoiceSessionConfig, VoiceSDKConfig } from
|
|
2
|
-
import { VoiceSDK } from
|
|
1
|
+
import type { VoiceHookOptions, VoiceConversationState, VoiceSessionConfig, VoiceSDKConfig } from "./voice-types.js";
|
|
2
|
+
import { VoiceSDK } from "./VoiceSDK.js";
|
|
3
3
|
/**
|
|
4
4
|
* Enhanced useVoiceConversation hook with our SDK's chat integration and session management
|
|
5
5
|
*/
|
|
@@ -11,8 +11,8 @@ export declare function useVoiceConversation(options?: VoiceHookOptions): {
|
|
|
11
11
|
setVolume: ({ volume }: {
|
|
12
12
|
volume: number;
|
|
13
13
|
}) => void;
|
|
14
|
-
getInputByteFrequencyData: () => Uint8Array<
|
|
15
|
-
getOutputByteFrequencyData: () => Uint8Array<
|
|
14
|
+
getInputByteFrequencyData: () => Uint8Array<ArrayBuffer>;
|
|
15
|
+
getOutputByteFrequencyData: () => Uint8Array<ArrayBuffer>;
|
|
16
16
|
getInputVolume: () => number;
|
|
17
17
|
getOutputVolume: () => number;
|
|
18
18
|
sendContextualUpdate: (text: string) => void;
|
|
@@ -27,7 +27,7 @@ export declare function useVoiceConversation(options?: VoiceHookOptions): {
|
|
|
27
27
|
getId: () => string | undefined;
|
|
28
28
|
currentSessionId: string;
|
|
29
29
|
conversationState: VoiceConversationState;
|
|
30
|
-
getConversationHistory: () => import("./voice-types").VoiceMessage[];
|
|
30
|
+
getConversationHistory: () => import("./voice-types.js").VoiceMessage[];
|
|
31
31
|
getVoiceState: () => VoiceConversationState;
|
|
32
32
|
voiceSDK: VoiceSDK;
|
|
33
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceConversation.d.ts","sourceRoot":"","sources":["../src/useVoiceConversation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAElB,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,gBAAqB;
|
|
1
|
+
{"version":3,"file":"useVoiceConversation.d.ts","sourceRoot":"","sources":["../src/useVoiceConversation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAElB,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,gBAAqB;4BAkH/C,kBAAkB,GAAG;QAAE,SAAS,CAAC,EAAE,cAAc,CAAA;KAAE;;4BAyDtD;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;;;;;iCAgFxB,MAAM;;;;;;;;;;;;;;;EAgFhB"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { SessionConfig, HookOptions as ElevenLabsHookOptions, ControlledState as ElevenLabsControlledState, HookCallbacks as ElevenLabsHookCallbacks, Status } from "@elevenlabs/react" with { "resolution-mode": "import" };
|
|
2
|
+
import { BaseClientConfig } from "./BaseClient.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the Voice SDK
|
|
5
|
+
* Extends base client config with ElevenLabs-specific options
|
|
6
|
+
*/
|
|
7
|
+
export interface VoiceSDKConfig extends BaseClientConfig {
|
|
8
|
+
/** Agent ID for the voice conversation */
|
|
9
|
+
agentId?: string;
|
|
10
|
+
/** Default voice settings */
|
|
11
|
+
defaultVoiceSettings?: VoiceSettings;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Voice settings configuration
|
|
15
|
+
*/
|
|
16
|
+
export interface VoiceSettings {
|
|
17
|
+
/** Voice stability (0.0 to 1.0) */
|
|
18
|
+
stability?: number;
|
|
19
|
+
/** Voice similarity boost (0.0 to 1.0) */
|
|
20
|
+
similarityBoost?: number;
|
|
21
|
+
/** Voice style (0.0 to 1.0) */
|
|
22
|
+
style?: number;
|
|
23
|
+
/** Speaker boost flag */
|
|
24
|
+
useSpeakerBoost?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Voice session configuration
|
|
28
|
+
* Wraps ElevenLabs SessionConfig with additional customization
|
|
29
|
+
*/
|
|
30
|
+
export interface VoiceSessionConfig extends Omit<SessionConfig, "agentId"> {
|
|
31
|
+
/** Agent ID override for this session */
|
|
32
|
+
agentId?: string;
|
|
33
|
+
/** Custom instructions for the voice agent */
|
|
34
|
+
customInstructions?: string;
|
|
35
|
+
/** Context from your chat system */
|
|
36
|
+
chatContext?: {
|
|
37
|
+
chatId?: string;
|
|
38
|
+
recentMessages?: Array<{
|
|
39
|
+
role: "user" | "assistant";
|
|
40
|
+
content: string;
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
/** Voice-specific settings */
|
|
44
|
+
voiceSettings?: VoiceSettings;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Voice conversation state management
|
|
48
|
+
*/
|
|
49
|
+
export interface VoiceConversationState extends ElevenLabsControlledState {
|
|
50
|
+
/** Current session ID */
|
|
51
|
+
sessionId?: string;
|
|
52
|
+
/** Whether the conversation is active */
|
|
53
|
+
isActive: boolean;
|
|
54
|
+
/** Connection status */
|
|
55
|
+
connectionStatus: Status;
|
|
56
|
+
/** Current volume level (0-100) */
|
|
57
|
+
volume: number;
|
|
58
|
+
/** Whether microphone is muted */
|
|
59
|
+
micMuted: boolean;
|
|
60
|
+
/** Whether AI is currently speaking */
|
|
61
|
+
isSpeaking: boolean;
|
|
62
|
+
/** Audio visualization data */
|
|
63
|
+
audioData?: {
|
|
64
|
+
inputFrequencyData?: Uint8Array;
|
|
65
|
+
outputFrequencyData?: Uint8Array;
|
|
66
|
+
inputVolume?: number;
|
|
67
|
+
outputVolume?: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Voice conversation callbacks
|
|
72
|
+
* Extends ElevenLabs callbacks with SDK-specific events
|
|
73
|
+
*/
|
|
74
|
+
export interface VoiceConversationCallbacks extends ElevenLabsHookCallbacks {
|
|
75
|
+
/** Called when voice session starts */
|
|
76
|
+
onSessionStart?: (sessionId: string) => void;
|
|
77
|
+
/** Called when voice session ends */
|
|
78
|
+
onSessionEnd?: (reason?: string) => void;
|
|
79
|
+
/** Called when voice state changes */
|
|
80
|
+
onStateChange?: (state: VoiceConversationState) => void;
|
|
81
|
+
/** Called when conversation is saved to chat history */
|
|
82
|
+
onConversationSaved?: (chatId: string, messageId: string) => void;
|
|
83
|
+
/** Called when voice-to-text transcription is available */
|
|
84
|
+
onTranscription?: (text: string, isFinal: boolean) => void;
|
|
85
|
+
/** Called when text-to-speech audio is generated */
|
|
86
|
+
onSpeechGenerated?: (audioUrl: string) => void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Options for starting a voice conversation
|
|
90
|
+
*/
|
|
91
|
+
export interface StartVoiceConversationOptions extends VoiceSessionConfig {
|
|
92
|
+
/** Callbacks for voice events */
|
|
93
|
+
callbacks?: VoiceConversationCallbacks;
|
|
94
|
+
/** Whether to automatically save conversation to chat */
|
|
95
|
+
saveToChat?: boolean;
|
|
96
|
+
/** Existing chat ID to continue conversation */
|
|
97
|
+
existingChatId?: string;
|
|
98
|
+
/** User information for saving messages */
|
|
99
|
+
userInfo?: {
|
|
100
|
+
name: string;
|
|
101
|
+
id: string;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Voice conversation hook options
|
|
106
|
+
* Combines ElevenLabs options with SDK-specific configuration
|
|
107
|
+
*/
|
|
108
|
+
export interface VoiceHookOptions extends Omit<ElevenLabsHookOptions, "agentId"> {
|
|
109
|
+
/** SDK configuration */
|
|
110
|
+
sdkConfig?: VoiceSDKConfig;
|
|
111
|
+
/** Voice session configuration */
|
|
112
|
+
sessionConfig?: VoiceSessionConfig;
|
|
113
|
+
/** Voice conversation callbacks */
|
|
114
|
+
callbacks?: VoiceConversationCallbacks;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Voice message for conversation history
|
|
118
|
+
*/
|
|
119
|
+
export interface VoiceMessage {
|
|
120
|
+
/** Message ID */
|
|
121
|
+
id: string;
|
|
122
|
+
/** Message type */
|
|
123
|
+
type: "user_speech" | "ai_speech" | "system";
|
|
124
|
+
/** Transcribed or generated text */
|
|
125
|
+
text: string;
|
|
126
|
+
/** Audio URL if available */
|
|
127
|
+
audioUrl?: string;
|
|
128
|
+
/** Timestamp */
|
|
129
|
+
timestamp: number;
|
|
130
|
+
/** Duration in seconds */
|
|
131
|
+
duration?: number;
|
|
132
|
+
/** Voice settings used */
|
|
133
|
+
voiceSettings?: VoiceSettings;
|
|
134
|
+
/** Whether this message has been saved to the database */
|
|
135
|
+
saved?: boolean;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Voice conversation session
|
|
139
|
+
*/
|
|
140
|
+
export interface VoiceConversationSession {
|
|
141
|
+
/** Session ID */
|
|
142
|
+
id: string;
|
|
143
|
+
/** Associated chat ID */
|
|
144
|
+
chatId?: string;
|
|
145
|
+
/** Session start time */
|
|
146
|
+
startTime: number;
|
|
147
|
+
/** Session end time */
|
|
148
|
+
endTime?: number;
|
|
149
|
+
/** Messages in this voice session */
|
|
150
|
+
messages: VoiceMessage[];
|
|
151
|
+
/** Session metadata */
|
|
152
|
+
metadata?: {
|
|
153
|
+
agentId?: string;
|
|
154
|
+
agentName?: string;
|
|
155
|
+
voiceSettings?: VoiceSettings;
|
|
156
|
+
totalDuration?: number;
|
|
157
|
+
averageResponseTime?: number;
|
|
158
|
+
userInfo?: {
|
|
159
|
+
name: string;
|
|
160
|
+
id: string;
|
|
161
|
+
};
|
|
162
|
+
enhancedCallbacks?: any;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Re-export commonly used ElevenLabs types
|
|
167
|
+
*/
|
|
168
|
+
export type { Status as VoiceStatus, Role as VoiceRole, Mode as VoiceMode, Language as VoiceLanguage, DisconnectionDetails as VoiceDisconnectionDetails, } from "@elevenlabs/react" with { "resolution-mode": "import" };
|
package/dist/voice-types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SessionConfig, HookOptions as ElevenLabsHookOptions, ControlledState as ElevenLabsControlledState, HookCallbacks as ElevenLabsHookCallbacks, Status } from
|
|
2
|
-
import { BaseClientConfig } from
|
|
1
|
+
import type { SessionConfig, HookOptions as ElevenLabsHookOptions, ControlledState as ElevenLabsControlledState, HookCallbacks as ElevenLabsHookCallbacks, Status } from "@elevenlabs/react";
|
|
2
|
+
import { BaseClientConfig } from "./BaseClient.js";
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for the Voice SDK
|
|
5
5
|
* Extends base client config with ElevenLabs-specific options
|
|
@@ -27,7 +27,7 @@ export interface VoiceSettings {
|
|
|
27
27
|
* Voice session configuration
|
|
28
28
|
* Wraps ElevenLabs SessionConfig with additional customization
|
|
29
29
|
*/
|
|
30
|
-
export interface VoiceSessionConfig extends Omit<SessionConfig,
|
|
30
|
+
export interface VoiceSessionConfig extends Omit<SessionConfig, "agentId"> {
|
|
31
31
|
/** Agent ID override for this session */
|
|
32
32
|
agentId?: string;
|
|
33
33
|
/** Custom instructions for the voice agent */
|
|
@@ -36,7 +36,7 @@ export interface VoiceSessionConfig extends Omit<SessionConfig, 'agentId'> {
|
|
|
36
36
|
chatContext?: {
|
|
37
37
|
chatId?: string;
|
|
38
38
|
recentMessages?: Array<{
|
|
39
|
-
role:
|
|
39
|
+
role: "user" | "assistant";
|
|
40
40
|
content: string;
|
|
41
41
|
}>;
|
|
42
42
|
};
|
|
@@ -105,7 +105,7 @@ export interface StartVoiceConversationOptions extends VoiceSessionConfig {
|
|
|
105
105
|
* Voice conversation hook options
|
|
106
106
|
* Combines ElevenLabs options with SDK-specific configuration
|
|
107
107
|
*/
|
|
108
|
-
export interface VoiceHookOptions extends Omit<ElevenLabsHookOptions,
|
|
108
|
+
export interface VoiceHookOptions extends Omit<ElevenLabsHookOptions, "agentId"> {
|
|
109
109
|
/** SDK configuration */
|
|
110
110
|
sdkConfig?: VoiceSDKConfig;
|
|
111
111
|
/** Voice session configuration */
|
|
@@ -120,7 +120,7 @@ export interface VoiceMessage {
|
|
|
120
120
|
/** Message ID */
|
|
121
121
|
id: string;
|
|
122
122
|
/** Message type */
|
|
123
|
-
type:
|
|
123
|
+
type: "user_speech" | "ai_speech" | "system";
|
|
124
124
|
/** Transcribed or generated text */
|
|
125
125
|
text: string;
|
|
126
126
|
/** Audio URL if available */
|
|
@@ -165,5 +165,5 @@ export interface VoiceConversationSession {
|
|
|
165
165
|
/**
|
|
166
166
|
* Re-export commonly used ElevenLabs types
|
|
167
167
|
*/
|
|
168
|
-
export type { Status as VoiceStatus, Role as VoiceRole, Mode as VoiceMode, Language as VoiceLanguage, DisconnectionDetails as VoiceDisconnectionDetails } from
|
|
168
|
+
export type { Status as VoiceStatus, Role as VoiceRole, Mode as VoiceMode, Language as VoiceLanguage, DisconnectionDetails as VoiceDisconnectionDetails, } from "@elevenlabs/react";
|
|
169
169
|
//# sourceMappingURL=voice-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-types.d.ts","sourceRoot":"","sources":["../src/voice-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,IAAI,qBAAqB,EACpC,eAAe,IAAI,yBAAyB,EAC5C,aAAa,IAAI,uBAAuB,EACxC,MAAM,EAKP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,oBAAoB,CAAC,EAAE,aAAa,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC;IACxE,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oCAAoC;IACpC,WAAW,CAAC,EAA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,MAAM,CAAC;IAClB,0BAA0B;IAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,0DAA0D;IAC1D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,uBAAuB;IACvB,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,EAAE;YACT,IAAI,EAAE,MAAM,CAAC;YACb,EAAE,EAAE,MAAM,CAAC;SACZ,CAAC;QACF,iBAAiB,CAAC,EAAE,GAAG,CAAC;KACzB,CAAC;CACH;AAED;;GAEG;AACH,YAAY,EACV,MAAM,IAAI,WAAW,EACrB,IAAI,IAAI,SAAS,EACjB,IAAI,IAAI,SAAS,EACjB,QAAQ,IAAI,aAAa,EACzB,oBAAoB,IAAI,yBAAyB,GAClD,MAAM,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,76 +1,103 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odin-ai/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript SDK for Odin AI - Chat, Workflows, Smart Tables, and Voice",
|
|
6
|
-
"main": "dist/index.
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.esm.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"./react": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/react.d.ts",
|
|
23
|
+
"default": "./dist/react.esm.js"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/react.d.cts",
|
|
27
|
+
"default": "./dist/react.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
9
32
|
"files": [
|
|
10
33
|
"dist",
|
|
11
34
|
"README.md",
|
|
12
35
|
"LICENSE"
|
|
13
36
|
],
|
|
14
37
|
"scripts": {
|
|
15
|
-
"build": "rollup -c",
|
|
38
|
+
"build": "rm -rf dist && npm run build:types && rollup -c && node scripts/postprocess-types.mjs",
|
|
39
|
+
"build:types": "tsc -p tsconfig.build.json --noCheck",
|
|
16
40
|
"build:watch": "rollup -c -w",
|
|
17
|
-
"test": "
|
|
18
|
-
"test:watch": "
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"test:watch": "vitest",
|
|
19
43
|
"lint": "eslint src --ext .ts",
|
|
20
44
|
"lint:fix": "eslint src --ext .ts --fix",
|
|
21
45
|
"type-check": "tsc --noEmit",
|
|
22
|
-
"
|
|
46
|
+
"verify:package": "node scripts/verify-package.mjs",
|
|
47
|
+
"prepublishOnly": "npm run build && npm run verify:package",
|
|
23
48
|
"example:basic": "npx tsx examples/basic-chat.ts",
|
|
24
49
|
"example:streaming": "npx tsx examples/streaming-chat.ts",
|
|
25
50
|
"example:voice": "npx tsx examples/voice-chat.ts"
|
|
26
51
|
},
|
|
27
52
|
"keywords": [
|
|
28
|
-
"
|
|
53
|
+
"chat",
|
|
29
54
|
"ai",
|
|
30
55
|
"sdk",
|
|
31
56
|
"typescript",
|
|
32
|
-
"chat",
|
|
33
|
-
"workflow",
|
|
34
|
-
"automation",
|
|
35
57
|
"streaming",
|
|
36
|
-
"sse",
|
|
37
58
|
"api",
|
|
38
59
|
"voice",
|
|
39
|
-
"
|
|
60
|
+
"elevenlabs",
|
|
61
|
+
"speech"
|
|
40
62
|
],
|
|
41
|
-
"author": "Odin AI
|
|
63
|
+
"author": "Odin AI",
|
|
42
64
|
"license": "MIT",
|
|
43
65
|
"repository": {
|
|
44
66
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/
|
|
67
|
+
"url": "git+https://github.com/CodeGlo/alignment-project-server.git",
|
|
68
|
+
"directory": "web/sdk"
|
|
46
69
|
},
|
|
47
70
|
"bugs": {
|
|
48
|
-
"url": "https://github.com/
|
|
71
|
+
"url": "https://github.com/CodeGlo/alignment-project-server/issues"
|
|
49
72
|
},
|
|
50
|
-
"homepage": "https://
|
|
73
|
+
"homepage": "https://github.com/CodeGlo/alignment-project-server/tree/dev/web/sdk#readme",
|
|
51
74
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@types/node": "^
|
|
75
|
+
"@rollup/plugin-typescript": "^12.3.1",
|
|
76
|
+
"@types/node": "^22.10.0",
|
|
54
77
|
"@types/react": "^18.0.0",
|
|
55
78
|
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
|
56
79
|
"@typescript-eslint/parser": "^5.57.0",
|
|
80
|
+
"dotenv": "^16.0.3",
|
|
57
81
|
"eslint": "^8.37.0",
|
|
58
|
-
"jest": "^29.5.0",
|
|
59
82
|
"rollup": "^3.20.0",
|
|
60
|
-
"rollup-plugin-typescript2": "^0.34.1",
|
|
61
|
-
"ts-jest": "^29.1.0",
|
|
62
83
|
"ts-node": "^10.9.0",
|
|
84
|
+
"tslib": "^2.9.1",
|
|
63
85
|
"tsx": "^4.20.2",
|
|
64
|
-
"typescript": "^5.
|
|
65
|
-
"
|
|
86
|
+
"typescript": "^5.9.3",
|
|
87
|
+
"vitest": "^5.0.3"
|
|
66
88
|
},
|
|
67
89
|
"dependencies": {
|
|
68
|
-
"@elevenlabs/client": "^0.12.
|
|
90
|
+
"@elevenlabs/client": "^0.12.2",
|
|
69
91
|
"@elevenlabs/react": "^0.12.3"
|
|
70
92
|
},
|
|
71
93
|
"peerDependencies": {
|
|
72
|
-
"
|
|
73
|
-
"
|
|
94
|
+
"react": ">=16.8.0",
|
|
95
|
+
"typescript": ">=4.0.0"
|
|
96
|
+
},
|
|
97
|
+
"peerDependenciesMeta": {
|
|
98
|
+
"react": {
|
|
99
|
+
"optional": true
|
|
100
|
+
}
|
|
74
101
|
},
|
|
75
102
|
"engines": {
|
|
76
103
|
"node": ">=14.0.0"
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Odin AI
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|