@erdoai/types 0.1.5 → 0.1.7
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 +20 -0
- package/dist/index.d.cts +53 -4
- package/dist/index.d.ts +53 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -19,6 +19,14 @@ import type {
|
|
|
19
19
|
InvokeResult,
|
|
20
20
|
InvokeParams,
|
|
21
21
|
UIContentType,
|
|
22
|
+
// Token types
|
|
23
|
+
CreateTokenParams,
|
|
24
|
+
TokenResponse,
|
|
25
|
+
// Thread types
|
|
26
|
+
Thread,
|
|
27
|
+
CreateThreadParams,
|
|
28
|
+
ListThreadsResponse,
|
|
29
|
+
SendMessageParams,
|
|
22
30
|
} from '@erdoai/types';
|
|
23
31
|
```
|
|
24
32
|
|
|
@@ -31,6 +39,18 @@ import type {
|
|
|
31
39
|
- **`InvokeResult`** - Processed result with `messages`, `steps`, `events`, `result`
|
|
32
40
|
- **`InvokeParams`** - Parameters for invoking an Erdo agent
|
|
33
41
|
|
|
42
|
+
### Token Types
|
|
43
|
+
|
|
44
|
+
- **`CreateTokenParams`** - Parameters for creating a scoped token (botKeys, datasetIds, threadIds, externalUserId)
|
|
45
|
+
- **`TokenResponse`** - Token creation response (tokenId, token, expiresAt)
|
|
46
|
+
|
|
47
|
+
### Thread Types
|
|
48
|
+
|
|
49
|
+
- **`Thread`** - Thread object (id, name, createdAt, updatedAt)
|
|
50
|
+
- **`CreateThreadParams`** - Parameters for creating a thread (name, datasetIds)
|
|
51
|
+
- **`ListThreadsResponse`** - Response from listThreads (threads array)
|
|
52
|
+
- **`SendMessageParams`** - Parameters for sending a message (content, botKey)
|
|
53
|
+
|
|
34
54
|
### UI Types
|
|
35
55
|
|
|
36
56
|
- **`UIContentType`** - Content type hints for UI rendering (charts, tables, etc.)
|
package/dist/index.d.cts
CHANGED
|
@@ -60,8 +60,8 @@ type UIContentType = 'chart' | 'bar_chart' | 'line_chart' | 'pie_chart' | 'scatt
|
|
|
60
60
|
interface InvokeResult {
|
|
61
61
|
/** Whether the invocation succeeded */
|
|
62
62
|
success: boolean;
|
|
63
|
-
/** Bot
|
|
64
|
-
|
|
63
|
+
/** Bot key used for invocation */
|
|
64
|
+
botKey?: string;
|
|
65
65
|
/** Unique invocation ID */
|
|
66
66
|
invocationId?: string;
|
|
67
67
|
/** The actual bot result */
|
|
@@ -129,13 +129,41 @@ interface ChartContent extends ContentItem {
|
|
|
129
129
|
interface ErdoClientConfig {
|
|
130
130
|
/** API endpoint URL */
|
|
131
131
|
endpoint?: string;
|
|
132
|
-
/** Authentication token (API key) */
|
|
132
|
+
/** Authentication token (API key) - use for server-side requests */
|
|
133
133
|
authToken?: string;
|
|
134
|
+
/** Scoped token - use for client-side requests (created via createToken) */
|
|
135
|
+
token?: string;
|
|
134
136
|
}
|
|
135
137
|
/** Interface for ErdoClient - implemented by @erdoai/server */
|
|
136
138
|
interface ErdoClient {
|
|
137
139
|
invoke(botKey: string, params?: InvokeParams): Promise<InvokeResult>;
|
|
138
140
|
invokeStream(botKey: string, params?: InvokeParams): AsyncGenerator<SSEEvent, void, unknown>;
|
|
141
|
+
createToken?(params: CreateTokenParams): Promise<TokenResponse>;
|
|
142
|
+
createThread?(params?: CreateThreadParams): Promise<Thread>;
|
|
143
|
+
listThreads?(): Promise<ListThreadsResponse>;
|
|
144
|
+
getThread?(threadId: string): Promise<Thread>;
|
|
145
|
+
sendMessage?(threadId: string, params: SendMessageParams): AsyncGenerator<SSEEvent, void, unknown>;
|
|
146
|
+
sendMessageAndWait?(threadId: string, params: SendMessageParams): Promise<SSEEvent[]>;
|
|
147
|
+
}
|
|
148
|
+
interface CreateTokenParams {
|
|
149
|
+
/** Bot keys to grant access to (e.g., ["my-org.data-analyst"]) */
|
|
150
|
+
botKeys?: string[];
|
|
151
|
+
/** Dataset IDs to grant access to */
|
|
152
|
+
datasetIds?: string[];
|
|
153
|
+
/** Thread IDs to grant access to */
|
|
154
|
+
threadIds?: string[];
|
|
155
|
+
/** Optional identifier for the external user */
|
|
156
|
+
externalUserId?: string;
|
|
157
|
+
/** Token expiry in seconds (default: 3600 = 1 hour, max: 86400 = 24 hours) */
|
|
158
|
+
expiresInSeconds?: number;
|
|
159
|
+
}
|
|
160
|
+
interface TokenResponse {
|
|
161
|
+
/** Token ID (needed for revocation) */
|
|
162
|
+
tokenId: string;
|
|
163
|
+
/** The scoped token (only returned once) */
|
|
164
|
+
token: string;
|
|
165
|
+
/** When the token expires */
|
|
166
|
+
expiresAt: string;
|
|
139
167
|
}
|
|
140
168
|
interface ToolInvocation {
|
|
141
169
|
invocation_id: string;
|
|
@@ -186,5 +214,26 @@ interface BotInvocationInfo {
|
|
|
186
214
|
started_at?: string;
|
|
187
215
|
completed_at?: string;
|
|
188
216
|
}
|
|
217
|
+
interface CreateThreadParams {
|
|
218
|
+
/** Optional thread name */
|
|
219
|
+
name?: string;
|
|
220
|
+
/** Dataset IDs to attach to the thread */
|
|
221
|
+
datasetIds?: string[];
|
|
222
|
+
}
|
|
223
|
+
interface Thread {
|
|
224
|
+
id: string;
|
|
225
|
+
name: string;
|
|
226
|
+
createdAt: string;
|
|
227
|
+
updatedAt: string;
|
|
228
|
+
}
|
|
229
|
+
interface ListThreadsResponse {
|
|
230
|
+
threads: Thread[];
|
|
231
|
+
}
|
|
232
|
+
interface SendMessageParams {
|
|
233
|
+
/** Message content */
|
|
234
|
+
content: string;
|
|
235
|
+
/** Optional bot key to use (must be in token scope) */
|
|
236
|
+
botKey?: string;
|
|
237
|
+
}
|
|
189
238
|
|
|
190
|
-
export type { AxisConfig, BotInvocationInfo, ChartConfig, ChartContent, ChartSeriesConfig, ChartType, CodeExecOutputItem, ContentItem, ContentType, ErdoClient, ErdoClientConfig, InvocationMode, InvocationStatus, InvokeParams, InvokeResult, LogEntry, LogLevel, Message, MessageContent, Result, ResultOutput, SSEEvent, SSEEventMetadata, SeriesConfig, StepInfo, ToolGroup, ToolInvocation, ToolResult, UIContentType, WebParseOutput, WebSearchOutput, WebSearchResult };
|
|
239
|
+
export type { AxisConfig, BotInvocationInfo, ChartConfig, ChartContent, ChartSeriesConfig, ChartType, CodeExecOutputItem, ContentItem, ContentType, CreateThreadParams, CreateTokenParams, ErdoClient, ErdoClientConfig, InvocationMode, InvocationStatus, InvokeParams, InvokeResult, ListThreadsResponse, LogEntry, LogLevel, Message, MessageContent, Result, ResultOutput, SSEEvent, SSEEventMetadata, SendMessageParams, SeriesConfig, StepInfo, Thread, TokenResponse, ToolGroup, ToolInvocation, ToolResult, UIContentType, WebParseOutput, WebSearchOutput, WebSearchResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -60,8 +60,8 @@ type UIContentType = 'chart' | 'bar_chart' | 'line_chart' | 'pie_chart' | 'scatt
|
|
|
60
60
|
interface InvokeResult {
|
|
61
61
|
/** Whether the invocation succeeded */
|
|
62
62
|
success: boolean;
|
|
63
|
-
/** Bot
|
|
64
|
-
|
|
63
|
+
/** Bot key used for invocation */
|
|
64
|
+
botKey?: string;
|
|
65
65
|
/** Unique invocation ID */
|
|
66
66
|
invocationId?: string;
|
|
67
67
|
/** The actual bot result */
|
|
@@ -129,13 +129,41 @@ interface ChartContent extends ContentItem {
|
|
|
129
129
|
interface ErdoClientConfig {
|
|
130
130
|
/** API endpoint URL */
|
|
131
131
|
endpoint?: string;
|
|
132
|
-
/** Authentication token (API key) */
|
|
132
|
+
/** Authentication token (API key) - use for server-side requests */
|
|
133
133
|
authToken?: string;
|
|
134
|
+
/** Scoped token - use for client-side requests (created via createToken) */
|
|
135
|
+
token?: string;
|
|
134
136
|
}
|
|
135
137
|
/** Interface for ErdoClient - implemented by @erdoai/server */
|
|
136
138
|
interface ErdoClient {
|
|
137
139
|
invoke(botKey: string, params?: InvokeParams): Promise<InvokeResult>;
|
|
138
140
|
invokeStream(botKey: string, params?: InvokeParams): AsyncGenerator<SSEEvent, void, unknown>;
|
|
141
|
+
createToken?(params: CreateTokenParams): Promise<TokenResponse>;
|
|
142
|
+
createThread?(params?: CreateThreadParams): Promise<Thread>;
|
|
143
|
+
listThreads?(): Promise<ListThreadsResponse>;
|
|
144
|
+
getThread?(threadId: string): Promise<Thread>;
|
|
145
|
+
sendMessage?(threadId: string, params: SendMessageParams): AsyncGenerator<SSEEvent, void, unknown>;
|
|
146
|
+
sendMessageAndWait?(threadId: string, params: SendMessageParams): Promise<SSEEvent[]>;
|
|
147
|
+
}
|
|
148
|
+
interface CreateTokenParams {
|
|
149
|
+
/** Bot keys to grant access to (e.g., ["my-org.data-analyst"]) */
|
|
150
|
+
botKeys?: string[];
|
|
151
|
+
/** Dataset IDs to grant access to */
|
|
152
|
+
datasetIds?: string[];
|
|
153
|
+
/** Thread IDs to grant access to */
|
|
154
|
+
threadIds?: string[];
|
|
155
|
+
/** Optional identifier for the external user */
|
|
156
|
+
externalUserId?: string;
|
|
157
|
+
/** Token expiry in seconds (default: 3600 = 1 hour, max: 86400 = 24 hours) */
|
|
158
|
+
expiresInSeconds?: number;
|
|
159
|
+
}
|
|
160
|
+
interface TokenResponse {
|
|
161
|
+
/** Token ID (needed for revocation) */
|
|
162
|
+
tokenId: string;
|
|
163
|
+
/** The scoped token (only returned once) */
|
|
164
|
+
token: string;
|
|
165
|
+
/** When the token expires */
|
|
166
|
+
expiresAt: string;
|
|
139
167
|
}
|
|
140
168
|
interface ToolInvocation {
|
|
141
169
|
invocation_id: string;
|
|
@@ -186,5 +214,26 @@ interface BotInvocationInfo {
|
|
|
186
214
|
started_at?: string;
|
|
187
215
|
completed_at?: string;
|
|
188
216
|
}
|
|
217
|
+
interface CreateThreadParams {
|
|
218
|
+
/** Optional thread name */
|
|
219
|
+
name?: string;
|
|
220
|
+
/** Dataset IDs to attach to the thread */
|
|
221
|
+
datasetIds?: string[];
|
|
222
|
+
}
|
|
223
|
+
interface Thread {
|
|
224
|
+
id: string;
|
|
225
|
+
name: string;
|
|
226
|
+
createdAt: string;
|
|
227
|
+
updatedAt: string;
|
|
228
|
+
}
|
|
229
|
+
interface ListThreadsResponse {
|
|
230
|
+
threads: Thread[];
|
|
231
|
+
}
|
|
232
|
+
interface SendMessageParams {
|
|
233
|
+
/** Message content */
|
|
234
|
+
content: string;
|
|
235
|
+
/** Optional bot key to use (must be in token scope) */
|
|
236
|
+
botKey?: string;
|
|
237
|
+
}
|
|
189
238
|
|
|
190
|
-
export type { AxisConfig, BotInvocationInfo, ChartConfig, ChartContent, ChartSeriesConfig, ChartType, CodeExecOutputItem, ContentItem, ContentType, ErdoClient, ErdoClientConfig, InvocationMode, InvocationStatus, InvokeParams, InvokeResult, LogEntry, LogLevel, Message, MessageContent, Result, ResultOutput, SSEEvent, SSEEventMetadata, SeriesConfig, StepInfo, ToolGroup, ToolInvocation, ToolResult, UIContentType, WebParseOutput, WebSearchOutput, WebSearchResult };
|
|
239
|
+
export type { AxisConfig, BotInvocationInfo, ChartConfig, ChartContent, ChartSeriesConfig, ChartType, CodeExecOutputItem, ContentItem, ContentType, CreateThreadParams, CreateTokenParams, ErdoClient, ErdoClientConfig, InvocationMode, InvocationStatus, InvokeParams, InvokeResult, ListThreadsResponse, LogEntry, LogLevel, Message, MessageContent, Result, ResultOutput, SSEEvent, SSEEventMetadata, SendMessageParams, SeriesConfig, StepInfo, Thread, TokenResponse, ToolGroup, ToolInvocation, ToolResult, UIContentType, WebParseOutput, WebSearchOutput, WebSearchResult };
|
package/package.json
CHANGED