@aui.io/aui-client 1.2.11 → 1.2.12

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
@@ -32,28 +32,34 @@ const client = new ApolloClient({
32
32
 
33
33
  ```typescript
34
34
  // Create a new task
35
- const response = await client.externalApis.task({
35
+ const taskResponse = await client.controllerApi.createTask({
36
36
  user_id: 'user123'
37
37
  });
38
38
 
39
- console.log('Task ID:', response.data.task_id);
39
+ console.log('Task ID:', taskResponse.id);
40
+ console.log('Welcome:', taskResponse.welcome_message);
40
41
 
41
42
  // Get all messages for a task
42
- const messages = await client.externalApis.getTaskMessages(response.data.task_id);
43
- console.log('Messages:', messages.data);
43
+ const messages = await client.controllerApi.getTaskMessages(taskResponse.id);
44
+ console.log('Messages:', messages);
44
45
 
45
46
  // Submit a message to an existing task
46
- await client.externalApis.message({
47
- task_id: response.data.task_id,
48
- text: 'Looking for a microwave with at least 20 liters capacity'
47
+ const messageResponse = await client.controllerApi.sendMessage({
48
+ task_id: taskResponse.id,
49
+ text: 'Looking for a microwave with at least 20 liters capacity',
50
+ is_external_api: true
49
51
  });
50
52
 
53
+ console.log('Agent response:', messageResponse.text);
54
+
51
55
  // Get all tasks for a user
52
- const userTasks = await client.externalApis.getTasksByUserId({
56
+ const userTasks = await client.controllerApi.listUserTasks({
53
57
  user_id: 'user123',
54
58
  page: 1,
55
59
  size: 10
56
60
  });
61
+
62
+ console.log('Total tasks:', userTasks.total);
57
63
  ```
58
64
 
59
65
  ### WebSocket - Real-time Agent Communication
@@ -76,25 +82,30 @@ socket.on('open', () => {
76
82
  // Handle streaming responses
77
83
  socket.on('message', (message) => {
78
84
  // Streaming updates (partial responses)
79
- if (message.type === 'streaming_update') {
80
- console.log('Agent is typing:', message.data.text);
85
+ if (message.channel?.eventName === 'thread-message-text-content-updated') {
86
+ console.log('Agent is typing:', message.data?.text);
81
87
  }
82
88
 
83
89
  // Final message with complete response
84
- if (message.type === 'final_message') {
85
- console.log('Complete response:', message.data.text);
90
+ if (message.id && message.text && message.sender) {
91
+ console.log('Complete response:', message.text);
86
92
 
87
93
  // Handle product recommendations (if any)
88
- if (message.data.product_cards) {
89
- message.data.product_cards.forEach(product => {
90
- console.log(`${product.title} - $${product.price}`);
94
+ if (message.cards && message.cards.length > 0) {
95
+ message.cards.forEach(card => {
96
+ console.log(`${card.name} - ${card.id}`);
91
97
  });
92
98
  }
99
+
100
+ // Follow-up suggestions
101
+ if (message.followupSuggestions) {
102
+ console.log('Suggestions:', message.followupSuggestions);
103
+ }
93
104
  }
94
105
 
95
106
  // Error messages
96
- if (message.type === 'error') {
97
- console.error('Agent error:', message.data.message);
107
+ if (message.statusCode) {
108
+ console.error('Agent error:', message.description);
98
109
  }
99
110
  });
100
111
 
@@ -149,52 +160,52 @@ The SDK is configured for production use. All REST and WebSocket connections use
149
160
 
150
161
  ### REST API Methods
151
162
 
152
- All methods are accessed via `client.externalApis.*`
163
+ All methods are accessed via `client.controllerApi.*`
153
164
 
154
- #### `task(request)` - Create Task
165
+ #### `createTask(request)` - Create Task
155
166
  Create a new task for the agent.
156
167
 
157
168
  ```typescript
158
- const response = await client.externalApis.task({
169
+ const taskResponse = await client.controllerApi.createTask({
159
170
  user_id: string // Unique user identifier
160
171
  });
161
172
 
162
- // Returns: { data: { task_id: string, user_id: string, ... } }
173
+ // Returns: { id: string, user_id: string, title: string, welcome_message?: string }
163
174
  ```
164
175
 
165
176
  #### `getTaskMessages(taskId)` - Get Task Messages
166
177
  Retrieve all messages for a specific task.
167
178
 
168
179
  ```typescript
169
- const response = await client.externalApis.getTaskMessages(taskId: string);
180
+ const messages = await client.controllerApi.getTaskMessages(taskId: string);
170
181
 
171
- // Returns: { data: ExternalTaskMessage[] }
182
+ // Returns: Message[] - Array of messages
172
183
  ```
173
184
 
174
- #### `message(request)` - Submit Message
175
- Submit a new message to an existing task.
185
+ #### `sendMessage(request)` - Send Message
186
+ Submit a new message to an existing task (non-streaming).
176
187
 
177
188
  ```typescript
178
- const response = await client.externalApis.message({
189
+ const messageResponse = await client.controllerApi.sendMessage({
179
190
  task_id: string, // Task identifier
180
191
  text: string, // Message text
181
192
  is_external_api?: boolean // Optional: mark as external API call
182
193
  });
183
194
 
184
- // Returns: { data: ExternalTaskMessage }
195
+ // Returns: Message - Complete agent response with optional product cards
185
196
  ```
186
197
 
187
- #### `getTasksByUserId(request)` - Get User Tasks
198
+ #### `listUserTasks(request)` - List User Tasks
188
199
  Retrieve all tasks for a specific user with pagination.
189
200
 
190
201
  ```typescript
191
- const response = await client.externalApis.getTasksByUserId({
202
+ const tasksResponse = await client.controllerApi.listUserTasks({
192
203
  user_id: string, // User identifier
193
- page?: number, // Page number (optional)
194
- size?: number // Page size (optional)
204
+ page?: number, // Page number (optional, default: 1)
205
+ size?: number // Page size (optional, default: 10)
195
206
  });
196
207
 
197
- // Returns: { data: { items: ExternalTask[], total: number, ... } }
208
+ // Returns: { tasks: Task[], total: number, page: number, size: number }
198
209
  ```
199
210
 
200
211
  ---
@@ -270,11 +281,11 @@ const client = new ApolloClient({
270
281
 
271
282
  async function searchProducts(userId: string, query: string) {
272
283
  // Step 1: Create a task
273
- const taskResponse = await client.externalApis.task({
284
+ const taskResponse = await client.controllerApi.createTask({
274
285
  user_id: userId
275
286
  });
276
287
 
277
- const taskId = taskResponse.data.task_id;
288
+ const taskId = taskResponse.id;
278
289
  console.log('Created task:', taskId);
279
290
 
280
291
  // Step 2: Connect to WebSocket
@@ -290,21 +301,23 @@ async function searchProducts(userId: string, query: string) {
290
301
  });
291
302
 
292
303
  socket.on('message', (message) => {
293
- if (message.type === 'streaming_update') {
304
+ if (message.channel?.eventName === 'thread-message-text-content-updated') {
294
305
  // Show real-time updates
295
- console.log('Agent:', message.data.text);
306
+ console.log('Agent:', message.data?.text);
296
307
  }
297
308
 
298
- if (message.type === 'final_message') {
299
- console.log('\n✅ Final Response:', message.data.text);
309
+ if (message.id && message.text && message.sender) {
310
+ console.log('\n✅ Final Response:', message.text);
300
311
 
301
312
  // Display product recommendations
302
- if (message.data.product_cards && message.data.product_cards.length > 0) {
313
+ if (message.cards && message.cards.length > 0) {
303
314
  console.log('\n🛍️ Product Recommendations:');
304
- message.data.product_cards.forEach((product, index) => {
305
- console.log(`${index + 1}. ${product.title}`);
306
- console.log(` Price: $${product.price}`);
307
- console.log(` Link: ${product.url}`);
315
+ message.cards.forEach((card, index) => {
316
+ console.log(`${index + 1}. ${card.name}`);
317
+ console.log(` Product ID: ${card.id}`);
318
+ if (card.parameters && card.parameters.length > 0) {
319
+ console.log(` Attributes: ${card.parameters.length}`);
320
+ }
308
321
  });
309
322
  }
310
323
 
@@ -333,22 +346,22 @@ const client = new ApolloClient({
333
346
 
334
347
  async function getTaskHistory(userId: string) {
335
348
  // Get all tasks for a user
336
- const tasks = await client.externalApis.getTasksByUserId({
349
+ const tasksResponse = await client.controllerApi.listUserTasks({
337
350
  user_id: userId,
338
351
  page: 1,
339
352
  size: 20
340
353
  });
341
354
 
342
- console.log(`Found ${tasks.data.total} tasks`);
355
+ console.log(`Found ${tasksResponse.total} tasks`);
343
356
 
344
357
  // Get messages for the most recent task
345
- if (tasks.data.items.length > 0) {
346
- const latestTask = tasks.data.items[0];
347
- const messages = await client.externalApis.getTaskMessages(latestTask.task_id);
358
+ if (tasksResponse.tasks && tasksResponse.tasks.length > 0) {
359
+ const latestTask = tasksResponse.tasks[0];
360
+ const messages = await client.controllerApi.getTaskMessages(latestTask.id);
348
361
 
349
- console.log(`Task ${latestTask.task_id} has ${messages.data.length} messages`);
350
- messages.data.forEach(msg => {
351
- console.log(`[${msg.sender}]: ${msg.text}`);
362
+ console.log(`Task ${latestTask.id} has ${messages.length} messages`);
363
+ messages.forEach(msg => {
364
+ console.log(`[${msg.sender.type}]: ${msg.text}`);
352
365
  });
353
366
  }
354
367
  }
@@ -368,7 +381,7 @@ const client = new ApolloClient({
368
381
  });
369
382
 
370
383
  // Per-request overrides
371
- const response = await client.externalApis.task(
384
+ const taskResponse = await client.controllerApi.createTask(
372
385
  { user_id: 'user123' },
373
386
  {
374
387
  timeoutInSeconds: 30, // Override for this request only
@@ -380,7 +393,7 @@ const response = await client.externalApis.task(
380
393
  ### WebSocket with Reconnection
381
394
 
382
395
  ```typescript
383
- const socket = await client.externalSession.connect({
396
+ const socket = await client.apolloWsSession.connect({
384
397
  reconnectAttempts: 50, // Try to reconnect up to 50 times
385
398
  debug: true // Enable debug logging
386
399
  });
@@ -402,7 +415,7 @@ const client = new ApolloClient({
402
415
  });
403
416
 
404
417
  try {
405
- const response = await client.externalApis.task({
418
+ const taskResponse = await client.controllerApi.createTask({
406
419
  user_id: 'user123'
407
420
  });
408
421
  } catch (error) {
@@ -448,8 +461,8 @@ const client = new ApolloClient({
448
461
  });
449
462
 
450
463
  // TypeScript will autocomplete and type-check
451
- const response = await client.externalApis.task({ user_id: 'user123' });
452
- response.data.task_id; // ✅ Fully typed
464
+ const taskResponse = await client.controllerApi.createTask({ user_id: 'user123' });
465
+ taskResponse.id; // ✅ Fully typed
453
466
  ```
454
467
 
455
468
  ## 🐛 Troubleshooting
@@ -45,8 +45,8 @@ class ApolloClient {
45
45
  "x-network-api-key": _options === null || _options === void 0 ? void 0 : _options.networkApiKey,
46
46
  "X-Fern-Language": "JavaScript",
47
47
  "X-Fern-SDK-Name": "@aui.io/aui-client",
48
- "X-Fern-SDK-Version": "1.2.11",
49
- "User-Agent": "@aui.io/aui-client/1.2.11",
48
+ "X-Fern-SDK-Version": "1.2.12",
49
+ "User-Agent": "@aui.io/aui-client/1.2.12",
50
50
  "X-Fern-Runtime": core.RUNTIME.type,
51
51
  "X-Fern-Runtime-Version": core.RUNTIME.version,
52
52
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.2.11";
1
+ export declare const SDK_VERSION = "1.2.12";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.2.11";
4
+ exports.SDK_VERSION = "1.2.12";
@@ -9,8 +9,8 @@ export class ApolloClient {
9
9
  "x-network-api-key": _options === null || _options === void 0 ? void 0 : _options.networkApiKey,
10
10
  "X-Fern-Language": "JavaScript",
11
11
  "X-Fern-SDK-Name": "@aui.io/aui-client",
12
- "X-Fern-SDK-Version": "1.2.11",
13
- "User-Agent": "@aui.io/aui-client/1.2.11",
12
+ "X-Fern-SDK-Version": "1.2.12",
13
+ "User-Agent": "@aui.io/aui-client/1.2.12",
14
14
  "X-Fern-Runtime": core.RUNTIME.type,
15
15
  "X-Fern-Runtime-Version": core.RUNTIME.version,
16
16
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.2.11";
1
+ export declare const SDK_VERSION = "1.2.12";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.2.11";
1
+ export const SDK_VERSION = "1.2.12";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aui.io/aui-client",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
4
4
  "private": false,
5
5
  "repository": "github:aui-io/aui-client-typescript",
6
6
  "type": "commonjs",