@mastra/client-js 1.60.0 → 1.60.1-alpha.1
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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +7 -7
- package/dist/docs/references/docs-harness-agent-controller.md +2 -0
- package/dist/docs/references/docs-studio-editor.md +17 -0
- package/dist/docs/references/reference-observability-metrics-queries.md +9 -9
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/observability/collector.d.ts.map +1 -1
- package/dist/route-types.generated.d.ts +25 -0
- package/dist/route-types.generated.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/docs/SKILL.md
CHANGED
|
@@ -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.60.
|
|
6
|
+
version: "1.60.1-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.60.
|
|
2
|
+
"version": "1.60.1-alpha.1",
|
|
3
3
|
"package": "@mastra/client-js",
|
|
4
4
|
"exports": {
|
|
5
5
|
"ClientTool": {
|
|
6
6
|
"types": "dist/tools.d.ts",
|
|
7
7
|
"implementation": "dist/index.js",
|
|
8
|
-
"line":
|
|
8
|
+
"line": 9628
|
|
9
9
|
},
|
|
10
10
|
"MastraClient": {
|
|
11
11
|
"types": "dist/client.d.ts",
|
|
12
12
|
"implementation": "dist/index.js",
|
|
13
|
-
"line":
|
|
13
|
+
"line": 7771
|
|
14
14
|
},
|
|
15
15
|
"MastraClientError": {
|
|
16
16
|
"types": "dist/types.d.ts",
|
|
17
17
|
"implementation": "dist/index.js",
|
|
18
|
-
"line":
|
|
18
|
+
"line": 1175
|
|
19
19
|
},
|
|
20
20
|
"agentControllerMessageText": {
|
|
21
21
|
"types": "dist/resources/agent-controller.d.ts",
|
|
22
22
|
"implementation": "dist/index.js",
|
|
23
|
-
"line":
|
|
23
|
+
"line": 7748
|
|
24
24
|
},
|
|
25
25
|
"createTool": {
|
|
26
26
|
"types": "dist/tools.d.ts",
|
|
27
27
|
"implementation": "dist/index.js",
|
|
28
|
-
"line":
|
|
28
|
+
"line": 9642
|
|
29
29
|
},
|
|
30
30
|
"isKnownAgentControllerEvent": {
|
|
31
31
|
"types": "dist/resources/agent-controller.d.ts",
|
|
32
32
|
"implementation": "dist/index.js",
|
|
33
|
-
"line":
|
|
33
|
+
"line": 7111
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"modules": {}
|
|
@@ -280,6 +280,8 @@ const controller = new AgentController({
|
|
|
280
280
|
})
|
|
281
281
|
```
|
|
282
282
|
|
|
283
|
+
Calls to tools the rules allow don't pause the run. On a regular `Agent`, tool calls in one step run concurrently when none of them needs approval or can suspend. Durable agents run them one at a time unless the session's `yolo` state is on.
|
|
284
|
+
|
|
283
285
|
Configure category policies with [`session.permissions.setForCategory()`](https://mastra.ai/reference/agent-controller/session) and tool policies with [`session.permissions.setForTool()`](https://mastra.ai/reference/agent-controller/session):
|
|
284
286
|
|
|
285
287
|
```typescript
|
|
@@ -331,6 +331,23 @@ The same version controls work when a supervisor calls sub-agents. Developers ca
|
|
|
331
331
|
|
|
332
332
|
See the [Editor versioning reference](https://mastra.ai/reference/editor/versioning) for version selection, sub-agent behavior, REST endpoints, and SDK methods.
|
|
333
333
|
|
|
334
|
+
## Visibility
|
|
335
|
+
|
|
336
|
+
With [`server.auth`](https://mastra.ai/docs/auth/overview) configured, every stored agent has an owner and a `visibility`. An agent created in Studio, through `POST /api/stored/agents`, or with the [built-in MCP server](https://mastra.ai/docs/server/mcp) is owned by the user who created it and is `private` unless they set `visibility: 'public'`. The owner is the caller's resource ID from `mapUserToResourceId`, or the user's `id` without it. Without `server.auth`, or when the caller has neither, stored agents have no owner, are `public`, and every caller can use them.
|
|
337
|
+
|
|
338
|
+
| Who | Can see and call a private agent | Can edit or delete it |
|
|
339
|
+
| -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------- |
|
|
340
|
+
| Owner | Yes | Yes |
|
|
341
|
+
| Users with `*`, `stored-agents:*`, or `stored-agents:admin` | Yes | Yes |
|
|
342
|
+
| Users granted that agent by id, for example `stored-agents:read:support-agent` or `stored-agents:edit:support-agent` | Yes, with a `read` grant. An `execute` grant only lets them call it | Yes, with an `edit` or `delete` grant |
|
|
343
|
+
| Everyone else | No | No |
|
|
344
|
+
|
|
345
|
+
The table covers ownership only. Each route still checks its own permission, such as `stored-agents:write` to edit or `agents:execute` to call, so an admin or id grant works only alongside the route permission. A grant by id only works when the agent is requested by its id. The agent still doesn't appear in their `GET /api/agents` or `GET /api/stored/agents` list.
|
|
346
|
+
|
|
347
|
+
A `public` agent can be seen and called by every user, but only the users in the table can edit or delete it. Agents saved before they had an owner stay visible to everyone, and any user with the route permission can edit or delete them. Code-defined agents aren't affected, including ones with Editor overrides.
|
|
348
|
+
|
|
349
|
+
The rules apply to every route that looks up an agent, not only `/api/stored/agents`. To another user, a private agent behaves like an agent that doesn't exist: `GET /api/agents` leaves it out, the agent, version, workspace, and schedule routes for it answer `404`, and the memory routes answer as they would for a missing agent. Changing its model at runtime with `POST /api/agents/:agentId/model` needs edit access. `POST /api/agents/:agentId/clone` makes the caller the owner of a private clone and ignores an `authorId` in the body.
|
|
350
|
+
|
|
334
351
|
## Programmatic access
|
|
335
352
|
|
|
336
353
|
Everything available in Studio is also available programmatically through [`mastra.getEditor()`](https://mastra.ai/reference/core/getEditor), the REST API, or the Client SDK. Use it to script bulk updates or seed stored configurations from code. It can also power automation that tunes agents based on [evaluation results](https://mastra.ai/docs/evals/experiments).
|
|
@@ -181,15 +181,15 @@ Groups matching records by one or more dimensions and aggregates each group. The
|
|
|
181
181
|
|
|
182
182
|
#### Arguments
|
|
183
183
|
|
|
184
|
-
| Field | Type | Required | Description
|
|
185
|
-
| ---------------- | ---------------------- | -------------------- |
|
|
186
|
-
| `name` | `string[]` | Yes | One or more metric names
|
|
187
|
-
| `groupBy` | `string[]` | Yes | One or more fields to group by
|
|
188
|
-
| `aggregation` | `AggregationType` | Yes | Aggregation for each group
|
|
189
|
-
| `distinctColumn` | `MetricDistinctColumn` | For `count_distinct` | Column whose distinct values are counted
|
|
190
|
-
| `filters` | `MetricsFilter` | No | Shared metric filters
|
|
191
|
-
| `limit` | `number` | No | Positive integer up to 1,000.
|
|
192
|
-
| `orderDirection` | `'ASC' \| 'DESC'` | No | Sort direction for the aggregated value. Storage implementations default to `DESC`.
|
|
184
|
+
| Field | Type | Required | Description |
|
|
185
|
+
| ---------------- | ---------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
186
|
+
| `name` | `string[]` | Yes | One or more metric names |
|
|
187
|
+
| `groupBy` | `string[]` | Yes | One or more fields to group by |
|
|
188
|
+
| `aggregation` | `AggregationType` | Yes | Aggregation for each group |
|
|
189
|
+
| `distinctColumn` | `MetricDistinctColumn` | For `count_distinct` | Column whose distinct values are counted |
|
|
190
|
+
| `filters` | `MetricsFilter` | No | Shared metric filters |
|
|
191
|
+
| `limit` | `number` | No | Positive integer up to 1,000. Keeps only the top groups after sorting by `orderDirection`. When omitted, all groups are returned. Set it for high-cardinality groupings such as `threadId` to bound the response. When grouping by a label key, some stores, such as PostgreSQL, exclude rows where the label is missing or empty, so the groups might not add up to the overall total even without a `limit`. Use `getMetricAggregate()` for that total. |
|
|
192
|
+
| `orderDirection` | `'ASC' \| 'DESC'` | No | Sort direction for the aggregated value. Storage implementations default to `DESC`. |
|
|
193
193
|
|
|
194
194
|
#### Returns
|
|
195
195
|
|
package/dist/index.cjs
CHANGED
|
@@ -183,6 +183,10 @@ var ObservabilityCollectorImpl = class {
|
|
|
183
183
|
flush() {
|
|
184
184
|
if (this.#flushed) return {};
|
|
185
185
|
this.#flushed = true;
|
|
186
|
+
if (this.#spans.some((span) => span.endTimeNs < span.startTimeNs) || this.#executionStartMs !== void 0 && this.#executionEndMs !== void 0 && this.#executionEndMs < this.#executionStartMs) {
|
|
187
|
+
console.warn("Client observability timing ends before it starts; dropping telemetry.");
|
|
188
|
+
return {};
|
|
189
|
+
}
|
|
186
190
|
const payload = {};
|
|
187
191
|
if (this.#executionStartMs !== void 0 && this.#executionEndMs !== void 0) payload.executionDurationMs = this.#executionEndMs - this.#executionStartMs;
|
|
188
192
|
if (this.#spans.length > 0) payload.spans = { resourceSpans: [{ scopeSpans: [{
|