@chaoslabs/ai-sdk 0.0.10 → 1.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,156 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-01-30
9
+
10
+ ### ⚠️ Breaking Changes
11
+
12
+ - **Wallet configuration**: Removed `wallet_id` from `RequestMetadata`. Use the `wallets` array instead for single or multi-chain wallet support.
13
+
14
+ - **Conversation history format**: Changed `prior_messages` to `previous_messages`.
15
+
16
+ - **Removed `useLegacyFormat` config option**: The SDK now exclusively uses the new API format.
17
+
18
+ - **Block type discriminators aligned with backend**: All block types now use field names matching the Python backend API:
19
+ - `CodeBlock.code` renamed to `CodeBlock.content`
20
+ - `InfoBlock.message` renamed to `InfoBlock.content`
21
+ - `InfoBlock` now includes `error` field for error states
22
+ - `InteractiveBlock.prompt` renamed to `InteractiveBlock.title`
23
+ - `InteractiveBlock` now includes `body`, `context`, and `style` fields
24
+
25
+ - **`ActionBlock` discriminator updated**: Now uses `type: "action"` in addition to `blockType: "transaction_action"` to match backend schema
26
+
27
+ - **`InteractiveBlock` structure revised**:
28
+ - Removed `allowCustom` and `multiSelect` fields
29
+ - Added `body`, `context`, and `style` fields to match backend schema
30
+
31
+ - **`InfoBlock` structure revised**:
32
+ - Removed `title` and `severity` fields
33
+ - Added `error` field for error messaging
34
+
35
+ - **Chart block types refined**: `PieChartBlock` and `TimeseriesChartBlock` are now distinct types with specific `chartType` discriminators (`"pie"` and `"timeseries"` respectively)
36
+
37
+ ### Added
38
+
39
+ - **Multi-wallet support**: The `RequestMetadata` interface now supports multiple wallet addresses across different chains via the new `wallets` field:
40
+ ```typescript
41
+ const metadata: RequestMetadata = {
42
+ user_id: 'user-123',
43
+ session_id: 'session-456',
44
+ wallets: [
45
+ { address: '0x...', chain: 'ethereum' },
46
+ { address: '0x...', chain: 'base' },
47
+ { address: 'So1...', chain: 'solana' },
48
+ ],
49
+ };
50
+ ```
51
+
52
+ - **Assistant role in conversation history**: Users can now use `role: 'assistant'` directly in `InputItem` instead of the `[Assistant]:` prefix workaround. Both formats remain supported for backward compatibility.
53
+ ```typescript
54
+ const input: InputItem[] = [
55
+ { type: 'message', role: 'user', content: 'What is ETH price?' },
56
+ { type: 'message', role: 'assistant', content: 'ETH is currently $3,500.' },
57
+ { type: 'message', role: 'user', content: 'And BTC?' },
58
+ ];
59
+ ```
60
+
61
+ - **Typed primitives**: New `Primitive` discriminated union with strongly-typed params for each primitive type:
62
+ - `SwapParams`, `BridgeParams`, `LendingParams`, `StakingParams`
63
+ - `PerpsParams`, `VaultParams`, `LiquidityParams`, `RestakingParams`
64
+ - Primitive type constants and category helpers
65
+
66
+ - **New `WalletInfo` interface**: Represents a wallet with `address` and `chain` fields
67
+
68
+ - **`DoneMessage` stream type**: Added support for `done_message` message type signaling workflow completion
69
+
70
+ ### Fixed
71
+
72
+ - **Defensive stream helpers**: `parseAgentStatus()`, `extractAgentMessageText()`, `extractSuggestions()`, and `extractReportBlock()` now gracefully handle malformed messages instead of throwing errors
73
+
74
+ ### Removed
75
+
76
+ - **CMS tooling**: Sanity CMS import tooling has been migrated to the docs repository
77
+
78
+ ### Migration Guide
79
+
80
+ **Wallet configuration:**
81
+ ```typescript
82
+ // Before (0.x)
83
+ const metadata = { user_id: '...', session_id: '...', wallet_id: '0x...' };
84
+
85
+ // After (1.0.0)
86
+ const metadata = {
87
+ user_id: '...',
88
+ session_id: '...',
89
+ wallets: [{ address: '0x...', chain: 'ethereum' }],
90
+ };
91
+ ```
92
+
93
+ **Block types:**
94
+ ```typescript
95
+ // Before (0.x)
96
+ const codeBlock: CodeBlock = { type: 'code', code: '...', language: 'typescript' };
97
+ const infoBlock: InfoBlock = { type: 'info', message: '...', severity: 'warning' };
98
+ const interactive: InteractiveBlock = { type: 'interactive', prompt: '...' };
99
+
100
+ // After (1.0.0)
101
+ const codeBlock: CodeBlock = { type: 'code', content: '...', language: 'typescript' };
102
+ const infoBlock: InfoBlock = { type: 'info', content: '...', error: null };
103
+ const interactive: InteractiveBlock = { type: 'interactive', title: '...', style: 'options' };
104
+ ```
105
+
106
+ ## [0.0.11] - 2026-01-27
107
+
108
+ ### Added
109
+
110
+ - **Typed StreamMessage**: `StreamMessage` is now a discriminated union with properly typed `content` for each message type:
111
+ - `agent_status_change`: `AgentStatusContent` with typed `status` field
112
+ - `agent_message`: `AgentMessageContent` with typed `data.message` field
113
+ - `report`: `ReportContent` with typed `data` (Block), `captions` (Caption[]), `references` (Reference[])
114
+ - `follow_up_suggestions`: `FollowUpSuggestionsContent` with typed `data.followUpQueries`
115
+ - `user_input`: `UserInputContent` with typed `candidates`
116
+
117
+ - **New types exported**:
118
+ - `Caption` - Block caption with label, value, group, collapsable
119
+ - `Reference` - Source reference with title, url, content, hiddenUrl, textSpans, engineId
120
+ - `AgentStatusMessage`, `AgentTextMessage`, `ReportMessage`, `FollowUpSuggestionsMessage`, `UserInputMessage` - Individual message types for type narrowing
121
+
122
+ - **Type-safe content access**: TypeScript now narrows content type automatically when checking `msg.type`:
123
+ ```typescript
124
+ if (msg.type === 'agent_status_change') {
125
+ console.log(msg.content.status); // TypeScript knows this is AgentStatus
126
+ }
127
+ ```
128
+
129
+ ### Changed
130
+
131
+ - `ReportContent.data` changed from `unknown` to `Block`
132
+ - `ReportContent.captions` changed from `unknown[]` to `Caption[]`
133
+ - `ReportContent.references` changed from `unknown` to `Reference[]`
134
+ - `extractReportBlock()` return type changed from `unknown | null` to `Block | null`
135
+ - `UserInputCandidate.coingecko_coin_id` renamed to `token_id`
136
+
137
+ ### Removed
138
+
139
+ - Staging environment support removed - SDK now only supports production (`https://ai.chaoslabs.co`)
140
+ - `CHAOS_STAGING_URL` and `CHAOS_STAGING_API_KEY` environment variables no longer used in examples
141
+
142
+ ## [0.0.10] - 2026-01-27
143
+
144
+ ### Changed
145
+
146
+ - Default `baseUrl` changed from staging to production (`https://ai.chaoslabs.co`)
147
+
148
+ ## [0.0.9] - 2026-01-26
149
+
150
+ ### Added
151
+
152
+ - Initial public release
153
+ - Core client with streaming support
154
+ - Block types: Markdown, Table, Chart, TransactionAction, Interactive
155
+ - Primitive constants and helpers
156
+ - Conversation class for multi-turn interactions
package/README.md CHANGED
@@ -29,7 +29,7 @@ import { Chaos, WALLET_MODEL, extractText, extractBlocks } from '@chaoslabs/ai-s
29
29
 
