@mastra/client-js 0.11.3-alpha.3 → 0.11.3-alpha.5

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/client.d.ts +12 -2
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/index.cjs +398 -4
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.js +398 -4
  7. package/dist/index.js.map +1 -1
  8. package/dist/resources/agent-builder.d.ts +148 -0
  9. package/dist/resources/agent-builder.d.ts.map +1 -0
  10. package/dist/resources/agent.d.ts +25 -0
  11. package/dist/resources/agent.d.ts.map +1 -1
  12. package/dist/resources/index.d.ts +1 -0
  13. package/dist/resources/index.d.ts.map +1 -1
  14. package/dist/types.d.ts +33 -0
  15. package/dist/types.d.ts.map +1 -1
  16. package/package.json +15 -8
  17. package/.turbo/turbo-build.log +0 -18
  18. package/eslint.config.js +0 -11
  19. package/integration-tests/agui-adapter.test.ts +0 -122
  20. package/integration-tests/package.json +0 -18
  21. package/integration-tests/src/mastra/index.ts +0 -35
  22. package/integration-tests/vitest.config.ts +0 -9
  23. package/src/adapters/agui.test.ts +0 -293
  24. package/src/adapters/agui.ts +0 -257
  25. package/src/client.ts +0 -644
  26. package/src/example.ts +0 -95
  27. package/src/index.test.ts +0 -1253
  28. package/src/index.ts +0 -3
  29. package/src/resources/a2a.ts +0 -98
  30. package/src/resources/agent.ts +0 -1460
  31. package/src/resources/base.ts +0 -77
  32. package/src/resources/index.ts +0 -11
  33. package/src/resources/legacy-workflow.ts +0 -242
  34. package/src/resources/mcp-tool.ts +0 -48
  35. package/src/resources/memory-thread.test.ts +0 -285
  36. package/src/resources/memory-thread.ts +0 -99
  37. package/src/resources/network-memory-thread.test.ts +0 -269
  38. package/src/resources/network-memory-thread.ts +0 -81
  39. package/src/resources/network.ts +0 -86
  40. package/src/resources/observability.ts +0 -53
  41. package/src/resources/tool.ts +0 -45
  42. package/src/resources/vNextNetwork.ts +0 -194
  43. package/src/resources/vector.ts +0 -83
  44. package/src/resources/workflow.ts +0 -410
  45. package/src/types.ts +0 -534
  46. package/src/utils/index.ts +0 -11
  47. package/src/utils/process-client-tools.ts +0 -32
  48. package/src/utils/process-mastra-stream.test.ts +0 -353
  49. package/src/utils/process-mastra-stream.ts +0 -49
  50. package/src/utils/zod-to-json-schema.ts +0 -30
  51. package/src/v2-messages.test.ts +0 -180
  52. package/tsconfig.build.json +0 -9
  53. package/tsconfig.json +0 -5
  54. package/tsup.config.ts +0 -17
  55. package/vitest.config.js +0 -8
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './client';
2
- export * from './types';
3
- export type { UIMessageWithMetadata } from '@mastra/core/agent';
@@ -1,98 +0,0 @@
1
- import type {
2
- AgentCard,
3
- GetTaskResponse,
4
- MessageSendParams,
5
- SendMessageResponse,
6
- SendStreamingMessageResponse,
7
- Task,
8
- TaskQueryParams,
9
- } from '@mastra/core/a2a';
10
- import type { ClientOptions } from '../types';
11
- import { BaseResource } from './base';
12
-
13
- /**
14
- * Class for interacting with an agent via the A2A protocol
15
- */
16
- export class A2A extends BaseResource {
17
- constructor(
18
- options: ClientOptions,
19
- private agentId: string,
20
- ) {
21
- super(options);
22
- }
23
-
24
- /**
25
- * Get the agent card with metadata about the agent
26
- * @returns Promise containing the agent card information
27
- */
28
- async getCard(): Promise<AgentCard> {
29
- return this.request(`/.well-known/${this.agentId}/agent-card.json`);
30
- }
31
-
32
- /**
33
- * Send a message to the agent and gets a message or task response
34
- * @param params - Parameters for the task
35
- * @returns Promise containing the response
36
- */
37
- async sendMessage(params: MessageSendParams): Promise<SendMessageResponse> {
38
- const response = await this.request<SendMessageResponse>(`/a2a/${this.agentId}`, {
39
- method: 'POST',
40
- body: {
41
- method: 'message/send',
42
- params,
43
- },
44
- });
45
-
46
- return response;
47
- }
48
-
49
- /**
50
- * Sends a message to an agent to initiate/continue a task and subscribes
51
- * the client to real-time updates for that task via Server-Sent Events (SSE).
52
- * @param params - Parameters for the task
53
- * @returns A stream of Server-Sent Events. Each SSE `data` field contains a `SendStreamingMessageResponse`
54
- */
55
- async sendStreamingMessage(params: MessageSendParams): Promise<AsyncIterable<SendStreamingMessageResponse>> {
56
- const response = await this.request<AsyncIterable<SendStreamingMessageResponse>>(`/a2a/${this.agentId}`, {
57
- method: 'POST',
58
- body: {
59
- method: 'message/stream',
60
- params,
61
- },
62
- });
63
-
64
- return response;
65
- }
66
-
67
- /**
68
- * Get the status and result of a task
69
- * @param params - Parameters for querying the task
70
- * @returns Promise containing the task response
71
- */
72
- async getTask(params: TaskQueryParams): Promise<GetTaskResponse> {
73
- const response = await this.request<GetTaskResponse>(`/a2a/${this.agentId}`, {
74
- method: 'POST',
75
- body: {
76
- method: 'tasks/get',
77
- params,
78
- },
79
- });
80
-
81
- return response;
82
- }
83
-
84
- /**
85
- * Cancel a running task
86
- * @param params - Parameters identifying the task to cancel
87
- * @returns Promise containing the task response
88
- */
89
- async cancelTask(params: TaskQueryParams): Promise<Task> {
90
- return this.request(`/a2a/${this.agentId}`, {
91
- method: 'POST',
92
- body: {
93
- method: 'tasks/cancel',
94
- params,
95
- },
96
- });
97
- }
98
- }