@mastra/code-sdk 1.1.1-alpha.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/auth/storage.js +1 -1
- package/dist/auth/storage.js.map +1 -1
- package/dist/onboarding/packs.js +1 -1
- package/dist/onboarding/packs.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @mastra/code-sdk
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Extended Mastra Code's transient retry policy to cover provider server errors with up to 10 retries and exponential backoff starting at 500ms. ([#20393](https://github.com/mastra-ai/mastra/pull/20393))
|
|
8
|
+
|
|
9
|
+
- Improved Mastra Code connection recovery with up to 10 retries, exponential backoff starting at 500ms, and visible retry progress in the TUI. ([#19724](https://github.com/mastra-ai/mastra/pull/19724))
|
|
10
|
+
|
|
11
|
+
- Fixed the OpenAI pack to use its supported default model ID. ([#20423](https://github.com/mastra-ai/mastra/pull/20423))
|
|
12
|
+
|
|
13
|
+
- Review sessions now load project AGENTS.md/CLAUDE.md from the pull request's trusted base branch instead of skipping them entirely. The working-tree copies on an untrusted checkout remain excluded from the system prompt and reminder injection; content is served from the base ref via git, and sessions without a known base ref still skip project instruction files. ([#20372](https://github.com/mastra-ai/mastra/pull/20372))
|
|
14
|
+
|
|
15
|
+
- Fixed sandbox file tools (view, write, edit, list) failing with "Path not found" in Factory sessions when called with absolute paths inside the session working directory. File tools now also work on macOS-hosted local sandboxes, not just Linux VMs. ([#20325](https://github.com/mastra-ai/mastra/pull/20325))
|
|
16
|
+
|
|
17
|
+
- Sandbox filesystem operations now behave like local ones: missing files, existing destinations, and directory misuse raise typed errors instead of generic ones, reading a directory as a file fails instead of returning empty content, moving or copying a file into a new directory works, overwrite protection can no longer be raced by concurrent writers, and each filesystem reports a unique id and status. ([#20325](https://github.com/mastra-ai/mastra/pull/20325))
|
|
18
|
+
|
|
19
|
+
- Review sessions no longer ingest AGENTS.md or CLAUDE.md from the checked-out pull request branch. A PR branch is third-party content, so its instruction files are treated as content under review instead of trusted configuration — closing a prompt-injection path into the reviewer agent. The reviewer also runs the PR's install/build/test commands with GitHub tokens stripped from the environment. ([#20372](https://github.com/mastra-ai/mastra/pull/20372))
|
|
20
|
+
|
|
21
|
+
- Added an option to the instruction-file reminder processor that lets hosts disable injection entirely for a request, so instruction files from untrusted checkouts are never surfaced as reminders. ([#20372](https://github.com/mastra-ai/mastra/pull/20372))
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`1288cba`](https://github.com/mastra-ai/mastra/commit/1288cba09b8ab906dba38270c7e2a75400344a98), [`3f472b4`](https://github.com/mastra-ai/mastra/commit/3f472b468892a1ff14ccb43cc0343b86f7d8fd7d), [`ba369f2`](https://github.com/mastra-ai/mastra/commit/ba369f2a0aaf998da0d6aa033d26f64f96bef8ac), [`35b929b`](https://github.com/mastra-ai/mastra/commit/35b929b7abc3d20d85c7985880960ac2d04a6c86), [`55c9e24`](https://github.com/mastra-ai/mastra/commit/55c9e248c27c1d72b5bb7e94ea6b8a3999eee49f), [`dcfed93`](https://github.com/mastra-ai/mastra/commit/dcfed93e1e256c6abfa792cbb7ca836f5d0e8638), [`2876e15`](https://github.com/mastra-ai/mastra/commit/2876e15b4d2f616a3bc1ed3af57d546c268384ce), [`9b3626a`](https://github.com/mastra-ai/mastra/commit/9b3626aeb1d16fcd34b0a8e94c114ddb80a3b240), [`4696963`](https://github.com/mastra-ai/mastra/commit/469696312ac4c618bc8475b0c5ed7949b8a3455e), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`07f5b4b`](https://github.com/mastra-ai/mastra/commit/07f5b4ba9d608d88865030732e580298296adf99), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`598080f`](https://github.com/mastra-ai/mastra/commit/598080f224edb3f0f5b801035b067fac50a56a03)]:
|
|
24
|
+
- @mastra/pg@1.18.1
|
|
25
|
+
- @mastra/core@1.55.0
|
|
26
|
+
|
|
3
27
|
## 1.1.1-alpha.3
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/auth/storage.js
CHANGED
|
@@ -16,7 +16,7 @@ import { dirname, join } from "path";
|
|
|
16
16
|
*/
|
|
17
17
|
const PROVIDER_DEFAULT_MODELS = {
|
|
18
18
|
anthropic: "anthropic/claude-fable-5",
|
|
19
|
-
"openai-codex": "openai/gpt-5.6",
|
|
19
|
+
"openai-codex": "openai/gpt-5.6-sol",
|
|
20
20
|
"github-copilot": "github-copilot/gpt-4.1",
|
|
21
21
|
xai: "xai/grok-4.5"
|
|
22
22
|
};
|
package/dist/auth/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","names":[],"sources":["../../src/auth/storage.ts"],"sourcesContent":["/**\n * Credential storage for API keys and OAuth tokens.\n * Handles loading, saving, and refreshing credentials from auth.json.\n */\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync, chmodSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { getAppDataDir } from '../utils/project.js';\nimport { anthropicOAuthProvider } from './providers/anthropic.js';\nimport { githubCopilotOAuthProvider } from './providers/github-copilot.js';\nimport { openaiCodexOAuthProvider } from './providers/openai-codex.js';\nimport { xaiOAuthProvider } from './providers/xai.js';\nimport type {\n AuthCredential,\n AuthStorageData,\n OAuthLoginCallbacks,\n OAuthProviderId,\n OAuthProviderInterface,\n} from './types.js';\n\n/**\n * Best/default models for each OAuth provider.\n * Used when auto-selecting a model after login.\n */\nexport const PROVIDER_DEFAULT_MODELS: Record<OAuthProviderId, string> = {\n anthropic: 'anthropic/claude-fable-5',\n 'openai-codex': 'openai/gpt-5.6',\n // gpt-4.1 routes through `/chat/completions` (which our OpenAI-compatible\n // adapter handles); Anthropic-shaped Copilot models (Claude on `/v1/messages`)\n // are not yet wired up, so picking one as the post-login default would error.\n 'github-copilot': 'github-copilot/gpt-4.1',\n xai: 'xai/grok-4.5',\n};\n\n// Provider registry\nconst oauthProviderRegistry = new Map<string, OAuthProviderInterface>([\n [anthropicOAuthProvider.id, anthropicOAuthProvider],\n [openaiCodexOAuthProvider.id, openaiCodexOAuthProvider],\n [githubCopilotOAuthProvider.id, githubCopilotOAuthProvider],\n [xaiOAuthProvider.id, xaiOAuthProvider],\n]);\n\n/**\n * Get an OAuth provider by ID\n */\nexport function getOAuthProvider(id: OAuthProviderId): OAuthProviderInterface | undefined {\n return oauthProviderRegistry.get(id);\n}\n\n/**\n * Get all registered OAuth providers\n */\nexport function getOAuthProviders(): OAuthProviderInterface[] {\n return Array.from(oauthProviderRegistry.values());\n}\n\n/**\n * Credential storage backed by a JSON file.\n */\nexport class AuthStorage {\n private data: AuthStorageData = {};\n\n constructor(private authPath: string = join(getAppDataDir(), 'auth.json')) {\n this.reload();\n }\n\n /**\n * Reload credentials from disk.\n */\n reload(): void {\n if (!existsSync(this.authPath)) {\n this.data = {};\n return;\n }\n try {\n this.data = JSON.parse(readFileSync(this.authPath, 'utf-8'));\n } catch {\n this.data = {};\n }\n }\n\n /**\n * Save credentials to disk.\n */\n private save(): void {\n const dir = dirname(this.authPath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true, mode: 0o700 });\n }\n writeFileSync(this.authPath, JSON.stringify(this.data, null, 2), 'utf-8');\n chmodSync(this.authPath, 0o600);\n }\n\n /**\n * Get credential for a provider.\n */\n get(provider: string): AuthCredential | undefined {\n return this.data[provider] ?? undefined;\n }\n\n /**\n * Set credential for a provider.\n */\n set(provider: string, credential: AuthCredential): void {\n this.data[provider] = credential;\n this.save();\n }\n\n /**\n * Remove credential for a provider.\n */\n remove(provider: string): void {\n delete this.data[provider];\n this.save();\n }\n\n /**\n * List all providers with credentials.\n */\n list(): string[] {\n return Object.keys(this.data);\n }\n\n /**\n * Check if credentials exist for a provider.\n */\n has(provider: string): boolean {\n return provider in this.data;\n }\n\n /**\n * Check if logged in via OAuth for a provider.\n */\n isLoggedIn(provider: string): boolean {\n const cred = this.data[provider];\n return cred?.type === 'oauth';\n }\n\n /**\n * Check if a stored API key exists for a provider.\n * Keys are stored under `apikey:<provider>` in auth.json.\n */\n hasStoredApiKey(provider: string): boolean {\n const cred = this.data[`apikey:${provider}`];\n return cred?.type === 'api_key' && cred.key.length > 0;\n }\n\n /**\n * Get a stored API key for a provider, if any.\n */\n getStoredApiKey(provider: string): string | undefined {\n const cred = this.data[`apikey:${provider}`];\n return cred?.type === 'api_key' && cred.key.length > 0 ? cred.key : undefined;\n }\n\n /**\n * Store an API key for a provider.\n * Also sets the corresponding environment variable so model resolution can find it.\n */\n setStoredApiKey(provider: string, key: string, envVar?: string): void {\n this.set(`apikey:${provider}`, { type: 'api_key', key });\n if (envVar) {\n process.env[envVar] = key;\n }\n }\n\n /**\n * Load all stored API keys into process.env.\n * Called at startup so model resolution can find stored keys.\n * Only sets env vars that aren't already set (env vars take precedence).\n */\n loadStoredApiKeysIntoEnv(providerEnvVars: Record<string, string | undefined>): void {\n for (const [key, cred] of Object.entries(this.data)) {\n if (!key.startsWith('apikey:') || cred.type !== 'api_key' || !cred.key) continue;\n const provider = key.substring('apikey:'.length);\n const envVar = providerEnvVars[provider];\n if (envVar && !process.env[envVar]) {\n process.env[envVar] = cred.key;\n }\n }\n }\n\n /**\n * Login to an OAuth provider.\n */\n async login(providerId: OAuthProviderId, callbacks: OAuthLoginCallbacks): Promise<void> {\n const provider = getOAuthProvider(providerId);\n if (!provider) {\n throw new Error(`Unknown OAuth provider: ${providerId}`);\n }\n\n const credentials = await provider.login(callbacks);\n this.set(providerId, { type: 'oauth', ...credentials });\n }\n\n /**\n * Logout from a provider.\n */\n logout(provider: string): void {\n this.remove(provider);\n }\n\n /**\n * Get API key for a provider, auto-refreshing OAuth tokens if needed.\n */\n async getApiKey(providerId: string): Promise<string | undefined> {\n const cred = this.data[providerId];\n\n if (cred?.type === 'api_key') {\n return cred.key;\n }\n\n if (cred?.type === 'oauth') {\n const provider = getOAuthProvider(providerId);\n if (!provider) {\n return undefined;\n }\n\n // Check if token needs refresh\n if (Date.now() >= cred.expires) {\n try {\n const newCreds = await provider.refreshToken(cred);\n this.set(providerId, { type: 'oauth', ...newCreds });\n return provider.getApiKey(newCreds);\n } catch {\n // Refresh failed - user needs to re-login\n return undefined;\n }\n }\n\n return provider.getApiKey(cred);\n }\n\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,MAAa,0BAA2D;CACtE,WAAW;CACX,gBAAgB;CAIhB,kBAAkB;CAClB,KAAK;AACP;AAGA,MAAM,wCAAwB,IAAI,IAAoC;CACpE,CAAC,uBAAuB,IAAI,sBAAsB;CAClD,CAAC,yBAAyB,IAAI,wBAAwB;CACtD,CAAC,2BAA2B,IAAI,0BAA0B;CAC1D,CAAC,iBAAiB,IAAI,gBAAgB;AACxC,CAAC;;;;AAKD,SAAgB,iBAAiB,IAAyD;CACxF,OAAO,sBAAsB,IAAI,EAAE;AACrC;;;;AAKA,SAAgB,oBAA8C;CAC5D,OAAO,MAAM,KAAK,sBAAsB,OAAO,CAAC;AAClD;;;;AAKA,IAAa,cAAb,MAAyB;CAGH;CAFpB,OAAgC,CAAC;CAEjC,YAAY,WAA2B,KAAK,cAAc,GAAG,WAAW,GAAG;EAAvD,KAAA,WAAA;EAClB,KAAK,OAAO;CACd;;;;CAKA,SAAe;EACb,IAAI,CAAC,WAAW,KAAK,QAAQ,GAAG;GAC9B,KAAK,OAAO,CAAC;GACb;EACF;EACA,IAAI;GACF,KAAK,OAAO,KAAK,MAAM,aAAa,KAAK,UAAU,OAAO,CAAC;EAC7D,QAAQ;GACN,KAAK,OAAO,CAAC;EACf;CACF;;;;CAKA,O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BADE,IAAI,UAAU,CACO;GACtC,IAAI,UAAU,CAAC,QAAQ,IAAI,SACzB,QAAQ,IAAI,UAAU,KAAK;EAE/B;CACF;;;;CAKA,MAAM,MAAM,YAA6B,WAA+C;EACtF,MAAM,WAAW,iBAAiB,UAAU;EAC5C,IAAI,CAAC,UACH,MAAM,IAAI,MAAM,2BAA2B,YAAY;EAGzD,MAAM,cAAc,MAAM,SAAS,MAAM,SAAS;EAClD,KAAK,IAAI,YAAY;GAAE,MAAM;GAAS,GAAG;EAAY,CAAC;CACxD;;;;CAKA,OAAO,UAAwB;EAC7B,KAAK,OAAO,QAAQ;CACtB;;;;CAKA,MAAM,UAAU,YAAiD;EAC/D,MAAM,OAAO,KAAK,KAAK;EAEvB,IAAI,MAAM,SAAS,WACjB,OAAO,KAAK;EAGd,IAAI,MAAM,SAAS,SAAS;GAC1B,MAAM,WAAW,iBAAiB,UAAU;GAC5C,IAAI,CAAC,UACH;GAIF,IAAI,KAAK,IAAI,KAAK,KAAK,SACrB,IAAI;IACF,MAAM,WAAW,MAAM,SAAS,aAAa,IAAI;IACjD,KAAK,IAAI,YAAY;KAAE,MAAM;KAAS,GAAG;IAAS,CAAC;IACnD,OAAO,SAAS,UAAU,QAAQ;GACpC,QAAQ;IAEN;GACF;GAGF,OAAO,SAAS,UAAU,IAAI;EAChC;CAGF;AACF"}
|
|
1
|
+
{"version":3,"file":"storage.js","names":[],"sources":["../../src/auth/storage.ts"],"sourcesContent":["/**\n * Credential storage for API keys and OAuth tokens.\n * Handles loading, saving, and refreshing credentials from auth.json.\n */\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync, chmodSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { getAppDataDir } from '../utils/project.js';\nimport { anthropicOAuthProvider } from './providers/anthropic.js';\nimport { githubCopilotOAuthProvider } from './providers/github-copilot.js';\nimport { openaiCodexOAuthProvider } from './providers/openai-codex.js';\nimport { xaiOAuthProvider } from './providers/xai.js';\nimport type {\n AuthCredential,\n AuthStorageData,\n OAuthLoginCallbacks,\n OAuthProviderId,\n OAuthProviderInterface,\n} from './types.js';\n\n/**\n * Best/default models for each OAuth provider.\n * Used when auto-selecting a model after login.\n */\nexport const PROVIDER_DEFAULT_MODELS: Record<OAuthProviderId, string> = {\n anthropic: 'anthropic/claude-fable-5',\n 'openai-codex': 'openai/gpt-5.6-sol',\n // gpt-4.1 routes through `/chat/completions` (which our OpenAI-compatible\n // adapter handles); Anthropic-shaped Copilot models (Claude on `/v1/messages`)\n // are not yet wired up, so picking one as the post-login default would error.\n 'github-copilot': 'github-copilot/gpt-4.1',\n xai: 'xai/grok-4.5',\n};\n\n// Provider registry\nconst oauthProviderRegistry = new Map<string, OAuthProviderInterface>([\n [anthropicOAuthProvider.id, anthropicOAuthProvider],\n [openaiCodexOAuthProvider.id, openaiCodexOAuthProvider],\n [githubCopilotOAuthProvider.id, githubCopilotOAuthProvider],\n [xaiOAuthProvider.id, xaiOAuthProvider],\n]);\n\n/**\n * Get an OAuth provider by ID\n */\nexport function getOAuthProvider(id: OAuthProviderId): OAuthProviderInterface | undefined {\n return oauthProviderRegistry.get(id);\n}\n\n/**\n * Get all registered OAuth providers\n */\nexport function getOAuthProviders(): OAuthProviderInterface[] {\n return Array.from(oauthProviderRegistry.values());\n}\n\n/**\n * Credential storage backed by a JSON file.\n */\nexport class AuthStorage {\n private data: AuthStorageData = {};\n\n constructor(private authPath: string = join(getAppDataDir(), 'auth.json')) {\n this.reload();\n }\n\n /**\n * Reload credentials from disk.\n */\n reload(): void {\n if (!existsSync(this.authPath)) {\n this.data = {};\n return;\n }\n try {\n this.data = JSON.parse(readFileSync(this.authPath, 'utf-8'));\n } catch {\n this.data = {};\n }\n }\n\n /**\n * Save credentials to disk.\n */\n private save(): void {\n const dir = dirname(this.authPath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true, mode: 0o700 });\n }\n writeFileSync(this.authPath, JSON.stringify(this.data, null, 2), 'utf-8');\n chmodSync(this.authPath, 0o600);\n }\n\n /**\n * Get credential for a provider.\n */\n get(provider: string): AuthCredential | undefined {\n return this.data[provider] ?? undefined;\n }\n\n /**\n * Set credential for a provider.\n */\n set(provider: string, credential: AuthCredential): void {\n this.data[provider] = credential;\n this.save();\n }\n\n /**\n * Remove credential for a provider.\n */\n remove(provider: string): void {\n delete this.data[provider];\n this.save();\n }\n\n /**\n * List all providers with credentials.\n */\n list(): string[] {\n return Object.keys(this.data);\n }\n\n /**\n * Check if credentials exist for a provider.\n */\n has(provider: string): boolean {\n return provider in this.data;\n }\n\n /**\n * Check if logged in via OAuth for a provider.\n */\n isLoggedIn(provider: string): boolean {\n const cred = this.data[provider];\n return cred?.type === 'oauth';\n }\n\n /**\n * Check if a stored API key exists for a provider.\n * Keys are stored under `apikey:<provider>` in auth.json.\n */\n hasStoredApiKey(provider: string): boolean {\n const cred = this.data[`apikey:${provider}`];\n return cred?.type === 'api_key' && cred.key.length > 0;\n }\n\n /**\n * Get a stored API key for a provider, if any.\n */\n getStoredApiKey(provider: string): string | undefined {\n const cred = this.data[`apikey:${provider}`];\n return cred?.type === 'api_key' && cred.key.length > 0 ? cred.key : undefined;\n }\n\n /**\n * Store an API key for a provider.\n * Also sets the corresponding environment variable so model resolution can find it.\n */\n setStoredApiKey(provider: string, key: string, envVar?: string): void {\n this.set(`apikey:${provider}`, { type: 'api_key', key });\n if (envVar) {\n process.env[envVar] = key;\n }\n }\n\n /**\n * Load all stored API keys into process.env.\n * Called at startup so model resolution can find stored keys.\n * Only sets env vars that aren't already set (env vars take precedence).\n */\n loadStoredApiKeysIntoEnv(providerEnvVars: Record<string, string | undefined>): void {\n for (const [key, cred] of Object.entries(this.data)) {\n if (!key.startsWith('apikey:') || cred.type !== 'api_key' || !cred.key) continue;\n const provider = key.substring('apikey:'.length);\n const envVar = providerEnvVars[provider];\n if (envVar && !process.env[envVar]) {\n process.env[envVar] = cred.key;\n }\n }\n }\n\n /**\n * Login to an OAuth provider.\n */\n async login(providerId: OAuthProviderId, callbacks: OAuthLoginCallbacks): Promise<void> {\n const provider = getOAuthProvider(providerId);\n if (!provider) {\n throw new Error(`Unknown OAuth provider: ${providerId}`);\n }\n\n const credentials = await provider.login(callbacks);\n this.set(providerId, { type: 'oauth', ...credentials });\n }\n\n /**\n * Logout from a provider.\n */\n logout(provider: string): void {\n this.remove(provider);\n }\n\n /**\n * Get API key for a provider, auto-refreshing OAuth tokens if needed.\n */\n async getApiKey(providerId: string): Promise<string | undefined> {\n const cred = this.data[providerId];\n\n if (cred?.type === 'api_key') {\n return cred.key;\n }\n\n if (cred?.type === 'oauth') {\n const provider = getOAuthProvider(providerId);\n if (!provider) {\n return undefined;\n }\n\n // Check if token needs refresh\n if (Date.now() >= cred.expires) {\n try {\n const newCreds = await provider.refreshToken(cred);\n this.set(providerId, { type: 'oauth', ...newCreds });\n return provider.getApiKey(newCreds);\n } catch {\n // Refresh failed - user needs to re-login\n return undefined;\n }\n }\n\n return provider.getApiKey(cred);\n }\n\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,MAAa,0BAA2D;CACtE,WAAW;CACX,gBAAgB;CAIhB,kBAAkB;CAClB,KAAK;AACP;AAGA,MAAM,wCAAwB,IAAI,IAAoC;CACpE,CAAC,uBAAuB,IAAI,sBAAsB;CAClD,CAAC,yBAAyB,IAAI,wBAAwB;CACtD,CAAC,2BAA2B,IAAI,0BAA0B;CAC1D,CAAC,iBAAiB,IAAI,gBAAgB;AACxC,CAAC;;;;AAKD,SAAgB,iBAAiB,IAAyD;CACxF,OAAO,sBAAsB,IAAI,EAAE;AACrC;;;;AAKA,SAAgB,oBAA8C;CAC5D,OAAO,MAAM,KAAK,sBAAsB,OAAO,CAAC;AAClD;;;;AAKA,IAAa,cAAb,MAAyB;CAGH;CAFpB,OAAgC,CAAC;CAEjC,YAAY,WAA2B,KAAK,cAAc,GAAG,WAAW,GAAG;EAAvD,KAAA,WAAA;EAClB,KAAK,OAAO;CACd;;;;CAKA,SAAe;EACb,I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E1B;;;;;;CAOA,yBAAyB,iBAA2D;EAClF,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,KAAK,IAAI,GAAG;GACnD,IAAI,CAAC,IAAI,WAAW,SAAS,KAAK,KAAK,SAAS,aAAa,CAAC,KAAK,KAAK;GAExE,MAAM,SAAS,gBADE,IAAI,UAAU,CACO;GACtC,IAAI,UAAU,CAAC,QAAQ,IAAI,SACzB,QAAQ,IAAI,UAAU,KAAK;EAE/B;CACF;;;;CAKA,MAAM,MAAM,YAA6B,WAA+C;EACtF,MAAM,WAAW,iBAAiB,UAAU;EAC5C,IAAI,CAAC,UACH,MAAM,IAAI,MAAM,2BAA2B,YAAY;EAGzD,MAAM,cAAc,MAAM,SAAS,MAAM,SAAS;EAClD,KAAK,IAAI,YAAY;GAAE,MAAM;GAAS,GAAG;EAAY,CAAC;CACxD;;;;CAKA,OAAO,UAAwB;EAC7B,KAAK,OAAO,QAAQ;CACtB;;;;CAKA,MAAM,UAAU,YAAiD;EAC/D,MAAM,OAAO,KAAK,KAAK;EAEvB,IAAI,MAAM,SAAS,WACjB,OAAO,KAAK;EAGd,IAAI,MAAM,SAAS,SAAS;GAC1B,MAAM,WAAW,iBAAiB,UAAU;GAC5C,IAAI,CAAC,UACH;GAIF,IAAI,KAAK,IAAI,KAAK,KAAK,SACrB,IAAI;IACF,MAAM,WAAW,MAAM,SAAS,aAAa,IAAI;IACjD,KAAK,IAAI,YAAY;KAAE,MAAM;KAAS,GAAG;IAAS,CAAC;IACnD,OAAO,SAAS,UAAU,QAAQ;GACpC,QAAQ;IAEN;GACF;GAGF,OAAO,SAAS,UAAU,IAAI;EAChC;CAGF;AACF"}
|
package/dist/onboarding/packs.js
CHANGED
|
@@ -15,7 +15,7 @@ import { DEFAULT_OM_MODEL_ID } from "../constants.js";
|
|
|
15
15
|
*/
|
|
16
16
|
function getAvailableModePacks(access, savedCustomPacks = []) {
|
|
17
17
|
const packs = [];
|
|
18
|
-
const openaiCodex = "openai/gpt-5.6";
|
|
18
|
+
const openaiCodex = "openai/gpt-5.6-sol";
|
|
19
19
|
const openaiFast = "openai/gpt-5.4-mini";
|
|
20
20
|
const anthropicBuild = "anthropic/claude-fable-5";
|
|
21
21
|
if (access.anthropic) packs.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packs.js","names":[],"sources":["../../src/onboarding/packs.ts"],"sourcesContent":["/**\n * Onboarding \"packs\" — predefined model configurations for each mode.\n *\n * Each pack assigns a default model to the build, plan, and fast modes,\n * plus an OM (observational memory) model.\n */\nimport { DEFAULT_OM_MODEL_ID } from '../constants.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface ModePack {\n id: string;\n name: string;\n description: string;\n models: {\n build: string;\n plan: string;\n fast: string;\n };\n}\n\nexport interface OMPack {\n id: string;\n name: string;\n description: string;\n modelId: string;\n}\n\ninterface BuiltinOMPack {\n id: string;\n providerId: string;\n name: string;\n modelId: string;\n description: (access: Exclude<ProviderAccessLevel, false>) => string;\n}\n\n/** How a provider is accessed: OAuth subscription, API key, or not at all. */\nexport type ProviderAccessLevel = 'oauth' | 'apikey' | false;\n\n/** Which providers the user has access to and how. */\nexport interface ProviderAccess {\n anthropic: ProviderAccessLevel;\n openai: ProviderAccessLevel;\n cerebras: ProviderAccessLevel;\n google: ProviderAccessLevel;\n deepseek: ProviderAccessLevel;\n 'github-copilot': ProviderAccessLevel;\n [provider: string]: ProviderAccessLevel;\n}\n\n// ---------------------------------------------------------------------------\n// Mode Packs\n// ---------------------------------------------------------------------------\n\n/**\n * Build the list of available mode packs based on which providers the user\n * can actually reach (API key or OAuth login).\n *\n * @param savedCustomPacks Previously saved custom packs from settings.json.\n * These are inserted before the \"New Custom\" option.\n */\nexport function getAvailableModePacks(\n access: ProviderAccess,\n savedCustomPacks: Array<{ name: string; models: Record<string, string> }> = [],\n): ModePack[] {\n const packs: ModePack[] = [];\n\n const openaiCodex = 'openai/gpt-5.6';\n const openaiFast = 'openai/gpt-5.4-mini';\n const anthropicBuild = 'anthropic/claude-fable-5';\n\n if (access.anthropic) {\n packs.push({\n id: 'anthropic',\n name: 'Anthropic',\n description:\n access.anthropic === 'oauth' ? 'All Anthropic models via Max subscription' : 'All Anthropic models via API key',\n models: {\n build: anthropicBuild,\n plan: anthropicBuild,\n fast: 'anthropic/claude-haiku-4-5',\n },\n });\n }\n\n if (access.openai) {\n packs.push({\n id: 'openai',\n name: 'OpenAI',\n description:\n access.openai === 'oauth' ? 'All OpenAI models via Codex subscription' : 'All OpenAI models via API key',\n models: {\n build: openaiCodex,\n plan: openaiCodex,\n fast: openaiFast,\n },\n });\n }\n\n if (access['github-copilot']) {\n packs.push({\n id: 'github-copilot',\n name: 'GitHub Copilot',\n description: 'GitHub Copilot subscription',\n models: {\n build: 'github-copilot/gpt-4.1',\n plan: 'github-copilot/gemini-2.5-pro',\n fast: 'github-copilot/grok-code-fast-1',\n },\n });\n }\n\n // Saved custom packs — inserted before the \"New Custom\" option\n for (const cp of savedCustomPacks) {\n packs.push({\n id: `custom:${cp.name}`,\n name: cp.name,\n description: 'Saved custom pack',\n models: {\n build: cp.models.build ?? '',\n plan: cp.models.plan ?? '',\n fast: cp.models.fast ?? '',\n },\n });\n }\n\n // New Custom — always available; user picks each model individually\n const hasCustom = savedCustomPacks.length > 0;\n packs.push({\n id: 'custom',\n name: hasCustom ? 'New Custom' : 'Custom',\n description: 'Choose a model for each mode',\n models: { build: '', plan: '', fast: '' },\n });\n\n return packs;\n}\n\n// ---------------------------------------------------------------------------\n// OM Packs\n// ---------------------------------------------------------------------------\n\nconst BUILTIN_OM_PACKS: BuiltinOMPack[] = [\n {\n id: 'gemini',\n providerId: 'google',\n name: 'Gemini Flash',\n modelId: 'google/gemini-3.5-flash',\n description: access => (access === 'oauth' ? 'Via Google OAuth' : 'Via Google API key'),\n },\n {\n id: 'anthropic',\n providerId: 'anthropic',\n name: 'Claude Haiku',\n modelId: 'anthropic/claude-haiku-4-5',\n description: access => (access === 'oauth' ? 'Via Max subscription' : 'Via Anthropic API key'),\n },\n {\n id: 'openai',\n providerId: 'openai',\n name: 'OpenAI Mini',\n modelId: 'openai/gpt-5.4-mini',\n description: access => (access === 'oauth' ? 'Via Codex subscription' : 'Via OpenAI API key'),\n },\n {\n id: 'deepseek',\n providerId: 'deepseek',\n name: 'DeepSeek',\n modelId: 'deepseek/deepseek-v4-flash',\n description: () => 'Via DeepSeek API key',\n },\n];\n\nfunction normalizeOMProviderId(providerId: string): string {\n return providerId === 'openai-codex' ? 'openai' : providerId;\n}\n\n/** A provider's low-cost OM pack, or a custom pack on `fallbackModelId` when it has none. */\nexport function resolveProviderOMDefault(providerId: string, fallbackModelId = DEFAULT_OM_MODEL_ID): OMPack {\n const normalizedProviderId = normalizeOMProviderId(providerId);\n const builtin = BUILTIN_OM_PACKS.find(pack => pack.providerId === normalizedProviderId);\n if (builtin) {\n return {\n id: builtin.id,\n name: builtin.name,\n description: builtin.description('apikey'),\n modelId: builtin.modelId,\n };\n }\n\n return {\n id: 'custom',\n name: 'Custom',\n description: 'Uses the selected provider model',\n modelId: fallbackModelId || DEFAULT_OM_MODEL_ID,\n };\n}\n\nexport function getAvailableOmPacks(access: ProviderAccess): OMPack[] {\n const packs = BUILTIN_OM_PACKS.flatMap(pack => {\n const providerAccess = access[pack.providerId];\n if (!providerAccess) return [];\n return [\n {\n id: pack.id,\n name: pack.name,\n description: pack.description(providerAccess),\n modelId: pack.modelId,\n },\n ];\n });\n\n // Custom — always available; user picks any model\n packs.push({\n id: 'custom',\n name: 'Custom',\n description: 'Choose any available model',\n modelId: '',\n });\n\n return packs;\n}\n\n/** Best reachable built-in OM pack: preferred provider, then OAuth, then built-in order. */\nexport function selectPreferredOMPack(access: ProviderAccess, preferredProviderId?: string): OMPack | undefined {\n const available = getAvailableOmPacks(access).filter(pack => pack.id !== 'custom');\n\n if (preferredProviderId) {\n const preferredPackId = resolveProviderOMDefault(preferredProviderId).id;\n const preferred = available.find(pack => pack.id === preferredPackId);\n if (preferred) return preferred;\n }\n\n const oauth = available.find(pack => {\n const definition = BUILTIN_OM_PACKS.find(candidate => candidate.id === pack.id);\n return definition ? access[definition.providerId] === 'oauth' : false;\n });\n return oauth ?? available[0];\n}\n\n// ---------------------------------------------------------------------------\n// Current onboarding version — bump when adding new steps\n// ---------------------------------------------------------------------------\n\nexport const ONBOARDING_VERSION = 1;\n"],"mappings":";;;;;;;;;;;;;;;AA+DA,SAAgB,sBACd,QACA,mBAA4E,CAAC,GACjE;CACZ,MAAM,QAAoB,CAAC;CAE3B,MAAM,cAAc;CACpB,MAAM,aAAa;CACnB,MAAM,iBAAiB;CAEvB,IAAI,OAAO,WACT,MAAM,KAAK;EACT,IAAI;EACJ,MAAM;EACN,aACE,OAAO,cAAc,UAAU,8CAA8C;EAC/E,QAAQ;GACN,OAAO;GACP,MAAM;GACN,MAAM;EACR;CACF,CAAC;CAGH,IAAI,OAAO,QACT,MAAM,KAAK;EACT,IAAI;EACJ,MAAM;EACN,aACE,OAAO,WAAW,UAAU,6CAA6C;EAC3E,QAAQ;GACN,OAAO;GACP,MAAM;GACN,MAAM;EACR;CACF,CAAC;CAGH,IAAI,OAAO,mBACT,MAAM,KAAK;EACT,IAAI;EACJ,MAAM;EACN,aAAa;EACb,QAAQ;GACN,OAAO;GACP,MAAM;GACN,MAAM;EACR;CACF,CAAC;CAIH,KAAK,MAAM,MAAM,kBACf,MAAM,KAAK;EACT,IAAI,UAAU,GAAG;EACjB,MAAM,GAAG;EACT,aAAa;EACb,QAAQ;GACN,OAAO,GAAG,OAAO,SAAS;GAC1B,MAAM,GAAG,OAAO,QAAQ;GACxB,MAAM,GAAG,OAAO,QAAQ;EAC1B;CACF,CAAC;CAIH,MAAM,YAAY,iBAAiB,SAAS;CAC5C,MAAM,KAAK;EACT,IAAI;EACJ,MAAM,YAAY,eAAe;EACjC,aAAa;EACb,QAAQ;GAAE,OAAO;GAAI,MAAM;GAAI,MAAM;EAAG;CAC1C,CAAC;CAED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,QAAO,SAAQ,KAAK,OAAO,QAAQ;CAEjF,IAAI,qBAAqB;EACvB,MAAM,kBAAkB,yBAAyB,mBAAmB,CAAC,CAAC;EACtE,MAAM,YAAY,UAAU,MAAK,SAAQ,KAAK,OAAO,eAAe;EACpE,IAAI,WAAW,OAAO;CACxB;CAMA,OAJc,UAAU,MAAK,SAAQ;EACnC,MAAM,aAAa,iBAAiB,MAAK,cAAa,UAAU,OAAO,KAAK,EAAE;EAC9E,OAAO,aAAa,OAAO,WAAW,gBAAgB,UAAU;CAClE,CACW,KAAK,UAAU;AAC5B;AAMA,MAAa,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"packs.js","names":[],"sources":["../../src/onboarding/packs.ts"],"sourcesContent":["/**\n * Onboarding \"packs\" — predefined model configurations for each mode.\n *\n * Each pack assigns a default model to the build, plan, and fast modes,\n * plus an OM (observational memory) model.\n */\nimport { DEFAULT_OM_MODEL_ID } from '../constants.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface ModePack {\n id: string;\n name: string;\n description: string;\n models: {\n build: string;\n plan: string;\n fast: string;\n };\n}\n\nexport interface OMPack {\n id: string;\n name: string;\n description: string;\n modelId: string;\n}\n\ninterface BuiltinOMPack {\n id: string;\n providerId: string;\n name: string;\n modelId: string;\n description: (access: Exclude<ProviderAccessLevel, false>) => string;\n}\n\n/** How a provider is accessed: OAuth subscription, API key, or not at all. */\nexport type ProviderAccessLevel = 'oauth' | 'apikey' | false;\n\n/** Which providers the user has access to and how. */\nexport interface ProviderAccess {\n anthropic: ProviderAccessLevel;\n openai: ProviderAccessLevel;\n cerebras: ProviderAccessLevel;\n google: ProviderAccessLevel;\n deepseek: ProviderAccessLevel;\n 'github-copilot': ProviderAccessLevel;\n [provider: string]: ProviderAccessLevel;\n}\n\n// ---------------------------------------------------------------------------\n// Mode Packs\n// ---------------------------------------------------------------------------\n\n/**\n * Build the list of available mode packs based on which providers the user\n * can actually reach (API key or OAuth login).\n *\n * @param savedCustomPacks Previously saved custom packs from settings.json.\n * These are inserted before the \"New Custom\" option.\n */\nexport function getAvailableModePacks(\n access: ProviderAccess,\n savedCustomPacks: Array<{ name: string; models: Record<string, string> }> = [],\n): ModePack[] {\n const packs: ModePack[] = [];\n\n const openaiCodex = 'openai/gpt-5.6-sol';\n const openaiFast = 'openai/gpt-5.4-mini';\n const anthropicBuild = 'anthropic/claude-fable-5';\n\n if (access.anthropic) {\n packs.push({\n id: 'anthropic',\n name: 'Anthropic',\n description:\n access.anthropic === 'oauth' ? 'All Anthropic models via Max subscription' : 'All Anthropic models via API key',\n models: {\n build: anthropicBuild,\n plan: anthropicBuild,\n fast: 'anthropic/claude-haiku-4-5',\n },\n });\n }\n\n if (access.openai) {\n packs.push({\n id: 'openai',\n name: 'OpenAI',\n description:\n access.openai === 'oauth' ? 'All OpenAI models via Codex subscription' : 'All OpenAI models via API key',\n models: {\n build: openaiCodex,\n plan: openaiCodex,\n fast: openaiFast,\n },\n });\n }\n\n if (access['github-copilot']) {\n packs.push({\n id: 'github-copilot',\n name: 'GitHub Copilot',\n description: 'GitHub Copilot subscription',\n models: {\n build: 'github-copilot/gpt-4.1',\n plan: 'github-copilot/gemini-2.5-pro',\n fast: 'github-copilot/grok-code-fast-1',\n },\n });\n }\n\n // Saved custom packs — inserted before the \"New Custom\" option\n for (const cp of savedCustomPacks) {\n packs.push({\n id: `custom:${cp.name}`,\n name: cp.name,\n description: 'Saved custom pack',\n models: {\n build: cp.models.build ?? '',\n plan: cp.models.plan ?? '',\n fast: cp.models.fast ?? '',\n },\n });\n }\n\n // New Custom — always available; user picks each model individually\n const hasCustom = savedCustomPacks.length > 0;\n packs.push({\n id: 'custom',\n name: hasCustom ? 'New Custom' : 'Custom',\n description: 'Choose a model for each mode',\n models: { build: '', plan: '', fast: '' },\n });\n\n return packs;\n}\n\n// ---------------------------------------------------------------------------\n// OM Packs\n// ---------------------------------------------------------------------------\n\nconst BUILTIN_OM_PACKS: BuiltinOMPack[] = [\n {\n id: 'gemini',\n providerId: 'google',\n name: 'Gemini Flash',\n modelId: 'google/gemini-3.5-flash',\n description: access => (access === 'oauth' ? 'Via Google OAuth' : 'Via Google API key'),\n },\n {\n id: 'anthropic',\n providerId: 'anthropic',\n name: 'Claude Haiku',\n modelId: 'anthropic/claude-haiku-4-5',\n description: access => (access === 'oauth' ? 'Via Max subscription' : 'Via Anthropic API key'),\n },\n {\n id: 'openai',\n providerId: 'openai',\n name: 'OpenAI Mini',\n modelId: 'openai/gpt-5.4-mini',\n description: access => (access === 'oauth' ? 'Via Codex subscription' : 'Via OpenAI API key'),\n },\n {\n id: 'deepseek',\n providerId: 'deepseek',\n name: 'DeepSeek',\n modelId: 'deepseek/deepseek-v4-flash',\n description: () => 'Via DeepSeek API key',\n },\n];\n\nfunction normalizeOMProviderId(providerId: string): string {\n return providerId === 'openai-codex' ? 'openai' : providerId;\n}\n\n/** A provider's low-cost OM pack, or a custom pack on `fallbackModelId` when it has none. */\nexport function resolveProviderOMDefault(providerId: string, fallbackModelId = DEFAULT_OM_MODEL_ID): OMPack {\n const normalizedProviderId = normalizeOMProviderId(providerId);\n const builtin = BUILTIN_OM_PACKS.find(pack => pack.providerId === normalizedProviderId);\n if (builtin) {\n return {\n id: builtin.id,\n name: builtin.name,\n description: builtin.description('apikey'),\n modelId: builtin.modelId,\n };\n }\n\n return {\n id: 'custom',\n name: 'Custom',\n description: 'Uses the selected provider model',\n modelId: fallbackModelId || DEFAULT_OM_MODEL_ID,\n };\n}\n\nexport function getAvailableOmPacks(access: ProviderAccess): OMPack[] {\n const packs = BUILTIN_OM_PACKS.flatMap(pack => {\n const providerAccess = access[pack.providerId];\n if (!providerAccess) return [];\n return [\n {\n id: pack.id,\n name: pack.name,\n description: pack.description(providerAccess),\n modelId: pack.modelId,\n },\n ];\n });\n\n // Custom — always available; user picks any model\n packs.push({\n id: 'custom',\n name: 'Custom',\n description: 'Choose any available model',\n modelId: '',\n });\n\n return packs;\n}\n\n/** Best reachable built-in OM pack: preferred provider, then OAuth, then built-in order. */\nexport function selectPreferredOMPack(access: ProviderAccess, preferredProviderId?: string): OMPack | undefined {\n const available = getAvailableOmPacks(access).filter(pack => pack.id !== 'custom');\n\n if (preferredProviderId) {\n const preferredPackId = resolveProviderOMDefault(preferredProviderId).id;\n const preferred = available.find(pack => pack.id === preferredPackId);\n if (preferred) return preferred;\n }\n\n const oauth = available.find(pack => {\n const definition = BUILTIN_OM_PACKS.find(candidate => candidate.id === pack.id);\n return definition ? access[definition.providerId] === 'oauth' : false;\n });\n return oauth ?? available[0];\n}\n\n// ---------------------------------------------------------------------------\n// Current onboarding version — bump when adding new steps\n// ---------------------------------------------------------------------------\n\nexport const ONBOARDING_VERSION = 1;\n"],"mappings":";;;;;;;;;;;;;;;AA+DA,SAAgB,sBACd,QACA,mBAA4E,CAAC,GACjE;CACZ,MAAM,QAAoB,CAAC;CAE3B,MAAM,cAAc;CACpB,MAAM,aAAa;CACnB,MAAM,iBAAiB;CAEvB,IAAI,OAAO,WACT,MAAM,KAAK;EACT,IAAI;EACJ,MAAM;EACN,aACE,OAAO,cAAc,UAAU,8CAA8C;EAC/E,QAAQ;GACN,OAAO;GACP,MAAM;GACN,MAAM;EACR;CACF,CAAC;CAGH,IAAI,OAAO,QACT,MAAM,KAAK;EACT,IAAI;EACJ,MAAM;EACN,aACE,OAAO,WAAW,UAAU,6CAA6C;EAC3E,QAAQ;GACN,OAAO;GACP,MAAM;GACN,MAAM;EACR;CACF,CAAC;CAGH,IAAI,OAAO,mBACT,MAAM,KAAK;EACT,IAAI;EACJ,MAAM;EACN,aAAa;EACb,QAAQ;GACN,OAAO;GACP,MAAM;GACN,MAAM;EACR;CACF,CAAC;CAIH,KAAK,MAAM,MAAM,kBACf,MAAM,KAAK;EACT,IAAI,UAAU,GAAG;EACjB,MAAM,GAAG;EACT,aAAa;EACb,QAAQ;GACN,OAAO,GAAG,OAAO,SAAS;GAC1B,MAAM,GAAG,OAAO,QAAQ;GACxB,MAAM,G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SAAS,KAAK;EAChB,CACF;CACF,CAAC;CAGD,MAAM,KAAK;EACT,IAAI;EACJ,MAAM;EACN,aAAa;EACb,SAAS;CACX,CAAC;CAED,OAAO;AACT;;AAGA,SAAgB,sBAAsB,QAAwB,qBAAkD;CAC9G,MAAM,YAAY,oBAAoB,MAAM,CAAC,CAAC,QAAO,SAAQ,KAAK,OAAO,QAAQ;CAEjF,IAAI,qBAAqB;EACvB,MAAM,kBAAkB,yBAAyB,mBAAmB,CAAC,CAAC;EACtE,MAAM,YAAY,UAAU,MAAK,SAAQ,KAAK,OAAO,eAAe;EACpE,IAAI,WAAW,OAAO;CACxB;CAMA,OAJc,UAAU,MAAK,SAAQ;EACnC,MAAM,aAAa,iBAAiB,MAAK,cAAa,UAAU,OAAO,KAAK,EAAE;EAC9E,OAAO,aAAa,OAAO,WAAW,gBAAgB,UAAU;CAClE,CACW,KAAK,UAAU;AAC5B;AAMA,MAAa,qBAAqB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/code-sdk",
|
|
3
|
-
"version": "1.1.1
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Mastra Code SDK: the agent core behind Mastra Code (everything except the TUI) — build your own UIs and surfaces on top of it",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -56,19 +56,19 @@
|
|
|
56
56
|
"vscode-languageserver-protocol": "^3.17.5",
|
|
57
57
|
"yaml": "^2.7.1",
|
|
58
58
|
"zod": "^4.3.6",
|
|
59
|
-
"@mastra/
|
|
59
|
+
"@mastra/agent-browser": "0.4.1",
|
|
60
|
+
"@mastra/core": "1.55.0",
|
|
60
61
|
"@mastra/fastembed": "1.2.0",
|
|
61
|
-
"@mastra/
|
|
62
|
+
"@mastra/duckdb": "1.5.2",
|
|
63
|
+
"@mastra/github-signals": "0.2.2",
|
|
62
64
|
"@mastra/libsql": "1.18.0",
|
|
63
|
-
"@mastra/agent-browser": "0.4.1",
|
|
64
65
|
"@mastra/mcp": "1.15.0",
|
|
65
66
|
"@mastra/observability": "1.16.3",
|
|
66
|
-
"@mastra/memory": "1.24.0",
|
|
67
|
-
"@mastra/pg": "1.18.1-alpha.0",
|
|
68
67
|
"@mastra/schema-compat": "1.3.4",
|
|
69
|
-
"@mastra/
|
|
68
|
+
"@mastra/tavily": "1.1.1",
|
|
70
69
|
"@mastra/stagehand": "0.3.1",
|
|
71
|
-
"@mastra/
|
|
70
|
+
"@mastra/pg": "1.18.1",
|
|
71
|
+
"@mastra/memory": "1.24.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@libsql/client": "^0.17.4",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"typescript": "^6.0.3",
|
|
80
80
|
"typescript-eslint": "^8.57.0",
|
|
81
81
|
"vitest": "4.1.10",
|
|
82
|
-
"@internal/
|
|
83
|
-
"@internal/
|
|
84
|
-
"@internal/
|
|
82
|
+
"@internal/lint": "0.0.119",
|
|
83
|
+
"@internal/types-builder": "0.0.94",
|
|
84
|
+
"@internal/workspace-test-utils": "0.0.63"
|
|
85
85
|
},
|
|
86
86
|
"engines": {
|
|
87
87
|
"node": ">=22.19.0"
|