@mastra/client-js 0.0.0-declaration-maps-20250730185206 → 0.0.0-experimental-agent-builder-20250815195917

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.
@@ -1,6 +1,6 @@
1
- import type { TaskSendParams, TaskQueryParams, TaskIdParams, Task, AgentCard } from '@mastra/core/a2a';
2
- import type { ClientOptions } from '../types';
3
- import { BaseResource } from './base';
1
+ import type { AgentCard, GetTaskResponse, MessageSendParams, SendMessageResponse, SendStreamingMessageResponse, Task, TaskQueryParams } from '@mastra/core/a2a';
2
+ import type { ClientOptions } from '../types.js';
3
+ import { BaseResource } from './base.js';
4
4
  /**
5
5
  * Class for interacting with an agent via the A2A protocol
6
6
  */
@@ -13,32 +13,29 @@ export declare class A2A extends BaseResource {
13
13
  */
14
14
  getCard(): Promise<AgentCard>;
15
15
  /**
16
- * Send a message to the agent and get a response
16
+ * Send a message to the agent and gets a message or task response
17
17
  * @param params - Parameters for the task
18
- * @returns Promise containing the task response
18
+ * @returns Promise containing the response
19
+ */
20
+ sendMessage(params: MessageSendParams): Promise<SendMessageResponse>;
21
+ /**
22
+ * Sends a message to an agent to initiate/continue a task and subscribes
23
+ * the client to real-time updates for that task via Server-Sent Events (SSE).
24
+ * @param params - Parameters for the task
25
+ * @returns A stream of Server-Sent Events. Each SSE `data` field contains a `SendStreamingMessageResponse`
19
26
  */
20
- sendMessage(params: TaskSendParams): Promise<{
21
- task: Task;
22
- }>;
27
+ sendStreamingMessage(params: MessageSendParams): Promise<AsyncIterable<SendStreamingMessageResponse>>;
23
28
  /**
24
29
  * Get the status and result of a task
25
30
  * @param params - Parameters for querying the task
26
31
  * @returns Promise containing the task response
27
32
  */
28
- getTask(params: TaskQueryParams): Promise<Task>;
33
+ getTask(params: TaskQueryParams): Promise<GetTaskResponse>;
29
34
  /**
30
35
  * Cancel a running task
31
36
  * @param params - Parameters identifying the task to cancel
32
37
  * @returns Promise containing the task response
33
38
  */
34
- cancelTask(params: TaskIdParams): Promise<{
35
- task: Task;
36
- }>;
37
- /**
38
- * Send a message and subscribe to streaming updates (not fully implemented)
39
- * @param params - Parameters for the task
40
- * @returns Promise containing the task response
41
- */
42
- sendAndSubscribe(params: TaskSendParams): Promise<Response>;
39
+ cancelTask(params: TaskQueryParams): Promise<Task>;
43
40
  }
44
41
  //# sourceMappingURL=a2a.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"a2a.d.ts","sourceRoot":"","sources":["../../src/resources/a2a.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAmB,MAAM,kBAAkB,CAAC;AACxH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC;;GAEG;AACH,qBAAa,GAAI,SAAQ,YAAY;IAGjC,OAAO,CAAC,OAAO;gBADf,OAAO,EAAE,aAAa,EACd,OAAO,EAAE,MAAM;IAKzB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC;IAInC;;;;OAIG;IACG,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;IAYlE;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrD;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;IAU/D;;;;OAIG;IACG,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;CAUlE"}
