@mastra/client-js 1.47.0-alpha.2 → 1.47.0-alpha.4

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 (46) hide show
  1. package/dist/client.d.ts +45 -201
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/docs/SKILL.md +1 -1
  4. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  5. package/dist/docs/references/reference-client-js-mastra-client.md +1 -1
  6. package/dist/index.cjs +57 -35
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +58 -36
  11. package/dist/index.js.map +1 -1
  12. package/dist/resources/a2a.d.ts +5 -1
  13. package/dist/resources/a2a.d.ts.map +1 -1
  14. package/dist/resources/agent-builder.d.ts +25 -40
  15. package/dist/resources/agent-builder.d.ts.map +1 -1
  16. package/dist/resources/agent-controller.d.ts +5 -4
  17. package/dist/resources/agent-controller.d.ts.map +1 -1
  18. package/dist/resources/agent.d.ts +32 -70
  19. package/dist/resources/agent.d.ts.map +1 -1
  20. package/dist/resources/channels.d.ts +13 -31
  21. package/dist/resources/channels.d.ts.map +1 -1
  22. package/dist/resources/conversations.d.ts +6 -3
  23. package/dist/resources/conversations.d.ts.map +1 -1
  24. package/dist/resources/mcp-tool.d.ts +3 -5
  25. package/dist/resources/mcp-tool.d.ts.map +1 -1
  26. package/dist/resources/memory-thread.d.ts +6 -11
  27. package/dist/resources/memory-thread.d.ts.map +1 -1
  28. package/dist/resources/observability-route-types.d.ts +88 -0
  29. package/dist/resources/observability-route-types.d.ts.map +1 -0
  30. package/dist/resources/observability.d.ts +6 -9
  31. package/dist/resources/observability.d.ts.map +1 -1
  32. package/dist/resources/responses.d.ts +5 -2
  33. package/dist/resources/responses.d.ts.map +1 -1
  34. package/dist/resources/run.d.ts +21 -57
  35. package/dist/resources/run.d.ts.map +1 -1
  36. package/dist/resources/tool.d.ts +6 -4
  37. package/dist/resources/tool.d.ts.map +1 -1
  38. package/dist/resources/vector.d.ts +5 -10
  39. package/dist/resources/vector.d.ts.map +1 -1
  40. package/dist/resources/workflow.d.ts +8 -10
  41. package/dist/resources/workflow.d.ts.map +1 -1
  42. package/dist/route-types.generated.d.ts +2750 -2127
  43. package/dist/route-types.generated.d.ts.map +1 -1
  44. package/dist/types.d.ts +230 -1598
  45. package/dist/types.d.ts.map +1 -1
  46. package/package.json +5 -5
package/dist/index.cjs CHANGED
@@ -919,6 +919,11 @@ var Agent = class extends BaseResource {
919
919
  * depending on the toolset's scope).
920
920
  *
921
921
  * @param threadId - Optional thread ID for thread-scoped browser sessions
922
+ *
923
+ * @remarks This is a browser-stream adapter compatibility endpoint, not a
924
+ * `SERVER_ROUTES` route. Its historical deployer implementation returns
925
+ * `{ success: true }`; no generated contract exists while the adapter owns it.
926
+ * The public `boolean` result remains broad for backwards compatibility.
922
927
  */
923
928
  closeBrowser(threadId) {
924
929
  return this.request(`/agents/${this.agentId}/browser/close`, {
@@ -3235,7 +3240,7 @@ var Run = class extends BaseResource {
3235
3240
  resourceId: params.resourceId,
3236
3241
  perStep: params.perStep
3237
3242
  }
3238
- }).then(deserializeWorkflowError);
3243
+ }).then((result) => deserializeWorkflowError(result));
3239
3244
  }
