@mastra/client-js 0.10.21-alpha.0 → 0.10.21-alpha.2
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +22 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +40 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -21
- package/dist/index.js.map +1 -1
- package/dist/resources/a2a.d.ts +13 -16
- package/dist/resources/a2a.d.ts.map +1 -1
- package/dist/resources/agent.d.ts +11 -0
- package/dist/resources/agent.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/client.ts +8 -0
- package/src/resources/a2a.ts +35 -25
- package/src/resources/agent.ts +13 -1
package/dist/index.js
CHANGED
|
@@ -875,6 +875,17 @@ var Agent = class extends BaseResource {
|
|
|
875
875
|
liveEvals() {
|
|
876
876
|
return this.request(`/api/agents/${this.agentId}/evals/live`);
|
|
877
877
|
}
|
|
878
|
+
/**
|
|
879
|
+
* Updates the model for the agent
|
|
880
|
+
* @param params - Parameters for updating the model
|
|
881
|
+
* @returns Promise containing the updated model
|
|
882
|
+
*/
|
|
883
|
+
updateModel(params) {
|
|
884
|
+
return this.request(`/api/agents/${this.agentId}/model`, {
|
|
885
|
+
method: "POST",
|
|
886
|
+
body: params
|
|
887
|
+
});
|
|
888
|
+
}
|
|
878
889
|
};
|
|
879
890
|
var Network = class extends BaseResource {
|
|
880
891
|
constructor(options, networkId) {
|
|
@@ -1614,22 +1625,38 @@ var A2A = class extends BaseResource {
|
|
|
1614
1625
|
* @returns Promise containing the agent card information
|
|
1615
1626
|
*/
|
|
1616
1627
|
async getCard() {
|
|
1617
|
-
return this.request(`/.well-known/${this.agentId}/agent.json`);
|
|
1628
|
+
return this.request(`/.well-known/${this.agentId}/agent-card.json`);
|
|
1618
1629
|
}
|
|
1619
1630
|
/**
|
|
1620
|
-
* Send a message to the agent and
|
|
1631
|
+
* Send a message to the agent and gets a message or task response
|
|
1621
1632
|
* @param params - Parameters for the task
|
|
1622
|
-
* @returns Promise containing the
|
|
1633
|
+
* @returns Promise containing the response
|
|
1623
1634
|
*/
|
|
1624
1635
|
async sendMessage(params) {
|
|
1625
1636
|
const response = await this.request(`/a2a/${this.agentId}`, {
|
|
1626
1637
|
method: "POST",
|
|
1627
1638
|
body: {
|
|
1628
|
-
method: "
|
|
1639
|
+
method: "message/send",
|
|
1629
1640
|
params
|
|
1630
1641
|
}
|
|
1631
1642
|
});
|
|
1632
|
-
return
|
|
1643
|
+
return response;
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* Sends a message to an agent to initiate/continue a task and subscribes
|
|
1647
|
+
* the client to real-time updates for that task via Server-Sent Events (SSE).
|
|
1648
|
+
* @param params - Parameters for the task
|
|
1649
|
+
* @returns A stream of Server-Sent Events. Each SSE `data` field contains a `SendStreamingMessageResponse`
|
|
1650
|
+
*/
|
|
1651
|
+
async sendStreamingMessage(params) {
|
|
1652
|
+
const response = await this.request(`/a2a/${this.agentId}`, {
|
|
1653
|
+
method: "POST",
|
|
1654
|
+
body: {
|
|
1655
|
+
method: "message/stream",
|
|
1656
|
+
params
|
|
1657
|
+
}
|
|
1658
|
+
});
|
|
1659
|
+
return response;
|
|
1633
1660
|
}
|
|
1634
1661
|
/**
|
|
1635
1662
|
* Get the status and result of a task
|
|
@@ -1644,7 +1671,7 @@ var A2A = class extends BaseResource {
|
|
|
1644
1671
|
params
|
|
1645
1672
|
}
|
|
1646
1673
|
});
|
|
1647
|
-
return response
|
|
1674
|
+
return response;
|
|
1648
1675
|
}
|
|
1649
1676
|
/**
|
|
1650
1677
|
* Cancel a running task
|
|
@@ -1660,21 +1687,6 @@ var A2A = class extends BaseResource {
|
|
|
1660
1687
|
}
|
|
1661
1688
|
});
|
|
1662
1689
|
}
|
|
1663
|
-
/**
|
|
1664
|
-
* Send a message and subscribe to streaming updates (not fully implemented)
|
|
1665
|
-
* @param params - Parameters for the task
|
|
1666
|
-
* @returns Promise containing the task response
|
|
1667
|
-
*/
|
|
1668
|
-
async sendAndSubscribe(params) {
|
|
1669
|
-
return this.request(`/a2a/${this.agentId}`, {
|
|
1670
|
-
method: "POST",
|
|
1671
|
-
body: {
|
|
1672
|
-
method: "tasks/sendSubscribe",
|
|
1673
|
-
params
|
|
1674
|
-
},
|
|
1675
|
-
stream: true
|
|
1676
|
-
});
|
|
1677
|
-
}
|
|
1678
1690
|
};
|
|
1679
1691
|
|
|
1680
1692
|
// src/resources/mcp-tool.ts
|
|
@@ -2419,6 +2431,13 @@ var MastraClient = class extends BaseResource {
|
|
|
2419
2431
|
body: params
|
|
2420
2432
|
});
|
|
2421
2433
|
}
|
|
2434
|
+
/**
|
|
2435
|
+
* Retrieves model providers with available keys
|
|
2436
|
+
* @returns Promise containing model providers with available keys
|
|
2437
|
+
*/
|
|
2438
|
+
getModelProviders() {
|
|
2439
|
+
return this.request(`/api/model-providers`);
|
|
2440
|
+
}
|
|
2422
2441
|
};
|
|
2423
2442
|
|
|
2424
2443
|
export { MastraClient };
|