0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
Commit graph

22 commits

Author SHA1 Message Date
Eric Pinzur
b2e0e40b57
feat(cli): align score and feedback API commands (#30089)
Closes [OBS-794](https://linear.app/kepler-crm/issue/OBS-794).

Adds `feedback create`, `list`, `get`, `replace`, and `review-status`,
plus `aggregate`, `breakdown`, `timeseries`, and `percentiles` for both
scores and feedback. Creates generate missing IDs and timestamps once
and preserve them across bounded HTTP retries and credential fallback.
Replacements require the original identity and timestamp; review-status
updates preserve missing-record errors. Context-mode omission and
feedback author fields are passed through without inferring values.

List output preserves pagination and delta cursors, and write output
retains the server's success and identity data. Score/feedback schemas
are generated from the server routes and bundled for `--schema` without
requiring a target schema endpoint. Most of the diff is that generated
file. Includes help examples, CLI reference docs, and a minor `mastra`
changeset.

Validation: 221 CLI API tests, including 57 real-HTTP cases; 20 repeated
timeout/credential-fallback runs; CLI typecheck; type-aware
lint/precommit checks; docs check with Vale and the CI Vale
configuration. Validated all 14 write/analytics help examples against
the current server body schemas. Missing-anchor retries, transient
failures, credential fallback, older success-only responses, unsupported
endpoints, and API-prefix/auth headers are covered.

The full `turbo build --filter mastra` stopped in the unchanged
`@mastra/playground-ui` declaration step (`tsc found type errors`, with
no underlying diagnostic emitted) before building the CLI. Local checks
used Node 23.11.0, which is outside the repository's requested engine
range. Live Platform writes and package publication/deployment were not
tested.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## ELI5

This PR adds commands to create, review, list, and analyze scores and
feedback. It also makes retries safer by preserving the same IDs,
timestamps, and request data.

## Changes

- Added feedback `create`, `list`, `get`, `replace`, and `review-status`
commands.
- Added `aggregate`, `breakdown`, `timeseries`, and `percentiles` for
scores and feedback.
- Added validation for write inputs and feedback replacement identity.
- Added bounded retries for transient failures and credential fallback.
- Preserved pagination cursors, response identity data, and feedback
fields.
- Bundled generated score and feedback schemas for offline `--schema`
output.
- Added unsupported-endpoint errors for HTTP 405 and 501 responses.
- Updated documentation, help examples, and the `mastra` changeset.
- Added HTTP-backed tests for commands, validation, retries, responses,
and schemas.

## Validation

- The author reports 221 CLI API tests, including 57 real-HTTP cases.
- The author reports passing typecheck, lint, precommit, Vale, and
documentation checks.
- The build stopped in the unchanged `@mastra/playground-ui` declaration
step before the CLI build.
- Local checks used Node 23.11.0, outside the repository’s requested
engine range.
- Live Platform writes and package publication or deployment were not
tested.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 19:53:52 +01:00
Tyler Barnes
ba602f5f46
feat(server): read-only Knowledge routes and client methods so Studio can browse a Knowledge instance (#29069)
Replaces #28363, which the triage bot closed.

> Stacked on #28362 (core Knowledge page readers), which is stacked on
#28361 (shared Knowledge explorer UI), on the Knowledge alpha branch
(#28353). Experimental: depends on the alpha's schema-4 page store.

## What this adds

**Read-only Knowledge routes in `@mastra/server`**, opt-in via
`KNOWLEDGE_ROUTES`:

| Route | Returns |
| - | - |
| `GET /knowledge` | Instances the caller can read |
| `GET /knowledge/:key/tree` | Root scopes, or child scopes and pages
under `parentId` (paged) |
| `GET /knowledge/:key/pages/:pageId` | Page with ancestors, notes, pin,
referenced pages, mentioned-by |
| `GET /knowledge/:key/graph` | Bounded page graph with parent and
mention edges |
| `GET /knowledge/:key/search` | Pages and notes matching a query |
| `GET /knowledge/:key/activity` | Recent changes, optionally per scope
or page |

Matching `listKnowledge()` / `getKnowledge(key)` methods in
`@mastra/client-js`.

**A Knowledge page in Studio**: page tree beside the graph with synced
selection, a detail pane for the selected page, search, and a Tree/Graph
toggle below 1024px. When the routes aren't registered the page explains
how to enable them.

## Access model

What a caller reads depends on whether the app configures auth
(`server.auth` or `studio.auth`).

- **No auth** (a local or test project): the routes read the whole
instance (`read: 'all'`).
- **Auth:** the routes read only what the signed-in caller can read. The
app maps the user to Knowledge principals in `authorize` by setting the
reserved request-context key `MASTRA_KNOWLEDGE_PRINCIPALS_KEY` (or
`'all'` for an admin). The instance resolves them with `readScopeFor`,
and every reader gets the resulting read scope. A caller with no mapping
gets 403. A malformed mapping, or a principal that matches no declared
scope type, returns 500 because it's a host configuration error.

On top of that: `knowledge:read`, and with FGA, per-instance checks
keyed by the registered Knowledge key (`GET /knowledge` filtered, other
routes 403 for other instances).

## Known limits

- `GET /knowledge` has no route FGA metadata, like every other list
route (`GET /agents`, `/workflows`, `/tools`), so
`requireForProtectedRoutes` refuses it and `auditProtectedRoutes` lists
it; the handler still filters instances per caller.

This replaces the earlier caller-supplied scope tags and
`MASTRA_KNOWLEDGE_SCOPE_KEY` binding. The `authorize` context change
from that work stays (adapters now expose `requestContext` to
`authorize`, and Elysia keeps repeated query values).

## Tests

- Server suite 3,098 passed; permission generator check passes.
- Shared adapter suite (`knowledge-routes`) on Hono, Express, Fastify,
Koa, Elysia: 200 with `knowledge:read`, 403 without, 401 with no token,
repeated `scopeId` honoured.
- Studio page MSW tests 10/10; 7 of them fail against the previous
scope-form page.
- Playground and server `tsc` clean; oxlint clean.




<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## ELI5

This PR lets Studio browse Knowledge data without changing it. It adds
optional server routes, matching client methods, and a Studio page to
view and search that data.

## What changed

- Added opt-in, read-only Knowledge routes for listing instances,
browsing trees and pages, viewing graphs, searching, reading activity,
and receiving change events. These routes are not mounted by default.
- Added `MastraClient.listKnowledge()` and
`MastraClient.getKnowledge(key)`, plus Knowledge methods for read
requests and event streams.
- Added a Studio Knowledge page with instance selection, tree and graph
views, page details, search, and live updates. Polling is the fallback
when streaming is unavailable.
- Added `knowledge:read` permission handling and auth-based access
controls. When auth is configured, the host must map callers to
Knowledge principals.
- Updated route tooling to include opt-in routes. Updated the Elysia
adapter to preserve repeated query parameters and authorization context
handling so `authorize` can access `requestContext` and `mastra`.
- Added documentation, changesets, and tests for Knowledge routes,
client methods, Studio behavior, and server adapters.

## Tests

The PR description reports 3,098 server tests and 10/10 Studio MSW tests
passing. It also reports that the permission-generator check, Playground
and server TypeScript checks, and oxlint completed cleanly.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
Co-authored-by: avis-reader[bot] <332681745+avis-reader[bot]@users.noreply.github.com>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-10-30 23:38:07 -07:00
Eric Pinzur
fc9679466b
feat(observability): add full queryThreads() support (#27652)
## Description

Adds full thread rows to `queryThreads()` across ClickHouse, PostgreSQL
and DuckDB, with server, client and CLI support. Rows include first/last
trace IDs, context, activity timestamps, trace count, previews, TTFC and
root-agent model/provider. Time windows qualify threads without cutting
off their retained history.

```ts
await client.queryTraceThreads({
  timeRange: { traces: { from, to } },
  orderBy: [{ field: 'endedAt', direction: 'desc' }],
  page: { limit: 100 },
});
```

The new contract supports direct scalar filters and either a trace-start
window or a thread first/last-activity window. It changes the default
client result type; legacy identity requests remain supported for mixed
package versions. Unsupported row requests return a structured `501`,
with support exposed through `capabilities.threadQueryRows`.

Selection uses a bounded candidate-size probe, expands retained history,
and fetches display fields after pagination. Broad queries use a guarded
fallback. Malformed multi-root traces select the earliest-started root,
breaking ties by spanId. ClickHouse prefers completed copies of that
root, including zero-duration completions whose pending copy has no
thread ID. Existing trace-query behavior is unchanged.

Validation: all 17 shared thread cases now run with automatic, candidate
and full-history selection on each database: 153 real-database
conformance executions. The ClickHouse fixture keeps merges stopped, and
a separate regression verifies 40 pending/completed root pairs over 40
reads. Focused files pass: ClickHouse 80 plus one existing intentional
skip, PostgreSQL 77, DuckDB 72. Broader observability suites, store
typechecks, client runtime/type tests, docs and lint were also checked.
Documentation and separate minor changesets are included.

Thread conformance runs inside the existing per-store test suites, using
the existing Combined Store Tests workflow. No separate thread-test
workflow is added. The storage skip on regular PRs follows the existing
Prebuild scheduling policy, independently of the two failing checks.
Moving the client type test out of the library build fixed Changed Test
Gate; rebasing onto the upstream Playground fixes resolved Validate
build outputs. Both checks passed after rebase.

Larger synthetic ClickHouse testing exposed a real fallback limit. The
fixture contains 16.25M roots across six tenant sizes, retained over 90
days, with UUID-sized IDs and fragmented parts. At 500K scoped roots,
repeated runs could exceed the 512-MiB cap. The fallback now rejects
scopes above **250K physical root rows** before sorting/grouping
history, using the existing resource-limit error. Narrow candidate
queries remain available on larger histories. Queries never return
truncated history to meet a budget.

At 250K, nine 28-day requests passed at about 385 MiB and 4.8–5.8 s; six
90-day cases passed at about 392 MiB and 5.3–6.8 s. Broad 500K/10M cases
reject early at about 117 MiB. Six-hour candidate windows on the
10M-root tenant return complete 1,000-row pages at 126–154 MiB: the
first request took 14.1 s, subsequent requests about 5.5–6.7 s.

This is a conservative guard, not a production capacity guarantee. The
isolated disk-backed Docker server has 2 CPUs and 3 GiB; stored previews
are populated and model rows are absent. Production concurrency and
legacy-payload costs remain unvalidated at this scale, and the first
large-tenant request approaches the 15-second deadline. PostgreSQL and
DuckDB retain their earlier 100K-root benchmark results.

## Related issue(s)

Fixes [OBS-683](https://linear.app/kepler-crm/issue/OBS-683).

## Type of change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
- [x] Code refactoring
- [x] Performance improvement
- [x] Test update

## Checklist

- [x] I have linked the related issue(s) in the description above
- [x] I have made corresponding changes to the documentation (if
applicable)
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have addressed all Coderabbit comments on this PR


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5

This change lets applications ask for useful summaries of threads, not
just thread IDs. It finds threads that match a time window, then returns
details from their full stored history.

## Summary

- Adds thread-row query planning, validation, filtering, ordering,
cursor pagination, and response types in core.
- Adds full-history thread-row queries for ClickHouse, PostgreSQL, and
DuckDB. The queries aggregate trace counts, activity times, first and
last trace IDs, previews, context, TTFC, and root-agent model/provider
details.
- Adds bounded candidate selection with a full-history fallback for
broad queries.
- Extends the server endpoint and capability reporting. The server
returns a structured `501` when the core or storage adapter does not
support row queries.
- Updates the client to infer the row response type for new requests
while retaining the legacy identity response type for legacy requests.
- Adds shared storage conformance tests, server compatibility tests,
client type tests, and API documentation.

The supplied PR description reports passing database, server, client,
CLI, type, lint, and mixed-version checks. These results were not
independently verified here.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-19 18:56:56 +02:00
Daniel Lew
80fa23cd36
feat(server): add POST /observability/traces/aggregate route (#25501)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-09-29 17:10:42 -04:00
Ward Peeters
ab0632ca5e
refactor: derive client API types from generated routes (#23961)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-09-16 22:59:10 +02:00
Ward Peeters
c975ebdb0b
fix: validate core imports against peer dependency floors (#22564)
Co-authored-by: Mastra Code (openai/gpt-5.6-sol) <noreply@mastra.ai>
2026-09-01 17:32:58 +02:00
Ward Peeters
d50fe06cbf
chore: upgrade monorepo to TypeScript 7 (#22459)
Co-authored-by: Mastra Code (openai/gpt-5.6-sol) <noreply@mastra.ai>
2026-08-28 23:55:51 +02:00
Tony Kovanen
5faf93f03e
Declarative, persistable workflow graphs: engine support, storage domain, and HTTP/client APIs (#20471)
Co-authored-by: Mastra Code (anthropic/claude-fable-5) <noreply@mastra.ai>
Co-authored-by: NikAiyer <nick.aiyer@gmail.com>
2026-07-31 17:18:31 +02:00
Ward Peeters
3a507cbd42
chore: migrate repository formatting to oxfmt (#19807)
Co-authored-by: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
2026-07-24 16:18:33 +02:00
Aaditya sah
39c6753788
fix(client-js): remove any types and optimize route-types generation (#19573)
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com>
Co-authored-by: Mastra Code (anthropic/claude-fable-5) <noreply@mastra.ai>
Co-authored-by: Roamin <97863888+roaminro@users.noreply.github.com>
2026-07-17 10:34:09 +02:00
Ward Peeters
985b274dc7
fix(server): handle unpublished core versions in import check (#18531)
Co-authored-by: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
2026-06-26 18:00:15 +02:00
Abhi Aiyer
22d8f5600d
Make AgentController the canonical API surface and remove the legacy Harness surface (#18510)
Co-authored-by: Mastra Code (anthropic/claude-opus-4-8) <noreply@mastra.ai>
2026-06-26 15:06:14 +02:00
Abhi Aiyer
507a5c461b
Introduce AgentController as the canonical hosted-controller API (Harness rename, non-breaking) (#18505)
Co-authored-by: Mastra Code (anthropic/claude-opus-4-8) <noreply@mastra.ai>
2026-06-26 11:06:20 +02:00
Abhi Aiyer
0be490fabb
feat(server): expose Harness sessions over HTTP (#18358)
## Summary

Adds `harness`-scoped HTTP routes to `@mastra/server` so a
Mastra-registered Harness can be driven over HTTP. Each route resolves
the target Harness via `mastra.getHarness(id)` and operates on the
session returned by `harness.createSession({ resourceId })`
(get-or-create by `resourceId`).

The route surface covers the full session interaction model:

- **Sessions**: list harnesses, create/get session, read session state,
set session state, set/get resource id(s)
- **Streaming**: subscribe to the session event stream over **SSE**
- **Run control**: send message, steer, abort, follow up
- **Tool gating**: approve/decline tool calls, respond to tool
suspensions
- **Mode/model**: switch mode, switch model, list modes, list available
models
- **Threads**: create, rename, clone, delete, switch, list, list
messages
- **Other**: send notification signal, get workspace status, get OM
record, goal get/set/update/clear, permissions get/set (category/tool)

A `harness` permission resource is added (`harness:read`,
`harness:execute`); the generated permissions file is regenerated
accordingly.

## Stacking

This PR is **stacked on #18355** (`feat/register-harness-on-mastra`),
which provides `mastra.getHarness()` registration and storage
inheritance. Review/merge #18355 first. This PR contains **only** the
`packages/server` route layer — no client SDK or web UI (those follow as
separate stacked PRs).

## Test plan

- `packages/server` build: clean (tsup type-emit passes)
- `pnpm --filter ./packages/server test`: 1801 passed / 4 skipped / 1
todo
- `src/server/handlers/harness.test.ts`: 13/13 passing (create session
-> send message -> SSE round-trip, mode switch, state snapshot,
modes/threads listing, notification)
- `check:core-imports`: 22/22 paths, 61 value imports compatible
- `generate:permissions` + `check:permissions`: 32 resources, 82
combinations, generator matches routes

🤖 Generated with Mastra Code


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
This PR adds HTTP endpoints so you can control Mastra Harnesses from a
web API: start or resume a session, send messages, and watch live
updates. It also adds the missing permissions and safeguards so session
“threads” from one harness/resource can’t be accessed from another.

---

## Overview
Adds a new HTTP route layer in `@mastra/server` for driving
Mastra-registered Harness instances. Routes resolve the Harness via
`mastra.getHarness(id)` and manage sessions using a get-or-create
pattern keyed by `resourceId`, implementing the full session interaction
model (including real-time SSE event streaming and run/thread control).

---

## Client SDK updates (`client-sdks/client-js`)
- `MastraClient.listHarnesses()` and
`MastraClient.getHarness(harnessId)` for discovery and harness scoping.
- New/expanded `harness` resource API:
- `HarnessSession` for session lifecycle (create/resume by
`resourceId`), messaging, steering/abort, tool approval/decline
(including tool-call-id disambiguation), tool suspension resume,
mode/model/thread operations, follow-ups, state read/mutate, and SSE
subscription to session events.
- `Harness` for listing modes/models, workspace status, and creating
session-scoped sessions.
- Re-exports of harness-related helpers and types (including
`harnessMessageText`).
- Added a dedicated test suite validating request/response wiring and
SSE behavior (including frame-splitting scenarios).

---

## Server route handlers (`packages/server`)
Introduces `harness`-scoped HTTP handlers and registers them into the
server route registry:
- Harness/session management: list harnesses, create/get sessions,
read/set session state, manage `resourceId`s.
- Streaming: subscribe to session events over SSE (with heartbeat
handling and disconnect/cleanup).
- Run control: send messages, steer execution, abort, handle follow-ups.
- Tool gating: approve/decline tool calls and respond to tool suspension
resume requests.
- Mode/model switching and introspection: switch active mode/model, list
available modes/models.
- Thread management: create/delete/rename/clone/switch threads and list
thread messages (with limiting/order support).
- Additional features: send notification signals, workspace status, OM
record retrieval, goal management, and permission-related endpoints.

Notable behavior changes called out in the release docs:
- Tool-approval route now forwards `toolCallId` to avoid stale/delayed
approvals resolving the wrong gate.
- The “list models” route no longer returns API key environment variable
names.

---

## Permissions (`packages/core` + server generator)
- Adds a new permission resource type `harness` with scopes:
  - `harness:read`
  - `harness:execute`
- Regenerates the permissions file and updates permission-description
generation to include the new `harness` resource.

---

## Thread ownership / isolation (security hardening)
- Enforces per-`resourceId` thread ownership for thread operations
(switch/delete/list messages/clone).
- If a thread belongs to a different `resourceId`, operations fail as if
the thread doesn’t exist (`Thread not found: <threadId>`), including
correct lock recovery on failed switches.
- Covered by both server handler tests and core session isolation tests.

---

## Testing
- Server package: 1801 passed, 4 skipped, 1 todo.
- Dedicated handler tests: 13/13 passing (get-or-create sessions,
messaging, SSE streaming, mode switching/state hydration, thread listing
with limiting/order, and cross-resource thread isolation).
- Permissions validation: generator compatibility confirmed (32
resources, 82 combinations).
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Mastra Code (anthropic/claude-opus-4-8) <noreply@mastra.ai>
2026-06-23 16:34:00 +02:00
NikAiyer
5ba7253745
feat(server): permission foundation — array permissions, request-context keys, stored resource families (#16605)
## Summary

Foundational pieces needed for richer RBAC permission checks in
`@mastra/server`. This is the unblocker for STACK-2 (stored-entity
handlers), STACK-3 (favorites API), STACK-4 (auth UI) and several
parallel feature tracks that share this surface.

Split out of the larger feature branch (`yj/magnificent-marquess`).
Self-contained — no dependency on other open PRs.

## What's in scope

### Array permissions on routes (FGA + classic RBAC)

- `requiresPermission` on `ApiRoute` / `ServerRoute` / `RouteConfig`
accepts a single permission **or** an array. When an array is provided,
the user needs **ANY ONE** of the listed permissions (logical OR).
- `MastraServer.checkPermissions` rewritten to normalize both shapes.
Error message reads `Missing required permission: a or b or c`.
- `@mastra/core/auth/ee` FGA interface widened:
`FGACheckParams.permission`, `FGARouteConfig.permission`,
`FGARouteInfo.requiresPermission`, and `FGADeniedError.permission` all
accept `MastraFGAPermissionInput | MastraFGAPermissionInput[]`.
- `@mastra/auth-workos` `MastraFGAWorkos.check()` / `require()` iterate
arrays with short-circuit ANY-of semantics.
- Useful for routes that serve multiple resource types (e.g. a streaming
endpoint usable by both runtime and stored agents).

### Request-context keys

- New `MASTRA_USER_KEY` (`mastra__user`), `MASTRA_USER_PERMISSIONS_KEY`
(`mastra__userPermissions`), `MASTRA_USER_ROLES_KEY`
(`mastra__userRoles`) constants in `@mastra/server`. Downstream handlers
can read user/permission/role state via named keys instead of string
literals, and the new namespaced keys avoid collisions with
caller-supplied context entries.
- `coreAuthMiddleware` writes those namespaced keys and accepts a
`requiresAuth` flag from the caller so routes can opt out of auth
cleanly.
- The 4 server adapters (`express`, `fastify`, `hono`, `koa`) read the
renamed `mastra__userPermissions` key instead of `userPermissions`.

### Permission derivation for stored resources

- `getEffectivePermission` widens its return type from `string | null`
to `string | string[] | null` (a single route can require any-of
multiple permissions).
- Adds `STORED_RESOURCE_FAMILIES` (agents, skills, prompt-blocks,
mcp-clients, scorers, workspaces).
- Adds `PUBLISH_PATTERNS` so `/publish`, `/activate`, `/restore` action
suffixes resolve to the right permission action.

### Role permissions introspection route

- New `GET /api/auth/roles/:roleId/permissions` returns the configured
permission list for a role. Admin-only via the existing `auth:admin`
guard, available to any tooling that needs to surface "what can role X
do" (current consumer: agent-builder role impersonation UI on the
feature branch).

### Tooling

- `generate-route-types` now strips the `[x: string]: never` index
signatures that zod-to-ts emits for `.strict()` schemas, so generated
route param/body types are usable as plain TS types.

## Test plan

- `pnpm --filter=@mastra/core check` — clean (`tsc --noEmit`).
- `pnpm --filter=@mastra/server build:lib` — clean.
- `pnpm --filter=@mastra/server test` — **1309 tests pass** across 58
files (covers new `permissions.test.ts`, updated `auth/helpers.test.ts`,
and the role permissions handler).
- `pnpm --filter=@mastra/auth-workos test` — **53/53 FGA tests pass**.

## Peer deps

- `@mastra/server` bumps its `@mastra/core` peer dep floor to
`>=1.35.0-0` (consumes the widened FGA types and `MASTRA_USER_*`
constants).
- `@mastra/auth-workos` and the 4 server adapters do NOT bump their core
peer dep — they're functionally backward-compatible (no new core API
touched at runtime; the array path is guarded by `Array.isArray`).

## Out of scope (still on feature branch)

- `validateAgentBuilderLicense()` in `server-adapter/index.ts` — calls
`mastra.getEditor()` (editor namespace). Ships with the editor PR.
- `RESERVED_CONTEXT_KEYS` `Set` declaration — declared but never read on
the feature branch; will land in a future PR that actually uses it.
- `EDITOR_BUILDER_ROUTES` import in `routes/index.ts` — ships with
STACK-2.
- `ASSERTION_ONLY_PERMISSIONS`, `COMPOUND_PATTERNS`, additional
stored-resource descriptions, and `publish`/`share` action descriptions
in `permission-generator.ts` — ship with STACK-2 alongside their first
consumers.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5

This PR adds better permission checking for the `@mastra/server`
authentication system. Instead of checking just one permission at a
time, routes can now require ANY of multiple permissions (like "can read
OR can execute"). It also introduces standardized names for where auth
data gets stored in requests, adds a new endpoint to look up what
permissions a role has, and fixes some code generation tooling.

---

## Overview

Foundational permission system enhancements for `@mastra/server`
RBAC/FGA:

- **Array permissions**: `requiresPermission` on routes now accepts a
single permission string OR an array of permissions. When an array is
provided, access is granted if the user has ANY one of the listed
permissions (logical OR). Error messages format as "Missing required
permission: a or b or c".

- **Request-context key namespacing**: Introduces exported constants
`MASTRA_USER_KEY` (`mastra__user`), `MASTRA_USER_PERMISSIONS_KEY`
(`mastra__userPermissions`), and `MASTRA_USER_ROLES_KEY`
(`mastra__userRoles`). Core auth middleware writes these namespaced keys
while maintaining backward-compatible legacy keys. All adapters
(Express, Fastify, Hono, Koa) updated to read from namespaced keys.

- **Stored resource permission derivation**: Expands permission
extraction to recognize stored resource families (`stored-agents`,
`stored-skills`, `stored-prompt-blocks`, `stored-mcp-clients`,
`stored-scorers`, `stored-workspaces`) and POST action patterns
(`/publish`, `/activate`, `/restore`). `getEffectivePermission()` now
returns `string | string[] | null` to support multiple-permission
mappings.

- **Stored resource RBAC support**: `@mastra/auth-workos` FGA provider
`check()` and `require()` methods updated with array permission support
using ANY-of semantics with short-circuit evaluation.

- **New role permissions endpoint**: `GET
/api/auth/roles/:roleId/permissions` (guarded by `auth:admin`) returns
resolved permission list for a given role.

- **Tooling improvements**: `generate-route-types` now strips zod-to-ts
`[x: string]: never` index signatures from generated types, making them
usable.

- **Auth middleware flexibility**: `coreAuthMiddleware` now accepts
optional `requiresAuth` flag to force authentication context population
even for public routes.

## Changes Summary

| Component | Changes |
|-----------|---------|
| **Core FGA types** | `FGACheckParams.permission`,
`FGARouteConfig.permission`, `FGARouteInfo.requiresPermission`, and
`FGADeniedError.permission` now support `MastraFGAPermissionInput[]` |
| **Route builders** | `ApiRoute`, `ServerRoute`, and `RouteConfig`
updated to accept permission arrays |
| **Auth handlers** | New `GET_ROLE_PERMISSIONS_ROUTE` endpoint added;
auth middleware supports `requiresAuth` flag |
| **Server adapter** | Route permission checks support ANY-of array
semantics; permission derivation flattens arrays |
| **Stored resources** | Permission extraction now handles 6 stored
resource families; POST routes support `/publish`, `/activate`,
`/restore` action patterns |
| **FGA provider** | `@mastra/auth-workos` implements array permission
iteration with short-circuit ANY-of semantics |
| **Request context** | Three new namespaced constants introduced; all
adapters refactored to use them |
| **Tooling** | Route type generator strips invalid Zod-to-TS
signatures; permission/route metadata generators handle array
permissions |
| **Tests** | All adapter middleware tests updated; new test coverage
for stored resources and role permissions endpoint; 1309+ server tests
passing |

## Test Coverage

- `@mastra/server`: 1309 passing tests across 58 files (includes
new/updated tests for permissions, stored resources, role endpoint)
- `@mastra/auth-workos`: 53/53 FGA tests pass
- All adapter auth middleware tests updated and passing
- New test suite for `/auth/roles/:roleId/permissions` endpoint covering
admin access, RBAC support, error cases

## Peer Dependencies

Original PR bumped `@mastra/core` peer-dep floor to `>=1.35.0-0` but was
reverted in follow-up commit after confirming runtime compatibility with
`>=1.32.0-0`. All packages restored to `>=1.32.0-0` floor; type-only
changes did not warrant version bump.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/mastra-ai/mastra/pull/16605?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Mastra Code (anthropic/claude-opus-4-7) <noreply@mastra.ai>
2026-05-18 13:20:41 -05:00
Grayson Hicks
f73980d651
Add FGA route policy coverage controls (#16651)
## Description

This PR makes Mastra's FGA path safer and easier to extend for hosted
server routes. ELI5: if auth says "this route is protected," FGA should
either know what resource/permission to check or clearly fail/warn
instead of silently letting the request through.

Before this change, configuring `server.fga` did not guarantee protected
resource routes were FGA-protected because `checkRouteFGA` only ran when
each route had explicit `route.fga` metadata. This adds provider-level
policy coverage controls (`requireForProtectedRoutes`,
`auditProtectedRoutes`, `resolveRouteFGA`, and `validatePermissions`),
built-in FGA metadata resolution for Mastra resource routes, and startup
validation for emitted permissions.

Example: a protected `POST /workflows/:workflowId/start` route can now
derive `{ resource: { type: 'workflow', id: workflowId }, permission:
'workflows:execute' }` without each adapter route manually mutating
metadata. Built-in coverage also applies to agents, workflows, tools,
MCP tools, memory threads, responses, and conversations, while custom
providers can still override route mapping globally with
`resolveRouteFGA`.

The built-in resolver is now the source of truth for those resource
routes, so redundant per-route `fga` blocks were removed from the server
handlers while keeping special tool resource IDs for agent-scoped and
MCP tools.

Follow-up review fixes also align direct execution FGA checks with the
same resource scope used at runtime, guard agent resume paths
(`resumeStream` / `resumeGenerate`), and preserve stored resource
metadata on partial updates when `metadata` is omitted.

This also hardens the WorkOS provider boundary: when WorkOS reports an
FGA resource is missing (`entity_not_found`/404), `check()` now returns
denial and `require()` throws `FGADeniedError` instead of leaking a
provider-specific error that can become a 500. The docs and focused
tests were updated to cover the new route policy behavior and WorkOS
denial semantics.

## Related Issue(s)

N/A

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
- [ ] Code refactoring
- [ ] Performance improvement
- [x] Test update

## Checklist

- [x] I have made corresponding changes to the documentation (if
applicable)
- [x] I have added tests that prove my fix is effective or that my
feature works


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
ELI5: This PR makes the server automatically check fine‑grained
permissions for common protected routes so actions are blocked unless
explicitly allowed, treats missing users or missing FGA resources as
denials (not server errors), and exposes provider-level switches so
operators can require/audit/resolve route FGA behavior.

Summary:
- Provider-level FGA controls
- Added server provider options: requireForProtectedRoutes,
auditProtectedRoutes, resolveRouteFGA, validatePermissions.
- Built-in route-to-FGA resolution
- New resolver getBuiltInRouteFGAConfig maps common routes (agents,
workflows, tools, MCP tools, stored resources, memory threads,
responses/conversations) to resource+permission pairs so protected
routes can be checked without per-route fga blocks.
- server-adapter now uses the built-in resolver at request time and for
startup coverage validation; redundant per-route fga blocks removed
while preserving agent-scoped and MCP tool resource IDs.
- FGA enforcement refactor & fail-closed semantics
- Introduced requireFGA(options)
(packages/core/src/auth/ee/fga-check.ts); checkFGA delegates to it.
requireFGA accepts requestContext + metadata and fail-closes (throws
FGADeniedError) when an FGA provider exists but no authenticated user.
  - FGADeniedError gains an optional reason for standardized messages.
- Provider boundary hardening
- WorkOS provider: when WorkOS reports missing FGA resources
(entity_not_found / 404), checks produce denials (check() returns
denial; require() throws FGADeniedError) instead of provider-specific
500s.
- Integrations updated to use richer context/metadata
- Agents, workflows, CoreToolBuilder/tools, memory threads updated to
call requireFGA with merged context/metadata (agentId, workflowId,
runId, threadId, executionResourceId, resourceId, etc.), aligning direct
execution and resume paths with runtime resource scopes.
- Stored-resource scoping
- Added StoredResourceScopeConfig and StoredResourcesConfig to
ServerConfig (packages/core/src/server/types.ts).
- New utilities: getStoredResourceScope, scopeStoredResourceMetadata,
assertStoredResourceScope (packages/server/src/server/utils.ts).
- Many stored-* route handlers and version endpoints (agents,
mcp-clients, prompt-blocks, scorers, skills, workspaces, etc.) now
thread requestContext, derive scope, scope persisted metadata, and
assert scope on reads/updates/deletes.
- Tests updated to cover stored-route FGA/metadata resolution and
scoping behavior; server-adapter tests added for built-in stored route
derivation.
- Permissions generation and generated permissions
- Permission generator recognizes publish, includes share in ACTIONS,
and expands stored:* families and compound permission patterns
(packages/server/scripts/permission-generator.ts).
- Generated permissions updated: removed agent-builder, auth, and
infrastructure families; reorganized stored-...:share patterns and
adjusted PERMISSIONS/Permission unions
(packages/core/src/auth/ee/interfaces/permissions.generated.ts).
- Tests, docs, and release notes
- Added/updated tests for built-in route FGA derivation, fail-closed
semantics (agents, tools, workflows, memory), permission derivation, and
stored-resource scoping.
- Documentation expanded for FGA setup, stored-resource scoping,
enforcement points, and examples
(docs/src/content/en/docs/server/auth/fga.mdx).
- Misc
- Preserved stored resource metadata on partial updates
(merge-incoming-with-existing), avoided duplicate fetches by reusing
resolved stored objects for checks, updated changesets, and minor
export/comment refactors.

Labels: bug fix, new feature, documentation update, test update.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/mastra-ai/mastra/pull/16651)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-18 12:47:16 -05:00
Lennart
0461546755
feat(cli): Add api subcommand (#16128) 2026-05-07 09:49:55 +09:00
Ward Peeters
0011a7e2bb
fix(ci): validate core peer compatibility (#16208)
## Summary

This PR adds CI coverage for the peer-dependency compatibility issue
where a package can compile against the workspace `@mastra/core`, but
publish a peer range that allows older `@mastra/core` versions missing
the runtime exports it imports.

It adds two guardrails:

1. **`@mastra/server` core import check**
   - Adds `packages/server/scripts/check-core-imports.ts`.
- Scans runtime named imports from `@mastra/core/*` in
`packages/server/src`.
- Resolves the `@mastra/core` peer dependency floor from
`packages/server/package.json`.
- Downloads that floor version via `npm pack` and checks the imported
runtime symbols against its `.d.ts` surface using `ts.createProgram()`.
- Fails with TypeScript diagnostics when server imports symbols that are
unavailable at the declared peer floor.

2. **Transitive peer dependency validation**
- Extends `scripts/validate-peerdeps.mjs` so packages that depend on
other Mastra packages cannot advertise a broader `@mastra/core` peer
range than their runtime Mastra dependencies require.
- This catches install graphs like `mastra` → `@mastra/deployer` →
`@mastra/server` where the top-level package would otherwise allow an
incompatible older `@mastra/core`.

The PR also aligns affected package peer ranges to `>=1.13.2-0 <2.0.0-0`
and adds a changeset for the published packages whose peer ranges
changed.

## Changed files of note

- `.github/workflows/lint.yml` — runs the server core import check in
`peerdeps-check`.
- `packages/server/scripts/check-core-imports.ts` — new import
compatibility check.
- `scripts/validate-peerdeps.mjs` — adds transitive `@mastra/core` peer
range validation.
- `packages/server/package.json` — adds `check:core-imports` script.
- `.changeset/giant-owls-rule.md` — patch changeset for peer range
updates.

## Validation

Ran locally:

- `pnpm --filter ./packages/server lint`
- `node ./scripts/validate-peerdeps.mjs`
- `pnpm --filter ./packages/server check:core-imports`

Note: `check:core-imports` currently reports the server/runtime import
incompatibilities against the declared `@mastra/core` peer floor. That
is the issue this guardrail is intended to surface in CI instead of
letting it reach users as an install/runtime mismatch.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## ELI5

This PR adds automatic safety checks to prevent publishing Mastra
packages with peer dependencies that claim to support older versions of
`@mastra/core` than they actually need. It's like saying "this toy works
with blocks from age 3 onwards" when it really only works with the
improved blocks from age 5. The PR catches this mismatch before
publishing and updates all affected packages to declare the correct
minimum version they require.

## Overview

This PR implements peer dependency compatibility guardrails across the
Mastra monorepo. It introduces runtime import validation for the server
package and transitive peer dependency checking, preventing packages
from advertising overly broad `@mastra/core` peer ranges that would
allow incompatible older versions to be installed.

## Key Changes

### New Runtime Import Validation Script
- **`packages/server/scripts/check-core-imports.ts`** (287 lines): A
TypeScript compatibility checker that scans `packages/server/src` for
non-type-only named imports from `@mastra/core`, extracts the declared
peer dependency floor, downloads that specific floor version, and
validates all imports are available at that version using TypeScript's
type checker. Failures report which imports are unavailable and suggest
updating the peer floor.

### Peer Dependency Validation Extension
- **`scripts/validate-peerdeps.mjs`**: Extended to add transitive peer
dependency validation. Ensures packages depending on other Mastra
packages cannot declare a broader `@mastra/core` peer range than their
runtime Mastra dependencies require, preventing installation graphs that
would allow incompatible older core versions.

### CI Integration
- **`.github/workflows/lint.yml`**: Updated `peerdeps-check` job to
enable dependency installation and run the new `check:core-imports`
check during linting.

### Documentation Update
- **`packages/server/AGENTS.md`**: Added instruction to keep
`check:core-imports` in sync when introducing new `@mastra/core`
imports.

### Configuration
- **`packages/server/package.json`**: Added `check:core-imports` script
invoking the new validation.

## Peer Dependency Updates

A changeset (`.changeset/giant-owls-rule.md`) documents updates to peer
dependency floors across 15+ packages:

- **Deployer packages** (`deployers/cloud`, `deployers/cloudflare`,
`deployers/netlify`, `deployers/vercel`) + `packages/deployer`: Updated
to `>=1.32.0-0 <2.0.0-0`
- **Server adapters** (`server-adapters/express`, `fastify`, `hono`,
`koa`, `nestjs`): Updated to `>=1.32.0-0 <2.0.0-0`
- **Workflow integrations** (`workflows/temporal`): Updated to
`>=1.32.0-0 <2.0.0-0`
- **Editor** (`packages/editor`), **Inngest** (`workflows/inngest`),
**Google Cloud Pub/Sub** (`pubsub/google-cloud-pubsub`): Updated to
`>=1.13.2-0 <2.0.0-0`
- **Observability packages** (Arize, Arthur, Braintrust, Datadog,
Laminar, Langfuse, Langsmith, OTEL Bridge, OTEL Exporter, PostHog,
Sentry): Updated to `>=1.16.0-0 <2.0.0-0`
- **Agent Builder** (`packages/agent-builder`): Updated to `>=1.4.1-0
<2.0.0-0`
- **CLI** (`packages/cli`): Updated to `>=1.32.0-0 <2.0.0-0`

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Mastra Code (openai/gpt-5.5) <noreply@mastra.ai>
2026-05-05 17:08:36 +02:00
Grayson Hicks
86c0298e64
feat(auth): add Fine-Grained Authorization (FGA) with WorkOS provider - resource-level enforcement across agents, workflows, tools, memory, and MCP (#15410)
## Description

Adds Fine-Grained Authorization (FGA) support to Mastra for
relationship-based, resource-level access control. The branch introduces
the core FGA provider/manager interfaces, typed `MastraFGAPermissions`,
`checkFGA()`/`FGADeniedError`, `server.fga` config, and a capabilities
flag. FGA checks are backward compatible and no-op when no provider is
configured.

Runtime enforcement is wired through agent `generate()`/`stream()`,
workflow execution, tool execution, MCP tool listing/execution, server
route handlers, and memory/thread operations. List and search paths now
filter agents, workflows, tools, MCP tools, and threads to only the
resources the user can access, with thread checks carrying the owning
`resourceId` and request context for tenant-aware providers.

Adds `MastraFGAWorkos` in `@mastra/auth-workos` backed by the WorkOS
Authorization API. It supports resource and permission mapping,
organization membership resolution and caching, organization scoping,
service-token/JWT claim context, resource management, role assignment
management, and accessible-resource filtering.

Updates the built-in server adapters (Express, Fastify, Hono, Koa) to
run route-level FGA on built-in and custom routes, including
request-aware resource ID resolvers and path/query/body params. The
branch also preserves auth refresh headers in adapter auth flows and
fixes MCP tool list output schema metadata while adding FGA coverage.

Docs, tests, and changesets are included for `@mastra/core`,
`@mastra/server`, `@mastra/auth-workos`, `@mastra/mcp`, and the server
adapter packages.

## Related Issue(s)

Fixes #14089

## Type of Change
- [ ] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
- [ ] Code refactoring
- [ ] Performance improvement
- [x] Test update

## Checklist
- [x] I have made corresponding changes to the documentation (if
applicable)
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have addressed all Coderabbit comments on this PR

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Ryan Hansen <rphansen91@gmail.com>
2026-05-04 10:49:08 -05:00
Ward Peeters
f5afe62bef
feat(client-js): generate route types from server contracts (#15519)
Co-authored-by: Mastra Code (openai/gpt-5.4) <noreply@mastra.ai>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-05-04 16:13:09 +02:00
Ryan Hansen
3355b311f9
fix(server): only bypass auth in dev mode when no auth provider is configured (#13873)
## Summary

The dev playground auth bypass was unconditionally skipping auth for all
localhost requests with `MASTRA_DEV=true`, which prevented auth
development/testing locally. Now the bypass only applies when no real
auth provider (with `authenticateToken`) is configured.

## Changes

- **Capabilities endpoint** (`auth.ts` handler): Return `{ enabled:
false }` when no auth provider exists, regardless of dev playground
status. Removes the `isDevPlaygroundRequest` check entirely — if
`getAuthProvider()` returns null, auth is disabled.
- **`coreAuthMiddleware`** (`helpers.ts`): Only use dev playground
bypass when no auth provider is configured (`!hasAuthProvider`), so the
full auth flow runs when auth IS configured — ensuring
user/roles/permissions are set in `requestContext`.
- **Tests**: Updated to cover both scenarios (no provider → disabled,
provider configured → real capabilities).
- **Bonus**: Fix pre-existing TS errors in `permission-generator.ts`
(default values for destructured `split()` result).

## Problem

When auth was configured and running locally (`MASTRA_DEV=true` +
localhost), the `isDevPlaygroundRequest()` check in `coreAuthMiddleware`
was returning `pass` immediately — without setting user context.
Downstream route handlers checking permissions would then fail with 403
because `userPermissions` was undefined.

## Test Plan

- `pnpm vitest run src/server/handlers/auth.test.ts` — 2/2 passing
- `pnpm vitest run src/server/auth/helpers.test.ts` — 60/60 passing
- `tsc --noEmit` on server package — clean (0 errors)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added support flag for fine-grained authorization (FGA) in capability
reporting.

* **Bug Fixes**
* Prevented undefined values when parsing permission patterns, improving
permission descriptions.

* **Refactor**
* Dev-mode authentication bypass now only applies when no auth provider
is configured; auth capabilities reflect actual provider presence.

* **Tests**
* Updated auth tests to validate capability behavior with and without an
auth provider.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Mastra Code (anthropic/claude-opus-4-6) <noreply@mastra.ai>
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com>
2026-03-11 18:36:12 -07:00
Ryan Hansen
6dbeeb94a8
feat: auth core, server RBAC, and adapter permission enforcement (#13163)
## Summary

PR 1 of 3 from the `auth-rbac-cms` branch split. This PR adds all
backend plumbing for auth/RBAC. PRs 2 (auth providers) and 3 (playground
UI) depend on this and can land in parallel once this merges.

- **New `@mastra/core/auth` export** — interfaces for RBAC, sessions,
SSO, credentials, ACL, and user management, plus default implementations
(static RBAC provider, cookie/memory session providers, built-in roles)
- **Server auth handlers** — login, signup, logout, session management,
and SSO flows with Zod-validated schemas
- **Route-level permission enforcement** — `requiresPermission` on route
configs with convention-based derivation from path/method (e.g. `GET
/agents/:id` → `agents:read`)
- **Server adapter RBAC middleware** (Hono, Express, Fastify, Koa) —
resolves user permissions via RBAC provider, cookie auth fallthrough for
session-based auth
- **Authorization policy fix** — `isProtectedPath` now uses
`isProtectedCustomRoute` instead of `!isCustomRoutePublic`, fixing a bug
where studio UI couldn't load in production
- **Deployer updates** — `MASTRA_PACKAGES_FILE` env var injection,
dynamic CORS origin when auth configured
- **Client SDK** — `getFullUrl` helper, `AuthCapabilities` type export

### Key behavioral changes

| Change | Risk | Mitigation |
|---|---|---|
| `SimpleAuth<TUser>` → `SimpleAuth<TUser extends EEUser>` | Medium —
requires `id` + `email` fields | Intentional; compile-time catch |
| `isProtectedPath` logic change | Medium — authorization policy | New
tests cover this; required for studio login in prod |
| Cookie fallthrough in Hono auth middleware | Low | Falls back to 401
if no user found |
| No RBAC → authenticated users get full access | Low — intentional |
Auth-only mode preserved |
| CORS dynamic origin when auth configured | Low | Only activates with
auth config; user can override |

### Deviation from plan

`deployers/cloud/package.json` — the plan called for adding
`@mastra/auth-cloud` dependency, but that package is created in PR 2.
Omitted here to avoid workspace resolution failure; PR 2 will add it.

### Fixed pre-existing test bug

All 4 adapter RBAC tests had a failing test ("should derive permissions
from route path/method when not explicitly set") that registered an API
handler at `/agents/test` with no prefix. That's a frontend/SPA path —
real API handlers are always under `/api/*`. Fixed the test to use
`prefix: '/api'` so the route is at `/api/agents/test`, matching how
routes are actually registered. Verified the bug exists on
`auth-rbac-cms` with clean install + build.

## Test plan

- [x] `pnpm build:packages` — 35/35 tasks pass
- [x] Core auth tests (cookie.test.ts) — 16/16 pass
- [x] Server tests (permissions, helpers, system) — 177/177 pass
- [x] Hono RBAC tests — 21/21 pass
- [x] Express RBAC tests — 15/15 pass
- [x] Fastify RBAC tests — 15/15 pass
- [x] Koa RBAC tests — 15/15 pass
- [x] Client SDK tests (base.test.ts) — 5/5 pass
- [ ] Verify no auth configured → all existing behavior identical (no
403s, no auth prompts)
- [ ] Verify pre-commit hooks pass (eslint + prettier)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Enterprise auth: SSO and credentials sign-in/sign-up, login/logout,
cookie and in-memory sessions, auth capabilities and current-user
endpoints.
* RBAC: default roles, static RBAC provider, route-level permission
enforcement and middleware across adapters.
  * Client: full-URL helper; system responses include isDev.
* Deploy/build: bundling emits package metadata; deployers set runtime
packages file and adjust CORS when auth is enabled.

* **Bug Fixes**
  * Studio UI loads correctly in production.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Shane Thomas <shane@codekarate.com>
Co-authored-by: Mastra Code (anthropic/claude-opus-4-6) <noreply@mastra.ai>
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com>
2026-03-03 22:49:10 +01:00