diff --git a/.changeset/@mastra_auth-better-auth-30464-dependencies.md b/.changeset/@mastra_auth-better-auth-30464-dependencies.md new file mode 100644 index 00000000000..885d6ba6dc7 --- /dev/null +++ b/.changeset/@mastra_auth-better-auth-30464-dependencies.md @@ -0,0 +1,5 @@ +--- +'@mastra/auth-better-auth': patch +--- +dependencies updates: + - Updated dependency [`better-auth@^1.7.22` ↗︎](https://www.npmjs.com/package/better-auth/v/1.7.22) (from `^1.7.18`, in `dependencies`) diff --git a/.changeset/all-tips-laugh.md b/.changeset/all-tips-laugh.md new file mode 100644 index 00000000000..533675792ea --- /dev/null +++ b/.changeset/all-tips-laugh.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Stopped the Mastra platform GitHub event poll from reading the Factory database every 20 seconds. It now remembers which repositories are linked to projects and reads them again only when a link or connection changes. Renamed repositories are picked up from the platform during the hourly reconcile. An idle Factory makes fewer database queries, which helps databases that suspend when unused. diff --git a/.changeset/blue-hoops-end.md b/.changeset/blue-hoops-end.md new file mode 100644 index 00000000000..bc8f20d9445 --- /dev/null +++ b/.changeset/blue-hoops-end.md @@ -0,0 +1,15 @@ +--- +'@mastra/factory': minor +--- + +New factories no longer create database columns and tables that nothing reads. Existing factories keep working: the old columns and their data stay in place, and the factory simply stops writing them. + +**Removed** + +- The `filesystem_snapshots` and `intake_label_routes` tables are no longer created, and the background file-listing capture that filled `filesystem_snapshots` no longer runs. +- The `waitForPendingFilesystemCapture` export is removed. Remove any call to it; there is nothing left to wait for. +- Project repository responses no longer include `sandboxWorkdir` or `lastBuiltAt`, and linking a repository no longer accepts `sandboxWorkdir`. + +**Upgrading** + +Update `@mastra/pg` or `@mastra/libsql` together with `@mastra/factory`. Older adapter versions keep the retired columns required on existing databases, which makes card, rule and repository writes fail. diff --git a/.changeset/brave-routes-reroute.md b/.changeset/brave-routes-reroute.md new file mode 100644 index 00000000000..ff663b34221 --- /dev/null +++ b/.changeset/brave-routes-reroute.md @@ -0,0 +1,10 @@ +--- +'mastra': patch +--- + +Added `factory intake-route reroute-preview` and `factory intake-route reroute` to `mastra api`, for listing and moving untouched cards whose intake route now points at a different board. + +```sh +mastra api factory intake-route reroute-preview +mastra api factory intake-route reroute +``` diff --git a/.changeset/brave-topics-redeliver.md b/.changeset/brave-topics-redeliver.md new file mode 100644 index 00000000000..cdb66e8931a --- /dev/null +++ b/.changeset/brave-topics-redeliver.md @@ -0,0 +1,5 @@ +--- +'@mastra/google-cloud-pubsub': patch +--- + +`GoogleCloudPubSub` now reports `redeliversUnacked` as `true`: a message a dead subscriber held is delivered again once its ack deadline passes. Workflow recovery then leaves evented runs to Pub/Sub instead of restarting them on every booting instance (#28712). diff --git a/.changeset/bright-details-link.md b/.changeset/bright-details-link.md new file mode 100644 index 00000000000..cd79992f21b --- /dev/null +++ b/.changeset/bright-details-link.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Recognize Detail findings as linked work items so intake cards retain their external source and rule identity. diff --git a/.changeset/bright-terms-crash.md b/.changeset/bright-terms-crash.md new file mode 100644 index 00000000000..46b301fe683 --- /dev/null +++ b/.changeset/bright-terms-crash.md @@ -0,0 +1,7 @@ +--- +'@mastra/core': patch +--- + +Fixed retries in `dountil` and `dowhile` loops on the evented engine. Each iteration of a loop body now starts at `retryCount` 0 and gets the step's full `retries`, as on the default engine. Before, the count carried over from earlier iterations, so a body that failed once in a later iteration could run out of retries and fail the run. + +If your step code reads `retryCount` inside a loop body, it now gets the attempt within the current iteration. The loop condition receives the iteration number as `iterationCount`. To use it inside the body, pass it through the step's output or workflow state. diff --git a/.changeset/calm-followups-file.md b/.changeset/calm-followups-file.md new file mode 100644 index 00000000000..93c59c29a0a --- /dev/null +++ b/.changeset/calm-followups-file.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +incident.io boards in Factory no longer create cards while a list loads. Factory now checks incident.io every five minutes and files new follow-ups itself. It files only follow-ups from a source bound to a project. This happens with no board open. The `MASTRACODE_INCIDENT_IO_RECONCILE_ENABLED` setting is removed: the check always runs. To stop incident.io for one organization, turn it off in Settings › Work Intake. diff --git a/.changeset/calm-icons-grow.md b/.changeset/calm-icons-grow.md new file mode 100644 index 00000000000..283080d0ec1 --- /dev/null +++ b/.changeset/calm-icons-grow.md @@ -0,0 +1,8 @@ +--- +'@mastra/playground-ui': minor +'mastra': patch +--- + +Central icons now draw at the size Lucide icons did. The icon sizes grow by 2px (`xs` 14px, `sm` 16px, `md` 18px, `lg` 22px) because Central leaves more room around each drawing, so an icon in the same slot keeps the size people are used to. Product icons, the remaining Lucide icons, brand logos and product marks keep their drawn size. Avatars no longer borrow the icon sizes: the `xs` and `inline` avatars use their own `--spacing-avatar-xs` (12px) and `--spacing-avatar-inline` (16px). + +A few Central shapes that run edge to edge, such as plain arrows and the `•••` dots, get an optical inset so they match the rest of the set, with their stroke thickened by the same factor so every icon keeps the same line weight. The inset lives in `central-icons.json` and the icon generator applies it. diff --git a/.changeset/calm-phases-load.md b/.changeset/calm-phases-load.md new file mode 100644 index 00000000000..7db2330ca6b --- /dev/null +++ b/.changeset/calm-phases-load.md @@ -0,0 +1,7 @@ +--- +'mastra': patch +--- + +Improved the Factory board on large projects. The board now loads the first cards of each phase, then more as you scroll. It no longer downloads every card of the project. + +Search, filters and sorting now run on the server. Search matches cards that contain every word typed, in any order. It also finds a card by its number or source id. diff --git a/.changeset/calm-sweeps-skip.md b/.changeset/calm-sweeps-skip.md new file mode 100644 index 00000000000..12d3eeeb7a5 --- /dev/null +++ b/.changeset/calm-sweeps-skip.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +The incident.io sweep no longer re-runs rules for follow-ups it already handled, and one follow-up that fails no longer stops the rest of its page from getting cards. diff --git a/.changeset/calm-threads-wait.md b/.changeset/calm-threads-wait.md new file mode 100644 index 00000000000..af7cc39e3a6 --- /dev/null +++ b/.changeset/calm-threads-wait.md @@ -0,0 +1,5 @@ +--- +'@mastra/libsql': patch +--- + +Fixed thread state writes failing with `SQLITE_BUSY` while another write is in progress on a local database file. Setting or clearing a thread's state, such as an agent's goal objective, now waits for that write to finish. diff --git a/.changeset/calm-verdicts-rest.md b/.changeset/calm-verdicts-rest.md new file mode 100644 index 00000000000..13ee5ea8f65 --- /dev/null +++ b/.changeset/calm-verdicts-rest.md @@ -0,0 +1,7 @@ +--- +'@mastra/factory': patch +--- + +Fixed pull request reviews that recorded the same verdict over and over without finishing. After a review session recorded its verdict, Factory told it a new review pass had started on the same commit, so it recorded the verdict again. The session is now told its pass is finished. + +When another review is requested on the same commit, the reviewer is now told to read the newest comments and reviews on the pull request before deciding whether its verdict still stands. diff --git a/.changeset/card-links-open-session.md b/.changeset/card-links-open-session.md new file mode 100644 index 00000000000..2629a17ef6c --- /dev/null +++ b/.changeset/card-links-open-session.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Factory card links that agents post (in Slack threads, GitHub comments and tool results) now open the card's session directly, the same as clicking the card on its board. Before, they opened the board with the card highlighted in the list, so you had to find and click the card again. diff --git a/.changeset/clean-pigs-win.md b/.changeset/clean-pigs-win.md new file mode 100644 index 00000000000..80042a5b83d --- /dev/null +++ b/.changeset/clean-pigs-win.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Added `GET /web/factory/projects/:id/work-items/:workItemId/session-repository`. It returns the repository a session on the card starts in, resolved with the same rules as the card's runs, or the reason the card has none. diff --git a/.changeset/clear-animals-enjoy.md b/.changeset/clear-animals-enjoy.md new file mode 100644 index 00000000000..db3808bc2c1 --- /dev/null +++ b/.changeset/clear-animals-enjoy.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Fixed board listing revalidation to use SHA-256, so a changed board is not treated as unchanged. Sandbox clone, checkout, environment sync, push, and merge-request refresh now refuse repository paths that resolve to a different repository, and default branch names that are not valid git refs. diff --git a/.changeset/clever-carpets-enter.md b/.changeset/clever-carpets-enter.md new file mode 100644 index 00000000000..864bb4a742d --- /dev/null +++ b/.changeset/clever-carpets-enter.md @@ -0,0 +1,25 @@ +--- +'@mastra/factory': minor +--- + +Organization admins can now create skills for one Factory from Settings › Skills, without redeploying. Choose **New skill**, give it a name, description and instructions, and the Factory's sessions can load it from their next start. A phase of the Factory's boards can also run it as `runner.skill`. Created skills show a **Custom** badge and can be edited or deleted from the same page. Creating and deleting are recorded in the audit log as `factory.skill.created` and `factory.skill.deleted`. + +A board phase runs a created skill by its name, like any other skill: + +```ts +await factory.upsertBoard( + { + key: 'notes', + name: 'Release notes', + phases: [ + { key: 'queued', name: 'Queued', kind: 'resting', nextPhases: ['writing'] }, + { key: 'writing', name: 'Writing', kind: 'working', runner: { context: 'writer', skill: 'release-notes' }, nextPhases: ['done'] }, + { key: 'done', name: 'Done', kind: 'terminal' }, + ], + }, + // Each project listed must have created `release-notes`; a board for 'all' projects may only run the app's skills. + { projects: [{ orgId, factoryProjectId }] }, +); +``` + +If the app later ships a skill under the same name, the app's skill takes over the name and the Factory's text becomes an edit of it, which **Revert to original** removes. diff --git a/.changeset/code-sdk-core-peer-floor.md b/.changeset/code-sdk-core-peer-floor.md new file mode 100644 index 00000000000..2292e4f00bb --- /dev/null +++ b/.changeset/code-sdk-core-peer-floor.md @@ -0,0 +1,5 @@ +--- +'@mastra/code-sdk': patch +--- + +Fixed `mastracode` crashing on startup after a fresh install. `@mastra/code-sdk` now requires `@mastra/core` 1.84 or newer, the first version with the knowledge scope helpers it imports. Before, npm could install `@mastra/core` 1.83, and `mastracode --help` failed with "does not provide an export named 'encodeKnowledgeScopeId'". diff --git a/.changeset/code-sdk-custom-provider-own-key.md b/.changeset/code-sdk-custom-provider-own-key.md new file mode 100644 index 00000000000..635d7e6107a --- /dev/null +++ b/.changeset/code-sdk-custom-provider-own-key.md @@ -0,0 +1,12 @@ +--- +'@mastra/code-sdk': patch +--- + +Fixed custom OpenAI-compatible providers so they only ever authenticate with the API key saved on the provider itself. + +- A custom provider is no longer given the saved credential of another provider when their names match (for example a custom provider called "OpenAI"). +- A Mastra Gateway model (`mastra/...`) never runs on a custom provider that shares its id, with or without a gateway key. +- Requests to a custom provider no longer follow redirects, so its API key is never sent on to another address. +- A custom provider without an API key now works when sign-in is enabled, instead of failing with a missing credential error. + +If a custom provider in `settings.json` has no `apiKey` and relied on a key you saved for the provider it is named after (for example with `/api-keys`), set `apiKey` on the custom provider itself. diff --git a/.changeset/code-sdk-vendor-scope-encoder.md b/.changeset/code-sdk-vendor-scope-encoder.md new file mode 100644 index 00000000000..6cc518c0830 --- /dev/null +++ b/.changeset/code-sdk-vendor-scope-encoder.md @@ -0,0 +1,5 @@ +--- +'@mastra/code-sdk': patch +--- + +`@mastra/code-sdk` now ships its own copy of the Knowledge scope id encoder instead of importing `encodeKnowledgeScopeId` from `@mastra/core`. If npm installs an older `@mastra/core`, `mastracode` still starts instead of crashing with "does not provide an export named 'encodeKnowledgeScopeId'". A test keeps the copy's output identical to core's. diff --git a/.changeset/cold-birds-swim.md b/.changeset/cold-birds-swim.md new file mode 100644 index 00000000000..7eef8da1e06 --- /dev/null +++ b/.changeset/cold-birds-swim.md @@ -0,0 +1,5 @@ +--- +'@mastra/code-sdk': patch +--- + +Fixed provider safety rejections losing their cause. Errors now show the provider's own wording (for example Anthropic's "Your request was rejected as a result of our safety system") and the request URL, and note that these are often false positives on code or security-like text. diff --git a/.changeset/connect-image-default-sunburst.md b/.changeset/connect-image-default-sunburst.md new file mode 100644 index 00000000000..50e940d9970 --- /dev/null +++ b/.changeset/connect-image-default-sunburst.md @@ -0,0 +1,5 @@ +--- +'@mastra/connect': patch +--- + +Changed the default model of the OpenAI create-image tool from `gpt-image-1` to `gpt-image-2.5-sunburst`. OpenAI retired `gpt-image-1` on October 23, 2026, so calls that omitted `model` were failing. The default is now a model that works again. diff --git a/.changeset/cozy-ways-refuse.md b/.changeset/cozy-ways-refuse.md new file mode 100644 index 00000000000..7cbe9b47776 --- /dev/null +++ b/.changeset/cozy-ways-refuse.md @@ -0,0 +1,13 @@ +--- +'@mastra/core': minor +'@mastra/libsql': minor +'@mastra/pg': minor +--- + +Added `collectionExists(name)` to Factory storage so a domain can tell whether a table already exists before registering it. Supported by `LibSQLFactoryStorage` and `PgFactoryStorage`; it is an optional capability, so other backends keep working unchanged. + +```ts +if (!storage.collectionExists || (await storage.collectionExists('work_items'))) { + await storage.ensureCollections([WORK_ITEMS_SCHEMA]); +} +``` diff --git a/.changeset/create-factory-current-directory.md b/.changeset/create-factory-current-directory.md new file mode 100644 index 00000000000..a131609ba3f --- /dev/null +++ b/.changeset/create-factory-current-directory.md @@ -0,0 +1,10 @@ +--- +'create-factory': patch +--- + +`create-factory` can now set up the Factory in the current directory. When you run it without a project name in an empty directory, the name prompt defaults to that directory: press Enter to use it, or type a name to create a new directory. An existing empty directory can also be passed as the project name. + +```bash +mkdir my-factory && cd my-factory +npx create-factory@latest +``` diff --git a/.changeset/create-factory-tag-flag.md b/.changeset/create-factory-tag-flag.md new file mode 100644 index 00000000000..b07d6d7c4ed --- /dev/null +++ b/.changeset/create-factory-tag-flag.md @@ -0,0 +1,11 @@ +--- +'create-factory': minor +--- + +Added a `--tag ` option to `create-factory`. It pins the scaffolded template's `mastra` and `@mastra/*` dependencies to the exact versions published under that npm dist-tag, so you can try a new Factory on prerelease packages: + +```sh +npx create-factory@latest my-factory --tag alpha +``` + +When the pinned versions include prereleases and the project uses npm, `create-factory` also writes `legacy-peer-deps=true` to the project's `.npmrc`, because npm otherwise rejects the prerelease peer ranges. diff --git a/.changeset/create-factory-tag-lookup-errors.md b/.changeset/create-factory-tag-lookup-errors.md new file mode 100644 index 00000000000..de7a0ad429c --- /dev/null +++ b/.changeset/create-factory-tag-lookup-errors.md @@ -0,0 +1,5 @@ +--- +'create-factory': patch +--- + +`create-factory --tag` now stops before installing when the npm registry lookup for a Mastra package fails, instead of keeping that package's template version and producing a project that mixes release channels. A package that simply has no release under the tag still keeps its template version with a warning. diff --git a/.changeset/cuddly-symbols-laugh.md b/.changeset/cuddly-symbols-laugh.md new file mode 100644 index 00000000000..502f8310dea --- /dev/null +++ b/.changeset/cuddly-symbols-laugh.md @@ -0,0 +1,15 @@ +--- +'@mastra/connect': patch +--- + +The `resourceId` callback on `userConnectRoutes()` now receives the authenticated user as a typed `MastraUser`, the same `user` that agent callbacks such as `tools` receive. You can read the ID without a cast, and the routes and the agent's tools derive the same resource ID from one value. + +```typescript +// Before +userConnectRoutes({ resourceId: ({ user }) => (user as { id: string } | undefined)?.id }); + +// After +userConnectRoutes({ resourceId: ({ user }) => user?.id }); +``` + +`user` is now the normalized user rather than the raw object your auth provider returned. To read provider-specific fields, use `requestContext.get('user')`. diff --git a/.changeset/curly-pillows-argue.md b/.changeset/curly-pillows-argue.md new file mode 100644 index 00000000000..b0121803acc --- /dev/null +++ b/.changeset/curly-pillows-argue.md @@ -0,0 +1,17 @@ +--- +'@mastra/core': patch +--- + +Fixed restart and time travel of workflow runs that contain a `.sleep()` or `.sleepUntil()` without an `id`. When another process restarted or time traveled such a run, the step after the sleep got no input, because each process gave the sleep a different random id. Unnamed sleeps now get the id `sleep__`, where `n` follows the order the sleeps are declared in, so every process agrees. + +Scheduled workflows with an unnamed sleep now have the same definition hash on every instance, so an instance no longer refuses a schedule another instance registered. + +Limits: + +- Runs stored before this version keep their random sleep ids and still won't match after a restart or time travel. +- If the workflow is already registered with a Mastra instance that has a custom `idGenerator` when the sleep is declared, that generator produces the id instead, so a generator that returns random ids still gives each process a different id. +- Adding or removing a sleep changes the ids of the unnamed sleeps after it; pass `{ id }` to keep one fixed: + +```ts +workflow.sleep(5000, { id: 'wait-for-payment' }); +``` diff --git a/.changeset/curvy-nights-bet.md b/.changeset/curvy-nights-bet.md new file mode 100644 index 00000000000..893dd930106 --- /dev/null +++ b/.changeset/curvy-nights-bet.md @@ -0,0 +1,5 @@ +--- +'mastra': patch +--- + +The Factory sidebar now groups sessions by board and shows a second line under each session by default, with when it last changed and its pull request. Turn on **Compact view** or set **Group** to **None** in the sidebar's properties menu to get one line per session or a single list back. Settings you already changed keep their values; the rest follow the new defaults. diff --git a/.changeset/cute-swans-march.md b/.changeset/cute-swans-march.md new file mode 100644 index 00000000000..89ba4b04c4f --- /dev/null +++ b/.changeset/cute-swans-march.md @@ -0,0 +1,6 @@ +--- +'@mastra/libsql': patch +'@mastra/pg': patch +--- + +Fixed factory storage on existing databases after a column is removed from a collection schema. The column is no longer required, so new rows that leave it out are accepted, and the values already stored in it are kept. Previously, LibSQL could also discard such a column's data while rebuilding a table. diff --git a/.changeset/daytona-sdk-package-rename.md b/.changeset/daytona-sdk-package-rename.md new file mode 100644 index 00000000000..332d4f3a82a --- /dev/null +++ b/.changeset/daytona-sdk-package-rename.md @@ -0,0 +1,17 @@ +--- +'@mastra/daytona': patch +--- + +Switched from `@daytonaio/sdk` to `@daytona/sdk`, the new name Daytona publishes its SDK under. The code is identical, so `DaytonaSandbox` behaves the same. If your own code imports `Daytona` or `Image` from `@daytonaio/sdk`, for example to build a snapshot, install `@daytona/sdk` and update the import. + +Before: + +```typescript +import { Daytona, Image } from '@daytonaio/sdk'; +``` + +After: + +```typescript +import { Daytona, Image } from '@daytona/sdk'; +``` diff --git a/.changeset/dry-worlds-sit.md b/.changeset/dry-worlds-sit.md new file mode 100644 index 00000000000..8c8df41fc6b --- /dev/null +++ b/.changeset/dry-worlds-sit.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +The **Activity** sort in the Factory sidebar now orders sessions that share a status by their last update instead of their creation date, the same as **Last updated** does. An older session that was updated since no longer sinks below a newer one that was left alone. diff --git a/.changeset/durable-agent-replay-takeover.md b/.changeset/durable-agent-replay-takeover.md new file mode 100644 index 00000000000..e2c30b11f84 --- /dev/null +++ b/.changeset/durable-agent-replay-takeover.md @@ -0,0 +1,5 @@ +--- +'@mastra/core': patch +--- + +Exclude uncheckpointed durable agent output when replaying a run after an ownership takeover, while retaining previously checkpointed steps. diff --git a/.changeset/durable-recover-processor-errors.md b/.changeset/durable-recover-processor-errors.md new file mode 100644 index 00000000000..4581c7887bb --- /dev/null +++ b/.changeset/durable-recover-processor-errors.md @@ -0,0 +1,5 @@ +--- +'@mastra/core': patch +--- + +Fixed `DurableAgent.recover()` silently continuing a recovered run without its processors or memory. If processor or memory resolution fails during recovery, `recover()` now rejects with `DurableProcessorRebuildError` before calling the model. The run stays recoverable, so calling `recover()` again once the resolver works resumes it with guardrails and message persistence intact. diff --git a/.changeset/e2b-run-as-user-mount-owner.md b/.changeset/e2b-run-as-user-mount-owner.md new file mode 100644 index 00000000000..29eabeee70f --- /dev/null +++ b/.changeset/e2b-run-as-user-mount-owner.md @@ -0,0 +1,30 @@ +--- +'@mastra/e2b': minor +'@mastra/s3': minor +'@mastra/gcs': minor +--- + +E2B sandboxes can run agent commands as a second, unprivileged OS user, and S3 and GCS mounts can name the user that owns their files. + +`E2BSandbox` takes a `user` option. Every command the agent runs — `executeCommand` and background processes alike — runs as that user instead of the template's default user, which has to keep `sudo` because mounting needs it. Without the option, nothing changes. + +`S3Filesystem` and `GCSFilesystem` take an `owner` option, `{ uid, gid }`. It sets the ownership of the files inside the mount, so a command user other than the one that mounts can read and write them. Without it, the mount keeps probing the default user's uid and gid. + +Together, the two options let agent commands run as a user that cannot read the credentials staged for a mount or become root: + +```ts +const workspace = new Workspace({ + mounts: { + '/s3-data': new S3Filesystem({ + bucket: 'my-bucket', + region: 'us-east-1', + owner: { uid: 1001, gid: 1001 }, + }), + }, + sandbox: new E2BSandbox({ user: 'agent' }), +}) +``` + +These options change command identity and mount ownership, not every operation: file tools and other files-API calls still run as the template's default user, which keeps the privileges mounting needs. + +The `user` must already exist in the sandbox template. diff --git a/.changeset/easy-clocks-switch.md b/.changeset/easy-clocks-switch.md new file mode 100644 index 00000000000..8af47245072 --- /dev/null +++ b/.changeset/easy-clocks-switch.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Fixed reopened pull request review sessions loading the pull request's AGENTS.md and CLAUDE.md as trusted instructions. After a review card finished and the server restarted or unloaded the session, a new message in that session read instruction files from the pull request branch. Sessions that ever ran pull request or review work now keep reading instructions from the base branch, or read none when the trusted branch can't be determined. diff --git a/.changeset/eight-buttons-juggle.md b/.changeset/eight-buttons-juggle.md new file mode 100644 index 00000000000..c39fe1bc827 --- /dev/null +++ b/.changeset/eight-buttons-juggle.md @@ -0,0 +1,6 @@ +--- +'@mastra/playground-ui': patch +'mastra': patch +--- + +Central Icons now cover every interface icon in Studio and Factory, and each icon family, such as speech bubbles, bells, folders and settings, uses one consistent shape. diff --git a/.changeset/eight-places-invent.md b/.changeset/eight-places-invent.md new file mode 100644 index 00000000000..4454192beff --- /dev/null +++ b/.changeset/eight-places-invent.md @@ -0,0 +1,18 @@ +--- +'@mastra/playground-ui': minor +--- + +Polished the shared sidebar so it looks the same in every app. + +- The sidebar is 232px wide by default (192px to 340px when dragged) and 60px collapsed. The defaults live in the component and `SIDEBAR_WIDTHS` exports them; pass `minWidth` only when a view needs more room. +- Rows sit 1px apart and 10px from the sidebar's edges, with 8px under the header. Groups sit 14px apart, with titles 4px above their rows, and the first group's title is kept for screen readers only. +- Filled product icons (Agent, Workflow, MCP Server) draw at the same size as the line icons beside them. +- The resize handle and the collapsed logo's toggle appear after a short hover delay, so passing over them doesn't flash them. +- The nav's scrollbar no longer stays on screen after you click a link, and expanding the sidebar onto an open sub-menu no longer moves focus to its Back button. + +`Sidebar.Meter` keeps one layout in both states. It accepts `loading`, which shows the card at its loaded size, and `railValue`, a shorter amount for the rail: + +```tsx + + +``` diff --git a/.changeset/eight-stars-hang.md b/.changeset/eight-stars-hang.md new file mode 100644 index 00000000000..0ead848f3c9 --- /dev/null +++ b/.changeset/eight-stars-hang.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +New Factory databases no longer get the tables that only existed to migrate data from older releases (pre-split cards, the split progress marker, per-member intake settings, the original intake source bindings and their migration log). Databases created by an older release keep those tables and their data, and still migrate them on boot. diff --git a/.changeset/eleven-pears-wave.md b/.changeset/eleven-pears-wave.md new file mode 100644 index 00000000000..801a2c98f21 --- /dev/null +++ b/.changeset/eleven-pears-wave.md @@ -0,0 +1,5 @@ +--- +'@mastra/valkey-streams': patch +--- + +Fixed workflow runs that stayed `running` on Valkey Streams when a worker shut down while one of their steps was still running. Another worker now runs that step again instead of skipping it. diff --git a/.changeset/eleven-rockets-melt.md b/.changeset/eleven-rockets-melt.md new file mode 100644 index 00000000000..5d41ccf9886 --- /dev/null +++ b/.changeset/eleven-rockets-melt.md @@ -0,0 +1,5 @@ +--- +'@mastra/playground-ui': minor +--- + +Opening a Knowledge page now shows it in a panel beside the Pages tree instead of replacing the graph, and the graph stops drawing while the page is open. The page's right column gains a Details list with its scope, last update, author, creation date and version. diff --git a/.changeset/empty-years-fold.md b/.changeset/empty-years-fold.md new file mode 100644 index 00000000000..c32ec110dde --- /dev/null +++ b/.changeset/empty-years-fold.md @@ -0,0 +1,5 @@ +--- +'@mastra/github-signals': patch +--- + +Fixed delivery of authorized review comments and inline findings even when bot summaries change or check status is unknown. Limit comment bursts to ten findings and a counted overflow notice per poll. diff --git a/.changeset/factory-board-rules-page.md b/.changeset/factory-board-rules-page.md new file mode 100644 index 00000000000..0df973ba672 --- /dev/null +++ b/.changeset/factory-board-rules-page.md @@ -0,0 +1,16 @@ +--- +'mastra': minor +--- + +Added a Rules page to every Factory board. It replaces the board's Card moves page and the Factory-wide "Where new cards go" list in Settings, so everything that decides where a board's issues and pull requests go is in one place. + +**Rules page** + +Each event gets its own lane, grouped under Issues and Pull requests, such as "Issue opened", "Issue closed" or "Pull request merged". In each lane, rules are checked top to bottom and the first match wins. The two lanes that file items with no card yet, Issue opened and Pull request opened, show where the board sits in the intake order; an item no rule here takes goes to the next board, and ends up in Not routed if no board takes it. Rules still stored on the old opened event show in both of those lanes, marked "Issue or pull request opened (legacy)". Rules are added and edited in a step-by-step dialog: pick the event, choose which items it applies to, then choose where they go. A card-move rule, on any event other than an item opening, can send cards to another board: pick the board, then the phase. Condition filters include the pull request author's trust, and on label or assignee changes, which label or assignee was added or removed. Rules can be reordered, switched off or deleted. A rule that can never be reached, because a rule above it matches everything, is marked as such. A card-move rule that matched but couldn't move the card, for example because the target phase doesn't take cards, shows how often that happened in the last 30 days, with a link to the latest item. "Test an item" opens the intake tester, which shows where an issue or pull request would go and what every rule answered. Old `/moves` links now open the Rules page. + +**Settings → Intake** + +- **Intake order**: set the order in which boards are offered a new item. Drag rows or use the up and down buttons to try an order, then save or discard it. The page shows whether the order was worked out from your rules or saved, and how many recent cards would land on a different board than they do now. +- **Not routed**: a list of items no board took, loaded a page at a time. Click "Why?" to open the tester on an item and see what each rule answered. Once a rule takes it, click "Route again" to file it. + +The board config page now sums this up in one line, for example "2 rules for new items · Checked 2nd", with a link to the board's rules. The "Send new cards to" control is removed. diff --git a/.changeset/factory-card-actions.md b/.changeset/factory-card-actions.md new file mode 100644 index 00000000000..05d4e1136a2 --- /dev/null +++ b/.changeset/factory-card-actions.md @@ -0,0 +1,31 @@ +--- +'@mastra/factory': minor +--- + +**Pull requests link to their issue's card on their own.** A pull request that closes an issue now links to that issue's unfinished card, whoever opened it and whichever board the card is on. Linking moves nothing by itself: the card gets a `pull_request.opened` event, and the default rule `Trusted pull requests take a waiting issue to Review` moves a waiting card to Review when the pull request's author is trusted. Stored routes that joined pull requests to cards (`joinClosedIssue: true`) are switched off and kept for history. A join route an admin had changed gets a `rule_retired` entry in the intake decision log naming it, since the default rule may not cover what it did. New join routes are refused with `422 join_retired`. + +**Nothing runs on an outside author's pull request until a person picks it.** An outsider's linked pull request never becomes the card's working pull request on its own, its pushes and review requests don't re-review it or move the card, and its comments don't reach the card's sessions. Its merge or close still moves the card. A person picks it with the new endpoint: + +```bash +curl -X PUT "$FACTORY_URL/web/factory/projects/$PROJECT/work-items/$CARD/working-pull-request" \ + -H 'content-type: application/json' -d '{ "pullRequest": 17, "expectedRevision": 4 }' +``` + +When the working pull request closes unmerged, the card falls back to its first trusted open pull request (else a trusted merged one), never an outsider's. + +**Card-move rules can send a card to another board.** A route that moves existing cards can set `moveToBoardKey` to send the card to a phase on another board. The card keeps its id, the old phase's sandbox stops and the target phase's runner starts. + +**Rules test pull request trust separately.** `item.trusted` replaces `author.trusted` (rules saved with the old name still work), and the new `pullRequest.trusted` tests the event's pull request author, or the author of the card's working pull request. + +```json +{ "field": "pullRequest.trusted", "operator": "equals", "value": true } +``` + +**Breaking:** `newestOpenPullRequestNumber` is no longer exported from `@mastra/factory/boards`. Use `workingPullRequest(item)` with `pullRequestSourceNumber` to get the pull request a card works on: + +```ts +import { pullRequestSourceNumber, workingPullRequest } from '@mastra/factory/boards'; + +const working = workingPullRequest(card); +const number = working ? pullRequestSourceNumber(working) : undefined; +``` diff --git a/.changeset/factory-checkout-plan-preview.md b/.changeset/factory-checkout-plan-preview.md new file mode 100644 index 00000000000..73715bbc226 --- /dev/null +++ b/.changeset/factory-checkout-plan-preview.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Fixed Factory plan previews when the plan file lives inside a repository checkout in a multi-repository session. The approval card now resolves the checkout's `.artifacts` root, and the session workspace routes can list and read approved plan files there without bypassing symlink and ignored-file guards. diff --git a/.changeset/factory-connect-tool-list-ui.md b/.changeset/factory-connect-tool-list-ui.md new file mode 100644 index 00000000000..b538471299f --- /dev/null +++ b/.changeset/factory-connect-tool-list-ui.md @@ -0,0 +1,5 @@ +--- +'mastra': patch +--- + +The Factory **Settings › Tools** page shows how many tools sessions get from each Mastra Connect connection. Expand one to see its tools with their descriptions, which ones ask for approval, and which ones Factory leaves out. With a `tools` option, a connection the code doesn't use shows no tools, and the code's other tools are listed under **Other tools from code**. diff --git a/.changeset/factory-connect-tool-list.md b/.changeset/factory-connect-tool-list.md new file mode 100644 index 00000000000..16427bbab33 --- /dev/null +++ b/.changeset/factory-connect-tool-list.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +**Settings › Tools** can now list each Mastra Connect connection's tools. The new `GET /web/integrations/platform/connect-tools/tools` route resolves the tools a session started by the signed-in user would get: Factory's default Connect tools, or what the `tools` option returns. It marks tools that ask for approval and lists the default tools Factory leaves out because they delete or archive. When the tools can't be resolved, it answers 502 `tools_unavailable` with the reason. diff --git a/.changeset/factory-connect-tools-panel-ui.md b/.changeset/factory-connect-tools-panel-ui.md new file mode 100644 index 00000000000..71e9c55f044 --- /dev/null +++ b/.changeset/factory-connect-tools-panel-ui.md @@ -0,0 +1,5 @@ +--- +'mastra': patch +--- + +The Factory **Settings › Tools** page lists a project's Mastra Connect connections when the Factory sets its session tools in code, with a note that the `tools` option decides which of their tools sessions get. When Connect isn't set up, it names the missing Platform credentials or `MASTRA_PROJECT_ID` (#30579). diff --git a/.changeset/factory-connect-tools-panel.md b/.changeset/factory-connect-tools-panel.md new file mode 100644 index 00000000000..310150be8b7 --- /dev/null +++ b/.changeset/factory-connect-tools-panel.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Fixed **Settings › Tools** saying Mastra Connect tools are off when a Factory sets the `tools` option, even when that option uses Connect tools (#30579). The page now lists the Platform project's connections whenever the Factory has Platform credentials and `MASTRA_PROJECT_ID`, and says that session tools come from code. When either one is missing, the page names it instead of listing every possible cause. diff --git a/.changeset/factory-duplicate-plan-card.md b/.changeset/factory-duplicate-plan-card.md new file mode 100644 index 00000000000..df569a85410 --- /dev/null +++ b/.changeset/factory-duplicate-plan-card.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Fixed the Factory chat showing the same tool call twice, such as two identical plan cards with their own Approve and Reject buttons. When the server saved a run as several steps, a later step that only held tool calls appeared as a second turn the next time the page refreshed the transcript. Every saved step now attaches to the live turn it belongs to. diff --git a/.changeset/factory-health-metrics.md b/.changeset/factory-health-metrics.md new file mode 100644 index 00000000000..a6eacb960e3 --- /dev/null +++ b/.changeset/factory-health-metrics.md @@ -0,0 +1,14 @@ +--- +'@mastra/factory': minor +--- + +Added opt-in health metrics to Factory, sent through `mastra.metrics`. Pick the groups you want, since every record counts towards observability usage: + +```ts +new MastraFactory({ + // ... + metrics: { groups: ['process', 'postgres', 'redis', 'sandbox', 'intake'] }, // or 'all' +}); +``` + +Or set `FACTORY_METRICS=all` (or a list like `sandbox,intake`). `FACTORY_METRICS_INTERVAL_MS` (default 60s, minimum 15s) and `FACTORY_METRICS_MAX_PER_MIN` (default 500) tune how often records are sent and cap their volume. Metrics are named `mastra_factory_*` and labeled with `service` (`api`, `worker` or `all`) so split deployments can be told apart. diff --git a/.changeset/factory-intake-order-cli.md b/.changeset/factory-intake-order-cli.md new file mode 100644 index 00000000000..38786a726ed --- /dev/null +++ b/.changeset/factory-intake-order-cli.md @@ -0,0 +1,13 @@ +--- +'mastra': patch +--- + +Added `mastra api` commands for Factory intake order and Not routed items: read and set a project's intake order or evaluator, list items no board took, and route one again. + +```sh +mastra api factory intake-order get +mastra api factory intake-order set '{"boardKeys":["docs","work"]}' +mastra api factory intake-order set '{"evaluator":"intake-order"}' +mastra api factory not-routed list '{"limit":50}' +mastra api factory not-routed route-again +``` diff --git a/.changeset/factory-intake-order.md b/.changeset/factory-intake-order.md new file mode 100644 index 00000000000..46b198989df --- /dev/null +++ b/.changeset/factory-intake-order.md @@ -0,0 +1,37 @@ +--- +'@mastra/factory': minor +--- + +Added intake order: each board now owns its intake rules (up to 100 per board), and a project keeps a separate order in which its boards are asked to take a new item. Under the new evaluator an item no board's rules take is recorded as Not routed instead of landing on a default board, and an admin can route it again once a rule is fixed. + +**Which projects use it** + +Projects created from this release on use the new evaluator. Existing projects keep the old one until an admin switches them: + +```sh +mastra api factory intake-order set '{"evaluator":"intake-order"}' +``` + +To force one evaluator on every project (for a rollout or tests), set the `intake` option or `FACTORY_INTAKE_EVALUATOR` (`intake-order` or `route-list`) the same on every replica: + +```ts +const factory = new MastraFactory({ + intake: { evaluator: 'intake-order' }, +}); +``` + +A project falls back to the old evaluator only when its setting was read and is empty; while it can't be read, arrivals wait and retry and a card created without a board is refused with `intake_board_required`. + +During a rolling deploy, replicas still on an older release decide every project by the old evaluator, so a new project's items can be routed that way until all replicas run this release. + +**Before you switch** + +Factory derives each project's intake order from its current rules, and follows your rule edits until you set the order yourself. `GET /web/factory/projects/:id/intake-order` runs both evaluators over the newest 200 items against the order in force and reports how many would land on a different board and how many no board would take, so you can fix rules first. + +**Also new** + +- `PUT /web/factory/projects/:id/intake-order` sets the order, the project's evaluator, or both; `GET` reports the evaluator in use and where it came from (`evaluatorSource`). +- `GET /web/factory/projects/:id/intake/not-routed` lists items no board took, oldest first, a page at a time (`limit`, `cursor`); `POST .../intake/not-routed/:decisionId/route-again` files one by intake order once a rule takes it. +- Intake rules can be listed and reordered per board with `boardKey`. +- Deleting a board deletes its intake rules, each audited. +- Under the new evaluator, a card created without a board that no board takes is refused with `intake_board_required` (the `factory_create_work_item` tool now accepts a `board` for this), and moving a rule to another board is refused with `intake_route_board_fixed`. diff --git a/.changeset/factory-intake-skipped-rules.md b/.changeset/factory-intake-skipped-rules.md new file mode 100644 index 00000000000..1a570048f28 --- /dev/null +++ b/.changeset/factory-intake-skipped-rules.md @@ -0,0 +1,8 @@ +--- +'@mastra/factory': minor +'mastra': patch +--- + +Added `GET /web/factory/projects/:id/intake/skipped`. For each card-move rule that matched an event but was skipped because its target couldn't take the card, it returns how often that happened in the last 30 days and the newest skip. + +Also added `mastra api factory intake skipped ` to read the same counts from the CLI. diff --git a/.changeset/factory-interactive-wakes-cli.md b/.changeset/factory-interactive-wakes-cli.md new file mode 100644 index 00000000000..76c8bf851eb --- /dev/null +++ b/.changeset/factory-interactive-wakes-cli.md @@ -0,0 +1,23 @@ +--- +'mastra': patch +--- + +`mastra api factory decision queue` now returns each run's `lane`, `queuedByLane`, and the reply reserve in `slots.interactive`. A waiting reply from a person is listed before the automated runs, and `position` counts within the run's lane: + +```bash +mastra api factory decision queue +``` + +```json +{ + "slots": { "scope": "server", "inUse": 10, "cap": 10, "interactive": { "inUse": 2, "cap": 2 } }, + "queuedCount": 2, + "queuedByLane": { "automated": 1, "interactive": 1 }, + "queued": [ + { "lane": "interactive", "position": 1, "type": "sendMessage" }, + { "lane": "automated", "position": 1, "type": "invokeSkill" } + ] +} +``` + +The board's run queue lists waiting replies from people first, under their own heading, and shows how many reply slots are in use. diff --git a/.changeset/factory-interactive-wakes.md b/.changeset/factory-interactive-wakes.md new file mode 100644 index 00000000000..5484edccafe --- /dev/null +++ b/.changeset/factory-interactive-wakes.md @@ -0,0 +1,18 @@ +--- +'@mastra/factory': minor +--- + +**A person's reply no longer waits behind automated runs.** When a trusted collaborator comments on, or reviews, a card's GitHub pull request or issue, the session wakes even while automated runs hold every run slot. Each server process keeps 2 slots for these replies on top of `dispatcher.maxInFlight`, claims them first, and lets them borrow a free automated slot. Bot accounts, untrusted authors, Factory's own comments and activity from other sources still wait as automated runs. + +Change the reserve with `dispatcher.maxInteractiveInFlight` (or `MASTRACODE_DISPATCH_MAX_INTERACTIVE_IN_FLIGHT`); `0` keeps no reserve: + +```ts +const factory = new MastraFactory({ + storage, + dispatcher: { maxInFlight: 10, maxInteractiveInFlight: 2 }, +}); +``` + +With the defaults a process holds up to 12 run slots. `GET /web/factory/projects/:id/run-queue` adds a `lane` to each run, `queuedByLane`, and `slots.interactive`, and lists waiting replies before automated runs. A run's `position` now counts within its lane, so a waiting reply and the oldest automated run are both `1`. The other fields keep their meaning; `slots.inUse` counts automated slots, including any a reply borrowed. + +GitHub rule actors now carry `human: true` when GitHub reports the sender as a user. diff --git a/.changeset/factory-onboarding-check-align.md b/.changeset/factory-onboarding-check-align.md new file mode 100644 index 00000000000..7f023695c77 --- /dev/null +++ b/.changeset/factory-onboarding-check-align.md @@ -0,0 +1,5 @@ +--- +'mastra': patch +--- + +Fixed the checkmark on a finished Factory onboarding step sitting 12px right of the step numbers below it. diff --git a/.changeset/factory-onboarding-code-host-issues.md b/.changeset/factory-onboarding-code-host-issues.md new file mode 100644 index 00000000000..66a9f9eb39a --- /dev/null +++ b/.changeset/factory-onboarding-code-host-issues.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Factory onboarding's Work step now lists the GitHub repository or GitLab project chosen in the first step as an issue source, switched on by default. Its open issues start feeding the Work board as soon as setup finishes, and the switch turns them off again (GitLab projects are routed to the new Factory so the board picks them up). diff --git a/.changeset/factory-personal-custom-providers.md b/.changeset/factory-personal-custom-providers.md new file mode 100644 index 00000000000..caa1e1fd24b --- /dev/null +++ b/.changeset/factory-personal-custom-providers.md @@ -0,0 +1,27 @@ +--- +'@mastra/factory': minor +--- + +Added personal custom providers. A custom OpenAI-compatible endpoint is now saved either for yourself or for your organization, the same way provider API keys are. + +- **Personal endpoints** are visible only to you and are used by your personal sessions. +- **Organization endpoints** are used by work that runs on the organization's credentials. Adding, editing or removing one now requires an organization admin. +- Custom endpoints are added from the **Add provider** dialog and listed with the other providers. The separate "Custom providers" section is gone. +- Editing an endpoint without retyping its API key keeps the saved key, as long as the URL stays on the same host. Moving it to another host asks for the key again. +- Adding an endpoint under a name that is already in use is refused instead of replacing the existing one. So are names reserved for a built-in provider, its sign-in, or the Mastra Gateway (for example "OpenAI", "OpenAI Codex" or "Mastra Gateway"). +- A Factory hosted on the Mastra platform only calls custom endpoints at a public HTTPS address. Saving one on plain HTTP, `localhost`, a private network or the cloud metadata address is refused with a message explaining why. Local and self-hosted Factories can still use endpoints on their own machine or network, such as Ollama or vLLM. + +**Before you upgrade** + +- Organization endpoints no longer apply to personal sessions. Add the endpoint again as a personal one to keep using it there. +- On a hosted Factory, endpoints saved earlier on a local or plain-HTTP address are marked "URL not allowed" and their models are no longer offered. Edit them to a public HTTPS address. +- Review your organization's endpoints. One named like a built-in provider (for example "OpenAI") still takes over that provider's models; remove it or rename it. + +The custom provider routes take a `scope` (`user` by default, or `org`). Saving with `previousId` edits that provider; saving without it adds one: + +```http +POST /web/config/custom-providers +{ "name": "My gateway", "url": "https://llm.example.com/v1", "models": ["my-model"], "scope": "org" } + +DELETE /web/config/custom-providers/my-gateway?scope=org +``` diff --git a/.changeset/factory-phase-session-owner.md b/.changeset/factory-phase-session-owner.md new file mode 100644 index 00000000000..9179d964640 --- /dev/null +++ b/.changeset/factory-phase-session-owner.md @@ -0,0 +1,35 @@ +--- +'@mastra/factory': patch +--- + +Fixed who owns the sessions a Factory card runs in, and who can approve what they wait on. + +**Who owns a card's phase session** + +- In a Factory that runs card work on the organization's model keys (the `factory` and `hybrid` credential settings), every new phase session now belongs to the Factory itself and uses the organization's keys and the Factory's default model. That holds whoever moved the card: a person, an agent, a webhook or a rule. Before, it ran as whoever connected the repository, or as the person who approved the move. +- The person who moved or approved the card stays on record as the one who did it. When they move a card from their own session, that session follows the card, so it hears when the phase waits on someone and can answer from there. +- If the organization has neither a model key nor a provider of its own, the run stops with a clear "add an organization key or provider" message and is not tried again on its own. Add one, then press Retry on the card. +- In a Factory on personal credentials there are no organization keys, so a phase runs as the person who moved or approved the card (or whose session's agent moved it), and otherwise as the person who created the Factory. + +Sessions that already exist keep their owner. + +**Approving a waiting tool call** + +- The person who asked for the work, and anyone whose session follows the card, can approve or decline any tool call the phase session is waiting on, a plan or any other tool that asks first. They can do it from their own session in the sidebar, with `factory_answer_approval`, or over HTTP: + + ```http + POST /web/user-sessions/:sessionId/parked-approval + { "decision": "approve" } + ``` + + Add `toolCallId` when the session waits on more than one approval. Questions that need a typed answer are still answered in the session. + +- A session following the card is told when the phase session waits on a yes or no, for a plan or any other tool, with the call to answer it. In the chat that notice now has Approve and Decline buttons and a link to open the waiting session; a notice about a question that needs a typed answer has the link only. +- Nobody is asked to approve what a phase approves itself: when a phase's `exitTool` has `autoApprove` and the card matches `autoApproveWhen`, the run carries on without a notice. This now works for any exit tool that pauses for a yes or no, not only `submit_plan`. +- When two people answer the same call at once, one answer is used and the other is told the call was already answered. +- The run then carries on as the phase session's owner. Before, it carried on as whoever answered, and could fail with "the request has no authenticated user". +- Following moves with a session: after a hand-over, the session's new owner can answer and the old one cannot. + +**Sidebar** + +A card's phase sessions now show under the session that asked for the work when child sessions are revealed, marked "run by Factory" when the Factory owns them, and that session shows "waiting on you", with Approve and Decline in its menu, while one of them waits on the viewer. diff --git a/.changeset/factory-pr-joins-external-card.md b/.changeset/factory-pr-joins-external-card.md new file mode 100644 index 00000000000..b89301d77a5 --- /dev/null +++ b/.changeset/factory-pr-joins-external-card.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Fixed a pull request Factory opened for a card whose issue lives in Jira, Linear or incident.io getting a card of its own on GitHub. The pull request now attaches to that card and moves it to Review, as it already does on GitLab, so the work is no longer tracked on two cards while it is being reviewed. Fixes [#30358](https://github.com/mastra-ai/mastra/issues/30358). \ No newline at end of file diff --git a/.changeset/factory-preferences-in-my-account.md b/.changeset/factory-preferences-in-my-account.md new file mode 100644 index 00000000000..c269b56211f --- /dev/null +++ b/.changeset/factory-preferences-in-my-account.md @@ -0,0 +1,5 @@ +--- +'mastra': patch +--- + +Factory **Settings** now shows theme and completion sound on **My account**, next to your profile and log out, instead of on a separate **Preferences** page. Settings opens on **My account**, and old Preferences links go there. diff --git a/.changeset/factory-pull-request-reopen.md b/.changeset/factory-pull-request-reopen.md new file mode 100644 index 00000000000..1ac898c06f4 --- /dev/null +++ b/.changeset/factory-pull-request-reopen.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Fixed reopened pull requests showing as closed in Factory. Reopening a GitHub pull request now marks it open again on every card that holds it: its own card and the issue card that links it. Reopening a GitLab merge request now does the same on the merge request's own card. diff --git a/.changeset/factory-recent-repos-picker.md b/.changeset/factory-recent-repos-picker.md new file mode 100644 index 00000000000..0ab3baa1d6d --- /dev/null +++ b/.changeset/factory-recent-repos-picker.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Fixed the repository picker failing with "Failed to list repos (500)" for GitHub accounts with hundreds of repositories. The picker now opens on the 8 most recently pushed repositories and searches GitHub by name once you start typing, instead of loading every repository up front. `/web/github/repos` accepts a `limit` and returns repositories most recently pushed first. diff --git a/.changeset/factory-remove-provider-list-routes.md b/.changeset/factory-remove-provider-list-routes.md new file mode 100644 index 00000000000..857d479fed8 --- /dev/null +++ b/.changeset/factory-remove-provider-list-routes.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Removed Factory server routes that nothing calls anymore. The board and search stopped reading provider issue and pull request lists, so `GET /web/github/projects/:id/issues`, `GET /web/github/projects/:id/prs`, `GET /web/gitlab/issues`, `GET /web/gitlab/projects/:id/prs`, `GET /web/linear/issues`, `GET /web/jira/issues` and `GET /web/incidentio/issues` are gone. Also removed the unused `GET /web/github/projects/:id/commits` and the legacy `GET`/`POST /web/github/projects/:id/settings` (use `/web/source-control/projects/:id/settings`). Single issue and pull request routes, webhooks, sign-in and session routes are unchanged. diff --git a/.changeset/factory-run-queue-cli.md b/.changeset/factory-run-queue-cli.md new file mode 100644 index 00000000000..66b3fb32b69 --- /dev/null +++ b/.changeset/factory-run-queue-cli.md @@ -0,0 +1,9 @@ +--- +'mastra': patch +--- + +Added `mastra api factory decision queue`, which lists a Factory project's automated runs waiting for a run slot, oldest first, and the runs holding one. + +```bash +mastra api factory decision queue +``` diff --git a/.changeset/factory-run-queue.md b/.changeset/factory-run-queue.md new file mode 100644 index 00000000000..e86387183a2 --- /dev/null +++ b/.changeset/factory-run-queue.md @@ -0,0 +1,18 @@ +--- +'@mastra/factory': minor +--- + +**Lower default run cap** + +A Factory server now runs at most 10 automated agent runs at once, down from 25. Runs past the cap wait their turn instead of all starting together. Raise the cap with `dispatcher.maxInFlight`, or the `MASTRACODE_DISPATCH_MAX_IN_FLIGHT` environment variable on a deployed server. The cap applies to each server process, not to the whole deployment. + +```ts +new MastraFactory({ + storage, + dispatcher: { maxInFlight: 25 }, +}); +``` + +**See the run queue on the board** + +The board now shows how many automated runs are waiting for a free slot. Click the indicator to see each waiting automated run, oldest first, with its card, and open the card from the list. A waiting card says `Queued (#3)` instead of `Starting an automated run…`. The list and card positions cover the oldest 50 waiting runs; the count always includes every one. The same data is available from `GET /web/factory/projects/:id/run-queue`. diff --git a/.changeset/factory-score-storage-option.md b/.changeset/factory-score-storage-option.md new file mode 100644 index 00000000000..b321fbd4b90 --- /dev/null +++ b/.changeset/factory-score-storage-option.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Allow Factory hosts to pass `scorers` to the mounted Mastra Code agent. No scorers are registered by default; the existing `disableScoreStorage` option remains available for hosts that opt into scorer results. diff --git a/.changeset/factory-server-gateway-key.md b/.changeset/factory-server-gateway-key.md new file mode 100644 index 00000000000..54fdd7de8e8 --- /dev/null +++ b/.changeset/factory-server-gateway-key.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +A Factory whose server already has a Mastra Gateway key, such as the one the Mastra platform adds to a deploy, now shows the gateway as connected and no longer offers the "Connect Mastra Gateway" button. It uses the server's key and does not create a second one. diff --git a/.changeset/factory-session-stage-bar.md b/.changeset/factory-session-stage-bar.md new file mode 100644 index 00000000000..87d8bedce20 --- /dev/null +++ b/.changeset/factory-session-stage-bar.md @@ -0,0 +1,29 @@ +--- +'mastra': patch +--- + +Improved Factory card sessions: the card's stage, links, changes and files now sit in one place beside the conversation. + +**Stage bar** + +The session header shows the card's phase, with arrows to the nearest phase it can move to and a menu of every allowed move. A move that can't happen says why. The breadcrumb is gone: the sidebar names the session and the panel names the card. + +**Session panel** + +The panel runs from the top of the page beside the conversation, which keeps its width: when room runs out, the panel narrows, then folds into the header. Its overview lists the card's source and description, the workspace branch and pull request, the changed files, the pull requests the work opened, related cards, and a timeline of the card's moves. Pull request links now show once, here. Opening the panel doesn't re-render the conversation, and its text doesn't rewrap while the panel opens, narrows or folds. + +**Go to file** + +Go to file searches every file in the workspace, not only folders already opened, and ranks changed files first. The file tree marks changed files and the file viewer numbers its lines. + +**Consistency fixes** + +- A pull request's status icon follows one rule on the board, in the sidebar and in the panel, and GitLab merge request cards show it too. +- Links name what they point at, such as **PR #202** or **Issue #42**. +- Phase names follow the card's own board everywhere, including custom boards. +- A finished pull request card whose pull request is still open offers **Re-review**. +- A section that can't load says so instead of looking empty. + +Search now sits only in the sidebar, on phones too. Cmd/Ctrl+K still opens it. + +The sidebar no longer asks for each session's pull request status every 5 seconds. It reads the status again when the board's live feed reports a change. diff --git a/.changeset/factory-stale-notification-binding.md b/.changeset/factory-stale-notification-binding.md new file mode 100644 index 00000000000..d20ae8c2d5b --- /dev/null +++ b/.changeset/factory-stale-notification-binding.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Deliver Factory notifications when their bound session no longer exists, including concurrent notifications. Notifications for a role that has been handed off remain suppressed. diff --git a/.changeset/factory-working-pull-request-cli.md b/.changeset/factory-working-pull-request-cli.md new file mode 100644 index 00000000000..86c7e2ad70b --- /dev/null +++ b/.changeset/factory-working-pull-request-cli.md @@ -0,0 +1,9 @@ +--- +'mastra': patch +--- + +Added `mastra api factory work-item working-pull-request` to pick which of a card's linked pull requests its sessions work on. + +```sh +mastra api factory work-item working-pull-request '{"pullRequest":42,"expectedRevision":3}' +``` diff --git a/.changeset/factory-workspace-file-index.md b/.changeset/factory-workspace-file-index.md new file mode 100644 index 00000000000..602d10ac7a1 --- /dev/null +++ b/.changeset/factory-workspace-file-index.md @@ -0,0 +1,7 @@ +--- +'@mastra/factory': patch +--- + +Added a file index for a session's workspace, so **Go to file** in the session panel finds any file the file tree can open by name, not only files in folders already opened. In a multi-repository session that includes files at the workspace root, such as saved plans. Files the repository ignores, nested repositories, and links that don't lead to a readable file in the workspace are left out. In a very large repository the list stops at a size limit, and in a multi-repository session a checkout that can't be read is skipped; either way the list says that it is partial. + +Pull request subscriptions from GitHub and GitLab now include when each one last changed. The session panel uses it to show the most recent state of a pull request when the card and the subscription disagree. diff --git a/.changeset/fetch-with-retry-wait-delay.md b/.changeset/fetch-with-retry-wait-delay.md new file mode 100644 index 00000000000..9d484ab3784 --- /dev/null +++ b/.changeset/fetch-with-retry-wait-delay.md @@ -0,0 +1,5 @@ +--- +'@mastra/core': patch +--- + +Retries in `fetchWithRetry` now wait through the shared retry delay helper. Retry timing and abort behaviour are unchanged. diff --git a/.changeset/fine-comics-change.md b/.changeset/fine-comics-change.md new file mode 100644 index 00000000000..1c17c5e2d0e --- /dev/null +++ b/.changeset/fine-comics-change.md @@ -0,0 +1,17 @@ +--- +'@mastra/core': minor +--- + +Added a workflow recovery loop. A default-engine workflow run whose instance crashed is now restarted without waiting for another instance to boot (#28712). + +`startWorkers()` starts the loop on an instance that runs the orchestration worker. Every `recovery.workflowScanIntervalMs` (60 seconds by default, give or take a fifth), it restarts the default-engine runs that stopped, by the same rule as `restartAllActiveWorkflowRuns()`. A crashed instance's run is restarted at the first pass after its lease (`MASTRA_AGENT_THREAD_LEASE_TTL_MS`, 15 seconds by default) expired and `recovery.workflowGraceMs` passed, so within about one scan interval of that. + +Instances that share a storage adapter elect one loop leader through a lease row in storage, and only the leader's loop lists runs. The leader keeps the role until its `stopWorkers()` or `shutdown()` hands it back, or its lease expires after a crash. The leader applies to the loop only: `restartAllActiveWorkflowRuns()` at boot still restarts each instance's own stopped default-engine runs. The loop recovers only the workflows the leader registers, and a run it restarts executes on the leader. + +```ts +const mastra = new Mastra({ + recovery: { workflowScanIntervalMs: 30_000 }, +}); +``` + +The loop never restarts evented runs, and doesn't run when `recovery.workflows` is `'off'` or on a storage adapter without run-ownership support. `restartAllActiveWorkflowRuns()` no longer schedules a check of its own for runs it found live or in their grace period; the loop looks at them again. diff --git a/.changeset/fine-cooks-end.md b/.changeset/fine-cooks-end.md new file mode 100644 index 00000000000..e731170ba50 --- /dev/null +++ b/.changeset/fine-cooks-end.md @@ -0,0 +1,5 @@ +--- +'@mastra/observability': patch +--- + +Clamp reversed live span timestamps to zero duration so exporters receive completion events. Reject client telemetry with reversed timestamps or negative execution durations. diff --git a/.changeset/flat-jokes-allow.md b/.changeset/flat-jokes-allow.md new file mode 100644 index 00000000000..0849a9f8130 --- /dev/null +++ b/.changeset/flat-jokes-allow.md @@ -0,0 +1,5 @@ +--- +'@mastra/code-sdk': patch +--- + +Fixed scheduled and notification runs pausing every tool call for approval when YOLO is off. These runs now follow the woken thread's own permission rules, so allowed tools run without pausing. On regular agents, independent tool calls run concurrently. Durable and evented agents still run them one at a time unless YOLO is on. diff --git a/.changeset/floppy-suns-flow.md b/.changeset/floppy-suns-flow.md new file mode 100644 index 00000000000..d6065e8ac61 --- /dev/null +++ b/.changeset/floppy-suns-flow.md @@ -0,0 +1,11 @@ +--- +'@mastra/factory': patch +'mastra': patch +--- + +Added `mastra api factory intake dry-run` and `mastra api factory intake test` to check a Factory project's intake rules against real items without filing anything. + +```sh +mastra api factory intake dry-run '{"order":["docs","work"]}' +mastra api factory intake test '{"url":"https://github.com/acme/app/issues/12"}' +``` diff --git a/.changeset/flush-diff-lines.md b/.changeset/flush-diff-lines.md new file mode 100644 index 00000000000..c4411d48629 --- /dev/null +++ b/.changeset/flush-diff-lines.md @@ -0,0 +1,5 @@ +--- +'@mastra/playground-ui': patch +--- + +`CodeDiff` with a file header now shows its lines flush against the header and the card's bottom edge, so stacked diffs in a `CodeDiffList` read like a pull request with no blank band above the first line or below the last. The horizontal scrollbar only takes room when lines overflow, and none on platforms with overlay scrollbars. Diffs without a header keep their padding. diff --git a/.changeset/forty-toes-nail.md b/.changeset/forty-toes-nail.md new file mode 100644 index 00000000000..b9583370341 --- /dev/null +++ b/.changeset/forty-toes-nail.md @@ -0,0 +1,5 @@ +--- +'@mastra/libsql': patch +--- + +Fixed workers failing to start when several of them upgrade the same libSQL database at once. A worker that finds a missing column already added by another worker now continues instead of failing `init` with `duplicate column name`. diff --git a/.changeset/frank-ants-flow.md b/.changeset/frank-ants-flow.md new file mode 100644 index 00000000000..8f6b3ed2ff2 --- /dev/null +++ b/.changeset/frank-ants-flow.md @@ -0,0 +1,23 @@ +--- +'@mastra/core': minor +--- + +Evented workflows from `@mastra/core/workflows/evented` now accept the experimental `storageVersion: 2` option. Before, setting it on an evented workflow threw. On version 2, each step's message carries only the previous step's result and the state changes, and the engine loads the rest from storage. In an `EventedAgent` run with 16 tool calls on `@mastra/pg`, published messages fell from 98 MB to 11 MB, storage writes from 75 MB to 3.1 MB, and run time from 3.9 s to 2.7 s. + +```ts +const workflow = createEventedWorkflow({ + id: 'my-workflow', + inputSchema, + outputSchema, + options: { storageVersion: 2 }, +}); +``` + +As on the default engine, `steps` on a version 2 run's result is an async function, which `onFinish` and `onError` receive too: + +```ts +const result = await run.start({ inputData }); +const steps = await result.steps(); +``` + +On both storage versions, a nested run's messages no longer carry a copy of the parent run's step graph. On version 1, this cut the messages an agent run with 16 tool calls publishes by more than a quarter. diff --git a/.changeset/full-humans-glow.md b/.changeset/full-humans-glow.md new file mode 100644 index 00000000000..0bf96abe010 --- /dev/null +++ b/.changeset/full-humans-glow.md @@ -0,0 +1,5 @@ +--- +'@mastra/core': patch +--- + +Background task lease tests can now run with a lease shorter than 3 seconds through an internal test-only setting, so lease-expiry tests finish in milliseconds instead of seconds. The supported 3-second minimum lease and all default timings are unchanged. diff --git a/.changeset/funky-bears-know.md b/.changeset/funky-bears-know.md new file mode 100644 index 00000000000..ca58b55c9a4 --- /dev/null +++ b/.changeset/funky-bears-know.md @@ -0,0 +1,9 @@ +--- +'@mastra/factory': patch +--- + +Reduced the work the Factory server does to keep the session sidebar and board up to date, and fixed session latency timestamps on LibSQL. + +- Projects without a linked repository no longer rebuild their session list on every sidebar poll. +- Session activity now sorts only the cards that are running, waiting or held by a session, instead of every card on the board. +- A session's first materialize, first message and first command times are now recorded once when several Factory processes share one LibSQL database, so a later write no longer replaces the first recorded time. diff --git a/.changeset/funky-jobs-carry.md b/.changeset/funky-jobs-carry.md new file mode 100644 index 00000000000..516ec837d56 --- /dev/null +++ b/.changeset/funky-jobs-carry.md @@ -0,0 +1,7 @@ +--- +'@mastra/mcp-apps-components': patch +'@mastra/playground-ui': patch +'mastra': patch +--- + +Interface icons now use Central's Medium chevrons, which match the size of the icons around them, and one consistent shape for speech bubbles (Chat Bubble 7), thumbs up and down, and the settings gear. Central Icons are updated to 1.2.44. diff --git a/.changeset/fuzzy-apes-warn.md b/.changeset/fuzzy-apes-warn.md new file mode 100644 index 00000000000..0a9acdac660 --- /dev/null +++ b/.changeset/fuzzy-apes-warn.md @@ -0,0 +1,5 @@ +--- +'@mastra/core': patch +--- + +Updated the bundled AI SDK provider utilities to the latest patch releases of each supported version (`@ai-sdk/provider-utils` 4.0.66 and 5.0.81, `@ai-sdk/provider` 4.0.38). diff --git a/.changeset/gateway-live-chat-catalog.md b/.changeset/gateway-live-chat-catalog.md new file mode 100644 index 00000000000..35f26f6746a --- /dev/null +++ b/.changeset/gateway-live-chat-catalog.md @@ -0,0 +1,5 @@ +--- +'@mastra/core': patch +--- + +Fixed Gateway v2 deployments showing models they cannot use. Studio now lists chat models from the connected Gateway's live model catalog. diff --git a/.changeset/gateway-v2-memory-routing.md b/.changeset/gateway-v2-memory-routing.md new file mode 100644 index 00000000000..b6ace622726 --- /dev/null +++ b/.changeset/gateway-v2-memory-routing.md @@ -0,0 +1,5 @@ +--- +'@mastra/server': patch +--- + +Fixed Gateway v2 deployments calling the Gateway v1 memory API. Studio now uses the agent's own memory configuration when Gateway v2 is selected. diff --git a/.changeset/great-bushes-smell.md b/.changeset/great-bushes-smell.md new file mode 100644 index 00000000000..3f4ffe46ced --- /dev/null +++ b/.changeset/great-bushes-smell.md @@ -0,0 +1,5 @@ +--- +'@mastra/memory': patch +--- + +`recall()` now only returns messages from the requested thread or resource, even if the vector store returns results outside its filter or labels them with the wrong thread or resource. `searchMessages()` now skips observation results whose thread or resource metadata is outside the requested scope, even if the vector store ignores its filter. diff --git a/.changeset/grumpy-words-move.md b/.changeset/grumpy-words-move.md new file mode 100644 index 00000000000..05f74ea91a0 --- /dev/null +++ b/.changeset/grumpy-words-move.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +A person can no longer move a busy Factory card into a phase that starts a run. While a run is in flight on the card's sessions or queued for it, the transition service refuses the move with the new `card_busy` rejection code and the reason "Another run can't start while this card is busy." Moving a busy card to a resting or terminal phase, such as closing it, still works, and agent, rule and run-start moves are not affected. diff --git a/.changeset/happy-boxes-hunt.md b/.changeset/happy-boxes-hunt.md new file mode 100644 index 00000000000..f63f7ba04d6 --- /dev/null +++ b/.changeset/happy-boxes-hunt.md @@ -0,0 +1,12 @@ +--- +'@mastra/core': patch +--- + +Fixed agents that resolve their model, instructions, or memory from request context failing to run when a signal wakes a thread whose claimed owner runs on another server. The caller's request context now travels with the wake, without the auth token, the signed-in user, or values that can't be sent as JSON, so the woken run resolves the same way it would locally. This covers background-task finish reports, schedules, and notifications delivered to a claimed owner. + +A claimed owner woken by a signal now always runs and saves on its own thread and resource, even when the caller's request context names another thread. When it has its own auth token, it also keeps its own signed-in user, roles, and permissions instead of taking the caller's. + +Background-task finish reports are more reliable: + +- A request context that a tool transformed with its `requestContextSchema` is passed to the woken run in its original input form, so the run no longer fails validation. +- When a suspended run's leftover lease briefly blocks the thread, the report waits for the lease to clear instead of being dropped. diff --git a/.changeset/headless-connect-client-credentials.md b/.changeset/headless-connect-client-credentials.md new file mode 100644 index 00000000000..7d2ef25d1a7 --- /dev/null +++ b/.changeset/headless-connect-client-credentials.md @@ -0,0 +1,31 @@ +--- +'@mastra/playground-ui': patch +--- + +Connect providers that use OAuth client credentials (`OAUTH2_CC`) or no authentication (`NONE`) without leaving Studio. Client-credential providers ask for a client ID and secret in the connect dialog; providers with no authentication connect immediately instead of opening an OAuth popup. + +Providers whose catalog lists only connection settings (for example a subdomain) now also ask for their API key, username and password, or client ID and secret. Previously the dialog showed only the settings, and the connection failed. + +The headless connect helpers in `@mastra/playground-ui/domains/connect` now return a fully resolved `HeadlessAuthField` and support conditional fields (`visibleWhen`), so other apps can import them instead of keeping their own copy. + +```ts +import { + headlessAuthFieldKey, + headlessAuthFields, + isHeadlessAuthFieldVisible, + splitHeadlessAuthValues, + startHeadlessAuth, +} from '@mastra/playground-ui/domains/connect'; + +// Every field comes back fully resolved: label, target, required, and so on are always set. +const fields = headlessAuthFields(provider); + +// Render only the fields whose `visibleWhen` condition matches the current values. +const visible = fields.filter(field => isHeadlessAuthFieldVisible(fields, field, values)); +const missingRequired = visible.some(field => field.required && !values[headlessAuthFieldKey(field)]); + +// On submit, values for hidden fields are dropped. +const { credentials, params } = splitHeadlessAuthValues(fields, values); +await startHeadlessAuth({ sessionToken, integrationId: provider.id, authType: provider.authType, credentials, params }) + .result; +``` diff --git a/.changeset/itchy-webs-search.md b/.changeset/itchy-webs-search.md new file mode 100644 index 00000000000..70dffc22169 --- /dev/null +++ b/.changeset/itchy-webs-search.md @@ -0,0 +1,32 @@ +--- +'@mastra/core': minor +--- + +`restartAllActiveWorkflowRuns()` no longer restarts evented workflow runs that a broker recovers on its own, and restarts a default-engine run only once it stopped (#28712). + +**Evented runs on a broker.** With a pubsub whose broker redelivers a dead worker's unacked messages (Redis Streams, Valkey Streams, Google Cloud Pub/Sub), booting instances no longer restart evented runs. Before, every instance that booted restarted every active evented run, so steps ran again on several instances at once. Now the broker hands the stopped step's message to another worker, and the run goes on from there. Pubsub implementations report this through the new `redeliversUnacked` getter, which defaults to `false`. + +With Redis or Valkey Streams, keep `reclaimIdleMs` at 30 seconds or more (the default is 60 seconds). A message reclaimed sooner can arrive while the dead worker's step fence is still held, and is then dropped as a duplicate. + +Booting instances still restart these evented runs, each of them, as before: + +- scheduled runs, whose events stay in the process that fired them +- runs on the default in-process `EventEmitterPubSub` or on the Unix socket pubsub. Several instances that share one storage aren't supported for evented workflows with these; use a broker. + +**Known limits on a broker.** These evented runs stay `running` until you call `restart()` on them. Before, the next booting instance restarted them. + +- A sleeping run whose instance exits, after a crash or during a normal deploy. The sleep's timer lives in that process. +- A run whose step message Redis or Valkey Streams trimmed. The streams trim to `maxStreamLength` entries (10,000 by default), pending ones included, so a step that is still running while that many newer events are published loses its message if its instance then exits. Raise `maxStreamLength` if you run long steps with a high event volume. +- A run whose message the broker dropped after `maxDeliveryAttempts` or `inFlightTimeoutMs`, a run whose failure couldn't be published after several attempts, and runs on a Redis instance that restarted without persistence. + +**Default-engine runs.** A `running` or `waiting` run counts as stopped when no instance holds its run lease and neither the run nor that lease changed for `recovery.workflowGraceMs` (2 seconds by default). A run that stopped more recently is left to the workflow recovery loop that `startWorkers()` starts. Without run fencing in the store, every active run is still restarted, as before. + +```ts +const mastra = new Mastra({ + recovery: { workflowGraceMs: 5_000 }, +}); +``` + +Recovery is also faster when many runs are active: it lists runs without their step results and reads a run's snapshot only when it restarts it. With 3,000 active runs that another instance holds, among 30,000 finished runs, a call takes about 30 ms instead of 1.8 s on Postgres and 45 ms instead of 630 ms on LibSQL. A call made while another is still handing out restarts joins that call, and `shutdown()` waits, within `drainTimeout`, for a recovery call in progress and the runs it is restarting. + +A default-engine nested run resumed directly now keeps its parent from being restarted while it runs. On stores without atomic status updates, it keeps itself from being restarted instead. diff --git a/.changeset/jolly-geckos-change.md b/.changeset/jolly-geckos-change.md new file mode 100644 index 00000000000..6f172de6f61 --- /dev/null +++ b/.changeset/jolly-geckos-change.md @@ -0,0 +1,19 @@ +--- +'@mastra/factory': minor +--- + +Intake rules can now set a description on the cards they create, so cards from integrations show the item's details instead of an empty description. + +```ts +return { + type: 'upsertLinkedWorkItem', + board: context.intake.board, + source: 'github-dependabot-alert', + sourceKey: alert.id, + title: alert.title, + description: alert.description, + url: alert.url, + stage: context.intake.initialPhase, + // ... +}; +``` diff --git a/.changeset/json-render-processor.md b/.changeset/json-render-processor.md new file mode 100644 index 00000000000..c013add17e6 --- /dev/null +++ b/.changeset/json-render-processor.md @@ -0,0 +1,27 @@ +--- +'@mastra/json-render': minor +--- + +Added `@mastra/json-render`, which lets agents compose [json-render](https://json-render.dev) interfaces from your component catalog. + +```ts +import { JsonRenderProcessor } from '@mastra/json-render'; + +const ui = new JsonRenderProcessor({ catalog }); + +const agent = new Agent({ + id: 'ui-agent', + name: 'UI Agent', + model: 'openai/gpt-6.1-sol', + instructions: catalog.prompt({ mode: 'inline', editModes: ['patch'] }), + inputProcessors: [ui], + outputProcessors: [ui], + maxProcessorRetries: 2, + memory: new Memory(), +}); +``` + +- Interfaces the model writes stream to the client as `data-spec` parts, and the reply's text keeps only the prose. Render them with `useJsonRenderMessage()` from `@json-render/react`. +- Interfaces are saved with the message, so they render again after a reload. +- Later turns can edit the latest interface with a few patches. Send the interface's state under the `JSON_RENDER_STATE` request context key, and the model sees what the user set and the edit keeps it. +- Interfaces that don't match the catalog are sent back to the model to fix before they're saved. diff --git a/.changeset/keep-processor-provider-metadata.md b/.changeset/keep-processor-provider-metadata.md new file mode 100644 index 00000000000..89491ebd49b --- /dev/null +++ b/.changeset/keep-processor-provider-metadata.md @@ -0,0 +1,5 @@ +--- +'@mastra/core': patch +--- + +Fixed processor workflows that use `ProcessorStepOutputSchema` dropping `providerMetadata` in the `outputStep` phase. `processOutputStep` in those workflows now receives the provider metadata, such as Bedrock guardrail traces. diff --git a/.changeset/khaki-eels-care.md b/.changeset/khaki-eels-care.md new file mode 100644 index 00000000000..0f6ab29e494 --- /dev/null +++ b/.changeset/khaki-eels-care.md @@ -0,0 +1,17 @@ +--- +'@mastra/factory': minor +--- + +Work Intake: what you select is what comes in. + +- **One list per service, no sync switches.** Settings → Work Intake lists each connected service with its selected sources and an Add account button. A service with nothing selected brings in nothing. Dependabot alerts keep their own switch. +- **GitHub issues follow the list.** New GitHub issues become cards only for repositories in the GitHub list. Pull requests still come from every linked repository. On upgrade, every repository already linked to a Factory is added to the list once, so nothing stops arriving. Linking a repository adds it to the list unless the request sends `selectIntake: false`, and adding a repository to the list brings in its open issues. + To link a repository without bringing in its issues: + + ```http + POST /web/factory/projects/:projectId/source-control-connections/:connectionId/repositories + { "repository": { "externalId": "99", "slug": "acme/app" }, "selectIntake": false } + ``` + +- **Vanta follows its selection.** Vulnerabilities sync only while the Vanta source is selected. Organizations whose Vanta sync was on with nothing selected get the source selected once on upgrade. +- **Routing has its own page.** The intake order and the Not routed list moved from Settings to Routing in board settings. diff --git a/.changeset/knowledge-host-move-page.md b/.changeset/knowledge-host-move-page.md new file mode 100644 index 00000000000..53178fffa33 --- /dev/null +++ b/.changeset/knowledge-host-move-page.md @@ -0,0 +1,11 @@ +--- +'@mastra/core': minor +--- + +Added `knowledge.movePage()` to move a page, with its child pages, to a new parent or scope from your app. The page keeps its ID, notes, pins and embeddings, and links by path follow it, so a sync that sees a page move at its source no longer has to remove and re-create it. + +```ts +await knowledge.movePage({ scope: 'docs:acme', path: 'inbox/plan', parent: 'projects/q4' }); +``` + +Links by name now stay correct when a page moves or a new page takes a name. A page moved to another scope, and every page under it, re-resolves its `[[Name]]` links in the new scope. A link that pointed at one page by name stops resolving once a second page answers to that name. When more than 99 pages share that name, the write logs a warning and `knowledge.reindexLinks()` repairs the rest. diff --git a/.changeset/knowledge-reembed-existing.md b/.changeset/knowledge-reembed-existing.md new file mode 100644 index 00000000000..38cd909b62e --- /dev/null +++ b/.changeset/knowledge-reembed-existing.md @@ -0,0 +1,14 @@ +--- +'@mastra/core': minor +--- + +Added `knowledge.reembed()` to embed Knowledge pages and notes that already exist, such as content written before `vector` and `embedder` were configured or after switching embedders. It runs in batches with a resumable cursor, doesn't change the pages, lists failures and pages over the chunk cap, and stops early with a cursor when the embedder keeps rate limiting. + +```ts +let cursor: string | undefined; +do { + const result = await knowledge.reembed({ scope: 'org:acme', cursor }); + if (result.rateLimited) await new Promise(resolve => setTimeout(resolve, 60_000)); + cursor = result.nextCursor; +} while (cursor); +``` diff --git a/.changeset/knowledge-scope-values-no-colons.md b/.changeset/knowledge-scope-values-no-colons.md new file mode 100644 index 00000000000..c62423e8f8f --- /dev/null +++ b/.changeset/knowledge-scope-values-no-colons.md @@ -0,0 +1,22 @@ +--- +'@mastra/core': minor +--- + +**Breaking (Knowledge alpha):** a `$param` in a Knowledge scope pattern now matches exactly one segment, so scope values can no longer contain a raw `:`. Before, the last param took the rest of the address, so `org:acme:viewer` counted as an `org:$orgId` scope and its holder got that pattern's `self` rights there. + +- Agent `scopes` are canonical addresses. An id containing `:`, `/`, `#` or `%` must be encoded with the new `encodeKnowledgeScopeId`. The raw form (e.g. `org:a:b` against `org:$orgId`) fails with "does not match a declared scope type", and `%` is always read as an escape, so each scope has one spelling. +- Memory ids are bound encoded: resource `slack:U123` becomes `resource:slack%3AU123`. +- Patterns of one type with different segment counts no longer overlap, so `org:$orgId` and `org:$orgId:viewer` can be declared side by side. +- `decodeKnowledgeScopeId` reads an id back from one segment of an address. + +```ts +import { encodeKnowledgeScopeId } from '@mastra/core/knowledge'; + +const scope = `org:${encodeKnowledgeScopeId('auth0|a:b')}`; // 'org:auth0|a%3Ab', pass this in Agent scopes +``` + +No data is rewritten: + +- **Ids with a colon in the last segment get new addresses.** Before, the last segment kept a raw `:` (`resource:slack:U123`); now it is encoded (`resource:slack%3AU123`), so a run reaches a new, empty scope, and pages, pins and notes stored under the old address stay there unreached. Nothing moves them. +- **Every other id keeps its address if you pass it through `encodeKnowledgeScopeId`.** `/`, `#` and `%` were already encoded the same way, so `org:${encodeKnowledgeScopeId('a/b')}` reaches rows stored from the raw `org:a/b`. Passing the old raw string unchanged does not: `org:a/b` is refused, and a raw scope that happened to contain an escape (`org:a%3Ab`, once stored as `org:a%253Ab`) now means the id `a:b`. +- **Stale rows get nothing from their new match.** A stored scope row whose address now matches a different declaration than the one it was created under (e.g. `org:acme:viewer` created under `org:$orgId`, once `org:$orgId:viewer` is declared) gets none of the new declaration's access. It is never a `belongsTo` parent, and using it as a scope of the new declaration fails with an error. Prefix grants of the declaration it was created under still let their holders read it, as before, without a role on it. diff --git a/.changeset/knowledge-store-scope-declarations.md b/.changeset/knowledge-store-scope-declarations.md new file mode 100644 index 00000000000..2944742812e --- /dev/null +++ b/.changeset/knowledge-store-scope-declarations.md @@ -0,0 +1,20 @@ +--- +'@mastra/core': minor +--- + +Knowledge storage can supply scope declarations, access rules included. + +A store returns declarations from `getScopeDeclarations()` (none by default). Knowledge merges them under its config's: the config wins on a key both declare, and a declaration that doesn't compile is skipped with a warning. When stored scopes come from a skipped declaration, the declaration check's error names that declaration and why it was skipped, so it can be fixed in the store. The store's answer is reused for 30 seconds and read again after `renameScopeDeclaration`, so a declaration the store adds, removes or changes (access rules included) applies within that window without a store read on every call. Revoking access through the store can therefore take up to 30 seconds to take effect. + +```ts +class ImportingKnowledgeStorage extends InMemoryKnowledgeStorage { + override async getScopeDeclarations() { + return { + 'imports:$name': {}, + 'linear:$account:$connection': { access: [{ principal: 'imports:all', role: 'viewer' }] }, + }; + } +} +``` + +Runs that hold `imports:all` then read every Linear connection's pages. diff --git a/.changeset/late-falcons-listen.md b/.changeset/late-falcons-listen.md new file mode 100644 index 00000000000..36697d8f987 --- /dev/null +++ b/.changeset/late-falcons-listen.md @@ -0,0 +1,14 @@ +--- +'@mastra/playground-ui': minor +--- + +Added `unavailableReason` to `ModelPicker`. When set, the picker shows its usual trigger, disabled, and hovering or focusing it shows the reason in a tooltip. Use it when the current user can see the model but is not allowed to change it. + +```tsx + +``` diff --git a/.changeset/lazy-suns-dream.md b/.changeset/lazy-suns-dream.md new file mode 100644 index 00000000000..9e3e2b4de30 --- /dev/null +++ b/.changeset/lazy-suns-dream.md @@ -0,0 +1,7 @@ +--- +'@mastra/core': patch +--- + +Fixed web search on models served through the Mastra gateway. An agent using `webSearchTool` with a model such as `mastra/openai/gpt-6.1-sol` failed every turn with `unknown tool type "openai:web_search"`, and on Anthropic and Google models the tool was dropped without an error. These models now use the gateway's web search. + +Other provider-native tools on gateway models now fail with a clear error. Previously the gateway rejected them with a 400 or ignored them, leaving the model without the tool. diff --git a/.changeset/legal-spies-kiss.md b/.changeset/legal-spies-kiss.md new file mode 100644 index 00000000000..2aa7ae8b618 --- /dev/null +++ b/.changeset/legal-spies-kiss.md @@ -0,0 +1,7 @@ +--- +'@mastra/factory': patch +--- + +Fixed slow Linear boards in Factory. Opening a board no longer creates cards while the page loads. + +New Linear issues in sources bound to a project now get their card from the background Linear sweep, within its interval (5 minutes by default), even when nobody has the board open. diff --git a/.changeset/light-worlds-draw.md b/.changeset/light-worlds-draw.md new file mode 100644 index 00000000000..25e342fb60f --- /dev/null +++ b/.changeset/light-worlds-draw.md @@ -0,0 +1,16 @@ +--- +'@mastra/playground-ui': patch +'mastra': patch +--- + +Added the `playground-ui/icon-size-from-parent` lint rule. It flags an icon that sets its own size with `size`, `width`, `height` or a size class, so icons take their size from the component they sit in, an `` wrapper, or a `size-icon-*` token. Sizes relative to the text (`h-[1em]`) and sizes computed from data are allowed. + +```tsx +// Before + + +// After + +``` + +Icons now sit on the four icon sizes everywhere, and the skill and prompt block pickers use `EmptyState` and `Spinner` for their empty and loading states. diff --git a/.changeset/linear-intake-reads-once.md b/.changeset/linear-intake-reads-once.md new file mode 100644 index 00000000000..7c9e8979ecd --- /dev/null +++ b/.changeset/linear-intake-reads-once.md @@ -0,0 +1,5 @@ +--- +'mastra': patch +--- + +Reduced provider requests from the Factory board and search. The board and ⌘K search now show only cards, read from Factory, and never ask GitHub, GitLab, Linear, Jira or incident.io for their issue or pull request lists. New issues and pull requests reach the board as cards the server files. An open issue or pull request with no card no longer appears in Intake or search until the server files it as a card. diff --git a/.changeset/linear-pr-number.md b/.changeset/linear-pr-number.md new file mode 100644 index 00000000000..0c8b358ddc5 --- /dev/null +++ b/.changeset/linear-pr-number.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Fixed slow reading of the pull request number from GitHub card keys that contain very long runs of digits. The number returned is unchanged. diff --git a/.changeset/linear-slash-trim.md b/.changeset/linear-slash-trim.md new file mode 100644 index 00000000000..60ece185357 --- /dev/null +++ b/.changeset/linear-slash-trim.md @@ -0,0 +1,6 @@ +--- +'@mastra/core': patch +'@mastra/auth-supabase': patch +--- + +Fixed slow handling of Gateway base URLs and Supabase URLs that contain very long runs of `/`. The resulting URLs are unchanged. diff --git a/.changeset/live-sidebar-sessions.md b/.changeset/live-sidebar-sessions.md new file mode 100644 index 00000000000..c4482ef9a14 --- /dev/null +++ b/.changeset/live-sidebar-sessions.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +New, renamed and hidden sessions now show up in teammates' sidebars right away, instead of after up to a minute, and the sidebar no longer polls while a session starts. The `session-rows` and `session-activity` answers no longer include `settling`: every change to either answer now sends a frame on the project's feed. diff --git a/.changeset/long-doors-obey.md b/.changeset/long-doors-obey.md new file mode 100644 index 00000000000..56fc0eca016 --- /dev/null +++ b/.changeset/long-doors-obey.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +GitLab boards in Factory no longer create cards while a list loads. Factory now checks GitLab every five minutes and files new merge requests and issues itself. This works without a webhook and with no board open. The `MASTRACODE_GITLAB_RECONCILE_ENABLED` and `MASTRACODE_GITLAB_ISSUE_RECONCILE_ENABLED` settings are removed: the check always runs. diff --git a/.changeset/loud-lizards-build.md b/.changeset/loud-lizards-build.md new file mode 100644 index 00000000000..8f56012c49c --- /dev/null +++ b/.changeset/loud-lizards-build.md @@ -0,0 +1,5 @@ +--- +'@mastra/memory': patch +--- + +Fixed Observational Memory crashing when capped history rendering encounters a message text part without text. Incomplete text parts are skipped without changing stored history or adjacent valid content. diff --git a/.changeset/loud-mentions-reply.md b/.changeset/loud-mentions-reply.md new file mode 100644 index 00000000000..7c5c8b849c8 --- /dev/null +++ b/.changeset/loud-mentions-reply.md @@ -0,0 +1,6 @@ +--- +'@mastra/core': patch +'@mastra/factory': patch +--- + +Channel agents now always reply when someone tags them in a public channel or thread. Messages that mention the bot are marked `mentioned="true"`, and the channel prompt tells the model to answer those, even with a short acknowledgement when the sender only says more details are coming. The stay-silent guidance now applies only to messages that don't mention the bot. diff --git a/.changeset/lovely-books-throw.md b/.changeset/lovely-books-throw.md new file mode 100644 index 00000000000..dbb25366054 --- /dev/null +++ b/.changeset/lovely-books-throw.md @@ -0,0 +1,18 @@ +--- +'@mastra/react': patch +'@mastra/playground-ui': patch +--- + +New feedback comments now show up in the list as soon as you submit them, instead of after the next refresh. Lists from `useTraceFeedback` and `useSpanFeedback` show the comment right away, remove it if the submit fails, and keep showing it until the list returns the stored comment or 60 seconds pass, whichever comes first. While a comment is waiting to be stored, the list refreshes every 3 seconds instead of every 30 seconds. + +Comments that are not stored yet have `isPending: true`, so you can hide actions such as delete until the stored comment arrives: + +```tsx +const { data } = useTraceFeedback({ traceId }); + +data?.feedback.map(item => (item.isPending ? Sending… : )); +``` + +In Studio, a comment that is not stored yet shows "Sending…" instead of its review status, and its Mark reviewed and Delete actions stay hidden until the stored comment arrives. + +`useCreateFeedback` now runs your `onMutate`, `onError` and `onSuccess` options in addition to its own behavior. Before, passing `onSuccess` skipped the hook's list refresh. diff --git a/.changeset/many-parrots-press.md b/.changeset/many-parrots-press.md new file mode 100644 index 00000000000..da289feda4b --- /dev/null +++ b/.changeset/many-parrots-press.md @@ -0,0 +1,8 @@ +--- +'@mastra/code-sdk': patch +'mastracode': patch +--- + +Fixed `ask_user` questions not firing permission hooks. A pending question now fires `PermissionRequest` with `permission_kind: "ask_question"`, and answering or skipping it fires `PermissionResult` with decision `answered` or `dismissed`. Integrations that show a blocked state for approvals, such as terminal multiplexers, now also show it while a question waits for an answer. + +`PermissionResult` now reports the `run_id` of its `PermissionRequest`. With background tools enabled, the result was previously dropped when the user answered after the suspended run had ended. diff --git a/.changeset/mastracode-knowledge-canonical-scopes.md b/.changeset/mastracode-knowledge-canonical-scopes.md new file mode 100644 index 00000000000..b133bce99cb --- /dev/null +++ b/.changeset/mastracode-knowledge-canonical-scopes.md @@ -0,0 +1,6 @@ +--- +'@mastra/code-sdk': patch +'@mastra/factory': patch +--- + +Mastra Code's Knowledge scopes now use canonical addresses, matching `@mastra/core`'s one-segment scope values. Factory sessions hold their org and project ids encoded (`org:acme%3Aeu` for org `acme:eu`), and the `/knowledge` inspector and Factory Knowledge routes read the same addresses the code agent writes, instead of encoding host scopes a second time. diff --git a/.changeset/mastracode-run-tui-export.md b/.changeset/mastracode-run-tui-export.md new file mode 100644 index 00000000000..0d2060e5cef --- /dev/null +++ b/.changeset/mastracode-run-tui-export.md @@ -0,0 +1,13 @@ +--- +'mastracode': patch +--- + +Added an ESM-only `mastracode/run-tui` export so a launcher can start the Mastra Code TUI with extra session options, such as Knowledge and its scopes: + +```ts +import { runTui } from 'mastracode/run-tui'; + +await runTui({ createMastraCode: { knowledge: { key: 'team', instance: knowledge }, scopes: ['org:acme'] } }); +``` + +Options given here replace the values Mastra Code would pass for the same keys, and apply to the interactive local TUI only. The `mastracode` command behaves as before. diff --git a/.changeset/memory-save-no-pause.md b/.changeset/memory-save-no-pause.md new file mode 100644 index 00000000000..3d0a4856d85 --- /dev/null +++ b/.changeset/memory-save-no-pause.md @@ -0,0 +1,7 @@ +--- +'@mastra/core': patch +--- + +Removed the 10 ms pause after every memory save. Saving messages no longer waits before the run continues. A new message stamped in the same millisecond as the stored answer before it now sorts after that answer instead of before it, so the next response no longer merges into the previous one. + +A queued message handed to a run on another process is no longer stuck when that run's lease disappears after this process stopped watching the thread; it now starts its own run. diff --git a/.changeset/mighty-pets-drive.md b/.changeset/mighty-pets-drive.md new file mode 100644 index 00000000000..88b5f24b8ff --- /dev/null +++ b/.changeset/mighty-pets-drive.md @@ -0,0 +1,6 @@ +--- +'@mastra/core': patch +'@mastra/convex': patch +--- + +Fixed evented workflows ending a run twice when two `foreach` iterations failed at the same time. The run now fails once, with the first failure's error, and a result saved after the failure no longer marks the step as running again. diff --git a/.changeset/modern-regions-lead.md b/.changeset/modern-regions-lead.md new file mode 100644 index 00000000000..dbb1f46e4bd --- /dev/null +++ b/.changeset/modern-regions-lead.md @@ -0,0 +1,5 @@ +--- +'@mastra/server': patch +--- + +Reduced memory and CPU use when clients stream agent controller sessions. Each display-state update is now copied and serialized once and shared by every client of the session, instead of once per client, and the copy no longer duplicates message text or tool results. Display state is now serialized the same way as other stream events, so the bytes change for three kinds of value: an object with a `toJSON` method is sent as that method's result, an error keeps its own enumerable fields such as `statusCode`, and a value that cannot be cloned, such as a function, is left out and no longer closes the stream. diff --git a/.changeset/modern-turtles-fix.md b/.changeset/modern-turtles-fix.md new file mode 100644 index 00000000000..a2f32d5889e --- /dev/null +++ b/.changeset/modern-turtles-fix.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Fixed Vanta intake appearing automatically when Platform credentials are configured. diff --git a/.changeset/new-ads-hug.md b/.changeset/new-ads-hug.md new file mode 100644 index 00000000000..43abdcb686f --- /dev/null +++ b/.changeset/new-ads-hug.md @@ -0,0 +1,5 @@ +--- +'@mastra/inngest': patch +--- + +Preserved Inngest execution when an HTTP observer disconnects by explicitly advertising detached streaming, even when the wrapped Agent has streams disabled. diff --git a/.changeset/nice-actors-stand.md b/.changeset/nice-actors-stand.md new file mode 100644 index 00000000000..45d1b6104a9 --- /dev/null +++ b/.changeset/nice-actors-stand.md @@ -0,0 +1,5 @@ +--- +'@mastra/mcp-apps-components': patch +--- + +Fixed the observability dashboard widget briefly drawing in the dark theme inside a light-themed host. The widget now applies the host's theme before its first frame. diff --git a/.changeset/nice-lands-double.md b/.changeset/nice-lands-double.md new file mode 100644 index 00000000000..9a5c1054640 --- /dev/null +++ b/.changeset/nice-lands-double.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': minor +--- + +Added Vanta vulnerabilities as a Factory intake source through MastraConnect. Once you connect Vanta and enable it in intake settings, each active vulnerability becomes a card labeled `security` with its severity, package, and remediation date in the description. diff --git a/.changeset/nine-boxes-pump.md b/.changeset/nine-boxes-pump.md new file mode 100644 index 00000000000..6f73ed94f49 --- /dev/null +++ b/.changeset/nine-boxes-pump.md @@ -0,0 +1,5 @@ +--- +'@mastra/memory': patch +--- + +Fixed the experimental vNext working memory tool letting one thread erase memory shared with other threads. With `scope` left at its default (`'resource'`), an update with `updateReason: 'replace-irrelevant-memory'` is now refused the same way as with an explicit `scope: 'resource'` setting, so a fact another conversation still needs isn't removed. The refusal now tells the agent the memory is shared and suggests `clarify-existing-memory` or `append-new-memory`, instead of saying no `searchString` was provided. Fixes [#30287](https://github.com/mastra-ai/mastra/issues/30287). diff --git a/.changeset/nine-pigs-kneel.md b/.changeset/nine-pigs-kneel.md new file mode 100644 index 00000000000..b0909d0e6ca --- /dev/null +++ b/.changeset/nine-pigs-kneel.md @@ -0,0 +1,5 @@ +--- +'@mastra/core': patch +--- + +Fixed durable agents sending the model a background tool's placeholder instead of its result. When a background tool finished while its `toModelOutput` was still running, or while a durable agent ran on storage version 2, the next model call saw the placeholder and the final save could write the placeholder over the stored result. diff --git a/.changeset/odd-bottles-notice.md b/.changeset/odd-bottles-notice.md new file mode 100644 index 00000000000..3d0dccaf99c --- /dev/null +++ b/.changeset/odd-bottles-notice.md @@ -0,0 +1,5 @@ +--- +'@mastra/libsql': patch +--- + +Fixed background task updates and deletes on a local LibSQL file database stalling for up to five seconds (and sometimes failing with `SQLITE_BUSY: database is locked`) when they ran alongside workflow run writes, for example while shutting down Mastra with background tasks still running. diff --git a/.changeset/olive-pandas-carry.md b/.changeset/olive-pandas-carry.md new file mode 100644 index 00000000000..e892c98475c --- /dev/null +++ b/.changeset/olive-pandas-carry.md @@ -0,0 +1,20 @@ +--- +'@mastra/mcp': minor +--- + +`MCPServer` accepts a `maxRequestBodySize` option, so HTTP requests larger than the 4 MiB default are no longer answered with a `413` before the tool runs. + +```typescript +// Before: a tools/call body over 4 MiB was rejected +// { "code": -32000, "message": "Payload Too Large: Request body must not exceed 4194304 bytes" } + +// After: raise the limit for the servers that need it +const server = new MCPServer({ + name: 'intake', + version: '1.0.0', + maxRequestBodySize: 16 * 1024 * 1024, + tools: { submitIntake }, +}); +``` + +The bound is in bytes and must be positive. Leaving it unset keeps the SDK default of `4194304` (4 MiB), and a body over the limit is still rejected with a `413` JSON-RPC error before it is parsed. It covers only a body the server reads itself: if body-parsing middleware supplies the parsed body, the bound does not apply, so raise the size limit on that parser too. It applies to `startHTTP` requests only; `stdio` has no request bodies. diff --git a/.changeset/otel-resources-sec-323.md b/.changeset/otel-resources-sec-323.md new file mode 100644 index 00000000000..822345c9edf --- /dev/null +++ b/.changeset/otel-resources-sec-323.md @@ -0,0 +1,8 @@ +--- +'@mastra/arize': patch +'@mastra/arthur': patch +'@mastra/laminar': patch +'@mastra/otel-exporter': patch +--- + +Raised the minimum versions of the OpenTelemetry SDK and OTLP exporter dependencies (`@opentelemetry/sdk-trace-base` and `@opentelemetry/core` `^2.12.1`, OTLP exporters `^0.223.1`) so they no longer resolve to releases that pin `@opentelemetry/resources` 2.12.0, which is affected by security advisory GHSA-qrww-3xmv-qhgm. If your project also depends on OpenTelemetry packages directly, check that they resolve `@opentelemetry/resources` 2.12.1 or later on the 2.x line, or 3.1.1 or later on the 3.x line. diff --git a/.changeset/parked-run-lease-outage.md b/.changeset/parked-run-lease-outage.md new file mode 100644 index 00000000000..e4e4d055768 --- /dev/null +++ b/.changeset/parked-run-lease-outage.md @@ -0,0 +1,5 @@ +--- +'@mastra/core': patch +--- + +Fixed a run waiting on a tool approval losing its saved state when the thread lease expired. This happened when the lease backend (such as Redis) was down for too long. Before, the run's snapshot was deleted, so the approval could not be resumed. Now the run resumes normally once the backend is back. If another run took the thread first, a resume in the same process is refused and the run keeps waiting. diff --git a/.changeset/perky-colts-glow.md b/.changeset/perky-colts-glow.md new file mode 100644 index 00000000000..8d31c8a2063 --- /dev/null +++ b/.changeset/perky-colts-glow.md @@ -0,0 +1,10 @@ +--- +'mastra': patch +--- + +Added `mastra api factory board phases` and `mastra api factory work-item filter-options`, which read the first cards under each phase of a Factory board and the labels and people it can be filtered by. + +```bash +mastra api factory board phases work '{"label":["bug"],"limit":10}' +mastra api factory work-item filter-options +``` diff --git a/.changeset/plain-lands-refuse.md b/.changeset/plain-lands-refuse.md new file mode 100644 index 00000000000..f9f5baa771c --- /dev/null +++ b/.changeset/plain-lands-refuse.md @@ -0,0 +1,5 @@ +--- +'mastra': patch +--- + +Improved how fast the Factory sidebar opens on projects with many sessions. The sidebar now asks the server for the sessions it shows, five per group with **Show more** for the rest, instead of downloading every session and every card that holds one. Sorting, grouping and filters run on the server, and reopening the sidebar when nothing changed downloads almost nothing. diff --git a/.changeset/plain-search-groups.md b/.changeset/plain-search-groups.md new file mode 100644 index 00000000000..825c8f17b5d --- /dev/null +++ b/.changeset/plain-search-groups.md @@ -0,0 +1,21 @@ +--- +'@mastra/playground-ui': minor +--- + +`InputGroupAddon` now insets its icon like a Button does (the group's `--control-px` and `--control-gap`), so a leading or trailing icon in any field lines up with the icons of the controls beside it. A field built from `InputGroup` parts by hand gets the same inset as `SearchInput`. An icon `InputGroupButton` is now a chip inset in the field (8px shorter than it, with an even ring around it) instead of a full-height circle. + +`SearchInput` is now plain `InputGroup` composition (a search icon, the input and a clear button) with no styling of its own. Its clear button keeps its space while hidden, so the field doesn't resize when text appears. It takes over `ListSearch`'s behaviour. It is either controlled (`value`, following every change the parent makes, such as a Reset or a URL change) or keeps its own text (`defaultValue`). Both modes accept `debounceMs`, which delays `onValueChange` while typing; clearing reports right away. `shortcut` turns on the Cmd/Ctrl+Shift+F focus shortcut, and `listSearchProps` bundles a list page's `size`, `debounceMs` and `shortcut`. `ListSearch` and `SearchFieldBlock` are removed. + +**Migrating** + +```tsx +// Before + + +// After + +``` + +- `ListSearch`'s `onSearch` → `onValueChange`, `value` → `defaultValue`, `shortcutDisabled` → leave out `shortcut`. It defaulted to `size="sm"` and a 300ms debounce; pass them. To reset a field that keeps its own text, remount it with a `key`. +- `SearchFieldBlock` → `SearchInput`, inside a `Field` when it needs a visible label. +- `SearchInput`'s `label` is now the input's `aria-label` instead of a visually hidden `