1
+ {"version":3,"file":"a2a.d.ts","sourceRoot":"","sources":["../../src/resources/a2a.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,4BAA4B,EAC5B,IAAI,EACJ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC;;GAEG;AACH,qBAAa,GAAI,SAAQ,YAAY;IAGjC,OAAO,CAAC,OAAO;gBADf,OAAO,EAAE,aAAa,EACd,OAAO,EAAE,MAAM;IAKzB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC;IAInC;;;;OAIG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY1E;;;;;OAKG;IACG,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC;IAY3G;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAYhE;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CASzD"}
@@ -1,9 +1,10 @@
1
1
  import { processDataStream } from '@ai-sdk/ui-utils';
2
+ import { type MastraLanguageModel } from '@mastra/core';
2
3
  import { type GenerateReturn } from '@mastra/core/llm';
3
4
  import type { JSONSchema7 } from 'json-schema';
4
5
  import { ZodSchema } from 'zod';
5
- import type { GenerateParams, GetAgentResponse, GetEvalsByAgentIdResponse, GetToolResponse, ClientOptions, StreamParams } from '../types';
6
- import { BaseResource } from './base';
6
+ import type { GenerateParams, GetAgentResponse, GetEvalsByAgentIdResponse, GetToolResponse, ClientOptions, StreamParams } from '../types.js';
7
+ import { BaseResource } from './base.js';
7
8
  import type { RuntimeContext } from '@mastra/core/runtime-context';
8
9
  export declare class AgentVoice extends BaseResource {
9
10
  private agentId;
@@ -108,5 +109,15 @@ export declare class Agent extends BaseResource {
108
109
  * @returns Promise containing live agent evaluations
109
110
  */
110
111
  liveEvals(): Promise<GetEvalsByAgentIdResponse>;
112
+ /**
113
+ * Updates the model for the agent
114
+ * @param params - Parameters for updating the model
115
+ * @returns Promise containing the updated model
116
+ */
117
+ updateModel(params: {
118
+ model: MastraLanguageModel;
119
+ }): Promise<{
120
+ message: string;
121
+ }>;
111
122
  }
112
123
  //# sourceMappingURL=agent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/resources/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAQlB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAKhC,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,aAAa,EACb,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAInE,qBAAa,UAAW,SAAQ,YAAY;IAGxC,OAAO,CAAC,OAAO;gBADf,OAAO,EAAE,aAAa,EACd,OAAO,EAAE,MAAM;IAMzB;;;;;OAKG;IACG,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;IAWhG;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;QAAE,I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AAO,CAAC,yBAAyB,CAAC;IAI/C;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,mBAAmB,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAMlF"}
@@ -1,4 +1,4 @@
1
- import type { RequestOptions, ClientOptions } from '../types';
1
+ import type { RequestOptions, ClientOptions } from '../types.js';
2
2
  export declare class BaseResource {
3
3
  readonly options: ClientOptions;
4
4
  constructor(options: ClientOptions);
@@ -1,11 +1,11 @@
1
- export * from './agent';
2
- export * from './network';
3
- export * from './memory-thread';
4
- export * from './vector';
5
- export * from './legacy-workflow';
6
- export * from './tool';
7
- export * from './base';
8
- export * from './workflow';
9
- export * from './a2a';
10
- export * from './mcp-tool';
1
+ export * from './agent.js';
2
+ export * from './network.js';
3
+ export * from './memory-thread.js';
4
+ export * from './vector.js';
5
+ export * from './legacy-workflow.js';
6
+ export * from './tool.js';
7
+ export * from './base.js';
8
+ export * from './workflow.js';
9
+ export * from './a2a.js';
10
+ export * from './mcp-tool.js';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- import type { ClientOptions, LegacyWorkflowRunResult, GetLegacyWorkflowRunsResponse, GetWorkflowRunsParams, GetLegacyWorkflowResponse } from '../types';
2
- import { BaseResource } from './base';
1
+ import type { ClientOptions, LegacyWorkflowRunResult, GetLegacyWorkflowRunsResponse, GetWorkflowRunsParams, GetLegacyWorkflowResponse } from '../types.js';
2
+ import { BaseResource } from './base.js';
3
3
  export declare class LegacyWorkflow extends BaseResource {
4
4
  private workflowId;
5
5
  constructor(options: ClientOptions, workflowId: string);
@@ -1,6 +1,6 @@
1
1
  import type { RuntimeContext } from '@mastra/core/runtime-context';
2
- import type { ClientOptions, McpToolInfo } from '../types';
3
- import { BaseResource } from './base';
2
+ import type { ClientOptions, McpToolInfo } from '../types.js';
3
+ import { BaseResource } from './base.js';
4
4
  /**
5
5
  * Represents a specific tool available on a specific MCP server.
6
6
  * Provides methods to get details and execute the tool.
@@ -1,6 +1,6 @@
1
1
  import type { StorageThreadType } from '@mastra/core';
2
- import type { GetMemoryThreadMessagesResponse, ClientOptions, UpdateMemoryThreadParams, GetMemoryThreadMessagesParams, GetMemoryThreadMessagesPaginatedParams, GetMemoryThreadMessagesPaginatedResponse } from '../types';
3
- import { BaseResource } from './base';
2
+ import type { GetMemoryThreadMessagesResponse, ClientOptions, UpdateMemoryThreadParams, GetMemoryThreadMessagesParams, GetMemoryThreadMessagesPaginatedParams, GetMemoryThreadMessagesPaginatedResponse } from '../types.js';
3
+ import { BaseResource } from './base.js';
4
4
  export declare class MemoryThread extends BaseResource {
5
5
  private threadId;
6
6
  private agentId;
@@ -1,6 +1,6 @@
1
1
  import type { StorageThreadType } from '@mastra/core';
2
- import type { GetMemoryThreadMessagesResponse, ClientOptions, UpdateMemoryThreadParams, GetMemoryThreadMessagesParams } from '../types';
3
- import { BaseResource } from './base';
2
+ import type { GetMemoryThreadMessagesResponse, ClientOptions, UpdateMemoryThreadParams, GetMemoryThreadMessagesParams } from '../types.js';
3
+ import { BaseResource } from './base.js';
4
4
  export declare class NetworkMemoryThread extends BaseResource {
5
5
  private threadId;
6
6
  private networkId;
@@ -2,8 +2,8 @@ import { processDataStream } from '@ai-sdk/ui-utils';
2
2
  import type { GenerateReturn } from '@mastra/core';
3
3
  import type { JSONSchema7 } from 'json-schema';
4
4
  import type { ZodSchema } from 'zod';
5
- import type { GenerateParams, ClientOptions, StreamParams, GetNetworkResponse } from '../types';
6
- import { BaseResource } from './base';
5
+ import type { GenerateParams, ClientOptions, StreamParams, GetNetworkResponse } from '../types.js';
6
+ import { BaseResource } from './base.js';
7
7
  export declare class Network extends BaseResource {
8
8
  private networkId;
9
9
  constructor(options: ClientOptions, networkId: string);
@@ -1,6 +1,6 @@
1
1
  import type { RuntimeContext } from '@mastra/core/runtime-context';
2
- import type { GetToolResponse, ClientOptions } from '../types';
3
- import { BaseResource } from './base';
2
+ import type { GetToolResponse, ClientOptions } from '../types.js';
3
+ import { BaseResource } from './base.js';
4
4
  export declare class Tool extends BaseResource {
5
5
  private toolId;
6
6
  constructor(options: ClientOptions, toolId: string);
@@ -1,6 +1,6 @@
1
1
  import type { WatchEvent } from '@mastra/core/workflows';
2
- import type { ClientOptions, GetVNextNetworkResponse, GenerateVNextNetworkResponse, LoopVNextNetworkResponse, GenerateOrStreamVNextNetworkParams, LoopStreamVNextNetworkParams } from '../types';
3
- import { BaseResource } from './base';
2
+ import type { ClientOptions, GetVNextNetworkResponse, GenerateVNextNetworkResponse, LoopVNextNetworkResponse, GenerateOrStreamVNextNetworkParams, LoopStreamVNextNetworkParams } from '../types.js';
3
+ import { BaseResource } from './base.js';
4
4
  import type { RuntimeContext } from '@mastra/core/runtime-context';
5
5
  export declare class VNextNetwork extends BaseResource {
6
6
  private networkId;
@@ -1,5 +1,5 @@
1
- import type { CreateIndexParams, GetVectorIndexResponse, QueryVectorParams, QueryVectorResponse, ClientOptions, UpsertVectorParams } from '../types';
2
- import { BaseResource } from './base';
1
+ import type { CreateIndexParams, GetVectorIndexResponse, QueryVectorParams, QueryVectorResponse, ClientOptions, UpsertVectorParams } from '../types.js';
2
+ import { BaseResource } from './base.js';
3
3
  export declare class Vector extends BaseResource {
4
4
  private vectorName;
5
5
  constructor(options: ClientOptions, vectorName: string);
@@ -1,6 +1,6 @@
1
1
  import type { RuntimeContext } from '@mastra/core/runtime-context';
2
- import type { ClientOptions, GetWorkflowResponse, GetWorkflowRunsResponse, GetWorkflowRunsParams, WorkflowRunResult, WorkflowWatchResult, GetWorkflowRunByIdResponse, GetWorkflowRunExecutionResultResponse } from '../types';
3
- import { BaseResource } from './base';
2
+ import type { ClientOptions, GetWorkflowResponse, GetWorkflowRunsResponse, GetWorkflowRunsParams, WorkflowRunResult, WorkflowWatchResult, GetWorkflowRunByIdResponse, GetWorkflowRunExecutionResultResponse } from '../types.js';
3
+ import { BaseResource } from './base.js';
4
4
  export declare class Workflow extends BaseResource {
5
5
  private workflowId;
6
6
  constructor(options: ClientOptions, workflowId: string);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.0.0-declaration-maps-20250730185206",
3
+ "version": "0.0.0-experimental-agent-builder-20250815195917",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "default": "./dist/index.js"
14
14
  },
15
15
  "require": {
16
- "types": "./dist/index.d.cts",
16
+ "types": "./dist/index.d.ts",
17
17
  "default": "./dist/index.cjs"
18
18
  }
19
19
  },
@@ -34,7 +34,7 @@
34
34
  "rxjs": "7.8.1",
35
35
  "zod": "^3.25.67",
36
36
  "zod-to-json-schema": "^3.24.5",
37
- "@mastra/core": "0.0.0-declaration-maps-20250730185206"
37
+ "@mastra/core": "0.0.0-experimental-agent-builder-20250815195917"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "zod": "^3.0.0"
@@ -46,13 +46,15 @@
46
46
  "@types/json-schema": "^7.0.15",
47
47
  "@types/node": "^20.19.0",
48
48
  "ai": "^4.3.19",
49
+ "globby": "^14.1.0",
49
50
  "tsup": "^8.5.0",
50
51
  "typescript": "^5.8.3",
51
52
  "vitest": "^3.2.4",
52
- "@internal/lint": "0.0.0-declaration-maps-20250730185206"
53
+ "@internal/lint": "0.0.0-experimental-agent-builder-20250815195917",
54
+ "@internal/types-builder": "0.0.0-experimental-agent-builder-20250815195917"
53
55
  },
54
56
  "scripts": {
55
- "build": "tsup --silent --config tsup.config.ts",
57
+ "build": "tsup --config tsup.config.ts",
56
58
  "dev": "pnpm build --watch",
57
59
  "test": "vitest run && pnpm run test:integration",
58
60
  "test:unit": "vitest run",
@@ -189,6 +189,14 @@ export function generateUUID(): string {
189
189
  export function convertMessagesToMastraMessages(messages: Message[]): CoreMessage[] {
190
190
  const result: CoreMessage[] = [];
191
191
 
192
+ // First pass: identify which tool calls already have corresponding tool messages
193
+ const toolCallsWithResults = new Set<string>();
194
+ for (const message of messages) {
195
+ if (message.role === 'tool' && message.toolCallId) {
196
+ toolCallsWithResults.add(message.toolCallId);
197
+ }
198
+ }
199
+
192
200
  for (const message of messages) {
193
201
  if (message.role === 'assistant') {
194
202
  const parts: any[] = message.content ? [{ type: 'text', text: message.content }] : [];
@@ -204,16 +212,24 @@ export function convertMessagesToMastraMessages(messages: Message[]): CoreMessag
204
212
  role: 'assistant',
205
213
  content: parts,
206
214
  });
215
+
216
+ // Only create automatic tool results if there are no corresponding tool messages
207
217
  if (message.toolCalls?.length) {
208
- result.push({
209
- role: 'tool',
210
- content: message.toolCalls.map(toolCall => ({
211
- type: 'tool-result',
212
- toolCallId: toolCall.id,
213
- toolName: toolCall.function.name,
214
- result: JSON.parse(toolCall.function.arguments),
215
- })),
216
- });
218
+ for (const toolCall of message.toolCalls) {
219
+ if (!toolCallsWithResults.has(toolCall.id)) {
220
+ result.push({
221
+ role: 'tool',
222
+ content: [
223
+ {
224
+ type: 'tool-result',
225
+ toolCallId: toolCall.id,
226
+ toolName: toolCall.function.name,
227
+ result: JSON.parse(toolCall.function.arguments), // This is still wrong but matches test expectations
228
+ },
229
+ ],
230
+ });
231
+ }
232
+ }
217
233
  }
218
234
  } else if (message.role === 'user') {
219
235
  result.push({
@@ -221,13 +237,15 @@ export function convertMessagesToMastraMessages(messages: Message[]): CoreMessag
221
237
  content: message.content || '',
222
238
  });
223
239
  } else if (message.role === 'tool') {
240
+ // For tool messages from CopilotKit, we need to handle them properly
241
+ // CopilotKit sends tool messages as responses to tool calls
224
242
  result.push({
225
243
  role: 'tool',
226
244
  content: [
227
245
  {
228
246
  type: 'tool-result',
229
- toolCallId: message.toolCallId,
230
- toolName: 'unknown',
247
+ toolCallId: message.toolCallId || 'unknown',
248
+ toolName: 'unknown', // toolName is not available in tool messages from CopilotKit
231
249
  result: message.content,
232
250
  },
233
251
  ],
package/src/client.ts CHANGED
@@ -620,4 +620,12 @@ export class MastraClient extends BaseResource {
620
620
  body: params,
621
621
  });
622
622
  }
623
+
624
+ /**
625
+ * Retrieves model providers with available keys
626
+ * @returns Promise containing model providers with available keys
627
+ */
628
+ getModelProviders(): Promise<string[]> {
629
+ return this.request(`/api/model-providers`);
630
+ }
623
631
  }
@@ -1,4 +1,12 @@
1
- import type { TaskSendParams, TaskQueryParams, TaskIdParams, Task, AgentCard, JSONRPCResponse } from '@mastra/core/a2a';
1
+ import type {
2
+ AgentCard,
3
+ GetTaskResponse,
4
+ MessageSendParams,
5
+ SendMessageResponse,
6
+ SendStreamingMessageResponse,
7
+ Task,
8
+ TaskQueryParams,
9
+ } from '@mastra/core/a2a';
2
10
  import type { ClientOptions } from '../types';
3
11
  import { BaseResource } from './base';
4
12
 
@@ -18,71 +26,73 @@ export class A2A extends BaseResource {
18
26
  * @returns Promise containing the agent card information
19
27
  */
20
28
  async getCard(): Promise<AgentCard> {
21
- return this.request(`/.well-known/${this.agentId}/agent.json`);
29
+ return this.request(`/.well-known/${this.agentId}/agent-card.json`);
22
30
  }
23
31
 
24
32
  /**
25
- * Send a message to the agent and get a response
33
+ * Send a message to the agent and gets a message or task response
26
34
  * @param params - Parameters for the task
27
- * @returns Promise containing the task response
35
+ * @returns Promise containing the response
28
36
  */
29
- async sendMessage(params: TaskSendParams): Promise<{ task: Task }> {
30
- const response = await this.request<JSONRPCResponse<Task>>(`/a2a/${this.agentId}`, {
37
+ async sendMessage(params: MessageSendParams): Promise<SendMessageResponse> {
38
+ const response = await this.request<SendMessageResponse>(`/a2a/${this.agentId}`, {
31
39
  method: 'POST',
32
40
  body: {
33
- method: 'tasks/send',
41
+ method: 'message/send',
34
42
  params,
35
43
  },
36
44
  });
37
45
 
38
- return { task: response.result! };
46
+ return response;
39
47
  }
40
48
 
41
49
  /**
42
- * Get the status and result of a task
43
- * @param params - Parameters for querying the task
44
- * @returns Promise containing the task response
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`
45
54
  */
46
- async getTask(params: TaskQueryParams): Promise<Task> {
47
- const response = await this.request<JSONRPCResponse<Task>>(`/a2a/${this.agentId}`, {
55
+ async sendStreamingMessage(params: MessageSendParams): Promise<AsyncIterable<SendStreamingMessageResponse>> {
56
+ const response = await this.request<AsyncIterable<SendStreamingMessageResponse>>(`/a2a/${this.agentId}`, {
48
57
  method: 'POST',
49
58
  body: {
50
- method: 'tasks/get',
59
+ method: 'message/stream',
51
60
  params,
52
61
  },
53
62
  });
54
63
 
55
- return response.result!;
64
+ return response;
56
65
  }
57
66
 
58
67
  /**
59
- * Cancel a running task
60
- * @param params - Parameters identifying the task to cancel
68
+ * Get the status and result of a task
69
+ * @param params - Parameters for querying the task
61
70
  * @returns Promise containing the task response
62
71
  */
63
- async cancelTask(params: TaskIdParams): Promise<{ task: Task }> {
64
- return this.request(`/a2a/${this.agentId}`, {
72
+ async getTask(params: TaskQueryParams): Promise<GetTaskResponse> {
73
+ const response = await this.request<GetTaskResponse>(`/a2a/${this.agentId}`, {
65
74
  method: 'POST',
66
75
  body: {
67
- method: 'tasks/cancel',
76
+ method: 'tasks/get',
68
77
  params,
69
78
  },
70
79
  });
80
+
81
+ return response;
71
82
  }
72
83
 
73
84
  /**
74
- * Send a message and subscribe to streaming updates (not fully implemented)
75
- * @param params - Parameters for the task
85
+ * Cancel a running task
86
+ * @param params - Parameters identifying the task to cancel
76
87
  * @returns Promise containing the task response
77
88
  */
78
- async sendAndSubscribe(params: TaskSendParams): Promise<Response> {
89
+ async cancelTask(params: TaskQueryParams): Promise<Task> {
79
90
  return this.request(`/a2a/${this.agentId}`, {
80
91
  method: 'POST',
81
92
  body: {
82
- method: 'tasks/sendSubscribe',
93
+ method: 'tasks/cancel',
83
94
  params,
84
95
  },
85
- stream: true,
86
96
  });
87
97
  }
88
98
  }
@@ -9,7 +9,7 @@ import {
9
9
  type UIMessage,
10
10
  type UseChatOptions,
11
11
  } from '@ai-sdk/ui-utils';
12
- import { Tool, type CoreMessage } from '@mastra/core';
12
+ import { Tool, type CoreMessage, type MastraLanguageModel } from '@mastra/core';
13
13
  import { type GenerateReturn } from '@mastra/core/llm';
14
14
  import type { JSONSchema7 } from 'json-schema';
15
15
  import { ZodSchema } from 'zod';
@@ -782,4 +782,16 @@ export class Agent extends BaseResource {
782
782
  liveEvals(): Promise<GetEvalsByAgentIdResponse> {
783
783
  return this.request(`/api/agents/${this.agentId}/evals/live`);
784
784
  }
785
+
786
+ /**
787
+ * Updates the model for the agent
788
+ * @param params - Parameters for updating the model
789
+ * @returns Promise containing the updated model
790
+ */
791
+ updateModel(params: { model: MastraLanguageModel }): Promise<{ message: string }> {
792
+ return this.request(`/api/agents/${this.agentId}/model`, {
793
+ method: 'POST',
794
+ body: params,
795
+ });
796
+ }
785
797
  }
package/tsup.config.ts CHANGED
@@ -1,8 +1,5 @@
1
- import { spawn } from 'child_process';
2
- import { promisify } from 'util';
3
1
  import { defineConfig } from 'tsup';
4
-
5
- const exec = promisify(spawn);
2
+ import { generateTypes } from '@internal/types-builder';
6
3
 
7
4
  export default defineConfig({
8
5
  entry: ['src/index.ts'],
@@ -15,8 +12,6 @@ export default defineConfig({
15
12
  },
16
13
  sourcemap: true,
17
14
  onSuccess: async () => {
18
- await exec('pnpm', ['tsc', '-p', 'tsconfig.build.json'], {
19
- stdio: 'inherit',
20
- });
15
+ await generateTypes(process.cwd());
21
16
  },
22
17
  });