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

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 (44) 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 +36 -29
  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 +36 -29
  11. package/dist/index.js.map +1 -1
  12. package/dist/resources/agent-builder.d.ts +25 -40
  13. package/dist/resources/agent-builder.d.ts.map +1 -1
  14. package/dist/resources/agent-controller.d.ts +5 -4
  15. package/dist/resources/agent-controller.d.ts.map +1 -1
  16. package/dist/resources/agent.d.ts +32 -70
  17. package/dist/resources/agent.d.ts.map +1 -1
  18. package/dist/resources/channels.d.ts +13 -31
  19. package/dist/resources/channels.d.ts.map +1 -1
  20. package/dist/resources/conversations.d.ts +6 -3
  21. package/dist/resources/conversations.d.ts.map +1 -1
  22. package/dist/resources/mcp-tool.d.ts +3 -5
  23. package/dist/resources/mcp-tool.d.ts.map +1 -1
  24. package/dist/resources/memory-thread.d.ts +6 -11
  25. package/dist/resources/memory-thread.d.ts.map +1 -1
  26. package/dist/resources/observability-route-types.d.ts +88 -0
  27. package/dist/resources/observability-route-types.d.ts.map +1 -0
  28. package/dist/resources/observability.d.ts +6 -9
  29. package/dist/resources/observability.d.ts.map +1 -1
  30. package/dist/resources/responses.d.ts +5 -2
  31. package/dist/resources/responses.d.ts.map +1 -1
  32. package/dist/resources/run.d.ts +21 -57
  33. package/dist/resources/run.d.ts.map +1 -1
  34. package/dist/resources/tool.d.ts +6 -4
  35. package/dist/resources/tool.d.ts.map +1 -1
  36. package/dist/resources/vector.d.ts +5 -10
  37. package/dist/resources/vector.d.ts.map +1 -1
  38. package/dist/resources/workflow.d.ts +8 -10
  39. package/dist/resources/workflow.d.ts.map +1 -1
  40. package/dist/route-types.generated.d.ts +2702 -2163
  41. package/dist/route-types.generated.d.ts.map +1 -1
  42. package/dist/types.d.ts +230 -1598
  43. package/dist/types.d.ts.map +1 -1
  44. 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
@@ -4023,12 +4028,8 @@ var MCPTool = class extends BaseResource {
4023
4028
  * @returns Promise containing `{ result }`, or the suspended shape described above.
4024
4029
  */
4025
4030
  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`, {
4031
+ const { requestContext, ...body } = params;
4032
+ return this.request(`/mcp/${encodeURIComponent(this.serverId)}/tools/${encodeURIComponent(this.toolId)}/execute${requestContextQueryString(requestContext)}`, {
4032
4033
  method: "POST",
4033
4034
  body
4034
4035
  });
@@ -4046,23 +4047,29 @@ var AgentBuilder = class extends BaseResource {
4046
4047
  this.actionId = actionId;
4047
4048
  }
4048
4049
  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 {
4050
+ if (result.status === "success") {
4051
+ const actionResult = result.result;
4052
+ return {
4053
+ success: actionResult?.success ?? false,
4054
+ applied: actionResult?.applied ?? false,
4055
+ branchName: actionResult?.branchName,
4056
+ message: actionResult?.message ?? "Agent builder action completed",
4057
+ validationResults: actionResult?.validationResults,
4058
+ error: actionResult?.error,
4059
+ errors: actionResult?.errors,
4060
+ stepResults: actionResult?.stepResults
4061
+ };
4062
+ }
4063
+ if (result.status === "failed") {
4064
+ const message = result.error?.message ?? "Agent builder action failed";
4065
+ return {
4066
+ success: false,
4067
+ applied: false,
4068
+ message: `Agent builder action failed: ${message}`,
4069
+ error: message
4070
+ };
4071
+ }
4072
+ return {
4066
4073
  success: false,
4067
4074
  applied: false,
4068
4075
  message: "Agent builder action was suspended",
@@ -4258,7 +4265,7 @@ var AgentBuilder = class extends BaseResource {
4258
4265
  * This calls `/agent-builder/:actionId`.
4259
4266
  */
4260
4267
  async details() {
4261
- return await this.request(`/agent-builder/${this.actionId}`);
4268
+ return this.request(`/agent-builder/${this.actionId}`);
4262
4269
  }
4263
4270
  /**
4264
4271
  * Gets all runs for this agent builder action.
@@ -4487,7 +4494,7 @@ var Observability = class extends BaseResource {
4487
4494
  deleteTraces(params) {
4488
4495
  return this.request(`/observability/traces/delete`, {
4489
4496
  method: "POST",
4490
- body: { traceIds: params.traceIds }
4497
+ body: params
4491
4498
  });
4492
4499
  }
4493
4500
  /**