3240
3245
  /**
3241
3246
  * Starts a workflow run and returns a stream
@@ -3317,7 +3322,7 @@ var Run = class extends BaseResource {
3317
3322
  perStep: params.perStep,
3318
3323
  forEachIndex: params.forEachIndex
3319
3324
  }
3320
- }).then(deserializeWorkflowError);
3325
+ }).then((result) => deserializeWorkflowError(result));
3321
3326
  }
3322
3327
  /**
3323
3328
  * Resumes a suspended workflow step without waiting for the workflow to complete (fire-and-forget)
@@ -3401,7 +3406,7 @@ var Run = class extends BaseResource {
3401
3406
  requestContext,
3402
3407
  tracingOptions: params?.tracingOptions
3403
3408
  }
3404
- }).then(deserializeWorkflowError);
3409
+ }).then((result) => deserializeWorkflowError(result));
3405
3410
  }
3406
3411
  /**
3407
3412
  * Time travels a workflow run synchronously without waiting for the workflow to complete
@@ -3431,7 +3436,7 @@ var Run = class extends BaseResource {
3431
3436
  ...params,
3432
3437
  requestContext
3433
3438
  }
3434
- }).then(deserializeWorkflowError);
3439
+ }).then((result) => deserializeWorkflowError(result));
3435
3440
  }
3436
3441
  /**
3437
3442
  * Time travels a workflow run and returns a stream
@@ -3943,12 +3948,27 @@ var A2AV1 = class extends BaseResource {
3943
3948
  }
3944
3949
  }));
3945
3950
  }
3951
+ async createTaskPushNotificationConfig(params) {
3952
+ const result = await this.rpc("CreateTaskPushNotificationConfig", _mastra_core_a2a_v1.TaskPushNotificationConfig.toJSON(params));
3953
+ return _mastra_core_a2a_v1.TaskPushNotificationConfig.fromJSON(result);
3954
+ }
3955
+ async getTaskPushNotificationConfig(params) {
3956
+ const result = await this.rpc("GetTaskPushNotificationConfig", _mastra_core_a2a_v1.GetTaskPushNotificationConfigRequest.toJSON(params));
3957
+ return _mastra_core_a2a_v1.TaskPushNotificationConfig.fromJSON(result);
3958
+ }
3959
+ async listTaskPushNotificationConfigs(params) {
3960
+ const result = await this.rpc("ListTaskPushNotificationConfigs", _mastra_core_a2a_v1.ListTaskPushNotificationConfigsRequest.toJSON(params));
3961
+ return _mastra_core_a2a_v1.ListTaskPushNotificationConfigsResponse.fromJSON(result);
3962
+ }
3963
+ async deleteTaskPushNotificationConfig(params) {
3964
+ await this.rpc("DeleteTaskPushNotificationConfig", _mastra_core_a2a_v1.DeleteTaskPushNotificationConfigRequest.toJSON(params));
3965
+ }
3946
3966
  async getAgentCard() {
3947
3967
  const card = await this.request(`/.well-known/${this.agentId}/agent-card.json`, { headers: { "A2A-Version": "1.0" } });
3948
3968
  return _mastra_core_a2a_v1.AgentCard.fromJSON(card);
3949
3969
  }
3950
3970
  async sendMessage(params) {
3951
- const result = await this.rpc("message/send", _mastra_core_a2a_v1.SendMessageRequest.toJSON(params));
3971
+ const result = await this.rpc("SendMessage", _mastra_core_a2a_v1.SendMessageRequest.toJSON(params));
3952
3972
  return _mastra_core_a2a_v1.SendMessageResponse.fromJSON(result);
3953
3973
  }
3954
3974
  async *sendMessageStream(params) {
@@ -3958,7 +3978,7 @@ var A2AV1 = class extends BaseResource {
3958
3978
  body: {
3959
3979
  jsonrpc: "2.0",
3960
3980
  id: crypto.randomUUID(),
3961
- method: "message/stream",
3981
+ method: "SendStreamingMessage",
3962
3982
  params: _mastra_core_a2a_v1.SendMessageRequest.toJSON(params)
3963
3983
  },
3964
3984
  stream: true
@@ -3966,15 +3986,15 @@ var A2AV1 = class extends BaseResource {
3966
3986
  for await (const event of processA2AStream(await requireResponseBody(response, "message/stream"))) yield _mastra_core_a2a_v1.StreamResponse.fromJSON(event);
3967
3987
  }
3968
3988
  async getTask(params) {
3969
- const result = await this.rpc("tasks/get", _mastra_core_a2a_v1.GetTaskRequest.toJSON(params));
3989
+ const result = await this.rpc("GetTask", _mastra_core_a2a_v1.GetTaskRequest.toJSON(params));
3970
3990
  return _mastra_core_a2a_v1.Task.fromJSON(result);
3971
3991
  }
3972
3992
  async listTasks(params) {
3973
- const result = await this.rpc("tasks/list", _mastra_core_a2a_v1.ListTasksRequest.toJSON(params));
3993
+ const result = await this.rpc("ListTasks", _mastra_core_a2a_v1.ListTasksRequest.toJSON(params));
3974
3994
  return _mastra_core_a2a_v1.ListTasksResponse.fromJSON(result);
3975
3995
  }
3976
3996
  async cancelTask(params) {
3977
- const result = await this.rpc("tasks/cancel", _mastra_core_a2a_v1.CancelTaskRequest.toJSON(params));
3997
+ const result = await this.rpc("CancelTask", _mastra_core_a2a_v1.CancelTaskRequest.toJSON(params));
3978
3998
  return _mastra_core_a2a_v1.Task.fromJSON(result);
3979
3999
  }
3980
4000
  async *resubscribeTask(params) {
@@ -3984,7 +4004,7 @@ var A2AV1 = class extends BaseResource {
3984
4004
  body: {
3985
4005
  jsonrpc: "2.0",
3986
4006
  id: crypto.randomUUID(),
3987
- method: "tasks/resubscribe",
4007
+ method: "SubscribeToTask",
3988
4008
  params: _mastra_core_a2a_v1.SubscribeToTaskRequest.toJSON(params)
3989
4009
  },
3990
4010
  stream: true
@@ -4023,12 +4043,8 @@ var MCPTool = class extends BaseResource {
4023
4043
  * @returns Promise containing `{ result }`, or the suspended shape described above.
4024
4044
  */