30
30
  const chaos = new Chaos({
31
31
  apiKey: process.env.CHAOS_API_KEY,
32
- baseUrl: 'https://ai-staging.chaoslabs.co', // Optional, this is the default
32
+ baseUrl: 'https://ai.chaoslabs.co', // Optional, this is the default
33
33
  });
34
34
 
35
35
  const response = await chaos.chat.responses.create({
@@ -40,7 +40,10 @@ const response = await chaos.chat.responses.create({
40
40
  metadata: {
41
41
  user_id: 'user-123',
42
42
  session_id: 'session-abc',
43
- wallet_id: '0x...', // Your wallet address
43
+ wallets: [
44
+ { address: '0x...', chain: 'ethereum' },
45
+ { address: '0x...', chain: 'base' },
46
+ ],
44
47
  },
45
48
  });
46
49
 
@@ -67,7 +70,11 @@ const response = await chaos.chat.responses.create({
67
70
  input: [
68
71
  { type: 'message', role: 'user', content: 'What is in my portfolio?' }
69
72
  ],
70
- metadata: { user_id: 'user-123', session_id: 'session-abc', wallet_id: '0x...' },
73
+ metadata: {
74
+ user_id: 'user-123',
75
+ session_id: 'session-abc',
76
+ wallets: [{ address: '0x...', chain: 'ethereum' }],
77
+ },
71
78
  onStreamEvent: (msg: StreamMessage) => {
72
79
  // Called immediately as each message arrives from the server
73
80
  console.log(`[${msg.type}]`, msg.content);
@@ -98,7 +105,7 @@ new Chaos(config: ChaosConfig)
98
105
  | Option | Type | Default | Description |
99
106
  |--------|------|---------|-------------|
100
107
  | `apiKey` | `string` | Required | Your Chaos API key |
101
- | `baseUrl` | `string` | `https://ai-staging.chaoslabs.co` | API base URL |
108
+ | `baseUrl` | `string` | `https://ai.chaoslabs.co` | API base URL |
102
109
  | `timeout` | `number` | `120000` | Request timeout in milliseconds |
103
110
 
104
111
  ### Request Options
@@ -110,15 +117,6 @@ new Chaos(config: ChaosConfig)
110
117
  | `metadata` | `RequestMetadata` | User, session, and wallet info |
111
118
  | `onStreamEvent` | `(msg: StreamMessage) => void` | Real-time streaming callback |
112
119
 
113
- > **Important:** API keys are environment-specific. A staging API key will not work with the production API, and vice versa. Make sure your `apiKey` and `baseUrl` are from the same environment.
114
-
115
- **Available Environments:**
116
-
117
- | Environment | Base URL |
118
- |-------------|----------|
119
- | Staging | `https://ai-staging.chaoslabs.co` |
120
- | Production | Coming soon |
121
-
122
120
  ### Models
123
121
 
124
122
  | Model | Description |
@@ -128,14 +126,33 @@ new Chaos(config: ChaosConfig)
128
126
  ### Request Metadata
129
127
 
130
128
  ```typescript
129
+ interface WalletInfo {
130
+ address: string; // Wallet address
131
+ chain: string; // Chain name (e.g., 'ethereum', 'base', 'solana')
132
+ }
133
+
131
134
  interface RequestMetadata {
132
- user_id: string; // Unique user identifier
133
- session_id: string; // Client-generated session ID for conversation continuity
134
- wallet_id?: string; // Wallet address (required for WALLET_MODEL)
135
+ user_id: string; // Unique user identifier
136
+ session_id: string; // Client-generated session ID for conversation continuity
137
+ wallets?: WalletInfo[]; // Array of wallet addresses across multiple chains
135
138
  }
136
139
  ```
137
140
 
138
- > **⚠️ Upcoming Change:** The `wallet_id` field currently accepts a wallet address string. In a future release, this will be replaced with a `wallet` object that includes additional wallet information (chain, connection status, etc.). We will provide migration guidance when this change is released.
141
+ #### Multi-Chain Wallet Support
142
+
143
+ The SDK supports multiple wallets across different chains. Provide an array of wallet/chain pairs:
144
+
145
+ ```typescript
146
+ metadata: {
147
+ user_id: 'user-123',
148
+ session_id: 'session-abc',
149
+ wallets: [
150
+ { address: '0x742d35Cc6634C0532925a3b844Bc9e7595f2bD21', chain: 'ethereum' },
151
+ { address: '0x8ba1f109551bD432803012645Hac136c22C501a', chain: 'base' },
152
+ { address: '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU', chain: 'solana' },
153
+ ],
154
+ }
155
+ ```
139
156
 
140
157
  ### Rendering Responses
141
158
 
@@ -182,11 +199,13 @@ The SDK returns structured blocks for rich content:
182
199
  | Block Type | Description |
183
200
  |------------|-------------|
184
201
  | `table` | Tabular data (portfolio holdings, positions) |
185
- | `pie_chart` | Distribution charts (allocation breakdown) |
186
- | `timeseries` | Historical data charts |
187
- | `transaction_action` | DeFi operations with primitives and risks |
188
- | `interactive_card` | User prompts and confirmations |
202
+ | `chart` (pie) | Distribution charts (allocation breakdown) |
203
+ | `chart` (timeseries) | Historical data charts |
204
+ | `action` | DeFi operations with primitives and risks |
205
+ | `interactive` | User prompts and confirmations |
189
206
  | `markdown` | Rich text content |
207
+ | `info` | Informational messages |
208
+ | `code` | Code blocks with syntax highlighting |
190
209
 
191
210
  ### Helper Functions
192
211
 
@@ -203,10 +222,11 @@ hasBlockers(response: Response): boolean
203
222
 
204
223
  // Type guards
205
224
  isTableBlock(block: Block): block is TableBlock
206
- isPieChartBlock(block: Block): block is PieChartBlock
207
- isTimeseriesBlock(block: Block): block is TimeseriesBlock
225
+ isChartBlock(block: Block): block is ChartBlock
226
+ isPieChartBlock(block: ChartBlock): block is PieChartBlock
227
+ isTimeseriesChartBlock(block: ChartBlock): block is TimeseriesChartBlock
208
228
  isTransactionActionBlock(block: Block): block is TransactionActionBlock
209
- isInteractiveCardBlock(block: Block): block is InteractiveCardBlock
229
+ isInteractiveBlock(block: Block): block is InteractiveBlock
210
230
  isMarkdownBlock(block: Block): block is MarkdownBlock
211
231
  ```
212
232
 
package/dist/blocks.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Block, TableBlock, ChartBlock, TransactionActionBlock, MarkdownBlock, InteractiveBlock, Primitive, Response } from './types.js';
1
+ import type { Block, TableBlock, ChartBlock, TransactionActionBlock, MarkdownBlock, InteractiveBlock, InfoBlock, CodeBlock, Primitive, Response, RiskInfoItem } from './types.js';
2
2
  /**
3
3
  * Extract all table blocks from a response.
4
4
  */
@@ -19,6 +19,14 @@ export declare function extractMarkdownBlocks(response: Response): MarkdownBlock
19
19
  * Extract all interactive blocks from a response.
20
20
  */
21
21
  export declare function extractInteractiveBlocks(response: Response): InteractiveBlock[];
22
+ /**
23
+ * Extract all info blocks from a response.
24
+ */
25
+ export declare function extractInfoBlocks(response: Response): InfoBlock[];
26
+ /**
27
+ * Extract all code blocks from a response.
28
+ */
29
+ export declare function extractCodeBlocks(response: Response): CodeBlock[];
22
30
  /**
23
31
  * Find the first table block with a matching title.
24
32
  */
@@ -55,7 +63,7 @@ export declare function getTableColumn(table: TableBlock, columnName: string): u
55
63
  /**
56
64
  * Find a row in a table by matching a column value.
57
65
  */
58
- export declare function findTableRow(table: TableBlock, columnName: string, value: unknown): (string | number | boolean | null)[] | undefined;
66
+ export declare function findTableRow(table: TableBlock, columnName: string, value: unknown): unknown[] | undefined;
59
67
  /**
60
68
  * Get table dimensions.
61
69
  */
@@ -85,11 +93,11 @@ export declare function getChartPercentages(chart: ChartBlock): Array<{
85
93
  /**
86
94
  * Get all warnings from transaction blocks.
87
95
  */
88
- export declare function getAllWarnings(response: Response): string[];
96
+ export declare function getAllWarnings(response: Response): RiskInfoItem[];
89
97
  /**
90
98
  * Get all blockers from transaction blocks.
91
99
  */
92
- export declare function getAllBlockers(response: Response): string[];
100
+ export declare function getAllBlockers(response: Response): RiskInfoItem[];
93
101
  /**
94
102
  * Get the highest risk level from all transaction blocks.
95
103
  */
package/dist/blocks.js CHANGED
@@ -2,6 +2,7 @@
2
2
  //
3
3
  // Helper functions for working with blocks extracted from responses.
4
4
  import { extractBlocks, isTableBlock, isChartBlock, isTransactionActionBlock, isMarkdownBlock, isInteractiveBlock, } from './types.js';
5
+ import { isInfoBlock, isCodeBlock } from './type-guards.js';
5
6
  // ============================================================================
6
7
  // Block Extraction Utilities
7
8
  // ============================================================================
@@ -35,6 +36,18 @@ export function extractMarkdownBlocks(response) {
35
36
  export function extractInteractiveBlocks(response) {
36
37
  return extractBlocks(response).filter(isInteractiveBlock);
37
38
  }
39
+ /**
40
+ * Extract all info blocks from a response.
41
+ */
42
+ export function extractInfoBlocks(response) {
43
+ return extractBlocks(response).filter(isInfoBlock);
44
+ }
45
+ /**
46
+ * Extract all code blocks from a response.
47
+ */
48
+ export function extractCodeBlocks(response) {
49
+ return extractBlocks(response).filter(isCodeBlock);
50
+ }
38
51
  // ============================================================================
39
52
  // Block Search Utilities
40
53
  // ============================================================================
@@ -42,13 +55,13 @@ export function extractInteractiveBlocks(response) {
42
55
  * Find the first table block with a matching title.
43
56
  */
44
57
  export function findTableByTitle(response, title) {
45
- return extractTableBlocks(response).find((block) => block.title.toLowerCase().includes(title.toLowerCase()));
58
+ return extractTableBlocks(response).find((block) => block.title?.toLowerCase().includes(title.toLowerCase()));
46
59
  }
47
60
  /**
48
61
  * Find the first chart block with a matching title.
49
62
  */
50
63
  export function findChartByTitle(response, title) {
51
- return extractChartBlocks(response).find((block) => block.title.toLowerCase().includes(title.toLowerCase()));
64
+ return extractChartBlocks(response).find((block) => block.title?.toLowerCase().includes(title.toLowerCase()));
52
65
  }
53
66
  /**
54
67
  * Find transaction blocks containing a specific primitive type.
@@ -139,10 +152,7 @@ export function getTableDimensions(table) {
139
152
  * Works with both segments and legacy data formats.
140
153
  */
141
154
  export function getChartData(chart) {
142
- if (chart.segments) {
143
- return chart.segments.map((s) => ({ label: s.label, value: s.value }));
144
- }
145
- if (chart.data) {
155
+ if (chart.chartType === 'pie') {
146
156
  return chart.data.map(([label, value]) => ({ label, value }));
147
157
  }
148
158
  return [];
@@ -224,6 +234,8 @@ export function countBlocksByType(response) {
224
234
  transaction_action: 0,
225
235
  markdown: 0,
226
236
  interactive: 0,
237
+ info: 0,
238
+ code: 0,
227
239
  };
228
240
  for (const block of extractBlocks(response)) {
229
241
  if (block.type in counts) {
@@ -10,8 +10,11 @@ export interface ConversationOptions {
10
10
  maxHistoryLength?: number;
11
11
  /** User identifier */
12
12
  userId: string;
13
- /** Wallet identifier */
14
- walletId: string;
13
+ /** Array of wallet addresses across multiple chains */
14
+ wallets?: Array<{
15
+ address: string;
16
+ chain: string;
17
+ }>;
15
18
  /** Optional initial session ID (auto-generated if not provided) */
16
19
  sessionId?: string;
17
20
  }
@@ -44,8 +44,8 @@ export class Conversation {
44
44
  this.startedAt = new Date();
45
45
  this.metadata = {
46
46
  user_id: options.userId,
47
- wallet_id: options.walletId,
48
47
  session_id: options.sessionId || `session-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
48
+ ...(options.wallets && { wallets: options.wallets }),
49
49
  };
50
50
  }
51
51
  /**
@@ -114,12 +114,10 @@ export class Conversation {
114
114
  * Useful for restoring conversation state.
115
115
  */
116
116
  addAssistantMessage(content) {
117
- // Store assistant responses as user messages with prefix for context
118
- // This matches the pattern used in the multi-turn example
119
117
  this.history.push({
120
118
  type: 'message',
121
- role: 'user',
122
- content: `[Assistant]: ${content}`,
119
+ role: 'assistant',
120
+ content,
123
121
  });
124
122
  this.assistantTurns++;
125
123
  this.trimHistory();
@@ -164,22 +162,16 @@ export class Conversation {
164
162
  model: this.model,
165
163
  maxHistoryLength: this.maxHistoryLength,
166
164
  userId: this.metadata.user_id,
167
- walletId: this.metadata.wallet_id,
165
+ wallets: this.metadata.wallets,
168
166
  });
169
167
  // Copy history
170
168
  for (const msg of this.history) {
171
- if (msg.role === 'user') {
172
- if (msg.content.startsWith('[Assistant]: ')) {
173
- forked.history.push(msg);
174
- forked.assistantTurns++;
175
- }
176
- else {
177
- forked.history.push(msg);
178
- forked.userTurns++;
179
- }
169
+ forked.history.push(msg);
170
+ if (msg.role === 'assistant' || (msg.role === 'user' && msg.content.startsWith('[Assistant]: '))) {
171
+ forked.assistantTurns++;
180
172
  }
181
- else {
182
- forked.history.push(msg);
173
+ else if (msg.role === 'user') {
174
+ forked.userTurns++;
183
175
  }
184
176
  }
185
177
  return forked;
@@ -201,19 +193,17 @@ export class Conversation {
201
193
  static fromJSON(client, data) {
202
194
  const conversation = new Conversation(client, {
203
195
  userId: data.metadata.user_id,
204
- walletId: data.metadata.wallet_id,
196
+ wallets: data.metadata.wallets,
205
197
  sessionId: data.sessionId,
206
198
  });
207
199
  // Restore history
208
200
  for (const msg of data.history) {
209
201
  conversation.history.push(msg);
210
- if (msg.role === 'user') {
211
- if (msg.content.startsWith('[Assistant]: ')) {
212
- conversation.assistantTurns++;
213
- }
214
- else {
215
- conversation.userTurns++;
216
- }
202
+ if (msg.role === 'assistant' || (msg.role === 'user' && msg.content.startsWith('[Assistant]: '))) {
203
+ conversation.assistantTurns++;
204
+ }
205
+ else if (msg.role === 'user') {
206
+ conversation.userTurns++;
217
207
  }
218
208
  }
219
209
  return conversation;
package/dist/index.d.ts CHANGED
@@ -1,17 +1,20 @@
1
1
  export { Chaos as default, Chaos, WALLET_MODEL, ASK_MODEL } from './client.js';
2
2
  export { httpStreamRequest, StreamingHttpClient } from './http-streaming.js';
3
- export type { HttpStreamOptions, StreamingHttpClientOptions, StreamRequestOptions } from './http-streaming.js';
4
- export type { V1WalletRequest, V1AskRequest } from './request.js';
3
+ export type { HttpStreamOptions, StreamingHttpClientOptions, StreamRequestOptions, } from './http-streaming.js';
4
+ export type { V1WalletRequest, V1AskRequest, PreviousMessage } from './request.js';
5
+ export type { WalletInfo } from './types.js';
5
6
  export type { V1StreamEvent, V1FinalState } from './response.js';
6
- export type { ChaosConfig, CreateResponseParams, RequestMetadata, InputItem, Response, OutputItem, ContentPart, Block, OutputText, ChaosBlock, MarkdownBlock, TableBlock, TableColumnType, TableSortDirection, TableColumnConfig, ChartBlock, ChartSeries, ChartSegment, ChartAxis, ChartDataPoint, TransactionActionBlock, Primitive, PrimitiveIcon, PrimitiveLineItem, PrimitiveDisplay, RawTransaction, TransactionGroup, Risks, RiskInfoItem, InteractiveBlock, InteractiveOption, ResponseError, } from './types.js';
7
+ export type { ChaosConfig, CreateResponseParams, RequestMetadata, InputItem, Response, OutputItem, ContentPart, Block, OutputText, ChaosBlock, MarkdownBlock, TableBlock, ChartBlock, PieChartBlock, TimeseriesChartBlock, ChartSeries, ChartSegment, ChartAxis, ChartDataPoint, TransactionActionBlock, Primitive, RawTransaction, TransactionGroup, Risks, RiskInfoItem, InteractiveBlock, InteractiveOption, InfoBlock, CodeBlock, ResponseError, } from './types.js';
7
8
  export { ChaosError, ChaosTimeoutError } from './types.js';
8
9
  export { extractText, extractBlocks, hasRisks, hasBlockers, isTableBlock, isChartBlock, isTransactionActionBlock, isInteractiveBlock, isMarkdownBlock, isOutputText, isChaosBlock, } from './types.js';
9
- export { BlockSchema, parseRawBlock, detectBlockType } from './schemas.js';
10
+ export { BlockSchema, parseRawBlock, detectBlockType, ChaosConfigSchema, InputItemSchema, WalletInfoSchema, RequestMetadataSchema, ResponseSchema, ResponseErrorSchema, OutputItemSchema, OutputTextSchema, ChaosBlockSchema, ContentPartSchema, MarkdownBlockSchema, TableBlockSchema, ChartBlockSchema, PieChartBlockSchema, TimeseriesChartBlockSchema, TransactionActionBlockSchema, InteractiveBlockSchema, InteractiveOptionSchema, InfoBlockSchema, CodeBlockSchema, ChartDataPointSchema, ChartSeriesSchema, ChartSegmentSchema, ChartAxisSchema, PrimitiveSchema, PrimitiveIconSchema, PrimitiveLineItemSchema, PrimitiveDisplaySchema, RawTransactionSchema, TransactionGroupSchema, RisksSchema, RiskCheckSchema, RiskInfoItemSchema, PreviousMessageSchema, V1WalletRequestSchema, V1AskRequestSchema, V1StreamEventSchema, V1FinalStateSchema, MessageTypeSchema, AgentStatusSchema, StreamMessageContextSchema, StreamMessageSchema, AgentStatusMessageSchema, AgentTextMessageSchema, ReportMessageSchema, FollowUpSuggestionsMessageSchema, UserInputMessageSchema, AgentStatusContentSchema, AgentMessageContentSchema, AgentTextDataSchema, ReportContentSchema, CaptionSchema, ReferenceSchema, FollowUpSuggestionsContentSchema, FollowUpDataSchema, UserInputContentSchema, UserInputCandidateSchema, ConversationOptionsSchema, ConversationStatsSchema, PrimitiveTypeSchema, SwapParamsSchema, BridgeParamsSchema, LendingParamsSchema, StakingParamsSchema, ClaimParamsSchema, LiquidityParamsSchema, PositionParamsSchema, DepositParamsSchema, MintParamsSchema, ApproveParamsSchema, TransferParamsSchema, WrapParamsSchema, TypedPrimitiveSchema, SwapPrimitiveSchema, BridgePrimitiveSchema, SupplyPrimitiveSchema, WithdrawPrimitiveSchema, BorrowPrimitiveSchema, RepayPrimitiveSchema, StakePrimitiveSchema, UnstakePrimitiveSchema, ClaimPrimitiveSchema, AddLiquidityPrimitiveSchema, RemoveLiquidityPrimitiveSchema, OpenPositionPrimitiveSchema, ClosePositionPrimitiveSchema, DepositPrimitiveSchema, MintPrimitiveSchema, BurnPrimitiveSchema, RestakePrimitiveSchema, ApprovePrimitiveSchema, TransferPrimitiveSchema, WrapPrimitiveSchema, UnwrapPrimitiveSchema, UnknownPrimitiveSchema, } from './schemas.js';
10
11
  export type { BlockParsed } from './schemas.js';
11
12
  export { Conversation } from './conversation.js';
12
13
  export type { ConversationOptions, ConversationStats } from './conversation.js';
13
14
  export { PRIMITIVE_SWAP, PRIMITIVE_SUPPLY, PRIMITIVE_WITHDRAW, PRIMITIVE_BORROW, PRIMITIVE_REPAY, PRIMITIVE_STAKE, PRIMITIVE_UNSTAKE, PRIMITIVE_CLAIM, PRIMITIVE_BRIDGE, PRIMITIVE_ADD_LIQUIDITY, PRIMITIVE_REMOVE_LIQUIDITY, PRIMITIVE_OPEN_POSITION, PRIMITIVE_CLOSE_POSITION, PRIMITIVE_DEPOSIT, PRIMITIVE_MINT, PRIMITIVE_BURN, PRIMITIVE_RESTAKE, PRIMITIVE_APPROVE, PRIMITIVE_TRANSFER, PRIMITIVE_WRAP, PRIMITIVE_UNWRAP, ALL_PRIMITIVES, LENDING_PRIMITIVES, TRADING_PRIMITIVES, STAKING_PRIMITIVES, LIQUIDITY_PRIMITIVES, TRANSFER_PRIMITIVES, isValidPrimitive, isLendingPrimitive, isTradingPrimitive, isStakingPrimitive, isLiquidityPrimitive, isTransferPrimitive, } from './primitives.js';
14
- export type { PrimitiveType } from './primitives.js';
15
- export { extractTableBlocks, extractChartBlocks, extractTransactionBlocks, extractMarkdownBlocks, extractInteractiveBlocks, findTableByTitle, findChartByTitle, findTransactionsByPrimitive, extractPrimitives, extractPrimitivesByType, getPrimitiveTypes, tableToObjects, getTableColumn, findTableRow, getTableDimensions, getChartData, getChartTotal, getChartPercentages, getAllWarnings, getAllBlockers, getHighestRiskLevel, countBlocksByType, hasBlocks, hasBlockType, } from './blocks.js';
15
+ export type { PrimitiveType, SwapParams, BridgeParams, LendingParams, StakingParams, ClaimParams, LiquidityParams, PositionParams, DepositParams, MintParams, ApproveParams, TransferParams, WrapParams, Primitive as TypedPrimitive, SwapPrimitive, BridgePrimitive, SupplyPrimitive, WithdrawPrimitive, BorrowPrimitive, RepayPrimitive, StakePrimitive, UnstakePrimitive, ClaimPrimitive, AddLiquidityPrimitive, RemoveLiquidityPrimitive, OpenPositionPrimitive, ClosePositionPrimitive, DepositPrimitive, MintPrimitive, BurnPrimitive, RestakePrimitive, ApprovePrimitive, TransferPrimitive, WrapPrimitive, UnwrapPrimitive, UnknownPrimitive, } from './primitives.js';
16
+ export { extractTableBlocks, extractChartBlocks, extractTransactionBlocks, extractMarkdownBlocks, extractInteractiveBlocks, extractInfoBlocks, extractCodeBlocks, findTableByTitle, findChartByTitle, findTransactionsByPrimitive, extractPrimitives, extractPrimitivesByType, getPrimitiveTypes, tableToObjects, getTableColumn, findTableRow, getTableDimensions, getChartData, getChartTotal, getChartPercentages, getAllWarnings, getAllBlockers, getHighestRiskLevel, countBlocksByType, hasBlocks, hasBlockType, } from './blocks.js';
16
17
  export { isAgentStatusMessage, isAgentMessage, isReportMessage, isFollowUpSuggestions, isUserInputMessage, parseAgentStatus, isTerminalStatus, extractAgentMessageText, extractSuggestions, extractReportBlock, parseStreamLine, parseStreamLines, } from './stream.js';
17
- export type { MessageType, AgentStatus, StreamMessage, StreamMessageContext, } from './stream.js';
18
+ export type { MessageType, AgentStatus, StreamMessage, StreamMessageContext, AgentStatusContent, AgentMessageContent, AgentTextData, ReportContent, Caption, Reference, FollowUpSuggestionsContent, FollowUpData, UserInputContent, UserInputCandidate, AgentStatusMessage, AgentTextMessage, ReportMessage, FollowUpSuggestionsMessage, UserInputMessage, } from './stream.js';
19
+ export { isSwapPrimitive, isBridgePrimitive, isSupplyPrimitive, isWithdrawPrimitive, isBorrowPrimitive, isRepayPrimitive, isStakePrimitive, isUnstakePrimitive, isClaimPrimitive, isAddLiquidityPrimitive, isRemoveLiquidityPrimitive, isOpenPositionPrimitive, isClosePositionPrimitive, isDepositPrimitive, isMintPrimitive, isBurnPrimitive, isRestakePrimitive, isApprovePrimitive, isTransferPrimitive as isTransferTypedPrimitive, // Renamed to avoid conflict with primitives.ts
20
+ isWrapPrimitive, isUnwrapPrimitive, isPieChartBlock, isTimeseriesChartBlock, isInfoBlock, isCodeBlock, } from './type-guards.js';
package/dist/index.js CHANGED
@@ -6,7 +6,29 @@ export { ChaosError, ChaosTimeoutError } from './types.js';
6
6
  // Export helper functions
7
7
  export { extractText, extractBlocks, hasRisks, hasBlockers, isTableBlock, isChartBlock, isTransactionActionBlock, isInteractiveBlock, isMarkdownBlock, isOutputText, isChaosBlock, } from './types.js';
8
8
  // Export schemas for validation
9
- export { BlockSchema, parseRawBlock, detectBlockType } from './schemas.js';
9
+ export {
10
+ // Block detection and parsing
11
+ BlockSchema, parseRawBlock, detectBlockType,
12
+ // Config and request schemas
13
+ ChaosConfigSchema, InputItemSchema, WalletInfoSchema, RequestMetadataSchema,
14
+ // Response schemas
15
+ ResponseSchema, ResponseErrorSchema, OutputItemSchema, OutputTextSchema, ChaosBlockSchema, ContentPartSchema,
16
+ // Block schemas
17
+ MarkdownBlockSchema, TableBlockSchema, ChartBlockSchema, PieChartBlockSchema, TimeseriesChartBlockSchema, TransactionActionBlockSchema, InteractiveBlockSchema, InteractiveOptionSchema, InfoBlockSchema, CodeBlockSchema,
18
+ // Chart component schemas
19
+ ChartDataPointSchema, ChartSeriesSchema, ChartSegmentSchema, ChartAxisSchema,
20
+ // Transaction component schemas
21
+ PrimitiveSchema, PrimitiveIconSchema, PrimitiveLineItemSchema, PrimitiveDisplaySchema, RawTransactionSchema, TransactionGroupSchema, RisksSchema, RiskCheckSchema, RiskInfoItemSchema,
22
+ // V1 API schemas
23
+ PreviousMessageSchema, V1WalletRequestSchema, V1AskRequestSchema, V1StreamEventSchema, V1FinalStateSchema,
24
+ // Stream message schemas
25
+ MessageTypeSchema, AgentStatusSchema, StreamMessageContextSchema, StreamMessageSchema, AgentStatusMessageSchema, AgentTextMessageSchema, ReportMessageSchema, FollowUpSuggestionsMessageSchema, UserInputMessageSchema, AgentStatusContentSchema, AgentMessageContentSchema, AgentTextDataSchema, ReportContentSchema, CaptionSchema, ReferenceSchema, FollowUpSuggestionsContentSchema, FollowUpDataSchema, UserInputContentSchema, UserInputCandidateSchema,
26
+ // Conversation schemas
27
+ ConversationOptionsSchema, ConversationStatsSchema,
28
+ // Primitive type and param schemas
29
+ PrimitiveTypeSchema, SwapParamsSchema, BridgeParamsSchema, LendingParamsSchema, StakingParamsSchema, ClaimParamsSchema, LiquidityParamsSchema, PositionParamsSchema, DepositParamsSchema, MintParamsSchema, ApproveParamsSchema, TransferParamsSchema, WrapParamsSchema,
30
+ // Typed primitive schemas
31
+ TypedPrimitiveSchema, SwapPrimitiveSchema, BridgePrimitiveSchema, SupplyPrimitiveSchema, WithdrawPrimitiveSchema, BorrowPrimitiveSchema, RepayPrimitiveSchema, StakePrimitiveSchema, UnstakePrimitiveSchema, ClaimPrimitiveSchema, AddLiquidityPrimitiveSchema, RemoveLiquidityPrimitiveSchema, OpenPositionPrimitiveSchema, ClosePositionPrimitiveSchema, DepositPrimitiveSchema, MintPrimitiveSchema, BurnPrimitiveSchema, RestakePrimitiveSchema, ApprovePrimitiveSchema, TransferPrimitiveSchema, WrapPrimitiveSchema, UnwrapPrimitiveSchema, UnknownPrimitiveSchema, } from './schemas.js';
10
32
  // Export Conversation class
11
33
  export { Conversation } from './conversation.js';
12
34
  // Export primitive constants and helpers
@@ -20,7 +42,7 @@ isValidPrimitive, isLendingPrimitive, isTradingPrimitive, isStakingPrimitive, is
20
42
  // Export block utilities
21
43
  export {
22
44
  // Block extraction
23
- extractTableBlocks, extractChartBlocks, extractTransactionBlocks, extractMarkdownBlocks, extractInteractiveBlocks,
45
+ extractTableBlocks, extractChartBlocks, extractTransactionBlocks, extractMarkdownBlocks, extractInteractiveBlocks, extractInfoBlocks, extractCodeBlocks,
24
46
  // Block search
25
47
  findTableByTitle, findChartByTitle, findTransactionsByPrimitive,
26
48
  // Primitive extraction
@@ -35,3 +57,12 @@ getAllWarnings, getAllBlockers, getHighestRiskLevel,
35
57
  countBlocksByType, hasBlocks, hasBlockType, } from './blocks.js';
36
58
  // Export stream message utilities
37
59
  export { isAgentStatusMessage, isAgentMessage, isReportMessage, isFollowUpSuggestions, isUserInputMessage, parseAgentStatus, isTerminalStatus, extractAgentMessageText, extractSuggestions, extractReportBlock, parseStreamLine, parseStreamLines, } from './stream.js';
60
+ // Export typed primitive type guards
61
+ export {
62
+ // Primitive type guards
63
+ isSwapPrimitive, isBridgePrimitive, isSupplyPrimitive, isWithdrawPrimitive, isBorrowPrimitive, isRepayPrimitive, isStakePrimitive, isUnstakePrimitive, isClaimPrimitive, isAddLiquidityPrimitive, isRemoveLiquidityPrimitive, isOpenPositionPrimitive, isClosePositionPrimitive, isDepositPrimitive, isMintPrimitive, isBurnPrimitive, isRestakePrimitive, isApprovePrimitive, isTransferPrimitive as isTransferTypedPrimitive, // Renamed to avoid conflict with primitives.ts
64
+ isWrapPrimitive, isUnwrapPrimitive,
65
+ // Chart subtype guards
66
+ isPieChartBlock, isTimeseriesChartBlock,
67
+ // Block type guards
68
+ isInfoBlock, isCodeBlock, } from './type-guards.js';