@mastra/server 1.58.0-alpha.1 → 1.58.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 (102) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/dist/_types/@mastra_schema-compat/dist/provider-compats/anthropic.d.ts +1 -1
  3. package/dist/{a2a-CnU9zaGR.js → a2a-8C4O2dVJ.js} +41 -5
  4. package/dist/a2a-8C4O2dVJ.js.map +1 -0
  5. package/dist/{a2a-D3ZYeXIx.cjs → a2a-B6YkZ2i9.cjs} +277 -52
  6. package/dist/a2a-B6YkZ2i9.cjs.map +1 -0
  7. package/dist/{a2a-oM7aqLz4.cjs → a2a-MPoM5lzS.cjs} +41 -5
  8. package/dist/a2a-MPoM5lzS.cjs.map +1 -0
  9. package/dist/{a2a-CHi9AJ0n.js → a2a-_D2EA4oa.js} +266 -53
  10. package/dist/a2a-_D2EA4oa.js.map +1 -0
  11. package/dist/{agent-builder-BDYN3r89.cjs → agent-builder-DAiJH1u2.cjs} +2 -2
  12. package/dist/{agent-builder-BDYN3r89.cjs.map → agent-builder-DAiJH1u2.cjs.map} +1 -1
  13. package/dist/{agent-builder-Dqy_qumV.js → agent-builder-gGFywDVq.js} +2 -2
  14. package/dist/{agent-builder-Dqy_qumV.js.map → agent-builder-gGFywDVq.js.map} +1 -1
  15. package/dist/{api-schema-manifest-J5hfk5ZZ.cjs → api-schema-manifest-B3bC-D98.cjs} +2 -2
  16. package/dist/{api-schema-manifest-J5hfk5ZZ.cjs.map → api-schema-manifest-B3bC-D98.cjs.map} +1 -1
  17. package/dist/{api-schema-manifest-R8CsF6RX.js → api-schema-manifest-B4J_QYOr.js} +2 -2
  18. package/dist/{api-schema-manifest-R8CsF6RX.js.map → api-schema-manifest-B4J_QYOr.js.map} +1 -1
  19. package/dist/{dist-IUXZtNBY.js → dist-BKRMiJcn.js} +102 -49
  20. package/dist/dist-BKRMiJcn.js.map +1 -0
  21. package/dist/{dist-DgY0llRv.cjs → dist-C2-SedDQ.cjs} +102 -49
  22. package/dist/dist-C2-SedDQ.cjs.map +1 -0
  23. package/dist/docs/SKILL.md +1 -1
  24. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  25. package/dist/docs/references/docs-agents-a2a.md +39 -0
  26. package/dist/docs/references/reference-server-routes.md +25 -11
  27. package/dist/route-builder-CIk5k35M.js.map +1 -1
  28. package/dist/route-builder-CgLVYL1c.cjs.map +1 -1
  29. package/dist/{routes-BzR8iVj4.cjs → routes-CZwPlO3-.cjs} +3 -2
  30. package/dist/routes-CZwPlO3-.cjs.map +1 -0
  31. package/dist/{routes-C7iRCN_l.js → routes-HUaCyUb7.js} +4 -3
  32. package/dist/{routes-C7iRCN_l.js.map → routes-HUaCyUb7.js.map} +1 -1
  33. package/dist/server/a2a/store.cjs +4 -0
  34. package/dist/server/a2a/store.cjs.map +1 -1
  35. package/dist/server/a2a/store.d.ts +3 -0
  36. package/dist/server/a2a/store.d.ts.map +1 -1
  37. package/dist/server/a2a/store.js +4 -0
  38. package/dist/server/a2a/store.js.map +1 -1
  39. package/dist/server/handlers/a2a.cjs +3 -1
  40. package/dist/server/handlers/a2a.d.ts +152 -10
  41. package/dist/server/handlers/a2a.d.ts.map +1 -1
  42. package/dist/server/handlers/a2a.js +2 -2
  43. package/dist/server/handlers/agent-builder.cjs +3 -3
  44. package/dist/server/handlers/agent-builder.js +3 -3
  45. package/dist/server/handlers/agent-controller.cjs +25 -6
  46. package/dist/server/handlers/agent-controller.cjs.map +1 -1
  47. package/dist/server/handlers/agent-controller.d.ts +4 -3
  48. package/dist/server/handlers/agent-controller.d.ts.map +1 -1
  49. package/dist/server/handlers/agent-controller.js +25 -6
  50. package/dist/server/handlers/agent-controller.js.map +1 -1
  51. package/dist/server/handlers/mcp-client-versions.cjs +1 -1
  52. package/dist/server/handlers/mcp-client-versions.js +1 -1
  53. package/dist/server/handlers/prompt-block-versions.cjs +1 -1
  54. package/dist/server/handlers/prompt-block-versions.js +1 -1
  55. package/dist/server/handlers/scorer-versions.cjs +1 -1
  56. package/dist/server/handlers/scorer-versions.js +1 -1
  57. package/dist/server/handlers/stored-mcp-clients.cjs +1 -1
  58. package/dist/server/handlers/stored-mcp-clients.js +1 -1
  59. package/dist/server/handlers/stored-prompt-blocks.cjs +1 -1
  60. package/dist/server/handlers/stored-prompt-blocks.js +1 -1
  61. package/dist/server/handlers/stored-scorers.cjs +1 -1
  62. package/dist/server/handlers/stored-scorers.js +1 -1
  63. package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
  64. package/dist/server/handlers/stored-skill-favorites.js +1 -1
  65. package/dist/server/handlers/stored-skills.cjs +1 -1
  66. package/dist/server/handlers/stored-skills.js +1 -1
  67. package/dist/server/handlers/system.cjs +1 -1
  68. package/dist/server/handlers/system.js +1 -1
  69. package/dist/server/handlers/workflows.cjs +93 -2
  70. package/dist/server/handlers/workflows.cjs.map +1 -1
  71. package/dist/server/handlers/workflows.d.ts +9 -0
  72. package/dist/server/handlers/workflows.d.ts.map +1 -1
  73. package/dist/server/handlers/workflows.js +92 -3
  74. package/dist/server/handlers/workflows.js.map +1 -1
  75. package/dist/server/handlers.cjs +1 -1
  76. package/dist/server/handlers.js +1 -1
  77. package/dist/server/schemas/a2a.d.ts +70 -6
  78. package/dist/server/schemas/a2a.d.ts.map +1 -1
  79. package/dist/server/schemas/index.cjs +4 -4
  80. package/dist/server/schemas/index.js +4 -4
  81. package/dist/server/schemas/workflows.d.ts +8 -0
  82. package/dist/server/schemas/workflows.d.ts.map +1 -1
  83. package/dist/server/server-adapter/index.cjs +1 -1
  84. package/dist/server/server-adapter/index.js +1 -1
  85. package/dist/server/server-adapter/routes/a2a.d.ts +116 -8
  86. package/dist/server/server-adapter/routes/a2a.d.ts.map +1 -1
  87. package/dist/server/server-adapter/routes/workflows.d.ts +7 -1
  88. package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -1
  89. package/dist/{workflows-DPW6FrY0.js → workflows-CMU5dz_4.js} +7 -2
  90. package/dist/workflows-CMU5dz_4.js.map +1 -0
  91. package/dist/{workflows-XfiENvkF.cjs → workflows-Dzxr6cmf.cjs} +12 -1
  92. package/dist/workflows-Dzxr6cmf.cjs.map +1 -0
  93. package/package.json +7 -7
  94. package/dist/a2a-CHi9AJ0n.js.map +0 -1
  95. package/dist/a2a-CnU9zaGR.js.map +0 -1
  96. package/dist/a2a-D3ZYeXIx.cjs.map +0 -1
  97. package/dist/a2a-oM7aqLz4.cjs.map +0 -1
  98. package/dist/dist-DgY0llRv.cjs.map +0 -1
  99. package/dist/dist-IUXZtNBY.js.map +0 -1
  100. package/dist/routes-BzR8iVj4.cjs.map +0 -1
  101. package/dist/workflows-DPW6FrY0.js.map +0 -1
  102. package/dist/workflows-XfiENvkF.cjs.map +0 -1
