@mastra/server 1.25.0-alpha.3 → 1.25.1-alpha.0

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 (33) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/{chunk-24VJHE45.cjs → chunk-735PUE35.cjs} +2 -2
  3. package/dist/{chunk-24VJHE45.cjs.map → chunk-735PUE35.cjs.map} +1 -1
  4. package/dist/chunk-JP6747C6.cjs +126 -0
  5. package/dist/chunk-JP6747C6.cjs.map +1 -0
  6. package/dist/chunk-NI5HCR63.js +122 -0
  7. package/dist/chunk-NI5HCR63.js.map +1 -0
  8. package/dist/{chunk-JFVESFFY.js → chunk-W3QIBYWZ.js} +2 -2
  9. package/dist/{chunk-JFVESFFY.js.map → chunk-W3QIBYWZ.js.map} +1 -1
  10. package/dist/docs/SKILL.md +1 -1
  11. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  12. package/dist/server/handlers/agent-builder.cjs +16 -16
  13. package/dist/server/handlers/agent-builder.js +1 -1
  14. package/dist/server/handlers/background-tasks.cjs +20 -0
  15. package/dist/server/handlers/background-tasks.cjs.map +1 -0
  16. package/dist/server/handlers/background-tasks.d.ts +166 -0
  17. package/dist/server/handlers/background-tasks.d.ts.map +1 -0
  18. package/dist/server/handlers/background-tasks.js +3 -0
  19. package/dist/server/handlers/background-tasks.js.map +1 -0
  20. package/dist/server/handlers.cjs +2 -2
  21. package/dist/server/handlers.js +1 -1
  22. package/dist/server/schemas/background-tasks.d.ts +118 -0
  23. package/dist/server/schemas/background-tasks.d.ts.map +1 -0
  24. package/dist/server/schemas/index.cjs +127 -127
  25. package/dist/server/schemas/index.js +3 -3
  26. package/dist/server/server-adapter/index.cjs +29 -20
  27. package/dist/server/server-adapter/index.cjs.map +1 -1
  28. package/dist/server/server-adapter/index.js +14 -5
  29. package/dist/server/server-adapter/index.js.map +1 -1
  30. package/dist/server/server-adapter/routes/background-tasks.d.ts +3 -0
  31. package/dist/server/server-adapter/routes/background-tasks.d.ts.map +1 -0
  32. package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
  33. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 1.25.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Add `/api/background-tasks` routes (SSE stream, list with filters + pagination, get by ID) and matching `MastraClient` methods (`listBackgroundTasks`, `getBackgroundTask`, `streamBackgroundTasks`). ([#15307](https://github.com/mastra-ai/mastra/pull/15307))
8
+
9
+ - Updated dependencies [[`d63ffdb`](https://github.com/mastra-ai/mastra/commit/d63ffdbb2c11e76fe5ea45faab44bc15460f010c)]:
10
+ - @mastra/core@1.25.1-alpha.0
11
+
12
+ ## 1.25.0
13
+
14
+ ### Minor Changes
15
+
16
+ - feat(server): Add `mapUserToResourceId` callback to auth config for automatic resource ID scoping ([#13954](https://github.com/mastra-ai/mastra/pull/13954))
17
+
18
+ Auth configs now accept a `mapUserToResourceId` callback that maps the authenticated user to a resource ID after successful authentication. This enables per-user memory and thread isolation without requiring custom middleware or adapter subclassing.
19
+
20
+ ```typescript
21
+ const mastra = new Mastra({
22
+ server: {
23
+ auth: {
24
+ authenticateToken: async token => verifyToken(token),
25
+ mapUserToResourceId: user => user.id,
26
+ },
27
+ },
28
+ });
29
+ ```
30
+
31
+ The callback is called in `coreAuthMiddleware` after the user is authenticated and set on the request context. The returned value is set as `MASTRA_RESOURCE_ID_KEY`, which takes precedence over client-provided values for security. Works across all server adapters (Hono, Express, Next.js, etc.).
32
+
33
+ ### Patch Changes
34
+
35
+ - fix(server): Strip reserved context keys from client-provided requestContext ([#13954](https://github.com/mastra-ai/mastra/pull/13954))
36
+
37
+ Clients could inject `mastra__resourceId` or `mastra__threadId` via the request body or query params to impersonate other users' memory/thread access. Reserved keys are now filtered out during request context creation in `mergeRequestContext`, so only server-side code (auth callbacks, middleware) can set them.
38
+
39
+ - Updated dependencies [[`87df955`](https://github.com/mastra-ai/mastra/commit/87df955c028660c075873fd5d74af28233ce32eb), [`8fad147`](https://github.com/mastra-ai/mastra/commit/8fad14759804179c8e080ce4d9dec6ef1a808b31), [`582644c`](https://github.com/mastra-ai/mastra/commit/582644c4a87f83b4f245a84d72b9e8590585012e), [`cbdf3e1`](https://github.com/mastra-ai/mastra/commit/cbdf3e12b3d0c30a6e5347be658e2009648c130a), [`8fe46d3`](https://github.com/mastra-ai/mastra/commit/8fe46d354027f3f0f0846e64219772348de106dd), [`18c67db`](https://github.com/mastra-ai/mastra/commit/18c67dbb9c9ebc26f26f65f7d3ff836e5691ef46), [`4ba3bb1`](https://github.com/mastra-ai/mastra/commit/4ba3bb1e465ad2ddaba3bbf2bc47e0faec32985e), [`5d84914`](https://github.com/mastra-ai/mastra/commit/5d84914e0e520c642a40329b210b413fcd139898), [`8dcc77e`](https://github.com/mastra-ai/mastra/commit/8dcc77e78a5340f5848f74b9e9f1b3da3513c1f5), [`aa67fc5`](https://github.com/mastra-ai/mastra/commit/aa67fc59ee8a5eeff1f23eb05970b8d7a536c8ff), [`fd2f314`](https://github.com/mastra-ai/mastra/commit/fd2f31473d3449b6b97e837ef8641264377f41a7), [`fa8140b`](https://github.com/mastra-ai/mastra/commit/fa8140bcd4251d2e3ac85fdc5547dfc4f372b5be), [`190f452`](https://github.com/mastra-ai/mastra/commit/190f45258b0640e2adfc8219fa3258cdc5b8f071), [`e80fead`](https://github.com/mastra-ai/mastra/commit/e80fead1412cc0d1b2f7d6a1ce5017d9e0098ff7), [`0287b64`](https://github.com/mastra-ai/mastra/commit/0287b644a5c3272755cf3112e71338106664103b), [`7e7bf60`](https://github.com/mastra-ai/mastra/commit/7e7bf606886bf374a6f9d4ca9b09dd83d0533372), [`184907d`](https://github.com/mastra-ai/mastra/commit/184907d775d8609c03c26e78ccaf37315f3aa287), [`075e91a`](https://github.com/mastra-ai/mastra/commit/075e91a4549baf46ad7a42a6a8ac8dfa78cc09e6), [`0c4cd13`](https://github.com/mastra-ai/mastra/commit/0c4cd131931c04ac5405373c932a242dbe88edd6), [`b16a753`](https://github.com/mastra-ai/mastra/commit/b16a753d5748440248d7df82e29bb987a9c8386c)]:
40
+ - @mastra/core@1.25.0
41
+
3
42
  ## 1.25.0-alpha.3
4
43
 
5
44
  ### Patch Changes
@@ -30436,5 +30436,5 @@ exports.START_ASYNC_AGENT_BUILDER_ACTION_ROUTE = START_ASYNC_AGENT_BUILDER_ACTIO
30436
30436
  exports.STREAM_AGENT_BUILDER_ACTION_ROUTE = STREAM_AGENT_BUILDER_ACTION_ROUTE;
30437
30437
  exports.STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE;
30438
30438
  exports.agent_builder_exports = agent_builder_exports;
30439
- //# sourceMappingURL=chunk-24VJHE45.cjs.map
30440
- //# sourceMappingURL=chunk-24VJHE45.cjs.map
30439
+ //# sourceMappingURL=chunk-735PUE35.cjs.map
30440
+ //# sourceMappingURL=chunk-735PUE35.cjs.map