From c54925339c7d17fa33283c536c3fcd46894eb7d4 Mon Sep 17 00:00:00 2001 From: Dane - AI <199639756+daneatmastra@users.noreply.github.com> Date: Tue, 17 Nov 2026 06:30:09 +0000 Subject: [PATCH 01/10] chore(deps): update dependency typescript to v7 --- pnpm-lock.yaml | 491 ++++++++++---------------------------------- pnpm-workspace.yaml | 2 +- 2 files changed, 109 insertions(+), 384 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7dff438958e..2b6a6b25ade 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,8 +68,8 @@ catalogs: version: 4.6.7 ts6: typescript: - specifier: ^6.0.3 - version: 6.0.3 + specifier: ^7.0.2 + version: 7.0.2 overrides: '@lancedb/lancedb@0.31.0>@huggingface/transformers': '-' @@ -2060,7 +2060,7 @@ importers: dependencies: voyageai: specifier: ^0.3.1 - version: 0.3.1(encoding@0.1.14)(onnxruntime-node@1.24.3) + version: 0.3.1(encoding@0.1.14)(onnxruntime-node@1.30.0) devDependencies: '@internal/ai-sdk-v4': specifier: workspace:* @@ -2508,16 +2508,16 @@ importers: version: 22.19.15 msw: specifier: ^2.12.11 - version: 2.15.0(@types/node@22.19.15)(typescript@6.0.3) + version: 2.15.0(@types/node@22.19.15)(typescript@7.0.2) tsdown: specifier: 0.23.1 - version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@6.0.3) + version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@7.0.2) typescript: specifier: catalog:ts6 - version: 6.0.3 + version: 7.0.2 vitest: specifier: 'catalog:' - version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) mastracode/factory-ui: dependencies: @@ -2605,7 +2605,7 @@ importers: version: 30.1.3(@noble/hashes@2.4.0) msw: specifier: ^2.15.0 - version: 2.15.0(@types/node@22.19.15)(typescript@6.0.3) + version: 2.15.0(@types/node@22.19.15)(typescript@7.0.2) react-grab: specifier: ^0.1.50 version: 0.1.50(react@19.3.1) @@ -2614,13 +2614,13 @@ importers: version: 4.3.3 typescript: specifier: catalog:ts6 - version: 6.0.3 + version: 7.0.2 vite: specifier: ^8.3.5 version: 8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1) vitest: specifier: 'catalog:' - version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) mastracode/mastra-factory: dependencies: @@ -2790,19 +2790,19 @@ importers: version: 22.19.15 msw: specifier: ^2.12.11 - version: 2.15.0(@types/node@22.19.15)(typescript@6.0.3) + version: 2.15.0(@types/node@22.19.15)(typescript@7.0.2) tsdown: specifier: 0.23.1 - version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@6.0.3) + version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@7.0.2) tsx: specifier: 'catalog:' version: 4.23.15 typescript: specifier: catalog:ts6 - version: 6.0.3 + version: 7.0.2 vitest: specifier: 'catalog:' - version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) mastracode/tui: dependencies: @@ -2935,16 +2935,16 @@ importers: version: 6.0.0 tsdown: specifier: 0.23.1 - version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@6.0.3) + version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@7.0.2) tsx: specifier: 'catalog:' version: 4.23.15 typescript: specifier: catalog:ts6 - version: 6.0.3 + version: 7.0.2 vitest: specifier: 'catalog:' - version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) observability/_test-utils: devDependencies: @@ -3256,7 +3256,7 @@ importers: version: 5.14.0(@opentelemetry/api@1.10.0) '@langfuse/otel': specifier: ^5.14.0 - version: 5.14.0(@opentelemetry/api@1.10.0)(@opentelemetry/core@2.12.0(@opentelemetry/api@1.10.0))(@opentelemetry/exporter-trace-otlp-http@0.300.0(@opentelemetry/api@1.10.0))(@opentelemetry/otlp-exporter-base@0.300.0(@opentelemetry/api@1.10.0))(@opentelemetry/sdk-trace-base@2.12.0(@opentelemetry/api@1.10.0)) + version: 5.14.0(@opentelemetry/api@1.10.0)(@opentelemetry/core@2.12.0(@opentelemetry/api@1.10.0))(@opentelemetry/exporter-trace-otlp-http@0.300.0(@opentelemetry/api@1.10.0))(@opentelemetry/otlp-exporter-base@0.300.0(@opentelemetry/api@1.10.0))(@opentelemetry/sdk-trace-base@2.12.1(@opentelemetry/api@1.10.0)) '@mastra/observability': specifier: workspace:* version: link:../mastra @@ -3278,7 +3278,7 @@ importers: version: 1.10.0 '@opentelemetry/sdk-trace-base': specifier: ^2.12.0 - version: 2.12.0(@opentelemetry/api@1.10.0) + version: 2.12.1(@opentelemetry/api@1.10.0) '@types/node': specifier: 22.19.15 version: 22.19.15 @@ -3424,16 +3424,16 @@ importers: version: link:../../packages/core '@opentelemetry/context-async-hooks': specifier: ^2.12.0 - version: 2.12.0(@opentelemetry/api@1.10.0) + version: 2.12.1(@opentelemetry/api@1.10.0) '@opentelemetry/sdk-logs': specifier: ^0.223.0 - version: 0.223.0(@opentelemetry/api@1.10.0) + version: 0.223.2(@opentelemetry/api@1.10.0) '@opentelemetry/sdk-trace-base': specifier: ^2.12.0 - version: 2.12.0(@opentelemetry/api@1.10.0) + version: 2.12.1(@opentelemetry/api@1.10.0) '@opentelemetry/sdk-trace-node': specifier: ^2.12.0 - version: 2.12.0(@opentelemetry/api@1.10.0) + version: 2.12.1(@opentelemetry/api@1.10.0) '@types/node': specifier: 22.19.15 version: 22.19.15 @@ -4358,13 +4358,13 @@ importers: version: ai@5.0.283(zod@4.6.7) tsdown: specifier: 0.23.1 - version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@6.0.3) + version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@7.0.2) typescript: specifier: catalog:ts6 - version: 6.0.3 + version: 7.0.2 vitest: specifier: 'catalog:' - version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) zod: specifier: 'catalog:' version: 4.6.7 @@ -4586,13 +4586,13 @@ importers: version: 5.1.0(vitest@5.1.0) tsdown: specifier: 0.23.1 - version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@6.0.3) + version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@7.0.2) typescript: specifier: catalog:ts6 - version: 6.0.3 + version: 7.0.2 vitest: specifier: 'catalog:' - version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) packages/connect: dependencies: @@ -4653,10 +4653,10 @@ importers: dependencies: '@a2a-js/sdk-v0_3': specifier: npm:@a2a-js/sdk@~0.3.14 - version: '@a2a-js/sdk@0.3.14(@bufbuild/protobuf@2.13.0)(@grpc/grpc-js@1.14.5)(express@5.3.0(supports-color@10.2.2))' + version: '@a2a-js/sdk@0.3.14(@bufbuild/protobuf@2.16.0)(@grpc/grpc-js@1.14.7)(express@5.3.0(supports-color@10.2.2))' '@a2a-js/sdk-v1': specifier: npm:@a2a-js/sdk@~1.0.1 - version: '@a2a-js/sdk@1.0.1(@bufbuild/protobuf@2.13.0)(@grpc/grpc-js@1.14.5)(express@5.3.0(supports-color@10.2.2))' + version: '@a2a-js/sdk@1.0.1(@bufbuild/protobuf@2.16.0)(@grpc/grpc-js@1.14.7)(express@5.3.0(supports-color@10.2.2))' '@ai-sdk/provider-utils-v6': specifier: npm:@ai-sdk/provider-utils@4.0.66 version: '@ai-sdk/provider-utils@4.0.66(zod@4.6.7)' @@ -5123,13 +5123,13 @@ importers: version: 2.1.0 hono-openapi: specifier: ^1.5.0 - version: 1.5.0(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@6.0.3)))(arktype@2.2.9)(hono@4.13.17)(valibot@1.5.0(typescript@6.0.3))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7) + version: 1.5.0(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@7.0.2)))(arktype@2.2.9)(hono@4.13.17)(valibot@1.5.0(typescript@7.0.2))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7) stacktrace-parser: specifier: ^0.1.11 version: 0.1.11 tsdown: specifier: 0.23.1 - version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@6.0.3) + version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@7.0.2) tsx: specifier: 'catalog:' version: 4.23.15 @@ -5138,10 +5138,10 @@ importers: version: 5.10.0 typescript: specifier: catalog:ts6 - version: 6.0.3 + version: 7.0.2 vitest: specifier: 'catalog:' - version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) zod: specifier: 'catalog:' version: 4.6.7 @@ -5764,16 +5764,16 @@ importers: version: 1.6.0 tsdown: specifier: 0.23.1 - version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@6.0.3) + version: 0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@7.0.2) tsx: specifier: 'catalog:' version: 4.23.15 typescript: specifier: catalog:ts6 - version: 6.0.3 + version: 7.0.2 vitest: specifier: 'catalog:' - version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) packages/platform: dependencies: @@ -6039,7 +6039,7 @@ importers: version: 30.1.3(@noble/hashes@2.4.0) msw: specifier: ^2.15.0 - version: 2.15.0(@types/node@22.19.15)(typescript@6.0.3) + version: 2.15.0(@types/node@22.19.15)(typescript@7.0.2) react-grab: specifier: ^0.1.50 version: 0.1.50(react@19.3.1) @@ -6051,13 +6051,13 @@ importers: version: 1.4.0 typescript: specifier: catalog:ts6 - version: 6.0.3 + version: 7.0.2 vite: specifier: ^8.3.5 version: 8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1) vitest: specifier: 'catalog:' - version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) packages/playground-ui: dependencies: @@ -10125,7 +10125,7 @@ importers: version: 7.0.2 vitest: specifier: 'catalog:' - version: 5.1.0(@opentelemetry/api@1.9.1)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) workspaces/docker: dependencies: @@ -12777,9 +12777,6 @@ packages: '@bufbuild/protobuf@1.10.1': resolution: {integrity: sha512-wJ8ReQbHxsAfXhrf9ixl0aYbZorRuOWpBNzm8pL8ftmSxQx/wnJD5Eg861NwJU/czy2VXFIebCeZnZrI9rktIQ==} - '@bufbuild/protobuf@2.13.0': - resolution: {integrity: sha512-acq7c49vxfm1ggJ95P70TX7ABDM0vxr1SYD3BB0o0jnBLB4OAqeHyKuN+cD3w80gXEDQ2zxHpR6CUeA+O/aU9g==} - '@bufbuild/protobuf@2.16.0': resolution: {integrity: sha512-FWa0sPlqYGJgpTs6OxBRcL/AW4JT0OIO+W1ajerluoTVh8CV0B7XM1qsNCRgnkSCkRCgOICKHRQlY17jrsm0+Q==} @@ -14902,10 +14899,6 @@ packages: peerDependencies: graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 - '@grpc/grpc-js@1.14.5': - resolution: {integrity: sha512-7VZM+SVdEcUUqSQeNI3zM8Qs/BhQKZndPo2h5VkYkAM8Iz0wJIa8mKV5ekQGqG8UUsnkQ0NMxIxwkIHYvj0qOw==} - engines: {node: '>=12.10.0'} - '@grpc/grpc-js@1.14.7': resolution: {integrity: sha512-W4W/fcBMGRVtG6dW2c7cw2mnpS3hvbBd+oQXjh2iYFTZDk1JJmcNqkM5KSaPubQpamlUUurrlb7G1s9NJeERmQ==} engines: {node: '>=12.10.0'} @@ -16463,16 +16456,6 @@ packages: peerDependencies: '@modelcontextprotocol/server': ^2.4.0 - '@modelcontextprotocol/sdk@1.32.1': - resolution: {integrity: sha512-2DdE+SJDtzLEEWzY1ZjY7Q+VcPhcV1KisD3zI4u0XZyktsjHum1mwbMI+JaulUBi2OZk+KJAi2uPXzxichPkdw==} - engines: {node: '>=18'} - peerDependencies: - '@cfworker/json-schema': ^4.1.1 - zod: 4.6.7 - peerDependenciesMeta: - '@cfworker/json-schema': - optional: true - '@modelcontextprotocol/sdk@1.32.2': resolution: {integrity: sha512-SWsVtH/0vULSQStoZ6xxH2K09Li8fXYTMC64ZeogCdpZ3XSi1eCPOByV1OpuJxuI3OcmHhosDWYyii07tpPsLw==} engines: {node: '>=18'} @@ -23185,11 +23168,6 @@ packages: base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - baseline-browser-mapping@2.11.0: - resolution: {integrity: sha512-oCu2wfipvX3AePSgmOuKkIywOu+8n9psz7hXYmk56ghpu3+7KzNIBopaOs4c9BrtdnTtW30unG9GTfHo7EwERQ==} - engines: {node: '>=6.0.0'} - hasBin: true - baseline-browser-mapping@2.11.35: resolution: {integrity: sha512-GNk8KX52CHqeNKGk8+7tZnQab/2k1t/BgrUHPKNdijzpEhF1saPQZHVKb6m5loSAxB39gyrTYw34Qf9CQ3u1qQ==} engines: {node: '>=6.0.0'} @@ -23388,11 +23366,6 @@ packages: browserify-zlib@0.1.4: resolution: {integrity: sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==} - browserslist@4.28.7: - resolution: {integrity: sha512-JxV13hNrFxqjOc8alRbq9dK1MM79NEXYpma2B2J4wAtpWS5zIEIKqWPGCl7N4o7Uc7B7itylh7SuDujATRyyTw==} - engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} - hasBin: true - browserslist@4.29.5: resolution: {integrity: sha512-khTmKu5NGYTotqcYo8Bew2k4RAE9PuXRSFRXG2lQBrCEQHyeQ/vX6gKMxfokwywBsLiXZMnHsmWMG1pnO8J7uQ==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -26747,10 +26720,6 @@ packages: js-base64@3.9.6: resolution: {integrity: sha512-LjkzbLtU6Lx6fjXMYGEACEB7rdtqZtxkBe9aS1ZpDNUyWgUivw3yBEIhQ37OVygJYRt+C+9e9fVT8PpFzH2Hww==} - js-cookie@3.0.7: - resolution: {integrity: sha512-z/wZZgDrkNV1eA0ULjM/F9/50Ya8fbzgKneSpoPsXSGd0KnpdtHfOZWK+GcwLk+EZbS4F9RBhU+K2RgzuDaItw==} - engines: {node: '>=20'} - js-cookie@3.0.8: resolution: {integrity: sha512-yeJd4aNAdYZQjaon2bpD/Gb0B/omw7HQOsynXXcOiWVCacbBcPlgn8S/d1X6blFSaHao7ozqtW7NZW19xpCtIw==} @@ -26774,10 +26743,6 @@ packages: resolution: {integrity: sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==} hasBin: true - js-yaml@5.4.1: - resolution: {integrity: sha512-28R/k+NAjeuf7+CKlTxWZVExJGwVVLwY06DgEnOMz2gEpfNkDcD7QvyiVPT0xy0XXhU8vHsd4Ot42OOPdJG7dQ==} - hasBin: true - js-yaml@5.5.0: resolution: {integrity: sha512-paNr4LFIFPjeeSmwNYdrb8FafLLG/Cr2Af3GjbsHJ5CxIjH4r0c2emlmRdAtpPAieP1gRVzk6buBbVP5gBMGAg==} hasBin: true @@ -31211,10 +31176,6 @@ packages: tar-stream@3.2.2: resolution: {integrity: sha512-+8NeqHRjQWH9nYlwo2gamAMImZCVzI4UoEgDpWorBt9OEfppiZn+uSkskzQKPWIZyji/C8fpWO7u69G0DX0tbg==} - tar@7.5.21: - resolution: {integrity: sha512-XdhtCvlMywwxpCW8YEq3lOXBJpUPTR2OHHcwLPO3HwsJqOHa2Ok/oJ7ruGzp+JrKoRPVCzJwAdEjqLW/vNRPHA==} - engines: {node: '>=18'} - tar@7.5.22: resolution: {integrity: sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA==} engines: {node: '>=18'} @@ -32751,21 +32712,21 @@ snapshots: section-matter: 1.0.0 strip-bom-string: 1.0.0 - '@a2a-js/sdk@0.3.14(@bufbuild/protobuf@2.13.0)(@grpc/grpc-js@1.14.5)(express@5.3.0(supports-color@10.2.2))': + '@a2a-js/sdk@0.3.14(@bufbuild/protobuf@2.16.0)(@grpc/grpc-js@1.14.7)(express@5.3.0(supports-color@10.2.2))': dependencies: uuid: 11.1.1 optionalDependencies: - '@bufbuild/protobuf': 2.13.0 - '@grpc/grpc-js': 1.14.5 + '@bufbuild/protobuf': 2.16.0 + '@grpc/grpc-js': 1.14.7 express: 5.3.0(supports-color@10.2.2) - '@a2a-js/sdk@1.0.1(@bufbuild/protobuf@2.13.0)(@grpc/grpc-js@1.14.5)(express@5.3.0(supports-color@10.2.2))': + '@a2a-js/sdk@1.0.1(@bufbuild/protobuf@2.16.0)(@grpc/grpc-js@1.14.7)(express@5.3.0(supports-color@10.2.2))': dependencies: jose: 6.2.12 uuid: 11.1.1 optionalDependencies: - '@bufbuild/protobuf': 2.13.0 - '@grpc/grpc-js': 1.14.5 + '@bufbuild/protobuf': 2.16.0 + '@grpc/grpc-js': 1.14.7 express: 5.3.0(supports-color@10.2.2) '@adobe/css-tools@4.5.0': {} @@ -34272,7 +34233,7 @@ snapshots: dependencies: '@babel/compat-data': 8.0.5 '@babel/helper-validator-option': 8.0.0 - browserslist: 4.28.7 + browserslist: 4.29.5 flru: 1.0.2 verkit: 0.5.0 @@ -35371,7 +35332,7 @@ snapshots: '@blaxel/core@0.3.34(@cfworker/json-schema@4.1.4)(@hey-api/openapi-ts@0.97.3(magicast@0.5.5)(typescript@7.0.2))(bufferutil@4.1.0)(debug@4.4.3(supports-color@10.2.2))(supports-color@10.2.2)': dependencies: '@hey-api/client-fetch': 0.10.2(@hey-api/openapi-ts@0.97.3(magicast@0.5.5)(typescript@7.0.2)) - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) + '@modelcontextprotocol/sdk': 1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) archiver: 7.0.1 axios: 1.20.0(debug@4.4.3(supports-color@10.2.2))(supports-color@10.2.2) dockerfile-ast: 0.7.1 @@ -35440,8 +35401,8 @@ snapshots: '@ai-sdk/provider': 2.0.5 '@anthropic-ai/sdk': 0.39.0(encoding@0.1.14) '@browserbasehq/sdk': 2.24.0(encoding@0.1.14) - '@google/genai': 1.52.0(@modelcontextprotocol/sdk@1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7))(bufferutil@4.1.0)(supports-color@10.2.2) - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) + '@google/genai': 1.52.0(@modelcontextprotocol/sdk@1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7))(bufferutil@4.1.0)(supports-color@10.2.2) + '@modelcontextprotocol/sdk': 1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) ai: 5.0.285(zod@4.6.7) devtools-protocol: 0.0.1642743 fetch-cookie: 3.2.0 @@ -35480,8 +35441,6 @@ snapshots: '@bufbuild/protobuf@1.10.1': {} - '@bufbuild/protobuf@2.13.0': {} - '@bufbuild/protobuf@2.16.0': {} '@cacheable/memory@2.2.0': @@ -36469,7 +36428,7 @@ snapshots: '@daytona/toolbox-api-client': 0.226.1(debug@4.4.3(supports-color@10.2.2))(supports-color@10.2.2) '@iarna/toml': 2.2.5 '@opentelemetry/api': 1.10.0 - '@opentelemetry/exporter-trace-otlp-http': 0.223.0(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-trace-otlp-http': 0.223.2(@opentelemetry/api@1.10.0) '@opentelemetry/instrumentation-http': 0.223.0(@opentelemetry/api@1.10.0)(supports-color@10.2.2) '@opentelemetry/otlp-exporter-base': 0.223.0(@opentelemetry/api@1.10.0) '@opentelemetry/resources': 2.12.1(@opentelemetry/api@1.10.0) @@ -36580,7 +36539,7 @@ snapshots: '@docker/sandboxes@0.53.0(bufferutil@4.1.0)': dependencies: - '@bufbuild/protobuf': 2.13.0 + '@bufbuild/protobuf': 2.16.0 '@types/formidable': 3.4.6 '@types/ws': 8.18.2 formidable: 3.5.4 @@ -36790,7 +36749,7 @@ snapshots: '@rspack/core': 1.7.12(@swc/helpers@0.5.23) '@swc/core': 1.16.21(@swc/helpers@0.5.23) '@swc/html': 1.16.21 - browserslist: 4.28.7 + browserslist: 4.29.5 lightningcss: 1.33.0 semver: 7.8.6 swc-loader: 0.2.7(@swc/core@1.16.21(@swc/helpers@0.5.23))(webpack@5.112.2(@swc/core@1.16.21(@swc/helpers@0.5.23))(@swc/html@1.16.21)(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.23))(csso@5.0.5)(esbuild@0.28.2)(html-minifier-terser@7.2.0)(lightningcss@1.33.0)(postcss@8.5.23)(uglify-js@3.19.3)) @@ -38522,14 +38481,14 @@ snapshots: '@google-cloud/precise-date': 6.2.1 '@google-cloud/promisify': 6.2.1 '@google-cloud/spanner-api': 0.4.0(supports-color@10.2.2) - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 '@grpc/proto-loader': 0.8.1 '@opentelemetry/api': 1.10.0 - '@opentelemetry/context-async-hooks': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/context-async-hooks': 2.12.1(@opentelemetry/api@1.10.0) '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) '@opentelemetry/resource-detector-gcp': 0.57.0(@opentelemetry/api@1.10.0)(supports-color@10.2.2) '@opentelemetry/resources': 2.12.1(@opentelemetry/api@1.10.0) - '@opentelemetry/sdk-metrics': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-metrics': 2.12.1(@opentelemetry/api@1.10.0) '@opentelemetry/semantic-conventions': 1.44.0 '@types/big.js': 6.2.2 big.js: 7.0.1 @@ -38582,19 +38541,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@google/genai@1.52.0(@modelcontextprotocol/sdk@1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7))(bufferutil@4.1.0)(supports-color@10.2.2)': - dependencies: - google-auth-library: 10.9.1(supports-color@10.2.2) - p-retry: 4.6.2 - protobufjs: 8.8.0 - ws: 8.22.0(bufferutil@4.1.0) - optionalDependencies: - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - '@google/genai@1.52.0(@modelcontextprotocol/sdk@1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7))(bufferutil@4.1.0)(supports-color@10.2.2)': dependencies: google-auth-library: 10.9.1(supports-color@10.2.2) @@ -38612,11 +38558,6 @@ snapshots: dependencies: graphql: 16.14.2 - '@grpc/grpc-js@1.14.5': - dependencies: - '@grpc/proto-loader': 0.8.1 - '@js-sdsl/ordered-map': 4.4.2 - '@grpc/grpc-js@1.14.7': dependencies: '@grpc/proto-loader': 0.8.1 @@ -39397,7 +39338,7 @@ snapshots: '@fingerprintjs/fingerprintjs-pro-react': 2.7.1 '@fingerprintjs/fingerprintjs-pro-spa': 1.3.3 '@hcaptcha/react-hcaptcha': 1.17.4(react-dom@19.3.1(react@19.3.1))(react@19.3.1) - js-cookie: 3.0.7 + js-cookie: 3.0.8 react: 19.3.1 react-dom: 19.3.1(react@19.3.1) tldts: 7.4.19 @@ -39465,14 +39406,14 @@ snapshots: dependencies: '@opentelemetry/api': 1.10.0 - '@langfuse/otel@5.14.0(@opentelemetry/api@1.10.0)(@opentelemetry/core@2.12.0(@opentelemetry/api@1.10.0))(@opentelemetry/exporter-trace-otlp-http@0.300.0(@opentelemetry/api@1.10.0))(@opentelemetry/otlp-exporter-base@0.300.0(@opentelemetry/api@1.10.0))(@opentelemetry/sdk-trace-base@2.12.0(@opentelemetry/api@1.10.0))': + '@langfuse/otel@5.14.0(@opentelemetry/api@1.10.0)(@opentelemetry/core@2.12.0(@opentelemetry/api@1.10.0))(@opentelemetry/exporter-trace-otlp-http@0.300.0(@opentelemetry/api@1.10.0))(@opentelemetry/otlp-exporter-base@0.300.0(@opentelemetry/api@1.10.0))(@opentelemetry/sdk-trace-base@2.12.1(@opentelemetry/api@1.10.0))': dependencies: '@langfuse/core': 5.14.0(@opentelemetry/api@1.10.0) '@opentelemetry/api': 1.10.0 '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) '@opentelemetry/exporter-trace-otlp-http': 0.300.0(@opentelemetry/api@1.10.0) '@opentelemetry/otlp-exporter-base': 0.300.0(@opentelemetry/api@1.10.0) - '@opentelemetry/sdk-trace-base': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-base': 2.12.1(@opentelemetry/api@1.10.0) '@langfuse/tracing@5.14.0(@opentelemetry/api@1.10.0)': dependencies: @@ -39666,7 +39607,7 @@ snapshots: '@livekit/typed-emitter': 3.0.0 '@opentelemetry/api': 1.10.0 '@opentelemetry/api-logs': 0.220.0 - '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/core': 2.12.1(@opentelemetry/api@1.10.0) '@opentelemetry/exporter-logs-otlp-proto': 0.220.0(@opentelemetry/api@1.10.0) '@opentelemetry/exporter-metrics-otlp-proto': 0.220.0(@opentelemetry/api@1.10.0) '@opentelemetry/exporter-trace-otlp-proto': 0.220.0(@opentelemetry/api@1.10.0) @@ -39674,9 +39615,9 @@ snapshots: '@opentelemetry/otlp-exporter-base': 0.220.0(@opentelemetry/api@1.10.0) '@opentelemetry/resources': 2.12.1(@opentelemetry/api@1.10.0) '@opentelemetry/sdk-logs': 0.220.0(@opentelemetry/api@1.10.0) - '@opentelemetry/sdk-metrics': 2.12.0(@opentelemetry/api@1.10.0) - '@opentelemetry/sdk-trace-base': 2.12.0(@opentelemetry/api@1.10.0) - '@opentelemetry/sdk-trace-node': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-metrics': 2.12.1(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-base': 2.12.1(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-node': 2.12.1(@opentelemetry/api@1.10.0) '@opentelemetry/semantic-conventions': 1.44.0 '@types/pidusage': 2.0.5 commander: 12.1.0 @@ -39945,9 +39886,9 @@ snapshots: '@mastra/core': link:packages/core '@modelcontextprotocol/client': 2.3.1 '@modelcontextprotocol/core': 2.3.1 - '@modelcontextprotocol/ext-apps': 1.7.5(@modelcontextprotocol/sdk@1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7))(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(zod@4.6.7) + '@modelcontextprotocol/ext-apps': 1.7.5(@modelcontextprotocol/sdk@1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7))(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(zod@4.6.7) '@modelcontextprotocol/node': 2.1.1(@modelcontextprotocol/server@2.3.1) - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) + '@modelcontextprotocol/sdk': 1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) '@modelcontextprotocol/server': 2.3.1 '@modelcontextprotocol/server-legacy': 2.3.1(express@5.3.0(supports-color@10.2.2))(supports-color@10.2.2) exit-hook: 5.1.0 @@ -39968,8 +39909,8 @@ snapshots: '@mcp-ui/client@7.1.1(@cfworker/json-schema@4.1.4)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@10.2.2)': dependencies: - '@modelcontextprotocol/ext-apps': 1.7.5(@modelcontextprotocol/sdk@1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@3.25.76))(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(zod@3.25.76) - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@3.25.76) + '@modelcontextprotocol/ext-apps': 1.7.5(@modelcontextprotocol/sdk@1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7))(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(zod@3.25.76) + '@modelcontextprotocol/sdk': 1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@3.25.76) react: 19.3.1 react-dom: 19.3.1(react@19.3.1) zod: 3.25.76 @@ -40203,7 +40144,7 @@ snapshots: '@modelcontextprotocol/conformance@0.2.0-alpha.12(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)': dependencies: - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) + '@modelcontextprotocol/sdk': 1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) '@octokit/rest': 22.0.1 ajv: 8.20.0 ajv-formats: 3.0.1(ajv@8.20.0) @@ -40226,18 +40167,18 @@ snapshots: dependencies: zod: 4.6.7 - '@modelcontextprotocol/ext-apps@1.7.5(@modelcontextprotocol/sdk@1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@3.25.76))(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(zod@3.25.76)': + '@modelcontextprotocol/ext-apps@1.7.5(@modelcontextprotocol/sdk@1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7))(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(zod@3.25.76)': dependencies: - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@3.25.76) + '@modelcontextprotocol/sdk': 1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) '@standard-schema/spec': 1.1.0 zod: 3.25.76 optionalDependencies: react: 19.3.1 react-dom: 19.3.1(react@19.3.1) - '@modelcontextprotocol/ext-apps@1.7.5(@modelcontextprotocol/sdk@1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7))(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(zod@4.6.7)': + '@modelcontextprotocol/ext-apps@1.7.5(@modelcontextprotocol/sdk@1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7))(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(zod@4.6.7)': dependencies: - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) + '@modelcontextprotocol/sdk': 1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) '@standard-schema/spec': 1.1.0 zod: 4.6.7 optionalDependencies: @@ -40278,7 +40219,7 @@ snapshots: '@modelcontextprotocol/server': 2.4.0 hono: 4.13.17 - '@modelcontextprotocol/sdk@1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@3.25.76)': + '@modelcontextprotocol/sdk@1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@3.25.76)': dependencies: '@hono/node-server': 2.1.6(hono@4.13.17) ajv: 8.20.0 @@ -40302,30 +40243,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@modelcontextprotocol/sdk@1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7)': - dependencies: - '@hono/node-server': 2.1.6(hono@4.13.17) - ajv: 8.20.0 - ajv-formats: 3.0.1(ajv@8.20.0) - content-type: 1.0.5 - cors: 2.8.6 - cross-spawn: 7.0.6 - eventsource: 3.0.7 - eventsource-parser: 3.1.1 - express: 5.3.0(supports-color@10.2.2) - express-rate-limit: 8.7.3(express@5.3.0(supports-color@10.2.2))(supports-color@10.2.2) - hono: 4.13.17 - jose: 6.2.12 - json-schema-typed: 8.0.2 - pkce-challenge: 5.0.1 - raw-body: 4.0.0 - zod: 4.6.7 - zod-to-json-schema: 3.25.2(zod@4.6.7) - optionalDependencies: - '@cfworker/json-schema': 4.1.4 - transitivePeerDependencies: - - supports-color - '@modelcontextprotocol/sdk@1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7)': dependencies: '@hono/node-server': 2.1.6(hono@4.13.17) @@ -40875,7 +40792,7 @@ snapshots: debug: 4.4.3(supports-color@10.2.2) openai: 6.49.0(@aws-sdk/credential-provider-node@3.972.92)(@smithy/signature-v4@5.7.5)(ws@8.22.0(bufferutil@4.1.0))(zod@4.6.7) optionalDependencies: - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) + '@modelcontextprotocol/sdk': 1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) zod: 4.6.7 transitivePeerDependencies: - '@aws-sdk/credential-provider-node' @@ -41280,7 +41197,7 @@ snapshots: '@opentelemetry/exporter-trace-otlp-grpc@0.207.0(@opentelemetry/api@1.10.0)': dependencies: - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 '@opentelemetry/api': 1.10.0 '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) '@opentelemetry/otlp-exporter-base': 0.207.0(@opentelemetry/api@1.10.0) @@ -41327,7 +41244,6 @@ snapshots: '@opentelemetry/otlp-exporter-base': 0.223.2(@opentelemetry/api@1.10.0) '@opentelemetry/otlp-transformer': 0.223.2(@opentelemetry/api@1.10.0) '@opentelemetry/sdk-trace': 2.12.1(@opentelemetry/api@1.10.0) - optional: true '@opentelemetry/exporter-trace-otlp-http@0.300.0(@opentelemetry/api@1.10.0)': dependencies: @@ -41846,7 +41762,7 @@ snapshots: '@opentelemetry/otlp-grpc-exporter-base@0.207.0(@opentelemetry/api@1.10.0)': dependencies: - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 '@opentelemetry/api': 1.10.0 '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) '@opentelemetry/otlp-exporter-base': 0.207.0(@opentelemetry/api@1.10.0) @@ -41854,7 +41770,7 @@ snapshots: '@opentelemetry/otlp-grpc-exporter-base@0.223.0(@opentelemetry/api@1.10.0)': dependencies: - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 '@opentelemetry/api': 1.10.0 '@opentelemetry/core': 2.12.0(@opentelemetry/api@1.10.0) '@opentelemetry/otlp-exporter-base': 0.223.0(@opentelemetry/api@1.10.0) @@ -44176,18 +44092,6 @@ snapshots: '@stablelib/base64@1.0.1': {} - '@standard-community/standard-json@0.3.7(@standard-schema/spec@1.1.0)(@types/json-schema@7.0.15)(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@6.0.3)))(arktype@2.2.9)(valibot@1.5.0(typescript@6.0.3))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7)': - dependencies: - '@standard-schema/spec': 1.1.0 - '@types/json-schema': 7.0.15 - quansync: 0.2.11 - optionalDependencies: - '@valibot/to-json-schema': 1.8.0(valibot@1.5.0(typescript@6.0.3)) - arktype: 2.2.9 - valibot: 1.5.0(typescript@6.0.3) - zod: 4.6.7 - zod-to-json-schema: 3.25.2(zod@4.6.7) - '@standard-community/standard-json@0.3.7(@standard-schema/spec@1.1.0)(@types/json-schema@7.0.15)(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@7.0.2)))(arktype@2.2.9)(valibot@1.5.0(typescript@7.0.2))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7)': dependencies: '@standard-schema/spec': 1.1.0 @@ -44200,16 +44104,6 @@ snapshots: zod: 4.6.7 zod-to-json-schema: 3.25.2(zod@4.6.7) - '@standard-community/standard-openapi@0.2.11(@standard-community/standard-json@0.3.7(@standard-schema/spec@1.1.0)(@types/json-schema@7.0.15)(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@6.0.3)))(arktype@2.2.9)(valibot@1.5.0(typescript@6.0.3))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7))(@standard-schema/spec@1.1.0)(arktype@2.2.9)(openapi-types@12.1.3)(valibot@1.5.0(typescript@6.0.3))(zod@4.6.7)': - dependencies: - '@standard-community/standard-json': 0.3.7(@standard-schema/spec@1.1.0)(@types/json-schema@7.0.15)(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@6.0.3)))(arktype@2.2.9)(valibot@1.5.0(typescript@6.0.3))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7) - '@standard-schema/spec': 1.1.0 - openapi-types: 12.1.3 - optionalDependencies: - arktype: 2.2.9 - valibot: 1.5.0(typescript@6.0.3) - zod: 4.6.7 - '@standard-community/standard-openapi@0.2.11(@standard-community/standard-json@0.3.7(@standard-schema/spec@1.1.0)(@types/json-schema@7.0.15)(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@7.0.2)))(arktype@2.2.9)(valibot@1.5.0(typescript@7.0.2))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7))(@standard-schema/spec@1.1.0)(arktype@2.2.9)(openapi-types@12.1.3)(valibot@1.5.0(typescript@7.0.2))(zod@4.6.7)': dependencies: '@standard-community/standard-json': 0.3.7(@standard-schema/spec@1.1.0)(@types/json-schema@7.0.15)(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@7.0.2)))(arktype@2.2.9)(valibot@1.5.0(typescript@7.0.2))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7) @@ -44253,11 +44147,11 @@ snapshots: '@storybook/addon-mcp@10.6.5(storybook@10.6.5(@types/react@19.3.0)(bufferutil@4.1.0)(prettier@3.9.10)(react@19.3.1))(typescript@7.0.2)': dependencies: - '@tmcp/adapter-valibot': 0.1.7(tmcp@1.20.1(typescript@7.0.2))(valibot@1.4.2(typescript@7.0.2)) + '@tmcp/adapter-valibot': 0.1.7(tmcp@1.20.1(typescript@7.0.2))(valibot@1.5.0(typescript@7.0.2)) '@tmcp/transport-http': 0.8.6(tmcp@1.20.1(typescript@7.0.2)) storybook: 10.6.5(@types/react@19.3.0)(bufferutil@4.1.0)(prettier@3.9.10)(react@19.3.1) tmcp: 1.20.1(typescript@7.0.2) - valibot: 1.4.2(typescript@7.0.2) + valibot: 1.5.0(typescript@7.0.2) transitivePeerDependencies: - '@tmcp/auth' - typescript @@ -44440,7 +44334,7 @@ snapshots: '@stryker-mutator/util': 10.0.0 semver: 7.8.6 tslib: 2.8.1 - vitest: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) + vitest: 5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) '@supabase/auth-js@2.118.0': dependencies: @@ -44894,7 +44788,7 @@ snapshots: '@temporalio/client@1.25.0(long@5.3.2)(protobufjs@8.8.0)': dependencies: - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 '@temporalio/common': 1.25.0(long@5.3.2)(protobufjs@8.8.0) '@temporalio/proto': 1.25.0 long: 5.3.2 @@ -44912,7 +44806,7 @@ snapshots: '@temporalio/core-bridge@1.25.0(long@5.3.2)(protobufjs@8.8.0)': dependencies: - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 '@temporalio/common': 1.25.0(long@5.3.2)(protobufjs@8.8.0) long: 5.3.2 protobufjs: 8.8.0 @@ -44935,7 +44829,7 @@ snapshots: '@temporalio/worker@1.25.0(@swc/helpers@0.5.23)(@swc/html@1.16.21)(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(esbuild@0.28.2)(html-minifier-terser@7.2.0)(lightningcss@1.33.0)(long@5.3.2)(postcss@8.5.32)(protobufjs@8.8.0)(sharp@0.35.5(@types/node@22.19.15))(svgo@3.3.5)(uglify-js@3.19.3)': dependencies: - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 '@swc/core': 1.16.21(@swc/helpers@0.5.23) '@temporalio/activity': 1.25.0(long@5.3.2)(protobufjs@8.8.0) '@temporalio/client': 1.25.0(long@5.3.2)(protobufjs@8.8.0) @@ -45027,12 +44921,12 @@ snapshots: dependencies: '@testing-library/dom': 10.4.2 - '@tmcp/adapter-valibot@0.1.7(tmcp@1.20.1(typescript@7.0.2))(valibot@1.4.2(typescript@7.0.2))': + '@tmcp/adapter-valibot@0.1.7(tmcp@1.20.1(typescript@7.0.2))(valibot@1.5.0(typescript@7.0.2))': dependencies: '@standard-schema/spec': 1.1.0 - '@valibot/to-json-schema': 1.8.0(valibot@1.4.2(typescript@7.0.2)) + '@valibot/to-json-schema': 1.8.0(valibot@1.5.0(typescript@7.0.2)) tmcp: 1.20.1(typescript@7.0.2) - valibot: 1.4.2(typescript@7.0.2) + valibot: 1.5.0(typescript@7.0.2) '@tmcp/session-manager@0.2.2(tmcp@1.20.1(typescript@7.0.2))': dependencies: @@ -45953,19 +45847,9 @@ snapshots: '@upstash/vector@1.2.3': {} - '@valibot/to-json-schema@1.8.0(valibot@1.4.2(typescript@7.0.2))': - dependencies: - valibot: 1.4.2(typescript@7.0.2) - - '@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@6.0.3))': - dependencies: - valibot: 1.5.0(typescript@6.0.3) - optional: true - '@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@7.0.2))': dependencies: valibot: 1.5.0(typescript@7.0.2) - optional: true '@valkey/valkey-glide-darwin-arm64@2.5.2': optional: true @@ -46249,16 +46133,6 @@ snapshots: msw: 2.15.0(@types/node@22.19.15)(typescript@5.9.3) vite: 8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1) - '@vitest/mocker@5.1.0(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1))': - dependencies: - '@jridgewell/trace-mapping': 0.3.31 - '@vitest/spy': 5.1.0 - estree-walker: 3.0.3 - magic-string: 1.4.5 - optionalDependencies: - msw: 2.15.0(@types/node@22.19.15)(typescript@6.0.3) - vite: 8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1) - '@vitest/mocker@5.1.0(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.25.12)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1))': dependencies: '@jridgewell/trace-mapping': 0.3.31 @@ -46487,7 +46361,7 @@ snapshots: '@wong2/mcp-cli@2.0.0(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7)': dependencies: '@json-schema-tools/traverse': 1.15.1 - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) + '@modelcontextprotocol/sdk': 1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) conf: 15.1.0 eventsource: 4.1.1 express: 5.3.0(supports-color@10.2.2) @@ -46518,7 +46392,7 @@ snapshots: '@workos-inc/node': 8.13.0 iron-webcrypto: 2.0.0 jose: 6.2.12 - valibot: 1.4.2(typescript@7.0.2) + valibot: 1.5.0(typescript@7.0.2) transitivePeerDependencies: - typescript @@ -47186,8 +47060,6 @@ snapshots: base64-js@1.5.1: {} - baseline-browser-mapping@2.11.0: {} - baseline-browser-mapping@2.11.35: {} basic-ftp@6.2.4: {} @@ -47413,14 +47285,6 @@ snapshots: dependencies: pako: 0.2.9 - browserslist@4.28.7: - dependencies: - baseline-browser-mapping: 2.11.0 - caniuse-lite: 1.0.30001820 - electron-to-chromium: 1.5.473 - node-releases: 2.0.63 - update-browserslist-db: 1.3.4(browserslist@4.28.7) - browserslist@4.29.5: dependencies: baseline-browser-mapping: 2.11.35 @@ -47822,7 +47686,7 @@ snapshots: node-api-headers: 1.9.0 rc: 1.2.8 semver: 7.8.6 - tar: 7.5.21 + tar: 7.5.22 url-join: 4.0.1 which: 6.0.1 yargs: 18.2.0 @@ -48286,7 +48150,7 @@ snapshots: cssnano-preset-advanced@6.1.2(postcss@8.5.23): dependencies: autoprefixer: 10.6.2(postcss@8.5.23) - browserslist: 4.28.7 + browserslist: 4.29.5 cssnano-preset-default: 6.1.2(postcss@8.5.23) postcss: 8.5.23 postcss-discard-unused: 6.0.5(postcss@8.5.23) @@ -48675,7 +48539,7 @@ snapshots: '@opentelemetry/exporter-trace-otlp-proto': 0.211.0(@opentelemetry/api@1.10.0) '@opentelemetry/resources': 2.12.1(@opentelemetry/api@1.10.0) '@opentelemetry/sdk-trace-base': 2.12.1(@opentelemetry/api@1.10.0) - '@opentelemetry/sdk-trace-node': 2.12.0(@opentelemetry/api@1.10.0) + '@opentelemetry/sdk-trace-node': 2.12.1(@opentelemetry/api@1.10.0) '@opentelemetry/semantic-conventions': 1.44.0 '@sentry/node': 10.78.0(@opentelemetry/core@2.12.0(@opentelemetry/api@1.10.0))(@opentelemetry/exporter-trace-otlp-http@0.223.2(@opentelemetry/api@1.10.0))(supports-color@10.2.2) axios: 1.20.0(debug@4.4.3(supports-color@10.2.2))(supports-color@10.2.2) @@ -48928,7 +48792,7 @@ snapshots: dockerode@4.0.12(supports-color@10.2.2): dependencies: '@balena/dockerignore': 1.0.2 - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 '@grpc/proto-loader': 0.7.15 docker-modem: 5.0.7(supports-color@10.2.2) protobufjs: 8.8.0 @@ -49882,7 +49746,7 @@ snapshots: '@azure/core-auth': 1.11.0(supports-color@10.2.2) '@azure/identity': 4.14.1(supports-color@10.2.2) '@azure/storage-blob': 12.34.0(supports-color@10.2.2) - '@modelcontextprotocol/sdk': 1.32.1(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) + '@modelcontextprotocol/sdk': 1.32.2(@cfworker/json-schema@4.1.4)(supports-color@10.2.2)(zod@4.6.7) '@openai/agents': 0.11.8(@aws-sdk/credential-provider-node@3.972.92)(@cfworker/json-schema@4.1.4)(@smithy/signature-v4@5.7.5)(bufferutil@4.1.0)(supports-color@10.2.2)(ws@8.22.0(bufferutil@4.1.0))(zod@4.6.7) '@opentelemetry/api': 1.10.0 '@supabase/storage-js': 2.118.0 @@ -50358,7 +50222,7 @@ snapshots: google-gax@5.0.8(supports-color@10.2.2): dependencies: - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 '@grpc/proto-loader': 0.8.1 duplexify: 4.1.3 google-auth-library: 10.5.0(supports-color@10.2.2) @@ -50374,7 +50238,7 @@ snapshots: google-gax@6.14.0(supports-color@10.2.2): dependencies: - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 '@grpc/proto-loader': 0.8.1 '@opentelemetry/api': 1.10.0 duplexify: 4.1.3 @@ -50438,7 +50302,7 @@ snapshots: grpc-gcp@1.1.1: dependencies: - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 protobufjs: 8.8.0 gtoken@8.0.0(supports-color@10.2.2): @@ -50750,26 +50614,6 @@ snapshots: dependencies: parse-passwd: 1.0.0 - hono-openapi@1.5.0(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@6.0.3)))(arktype@2.2.9)(hono@4.13.17)(valibot@1.5.0(typescript@6.0.3))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7): - dependencies: - '@hono/standard-validator': 0.4.1(@standard-schema/spec@1.1.0)(hono@4.13.17) - '@standard-community/standard-json': 0.3.7(@standard-schema/spec@1.1.0)(@types/json-schema@7.0.15)(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@6.0.3)))(arktype@2.2.9)(valibot@1.5.0(typescript@6.0.3))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7) - '@standard-community/standard-openapi': 0.2.11(@standard-community/standard-json@0.3.7(@standard-schema/spec@1.1.0)(@types/json-schema@7.0.15)(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@6.0.3)))(arktype@2.2.9)(valibot@1.5.0(typescript@6.0.3))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7))(@standard-schema/spec@1.1.0)(arktype@2.2.9)(openapi-types@12.1.3)(valibot@1.5.0(typescript@6.0.3))(zod@4.6.7) - '@standard-schema/spec': 1.1.0 - '@types/json-schema': 7.0.15 - hono: 4.13.17 - openapi-types: 12.1.3 - transitivePeerDependencies: - - '@valibot/to-json-schema' - - arktype - - effect - - sury - - typebox - - valibot - - zod - - zod-openapi - - zod-to-json-schema - hono-openapi@1.5.0(@valibot/to-json-schema@1.8.0(valibot@1.5.0(typescript@7.0.2)))(arktype@2.2.9)(hono@4.13.17)(valibot@1.5.0(typescript@7.0.2))(zod-to-json-schema@3.25.2(zod@4.6.7))(zod@4.6.7): dependencies: '@hono/standard-validator': 0.4.1(@standard-schema/spec@1.1.0)(hono@4.13.17) @@ -51069,20 +50913,20 @@ snapshots: adm-zip: 0.6.1 debug: 4.4.3(supports-color@10.2.2) node-fetch: 2.7.0(encoding@0.1.14) - tar: 7.5.21 + tar: 7.5.22 transitivePeerDependencies: - encoding - supports-color inngest@4.26.2(@opentelemetry/core@3.1.1(@opentelemetry/api@1.10.0))(encoding@0.1.14)(express@5.3.0(supports-color@10.2.2))(fastify@5.12.8)(hono@4.13.17)(koa@3.3.0)(react@19.3.1)(supports-color@10.2.2)(typescript@7.0.2)(zod@4.6.7): dependencies: - '@bufbuild/protobuf': 2.13.0 + '@bufbuild/protobuf': 2.16.0 '@inngest/ai': 0.1.8 '@jpwilliams/waitgroup': 2.1.1 '@opentelemetry/api': 1.10.0 '@opentelemetry/auto-instrumentations-node': 0.82.0(@opentelemetry/api@1.10.0)(@opentelemetry/core@3.1.1(@opentelemetry/api@1.10.0))(supports-color@10.2.2) - '@opentelemetry/context-async-hooks': 2.12.0(@opentelemetry/api@1.10.0) - '@opentelemetry/exporter-trace-otlp-http': 0.223.0(@opentelemetry/api@1.10.0) + '@opentelemetry/context-async-hooks': 2.12.1(@opentelemetry/api@1.10.0) + '@opentelemetry/exporter-trace-otlp-http': 0.223.2(@opentelemetry/api@1.10.0) '@opentelemetry/instrumentation': 0.223.0(@opentelemetry/api@1.10.0)(supports-color@10.2.2) '@opentelemetry/resources': 2.12.1(@opentelemetry/api@1.10.0) '@opentelemetry/sdk-trace-base': 2.12.1(@opentelemetry/api@1.10.0) @@ -51345,8 +51189,6 @@ snapshots: js-base64@3.9.6: {} - js-cookie@3.0.7: {} - js-cookie@3.0.8: {} js-md4@0.3.2: {} @@ -51368,10 +51210,6 @@ snapshots: dependencies: argparse: 2.0.1 - js-yaml@5.4.1: - dependencies: - argparse: 2.0.1 - js-yaml@5.5.0: dependencies: argparse: 3.0.4 @@ -51468,7 +51306,7 @@ snapshots: '@apidevtools/json-schema-ref-parser': 11.9.3 '@types/json-schema': 7.0.15 '@types/lodash': 4.17.27 - js-yaml: 5.4.1 + js-yaml: 5.5.0 lodash: 4.18.1 minimist: 1.2.8 prettier: 3.9.10 @@ -52977,31 +52815,6 @@ snapshots: - '@types/node' optional: true - msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3): - dependencies: - '@inquirer/confirm': 6.3.5(@types/node@22.19.15) - '@mswjs/interceptors': 0.41.9 - '@open-draft/deferred-promise': 3.0.0 - '@types/statuses': 2.0.6 - cookie: 1.1.1 - graphql: 16.14.2 - headers-polyfill: 5.0.1 - is-node-process: 1.2.0 - outvariant: 1.4.3 - path-to-regexp: 6.3.0 - picocolors: 1.1.1 - rettime: 0.11.12 - statuses: 2.0.2 - strict-event-emitter: 0.5.1 - tough-cookie: 6.0.2 - type-fest: 5.10.0 - until-async: 3.0.2 - yargs: 18.2.0 - optionalDependencies: - typescript: 6.0.3 - transitivePeerDependencies: - - '@types/node' - msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2): dependencies: '@inquirer/confirm': 6.3.5(@types/node@22.19.15) @@ -53120,7 +52933,7 @@ snapshots: nice-grpc@2.1.18: dependencies: - '@grpc/grpc-js': 1.14.5 + '@grpc/grpc-js': 1.14.7 abort-controller-x: 0.5.0 nice-grpc-common: 2.0.4 @@ -54630,7 +54443,7 @@ snapshots: '@csstools/postcss-trigonometric-functions': 4.0.9(postcss@8.5.23) '@csstools/postcss-unset-value': 4.0.0(postcss@8.5.23) autoprefixer: 10.6.2(postcss@8.5.23) - browserslist: 4.28.7 + browserslist: 4.29.5 css-blank-pseudo: 7.0.1(postcss@8.5.23) css-has-pseudo: 7.0.3(postcss@8.5.23) css-prefers-color-scheme: 10.0.0(postcss@8.5.23) @@ -56084,20 +55897,6 @@ snapshots: transitivePeerDependencies: - oxc-resolver - rolldown-plugin-dts@0.28.8(oxc-resolver@11.21.2)(rolldown@1.2.16)(typescript@6.0.3): - dependencies: - dts-resolver: 3.0.0(oxc-resolver@11.21.2) - get-tsconfig: 5.0.0-beta.6 - obug: 3.0.0 - rolldown: 1.2.16 - yuku-ast: 0.19.0 - yuku-codegen: 0.19.0 - yuku-parser: 0.19.0 - optionalDependencies: - typescript: 6.0.3 - transitivePeerDependencies: - - oxc-resolver - rolldown-plugin-dts@0.28.8(oxc-resolver@11.21.2)(rolldown@1.2.16)(typescript@7.0.2): dependencies: dts-resolver: 3.0.0(oxc-resolver@11.21.2) @@ -57143,14 +56942,6 @@ snapshots: - bare-buffer - react-native-b4a - tar@7.5.21: - dependencies: - '@isaacs/fs-minipass': 4.0.1 - chownr: 3.0.0 - minipass: 7.1.3 - minizlib: 3.1.0 - yallist: 5.0.0 - tar@7.5.22: dependencies: '@isaacs/fs-minipass': 4.0.1 @@ -57324,7 +57115,7 @@ snapshots: json-rpc-2.0: 1.8.1 sqids: 0.3.0 uri-template-matcher: 1.1.2 - valibot: 1.4.2(typescript@7.0.2) + valibot: 1.5.0(typescript@7.0.2) transitivePeerDependencies: - typescript @@ -57461,32 +57252,6 @@ snapshots: - oxc-resolver - vue-tsc - tsdown@0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@6.0.3): - dependencies: - cac: 7.1.0 - defu: 6.1.7 - empathic: 2.1.0 - hookable: 6.1.2 - import-without-cache: 0.4.1 - obug: 3.0.0 - picomatch: 4.0.7 - rolldown: 1.2.16 - rolldown-plugin-dts: 0.28.8(oxc-resolver@11.21.2)(rolldown@1.2.16)(typescript@6.0.3) - tinyexec: 1.3.1 - tinyglobby: 0.2.17 - tree-kill: 1.2.2 - unconfig-core: 7.5.0 - verkit: 0.5.0 - optionalDependencies: - tsx: 4.23.15 - typescript: 6.0.3 - transitivePeerDependencies: - - '@typescript/native-preview' - - '@volar/typescript' - - '@vue/language-core' - - oxc-resolver - - vue-tsc - tsdown@0.23.1(oxc-resolver@11.21.2)(tsx@4.23.15)(typescript@7.0.2): dependencies: cac: 7.1.0 @@ -57844,12 +57609,6 @@ snapshots: untildify@4.0.0: {} - update-browserslist-db@1.3.4(browserslist@4.28.7): - dependencies: - browserslist: 4.28.7 - escalade: 3.2.0 - picocolors: 1.1.1 - update-browserslist-db@1.3.4(browserslist@4.29.5): dependencies: browserslist: 4.29.5 @@ -57950,15 +57709,6 @@ snapshots: optionalDependencies: typescript: 5.9.3 - valibot@1.4.2(typescript@7.0.2): - optionalDependencies: - typescript: 7.0.2 - - valibot@1.5.0(typescript@6.0.3): - optionalDependencies: - typescript: 6.0.3 - optional: true - valibot@1.5.0(typescript@7.0.2): optionalDependencies: typescript: 7.0.2 @@ -58182,31 +57932,6 @@ snapshots: transitivePeerDependencies: - msw - vitest@5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)): - dependencies: - '@types/chai': 5.2.3 - '@vitest/mocker': 5.1.0(msw@2.15.0(@types/node@22.19.15)(typescript@6.0.3))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) - chai: 6.3.0 - es-module-lexer: 2.3.2 - expect-type: 1.4.0 - magic-string: 1.4.5 - obug: 3.0.0 - picomatch: 4.0.7 - std-env: 4.3.0 - tinybench: 6.2.3 - tinyexec: 1.3.1 - tinyglobby: 0.2.17 - vite: 8.3.5(@types/node@22.19.15)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1) - why-is-node-running: 3.2.1 - optionalDependencies: - '@opentelemetry/api': 1.10.0 - '@types/node': 22.19.15 - '@vitest/coverage-v8': 5.1.0(vitest@5.1.0) - '@vitest/ui': 5.1.0(vitest@5.1.0) - jsdom: 30.1.3(@noble/hashes@2.4.0) - transitivePeerDependencies: - - msw - vitest@5.1.0(@opentelemetry/api@1.10.0)(@types/node@22.19.15)(@vitest/coverage-v8@5.1.0)(@vitest/ui@5.1.0)(jsdom@30.1.3(@noble/hashes@2.4.0))(msw@2.15.0(@types/node@22.19.15)(typescript@7.0.2))(vite@8.3.5(@types/node@22.19.15)(esbuild@0.25.12)(jiti@2.7.0)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)): dependencies: '@types/chai': 5.2.3 @@ -58282,11 +58007,11 @@ snapshots: transitivePeerDependencies: - msw - voyageai@0.3.1(encoding@0.1.14)(onnxruntime-node@1.24.3): + voyageai@0.3.1(encoding@0.1.14)(onnxruntime-node@1.30.0): dependencies: node-fetch: 2.7.0(encoding@0.1.14) optionalDependencies: - onnxruntime-node: 1.24.3 + onnxruntime-node: 1.30.0 transitivePeerDependencies: - encoding diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 49828db58ea..1bbbf93228a 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -60,7 +60,7 @@ catalog: catalogs: ts6: - typescript: ^6.0.3 + typescript: ^7.0.2 peerDependencyRules: allowedVersions: From f346f6c4afe60931ee0caedfc94fb74e8a8b4d71 Mon Sep 17 00:00:00 2001 From: "dane-ai-mastra[bot]" <199668360+dane-ai-mastra[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 00:01:31 -0700 Subject: [PATCH 02/10] chore: version packages (alpha) (#30660) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/core@1.84.0-alpha.6 ### Minor Changes - Knowledge storage can supply scope declarations, access rules included. ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) A store returns declarations from `getScopeDeclarations()` (none by default). Knowledge merges them under its config's: the config wins on a key both declare, and a declaration that doesn't compile is skipped with a warning. When stored scopes come from a skipped declaration, the declaration check's error names that declaration and why it was skipped, so it can be fixed in the store. The store's answer is reused for 30 seconds and read again after `renameScopeDeclaration`, so a declaration the store adds, removes or changes (access rules included) applies within that window without a store read on every call. Revoking access through the store can therefore take up to 30 seconds to take effect. ```ts class ImportingKnowledgeStorage extends InMemoryKnowledgeStorage { override async getScopeDeclarations() { return { 'imports:$name': {}, 'linear:$account:$connection': { access: [{ principal: 'imports:all', role: 'viewer' }] }, }; } } ``` Runs that hold `imports:all` then read every Linear connection's pages. ## @mastra/platform@0.1.0-alpha.1 ### Minor Changes - Added `PlatformBrowser`, a Stagehand browser backed by a Mastra Platform browser session. By default it provisions a session with `POST /v1/browsers/sessions` on the Platform and connects to the returned CDP URL; pass `cdpUrl` to connect to a session you already provisioned, with no token or API call. The access token falls back to `MASTRA_PLATFORM_ACCESS_TOKEN` / `MASTRA_PLATFORM_SECRET_KEY`, the project to `MASTRA_PROJECT_ID`, and the API URL to `MASTRA_BROWSER_API_URL`. `@mastra/platform` now depends on `@mastra/stagehand` at runtime. ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) ```ts import { PlatformBrowser } from '@mastra/platform'; const agent = new Agent({ name: 'browser-agent', model, browser: new PlatformBrowser() }); ``` - Added `@mastra/platform`: hosted Mastra Platform Memory and Knowledge clients, with Platform Sandbox and Filesystem re-exported from `@mastra/platform-workspace`. `PlatformMemory` is a drop-in `memory` for `Agent` that loads observations and recent messages from a Platform Memory instance and saves each turn back; observation and reflection run on the Platform. `PlatformMemoryClient` exposes the same API directly. Credentials fall back to `MASTRA_PLATFORM_ACCESS_TOKEN` / `MASTRA_PLATFORM_SECRET_KEY`. `PlatformMemory` uses `MASTRA_MEMORY_INSTANCE_ID`; `PlatformKnowledge` uses `MASTRA_KNOWLEDGE_INSTANCE_ID`. `PlatformKnowledge` takes every scope declaration and access rule from its instance, Memory's and Platform importers' included, and has no `scopes` option. Agents read imported pages when their runs hold the scope an importer's rule grants (for now `imports:all`). ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) ```ts import { PlatformMemory, PlatformKnowledge, PlatformSandbox, PlatformFilesystem } from '@mastra/platform'; const agent = new Agent({ name: 'assistant', model, memory: new PlatformMemory() }); ``` ### Patch Changes - `PlatformKnowledge` now supports listing pins: `knowledge_pin` with `kind: 'list'` pins a page's listing on hosted Knowledge instead of refusing it as an old storage adapter. ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) - `PlatformMemory` fixes for read-only runs and working memory: ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) - A read-only run (`memory: { options: { readOnly: true } }`) now sees the thread's observations and unobserved messages, read through the Memory instance's read-only context route. Before, it got no stored context at all. It still saves nothing and starts no observation. - The `workingMemory` option now delivers what it says: `readonly` and `tool` add the resource's stored working memory to each run's prompt, read fresh each run; `tool` also tells the agent to update it with `updateWorkingMemory`; `off` leaves it out. Before, stored working memory never reached the prompt in any mode. - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 See [release notes](https://github.com/mastra-ai/mastra/releases) for published changes. ## @mastra/client-js@1.60.1-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 ## @mastra/react@1.15.1-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/client-js@1.60.1-alpha.6 ## @mastra/deployer-cloud@1.84.0-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/deployer@1.84.0-alpha.6 ## @mastra/longmemeval@1.1.43-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 ## @mastra/opencode@0.1.43-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 ## @mastra/factory@0.29.0-alpha.7 ### Patch Changes - The **Activity** sort in the Factory sidebar now orders sessions that share a status by their last update instead of their creation date, the same as **Last updated** does. An older session that was updated since no longer sinks below a newer one that was left alone. ([#30656](https://github.com/mastra-ai/mastra/pull/30656)) - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/code-sdk@1.19.1-alpha.7 ## create-factory@0.5.0-alpha.6 ### Patch Changes - Updated dependencies [[`bfcb0f7`](https://github.com/mastra-ai/mastra/commit/bfcb0f738dc0891014c0802d4d0fc5982fca83ee), [`383a19d`](https://github.com/mastra-ai/mastra/commit/383a19d0474ea150b8e209e20963ee6f6206393e)]: - mastra@1.40.0-alpha.6 ## @mastra/code-sdk@1.19.1-alpha.7 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/client-js@1.60.1-alpha.6 ## mastracode@0.50.1-alpha.7 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/code-sdk@1.19.1-alpha.7 ## mastra@1.40.0-alpha.6 ### Patch Changes - The Factory sidebar now groups sessions by board and shows a second line under each session by default, with when it last changed and its pull request. Turn on **Compact view** or set **Group** to **None** in the sidebar's properties menu to get one line per session or a single list back. Settings you already changed keep their values; the rest follow the new defaults. ([#30656](https://github.com/mastra-ai/mastra/pull/30656)) - Factory **Settings** now shows theme and completion sound on **My account**, next to your profile and log out, instead of on a separate **Preferences** page. Settings opens on **My account**, and old Preferences links go there. ([#30658](https://github.com/mastra-ai/mastra/pull/30658)) - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/deployer@1.84.0-alpha.6 ## @mastra/deployer@1.84.0-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/server@1.84.0-alpha.6 ## @mastra/mcp-docs-server@1.3.14-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 ## @mastra/playground-ui@69.1.0-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/client-js@1.60.1-alpha.6 - @mastra/react@1.15.1-alpha.6 ## @mastra/server@1.84.0-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 ## @mastra/elysia@0.1.24-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/server@1.84.0-alpha.6 ## @mastra/express@1.5.28-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/server@1.84.0-alpha.6 ## @mastra/fastify@1.5.28-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/server@1.84.0-alpha.6 ## @mastra/hono@1.7.26-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/server@1.84.0-alpha.6 ## @mastra/koa@1.7.28-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/server@1.84.0-alpha.6 ## @mastra/nestjs@0.3.1-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/server@1.84.0-alpha.6 ## @mastra/next@0.2.42-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/hono@1.7.26-alpha.6 - @mastra/server@1.84.0-alpha.6 ## @mastra/tanstack-start@0.2.42-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/hono@1.7.26-alpha.6 - @mastra/server@1.84.0-alpha.6 ## @mastra/temporal@0.6.1-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/deployer@1.84.0-alpha.6 ## create-mastra@1.40.0-alpha.6 ## @internal/playground@1.40.0-alpha.6 ### Patch Changes - Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: - @mastra/core@1.84.0-alpha.6 - @mastra/client-js@1.60.1-alpha.6 - @mastra/react@1.15.1-alpha.6 - @mastra/playground-ui@69.1.0-alpha.6 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .changeset/pre.json | 11 ++++++- client-sdks/client-js/CHANGELOG.md | 7 +++++ client-sdks/client-js/package.json | 2 +- client-sdks/react/CHANGELOG.md | 8 ++++++ client-sdks/react/package.json | 2 +- deployers/cloud/CHANGELOG.md | 8 ++++++ deployers/cloud/package.json | 2 +- explorations/longmemeval/CHANGELOG.md | 7 +++++ explorations/longmemeval/package.json | 2 +- integrations/opencode/CHANGELOG.md | 7 +++++ integrations/opencode/package.json | 2 +- mastracode/factory/CHANGELOG.md | 10 +++++++ mastracode/factory/package.json | 2 +- mastracode/mastra-factory/CHANGELOG.md | 7 +++++ mastracode/mastra-factory/package.json | 2 +- mastracode/sdk/CHANGELOG.md | 8 ++++++ mastracode/sdk/package.json | 2 +- mastracode/tui/CHANGELOG.md | 8 ++++++ mastracode/tui/package.json | 2 +- packages/cli/CHANGELOG.md | 12 ++++++++ packages/cli/package.json | 2 +- packages/core/CHANGELOG.md | 21 ++++++++++++++ packages/core/package.json | 2 +- packages/create-mastra/CHANGELOG.md | 2 ++ packages/create-mastra/package.json | 2 +- packages/deployer/CHANGELOG.md | 8 ++++++ packages/deployer/package.json | 2 +- packages/mcp-docs-server/CHANGELOG.md | 7 +++++ packages/mcp-docs-server/package.json | 2 +- packages/platform/CHANGELOG.md | 32 +++++++++++++++++++++ packages/platform/package.json | 2 +- packages/playground-ui/CHANGELOG.md | 9 ++++++ packages/playground-ui/package.json | 2 +- packages/playground/CHANGELOG.md | 10 +++++++ packages/playground/package.json | 2 +- packages/server/CHANGELOG.md | 7 +++++ packages/server/package.json | 2 +- server-adapters/elysia/CHANGELOG.md | 8 ++++++ server-adapters/elysia/package.json | 2 +- server-adapters/express/CHANGELOG.md | 8 ++++++ server-adapters/express/package.json | 2 +- server-adapters/fastify/CHANGELOG.md | 8 ++++++ server-adapters/fastify/package.json | 2 +- server-adapters/hono/CHANGELOG.md | 8 ++++++ server-adapters/hono/package.json | 2 +- server-adapters/koa/CHANGELOG.md | 8 ++++++ server-adapters/koa/package.json | 2 +- server-adapters/nestjs/CHANGELOG.md | 8 ++++++ server-adapters/nestjs/package.json | 2 +- server-adapters/next/CHANGELOG.md | 9 ++++++ server-adapters/next/package.json | 2 +- server-adapters/tanstack-start/CHANGELOG.md | 9 ++++++ server-adapters/tanstack-start/package.json | 2 +- workflows/temporal/CHANGELOG.md | 8 ++++++ workflows/temporal/package.json | 2 +- 55 files changed, 289 insertions(+), 28 deletions(-) diff --git a/.changeset/pre.json b/.changeset/pre.json index 41985cc88f3..1af639fe419 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -195,7 +195,8 @@ "@mastra/s3": "0.6.5", "@mastra/sprites": "0.1.2", "@mastra/vercel": "1.6.3", - "@mastra/json-render": "0.0.0" + "@mastra/json-render": "0.0.0", + "@mastra/platform": "0.1.0-alpha.0" }, "changesets": [ "@mastra_auth-better-auth-30464-dependencies", @@ -224,8 +225,10 @@ "create-factory-tag-lookup-errors", "cuddly-symbols-laugh", "curly-pillows-argue", + "curvy-nights-bet", "cute-swans-march", "daytona-sdk-package-rename", + "dry-worlds-sit", "durable-agent-replay-takeover", "durable-recover-processor-errors", "e2b-run-as-user-mount-owner", @@ -255,6 +258,7 @@ "factory-personal-custom-providers", "factory-phase-session-owner", "factory-pr-joins-external-card", + "factory-preferences-in-my-account", "factory-pull-request-reopen", "factory-recent-repos-picker", "factory-remove-provider-list-routes", @@ -291,6 +295,7 @@ "knowledge-host-move-page", "knowledge-reembed-existing", "knowledge-scope-values-no-colons", + "knowledge-store-scope-declarations", "late-falcons-listen", "lazy-suns-dream", "legal-spies-kiss", @@ -323,6 +328,10 @@ "plain-lands-refuse", "plain-search-groups", "plan-feedback-revises", + "platform-browser", + "platform-knowledge-listing-pins", + "platform-memory-initial", + "platform-memory-read-only-and-working-memory", "plenty-boats-travel", "plenty-buckets-relate", "plenty-clouds-search", diff --git a/client-sdks/client-js/CHANGELOG.md b/client-sdks/client-js/CHANGELOG.md index 259d4cfb224..58275b661c1 100644 --- a/client-sdks/client-js/CHANGELOG.md +++ b/client-sdks/client-js/CHANGELOG.md @@ -1,5 +1,12 @@ # @mastra/client-js +## 1.60.1-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + ## 1.60.1-alpha.5 ### Patch Changes diff --git a/client-sdks/client-js/package.json b/client-sdks/client-js/package.json index c49cdf68829..69c40fc0d56 100644 --- a/client-sdks/client-js/package.json +++ b/client-sdks/client-js/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/client-js", - "version": "1.60.1-alpha.5", + "version": "1.60.1-alpha.6", "description": "The official TypeScript library for the Mastra Client API", "author": "", "type": "module", diff --git a/client-sdks/react/CHANGELOG.md b/client-sdks/react/CHANGELOG.md index d0c193625ae..78123e64677 100644 --- a/client-sdks/react/CHANGELOG.md +++ b/client-sdks/react/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/react +## 1.15.1-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/client-js@1.60.1-alpha.6 + ## 1.15.1-alpha.5 ### Patch Changes diff --git a/client-sdks/react/package.json b/client-sdks/react/package.json index 1452ae643a6..528fb72cbaf 100644 --- a/client-sdks/react/package.json +++ b/client-sdks/react/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/react", - "version": "1.15.1-alpha.5", + "version": "1.15.1-alpha.6", "repository": { "type": "git", "url": "git+https://github.com/mastra-ai/mastra.git", diff --git a/deployers/cloud/CHANGELOG.md b/deployers/cloud/CHANGELOG.md index f3674e28354..d8e74d50130 100644 --- a/deployers/cloud/CHANGELOG.md +++ b/deployers/cloud/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/deployer-cloud +## 1.84.0-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/deployer@1.84.0-alpha.6 + ## 1.84.0-alpha.5 ### Patch Changes diff --git a/deployers/cloud/package.json b/deployers/cloud/package.json index 4a2b88e1a25..1508f332b90 100644 --- a/deployers/cloud/package.json +++ b/deployers/cloud/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/deployer-cloud", - "version": "1.84.0-alpha.5", + "version": "1.84.0-alpha.6", "description": "", "type": "module", "files": [ diff --git a/explorations/longmemeval/CHANGELOG.md b/explorations/longmemeval/CHANGELOG.md index e1e42689119..4c5879ae698 100644 --- a/explorations/longmemeval/CHANGELOG.md +++ b/explorations/longmemeval/CHANGELOG.md @@ -1,5 +1,12 @@ # @mastra/longmemeval +## 1.1.43-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + ## 1.1.43-alpha.5 ### Patch Changes diff --git a/explorations/longmemeval/package.json b/explorations/longmemeval/package.json index 6a8b5f54d28..c86ccf7075f 100644 --- a/explorations/longmemeval/package.json +++ b/explorations/longmemeval/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/longmemeval", - "version": "1.1.43-alpha.5", + "version": "1.1.43-alpha.6", "description": "LongMemEval benchmark implementation for Mastra Memory", "scripts": { "test": "vitest", diff --git a/integrations/opencode/CHANGELOG.md b/integrations/opencode/CHANGELOG.md index 13aec392a11..d0af7db25ce 100644 --- a/integrations/opencode/CHANGELOG.md +++ b/integrations/opencode/CHANGELOG.md @@ -1,5 +1,12 @@ # @mastra/opencode +## 0.1.43-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + ## 0.1.43-alpha.5 ### Patch Changes diff --git a/integrations/opencode/package.json b/integrations/opencode/package.json index 160397f5e4d..5829b3071b6 100644 --- a/integrations/opencode/package.json +++ b/integrations/opencode/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/opencode", - "version": "0.1.43-alpha.5", + "version": "0.1.43-alpha.6", "description": "OpenCode plugin for Mastra Observational Memory", "type": "module", "main": "./dist/index.js", diff --git a/mastracode/factory/CHANGELOG.md b/mastracode/factory/CHANGELOG.md index 718cd80014c..9211ee00385 100644 --- a/mastracode/factory/CHANGELOG.md +++ b/mastracode/factory/CHANGELOG.md @@ -1,5 +1,15 @@ # @mastra/factory +## 0.29.0-alpha.7 + +### Patch Changes + +- The **Activity** sort in the Factory sidebar now orders sessions that share a status by their last update instead of their creation date, the same as **Last updated** does. An older session that was updated since no longer sinks below a newer one that was left alone. ([#30656](https://github.com/mastra-ai/mastra/pull/30656)) + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/code-sdk@1.19.1-alpha.7 + ## 0.29.0-alpha.6 ### Minor Changes diff --git a/mastracode/factory/package.json b/mastracode/factory/package.json index f9a3055c702..134ab365c61 100644 --- a/mastracode/factory/package.json +++ b/mastracode/factory/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/factory", - "version": "0.29.0-alpha.6", + "version": "0.29.0-alpha.7", "description": "Mastra Software Factory module: the server core behind the Mastra Software Factory — storage domains, integrations, and surfaces for agent-powered software delivery", "type": "module", "publishConfig": { diff --git a/mastracode/mastra-factory/CHANGELOG.md b/mastracode/mastra-factory/CHANGELOG.md index 3e728bb0198..b938042f061 100644 --- a/mastracode/mastra-factory/CHANGELOG.md +++ b/mastracode/mastra-factory/CHANGELOG.md @@ -1,5 +1,12 @@ # create-factory +## 0.5.0-alpha.6 + +### Patch Changes + +- Updated dependencies [[`bfcb0f7`](https://github.com/mastra-ai/mastra/commit/bfcb0f738dc0891014c0802d4d0fc5982fca83ee), [`383a19d`](https://github.com/mastra-ai/mastra/commit/383a19d0474ea150b8e209e20963ee6f6206393e)]: + - mastra@1.40.0-alpha.6 + ## 0.5.0-alpha.5 ### Minor Changes diff --git a/mastracode/mastra-factory/package.json b/mastracode/mastra-factory/package.json index f0b372819e8..30939f36c00 100644 --- a/mastracode/mastra-factory/package.json +++ b/mastracode/mastra-factory/package.json @@ -1,6 +1,6 @@ { "name": "create-factory", - "version": "0.5.0-alpha.5", + "version": "0.5.0-alpha.6", "description": "Create a Mastra Factory project: an agent-powered software delivery environment built on Mastra. Run `npm create factory` to scaffold and get started.", "type": "module", "license": "Apache-2.0", diff --git a/mastracode/sdk/CHANGELOG.md b/mastracode/sdk/CHANGELOG.md index 3fd577e1d73..f8ab5314ff4 100644 --- a/mastracode/sdk/CHANGELOG.md +++ b/mastracode/sdk/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/code-sdk +## 1.19.1-alpha.7 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/client-js@1.60.1-alpha.6 + ## 1.19.1-alpha.6 ### Patch Changes diff --git a/mastracode/sdk/package.json b/mastracode/sdk/package.json index 1d7781cf804..d2e5e6c32e1 100644 --- a/mastracode/sdk/package.json +++ b/mastracode/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/code-sdk", - "version": "1.19.1-alpha.6", + "version": "1.19.1-alpha.7", "description": "Mastra Code SDK: the agent core behind Mastra Code (everything except the TUI) — build your own UIs and surfaces on top of it", "type": "module", "publishConfig": { diff --git a/mastracode/tui/CHANGELOG.md b/mastracode/tui/CHANGELOG.md index 9be7e44fab1..50052a8f505 100644 --- a/mastracode/tui/CHANGELOG.md +++ b/mastracode/tui/CHANGELOG.md @@ -1,5 +1,13 @@ # mastracode +## 0.50.1-alpha.7 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/code-sdk@1.19.1-alpha.7 + ## 0.50.1-alpha.6 ### Patch Changes diff --git a/mastracode/tui/package.json b/mastracode/tui/package.json index e124dfceaee..7eac0c32e71 100644 --- a/mastracode/tui/package.json +++ b/mastracode/tui/package.json @@ -1,6 +1,6 @@ { "name": "mastracode", - "version": "0.50.1-alpha.6", + "version": "0.50.1-alpha.7", "description": "", "type": "module", "files": [ diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index cc38e39c071..724c31ede6d 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,17 @@ # mastra +## 1.40.0-alpha.6 + +### Patch Changes + +- The Factory sidebar now groups sessions by board and shows a second line under each session by default, with when it last changed and its pull request. Turn on **Compact view** or set **Group** to **None** in the sidebar's properties menu to get one line per session or a single list back. Settings you already changed keep their values; the rest follow the new defaults. ([#30656](https://github.com/mastra-ai/mastra/pull/30656)) + +- Factory **Settings** now shows theme and completion sound on **My account**, next to your profile and log out, instead of on a separate **Preferences** page. Settings opens on **My account**, and old Preferences links go there. ([#30658](https://github.com/mastra-ai/mastra/pull/30658)) + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/deployer@1.84.0-alpha.6 + ## 1.40.0-alpha.5 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index 234afa84cc2..a0c4ce4afa6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "mastra", - "version": "1.40.0-alpha.5", + "version": "1.40.0-alpha.6", "license": "Apache-2.0", "description": "cli for mastra", "type": "module", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index bbfc39d8cec..d110e1b9408 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,26 @@ # @mastra/core +## 1.84.0-alpha.6 + +### Minor Changes + +- Knowledge storage can supply scope declarations, access rules included. ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) + + A store returns declarations from `getScopeDeclarations()` (none by default). Knowledge merges them under its config's: the config wins on a key both declare, and a declaration that doesn't compile is skipped with a warning. When stored scopes come from a skipped declaration, the declaration check's error names that declaration and why it was skipped, so it can be fixed in the store. The store's answer is reused for 30 seconds and read again after `renameScopeDeclaration`, so a declaration the store adds, removes or changes (access rules included) applies within that window without a store read on every call. Revoking access through the store can therefore take up to 30 seconds to take effect. + + ```ts + class ImportingKnowledgeStorage extends InMemoryKnowledgeStorage { + override async getScopeDeclarations() { + return { + 'imports:$name': {}, + 'linear:$account:$connection': { access: [{ principal: 'imports:all', role: 'viewer' }] }, + }; + } + } + ``` + + Runs that hold `imports:all` then read every Linear connection's pages. + ## 1.84.0-alpha.5 ### Minor Changes diff --git a/packages/core/package.json b/packages/core/package.json index 4329a7c80ce..949cfe5b907 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/core", - "version": "1.84.0-alpha.5", + "version": "1.84.0-alpha.6", "license": "Apache-2.0", "type": "module", "main": "dist/index.js", diff --git a/packages/create-mastra/CHANGELOG.md b/packages/create-mastra/CHANGELOG.md index 03f86055703..dc0f5119c2d 100644 --- a/packages/create-mastra/CHANGELOG.md +++ b/packages/create-mastra/CHANGELOG.md @@ -1,5 +1,7 @@ # create-mastra +## 1.40.0-alpha.6 + ## 1.40.0-alpha.5 ## 1.40.0-alpha.4 diff --git a/packages/create-mastra/package.json b/packages/create-mastra/package.json index 0744e745f85..8b7e2a925cf 100644 --- a/packages/create-mastra/package.json +++ b/packages/create-mastra/package.json @@ -1,6 +1,6 @@ { "name": "create-mastra", - "version": "1.40.0-alpha.5", + "version": "1.40.0-alpha.6", "description": "Create Mastra apps with one command", "license": "Apache-2.0", "type": "module", diff --git a/packages/deployer/CHANGELOG.md b/packages/deployer/CHANGELOG.md index 2fc77b65d96..72d55907ebf 100644 --- a/packages/deployer/CHANGELOG.md +++ b/packages/deployer/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/deployer +## 1.84.0-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/server@1.84.0-alpha.6 + ## 1.84.0-alpha.5 ### Patch Changes diff --git a/packages/deployer/package.json b/packages/deployer/package.json index 07eeddd9540..abc382ff30c 100644 --- a/packages/deployer/package.json +++ b/packages/deployer/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/deployer", - "version": "1.84.0-alpha.5", + "version": "1.84.0-alpha.6", "description": "", "type": "module", "files": [ diff --git a/packages/mcp-docs-server/CHANGELOG.md b/packages/mcp-docs-server/CHANGELOG.md index 3149add7065..2307b3d0e56 100644 --- a/packages/mcp-docs-server/CHANGELOG.md +++ b/packages/mcp-docs-server/CHANGELOG.md @@ -1,5 +1,12 @@ # @mastra/mcp-docs-server +## 1.3.14-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + ## 1.3.14-alpha.5 ### Patch Changes diff --git a/packages/mcp-docs-server/package.json b/packages/mcp-docs-server/package.json index 9e637087ae9..36fc0ac104d 100644 --- a/packages/mcp-docs-server/package.json +++ b/packages/mcp-docs-server/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/mcp-docs-server", - "version": "1.3.14-alpha.5", + "version": "1.3.14-alpha.6", "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.", "type": "module", "main": "dist/index.js", diff --git a/packages/platform/CHANGELOG.md b/packages/platform/CHANGELOG.md index 940100dac15..34736d81589 100644 --- a/packages/platform/CHANGELOG.md +++ b/packages/platform/CHANGELOG.md @@ -1,3 +1,35 @@ # @mastra/platform +## 0.1.0-alpha.1 + +### Minor Changes + +- Added `PlatformBrowser`, a Stagehand browser backed by a Mastra Platform browser session. By default it provisions a session with `POST /v1/browsers/sessions` on the Platform and connects to the returned CDP URL; pass `cdpUrl` to connect to a session you already provisioned, with no token or API call. The access token falls back to `MASTRA_PLATFORM_ACCESS_TOKEN` / `MASTRA_PLATFORM_SECRET_KEY`, the project to `MASTRA_PROJECT_ID`, and the API URL to `MASTRA_BROWSER_API_URL`. `@mastra/platform` now depends on `@mastra/stagehand` at runtime. ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) + + ```ts + import { PlatformBrowser } from '@mastra/platform'; + + const agent = new Agent({ name: 'browser-agent', model, browser: new PlatformBrowser() }); + ``` + +- Added `@mastra/platform`: hosted Mastra Platform Memory and Knowledge clients, with Platform Sandbox and Filesystem re-exported from `@mastra/platform-workspace`. `PlatformMemory` is a drop-in `memory` for `Agent` that loads observations and recent messages from a Platform Memory instance and saves each turn back; observation and reflection run on the Platform. `PlatformMemoryClient` exposes the same API directly. Credentials fall back to `MASTRA_PLATFORM_ACCESS_TOKEN` / `MASTRA_PLATFORM_SECRET_KEY`. `PlatformMemory` uses `MASTRA_MEMORY_INSTANCE_ID`; `PlatformKnowledge` uses `MASTRA_KNOWLEDGE_INSTANCE_ID`. `PlatformKnowledge` takes every scope declaration and access rule from its instance, Memory's and Platform importers' included, and has no `scopes` option. Agents read imported pages when their runs hold the scope an importer's rule grants (for now `imports:all`). ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) + + ```ts + import { PlatformMemory, PlatformKnowledge, PlatformSandbox, PlatformFilesystem } from '@mastra/platform'; + + const agent = new Agent({ name: 'assistant', model, memory: new PlatformMemory() }); + ``` + +### Patch Changes + +- `PlatformKnowledge` now supports listing pins: `knowledge_pin` with `kind: 'list'` pins a page's listing on hosted Knowledge instead of refusing it as an old storage adapter. ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) + +- `PlatformMemory` fixes for read-only runs and working memory: ([#29428](https://github.com/mastra-ai/mastra/pull/29428)) + + - A read-only run (`memory: { options: { readOnly: true } }`) now sees the thread's observations and unobserved messages, read through the Memory instance's read-only context route. Before, it got no stored context at all. It still saves nothing and starts no observation. + - The `workingMemory` option now delivers what it says: `readonly` and `tool` add the resource's stored working memory to each run's prompt, read fresh each run; `tool` also tells the agent to update it with `updateWorkingMemory`; `off` leaves it out. Before, stored working memory never reached the prompt in any mode. + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + See [release notes](https://github.com/mastra-ai/mastra/releases) for published changes. diff --git a/packages/platform/package.json b/packages/platform/package.json index c2e3bf94000..ca690d37ca0 100644 --- a/packages/platform/package.json +++ b/packages/platform/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/platform", - "version": "0.1.0-alpha.0", + "version": "0.1.0-alpha.1", "description": "Mastra Platform hosted Memory, Knowledge, Browser, and workspace clients", "type": "module", "main": "dist/index.js", diff --git a/packages/playground-ui/CHANGELOG.md b/packages/playground-ui/CHANGELOG.md index 6ca9957c50c..5ba7925a391 100644 --- a/packages/playground-ui/CHANGELOG.md +++ b/packages/playground-ui/CHANGELOG.md @@ -1,5 +1,14 @@ # @mastra/playground-ui +## 69.1.0-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/client-js@1.60.1-alpha.6 + - @mastra/react@1.15.1-alpha.6 + ## 69.1.0-alpha.5 ### Patch Changes diff --git a/packages/playground-ui/package.json b/packages/playground-ui/package.json index 1a8aa76db5c..6c1b54a190e 100644 --- a/packages/playground-ui/package.json +++ b/packages/playground-ui/package.json @@ -1,7 +1,7 @@ { "name": "@mastra/playground-ui", "type": "module", - "version": "69.1.0-alpha.5", + "version": "69.1.0-alpha.6", "description": "Mastra Playground components", "sideEffects": [ "**/*.css" diff --git a/packages/playground/CHANGELOG.md b/packages/playground/CHANGELOG.md index c0b09f129e4..02a9e83f254 100644 --- a/packages/playground/CHANGELOG.md +++ b/packages/playground/CHANGELOG.md @@ -1,5 +1,15 @@ # @internal/playground +## 1.40.0-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/client-js@1.60.1-alpha.6 + - @mastra/react@1.15.1-alpha.6 + - @mastra/playground-ui@69.1.0-alpha.6 + ## 1.40.0-alpha.5 ### Patch Changes diff --git a/packages/playground/package.json b/packages/playground/package.json index 218eba96031..f3667165067 100644 --- a/packages/playground/package.json +++ b/packages/playground/package.json @@ -1,7 +1,7 @@ { "name": "@internal/playground", "private": true, - "version": "1.40.0-alpha.5", + "version": "1.40.0-alpha.6", "type": "module", "main": "./src/exports.ts", "types": "./src/exports.ts", diff --git a/packages/server/CHANGELOG.md b/packages/server/CHANGELOG.md index 992d879045c..e559fd9a4ff 100644 --- a/packages/server/CHANGELOG.md +++ b/packages/server/CHANGELOG.md @@ -1,5 +1,12 @@ # @mastra/server +## 1.84.0-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + ## 1.84.0-alpha.5 ### Patch Changes diff --git a/packages/server/package.json b/packages/server/package.json index 784f492f550..8a6539caeac 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/server", - "version": "1.84.0-alpha.5", + "version": "1.84.0-alpha.6", "description": "", "type": "module", "files": [ diff --git a/server-adapters/elysia/CHANGELOG.md b/server-adapters/elysia/CHANGELOG.md index 1d22e5fe35f..51b1981b5ab 100644 --- a/server-adapters/elysia/CHANGELOG.md +++ b/server-adapters/elysia/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/elysia +## 0.1.24-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/server@1.84.0-alpha.6 + ## 0.1.24-alpha.5 ### Patch Changes diff --git a/server-adapters/elysia/package.json b/server-adapters/elysia/package.json index 129a70a6b27..8b516d8edcd 100644 --- a/server-adapters/elysia/package.json +++ b/server-adapters/elysia/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/elysia", - "version": "0.1.24-alpha.5", + "version": "0.1.24-alpha.6", "description": "Mastra Elysia adapter for the server", "type": "module", "main": "dist/index.js", diff --git a/server-adapters/express/CHANGELOG.md b/server-adapters/express/CHANGELOG.md index b3cd096e058..fa765b58d08 100644 --- a/server-adapters/express/CHANGELOG.md +++ b/server-adapters/express/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/express +## 1.5.28-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/server@1.84.0-alpha.6 + ## 1.5.28-alpha.5 ### Patch Changes diff --git a/server-adapters/express/package.json b/server-adapters/express/package.json index 3d089af4fe4..f10d040ae80 100644 --- a/server-adapters/express/package.json +++ b/server-adapters/express/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/express", - "version": "1.5.28-alpha.5", + "version": "1.5.28-alpha.6", "description": "Mastra Express adapter for the server", "type": "module", "main": "dist/index.js", diff --git a/server-adapters/fastify/CHANGELOG.md b/server-adapters/fastify/CHANGELOG.md index d3199e8727c..67023f326b9 100644 --- a/server-adapters/fastify/CHANGELOG.md +++ b/server-adapters/fastify/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/fastify +## 1.5.28-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/server@1.84.0-alpha.6 + ## 1.5.28-alpha.5 ### Patch Changes diff --git a/server-adapters/fastify/package.json b/server-adapters/fastify/package.json index 08700f77bcd..a766a9424f2 100644 --- a/server-adapters/fastify/package.json +++ b/server-adapters/fastify/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/fastify", - "version": "1.5.28-alpha.5", + "version": "1.5.28-alpha.6", "description": "Mastra Fastify adapter for the server", "type": "module", "main": "dist/index.js", diff --git a/server-adapters/hono/CHANGELOG.md b/server-adapters/hono/CHANGELOG.md index b9e6c00a541..6f9ec96a3cf 100644 --- a/server-adapters/hono/CHANGELOG.md +++ b/server-adapters/hono/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/hono +## 1.7.26-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/server@1.84.0-alpha.6 + ## 1.7.26-alpha.5 ### Patch Changes diff --git a/server-adapters/hono/package.json b/server-adapters/hono/package.json index 1f4fad27e3d..9830388d641 100644 --- a/server-adapters/hono/package.json +++ b/server-adapters/hono/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/hono", - "version": "1.7.26-alpha.5", + "version": "1.7.26-alpha.6", "description": "Mastra Hono adapter for the server", "type": "module", "main": "dist/index.js", diff --git a/server-adapters/koa/CHANGELOG.md b/server-adapters/koa/CHANGELOG.md index a5dfc0b1970..7c60fdb352a 100644 --- a/server-adapters/koa/CHANGELOG.md +++ b/server-adapters/koa/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/koa +## 1.7.28-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/server@1.84.0-alpha.6 + ## 1.7.28-alpha.5 ### Patch Changes diff --git a/server-adapters/koa/package.json b/server-adapters/koa/package.json index 2e23ba78c98..58a55e6a787 100644 --- a/server-adapters/koa/package.json +++ b/server-adapters/koa/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/koa", - "version": "1.7.28-alpha.5", + "version": "1.7.28-alpha.6", "description": "Mastra Koa adapter for the server", "type": "module", "main": "dist/index.js", diff --git a/server-adapters/nestjs/CHANGELOG.md b/server-adapters/nestjs/CHANGELOG.md index 3f008bfa1ea..27c3b1a5387 100644 --- a/server-adapters/nestjs/CHANGELOG.md +++ b/server-adapters/nestjs/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/nestjs +## 0.3.1-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/server@1.84.0-alpha.6 + ## 0.3.1-alpha.5 ### Patch Changes diff --git a/server-adapters/nestjs/package.json b/server-adapters/nestjs/package.json index 482760e635d..81cbb1a62f7 100644 --- a/server-adapters/nestjs/package.json +++ b/server-adapters/nestjs/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/nestjs", - "version": "0.3.1-alpha.5", + "version": "0.3.1-alpha.6", "description": "Mastra NestJS adapter for the server", "type": "module", "main": "dist/index.js", diff --git a/server-adapters/next/CHANGELOG.md b/server-adapters/next/CHANGELOG.md index ca9f7cc1471..06eb07c5be4 100644 --- a/server-adapters/next/CHANGELOG.md +++ b/server-adapters/next/CHANGELOG.md @@ -1,5 +1,14 @@ # @mastra/next +## 0.2.42-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/hono@1.7.26-alpha.6 + - @mastra/server@1.84.0-alpha.6 + ## 0.2.42-alpha.5 ### Patch Changes diff --git a/server-adapters/next/package.json b/server-adapters/next/package.json index c6931f00cc2..ba541839c08 100644 --- a/server-adapters/next/package.json +++ b/server-adapters/next/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/next", - "version": "0.2.42-alpha.5", + "version": "0.2.42-alpha.6", "description": "Mastra Next.js server adapter — drop your Mastra instance into a Next.js app", "type": "module", "main": "dist/index.js", diff --git a/server-adapters/tanstack-start/CHANGELOG.md b/server-adapters/tanstack-start/CHANGELOG.md index 17f8b56dba7..02000e37004 100644 --- a/server-adapters/tanstack-start/CHANGELOG.md +++ b/server-adapters/tanstack-start/CHANGELOG.md @@ -1,5 +1,14 @@ # @mastra/tanstack-start +## 0.2.42-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/hono@1.7.26-alpha.6 + - @mastra/server@1.84.0-alpha.6 + ## 0.2.42-alpha.5 ### Patch Changes diff --git a/server-adapters/tanstack-start/package.json b/server-adapters/tanstack-start/package.json index 864d38283b4..f32450fe05b 100644 --- a/server-adapters/tanstack-start/package.json +++ b/server-adapters/tanstack-start/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/tanstack-start", - "version": "0.2.42-alpha.5", + "version": "0.2.42-alpha.6", "description": "Mastra TanStack Start server adapter — drop your Mastra instance into a TanStack Start app", "type": "module", "main": "dist/index.js", diff --git a/workflows/temporal/CHANGELOG.md b/workflows/temporal/CHANGELOG.md index 31b5735bdd4..be709b24670 100644 --- a/workflows/temporal/CHANGELOG.md +++ b/workflows/temporal/CHANGELOG.md @@ -1,5 +1,13 @@ # @mastra/temporal +## 0.6.1-alpha.6 + +### Patch Changes + +- Updated dependencies [[`0eb407e`](https://github.com/mastra-ai/mastra/commit/0eb407ebcce9d87e96cb399df5a3afb265fc2806)]: + - @mastra/core@1.84.0-alpha.6 + - @mastra/deployer@1.84.0-alpha.6 + ## 0.6.1-alpha.5 ### Patch Changes diff --git a/workflows/temporal/package.json b/workflows/temporal/package.json index 87eb906d3f1..0b9cd72857a 100644 --- a/workflows/temporal/package.json +++ b/workflows/temporal/package.json @@ -1,6 +1,6 @@ { "name": "@mastra/temporal", - "version": "0.6.1-alpha.5", + "version": "0.6.1-alpha.6", "description": "Mastra Temporal workflows integration - run Mastra workflows on the Temporal durable execution platform", "type": "module", "main": "dist/index.js", From ec3fd034e59c9b12792130d6494438a7607cb46c Mon Sep 17 00:00:00 2001 From: Damien Schneider <74979845+damien-schneider@users.noreply.github.com> Date: Mon, 16 Nov 2026 23:08:01 -0800 Subject: [PATCH 03/10] feat(factory): let org admins create skills for one Factory (#30647) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Factory could edit the skills an app already ships (#29042), but it couldn't create new ones. Settings › Skills now has a **New skill** button. An org admin enters a name, description and instructions, and the skill belongs to that one Factory. No redeploy is needed. Agents load it from their next session, and a board phase can run it as `runner.skill`. Created skills show a **Custom** badge and can be edited or deleted from the same dialog. What changed: - **Storage:** - `factory_skill_overrides` gets an additive `kind` column (`edit` | `created`). It defaults to `edit`, so existing rows keep working. I checked that an existing Postgres table upgrades in place. - `create()` and `updateCreated()` run under the existing revision-row lock. A second create of a name returns null, and so does a save that lands after a delete, so a late save doesn't bring the skill back. - **Sessions:** - Created skills come from the snapshot each workspace already loads for edits, so there is no new query on the session path. - `FactorySkillSource` serves a created skill when no code, folder or built-in skill has a `SKILL.md` under that name. It also reserves the name, so a repository skill with the same name stays hidden. - A folder or file the app left behind under the name doesn't hide a created skill. - Edits whose original skill was removed stay hidden, as before. - **API:** - `POST /web/factory/projects/:id/skills` with `{ name, content }` creates a skill. It returns 409 `skill_exists` when an app skill or another created skill already uses the name. - `PUT /web/factory/projects/:id/skills/:name` updates a created skill, and `DELETE` on the same path deletes one, returning `{ skill: null }`. - Responses are built from the row that was written, not from a reread. - Admins only. New audit actions: `factory.skill.created` and `factory.skill.deleted`. - **Boards:** - Board validation and board problems count the project's created skills, so a phase can run one. - The board cache rechecks when the project's skill revision moves. If the names can't be read, the boards still load, flag the skill as missing, and aren't cached. - A board *write* that can't read the names fails with the storage error instead of `unknown_skill`. - `upsertBoard()` checks each project listed in `projects`. A board for `'all'` projects may only run app skills. - **CLI:** new `mastra api factory skill create`. Route metadata is regenerated. - **UI:** - New skill dialog, which reuses `SkillSimpleForm` with an editable name and checks the name format client-side. The name is quoted in the SKILL.md it writes, so names like `123` work. - **Custom** badge on the Skills page and the phase page. - **Delete** with an inline confirmation. If an app later ships a skill with the same name, the app's skill takes over the name and the Factory's text becomes an edit of it. It keeps applying, the editor shows "original changed", and **Revert to original** switches to the app's skill. Nothing is lost. One review suggestion is deliberately not applied. CodeRabbit suggested wiring the board cache's skill reader even when the `skill-overrides` domain isn't ready at boot. Sessions get skill edits under the same boot-time readiness check (`factory.ts`, where the workspace factory is built). Changing only boards would let a board accept a skill that sessions can't load, so both keep that check. ⚠️ **Before release:** `factory.skill.created` and `factory.skill.deleted` must be registered in the WorkOS dashboard (Audit Logs → Events), like the edit actions were. ## Related issue(s) None. Follow-up to #29042 (skill edits) and #28823 (custom board skills). ## Type of change - [ ] Bug fix (non-breaking change that fixes an issue) - [x] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Test update ## Test plan All new tests use real storage and real routes, with no mocked storage. I checked that each fix's test fails without that fix. - **Storage (LibSQL and Postgres):** - create once per name, including under concurrency - `updateCreated` refuses after a delete, and never touches edits - an orphaned edit gives way to a created skill - an existing table upgrades in place - **Routes:** - create, update and delete, each with its audit event - 409 for app-skill and duplicate names - 400 for an invalid SKILL.md or name - 403 for non-admins, and 404 for another org's project - an all-digit name works - responses stay correct when another admin deletes the skill mid-request - a created skill becomes an edit once the app ships the same name - **Sessions:** - the creating project's sessions load the skill, and another project's don't - a delete reaches new and reused workspaces - a repository skill with the same name is hidden - a leftover folder or stray file doesn't hide the created skill - **Boards and `upsertBoard()`:** - a phase running a created skill is accepted, and flagged missing after a delete - a names read that fails once recovers on the next load - a write fails with the storage error - named projects are each checked, and `'all'` stays app-only - **UI (MSW):** - create sends the expected SKILL.md (quoted name) and shows **Custom** - an invalid name keeps Create disabled, and a 409 message shows in the dialog - non-admins get no button - delete asks for confirmation - **Results:** - `@mastra/factory`: `check` and `lint` pass, and 32 focused test files (920 tests) pass. - `factory-ui`: `typecheck`, `test:unit` and the skills and board-config MSW tests pass. - CLI descriptor test passes. - Not tried in a running Factory in a browser yet. ## Checklist - [ ] 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VhgyDSnuLvveDjDQduz1fT ELI5: Organization admins can now create a new skill for one Factory project without a new app release. Sessions and board phases can then use that skill. Admins can also edit or delete it. ## Overview This change adds Factory-scoped skills. Admins create them in the UI or the CLI. A created skill belongs to one Factory project. Admins can edit and delete it. The skill works in sessions, board phases, and board validation. ## Storage - `SkillOverridesStorage` adds a `kind` field to each record. Valid values are `edit` and `created`. The database default is `edit`. - `upsert` accepts an optional `kind`. The default is `edit`. - The new `create` method stores a created skill with an empty `baseHash`. If a created skill with the same name exists, `create` returns `null` and does not change the revision. Otherwise, it replaces any existing row and increments the project revision in one transaction. - `updateCreated` saves changes only to an existing created skill. Otherwise, it returns `null`. - The audit `skill` action list adds `created` and `deleted`. ## Catalog and sessions - `FactorySkillInfo.origin` adds the value `project`. It adds optional `created` metadata with `updatedBy` and `updatedAt`. - `listFactorySkills` includes created overrides whose names do not match an original skill. It sorts the combined list by name. - A name that matches an original skill appears as an edit to that original skill. - The new `projectSkillNamesOf` adapter returns the storage revision and the created-skill names for a board scope. - `workspace.ts` adds an optional `created` flag to `FactorySkillOverride`. Created skills appear as directories that contain `SKILL.md`. Created skill names are excluded from repository skills. ## Boards - `ProjectBoardCache` accepts a `projectSkills` provider. It stores the skill revision with each board check. It rechecks board skill problems when the revision changes. - If reading project skill names fails, the cache logs one warning per project. It compiles with an empty set. It records an unreadable revision so the next load retries. - `findBoardSkillProblems` accepts a `projectSkills` set. A runner skill that matches a project skill name counts as found. - `BoardWrites.validate` accepts an optional `projectSkills` set. Board create, replace, and validate paths pass it. - `MastraFactory.upsertBoard` checks each named project against that project's skill names. A board for `'all'` projects can use only app skills. - `factory.ts` supplies the resolver only when the `skill-overrides` storage domain is ready. ## API - The new `skillCreate` route is `POST /web/factory/projects/:id/skills`. Its body schema checks the name and content. - The create handler returns `409` when the name matches an original skill or when storage reports a conflict. Otherwise, it returns `201` with the catalog entry. - Edit works for a skill that has an original or an existing override of kind `created`. - Revert of a created skill deletes it, audits `factory.skill.deleted`, and returns `skill: null`. ## CLI - `mastra api factory skill create` uses the `skillCreate` route and requires JSON input. - The `update` and `revert` descriptions now cover project-created skills. ## Factory UI - `FactorySkillsSection` shows a **New skill** button when `factoryId` is set and `canEdit` is true. It shows a **Custom** badge for `project`-origin skills. `PhaseConfig` shows the same badge. - `FactorySkillEditorDialog` supports create and edit. Its `skill` prop is optional. Names allow lowercase letters and digits separated by single hyphens, up to 64 characters. The description must be nonempty after trimming. - For project-origin skills, the dialog offers delete with confirmation. Confirming calls the edit mutation with `content: null`. - `useFactorySkillCreateMutation` is added. The edit and create mutations invalidate the skills and board catalog queries. ## Notes - If an app later ships a skill with the same name, the app skill takes over the name. The Factory text remains as an edit. Reverting it removes the Factory text. - `factory.skill.created` and `factory.skill.deleted` must be registered in WorkOS before release. The PR objectives state this requirement. The diff does not verify it. ## Test coverage - Storage tests cover create, the duplicate case, kind preservation on upsert, replacement of an edit, and six concurrent creates that yield one result. - Route tests cover creation and audit records, edit and delete of created skills, conflicts, invalid content, permission checks, and app-skill takeover. - Workspace tests cover session visibility, reuse, other projects, and deletion. - Board tests cover unknown-skill refusal and recovery after creation or deletion. - UI MSW tests cover creation, invalid names, duplicate-name errors, admin-only access, and confirmed deletion. - The PR author reports these results. This review did not verify them against the current head: - `@mastra/factory` `check` and `lint` pass. - Focused suites pass across 32 files and 911 tests. - `factory-ui` `typecheck` and `test:unit` pass (776 tests). - The CLI descriptor test passes. ## Review metrics - Files changed: 28. Lines added: 1447. Lines removed: 163. - Review findings: not available. --------- Co-authored-by: Claude --- .changeset/clever-carpets-enter.md | 25 ++ .changeset/vast-parks-unite.md | 9 + mastracode/factory-ui/src/api/types.ts | 9 +- .../factory-ui/src/hooks/useFactorySkills.ts | 76 ++++--- .../FactorySkillsSection.msw.test.tsx | 151 ++++++++++++- .../components/FactorySkillsSection.tsx | 17 ++ .../boardConfig/components/PhaseConfig.tsx | 1 + .../components/FactorySkillEditorDialog.tsx | 127 ++++++++--- mastracode/factory/README.md | 15 ++ .../factory/src/boards/board-writes.test.ts | 95 +++++++- mastracode/factory/src/boards/board-writes.ts | 20 +- .../factory/src/boards/project-boards.ts | 89 +++++++- .../src/boards/stored-board-runtime.test.ts | 39 ++++ mastracode/factory/src/factory.ts | 13 +- mastracode/factory/src/routes/boards.ts | 5 +- mastracode/factory/src/routes/contracts.ts | 23 +- mastracode/factory/src/routes/skills.test.ts | 213 +++++++++++++++++- mastracode/factory/src/routes/skills.ts | 104 +++++++-- mastracode/factory/src/skills/app-skills.ts | 9 +- mastracode/factory/src/skills/catalog.ts | 91 ++++++-- .../src/storage/domains/audit/actions.ts | 2 +- .../domains/skill-overrides/base.test.ts | 78 +++++++ .../storage/domains/skill-overrides/base.ts | 67 +++++- mastracode/factory/src/workspace.test.ts | 120 ++++++++++ mastracode/factory/src/workspace.ts | 93 +++++++- .../cli/src/commands/api/descriptors.test.ts | 1 + .../api/factory-route-metadata.generated.ts | 101 ++++++++- packages/cli/src/commands/api/index.ts | 19 +- 28 files changed, 1448 insertions(+), 164 deletions(-) create mode 100644 .changeset/clever-carpets-enter.md create mode 100644 .changeset/vast-parks-unite.md diff --git a/.changeset/clever-carpets-enter.md b/.changeset/clever-carpets-enter.md new file mode 100644 index 00000000000..864bb4a742d --- /dev/null +++ b/.changeset/clever-carpets-enter.md @@ -0,0 +1,25 @@ +--- +'@mastra/factory': minor +--- + +Organization admins can now create skills for one Factory from Settings › Skills, without redeploying. Choose **New skill**, give it a name, description and instructions, and the Factory's sessions can load it from their next start. A phase of the Factory's boards can also run it as `runner.skill`. Created skills show a **Custom** badge and can be edited or deleted from the same page. Creating and deleting are recorded in the audit log as `factory.skill.created` and `factory.skill.deleted`. + +A board phase runs a created skill by its name, like any other skill: + +```ts +await factory.upsertBoard( + { + key: 'notes', + name: 'Release notes', + phases: [ + { key: 'queued', name: 'Queued', kind: 'resting', nextPhases: ['writing'] }, + { key: 'writing', name: 'Writing', kind: 'working', runner: { context: 'writer', skill: 'release-notes' }, nextPhases: ['done'] }, + { key: 'done', name: 'Done', kind: 'terminal' }, + ], + }, + // Each project listed must have created `release-notes`; a board for 'all' projects may only run the app's skills. + { projects: [{ orgId, factoryProjectId }] }, +); +``` + +If the app later ships a skill under the same name, the app's skill takes over the name and the Factory's text becomes an edit of it, which **Revert to original** removes. diff --git a/.changeset/vast-parks-unite.md b/.changeset/vast-parks-unite.md new file mode 100644 index 00000000000..ab1ec12e0d0 --- /dev/null +++ b/.changeset/vast-parks-unite.md @@ -0,0 +1,9 @@ +--- +'mastra': minor +--- + +Added `mastra api factory skill create` to create a skill for one Factory project. `mastra api factory skill update` now also updates a skill the project created, and `mastra api factory skill revert` deletes one. Only organization admins can create skills. + +```sh +mastra api factory skill create '{"name":"release-notes","content":"---\nname: release-notes\ndescription: Write release notes for a merged change\n---\n\n# Release notes\n"}' +``` diff --git a/mastracode/factory-ui/src/api/types.ts b/mastracode/factory-ui/src/api/types.ts index 2e67ee10840..8a539ac17ca 100644 --- a/mastracode/factory-ui/src/api/types.ts +++ b/mastracode/factory-ui/src/api/types.ts @@ -157,8 +157,11 @@ export interface FactorySkillInfo { description: string; /** SKILL.md body with the frontmatter removed. */ content: string; - /** Shipped with Factory, the app's `factory-skills/` folder, or `MastraFactory({ skills })`. Absent from older servers. */ - origin?: 'bundled' | 'folder' | 'code'; + /** + * Shipped with Factory, the app's `factory-skills/` folder, `MastraFactory({ skills })`, or `project` for a skill + * this Factory created. Absent from older servers. + */ + origin?: 'bundled' | 'folder' | 'code' | 'project'; /** True for a skill Factory ships, including when the app overrides it. Absent from older servers. */ builtIn?: boolean; /** Set when the SKILL.md fails runtime parsing/validation; the agent will not be able to load the skill. */ @@ -169,6 +172,8 @@ export interface FactorySkillInfo { edited?: { updatedBy: string; updatedAt: string }; /** True when the original SKILL.md changed since the project's edit was made. */ originalChanged?: boolean; + /** Set for a skill this Factory created (`origin: 'project'`): who saved it last, and when. */ + created?: { updatedBy: string; updatedAt: string }; } export interface FactorySkillsResponse { diff --git a/mastracode/factory-ui/src/hooks/useFactorySkills.ts b/mastracode/factory-ui/src/hooks/useFactorySkills.ts index f342dbf738c..769da4bfd18 100644 --- a/mastracode/factory-ui/src/hooks/useFactorySkills.ts +++ b/mastracode/factory-ui/src/hooks/useFactorySkills.ts @@ -19,42 +19,66 @@ export function useFactorySkillsQuery(factoryProjectId?: string) { }); } -async function sendSkillEdit( +/** Sends one write to a project's skills and returns the skill it leaves, or null when it deleted the skill. */ +async function sendSkillWrite( baseUrl: string, - factoryProjectId: string, - name: string, - init: { method: 'PUT'; content: string } | { method: 'DELETE' }, -): Promise { - const res = await fetch( - `${baseUrl}/web/factory/projects/${encodeURIComponent(factoryProjectId)}/skills/${encodeURIComponent(name)}`, - { - method: init.method, - credentials: 'include', - headers: { 'content-type': 'application/json', Accept: 'application/json' }, - ...(init.method === 'PUT' ? { body: JSON.stringify({ content: init.content }) } : {}), - }, - ); - const body = (await res.json().catch(() => undefined)) as - | { skill?: FactorySkillInfo; message?: string; error?: string } + path: string, + method: 'POST' | 'PUT' | 'DELETE', + body?: Record, +): Promise { + const res = await fetch(`${baseUrl}${path}`, { + method, + credentials: 'include', + headers: { 'content-type': 'application/json', Accept: 'application/json' }, + ...(body ? { body: JSON.stringify(body) } : {}), + }); + const json = (await res.json().catch(() => undefined)) as + | { skill?: FactorySkillInfo | null; message?: string; error?: string } | undefined; - if (!res.ok || !body?.skill) { - throw new Error(body?.message ?? body?.error ?? `Request failed (${res.status})`); + if (!res.ok || !json || json.skill === undefined) { + throw new Error(json?.message ?? json?.error ?? `Request failed (${res.status})`); } - return body.skill; + return json.skill; } -/** Save (`content`) or revert (`content: null`) a project's edit of one skill. */ +const skillsPath = (factoryProjectId: string) => `/web/factory/projects/${encodeURIComponent(factoryProjectId)}/skills`; + +/** Refreshes the skills, and the boards, whose phases flag a skill that is missing. */ +function useInvalidateSkills(factoryProjectId: string | undefined) { + const queryClient = useQueryClient(); + return () => + Promise.all([ + queryClient.invalidateQueries({ queryKey: queryKeys.factorySkills(factoryProjectId) }), + queryClient.invalidateQueries({ queryKey: queryKeys.boardCatalog(factoryProjectId) }), + ]); +} + +/** + * Save (`content`) or revert (`content: null`) a project's edit of one skill. For a skill the project created, + * saving updates it and `content: null` deletes it. + */ export function useFactorySkillEditMutation(factoryProjectId: string | undefined) { const { baseUrl } = useApiConfig(); - const queryClient = useQueryClient(); + const invalidate = useInvalidateSkills(factoryProjectId); return useMutation({ mutationFn: ({ name, content }: { name: string; content: string | null }) => - sendSkillEdit( + sendSkillWrite( baseUrl, - factoryProjectId!, - name, - content === null ? { method: 'DELETE' } : { method: 'PUT', content }, + `${skillsPath(factoryProjectId!)}/${encodeURIComponent(name)}`, + content === null ? 'DELETE' : 'PUT', + content === null ? undefined : { content }, ), - onSuccess: () => queryClient.invalidateQueries({ queryKey: queryKeys.factorySkills(factoryProjectId) }), + onSuccess: invalidate, + }); +} + +/** Creates a skill for one Factory project. Mirrors `POST /web/factory/projects/:id/skills`. */ +export function useFactorySkillCreateMutation(factoryProjectId: string | undefined) { + const { baseUrl } = useApiConfig(); + const invalidate = useInvalidateSkills(factoryProjectId); + return useMutation({ + mutationFn: ({ name, content }: { name: string; content: string }) => + sendSkillWrite(baseUrl, skillsPath(factoryProjectId!), 'POST', { name, content }), + onSuccess: invalidate, }); } diff --git a/mastracode/factory-ui/src/ui/domains/boardConfig/__tests__/FactorySkillsSection.msw.test.tsx b/mastracode/factory-ui/src/ui/domains/boardConfig/__tests__/FactorySkillsSection.msw.test.tsx index 3b4431ccfb6..55c8a17905c 100644 --- a/mastracode/factory-ui/src/ui/domains/boardConfig/__tests__/FactorySkillsSection.msw.test.tsx +++ b/mastracode/factory-ui/src/ui/domains/boardConfig/__tests__/FactorySkillsSection.msw.test.tsx @@ -5,13 +5,14 @@ import { describe, expect, it } from 'vitest'; import { builtinBoardCatalog } from '../../../../../e2e/ui/board-catalog'; import { server } from '../../../../../e2e/ui/msw-server'; -import { TEST_BASE_URL, renderWithProviders } from '../../../../../e2e/ui/render'; +import { TEST_BASE_URL, renderWithProviders, waitForMutationsIdle } from '../../../../../e2e/ui/render'; import type { BoardCatalogResponse, FactorySkillInfo, FactorySkillsResponse } from '../../../../api/types'; import { FactorySkillsSection } from '../components/FactorySkillsSection'; const SKILLS_URL = `${TEST_BASE_URL}/web/factory/skills`; const BOARDS_URL = `${TEST_BASE_URL}/web/factory/projects/fp-1/boards`; const SKILL_URL = `${TEST_BASE_URL}/web/factory/projects/fp-1/skills/:name`; +const CREATE_URL = `${TEST_BASE_URL}/web/factory/projects/fp-1/skills`; const bundled = { origin: 'bundled', builtIn: true } as const; @@ -49,7 +50,7 @@ function serve({ const { content } = (await request.json()) as { content: string }; const name = String(params.name); writes.push({ method: 'PUT', name, content }); - if (!content.includes(`name: ${name}\n`)) { + if (!content.includes(`name: ${JSON.stringify(name)}\n`)) { return HttpResponse.json({ error: 'invalid_skill', message: 'name must match' }, { status: 400 }); } const description = JSON.parse(/^description: (.*)$/m.exec(content)![1]) as string; @@ -67,9 +68,34 @@ function serve({ ); return HttpResponse.json({ skill: current.find(skill => skill.name === name) }); }), + http.post(CREATE_URL, async ({ request }) => { + const { name, content } = (await request.json()) as { name: string; content: string }; + writes.push({ method: 'POST', name, content }); + if (current.some(skill => skill.name === name)) { + return HttpResponse.json( + { error: 'skill_exists', message: `A skill named "${name}" already exists. Edit it instead.` }, + { status: 409 }, + ); + } + const description = JSON.parse(/^description: (.*)$/m.exec(content)![1]) as string; + const created: FactorySkillInfo = { + name, + description, + content: content.slice(content.indexOf('\n---\n') + 5).trim(), + origin: 'project', + builtIn: false, + created: { updatedBy: 'admin-1', updatedAt: '2026-11-17T00:00:00.000Z' }, + }; + current = [...current, created]; + return HttpResponse.json({ skill: created }, { status: 201 }); + }), http.delete(SKILL_URL, ({ params }) => { const name = String(params.name); writes.push({ method: 'DELETE', name }); + if (current.find(skill => skill.name === name)?.origin === 'project') { + current = current.filter(skill => skill.name !== name); + return HttpResponse.json({ skill: null }); + } const original = catalog.find(skill => skill.name === name)!; current = current.map(skill => skill.name === name ? { ...original, edited: undefined, originalChanged: undefined } : skill, @@ -219,7 +245,7 @@ describe('FactorySkillsSection', () => { { method: 'PUT', name: 'changelog-lint', - content: '---\nname: changelog-lint\ndescription: "Our lint: check # first"\n---\n\n# Lint\n', + content: '---\nname: "changelog-lint"\ndescription: "Our lint: check # first"\n---\n\n# Lint\n', }, ]); expect(await within(card('changelog-lint')).findByText('Edited')).toBeInTheDocument(); @@ -357,6 +383,125 @@ describe('FactorySkillsSection', () => { }); }); + describe('creating a skill', () => { + it('creates a skill for this Factory and lists it as custom', async () => { + const { writes } = serve(); + const user = userEvent.setup(); + const { client } = renderSection(); + + await user.click(await screen.findByRole('button', { name: 'New skill' })); + const dialog = await screen.findByRole('dialog', { name: 'New skill' }); + const create = within(dialog).getByRole('button', { name: 'Create' }); + expect(create).toBeDisabled(); + await user.type(within(dialog).getByRole('textbox', { name: 'Name' }), 'release-notes'); + expect(create).toBeDisabled(); + await user.type(within(dialog).getByRole('textbox', { name: 'Description' }), 'Write notes: what # changed'); + await user.click(create); + + await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument()); + expect(writes).toEqual([ + { + method: 'POST', + name: 'release-notes', + content: '---\nname: "release-notes"\ndescription: "Write notes: what # changed"\n---\n\n\n', + }, + ]); + const created = await screen.findByRole('button', { name: /^release-notes/ }); + expect(within(created).getByText('Custom')).toBeInTheDocument(); + expect(within(card('changelog-lint')).queryByText('Custom')).not.toBeInTheDocument(); + await waitForMutationsIdle(client); + }); + + it('keeps an all-digit name a string in the SKILL.md it sends', async () => { + const { writes } = serve(); + const user = userEvent.setup(); + const { client } = renderSection(); + + await user.click(await screen.findByRole('button', { name: 'New skill' })); + const dialog = await screen.findByRole('dialog', { name: 'New skill' }); + await user.type(within(dialog).getByRole('textbox', { name: 'Name' }), '123'); + await user.type(within(dialog).getByRole('textbox', { name: 'Description' }), 'Numbered'); + await user.click(within(dialog).getByRole('button', { name: 'Create' })); + + await waitFor(() => expect(writes).toHaveLength(1)); + expect(writes[0]).toMatchObject({ method: 'POST', name: '123' }); + expect(writes[0].content).toMatch(/^---\nname: "123"\n/); + await waitForMutationsIdle(client); + }); + + it('explains a name agents cannot use and keeps Create disabled', async () => { + const { writes } = serve(); + const user = userEvent.setup(); + renderSection(); + + await user.click(await screen.findByRole('button', { name: 'New skill' })); + const dialog = await screen.findByRole('dialog', { name: 'New skill' }); + await user.type(within(dialog).getByRole('textbox', { name: 'Name' }), 'Release_Notes'); + await user.type(within(dialog).getByRole('textbox', { name: 'Description' }), 'Write release notes'); + + expect(within(dialog).getByText(/lowercase letters, digits, and single hyphens/)).toBeInTheDocument(); + expect(within(dialog).getByRole('button', { name: 'Create' })).toBeDisabled(); + expect(writes).toEqual([]); + }); + + it('shows why the server refused it and keeps the editor open', async () => { + serve(); + const user = userEvent.setup(); + const { client } = renderSection(); + + await user.click(await screen.findByRole('button', { name: 'New skill' })); + const dialog = await screen.findByRole('dialog', { name: 'New skill' }); + await user.type(within(dialog).getByRole('textbox', { name: 'Name' }), 'changelog-lint'); + await user.type(within(dialog).getByRole('textbox', { name: 'Description' }), 'Mine'); + await user.click(within(dialog).getByRole('button', { name: 'Create' })); + + expect(await within(dialog).findByRole('alert')).toHaveTextContent( + 'A skill named "changelog-lint" already exists. Edit it instead.', + ); + expect(screen.getByRole('dialog', { name: 'New skill' })).toBeInTheDocument(); + await waitForMutationsIdle(client); + }); + + it('offers no New skill to members who are not admins', async () => { + serve({ canEdit: false }); + renderSection(); + + expect(await screen.findByRole('button', { name: 'View configure-factory-rules' })).toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'New skill' })).not.toBeInTheDocument(); + }); + }); + + it('deletes a skill this Factory created once confirmed, and offers no revert for it', async () => { + const releaseNotes: FactorySkillInfo = { + name: 'release-notes', + description: 'Write release notes', + content: '# Notes', + origin: 'project', + builtIn: false, + created: { updatedBy: 'admin-1', updatedAt: '2026-11-17T00:00:00.000Z' }, + }; + const { writes } = serve({ catalog: [...skills, releaseNotes] }); + const user = userEvent.setup(); + const { client } = renderSection(); + + await user.click(await screen.findByRole('button', { name: 'Edit release-notes' })); + const dialog = await screen.findByRole('dialog', { name: 'Edit skill' }); + expect(within(dialog).queryByRole('button', { name: 'Revert to original' })).not.toBeInTheDocument(); + await user.click(within(dialog).getByRole('button', { name: 'Delete' })); + expect(within(dialog).getByText(/Delete release-notes\?/)).toBeInTheDocument(); + expect(writes).toEqual([]); + + // Keep backs out without deleting. + await user.click(within(dialog).getByRole('button', { name: 'Keep' })); + await user.click(within(dialog).getByRole('button', { name: 'Delete' })); + await user.click(within(dialog).getByRole('button', { name: 'Delete skill' })); + + await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument()); + expect(writes).toEqual([{ method: 'DELETE', name: 'release-notes' }]); + await waitFor(() => expect(screen.queryByRole('button', { name: /^release-notes/ })).not.toBeInTheDocument()); + await waitForMutationsIdle(client); + }); + it('surfaces a load failure from the server', async () => { serve(); server.use(http.get(SKILLS_URL, () => HttpResponse.json({ error: 'boom' }, { status: 500 }))); diff --git a/mastracode/factory-ui/src/ui/domains/boardConfig/components/FactorySkillsSection.tsx b/mastracode/factory-ui/src/ui/domains/boardConfig/components/FactorySkillsSection.tsx index 377b31ae655..c3ca6dc5fb0 100644 --- a/mastracode/factory-ui/src/ui/domains/boardConfig/components/FactorySkillsSection.tsx +++ b/mastracode/factory-ui/src/ui/domains/boardConfig/components/FactorySkillsSection.tsx @@ -17,6 +17,7 @@ import { FactorySkillEditorDialog } from '../../settings/components/FactorySkill import { IconFileText } from '@mastra/playground-ui/icons/central/IconFileText'; import { IconPencil } from '@mastra/playground-ui/icons/central/IconPencil'; import { IconCodeBrackets } from '@mastra/playground-ui/icons/central/IconCodeBrackets'; +import { IconPlusMedium } from '@mastra/playground-ui/icons/central/IconPlusMedium'; /** Skills some board's settings already show: the ones its phases run. None while the boards are unknown. */ function boardSkillNames(boards: InstalledBoardInfo[] | undefined): Set { @@ -67,6 +68,7 @@ function SkillCard({ skill, factoryId, canEdit }: { skill: FactorySkillInfo; fac {skill.builtIn && skill.origin !== undefined && skill.origin !== 'bundled' && ( Overridden by app )} + {skill.origin === 'project' && Custom} {skill.edited && Edited} {skill.error ? ( @@ -106,6 +108,20 @@ function SkillCard({ skill, factoryId, canEdit }: { skill: FactorySkillInfo; fac ); } +/** Opens the editor on a new skill; admins of an open Factory only. */ +function NewSkillButton({ factoryId }: { factoryId: string }) { + const [creating, setCreating] = useState(false); + + return ( +
+ + {creating && setCreating(false)} />} +
+ ); +} + /** * The skills no board phase runs. A skill a phase runs lives on that phase's page, so it isn't listed twice. */ @@ -120,6 +136,7 @@ export function FactorySkillsSection({ factoryId }: { factoryId?: string }) { return (
+ {factoryId !== undefined && canEdit && } {loading && ( Loading skills… diff --git a/mastracode/factory-ui/src/ui/domains/boardConfig/components/PhaseConfig.tsx b/mastracode/factory-ui/src/ui/domains/boardConfig/components/PhaseConfig.tsx index f9076fe2a9f..af4aaf5544a 100644 --- a/mastracode/factory-ui/src/ui/domains/boardConfig/components/PhaseConfig.tsx +++ b/mastracode/factory-ui/src/ui/domains/boardConfig/components/PhaseConfig.tsx @@ -59,6 +59,7 @@ function SkillBadges({ skill, missing }: { skill?: FactorySkillInfo; missing: bo {missing && Not found} {skill?.error && Failed to load} {skill?.builtIn && skill.origin !== undefined && skill.origin !== 'bundled' && Overridden by app} + {skill?.origin === 'project' && Custom} {skill?.edited && Edited} ); diff --git a/mastracode/factory-ui/src/ui/domains/settings/components/FactorySkillEditorDialog.tsx b/mastracode/factory-ui/src/ui/domains/settings/components/FactorySkillEditorDialog.tsx index 24f7de88238..37e049e425b 100644 --- a/mastracode/factory-ui/src/ui/domains/settings/components/FactorySkillEditorDialog.tsx +++ b/mastracode/factory-ui/src/ui/domains/settings/components/FactorySkillEditorDialog.tsx @@ -14,20 +14,31 @@ import { SkillSimpleForm } from '@mastra/playground-ui/domains/skills/skill-simp import { useState } from 'react'; import type { FactorySkillInfo } from '../../../../api/types'; -import { useFactorySkillEditMutation } from '../../../../hooks/useFactorySkills'; +import { useFactorySkillCreateMutation, useFactorySkillEditMutation } from '../../../../hooks/useFactorySkills'; interface FactorySkillEditorDialogProps { - skill: FactorySkillInfo; + /** The skill to open; without one the dialog creates a new skill. */ + skill?: FactorySkillInfo; /** The Factory project whose copy of the skill is edited; without one the skill is view-only. */ factoryId?: string; canEdit: boolean; onClose: () => void; } +/** The names the server accepts: what agents call the skill by, and its folder name. */ +const SKILL_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/; +const MAX_SKILL_NAME_LENGTH = 64; + +function nameProblem(name: string): string | undefined { + if (name === '' || (SKILL_NAME_RE.test(name) && name.length <= MAX_SKILL_NAME_LENGTH)) return undefined; + return 'Use up to 64 lowercase letters, digits, and single hyphens, such as release-notes.'; +} + /** * Writes the editor's fields back as a SKILL.md. Values are JSON-quoted, which - * YAML reads as the same strings, so descriptions with `:` or `#` stay intact, - * and frontmatter fields the editor does not show are kept. + * YAML reads as the same strings, so descriptions with `:` or `#` stay intact + * and a name such as `123` stays a string, and frontmatter fields the editor + * does not show are kept. */ export function composeSkillMarkdown({ name, @@ -41,7 +52,7 @@ export function composeSkillMarkdown({ instructions: string; }): string { const fields = [ - `name: ${name}`, + `name: ${JSON.stringify(name)}`, `description: ${JSON.stringify(description)}`, ...Object.entries(frontmatter ?? {}).map(([key, value]) => `${key}: ${JSON.stringify(value)}`), ]; @@ -54,77 +65,119 @@ function viewOnlyReason(factoryId: string | undefined, canEdit: boolean): string return undefined; } +function dialogTitle(creating: boolean, readOnly: boolean): string { + if (creating) return 'New skill'; + return readOnly ? 'View skill' : 'Edit skill'; +} + /** - * Opens a Factory skill in the shared skill editor. Admins save the edit for - * this Factory project or revert it to the original; everyone else views it. + * Opens a Factory skill in the shared skill editor, or creates one. Admins save an edit for this Factory + * project, revert it to the original, or delete a skill this Factory created; everyone else views it. */ export function FactorySkillEditorDialog({ skill, factoryId, canEdit, onClose }: FactorySkillEditorDialogProps) { - const [description, setDescription] = useState(skill.description); - const [instructions, setInstructions] = useState(skill.content); + const creating = skill === undefined; + const [name, setName] = useState(skill?.name ?? ''); + const [description, setDescription] = useState(skill?.description ?? ''); + const [instructions, setInstructions] = useState(skill?.content ?? ''); + const [confirmingDelete, setConfirmingDelete] = useState(false); const edit = useFactorySkillEditMutation(factoryId); + const create = useFactorySkillCreateMutation(factoryId); + const pending = edit.isPending || create.isPending; + const error = create.error ?? edit.error; const readOnlyReason = viewOnlyReason(factoryId, canEdit); - const changed = description !== skill.description || instructions !== skill.content; + const createdHere = skill?.origin === 'project'; + const changed = description !== (skill?.description ?? '') || instructions !== (skill?.content ?? ''); + const invalidName = creating ? nameProblem(name) : undefined; + const canCreate = name !== '' && !invalidName && description.trim() !== ''; + const markdown = () => composeSkillMarkdown({ name, description, frontmatter: skill?.frontmatter, instructions }); - const save = () => - edit.mutate( - { - name: skill.name, - content: composeSkillMarkdown({ name: skill.name, description, frontmatter: skill.frontmatter, instructions }), - }, - { onSuccess: onClose }, - ); - const revert = () => edit.mutate({ name: skill.name, content: null }, { onSuccess: onClose }); + const save = () => edit.mutate({ name, content: markdown() }, { onSuccess: onClose }); + const submitCreate = () => create.mutate({ name, content: markdown() }, { onSuccess: onClose }); + const revert = () => edit.mutate({ name, content: null }, { onSuccess: onClose }); return ( !open && onClose()}> - {readOnlyReason ? 'View skill' : 'Edit skill'} + {dialogTitle(creating, readOnlyReason !== undefined)} {readOnlyReason ?? - 'Changes apply to this Factory only. Agents pick them up from their next session; running sessions keep the version they started with.'} + (creating + ? 'The skill belongs to this Factory only. Agents can load it from their next session, and a board phase can run it.' + : 'Changes apply to this Factory only. Agents pick them up from their next session; running sessions keep the version they started with.')}
- {skill.edited && skill.originalChanged && ( + {skill?.edited && skill.originalChanged && ( The original changed since this was edited. Revert to use the new original. )} {}} - nameReadOnly + name={name} + onNameChange={value => setName(value.trim())} + nameReadOnly={!creating} description={description} onDescriptionChange={setDescription} instructions={instructions} onInstructionsChange={setInstructions} readOnly={readOnlyReason !== undefined} /> + {invalidName && ( + + {invalidName} + + )}
- {edit.error && ( + {error && ( - {edit.error.message} + {error.message} )} - {readOnlyReason ? 'Close' : 'Cancel'} - {!readOnlyReason && skill.edited && ( - - )} - {!readOnlyReason && ( - + {confirmingDelete ? ( + <> + + Delete {name}? Cards entering a phase that runs it won't start until the phase gets another skill. + + + + + ) : ( + <> + {readOnlyReason ? 'Close' : 'Cancel'} + {!readOnlyReason && skill?.edited && ( + + )} + {!readOnlyReason && createdHere && ( + + )} + {!readOnlyReason && creating && ( + + )} + {!readOnlyReason && !creating && ( + + )} + )}
diff --git a/mastracode/factory/README.md b/mastracode/factory/README.md index 58cb2cef3b1..d192f6ceaad 100644 --- a/mastracode/factory/README.md +++ b/mastracode/factory/README.md @@ -772,6 +772,7 @@ A phase's `runner.skill` runs a skill when a card enters the phase. Use a built- 1. **Code skills** — passed to `new MastraFactory({ skills })`, created with `createSkill()` from `@mastra/core/skills`. 2. **Folder skills** — `src/mastra/factory-skills//SKILL.md` in your app. `mastra build` copies the folder into the build output. The older `src/mastra/public/factory-skills` still works; when both exist, `src/mastra/factory-skills` wins. Factory also looks in `public/factory-skills`, `factory-skills` and `output/factory-skills` under the working directory, and uses the first that exists. Supporting files, such as `references/`, can sit next to `SKILL.md`. 3. **Built-in skills** shipped with `@mastra/factory`. +4. **Factory skills** — skills an organization admin created for one Factory in Settings › Skills (see [Create skills for one Factory](#create-skills-for-one-factory)). They only fill names the first three don't use. A skill with the same name as a built-in skill replaces it, for the built-in boards too. A code skill replaces the whole folder skill of the same name, including its supporting files. Repository skills in a project's own repository never replace these. @@ -834,6 +835,20 @@ An edited skill shows an **Edited** badge. When the original changes after the e Saves and reverts are recorded in the audit log as `factory.skill.updated` and `factory.skill.reverted`. The API is `PUT` and `DELETE` on `/web/factory/projects/:id/skills/:name`, and `GET /web/factory/skills?projectId=` lists a Factory's skills with its edits. +### Create skills for one Factory + +Organization admins can also add a skill to one Factory without changing the app. Open Settings › Skills, choose **New skill**, enter a name, a description and instructions, and choose **Create**. The name uses 1–64 lowercase letters, digits and single hyphens, such as `release-notes`, and can't be one an app or built-in skill already uses; edit that skill instead. + +A created skill belongs to that Factory only and shows a **Custom** badge. Its sessions can load it from their next start, like any other skill, and a phase of its boards can run it as `runner.skill`. `factory.upsertBoard()` accepts a board that runs a created skill only when `projects` lists the projects, and each of them must have created it; a board for `'all'` projects may only run the app's skills. Choose **Edit** to change it, and **Delete** to remove it; a phase that runs a deleted skill shows it as missing, and cards entering that phase fail to start until you pick another skill. A repository skill with the same name is hidden in that Factory's sessions, as it is for app skills. + +If your app later ships a skill under the same name, the app's skill takes over the name and the Factory's text becomes an edit of it: it keeps applying, the editor notes that the original changed, and **Revert to original** switches to the app's skill. + +Creating and deleting are recorded in the audit log as `factory.skill.created` and `factory.skill.deleted`; changes to a created skill as `factory.skill.updated`. The API is `POST /web/factory/projects/:id/skills` with `{ "name", "content" }`, where `content` is the full `SKILL.md` whose frontmatter `name` matches; `PUT` and `DELETE` on `/web/factory/projects/:id/skills/:name` update and delete it. `GET /web/factory/skills?projectId=` lists created skills with `origin: "project"`. From the CLI: + +```bash +mastra api factory skill create '{"name":"release-notes","content":"---\nname: release-notes\ndescription: Write release notes for a merged change\n---\n\n# Release notes\n"}' +``` + ### Execute a custom board Custom boards can create linked items, start working roles, transition through bound tools, and react to completed tool results. Board and phase identifiers contain 1–128 letters, digits, underscores, or hyphens and start with a letter or digit. Identifiers are case-sensitive and cannot contain surrounding whitespace. diff --git a/mastracode/factory/src/boards/board-writes.test.ts b/mastracode/factory/src/boards/board-writes.test.ts index bfab7a8d94c..315a26f4304 100644 --- a/mastracode/factory/src/boards/board-writes.test.ts +++ b/mastracode/factory/src/boards/board-writes.test.ts @@ -5,12 +5,14 @@ import { join } from 'node:path'; import { LibSQLFactoryStorage } from '@mastra/libsql'; import { PgFactoryStorage } from '@mastra/pg'; -import { describe, expect, it, onTestFinished } from 'vitest'; +import { describe, expect, it, onTestFinished, vi } from 'vitest'; +import { projectSkillNamesOf } from '../skills/catalog.js'; import type { EmitAuditInput } from '../storage/domains/audit/domain.js'; import { StoredBoardsStorage } from '../storage/domains/boards/base.js'; import type { StoredPhaseInput } from '../storage/domains/boards/base.js'; import { FactoryProjectsStorage } from '../storage/domains/projects/base.js'; +import { SkillOverridesStorage } from '../storage/domains/skill-overrides/base.js'; import { WorkItemsStorage } from '../storage/domains/work-items/base.js'; import { BoardWriteError, BoardWrites } from './board-writes.js'; import type { BoardWriter } from './board-writes.js'; @@ -57,20 +59,107 @@ describe.each(['libsql', ...(postgresUrl ? ['postgres'] : [])])('board writes on const projects = factoryStorage.registerDomain(new FactoryProjectsStorage()); const workItems = factoryStorage.registerDomain(new WorkItemsStorage()); const storage = factoryStorage.registerDomain(new StoredBoardsStorage()); + const skillOverrides = factoryStorage.registerDomain(new SkillOverridesStorage()); await factoryStorage.init(); onTestFinished(() => factoryStorage.close()); const orgId = `org-${randomUUID()}`; const project = await projects.create({ orgId, userId: 'admin', input: { name: 'Acme' } }); const scope = { orgId, factoryProjectId: project.id }; - const boards = new ProjectBoardCache({ codeRegistry: createBoardRegistry(), storage, projects, warn: () => {} }); + const boards = new ProjectBoardCache({ + codeRegistry: createBoardRegistry(), + storage, + projects, + projectSkills: projectSkillNamesOf(skillOverrides), + recheckMs: 0, + warn: () => {}, + }); const audits: EmitAuditInput[] = []; const writer: BoardWriter = { id: 'admin', audit: async input => void audits.push(input) }; const writes = new BoardWrites({ storage, boards, workItems }); const served = async (key: string) => (await boards.describe(scope)).registry.get(key); - return { storage, workItems, scope, boards, writes, writer, audits, served }; + return { storage, workItems, skillOverrides, scope, boards, writes, writer, audits, served }; } + it("runs a skill the project created, and flags the phase once it's deleted", async () => { + const { writes, writer, scope, boards, skillOverrides } = await setup(); + const notes = { + key: 'notes', + name: 'Release notes', + phases: [ + { key: 'queued', name: 'Queued', kind: 'resting', nextPhases: ['writing'] }, + { + key: 'writing', + name: 'Writing', + kind: 'working', + runner: { context: 'writer', skill: 'release-notes' }, + nextPhases: ['done'], + }, + { key: 'done', name: 'Done', kind: 'terminal' }, + ], + } satisfies { key: string; name: string; phases: StoredPhaseInput[] }; + const skill = { orgId: scope.orgId, projectId: scope.factoryProjectId, skillName: 'release-notes' }; + + expect(await refusal(() => writes.create(scope, notes, writer))).toMatchObject({ + status: 422, + code: 'unknown_skill', + }); + + await skillOverrides.create({ + ...skill, + content: '---\nname: release-notes\ndescription: Write release notes\n---\n\n# Notes\n', + updatedBy: 'admin', + }); + await writes.create(scope, notes, writer); + expect((await boards.describe(scope)).details.get('notes')?.problems).toEqual([]); + + // Another project has no such skill. + const other = { orgId: scope.orgId, factoryProjectId: randomUUID() }; + expect(await boards.projectSkillNames(other)).toEqual(new Set()); + + await skillOverrides.delete(skill); + expect((await boards.describe(scope)).details.get('notes')?.problems).toEqual([ + expect.stringContaining("runs skill 'release-notes', but no such skill exists"), + ]); + }); + + it("fails a write with the storage error, not unknown_skill, when the project's skills can't be read", async () => { + const { writes, writer, scope, skillOverrides, storage } = await setup(); + vi.spyOn(skillOverrides, 'list').mockRejectedValueOnce(new Error('connection reset')); + await expect(writes.create(scope, bugs, writer)).rejects.toThrow('connection reset'); + expect(await storage.get(scope, 'bugs')).toBeNull(); + }); + + it("flags a created skill as missing only while the project's skills can't be read", async () => { + const { writes, writer, scope, boards, skillOverrides } = await setup(); + const project = { orgId: scope.orgId, projectId: scope.factoryProjectId }; + const create = (skillName: string) => + skillOverrides.create({ + ...project, + skillName, + content: `---\nname: ${skillName}\ndescription: A skill\n---\n\n# ${skillName}\n`, + updatedBy: 'admin', + }); + await create('release-notes'); + const runsNotes = { + ...bugs, + phases: bugs.phases.map(phase => + phase.key === 'fixing' ? { ...phase, runner: { context: 'work', skill: 'release-notes' } } : phase, + ), + }; + await writes.create(scope, runsNotes, writer); + const problems = async () => (await boards.describe(scope)).details.get('bugs')?.problems; + expect(await problems()).toEqual([]); + + // Another save moves the revision; the names read after it fails once. + await create('changelog'); + vi.spyOn(skillOverrides, 'list').mockRejectedValueOnce(new Error('connection reset')); + expect(await problems()).toEqual([expect.stringContaining("runs skill 'release-notes', but no such skill exists")]); + + // The revision hasn't moved since, but the next load reads the names again. + expect(await problems()).toEqual([]); + }); + it('creates a board, serves it at once, and records who did it', async () => { const { writes, writer, scope, audits, served } = await setup(); const row = await writes.create(scope, bugs, writer); diff --git a/mastracode/factory/src/boards/board-writes.ts b/mastracode/factory/src/boards/board-writes.ts index 8de8de6ee11..7fb5dbccdc3 100644 --- a/mastracode/factory/src/boards/board-writes.ts +++ b/mastracode/factory/src/boards/board-writes.ts @@ -37,7 +37,10 @@ import { workBoard } from './work.js'; export interface BoardWritesDeps { storage: StoredBoardsStorage; /** The per-project boards: the code boards and their seeds, skills, and the cache to invalidate. */ - boards: Pick; + boards: Pick< + ProjectBoardCache, + 'describe' | 'invalidate' | 'codeRegistry' | 'codeSkills' | 'projectSkillNames' | 'seedFor' + >; /** Read to refuse edits that would strand cards; the retired Review board's cards leave `review` through it. */ workItems: Pick; } @@ -120,10 +123,12 @@ export class BoardWrites { } /** - * Validates a definition the way `defineBoard()` does, plus the skills its runners name. A code - * board's copy is also checked against the code behaviour of its board and phase keys. + * Validates a definition the way `defineBoard()` does, plus the skills its runners name: the app's, + * and `projectSkills`, the skills the project it is stored in created. `null` leaves the runners' + * skills unchecked, for a caller that checks them per project. A code board's copy is also checked + * against the code behaviour of its board and phase keys. */ - validate(input: unknown): StoredBoardInput { + validate(input: unknown, projectSkills?: ReadonlySet | null): StoredBoardInput { const { boards } = this.deps; const parsed = storedBoardInputSchema.safeParse(input); if (!parsed.success) { @@ -137,7 +142,8 @@ export class BoardWrites { } } const board = code ? compileStoredBoard(parsed.data, code) : compileStoredBoard(parsed.data); - const problems = findBoardSkillProblems(boardRegistryOf([board]), boards.codeSkills); + if (projectSkills === null) return parsed.data; + const problems = findBoardSkillProblems(boardRegistryOf([board]), boards.codeSkills, undefined, projectSkills); const unknown = problems.filter(problem => problem.includes(UNKNOWN_SKILL)); if (unknown.length > 0) throw new BoardWriteError(422, { error: 'unknown_skill', message: unknown.join(' ') }); return parsed.data; @@ -147,7 +153,7 @@ export class BoardWrites { async create(scope: StoredBoardScope, input: unknown, writer: BoardWriter): Promise { const key = (input as { key?: unknown } | null)?.key; if (typeof key === 'string') this.refuseCodeBoard(key, 'create'); - const board = this.validate(input); + const board = this.validate(input, await this.deps.boards.projectSkillNames(scope)); // Factory stores its boards only into a project that has none, so they go in first. await this.deps.boards.describe(scope); const row = await stored(() => @@ -222,7 +228,7 @@ export class BoardWrites { // The project's first load stores Factory's boards. if (seed) await boards.describe(scope); const row = await this.existing(scope, key); - const input = this.validate({ key, ...definition }); + const input = this.validate({ key, ...definition }, await boards.projectSkillNames(scope)); if (row.revision === expectedRevision && sameBoardDefinition(row, input)) { return { row, written: false }; } diff --git a/mastracode/factory/src/boards/project-boards.ts b/mastracode/factory/src/boards/project-boards.ts index c39e12bd0c6..c58f6d42db0 100644 --- a/mastracode/factory/src/boards/project-boards.ts +++ b/mastracode/factory/src/boards/project-boards.ts @@ -123,9 +123,24 @@ interface CacheEntry { boards: ProjectBoards; version: string | null; reviewInUse: boolean; + /** The project's skill revision the boards' skill problems were checked at. */ + skillsRevision: number; checkedAt: number; } +/** + * The skills a project created (Settings › Skills), which its boards' runners may name besides the app's. + * `revision` moves whenever the project's skills change, so loads recheck the names only then. + */ +export interface ProjectSkillNames { + revision(scope: StoredBoardScope): Promise; + names(scope: StoredBoardScope): Promise>; +} + +const NO_PROJECT_SKILLS: ReadonlySet = new Set(); +/** Recorded when the project's skills couldn't be read; never a stored revision, so the next load rereads them. */ +const UNREAD_SKILLS_REVISION = -1; + export interface ProjectBoardCacheOptions { /** The code boards, built-ins included when enabled. */ codeRegistry: BoardRegistry; @@ -147,6 +162,8 @@ export interface ProjectBoardCacheOptions { ops: FactoryStorageOps, ) => Promise> | null>; codeSkills?: readonly InlineSkill[]; + /** The skills each project created. Without it, runners may only name the app's skills. */ + projectSkills?: ProjectSkillNames; /** * Whether the project still uses the retired Review board (an open card is stored on it). Such * a project is served Review alongside its boards; without this, no project is. @@ -213,6 +230,7 @@ export class ProjectBoardCache implements ProjectBoardSource { readonly #warned = new Set(); readonly #seeded = new Set(); readonly #codeSkills: readonly InlineSkill[]; + readonly #projectSkills: ProjectSkillNames | undefined; readonly #seeds: ReadonlyMap; /** Boards the app upserted for every project, which a project with no boards gets before Factory's. */ readonly #appBoards = new Map(); @@ -228,6 +246,7 @@ export class ProjectBoardCache implements ProjectBoardSource { this.#occupiedPhases = options.occupiedPhases; this.#projects = options.projects; this.#codeSkills = options.codeSkills ?? []; + this.#projectSkills = options.projectSkills; this.#recheckMs = options.recheckMs ?? DEFAULT_RECHECK_MS; this.#now = options.now ?? Date.now; this.#warn = options.warn ?? (message => console.warn(`[factory] ${message}`)); @@ -346,6 +365,39 @@ export class ProjectBoardCache implements ProjectBoardSource { return this.#codeSkills; } + /** + * The skills the project created, which its runners may name besides the app's. Throws when they can't be + * read, so a board write fails with the storage error instead of refusing a skill the project has. + */ + async projectSkillNames(scope: StoredBoardScope): Promise> { + return this.#projectSkills ? this.#projectSkills.names(scope) : NO_PROJECT_SKILLS; + } + + /** + * The names for a load, or undefined when they can't be read: the load still serves the boards, flags their + * created skills as missing, and doesn't cache what it compiled without them. + */ + async #readProjectSkillNames(scope: StoredBoardScope): Promise | undefined> { + try { + return await this.projectSkillNames(scope); + } catch (error) { + this.#warnOnce( + `project-skills:${scopeKey(scope)}`, + `Could not read the skills project ${scope.factoryProjectId} created; boards that run them show them as missing: ${error instanceof Error ? error.message : String(error)}`, + ); + return undefined; + } + } + + async #projectSkillsRevision(scope: StoredBoardScope): Promise { + if (!this.#projectSkills) return 0; + try { + return await this.#projectSkills.revision(scope); + } catch { + return UNREAD_SKILLS_REVISION; + } + } + /** Makes the next load reread the project. The loaded boards keep serving sync reads until then. */ invalidate(scope: StoredBoardScope): void { const key = scopeKey(scope); @@ -378,14 +430,30 @@ export class ProjectBoardCache implements ProjectBoardSource { const current = this.#entries.get(key); const version = await this.#storage.readVersion(scope); const reviewInUse = (await this.#reviewBoardInUse?.(scope)) ?? false; - if (current && current.version === version && current.reviewInUse === reviewInUse) { + let skillsRevision = await this.#projectSkillsRevision(scope); + if ( + current && + current.version === version && + current.reviewInUse === reviewInUse && + current.skillsRevision === skillsRevision && + skillsRevision !== UNREAD_SKILLS_REVISION + ) { if ((this.#generations.get(key) ?? 0) === generation) current.checkedAt = this.#now(); return current.boards; } const snapshot = await this.#consistentSnapshot(scope); - const boards = this.#compile(scope, snapshot.boards, reviewInUse); + const projectSkills = await this.#readProjectSkillNames(scope); + // Compiled without the names, the boards flag their skills as missing: the next load reads them again. + if (projectSkills === undefined) skillsRevision = UNREAD_SKILLS_REVISION; + const boards = this.#compile(scope, snapshot.boards, reviewInUse, projectSkills ?? NO_PROJECT_SKILLS); if ((this.#generations.get(key) ?? 0) === generation) { - this.#entries.set(key, { boards, version: snapshot.version, reviewInUse, checkedAt: this.#now() }); + this.#entries.set(key, { + boards, + version: snapshot.version, + reviewInUse, + skillsRevision, + checkedAt: this.#now(), + }); } return boards; } @@ -479,7 +547,12 @@ export class ProjectBoardCache implements ProjectBoardSource { }; } - #compile(scope: StoredBoardScope, rows: readonly StoredBoardRecord[], reviewInUse: boolean): ProjectBoards { + #compile( + scope: StoredBoardScope, + rows: readonly StoredBoardRecord[], + reviewInUse: boolean, + projectSkills: ReadonlySet, + ): ProjectBoards { const byKey = new Map(rows.map(row => [row.key, row])); const details = new Map(this.#codeDetails); const problems: string[] = []; @@ -521,7 +594,7 @@ export class ProjectBoardCache implements ProjectBoardSource { report(row, merged.problems); details.set(code.id, { ...details.get(code.id)!, - problems: [...merged.problems, ...this.#skillProblems(merged.board)], + problems: [...merged.problems, ...this.#skillProblems(merged.board, projectSkills)], }); boards.push(merged.board); } @@ -548,7 +621,7 @@ export class ProjectBoardCache implements ProjectBoardSource { continue; } boards.push(board); - details.set(row.key, { source: 'stored', editable: true, problems: this.#skillProblems(board) }); + details.set(row.key, { source: 'stored', editable: true, problems: this.#skillProblems(board, projectSkills) }); } return { registry: boardRegistryOf(boards), @@ -557,8 +630,8 @@ export class ProjectBoardCache implements ProjectBoardSource { }; } - #skillProblems(board: InstalledBoard): string[] { - return findBoardSkillProblems(boardRegistryOf([board]), this.#codeSkills); + #skillProblems(board: InstalledBoard, projectSkills?: ReadonlySet): string[] { + return findBoardSkillProblems(boardRegistryOf([board]), this.#codeSkills, undefined, projectSkills); } #warnOnce(key: string, message: string, debug = false): void { diff --git a/mastracode/factory/src/boards/stored-board-runtime.test.ts b/mastracode/factory/src/boards/stored-board-runtime.test.ts index ae067c8a583..f343ea20b94 100644 --- a/mastracode/factory/src/boards/stored-board-runtime.test.ts +++ b/mastracode/factory/src/boards/stored-board-runtime.test.ts @@ -1077,6 +1077,45 @@ describe.each(['libsql', ...(postgresUrl ? ['postgres'] : [])])( ).rejects.toMatchObject({ code: 'project_not_found' }); }, 60_000); + it('lets a board run a skill the named projects created, and refuses it where one has none', async () => { + stubModel(); + const orgId = `org-${randomUUID()}`; + const replica = await boot(await isolatedDatabase(), orgId); + const [withSkill, without] = [await createProject(replica, 'With'), await createProject(replica, 'Without')]; + const created = await replica.send('POST', `/web/factory/projects/${withSkill}/skills`, { + name: 'release-notes', + content: '---\nname: release-notes\ndescription: Write release notes\n---\n\n# Notes\n', + }); + expect(created.status, JSON.stringify(created.json)).toBe(201); + const notes: StoredBoardInput = { + ...bugsBoard, + key: 'notes', + name: 'Notes', + phases: bugsBoard.phases.map(phase => + phase.key === 'fixing' ? { ...phase, runner: { context: 'work', skill: 'release-notes' } } : phase, + ), + }; + const scope = (factoryProjectId: string) => ({ orgId, factoryProjectId }); + + // A list with a project that lacks the skill is refused before any project is written. + await expect( + replica.factory.upsertBoard(notes, { projects: [scope(withSkill), scope(without)] }), + ).rejects.toMatchObject({ code: 'unknown_skill' }); + expect(await replica.boards.get(scope(withSkill), 'notes')).toBeNull(); + // A board for every project may only run the app's skills. + await expect(replica.factory.upsertBoard(notes, { projects: 'all' })).rejects.toMatchObject({ + code: 'unknown_skill', + }); + + expect(await replica.factory.upsertBoard(notes, { projects: [scope(withSkill)] })).toMatchObject({ + inserted: [scope(withSkill)], + }); + // Saved again, it is checked against the project's skills as an edit is. + expect(await replica.factory.upsertBoard(notes, { projects: [scope(withSkill)] })).toMatchObject({ + unchanged: [scope(withSkill)], + }); + }, 60_000); + it('stores the Work board the README shows for replacing Work in every project, over edits and cards in Triage, and keeps it through a reset', async () => { stubModel(); // The README, not the changeset: `changeset version` deletes changesets. diff --git a/mastracode/factory/src/factory.ts b/mastracode/factory/src/factory.ts index 609aeabd036..eebd320456d 100644 --- a/mastracode/factory/src/factory.ts +++ b/mastracode/factory/src/factory.ts @@ -194,6 +194,7 @@ import { observeSessionThreadTitle } from './session/thread-title-mirror.js'; import { FactoryWorkItemStateProcessor } from './session/work-item-state-processor.js'; import { shareSessionListChanges } from './session-list-changes.js'; import { assertFactorySkills, findBoardSkillProblems } from './skills/app-skills.js'; +import { projectSkillNamesOf } from './skills/catalog.js'; import { createSpaStaticMiddleware, resolveUiDistDir } from './spa-static.js'; import { createStateSigner } from './state-signing.js'; import { observeAgentGitAction } from './storage/domains/audit/agent-audit.js'; @@ -735,7 +736,9 @@ export class MastraFactory { * project gets none. This lasts for the process, so run it at every startup. A Work or app * board's key keeps that board's code behaviour, * so the definition is checked as an edit is; a new key gets none (no tool, source-closed or - * event rules). The board is validated once, as the boards API does, and each write is audited + * event rules). The board is validated as the boards API validates it; a runner may name a skill a + * project created in Settings › Skills only when `projects` lists the projects, and each listed + * project must have it, while a board for `'all'` projects may only run the app's skills. Each write is audited * as `factory.board.created` or `factory.board.updated` by `system:factory`. Refusals throw a * `BoardWriteError` (`invalid_board`, `unknown_skill`, `code_behaviour`, `phase_in_use` when cards * sit in a phase it removes, `board_in_use` when the key is `review` and the retired Review board @@ -773,7 +776,8 @@ export class MastraFactory { ); } const { writes, boards, projects, audit } = store; - const input = writes.validate(board); + // Named projects may have created the skills their runners name, so those are checked per project below. + const input = writes.validate(board, options.projects === 'all' ? undefined : null); // Work and app boards are stored per project like any other. writes.refuseCodeBoard(input.key, 'edit'); await projects.ensureReady(); @@ -791,6 +795,7 @@ export class MastraFactory { message: `Project "${scope.factoryProjectId}" does not exist.`, }); } + writes.validate(input, await boards.projectSkillNames(scope)); } } const result: { inserted: StoredBoardScope[]; updated: StoredBoardScope[]; unchanged: StoredBoardScope[] } = { @@ -1121,6 +1126,10 @@ export class MastraFactory { storage: storedBoardsStorage, projects: factoryProjectsStorage, codeSkills: this.#skills, + // Runners may also name the skills a project created in Settings › Skills. + ...(storage.isDomainReady('skill-overrides') + ? { projectSkills: projectSkillNamesOf(skillOverridesStorage) } + : {}), // A project still using the retired Review board keeps it; work items are read once they're ready. ...(storage.isDomainReady('work-items') ? { diff --git a/mastracode/factory/src/routes/boards.ts b/mastracode/factory/src/routes/boards.ts index 98cd77fc40f..7c2db25dc68 100644 --- a/mastracode/factory/src/routes/boards.ts +++ b/mastracode/factory/src/routes/boards.ts @@ -31,7 +31,10 @@ export interface BoardRoutesDeps extends RouteDependencies { workItems: Pick; storage: StoredBoardsStorage; /** The per-project boards: the code boards and their seeds, skills, and the cache to invalidate. */ - boards: Pick; + boards: Pick< + ProjectBoardCache, + 'describe' | 'invalidate' | 'codeRegistry' | 'codeSkills' | 'projectSkillNames' | 'seedFor' + >; } type Resolved = StoredBoardScope & { userId: string }; diff --git a/mastracode/factory/src/routes/contracts.ts b/mastracode/factory/src/routes/contracts.ts index 847cb6fca48..e39e17f4e87 100644 --- a/mastracode/factory/src/routes/contracts.ts +++ b/mastracode/factory/src/routes/contracts.ts @@ -1474,6 +1474,8 @@ const skillNameSchema = z .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/); const skillPathSchema = z.object({ id: uuidSchema, name: skillNameSchema }); const skillResponseSchema = z.object({ skill: entitySchema }); +/** `skill` is null when the request deleted a skill the project created. */ +const skillRevertResponseSchema = z.object({ skill: entitySchema.nullable() }); /** Adds the runtime's SKILL.md validation errors, checking the frontmatter name against `directoryName` when given. */ function refineSkillContent(content: string, context: z.RefinementCtx, directoryName?: string) { @@ -1496,6 +1498,12 @@ export const skillOverrideSaveRequestSchema = skillPathSchema .extend({ content: skillContentSchema }) .superRefine((input, context) => refineSkillContent(input.content, context, input.name)); +/** A new skill's SKILL.md must load under the name it is created with, exactly as the runtime validates it. */ +export const skillCreateBodySchema = z + .object({ name: skillNameSchema, content: skillContentSchema }) + .strict() + .superRefine((input, context) => refineSkillContent(input.content, context, input.name)); + export const FACTORY_ROUTE_CONTRACTS = { projectList: { method: 'GET', @@ -2074,10 +2082,18 @@ export const FACTORY_ROUTE_CONTRACTS = { querySchema: z.object({ projectId: uuidSchema.optional() }), responseSchema: z.object({ skills: z.array(entitySchema), canEdit: z.boolean().optional() }), }, + skillCreate: { + method: 'POST', + path: '/web/factory/projects/:id/skills', + description: 'Create a skill for one Factory project', + pathSchema: projectPathSchema, + bodySchema: skillCreateBodySchema, + responseSchema: skillResponseSchema, + }, skillOverrideSave: { method: 'PUT', path: '/web/factory/projects/:id/skills/:name', - description: "Save a project's edited SKILL.md for a Factory skill", + description: "Save a project's SKILL.md for a Factory skill: an edit of an app skill, or a skill it created", pathSchema: skillPathSchema, bodySchema: skillOverrideBodySchema, responseSchema: skillResponseSchema, @@ -2085,9 +2101,10 @@ export const FACTORY_ROUTE_CONTRACTS = { skillOverrideRevert: { method: 'DELETE', path: '/web/factory/projects/:id/skills/:name', - description: "Revert a project's edited Factory skill to its original SKILL.md", + description: + "Revert a project's edited Factory skill to its original SKILL.md, or delete a skill the project created", pathSchema: skillPathSchema, - responseSchema: skillResponseSchema, + responseSchema: skillRevertResponseSchema, }, } as const satisfies Record; diff --git a/mastracode/factory/src/routes/skills.test.ts b/mastracode/factory/src/routes/skills.test.ts index 6742fcde079..7af28503db3 100644 --- a/mastracode/factory/src/routes/skills.test.ts +++ b/mastracode/factory/src/routes/skills.test.ts @@ -626,10 +626,12 @@ describe('project skill edit routes', () => { writeFileSync(join(projectDir, 'factory-skills', dir, 'SKILL.md'), content); } - async function setup() { + /** `afterAudit` runs once each write is audited, before the route responds, as another request could. */ + async function setup({ afterAudit }: { afterAudit?: () => Promise } = {}) { const seed = await createFactoryStorageForTests(); const admins = new Set([ADMIN.workosId]); const auth = fakeRouteAuth({ isOrganizationAdmin: async (_org, userId) => admins.has(userId) }); + const auditDomain = new AuditDomain({ auth, audit: seed.audit, projects: seed.projects }); const routes = new SkillRoutes({ auth, controllerId: 'code', @@ -637,7 +639,12 @@ describe('project skill edit routes', () => { overrides: { projects: seed.projects, storage: seed.skillOverrides, - audit: new AuditDomain({ auth, audit: seed.audit, projects: seed.projects }), + audit: { + emit: async input => { + await auditDomain.emit(input); + await afterAudit?.(); + }, + }, }, }).routes(); const projectA = await seed.projects.create({ orgId: 'org-1', userId: ADMIN.workosId, input: { name: 'A' } }); @@ -661,6 +668,12 @@ describe('project skill edit routes', () => { }); const revert = (user: TestAuthUser, projectId: string, name: string) => request(user, `/web/factory/projects/${projectId}/skills/${name}`, { method: 'DELETE' }); + const create = (user: TestAuthUser, projectId: string, name: string, content: string) => + request(user, `/web/factory/projects/${projectId}/skills`, { + method: 'POST', + headers: { 'content-type': 'application/json' }, + body: JSON.stringify({ name, content }), + }); const list = async (user: TestAuthUser, projectId: string) => { const response = await request(user, `/web/factory/skills?projectId=${projectId}`); expect(response.status).toBe(200); @@ -672,6 +685,7 @@ describe('project skill edit routes', () => { content: string; origin: string; edited?: { updatedBy: string; updatedAt: string }; + created?: { updatedBy: string; updatedAt: string }; originalChanged?: boolean; }[]; }; @@ -684,10 +698,203 @@ describe('project skill edit routes', () => { project: event.factoryProjectId, targets: event.targets, })); - return { seed, projectA, projectB, elsewhere, save, revert, list, skill, auditActions }; + return { seed, projectA, projectB, elsewhere, save, revert, create, list, skill, auditActions }; } const editedPlan = (body: string) => `---\nname: factory-plan\ndescription: Our planning rules\n---\n\n${body}\n`; + const releaseNotes = (body: string) => + `---\nname: release-notes\ndescription: Write release notes for a merged change\n---\n\n${body}\n`; + + describe('creating skills', () => { + it('creates a skill for its project only, lists it as a project skill, and records it', async () => { + const { projectA, projectB, create, list, auditActions } = await setup(); + const response = await create(ADMIN, projectA.id, 'release-notes', releaseNotes('# Notes')); + expect(response.status).toBe(201); + expect(((await response.json()) as { skill: unknown }).skill).toMatchObject({ + name: 'release-notes', + description: 'Write release notes for a merged change', + content: '# Notes', + origin: 'project', + builtIn: false, + created: { updatedBy: ADMIN.workosId }, + }); + + const a = await list(ADMIN, projectA.id); + const created = a.skills.find(s => s.name === 'release-notes'); + expect(created).toMatchObject({ origin: 'project', content: '# Notes' }); + expect(created?.edited).toBeUndefined(); + // The catalog stays sorted by name with created skills among the others. + const names = a.skills.map(s => s.name); + expect(names).toEqual([...names].sort()); + expect((await list(ADMIN, projectB.id)).skills.map(s => s.name)).not.toContain('release-notes'); + expect(await auditActions()).toEqual([ + { action: 'factory.skill.created', project: projectA.id, targets: [{ type: 'skill', id: 'release-notes' }] }, + ]); + }); + + it('creates a skill with an all-digit name when the SKILL.md quotes it, as the settings editor writes it', async () => { + const { projectA, create, skill } = await setup(); + const response = await create( + ADMIN, + projectA.id, + '123', + '---\nname: "123"\ndescription: "Numbered"\n---\n\n# 123\n', + ); + expect(response.status).toBe(201); + expect(await skill(ADMIN, projectA.id, '123')).toMatchObject({ origin: 'project', description: 'Numbered' }); + }); + + it('answers a create or save with the skill it stored, even when another admin deletes it at once', async () => { + let deleteAfterAudit: (() => Promise) | undefined; + const { seed, projectA, create, save } = await setup({ + afterAudit: async () => void (await deleteAfterAudit?.()), + }); + const scope = { orgId: 'org-1', projectId: projectA.id, skillName: 'release-notes' }; + deleteAfterAudit = () => seed.skillOverrides.delete(scope); + + const created = await create(ADMIN, projectA.id, 'release-notes', releaseNotes('# Notes')); + expect(created.status).toBe(201); + expect(((await created.json()) as { skill: unknown }).skill).toMatchObject({ + name: 'release-notes', + content: '# Notes', + origin: 'project', + }); + expect(await seed.skillOverrides.get(scope)).toBeNull(); + + deleteAfterAudit = undefined; + await create(ADMIN, projectA.id, 'release-notes', releaseNotes('# Notes')); + deleteAfterAudit = () => seed.skillOverrides.delete(scope); + const saved = await save(ADMIN, projectA.id, 'release-notes', releaseNotes('# Shorter')); + expect(saved.status).toBe(200); + expect(((await saved.json()) as { skill: unknown }).skill).toMatchObject({ + content: '# Shorter', + origin: 'project', + }); + }); + + it('updates a created skill, then deletes it', async () => { + const { projectA, create, save, revert, list, auditActions } = await setup(); + expect((await create(ADMIN, projectA.id, 'release-notes', releaseNotes('# Notes'))).status).toBe(201); + + const updated = await save(ADMIN, projectA.id, 'release-notes', releaseNotes('# Shorter notes')); + expect(updated.status).toBe(200); + expect(((await updated.json()) as { skill: unknown }).skill).toMatchObject({ + content: '# Shorter notes', + origin: 'project', + }); + + const deleted = await revert(ADMIN, projectA.id, 'release-notes'); + expect(deleted.status).toBe(200); + expect(await deleted.json()).toEqual({ skill: null }); + expect((await list(ADMIN, projectA.id)).skills.map(s => s.name)).not.toContain('release-notes'); + // Gone, so neither a save nor a second delete finds it. + expect((await save(ADMIN, projectA.id, 'release-notes', releaseNotes('# Again'))).status).toBe(404); + expect((await revert(ADMIN, projectA.id, 'release-notes')).status).toBe(404); + expect((await auditActions()).map(event => event.action).sort()).toEqual([ + 'factory.skill.created', + 'factory.skill.deleted', + 'factory.skill.updated', + ]); + }); + + it('refuses a name an app skill or another created skill already has', async () => { + writeLocalSkill('deploy-notes', '---\nname: deploy-notes\ndescription: Folder skill\n---\n\n# Folder\n'); + const { projectA, projectB, create, skill } = await setup(); + const builtIn = await create(ADMIN, projectA.id, 'factory-plan', editedPlan('# Not a new skill')); + expect(builtIn.status).toBe(409); + expect(await builtIn.json()).toEqual({ + error: 'skill_exists', + message: 'A skill named "factory-plan" already exists. Edit it instead.', + }); + const folder = '---\nname: deploy-notes\ndescription: Mine\n---\n\n# Mine\n'; + expect((await create(ADMIN, projectA.id, 'deploy-notes', folder)).status).toBe(409); + + expect((await create(ADMIN, projectA.id, 'release-notes', releaseNotes('# First'))).status).toBe(201); + expect((await create(ADMIN, projectA.id, 'release-notes', releaseNotes('# Second'))).status).toBe(409); + expect((await skill(ADMIN, projectA.id, 'release-notes')).content).toBe('# First'); + // Another project may use the name. + expect((await create(ADMIN, projectB.id, 'release-notes', releaseNotes('# Other'))).status).toBe(201); + expect((await skill(ADMIN, projectA.id, 'factory-plan')).edited).toBeUndefined(); + }); + + it('creates one skill when two admins create the same name at once', async () => { + const { projectA, create, seed } = await setup(); + const statuses = await Promise.all( + ['# One', '# Two', '# Three'].map(body => create(ADMIN, projectA.id, 'release-notes', releaseNotes(body))), + ).then(responses => responses.map(response => response.status).sort()); + expect(statuses).toEqual([201, 409, 409]); + expect(await seed.skillOverrides.list({ orgId: 'org-1', projectId: projectA.id })).toHaveLength(1); + }); + + it('rejects a skill the runtime could not load, or a name that is not a skill name', async () => { + const { projectA, create, seed } = await setup(); + const cases = [ + [ + 'release-notes', + '---\nname: other-notes\ndescription: Renamed\n---\n\n# Notes\n', + /must match directory name/, + ], + ['release-notes', '---\nname: release-notes\n---\n\n# Notes\n', /description/i], + ['Release Notes', '---\nname: Release Notes\ndescription: x\n---\n\n# Notes\n', /Invalid/i], + ['release-notes', '', /Too small/], + ] as const; + for (const [name, content, message] of cases) { + const response = await create(ADMIN, projectA.id, name, content); + expect(response.status).toBe(400); + const body = (await response.json()) as { error: string; message: string }; + expect(body.error).toBe('invalid_skill'); + expect(body.message).toMatch(message); + } + expect(await seed.skillOverrides.list({ orgId: 'org-1', projectId: projectA.id })).toEqual([]); + }); + + it('refuses creation from members who are not org admins and in other organizations', async () => { + const { projectA, elsewhere, create, seed, auditActions } = await setup(); + const member = await create(MEMBER, projectA.id, 'release-notes', releaseNotes('# Notes')); + expect(member.status).toBe(403); + expect(await member.json()).toEqual({ + error: 'forbidden', + message: 'Organization administrator access is required to create skills.', + }); + expect((await create(ADMIN, elsewhere.id, 'release-notes', releaseNotes('# Notes'))).status).toBe(404); + expect((await create(ADMIN, 'not-a-uuid', 'release-notes', releaseNotes('# Notes'))).status).toBe(404); + expect(await seed.skillOverrides.list({ orgId: 'org-1', projectId: projectA.id })).toEqual([]); + expect(await auditActions()).toEqual([]); + }); + + it('treats a created skill as an edit once the app ships a skill of the same name', async () => { + const { projectA, create, revert, skill } = await setup(); + expect((await create(ADMIN, projectA.id, 'release-notes', releaseNotes('# Ours'))).status).toBe(201); + + writeLocalSkill('release-notes', releaseNotes('# From the app')); + expect(await skill(ADMIN, projectA.id, 'release-notes')).toMatchObject({ + origin: 'folder', + content: '# Ours', + edited: { updatedBy: ADMIN.workosId }, + originalChanged: true, + }); + + // Reverting drops the project's text for the app's skill. + const reverted = await revert(ADMIN, projectA.id, 'release-notes'); + expect(((await reverted.json()) as { skill: unknown }).skill).toMatchObject({ + origin: 'folder', + content: '# From the app', + }); + }); + + it('creates over an edit whose skill the app no longer has', async () => { + writeLocalSkill('release-notes', releaseNotes('# From the app')); + const { projectA, save, create, skill } = await setup(); + expect((await save(ADMIN, projectA.id, 'release-notes', releaseNotes('# Edited'))).status).toBe(200); + rmSync(join(projectDir, 'factory-skills', 'release-notes'), { recursive: true }); + + expect((await create(ADMIN, projectA.id, 'release-notes', releaseNotes('# Ours now'))).status).toBe(201); + expect(await skill(ADMIN, projectA.id, 'release-notes')).toMatchObject({ + origin: 'project', + content: '# Ours now', + }); + }); + }); it("serves an admin's edit to its project only, with who edited it", async () => { const { projectA, projectB, save, list, skill, auditActions } = await setup(); diff --git a/mastracode/factory/src/routes/skills.ts b/mastracode/factory/src/routes/skills.ts index 9e0d1bb1c9f..1cb6f693e9e 100644 --- a/mastracode/factory/src/routes/skills.ts +++ b/mastracode/factory/src/routes/skills.ts @@ -6,13 +6,19 @@ import { registerApiRoute } from '@mastra/core/server'; import type { InlineSkill } from '@mastra/core/skills'; import type { Context } from 'hono'; -import { hashSkillContent, listFactorySkills, readFactorySkillOriginals } from '../skills/catalog.js'; +import { + createdSkillInfo, + hashSkillContent, + listFactorySkills, + originalSkillInfo, + readFactorySkillOriginals, +} from '../skills/catalog.js'; import { formatSkillMessage, resolveSkillInvocation, SkillInvocationError } from '../skills/service.js'; import type { AuditEmitter } from '../storage/domains/audit/domain.js'; import type { FactoryProjectsStorage } from '../storage/domains/projects/base.js'; import type { SkillOverridesStorage } from '../storage/domains/skill-overrides/base.js'; import type { SourceControlStorageHandle } from '../storage/domains/source-control/base.js'; -import { FACTORY_ROUTE_CONTRACTS, skillOverrideSaveRequestSchema } from './contracts.js'; +import { FACTORY_ROUTE_CONTRACTS, skillCreateBodySchema, skillOverrideSaveRequestSchema } from './contracts.js'; import type { RouteDependencies } from './route.js'; import { loose, Route } from './route.js'; @@ -45,7 +51,10 @@ export interface SkillRoutesDeps extends RouteDependencies { /** Per-project skill edits. Without it the catalog lists originals only and edit routes are not served. */ overrides?: { projects: Pick; - storage: Pick; + storage: Pick< + SkillOverridesStorage, + 'ensureReady' | 'list' | 'get' | 'upsert' | 'create' | 'updateCreated' | 'delete' + >; audit: AuditEmitter; }; } @@ -139,12 +148,6 @@ export class SkillRoutes extends Route { return !auth.enabled() || (await auth.isOrganizationAdmin(c, orgId)); } - async #catalogEntry(scope: { orgId: string; projectId: string }, name: string) { - const { overrides, skills } = this.deps; - const edits = overrides ? await overrides.storage.list(scope) : []; - return (await listFactorySkills(skills, edits)).find(skill => skill.name === name); - } - routes(): ApiRoute[] { const { controllerId, controller, authorizeSessionAddress: customAuthorize } = this.deps; const authorize = @@ -232,23 +235,27 @@ export class SkillRoutes extends Route { ); } const name = path.data.name; - const original = (await readFactorySkillOriginals(this.deps.skills)).get(name); - if (!original) return c.json({ error: 'not_found', message: `Skill "${name}" not found.` }, 404); const scope = { orgId: access.orgId, projectId: access.projectId, skillName: name }; await overrides!.storage.ensureReady(); + const original = (await readFactorySkillOriginals(this.deps.skills)).get(name); + // Without an original, the name can only be a skill this project created. + if (!original && (await overrides!.storage.get(scope))?.kind !== 'created') { + return c.json({ error: 'not_found', message: `Skill "${name}" not found.` }, 404); + } if (revert) { if (await overrides!.storage.delete(scope)) { await overrides!.audit.emit({ context: c, input: { - action: 'factory.skill.reverted', + action: original ? 'factory.skill.reverted' : 'factory.skill.deleted', targets: [{ type: 'skill', id: name }], factoryProjectId: access.projectId, }, }); } - return c.json({ skill: await this.#catalogEntry(access, name) }); + // The response describes what the delete left, not a reread another write could change. + return c.json({ skill: original ? originalSkillInfo(name, original) : null }); } let body: unknown; @@ -267,22 +274,72 @@ export class SkillRoutes extends Route { 400, ); } - await overrides!.storage.upsert({ - ...scope, - content: request.data.content, - baseHash: hashSkillContent(original.raw), - updatedBy: access.userId, - }); + const write = { ...scope, content: request.data.content, updatedBy: access.userId }; + // A created skill is only updated while it exists, so a save racing a delete doesn't bring it back. + const saved = original + ? await overrides!.storage.upsert({ ...write, baseHash: hashSkillContent(original.raw), kind: 'edit' }) + : await overrides!.storage.updateCreated(write); + if (!saved) return c.json({ error: 'not_found', message: `Skill "${name}" not found.` }, 404); await overrides!.audit.emit({ context: c, input: { action: 'factory.skill.updated', targets: [{ type: 'skill', id: name }], factoryProjectId: access.projectId, - metadata: { origin: original.origin }, + metadata: { origin: original?.origin ?? 'project' }, }, }); - return c.json({ skill: await this.#catalogEntry(access, name) }); + return c.json({ skill: original ? originalSkillInfo(name, original, saved) : createdSkillInfo(saved) }); + }; + + const handleSkillCreate = async (context: unknown) => { + const c = loose(context); + const { overrides } = this.deps; + const path = FACTORY_ROUTE_CONTRACTS.skillCreate.pathSchema.safeParse({ id: c.req.param('id') }); + if (!path.success) return c.json({ error: 'Project not found' }, 404); + const access = await this.#projectAccess(c, path.data.id); + if ('response' in access) return access.response; + if (!(await this.#canEdit(c, access.orgId))) { + return c.json( + { error: 'forbidden', message: 'Organization administrator access is required to create skills.' }, + 403, + ); + } + + let body: unknown; + try { + body = await c.req.json(); + } catch { + return c.json({ error: 'invalid_request', message: 'Invalid JSON body.' }, 400); + } + const request = skillCreateBodySchema.safeParse(body); + if (!request.success) { + return c.json( + { error: 'invalid_skill', message: request.error.issues.map(issue => issue.message).join('\n') }, + 400, + ); + } + const { name, content } = request.data; + const exists = { error: 'skill_exists', message: `A skill named "${name}" already exists. Edit it instead.` }; + if ((await readFactorySkillOriginals(this.deps.skills)).has(name)) return c.json(exists, 409); + await overrides!.storage.ensureReady(); + const created = await overrides!.storage.create({ + orgId: access.orgId, + projectId: access.projectId, + skillName: name, + content, + updatedBy: access.userId, + }); + if (!created) return c.json(exists, 409); + await overrides!.audit.emit({ + context: c, + input: { + action: 'factory.skill.created', + targets: [{ type: 'skill', id: name }], + factoryProjectId: access.projectId, + }, + }); + return c.json({ skill: createdSkillInfo(created) }, 201); }; return [ @@ -293,6 +350,11 @@ export class SkillRoutes extends Route { }), ...(this.deps.overrides ? [ + registerApiRoute(FACTORY_ROUTE_CONTRACTS.skillCreate.path, { + method: FACTORY_ROUTE_CONTRACTS.skillCreate.method, + requiresAuth: false, + handler: context => handleSkillCreate(context), + }), registerApiRoute(FACTORY_ROUTE_CONTRACTS.skillOverrideSave.path, { method: FACTORY_ROUTE_CONTRACTS.skillOverrideSave.method, requiresAuth: false, diff --git a/mastracode/factory/src/skills/app-skills.ts b/mastracode/factory/src/skills/app-skills.ts index 191bcc3346f..b118eb4c596 100644 --- a/mastracode/factory/src/skills/app-skills.ts +++ b/mastracode/factory/src/skills/app-skills.ts @@ -28,15 +28,19 @@ export function assertFactorySkills(skills: unknown): readonly InlineSkill[] { return Object.freeze([...skills]); } +const NO_PROJECT_SKILLS: ReadonlySet = new Set(); + /** * Problems with the skills board phases name in `runner.skill`, found at * startup instead of when a card first enters the phase. A skill is found when - * it is a code skill, a folder skill in the app's `factory-skills/`, or bundled. + * it is a code skill, a folder skill in the app's `factory-skills/`, bundled, + * or one of `projectSkills`, the skills a project created for its own boards. */ export function findBoardSkillProblems( boards: BoardRegistry, codeSkills: readonly InlineSkill[], localSkillsPath: string | undefined = resolveLocalFactorySkillsPath(), + projectSkills: ReadonlySet = NO_PROJECT_SKILLS, ): string[] { const codeNames = new Set(codeSkills.map(skill => skill.name)); const problems: string[] = []; @@ -48,10 +52,11 @@ export function findBoardSkillProblems( const found = codeNames.has(skill) || FACTORY_SKILL_NAMES.has(skill) || + projectSkills.has(skill) || (localSkillsPath !== undefined && existsSync(join(localSkillsPath, skill, 'SKILL.md'))); if (!found) { problems.push( - `${where} runs skill '${skill}', but no such skill exists. Pass it in MastraFactory({ skills }) or add factory-skills/${skill}/SKILL.md.`, + `${where} runs skill '${skill}', but no such skill exists. Pass it in MastraFactory({ skills }), add factory-skills/${skill}/SKILL.md, or create it in Settings › Skills.`, ); } else if (REVIEW_ONLY_FACTORY_SKILLS.has(skill) && context !== 'review') { problems.push( diff --git a/mastracode/factory/src/skills/catalog.ts b/mastracode/factory/src/skills/catalog.ts index f33895c2768..6b0f8979189 100644 --- a/mastracode/factory/src/skills/catalog.ts +++ b/mastracode/factory/src/skills/catalog.ts @@ -16,7 +16,9 @@ import type { InlineSkill } from '@mastra/core/skills'; import { validateSkillContent } from '@mastra/core/skills'; import type { SkillSource } from '@mastra/core/workspace'; -import type { SkillOverrideRecord } from '../storage/domains/skill-overrides/base.js'; +import type { ProjectSkillNames } from '../boards/project-boards.js'; +import type { StoredBoardScope } from '../storage/domains/boards/base.js'; +import type { SkillOverrideRecord, SkillOverridesStorage } from '../storage/domains/skill-overrides/base.js'; import { FACTORY_SKILL_NAMES, FACTORY_SKILLS_MOUNT, @@ -27,6 +29,9 @@ import { /** Where a skill comes from: shipped with Factory, the app's `factory-skills/` folder, or `MastraFactory({ skills })`. */ export type FactorySkillOrigin = 'bundled' | 'folder' | 'code'; +/** Where a listed skill comes from: an original's origin, or `project` for a skill the project created. */ +export type FactorySkillCatalogOrigin = FactorySkillOrigin | 'project'; + export interface FactorySkillInfo { name: string; description: string; @@ -34,13 +39,15 @@ export interface FactorySkillInfo { content: string; /** Frontmatter fields besides `name` and `description` (license, user-invocable, …), so an editor can keep them. */ frontmatter?: Record; - origin: FactorySkillOrigin; + origin: FactorySkillCatalogOrigin; /** True for the skills Factory ships, including when the app overrides one. */ builtIn: boolean; /** Set when the SKILL.md fails the runtime's parsing/validation, so the agent will not be able to load it. */ error?: string; /** Set when the project has an edited copy; `description` and `content` then come from the edit. */ edited?: { updatedBy: string; updatedAt: string }; + /** Set for a skill the project created (`origin: 'project'`): who saved it last, and when. */ + created?: { updatedBy: string; updatedAt: string }; /** True when the code, folder, or bundled SKILL.md changed since the project's edit was made. */ originalChanged?: boolean; } @@ -120,33 +127,73 @@ export async function readFactorySkillOriginals( return originals; } +/** The catalog entry of a skill the project created, from its stored row. */ +export function createdSkillInfo(created: SkillOverrideRecord): FactorySkillInfo { + return { + name: created.skillName, + ...parseSkillMarkdown(created.skillName, created.content), + origin: 'project', + builtIn: false, + created: { updatedBy: created.updatedBy, updatedAt: created.updatedAt.toISOString() }, + }; +} + +/** The catalog entry of a code, folder, or bundled skill, showing the project's `edit` of it when it has one. */ +export function originalSkillInfo( + name: string, + { raw, origin }: FactorySkillOriginal, + edit?: SkillOverrideRecord, +): FactorySkillInfo { + const builtIn = FACTORY_SKILL_NAMES.has(name); + if (!edit) return { name, ...parseSkillMarkdown(name, raw), origin, builtIn }; + return { + name, + ...parseSkillMarkdown(name, edit.content), + origin, + builtIn, + edited: { updatedBy: edit.updatedBy, updatedAt: edit.updatedAt.toISOString() }, + originalChanged: hashSkillContent(raw) !== edit.baseHash, + }; +} + /** * List the skills the Factory skill mount serves, sorted by name. With a * project's `overrides`, edited skills show the edited text, who edited them, - * and whether the original changed since. Edits of skills that no longer - * exist are not listed, matching what sessions load. + * and whether the original changed since, and the project's created skills + * are listed with origin `project`. Edits of skills that no longer exist are + * not listed, matching what sessions load. A created skill whose name an app + * skill later takes is listed as that skill's edit. */ export async function listFactorySkills( codeSkills: readonly InlineSkill[] = [], overrides: readonly SkillOverrideRecord[] = [], ): Promise { const edits = new Map(overrides.map(override => [override.skillName, override])); - const skills: FactorySkillInfo[] = []; - for (const [name, { raw, origin }] of await readFactorySkillOriginals(codeSkills)) { - const edit = edits.get(name); - const builtIn = FACTORY_SKILL_NAMES.has(name); - if (!edit) { - skills.push({ name, ...parseSkillMarkdown(name, raw), origin, builtIn }); - continue; - } - skills.push({ - name, - ...parseSkillMarkdown(name, edit.content), - origin, - builtIn, - edited: { updatedBy: edit.updatedBy, updatedAt: edit.updatedAt.toISOString() }, - originalChanged: hashSkillContent(raw) !== edit.baseHash, - }); - } - return skills; + const originals = await readFactorySkillOriginals(codeSkills); + const created = overrides.filter(override => override.kind === 'created' && !originals.has(override.skillName)); + return [ + ...created.map(createdSkillInfo), + ...[...originals].map(([name, original]) => originalSkillInfo(name, original, edits.get(name))), + ].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)); +} + +/** + * Reads the skills each project created, for its boards' runners. A created skill an app skill later + * shadows still counts: a runner naming it finds the app's skill. + */ +export function projectSkillNamesOf( + storage: Pick, +): ProjectSkillNames { + const projectScope = (scope: StoredBoardScope) => ({ orgId: scope.orgId, projectId: scope.factoryProjectId }); + return { + revision: async scope => { + await storage.ensureReady(); + return storage.revision(projectScope(scope)); + }, + names: async scope => { + await storage.ensureReady(); + const overrides = await storage.list(projectScope(scope)); + return new Set(overrides.filter(override => override.kind === 'created').map(override => override.skillName)); + }, + }; } diff --git a/mastracode/factory/src/storage/domains/audit/actions.ts b/mastracode/factory/src/storage/domains/audit/actions.ts index 37749afbcbe..6327c6116b9 100644 --- a/mastracode/factory/src/storage/domains/audit/actions.ts +++ b/mastracode/factory/src/storage/domains/audit/actions.ts @@ -11,7 +11,7 @@ export const AUDIT_ACTIONS = { intake_order: ['updated', 'evaluator_updated'], session: ['owner_transferred'], board: ['created', 'updated', 'deleted', 'reset'], - skill: ['updated', 'reverted'], + skill: ['created', 'updated', 'reverted', 'deleted'], intake_route: ['created', 'updated', 'deleted', 'reordered', 'rerouted'], sandbox_env: ['set', 'updated', 'deleted'], } as const; diff --git a/mastracode/factory/src/storage/domains/skill-overrides/base.test.ts b/mastracode/factory/src/storage/domains/skill-overrides/base.test.ts index c1f82448eae..b473d137660 100644 --- a/mastracode/factory/src/storage/domains/skill-overrides/base.test.ts +++ b/mastracode/factory/src/storage/domains/skill-overrides/base.test.ts @@ -60,6 +60,84 @@ describe.each(['libsql', ...(postgresUrl ? ['postgres'] : [])])('SkillOverridesS expect(await overrides.revision(scope)).toBe(3); }); + it('creates a skill once per project, replacing only an edit stored under its name', async () => { + const { overrides, orgId } = await makeStorage(); + const scope = { orgId, projectId: 'project-a' }; + const create = (content: string) => + overrides.create({ ...scope, skillName: 'release-notes', content, updatedBy: 'user-1' }); + + const first = await create('first'); + expect(first).toMatchObject({ skillName: 'release-notes', content: 'first', kind: 'created', baseHash: '' }); + expect(await overrides.revision(scope)).toBe(1); + expect(await create('second')).toBeNull(); + expect(await overrides.revision(scope)).toBe(1); + expect(await overrides.get({ ...scope, skillName: 'release-notes' })).toEqual(first); + // Saving it keeps it a created skill when asked to. + await overrides.upsert({ + ...scope, + skillName: 'release-notes', + content: 'third', + baseHash: '', + kind: 'created', + updatedBy: 'user-1', + }); + expect(await overrides.get({ ...scope, skillName: 'release-notes' })).toMatchObject({ + kind: 'created', + content: 'third', + }); + + // An edit left behind by a removed app skill gives way to a created skill. + await save(overrides, scope, 'old-app-skill', 'edited'); + expect((await overrides.get({ ...scope, skillName: 'old-app-skill' }))?.kind).toBe('edit'); + expect( + await overrides.create({ ...scope, skillName: 'old-app-skill', content: 'mine', updatedBy: 'user-2' }), + ).toMatchObject({ + kind: 'created', + content: 'mine', + updatedBy: 'user-2', + }); + }); + + it('updates a created skill only while it exists, and never turns an edit into one', async () => { + const { overrides, orgId } = await makeStorage(); + const scope = { orgId, projectId: 'project-a' }; + const update = (skillName: string, content: string) => + overrides.updateCreated({ ...scope, skillName, content, updatedBy: 'user-2' }); + + expect(await update('release-notes', 'nothing yet')).toBeNull(); + await overrides.create({ ...scope, skillName: 'release-notes', content: 'first', updatedBy: 'user-1' }); + expect(await update('release-notes', 'second')).toMatchObject({ + kind: 'created', + content: 'second', + updatedBy: 'user-2', + }); + expect(await overrides.revision(scope)).toBe(2); + + // Deleted first, a late save finds nothing and stores nothing. + await overrides.delete({ ...scope, skillName: 'release-notes' }); + expect(await update('release-notes', 'late')).toBeNull(); + expect(await overrides.get({ ...scope, skillName: 'release-notes' })).toBeNull(); + + await save(overrides, scope, 'factory-plan', 'edited'); + expect(await update('factory-plan', 'not mine')).toBeNull(); + expect(await overrides.get({ ...scope, skillName: 'factory-plan' })).toMatchObject({ + kind: 'edit', + content: 'edited', + }); + }); + + it('creates one skill when the same name is created concurrently', async () => { + const { overrides, orgId } = await makeStorage(); + const scope = { orgId, projectId: 'project-a' }; + const results = await Promise.all( + Array.from({ length: 6 }, (_, i) => + overrides.create({ ...scope, skillName: 'release-notes', content: `content ${i}`, updatedBy: 'user-1' }), + ), + ); + expect(results.filter(result => result !== null)).toHaveLength(1); + expect(await overrides.revision(scope)).toBe(1); + }); + it('counts every concurrent save once', async () => { const { overrides, orgId } = await makeStorage(); const scope = { orgId, projectId: 'project-a' }; diff --git a/mastracode/factory/src/storage/domains/skill-overrides/base.ts b/mastracode/factory/src/storage/domains/skill-overrides/base.ts index 5b51029f5dd..786d9abbc63 100644 --- a/mastracode/factory/src/storage/domains/skill-overrides/base.ts +++ b/mastracode/factory/src/storage/domains/skill-overrides/base.ts @@ -1,15 +1,22 @@ import { FactoryStorageDomain } from '@mastra/core/storage'; import type { CollectionSchema, FactoryStorageOps } from '@mastra/core/storage'; -/** A project's edited copy of one Factory skill's SKILL.md. */ +/** + * `edit` replaces a skill the app serves and stops applying when that skill is removed. `created` is a skill + * the project added itself, served even when the app has no skill of that name. + */ +export type SkillOverrideKind = 'edit' | 'created'; + +/** A project's SKILL.md for one Factory skill: an edited copy of an app skill, or a skill the project created. */ export interface SkillOverrideRecord { orgId: string; projectId: string; skillName: string; - /** The full edited SKILL.md, frontmatter included. */ + /** The full SKILL.md, frontmatter included. */ content: string; - /** sha256 of the original SKILL.md the edit was made against. */ + /** sha256 of the original SKILL.md an edit was made against; empty for a created skill. */ baseHash: string; + kind: SkillOverrideKind; updatedBy: string; updatedAt: Date; } @@ -38,6 +45,8 @@ export const SKILL_OVERRIDES_SCHEMA: CollectionSchema = { skill_name: { type: 'text' }, content: { type: 'text' }, base_hash: { type: 'text' }, + // Added after the first release; rows stored before it are edits. + kind: { type: 'text', default: 'edit' }, updated_by: { type: 'text' }, updated_at: { type: 'timestamp' }, }, @@ -69,6 +78,7 @@ interface SkillOverrideDbRow extends Record { skill_name: string; content: string; base_hash: string; + kind: string; updated_by: string; updated_at: Date; } @@ -88,6 +98,7 @@ function toRecord(row: SkillOverrideDbRow): SkillOverrideRecord { skillName: row.skill_name, content: row.content, baseHash: row.base_hash, + kind: row.kind === 'created' ? 'created' : 'edit', updatedBy: row.updated_by, updatedAt: row.updated_at, }; @@ -143,13 +154,20 @@ export class SkillOverridesStorage extends FactoryStorageDomain { return row ? toRecord(row) : null; } + /** Saves the project's SKILL.md for a skill, replacing any stored one. `kind` defaults to `edit`. */ async upsert({ content, baseHash, + kind = 'edit', updatedBy, skillName, ...scope - }: SkillScope & { content: string; baseHash: string; updatedBy: string }): Promise { + }: SkillScope & { + content: string; + baseHash: string; + kind?: SkillOverrideKind; + updatedBy: string; + }): Promise { await this.#ensureRevisionRow(scope); return this.storage.withTransaction(async ops => { const now = await this.#bumpRevision(ops, scope); @@ -161,6 +179,7 @@ export class SkillOverridesStorage extends FactoryStorageDomain { skill_name: skillName, content, base_hash: baseHash, + kind, updated_by: updatedBy, updated_at: now, }, @@ -169,6 +188,46 @@ export class SkillOverridesStorage extends FactoryStorageDomain { }); } + /** + * Stores a skill the project created, or returns `null` when the project already created one by that name. + * An edit stored under the name is replaced: its skill is gone from the app, so nothing served it. + */ + create(input: SkillScope & { content: string; updatedBy: string }): Promise { + return this.#writeCreated(input, existing => existing?.kind !== 'created'); + } + + /** + * Saves a new SKILL.md for a skill the project created, or returns `null` when it has no created skill by + * that name, so a save that loses a race with a delete doesn't create the skill again. + */ + updateCreated(input: SkillScope & { content: string; updatedBy: string }): Promise { + return this.#writeCreated(input, existing => existing?.kind === 'created'); + } + + /** Writes a created skill when `canWrite` accepts the row stored under its name, else returns `null`. */ + async #writeCreated( + { content, updatedBy, skillName, ...scope }: SkillScope & { content: string; updatedBy: string }, + canWrite: (existing: SkillOverrideDbRow | null) => boolean, + ): Promise { + await this.#ensureRevisionRow(scope); + return this.storage.withTransaction(async ops => { + // Lock the revision row first, so concurrent writes of one name serialize and each sees the last. + const result: { written?: SkillOverrideDbRow } = {}; + await ops.updateAtomic('factory_skill_override_revisions', projectWhere(scope), async row => { + const skill = { ...projectWhere(scope), skill_name: skillName }; + if (!canWrite(await ops.findOne('factory_skill_overrides', skill))) return null; + const now = new Date(); + result.written = await ops.upsertOne( + 'factory_skill_overrides', + ['org_id', 'factory_project_id', 'skill_name'], + { ...skill, content, base_hash: '', kind: 'created', updated_by: updatedBy, updated_at: now }, + ); + return { revision: row.revision + 1, updated_at: now }; + }); + return result.written ? toRecord(result.written) : null; + }); + } + /** False when the skill had no override; the revision only moves when a row was removed. */ async delete({ skillName, ...scope }: SkillScope): Promise { await this.#ensureRevisionRow(scope); diff --git a/mastracode/factory/src/workspace.test.ts b/mastracode/factory/src/workspace.test.ts index bde9fcb7bac..59d54cd4d48 100644 --- a/mastracode/factory/src/workspace.test.ts +++ b/mastracode/factory/src/workspace.test.ts @@ -158,6 +158,7 @@ import type { SkillOverridesStorage } from './storage/domains/skill-overrides/ba import { createFactoryStorageForTests } from './storage/test-utils.js'; import { createWorkspaceFactory, + FACTORY_SKILLS_MOUNT, FactorySkillSource, REVIEW_ONLY_FACTORY_SKILLS, FactoryWorkspaceRegistry, @@ -1723,6 +1724,50 @@ describe('GitHub session workspace preparation', () => { expect(await workspace.skills?.get('removed-app-skill')).toBeFalsy(); }); + it('gives sessions in the project that created a skill that skill, and drops it once deleted', async () => { + const { skillOverrides } = await createFactoryStorageForTests(); + const { resolver } = await createLocalFactory(undefined, undefined, skillOverrides); + addProject(); + addProject({ id: 'project-2', repoFullName: 'octocat/other' }); + for (const id of ['session-reused', 'session-1', 'session-2']) addSession({ id }); + addSession({ id: 'session-other', projectRepositoryId: 'project-2' }); + const reusedContext = createGithubRequestContext('project-1', 'session-reused'); + const reused = (await resolver({ requestContext: reusedContext }))!; + await reused.skills?.maybeRefresh(); + // Prime the reuse record, as a session's first turn does. + await resolver({ requestContext: reusedContext }); + const notesIn = async (workspace: Awaited>>) => { + await workspace!.skills?.maybeRefresh(); + return workspace!.skills?.get('release-notes'); + }; + + const created = await skillOverrides.create({ + orgId: 'org-1', + projectId: 'project-1', + skillName: 'release-notes', + content: '---\nname: release-notes\ndescription: Write release notes\n---\n\n# Release notes\n', + updatedBy: 'admin-1', + }); + expect(created?.kind).toBe('created'); + + const session = await resolver({ requestContext: createGithubRequestContext('project-1', 'session-1') }); + const notes = await notesIn(session); + expect(notes?.description).toBe('Write release notes'); + expect(notes?.instructions).toContain('# Release notes'); + expect((await session!.skills?.list())?.map(skill => skill.name)).toContain('release-notes'); + expect(await resolver({ requestContext: reusedContext })).toBe(reused); + expect((await reused.skills?.get('release-notes'))?.instructions).toContain('# Release notes'); + const other = await resolver({ requestContext: createGithubRequestContext('project-2', 'session-other') }); + expect(await notesIn(other)).toBeFalsy(); + + await skillOverrides.delete({ orgId: 'org-1', projectId: 'project-1', skillName: 'release-notes' }); + expect( + await notesIn(await resolver({ requestContext: createGithubRequestContext('project-1', 'session-2') })), + ).toBeFalsy(); + expect(await resolver({ requestContext: reusedContext })).toBe(reused); + expect(await reused.skills?.get('release-notes')).toBeFalsy(); + }); + it('serves the original skills while edits cannot be read, and the edit once they can', async () => { const { skillOverrides } = await createFactoryStorageForTests(); const { resolver } = await createLocalFactory(undefined, undefined, skillOverrides); @@ -3899,6 +3944,81 @@ describe('FactorySkillSource layering', () => { expect(names).toEqual(['repo-only-skill', 'README.md']); }); + it("hides a repository skill named after a skill the project created, and not after another's edit", async () => { + const overrides = new Map([ + [ + 'release-notes', + { content: '---\nname: release-notes\ndescription: notes\n---\n', updatedAt: new Date(), created: true }, + ], + // An edit of an app skill the app no longer has serves nothing, so it reserves nothing. + [ + 'removed-app-skill', + { content: '---\nname: removed-app-skill\ndescription: gone\n---\n', updatedAt: new Date() }, + ], + ]); + const source = new FactorySkillSource( + repoFallback(['release-notes', 'removed-app-skill', 'repo-only-skill']), + [repoRoot], + undefined, + async () => true, + [], + async () => overrides, + ); + + expect((await source.readdir(repoRoot)).map(entry => entry.name)).toEqual([ + 'removed-app-skill', + 'repo-only-skill', + ]); + expect((await source.readdir(FACTORY_SKILLS_MOUNT)).map(entry => entry.name)).toContain('release-notes'); + expect(String(await source.readFile(path.join(FACTORY_SKILLS_MOUNT, 'release-notes', 'SKILL.md')))).toContain( + 'name: release-notes', + ); + }); + + it('serves a created skill whose name only a folder without a SKILL.md uses', async () => { + const localRoot = await makeLocalRoot({}); + // The app removed its release-notes skill but left the folder behind. + await fs.mkdir(path.join(localRoot, 'release-notes', 'references'), { recursive: true }); + const content = '---\nname: release-notes\ndescription: notes\n---\n\n# Ours\n'; + const source = new FactorySkillSource( + repoFallback([]), + [repoRoot], + localRoot, + async () => true, + [], + async () => new Map([['release-notes', { content, updatedAt: new Date(), created: true }]]), + ); + const skillDir = path.join(FACTORY_SKILLS_MOUNT, 'release-notes'); + + expect((await source.readdir(FACTORY_SKILLS_MOUNT)).map(entry => entry.name)).toContain('release-notes'); + expect((await source.readdir(skillDir)).map(entry => entry.name).sort()).toEqual(['SKILL.md', 'references']); + expect(await source.exists(path.join(skillDir, 'SKILL.md'))).toBe(true); + expect(String(await source.readFile(path.join(skillDir, 'SKILL.md')))).toBe(content); + }); + + it('serves a created skill whose name a stray file in the app skills folder uses', async () => { + const localRoot = await makeLocalRoot({}); + await fs.writeFile(path.join(localRoot, 'release-notes'), 'not a skill'); + const content = '---\nname: release-notes\ndescription: notes\n---\n\n# Ours\n'; + const source = new FactorySkillSource( + repoFallback([]), + [repoRoot], + localRoot, + async () => true, + [], + async () => new Map([['release-notes', { content, updatedAt: new Date(), created: true }]]), + ); + const skillDir = path.join(FACTORY_SKILLS_MOUNT, 'release-notes'); + + expect((await source.readdir(FACTORY_SKILLS_MOUNT)).find(entry => entry.name === 'release-notes')).toEqual({ + name: 'release-notes', + type: 'directory', + }); + expect(await source.readdir(skillDir)).toEqual([{ name: 'SKILL.md', type: 'file' }]); + expect((await source.stat(skillDir)).type).toBe('directory'); + expect(String(await source.readFile(path.join(skillDir, 'SKILL.md')))).toBe(content); + }); + it('picks up app-local skills added after the source was created', async () => { const localRoot = await makeLocalRoot({}); const source = new FactorySkillSource(repoFallback(['late-skill']), [repoRoot], localRoot); diff --git a/mastracode/factory/src/workspace.ts b/mastracode/factory/src/workspace.ts index a2b0c81e867..3d164fafedf 100644 --- a/mastracode/factory/src/workspace.ts +++ b/mastracode/factory/src/workspace.ts @@ -203,10 +203,14 @@ class CodeSkillSource implements SkillSource { } } -/** A project's edited SKILL.md, served in place of the original's. */ +/** + * A project's SKILL.md for one skill: an edit served in place of the original's, or, with `created`, a skill + * the project added that is served even when the app has no skill of that name. + */ export interface FactorySkillOverride { content: string; updatedAt: Date; + created?: boolean; } const NO_SKILL_OVERRIDES: ReadonlyMap = new Map(); @@ -265,8 +269,8 @@ export class FactorySkillSource implements SkillSource { /** * The edit replacing this path, when it is a skill's SKILL.md. Only the instructions are - * edited; the skill's other files still come from its layer. `exists` and `readdir` never - * consult edits, so an edit whose skill was removed from the app is never discovered. + * edited; the skill's other files still come from its layer. `exists` and `readdir` only + * consult created skills, so an edit whose skill was removed from the app is never discovered. */ async #overrideFor(relativePath: string): Promise { const [skillName, file, ...rest] = relativePath.split(path.sep); @@ -274,13 +278,57 @@ export class FactorySkillSource implements SkillSource { return (await this.skillOverrides()).get(skillName); } + /** + * True when a code, folder, or bundled skill has this name, so a created skill of the name is its edit + * instead. Only a SKILL.md makes a skill, as for the catalog: a folder left without one serves nothing. + */ + async #servedByLayer(skillName: string): Promise { + const skillFile = path.join(skillName, 'SKILL.md'); + if (this.#codeSource && (await this.#codeSource.exists(skillName))) return true; + if (this.#localSource && (await this.#localSource.exists(skillFile))) return true; + return this.#bundledSource.exists(skillFile); + } + + /** Names of the skills the project created that no layer serves; each is a directory holding only its SKILL.md. */ + async #createdSkillNames(): Promise { + const names: string[] = []; + for (const [name, override] of await this.skillOverrides()) { + if (override.created && !(await this.#servedByLayer(name))) names.push(name); + } + return names; + } + + /** The created skill this mount-relative path is in (its directory or its SKILL.md), when no layer serves it. */ + async #createdSkillAt(relativePath: string): Promise<{ file: boolean; override: FactorySkillOverride } | undefined> { + const [skillName, file, ...rest] = relativePath.split(path.sep); + if (!skillName || rest.length > 0 || (file !== undefined && file !== 'SKILL.md')) return undefined; + const override = (await this.skillOverrides()).get(skillName); + if (!override?.created || (await this.#servedByLayer(skillName))) return undefined; + return { file: file !== undefined, override }; + } + + /** A created skill's folder: its SKILL.md, plus whatever an app skill left in a folder of the same name. */ + async #createdSkillEntries(relativePath: string): Promise { + const entries = new Map(); + for (const source of [this.#bundledSource, this.#localSource]) { + try { + for (const entry of (await source?.readdir(relativePath)) ?? []) entries.set(entry.name, entry); + } catch { + // Nothing under the name in this layer, or a file rather than a folder. + } + } + entries.set('SKILL.md', { name: 'SKILL.md', type: 'file' }); + return [...entries.values()]; + } + async exists(skillPath: string): Promise { if (!this.#isFactoryPath(skillPath)) return this.fallback.exists(skillPath); const relative = this.#factoryPath(skillPath); if (await this.#isHiddenReviewPath(relative)) return false; if (await this.#ownedByCode(relative)) return this.#codeSource!.exists(relative); if (this.#localSource && (await this.#localSource.exists(relative))) return true; - return this.#bundledSource.exists(relative); + if (await this.#bundledSource.exists(relative)) return true; + return (await this.#createdSkillAt(relative)) !== undefined; } async stat(skillPath: string): Promise { @@ -297,6 +345,16 @@ export class FactorySkillSource implements SkillSource { modifiedAt: override.updatedAt, }; } + const created = await this.#createdSkillAt(relative); + if (created) { + return { + name: relative, + type: 'directory', + size: 0, + createdAt: created.override.updatedAt, + modifiedAt: created.override.updatedAt, + }; + } return (await this.#layerFor(relative)).stat(relative); } @@ -314,6 +372,11 @@ export class FactorySkillSource implements SkillSource { const relative = this.#factoryPath(skillPath); if (await this.#isHiddenReviewPath(relative)) throw skillSourceEnoent(skillPath); if (relative !== '' && (await this.#ownedByCode(relative))) return this.#codeSource!.readdir(relative); + const created = relative === '' ? undefined : await this.#createdSkillAt(relative); + if (created) { + if (created.file) throw skillSourceEnoent(skillPath); + return this.#createdSkillEntries(relative); + } const [bundledExists, localExists] = await Promise.all([ this.#bundledSource.exists(relative), this.#localSource?.exists(relative) ?? Promise.resolve(false), @@ -321,16 +384,21 @@ export class FactorySkillSource implements SkillSource { if (!bundledExists && !localExists && !(relative === '' && this.#codeSource)) { throw skillSourceEnoent(skillPath); } - const [bundledEntries, localEntries, codeEntries] = await Promise.all([ + const [bundledEntries, localEntries, codeEntries, createdNames] = await Promise.all([ bundledExists ? this.#bundledSource.readdir(relative) : [], localExists ? this.#localSource!.readdir(relative) : [], relative === '' && this.#codeSource ? this.#codeSource.readdir('') : [], + relative === '' ? this.#createdSkillNames() : [], ]); const merged = new Map(); for (const entry of bundledEntries) merged.set(entry.name, entry); // Local entries override bundled names; code skills override both. for (const entry of localEntries) merged.set(entry.name, entry); for (const entry of codeEntries) merged.set(entry.name, entry); + // Created skills only fill names no layer serves a skill under; a stray file of that name doesn't hide one. + for (const name of createdNames) { + if (merged.get(name)?.type !== 'directory') merged.set(name, { name, type: 'directory' }); + } const entries = [...merged.values()]; if (relative !== '' || (await this.isReviewSession())) return entries; return entries.filter(entry => !REVIEW_ONLY_FACTORY_SKILLS.has(entry.name)); @@ -344,13 +412,14 @@ export class FactorySkillSource implements SkillSource { } /** - * Names the Factory mount serves: bundled skills plus the app's code and local skills. - * Repository skills with these names are hidden so they cannot collide with - * Factory's copy. Recomputed per scan so skill refreshes pick up local changes. + * Names the Factory mount serves: bundled skills plus the app's code and local skills and the + * project's created skills. Repository skills with these names are hidden so they cannot collide + * with Factory's copy. Recomputed per scan so skill refreshes pick up local changes. */ async #reservedNames(): Promise> { const reserved = new Set(FACTORY_SKILL_NAMES); for (const entry of (await this.#codeSource?.readdir('')) ?? []) reserved.add(entry.name); + for (const name of await this.#createdSkillNames()) reserved.add(name); if (!this.#localSource) return reserved; try { for (const entry of await this.#localSource.readdir('')) { @@ -1265,7 +1334,13 @@ export function createWorkspaceFactory(options: CreateWorkspaceFactoryOptions = return { revision: snapshot.revision, overrides: new Map( - snapshot.overrides.map(o => [o.skillName, { content: o.content, updatedAt: o.updatedAt }] as const), + snapshot.overrides.map( + o => + [ + o.skillName, + { content: o.content, updatedAt: o.updatedAt, ...(o.kind === 'created' ? { created: true } : {}) }, + ] as const, + ), ), }; })(); diff --git a/packages/cli/src/commands/api/descriptors.test.ts b/packages/cli/src/commands/api/descriptors.test.ts index 64b77cad46a..36f4faeb37b 100644 --- a/packages/cli/src/commands/api/descriptors.test.ts +++ b/packages/cli/src/commands/api/descriptors.test.ts @@ -151,6 +151,7 @@ describe('api command descriptors', () => { factoryBoardDelete: ['boardDelete', ['id', 'boardKey'], true, true, false], factoryBoardReset: ['boardReset', ['id', 'boardKey'], true, true, false], factorySkills: ['skillList', [], true, false, false], + factorySkillCreate: ['skillCreate', ['id'], true, true, false], factorySkillUpdate: ['skillOverrideSave', ['id', 'name'], true, true, false], factorySkillRevert: ['skillOverrideRevert', ['id', 'name'], false, false, false], 'factoryIntake-routeList': ['intakeRouteList', ['id'], true, false, false], diff --git a/packages/cli/src/commands/api/factory-route-metadata.generated.ts b/packages/cli/src/commands/api/factory-route-metadata.generated.ts index c9ef27e8c5b..3d2e09a68ba 100644 --- a/packages/cli/src/commands/api/factory-route-metadata.generated.ts +++ b/packages/cli/src/commands/api/factory-route-metadata.generated.ts @@ -76,7 +76,7 @@ export const FACTORY_API_ROUTE_METADATA = { "contractKey": "skillOverrideRevert", "method": "DELETE", "path": "/web/factory/projects/:id/skills/:name", - "description": "Revert a project's edited Factory skill to its original SKILL.md", + "description": "Revert a project's edited Factory skill to its original SKILL.md, or delete a skill the project created", "pathParams": [ "id", "name" @@ -1111,6 +1111,25 @@ export const FACTORY_API_ROUTE_METADATA = { "kind": "record" } }, + "POST /web/factory/projects/:id/skills": { + "contractKey": "skillCreate", + "method": "POST", + "path": "/web/factory/projects/:id/skills", + "description": "Create a skill for one Factory project", + "pathParams": [ + "id" + ], + "queryParams": [], + "bodyParams": [ + "content", + "name" + ], + "hasQuery": false, + "hasBody": true, + "responseShape": { + "kind": "single" + } + }, "POST /web/factory/projects/:id/work-items": { "contractKey": "workItemCreate", "method": "POST", @@ -1226,7 +1245,7 @@ export const FACTORY_API_ROUTE_METADATA = { "contractKey": "skillOverrideSave", "method": "PUT", "path": "/web/factory/projects/:id/skills/:name", - "description": "Save a project's edited SKILL.md for a Factory skill", + "description": "Save a project's SKILL.md for a Factory skill: an edit of an app skill, or a skill it created", "pathParams": [ "id", "name" @@ -1414,11 +1433,18 @@ export const FACTORY_API_ROUTE_SCHEMAS = { "type": "object", "properties": { "skill": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} + "anyOf": [ + { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + { + "type": "null" + } + ] } }, "required": [ @@ -12538,6 +12564,66 @@ export const FACTORY_API_ROUTE_SCHEMAS = { "additionalProperties": {} } }, + "POST /web/factory/projects/:id/skills": { + "path": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" + } + }, + "required": [ + "id" + ] + }, + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "name": { + "$ref": "#/$defs/__schema0" + }, + "content": { + "$ref": "#/$defs/__schema1" + } + }, + "required": [ + "name", + "content" + ], + "additionalProperties": false, + "$defs": { + "__schema0": { + "type": "string", + "maxLength": 64, + "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" + }, + "__schema1": { + "type": "string", + "minLength": 1, + "maxLength": 200000 + } + } + }, + "response": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "skill": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + } + }, + "required": [ + "skill" + ] + } + }, "POST /web/factory/projects/:id/work-items": { "path": { "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -13359,6 +13445,7 @@ export const FACTORY_API_ROUTE_CATALOG = { "intakeRouteAgain": "POST /web/factory/projects/:id/intake/not-routed/:decisionId/route-again", "intakeTest": "POST /web/factory/projects/:id/intake/test", "workItemStart": "POST /web/factory/projects/:id/runs/start", + "skillCreate": "POST /web/factory/projects/:id/skills", "workItemCreate": "POST /web/factory/projects/:id/work-items", "workItemAutomationRun": "POST /web/factory/projects/:id/work-items/:workItemId/automation-runs", "workItemTransition": "POST /web/factory/projects/:id/work-items/:workItemId/transition", diff --git a/packages/cli/src/commands/api/index.ts b/packages/cli/src/commands/api/index.ts index 7a75ca36e00..2ab6bcc3aea 100644 --- a/packages/cli/src/commands/api/index.ts +++ b/packages/cli/src/commands/api/index.ts @@ -873,9 +873,21 @@ export function registerApiCommand(program: CommanderCommand): void { const factorySkill = factory .command('skill') - .description("Edit a Factory project's skills; organization admins only"); + .description("Create and edit a Factory project's skills; organization admins only"); + addAction(factorySkill, 'create', FACTORY_API_ROUTE_CATALOG.skillCreate, { + description: 'Create a skill for one Factory project; the frontmatter name must match the skill name', + input: 'required', + routePlacement: 'origin', + examples: [ + { + description: 'Create a release-notes skill for one project', + command: `mastra api factory skill create '{"name":"release-notes","content":"---\\nname: release-notes\\ndescription: Write release notes for a merged change\\n---\\n\\n# Release notes\\n"}'`, + }, + ], + }); addAction(factorySkill, 'update', FACTORY_API_ROUTE_CATALOG.skillOverrideSave, { - description: 'Save an edited SKILL.md for one Factory project; the frontmatter name must match the skill name', + description: + 'Save a SKILL.md for one Factory project: an edit of an app skill, or a skill the project created; the frontmatter name must match the skill name', input: 'required', routePlacement: 'origin', examples: [ @@ -886,7 +898,8 @@ export function registerApiCommand(program: CommanderCommand): void { ], }); addAction(factorySkill, 'revert', FACTORY_API_ROUTE_CATALOG.skillOverrideRevert, { - description: "Revert a Factory project's edit so the skill uses its original SKILL.md", + description: + "Revert a Factory project's edit so the skill uses its original SKILL.md, or delete a skill the project created", routePlacement: 'origin', }); From c2fc2fca283eac3e42c022320e6587a959fd66a9 Mon Sep 17 00:00:00 2001 From: "mastra-platform[bot]" <284800079+mastra-platform[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 23:08:59 -0800 Subject: [PATCH 04/10] fix(factory): open the card's session from posted card links (#30666) > Opened by @damien-schneider ## Summary Factory card links that agents post (Slack replies, GitHub comments, tool results like `factory_create_work_item` / `factory_transition_work_item` / `factory_list_work_items`) opened the board with `?item=`. The UI treats that as a highlight on the board list, so people landed on the list and had to find and click the card again to reach its session. `factoryWorkItemUrl()` now builds `/factories//cards/`. That's the route a board click already uses: it redirects to the session the card shows (the current phase's context, otherwise the most recently visited one), or to a draft that starts one if the card has no session yet. The `board` argument is gone because the card route resolves the board on its own. In-app board highlights (`?item=` from the attention list) stay as they are. ## Test plan - `mastracode/factory`: `links.test.ts`, `read-tools.test.ts`, `work-item-tools.test.ts` updated to expect `/cards/`. All 67 pass, and `tsc --noEmit` is clean. - `mastracode/factory-ui`: added a `CardDraftPage` MSW test showing that `/cards/` on a card with triage and work sessions, sitting in Building, redirects to the work session's thread. The file's 12 tests pass. ELI5: When an agent posts a link to a work card, the link now opens that card's work session. Before, it opened the board list. Readers now go straight to the work they need. ## Summary Posted card links now use the card route. `factoryWorkItemUrl()` returns `/factories//cards/`. It no longer returns a board URL with an `?item=` query parameter. The card route resolves the board, so the `board` input is removed from `factoryWorkItemUrl()`. Its signature changes from `{ factoryProjectId, board, workItemId }` to `{ factoryProjectId, workItemId }`. The card route behaves as follows: - It redirects to the session for the card's current phase when one exists. - If not, it redirects to the most recently visited session. - If the card has no sessions, it opens a draft that starts a session. ### Changes by area - **Link generation (`mastracode/factory/src/links.ts`):** Builds card links from the project and work item IDs. The work item ID is URL-encoded. The documentation describes the new routing. - **Callers (`read-tools.ts`, `work-item-tools.ts`):** Stop passing the board key to `factoryWorkItemUrl()`. Board-based stage validation and transitions still use the work item's board. - **Tests (`links.test.ts`, `read-tools.test.ts`, `work-item-tools.test.ts`):** Expect `/cards/` URLs. The no-public-URL case expects `undefined`. - **UI test (`mastracode/factory-ui/src/ui/pages/__tests__/CardDraftPage.msw.test.tsx`):** Adds a test. A card with `triage` and `work` sessions in the `execute` stage redirects to the thread for the `work` session. - **Changeset (`.changeset/card-links-open-session.md`):** Declares a patch release for `@mastra/factory`. Board highlights in the in-app attention list are unchanged. ### Scope 8 files changed, 47 lines added, 21 lines removed. ### Test status The PR author reports these results. This summary does not verify them against completed CI checks on the current head: - `mastracode/factory`: 67 tests pass in the updated files. `tsc --noEmit` is clean. - `mastracode/factory-ui`: 12 tests in `CardDraftPage.msw.test.tsx` pass. ### API impact `factoryWorkItemUrl()` has a breaking signature change for direct callers. The `board` input is removed. The changeset is a patch release. Co-authored-by: mastra-platform[bot] Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> --- .changeset/card-links-open-session.md | 5 ++++ .../__tests__/CardDraftPage.msw.test.tsx | 29 +++++++++++++++++++ mastracode/factory/src/links.test.ts | 6 ++-- mastracode/factory/src/links.ts | 14 ++++----- .../factory/src/tools/read-tools.test.ts | 6 ++-- mastracode/factory/src/tools/read-tools.ts | 1 - .../factory/src/tools/work-item-tools.test.ts | 4 +-- .../factory/src/tools/work-item-tools.ts | 3 -- 8 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 .changeset/card-links-open-session.md diff --git a/.changeset/card-links-open-session.md b/.changeset/card-links-open-session.md new file mode 100644 index 00000000000..2629a17ef6c --- /dev/null +++ b/.changeset/card-links-open-session.md @@ -0,0 +1,5 @@ +--- +'@mastra/factory': patch +--- + +Factory card links that agents post (in Slack threads, GitHub comments and tool results) now open the card's session directly, the same as clicking the card on its board. Before, they opened the board with the card highlighted in the list, so you had to find and click the card again. diff --git a/mastracode/factory-ui/src/ui/pages/__tests__/CardDraftPage.msw.test.tsx b/mastracode/factory-ui/src/ui/pages/__tests__/CardDraftPage.msw.test.tsx index 217eeb7882a..a0a01139f08 100644 --- a/mastracode/factory-ui/src/ui/pages/__tests__/CardDraftPage.msw.test.tsx +++ b/mastracode/factory-ui/src/ui/pages/__tests__/CardDraftPage.msw.test.tsx @@ -63,6 +63,35 @@ function renderAt(path: string) { return { router, ...renderWithProviders(, createQueryClient()) }; } +describe('a card with sessions', () => { + it("opens the thread of the session its current phase runs in, as a chat's link to the card does", async () => { + stubDraftRoute(); + server.use( + http.get(`${TEST_BASE_URL}/web/factory/projects/${FACTORY_ID}/work-items`, () => + HttpResponse.json({ + workItems: [ + { + ...linearCard, + stages: ['execute'], + sessions: { + triage: { sessionId: 'session-triage', threadId: 'thread-triage' }, + work: { sessionId: 'session-work', threadId: 'thread-work' }, + }, + }, + ], + }), + ), + ); + const { router } = renderAt(`/factories/${FACTORY_ID}/cards/${CARD_ID}`); + + await waitFor(() => + expect(router.state.location.pathname).toBe( + `/factories/${FACTORY_ID}/workspaces/session-work/threads/thread-work`, + ), + ); + }); +}); + describe('a card without a session', () => { it('opens on a draft titled after the card that creates nothing until the first prompt', async () => { const route = stubDraftRoute(); diff --git a/mastracode/factory/src/links.test.ts b/mastracode/factory/src/links.test.ts index 9fd23b91c99..5043dbf0702 100644 --- a/mastracode/factory/src/links.test.ts +++ b/mastracode/factory/src/links.test.ts @@ -15,7 +15,7 @@ describe('factory links', () => { it('builds nothing when no public URL is configured', () => { vi.stubEnv('MASTRACODE_PUBLIC_URL', ' '); expect(factoryUiOrigin()).toBeNull(); - expect(factoryWorkItemUrl({ factoryProjectId: 'f', board: 'work', workItemId: 'i' })).toBeUndefined(); + expect(factoryWorkItemUrl({ factoryProjectId: 'f', workItemId: 'i' })).toBeUndefined(); }); it('links boards, cards, sessions, settings and rules', () => { @@ -24,9 +24,7 @@ describe('factory links', () => { // The Review board is retired; a board keyed `review` now is a custom board like any other. expect(factoryBoardUrl('f 1', 'review')).toBe(`${base}/boards/review`); expect(factoryBoardUrl('f 1', 'ops')).toBe(`${base}/boards/ops`); - expect(factoryWorkItemUrl({ factoryProjectId: 'f 1', board: 'work', workItemId: 'i-1' })).toBe( - `${base}/work?item=i-1`, - ); + expect(factoryWorkItemUrl({ factoryProjectId: 'f 1', workItemId: 'i 1' })).toBe(`${base}/cards/i%201`); expect(factorySessionUrl({ factoryProjectId: 'f 1', sessionId: 's', threadId: 't' })).toBe( `${base}/workspaces/s/threads/t`, ); diff --git a/mastracode/factory/src/links.ts b/mastracode/factory/src/links.ts index c3b55ead910..70f81dca6e9 100644 --- a/mastracode/factory/src/links.ts +++ b/mastracode/factory/src/links.ts @@ -25,14 +25,12 @@ export function factoryBoardUrl(factoryProjectId: string, board: string): string return factoryUrl(factoryProjectId, boardSegment(board)); } -/** A card opened on its board. */ -export function factoryWorkItemUrl(input: { - factoryProjectId: string; - board: string; - workItemId: string; -}): string | undefined { - const query = new URLSearchParams({ item: input.workItemId }); - return factoryUrl(input.factoryProjectId, `${boardSegment(input.board)}?${query}`); +/** + * A card, opened as the board opens it on a click: the UI sends the link on to the session the card + * shows (its current phase's, else its last visited one's), or to a draft that starts one. + */ +export function factoryWorkItemUrl(input: { factoryProjectId: string; workItemId: string }): string | undefined { + return factoryUrl(input.factoryProjectId, `/cards/${encodeURIComponent(input.workItemId)}`); } export function factorySessionUrl(input: { diff --git a/mastracode/factory/src/tools/read-tools.test.ts b/mastracode/factory/src/tools/read-tools.test.ts index a26333523e9..7cc892b56ae 100644 --- a/mastracode/factory/src/tools/read-tools.test.ts +++ b/mastracode/factory/src/tools/read-tools.test.ts @@ -246,16 +246,16 @@ describe('factory_list_work_items', () => { expect(result.items.find(row => row.id === 'a')?.number).toBe(12); }); - it('links each card on its board when a public URL is configured', async () => { + it('links each card to the page that opens its session when a public URL is configured', async () => { vi.stubEnv('MASTRACODE_PUBLIC_URL', 'https://factory.example.com'); try { const { run } = setup({ items: rows }); const result = await run<{ items: Array<{ id: string; url: string | null }> }>('factory_list_work_items', {}); expect(result.items.find(row => row.id === 'a')?.url).toBe( - 'https://factory.example.com/factories/project-1/work?item=a', + 'https://factory.example.com/factories/project-1/cards/a', ); expect(result.items.find(row => row.id === 'c')?.url).toBe( - 'https://factory.example.com/factories/project-1/boards/release?item=c', + 'https://factory.example.com/factories/project-1/cards/c', ); } finally { vi.unstubAllEnvs(); diff --git a/mastracode/factory/src/tools/read-tools.ts b/mastracode/factory/src/tools/read-tools.ts index d11749ab36b..2d1720e2222 100644 --- a/mastracode/factory/src/tools/read-tools.ts +++ b/mastracode/factory/src/tools/read-tools.ts @@ -169,7 +169,6 @@ function workItemUrl(item: Card) { return ( factoryWorkItemUrl({ factoryProjectId: item.factoryProjectId, - board: boardForWorkItem(item), workItemId: item.id, }) ?? null ); diff --git a/mastracode/factory/src/tools/work-item-tools.test.ts b/mastracode/factory/src/tools/work-item-tools.test.ts index c6d52fb1758..9de9d8b0fdf 100644 --- a/mastracode/factory/src/tools/work-item-tools.test.ts +++ b/mastracode/factory/src/tools/work-item-tools.test.ts @@ -815,7 +815,7 @@ describe("a card's work requested from a chat", () => { env.run('factory_transition_work_item', { workItem: PULL_REQUEST_URL, stage: 'pr-review', rerun: true }), ).resolves.toMatchObject({ workItemId: card.id, - url: `https://factory.example.com/factories/project-1/work?item=${card.id}`, + url: `https://factory.example.com/factories/project-1/cards/${card.id}`, stage: 'pr-review', reran: true, }); @@ -885,7 +885,7 @@ describe("a card's work requested from a chat", () => { ).resolves.toMatchObject({ workItemId: card.id, status: 'pending', - url: `https://factory.example.com/factories/project-1/work?item=${card.id}`, + url: `https://factory.example.com/factories/project-1/cards/${card.id}`, }); // Who the card's review session reports to when its run ends. diff --git a/mastracode/factory/src/tools/work-item-tools.ts b/mastracode/factory/src/tools/work-item-tools.ts index f3f1f341cf4..8074a59f5f0 100644 --- a/mastracode/factory/src/tools/work-item-tools.ts +++ b/mastracode/factory/src/tools/work-item-tools.ts @@ -72,7 +72,6 @@ function briefItem(item: Card) { url: factoryWorkItemUrl({ factoryProjectId: item.factoryProjectId, - board: boardForWorkItem(item), workItemId: item.id, }) ?? null, }; @@ -166,7 +165,6 @@ export function createFactoryWorkItemTools( url = factoryWorkItemUrl({ factoryProjectId: item.factoryProjectId, - board: boardForWorkItem(item), workItemId: item.id, }) ?? null; await follow(item, 'started'); @@ -287,7 +285,6 @@ export function createFactoryWorkItemTools( const url = factoryWorkItemUrl({ factoryProjectId: item.factoryProjectId, - board: boardForWorkItem(item), workItemId: item.id, }) ?? null; const sameStage = item.stages.length === 1 && item.stages[0] === stage; From 135aa65c3ce5c2afc783616999d4b0a597e2721b Mon Sep 17 00:00:00 2001 From: Eric Pinzur <2641606+epinzur@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:22:26 +0100 Subject: [PATCH 05/10] fix(otel-bridge): deliver logs in apps on OpenTelemetry JS SDK 3 (#30546) ## Description In an app on OpenTelemetry JS SDK 3, `OtelBridge` dropped every Mastra log without an error. Spans were fine. The bridge only looked for the app's global `LoggerProvider` in `@opentelemetry/api-logs`. SDK 3 apps register theirs through `logs` from `@opentelemetry/api` (1.10 and later), and the two registries don't see each other, so the bridge got a no-op proxy. The bridge now checks both registries on each log and each flush and uses whichever holds a registered provider. SDK 2 apps keep working, including when `@opentelemetry/api` 1.10 is installed next to SDK 2. A provider registered after `new OtelBridge()` is picked up too. When nothing is registered anywhere, the bridge says so once at debug level, so a missing registration can be told apart from a bug. ```ts // SDK 3 app import { logs } from '@opentelemetry/api'; logs.setGlobalLoggerProvider(loggerProvider); new OtelBridge(); // before: logs dropped. after: logs reach loggerProvider ``` Passing `new OtelBridge({ loggerProvider })` behaves as before. The four new tests fail with the fix reverted. I also ran the built bridge against the published `@opentelemetry/sdk-logs` 3.1.0 and `@opentelemetry/api` 1.10.0 in a scratch project, and the log arrived whether the provider was registered before or after the bridge was constructed. This does not move the package to SDK 3. That is tracked in #29696. ## Related issue(s) Fixes #29695 ## Type of change - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Test update ## Checklist - [x] I have linked the related issue(s) in the description above - [ ] I have made corresponding changes to the documentation (if applicable) - [x] I have added tests that prove my fix is effective or that my feature works - [ ] I have addressed all Coderabbit comments on this PR --- _Generated by [Claude Code](https://claude.ai/code/session_018e9kMajbtR6UM1nrfYpvGa)_ **ELI5:** Mastra sends its logs through the app's OpenTelemetry setup. On newer OpenTelemetry versions, the app registers its log sender in a different place. Mastra looked only in the old place, so it lost every log. This PR makes Mastra look in both places. ## Summary This PR fixes `@mastra/otel-bridge` so it drops no logs in apps that use OpenTelemetry JS SDK 3. The bridge now finds the global `LoggerProvider` in either registry: - `logs` from `@opentelemetry/api`, used by SDK 3 apps. - `logs` from `@opentelemetry/api-logs`, used by SDK 2 apps. ### Changes - **`observability/otel-bridge/src/bridge.ts`** - Adds `globalLogsApis()`. It reads `logs` from the `@opentelemetry/api` namespace object, not as a named import. This keeps the module linkable on `@opentelemetry/api` versions below 1.10, which do not export `logs`. The `api-logs` registry is always checked too. - Adds `getGlobalLoggerProvider()`. It returns the first provider that is not an unregistered proxy. It also returns whether a provider was registered. The proxy check tests for a `_setDelegate` function. - Adds `resolveLogger()`. When no `loggerProvider` is passed in config, it re-reads the global provider on each log emit. This picks up providers registered after the bridge is constructed. If the provider changes, it rebuilds the logger. - When no provider is registered, `resolveLogger()` writes one debug message. The message is written once per bridge instance. It explains how to register a provider or pass one to `new OtelBridge({ loggerProvider })`. - `flush()` uses the same global lookup for the logger provider when no `loggerProvider` is passed in config. - The constructor uses the same lookup for its initial logger. - An explicit `loggerProvider` in config is unchanged. It is never re-resolved. - **`.changeset/quiet-logs-arrive.md`**: adds a patch changeset for `@mastra/otel-bridge`. - **`observability/otel-bridge/src/bridge.test.ts`**: adds tests. They cover a provider registered through `@opentelemetry/api`, with registration before and after bridge construction. They also cover flushing that provider and the single debug message when no provider is registered. The author reports that four new tests fail with the fix reverted. ### Scope - Only log delivery changes. Span handling is not changed. - The package stays on the SDK 2 line. The move to SDK 3 is tracked separately in `#29696`. - The author reports a scratch-project check with `@opentelemetry/sdk-logs` 3.1.0 and `@opentelemetry/api` 1.10.0. In that check, the log arrived whether registration happened before or after bridge construction. This check was not run in CI as part of this review. Co-authored-by: Claude --- .changeset/quiet-logs-arrive.md | 5 ++ observability/otel-bridge/src/bridge.test.ts | 84 +++++++++++++++++++- observability/otel-bridge/src/bridge.ts | 77 ++++++++++++++++-- 3 files changed, 159 insertions(+), 7 deletions(-) create mode 100644 .changeset/quiet-logs-arrive.md diff --git a/.changeset/quiet-logs-arrive.md b/.changeset/quiet-logs-arrive.md new file mode 100644 index 00000000000..ba86c08b369 --- /dev/null +++ b/.changeset/quiet-logs-arrive.md @@ -0,0 +1,5 @@ +--- +'@mastra/otel-bridge': patch +--- + +Fixed Mastra logs being dropped by `OtelBridge` in apps on OpenTelemetry JS SDK 3. The bridge now finds a `LoggerProvider` registered through `@opentelemetry/api` (SDK 3) as well as one registered through `@opentelemetry/api-logs` (SDK 2), including when it is registered after the bridge is created. When no provider is registered, the bridge now says so once at debug level. Fixes [#29695](https://github.com/mastra-ai/mastra/issues/29695). diff --git a/observability/otel-bridge/src/bridge.test.ts b/observability/otel-bridge/src/bridge.test.ts index 6a622a29f79..c63d1d8fa21 100644 --- a/observability/otel-bridge/src/bridge.test.ts +++ b/observability/otel-bridge/src/bridge.test.ts @@ -15,7 +15,7 @@ import { InternalSpans, SamplingStrategyType, SpanType, TracingEventType } from import { InMemoryStore } from '@mastra/core/storage'; import { createTool } from '@mastra/core/tools'; import { DefaultObservabilityInstance, Observability, TestExporter } from '@mastra/observability'; -import { context, isSpanContextValid, trace } from '@opentelemetry/api'; +import { context, isSpanContextValid, logs as coreLogs, trace } from '@opentelemetry/api'; import { logs as otelLogs, SeverityNumber } from '@opentelemetry/api-logs'; import { InMemoryLogRecordExporter, LoggerProvider, SimpleLogRecordProcessor } from '@opentelemetry/sdk-logs'; import { BasicTracerProvider, InMemorySpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base'; @@ -1010,6 +1010,88 @@ describe('OtelBridge', () => { }); }); + // An app on OpenTelemetry JS SDK 3 registers its LoggerProvider with `logs` + // from `@opentelemetry/api`. That registry is separate from the one in + // `@opentelemetry/api-logs`, which SDK 2 apps use. (#29695) + describe('LoggerProvider registered through @opentelemetry/api', () => { + function makeLogEvent(message: string): LogEvent { + return { type: 'log', log: { logId: 'log-1', timestamp: new Date(), level: 'info', message } }; + } + + function makeProvider() { + const exporter = new InMemoryLogRecordExporter(); + const provider = new LoggerProvider({ processors: [new SimpleLogRecordProcessor({ exporter })] }); + return { exporter, provider }; + } + + /** Runs `fn` with nothing in the api-logs registry, as in an app that only has SDK 3. */ + async function withOnlyCoreRegistry(fn: () => Promise): Promise { + otelLogs.disable(); + try { + await fn(); + } finally { + coreLogs.disable(); + otelLogs.setGlobalLoggerProvider(loggerProvider); + } + } + + it('delivers Mastra logs to the app log exporter (#29695)', async () => { + await withOnlyCoreRegistry(async () => { + const { exporter, provider } = makeProvider(); + coreLogs.setGlobalLoggerProvider(provider); + + const bridge = new OtelBridge(); + await bridge.onLogEvent(makeLogEvent('from an SDK 3 app')); + + expect(exporter.getFinishedLogRecords().map(record => record.body)).toEqual(['from an SDK 3 app']); + await bridge.shutdown(); + }); + }); + + it('delivers Mastra logs when the provider is registered after the bridge is constructed', async () => { + await withOnlyCoreRegistry(async () => { + const bridge = new OtelBridge(); + await bridge.onLogEvent(makeLogEvent('before registration')); + + const { exporter, provider } = makeProvider(); + coreLogs.setGlobalLoggerProvider(provider); + await bridge.onLogEvent(makeLogEvent('after registration')); + + expect(exporter.getFinishedLogRecords().map(record => record.body)).toEqual(['after registration']); + await bridge.shutdown(); + }); + }); + + it('flushes the provider on flush()', async () => { + await withOnlyCoreRegistry(async () => { + const { provider } = makeProvider(); + const forceFlush = vi.spyOn(provider, 'forceFlush'); + coreLogs.setGlobalLoggerProvider(provider); + + const bridge = new OtelBridge(); + await bridge.flush(); + + expect(forceFlush).toHaveBeenCalledTimes(1); + await bridge.shutdown(); + }); + }); + + it('says once at debug level that logs are not exported when no provider is registered anywhere', async () => { + await withOnlyCoreRegistry(async () => { + const debug = vi.fn(); + const bridge = new OtelBridge(); + bridge.__setLogger({ debug, info: vi.fn(), warn: vi.fn(), error: vi.fn() } as any); + + await bridge.onLogEvent(makeLogEvent('dropped')); + await bridge.onLogEvent(makeLogEvent('dropped again')); + + const notes = debug.mock.calls.filter(([message]) => String(message).includes('logger provider')); + expect(notes).toHaveLength(1); + await bridge.shutdown(); + }); + }); + }); + describe('custom providers', () => { it('should use a custom tracerProvider to create spans without touching the global', async () => { trace.disable(); diff --git a/observability/otel-bridge/src/bridge.ts b/observability/otel-bridge/src/bridge.ts index eb4337a0efd..57292ac9fa3 100644 --- a/observability/otel-bridge/src/bridge.ts +++ b/observability/otel-bridge/src/bridge.ts @@ -26,6 +26,7 @@ import { TracingEventType } from '@mastra/core/observability'; import { BaseExporter, getExternalParentId } from '@mastra/observability'; import type { BaseExporterConfig } from '@mastra/observability'; import { SpanConverter, convertLog, getSpanKind } from '@mastra/otel-exporter'; +import * as otelApi from '@opentelemetry/api'; import { trace as otelTrace, context as otelContext, isSpanContextValid, TraceFlags } from '@opentelemetry/api'; import type { Span as OtelSpan, Context as OtelContext, Link, TracerProvider, Tracer } from '@opentelemetry/api'; import { logs as otelLogs } from '@opentelemetry/api-logs'; @@ -43,6 +44,41 @@ function toOtelLinks(links: SpanLink[]): Link[] { .map(context => ({ context })); } +type LogsApi = { getLoggerProvider(): LoggerProvider }; + +/** + * The global logs registries an app can register its LoggerProvider with. + * + * OpenTelemetry JS SDK 3 registers through `logs` from `@opentelemetry/api` + * (1.10 and later). SDK 2 registers through `logs` from `@opentelemetry/api-logs`. + * The two registries do not see each other, so the bridge has to look at both. + * + * `logs` is read off the namespace because `@opentelemetry/api` below 1.10 does + * not export it, and a named import would fail to link there. + */ +function globalLogsApis(): LogsApi[] { + const coreLogs = (otelApi as { logs?: LogsApi }).logs; + return coreLogs ? [coreLogs, otelLogs] : [otelLogs]; +} + +/** With no provider registered, both logs APIs return their own proxy, which drops every record. */ +function isUnregisteredProxy(provider: LoggerProvider): boolean { + return typeof (provider as { _setDelegate?: unknown })._setDelegate === 'function'; +} + +/** + * The LoggerProvider the app registered globally, from whichever registry holds one. + * `registered` is false when neither does, and `provider` is then a no-op proxy. + */ +function getGlobalLoggerProvider(): { provider: LoggerProvider; registered: boolean } { + const apis = globalLogsApis(); + for (const api of apis) { + const provider = api.getLoggerProvider(); + if (!isUnregisteredProxy(provider)) return { provider, registered: true }; + } + return { provider: apis[0]!.getLoggerProvider(), registered: false }; +} + const SETUP_DOCS_URL = 'https://mastra.ai/reference/observability/tracing/bridges/otel#setup-requirements'; export type OtelBridgeConfig = BaseExporterConfig & { @@ -77,6 +113,7 @@ export type OtelBridgeConfig = BaseExporterConfig & { export class OtelBridge extends BaseExporter implements ObservabilityBridge { name = 'otel'; private tracerProvider: TracerProvider; + /** The provider passed in config, or the global one the current `otelLogger` came from. */ private loggerProvider: LoggerProvider; private otelTracer: Tracer; private otelLogger: OtelLogger; @@ -86,6 +123,7 @@ export class OtelBridge extends BaseExporter implements ObservabilityBridge { private hasCustomTracerProvider: boolean; private hasCustomLoggerProvider: boolean; private warnedNoTracerProvider = false; + private notedNoLoggerProvider = false; constructor(config: OtelBridgeConfig = {}) { super(config); @@ -93,10 +131,37 @@ export class OtelBridge extends BaseExporter implements ObservabilityBridge { this.hasCustomLoggerProvider = config.loggerProvider !== undefined; this.tracerProvider = config.tracerProvider ?? otelTrace.getTracerProvider(); this.otelTracer = this.tracerProvider.getTracer('@mastra/otel-bridge', '1.0.0'); - this.loggerProvider = config.loggerProvider ?? otelLogs.getLoggerProvider(); + this.loggerProvider = config.loggerProvider ?? getGlobalLoggerProvider().provider; this.otelLogger = this.loggerProvider.getLogger('@mastra/otel-bridge', '1.0.0'); } + /** + * The logger to emit through. + * + * Without a `loggerProvider` in config, the global provider is looked up on + * every call: the OTEL SDK is often registered after the bridge is constructed, + * and which registry it lands in depends on the SDK line the app is on. + */ + private resolveLogger(): OtelLogger { + if (this.hasCustomLoggerProvider) return this.otelLogger; + + const { provider, registered } = getGlobalLoggerProvider(); + if (provider !== this.loggerProvider) { + this.loggerProvider = provider; + this.otelLogger = provider.getLogger('@mastra/otel-bridge', '1.0.0'); + } + if (!registered && !this.notedNoLoggerProvider) { + this.notedNoLoggerProvider = true; + this.logger.debug( + '[OtelBridge] No OpenTelemetry logger provider is registered globally, so Mastra logs will not be ' + + 'exported through OpenTelemetry. Register one (for example with `logRecordProcessors` on `NodeSDK`, or ' + + '`logs.setGlobalLoggerProvider(provider)`), or pass it directly with `new OtelBridge({ loggerProvider })`. ' + + `See ${SETUP_DOCS_URL}`, + ); + } + return this.otelLogger; + } + /** * Handle Mastra tracing events * @@ -116,7 +181,7 @@ export class OtelBridge extends BaseExporter implements ObservabilityBridge { * * If the user has not registered a LoggerProvider (e.g. via @opentelemetry/sdk-logs * or NodeSDK's logRecordProcessor option), the API returns a no-op logger and - * emit() is a silent no-op — the bridge degrades gracefully. + * emit() is a no-op — the bridge degrades gracefully, with one debug line. * * Trace correlation: * - If the log carries a spanId we have an OTEL span for, emit under that span's @@ -137,7 +202,7 @@ export class OtelBridge extends BaseExporter implements ObservabilityBridge { const logContext = this.resolveLogContext(params.traceId, params.spanId); - this.otelLogger.emit({ + this.resolveLogger().emit({ timestamp: params.timestamp, severityNumber: params.severityNumber, severityText: params.severityText, @@ -475,10 +540,10 @@ export class OtelBridge extends BaseExporter implements ObservabilityBridge { */ async flush(): Promise { // Re-resolve the global providers on every flush: the OTEL SDK is often - // registered after the bridge is constructed, and `otelLogs.getLoggerProvider()` - // only returns the real provider once one has been registered. + // registered after the bridge is constructed, and the logs API only returns + // the real provider once one has been registered. const tracerProvider = this.hasCustomTracerProvider ? this.tracerProvider : otelTrace.getTracerProvider(); - const loggerProvider = this.hasCustomLoggerProvider ? this.loggerProvider : otelLogs.getLoggerProvider(); + const loggerProvider = this.hasCustomLoggerProvider ? this.loggerProvider : getGlobalLoggerProvider().provider; await this.flushProvider(tracerProvider, 'tracer'); await this.flushProvider(loggerProvider, 'logger'); } From 4985b71a20bf569a55dc1fcf1b461a5d8d2e4362 Mon Sep 17 00:00:00 2001 From: "mastra-platform[bot]" <284800079+mastra-platform[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 23:51:12 -0800 Subject: [PATCH 06/10] fix(playground-ui): run CodeDiff lines flush under the file header (#30668) > Opened by @damien-schneider ## What When the Factory changes panel stacks file diffs, a blank band shows below each file's last line and above the next file's first line. `@pierre/diffs` adds 8px of padding above the code, and by default it always keeps room for a horizontal scrollbar under it. The design system's `CodeDiff` places that code on the card fill, so both show up as empty strips. When a `CodeDiff` has a file header, it now sets a `data-header` attribute. A matching rule in `code-diff.css`, next to the other `--diffs-*` overrides, sets two of pierre's variables. pierre doesn't set these itself, so the values reach the diff's shadow DOM: - `--diffs-gap-block: 0px`: no padding above the first line or below the last, and the "N unmodified lines" separators between hunks sit flush too. - `--diffs-overflow-override: auto`: the horizontal scrollbar only takes room when lines overflow. Platforms with overlay scrollbars, like macOS, reserve no room for it. A `CodeDiff` without a header keeps its padding. That case is the standalone diff in the observation detail view. ## Test plan - [x] `vitest run src/ds/components/CodeDiff`: 6/6 pass - [x] `oxlint` and `prettier --check` pass on the changed files - [x] Storybook `Elements/CodeDiff` in Chromium with real scrollbars. File list: 0px top and bottom padding and no scrollbar strip, where before there was 8px of padding plus a 15px strip under every file. A multi-hunk diff with overflowing lines: flush lines and separators, with a scrollbar only on the diff that overflows. A diff without a header keeps its 8px padding. - [ ] Full `tsc` for `playground-ui` didn't finish in the sandbox. The TSX change only adds a `data-header` attribute. ELI5: When a code diff has a file name bar on top, the diff used to have empty gaps. This change removes the gap under the bar. It also makes the horizontal scrollbar appear only when the code is too wide. ## Summary This change adjusts `CodeDiff` layout when a file header is present. The outer container gets a `data-header` attribute. A CSS rule for that attribute sets the block gap to `0px` and sets overflow to `auto`. Diffs without a header are unchanged. A patch changeset for `@mastra/playground-ui` documents the change. ## Changes - `packages/playground-ui/src/ds/components/CodeDiff/code-diff.tsx` (+5/-1): The root `div` sets `data-header` to an empty string when `header` is provided. It sets the attribute to `undefined` otherwise. The `ref` and class names are unchanged. - `packages/playground-ui/src/ds/components/CodeDiff/code-diff.css` (+7): Adds a comment and a `.code-diff[data-header]` rule. The rule sets `--diffs-gap-block: 0px` and `--diffs-overflow-override: auto`. - `.changeset/flush-diff-lines.md` (+5): Adds a patch entry for `@mastra/playground-ui`. It states that headered diffs have no blank band above the first line or below the last. It also states that the horizontal scrollbar takes space only when lines overflow. ## Notes - The diff does not set `padding-block: 0`, `scrollbar-width: thin`, or any shadow-root selector. The PR objectives describe these, but the diff does not contain them. This summary follows the diff. - No exported or public declarations changed. - Totals: 3 files changed, 17 lines added, 1 line removed. - The PR objectives report that `vitest run src/ds/components/CodeDiff` passed (6/6) and that `oxlint` and `prettier --check` passed. They also report that full `tsc` did not finish. These results come from the PR description. They were not re-run here. --------- Co-authored-by: mastra-platform[bot] Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> --- .changeset/flush-diff-lines.md | 5 +++++ .../playground-ui/src/ds/components/CodeDiff/code-diff.css | 7 +++++++ .../playground-ui/src/ds/components/CodeDiff/code-diff.tsx | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .changeset/flush-diff-lines.md diff --git a/.changeset/flush-diff-lines.md b/.changeset/flush-diff-lines.md new file mode 100644 index 00000000000..c4411d48629 --- /dev/null +++ b/.changeset/flush-diff-lines.md @@ -0,0 +1,5 @@ +--- +'@mastra/playground-ui': patch +--- + +`CodeDiff` with a file header now shows its lines flush against the header and the card's bottom edge, so stacked diffs in a `CodeDiffList` read like a pull request with no blank band above the first line or below the last. The horizontal scrollbar only takes room when lines overflow, and none on platforms with overlay scrollbars. Diffs without a header keep their padding. diff --git a/packages/playground-ui/src/ds/components/CodeDiff/code-diff.css b/packages/playground-ui/src/ds/components/CodeDiff/code-diff.css index f7ddb710e59..e1a83211f0d 100644 --- a/packages/playground-ui/src/ds/components/CodeDiff/code-diff.css +++ b/packages/playground-ui/src/ds/components/CodeDiff/code-diff.css @@ -12,3 +12,10 @@ --diffs-bg-separator-override: var(--muted); --diffs-fg-number-override: var(--placeholder); } + +/* Under a file header the lines run flush from the header to the card's bottom edge, like a pull request. + The horizontal scrollbar only takes room when lines overflow. */ +.code-diff[data-header] { + --diffs-gap-block: 0px; + --diffs-overflow-override: auto; +} diff --git a/packages/playground-ui/src/ds/components/CodeDiff/code-diff.tsx b/packages/playground-ui/src/ds/components/CodeDiff/code-diff.tsx index 69ebe8f8d51..f469a21ce05 100644 --- a/packages/playground-ui/src/ds/components/CodeDiff/code-diff.tsx +++ b/packages/playground-ui/src/ds/components/CodeDiff/code-diff.tsx @@ -97,7 +97,11 @@ export function CodeDiff({ className, layout, overflow = 'wrap', header, ref, .. }; return ( -
+
{header ? ( Date: Mon, 16 Nov 2026 23:52:44 -0800 Subject: [PATCH 07/10] fix(factory-ui): show notification summaries as a readable inline line (#30662) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > Opened by @damien-schneider ## Description When pending notifications are rolled into a summary, Factory chat showed them as a row labeled "Notification summary" followed by the raw summary text, e.g. `factory-session: 1`. The row also used the padded, caption-sized activity style. It sat between inline signal lines like "Factory sessions snapshot", so it looked out of place and read like debug output. The summary now renders like those inline lines and is built from the structured fields every summary carries (`pending`, `bySource`, `byPriority`): - **Label and count:** "Notifications" followed by "1 new" / "4 new". - **Sources:** one badge per source. With a single source it shows just the name (`Factory session`). With several, each badge has its count (`GitHub 3`, `My webhook 1`). - **Source names:** a small map gives readable names for known sources (`factory-session`, `github`, `gitlab`, `linear`, `jira`, `slack`). Any other source shows its id in sentence case (`my-webhook` → "My webhook"), so new sources need no code change. - **Priority:** the bell is tinted only when something high or urgent is pending. - **Fallback:** a summary with no counts shows its original text. The change is limited to `NotificationSummaryCard` in factory-ui. The shared `NotificationActivity` component and individual notification rows are unchanged. ## Test plan - `TranscriptNotifications.msw.test.tsx` covers a single Factory session summary (no raw `factory-session: 1` text), several sources including an unmapped one, and the fallback with no counts. - `pnpm typecheck`, oxlint and prettier pass on factory-ui. ELI5: When many alerts are waiting, the app used to show a plain block of raw text. Now it shows one short line that says how many are new and where they came from. ## Summary This PR changes how `NotificationSummaryCard` renders notification summaries in factory-ui. The card now shows an inline activity line instead of a padded row with raw summary text. ### Changes **`TranscriptNotifications.tsx`** (+47/-2) - Replaces the `NotificationActivity` call in `NotificationSummaryCard` with an `Activity` line. The line contains a bell icon, a "Notifications" label, and a status label. - Shows `" new"` when `pending > 0` and at least one source has a count above zero. Otherwise, shows `entry.message`. - Adds one `Badge` per source with a positive count. With one source, the badge shows the source name. With several sources, the badge shows the name and count, for example `GitHub 3`. - Tints the bell only when `byPriority` has an `urgent` or `high` count above zero. - Adds a `NOTIFICATION_SOURCE_NAMES` map for `factory-session`, `github`, `gitlab`, `linear`, `jira`, and `slack`. - Adds exported `notificationSourceName(source: string): string`. It returns the mapped name for a known source. For an unknown source, it replaces `-` and `_` with spaces and applies sentence case. An empty ID is returned unchanged. - Adds an own-key check when it looks up source names. IDs such as `__proto__` do not match inherited object properties. These IDs use the sentence-case fallback, so the component does not render an invalid React child. - Imports the `Activity`, `ActivityHeader`, `ActivityIcon`, and `ActivityLabel` primitives and `Badge`. **`TranscriptNotifications.msw.test.tsx`** (+67/-9) - Replaces the test that checked for the summary under its own label. - Adds a test for one pending `factory-session` notification. It checks for `Notifications`, `1 new`, and `Factory session`. It checks that the raw `factory-session: 1` text and any button are absent. - Adds a test for multiple sources, including an unnamed source. It checks the total and the per-source counts. - Adds a test for a summary with no counts. It checks that the summary message is shown. - Adds a test that a source named `__proto__` displays as `Proto`. ### Scope - The shared `NotificationActivity` component is not changed by this diff. - Individual notification rows are not changed by this diff. - The diff touches only these two files under `mastracode/factory-ui/`. ### Verification - The PR author reports that `pnpm typecheck`, oxlint, and prettier pass on factory-ui. These results were not re-run for this summary. - The new tests exist in the diff. Their pass or fail status was not checked. --------- Co-authored-by: mastra-platform[bot] Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> --- .../components/TranscriptNotifications.tsx | 49 +++++++++++- .../TranscriptNotifications.msw.test.tsx | 76 ++++++++++++++++--- 2 files changed, 114 insertions(+), 11 deletions(-) diff --git a/mastracode/factory-ui/src/ui/domains/chat/components/TranscriptNotifications.tsx b/mastracode/factory-ui/src/ui/domains/chat/components/TranscriptNotifications.tsx index 4e3daecbbb1..3797602c7b4 100644 --- a/mastracode/factory-ui/src/ui/domains/chat/components/TranscriptNotifications.tsx +++ b/mastracode/factory-ui/src/ui/domains/chat/components/TranscriptNotifications.tsx @@ -1,4 +1,11 @@ -import { NotificationActivity } from '@mastra/playground-ui/components/ai/activity'; +import { + Activity, + ActivityHeader, + ActivityIcon, + ActivityLabel, + NotificationActivity, +} from '@mastra/playground-ui/components/ai/activity'; +import { Badge } from '@mastra/playground-ui/components/Badge'; import { Button } from '@mastra/playground-ui/components/Button'; import { Txt } from '@mastra/playground-ui/components/Txt'; import { cn } from '@mastra/playground-ui/utils/cn'; @@ -162,8 +169,46 @@ function WaitingSessionActions({ factoryId, waiting }: { factoryId: string; wait ); } +const NOTIFICATION_SOURCE_NAMES: Record = { + 'factory-session': 'Factory session', + github: 'GitHub', + gitlab: 'GitLab', + linear: 'Linear', + jira: 'Jira', + slack: 'Slack', +}; + +/** A readable name for a notification source; unknown sources fall back to their id in sentence case. */ +export function notificationSourceName(source: string): string { + if (Object.hasOwn(NOTIFICATION_SOURCE_NAMES, source)) return NOTIFICATION_SOURCE_NAMES[source]; + const words = source.replace(/[-_]+/g, ' ').trim(); + return words ? words.charAt(0).toUpperCase() + words.slice(1) : source; +} + export function NotificationSummaryCard({ entry }: { entry: NotificationSummaryEntry }) { - return ; + const sources = Object.entries(entry.bySource).filter(([, count]) => count > 0); + const counted = entry.pending > 0 && sources.length > 0; + const urgent = (entry.byPriority.urgent ?? 0) > 0 || (entry.byPriority.high ?? 0) > 0; + + return ( + + + + + + Notifications + + {counted ? `${entry.pending} new` : entry.message} + + {counted && + sources.map(([source, count]) => ( + + {sources.length > 1 ? `${notificationSourceName(source)} ${count}` : notificationSourceName(source)} + + ))} + + + ); } export function notificationMetadata(entry: MessageEntry): Array { diff --git a/mastracode/factory-ui/src/ui/domains/chat/components/__tests__/TranscriptNotifications.msw.test.tsx b/mastracode/factory-ui/src/ui/domains/chat/components/__tests__/TranscriptNotifications.msw.test.tsx index f84f8327594..7196cd9da9e 100644 --- a/mastracode/factory-ui/src/ui/domains/chat/components/__tests__/TranscriptNotifications.msw.test.tsx +++ b/mastracode/factory-ui/src/ui/domains/chat/components/__tests__/TranscriptNotifications.msw.test.tsx @@ -56,22 +56,80 @@ describe('Transcript notifications', () => { }); describe('when pending notifications are summarized', () => { - it('puts the summary in the transcript under its own label', () => { + it('says how many are new and names their source', () => { renderEntries([ { kind: 'notification_summary', id: 'summary', - message: '2 pull requests and 1 issue need attention.', - pending: 3, - bySource: { github: 3 }, - byPriority: { high: 3 }, - notificationIds: ['1', '2', '3'], + message: 'factory-session: 1', + pending: 1, + bySource: { 'factory-session': 1 }, + byPriority: { low: 1 }, + notificationIds: ['1'], }, ]); - const notification = within(screen.getByRole('group', { name: 'Notification: Notification summary' })); - expect(notification.getByText('2 pull requests and 1 issue need attention.')).toBeVisible(); - expect(notification.queryByRole('button')).not.toBeInTheDocument(); + const summary = screen.getByRole('group', { name: 'Notification summary' }); + expect(summary).toHaveAttribute('data-notification-state', 'summary'); + expect(within(summary).getByText('Notifications')).toBeVisible(); + expect(within(summary).getByText('1 new')).toBeVisible(); + expect(within(summary).getByText('Factory session')).toBeVisible(); + expect(within(summary).queryByText('factory-session: 1')).not.toBeInTheDocument(); + expect(within(summary).queryByRole('button')).not.toBeInTheDocument(); + }); + + it('counts each source when several are pending, including ones it has no name for', () => { + renderEntries([ + { + kind: 'notification_summary', + id: 'summary', + message: 'github: 3, my-webhook: 1', + pending: 4, + bySource: { github: 3, 'my-webhook': 1 }, + byPriority: { high: 3, low: 1 }, + notificationIds: ['1', '2', '3', '4'], + }, + ]); + + const summary = within(screen.getByRole('group', { name: 'Notification summary' })); + expect(summary.getByText('4 new')).toBeVisible(); + expect(summary.getByText('GitHub 3')).toBeVisible(); + expect(summary.getByText('My webhook 1')).toBeVisible(); + }); + + it('falls back to the summary text when it carries no counts', () => { + renderEntries([ + { + kind: 'notification_summary', + id: 'summary', + message: 'No pending notifications', + pending: 0, + bySource: {}, + byPriority: {}, + notificationIds: [], + }, + ]); + + const summary = within(screen.getByRole('group', { name: 'Notification summary' })); + expect(summary.getByText('No pending notifications')).toBeVisible(); + }); + + it('names a source that collides with a built-in object key from its id', () => { + renderEntries([ + { + kind: 'notification_summary', + id: 'summary', + message: '__proto__: 1', + pending: 1, + bySource: JSON.parse('{"__proto__": 1}') as Record, + byPriority: { low: 1 }, + notificationIds: ['1'], + }, + ]); + + const summary = within(screen.getByRole('group', { name: 'Notification summary' })); + expect(summary.getByText('1 new')).toBeVisible(); + expect(summary.getByText('Proto')).toBeVisible(); }); }); }); From cf6f1b04595c8ab3f899cdbbd615d92c3a68e04b Mon Sep 17 00:00:00 2001 From: "mastra-platform[bot]" <284800079+mastra-platform[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:58:25 +0100 Subject: [PATCH 08/10] docs(otel): sort vendors alphabetically on OpenTelemetry integration page (#30670) --- .../observability/opentelemetry.mdx | 516 +++++++++--------- 1 file changed, 258 insertions(+), 258 deletions(-) diff --git a/docs/src/content/en/integrations/observability/opentelemetry.mdx b/docs/src/content/en/integrations/observability/opentelemetry.mdx index d2527be1ca8..3c72c571eda 100644 --- a/docs/src/content/en/integrations/observability/opentelemetry.mdx +++ b/docs/src/content/en/integrations/observability/opentelemetry.mdx @@ -13,13 +13,13 @@ Mastra supports OpenTelemetry (OTEL) through an exporter for sending traces and ## Exporter -The OpenTelemetry exporter sends your traces and logs using standardized [OpenTelemetry Semantic Conventions for GenAI](https://opentelemetry.io/docs/specs/semconv/gen-ai/). This ensures broad compatibility with platforms like Datadog, New Relic, Sentry, SigNoz, MLflow, Latitude, Dash0, Traceloop, Laminar, telemetry.dev, Sazabi, Agnost AI, and more. +The OpenTelemetry exporter sends your traces and logs using standardized [OpenTelemetry Semantic Conventions for GenAI](https://opentelemetry.io/docs/specs/semconv/gen-ai/). This ensures broad compatibility with platforms like Agnost AI, Dash0, Datadog, Laminar, Latitude, MLflow, New Relic, Sazabi, Sentry, SigNoz, telemetry.dev, Traceloop, and more. ### Installation Each provider requires specific protocol packages. Install the base exporter plus the protocol package for your provider: -#### For HTTP/Protobuf providers (SigNoz, New Relic, Sentry, Laminar, MLflow, Latitude, telemetry.dev, Agnost AI) +#### For HTTP/Protobuf providers (Agnost AI, Laminar, Latitude, MLflow, New Relic, Sentry, SigNoz, telemetry.dev) ```bash npm2yarn npm install @mastra/otel-exporter@latest @opentelemetry/exporter-trace-otlp-proto @@ -31,7 +31,7 @@ npm install @mastra/otel-exporter@latest @opentelemetry/exporter-trace-otlp-prot npm install @mastra/otel-exporter@latest @opentelemetry/exporter-trace-otlp-grpc @grpc/grpc-js ``` -#### For HTTP/JSON providers (Traceloop, Sazabi) +#### For HTTP/JSON providers (Sazabi, Traceloop) ```bash npm2yarn npm install @mastra/otel-exporter@latest @opentelemetry/exporter-trace-otlp-http @@ -44,129 +44,13 @@ All providers support zero-config setup via environment variables. Set the appro | Provider | Environment Variables | | - | - | | Dash0 | `DASH0_API_KEY` (required), `DASH0_ENDPOINT` (required), `DASH0_DATASET` (optional) | -| SigNoz | `SIGNOZ_API_KEY` (required), `SIGNOZ_REGION` (optional), `SIGNOZ_ENDPOINT` (optional) | -| New Relic | `NEW_RELIC_LICENSE_KEY` (required), `NEW_RELIC_ENDPOINT` (optional) | -| Traceloop | `TRACELOOP_API_KEY` (required), `TRACELOOP_DESTINATION_ID`, `TRACELOOP_ENDPOINT` (optional) | | Laminar | `LMNR_PROJECT_API_KEY` (required), `LAMINAR_ENDPOINT` (optional) | +| New Relic | `NEW_RELIC_LICENSE_KEY` (required), `NEW_RELIC_ENDPOINT` (optional) | +| SigNoz | `SIGNOZ_API_KEY` (required), `SIGNOZ_REGION` (optional), `SIGNOZ_ENDPOINT` (optional) | +| Traceloop | `TRACELOOP_API_KEY` (required), `TRACELOOP_DESTINATION_ID`, `TRACELOOP_ENDPOINT` (optional) | ### Provider configurations -#### Sentry - -[Sentry](https://sentry.io/) accepts OpenTelemetry traces and logs through its OTLP endpoints. In Sentry, open [**Project Settings** > **Client Keys (DSN)**](https://sentry.io/settings/projects/) and copy the OTLP traces endpoint and authentication header. Add both values to your environment: - -```bash title=".env" -SENTRY_OTLP_ENDPOINT=https://o000000.ingest.sentry.io/api/0000000/integration/otlp/v1/traces -SENTRY_OTLP_AUTH_HEADER="sentry sentry_key=..." -``` - -Use the `custom` provider with HTTP/Protobuf: - -```typescript title="src/mastra/index.ts" -new OtelExporter({ - provider: { - custom: { - endpoint: process.env.SENTRY_OTLP_ENDPOINT!, - protocol: 'http/protobuf', - headers: { - 'x-sentry-auth': process.env.SENTRY_OTLP_AUTH_HEADER!, - }, - }, - }, -}) -``` - -See [Sentry's OTLP documentation](https://docs.sentry.io/concepts/otlp/) for endpoint setup, supported signals, and current ingestion limits. - -Choose an exporter based on your setup: - -- `OtelExporter`: Sends vendor-neutral traces and logs over OTLP. Use it with an existing OpenTelemetry pipeline or when you want backend portability. -- [`SentryExporter`](/integrations/observability/sentry): Uses the Sentry SDK to map Mastra span types to Sentry operations, add AI monitoring attributes, and capture span errors as Sentry issues. - -#### MLflow - -[MLflow](https://mlflow.org/docs/latest/genai/tracing/integrations/listing/mastra) supports native Mastra tracing through its OTLP endpoint at `/v1/traces`. Use the `custom` provider with HTTP/Protobuf and include the experiment header so traces are routed to the correct MLflow experiment: - -```typescript title="src/mastra/index.ts" -new OtelExporter({ - provider: { - custom: { - endpoint: `${process.env.MLFLOW_TRACKING_URI}/v1/traces`, - protocol: 'http/protobuf', - headers: { - 'x-mlflow-experiment-id': process.env.MLFLOW_EXPERIMENT_ID, - }, - }, - }, -}) -``` - -#### Latitude - -[Latitude](https://latitude.so) is an open-source LLM observability and evaluation platform that ingests OTLP traces. Use the `custom` provider with HTTP/Protobuf, pointing at Latitude's ingestion endpoint and authenticating with your API key and project slug: - -```typescript title="src/mastra/index.ts" -new OtelExporter({ - provider: { - custom: { - endpoint: 'https://ingest.latitude.so/v1/traces', - protocol: 'http/protobuf', - headers: { - Authorization: `Bearer ${process.env.LATITUDE_API_KEY}`, - 'X-Latitude-Project': process.env.LATITUDE_PROJECT, - }, - }, - }, -}) -``` - -Sign up at [console.latitude.so](https://console.latitude.so/login), or self-host and point the endpoint at your own ingestion host. - -#### telemetry.dev - -[telemetry.dev](https://telemetry.dev) ingests OTLP/HTTP protobuf traces and normalizes OpenTelemetry GenAI semantic conventions into model, provider, token, latency, and cost fields. Use the `custom` provider with your project API key: - -```bash title=".env" -TELEMETRY_DEV_API_KEY=td_live_... -``` - -```typescript title="src/mastra/index.ts" -new OtelExporter({ - provider: { - custom: { - endpoint: 'https://ingest.telemetry.dev/v1/traces', - protocol: 'http/protobuf', - headers: { - Authorization: `Bearer ${process.env.TELEMETRY_DEV_API_KEY}`, - }, - }, - }, -}) -``` - -#### Sazabi - -[Sazabi](https://sazabi.com) is an AI-native observability platform that ingests OTLP traces. In Sazabi, add a Mastra log source and copy its intake URL. The URL carries your project key, so no auth header is needed: - -```bash title=".env" -SAZABI_INTAKE_URL=https://... -``` - -Use the `custom` provider with HTTP/JSON: - -```typescript title="src/mastra/index.ts" -new OtelExporter({ - provider: { - custom: { - endpoint: process.env.SAZABI_INTAKE_URL!, - protocol: 'http/json', - }, - }, -}) -``` - -See [Sazabi's Mastra guide](https://docs.sazabi.com/catalogs/log-sources/send-to-an-endpoint/mastra) for the full setup. - #### Agnost AI [Agnost AI](https://agnost.ai) ingests OTLP/HTTP protobuf traces and groups them into conversations and users for production agent monitoring. Use the `custom` provider with your organization ID: @@ -265,138 +149,6 @@ Get your Dash0 endpoint from your dashboard. It should be in the format `ingress ::: -#### `SigNoz` - -[SigNoz](https://signoz.io/) is an open-source APM alternative with built-in Tracing support. - -##### Zero-Config Setup - -```bash title=".env" -# Required -SIGNOZ_API_KEY=your-api-key - -# Optional -SIGNOZ_REGION=us # 'us' | 'eu' | 'in' -SIGNOZ_ENDPOINT=https://my-signoz.example.com # For self-hosted -``` - -```typescript title="src/mastra/index.ts" -new OtelExporter({ provider: { signoz: {} } }) -``` - -##### Explicit Configuration - -```typescript title="src/mastra/index.ts" -new OtelExporter({ - provider: { - signoz: { - apiKey: process.env.SIGNOZ_API_KEY, - region: 'us', // 'us' | 'eu' | 'in' - // endpoint: 'https://my-signoz.example.com', // For self-hosted - }, - }, -}) -``` - -#### New Relic - -[New Relic](https://newrelic.com/) provides complete observability with AI monitoring capabilities. - -##### Zero-Config Setup - -```bash title=".env" -# Required -NEW_RELIC_LICENSE_KEY=your-license-key - -# Optional -NEW_RELIC_ENDPOINT=https://otlp.eu01.nr-data.net # For EU region -``` - -```typescript title="src/mastra/index.ts" -new OtelExporter({ provider: { newrelic: {} } }) -``` - -##### Explicit Configuration - -```typescript title="src/mastra/index.ts" -new OtelExporter({ - provider: { - newrelic: { - apiKey: process.env.NEW_RELIC_LICENSE_KEY, - // endpoint: 'https://otlp.eu01.nr-data.net', // For EU region - }, - }, -}) -``` - -#### Traceloop - -[Traceloop](https://www.traceloop.com/) specializes in LLM observability with automatic prompt tracking. - -##### Zero-Config Setup - -```bash title=".env" -# Required -TRACELOOP_API_KEY=your-api-key - -# Optional -TRACELOOP_DESTINATION_ID=my-destination -TRACELOOP_ENDPOINT=https://custom.traceloop.com -``` - -```typescript title="src/mastra/index.ts" -new OtelExporter({ provider: { traceloop: {} } }) -``` - -##### Explicit Configuration - -```typescript title="src/mastra/index.ts" -new OtelExporter({ - provider: { - traceloop: { - apiKey: process.env.TRACELOOP_API_KEY, - destinationId: 'my-destination', // Optional - }, - }, -}) -``` - -#### Laminar - -[Laminar](https://laminar.sh/) provides specialized LLM observability and analytics. - -##### Zero-Config Setup - -```bash title=".env" -# Required -LMNR_PROJECT_API_KEY=your-api-key - -# Optional -LAMINAR_ENDPOINT=https://api.lmnr.ai/v1/traces -``` - -```typescript title="src/mastra/index.ts" -new OtelExporter({ provider: { laminar: {} } }) -``` - -##### Explicit Configuration - -```typescript title="src/mastra/index.ts" -new OtelExporter({ - provider: { - laminar: { - apiKey: process.env.LMNR_PROJECT_API_KEY, - }, - }, -}) -``` - -:::tip Laminar-Native Exporter - -For Laminar-specific features like native span paths, metadata, and tags rendering in the Laminar dashboard, consider using the dedicated [`@mastra/laminar`](/integrations/observability/laminar) exporter instead. It provides optimized integration with Laminar's platform. - -::: - #### Datadog [Datadog](https://www.datadoghq.com/) APM provides application performance monitoring with distributed tracing. To send traces to Datadog via OTLP, you need the Datadog Agent running with OTLP ingestion enabled. @@ -465,6 +217,254 @@ For Datadog-specific features like automatic span type mapping, LLM span categor ::: +#### Laminar + +[Laminar](https://laminar.sh/) provides specialized LLM observability and analytics. + +##### Zero-Config Setup + +```bash title=".env" +# Required +LMNR_PROJECT_API_KEY=your-api-key + +# Optional +LAMINAR_ENDPOINT=https://api.lmnr.ai/v1/traces +``` + +```typescript title="src/mastra/index.ts" +new OtelExporter({ provider: { laminar: {} } }) +``` + +##### Explicit Configuration + +```typescript title="src/mastra/index.ts" +new OtelExporter({ + provider: { + laminar: { + apiKey: process.env.LMNR_PROJECT_API_KEY, + }, + }, +}) +``` + +:::tip Laminar-Native Exporter + +For Laminar-specific features like native span paths, metadata, and tags rendering in the Laminar dashboard, consider using the dedicated [`@mastra/laminar`](/integrations/observability/laminar) exporter instead. It provides optimized integration with Laminar's platform. + +::: + +#### Latitude + +[Latitude](https://latitude.so) is an open-source LLM observability and evaluation platform that ingests OTLP traces. Use the `custom` provider with HTTP/Protobuf, pointing at Latitude's ingestion endpoint and authenticating with your API key and project slug: + +```typescript title="src/mastra/index.ts" +new OtelExporter({ + provider: { + custom: { + endpoint: 'https://ingest.latitude.so/v1/traces', + protocol: 'http/protobuf', + headers: { + Authorization: `Bearer ${process.env.LATITUDE_API_KEY}`, + 'X-Latitude-Project': process.env.LATITUDE_PROJECT, + }, + }, + }, +}) +``` + +Sign up at [console.latitude.so](https://console.latitude.so/login), or self-host and point the endpoint at your own ingestion host. + +#### MLflow + +[MLflow](https://mlflow.org/docs/latest/genai/tracing/integrations/listing/mastra) supports native Mastra tracing through its OTLP endpoint at `/v1/traces`. Use the `custom` provider with HTTP/Protobuf and include the experiment header so traces are routed to the correct MLflow experiment: + +```typescript title="src/mastra/index.ts" +new OtelExporter({ + provider: { + custom: { + endpoint: `${process.env.MLFLOW_TRACKING_URI}/v1/traces`, + protocol: 'http/protobuf', + headers: { + 'x-mlflow-experiment-id': process.env.MLFLOW_EXPERIMENT_ID, + }, + }, + }, +}) +``` + +#### New Relic + +[New Relic](https://newrelic.com/) provides complete observability with AI monitoring capabilities. + +##### Zero-Config Setup + +```bash title=".env" +# Required +NEW_RELIC_LICENSE_KEY=your-license-key + +# Optional +NEW_RELIC_ENDPOINT=https://otlp.eu01.nr-data.net # For EU region +``` + +```typescript title="src/mastra/index.ts" +new OtelExporter({ provider: { newrelic: {} } }) +``` + +##### Explicit Configuration + +```typescript title="src/mastra/index.ts" +new OtelExporter({ + provider: { + newrelic: { + apiKey: process.env.NEW_RELIC_LICENSE_KEY, + // endpoint: 'https://otlp.eu01.nr-data.net', // For EU region + }, + }, +}) +``` + +#### Sazabi + +[Sazabi](https://sazabi.com) is an AI-native observability platform that ingests OTLP traces. In Sazabi, add a Mastra log source and copy its intake URL. The URL carries your project key, so no auth header is needed: + +```bash title=".env" +SAZABI_INTAKE_URL=https://... +``` + +Use the `custom` provider with HTTP/JSON: + +```typescript title="src/mastra/index.ts" +new OtelExporter({ + provider: { + custom: { + endpoint: process.env.SAZABI_INTAKE_URL!, + protocol: 'http/json', + }, + }, +}) +``` + +See [Sazabi's Mastra guide](https://docs.sazabi.com/catalogs/log-sources/send-to-an-endpoint/mastra) for the full setup. + +#### Sentry + +[Sentry](https://sentry.io/) accepts OpenTelemetry traces and logs through its OTLP endpoints. In Sentry, open [**Project Settings** > **Client Keys (DSN)**](https://sentry.io/settings/projects/) and copy the OTLP traces endpoint and authentication header. Add both values to your environment: + +```bash title=".env" +SENTRY_OTLP_ENDPOINT=https://o000000.ingest.sentry.io/api/0000000/integration/otlp/v1/traces +SENTRY_OTLP_AUTH_HEADER="sentry sentry_key=..." +``` + +Use the `custom` provider with HTTP/Protobuf: + +```typescript title="src/mastra/index.ts" +new OtelExporter({ + provider: { + custom: { + endpoint: process.env.SENTRY_OTLP_ENDPOINT!, + protocol: 'http/protobuf', + headers: { + 'x-sentry-auth': process.env.SENTRY_OTLP_AUTH_HEADER!, + }, + }, + }, +}) +``` + +See [Sentry's OTLP documentation](https://docs.sentry.io/concepts/otlp/) for endpoint setup, supported signals, and current ingestion limits. + +Choose an exporter based on your setup: + +- `OtelExporter`: Sends vendor-neutral traces and logs over OTLP. Use it with an existing OpenTelemetry pipeline or when you want backend portability. +- [`SentryExporter`](/integrations/observability/sentry): Uses the Sentry SDK to map Mastra span types to Sentry operations, add AI monitoring attributes, and capture span errors as Sentry issues. + +#### SigNoz + +[SigNoz](https://signoz.io/) is an open-source APM alternative with built-in Tracing support. + +##### Zero-Config Setup + +```bash title=".env" +# Required +SIGNOZ_API_KEY=your-api-key + +# Optional +SIGNOZ_REGION=us # 'us' | 'eu' | 'in' +SIGNOZ_ENDPOINT=https://my-signoz.example.com # For self-hosted +``` + +```typescript title="src/mastra/index.ts" +new OtelExporter({ provider: { signoz: {} } }) +``` + +##### Explicit Configuration + +```typescript title="src/mastra/index.ts" +new OtelExporter({ + provider: { + signoz: { + apiKey: process.env.SIGNOZ_API_KEY, + region: 'us', // 'us' | 'eu' | 'in' + // endpoint: 'https://my-signoz.example.com', // For self-hosted + }, + }, +}) +``` + +#### telemetry.dev + +[telemetry.dev](https://telemetry.dev) ingests OTLP/HTTP protobuf traces and normalizes OpenTelemetry GenAI semantic conventions into model, provider, token, latency, and cost fields. Use the `custom` provider with your project API key: + +```bash title=".env" +TELEMETRY_DEV_API_KEY=td_live_... +``` + +```typescript title="src/mastra/index.ts" +new OtelExporter({ + provider: { + custom: { + endpoint: 'https://ingest.telemetry.dev/v1/traces', + protocol: 'http/protobuf', + headers: { + Authorization: `Bearer ${process.env.TELEMETRY_DEV_API_KEY}`, + }, + }, + }, +}) +``` + +#### Traceloop + +[Traceloop](https://www.traceloop.com/) specializes in LLM observability with automatic prompt tracking. + +##### Zero-Config Setup + +```bash title=".env" +# Required +TRACELOOP_API_KEY=your-api-key + +# Optional +TRACELOOP_DESTINATION_ID=my-destination +TRACELOOP_ENDPOINT=https://custom.traceloop.com +``` + +```typescript title="src/mastra/index.ts" +new OtelExporter({ provider: { traceloop: {} } }) +``` + +##### Explicit Configuration + +```typescript title="src/mastra/index.ts" +new OtelExporter({ + provider: { + traceloop: { + apiKey: process.env.TRACELOOP_API_KEY, + destinationId: 'my-destination', // Optional + }, + }, +}) +``` + #### Custom/Generic OTEL Endpoints For other OTEL-compatible platforms or custom collectors: @@ -525,7 +525,7 @@ If the matching log exporter package isn't installed, log export is silently dis new OtelExporter({ // Provider configuration (required) provider: { - // Use one of: dash0, signoz, newrelic, traceloop, laminar, custom + // Use one of: dash0, laminar, newrelic, signoz, traceloop, custom }, // Per-signal toggles. Both default to true. @@ -577,10 +577,10 @@ Choose the right protocol package based on your provider: | - | - | - | | Dash0 | gRPC | `@opentelemetry/exporter-trace-otlp-grpc` | | Datadog | gRPC | `@opentelemetry/exporter-trace-otlp-grpc` | -| SigNoz | HTTP/Protobuf | `@opentelemetry/exporter-trace-otlp-proto` | -| New Relic | HTTP/Protobuf | `@opentelemetry/exporter-trace-otlp-proto` | -| Traceloop | HTTP/JSON | `@opentelemetry/exporter-trace-otlp-http` | | Laminar | HTTP/Protobuf | `@opentelemetry/exporter-trace-otlp-proto` | +| New Relic | HTTP/Protobuf | `@opentelemetry/exporter-trace-otlp-proto` | +| SigNoz | HTTP/Protobuf | `@opentelemetry/exporter-trace-otlp-proto` | +| Traceloop | HTTP/JSON | `@opentelemetry/exporter-trace-otlp-http` | | Custom | Varies | Depends on your collector | :::warning From 657d2e21275cc10d367e35038a31c94791fc8688 Mon Sep 17 00:00:00 2001 From: "mastra-platform[bot]" <284800079+mastra-platform[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 09:01:13 +0100 Subject: [PATCH 09/10] docs: clarify DurableAgent.abortThreadStream returns false while still forwarding the abort (#30439) --- docs/src/content/en/reference/agents/durable-agent.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/content/en/reference/agents/durable-agent.mdx b/docs/src/content/en/reference/agents/durable-agent.mdx index 5e7bf3a0aea..b381f2a9544 100644 --- a/docs/src/content/en/reference/agents/durable-agent.mdx +++ b/docs/src/content/en/reference/agents/durable-agent.mdx @@ -440,7 +440,7 @@ Returns: `boolean`. `true` when this process aborted the run locally or can see #### `abortThreadStream({ threadId, resourceId?, expectedRunId? })` -Aborts the active run on a memory thread with the same abort request as `abortRunStream()`. The run is resolved from this process's thread runtime, so it must have been started here or observed through `subscribeToThread()` on this process. The server route `POST /agents/:agentId/threads/abort` uses this method. +Aborts the active run on a memory thread with the same abort request as `abortRunStream()`. When this process runs the thread's active run, the abort applies here. When this process has observed the run through `subscribeToThread()`, the abort request is published to the process executing the run, and nothing stops in this process. When the process never saw the run, it looks the run up in the background through the thread's lease and asks the process executing it to stop, publishing the request over the shared PubSub. That lookup runs asynchronously. The method returns before the lookup finishes. The server route [`POST /agents/:agentId/threads/abort`](/reference/server/routes#thread-cancellation-routes) awaits the lookup when the abort wasn't resolved in this process, which is how it reports whether a run on another process was asked to stop. Pass `expectedRunId` when the request must only stop a specific run. If another queued run becomes active before the request is handled, the method returns `false` without aborting the successor. Omit `expectedRunId` to abort whichever run is active when the request is handled. @@ -452,7 +452,7 @@ const aborted = durableAgent.abortThreadStream({ }) ``` -Returns: `boolean`. `false` when this process has no active run recorded for the thread or the active run doesn't match `expectedRunId`. No abort request is sent in either case. +Returns: `boolean`. `true` when this process aborted the run, or when the abort request was published to the process executing it. A published request doesn't confirm that the other process stopped the run. `false` is this process's own result: it had no run of the thread's to stop, the active run didn't match `expectedRunId`, or `localOnly: true` kept the abort local and left a run owned by another process alone. An `expectedRunId` mismatch and `localOnly: true` leave the run running by design. Otherwise `false` doesn't rule out a forwarded abort: the background lookup still publishes an abort request to the process holding the lease when it finishes, or finds nothing to publish. A failed lookup or publish is logged as a warning through the Mastra logger. Use the thread-abort route above when you need the forwarded outcome reported. ### Recovery From 30852ab5fe4508bfac336e3c38037060e4dc8e25 Mon Sep 17 00:00:00 2001 From: "mastra-platform[bot]" <284800079+mastra-platform[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 09:22:33 +0100 Subject: [PATCH 10/10] docs(client-js): align retry docs with the write default (#30435) Co-authored-by: sdivyanshu90 <97019230+sdivyanshu90@users.noreply.github.com> --- docs/src/content/en/reference/client-js/mastra-client.mdx | 2 +- docs/src/content/en/reference/client-js/observability.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/content/en/reference/client-js/mastra-client.mdx b/docs/src/content/en/reference/client-js/mastra-client.mdx index 1c34280cd35..9de478a891e 100644 --- a/docs/src/content/en/reference/client-js/mastra-client.mdx +++ b/docs/src/content/en/reference/client-js/mastra-client.mdx @@ -56,7 +56,7 @@ You can also pass `requestContext` as a `Record`. name: 'retries', type: 'number', description: - "The number of times a request will be retried on failure before throwing an error. Retries apply to read requests (GET, HEAD, OPTIONS) by default, and to the observability queries that read server state even though they are sent as POST (aggregateTraces, aggregateSpans, queryTraceThreads, querySpans). Write requests (POST, PUT, PATCH, DELETE) are sent once unless you set this explicitly, so a server error can't repeat a state-changing request.", + "The number of times a request will be retried on failure before throwing an error. Retries apply to read requests (GET, HEAD, OPTIONS) by default, and to the observability queries that read server state even though they are sent as POST (aggregateTraces, aggregateSpans, queryTraceThreads, querySpans). Write requests (POST, PUT, PATCH, DELETE) are sent once unless you set `retries` here, so a server error can't repeat a state-changing request. Methods that accept request options, such as `createFeedback()` and `replaceFeedback()`, can also set `retries` per call, and that count takes precedence over this one. This count covers transport retries only: `createScore()`, `createFeedback()`, and `replaceFeedback()` also retry missing-trace and missing-span responses for up to 30 seconds unless you pass `anchorRetryTimeoutMs: 0`, as described in the observability reference under Signal write options.", isOptional: true, defaultValue: '3 for read requests, 0 for write requests', }, diff --git a/docs/src/content/en/reference/client-js/observability.mdx b/docs/src/content/en/reference/client-js/observability.mdx index e2d9ab0ce00..9940a39181c 100644 --- a/docs/src/content/en/reference/client-js/observability.mdx +++ b/docs/src/content/en/reference/client-js/observability.mdx @@ -520,7 +520,7 @@ await mastraClient.replaceFeedback({ }) ``` -Use the normalized timestamp from the create response's `data` when available. OSS rejects changes to the original trace or timestamp with `409`. Platform uses the timestamp as part of record identity, so preserve it there too. The client preserves the replacement body across retries, but each accepted PUT retry is a new replacement and can supersede another edit. Pass `{ retries: 0, anchorRetryTimeoutMs: 0 }` as the second argument to disable automatic retries. +Use the normalized timestamp from the create response's `data` when available. OSS rejects changes to the original trace or timestamp with `409`. Platform uses the timestamp as part of record identity, so preserve it there too. The client preserves the replacement body across retries, but each accepted PUT retry is a new replacement and can supersede another edit. PUT requests get no transport retries by default, but a client configured with `retries` applies that count here too, and anchor retries stay on unless you turn them off. Pass `{ retries: 0, anchorRetryTimeoutMs: 0 }` as the second argument to disable both transport and anchor retries. `retries: 0` is only redundant when the client has no `retries` configured. ### Deleting feedback and scores