@@ -3,7 +3,7 @@ name: mastra-server
3
3
  description: Documentation for @mastra/server. Use when working with @mastra/server APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/server"
6
- version: "1.58.0-alpha.1"
6
+ version: "1.58.0-alpha.3"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.58.0-alpha.1",
2
+ "version": "1.58.0-alpha.3",
3
3
  "package": "@mastra/server",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -57,6 +57,18 @@ A2A represents work as messages and tasks. Messages carry text, file, or structu
57
57
 
58
58
  Tasks are stateful units of work with IDs and lifecycle states. Clients can follow long-running work and send follow-up turns. They can also cancel work or resubscribe after a disconnect.
59
59
 
60
+ ## Protocol versions
61
+
62
+ Mastra supports A2A Protocol v0.3 and v1.0 on the same agent card and execution URLs. The `A2A-Version` request header selects the wire protocol:
63
+
64
+ - Missing, empty, or `0.3`: Uses the existing v0.3 API.
65
+ - `1.0`: Uses the v1.0 API.
66
+ - Any other value: Returns a `VersionNotSupported` protocol error.
67
+
68
+ Existing `A2AAgent` and `MastraClient.getA2A()` integrations continue to use v0.3. Use `MastraClient.getA2AV1()` for v1.0 requests. The v1 client sends `A2A-Version: 1.0` automatically and adds the `tasks/list` operation.
69
+
70
+ Import v1.0 protocol types and codecs from `@mastra/core/a2a/v1`. The existing `@mastra/core/a2a/client` export remains on v0.3.
71
+
60
72
  ## Get started
