@erdoai/types 0.1.6 → 0.1.8

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 CHANGED
@@ -41,8 +41,8 @@ import type {
41
41
 
42
42
  ### Token Types
43
43
 
44
- - **`CreateTokenParams`** - Parameters for creating a scoped token (botKeys, datasetIds, externalUserId)
45
- - **`TokenResponse`** - Token creation response (token, expiresAt)
44
+ - **`CreateTokenParams`** - Parameters for creating a scoped token (botKeys, datasetIds, threadIds, externalUserId)
45
+ - **`TokenResponse`** - Token creation response (tokenId, token, expiresAt)
46
46
 
47
47
  ### Thread Types
48
48
 
package/dist/index.d.cts CHANGED
@@ -38,10 +38,8 @@ interface ResultOutput {
38
38
  interface ContentItem {
39
39
  id?: string;
40
40
  content_type: ContentType | string;
41
- ui_content_type?: UIContentType | {
42
- Valid: boolean;
43
- String: string;
44
- };
41
+ /** UI content type (e.g., 'markdown', 'chart'). Simple string - normalized by useThread. */
42
+ ui_content_type?: UIContentType;
45
43
  content: unknown;
46
44
  data?: unknown;
47
45
  chartConfig?: unknown;
@@ -142,20 +140,25 @@ interface ErdoClient {
142
140
  createThread?(params?: CreateThreadParams): Promise<Thread>;
143
141
  listThreads?(): Promise<ListThreadsResponse>;
144
142
  getThread?(threadId: string): Promise<Thread>;
143
+ getThreadMessages?(threadId: string): Promise<ListThreadMessagesResponse>;
145
144
  sendMessage?(threadId: string, params: SendMessageParams): AsyncGenerator<SSEEvent, void, unknown>;
146
145
  sendMessageAndWait?(threadId: string, params: SendMessageParams): Promise<SSEEvent[]>;
147
146
  }
148
147
  interface CreateTokenParams {
149
- /** Bot keys to grant access to */
148
+ /** Bot keys to grant access to (e.g., ["my-org.data-analyst"]) */
150
149
  botKeys?: string[];
151
150
  /** Dataset IDs to grant access to */
152
151
  datasetIds?: string[];
152
+ /** Thread IDs to grant access to */
153
+ threadIds?: string[];
153
154
  /** Optional identifier for the external user */
154
155
  externalUserId?: string;
155
156
  /** Token expiry in seconds (default: 3600 = 1 hour, max: 86400 = 24 hours) */
156
157
  expiresInSeconds?: number;
157
158
  }
158
159
  interface TokenResponse {
160
+ /** Token ID (needed for revocation) */
161
+ tokenId: string;
159
162
  /** The scoped token (only returned once) */
160
163
  token: string;
161
164
  /** When the token expires */
@@ -231,5 +234,31 @@ interface SendMessageParams {
231
234
  /** Optional bot key to use (must be in token scope) */
232
235
  botKey?: string;
233
236
  }
237
+ /** A message content item from the thread API */
238
+ interface ThreadMessageContent {
239
+ id: string;
240
+ content_type: string;
241
+ ui_content_type?: {
242
+ Valid: boolean;
243
+ String: string;
244
+ } | string;
245
+ content: unknown;
246
+ user_visibility?: string;
247
+ bot_visibility?: string;
248
+ created_at?: string;
249
+ }
250
+ /** A message with its contents from the thread API */
251
+ interface ThreadMessage {
252
+ id: string;
253
+ thread_id: string;
254
+ role: 'user' | 'assistant';
255
+ created_at: string;
256
+ updated_at: string;
257
+ contents: ThreadMessageContent[];
258
+ }
259
+ /** Response from listing thread messages */
260
+ interface ListThreadMessagesResponse {
261
+ messages: ThreadMessage[];
262
+ }
234
263
 
235
- 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 };
264
+ export type { AxisConfig, BotInvocationInfo, ChartConfig, ChartContent, ChartSeriesConfig, ChartType, CodeExecOutputItem, ContentItem, ContentType, CreateThreadParams, CreateTokenParams, ErdoClient, ErdoClientConfig, InvocationMode, InvocationStatus, InvokeParams, InvokeResult, ListThreadMessagesResponse, ListThreadsResponse, LogEntry, LogLevel, Message, MessageContent, Result, ResultOutput, SSEEvent, SSEEventMetadata, SendMessageParams, SeriesConfig, StepInfo, Thread, ThreadMessage, ThreadMessageContent, TokenResponse, ToolGroup, ToolInvocation, ToolResult, UIContentType, WebParseOutput, WebSearchOutput, WebSearchResult };
package/dist/index.d.ts CHANGED
@@ -38,10 +38,8 @@ interface ResultOutput {
38
38
  interface ContentItem {
39
39
  id?: string;
40
40
  content_type: ContentType | string;
41
- ui_content_type?: UIContentType | {
42
- Valid: boolean;
43
- String: string;
44
- };
41
+ /** UI content type (e.g., 'markdown', 'chart'). Simple string - normalized by useThread. */
42
+ ui_content_type?: UIContentType;
45
43
  content: unknown;
46
44
  data?: unknown;
47
45
  chartConfig?: unknown;
@@ -142,20 +140,25 @@ interface ErdoClient {
142
140
  createThread?(params?: CreateThreadParams): Promise<Thread>;
143
141
  listThreads?(): Promise<ListThreadsResponse>;
144
142
  getThread?(threadId: string): Promise<Thread>;
143
+ getThreadMessages?(threadId: string): Promise<ListThreadMessagesResponse>;
145
144
  sendMessage?(threadId: string, params: SendMessageParams): AsyncGenerator<SSEEvent, void, unknown>;
146
145
  sendMessageAndWait?(threadId: string, params: SendMessageParams): Promise<SSEEvent[]>;
147
146
  }
148
147
  interface CreateTokenParams {
149
- /** Bot keys to grant access to */
148
+ /** Bot keys to grant access to (e.g., ["my-org.data-analyst"]) */
150
149
  botKeys?: string[];
151
150
  /** Dataset IDs to grant access to */
152
151
  datasetIds?: string[];
152
+ /** Thread IDs to grant access to */
153
+ threadIds?: string[];
153
154
  /** Optional identifier for the external user */
154
155
  externalUserId?: string;
155
156
  /** Token expiry in seconds (default: 3600 = 1 hour, max: 86400 = 24 hours) */
156
157
  expiresInSeconds?: number;
157
158
  }
158
159
  interface TokenResponse {
160
+ /** Token ID (needed for revocation) */
161
+ tokenId: string;
159
162
  /** The scoped token (only returned once) */
160
163
  token: string;
161
164
  /** When the token expires */
@@ -231,5 +234,31 @@ interface SendMessageParams {
231
234
  /** Optional bot key to use (must be in token scope) */
232
235
  botKey?: string;
233
236
  }
237
+ /** A message content item from the thread API */
238
+ interface ThreadMessageContent {
239
+ id: string;
240
+ content_type: string;
241
+ ui_content_type?: {
242
+ Valid: boolean;
243
+ String: string;
244
+ } | string;
245
+ content: unknown;
246
+ user_visibility?: string;
247
+ bot_visibility?: string;
248
+ created_at?: string;
249
+ }
250
+ /** A message with its contents from the thread API */
251
+ interface ThreadMessage {
252
+ id: string;
253
+ thread_id: string;
254
+ role: 'user' | 'assistant';
255
+ created_at: string;
256
+ updated_at: string;
257
+ contents: ThreadMessageContent[];
258
+ }
259
+ /** Response from listing thread messages */
260
+ interface ListThreadMessagesResponse {
261
+ messages: ThreadMessage[];
262
+ }
234
263
 
235
- 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 };
264
+ export type { AxisConfig, BotInvocationInfo, ChartConfig, ChartContent, ChartSeriesConfig, ChartType, CodeExecOutputItem, ContentItem, ContentType, CreateThreadParams, CreateTokenParams, ErdoClient, ErdoClientConfig, InvocationMode, InvocationStatus, InvokeParams, InvokeResult, ListThreadMessagesResponse, ListThreadsResponse, LogEntry, LogLevel, Message, MessageContent, Result, ResultOutput, SSEEvent, SSEEventMetadata, SendMessageParams, SeriesConfig, StepInfo, Thread, ThreadMessage, ThreadMessageContent, TokenResponse, ToolGroup, ToolInvocation, ToolResult, UIContentType, WebParseOutput, WebSearchOutput, WebSearchResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/types",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Erdo SDK shared types",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,6 +22,7 @@
22
22
  },
23
23
  "scripts": {
24
24
  "build": "tsup",
25
+ "build:check": "tsup --outDir dist-check",
25
26
  "dev": "tsup --watch",
26
27
  "typecheck": "tsc --noEmit"
27
28
  },