@mastra/client-js 1.28.1-alpha.0 → 1.28.1-alpha.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 1.28.1-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`e420b3c`](https://github.com/mastra-ai/mastra/commit/e420b3c3ffc98bbc5b791897ea390bb47af99696)]:
8
+ - @mastra/core@1.48.0-alpha.2
9
+
10
+ ## 1.28.1-alpha.1
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`95857bc`](https://github.com/mastra-ai/mastra/commit/95857bcd6669da7193f503e803f0d72a2bd66be6), [`8e9c0fb`](https://github.com/mastra-ai/mastra/commit/8e9c0fb48fd58da2efcdff2cf1202ee41092c315)]:
15
+ - @mastra/core@1.48.0-alpha.1
16
+
3
17
  ## 1.28.1-alpha.0
4
18
 
5
19
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-client-js
3
3
  description: Documentation for @mastra/client-js. Use when working with @mastra/client-js APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/client-js"
6
- version: "1.28.1-alpha.0"
6
+ version: "1.28.1-alpha.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.28.1-alpha.0",
2
+ "version": "1.28.1-alpha.2",
3
3
  "package": "@mastra/client-js",
4
4
  "exports": {
5
5
  "RequestContext": {
@@ -322,6 +322,29 @@ Use `createNotificationInboxTool()` to give agents one tool for inbox actions in
322
322
 
323
323
  `sendNotificationSignal()` requires a storage domain with `notifications` support. Use `sendSignal({ type: 'notification' })` only for lower-level notification-shaped context that should bypass inbox storage.
324
324
 
325
+ ## Distributed and serverless deployments
326
+
327
+ Signals coordinate runs through a pub/sub backend. When a signal arrives on a backend that implements `LeaseProvider`, Mastra acquires a lease on the target thread so a single process owns the conversation at a time, then either wakes the agent or routes the input into the running loop. Backends without leasing fall back to a no-op that always grants ownership, which is fine in a single process but not across instances.
328
+
329
+ The default in-memory pub/sub can't cross instance boundaries. On serverless platforms like Vercel, or any multi-instance deployment, a follow-up signal can land on a different instance than the one running the agent. Without a shared pub/sub, that instance can't reach the active run and starts its own, leaving the original run untouched and the thread processed twice.
330
+
331
+ Configure a shared pub/sub backed by Redis Streams on the `Mastra` instance so leases and signals coordinate across instances:
332
+
333
+ ```typescript
334
+ import { Mastra } from '@mastra/core'
335
+ import { RedisStreamsPubSub } from '@mastra/redis-streams'
336
+
337
+ export const mastra = new Mastra({
338
+ agents: { agent },
339
+ pubsub: new RedisStreamsPubSub({
340
+ url: process.env.REDIS_URL,
341
+ keyPrefix: 'mastra:my-app',
342
+ }),
343
+ })
344
+ ```
345
+
346
+ `RedisStreamsPubSub` implements both the event delivery contract and distributed leasing, so a single backend handles cross-instance signal delivery and lease ownership. Vercel's one-click Redis integration and Upstash Redis both work well. For more on when a distributed pub/sub is needed, see the [PubSub guide](https://mastra.ai/docs/server/pubsub) and the [`RedisStreamsPubSub` reference](https://mastra.ai/reference/pubsub/redis-streams).
347
+
325
348
  ## Compatibility and APIs
326
349
 
327
350
  ### Compatibility
@@ -404,4 +427,5 @@ Use heartbeats together with client-side reconnect logic. Heartbeats reduce idle
404
427
  - [`client.getAgent().sendSignal()`](https://mastra.ai/reference/client-js/agents)
405
428
  - [Server agent routes](https://mastra.ai/reference/server/routes)
406
429
  - [`client.getAgent().subscribeToThread()`](https://mastra.ai/reference/client-js/agents)
407
- - [`client.getAgent().sendToolApproval()`](https://mastra.ai/reference/client-js/agents)
430
+ - [`client.getAgent().sendToolApproval()`](https://mastra.ai/reference/client-js/agents)
431
+ - [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "1.28.1-alpha.0",
3
+ "version": "1.28.1-alpha.2",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -39,7 +39,7 @@
39
39
  "canonicalize": "^1.0.8",
40
40
  "jose": "^6.2.1",
41
41
  "json-schema": "^0.4.0",
42
- "@mastra/core": "1.48.0-alpha.0",
42
+ "@mastra/core": "1.48.0-alpha.2",
43
43
  "@mastra/schema-compat": "1.3.1"
44
44
  },
45
45
  "peerDependencies": {
@@ -56,10 +56,10 @@
56
56
  "typescript": "^6.0.3",
57
57
  "vitest": "4.1.8",
58
58
  "zod": "^4.4.3",
59
+ "@internal/ai-sdk-v4": "0.0.56",
59
60
  "@internal/ai-sdk-v5": "0.0.56",
60
61
  "@internal/lint": "0.0.109",
61
- "@internal/types-builder": "0.0.84",
62
- "@internal/ai-sdk-v4": "0.0.56"
62
+ "@internal/types-builder": "0.0.84"
63
63
  },
64
64
  "engines": {
65
65
  "node": ">=22.13.0"