mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
254 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d60ba71be0 | chore: version - exit prerelease mode | ||
|
|
5c87442ed7 |
chore: version packages (alpha) (#30203)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/auth-auth0@1.3.0-alpha.0 ## @mastra/auth-clerk@1.4.0-alpha.0 ## @mastra/auth-okta@0.3.0-alpha.0 ## @mastra/auth-supabase@1.2.0-alpha.0 ## @mastra/client-js@1.60.0-alpha.13 ## @mastra/auth@1.2.0-alpha.0 ## @mastra/core@1.83.0-alpha.13 ## @mastra/playground-ui@69.0.0-alpha.15 ## @mastra/rag@2.8.0-alpha.3 ## @mastra/server@1.83.0-alpha.13 ## @mastra/server-adapters-test-suite@0.3.0-alpha.5 ## @mastra/auth-better-auth@1.1.11-alpha.2 ## @mastra/auth-cloud@1.2.9-alpha.0 ## @mastra/auth-neon@0.3.6-alpha.1 ## @mastra/auth-workos@1.6.9-alpha.0 ## @mastra/discord@1.3.4-alpha.0 ## @mastra/react@1.15.0-alpha.13 ## @mastra/deployer-cloud@1.83.0-alpha.13 ## @mastra/deployer-cloudflare@1.2.42-alpha.3 ## @mastra/deployer-netlify@1.2.42-alpha.1 ## @mastra/deployer-sandbox@0.3.27-alpha.1 ## @mastra/deployer-vercel@1.2.42-alpha.1 ## @mastra/longmemeval@1.1.42-alpha.13 ## @mastra/opencode@0.1.42-alpha.13 ## @mastra/factory@0.28.0-alpha.15 ## create-factory@0.4.3-alpha.15 ## @mastra/code-sdk@1.19.0-alpha.15 ## mastracode@0.50.0-alpha.14 ## @mastra/agent-builder@1.2.1-alpha.5 ## mastra@1.39.0-alpha.15 ## @mastra/connect@1.4.0-alpha.6 ## @mastra/deployer@1.83.0-alpha.13 ## @mastra/editor@0.17.1-alpha.7 ## @mastra/mcp@2.9.0-alpha.5 ## @mastra/mcp-docs-server@1.3.13-alpha.17 ## @mastra/memory@1.41.1-alpha.5 ## @mastra/schema-compat@1.4.0-alpha.2 ## @mastra/elysia@0.1.23-alpha.13 ## @mastra/express@1.5.27-alpha.13 ## @mastra/fastify@1.5.27-alpha.13 ## @mastra/hono@1.7.25-alpha.13 ## @mastra/koa@1.7.27-alpha.13 ## @mastra/nestjs@0.3.0-alpha.13 ## @mastra/next@0.2.41-alpha.13 ## @mastra/tanstack-start@0.2.41-alpha.13 ## @mastra/voice-google-gemini-live@0.14.19-alpha.2 ## @mastra/voice-openai-realtime@0.14.9-alpha.3 ## @mastra/voice-xai-realtime@0.2.18-alpha.2 ## @mastra/inngest@1.11.2-alpha.9 ## @mastra/temporal@0.6.0-alpha.13 ## create-mastra@1.39.0-alpha.15 ## @internal/playground@1.39.0-alpha.15 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
27705673f2 |
feat(server): OAuth discovery and audience checks for the built-in MCP endpoint (#29930)
## Description
Lets MCP clients such as Claude Code sign in to the built-in `/api/mcp`
endpoint with OAuth instead of a pasted token. The endpoint tells
clients where to sign in (RFC 9728 protected-resource metadata) and can
reject tokens issued for a different API (audience check).
```ts
new Mastra({
server: {
auth: new MastraJwtAuth({
jwksUri: 'https://auth.example.com/.well-known/jwks.json',
issuer: 'https://auth.example.com/',
}),
mcp: { oauth: { resource: 'https://my-app.example.com/api/mcp' } },
},
});
```
### Behavior changes
**OAuth discovery for `/api/mcp`** (`@mastra/server`, every server
adapter including NestJS)
- When `server.auth` is set and the built-in MCP server is on, a `401`
from `/api/mcp` carries `WWW-Authenticate: Bearer
resource_metadata="…"`. `error="invalid_token"` is added only when a
token was sent (RFC 6750 §3).
- Metadata is served publicly at
`/.well-known/oauth-protected-resource/api/mcp` and
`/.well-known/oauth-protected-resource`, with `Cache-Control: no-store`.
- The document lists `resource`, `authorization_servers`, optional
`scopes_supported`, and `bearer_methods_supported: ['header']`. Without
`oauth.resource`, `resource` is derived from the request origin.
- The challenge, metadata routes and audience check apply only to
`/api/mcp`. Other routes are unaffected.
**Audience check** (`server.mcp.oauth.resource`)
- When set, the token audience must include this exact value, or the
request gets 401.
- An invalid value (non-URL, or a non-loopback `http://` URL) turns
discovery off and logs an error, but the audience check still runs
against it. Requests fail closed until the value is fixed.
- A provider that can't check audience (no `verifyAudience`, for example
`SimpleAuth` API keys) is accepted by default. The server logs a startup
warning on adapters built on `MastraServer`, not on NestJS.
- `requireAudience: true` (opt-in, only valid together with `resource`)
rejects those requests on `/api/mcp` with 401 `invalid_token`. Inside
`CompositeAuth`, only requests accepted by such providers are rejected.
Without `resource`, nothing changes.
**Config and provider hooks** (`@mastra/core`)
- New `server.mcp.oauth` config: `resource`, `requireAudience`,
`authorizationServers`, `scopesSupported`.
- Two new optional auth-provider methods:
- `getOAuthMetadata()` advertises the provider's authorization server.
- `verifyAudience()` checks the token audience.
- `CompositeAuth` combines the authorization servers of its providers.
It checks the audience with the provider that accepted the token, and
rejects when that provider can't be determined. The new
`getAuthenticatedProvider(user)` returns that provider.
**Providers**
| Provider | Advertises its authorization server | Checks audience
against `oauth.resource` |
|---|---|---|
| `MastraJwtAuth` | Yes, its `issuer` | Yes |
| Auth0 | Yes, the tenant | Yes |
| Clerk | Yes, the Frontend API | No |
| Okta | Yes, the issuer | No: Okta already enforces its own `audience`
(`OKTA_AUDIENCE`) |
| Supabase | Yes, `<url>/auth/v1` (requires Supabase's OAuth 2.1 server)
| No |
`MastraJwtAuth` gains `jwksUri` and `issuer` options
(`JWT_AUTH_JWKS_URI`, `JWT_AUTH_ISSUER`), so it can verify tokens signed
by an identity provider. JWKS keys are restricted to their key type, so
HMAC tokens forged with the public key are rejected.
**JWT subject as user id** (`@mastra/auth`, Auth0, Clerk)
- When a token has no `id` claim, the user's `id` is now set to `sub`.
Existing `id` claims are kept.
- Standard OIDC access tokens only carry `sub`. Before this change, RBAC
never loaded roles for these users, so every protected route returned
`403 Missing required permission`.
- Unless `mapUserToResourceId` is set, this also scopes data for these
users:
- **Owned records** (stored agents, skills, workspaces and other owned
records): each user sees their own records plus public ones. Admin
permissions keep the full list.
- **Tool-provider connections:** per-author connections move from the
shared `default` owner to the user's `sub`. Existing connections need
reconnecting, or set `mapUserToResourceId: () => 'default'` to keep the
old shared behavior.
- **Feedback:** recorded with `sub` as the user id.
- The changeset describes all of these effects.
**Test suite** (`@mastra/server-adapters-test-suite`)
- New `createBuiltinMCPOAuthTestSuite`.
- The package now has `@mastra/auth` and `jose` as peer dependencies.
Stacked on #29929.
## Test plan
- `packages/server`: `src/server/mcp/oauth.test.ts` and
`oauth-without-mcp.test.ts`. They cover metadata, the challenge format,
resource validation, failing closed on an invalid `resource`, and
discovery working without `@mastra/mcp` installed.
- `packages/auth` `jwt.test.ts`:
- JWKS and issuer validation
- string and array `aud`
- an algorithm-confusion token that is HS256-signed with the real RSA
public key PEM and must be rejected
- `sub` used as `id`
- `packages/core` `composite-auth.test.ts`: per-provider audience
delegation, rejection when the authenticating provider is unknown, and
`getAuthenticatedProvider`.
- `auth/auth0`, `auth/clerk`, `auth/okta`, `auth/supabase` unit tests.
- `createBuiltinMCPOAuthTestSuite` on Hono, Express, Fastify, Koa and
Elysia, plus the NestJS equivalent. It checks:
- the challenge, and fetching the advertised metadata URL
- audience accept and reject, including for an invalid `resource`
- `requireAudience`:
- `SimpleAuth` + `resource`: 200 by default, 401 in strict mode
- a JWT with a matching audience: 200 in strict mode
- a mixed `CompositeAuth`: only the API key is rejected
- RBAC with a token that carries only `sub`
- that a `sub`-only user can't list another user's private stored agent
- `tsc --noEmit` and `oxlint` on the touched packages, plus docs `pnpm
check` and Vale.
- Manual run end to end with Claude Code against a local identity
provider: discovery, client registration, PKCE login, and two users with
different roles.
---------
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
|
||
|
|
c0d3bfdc43 |
feat: pass the authenticated user to DynamicArgument callbacks (#28612)
Dynamic agent config callbacks now get the authenticated end user as an
optional `user` argument, so you can personalize an agent without
digging auth keys out of `requestContext` yourself. It works in any
`DynamicArgument` callback: instructions, model, tools, memory,
workspace, processors, scorers, and so on.
```ts
import { Agent } from '@mastra/core/agent';
const supportAgent = new Agent({
id: 'support-agent',
instructions: ({ user }) =>
user ? `You are helping ${user.name ?? user.id}.` : 'You are a helpful assistant.',
model: ({ user }) => (user?.role === 'admin' ? 'openai/gpt-5' : 'openai/gpt-5-mini'),
tools: ({ user }) => (user ? { accountTool, ...(user.role === 'admin' ? { adminTool } : {}) } : {}),
memory: ({ user }) => (user ? userMemory : undefined),
});
```
`user` always has the same `MastraUser` shape, no matter which auth
provider you use, and it's `undefined` for unauthenticated requests:
```ts
import type { MastraUser } from '@mastra/core/types';
// { id: string; name?: string; email?: string; avatarUrl?: string; role?: string }
```
The server auth middleware builds it through a new overridable
`toMastraUser()` on `MastraAuthProvider`. The default handles common
shapes (`id`/`sub`/`userId`, `name`, `email`, `avatarUrl`/`picture`,
`role`), and JWT, Cloud, Supabase, Neon and Better Auth ship overrides
for their user objects. Custom providers can map their own shape:
```ts
import { MastraAuthProvider } from '@mastra/core/server';
import type { MastraUser } from '@mastra/core/types';
class MyAuth extends MastraAuthProvider<MyUser> {
async authenticateToken(token: string) { /* ... */ }
async authorizeUser(user: MyUser) { return true; }
toMastraUser(user: MyUser): MastraUser {
return { id: user.accountId, name: user.profile.displayName, role: user.permissions.primaryRole };
}
}
```
Inline auth configs can pass `toMastraUser` too. If the provider user
has no role and an RBAC provider is configured, the primary RBAC role
fills it in, so `user.role` also works with WorkOS, Okta, Google and
Neon. The raw provider user is still available when you need
provider-specific fields, and the new context key is reserved, so
clients can't spoof it through the request body:
```ts
instructions: ({ requestContext }) => {
const rawUser = requestContext.get('mastra__user'); // provider-specific object, unchanged
// ...
},
```
Dynamic `vectorStore` resolvers on RAG tools get `user` as well:
```ts
createVectorQueryTool({
indexName: 'docs',
model: embedder,
vectorStore: ({ user }) => (user ? tenantStores.get(user.id)! : sharedStore),
});
```
Inside core, every place that invoked a `DynamicArgument` callback
inline now goes through a single `resolveDynamicArgument` helper, which
reads the user from `requestContext` at call time. This is non-breaking:
callbacks get an extra optional field, providers get a method with a
working default. Requests served through an `MCPServer` don't get `user`
yet, since MCP builds its own request context; that's documented.
Tested with unit tests for the helper, normalization and each provider
override, middleware tests (inline config, provider role, RBAC role,
CompositeAuth ordering, unauthenticated), regression tests for the
migrated call sites, and an end-to-end test where an agent behind a fake
auth provider gets personalized instructions. Core, server, rag and the
touched auth packages typecheck clean, and their suites pass.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
When a signed-in user makes a request, configuration callbacks can now
use a standard set of details about that user. When a workflow resumes,
it uses the new request’s user details instead of restoring them from
the earlier run.
## Summary
- Added optional `user` data to `DynamicArgument` callbacks and RAG
vector-store resolvers. Callbacks can also use `getRequestUser()` to
read the normalized user from request context.
- Added the `MastraUser` type and `toMastraUser()` normalization hooks
for auth providers and inline auth configs. The server stores the
normalized user in a reserved request-context key and uses the primary
RBAC role when the user has no role.
- Updated core dynamic configuration paths to use the shared resolver.
Added user support to agent scopes and migrated A2A memory resolution.
- Added `withoutLiveRequestKeys()` to remove live authentication and
authorization data from saved context during workflow resume, restart,
and time travel. Saved non-authentication context, such as tenant data,
remains available.
- Added documentation and changesets. Raised relevant `@mastra/core`
peer dependency minimums to 1.81.0. MCPServer requests do not receive
the normalized `user`.
## Validation
The author reports passing typechecks and test suites across core,
server, RAG, and several auth packages. The author also reports three
failing Inngest tests and earlier failures in evented workflow and
scheduler tests, which reportedly fail the same way on comparison
sources. These results are author-reported and have not been
independently verified.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
|
||
|
|
779d2875b1 |
chore: version packages (alpha) (#29912)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/auth-studio@1.4.0-alpha.1 ## @mastra/factory@0.28.0-alpha.5 ## @mastra/mcp-apps-components@0.1.0-alpha.5 ## @mastra/playground-ui@69.0.0-alpha.6 ## @mastra/client-js@1.60.0-alpha.5 ## @mastra/react@1.15.0-alpha.5 ## @mastra/deployer-cloud@1.83.0-alpha.5 ## @mastra/longmemeval@1.1.42-alpha.5 ## @mastra/opencode@0.1.42-alpha.5 ## create-factory@0.4.3-alpha.5 ## @mastra/code-sdk@1.19.0-alpha.5 ## mastracode@0.50.0-alpha.5 ## @mastra/agent-builder@1.2.1-alpha.2 ## mastra@1.39.0-alpha.5 ## @mastra/core@1.83.0-alpha.5 ## @mastra/deployer@1.83.0-alpha.5 ## @mastra/editor@0.17.1-alpha.3 ## @mastra/mcp@2.9.0-alpha.2 ## @mastra/mcp-docs-server@1.3.13-alpha.8 ## @mastra/memory@1.41.1-alpha.2 ## @mastra/rag@2.7.3-alpha.1 ## @mastra/server@1.83.0-alpha.5 ## @mastra/elysia@0.1.23-alpha.5 ## @mastra/express@1.5.27-alpha.5 ## @mastra/fastify@1.5.27-alpha.5 ## @mastra/hono@1.7.25-alpha.5 ## @mastra/koa@1.7.27-alpha.5 ## @mastra/nestjs@0.3.0-alpha.5 ## @mastra/next@0.2.41-alpha.5 ## @mastra/server-adapters-test-suite@0.3.0-alpha.2 ## @mastra/tanstack-start@0.2.41-alpha.5 ## @mastra/libsql@1.30.0-alpha.2 ## @mastra/turso@0.1.21-alpha.2 ## @mastra/inngest@1.11.2-alpha.3 ## @mastra/temporal@0.6.0-alpha.5 ## create-mastra@1.39.0-alpha.5 ## @internal/playground@1.39.0-alpha.5 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
b3801a79d3 |
feat(factory): default new factories to the Mastra Gateway (#29183)
New factories can run on the Mastra Gateway in one click instead of bringing provider keys. Factory already signs users in with their Mastra account, so **Connect Mastra Gateway** creates a gateway key on the user's Mastra organization (as that user) and stores it with the Factory's model credentials. Every `mastra/...` model then runs on the organization's Mastra credits, and new setups start on Claude Opus 5.5. The gateway option says what it bills and how much is left. At $0, Factory says so where you pick the model, in Settings and on a failed run, with **Add credits** opening the organization's add-credits page on Mastra in a new tab (the same page the CLI uses). The balance is read again when you come back to Factory. ## Before / After Dark mode, local Factory signed in through local Platform. Before is `main`. **Choosing a provider** | Before | After | | --- | --- | | <img src="https://github.com/user-attachments/assets/9ba10a45-e43b-48c6-87ab-2093cc7bbd87" width="420"> | <img src="https://github.com/user-attachments/assets/51510a44-6023-4c75-ab81-42fceeb7c5de" width="420"><br>Onboarding | | <img src="https://github.com/user-attachments/assets/2f5ebaab-990c-4ac6-8db2-af64bbc74c4e" width="420"> | <img src="https://github.com/user-attachments/assets/8696d2fd-b1f2-4b07-83bf-496de71cc538" width="420"><br>New factory palette | | <img src="https://github.com/user-attachments/assets/c2493dd8-16b6-49be-8bcf-ee0b1a5974ee" width="420"> | <img src="https://github.com/user-attachments/assets/61b3447e-a5eb-4ca5-b928-50252c516019" width="420"><br>Settings › Models › Add provider | | <img src="https://github.com/user-attachments/assets/022cb25b-de82-4834-abaf-ec76ca07b5d6" width="420"> | <img src="https://github.com/user-attachments/assets/a924bee2-1d76-4719-9e2c-90c86a6bd2e7" width="420"><br>Settings, connected | **After connecting, and at $0** (the $0 balance is stubbed locally) | With credits | No credits left | | --- | --- | | <img src="https://github.com/user-attachments/assets/a60e9bd2-bc0e-4db2-a252-b2c3fe084314" width="420"><br>Starts on Claude Opus 5.5 | <img src="https://github.com/user-attachments/assets/d3bce67b-3e8a-401f-80c6-63a4e7ac4d14" width="420"><br>Add credits opens Mastra in a new tab, Continue stays enabled | | <img src="https://github.com/user-attachments/assets/9f3d0b6d-1c16-4476-ac7b-fa113e0f3238" width="420"><br>The option at $0, before connecting | <img src="https://github.com/user-attachments/assets/f402c60d-db14-4247-9370-1ac439cdce03" width="420"><br>Settings | | <img src="https://github.com/user-attachments/assets/4b58590b-80d9-427c-999e-b11576231efe" width="420"><br>New factory palette | <img src="https://github.com/user-attachments/assets/c60c0556-e7a6-451e-bc54-83c46646c776" width="420"><br>A run at $0 (from Damien's stubbed run) | ## What changed - `POST /web/config/providers/mastra/connect` creates the key on Mastra as the signed-in user (new `MastraAuthStudio.fetchAsRequestUser`), only when their Mastra session is on the Factory's organization, and stores it as the scope's `mastra-gateway` credential (org-wide for admins, or personal). Keys are labeled `Factory · Shared` or `Factory · <email>`. `GET .../mastra/credits` reads the balance the way the dashboard does. - Model resolution uses the tenant's own gateway key for `mastra/...` models (the server key still works as before), web search included. The catalog lists the gateway's models once a scope has a key. - UI: the gateway is listed first under Recommended in onboarding, the new factory palette and Settings, with its billing line; one-row "No gateway credits left" warning; a gateway-specific run error for the gateway's 402. Members who aren't Mastra admins are told to ask an admin. No Platform changes. ## Scope - Adding credits happens on Mastra, not inside Factory. A shared credits component for both is a separate piece of work. - Factory gets its key from Gateway project provisioning (`/v1/gateway/projects/provision`), the same v1 project key the CLI creates, because organization (v2) keys aren't released yet. Each connect creates a small `Factory · …` project on Mastra, and removing the gateway in Factory doesn't revoke its key there. - Not covered: orgs that bring their own provider keys to the gateway (no credits needed) still see the $0 warning. - Not verified: a model run through the hosted gateway with a key Factory created (a local Platform key isn't valid there). Everything up to the model call was run against local Platform. ## Testing 1. Sign in to Factory with a Mastra account. On a fresh org, `/onboarding` › company account › Model shows Mastra Gateway with the balance; **Connect Mastra Gateway** goes to the model picker on Claude Opus 5.5. 2. Mastra shows a new `Factory · Shared` key; Settings › Models shows Mastra Gateway · Key saved and `mastra/...` models in the pickers. 3. With $0, the model step, Settings and the new factory palette show "No gateway credits left"; **Add credits** opens `projects.mastra.ai/add-credits/<org>` in a new tab, and the warning clears after adding credits and coming back. 4. A run on a gateway model at $0 shows "Out of Mastra Gateway credits" with Add credits, Continue and Change model. Fixes PLTFRM-2941 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 Factory users can connect Mastra Gateway and use their organization’s Mastra credits to run models. Factory shows the available balance and provides guidance when credits run out. ## What changed - Added Mastra Gateway connection options to onboarding, Factory creation, and provider settings. - Set Claude Opus 5.5 as the preferred model for new Gateway setups. - Added credit balance details, zero-credit warnings, an Add credits action, and guidance for members who cannot add credits. - Added Gateway-specific run errors and recovery options for exhausted credits. - Added Factory routes to create user- or organization-scoped Gateway credentials and read credit balances. Removing a credential in Factory does not revoke the Mastra key. - Updated model routing so `mastra/...` models use a tenant’s stored Gateway key when available, with the server key as fallback. - Updated Gateway routing to skip custom-provider lookup when a model uses Mastra Gateway. - Added `MastraAuthStudio.fetchAsRequestUser` and Factory route support for Platform requests made as the signed-in user. ## Validation The PR description reports tests with a stubbed API and route tests. It does not report verification against a live Mastra Platform or Stripe. CI and build results are not available. ## Scope 44 files changed: 1,377 lines added and 59 removed. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Damien Schneider <damien.schneider01@gmail.com> |
||
|
|
6deb16047f |
chore: version packages (alpha) (#29719)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/slack@1.9.0-alpha.0 ## @mastra/factory@0.28.0-alpha.3 ## @mastra/code-sdk@1.19.0-alpha.3 ## mastracode@0.50.0-alpha.3 ## @mastra/observability@1.24.0-alpha.2 ## @mastra/core@1.83.0-alpha.3 ## @mastra/mcp-apps-components@0.1.0-alpha.3 ## @mastra/playground-ui@69.0.0-alpha.4 ## @mastra/server@1.83.0-alpha.3 ## @mastra/server-adapters-test-suite@0.3.0-alpha.1 ## @mastra/platform-workspace@1.13.0-alpha.0 ## @mastra/auth-better-auth@1.1.11-alpha.1 ## @mastra/client-js@1.60.0-alpha.3 ## @mastra/react@1.15.0-alpha.3 ## @mastra/deployer-cloud@1.83.0-alpha.3 ## @mastra/longmemeval@1.1.42-alpha.3 ## @mastra/opencode@0.1.42-alpha.3 ## create-factory@0.4.3-alpha.3 ## @mastra/arize@1.3.30-alpha.2 ## @mastra/arthur@0.4.30-alpha.2 ## @mastra/braintrust@1.3.27-alpha.2 ## @mastra/datadog@1.4.22-alpha.2 ## @mastra/deepeval@0.1.24-alpha.2 ## @mastra/laminar@1.3.32-alpha.2 ## @mastra/langfuse@1.6.6-alpha.2 ## @mastra/langsmith@1.4.3-alpha.2 ## @mastra/otel-bridge@1.5.22-alpha.2 ## @mastra/otel-exporter@1.5.2-alpha.2 ## @mastra/posthog@1.4.7-alpha.2 ## @mastra/sentry@1.2.32-alpha.2 ## @mastra/agent-builder@1.2.1-alpha.1 ## mastra@1.39.0-alpha.3 ## @mastra/connect@1.3.2-alpha.2 ## @mastra/deployer@1.83.0-alpha.3 ## @mastra/editor@0.17.1-alpha.2 ## @mastra/fastembed@1.3.7-alpha.0 ## @mastra/mcp-docs-server@1.3.13-alpha.6 ## @mastra/memory@1.41.1-alpha.1 ## @mastra/elysia@0.1.23-alpha.3 ## @mastra/express@1.5.27-alpha.3 ## @mastra/fastify@1.5.27-alpha.3 ## @mastra/hono@1.7.25-alpha.3 ## @mastra/koa@1.7.27-alpha.3 ## @mastra/nestjs@0.3.0-alpha.3 ## @mastra/next@0.2.41-alpha.3 ## @mastra/tanstack-start@0.2.41-alpha.3 ## @mastra/convex@1.8.1-alpha.0 ## @mastra/pg@1.36.0-alpha.2 ## @mastra/inngest@1.11.2-alpha.2 ## @mastra/temporal@0.6.0-alpha.3 ## create-mastra@1.39.0-alpha.3 ## @internal/playground@1.39.0-alpha.3 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
4bd4b7f48e |
chore(deps): update better-auth monorepo to v1.7.18 (#29714)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
f21e0742ce | chore: version packages | ||
|
|
4045b99c0b |
fix(auth-neon): support hosted Neon Auth and document integration (#29633)
## Summary - Correct Neon Auth session, JWT, and credential flows for hosted Neon projects; make Studio sign-in, sign-up, and sign-out functional. - Resolve Neon organization membership roles for Mastra RBAC, with local HTTP integration coverage and optional live-project testing. - Add an auth integration guide and update the Neon reference documentation. Original contribution by Rishi Raj Jain; his commit authorship is preserved. ## Test plan - `pnpm --filter @mastra/auth-neon test` (17 passed) - `pnpm --filter @mastra/auth-neon build` - `pnpm --filter @mastra/auth-neon exec tsc --noEmit` - `pnpm --filter @mastra/auth-neon lint` - `pnpm --dir docs validate` - `pnpm exec remark --no-stdout --frail --quiet src/content/en/integrations/auth/neon.mdx src/content/en/reference/auth/neon.mdx` (from docs/) Live Neon project testing requires Neon credentials and was not rerun here. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This change helps Mastra sign users in to hosted Neon Auth and keep their sessions working. It also lets Neon organization membership affect access and adds guides for setting up the integration. ## Summary - Updated `@mastra/auth-neon` to support hosted Neon Auth endpoints, JWT verification, session cookies, sign-in, sign-up, and sign-out. - Added organization membership role lookup for RBAC, with a configurable `getUserRoles` override. - Added local integration tests and optional tests against a live Neon project. - Added a Neon integration guide and updated the Neon reference documentation. - Changed 14 files, with 1,331 lines added and 1,081 lines removed. ## Checks Results for tests, build, typecheck, lint, and documentation checks on the current head: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Rishi Raj Jain <jain71000@gmail.com> Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com> Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
cb2b399294 |
perf(factory-ui): load each page's data and code alongside the sign-in check (#29434)
## Description
Opening a Factory page used to run its waits one after another. First
`/auth/me`, then `/web/factory/projects`, then the page's code, then the
page's own requests: the sidebar's sessions, boards, work items and
decisions, and the board's intake settings and connection status. All of
those only need the Factory id from the URL, or the Factory list.
Now React Router loaders (`src/ui/routeLoaders.ts`) start them. When a
route is entered, its loader starts the queries its element reads and
returns without waiting. It uses the same `queryOptions` as the hook
that reads the data, so the component finds the request already in
flight. The router runs every matched route's loader at once.
- **Under `RootGuards`** (a pathless route): the Factory list.
`RootGuards` still renders in the first frame, and `AuthGuard` sends
`/auth/me` itself. It refetches on every mount to watch the session, so
prefetching the check could fetch it twice.
- **`FactoryLayout`:** session runs, once the list shows the Factory has
a linked repository. That's the same `hasLinkedRepository` rule the
layout uses.
- **`AppLayout`, outside Settings:** the sidebar's features, boards,
sessions, work items, decisions and active runs. Settings uses the same
`isSettingsPath` rule as the sidebar.
- **Work, Review and custom boards:** intake config, intake bindings,
and the GitHub, GitLab, Linear, Jira and incident.io statuses, once the
Factory has a linked repository.
- **Lazy pages:** their code. Rules also starts its decisions for the
current `?group=`, and the new-session routes start the composer's
project, default model and providers.
Some requests stay with the components that read them, so the router
never copies a component's logic. These are the ones keyed by another
response or by state a component resolves:
- the board's issue and PR lists, recent activity and label routes;
- the composer's model list;
- the chat permissions;
- each Settings section's data;
- the feed stream.
Loaders run only when their route is entered. By the next navigation the
components are mounted and fetch for themselves in the same render.
Gating, layouts and screens are unchanged. Without the new `services`
argument, as in most tests, `createAppRoutes()` declares no loaders.
React best practices: shared query options guard a missing id with
`skipToken`, not `enabled` and `id!` (`prefetchQuery` ignores
`enabled`). There are no `as` casts, and loaders return nothing instead
of `null`. `main.tsx` builds one `ApiConfig` for both the router and
`ApiConfigProvider`, which now takes it as `config`. The API client
reads the global `fetch` per request instead of capturing it when the
client is created.
**`@mastra/auth-studio`:** concurrent verifications of the same session
cookie now share one call to the platform's `/auth/me`. With the startup
requests leaving together, each used to verify the cookie on its own.
With an expired session, each also tried to refresh it with the same
refresh token, so every request but the first failed. The merge is keyed
by the cookie, so only requests carrying the identical cookie share an
answer. Each request still gets its own renewed `Set-Cookie`. This is
tested against a real HTTP server that refuses a reused refresh token.
**Access:** prefetching changes when the browser asks, not what it may
receive. Every prefetched Factory endpoint goes through the auth gate
(401 when signed out). It resolves the caller's organization and looks
the Factory up within it (`projects.get({ orgId, id })`), returning 404
otherwise. The sessions list also filters private sessions by viewer.
Nothing renders before both checks pass.
I measured in Chromium against the built app, from when the startup
script finishes running. `/auth/me` starts at the same time as on
`main`. The Factory list starts during the startup script instead of 640
ms after it. The sidebar's requests start with it instead of after both
checks. The routes manifest is unchanged, and the startup bundle grows
by 0.8 KB gzipped.
`AppStartup.msw.test.tsx` drives the real routes, query client and
loaders with a repository-linked Factory. It covers Work, Review, a
custom board, Rules, new and draft sessions, Settings, a Factory without
a repository, and a link without a Factory. On each it checks three
things: nothing starts after `/auth/me` answers except the requests
listed above, nothing is sent twice, and every prefetched query is read
by the page. It also checks that a visitor who signs in from another tab
never sees "Unable to load your factories". I broke the loaders seven
ways and each one made it fail. It passed 20 runs out of 20.
The full MSW suite passes except 5 tests that fail on `main` too
(`BoardPageProviderFacts`, `SessionsSectionGroups`, `KnowledgePage`).
factory-ui unit tests (585) and the `auth-studio` suite (140) pass.
## Related issue(s)
No issue. Follow-up to https://github.com/mastra-ai/mastra/pull/29322.
## Type of change
- [x] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Code refactoring
- [x] Performance improvement
- [ ] Test update
## Checklist
- [ ] I have linked the related issue(s) in the description above
- [ ] 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
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01VhgyDUZnNc7MLonrGJtR33
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
The app starts loading page code and data while it checks whether the
user is signed in. This can reduce the wait before a page is ready.
Concurrent requests that use the same session cookie can share one
sign-in check, while each request still gets its own renewed cookie.
## What changed
- Added route loaders that start page preloads and data queries on route
entry without waiting for them to finish. Loaders do not revalidate;
page components continue to manage their data.
- Added shared query-option builders so loaders and page hooks use the
same query definitions.
- Added prefetching for Factory data, sidebar data, board intake
settings and connection status, composer data, and Rules decisions.
Loaders skip requests when required IDs or repository information are
missing. Sidebar prefetching is skipped on Settings paths.
- Kept `/auth/me` out of the loaders because `AuthGuard` checks it on
mount.
- Updated API configuration so the app shares one config between the
router and API provider.
- Encoded Factory IDs in the board catalog URL.
- Coalesced concurrent session checks for the same credential. Added
tests for concurrent verification and cookie renewal.
- Added changeset notes for the Factory startup loading changes and the
auth-studio session-check fix.
## Validation
The PR description reports 20 successful runs of
`AppStartup.msw.test.tsx`, 585 passing factory-ui unit tests, and 140
passing auth-studio tests. It also reports five failures in the full MSW
suite, which the author says also occur on `main`.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
||
|
|
675caf0613 |
chore: version packages (alpha) (#29336)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/client-js@1.60.0-alpha.0 ## @mastra/react@1.15.0-alpha.0 ## @mastra/factory@0.28.0-alpha.0 ## @mastra/code-sdk@1.19.0-alpha.0 ## mastra@1.39.0-alpha.0 ## @mastra/core@1.83.0-alpha.0 ## @mastra/mcp@2.9.0-alpha.0 ## @mastra/mcp-apps-components@0.1.0-alpha.0 ## @mastra/playground-ui@69.0.0-alpha.0 ## @mastra/server@1.83.0-alpha.0 ## @mastra/nestjs@0.3.0-alpha.0 ## @mastra/clickhouse@1.30.0-alpha.0 ## @mastra/duckdb@1.19.0-alpha.0 ## @mastra/libsql@1.30.0-alpha.0 ## @mastra/pg@1.36.0-alpha.0 ## @mastra/temporal@0.6.0-alpha.0 ## @mastra/auth-better-auth@1.1.11-alpha.0 ## @mastra/deployer-cloud@1.83.0-alpha.0 ## @mastra/deployer-cloudflare@1.2.42-alpha.0 ## @mastra/deployer-netlify@1.2.42-alpha.0 ## @mastra/deployer-sandbox@0.3.27-alpha.0 ## @mastra/deployer-vercel@1.2.42-alpha.0 ## @mastra/longmemeval@1.1.42-alpha.0 ## @mastra/opencode@0.1.42-alpha.0 ## create-factory@0.4.3-alpha.0 ## mastracode@0.49.1-alpha.0 ## @mastra/arize@1.3.30-alpha.0 ## @mastra/arthur@0.4.30-alpha.0 ## @mastra/braintrust@1.3.27-alpha.0 ## @mastra/datadog@1.4.22-alpha.0 ## @mastra/deepeval@0.1.24-alpha.0 ## @mastra/laminar@1.3.32-alpha.0 ## @mastra/langfuse@1.6.6-alpha.0 ## @mastra/langsmith@1.4.3-alpha.0 ## @mastra/observability@1.23.2-alpha.0 ## @mastra/otel-bridge@1.5.22-alpha.0 ## @mastra/otel-exporter@1.5.2-alpha.0 ## @mastra/posthog@1.4.7-alpha.0 ## @mastra/sentry@1.2.32-alpha.0 ## @mastra/agent-builder@1.2.1-alpha.0 ## @mastra/connect@1.3.2-alpha.0 ## create-mastra@1.39.0-alpha.0 ## @mastra/deployer@1.83.0-alpha.0 ## @mastra/editor@0.17.1-alpha.0 ## @mastra/mcp-docs-server@1.3.13-alpha.0 ## @mastra/memory@1.41.1-alpha.0 ## @mastra/rag@2.7.3-alpha.0 ## @mastra/redis-streams@0.8.1-alpha.0 ## @mastra/elysia@0.1.23-alpha.0 ## @mastra/express@1.5.27-alpha.0 ## @mastra/fastify@1.5.27-alpha.0 ## @mastra/hono@1.7.25-alpha.0 ## @mastra/koa@1.7.27-alpha.0 ## @mastra/next@0.2.41-alpha.0 ## @mastra/tanstack-start@0.2.41-alpha.0 ## @mastra/spanner@1.11.2-alpha.0 ## @mastra/turso@0.1.21-alpha.0 ## @mastra/inngest@1.11.2-alpha.0 ## @mastra/gcs@0.3.6-alpha.0 ## @internal/playground@1.39.0-alpha.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
b6dd5da728 |
chore(deps): bump @google-cloud/spanner, better-auth and follow-redirects (#29052) | ||
|
|
77076a1012 | chore: version - exit prerelease mode | ||
|
|
4f12792ed1 |
chore: version packages (alpha) (#28722)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
29747ebd1d |
chore(deps): update better-auth monorepo to v1.7.13 (#28538)
This PR contains the following updates: | Package | Type | Update | Change | Pending | |---|---|---|---|---| | [@better-auth/drizzle-adapter@<1.7.7](https://www.better-auth.com/docs/adapters/drizzle) ([source](https://redirect.github.com/better-auth/better-auth/tree/HEAD/packages/drizzle-adapter)) | pnpm-workspace.overrides | patch | [`1.7.7` → `1.7.13`](https://renovatebot.com/diffs/npm/@better-auth%2fdrizzle-adapter@<1.7.7/1.7.7/1.7.13) | `1.7.14` | | [better-auth](https://better-auth.com) ([source](https://redirect.github.com/better-auth/better-auth/tree/HEAD/packages/better-auth)) | pnpm-workspace.overrides | patch | [`^1.7.7` → `^1.7.13`](https://renovatebot.com/diffs/npm/better-auth/1.7.7/1.7.13) | `1.7.14` | | [better-auth](https://better-auth.com) ([source](https://redirect.github.com/better-auth/better-auth/tree/HEAD/packages/better-auth)) | dependencies | patch | [`^1.7.12` → `^1.7.13`](https://renovatebot.com/diffs/npm/better-auth/1.7.12/1.7.13) | `1.7.14` | --- > [!WARNING] > Some dependencies could not be looked up. Check the [Dependency Dashboard](../issues/9505) for more information. --- ### Release Notes <details> <summary>better-auth/better-auth (@​better-auth/drizzle-adapter@<1.7.7)</summary> ### [`v1.7.13`](https://redirect.github.com/better-auth/better-auth/blob/HEAD/packages/drizzle-adapter/CHANGELOG.md#1713) [Compare Source](https://redirect.github.com/better-auth/better-auth/compare/v1.7.12...v1.7.13) ### [`v1.7.12`](https://redirect.github.com/better-auth/better-auth/blob/HEAD/packages/drizzle-adapter/CHANGELOG.md#1712) [Compare Source](https://redirect.github.com/better-auth/better-auth/compare/v1.7.11...v1.7.12) ### [`v1.7.11`](https://redirect.github.com/better-auth/better-auth/blob/HEAD/packages/drizzle-adapter/CHANGELOG.md#1711) [Compare Source](https://redirect.github.com/better-auth/better-auth/compare/v1.7.10...v1.7.11) ### [`v1.7.10`](https://redirect.github.com/better-auth/better-auth/blob/HEAD/packages/drizzle-adapter/CHANGELOG.md#1710) [Compare Source](https://redirect.github.com/better-auth/better-auth/compare/v1.7.9...v1.7.10) ### [`v1.7.9`](https://redirect.github.com/better-auth/better-auth/blob/HEAD/packages/drizzle-adapter/CHANGELOG.md#179) [Compare Source](https://redirect.github.com/better-auth/better-auth/compare/v1.7.8...v1.7.9) ### [`v1.7.8`](https://redirect.github.com/better-auth/better-auth/blob/HEAD/packages/drizzle-adapter/CHANGELOG.md#178) [Compare Source](https://redirect.github.com/better-auth/better-auth/compare/v1.7.7...v1.7.8) ##### Patch Changes - [#​11512](https://redirect.github.com/better-auth/better-auth/pull/11512) [`4175b34`]( |
||
|
|
6a191d46dc | chore: version - exit prerelease mode | ||
|
|
2c646b53d0 |
chore: version packages (alpha) (#28399)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/factory@0.25.0-alpha.5 ## @mastra/langsmith@1.4.0-alpha.2 ## @mastra/connect@1.2.0-alpha.2 ## @mastra/core@1.80.0-alpha.4 ## @mastra/playground-ui@66.0.0-alpha.4 ## @mastra/acp@0.4.4-alpha.0 ## @mastra/claude@0.3.4-alpha.0 ## @mastra/cursor@0.3.4-alpha.0 ## @mastra/openai@1.1.4-alpha.0 ## @mastra/auth-auth0@1.2.6-alpha.0 ## @mastra/auth-better-auth@1.1.9-alpha.0 ## @mastra/auth-clerk@1.3.2-alpha.0 ## @mastra/auth-cloud@1.2.8-alpha.0 ## @mastra/auth-firebase@1.1.5-alpha.0 ## @mastra/auth-google@0.1.7-alpha.0 ## @mastra/auth-neon@0.3.5-alpha.0 ## @mastra/auth-okta@0.2.6-alpha.0 ## @mastra/auth-studio@1.3.11-alpha.1 ## @mastra/auth-supabase@1.1.6-alpha.0 ## @mastra/auth-workos@1.6.8-alpha.0 ## @mastra/agent-browser@0.5.5-alpha.0 ## @mastra/browser-viewer@0.2.6-alpha.0 ## @mastra/browser-firecrawl@0.2.5-alpha.1 ## @mastra/stagehand@0.3.7-alpha.1 ## @mastra/discord@1.3.2-alpha.0 ## @mastra/slack@1.8.0-alpha.1 ## @mastra/teams@0.1.3-alpha.0 ## @mastra/telegram@0.2.4-alpha.0 ## @mastra/client-js@1.57.0-alpha.4 ## @mastra/react@1.13.0-alpha.4 ## @mastra/isolated-vm@0.1.4-alpha.0 ## @mastra/quickjs@0.1.5-alpha.0 ## @mastra/deployer-cloud@1.80.0-alpha.4 ## @mastra/deployer-cloudflare@1.2.39-alpha.1 ## @mastra/deployer-netlify@1.2.39-alpha.1 ## @mastra/deployer-sandbox@0.3.24-alpha.1 ## @mastra/deployer-vercel@1.2.39-alpha.1 ## @mastra/voyageai@0.4.3-alpha.0 ## @mastra/longmemeval@1.1.39-alpha.4 ## @mastra/livekit@0.5.2-alpha.0 ## @mastra/opencode@0.1.39-alpha.4 ## @mastra/parallel@0.1.4-alpha.0 ## create-factory@0.3.1-alpha.4 ## @mastra/code-sdk@1.15.1-alpha.5 ## mastracode@0.48.1-alpha.4 ## @mastra/arize@1.3.27-alpha.2 ## @mastra/arthur@0.4.27-alpha.2 ## @mastra/braintrust@1.3.24-alpha.2 ## @mastra/datadog@1.4.19-alpha.2 ## @mastra/deepeval@0.1.21-alpha.2 ## @mastra/laminar@1.3.29-alpha.2 ## @mastra/langfuse@1.6.3-alpha.2 ## @mastra/observability@1.21.1-alpha.2 ## @mastra/otel-bridge@1.5.19-alpha.2 ## @mastra/otel-exporter@1.4.10-alpha.2 ## @mastra/posthog@1.4.4-alpha.2 ## @mastra/sentry@1.2.29-alpha.2 ## @mastra/agent-builder@1.1.31-alpha.2 ## @mastra/auth@1.1.5-alpha.0 ## mastra@1.36.0-alpha.4 ## @mastra/codemod@1.1.8-alpha.0 ## create-mastra@1.36.0-alpha.4 ## @mastra/deployer@1.80.0-alpha.4 ## @mastra/editor@0.16.5-alpha.2 ## @mastra/evals@1.10.9-alpha.0 ## @mastra/fastembed@1.3.5-alpha.2 ## @mastra/loggers@1.3.10-alpha.1 ## @mastra/mcp@2.6.0-alpha.1 ## @mastra/mcp-docs-server@1.3.10-alpha.7 ## @mastra/mcp-registry-registry@1.1.7-alpha.0 ## @mastra/memory@1.39.1-alpha.2 ## @mastra/rag@2.7.1-alpha.0 ## @mastra/schema-compat@1.3.17-alpha.0 ## @mastra/server@1.80.0-alpha.4 ## @mastra/google-cloud-pubsub@1.1.5-alpha.1 ## @mastra/redis-streams@0.6.5-alpha.1 ## @mastra/valkey-streams@0.5.7-alpha.1 ## @mastra/elysia@0.1.20-alpha.4 ## @mastra/express@1.5.24-alpha.4 ## @mastra/fastify@1.5.24-alpha.4 ## @mastra/hono@1.7.22-alpha.4 ## @mastra/koa@1.7.24-alpha.4 ## @mastra/nestjs@0.2.39-alpha.4 ## @mastra/next@0.2.38-alpha.4 ## @mastra/server-adapters-test-suite@0.1.4-alpha.2 ## @mastra/tanstack-start@0.2.38-alpha.4 ## @mastra/astra@1.1.3-alpha.0 ## @mastra/azure-ai-search@0.1.2-alpha.1 ## @mastra/chroma@1.1.5-alpha.0 ## @mastra/clickhouse@1.27.0-alpha.1 ## @mastra/cloudflare@1.7.6-alpha.0 ## @mastra/cloudflare-d1@1.4.5-alpha.1 ## @mastra/convex@1.7.6-alpha.0 ## @mastra/couchbase@1.1.4-alpha.1 ## @mastra/dsql@1.5.5-alpha.0 ## @mastra/duckdb@1.16.0-alpha.1 ## @mastra/dynamodb@1.4.5-alpha.1 ## @mastra/elasticsearch@1.4.6-alpha.1 ## @mastra/lance@1.5.2-alpha.1 ## @mastra/libsql@1.27.1-alpha.0 ## @mastra/mongodb@1.24.1-alpha.1 ## @mastra/mssql@1.10.6-alpha.0 ## @mastra/mysql@0.14.1-alpha.0 ## @mastra/opensearch@1.1.4-alpha.1 ## @mastra/oracledb@0.5.5-alpha.0 ## @mastra/pg@1.33.0-alpha.2 ## @mastra/pinecone@1.1.3-alpha.0 ## @mastra/qdrant@1.1.6-alpha.0 ## @mastra/redis@1.4.12-alpha.1 ## @mastra/s3vectors@1.1.5-alpha.0 ## @mastra/spanner@1.10.1-alpha.1 ## @mastra/turbopuffer@1.2.3-alpha.0 ## @mastra/turso@0.1.18-alpha.0 ## @mastra/upstash@1.5.5-alpha.1 ## @mastra/valkey@0.2.8-alpha.1 ## @mastra/vectorize@1.1.4-alpha.0 ## @mastra/weaviate@0.1.4-alpha.0 ## @mastra/voice-aws-nova-sonic@0.2.6-alpha.0 ## @mastra/voice-azure@0.12.3-alpha.0 ## @mastra/voice-cloudflare@0.13.4-alpha.0 ## @mastra/voice-deepgram@0.13.3-alpha.0 ## @mastra/voice-elevenlabs@0.13.3-alpha.0 ## @mastra/voice-gladia@0.13.3-alpha.0 ## @mastra/voice-google@0.14.4-alpha.0 ## @mastra/voice-google-gemini-live@0.14.18-alpha.0 ## @mastra/voice-inworld@0.4.6-alpha.0 ## @mastra/voice-mistral@0.1.3-alpha.0 ## @mastra/voice-modelslab@0.2.3-alpha.0 ## @mastra/voice-murf@0.13.3-alpha.0 ## @mastra/voice-openai@0.13.4-alpha.0 ## @mastra/voice-openai-realtime@0.14.8-alpha.0 ## @mastra/voice-playai@0.13.3-alpha.0 ## @mastra/voice-sarvam@1.1.4-alpha.0 ## @mastra/voice-speechify@0.14.3-alpha.0 ## @mastra/voice-xai-realtime@0.2.17-alpha.0 ## @mastra/inngest@1.10.8-alpha.3 ## @mastra/temporal@0.4.18-alpha.4 ## @mastra/agentcore@0.5.3-alpha.0 ## @mastra/agentfs@0.2.3-alpha.0 ## @mastra/apple-container@0.5.2-alpha.0 ## @mastra/archil@0.3.2-alpha.0 ## @mastra/azure@0.3.3-alpha.1 ## @mastra/blaxel@0.10.2-alpha.0 ## @mastra/cloudflare-sandbox@0.5.4-alpha.0 ## @mastra/daytona@0.11.4-alpha.0 ## @mastra/docker@0.12.1-alpha.0 ## @mastra/e2b@0.15.1-alpha.1 ## @mastra/e2b-desktop@0.1.10-alpha.1 ## @mastra/files-sdk@0.3.3-alpha.0 ## @mastra/gcs@0.3.5-alpha.1 ## @mastra/google-drive@0.2.4-alpha.0 ## @mastra/mesa@0.3.3-alpha.0 ## @mastra/modal@0.7.3-alpha.0 ## @mastra/platform-workspace@1.10.0-alpha.1 ## @mastra/railway@0.10.2-alpha.1 ## @mastra/s3@0.6.5-alpha.1 ## @mastra/sprites@0.1.2-alpha.0 ## @mastra/vercel@1.6.2-alpha.0 ## @internal/playground@1.36.0-alpha.4 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
ce5d4731ee |
chore(deps): update dependencies across the monorepo (#28417)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
dacb190944 |
chore: version packages (alpha) (#28009)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
2ac8cf1435 |
fix(auth-studio): issue host-only Studio session cookie (#28168) | ||
|
|
40a522c142 |
chore(deps): update build tools (#27997) | ||
|
|
e5c433b792 |
refactor(lint): prefer explicit reduce accumulator types (#27984)
Enable `typescript/prefer-reduce-type-parameter` across the repository,
including tests, and move 31 accumulator assertions across 24 files into
explicit `reduce<T>` arguments. For example, `items.reduce(callback, {}
as Record<string, string>)` becomes `items.reduce<Record<string,
string>>(callback, {})`. Emitted JavaScript ASTs match for every
migrated file, and 66 reducer return/accumulator type snapshots remain
equivalent.
Adds monorepo coverage that executes exports from multiple optimized
dependencies through the built HTTP server. CI lint/formatting, all 14
affected package typechecks, 235 focused tests, and the 55-task
publish-root build pass. All 81 monorepo E2E cases passed across the
full run and a 19-case targeted retry; retries disabled telemetry and
used writable package-manager caches after DNS/cache failures and a
shutdown timeout. No production changes were needed for that test setup.
This maintenance PR intentionally includes no changeset and requests no
package releases. The Changesets status check may therefore fail. The
follow-up commit removes only release metadata; source code and tests
are unchanged from the validated revision.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
This PR updates TypeScript code to state reducer result types more
clearly. It keeps the same runtime behavior and adds a test for
optimized dependencies in the monorepo build.
## Summary
- Enabled `typescript/prefer-reduce-type-parameter` for TypeScript
files, including tests.
- Replaced 31 reducer accumulator assertions across 24 files with
explicit `reduce<T>` type parameters.
- Added monorepo E2E coverage for `lodash` and `date-fns` imports
through the built HTTP server.
- Removed release changesets because this maintenance change does not
require package releases.
- Reported validation includes linting, formatting, 14 package
typechecks, 235 focused tests, the publish-root build, and all 81
monorepo E2E cases.
- Reported JavaScript ASTs and 66 reducer type snapshots remain
equivalent.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
||
|
|
fbd27197d7 |
refactor(lint): simplify literal strings and const assertions (#27982)
Enable `no-useless-concat` and `typescript/prefer-as-const` in the
shared Oxlint config. Simplify 15 string concatenations and use const
assertions for four readonly SDK specification versions. Existing
package filters stay as configured.
String contents and expression evaluation order are preserved, and the
SDK fields keep their readonly `v1`–`v4` literal types. A documented
exception keeps NUL-delimited fixture records separate so the next
record’s leading digit cannot become an octal escape.
261 focused tests pass. A fresh scan clears both rules across 14,747
files, and emitted-JavaScript and declaration comparisons preserve
values and public field types. [CI lint and formatting
pass](https://github.com/mastra-ai/mastra/actions/runs/39583377036/job/119166317139)
for `
|
||
|
|
4c22623ea3 | chore: version - exit prerelease mode | ||
|
|
9a423dae48 |
refactor(lint): replace ESLint with type-aware oxlint (#27476) | ||
|
|
a15924e709 | chore: version packages | ||
|
|
f88217d19b | chore: version - exit prerelease mode | ||
|
|
e45f83981a | chore: version packages | ||
|
|
7aec8b0d95 |
security: Vanta remediation pass 2026-10-12 (better-auth, MCP SDK) (#26773)
## Summary Vanta remediation for 2026-10-12. Target list is today's live export (77 findings, 44 unique IDs). Platform findings are handled in mastra-ai/platform#3317. ### What changed | Package | From → To | Findings | Where | How | |---|---|---|---|---| | better-auth | 1.7.5 → 1.7.7 | AIKIDO-2026-373183 (Critical) | root + `examples/agent` | raise override `better-auth: ^1.7.7`; direct dep `@mastra/auth-better-auth` ^1.7.7 | | @better-auth/drizzle-adapter | 1.7.5 → 1.7.7 | AIKIDO-2026-261025 (Low) | root + `examples/agent` | floor `'@better-auth/drizzle-adapter@<1.7.7': 1.7.7` (also pulled by better-auth 1.7.7) | | @modelcontextprotocol/sdk | 1.31.0 → 1.32.1 | AIKIDO-2026-365378 (High), -156139, -344432 | root, nested locks, `scripts/gh-issue-triage` | raise floor to `<1.32.0 → 1.32.1`; bump direct pins/ranges | Nested `pnpm-workspace.yaml` floors raised in e2e-tests/*, examples/*, integration-tests, etc., and those lockfiles regenerated. Versions used were published >24h ago (minimumReleaseAge). Patch changeset included for published packages whose dependency ranges changed. Aikido lens on this branch: better-auth and MCP SDK findings are gone. OSV: handlebars already clear on main; remaining high are braces/extract-zip (no patch). ### Left as-is (no patch, or major-only) - extract-zip ≤2.0.1: no fix (overdue; removed by #25855 when that lands). Needs Vanta risk acceptance. - braces 3.0.3, sprintf-js 1.0.3/1.1.3: no patched release - postcss-selector-parser 6.x: @tailwindcss/typography pins 6.0.10 - katex 0.16: mermaid declares ^0.16.47 - @ag-ui/client 0.0.59: fix only in 1.0.0 (major). Parent `@copilotkit/channels-*` 0.11.0 pins 0.0.59 exactly (template-genui-data-explorer) - @hono/node-server 1.19 (fix 2.1.3), undici 6.29 (fix 7.23/8.10), raw-body 3 in templates (fix 4), bundle-name 3 (fix 4.1.1), got 15 (fix 16), zod 3.25 (fix 4.x), @bufbuild/protobuf 1.10 (fix 2.x), openai 6.49 (fix 7.x), jose 5.10 via @segment/analytics-node in template (fix 6.x), @ai-sdk/provider-utils 2.2.8 / 3.0.x Aikido ranges wanting 4.0.18+: major-only or scanner range noise Do not merge unless reviewed. No CI weakened. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 This PR updates shared dependency versions so the project uses newer releases of Better Auth and the MCP SDK. It also updates workspace rules to keep older versions from being selected. ## Changes - Updated Better Auth requirements and workspace overrides to `^1.7.7`. - Updated `@modelcontextprotocol/sdk` requirements and overrides to `1.32.1` across affected packages and workspaces. - Added overrides for older `@better-auth/drizzle-adapter` versions to use `1.7.7`. - Added a patch changeset for `@mastra/auth-better-auth`, `@mastra/mcp-registry-registry`, and `@mastra/playground-ui`. Test results and review findings were not provided. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
81299c921d | chore: version - exit prerelease mode | ||
|
|
1a363be7df | chore: version packages | ||
|
|
9a511a4ff5 |
fix(auth-studio): keep Studio/Factory sessions alive for the full session length (#26447)
## Problem Users of deployed Studios and Factories (e.g. Shipyard) get signed out roughly once a day, even while active. Reported as FACT-382: an idle Factory tab that, on the next click, landed on the login screen. Verified against Shipyard (prod) on 2026-10-08: - The `wos-session` cookie on `*.mastra.cloud` expires exactly **24h after sign-in**. `MastraAuthStudio` hardcoded `Max-Age=86400`. Our WorkOS config allows a 14-day max session with a 5-day inactivity timeout. - Nothing ever extended that cookie. 19 Factory requests over ~9 minutes, past the 5-minute access-token expiry, returned **zero `Set-Cookie`**. - The shared API *does* renew the session on `/auth/me` and returns a new cookie. `MastraAuthStudio` discarded it, and it was scoped to `mastra.ai`, which browsers on `*.mastra.cloud` reject anyway. - Even a forwarded cookie wouldn't reach the browser on most paths: - Platform-deployed Studios wrap the provider in `CompositeAuth`, which didn't pass provider headers through. - Factory authenticates every request in its own auth gate, which doesn't implement session refresh. - 122 of Factory's 161 routes are declared `requiresAuth: false` and authenticate in the handler via `ensureFactoryAuthUser`. The framework skips user middleware on those routes (`skipIfFrameworkPublic`, #20989), so the gate never runs there either. ## Changes - **`@mastra/auth-studio`** - The session lifetime is configurable via `sessionMaxAgeSeconds` or `MASTRA_SESSION_MAX_AGE`, default **14 days**. It applies to the cookie `Max-Age` and every `Session.expiresAt`. It's configurable rather than a constant because deployed Studios pin framework versions and Platform needs to control the value. - When `/auth/me` returns a renewed cookie, the provider: - re-issues it with the deployment's own cookie attributes (domain, Secure, Max-Age) - invalidates the 30s verification-cache entry for the old cookie - remembers the renewed cookie (not the used-up one) for organization calls such as `ensureOrganization` - exposes it through a new optional `consumePendingResponseHeaders(request)` hook - `getCurrentUser` passes the request through, so renewals on that path are captured too. - **`@mastra/server`** - The auth middleware merges pending provider headers into the response, including after its own refresh-and-retry, where it reads them from the retry request. - The public `GET /auth/me` route forwards them too, since the middleware skips public routes. - **`CompositeAuth`** (`@mastra/core`) delegates `consumePendingResponseHeaders` to inner providers and merges the results. - **`@mastra/factory`**: both the auth gate and `ensureFactoryAuthUser` forward pending headers, so gated and `requiresAuth: false` routes both renew the cookie. All forwarding is optional-chained and wrapped in try/catch, so any mix of package versions is safe, and a failure to forward headers can never turn into a 401. ## Testing ### Unit Every new behavior has a regression test that fails without its change. | Package | Result | New coverage | |---|---|---| | auth-studio | 125/125 | domain rewrite (`Domain=mastra.ai` → `.mastra.cloud`); max-age option, env var, invalid-env fallback; cache invalidation on rotation; renewed cookie used for org calls; `getCurrentUser` exposes the renewal | | server auth helpers | 95/95 | headers stashed against the raw Request are emitted via the adapted request; renewal during the post-refresh retry is forwarded; a throwing hook doesn't break auth | | server auth handlers | 27/27 | `GET /auth/me` forwards pending headers; a throwing hook still returns the user | | `CompositeAuth` | 8/8 | delegation and merging; a throwing inner provider is ignored | | Factory auth | 56/56 | gate forwarding; `ensureFactoryAuthUser` forwarding on an ungated route; a throwing hook still returns 200 | A harness against the real `@mastra/deployer` Hono server with the snapshot Factory auth confirmed the `requiresAuth: false` gap, and that the `ensureFactoryAuthUser` change closes it. ### Staging (snapshot `0.0.0-fix-set-cookie-20261008222303`) Factory deployed to staging Platform with this PR's snapshot. - **Sign-in:** the cookie's Expires was ~14 days out (was 24h on Shipyard). - **After the 5-minute access-token expiry:** ``` GET /web/factory/projects → 200 set-cookie: wos-session=…; HttpOnly; SameSite=Lax; Path=/; Max-Age=1209600; Secure; Domain=.mastra.cloud ``` | Route (after access-token expiry) | Previous snapshot (gate only) | This PR | |---|---|---| | `/web/factory/projects` (most-polled) | ❌ | ✅ | | `/web/gitlab/issues`, `/web/gitlab/subscriptions` | ❌ | ✅ | | `/web/audit/portal-link`, `/web/custom-jira`, `/web/custom/status` | ✅ | ✅ | | `/api/agents`, `/api/workflows` | ✅ | ✅ | Not renewed, and not needed: - `/` is the SPA shell. It loads without auth, and the API calls it makes do the renewing. - Two GitLab routes returned 502 because the test Factory has no GitLab connection. ## Follow-ups - A Platform PR to set `MASTRA_SESSION_MAX_AGE` on Studio/Factory deploys, so Platform controls the value. - The Factory gate should return 503 instead of a sign-out on verification errors or timeouts. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 Studio and Factory users could be signed out even when they were still using the service. This change lets Studio sessions last longer and sends renewed login cookies back to the browser so users can stay signed in. ## Summary - Set the default Studio session lifetime to 14 days. Configure it with `sessionMaxAgeSeconds` or `MASTRA_SESSION_MAX_AGE`. - When `/auth/me` renews a `wos-session` cookie, reissue it with the deployment’s cookie attributes and invalidate the old cookie’s verification-cache entry. - Add `consumePendingResponseHeaders` to expose renewed cookies. Forward pending headers through server auth middleware, `CompositeAuth`, Factory auth paths, and the public `GET /auth/me` route. - Ignore errors from the optional header-forwarding hook so they do not block authentication. - Add tests for session lifetime configuration, cookie rotation, cache invalidation, and header forwarding. ## Validation The supplied PR summary reports passing tests: auth-studio 125/125, server auth helpers 95/95, server auth handlers 27/27, `CompositeAuth` 8/8, and Factory auth 56/56. It also reports a staging Factory probe and a harness using the real `@mastra/deployer` Hono server. These results were not independently verified. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
b10b70fd77 | chore: version - exit prerelease mode | ||
|
|
8cacbf7267 | chore: version packages | ||
|
|
022cae93cb |
fix(auth): remove node-forge (okta SDK -> fetch, firebase-admin 14) (#25829)
node-forge 1.4.0 is the newest release and is affected by CVE-2026-85393 (RSA PKCS#1 v1.5 signature forgery). There is no patched version, so the only fix is to stop depending on it. This clears 3 open Vanta findings (2 on the mastra-ai/mastra asset, 1 from Aikido). It came in four ways: - Root and `docs` package.json listed `node-forge` directly. These were old Dependabot floors from #11359 and #14754. Nothing imports it, so they're removed. - `firebase-admin` 13 depended on it. v14 doesn't, but v14 also removed the namespaced `admin.*` API, so `@mastra/auth-firebase` now uses `firebase-admin/app` and `firebase-admin/auth`. It requires Node >= 22, which the package already does. - `@okta/okta-sdk-nodejs` -> `node-jose` -> `node-forge`. The latest Okta SDK still has this chain. `MastraRBACOkta` only used the SDK for `userApi.listUserGroups`, so it now calls `GET /api/v1/users/:id/groups` with `fetch` and the same `SSWS` token header that `MastraAuthOkta.getUser` already uses. It follows `Link: rel="next"` pagination, but only to the configured org's origin, so the token never goes anywhere else. After this PR, `node-forge`, `node-jose` and `@okta/okta-sdk-nodejs` are gone from `pnpm-lock.yaml`. Testing: auth-okta and auth-firebase unit tests pass locally (I added tests for pagination, the cross-origin guard, error retry and the ADC fallback), and both packages build and typecheck. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## ELI5 This change removes packages that pull in `node-forge`, which the PR reports has no patched release for the cited security issue. It keeps Firebase authentication working with the newer Firebase Admin package and fetches Okta groups directly from Okta. ## Changes - Upgraded `firebase-admin` to `^14.5.0` and switched `@mastra/auth-firebase` to modular Firebase Admin APIs. The provider uses application-default credentials when no service account is configured. - Removed `@okta/okta-sdk-nodejs` from `@mastra/auth-okta`. `MastraRBACOkta` now fetches group pages from Okta’s REST API and follows pagination links only when they match the configured organization’s origin. - Removed direct `node-forge` dependencies from the root and docs manifests. The supplied dependency search found no references to `node-forge`, `node-jose`, or `@okta/okta-sdk-nodejs` in the lockfile. - Added changesets for `@mastra/auth-firebase` and `@mastra/auth-okta`. ## Tests The PR objectives report that auth-okta and auth-firebase unit tests passed locally, and that both packages built and typechecked. These results were not independently verified here. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
8b35a6c1d6 | chore: version - exit prerelease mode | ||
|
|
de967f00ab | chore: version packages | ||
|
|
7b3ddfad10 |
fix(auth-studio): fall back to .mastra-project.json for organizationId (#25583)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
5306a14346 | chore: version - exit prerelease mode | ||
|
|
81817c032a | chore: version packages | ||
|
|
285828ec03 |
fix(auth-workos): keep single-membership organization for cookie sessions (#25264)
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> |
||
|
|
6721bffd7e | chore: version - exit prerelease mode | ||
|
|
666f01ddc0 |
fix(auth-google): keep Google SSO sessions valid for cookieMaxAge (#25043)
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> |
||
|
|
a436d6c513 | chore: version - exit prerelease mode | ||
|
|
b6df015ee8 | chore: version packages | ||
|
|
ac05f2d7fc |
refactor(auth): adopt Web Crypto without async API breaks (#24583) | ||
|
|
429d7b9f93 | chore: version - exit prerelease mode | ||
|
|
a0f543a216 | chore: version packages | ||
|
|
0aa22af31c |
Restrict Clerk Studio login to a single organization (#24188)
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> |