@erdoai/types 0.1.12 → 0.1.14

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/dist/index.d.cts CHANGED
@@ -53,7 +53,7 @@ interface ContentItem {
53
53
  tableData?: unknown[];
54
54
  [key: string]: unknown;
55
55
  }
56
- type ContentType = 'text' | 'json' | 'code' | 'table' | 'image' | 'error';
56
+ type ContentType = 'text' | 'json' | 'code' | 'table' | 'image' | 'error' | 'agent_invocation' | 'tool_invocation' | 'tool_result';
57
57
  type UIContentType = 'chart' | 'bar_chart' | 'line_chart' | 'pie_chart' | 'scatter_chart' | 'heatmap' | 'table' | 'markdown' | string;
58
58
  interface InvokeResult {
59
59
  /** Whether the invocation succeeded */
@@ -266,41 +266,73 @@ interface ListThreadMessagesResponse {
266
266
  }
267
267
  /** Step types: agent, LLM call, or tool call */
268
268
  type StepType = 'agent' | 'llm_call' | 'tool_call';
269
- /** A step in the execution tree */
270
- interface Step {
269
+ /** The container one per agent invocation */
270
+ interface AgentStreamState {
271
+ /** All nodes ordered by event arrival — render from this */
272
+ nodes: AgentContent[];
273
+ /** Fast lookup for step nodes by step ID */
274
+ byStepId: Record<string, AgentStepNode>;
275
+ /** Fast lookup for content nodes by content ID */
276
+ byContentId: Record<string, AgentContentNode>;
277
+ /** Step tree structure: parent step ID → child step IDs */
278
+ childrenByParentId: Record<string, string[]>;
279
+ /** The first parentless step */
280
+ rootStepId: string | null;
281
+ /** Assistant message ID from `message created` event — used for anchoring */
282
+ messageId: string | null;
283
+ /** Whether the stream is still active */
284
+ isStreaming: boolean;
285
+ }
286
+ /** Union of all node types in the flat content model */
287
+ type AgentContent = AgentStepNode | AgentContentNode | AgentStatusNode;
288
+ /** Structural node — steps form the hierarchy, NO content on them */
289
+ interface AgentStepNode {
290
+ kind: 'step';
271
291
  id: string;
272
- parent_id: string | null;
292
+ parentId: string | null;
273
293
  type: StepType;
274
294
  name: string;
275
- /** For agent steps: the agent key (e.g., "erdo.data-analyst"). Used for display label lookup. */
295
+ /** For agent steps: the agent key (e.g., "erdo.data-analyst") */
276
296
  key?: string;
277
297
  status: 'running' | 'completed' | 'error';
278
- content: StepContentItem[];
279
298
  error?: string;
280
- /** For llm_call steps: "text" (markdown) or "json" (structured output). Set from step_started. */
281
- content_type?: string;
282
- /** Human-readable label while step is running (e.g., "Searching datasets..."). Set from step_started. */
283
- running_status?: string;
284
- /** Human-readable label when step completes (e.g., "Searched datasets"). Set from step_started or step_finished. */
285
- finished_status?: string;
286
- /** If true, step should not be rendered in the UI. */
299
+ /** Response format hint: 'json' | 'text' */
300
+ contentType?: string;
301
+ /** Human-readable label while step is running */
302
+ runningStatus?: string;
303
+ /** Human-readable label when step completes */
304
+ finishedStatus?: string;
305
+ /** If true, step should not be rendered in the UI */
287
306
  hidden?: boolean;
288
- /** Pre-parsed content chunks from parseMixedJson. Updated as text_delta accumulates. */
289
- parsed_content?: Array<{
307
+ }
308
+ /** Content node — flat, with optional stepId for location */
309
+ interface AgentContentNode {
310
+ kind: 'content';
311
+ /** Unique content ID (from message_content_id) */
312
+ id: string;
313
+ /** Location — null means root level */
314
+ stepId: string | null;
315
+ /** e.g. 'text', 'json', 'tool_invocation', 'tool_result' */
316
+ contentType: string;
317
+ /** e.g. 'markdown', 'codegen_json', 'ui_generation' */
318
+ uiContentType: string;
319
+ /** Accumulated text from deltas */
320
+ text: string;
321
+ /** Final result from message content result */
322
+ result?: unknown;
323
+ state: 'streaming' | 'completed';
324
+ /** For incremental JSON parsing (reuses existing parser infrastructure) */
325
+ parsedContent?: Array<{
290
326
  content: string | Record<string, unknown>;
291
327
  type: 'json' | 'text';
292
328
  }>;
293
329
  }
294
- /** One piece of content produced by a step */
295
- interface StepContentItem {
296
- type: 'text_delta' | 'tool_input' | 'tool_result' | 'error' | 'status_update';
297
- data: unknown;
298
- }
299
- /** State for step-based streaming */
300
- interface StepStreamState {
301
- steps: Record<string, Step>;
302
- rootStepId: string | null;
303
- isStreaming: boolean;
330
+ /** Status update node */
331
+ interface AgentStatusNode {
332
+ kind: 'status';
333
+ /** Step this status belongs to (null = root level) */
334
+ stepId: string | null;
335
+ message: string;
304
336
  }
305
337
 
306
- 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, Step, StepContentItem, StepInfo, StepStreamState, StepType, Thread, ThreadMessage, ThreadMessageContent, TokenResponse, ToolGroup, ToolInvocation, ToolResult, UIContentType, WebParseOutput, WebSearchOutput, WebSearchResult };
338
+ export type { AgentContent, AgentContentNode, AgentStatusNode, AgentStepNode, AgentStreamState, 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, StepType, Thread, ThreadMessage, ThreadMessageContent, TokenResponse, ToolGroup, ToolInvocation, ToolResult, UIContentType, WebParseOutput, WebSearchOutput, WebSearchResult };
package/dist/index.d.ts CHANGED
@@ -53,7 +53,7 @@ interface ContentItem {
53
53
  tableData?: unknown[];
54
54
  [key: string]: unknown;
55
55
  }
56
- type ContentType = 'text' | 'json' | 'code' | 'table' | 'image' | 'error';
56
+ type ContentType = 'text' | 'json' | 'code' | 'table' | 'image' | 'error' | 'agent_invocation' | 'tool_invocation' | 'tool_result';
57
57
  type UIContentType = 'chart' | 'bar_chart' | 'line_chart' | 'pie_chart' | 'scatter_chart' | 'heatmap' | 'table' | 'markdown' | string;
58
58
  interface InvokeResult {
59
59
  /** Whether the invocation succeeded */
@@ -266,41 +266,73 @@ interface ListThreadMessagesResponse {
266
266
  }
267
267
  /** Step types: agent, LLM call, or tool call */
268
268
  type StepType = 'agent' | 'llm_call' | 'tool_call';
269
- /** A step in the execution tree */
270
- interface Step {
269
+ /** The container one per agent invocation */
270
+ interface AgentStreamState {
271
+ /** All nodes ordered by event arrival — render from this */
272
+ nodes: AgentContent[];
273
+ /** Fast lookup for step nodes by step ID */
274
+ byStepId: Record<string, AgentStepNode>;
275
+ /** Fast lookup for content nodes by content ID */
276
+ byContentId: Record<string, AgentContentNode>;
277
+ /** Step tree structure: parent step ID → child step IDs */
278
+ childrenByParentId: Record<string, string[]>;
279
+ /** The first parentless step */
280
+ rootStepId: string | null;
281
+ /** Assistant message ID from `message created` event — used for anchoring */
282
+ messageId: string | null;
283
+ /** Whether the stream is still active */
284
+ isStreaming: boolean;
285
+ }
286
+ /** Union of all node types in the flat content model */
287
+ type AgentContent = AgentStepNode | AgentContentNode | AgentStatusNode;
288
+ /** Structural node — steps form the hierarchy, NO content on them */
289
+ interface AgentStepNode {
290
+ kind: 'step';
271
291
  id: string;
272
- parent_id: string | null;
292
+ parentId: string | null;
273
293
  type: StepType;
274
294
  name: string;
275
- /** For agent steps: the agent key (e.g., "erdo.data-analyst"). Used for display label lookup. */
295
+ /** For agent steps: the agent key (e.g., "erdo.data-analyst") */
276
296
  key?: string;
277
297
  status: 'running' | 'completed' | 'error';
278
- content: StepContentItem[];
279
298
  error?: string;
280
- /** For llm_call steps: "text" (markdown) or "json" (structured output). Set from step_started. */
281
- content_type?: string;
282
- /** Human-readable label while step is running (e.g., "Searching datasets..."). Set from step_started. */
283
- running_status?: string;
284
- /** Human-readable label when step completes (e.g., "Searched datasets"). Set from step_started or step_finished. */
285
- finished_status?: string;
286
- /** If true, step should not be rendered in the UI. */
299
+ /** Response format hint: 'json' | 'text' */
300
+ contentType?: string;
301
+ /** Human-readable label while step is running */
302
+ runningStatus?: string;
303
+ /** Human-readable label when step completes */
304
+ finishedStatus?: string;
305
+ /** If true, step should not be rendered in the UI */
287
306
  hidden?: boolean;
288
- /** Pre-parsed content chunks from parseMixedJson. Updated as text_delta accumulates. */
289
- parsed_content?: Array<{
307
+ }
308
+ /** Content node — flat, with optional stepId for location */
309
+ interface AgentContentNode {
310
+ kind: 'content';
311
+ /** Unique content ID (from message_content_id) */
312
+ id: string;
313
+ /** Location — null means root level */
314
+ stepId: string | null;
315
+ /** e.g. 'text', 'json', 'tool_invocation', 'tool_result' */
316
+ contentType: string;
317
+ /** e.g. 'markdown', 'codegen_json', 'ui_generation' */
318
+ uiContentType: string;
319
+ /** Accumulated text from deltas */
320
+ text: string;
321
+ /** Final result from message content result */
322
+ result?: unknown;
323
+ state: 'streaming' | 'completed';
324
+ /** For incremental JSON parsing (reuses existing parser infrastructure) */
325
+ parsedContent?: Array<{
290
326
  content: string | Record<string, unknown>;
291
327
  type: 'json' | 'text';
292
328
  }>;
293
329
  }
294
- /** One piece of content produced by a step */
295
- interface StepContentItem {
296
- type: 'text_delta' | 'tool_input' | 'tool_result' | 'error' | 'status_update';
297
- data: unknown;
298
- }
299
- /** State for step-based streaming */
300
- interface StepStreamState {
301
- steps: Record<string, Step>;
302
- rootStepId: string | null;
303
- isStreaming: boolean;
330
+ /** Status update node */
331
+ interface AgentStatusNode {
332
+ kind: 'status';
333
+ /** Step this status belongs to (null = root level) */
334
+ stepId: string | null;
335
+ message: string;
304
336
  }
305
337
 
306
- 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, Step, StepContentItem, StepInfo, StepStreamState, StepType, Thread, ThreadMessage, ThreadMessageContent, TokenResponse, ToolGroup, ToolInvocation, ToolResult, UIContentType, WebParseOutput, WebSearchOutput, WebSearchResult };
338
+ export type { AgentContent, AgentContentNode, AgentStatusNode, AgentStepNode, AgentStreamState, 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, StepType, 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.12",
3
+ "version": "0.1.14",
4
4
  "description": "Erdo SDK shared types",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",