@aui.io/aui-client 1.2.17 → 1.2.18
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 +81 -5
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/controllerApi/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/controllerApi/client/Client.js +2 -1
- package/dist/cjs/api/resources/controllerApi/client/requests/CreateTaskRequest.d.ts +4 -1
- package/dist/cjs/api/types/Message.d.ts +1 -0
- package/dist/cjs/api/types/RecordOriginType.d.ts +9 -0
- package/dist/cjs/api/types/RecordOriginType.js +12 -0
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/controllerApi/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/controllerApi/client/Client.mjs +2 -1
- package/dist/esm/api/resources/controllerApi/client/requests/CreateTaskRequest.d.mts +4 -1
- package/dist/esm/api/types/Message.d.mts +1 -0
- package/dist/esm/api/types/RecordOriginType.d.mts +9 -0
- package/dist/esm/api/types/RecordOriginType.mjs +9 -0
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +2 -1
package/README.md
CHANGED
|
@@ -31,7 +31,8 @@ const client = new ApolloClient({
|
|
|
31
31
|
```typescript
|
|
32
32
|
// Create a new task
|
|
33
33
|
const taskResponse = await client.controllerApi.createTask({
|
|
34
|
-
user_id: 'user123'
|
|
34
|
+
user_id: 'user123',
|
|
35
|
+
task_origin_type: 'web-widget' // Required: identifies the source of the task
|
|
35
36
|
});
|
|
36
37
|
|
|
37
38
|
console.log('Task ID:', taskResponse.id);
|
|
@@ -165,12 +166,15 @@ Create a new task for the agent.
|
|
|
165
166
|
|
|
166
167
|
```typescript
|
|
167
168
|
const taskResponse = await client.controllerApi.createTask({
|
|
168
|
-
user_id: string
|
|
169
|
+
user_id: string, // Unique user identifier
|
|
170
|
+
task_origin_type: string // Required: origin type (e.g., 'web-widget', 'mobile-app', 'api')
|
|
169
171
|
});
|
|
170
172
|
|
|
171
173
|
// Returns: { id: string, user_id: string, title: string, welcome_message?: string }
|
|
172
174
|
```
|
|
173
175
|
|
|
176
|
+
**Note:** `task_origin_type` is required in v1.2.17+. Common values: `'web-widget'`, `'mobile-app'`, `'api'`, `'internal-tool'`
|
|
177
|
+
|
|
174
178
|
#### `getTaskMessages(taskId)` - Get Task Messages
|
|
175
179
|
Retrieve all messages for a specific task.
|
|
176
180
|
|
|
@@ -206,6 +210,17 @@ const tasksResponse = await client.controllerApi.listUserTasks({
|
|
|
206
210
|
// Returns: { tasks: Task[], total: number, page: number, size: number }
|
|
207
211
|
```
|
|
208
212
|
|
|
213
|
+
#### `getProductMetadata(link)` - Get Product Metadata
|
|
214
|
+
Retrieve metadata for a product from a given URL/link.
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
const metadata = await client.controllerApi.getProductMetadata({
|
|
218
|
+
link: string // Product URL or link
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// Returns: Record<string, any> - Product metadata object
|
|
222
|
+
```
|
|
223
|
+
|
|
209
224
|
---
|
|
210
225
|
|
|
211
226
|
### WebSocket API
|
|
@@ -246,6 +261,11 @@ socket.on('close', (event: CloseEvent) => void);
|
|
|
246
261
|
- `final_message` - Complete response with optional product cards
|
|
247
262
|
- `error` - Error message from the agent
|
|
248
263
|
|
|
264
|
+
**New in v0.6.0:**
|
|
265
|
+
- **Message fields:** `welcome_message`, `executed_workflows` - Track workflow execution and welcome messages
|
|
266
|
+
- **Card fields:** `category`, `query`, `sub_entities`, `self_review` - Enhanced product card information with self-review scoring
|
|
267
|
+
- **Product Metadata API:** New endpoint to retrieve metadata from product URLs
|
|
268
|
+
|
|
249
269
|
#### Socket Methods
|
|
250
270
|
|
|
251
271
|
```typescript
|
|
@@ -280,7 +300,8 @@ const client = new ApolloClient({
|
|
|
280
300
|
async function searchProducts(userId: string, query: string) {
|
|
281
301
|
// Step 1: Create a task
|
|
282
302
|
const taskResponse = await client.controllerApi.createTask({
|
|
283
|
-
user_id: userId
|
|
303
|
+
user_id: userId,
|
|
304
|
+
task_origin_type: 'web-widget'
|
|
284
305
|
});
|
|
285
306
|
|
|
286
307
|
const taskId = taskResponse.id;
|
|
@@ -367,6 +388,40 @@ async function getTaskHistory(userId: string) {
|
|
|
367
388
|
getTaskHistory('user123');
|
|
368
389
|
```
|
|
369
390
|
|
|
391
|
+
### Get Product Metadata
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
import { ApolloClient } from '@aui.io/aui-client';
|
|
395
|
+
|
|
396
|
+
const client = new ApolloClient({
|
|
397
|
+
networkApiKey: 'API_KEY_YOUR_KEY_HERE'
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
async function fetchProductMetadata(productLink: string) {
|
|
401
|
+
try {
|
|
402
|
+
// Fetch metadata for a product
|
|
403
|
+
const metadata = await client.controllerApi.getProductMetadata({
|
|
404
|
+
link: productLink
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
console.log('Product Metadata:', metadata);
|
|
408
|
+
|
|
409
|
+
// Metadata might include: name, price, description, images, etc.
|
|
410
|
+
if (metadata) {
|
|
411
|
+
console.log('Available fields:', Object.keys(metadata));
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
return metadata;
|
|
415
|
+
} catch (error) {
|
|
416
|
+
console.error('Error fetching product metadata:', error);
|
|
417
|
+
throw error;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// Example usage
|
|
422
|
+
fetchProductMetadata('https://www.example.com/product/12345');
|
|
423
|
+
```
|
|
424
|
+
|
|
370
425
|
## 🔧 Advanced Configuration
|
|
371
426
|
|
|
372
427
|
### Custom Timeout and Retries
|
|
@@ -380,7 +435,10 @@ const client = new ApolloClient({
|
|
|
380
435
|
|
|
381
436
|
// Per-request overrides
|
|
382
437
|
const taskResponse = await client.controllerApi.createTask(
|
|
383
|
-
{
|
|
438
|
+
{
|
|
439
|
+
user_id: 'user123',
|
|
440
|
+
task_origin_type: 'web-widget'
|
|
441
|
+
},
|
|
384
442
|
{
|
|
385
443
|
timeoutInSeconds: 30, // Override for this request only
|
|
386
444
|
maxRetries: 2
|
|
@@ -414,7 +472,8 @@ const client = new ApolloClient({
|
|
|
414
472
|
|
|
415
473
|
try {
|
|
416
474
|
const taskResponse = await client.controllerApi.createTask({
|
|
417
|
-
user_id: 'user123'
|
|
475
|
+
user_id: 'user123',
|
|
476
|
+
task_origin_type: 'web-widget'
|
|
418
477
|
});
|
|
419
478
|
} catch (error) {
|
|
420
479
|
if (error instanceof UnprocessableEntityError) {
|
|
@@ -534,6 +593,23 @@ const client = new ApolloClient({
|
|
|
534
593
|
npm install --save-dev typescript@latest
|
|
535
594
|
```
|
|
536
595
|
|
|
596
|
+
## 📚 Examples
|
|
597
|
+
|
|
598
|
+
The `examples/` directory contains ready-to-run code examples:
|
|
599
|
+
|
|
600
|
+
- **Product Metadata API** - [`examples/test-product-metadata.js`](./examples/test-product-metadata.js)
|
|
601
|
+
- Fetch product information from URLs
|
|
602
|
+
- Handle errors and edge cases
|
|
603
|
+
- Extract and use metadata
|
|
604
|
+
|
|
605
|
+
Run examples:
|
|
606
|
+
```bash
|
|
607
|
+
export NETWORK_API_KEY="API_KEY_YOUR_KEY_HERE"
|
|
608
|
+
node examples/test-product-metadata.js
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
See the [examples README](./examples/README.md) for more details.
|
|
612
|
+
|
|
537
613
|
## 🔗 Resources
|
|
538
614
|
|
|
539
615
|
- **GitHub Repository:** [aui-io/aui-client-typescript](https://github.com/aui-io/aui-client-typescript)
|
package/dist/cjs/Client.js
CHANGED
|
@@ -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.
|
|
49
|
-
"User-Agent": "@aui.io/aui-client/1.2.
|
|
48
|
+
"X-Fern-SDK-Version": "1.2.18",
|
|
49
|
+
"User-Agent": "@aui.io/aui-client/1.2.18",
|
|
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) });
|
|
@@ -33,7 +33,8 @@ export declare class ControllerApi {
|
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* await client.controllerApi.createTask({
|
|
36
|
-
* user_id: "user_id"
|
|
36
|
+
* user_id: "user_id",
|
|
37
|
+
* task_origin_type: "stores"
|
|
37
38
|
* })
|
|
38
39
|
*/
|
|
39
40
|
createTask(request: Apollo.CreateTaskRequest, requestOptions?: ControllerApi.RequestOptions): core.HttpResponsePromise<Apollo.CreateTaskResponse>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type * as Apollo from "../../../../index.js";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {
|
|
4
|
-
* user_id: "user_id"
|
|
5
|
+
* user_id: "user_id",
|
|
6
|
+
* task_origin_type: "stores"
|
|
5
7
|
* }
|
|
6
8
|
*/
|
|
7
9
|
export interface CreateTaskRequest {
|
|
8
10
|
user_id: string;
|
|
11
|
+
task_origin_type: Apollo.RecordOriginType;
|
|
9
12
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const RecordOriginType: {
|
|
2
|
+
readonly Stores: "stores";
|
|
3
|
+
readonly WebWidget: "web-widget";
|
|
4
|
+
readonly InspectionPlayground: "inspection-playground";
|
|
5
|
+
readonly FeedbackPlayground: "feedback-playground";
|
|
6
|
+
readonly LlmManagement: "llm-management";
|
|
7
|
+
readonly ThirdParty: "third-party";
|
|
8
|
+
};
|
|
9
|
+
export type RecordOriginType = (typeof RecordOriginType)[keyof typeof RecordOriginType];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RecordOriginType = void 0;
|
|
5
|
+
exports.RecordOriginType = {
|
|
6
|
+
Stores: "stores",
|
|
7
|
+
WebWidget: "web-widget",
|
|
8
|
+
InspectionPlayground: "inspection-playground",
|
|
9
|
+
FeedbackPlayground: "feedback-playground",
|
|
10
|
+
LlmManagement: "llm-management",
|
|
11
|
+
ThirdParty: "third-party",
|
|
12
|
+
};
|
|
@@ -16,6 +16,7 @@ export * from "./OptionsSearchSelfReviewMethod.js";
|
|
|
16
16
|
export * from "./ParameterType.js";
|
|
17
17
|
export * from "./ProductCard.js";
|
|
18
18
|
export * from "./ProductParameter.js";
|
|
19
|
+
export * from "./RecordOriginType.js";
|
|
19
20
|
export * from "./StreamingUpdatePayload.js";
|
|
20
21
|
export * from "./TaskInteractionOptionSelfReview.js";
|
|
21
22
|
export * from "./TaskInteractionOptionSelfReviewScore.js";
|
|
@@ -32,6 +32,7 @@ __exportStar(require("./OptionsSearchSelfReviewMethod.js"), exports);
|
|
|
32
32
|
__exportStar(require("./ParameterType.js"), exports);
|
|
33
33
|
__exportStar(require("./ProductCard.js"), exports);
|
|
34
34
|
__exportStar(require("./ProductParameter.js"), exports);
|
|
35
|
+
__exportStar(require("./RecordOriginType.js"), exports);
|
|
35
36
|
__exportStar(require("./StreamingUpdatePayload.js"), exports);
|
|
36
37
|
__exportStar(require("./TaskInteractionOptionSelfReview.js"), exports);
|
|
37
38
|
__exportStar(require("./TaskInteractionOptionSelfReviewScore.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.2.
|
|
1
|
+
export declare const SDK_VERSION = "1.2.18";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -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.
|
|
13
|
-
"User-Agent": "@aui.io/aui-client/1.2.
|
|
12
|
+
"X-Fern-SDK-Version": "1.2.18",
|
|
13
|
+
"User-Agent": "@aui.io/aui-client/1.2.18",
|
|
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) });
|
|
@@ -33,7 +33,8 @@ export declare class ControllerApi {
|
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* await client.controllerApi.createTask({
|
|
36
|
-
* user_id: "user_id"
|
|
36
|
+
* user_id: "user_id",
|
|
37
|
+
* task_origin_type: "stores"
|
|
37
38
|
* })
|
|
38
39
|
*/
|
|
39
40
|
createTask(request: Apollo.CreateTaskRequest, requestOptions?: ControllerApi.RequestOptions): core.HttpResponsePromise<Apollo.CreateTaskResponse>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type * as Apollo from "../../../../index.mjs";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {
|
|
4
|
-
* user_id: "user_id"
|
|
5
|
+
* user_id: "user_id",
|
|
6
|
+
* task_origin_type: "stores"
|
|
5
7
|
* }
|
|
6
8
|
*/
|
|
7
9
|
export interface CreateTaskRequest {
|
|
8
10
|
user_id: string;
|
|
11
|
+
task_origin_type: Apollo.RecordOriginType;
|
|
9
12
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const RecordOriginType: {
|
|
2
|
+
readonly Stores: "stores";
|
|
3
|
+
readonly WebWidget: "web-widget";
|
|
4
|
+
readonly InspectionPlayground: "inspection-playground";
|
|
5
|
+
readonly FeedbackPlayground: "feedback-playground";
|
|
6
|
+
readonly LlmManagement: "llm-management";
|
|
7
|
+
readonly ThirdParty: "third-party";
|
|
8
|
+
};
|
|
9
|
+
export type RecordOriginType = (typeof RecordOriginType)[keyof typeof RecordOriginType];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export const RecordOriginType = {
|
|
3
|
+
Stores: "stores",
|
|
4
|
+
WebWidget: "web-widget",
|
|
5
|
+
InspectionPlayground: "inspection-playground",
|
|
6
|
+
FeedbackPlayground: "feedback-playground",
|
|
7
|
+
LlmManagement: "llm-management",
|
|
8
|
+
ThirdParty: "third-party",
|
|
9
|
+
};
|
|
@@ -16,6 +16,7 @@ export * from "./OptionsSearchSelfReviewMethod.mjs";
|
|
|
16
16
|
export * from "./ParameterType.mjs";
|
|
17
17
|
export * from "./ProductCard.mjs";
|
|
18
18
|
export * from "./ProductParameter.mjs";
|
|
19
|
+
export * from "./RecordOriginType.mjs";
|
|
19
20
|
export * from "./StreamingUpdatePayload.mjs";
|
|
20
21
|
export * from "./TaskInteractionOptionSelfReview.mjs";
|
|
21
22
|
export * from "./TaskInteractionOptionSelfReviewScore.mjs";
|
|
@@ -16,6 +16,7 @@ export * from "./OptionsSearchSelfReviewMethod.mjs";
|
|
|
16
16
|
export * from "./ParameterType.mjs";
|
|
17
17
|
export * from "./ProductCard.mjs";
|
|
18
18
|
export * from "./ProductParameter.mjs";
|
|
19
|
+
export * from "./RecordOriginType.mjs";
|
|
19
20
|
export * from "./StreamingUpdatePayload.mjs";
|
|
20
21
|
export * from "./TaskInteractionOptionSelfReview.mjs";
|
|
21
22
|
export * from "./TaskInteractionOptionSelfReviewScore.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.2.
|
|
1
|
+
export declare const SDK_VERSION = "1.2.18";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.2.
|
|
1
|
+
export const SDK_VERSION = "1.2.18";
|
package/package.json
CHANGED