@mastra/client-js 1.28.0-alpha.6 → 1.28.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,133 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 1.28.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`b9a2961`](https://github.com/mastra-ai/mastra/commit/b9a2961c1be81e3639c0879e58588c26dd0ae866), [`1274eb3`](https://github.com/mastra-ai/mastra/commit/1274eb3a9508f579ceb3187fbce34408222d4b71), [`1274eb3`](https://github.com/mastra-ai/mastra/commit/1274eb3a9508f579ceb3187fbce34408222d4b71), [`9566d27`](https://github.com/mastra-ai/mastra/commit/9566d27ead3d95bdbe5a69e5a082a68222829cf2)]:
8
+ - @mastra/core@1.48.0-alpha.0
9
+
10
+ ## 1.28.0
11
+
12
+ ### Minor Changes
13
+
14
+ - Enrich the agent-controller HTTP session surface so a client can render a status ([#18446](https://github.com/mastra-ai/mastra/pull/18446))
15
+ line, read behavior settings, and scope threads per working directory.
16
+
17
+ `GET /agent-controller/:controllerId/sessions/:resourceId` now also returns:
18
+ - `omProgress` — the status-line slice of observational-memory progress
19
+ (pending tokens vs. observation threshold, accumulated observations vs.
20
+ reflection threshold, plus projected message removal / reflection savings)
21
+ - `tokenUsage` — cumulative token usage for the current thread
22
+ - `settings` — agent behavior settings (`yolo`, `thinkingLevel`,
23
+ `notifications`, `smartEditing`)
24
+
25
+ `GET /agent-controller/:controllerId/sessions/:resourceId/threads` accepts
26
+ an optional `tags` query param (a JSON-encoded object). A single resourceId can
27
+ be shared across git worktrees of the same repo (the id is derived from the git
28
+ URL), so passing `tags` scopes the list to threads matching every tag (e.g.
29
+ `{ projectPath }` for the working directory). Each returned thread now also
30
+ includes the scoping `tags` it was stamped with at creation.
31
+
32
+ The session event stream route (`.../stream`) now enqueues raw event objects
33
+ and lets the server adapter handle SSE framing, fixing a double-framing bug
34
+ where events were wrapped twice (`data: "data: {...}\n\n"\n\n`) and could not be
35
+ parsed by clients.
36
+
37
+ `@mastra/client-js` gains the matching types and reads:
38
+ - `AgentControllerOMProgress` and `AgentControllerSessionSettings`, surfaced on
39
+ `AgentControllerSessionState` (`omProgress`, `tokenUsage`, `settings`)
40
+ - a `display_state_changed` event in `KnownAgentControllerEvent` carrying the
41
+ status-line figures
42
+ - `AgentControllerSession.listThreads()` now accepts either a number
43
+ (back-compat) or `{ limit?, tags? }`
44
+
45
+ Example:
46
+
47
+ ```ts
48
+ const session = client.getAgentController('code').session(resourceId);
49
+
50
+ // Scope a worktree's thread list (and resumed session) to its own threads.
51
+ await session.create({ tags: { projectPath: '/repo/worktree-a' } });
52
+ const threads = await session.listThreads({ tags: { projectPath: '/repo/worktree-a' } });
53
+
54
+ // Read the status-line figures and agent settings.
55
+ const state = await session.state();
56
+ state.omProgress; // observational-memory progress
57
+ state.tokenUsage; // cumulative token usage
58
+ state.settings; // { yolo, thinkingLevel, notifications, smartEditing }
59
+ ```
60
+
61
+ - Rename the `Harness` class to `AgentController` and its associated `Harness*` types to `AgentController*` (e.g. `HarnessConfig` → `AgentControllerConfig`, `HarnessMode` → `AgentControllerMode`, `HarnessEvent` → `AgentControllerEvent`). ([#18505](https://github.com/mastra-ai/mastra/pull/18505))
62
+
63
+ `@mastra/core`: A new canonical subpath `@mastra/core/agent-controller` exports the `AgentController` class plus the `AgentController*` types. The legacy `@mastra/core/harness` subpath remains available and re-exports the deprecated `Harness*` aliases, so existing `Harness` class and type usage continues to work unchanged. New code should import from `@mastra/core/agent-controller`. On `Mastra`, the hosted-controller API is exposed under agent-controller names — `getAgentController`, `getAgentControllerById`, `listAgentControllers`, and the `agentControllers` config key — while `getHarness`/`getHarnessById`/`listHarnesses` and the `harnesses` config key remain as deprecated aliases.
64
+
65
+ `@mastra/server`: The controller session API is now served exclusively under `/agent-controller/...` (with `agent-controller:read` / `agent-controller:execute` permissions). The legacy `/harness/...` routes and `harness:*` permissions have been removed. List responses use the `agentControllers` key, session responses use `controllerId`, and path params use `:controllerId`.
66
+
67
+ `@mastra/client-js`: `AgentController` and `AgentControllerSession` are now the canonical resource classes, with `MastraClient.getAgentController(id)` / `listAgentControllers()` targeting the `/agent-controller` routes and reading the canonical `agentControllers` / `controllerId` response keys. The deprecated `getHarness` / `listHarnesses` methods and `Harness` / `HarnessSession` classes have been removed. This is a breaking change for the recently released client.
68
+
69
+ The `@mastra/core` peer dependency floor is raised to `>=1.47.0-0` so consumers must be on the release that introduces the canonical agent-controller surface. This applies to `@mastra/server`, `@mastra/deployer`, and `mastra` (CLI), and is propagated to the packages that depend on them: the deployers (`@mastra/deployer-cloud`, `@mastra/deployer-cloudflare`, `@mastra/deployer-netlify`, `@mastra/deployer-vercel`), the server adapters (`@mastra/express`, `@mastra/fastify`, `@mastra/hono`, `@mastra/koa`, `@mastra/nestjs`, `@mastra/next`, `@mastra/tanstack-start`), and `@mastra/temporal`.
70
+
71
+ - Scope harness session creation with tags so sessions sharing a resourceId can ([#18446](https://github.com/mastra-ai/mastra/pull/18446))
72
+ each resume their own thread.
73
+
74
+ `harness.createSession()` now accepts an optional `tags` record. The tags are
75
+ (a) seeded into the new session's state, (b) stamped onto every thread the
76
+ session creates (so thread listings can be filtered back to the session's
77
+ scope), and (c) used to filter initial thread selection: a thread is a resume
78
+ candidate only when its metadata matches every provided tag. Previously, initial
79
+ thread selection only consulted the
80
+ harness-global `initialState.projectPath`; on a multi-session server (where one
81
+ Harness serves many scopes) a session could resume the most recently updated
82
+ thread from a _different_ scope that shared the resourceId. Using a generic tag
83
+ record (e.g. `{ projectPath }`) keeps room for future scoping dimensions without
84
+ further API changes.
85
+
86
+ The `@mastra/client-js` `HarnessSession.create()` method accepts `{ tags }`, and
87
+ the `POST /harness/:id/sessions` route accepts a `tags` body field.
88
+
89
+ ```ts
90
+ // before: initial thread chosen by resourceId only
91
+ const session = await harness.createSession({ resourceId, id, ownerId });
92
+
93
+ // after: initial thread scoped to this worktree via a tag
94
+ const session = await harness.createSession({
95
+ resourceId,
96
+ id,
97
+ ownerId,
98
+ tags: { projectPath: '/repo/worktree-a' },
99
+ });
100
+ ```
101
+
102
+ ### Patch Changes
103
+
104
+ - feat(playground): render ask_user tool as interactive question UI in Studio ([#18374](https://github.com/mastra-ai/mastra/pull/18374))
105
+
106
+ Adds an `AskUserBadge` component that renders suspended `ask_user` tool calls
107
+ as interactive prompts with clickable option buttons (single/multi-select) or
108
+ free-text input. The user's answer is sent as `resumeData` through the existing
109
+ `sendToolApproval` flow to properly resume the tool.
110
+
111
+ Plumbing changes:
112
+ - `sendToolApprovalBodySchema` now accepts optional `resumeData`
113
+ - `agent.sendToolApproval()` passes custom `resumeData` when provided
114
+ - `@mastra/client-js` and `@mastra/react` expose the new parameter
115
+
116
+ - Preserve original tool-call arguments when a tool result is persisted without its matching tool-call in the same message. Previously the arguments were saved as empty `{}`, which poisoned the model's context and caused it to emit invalid empty-argument tool calls after a few cycles. The adapter now recovers the original arguments from prior persisted messages, covering the server resume path, AG-UI hosts replaying client-tool results, and `@mastra/client-js` streaming recursion. ([#16981](https://github.com/mastra-ai/mastra/pull/16981))
117
+
118
+ Also execute every streamed client tool call emitted in the same tool-calls step before continuing, instead of only continuing with one tool result. Fixes #16017 and #15576.
119
+
120
+ - Updated dependencies [[`86623c1`](https://github.com/mastra-ai/mastra/commit/86623c1adf7d22de32cc916dda17f4155184db36), [`023766f`](https://github.com/mastra-ai/mastra/commit/023766f44d59b30a50f3a381e33eddde8ab56c00), [`0200e75`](https://github.com/mastra-ai/mastra/commit/0200e7552d02d4221cd6040bf4eddf189a97a156), [`7c9dd77`](https://github.com/mastra-ai/mastra/commit/7c9dd77bd18cb8dc72797e25f1a0fbdc71a11347), [`7f9ae70`](https://github.com/mastra-ai/mastra/commit/7f9ae70826b047e5a66218f9e92f20e54a2d791f), [`a0509c7`](https://github.com/mastra-ai/mastra/commit/a0509c731a08aa3ed626557c5338126362856f57), [`06e0d63`](https://github.com/mastra-ai/mastra/commit/06e0d63d42bc2a202e18bc091f3781f409f5e6fb), [`bf3fe49`](https://github.com/mastra-ai/mastra/commit/bf3fe49f9467dbbdb8f9eaf74e0f7971ffb19559), [`01caf93`](https://github.com/mastra-ai/mastra/commit/01caf93d71ae2c1e65f49735cafb531975187426), [`438a971`](https://github.com/mastra-ai/mastra/commit/438a9715c8b4398e5eaf8914a1f19dc8a85dc1de), [`9990965`](https://github.com/mastra-ai/mastra/commit/999096571635a83b42ef40841fd7028cfa630779), [`77518cc`](https://github.com/mastra-ai/mastra/commit/77518ccb5bb8cc684875081e64213dc85cffdbee), [`fbeda0c`](https://github.com/mastra-ai/mastra/commit/fbeda0c0f35def07e6837936dd3a003b2b7c5172), [`8a68844`](https://github.com/mastra-ai/mastra/commit/8a688443013816105a09f89c6afa34b5ff13e26d), [`bb2a13b`](https://github.com/mastra-ai/mastra/commit/bb2a13bb4b32e6bb807200fe7b18ae8fa4322118), [`24ceaea`](https://github.com/mastra-ai/mastra/commit/24ceaea0bdd8609cabbab764380608ca6621a194), [`a73cd1a`](https://github.com/mastra-ai/mastra/commit/a73cd1a62a5e4ca023dcc39ba150029f4f1f74c1), [`c0ffa3c`](https://github.com/mastra-ai/mastra/commit/c0ffa3c897ccd326de880df734740a7f0681a18f), [`462a769`](https://github.com/mastra-ai/mastra/commit/462a769da61850862ca1be3d74134d33078ee6a7), [`0504bf5`](https://github.com/mastra-ai/mastra/commit/0504bf5e8cffc571a4b343326178de371e6f859b), [`0b5cc47`](https://github.com/mastra-ai/mastra/commit/0b5cc4726dc18d9a685a27520db39ff1b36bb89a), [`87f38a3`](https://github.com/mastra-ai/mastra/commit/87f38a3de03e24731f2dd6f8ed6a60b6722b85a1), [`d5fa3cd`](https://github.com/mastra-ai/mastra/commit/d5fa3cda1788c3cb93a361a3c6ec47de6ba21e98), [`fe98ef2`](https://github.com/mastra-ai/mastra/commit/fe98ef2e66dbfcbd7d645c88c9ee1e67b458a136), [`6ccf67b`](https://github.com/mastra-ai/mastra/commit/6ccf67bf075753754927a57bc2e1734ba2c820c5), [`793ea0f`](https://github.com/mastra-ai/mastra/commit/793ea0f52f831178837f21c83af6af93bf4ce638), [`825d8de`](https://github.com/mastra-ai/mastra/commit/825d8def9fa64c2bcc3d8dd6b49e09342c3ac5c7), [`507a5c4`](https://github.com/mastra-ai/mastra/commit/507a5c461bdc3136ad80744c0efbb55ce1f18f97), [`5afe423`](https://github.com/mastra-ai/mastra/commit/5afe423e4badf040f1b0d4525183a856fcb8146e), [`307573b`](https://github.com/mastra-ai/mastra/commit/307573b9ff3149b70c79540dbc86f1319b180f29), [`79b3626`](https://github.com/mastra-ai/mastra/commit/79b3626f8d647307eb07c8da14c9073c2699719d), [`c2c1d7b`](https://github.com/mastra-ai/mastra/commit/c2c1d7bb61d2602955f14ed3952f807c2d6eb576), [`86623c1`](https://github.com/mastra-ai/mastra/commit/86623c1adf7d22de32cc916dda17f4155184db36), [`1505c07`](https://github.com/mastra-ai/mastra/commit/1505c07603f6346bae12aa82f140e8b88ffea9ab), [`f328049`](https://github.com/mastra-ai/mastra/commit/f3280498c324afd2a8d36cd828f5b9f94a2dddc1), [`e545228`](https://github.com/mastra-ai/mastra/commit/e54522856934a5dc030b7b6385771e3548020d59), [`3eb852e`](https://github.com/mastra-ai/mastra/commit/3eb852e5435bc908b800193498103dc724f455b0), [`ffa09e7`](https://github.com/mastra-ai/mastra/commit/ffa09e772a5c92270eabe2090fc42d45bd8ec4b7), [`8c9f1c0`](https://github.com/mastra-ai/mastra/commit/8c9f1c0361d89066f9bcd14a2f69e761b01766c8), [`461a7c5`](https://github.com/mastra-ai/mastra/commit/461a7c501449295287f4f0ee4b0b42344f39fcf8), [`4211472`](https://github.com/mastra-ai/mastra/commit/4211472a5a2bd319c60cd2e42d9109c3eef7ac1c), [`9e45902`](https://github.com/mastra-ai/mastra/commit/9e4590208e745055cecca202e2db0e5c65e17d3c), [`5c0df77`](https://github.com/mastra-ai/mastra/commit/5c0df776c40efa420f8c07a2f3ee66010296618e), [`e940f09`](https://github.com/mastra-ai/mastra/commit/e940f099ef5d18b403e6f2b4937e086a4da857b1)]:
121
+ - @mastra/core@1.47.0
122
+ - @mastra/schema-compat@1.3.1
123
+
124
+ ## 1.28.0-alpha.7
125
+
126
+ ### Patch Changes
127
+
128
+ - Updated dependencies [[`8a68844`](https://github.com/mastra-ai/mastra/commit/8a688443013816105a09f89c6afa34b5ff13e26d)]:
129
+ - @mastra/core@1.47.0-alpha.7
130
+
3
131
  ## 1.28.0-alpha.6
4
132
 
5
133
  ### Minor 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.0-alpha.6"
6
+ version: "1.28.1-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.28.0-alpha.6",
2
+ "version": "1.28.1-alpha.0",
3
3
  "package": "@mastra/client-js",
4
4
  "exports": {
5
5
  "RequestContext": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "1.28.0-alpha.6",
3
+ "version": "1.28.1-alpha.0",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -39,8 +39,8 @@
39
39
  "canonicalize": "^1.0.8",
40
40
  "jose": "^6.2.1",
41
41
  "json-schema": "^0.4.0",
42
- "@mastra/schema-compat": "1.3.1-alpha.0",
43
- "@mastra/core": "1.47.0-alpha.6"
42
+ "@mastra/core": "1.48.0-alpha.0",
43
+ "@mastra/schema-compat": "1.3.1"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "zod": "^3.25.0 || ^4.0.0"
@@ -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-v5": "0.0.55",
60
- "@internal/ai-sdk-v4": "0.0.55",
61
- "@internal/lint": "0.0.108",
62
- "@internal/types-builder": "0.0.83"
59
+ "@internal/ai-sdk-v5": "0.0.56",
60
+ "@internal/lint": "0.0.109",
61
+ "@internal/types-builder": "0.0.84",
62
+ "@internal/ai-sdk-v4": "0.0.56"
63
63
  },
64
64
  "engines": {
65
65
  "node": ">=22.13.0"