@chaoslabs/ai-sdk 0.0.11 → 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 +98 -0
- package/README.md +42 -13
- package/dist/blocks.d.ts +12 -4
- package/dist/blocks.js +18 -6
- package/dist/conversation.d.ts +5 -2
- package/dist/conversation.js +15 -25
- package/dist/index.d.ts +9 -6
- package/dist/index.js +33 -2
- package/dist/primitives.d.ts +458 -0
- package/dist/primitives.js +1 -0
- package/dist/request.d.ts +14 -12
- package/dist/request.js +42 -12
- package/dist/response.js +15 -24
- package/dist/schemas.d.ts +5728 -577
- package/dist/schemas.js +583 -92
- package/dist/stream.js +8 -4
- package/dist/type-guards.d.ts +316 -0
- package/dist/type-guards.js +373 -0
- package/dist/types.d.ts +87 -110
- package/dist/types.js +3 -2
- package/package.json +6 -8
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,104 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
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
|
+
|
|
8
106
|
## [0.0.11] - 2026-01-27
|
|
9
107
|
|
|
10
108
|
### Added
|
package/README.md
CHANGED
|
@@ -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
|
-
|
|
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: {
|
|
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);
|
|
@@ -119,14 +126,33 @@ new Chaos(config: ChaosConfig)
|
|
|
119
126
|
### Request Metadata
|
|
120
127
|
|
|
121
128
|
```typescript
|
|
129
|
+
interface WalletInfo {
|
|
130
|
+
address: string; // Wallet address
|
|
131
|
+
chain: string; // Chain name (e.g., 'ethereum', 'base', 'solana')
|
|
132
|
+
}
|
|
133
|
+
|
|
122
134
|
interface RequestMetadata {
|
|
123
|
-
user_id: string;
|
|
124
|
-
session_id: string;
|
|
125
|
-
|
|
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
|
|
126
138
|
}
|
|
127
139
|
```
|
|
128
140
|
|
|
129
|
-
|
|
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
|
+
```
|
|
130
156
|
|
|
131
157
|
### Rendering Responses
|
|
132
158
|
|
|
@@ -173,11 +199,13 @@ The SDK returns structured blocks for rich content:
|
|
|
173
199
|
| Block Type | Description |
|
|
174
200
|
|------------|-------------|
|
|
175
201
|
| `table` | Tabular data (portfolio holdings, positions) |
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
| `
|
|
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 |
|
|
180
206
|
| `markdown` | Rich text content |
|
|
207
|
+
| `info` | Informational messages |
|
|
208
|
+
| `code` | Code blocks with syntax highlighting |
|
|
181
209
|
|
|
182
210
|
### Helper Functions
|
|
183
211
|
|
|
@@ -194,10 +222,11 @@ hasBlockers(response: Response): boolean
|
|
|
194
222
|
|
|
195
223
|
// Type guards
|
|
196
224
|
isTableBlock(block: Block): block is TableBlock
|
|
197
|
-
|
|
198
|
-
|
|
225
|
+
isChartBlock(block: Block): block is ChartBlock
|
|
226
|
+
isPieChartBlock(block: ChartBlock): block is PieChartBlock
|
|
227
|
+
isTimeseriesChartBlock(block: ChartBlock): block is TimeseriesChartBlock
|
|
199
228
|
isTransactionActionBlock(block: Block): block is TransactionActionBlock
|
|
200
|
-
|
|
229
|
+
isInteractiveBlock(block: Block): block is InteractiveBlock
|
|
201
230
|
isMarkdownBlock(block: Block): block is MarkdownBlock
|
|
202
231
|
```
|
|
203
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):
|
|
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):
|
|
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):
|
|
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
|
|
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
|
|
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.
|
|
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) {
|
package/dist/conversation.d.ts
CHANGED
|
@@ -10,8 +10,11 @@ export interface ConversationOptions {
|
|
|
10
10
|
maxHistoryLength?: number;
|
|
11
11
|
/** User identifier */
|
|
12
12
|
userId: string;
|
|
13
|
-
/**
|
|
14
|
-
|
|
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
|
}
|
package/dist/conversation.js
CHANGED
|
@@ -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: '
|
|
122
|
-
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
|
-
|
|
165
|
+
wallets: this.metadata.wallets,
|
|
168
166
|
});
|
|
169
167
|
// Copy history
|
|
170
168
|
for (const msg of this.history) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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,
|
|
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
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 {
|
|
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';
|