4025
4045
  execute(params) {
4026
- const body = {};
4027
- if (params.data !== void 0) body.data = params.data;
4028
- if (params.requestContext !== void 0) body.requestContext = params.requestContext;
4029
- if (params.resumeData !== void 0) body.resumeData = params.resumeData;
4030
- if (params.suspendPayload !== void 0) body.suspendPayload = params.suspendPayload;
4031
- return this.request(`/mcp/${encodeURIComponent(this.serverId)}/tools/${encodeURIComponent(this.toolId)}/execute`, {
4046
+ const { requestContext, ...body } = params;
4047
+ return this.request(`/mcp/${encodeURIComponent(this.serverId)}/tools/${encodeURIComponent(this.toolId)}/execute${requestContextQueryString(requestContext)}`, {
4032
4048
  method: "POST",
4033
4049
  body
4034
4050
  });
@@ -4046,23 +4062,29 @@ var AgentBuilder = class extends BaseResource {
4046
4062
  this.actionId = actionId;
4047
4063
  }
4048
4064
  transformWorkflowResult(result) {
4049
- if (result.status === "success") return {
4050
- success: result.result.success || false,
4051
- applied: result.result.applied || false,
4052
- branchName: result.result.branchName,
4053
- message: result.result.message || "Agent builder action completed",
4054
- validationResults: result.result.validationResults,
4055
- error: result.result.error,
4056
- errors: result.result.errors,
4057
- stepResults: result.result.stepResults
4058
- };
4059
- else if (result.status === "failed") return {
4060
- success: false,
4061
- applied: false,
4062
- message: `Agent builder action failed: ${result.error.message}`,
4063
- error: result.error.message
4064
- };
4065
- else return {
4065
+ if (result.status === "success") {
4066
+ const actionResult = result.result;
4067
+ return {
4068
+ success: actionResult?.success ?? false,
4069
+ applied: actionResult?.applied ?? false,
4070
+ branchName: actionResult?.branchName,
4071
+ message: actionResult?.message ?? "Agent builder action completed",
4072
+ validationResults: actionResult?.validationResults,
4073
+ error: actionResult?.error,
4074
+ errors: actionResult?.errors,
4075
+ stepResults: actionResult?.stepResults
4076
+ };
4077
+ }
4078
+ if (result.status === "failed") {
4079
+ const message = result.error?.message ?? "Agent builder action failed";
4080
+ return {
4081
+ success: false,
4082
+ applied: false,
4083
+ message: `Agent builder action failed: ${message}`,
4084
+ error: message
4085
+ };
4086
+ }
4087
+ return {
4066
4088
  success: false,
4067
4089
  applied: false,
4068
4090
  message: "Agent builder action was suspended",
@@ -4258,7 +4280,7 @@ var AgentBuilder = class extends BaseResource {
4258
4280
  * This calls `/agent-builder/:actionId`.
4259
4281
  */
4260
4282
  async details() {
4261
- return await this.request(`/agent-builder/${this.actionId}`);
4283
+ return this.request(`/agent-builder/${this.actionId}`);
4262
4284
  }
4263
4285
  /**
4264
4286
  * Gets all runs for this agent builder action.
@@ -4487,7 +4509,7 @@ var Observability = class extends BaseResource {
4487
4509
  deleteTraces(params) {
4488
4510
  return this.request(`/observability/traces/delete`, {
4489
4511
  method: "POST",
4490
- body: { traceIds: params.traceIds }
4512
+ body: params
4491
4513
  });
4492
4514
  }
4493
4515
  /**