@mastra/client-js 1.0.0-beta.8 → 1.0.0-beta.9
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 +9 -0
- package/dist/client.d.ts +20 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +81 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/stored-agent.d.ts +26 -0
- package/dist/resources/stored-agent.d.ts.map +1 -0
- package/dist/types.d.ts +99 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2834,6 +2834,41 @@ var Observability = class extends BaseResource {
|
|
|
2834
2834
|
}
|
|
2835
2835
|
};
|
|
2836
2836
|
|
|
2837
|
+
// src/resources/stored-agent.ts
|
|
2838
|
+
var StoredAgent = class extends BaseResource {
|
|
2839
|
+
constructor(options, storedAgentId) {
|
|
2840
|
+
super(options);
|
|
2841
|
+
this.storedAgentId = storedAgentId;
|
|
2842
|
+
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Retrieves details about the stored agent
|
|
2845
|
+
* @returns Promise containing stored agent details
|
|
2846
|
+
*/
|
|
2847
|
+
details() {
|
|
2848
|
+
return this.request(`/api/stored/agents/${encodeURIComponent(this.storedAgentId)}`);
|
|
2849
|
+
}
|
|
2850
|
+
/**
|
|
2851
|
+
* Updates the stored agent with the provided fields
|
|
2852
|
+
* @param params - Fields to update
|
|
2853
|
+
* @returns Promise containing the updated stored agent
|
|
2854
|
+
*/
|
|
2855
|
+
update(params) {
|
|
2856
|
+
return this.request(`/api/stored/agents/${encodeURIComponent(this.storedAgentId)}`, {
|
|
2857
|
+
method: "PATCH",
|
|
2858
|
+
body: params
|
|
2859
|
+
});
|
|
2860
|
+
}
|
|
2861
|
+
/**
|
|
2862
|
+
* Deletes the stored agent
|
|
2863
|
+
* @returns Promise containing deletion confirmation
|
|
2864
|
+
*/
|
|
2865
|
+
delete() {
|
|
2866
|
+
return this.request(`/api/stored/agents/${encodeURIComponent(this.storedAgentId)}`, {
|
|
2867
|
+
method: "DELETE"
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
};
|
|
2871
|
+
|
|
2837
2872
|
// src/client.ts
|
|
2838
2873
|
var MastraClient = class extends BaseResource {
|
|
2839
2874
|
observability;
|
|
@@ -3349,6 +3384,52 @@ var MastraClient = class extends BaseResource {
|
|
|
3349
3384
|
score(params) {
|
|
3350
3385
|
return this.observability.score(params);
|
|
3351
3386
|
}
|
|
3387
|
+
// ============================================================================
|
|
3388
|
+
// Stored Agents
|
|
3389
|
+
// ============================================================================
|
|
3390
|
+
/**
|
|
3391
|
+
* Lists all stored agents with optional pagination
|
|
3392
|
+
* @param params - Optional pagination and ordering parameters
|
|
3393
|
+
* @returns Promise containing paginated list of stored agents
|
|
3394
|
+
*/
|
|
3395
|
+
listStoredAgents(params) {
|
|
3396
|
+
const searchParams = new URLSearchParams();
|
|
3397
|
+
if (params?.page !== void 0) {
|
|
3398
|
+
searchParams.set("page", String(params.page));
|
|
3399
|
+
}
|
|
3400
|
+
if (params?.perPage !== void 0) {
|
|
3401
|
+
searchParams.set("perPage", String(params.perPage));
|
|
3402
|
+
}
|
|
3403
|
+
if (params?.orderBy) {
|
|
3404
|
+
if (params.orderBy.field) {
|
|
3405
|
+
searchParams.set("orderBy[field]", params.orderBy.field);
|
|
3406
|
+
}
|
|
3407
|
+
if (params.orderBy.direction) {
|
|
3408
|
+
searchParams.set("orderBy[direction]", params.orderBy.direction);
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
const queryString = searchParams.toString();
|
|
3412
|
+
return this.request(`/api/stored/agents${queryString ? `?${queryString}` : ""}`);
|
|
3413
|
+
}
|
|
3414
|
+
/**
|
|
3415
|
+
* Creates a new stored agent
|
|
3416
|
+
* @param params - Agent configuration including id, name, instructions, model, etc.
|
|
3417
|
+
* @returns Promise containing the created stored agent
|
|
3418
|
+
*/
|
|
3419
|
+
createStoredAgent(params) {
|
|
3420
|
+
return this.request("/api/stored/agents", {
|
|
3421
|
+
method: "POST",
|
|
3422
|
+
body: params
|
|
3423
|
+
});
|
|
3424
|
+
}
|
|
3425
|
+
/**
|
|
3426
|
+
* Gets a stored agent instance by ID for further operations (details, update, delete)
|
|
3427
|
+
* @param storedAgentId - ID of the stored agent to retrieve
|
|
3428
|
+
* @returns StoredAgent instance
|
|
3429
|
+
*/
|
|
3430
|
+
getStoredAgent(storedAgentId) {
|
|
3431
|
+
return new StoredAgent(this.options, storedAgentId);
|
|
3432
|
+
}
|
|
3352
3433
|
};
|
|
3353
3434
|
|
|
3354
3435
|
// src/tools.ts
|