61
73
 
62
74
  A2A has two common paths in Mastra:
@@ -155,6 +167,33 @@ for await (const event of updates) {
155
167
  }
156
168
  ```
157
169
 
170
+ ### Use the v1.0 client
171
+
172
+ Use `getA2AV1()` to opt into the A2A v1.0 wire protocol. The protocol package provides codecs for creating v1 request values from JSON-shaped input:
173
+
174
+ ```typescript
175
+ import { ListTasksRequest } from '@mastra/core/a2a/v1'
176
+ import { MastraClient } from '@mastra/client-js'
177
+
178
+ const client = new MastraClient({
179
+ baseUrl: 'https://agent.example.com',
180
+ })
181
+
182
+ const a2a = client.getA2AV1('weather-agent')
183
+ const response = await a2a.listTasks(
184
+ ListTasksRequest.fromJSON({
185
+ contextId: 'customer-support',
186
+ pageSize: 20,
187
+ }),
188
+ )
189
+
190
+ for (const task of response.tasks) {
191
+ console.log(task.id, task.status)
192
+ }
193
+ ```
194
+
195
+ The v1.0 client supports `getAgentCard()`, `sendMessage()`, `sendMessageStream()`, `getTask()`, `listTasks()`, `cancelTask()`, and `resubscribeTask()`.
196
+
158
197
  ## Configure subagent calls
159
198
 
160
199
  `A2AAgent` accepts request options for authenticated or constrained environments:
@@ -171,17 +171,31 @@ The route returns:
171
171
 
172
172
  ## Workflows
173
173
 
174
- | Method | Path | Description |
175
- | ------ | ----------------------------------------- | ------------------------------- |
176
- | `GET` | `/api/workflows` | List all workflows |
177
- | `GET` | `/api/workflows/:workflowId` | Get workflow by ID |
178
- | `POST` | `/api/workflows/:workflowId/create-run` | Create a new workflow run |
179
- | `POST` | `/api/workflows/:workflowId/start-async` | Start workflow and await result |
180
- | `POST` | `/api/workflows/:workflowId/stream` | Stream workflow execution |
181
- | `POST` | `/api/workflows/:workflowId/resume` | Resume suspended workflow |
182
- | `POST` | `/api/workflows/:workflowId/resume-async` | Resume asynchronously |
183
- | `GET` | `/api/workflows/:workflowId/runs` | List workflow runs |
184
- | `GET` | `/api/workflows/:workflowId/runs/:runId` | Get specific run |
174
+ | Method | Path | Description |
175
+ | ------ | ----------------------------------------- | ----------------------------------------------------- |
176
+ | `GET` | `/api/workflows` | List all workflows |
177
+ | `GET` | `/api/workflows/run-counts` | Get per-workflow counts of running and suspended runs |
178
+ | `GET` | `/api/workflows/:workflowId` | Get workflow by ID |
179
+ | `POST` | `/api/workflows/:workflowId/create-run` | Create a new workflow run |
180
+ | `POST` | `/api/workflows/:workflowId/start-async` | Start workflow and await result |
181
+ | `POST` | `/api/workflows/:workflowId/stream` | Stream workflow execution |
182
+ | `POST` | `/api/workflows/:workflowId/resume` | Resume suspended workflow |
183
+ | `POST` | `/api/workflows/:workflowId/resume-async` | Resume asynchronously |
184
+ | `GET` | `/api/workflows/:workflowId/runs` | List workflow runs |
185
+ | `GET` | `/api/workflows/:workflowId/runs/:runId` | Get specific run |
186
+
187
+ ### Run counts response
188
+
189
+ The `/api/workflows/run-counts` endpoint returns counts of `running` and [`suspended`](https://mastra.ai/docs/workflows/suspend-and-resume) runs for every registered workflow. The record is keyed by the workflow's registry key from the Mastra config, and the server may cache the response for a few seconds:
190
+
191
+ ```typescript
192
+ {
193
+ [workflowRegistryKey: string]: {
194
+ running: number;
195
+ suspended: number;
196
+ };
197
+ }
198
+ ```
185
199
 
186
200
  ### Stored workflows
187
201