@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChatSDKConfig, SendMessageOptions, StreamCallbacks, CreateChatResponse, SendMessageResponse, ListChatsResponse, ChatHistoryResponse } from
|
|
2
|
-
import { BaseClient
|
|
1
|
+
import { ChatSDKConfig, SendMessageOptions, StreamCallbacks, CreateChatResponse, SendMessageResponse, ChatListConditionalResult, ListChatsResponse, ListRunningChatsResponse, ChatHistoryResponse, TurnStatusResponse } from "./types.cjs";
|
|
2
|
+
import { BaseClient } from "./BaseClient.cjs";
|
|
3
3
|
/**
|
|
4
4
|
* Main SDK class for interacting with the AI Content Creator chat system
|
|
5
5
|
*/
|
|
@@ -9,6 +9,10 @@ export declare class ChatSDK extends BaseClient {
|
|
|
9
9
|
* @param config Configuration object with API credentials and settings
|
|
10
10
|
*/
|
|
11
11
|
constructor(config: ChatSDKConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Get the project ID this SDK is configured for (for use when building requests elsewhere)
|
|
14
|
+
*/
|
|
15
|
+
getProjectId(): string;
|
|
12
16
|
/**
|
|
13
17
|
* Create a new chat in the project
|
|
14
18
|
* @param name Optional name for the chat (defaults to "Untitled")
|
|
@@ -23,6 +27,25 @@ export declare class ChatSDK extends BaseClient {
|
|
|
23
27
|
* @returns Promise resolving to paginated chat list
|
|
24
28
|
*/
|
|
25
29
|
listChats(cursor?: number, limit?: number): Promise<ListChatsResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Like `listChats`, but revalidates a page the caller already holds.
|
|
32
|
+
*
|
|
33
|
+
* Pass the `etag` from the last response for the same cursor and limit. The
|
|
34
|
+
* server answers 304 when the page has not changed, and then there is no
|
|
35
|
+
* body to parse: `notModified` is true and the caller keeps its copy.
|
|
36
|
+
* @returns The fresh page with its ETag, or `notModified: true`
|
|
37
|
+
*/
|
|
38
|
+
listChatsIfChanged(cursor?: number, limit?: number, etag?: string | null): Promise<ChatListConditionalResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Chats in the project with a turn running right now.
|
|
41
|
+
*
|
|
42
|
+
* Unlike the session list a client builds up locally, this includes turns
|
|
43
|
+
* started in another tab or device, or before a reload -- a turn's life is
|
|
44
|
+
* server-side, so this is the only way a client
|
|
45
|
+
* can tell. Poll it only while something is running.
|
|
46
|
+
* @returns Promise resolving to the running chats
|
|
47
|
+
*/
|
|
48
|
+
listRunningChats(): Promise<ListRunningChatsResponse>;
|
|
26
49
|
/**
|
|
27
50
|
* Get a specific chat with its message history
|
|
28
51
|
* @param chatId The ID of the chat to retrieve
|
|
@@ -42,6 +65,10 @@ export declare class ChatSDK extends BaseClient {
|
|
|
42
65
|
* @returns Promise that resolves when the name is updated
|
|
43
66
|
*/
|
|
44
67
|
updateChatName(chatId: string, newName: string): Promise<void>;
|
|
68
|
+
/** Get the current user's starred chat IDs for this project. */
|
|
69
|
+
listStarredChatIds(): Promise<string[]>;
|
|
70
|
+
/** Star or unstar a chat for the current user. */
|
|
71
|
+
setChatStarred(chatId: string, starred: boolean): Promise<void>;
|
|
45
72
|
/**
|
|
46
73
|
* Send a message and get the response
|
|
47
74
|
* @param message The message text to send
|
|
@@ -55,7 +82,24 @@ export declare class ChatSDK extends BaseClient {
|
|
|
55
82
|
* @param options Configuration including streaming callbacks
|
|
56
83
|
* @returns Promise that resolves when streaming is complete
|
|
57
84
|
*/
|
|
58
|
-
sendMessageStream(message: string, options?: SendMessageOptions & StreamCallbacks
|
|
85
|
+
sendMessageStream(message: string, options?: SendMessageOptions & StreamCallbacks & {
|
|
86
|
+
signal?: AbortSignal;
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Status of a streamed turn, so a reloaded page can reattach to one still
|
|
90
|
+
* running. Resolves to null once the turn is no longer resumable.
|
|
91
|
+
*/
|
|
92
|
+
getTurnStatus(messageId: string): Promise<TurnStatusResponse | null>;
|
|
93
|
+
/**
|
|
94
|
+
* Reattach to a turn (e.g. after a page reload) and stream it from the
|
|
95
|
+
* start, with the same callbacks as `sendMessageStream`.
|
|
96
|
+
*/
|
|
97
|
+
resumeTurnStream(messageId: string, options?: StreamCallbacks & {
|
|
98
|
+
signal?: AbortSignal;
|
|
99
|
+
}): Promise<void>;
|
|
100
|
+
private streamHeaders;
|
|
101
|
+
private openTurnStream;
|
|
102
|
+
private consumeTurnStream;
|
|
59
103
|
/**
|
|
60
104
|
* Send user feedback for a message
|
|
61
105
|
* @param messageId The ID of the message to provide feedback for
|
|
@@ -67,6 +111,10 @@ export declare class ChatSDK extends BaseClient {
|
|
|
67
111
|
private messageChunkString;
|
|
68
112
|
private docMessageString;
|
|
69
113
|
private messageInitObject;
|
|
114
|
+
private actionsMap;
|
|
115
|
+
private hasCalledOnStart;
|
|
116
|
+
/** Unfinished tag payload from the previous TCP chunk (JSON split across reads). */
|
|
117
|
+
private streamTagRemainder;
|
|
70
118
|
/**
|
|
71
119
|
* Reset streaming state for a new message
|
|
72
120
|
* @private
|
|
@@ -86,6 +134,5 @@ export declare class ChatSDK extends BaseClient {
|
|
|
86
134
|
* Create an error object from an HTTP response
|
|
87
135
|
* @private
|
|
88
136
|
*/
|
|
89
|
-
protected createErrorFromResponse(response: Response): Promise<
|
|
137
|
+
protected createErrorFromResponse(response: Response): Promise<Error>;
|
|
90
138
|
}
|
|
91
|
-
//# sourceMappingURL=ChatSDK.d.ts.map
|
package/dist/ChatSDK.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChatSDKConfig, SendMessageOptions, StreamCallbacks, CreateChatResponse, SendMessageResponse, ListChatsResponse, ChatHistoryResponse } from "./types";
|
|
2
|
-
import { BaseClient } from "./BaseClient";
|
|
1
|
+
import { ChatSDKConfig, SendMessageOptions, StreamCallbacks, CreateChatResponse, SendMessageResponse, ChatListConditionalResult, ListChatsResponse, ListRunningChatsResponse, ChatHistoryResponse, TurnStatusResponse } from "./types.js";
|
|
2
|
+
import { BaseClient } from "./BaseClient.js";
|
|
3
3
|
/**
|
|
4
4
|
* Main SDK class for interacting with the AI Content Creator chat system
|
|
5
5
|
*/
|
|
@@ -9,6 +9,10 @@ export declare class ChatSDK extends BaseClient {
|
|
|
9
9
|
* @param config Configuration object with API credentials and settings
|
|
10
10
|
*/
|
|
11
11
|
constructor(config: ChatSDKConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Get the project ID this SDK is configured for (for use when building requests elsewhere)
|
|
14
|
+
*/
|
|
15
|
+
getProjectId(): string;
|
|
12
16
|
/**
|
|
13
17
|
* Create a new chat in the project
|
|
14
18
|
* @param name Optional name for the chat (defaults to "Untitled")
|
|
@@ -23,6 +27,25 @@ export declare class ChatSDK extends BaseClient {
|
|
|
23
27
|
* @returns Promise resolving to paginated chat list
|
|
24
28
|
*/
|
|
25
29
|
listChats(cursor?: number, limit?: number): Promise<ListChatsResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Like `listChats`, but revalidates a page the caller already holds.
|
|
32
|
+
*
|
|
33
|
+
* Pass the `etag` from the last response for the same cursor and limit. The
|
|
34
|
+
* server answers 304 when the page has not changed, and then there is no
|
|
35
|
+
* body to parse: `notModified` is true and the caller keeps its copy.
|
|
36
|
+
* @returns The fresh page with its ETag, or `notModified: true`
|
|
37
|
+
*/
|
|
38
|
+
listChatsIfChanged(cursor?: number, limit?: number, etag?: string | null): Promise<ChatListConditionalResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Chats in the project with a turn running right now.
|
|
41
|
+
*
|
|
42
|
+
* Unlike the session list a client builds up locally, this includes turns
|
|
43
|
+
* started in another tab or device, or before a reload -- a turn's life is
|
|
44
|
+
* server-side, so this is the only way a client
|
|
45
|
+
* can tell. Poll it only while something is running.
|
|
46
|
+
* @returns Promise resolving to the running chats
|
|
47
|
+
*/
|
|
48
|
+
listRunningChats(): Promise<ListRunningChatsResponse>;
|
|
26
49
|
/**
|
|
27
50
|
* Get a specific chat with its message history
|
|
28
51
|
* @param chatId The ID of the chat to retrieve
|
|
@@ -42,6 +65,10 @@ export declare class ChatSDK extends BaseClient {
|
|
|
42
65
|
* @returns Promise that resolves when the name is updated
|
|
43
66
|
*/
|
|
44
67
|
updateChatName(chatId: string, newName: string): Promise<void>;
|
|
68
|
+
/** Get the current user's starred chat IDs for this project. */
|
|
69
|
+
listStarredChatIds(): Promise<string[]>;
|
|
70
|
+
/** Star or unstar a chat for the current user. */
|
|
71
|
+
setChatStarred(chatId: string, starred: boolean): Promise<void>;
|
|
45
72
|
/**
|
|
46
73
|
* Send a message and get the response
|
|
47
74
|
* @param message The message text to send
|
|
@@ -55,7 +82,24 @@ export declare class ChatSDK extends BaseClient {
|
|
|
55
82
|
* @param options Configuration including streaming callbacks
|
|
56
83
|
* @returns Promise that resolves when streaming is complete
|
|
57
84
|
*/
|
|
58
|
-
sendMessageStream(message: string, options?: SendMessageOptions & StreamCallbacks
|
|
85
|
+
sendMessageStream(message: string, options?: SendMessageOptions & StreamCallbacks & {
|
|
86
|
+
signal?: AbortSignal;
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Status of a streamed turn, so a reloaded page can reattach to one still
|
|
90
|
+
* running. Resolves to null once the turn is no longer resumable.
|
|
91
|
+
*/
|
|
92
|
+
getTurnStatus(messageId: string): Promise<TurnStatusResponse | null>;
|
|
93
|
+
/**
|
|
94
|
+
* Reattach to a turn (e.g. after a page reload) and stream it from the
|
|
95
|
+
* start, with the same callbacks as `sendMessageStream`.
|
|
96
|
+
*/
|
|
97
|
+
resumeTurnStream(messageId: string, options?: StreamCallbacks & {
|
|
98
|
+
signal?: AbortSignal;
|
|
99
|
+
}): Promise<void>;
|
|
100
|
+
private streamHeaders;
|
|
101
|
+
private openTurnStream;
|
|
102
|
+
private consumeTurnStream;
|
|
59
103
|
/**
|
|
60
104
|
* Send user feedback for a message
|
|
61
105
|
* @param messageId The ID of the message to provide feedback for
|
|
@@ -69,6 +113,8 @@ export declare class ChatSDK extends BaseClient {
|
|
|
69
113
|
private messageInitObject;
|
|
70
114
|
private actionsMap;
|
|
71
115
|
private hasCalledOnStart;
|
|
116
|
+
/** Unfinished tag payload from the previous TCP chunk (JSON split across reads). */
|
|
117
|
+
private streamTagRemainder;
|
|
72
118
|
/**
|
|
73
119
|
* Reset streaming state for a new message
|
|
74
120
|
* @private
|
package/dist/ChatSDK.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatSDK.d.ts","sourceRoot":"","sources":["../src/ChatSDK.ts"],"names":[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,OAAO,CAAC,gBAAgB;IA2TxB;;;OAGG;cACsB,mBAAmB,CAC1C,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,KAAK,CAAC;IAKjB;;;OAGG;cACsB,uBAAuB,CAC9C,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,KAAK,CAAC;CAoClB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BaseClient, BaseClientConfig } from
|
|
1
|
+
import { BaseClient, BaseClientConfig } from "./BaseClient.cjs";
|
|
2
2
|
export interface Filter {
|
|
3
3
|
column: string;
|
|
4
4
|
operator: string;
|
|
5
|
-
value: string | number | boolean;
|
|
5
|
+
value: string | number | boolean | null;
|
|
6
|
+
logicalOperator?: "AND" | "OR";
|
|
6
7
|
}
|
|
7
8
|
export interface PaginationParams {
|
|
8
9
|
page?: number;
|
|
@@ -23,7 +24,7 @@ export interface SmartTable {
|
|
|
23
24
|
}
|
|
24
25
|
export interface SmartTableColumn {
|
|
25
26
|
name: string;
|
|
26
|
-
type:
|
|
27
|
+
type: "text" | "number" | "boolean" | "date" | "email" | "url" | "json";
|
|
27
28
|
description?: string;
|
|
28
29
|
notNull?: boolean;
|
|
29
30
|
unique?: boolean;
|
|
@@ -32,12 +33,13 @@ export interface SmartTableColumn {
|
|
|
32
33
|
}
|
|
33
34
|
export interface TableFilter {
|
|
34
35
|
column: string;
|
|
35
|
-
operator:
|
|
36
|
+
operator: "eq" | "ne" | "gt" | "lt" | "gte" | "lte" | "contains" | "notcontains" | "startswith" | "endswith";
|
|
36
37
|
value: string | number | boolean | null;
|
|
38
|
+
logicalOperator?: "AND" | "OR";
|
|
37
39
|
}
|
|
38
40
|
export interface TableSort {
|
|
39
41
|
column: string;
|
|
40
|
-
direction:
|
|
42
|
+
direction: "asc" | "desc";
|
|
41
43
|
}
|
|
42
44
|
export interface TablePagination {
|
|
43
45
|
page?: number;
|
|
@@ -232,6 +234,25 @@ export declare class SmartTablesSDK extends BaseClient {
|
|
|
232
234
|
defaultView: TableView | null;
|
|
233
235
|
viewId: string;
|
|
234
236
|
}>;
|
|
237
|
+
/**
|
|
238
|
+
* Query table with grouped data and schema
|
|
239
|
+
* @param tableId The ID of the table
|
|
240
|
+
* @param options Query options including grouping parameters
|
|
241
|
+
* @returns Promise resolving to grouped data and schema
|
|
242
|
+
*/
|
|
243
|
+
queryGroupedTableWithSchema(tableId: string, options: {
|
|
244
|
+
groupColumn: string;
|
|
245
|
+
groupColumnType: string;
|
|
246
|
+
filters?: TableFilter[];
|
|
247
|
+
sort?: TableSort[];
|
|
248
|
+
pagination?: TablePagination;
|
|
249
|
+
}): Promise<{
|
|
250
|
+
grouped_data: Record<string, unknown>[];
|
|
251
|
+
total_count: number;
|
|
252
|
+
data_schema: TableSchemaColumn[];
|
|
253
|
+
defaultView: TableView | null;
|
|
254
|
+
viewId: string;
|
|
255
|
+
}>;
|
|
235
256
|
/**
|
|
236
257
|
* Get processed table schema with view metadata applied
|
|
237
258
|
* @param tableId The ID of the table
|
|
@@ -255,9 +276,11 @@ export declare class SmartTablesSDK extends BaseClient {
|
|
|
255
276
|
* @param description Description for the new table
|
|
256
277
|
* @param columnMappings Array of column mappings
|
|
257
278
|
* @param file File to import
|
|
279
|
+
* @param needsDecryption True when the file is encrypted by an external DRM /
|
|
280
|
+
* envelope encryption scheme; the server decrypts it before parsing
|
|
258
281
|
* @returns Promise resolving to import result
|
|
259
282
|
*/
|
|
260
|
-
importTable(title: string, description: string, columnMappings: ColumnMapping[], file: File): Promise<ImportResult>;
|
|
283
|
+
importTable(title: string, description: string, columnMappings: ColumnMapping[], file: File, needsDecryption?: boolean): Promise<ImportResult>;
|
|
261
284
|
/**
|
|
262
285
|
* Update a table view
|
|
263
286
|
* @param dataTypeId The ID of the data type
|
|
@@ -285,6 +308,77 @@ export declare class SmartTablesSDK extends BaseClient {
|
|
|
285
308
|
* @returns Promise resolving when computation is complete
|
|
286
309
|
*/
|
|
287
310
|
computeRowColumns(dataTypeId: string, rowId: string, columnNames?: string[]): Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* Start async column computation for all rows or specific row
|
|
313
|
+
* @param dataTypeId The ID of the data type
|
|
314
|
+
* @param columnName The name of the column to compute
|
|
315
|
+
* @param options Computation options
|
|
316
|
+
* @returns Promise resolving to execution ID
|
|
317
|
+
*/
|
|
318
|
+
startAsyncColumnComputation(dataTypeId: string, columnName: string, options?: {
|
|
319
|
+
rowId?: number;
|
|
320
|
+
recompute?: boolean;
|
|
321
|
+
}): Promise<{
|
|
322
|
+
execution_id: string;
|
|
323
|
+
status: string;
|
|
324
|
+
}>;
|
|
325
|
+
/**
|
|
326
|
+
* Get the status of an async column computation job
|
|
327
|
+
* @param dataTypeId The ID of the data type
|
|
328
|
+
* @param executionId The execution ID returned from startAsyncColumnComputation
|
|
329
|
+
* @returns Promise resolving to job status
|
|
330
|
+
*/
|
|
331
|
+
getJobStatus(dataTypeId: string, executionId: string): Promise<{
|
|
332
|
+
execution_id: string;
|
|
333
|
+
status: string;
|
|
334
|
+
progress_percentage: number;
|
|
335
|
+
processed_rows: number;
|
|
336
|
+
total_rows: number;
|
|
337
|
+
updated_rows: number;
|
|
338
|
+
failed_rows: number[];
|
|
339
|
+
started_at: string;
|
|
340
|
+
completed_at?: string;
|
|
341
|
+
error_message?: string;
|
|
342
|
+
metadata: any;
|
|
343
|
+
}>;
|
|
344
|
+
/**
|
|
345
|
+
* List all async column computation jobs
|
|
346
|
+
* @param dataTypeId The ID of the data type
|
|
347
|
+
* @param options Query options
|
|
348
|
+
* @returns Promise resolving to job list
|
|
349
|
+
*/
|
|
350
|
+
listJobs(dataTypeId: string, options?: {
|
|
351
|
+
limit?: number;
|
|
352
|
+
offset?: number;
|
|
353
|
+
}): Promise<{
|
|
354
|
+
jobs: Array<{
|
|
355
|
+
id: string;
|
|
356
|
+
execution_id?: string;
|
|
357
|
+
status: string;
|
|
358
|
+
progress_percentage: number;
|
|
359
|
+
processed_rows: number;
|
|
360
|
+
total_rows: number;
|
|
361
|
+
updated_rows: number;
|
|
362
|
+
started_at: string;
|
|
363
|
+
completed_at?: string;
|
|
364
|
+
task_metadata: {
|
|
365
|
+
column_name?: string;
|
|
366
|
+
job_type?: string;
|
|
367
|
+
[key: string]: unknown;
|
|
368
|
+
} | null;
|
|
369
|
+
}>;
|
|
370
|
+
total_count: number;
|
|
371
|
+
}>;
|
|
372
|
+
/**
|
|
373
|
+
* Cancel an async column computation job
|
|
374
|
+
* @param dataTypeId The ID of the data type
|
|
375
|
+
* @param executionId The execution ID to cancel
|
|
376
|
+
* @returns Promise resolving when cancellation is complete
|
|
377
|
+
*/
|
|
378
|
+
cancelJob(dataTypeId: string, executionId: string): Promise<{
|
|
379
|
+
execution_id: string;
|
|
380
|
+
cancelled: boolean;
|
|
381
|
+
}>;
|
|
288
382
|
/**
|
|
289
383
|
* Compute values for all rows in a table using LLM
|
|
290
384
|
* @param dataTypeId The ID of the data type
|
|
@@ -300,6 +394,19 @@ export declare class SmartTablesSDK extends BaseClient {
|
|
|
300
394
|
retry_attempts: Record<number, number>;
|
|
301
395
|
computation_id?: string;
|
|
302
396
|
history_table?: string;
|
|
397
|
+
task_id?: string;
|
|
398
|
+
execution_id?: string;
|
|
399
|
+
}>;
|
|
400
|
+
/**
|
|
401
|
+
* Cancel a running compute-all-rows job (EN-3633).
|
|
402
|
+
* @param dataTypeId The ID of the data type
|
|
403
|
+
* @param executionId The execution ID returned from computeAllRows
|
|
404
|
+
* @returns Promise resolving when cancellation is requested
|
|
405
|
+
*/
|
|
406
|
+
cancelAllRowsJob(dataTypeId: string, executionId: string): Promise<{
|
|
407
|
+
message: string;
|
|
408
|
+
execution_id: string;
|
|
409
|
+
cancelled: boolean;
|
|
303
410
|
}>;
|
|
304
411
|
/**
|
|
305
412
|
* Normalize table data from API response
|
|
@@ -307,6 +414,5 @@ export declare class SmartTablesSDK extends BaseClient {
|
|
|
307
414
|
*/
|
|
308
415
|
private normalizeTable;
|
|
309
416
|
}
|
|
310
|
-
export declare const createSmartTablesSDK: (projectId: string
|
|
311
|
-
export declare const useSmartTablesSDK: (projectId: string
|
|
312
|
-
//# sourceMappingURL=SmartTablesSDK.d.ts.map
|
|
417
|
+
export declare const createSmartTablesSDK: (projectId: string) => SmartTablesSDK;
|
|
418
|
+
export declare const useSmartTablesSDK: (projectId: string) => SmartTablesSDK;
|
package/dist/SmartTablesSDK.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BaseClient, BaseClientConfig } from
|
|
1
|
+
import { BaseClient, BaseClientConfig } from "./BaseClient.js";
|
|
2
2
|
export interface Filter {
|
|
3
3
|
column: string;
|
|
4
4
|
operator: string;
|
|
5
5
|
value: string | number | boolean | null;
|
|
6
|
+
logicalOperator?: "AND" | "OR";
|
|
6
7
|
}
|
|
7
8
|
export interface PaginationParams {
|
|
8
9
|
page?: number;
|
|
@@ -23,7 +24,7 @@ export interface SmartTable {
|
|
|
23
24
|
}
|
|
24
25
|
export interface SmartTableColumn {
|
|
25
26
|
name: string;
|
|
26
|
-
type:
|
|
27
|
+
type: "text" | "number" | "boolean" | "date" | "email" | "url" | "json";
|
|
27
28
|
description?: string;
|
|
28
29
|
notNull?: boolean;
|
|
29
30
|
unique?: boolean;
|
|
@@ -32,12 +33,13 @@ export interface SmartTableColumn {
|
|
|
32
33
|
}
|
|
33
34
|
export interface TableFilter {
|
|
34
35
|
column: string;
|
|
35
|
-
operator:
|
|
36
|
+
operator: "eq" | "ne" | "gt" | "lt" | "gte" | "lte" | "contains" | "notcontains" | "startswith" | "endswith";
|
|
36
37
|
value: string | number | boolean | null;
|
|
38
|
+
logicalOperator?: "AND" | "OR";
|
|
37
39
|
}
|
|
38
40
|
export interface TableSort {
|
|
39
41
|
column: string;
|
|
40
|
-
direction:
|
|
42
|
+
direction: "asc" | "desc";
|
|
41
43
|
}
|
|
42
44
|
export interface TablePagination {
|
|
43
45
|
page?: number;
|
|
@@ -274,9 +276,11 @@ export declare class SmartTablesSDK extends BaseClient {
|
|
|
274
276
|
* @param description Description for the new table
|
|
275
277
|
* @param columnMappings Array of column mappings
|
|
276
278
|
* @param file File to import
|
|
279
|
+
* @param needsDecryption True when the file is encrypted by an external DRM /
|
|
280
|
+
* envelope encryption scheme; the server decrypts it before parsing
|
|
277
281
|
* @returns Promise resolving to import result
|
|
278
282
|
*/
|
|
279
|
-
importTable(title: string, description: string, columnMappings: ColumnMapping[], file: File): Promise<ImportResult>;
|
|
283
|
+
importTable(title: string, description: string, columnMappings: ColumnMapping[], file: File, needsDecryption?: boolean): Promise<ImportResult>;
|
|
280
284
|
/**
|
|
281
285
|
* Update a table view
|
|
282
286
|
* @param dataTypeId The ID of the data type
|
|
@@ -348,7 +352,8 @@ export declare class SmartTablesSDK extends BaseClient {
|
|
|
348
352
|
offset?: number;
|
|
349
353
|
}): Promise<{
|
|
350
354
|
jobs: Array<{
|
|
351
|
-
|
|
355
|
+
id: string;
|
|
356
|
+
execution_id?: string;
|
|
352
357
|
status: string;
|
|
353
358
|
progress_percentage: number;
|
|
354
359
|
processed_rows: number;
|
|
@@ -356,7 +361,11 @@ export declare class SmartTablesSDK extends BaseClient {
|
|
|
356
361
|
updated_rows: number;
|
|
357
362
|
started_at: string;
|
|
358
363
|
completed_at?: string;
|
|
359
|
-
task_metadata:
|
|
364
|
+
task_metadata: {
|
|
365
|
+
column_name?: string;
|
|
366
|
+
job_type?: string;
|
|
367
|
+
[key: string]: unknown;
|
|
368
|
+
} | null;
|
|
360
369
|
}>;
|
|
361
370
|
total_count: number;
|
|
362
371
|
}>;
|
|
@@ -385,6 +394,19 @@ export declare class SmartTablesSDK extends BaseClient {
|
|
|
385
394
|
retry_attempts: Record<number, number>;
|
|
386
395
|
computation_id?: string;
|
|
387
396
|
history_table?: string;
|
|
397
|
+
task_id?: string;
|
|
398
|
+
execution_id?: string;
|
|
399
|
+
}>;
|
|
400
|
+
/**
|
|
401
|
+
* Cancel a running compute-all-rows job (EN-3633).
|
|
402
|
+
* @param dataTypeId The ID of the data type
|
|
403
|
+
* @param executionId The execution ID returned from computeAllRows
|
|
404
|
+
* @returns Promise resolving when cancellation is requested
|
|
405
|
+
*/
|
|
406
|
+
cancelAllRowsJob(dataTypeId: string, executionId: string): Promise<{
|
|
407
|
+
message: string;
|
|
408
|
+
execution_id: string;
|
|
409
|
+
cancelled: boolean;
|
|
388
410
|
}>;
|
|
389
411
|
/**
|
|
390
412
|
* Normalize table data from API response
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartTablesSDK.d.ts","sourceRoot":"","sources":["../src/SmartTablesSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG5D,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"SmartTablesSDK.d.ts","sourceRoot":"","sources":["../src/SmartTablesSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG5D,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACxC,eAAe,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACjC;AAGD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAA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cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACvC,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QAGvB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IAOF;;;;;OAKG;IACG,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAOzE;;;OAGG;IACH,OAAO,CAAC,cAAc;CAYvB;AAGD,eAAO,MAAM,oBAAoB,GAAI,WAAW,MAAM,mBAErD,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,mBAElD,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { BaseClient } from "./BaseClient.cjs";
|
|
2
|
+
import type { VoiceSDKConfig, VoiceConversationState, StartVoiceConversationOptions, VoiceConversationSession, VoiceMessage, VoiceSettings } from "./voice-types.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Voice SDK for ElevenLabs integration
|
|
5
|
+
* Provides voice conversation capabilities with automatic chat integration
|
|
6
|
+
*/
|
|
7
|
+
export declare class VoiceSDK extends BaseClient {
|
|
8
|
+
private defaultAgentId?;
|
|
9
|
+
private defaultVoiceSettings?;
|
|
10
|
+
private chatSDK?;
|
|
11
|
+
private activeSessions;
|
|
12
|
+
constructor(config: VoiceSDKConfig);
|
|
13
|
+
/**
|
|
14
|
+
* Start a voice conversation session
|
|
15
|
+
*/
|
|
16
|
+
startVoiceConversation(options?: StartVoiceConversationOptions): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* End a voice conversation session
|
|
19
|
+
*/
|
|
20
|
+
endVoiceSession(sessionId: string, reason?: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Get current voice conversation state
|
|
23
|
+
*/
|
|
24
|
+
getVoiceState(sessionId: string): VoiceConversationState | null;
|
|
25
|
+
/**
|
|
26
|
+
* Update voice settings for a session
|
|
27
|
+
*/
|
|
28
|
+
updateVoiceSettings(sessionId: string, settings: VoiceSettings): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Mute/unmute microphone for a session
|
|
31
|
+
*/
|
|
32
|
+
setMicrophoneMuted(sessionId: string, muted: boolean): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Set volume for a session
|
|
35
|
+
*/
|
|
36
|
+
setVolume(sessionId: string, volume: number): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Get audio frequency data for visualization
|
|
39
|
+
*/
|
|
40
|
+
getAudioFrequencyData(sessionId: string): {
|
|
41
|
+
input?: Uint8Array;
|
|
42
|
+
output?: Uint8Array;
|
|
43
|
+
} | null;
|
|
44
|
+
/**
|
|
45
|
+
* Send contextual information to enhance voice conversation
|
|
46
|
+
*/
|
|
47
|
+
sendContextualUpdate(sessionId: string, context: string): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Get conversation history for a session
|
|
50
|
+
*/
|
|
51
|
+
getConversationHistory(sessionId: string): VoiceMessage[];
|
|
52
|
+
/**
|
|
53
|
+
* Get all active voice sessions
|
|
54
|
+
*/
|
|
55
|
+
getActiveSessions(): VoiceConversationSession[];
|
|
56
|
+
/**
|
|
57
|
+
* Automatically save voice message to database via API
|
|
58
|
+
* This is called internally when voice messages are processed
|
|
59
|
+
*/
|
|
60
|
+
private saveVoiceMessageToAPI;
|
|
61
|
+
/**
|
|
62
|
+
* Private helper methods
|
|
63
|
+
*/
|
|
64
|
+
private generateSessionId;
|
|
65
|
+
private generateMessageId;
|
|
66
|
+
private handleVoiceMessage;
|
|
67
|
+
/**
|
|
68
|
+
* Auto-save voice messages when we have complete conversation pairs
|
|
69
|
+
*/
|
|
70
|
+
private autoSaveVoiceMessages;
|
|
71
|
+
private saveVoiceConversationToChat;
|
|
72
|
+
}
|
package/dist/VoiceSDK.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseClient } from
|
|
2
|
-
import type { VoiceSDKConfig, VoiceConversationState, StartVoiceConversationOptions, VoiceConversationSession, VoiceMessage, VoiceSettings } from
|
|
1
|
+
import { BaseClient } from "./BaseClient.js";
|
|
2
|
+
import type { VoiceSDKConfig, VoiceConversationState, StartVoiceConversationOptions, VoiceConversationSession, VoiceMessage, VoiceSettings } from "./voice-types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Voice SDK for ElevenLabs integration
|
|
5
5
|
* Provides voice conversation capabilities with automatic chat integration
|
package/dist/VoiceSDK.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceSDK.d.ts","sourceRoot":"","sources":["../src/VoiceSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EACV,cAAc,EAEd,sBAAsB,EAEtB,6BAA6B,EAC7B,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACd,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AACH,qBAAa,QAAS,SAAQ,UAAU;IACtC,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,oBAAoB,CAAC,CAAgB;IAC7C,OAAO,CAAC,OAAO,CAAC,CAAU;IAC1B,OAAO,CAAC,cAAc,CAAoD;gBAE9D,MAAM,EAAE,cAAc;IAWlC;;OAEG;IACG,sBAAsB,
|
|
1
|
+
{"version":3,"file":"VoiceSDK.d.ts","sourceRoot":"","sources":["../src/VoiceSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EACV,cAAc,EAEd,sBAAsB,EAEtB,6BAA6B,EAC7B,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACd,MA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