mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
2,965 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d60ba71be0 | chore: version - exit prerelease mode | ||
|
|
5c87442ed7 |
chore: version packages (alpha) (#30203)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/auth-auth0@1.3.0-alpha.0 ## @mastra/auth-clerk@1.4.0-alpha.0 ## @mastra/auth-okta@0.3.0-alpha.0 ## @mastra/auth-supabase@1.2.0-alpha.0 ## @mastra/client-js@1.60.0-alpha.13 ## @mastra/auth@1.2.0-alpha.0 ## @mastra/core@1.83.0-alpha.13 ## @mastra/playground-ui@69.0.0-alpha.15 ## @mastra/rag@2.8.0-alpha.3 ## @mastra/server@1.83.0-alpha.13 ## @mastra/server-adapters-test-suite@0.3.0-alpha.5 ## @mastra/auth-better-auth@1.1.11-alpha.2 ## @mastra/auth-cloud@1.2.9-alpha.0 ## @mastra/auth-neon@0.3.6-alpha.1 ## @mastra/auth-workos@1.6.9-alpha.0 ## @mastra/discord@1.3.4-alpha.0 ## @mastra/react@1.15.0-alpha.13 ## @mastra/deployer-cloud@1.83.0-alpha.13 ## @mastra/deployer-cloudflare@1.2.42-alpha.3 ## @mastra/deployer-netlify@1.2.42-alpha.1 ## @mastra/deployer-sandbox@0.3.27-alpha.1 ## @mastra/deployer-vercel@1.2.42-alpha.1 ## @mastra/longmemeval@1.1.42-alpha.13 ## @mastra/opencode@0.1.42-alpha.13 ## @mastra/factory@0.28.0-alpha.15 ## create-factory@0.4.3-alpha.15 ## @mastra/code-sdk@1.19.0-alpha.15 ## mastracode@0.50.0-alpha.14 ## @mastra/agent-builder@1.2.1-alpha.5 ## mastra@1.39.0-alpha.15 ## @mastra/connect@1.4.0-alpha.6 ## @mastra/deployer@1.83.0-alpha.13 ## @mastra/editor@0.17.1-alpha.7 ## @mastra/mcp@2.9.0-alpha.5 ## @mastra/mcp-docs-server@1.3.13-alpha.17 ## @mastra/memory@1.41.1-alpha.5 ## @mastra/schema-compat@1.4.0-alpha.2 ## @mastra/elysia@0.1.23-alpha.13 ## @mastra/express@1.5.27-alpha.13 ## @mastra/fastify@1.5.27-alpha.13 ## @mastra/hono@1.7.25-alpha.13 ## @mastra/koa@1.7.27-alpha.13 ## @mastra/nestjs@0.3.0-alpha.13 ## @mastra/next@0.2.41-alpha.13 ## @mastra/tanstack-start@0.2.41-alpha.13 ## @mastra/voice-google-gemini-live@0.14.19-alpha.2 ## @mastra/voice-openai-realtime@0.14.9-alpha.3 ## @mastra/voice-xai-realtime@0.2.18-alpha.2 ## @mastra/inngest@1.11.2-alpha.9 ## @mastra/temporal@0.6.0-alpha.13 ## create-mastra@1.39.0-alpha.15 ## @internal/playground@1.39.0-alpha.15 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
18168d518c |
feat(playground): show the built-in MCP server in Studio (#29932)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
c0d3bfdc43 |
feat: pass the authenticated user to DynamicArgument callbacks (#28612)
Dynamic agent config callbacks now get the authenticated end user as an
optional `user` argument, so you can personalize an agent without
digging auth keys out of `requestContext` yourself. It works in any
`DynamicArgument` callback: instructions, model, tools, memory,
workspace, processors, scorers, and so on.
```ts
import { Agent } from '@mastra/core/agent';
const supportAgent = new Agent({
id: 'support-agent',
instructions: ({ user }) =>
user ? `You are helping ${user.name ?? user.id}.` : 'You are a helpful assistant.',
model: ({ user }) => (user?.role === 'admin' ? 'openai/gpt-5' : 'openai/gpt-5-mini'),
tools: ({ user }) => (user ? { accountTool, ...(user.role === 'admin' ? { adminTool } : {}) } : {}),
memory: ({ user }) => (user ? userMemory : undefined),
});
```
`user` always has the same `MastraUser` shape, no matter which auth
provider you use, and it's `undefined` for unauthenticated requests:
```ts
import type { MastraUser } from '@mastra/core/types';
// { id: string; name?: string; email?: string; avatarUrl?: string; role?: string }
```
The server auth middleware builds it through a new overridable
`toMastraUser()` on `MastraAuthProvider`. The default handles common
shapes (`id`/`sub`/`userId`, `name`, `email`, `avatarUrl`/`picture`,
`role`), and JWT, Cloud, Supabase, Neon and Better Auth ship overrides
for their user objects. Custom providers can map their own shape:
```ts
import { MastraAuthProvider } from '@mastra/core/server';
import type { MastraUser } from '@mastra/core/types';
class MyAuth extends MastraAuthProvider<MyUser> {
async authenticateToken(token: string) { /* ... */ }
async authorizeUser(user: MyUser) { return true; }
toMastraUser(user: MyUser): MastraUser {
return { id: user.accountId, name: user.profile.displayName, role: user.permissions.primaryRole };
}
}
```
Inline auth configs can pass `toMastraUser` too. If the provider user
has no role and an RBAC provider is configured, the primary RBAC role
fills it in, so `user.role` also works with WorkOS, Okta, Google and
Neon. The raw provider user is still available when you need
provider-specific fields, and the new context key is reserved, so
clients can't spoof it through the request body:
```ts
instructions: ({ requestContext }) => {
const rawUser = requestContext.get('mastra__user'); // provider-specific object, unchanged
// ...
},
```
Dynamic `vectorStore` resolvers on RAG tools get `user` as well:
```ts
createVectorQueryTool({
indexName: 'docs',
model: embedder,
vectorStore: ({ user }) => (user ? tenantStores.get(user.id)! : sharedStore),
});
```
Inside core, every place that invoked a `DynamicArgument` callback
inline now goes through a single `resolveDynamicArgument` helper, which
reads the user from `requestContext` at call time. This is non-breaking:
callbacks get an extra optional field, providers get a method with a
working default. Requests served through an `MCPServer` don't get `user`
yet, since MCP builds its own request context; that's documented.
Tested with unit tests for the helper, normalization and each provider
override, middleware tests (inline config, provider role, RBAC role,
CompositeAuth ordering, unauthenticated), regression tests for the
migrated call sites, and an end-to-end test where an agent behind a fake
auth provider gets personalized instructions. Core, server, rag and the
touched auth packages typecheck clean, and their suites pass.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
When a signed-in user makes a request, configuration callbacks can now
use a standard set of details about that user. When a workflow resumes,
it uses the new request’s user details instead of restoring them from
the earlier run.
## Summary
- Added optional `user` data to `DynamicArgument` callbacks and RAG
vector-store resolvers. Callbacks can also use `getRequestUser()` to
read the normalized user from request context.
- Added the `MastraUser` type and `toMastraUser()` normalization hooks
for auth providers and inline auth configs. The server stores the
normalized user in a reserved request-context key and uses the primary
RBAC role when the user has no role.
- Updated core dynamic configuration paths to use the shared resolver.
Added user support to agent scopes and migrated A2A memory resolution.
- Added `withoutLiveRequestKeys()` to remove live authentication and
authorization data from saved context during workflow resume, restart,
and time travel. Saved non-authentication context, such as tenant data,
remains available.
- Added documentation and changesets. Raised relevant `@mastra/core`
peer dependency minimums to 1.81.0. MCPServer requests do not receive
the normalized `user`.
## Validation
The author reports passing typechecks and test suites across core,
server, RAG, and several auth packages. The author also reports three
failing Inngest tests and earlier failures in evented workflow and
scheduler tests, which reportedly fail the same way on comparison
sources. These results are author-reported and have not been
independently verified.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
|
||
|
|
e1a20364af |
Fix OpenAPI request schemas for defaulted and transformed fields (#30187)
## Summary - Generate request path, query, and body JSON Schemas from input types while retaining output types for responses. - Pass input/output mode through the Zod v4 adapter to represent defaults and transformations accurately. - Add regressions for OpenAPI documents, API schema manifests, and Zod v4 conversion, plus patch changesets for both packages. ## Test plan - `pnpm exec vitest run` in `packages/schema-compat` (1089 passed, 9 skipped) - `pnpm exec vitest run` in `packages/server` (3406 passed, 3 skipped, 1 todo) - `pnpm exec tsc --noEmit -p tsconfig.json` in both packages - `pnpm exec oxlint --type-aware` on modified files; `pnpm exec prettier --check` on modified files Fixes #30050 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> **ELI5:** Mastra builds an API document that tells client programs what data to send. Before this change, the document described the cleaned-up data the server produces, not the data the client sends. This change makes the document describe what clients send for requests, and keeps the cleaned-up form for responses. ## Summary This pull request changes how OpenAPI documents describe request and response schemas for Zod schemas. It addresses issue `#30050`. ### Problem The OpenAPI conversion used the Zod output side for all schemas. Request data needs the input side. This caused two errors: - Fields with `.default()` appeared as required in request bodies. - Parameters with `.transform()` appeared as `{}` in path and query schemas. On Zod versions before 4.2, and through the 3.25 v4 compatibility layer, the `@mastra/schema-compat` Zod v4 adapter also dropped the input/output mode. ### Changes - **`packages/server/src/server/server-adapter/openapi-utils.ts`:** `schemaToJsonSchema` accepts an optional `io` argument (`'input' | 'output'`, default `'output'`) and passes it to `standardSchemaToJSONSchema`. Path parameters, query parameters, and request bodies use `'input'`. Response schemas keep the default `'output'`. - **`packages/server/src/server/server-adapter/api-schema-manifest.ts`:** `convertSchema` accepts a direction and passes it to `schemaToJsonSchema`. The manifest builder converts response schemas as output. It converts path, query, and body schemas as input. - **`packages/schema-compat/src/standard-schema/adapters/zod-v4.ts`:** `convertToJsonSchema` accepts a direction and passes it to Zod's `toJSONSchema` options. The `input` converter uses `'input'`. The `output` converter uses `'output'`. - **Generated CLI schemas:** `packages/cli/src/commands/api/feedback-score-schemas.generated.ts` and `route-metadata.generated.ts` are regenerated to match the OpenAPI request-schema change. - **Changeset:** Adds patch releases for `@mastra/schema-compat` and `@mastra/server`. ### Tests - `openapi-utils.test.ts`: Adds a test for a `createRoute` POST route. It checks that transformed path and query inputs use string schemas, that the defaulted query parameter is optional, and that only non-defaulted body and response fields are required. - `api-schema-manifest.test.ts`: Adds a test that checks property schemas and required fields for path, query, body, and response schemas with defaults and transforms. - `zod-v4.test.ts`: Changes the input/output comparison. It now checks that properties and required fields match for a schema without defaults or transforms. It adds a test for a defaulted, transformed field through the routed adapter. ### Scope - 9 files changed, 155 lines added, 62 lines removed (from `git diff --stat` against the merge base). - Two of the nine files are generated CLI schema files. - No exported declarations changed except the `schemaToJsonSchema` signature, which gained an optional parameter. ### Verification The PR objectives report these local checks by the author: `schema-compat` and `server` Vitest runs, `tsc --noEmit` in both packages, and `oxlint` and `prettier --check` on modified files. These results come from the PR description. CI results on the current head are not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com> Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
05a6931471 |
chore: version packages (alpha) (#30172)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases ## @mastra/client-js@1.60.0-alpha.12 ### Minor Changes - Allow `querySpans()` to sort by `model` or `provider`. ([#30096](https://github.com/mastra-ai/mastra/pull/30096)) ```ts orderBy: [{ field: 'model', direction: 'asc' }]; ``` ### Patch Changes - The generated route types for scores now include the `SCORER` and `PROCESSOR` entity types, matching the entity types experiments can emit. ([#30145](https://github.com/mastra-ai/mastra/pull/30145)) - Add span-local error counts. ([#30088](https://github.com/mastra-ai/mastra/pull/30088)) - Updated dependencies [[`56f654f`]( |
||
|
|
1fbc69aa9a |
feat(factory): count the new session page's starters and activity on the server (#30097)
**─────── TLDR ───────** > The new session page now gets its starter counts and activity dates from two small server reads instead of downloading every card of the project. To show a handful of numbers, the page read the whole board: 1,505 KB gzipped on the 8,078-card board measured in #28915. The rules that decide which cards a starter counts now run on the server, and the browser keeps the wording and the layout. Since #30099 a tab that already holds the board only reads the cards that moved. What this PR removes is the first download, and the board the tab had to keep to count on it. Fifth step of removing whole-board reads, after #30080, #30083, #30087 and #30081 (⌘K). The board page comes next. ### Behavior changed opening a new session page ├─ **was** — every card of the project downloaded, then counted in the browser └─ **now** — two reads: the starter counts, and the instants of the period a card changes while the page is open ├─ **was** — the cards that moved, merged into the board the tab kept └─ **now** — the two reads asked again; the instants come back only when one was added or removed, a `304` otherwise choosing "This month" in the activity band ├─ **was** — recounted at once on the board the tab kept └─ **now** — one more read; the band stays up on the week's instants until it answers the live session counts in the activity band ├─ **was** — read off the whole board └─ **now** — read off the sidebar's cards holding a session, already loaded a pull request card whose source reports no state ├─ **was** — finished only in a phase named `done` or `canceled` └─ **now** — finished in any terminal phase of the default board the page served by a Factory server without the two routes └─ **new** — starters and activity band stay hidden, the rest of the page works; feed frames do not ask the two routes again ### Shape changed | | | | |---|---|---| | **+** | `routes/work-item-starters.ts` | the starter rules, moved here from the browser; they read the cards as storage holds them | | **+** | `routes/work-item-activity.ts` | the instants one period needs | | **+** | `hashedBody()` in `routes/board-snapshot.ts` | a computed answer and the `ETag` naming it | | **~** | `starterPrompts.ts` | words the counts, no longer reads cards | | **+** | `queryKeys.boardFacts(id)` | answers computed from the board, refreshed with it | | **+** | `activityDepth(period)` | one home for "Today reads the week's answer" | | **−** | draft page in `pageLoadsBoard` | it no longer reads the board | | **−** | `doneAt` in `boardItems.ts` | its only caller moved to the server | what callers can now ask `GET …/work-items/starters` · `GET …/work-items/activity?since=<instant>` (answers `304` to `If-None-Match`) · `mastra api factory work-item starters` · `mastra api factory work-item activity` ### Decisions - **counted on the server, not from a smaller card list** — the page needs eight numbers, not cards; a new starter now takes a server rule plus its wording - **instants, not buckets** — the browser buckets in the viewer's time zone and Today reuses the week's answer; bucket on the server if the list ever weighs - **no whole-board fallback on an older server** — the two blocks hide until the server is deployed; one `catch` away if you disagree - **counted on stored cards, not on their wire copy** — copying every card per request was three quarters of the read's time; the rules merge the work item's facts with the card's where they read them - **recounted on every request, no memo per board** — a memo would have to expire with the clock (stale pull requests), the board registry and the decisions; the count costs 1 to 5 ms - **`ETag` on the instants, none on the counts** — the counts weigh about 150 bytes; the page asks the instants from the top of the hour so the address repeats and the browser can revalidate - **the other depth stands in while a period loads** — two observers, one enabled; a placeholder would set the band's clock to zero ### Gain Opening the page on 2,500 cards with ~2 KB descriptions: the whole board, 1.2 MB gzipped, becomes about 150 bytes of counts plus 27 bytes per card created or completed in the period. That is 1.9 KB when the cards were filed over 400 days, 67.9 KB when all 2,500 fall in the week (sent uncompressed: instants gzip about 3.5×). Once the page is open, this branch does not beat `main`, it costs a little more. One refresh of one open tab, at most every 5 s: | one refresh of an open tab | 2,500 cards | 10,000 cards | |---|---|---| | `main`, nothing changed | 0.5 ms · 124 B | 1.4 ms · 122 B | | here, nothing changed | 2.4 ms · 154 B | 7.7 ms · 156 B | | `main`, one card filed | 860 B | 868 B | | here, one card filed | 2,030 B | 5,921 B | "here" adds up the three reads the page makes: cards holding a session (`304`), starters, instants. Cards filed over 400 days, medians of 10 rounds in the in-memory route harness. When every card falls in the week the two counts take 0.98 + 1.15 ms at 2,500 cards and 4.27 + 4.60 ms at 10,000. Counting on stored cards took the starters function from 1.11 to 0.29 ms at 2,500 cards and from 4.61 to 1.15 ms at 10,000. ### Watch > [!WARNING] > The starter rules moved from the browser to the server together with their scenario tests. <mark>A porting mistake would show as a wrong number on a starter button</mark> and nowhere else, so compare a few buttons with the board after deploy. on merge: nothing to do. `main` with #30153 is merged into this branch and the CLI route metadata check passes. ### Not verified - [ ] against a real board or Postgres — the timings come from the in-memory route harness - [ ] the `304` in the signed-in app — the route is tested, and headless Chromium revalidated a stand-in answer with the same headers, but the real page was not watched against a real server --- > ████████████████████ **tests** `+1077 −431` — 58% of the additions > ███████████ **source** `+572 −222` > ███ **generated** `+177` > █ **changeset** `+24` > █ **docs** `+2` --------- Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local> |
||
|
|
d97d3c5fd8 |
chore: version packages (alpha) (#30167)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
2742d51576 |
fix(cli): pass filters and lists to Factory list commands (#30153)
**─────── TLDR ───────** > `mastra api factory work-item list` now accepts its filters, and a list of values given to a Factory command reaches the server in the form it reads. Copilot found this on #30081 after it merged. That PR's changeset says `mastra api` can pass the list route's new filters (`started`, `q`, `limit`, `source`). It could not: the command was registered without input, so the JSON was dropped and the whole board came back. This makes that sentence true before it ships. ### Behavior changed `mastra api factory work-item list <project-id> '{"started":"false","q":"login flow"}'` ├─ **was** — the JSON input dropped without a word, every card of the project listed └─ **now** — the filters are sent a list in the input of a Factory command, such as `{"kind":["automation-failed","agent-waiting"]}` on `attention list` ├─ **was** — sent as one JSON string: answered 400, or read as one literal value that matches nothing └─ **now** — one query parameter per value, the form Factory routes read ### Shape changed | | | | |---|---|---| | **~** | `factory work-item list` | takes optional JSON input, like `attention list` and `decision list` | | **~** | `buildUrl(…, route)` | fifth parameter is `{ apiPrefix, repeatLists }`, no longer the prefix alone | ### Decisions - **only on Factory routes** — Mastra API routes parse object-typed query values from JSON, and a single-element `tags` on `trace list`, `log list`, `score list` and `feedback list` only parses in that form; repeating values there would break them - **an empty list and a list of objects keep the JSON form** — an empty list sent as no parameter at all would turn `{"source":[]}` into a request for the whole board ### Watch > [!WARNING] > <mark>A script that already passed a list to a Factory command now sends a different query string.</mark> The old form was answered 400 or matched nothing, so no call that worked changes. on merge: nothing to do. ### Not verified - [ ] against a running Factory server — the tests assert the URL the CLI requests, not the server's answer - [ ] list filters on Mastra API commands (`datasetIds`, `scorerId`, `feedbackType`, `level`) — reading their schemas suggests some are refused in the JSON form the CLI sends today; not run, and not touched here --- > ██████████████████ **tests** `+101 −6` — 77% of the additions > ████ **source** `+24 −4` > █ **changeset** `+7` --------- Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local> |
||
|
|
a4258a989c |
chore: version packages (alpha) (#30127)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
6937417bd4 |
fix(factory): ⌘K reads the clicked card by its id, and three search fixes (#30154)
**─────── TLDR ───────** > ⌘K now reads the card you click by its id before starting it, and three smaller search bugs are fixed. Copilot reviewed #30081 after it merged and left six findings. Four are about the palette and are fixed here, one commit each. The CLI one is #30153, and the sixth was declined on the PR. ### Behavior changed clicking a listed card the search would no longer return, because a more recently updated card took its place among the 20 ├─ **was** — "This card no longer exists", nothing started └─ **now** — the card is read by its id and its session starts Retry after the board cards failed to load, when the intake has no candidate ├─ **was** — the failure notice stayed up for good └─ **now** — only the reads that failed are asked again, and the notice goes typing a source label such as "review" with more than 20 intake items ├─ **was** — the item matching by its label could miss the 20 looked up, and its row never showed └─ **now** — the 20 are ranked on the same text the rows are filtered on typing the number of a card that has no key and no GitHub source ├─ **was** — the server found the card, the palette then hid its row └─ **now** — the row shows the list route asked for `?workItemId=<id>` └─ **new** — the cards with those ids and no other; an id no card has is left out, and a board cursor (`since`) sent with it is ignored, as on the other narrowed lists ### Shape changed | | | | |---|---|---| | **+** | `workItemId` on `workItemListQuerySchema` | repeatable, 100 ids at most, refused with any other filter | | **+** | `cardsWithIds` | beside `cardsFiledFrom` in `work-item-selection.ts` | | **~** | `useBoardRuns({ refetchItems })` | now given the id of the card clicked | | **~** | `useGlobalSearchWorkItems.refetch` | one card by its id, no longer both lists | | **+** | `candidateSearchValue` | one home for the text a candidate row is filtered and ranked on | | **+** | `searchedNumber` | the number the server's search reads, mirrored for the row | what callers can now ask `GET …/work-items?workItemId=<id>` · `mastra api factory work-item list` can pass it once #30153 is in ### Decisions - **a filter on the list route, not `GET /work-items/:id`** — a server older than the filter ignores it and sends the whole board, which still holds the card; a new route would answer 404 there and read as "deleted" - **not the listed copy as a fallback** — starting a run on an id the server no longer has creates the card again (`prepareRunStart`), so a deleted card would come back; the fresh read decides, and a deleted card still gets the toast - **the board page keeps refetching its list on a click** — it moves to the same read with the board page's own PR ### Gain A click in ⌘K asks for one card instead of two lists. ### Watch > [!WARNING] > <mark>Until a server with `workItemId` is deployed, each click on a card in ⌘K downloads the whole board.</mark> It still finds the card there, so the click works, only slower. on merge: `main` with #30099 is merged in and the CLI route metadata regenerated. #30097 regenerates the same file, so whichever merges second runs `pnpm --filter @mastra/factory generate:api-cli-route-metadata` again. ### Not verified - [ ] against a deployed Factory or Postgres — the route tests run on the in-memory harness, the palette tests against stubbed routes - [ ] in a real browser — the palette tests run in jsdom --- > ██████████████████ **tests** `+273 −5` — 65% of the additions > ███████ **source** `+110 −25` > █ **generated** `+18 −2` > █ **changeset** `+16` > █ **docs** `+2 −2` --------- Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local> |
||
|
|
055a8c3b82 | chore: version packages | ||
|
|
b9610409ab |
perf(factory): send an open board only the cards that changed (#30099)
Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local> Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
7c40bc84b6 |
fix(react): load the Studio review queue page by page (#29291)
Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com> Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
ddf1c08cf6 |
perf(factory): ⌘K asks the server for matching cards instead of downloading the board (#30081)
Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local> Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
9e82af0237 |
chore: version packages (alpha) (#30074)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
cd30020f7a |
feat(factory): read the sidebar's cards with ?scope=sessions (#30087)
**─────── TLDR ───────** > Away from a board, the Factory sidebar now reads only the cards holding a session, through a new `?scope=sessions`, so a session page no longer downloads the whole board. Step 2 of taking the full-board read out of the UI. After #30080 the sidebar was the last thing on a session page still downloading the board: it uses the cards to mark each session row with its card's source and to say which sessions wait on a person. The list route now takes `scope=sessions` and answers with every card holding a session plus the cards related to them, in the same shape, and the sidebar reads that. On a page that loads the board anyway (the board pages, and the new-session draft, whose starters and activity read it) the sidebar keeps sharing that one read, as it does on main. The board used to arrive on every page through the sidebar's route loader; it now starts from the loaders of those pages. ⌘K still reads the whole board when it opens. Those are the next PRs. ### Behavior changed a session page, Rules, a new session ├─ **was** — the sidebar downloads the whole board to mark its sessions └─ **now** — it asks for the cards holding a session; the board is not requested going from one of those pages to a board ├─ **was** — the board is already loaded, cards show at once └─ **now** — the board loads when its page opens; the sidebar keeps its marks meanwhile going from a board back to one of those pages ├─ **was** — no request └─ **now** — the sidebar asks for the cards holding a session, marked from the board until they answer `GET …/work-items?scope=sessions` └─ **new** — cards holding any session and their related cards, in board order `scope` with any other value, or sent together with `sessionId` └─ **new** — 400 `invalid_scope`, never the whole board a board page, a new-session draft └─ **unchanged** — one board read, shared by the page and the sidebar ⌘K └─ **unchanged** — still reads the whole board ### Shape changed | | | | |---|---|---| | **+** | `allSessionCards(board)` | picks the scope's cards, kept once per board version | | **~** | `sessionCards` | shares `withRelatedCards` with it, same result | | **~** | `scopedSnapshot` | serialized once per card list; its ETag still names the body | | **~** | `listWorkItems(…, only)` | fourth argument takes `{ sessionId }` or `{ scope }` | | **~** | `boardQueryOptions(…, scope)` | third argument `'sessions'` narrows the board to the scope | | **+** | `pageLoadsBoard(pathname)` | names the pages that load the board themselves | | **+** | `useSidebarWorkItemsQuery` | the board on those pages, the scope elsewhere | | **+** | `prefetchDraft` | the draft's loader: the composer's queries plus the board | what the reviewer now lives with `?scope=sessions` on `workItemList` · `workItemListQuerySchema.scope` · error `invalid_scope` · `queryKeys.workItemsWithSessions(projectId)` · `pageLoadsBoard` ### Decisions - **a scope the server resolves, not the sidebar's session ids** — the ids come from another request and have no upper bound; repeated `sessionId` already works if you'd rather not add the param - **which list the sidebar reads is decided from the URL** — `pageLoadsBoard` is a path pattern next to `isSettingsPath`, because the sidebar's loader only gets the URL; a new page that loads the board has to be added to it, or it downloads both lists; `AppStartup` checks the four pages there are today - **between its two lists the sidebar borrows the other one from the cache, not `keepPreviousData`** — the previous data could be another Factory's cards after switching Factory ### Cost Moving from a board to a session page now sends one request where main sent none. A board opened from a session page is no longer already in memory: its columns wait for the read. The sidebar's list takes a write only for a card it already holds, so a card that gains its first session reaches it with the next refetch, not from the mutation's response. The scope also returns cards held only by a teammate's private session, which the sidebar has no row for. On the server the scoped list is picked and serialized once per board version and shared by every tab. ### Watch on deploy: nothing to migrate, and tabs loaded before the deploy keep reading the whole board from the sidebar. Worth a look afterwards: unscoped `GET …/work-items` should drop to board pages, drafts and ⌘K. Also the size of `?scope=sessions` next to the whole board. A card keeps its session until that session is deleted, so the scoped list grows with every card a session has worked: on a board where most cards have been, the two are nearly the same download and the sidebar needs paging instead. ### Not verified - [ ] a real large board — sizes and timings; the tests use a handful of cards - [ ] a live browser — everything ran under Vitest with MSW - [ ] moving between a session page and a board through the real router — the test drives the sidebar alone, behind a plain link - [ ] `AppStartup` on my machine — its 8 route cases fail on a late `GET /web/status`, on main too; with that request masked all 11 pass --- > ██████████████████ **tests** `+216 −40` — 55% of the additions > ████████████ **source** `+142 −54` > █ **changeset** `+16` > █ **generated** `+15` > █ **docs** `+1 −1` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 The Factory sidebar now loads only cards connected to sessions when it does not need the full board. This reduces unnecessary data loading while keeping session card sources and waiting indicators accurate. ## Changes - Added `scope=sessions` to the Factory work-item list API. - Scoped results include session cards, related cards, and linked pull requests in board order. - Reject invalid scopes and `scope` combined with `sessionId` with `400 invalid_scope`. - Shared related-card selection through `withRelatedCards` and cached `allSessionCards`. - Added scoped ETag and snapshot caching that ignores changes outside the scoped cards. - Added scoped query keys, request handling, and `useSidebarWorkItemsQuery`. - Use the full board on board pages and session-scoped cards elsewhere. - Added placeholder data when switching between the full-board and scoped queries. - Added board and draft prefetching, including immediate board prefetches. - Use a parked-session ID set for sidebar lookups. - Updated API documentation, generated route metadata, and changesets. - Expanded route, startup, sidebar icon, and session filtering tests. ## Validation - Test execution results are not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local> |
||
|
|
b2e0e40b57 |
feat(cli): align score and feedback API commands (#30089)
Closes [OBS-794](https://linear.app/kepler-crm/issue/OBS-794). Adds `feedback create`, `list`, `get`, `replace`, and `review-status`, plus `aggregate`, `breakdown`, `timeseries`, and `percentiles` for both scores and feedback. Creates generate missing IDs and timestamps once and preserve them across bounded HTTP retries and credential fallback. Replacements require the original identity and timestamp; review-status updates preserve missing-record errors. Context-mode omission and feedback author fields are passed through without inferring values. List output preserves pagination and delta cursors, and write output retains the server's success and identity data. Score/feedback schemas are generated from the server routes and bundled for `--schema` without requiring a target schema endpoint. Most of the diff is that generated file. Includes help examples, CLI reference docs, and a minor `mastra` changeset. Validation: 221 CLI API tests, including 57 real-HTTP cases; 20 repeated timeout/credential-fallback runs; CLI typecheck; type-aware lint/precommit checks; docs check with Vale and the CI Vale configuration. Validated all 14 write/analytics help examples against the current server body schemas. Missing-anchor retries, transient failures, credential fallback, older success-only responses, unsupported endpoints, and API-prefix/auth headers are covered. The full `turbo build --filter mastra` stopped in the unchanged `@mastra/playground-ui` declaration step (`tsc found type errors`, with no underlying diagnostic emitted) before building the CLI. Local checks used Node 23.11.0, which is outside the repository's requested engine range. Live Platform writes and package publication/deployment were not tested. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This PR adds commands to create, review, list, and analyze scores and feedback. It also makes retries safer by preserving the same IDs, timestamps, and request data. ## Changes - Added feedback `create`, `list`, `get`, `replace`, and `review-status` commands. - Added `aggregate`, `breakdown`, `timeseries`, and `percentiles` for scores and feedback. - Added validation for write inputs and feedback replacement identity. - Added bounded retries for transient failures and credential fallback. - Preserved pagination cursors, response identity data, and feedback fields. - Bundled generated score and feedback schemas for offline `--schema` output. - Added unsupported-endpoint errors for HTTP 405 and 501 responses. - Updated documentation, help examples, and the `mastra` changeset. - Added HTTP-backed tests for commands, validation, retries, responses, and schemas. ## Validation - The author reports 221 CLI API tests, including 57 real-HTTP cases. - The author reports passing typecheck, lint, precommit, Vale, and documentation checks. - The build stopped in the unchanged `@mastra/playground-ui` declaration step before the CLI build. - Local checks used Node 23.11.0, outside the repository’s requested engine range. - Live Platform writes and package publication or deployment were not tested. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
b0ef22e7bf |
feat(schedules): Add bounded one-off schedules (#25131)
> Opened by @abhiaiyer91 Refs #24610 ## Summary Schedules can now fire once or stop after a given time, so you no longer need to pin a cron expression to a date and clean it up yourself. - **New `completed` status**: the scheduler and timing reconciliation set it when no automatic fires remain. It's written in the same atomic `nextFireAt` check-and-set used to claim a run, so a schedule still fires only once across instances. A cron with no future occurrence left also moves to `completed` instead of erroring. `pause`/`resume` on a completed schedule return 409. Changing `runAt`/`endAt` reactivates it only when the resulting timing can still fire. `list()` hides completed schedules unless you pass `status: 'completed'`. - **Declarative workflow schedules**: `createWorkflow({ schedule: { runAt } })` and `{ cron, endAt }` are supported. Past times are accepted so redeploys don't fail, and a completed schedule isn't re-armed unless its timing changes. - **Trigger kind**: one-off fires report `trigger.kind: 'once'`. - `run(id)` doesn't complete a one-off schedule. ## Surfaces - **Core**: types, validation, scheduler claim logic, create/update/pause/resume/list, declarative sync. - **Storage**: new nullable `run_at`/`end_at` columns for libsql, pg, mysql, mongodb, spanner, convex and in-memory. Existing columns are untouched: one-off schedules store `cron` as `''`. `updateScheduleNextFire` takes an optional `newStatus`. - **Server/client-js/CLI**: request bodies accept `runAt`/`endAt` (one-of rule checked in the schema). Responses include the new fields and `completed`. Route types and CLI route metadata regenerated. - **Studio**: shows the run time for one-off schedules, shows the `endAt` bound, adds a `completed` badge and hides pause/resume for completed schedules. - **Docs + changeset.** ## Not in this PR (remaining #24610 work) - ISO 8601 string inputs for `runAt`/`endAt` (numbers and `Date` are accepted today). - The template `schedule_once` tool. ## Test plan - [x] core: schedules, scheduler, cron, schedule-config and scheduler integration tests (260 passing), clean `tsc` - [x] Shared adapter suite gained tests for `runAt`/`endAt` round-trip and atomic status CAS. Passing on libsql, pg, mysql and mongodb (Docker), plus convex server tests. **Not run on Spanner (no emulator available); typecheck only.** - [x] server schedules handler tests (51 passing, including one-off/bounded creation and body validation) - [x] client-js and playground typecheck clean; playground schedules tests passing <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 Schedules can now run once at a chosen time or repeat until a chosen end time. They complete when their planned runs are over, and changing their timing can make them active again. ## Summary - Added `runAt` for one-off agent and workflow schedules. API-created schedules require a future `runAt`; declarative workflow schedules can register past times as `completed`. - Added `endAt` for cron schedules. A schedule becomes `completed` when its next run would occur after `endAt`, or when no future run remains. - Completed schedules cannot be paused or resumed. Timing changes can reactivate a completed schedule when a future run remains. `list()` hides completed schedules unless callers filter with `status: 'completed'`. - Resuming a paused one-off schedule after its `runAt` has passed allows it to fire on the next scheduler tick. Calling `run(id)` manually does not complete a one-off schedule. - Added the `once` trigger kind for scheduled one-off agent fires. Manual runs remain `manual`. - Declarative workflow schedules preserve completed status across redeploys when timing is unchanged. Timing changes can re-arm them. - Updated schedule APIs, storage adapters, Studio, and documentation. Storage persists `runAt` and `endAt` and supports atomic status updates. ## Checks Current-head CI, build, and test results: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> Co-authored-by: NikAiyer <nick.aiyer@gmail.com> Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com> Co-authored-by: Ehindero Israel <iehindero419@stu.ui.edu.ng> |
||
|
|
005b6f0247 |
feat(factory): list one session's cards with ?sessionId= (#30080)
**─────── TLDR ───────** > A Factory session page now asks for its own cards with `?sessionId=`, so its tab title, breadcrumb and pull request links stop waiting for the whole board. On a large board the work-item list is the biggest download the UI makes, and three places on a session page read all of it to find one card. The list route now takes an optional, repeatable `sessionId` and answers with the cards holding those sessions plus the cards related to them, in the same shape. `PageTitle`, `StatusLine` and `RelatedFactorySessions` read that instead. This is step 1 of taking the full-board read out of the UI. The sidebar still loads the board on these pages until the next PR, so total bytes on a session page don't drop yet. ### Behavior changed a session page while the board is still downloading ├─ **was** — tab title, breadcrumb and PR links wait for the whole board └─ **now** — they show as soon as the session's own cards arrive `GET …/work-items?sessionId=a&sessionId=b` └─ **new** — cards holding those sessions and their related cards, in board order a card outside that scope changes └─ **new** — the scoped read gets a 304, its ETag hashes the body a `sessionId` that is empty or longer than 512 characters └─ **new** — 400 `invalid_session_id`, never the whole board `GET …/work-items` with no `sessionId` └─ **unchanged** — the whole board, same ETag and gzip path ### Shape changed | | | | |---|---|---| | **+** | `relatedCardIndex(cards, facts)` | extracted from the UI so the server scope uses the same rules | | **~** | `relatedWorkItemIndex` | now a wrapper over it, same signature, callers untouched | | **+** | `scopedSnapshot` | sibling of `boardSnapshot`, with a body-hash ETag | | **+** | `useSessionWorkItemsQuery` | the scoped read, keyed under the board key | what the reviewer now lives with `?sessionId=` on `workItemList` · `workItemListQuerySchema` · `@mastra/factory/work-items/related-cards` · `queryKeys.sessionWorkItems(projectId, sessionId)` ### Decisions - **related cards ride along in the scoped answer** — the header's related links read them; drop the second pass in `sessionCards` to return holders only - **scoped key nested under the board key** — feed invalidation and the board's optimistic writes reach it unchanged; a sibling key would need each wired again - **no cap on repeated `sessionId`** — the sidebar PR knows the real count; one `.max()` on the schema then ### Cost Until the sidebar moves, a session page makes one request more than before: the scoped read, next to the board read the sidebar still makes, and again on each feed event (a 304 when its cards didn't change). The server still loads the cached board to answer it, then stringifies and hashes the picked cards on every request. ### Watch on deploy: nothing to migrate, and tabs loaded before the deploy keep calling the unscoped route. Worth a look afterwards: response size and duration of `GET …/work-items` with and without `sessionId`. The unscoped count per session page stays flat until the sidebar PR. ### Not verified - [ ] a real large board — sizes and timings; the tests use a handful of cards - [ ] a live session page in a browser — the three surfaces ran under Vitest with MSW only --- > ██████████████████ **tests** `+358 −53` — 58% of the additions > ███████████ **source** `+223 −96` — 57 of the removed lines are relation logic leaving the UI > █ **generated** `+18 −2` — CLI route metadata > █ **changeset** `+16` > █ **docs** `+2` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 A session page can now request only the work-item cards connected to its session. This lets page details load without waiting for the full board request. ## Changes - Added repeatable `sessionId` filtering to the work-item list route. - Returns matching cards and related parents, children, and pull requests in board order. - Returns `400 invalid_session_id` for invalid session IDs. - Added scoped snapshots with body-based weak ETags and conditional `304` responses. - Extracted shared relationship logic into `relatedCardIndex`. - Added session-scoped React Query keys, requests, and cache updates. - Updated page titles, status lines, related sessions, and pull-request links to use scoped cards. - Preserved unscoped board behavior. - Added route, hook, and UI test coverage, documentation, changesets, and generated route metadata. ## Known limitation The sidebar still loads the full board. The scoped request adds another request and still reads the cached board server-side. ## Validation Test execution status: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local> |
||
|
|
3a6ca42696 |
chore: version packages (alpha) (#30026)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
c860b9bb43 |
feat(observability): support OSS feedback replacement (OBS-887) (#30059)
Implements [OBS-887](https://linear.app/kepler-crm/issue/OBS-887/add-oss-feedback-replacement-and-export). Add OSS `PUT /api/observability/feedback/:feedbackId` with the existing wrapped client request. Replacements retain the original feedback ID, trace ID, timestamp, and tenant; omitted optional fields are cleared. A full replacement can create a missing record. OSS persists locally before responding, then independently notifies supporting exporters. Resolve mode still requires the local anchor. The SDK also exposes optional `replaceFeedback()` for independent exporter delivery without a producer-side storage lookup. Replacement events use a separate optional exporter hook. `MastraPlatformExporter` sends PUT with stable identity across bounded anchor retries, and flush/shutdown drain deliveries. Older exporters skip replacements rather than replaying them as creates. Unsupported storage/package combinations return 501 or skip unavailable export support. No UI changes; review-status PATCH propagation remains tracked in OBS-785. In-memory, PostgreSQL vNext, DuckDB, and ClickHouse vNext support replacement. In-memory, PostgreSQL, and DuckDB enforce replacement identity at the write. PostgreSQL coordinates writes by feedback ID, including duplicates submitted with a different timestamp. Duplicate HTTP creates return the stored identity and timestamp and re-notify exporters with accepted values. Tenant mismatches remain hidden, and an omitted SDK replacement author stays null. HTTP/exporter creates use `onConflict: 'ignore'` so a delayed original create doesn't undo an edit; direct storage calls keep their legacy upsert default. **ClickHouse requires no migration:** it uses the existing schema and read-before-insert protection. Sequential delayed creates are covered, but overlapping writes from separate processes can race; this is not a globally ordered or exactly-once protocol. Latest review fixes: DuckDB's lazy facade delegates replacement to its guarded writer; concurrent coverage runs 20 overlapping request pairs per identity variant. Direct storage replacements normalize an omitted author to null. PostgreSQL single-feedback reads use the primary for read-after-write consistency, while list/aggregate reads retain the configured read client. Batch advisory locks use one ordered query with unchanged lock keys. Validation: the stronger DuckDB regression failed on all four identity variants before the facade fix. Afterward, the entire DuckDB package passed 718 tests across 21 files in three consecutive runs. PostgreSQL passed 57 feedback tests, including a real stale read snapshot and overlapping reversed 1,000-ID batches. Shared replacement tests passed on in-memory (12), and the new author regression passed on ClickHouse without a migration. Core/storage builds and declarations, typed lint, and formatting passed. Earlier HTTP (85 cases on each of four adapters), generic Hono routes (2,848), server/system, exporter, and docs checks remain recorded in the PR history. Local tests use Node 23.11.0; CI validates the supported runtime. The unrelated Traces UI fade assertion failure was fixed in https://github.com/mastra-ai/mastra/pull/30068; this branch includes that fix from main. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This PR lets users replace feedback without changing its identity. It stores the replacement locally and sends it to supported exporters without allowing delayed creates to overwrite it. ## Changes - Added `PUT /api/observability/feedback/:feedbackId`. - Preserved the feedback ID, trace ID, timestamp, and tenant. - Cleared omitted optional fields. - Added capability detection and `501` responses for unsupported storage. - Added replacement event types, SDK support, client types, route metadata, and documentation. - Added replacement delivery, stable retries, flush handling, and shutdown draining for `MastraPlatformExporter`. - Added replacement support for in-memory, PostgreSQL vNext, DuckDB, and ClickHouse vNext. - Added `onConflict: 'ignore'` for HTTP and exporter creates. Direct storage calls retain their upsert default. - Older exporters skip replacements instead of replaying them as creates. - Added ClickHouse support without a migration. Concurrent writes from separate processes can still race. - No UI changes were included. ## Validation The author reports passing the HTTP route and contract suites, feedback storage suites, partition and SQL tests, server and system tests, record-builder tests, build, typecheck, lint, and documentation checks. For the current head, the available CI result is `2027dev Evals: skipped`. Other listed CI checks target different commits or remain in progress. Current-head CI results are otherwise not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
9751742c44 |
feat(observability): add aggregated trace root contracts (#30054)
Adds the shared contract for the Platform aggregated-roots experiment in [OBS-891](https://linear.app/kepler-crm/issue/OBS-891): optional `rootSource`, `rootKind`, runtime/error totals, and availability reporting. Legacy requests retain their cursor bindings; aggregated cursors are separate and aggregated metadata predicates and delta requests are rejected. The planner requires host opt-in. OSS servers report the capability as false and explicitly reject aggregated requests; storage implementations and UI are outside this prerequisite. Generated client and CLI contracts are updated. Validated with 102 core tests, 146 server tests, core typecheck, core/server/client builds, and formatting/lint checks. A mutation check confirms that removing root-source cursor binding fails the regression test. Platform implementation follows after this merges and a snapshot is published. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This PR defines how systems can report aggregated trace roots and their totals. Systems without support reject these requests, while existing legacy trace queries continue to work. ## Changes - Added `rootSource` with `legacy` and `aggregated` values. - Added aggregated-root response fields: - `rootKind` - `runtimeDurationMs` - `errorCount` - Bound trace and group cursors to their root source. - Rejected aggregated delta requests. - Rejected metadata predicates for aggregated roots. - Kept `runtimeDurationMs` and `errorCount` response-only. - Added the `traceQueryAggregatedRoots` capability, which defaults to `false`. - Added a `501 TRACE_QUERY_UNSUPPORTED` response for unsupported aggregated requests. - Updated generated client and CLI route contracts. - Added core and server regression tests. - Added release changes for `@mastra/core`, `@mastra/client-js`, `@mastra/server`, and `mastra`. ## Validation Not available from completed checks on the current head. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
9ee332c1fd |
feat(ui): rounded squircle favicon for Studio, Factory and docs (#30040)
The tab icon gets rounded corners, matching the rounded style used everywhere else in the UI. Today's tile has a 5% corner radius, which reads as a plain square at 16px. The new tile is a squircle (superellipse, n=7), the smooth corner shape app icons use. The logo is at 80% of the tile width and centered, so it has a little room from the corners. ## Before / After | Before | After | | --- | --- | | <img src="https://github.com/user-attachments/assets/de26b6ac-83db-4212-9a46-a73b36daa714" width="400" alt="Before"> | <img src="https://github.com/user-attachments/assets/d1f885ba-c647-4fa6-9a7d-58e7b72dcf02" width="400" alt="After"> | ## What changed - Studio (`mastra-dark-tile.svg`, green dev variant), Factory (`mastra.svg`, `mastra-dev.svg` and the four session status icons) and the docs `favicon.ico` all come from the same source, so they stay identical. - Factory's status dot still sits on the logo's bottom-left dot. - `mastra studio` now serves `/mastra-dark-tile.svg` as a file. It still checked for the old `/mastra.svg` name, so the tab got the page HTML instead of the icon. ## Scope - Factory's PWA and apple-touch PNGs stay as they are: the OS masks those itself, so a rounded tile inside them would look double-rounded. - Platform and mastra.ai get the same icon in their own PRs. ## Testing 1. Run Studio or Factory: the tab shows the rounded tile (green logo in dev). 2. Factory: open a session, and the colored status dot shows on the same rounded tile. 3. Docs: the tab shows the rounded tile from `favicon.ico`. 4. Run `mastra studio`: the tab shows the rounded tile. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This PR makes the Mastra favicon more rounded across Studio, Factory, and the docs. It also makes Studio serve the correct icon file so browsers display it. ## Changes - Updated Studio, Factory, and Factory session-status SVGs with the rounded tile design. - Replaced the docs `favicon.ico`. - Updated Studio asset handling to serve `/mastra-dark-tile.svg`, including nested paths. - Added a test for serving the Studio favicon instead of the SPA HTML. - Added patch changesets for `mastra` and `@mastra/factory`. ## Validation - Test results: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
695599b8ab |
chore: version packages (alpha) (#30013)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
2c4f13b0e5 |
Avoid timeouts when switching running-session models (#29979)
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com> |
||
|
|
8bce7717eb |
chore: version packages (alpha) (#29986)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
bd1fca831d |
fix(deployer): build and serve file-based agents with CloudflareDeployer (#30003) | ||
|
|
2d16c84823 |
feat(factory): Factory-wide sandbox environment variables (#29923)
Factory members can now add environment variables for every sandbox in a
Factory, under Settings › Manage Factory › Environment variables. Each
variable is marked Build, Runtime, or Both.
Runtime variables reach every command in the Factory's sandboxes.
Adding, editing or deleting one takes effect on the next command in a
sandbox that's already running, with no restart (processes already
running keep their old env). Build variables reach template builds and
Factory's setup commands, never runtime commands, and editing one makes
the next build rebuild the template.
Values are encrypted at rest, never returned by the API or shown in the
UI after saving, and never put into template names, identity, or images.
Saving is blocked when sign-in is on but no credential encryption key is
configured.
To make builds work, `FactorySandboxContext` gets two optional fields.
Providers pass `buildEnv` only to a build-only mechanism and put
`buildEnvRevision` (a random id, never derived from values) in template
identity:
```ts
const { buildEnv, buildEnvRevision, ...rest } = ctx;
return createRepoTemplate({ ...rest, buildEnvRevision });
```
The platform and E2B workspace packages pass Build variables to template
builds. Docker keeps them out of the image and its identity, and doesn't
apply them to template builds yet. The routes are also available from
the CLI as `mastra api factory project environment variables
list|set|update|delete`.
Tested with unit tests on a real local sandbox, route tests that check
no response ever contains a value, and UI tests. I also ran it end to
end against a Platform sandbox: a Runtime variable's new value showed up
after an edit and was gone after a delete, and a Build variable was seen
by setup but not at runtime, with an edit producing a new build.
Part of FACT-554
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
Factory admins can save environment variables for a project and choose
whether each one is used to build sandboxes, run commands, or both.
Factory protects the values and applies changes to later commands or
relevant builds.
## Summary
- Added encrypted, project-scoped storage and authenticated API routes
to list, set, update, and delete sandbox environment variables.
Responses include metadata, not values. When sign-in is enabled without
a credential encryption key, writes are blocked.
- Added a Factory settings interface and CLI commands to manage
variables with Build, Runtime, or Both scopes.
- Runtime variable changes refresh the environment before later
commands. Build variables are available to build contexts and setup
commands. Build-variable changes update a revision used by supported
providers for template identity.
- Reads are served from memory per server: the revision and decrypted
values are reused until a variable changes. A write clears this server's
entry and is announced on Factory's event bus so other servers drop
theirs; a cached read is re-checked after a minute with a cross-process
bus, or after a second without one.
- Added optional `buildEnv` and `buildEnvRevision` fields to
`FactorySandboxContext`. Platform and E2B pass Build variables to
template builds. Docker excludes these fields from template input and
identity; Docker template builds do not receive the variables.
- Added documentation and tests for storage, API routes, settings, CLI,
sandbox behavior, and provider handling.
**Diff size:** 54 files changed; 3,241 lines added and 50 removed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
|
||
|
|
23cc34a9c5 |
chore: version packages (alpha) (#29938)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/factory@0.28.0-alpha.6 ## @mastra/code-sdk@1.19.0-alpha.6 ## @mastra/playground-ui@69.0.0-alpha.7 ## @mastra/client-js@1.60.0-alpha.6 ## @mastra/react@1.15.0-alpha.6 ## @mastra/deployer-cloud@1.83.0-alpha.6 ## @mastra/longmemeval@1.1.42-alpha.6 ## @mastra/opencode@0.1.42-alpha.6 ## create-factory@0.4.3-alpha.6 ## mastracode@0.50.0-alpha.6 ## @mastra/agent-builder@1.2.1-alpha.3 ## mastra@1.39.0-alpha.6 ## @mastra/core@1.83.0-alpha.6 ## @mastra/deployer@1.83.0-alpha.6 ## @mastra/editor@0.17.1-alpha.4 ## @mastra/mcp@2.9.0-alpha.3 ## @mastra/mcp-docs-server@1.3.13-alpha.9 ## @mastra/memory@1.41.1-alpha.3 ## @mastra/rag@2.7.3-alpha.2 ## @mastra/schema-compat@1.3.18-alpha.0 ## @mastra/server@1.83.0-alpha.6 ## @mastra/elysia@0.1.23-alpha.6 ## @mastra/express@1.5.27-alpha.6 ## @mastra/fastify@1.5.27-alpha.6 ## @mastra/hono@1.7.25-alpha.6 ## @mastra/koa@1.7.27-alpha.6 ## @mastra/nestjs@0.3.0-alpha.6 ## @mastra/next@0.2.41-alpha.6 ## @mastra/server-adapters-test-suite@0.3.0-alpha.3 ## @mastra/tanstack-start@0.2.41-alpha.6 ## @mastra/upstash@1.6.1-alpha.0 ## @mastra/vectorize@1.1.5-alpha.0 ## @mastra/voice-google-gemini-live@0.14.19-alpha.0 ## @mastra/voice-openai-realtime@0.14.9-alpha.0 ## @mastra/voice-xai-realtime@0.2.18-alpha.0 ## @mastra/inngest@1.11.2-alpha.4 ## @mastra/temporal@0.6.0-alpha.6 ## create-mastra@1.39.0-alpha.6 ## @internal/playground@1.39.0-alpha.6 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
8d4f090107 |
Factory: replace work-item comments with a card description (#29062)
> Opened by @DSchau ## What This removes comments from Factory work items across the API, storage, agent tools, integrations and UI. In their place, each card gets a single **description**. **Removed** - Comments storage: `work_item_comments`, `work_item_comment_mentions` and `work_item_activity` are no longer registered. - The comment CRUD routes, `/mention-roster` and the `/feed-events` SSE stream. The stream only ever refreshed comment queries. - The `mention` and `activity` attention kinds and their providers. - Work-item fields `commentCount` and `feedActivityAt`. - Slack integration: `aside` messages are no longer saved as card comments (the agent still ignores them), and card comments are no longer published back to Slack. The Slack emoji table, which existed only to support that, is gone too. - Integration hooks: `IntegrationContext.feed` and the integration `feedPublisher` hook. - Rules dispatcher: kickoffs no longer get the comment feed injected. - UI: the feed panel, composer, comment counts on cards, the workspace Comments button, `?comment=` deep links and the feed-events provider. - Audit actions `comment_*`, and `commentId` on `factoryWorkItemUrl()`. **Added** - A nullable `description` column on work items. Pg adds it on boot with `ADD COLUMN IF NOT EXISTS`. - Create and update routes accept `description`; a blank value clears it. - Agent tools: - `factory_create_work_item` takes `description` instead of `brief`. - `factory_update_work_item` can edit the description. - `factory_inspect_work_item` returns it. - Kickoffs append a `<work-item-description>` block, with an escaped boundary and a "data, not instructions" preamble. The playground-ui transcript renderer and the TUI now handle that tag instead of `<work-item-feed>`. - The card tray shows title, then an editable description, then the activity timeline. Dragging a candidate with a custom prompt saves that prompt as the card description. Docs PR: mastra-ai/softwarefactory-docs, branch `slack/1793395240-241709`. ## Proof - `mastracode/factory`: `tsc --noEmit` and `oxlint --type-aware` are clean, and the full vitest suite passes (226 files). - `factory-ui`: typecheck and lint are clean. Full suite: 2,227 tests pass. Two failures remain, and both also fail on unmodified `HEAD`: - `BoardPageProposedRun` "leads with the suggested run…" - `SessionsSectionGroups` "says so when every group…hidden" - `playground-ui` (`skill-activation`, `span-payload-signal`), `tui` (`render-messages`) and `core` (`signals`) tests pass, and those packages typecheck clean. - New and changed tests cover: - the description in dispatcher kickoffs, including tag escaping and the replay guard - setting and clearing the description through the tools - the attention inbox across the remaining kinds - the description editor in the board virtualization and grouped-list tests ## Unverified - Not run against a real Postgres. The new column relies on the existing boot-time `ADD COLUMN IF NOT EXISTS`. - The Playwright e2e specs were not run. Only their feed-events stubs changed. ## Risk: medium - **Existing data stays in the database.** Factory storage has no drop-table operation, so the old comment tables and the `comment_count`/`feed_activity_at` columns remain unused. Old `mention`/`activity` receipt rows are inert, because reads are filtered by kind. A follow-up migration could drop them. - **Breaking API change.** Callers sending `brief` to `factory_create_work_item`, or calling the removed routes or attention kinds, will break. See the changeset. - **Old transcripts.** Messages that contain the old `<work-item-feed>` trailer now show as raw text instead of a folded row. - **Session owner names.** The session hover card now names people only from the audit trail. An earlier owner who never appears there shows as a raw id. Previously the mention roster could fill in their name from comment authors or Slack links. - **New card composer.** It still takes only a title; the description is added from the card tray. --------- Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local> |
||
|
|
779d2875b1 |
chore: version packages (alpha) (#29912)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/auth-studio@1.4.0-alpha.1 ## @mastra/factory@0.28.0-alpha.5 ## @mastra/mcp-apps-components@0.1.0-alpha.5 ## @mastra/playground-ui@69.0.0-alpha.6 ## @mastra/client-js@1.60.0-alpha.5 ## @mastra/react@1.15.0-alpha.5 ## @mastra/deployer-cloud@1.83.0-alpha.5 ## @mastra/longmemeval@1.1.42-alpha.5 ## @mastra/opencode@0.1.42-alpha.5 ## create-factory@0.4.3-alpha.5 ## @mastra/code-sdk@1.19.0-alpha.5 ## mastracode@0.50.0-alpha.5 ## @mastra/agent-builder@1.2.1-alpha.2 ## mastra@1.39.0-alpha.5 ## @mastra/core@1.83.0-alpha.5 ## @mastra/deployer@1.83.0-alpha.5 ## @mastra/editor@0.17.1-alpha.3 ## @mastra/mcp@2.9.0-alpha.2 ## @mastra/mcp-docs-server@1.3.13-alpha.8 ## @mastra/memory@1.41.1-alpha.2 ## @mastra/rag@2.7.3-alpha.1 ## @mastra/server@1.83.0-alpha.5 ## @mastra/elysia@0.1.23-alpha.5 ## @mastra/express@1.5.27-alpha.5 ## @mastra/fastify@1.5.27-alpha.5 ## @mastra/hono@1.7.25-alpha.5 ## @mastra/koa@1.7.27-alpha.5 ## @mastra/nestjs@0.3.0-alpha.5 ## @mastra/next@0.2.41-alpha.5 ## @mastra/server-adapters-test-suite@0.3.0-alpha.2 ## @mastra/tanstack-start@0.2.41-alpha.5 ## @mastra/libsql@1.30.0-alpha.2 ## @mastra/turso@0.1.21-alpha.2 ## @mastra/inngest@1.11.2-alpha.3 ## @mastra/temporal@0.6.0-alpha.5 ## create-mastra@1.39.0-alpha.5 ## @internal/playground@1.39.0-alpha.5 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
bfda77de97 |
fix(core,server): scope experiment comparison by organization and project (#29479)
`mastra.datasets.compareExperiments` had no way to scope by organization or project, and the compare route ignored the tenancy query params the other dataset routes accept. A caller scoped to one tenant could compare experiments from another by ID. `compareExperiments` now takes `organizationId` and `projectId`. When either is set, every experiment must match, otherwise it throws `EXPERIMENT_NOT_FOUND` (same as a missing row, so other tenants' IDs don't leak). The route reads `tenancyQuerySchema` and passes the scope to both the dataset lookup and the comparison. Unscoped calls behave as before. Added manager tests for a cross-tenant pair (rejected, fails without the fix) and a same-tenant pair. Core datasets tests (490), server datasets handler tests (106), tsc and lint pass. Fixes PLTFRM-3165 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 When a caller chooses an organization or project, experiment comparisons now stay within that scope. Experiments outside it are treated as not found, so their results are not exposed. ## Changes - `mastra.datasets.compareExperiments` accepts optional `organizationId` and `projectId` values. - When either scope is set, the manager checks every distinct experiment ID. It throws `EXPERIMENT_NOT_FOUND` if an experiment is missing or outside the scope. - The comparison route reads tenancy query parameters and passes them to the dataset lookup and comparison. - If scoped comparison is requested with a core version that does not advertise tenancy enforcement, the route returns HTTP 501 before reading data. Unscoped comparisons remain unchanged. - Tests cover cross-organization rejection, same-organization comparisons, and the route’s behavior when the core feature is unavailable. - Updated generated route metadata and added patch changesets for `@mastra/core` and `@mastra/server`. ## Validation Current-head test, TypeScript, and lint results are not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> |
||
|
|
7c4dd88400 |
chore: version packages (alpha) (#29889)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
2cfa92405b |
feat(observability): add shared text search query contracts (#29897)
Adds shared text-search query contracts for Platform integration: optional `textSearch` on `querySpans()` and `queryTraces()`, normalization, a 3–256 character limit, and cursor binding. This does not implement or enable text search in OSS stores. Adds capability reporting, request forwarding, and unsupported-store rejection, with generated client types and CLI metadata. Platform search implementation and rollout flags follow in OBS-867. Delta search is rejected for now. Public documentation is unchanged; changesets only describe the contract additions. Validated with 404 focused tests, 5 type tests, and core/server/client typechecks. The 228 core query tests were rerun after reducing the limit to 256. New contract tests also fail against the original implementation. Fixes [OBS-866](https://linear.app/kepler-crm/issue/OBS-866/add-shared-text-search-query-contracts). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 This PR gives span and trace queries a standard way to request text search. It also lets clients check whether a storage provider supports that search, so unsupported searches return an error instead of misleading results. ## Summary - Add optional `textSearch` to span and trace query contracts. Trim outer whitespace, convert input to lowercase, and require 3–256 Unicode code points. - Bind normalized search text to query cursors. Reject `textSearch` for delta trace queries. - Add span and trace text-search capability fields. Default missing fields to `false` for compatibility with older responses. - Forward search input to query planners. Return HTTP 501 when the configured storage provider does not declare support. - Report text-search capability only when Core can parse the field and the storage provider declares the matching feature. - Add tests for validation, normalization, cursor binding, unsupported stores, and compatibility behavior. ## Validation Reported test and typecheck results: not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
85f28b583a |
fix(factory): remove the unreleased allowWorkingPhase from intake routes (#29894)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
6cbcaa9b4c |
feat(factory): place new cards by intake routes alone, matching any work item fact (#29754)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
a3c9f4b3c3 |
feat(factory): let intake routes move cards into any phase (#29884)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
6deb16047f |
chore: version packages (alpha) (#29719)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. ⚠️⚠️⚠️⚠️⚠️⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`. ⚠️⚠️⚠️⚠️⚠️⚠️ # Releases > The changelog information of each package has been omitted from this message, as the content exceeds the size limit. ## @mastra/slack@1.9.0-alpha.0 ## @mastra/factory@0.28.0-alpha.3 ## @mastra/code-sdk@1.19.0-alpha.3 ## mastracode@0.50.0-alpha.3 ## @mastra/observability@1.24.0-alpha.2 ## @mastra/core@1.83.0-alpha.3 ## @mastra/mcp-apps-components@0.1.0-alpha.3 ## @mastra/playground-ui@69.0.0-alpha.4 ## @mastra/server@1.83.0-alpha.3 ## @mastra/server-adapters-test-suite@0.3.0-alpha.1 ## @mastra/platform-workspace@1.13.0-alpha.0 ## @mastra/auth-better-auth@1.1.11-alpha.1 ## @mastra/client-js@1.60.0-alpha.3 ## @mastra/react@1.15.0-alpha.3 ## @mastra/deployer-cloud@1.83.0-alpha.3 ## @mastra/longmemeval@1.1.42-alpha.3 ## @mastra/opencode@0.1.42-alpha.3 ## create-factory@0.4.3-alpha.3 ## @mastra/arize@1.3.30-alpha.2 ## @mastra/arthur@0.4.30-alpha.2 ## @mastra/braintrust@1.3.27-alpha.2 ## @mastra/datadog@1.4.22-alpha.2 ## @mastra/deepeval@0.1.24-alpha.2 ## @mastra/laminar@1.3.32-alpha.2 ## @mastra/langfuse@1.6.6-alpha.2 ## @mastra/langsmith@1.4.3-alpha.2 ## @mastra/otel-bridge@1.5.22-alpha.2 ## @mastra/otel-exporter@1.5.2-alpha.2 ## @mastra/posthog@1.4.7-alpha.2 ## @mastra/sentry@1.2.32-alpha.2 ## @mastra/agent-builder@1.2.1-alpha.1 ## mastra@1.39.0-alpha.3 ## @mastra/connect@1.3.2-alpha.2 ## @mastra/deployer@1.83.0-alpha.3 ## @mastra/editor@0.17.1-alpha.2 ## @mastra/fastembed@1.3.7-alpha.0 ## @mastra/mcp-docs-server@1.3.13-alpha.6 ## @mastra/memory@1.41.1-alpha.1 ## @mastra/elysia@0.1.23-alpha.3 ## @mastra/express@1.5.27-alpha.3 ## @mastra/fastify@1.5.27-alpha.3 ## @mastra/hono@1.7.25-alpha.3 ## @mastra/koa@1.7.27-alpha.3 ## @mastra/nestjs@0.3.0-alpha.3 ## @mastra/next@0.2.41-alpha.3 ## @mastra/tanstack-start@0.2.41-alpha.3 ## @mastra/convex@1.8.1-alpha.0 ## @mastra/pg@1.36.0-alpha.2 ## @mastra/inngest@1.11.2-alpha.2 ## @mastra/temporal@0.6.0-alpha.3 ## create-mastra@1.39.0-alpha.3 ## @internal/playground@1.39.0-alpha.3 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
8b46b512f8 |
feat(factory-ui): drive the board UI from each board's own loop phases (#29712)
## The Factory board UI follows each board's own loop
The board UI had Work's phase names built in. It offered Investigate,
Plan, Build and Review moves, triage decisions, column guards and
starter prompts, and counted "shipped" cards, all by checking for
`work`, `intake`, `planning`, `execute`, `pr-review` or `done`. A custom
board running the pull request loop got none of it.
The server's board catalog now reports `flow` on each board, which says
which phase plays each part of the loop: `triage`, `build`,
`selfReview`, `pullRequestReview`, `completed`, `canceled`. The catalog
adds no `default` field; the UI identifies the default board by id
(`DEFAULT_BOARD_ID`). For older servers that omit `flow`, the UI
backfills it for Work and the retired Review board, keeping only phases
the board has.
The UI's new `boardFlow.ts` reads `flow`, and these parts now use it
instead of Work literals:
- card moves (`cardPrimaryAction`)
- column stage options and pull request guards (`boardStages`)
- triage decisions ("Accept and plan" or "Accept and build", and
"Close")
- starter prompts
- shipped counts in activity
- the "Mark …" menu label and status
- the requested-reviewer filter
- intake feeds, label routing, and search
Boards without a loop keep the generic "move to the next phase" action.
Also, a board that doesn't build no longer treats its first working
phase as triage.
### Test plan
- [x] `factory-ui`: `typecheck`, `lint`, `test:unit` (626 passed). New
tests cover a `ship` board fixture: moves by its own phase names,
resume, stage options, triage decisions in the menu, and shipped counts.
- [x] `factory-ui` `test:msw`: 1808 passed. The 16 failures are the
existing locale and time-format tests (OMSection, MemorySettings,
TranscriptMessageMeta, SessionsSectionShowMore, NewSessionStarters), and
they fail on the base branch too.
- [x] Server catalog test asserts Work's `flow` and that the catalog has
no `default` field or `flow.buildContext`. CLI route metadata
regenerated; changeset added.
Stack: third of three PRs.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
Each board can have its own steps, but the UI used to assume every board
followed Work’s process. This change makes the UI use each board’s
configured steps so its actions, filters, and counts fit that board.
## Summary
- The board catalog now reports each board’s configured loop phases,
including triage, build, review, completion, and cancellation when
present. The UI identifies the default board by its ID; the catalog does
not add a `default` field.
- Board actions, stage options, triage decisions, resume behavior, and
pull-request rules now use the board’s configuration instead of fixed
Work phase names.
- Board feeds, label routing, starter prompts, search, reviewer filters,
and shipped activity now use the default board or the relevant board’s
phases.
- Boards without a configured loop retain phase-transition behavior.
Boards that review pull requests but do not build do not offer a
new-card composer.
- For older servers that omit flow data, the UI backfills known phases
for the default Work board and the retired Review board.
- Added fixture and test coverage for custom phases, flow behavior, and
the older-server fallback.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Rebased onto #29346 and #29707
The kept Review board in the UI runs on its flow too. Its card button is
Review or Re-review in its `review` phase, and a board that reviews pull
requests but builds nothing offers no "new card" composer.
`KEPT_REVIEW_MOVE` and the `kind === 'review'` checks are gone.
---------
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
|
||
|
|
d889bd41f2 |
feat(factory): let intake routes move cards on pull request events (#29711)
## Routes can move cards on pull request events
Intake routes decide where a card goes when its source changes
(`work_item.created`, `closed`, `reopened`). This PR adds pull request
events to that list: `pull_request.opened`, `pull_request.synchronized`
(a push), `pull_request.review_requested`, `pull_request.merged` and
`pull_request.closed`. With these, any board can say what a merge, a
close or a push does to its cards.
```json
{ "name": "Merged pull requests ship", "on": ["pull_request.merged"], "target": { "boardKey": "ship", "phaseKey": "shipped" } }
```
How it works:
- The integration's default rule decides first, as it always has, then
hands its move to the routes. A route on the card's board that names the
event sends the card to the route's phase instead.
- A route that targets the phase the rule already picked keeps the
rule's move whole, including its message and its re-entry. For example,
a push re-enters PR review to restart the review pass.
- When no enabled route takes the card, the rule's own move still runs.
Disabling or deleting a route never strands a merged card.
- A merge or close moves only an unfinished card. A push or review
request can bring a finished pull request card back into review.
- On a board with no pull request loop, a merge or close moves the card
only where a route says.
- Pull request events never cancel each other out.
Work gets five default routes that keep today's behaviour: a merge goes
to Done; a pull request closed unmerged sends its own card to Canceled
and an issue card back to Intake; a push or review request goes back to
PR review. Existing projects get them once, and deleted defaults aren't
added back. Work's route seeds now live in `src/boards/work-routes.ts`.
### Proof
- `src/integrations/github/any-board-pr-loop.test.ts` runs on LibSQL and
Postgres. It creates a stored board `ship` with its own phase names
(inbox, think, make, check, pr, shipped, dropped) through the real
boards write path, routes GitHub issues and pull requests to it, and
drives the whole loop through the real dispatcher and GitHub rules:
- the pull request attaches to the ship card
- the verdict records in `pr`
- self-review hands off
- a push re-reviews
- a merge lands in `shipped`
- a close goes back to rest
The same test runs against Work. Break-proofs: limiting `boardFlow` to
Work, or limiting merge handling to Work, fails the ship cases.
- `src/boards/phase-key-literals.test.ts` is a grep gate that fails when
Work's board or phase keys appear in runtime code outside the Work seed
and the legacy-migration files.
- Route tests cover these cases:
- a route agreeing with the rule
- a route retargeting the card
- a finished card
- a board with no loop
- a disabled merge route (break-proofed)
### Test plan
- [x] `pnpm check`, `oxlint`, full factory suite on LibSQL and Postgres
(only known flakes fail)
- [x] CLI route metadata regenerated; changeset added
Stack: second of three PRs.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
Cards can now move when a pull request is opened, updated, reviewed,
merged, or closed. Built-in routes move cards to the right Work phase,
and teams can change or disable those routes.
## Summary
- Intake routes now support `pull_request.opened`,
`pull_request.synchronized`, `pull_request.review_requested`,
`pull_request.merged`, and `pull_request.closed`.
- GitHub and GitLab pull request handlers use route-based move
decisions. A matching route can redirect a card. When no enabled route
handles the event, the rule’s fallback move can still apply.
- Default Work routes send merged pull requests to Done, unmerged pull
request cards to Canceled, and associated issue cards to Intake. Pushes
and review requests can return cards to PR review, including cards in a
finished phase.
- Route resolution considers whether a card carries a pull request and
whether its current state allows the event to move it. Route validation
requires `work_item.closed` in `on` when a condition uses
`event.reason`.
- Default routes now live in `src/boards/work-routes.ts`. Existing
projects receive the new defaults once. Deleted defaults are not
restored.
- The changes add pull request routing and integration tests, a Work
phase-key test, and changesets for the Factory feature and generated API
route metadata.
## Validation
Completed check results on the current head are not available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Rebased onto #29346 and #29707
The phase-key grep gate allows `boards/review.ts`, which declares the
kept Review board, the same way it allows Work's seed.
---------
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
|
||
|
|
0c2ffd0580 |
feat(factory): any board runs the pull request loop, read from its phases (#29710)
## Any board can run the pull request loop Factory moves a card through a loop: someone triages it, a builder writes the code, a reviewer self-reviews the branch, a pull request gets reviewed, and the merge finishes the card. Until now this loop only worked on the built-in **Work** board. The code checked for the board key `work` and for Work's phase names (`execute`, `review`, `pr-review`, `done`, …), so a custom board could hold cards but never review a pull request. This PR reads each part of the loop from what a board's phases declare: | Part | How Factory finds it | |---|---| | Pull request review | the first working phase in the `review` context that grants `factory_review_source` | | Self-review | another `review`-context phase that grants only `factory_record_review_verdict` | | Build | the last other working phase that can move into self-review (or straight into PR review) | | Triage | on a board that builds, the first working phase that neither builds nor reviews | | Completed / canceled | the board's `sourceClosed` phases, else its terminal phases in order | `boardFlow(board)` in `@mastra/factory/boards` computes this, so nothing new is stored. The runtime, the review verdict tool, pull request attachment, the dispatcher, the GitHub/GitLab/Linear/Jira/incident.io integrations, and the Factory skills all use it. Skills get a new `Board phases by part:` line in the card's phase signal and move cards by those names, never by Work's. Provider integrations now see the project's stored boards. Before, they only saw boards declared in code, so a decision about a card on a board created in the UI failed with "board is not installed". **Breaking (0.x):** the exports that named Work's phases are removed (`PULL_REQUEST_REVIEW_PHASE`, `FACTORY_RULE_STAGES`, `FACTORY_ROLE_STAGES`, `isFactoryRuleStage`, `isFactoryRole`, `factoryLaneForRole`, and related exports). `FactoryRuleStage` and `FactoryRuleBoard` are now plain strings. The Work board behaves exactly as before. ### Test plan - [x] `pnpm check`, `oxlint`, `pnpm build:lib` in `mastracode/factory` - [x] Full factory suite on LibSQL and Postgres. The only failures are known flakes (board-phase-runtime, projects-concurrency, sandbox.git), and every file that failed under load passes when run alone. - [x] New tests: - `boardFlow` derivation - the phase signal naming each part on a custom board - a second PR-review phase is never read as self-review - skill prose has no Work phase keys - [x] CLI route metadata regenerated Stack: first of three PRs. The next one, pull request route events, includes the end-to-end proof on a custom board. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 Factory now uses the phases each board defines instead of assuming every board uses Work’s phase names. This lets teams use custom boards for pull-request reviews, builds, and handoffs. ## Summary - Added `boardFlow(board)` and related helpers to derive pull-request review, self-review, build, triage, intake, and terminal-phase behavior from board definitions. - Updated runtime rules, tools, dispatch, metrics, and GitHub, GitLab, Jira, Linear, and incident.io integrations to use project-specific board definitions. - Updated Factory skills to read board phase names from the `factory-phase` signal and use them for card transitions. - Removed exports tied to Work’s fixed phase and role names. Changed `FactoryRuleStage` and `FactoryRuleBoard` to `string`. - Added tests for custom-board phase signals and phase selection, including boards with multiple review phases. Regenerated CLI route metadata. - The diff changes 76 files, with 1,435 lines added and 706 removed. - CI, build, and test results on the current head are not available. The PR description reports earlier checks and test runs, including known flakes. - End-to-end validation on a custom board is planned for a later PR. <!-- end of auto-generated comment: release notes by coderabbit.ai --> ## Rebased onto #29346 (kept Review board) and #29707 (exit tools halt) - The kept Review board needs no special cases: its `review` phase grants `factory_review_source`, so `boardFlow` reads it as the pull request review phase. `pullRequestReviewPhase(board)` and the `board === 'review'` checks from #29346 are gone. A board that reviews pull requests but builds nothing only takes pull request cards at intake. A pull request card already on such a board stays there when its pull request is filed again. - The Review board declares no `sourceClosed`, so merging or closing its pull request reads the board's terminal phases from its flow. - `factory-plan` follows #29707: once the plan is approved, the planner moves the card to the board's build phase itself. `exitTool.next` and `manualEntry` aren't used anywhere in this stack. --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
204118ee1d |
feat(factory): board phases run only from their stored fields (#29707)
## Summary Stacked on #29346. A Factory board phase now does exactly what its stored fields say. Before this change, each Work phase started its agent through code `onEnter` handlers with hand-written prompts, and project edits to a phase's runner were locked or overridden by that code. Now: - **One start path.** Entering a working phase starts its stored `runner` (`skill`, `context`, `instructions`, and an optional `goal`) through `boards/phase-runner.ts`. `onEnter`, `onExit` and `outcomes` are gone from the board model; code boards that still declare them get a one-time warning and the fields are ignored. - **Work runs on stored runners.** Triage → `factory-triage`, Planning → `factory-plan` (Planning holds the card until `submit_plan` comes back approved; then the planner moves it to Building), Building → new `factory-build` skill pursuing the approved plan as a **Mastra goal** (up to 20 runs, ended when the card leaves the phase), Review → `factory-self-review` (opens the PR on approval), PR review → `factory-review`. With self-review off (the default), Building opens the PR and moves to PR review. - **Card context through a state signal.** A new `factory-work-item` signal gives the agent the card, its sources, PR heads, plan/review state and the review checkout procedure; untrusted authors' titles and descriptions are fenced as data. Kickoffs only name the card. - **Tools follow the phase.** `factory_record_review_verdict` and `factory_review_source` are granted by the phase's stored `tools`, only to the session working the card in that phase, not by session role. - **Exit tools hold the card.** A working phase with an `exitTool` keeps the card until that tool succeeds (for `submit_plan`, with an approved plan) in the session working the card there; agent and rule moves out are refused with `approval_required` until then. `autoApprove`/`autoApproveWhen` only decide whether the tool approves itself or waits for a person. The tool's success never moves the card: the agent does. People can always move cards. - **New stored phase fields:** `runner.goal` and `tools`, plus the `item.pullRequest` rule fact. `nextPhases` stays the only limit on where a card may go. - **Retired Review board.** For projects that still use it (#29346), its Reviewing phase runs `factory-review` from its runner too. - **Migration.** Existing projects' stored Work boards get the new fields once (`work-phase-runners-v1`), filling only fields that still hold Factory's previous default; anything a person edited is kept. - **Factory UI** Settings › Work board edits the new fields; README documents the model. ## Test plan - Real-storage tests on LibSQL and Postgres for the signal, the exit-tool hold (refused before approval, accepted after, never moved by the tool alone, an earlier visit's approval not reused), phase tools, goal start/replay/end (including a closed session and a move racing the goal stamp), phase-runner decisions, an edited runner being what runs, and the migration (edits kept, run once, concurrent replicas); each with a recorded break-proof. - `pnpm --filter ./mastracode/factory check` / `lint`, oxfmt on changed files, factory-ui typecheck + unit + Work board MSW tests. - In-process proof: a fresh project's card goes Triage → Planning → Building (goal active on the thread) → Review → PR review, each started from stored runners, with an edited Triage runner visible in its kickoff; the same script fails on the base branch. - Settings › Work board MSW: 7/7; the remaining settings failures (`MemorySettings`, `OMSection`) are pre-existing. - Known unrelated failures: `board-phase-runtime` app-skill ×3 (pass in isolation; shared tenant-credential cache), 11 Postgres-only dispatcher timer tests (pre-existing). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 Factory boards now use saved settings to decide what work to start and which tools an agent can use. Teams can change this behavior through the board settings, while the system still enforces required steps before a card can move. ## Summary - Replaced code-defined phase entry and exit handlers with stored phase runners. Legacy `onEnter` and `onExit` handlers are ignored with a warning. Deprecated `outcomes` still define allowed destinations. - Added runner goals, phase-specific Factory tools, and exit-tool approvals. Building runs toward its goal for up to 20 runs. - Updated the Work board to use runners for triage, planning, building, review, and PR review. Agents need an approved `submit_plan` result before moving a card from Planning to Building. - Added the `factory-work-item` state signal and the `item.pullRequest` rule fact. - Added a migration that fills eligible fields on Factory’s Work board while preserving user edits. It does not modify an application-defined board that uses the `work` key. - Updated board APIs, the settings UI, documentation, skills, and tests for the stored-runner model. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
9609b9028d |
feat(factory): one card for an issue and its pull requests, retire the Review board (#29346)
## Summary A pull request used to file a second card beside the issue it fixed, so one piece of work was split across two cards, two histories and two boards. Now a pull request or merge request for an issue already on Work joins that issue's card as an extra source. **Which pull requests attach** - A pull request Factory opens for a GitHub issue card attaches to that card. On GitLab, a merge request Factory opens attaches to any card with an issue of its own (GitLab, Linear, Jira or incident.io). Every other card, including a manual card, gets a separate card for its pull request. The card goes from Building to self-review as before. - Whether someone else's pull request joins the card of the issue it closes is an intake route. Routes gain a `joinClosedIssue` target and three route-only conditions: `pullRequest.closesIssue`, `closedIssue.phase` and `closedIssue.hasPullRequest`. - Every project gets a new first route, "Pull requests that close a waiting issue join its card". It joins a trusted author's pull request (`Fixes #12`, `Closes group/project#12`; GitLab also `Implements`) to that issue's card while the card is still waiting in Intake and has no pull request yet, and moves the card to PR review. - Once the issue has moved on (Triage, Planning, Building, Review, PR review) or already carries a pull request, the pull request gets its own card in PR review and is reviewed right away. Done and Canceled cards are finished, so the pull request gets its own card too. - Projects can edit the route (for example to let pull requests join planned issues) or delete it. - Code enforces what a route can't loosen. An untrusted author's pull request never attaches, even when it says `fixes #12` and a route matches every card. It keeps its own card in Intake. The join is checked again under the card's revision when it is filed. - A pull request with no matching card, or one no route joins, gets its own card, as before. **How an attached pull request behaves** - Linking happens only on first sighting. Body edits and replays never move a pull request between cards. - The pull request's state lives on its own source, and the issue keeps its own. - The reviewer checks it out on its own branch (`factory/pr-<n>-…` or `factory/gitlab-mr-<n>-…`) in an untrusted checkout, never in the builder's session. - `openPullRequestNumber` only names a pull request from the card's own branch (a session branch, or the branch Factory builds the card on), so someone else's pull request never switches off the builder's self-review. When the card's PR closes, the pointer moves to its next own open PR or clears. - On merge, the card goes to Done unless another pull request is still open. **New projects get no Review board.** Work's PR review phase does its job. An existing project keeps the Review board while it still has a Review card that isn't Done or Canceled; otherwise it retires. This is decided per project at read time. Nothing is migrated. ## What changes for an existing install - A project with an open Review card keeps the board as it was: served read-only, its cards stay there in their phases and are reviewed there, `/factories/:id/review` opens it, and no card can be created on it. New pull requests still follow the project's intake routes (the default files them on Work › PR review). - In any other project, old Review cards show on Work, with Reviewing shown as PR review. Stored rows keep `board = 'review'` until their next normal write, which stores `work`. `/factories/:id/review` redirects to Work filtered to cards with a pull request, and keeps `?item=`. Once a project's last open Review card finishes, the board goes away for good. - In a project without the Review board, an intake route targeting board `review` stops matching, and arrivals fall through to the next route. - Board config and skill overrides for `review` are ignored, and `review` is reserved as a board ID. - `reviewBoard`, `ReviewBoardPhase` and `builtInBoard` are no longer exported from `@mastra/factory/boards`. - Every project gets the new closing-issue route at position 0; existing routes move down one place, keeping their order (each move bumps its revision). An admin who edits a route during the upgrade may get a revision conflict and must retry. - Updating a route's `target` replaces it whole: repeat `joinClosedIssue: true` to keep a route joining. - A run in flight on an old Review card keeps its binding and runs the same PR review handler. - Pairs filed before this change (a PR card plus its authoring card) stay two cards and keep working. - GitLab bindings stored on `review` read as Work. ## Known gaps - A link made only in GitHub's sidebar isn't in the webhook, so that pull request gets its own card. - The reconcile sweep carries no body, so closing references are only read from live deliveries. - Attaching an outside author's pull request to an issue card on a maintainer's say-so is a possible follow-up. ## Coordination w8T (`feat/factory-editable-builtin-boards`): stop seeding `review` after this lands (it is now a reserved board id); as of this branch's base it seeds Work only. Linking, the PR lane rule, the reviewer branch and the `review → pr-review` read alias live in code keyed by board id and phase key, so they survive an edited stored Work board. A stored Work board without `pr-review` still attaches; it just doesn't move the card. ## Test plan - New tests drive real webhook payloads on real LibSQL and Postgres storage, mocking only the provider HTTP boundary: - storage attach and the legacy Review read; - closing-reference parsing; - GitHub and GitLab one-card ingest (attach, outsider, no issue, Done, Canceled, per-phase route outcome, Triage → own reviewed card, edited/deleted route, two issues, edit, replay, batch race, two PRs, close → Intake, reopen, builder pointer); - dispatcher join route: trusted joins, untrusted never joins under `when: null`, disabled route falls through; - route storage: seeding order on new and existing projects, `joinClosedIssue` target validation; - reviewer branch and session separation; - untrusted checkout; - manual create on `review` refused; - factory-ui MSW for the `/review` redirect, PR filter, and legacy card rendering. - Each new test was shown failing with its code disabled. - `proof/without.txt`: on base, the branch's one-card tests fail 38 (two cards where one is expected). `proof/with.txt`: 80 pass on LibSQL and Postgres. - Gates: - `@mastra/factory` check and oxlint are clean, and the full suite passes apart from failures that also happen on main under parallel load (details in the progress file). - factory-ui typecheck, oxlint and unit tests are clean, and MSW shows only the 14 failures already present on main. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## ELI5 A pull request can share a Work card with the issue it closes when the author and routing rules allow it. New projects don't get the separate Review board, so pull request reviews use a lane on Work. Existing projects keep the Review board only while cards are still open on it. ## What changed - Eligible, trusted pull requests can attach to an existing issue card when an intake route matches. The card moves to PR review when the board allows it. Otherwise, the pull request gets its own card. - Intake routes can target the card for a closed issue and check the issue’s phase and whether it already has a pull request. - An attached pull request remains a separate source on the issue card. Reviews use that pull request’s branch in an untrusted checkout, and verdicts record which pull request they cover. - When an attached pull request merges, the issue card moves to Done only if no other owned pull request remains open. - The Review board is retired from new projects. An existing project with an open Review card keeps the board and its cards where they are; other projects read their old Review cards as Work cards in PR review, without a database migration, and old Review URLs redirect to Work with the pull-request filter. - The `review` board key is reserved. Writes to that key are rejected. Legacy Review settings and exports are removed or ignored. The issue remains the card’s primary source. ## Known gaps GitHub sidebar-only links are not available in webhook payloads. Reconciliation sweeps also lack pull-request bodies for parsing closing references. These cases cannot provide closing references for issue-card joins. ## Tests and checks Results from completed checks on the current head are not available. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
3324576ced |
feat(factory): show running package versions in Factory debug settings (#29647)
> Opened by @DSchau
## Summary
People and agents debugging a deployed Factory had no way to see which
`@mastra/*` versions it runs. Studio's version row only works under
`mastra dev`, because it reads a file that only `mastra dev` writes.
- **CLI (`mastra build`)**: writes `mastra-packages.json` (resolved
`@mastra/*` + `mastra` versions, same format as the dev file) into
`.mastra/output`. The write is best-effort: a failure logs a warning
instead of failing the build. This covers both build paths, so the file
is included in deploy zips. The file isn't served publicly: the Factory
UI is served only from `output/factory` and Studio only from
`output/studio`.
- **Factory server**: new `GET /web/config/versions` returns `{
packages, nodeVersion }` and requires a signed-in user when auth is on.
It reads `MASTRA_PACKAGES_FILE` (dev) first. If that's missing, it looks
(asynchronously) for the manifest next to the server entry, then next to
the bundle, then in `cwd/.mastra/output`. A missing or malformed file
gives an empty list.
- **Factory UI**: new **Settings › Debug** section (Factory group)
listing each package version and Node.js, styled like Studio's packages
panel and the Account rows, with a **Copy versions** button
(`name@version` lines) for bug reports. It also shows an empty state for
builds made with an older CLI.
- **Fix**: Connect tools settings imported `MASTRA_PROJECTS_URL` from
`gitlab.ts`, but that constant had been renamed to `MASTRA_PLATFORM_URL`
and moved to `platformConnect.ts`. On `main`, the missing export breaks
every Settings page with a "Something went wrong" error.
Follow-up (not in this PR): expose the same list through the Factory MCP
so agents can report it themselves.
## Screenshots
**Settings › Debug**
: intake routes handle issue close, reopen and activity events (#29353)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |
||
|
|
23308f9c19 |
feat(observability): add single score and feedback reads (#29529)
## Description
Add `GET /observability/feedback/:feedbackId` and typed client getters
for individual scores and feedback. Missing records return HTTP 200 with
`{ score: null }` or `{ feedback: null }`, preserving the existing score
endpoint contract.
```ts
const { score } = await client.getScore(scoreId);
const { feedback } = await client.getFeedback(feedbackId);
```
Client getters encode path IDs and preserve configured API prefixes,
credentials, and headers. Feedback reads use direct lookups in
in-memory, PostgreSQL, ClickHouse, and DuckDB storage. Includes
generated route types/CLI metadata, public API documentation, and
changesets.
Validation: package builds passed; 30 single-record HTTP cases passed
across five server adapters; 6 client transport tests, 341 server tests,
and 9 focused database cases passed across PostgreSQL/TimescaleDB,
ClickHouse, and DuckDB. Removing the feedback route caused the new
feedback HTTP cases to fail. Permission generation/checks, scoped
implementation lint, MDX formatting, Remark, and Vale passed.
Broader validation limitations: existing POST cases fail with
body-parser dependency errors in Express, Koa, and NestJS; the new GET
cases pass in all five adapters. The shared storage test helper also has
existing import-order lint errors outside the changed lines.
## Related issue(s)
Fixes
[OBS-790](https://linear.app/kepler-crm/issue/OBS-790/add-oss-single-score-and-feedback-reads),
under [OBS-792](https://linear.app/kepler-crm/issue/OBS-792). Platform
single-record endpoints remain scoped to OBS-791.
## Type of change
- [x] New feature (non-breaking change that adds functionality)
- [x] Documentation update
- [x] Test update
## Checklist
- [x] I have linked the related issue(s) in the description above
- [x] I have made corresponding changes to the documentation (if
applicable)
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have addressed all Coderabbit comments on this PR
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## ELI5
Applications can now look up a score or feedback record by its ID. If no
feedback record exists, the server returns `null`; it can also add
available author details to feedback.
## Summary
- Added `GET /observability/feedback/:feedbackId`. The route uses
existing observability authorization and returns `{ feedback: record }`
or `{ feedback: null }`.
- The feedback route adds author details when available. It returns HTTP
501 when the storage provider does not support single-feedback reads.
- Added `getScore(id)` and `getFeedback(id)` to the JavaScript client.
These methods encode IDs in the URL and use the client’s configured
request options.
- Added direct feedback lookups to in-memory, PostgreSQL, ClickHouse,
and DuckDB storage.
- Added response types, generated route metadata, API documentation,
tests, and changesets.
## Validation
Test and CI results: not available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
||
|
|
a78f612c72 |
fix(cli): point headless mastra auth login callers to MASTRA_API_TOKEN (#29585)
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> |