mastracode 0.49.0 → 0.50.0-alpha.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 +43 -0
- package/dist/cli.cjs +3 -3
- package/dist/cli.js +3 -3
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{login-command-EvJk2jIW.js → login-command-CT7RA_DY.js} +2 -2
- package/dist/{login-command-EvJk2jIW.js.map → login-command-CT7RA_DY.js.map} +1 -1
- package/dist/{login-command-COPViada.cjs → login-command-DvbCd7Pz.cjs} +2 -2
- package/dist/{login-command-COPViada.cjs.map → login-command-DvbCd7Pz.cjs.map} +1 -1
- package/dist/tui/components/ask-question-dialog.d.ts.map +1 -1
- package/dist/tui/components/tool-execution-enhanced.d.ts.map +1 -1
- package/dist/tui/handlers/tool.d.ts.map +1 -1
- package/dist/tui/utils/bounded-output.d.ts +8 -0
- package/dist/tui/utils/bounded-output.d.ts.map +1 -0
- package/dist/tui/voice/engines/cloud-engine.d.ts.map +1 -1
- package/dist/tui/voice/transcribe.d.ts +4 -54
- package/dist/tui/voice/transcribe.d.ts.map +1 -1
- package/dist/{tui-oSQAQVok.js → tui-Ba0GZdaT.js} +47 -113
- package/dist/tui-Ba0GZdaT.js.map +1 -0
- package/dist/{tui-DoJe_K8c.cjs → tui-DojlwY6e.cjs} +46 -112
- package/dist/tui-DojlwY6e.cjs.map +1 -0
- package/dist/tui.cjs +1 -1
- package/dist/tui.js +1 -1
- package/package.json +14 -16
- package/dist/tui-DoJe_K8c.cjs.map +0 -1
- package/dist/tui-oSQAQVok.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# mastracode
|
|
2
2
|
|
|
3
|
+
## 0.50.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added Mistral Voxtral as a speech-to-text provider for voice input. Pick `mistral` in `/voice` and set `MISTRAL_API_KEY` (or add a key with `/api-keys`) to dictate with `voxtral-mini-latest`. ([#29363](https://github.com/mastra-ai/mastra/pull/29363))
|
|
8
|
+
|
|
9
|
+
Fixed voice input with Groq and the other OpenAI-compatible hosts failing with "No API key provided for speech model" when `OPENAI_API_KEY` was not set.
|
|
10
|
+
|
|
11
|
+
Fixed voice input with NEAR AI ignoring `NEARAI_API_KEY`. `NEAR_AI_API_KEY` is no longer read; rename it to `NEARAI_API_KEY`.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`a0068a9`](https://github.com/mastra-ai/mastra/commit/a0068a9ad1fb0a31ae60a07ecbeae41a32ea4081), [`bb0fcd6`](https://github.com/mastra-ai/mastra/commit/bb0fcd6211a416cece10c20e11f6f3cb70b4c93b), [`459757f`](https://github.com/mastra-ai/mastra/commit/459757f07de6905c6abdfc3b08a7f48a808dcc6b), [`592a907`](https://github.com/mastra-ai/mastra/commit/592a9071cae12ef7d1defa5f7942f1a9cbdaa340), [`3cf319b`](https://github.com/mastra-ai/mastra/commit/3cf319b5af74aeebb1b70bd29ec539fbd2af4bb8), [`8960f55`](https://github.com/mastra-ai/mastra/commit/8960f55dec7ebf39b460ee8664509d2924065b86), [`b518fc9`](https://github.com/mastra-ai/mastra/commit/b518fc9abeb05093aff4b1bb3e74f018e3612078), [`68869db`](https://github.com/mastra-ai/mastra/commit/68869dbb53034aee5868bccef4691af61bf6656e), [`cd369c3`](https://github.com/mastra-ai/mastra/commit/cd369c334cf5af81597d7d61e7419b390f92365b), [`f94beac`](https://github.com/mastra-ai/mastra/commit/f94beac86288cb94e2973c9ed492c8f0d68b919d), [`544224c`](https://github.com/mastra-ai/mastra/commit/544224c38f61d08a0b9952d202366fb3c6cc5bd9), [`a873e2d`](https://github.com/mastra-ai/mastra/commit/a873e2df4335b4cd7d50d4d2d26b166f976af9e3), [`d6a5f98`](https://github.com/mastra-ai/mastra/commit/d6a5f98df3a1f6d11743e0bdf150358d7db4dd40), [`d6a5f98`](https://github.com/mastra-ai/mastra/commit/d6a5f98df3a1f6d11743e0bdf150358d7db4dd40), [`defb820`](https://github.com/mastra-ai/mastra/commit/defb82048f6e78bde95c10ffa0ca36f20d714f41), [`23308f9`](https://github.com/mastra-ai/mastra/commit/23308f9c193ef852c28f6ec1c6e872f75363c5f7), [`83b6997`](https://github.com/mastra-ai/mastra/commit/83b6997a2ac9e2a3d94bcfe4de181b32a26cf7c6), [`36bbc29`](https://github.com/mastra-ai/mastra/commit/36bbc291292170e68774d6e9a7c76b6a5d930dd8), [`f79db0d`](https://github.com/mastra-ai/mastra/commit/f79db0de42bc8205fe62b39c1fe78932661b5e14), [`e14e5df`](https://github.com/mastra-ai/mastra/commit/e14e5dfb7a50422ef84e3623c823d8b782dec330), [`8d07b0b`](https://github.com/mastra-ai/mastra/commit/8d07b0b293812d84c3f45c2806eb53ed45f58324), [`f7320ab`](https://github.com/mastra-ai/mastra/commit/f7320abd205aa865e3ae467b7bf82373af30a6aa), [`d6a5f98`](https://github.com/mastra-ai/mastra/commit/d6a5f98df3a1f6d11743e0bdf150358d7db4dd40), [`459757f`](https://github.com/mastra-ai/mastra/commit/459757f07de6905c6abdfc3b08a7f48a808dcc6b), [`2f93851`](https://github.com/mastra-ai/mastra/commit/2f93851c37410a9d9740263a636e802ef9ee2f8d), [`75983cd`](https://github.com/mastra-ai/mastra/commit/75983cdb05ffa4f70aac528220c7fbe5cfa2baf3)]:
|
|
16
|
+
- @mastra/core@1.83.0-alpha.1
|
|
17
|
+
- @mastra/code-sdk@1.19.0-alpha.1
|
|
18
|
+
- @mastra/mcp@2.9.0-alpha.1
|
|
19
|
+
- @mastra/pg@1.36.0-alpha.1
|
|
20
|
+
- @mastra/duckdb@1.19.0-alpha.1
|
|
21
|
+
- @mastra/observability@1.23.2-alpha.1
|
|
22
|
+
- @mastra/libsql@1.30.0-alpha.0
|
|
23
|
+
|
|
24
|
+
## 0.49.1-alpha.0
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Fixed unbounded shell output retention in the controller display state and the Mastra Code terminal UI. Live shell output now keeps the latest 1 MB per command. ([#28808](https://github.com/mastra-ai/mastra/pull/28808))
|
|
29
|
+
|
|
30
|
+
`execute_command` no longer rewrites a trailing `| tail -N`; the pipeline runs as written. Pipelines that end in `tail` now run with `pipefail` where the shell supports it, so a failing upstream command reports its non-zero exit code instead of `tail`'s success. The `tail` option still limits output returned to the model.
|
|
31
|
+
|
|
32
|
+
- Mastra Code now runs on AI SDK v7. Claude, OpenAI, Codex, Kimi, xAI sign-in, GitHub Copilot and custom endpoints use the v7 provider packages. Sign-ins, API keys, thinking levels, prompt caching and image tool results work as before, including when you switch providers mid-thread. Vertex AI, Bedrock, and models served through `@mastra/core` such as Gemini keep their current provider packages. ([#28738](https://github.com/mastra-ai/mastra/pull/28738))
|
|
33
|
+
|
|
34
|
+
- Fixed the `/schedules` dialog rendering outside its box when a schedule's prompt spans multiple lines. Option rows in dialogs now always render on a single line. ([#29335](https://github.com/mastra-ai/mastra/pull/29335))
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [[`1a078af`](https://github.com/mastra-ai/mastra/commit/1a078afbb1cb4ac73eca047e80d366c57e83e5e8), [`1a078af`](https://github.com/mastra-ai/mastra/commit/1a078afbb1cb4ac73eca047e80d366c57e83e5e8), [`4afecea`](https://github.com/mastra-ai/mastra/commit/4afeceaf2de5ae85e9c14d25227805ebaf3eaace), [`a3caf25`](https://github.com/mastra-ai/mastra/commit/a3caf25629671bb76fdfdef77189443b02f550b8), [`6650c26`](https://github.com/mastra-ai/mastra/commit/6650c2687c44e3d37f985a8ba7f58ab255ea9a48), [`49eaabb`](https://github.com/mastra-ai/mastra/commit/49eaabb19b1a28e3614cc79e82a30ab342530f85), [`4afecea`](https://github.com/mastra-ai/mastra/commit/4afeceaf2de5ae85e9c14d25227805ebaf3eaace), [`b4fdcf5`](https://github.com/mastra-ai/mastra/commit/b4fdcf59a5df1baeb0c4683bb1e6e0175a37df6d), [`0f8a26f`](https://github.com/mastra-ai/mastra/commit/0f8a26f9112f5946b3c5a3152e79003daaa4cdde), [`0893940`](https://github.com/mastra-ai/mastra/commit/0893940ca2f2017ccb59432fdd93f63748561e3b), [`0f8a26f`](https://github.com/mastra-ai/mastra/commit/0f8a26f9112f5946b3c5a3152e79003daaa4cdde), [`0f8a26f`](https://github.com/mastra-ai/mastra/commit/0f8a26f9112f5946b3c5a3152e79003daaa4cdde), [`0f2df1f`](https://github.com/mastra-ai/mastra/commit/0f2df1f3d69c25a5bbb6f1f046df30e5a83b8e2b), [`b5acfcd`](https://github.com/mastra-ai/mastra/commit/b5acfcdff695b5c3f42512e4939b3b0eed71ac44), [`aa67776`](https://github.com/mastra-ai/mastra/commit/aa6777693de4d78758e8c4f57e5592fe10bb0b03), [`3757223`](https://github.com/mastra-ai/mastra/commit/3757223067acd3f4dd9d9ec53e27a64ee348a834), [`f611832`](https://github.com/mastra-ai/mastra/commit/f611832d661439f6b2aada795dcc16efdc2b12c3), [`d8f11cb`](https://github.com/mastra-ai/mastra/commit/d8f11cb21eb6a809ab7969de47b9abd2f098d2f5), [`0f8a26f`](https://github.com/mastra-ai/mastra/commit/0f8a26f9112f5946b3c5a3152e79003daaa4cdde), [`0f8a26f`](https://github.com/mastra-ai/mastra/commit/0f8a26f9112f5946b3c5a3152e79003daaa4cdde), [`0f8a26f`](https://github.com/mastra-ai/mastra/commit/0f8a26f9112f5946b3c5a3152e79003daaa4cdde), [`b4fdcf5`](https://github.com/mastra-ai/mastra/commit/b4fdcf59a5df1baeb0c4683bb1e6e0175a37df6d), [`944d4bc`](https://github.com/mastra-ai/mastra/commit/944d4bcb13c98c326f326b5a9d870b8a613bf4f5), [`944d4bc`](https://github.com/mastra-ai/mastra/commit/944d4bcb13c98c326f326b5a9d870b8a613bf4f5), [`a5d56cd`](https://github.com/mastra-ai/mastra/commit/a5d56cd4aaec46f84a1217ab2dd62375b6b5e354), [`b4fdcf5`](https://github.com/mastra-ai/mastra/commit/b4fdcf59a5df1baeb0c4683bb1e6e0175a37df6d), [`c351978`](https://github.com/mastra-ai/mastra/commit/c3519781275689a562e9347121b6316c909c5cdb), [`f9feb98`](https://github.com/mastra-ai/mastra/commit/f9feb98ba33a362ace4db6ad8ec6ac01ca933ca5), [`33d1dc2`](https://github.com/mastra-ai/mastra/commit/33d1dc21107c402d244b3ac372d309e0d8e73199), [`4afecea`](https://github.com/mastra-ai/mastra/commit/4afeceaf2de5ae85e9c14d25227805ebaf3eaace), [`8ad7773`](https://github.com/mastra-ai/mastra/commit/8ad7773cd4f50dd344f047547074607f5bb81ff6), [`8ad7773`](https://github.com/mastra-ai/mastra/commit/8ad7773cd4f50dd344f047547074607f5bb81ff6), [`a7c4069`](https://github.com/mastra-ai/mastra/commit/a7c4069df2d7207a74916e2ced5cc35dc42bf3b6), [`f9feb98`](https://github.com/mastra-ai/mastra/commit/f9feb98ba33a362ace4db6ad8ec6ac01ca933ca5), [`4afecea`](https://github.com/mastra-ai/mastra/commit/4afeceaf2de5ae85e9c14d25227805ebaf3eaace)]:
|
|
37
|
+
- @mastra/observability@1.23.2-alpha.0
|
|
38
|
+
- @mastra/core@1.83.0-alpha.0
|
|
39
|
+
- @mastra/libsql@1.30.0-alpha.0
|
|
40
|
+
- @mastra/code-sdk@1.19.0-alpha.0
|
|
41
|
+
- @mastra/memory@1.41.1-alpha.0
|
|
42
|
+
- @mastra/mcp@2.9.0-alpha.0
|
|
43
|
+
- @mastra/duckdb@1.19.0-alpha.0
|
|
44
|
+
- @mastra/pg@1.36.0-alpha.0
|
|
45
|
+
|
|
3
46
|
## 0.49.0
|
|
4
47
|
|
|
5
48
|
### Minor Changes
|
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_tui = require("./tui-
|
|
2
|
+
const require_tui = require("./tui-DojlwY6e.cjs");
|
|
3
3
|
let _mastra_code_sdk = require("@mastra/code-sdk");
|
|
4
4
|
let child_process = require("child_process");
|
|
5
5
|
let fs = require("fs");
|
|
@@ -265,7 +265,7 @@ async function runUpdateCommand({ args = [], output = process.stdout, errorOutpu
|
|
|
265
265
|
}
|
|
266
266
|
// src/version.ts
|
|
267
267
|
function getCurrentVersion() {
|
|
268
|
-
return "0.
|
|
268
|
+
return "0.50.0-alpha.1";
|
|
269
269
|
}
|
|
270
270
|
/** Whether the invocation is `mastracode --version` or `mastracode -v`. */
|
|
271
271
|
function isVersionCommand(argv) {
|
|
@@ -650,7 +650,7 @@ async function main() {
|
|
|
650
650
|
}
|
|
651
651
|
const loginIndex = process.argv.findIndex((arg, index) => index >= 2 && arg !== "--acp" && arg !== "--dangerous-auto-approve");
|
|
652
652
|
if (process.argv[loginIndex] === "login") {
|
|
653
|
-
const { runLoginCommand } = await Promise.resolve().then(() => require("./login-command-
|
|
653
|
+
const { runLoginCommand } = await Promise.resolve().then(() => require("./login-command-DvbCd7Pz.cjs"));
|
|
654
654
|
const code = await runLoginCommand({ args: process.argv.slice(loginIndex + 1) });
|
|
655
655
|
await new Promise((resolve) => process.stdout.write("", resolve));
|
|
656
656
|
return process.exit(code);
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { D as closeActiveBrowser, E as activeBrowserGeneration, O as discardBrowser, T as TUI_CO_AUTHOR, _ as normalizeThemePreference, a as formatUpdateHeader, g as applyThemePreference, i as formatUpToDate, k as replaceActiveBrowser, n as formatInstallingLabel, o as formatUpdateOutcome, r as formatRegistryError, t as MastraTUI } from "./tui-
|
|
2
|
+
import { D as closeActiveBrowser, E as activeBrowserGeneration, O as discardBrowser, T as TUI_CO_AUTHOR, _ as normalizeThemePreference, a as formatUpdateHeader, g as applyThemePreference, i as formatUpToDate, k as replaceActiveBrowser, n as formatInstallingLabel, o as formatUpdateOutcome, r as formatRegistryError, t as MastraTUI } from "./tui-Ba0GZdaT.js";
|
|
3
3
|
import { createMastraCode, resolveSubagentsSetting } from "@mastra/code-sdk";
|
|
4
4
|
import { spawn } from "child_process";
|
|
5
5
|
import fs from "fs";
|
|
@@ -264,7 +264,7 @@ async function runUpdateCommand({ args = [], output = process.stdout, errorOutpu
|
|
|
264
264
|
}
|
|
265
265
|
// src/version.ts
|
|
266
266
|
function getCurrentVersion() {
|
|
267
|
-
return "0.
|
|
267
|
+
return "0.50.0-alpha.1";
|
|
268
268
|
}
|
|
269
269
|
/** Whether the invocation is `mastracode --version` or `mastracode -v`. */
|
|
270
270
|
function isVersionCommand(argv) {
|
|
@@ -649,7 +649,7 @@ async function main() {
|
|
|
649
649
|
}
|
|
650
650
|
const loginIndex = process.argv.findIndex((arg, index) => index >= 2 && arg !== "--acp" && arg !== "--dangerous-auto-approve");
|
|
651
651
|
if (process.argv[loginIndex] === "login") {
|
|
652
|
-
const { runLoginCommand } = await import("./login-command-
|
|
652
|
+
const { runLoginCommand } = await import("./login-command-CT7RA_DY.js");
|
|
653
653
|
const code = await runLoginCommand({ args: process.argv.slice(loginIndex + 1) });
|
|
654
654
|
await new Promise((resolve) => process.stdout.write("", resolve));
|
|
655
655
|
return process.exit(code);
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AuthStorage, getOAuthProviders } from "@mastra/code-sdk/auth/storage";
|
|
2
|
-
import { Writable } from "stream";
|
|
3
2
|
import { openUrlInBrowser } from "@mastra/code-sdk/utils/open-url";
|
|
4
3
|
import { parseArgs } from "util";
|
|
5
4
|
import { PROVIDER_REGISTRY } from "@mastra/core/llm";
|
|
6
5
|
import { createInterface } from "readline";
|
|
6
|
+
import { Writable } from "stream";
|
|
7
7
|
// src/login-command.ts
|
|
8
8
|
async function choose(ask, labels, say) {
|
|
9
9
|
labels.forEach((label, index) => say(` ${index + 1}. ${label}`));
|
|
@@ -94,4 +94,4 @@ async function runLoginCommand({ args = [], input = process.stdin, output = proc
|
|
|
94
94
|
}
|
|
95
95
|
export { runLoginCommand };
|
|
96
96
|
|
|
97
|
-
//# sourceMappingURL=login-command-
|
|
97
|
+
//# sourceMappingURL=login-command-CT7RA_DY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-command-
|
|
1
|
+
{"version":3,"file":"login-command-CT7RA_DY.js","names":[],"sources":["../src/login-command.ts"],"sourcesContent":["import { createInterface } from 'node:readline';\nimport { Writable } from 'node:stream';\nimport type { Readable } from 'node:stream';\nimport { parseArgs } from 'node:util';\nimport { AuthStorage, getOAuthProviders } from '@mastra/code-sdk/auth/storage';\nimport type { OAuthProviderInterface } from '@mastra/code-sdk/auth/types';\nimport { openUrlInBrowser } from '@mastra/code-sdk/utils/open-url';\nimport { PROVIDER_REGISTRY } from '@mastra/core/llm';\n\ntype Ask = (prompt: string, options?: { secret?: boolean }) => Promise<string>;\n\ninterface LoginCommandOptions {\n args?: string[];\n input?: Readable & { isTTY?: boolean };\n output?: NodeJS.WritableStream;\n authStorage?: AuthStorage;\n openUrl?: (url: string) => void;\n}\n\nasync function choose(ask: Ask, labels: string[], say: (line: string) => void): Promise<number | undefined> {\n labels.forEach((label, index) => say(` ${index + 1}. ${label}`));\n const index = Number((await ask('Choose an option: ')).trim()) - 1;\n return Number.isInteger(index) && index >= 0 && index < labels.length ? index : undefined;\n}\n\nasync function signIn(\n ask: Ask,\n provider: OAuthProviderInterface,\n authStorage: AuthStorage,\n openUrl: (url: string) => void,\n say: (line: string) => void,\n): Promise<void> {\n const modes = provider.authModes ?? [];\n let authMode: string | undefined;\n if (modes.length > 1) {\n const index = await choose(\n ask,\n modes.map(mode => mode.name),\n say,\n );\n if (index === undefined) throw new Error('No sign-in method selected');\n authMode = modes[index]!.id;\n }\n await authStorage.login(provider.id, {\n authMode,\n onAuth: ({ url, instructions }) => {\n say(`Open ${url} to sign in`);\n if (instructions) say(instructions);\n openUrl(url);\n },\n onPrompt: ({ message, placeholder }) => ask(`${message}${placeholder ? ` (${placeholder})` : ''} `),\n onProgress: say,\n });\n say(`Signed in to ${provider.name}`);\n}\n\nasync function addApiKey(ask: Ask, authStorage: AuthStorage, say: (line: string) => void): Promise<void> {\n const providerId = (await ask('Provider (for example anthropic, openai, google): ')).trim();\n if (!(providerId in PROVIDER_REGISTRY)) throw new Error(`Unknown provider: ${providerId}`);\n const key = (await ask('API key: ', { secret: true })).trim();\n say('');\n if (!key) throw new Error('No API key entered');\n authStorage.setStoredApiKey(providerId, key);\n say(`Saved the ${providerId} API key`);\n}\n\nexport async function runLoginCommand({\n args = [],\n input = process.stdin,\n output = process.stdout,\n authStorage = new AuthStorage(),\n openUrl = openUrlInBrowser,\n}: LoginCommandOptions = {}): Promise<number> {\n let echo = false;\n const rl = createInterface({\n input,\n output: new Writable({\n write(chunk, encoding, callback) {\n if (echo) output.write(chunk, encoding);\n callback();\n },\n }),\n prompt: '',\n terminal: Boolean(input.isTTY),\n });\n rl.on('line', () => {\n echo = false;\n });\n const lines = rl[Symbol.asyncIterator]();\n const say = (line: string) => output.write(`${line}\\n`);\n const ask: Ask = async (prompt, { secret = false } = {}) => {\n output.write(prompt);\n echo = !secret;\n const line = await lines.next();\n echo = false;\n if (line.done) throw new Error('Input ended before sign-in finished');\n return line.value;\n };\n try {\n const providers = getOAuthProviders();\n const { values } = parseArgs({ args, options: { provider: { type: 'string' } } });\n if (values.provider !== undefined) {\n const provider = providers.find(({ id }) => id === values.provider);\n if (!provider) {\n const ids = providers.map(({ id }) => id).join(', ');\n throw new Error(`Unknown provider: ${values.provider}. Use one of: ${ids}`);\n }\n await signIn(ask, provider, authStorage, openUrl, say);\n return 0;\n }\n say('Sign in to Mastra Code');\n const index = await choose(ask, [...providers.map(provider => provider.name), 'Add an API key'], say);\n if (index === undefined) throw new Error('No option selected');\n const provider = providers[index];\n if (provider) {\n await signIn(ask, provider, authStorage, openUrl, say);\n } else {\n await addApiKey(ask, authStorage, say);\n }\n return 0;\n } catch (error) {\n say(`Sign-in failed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AM,OAAO,KAAK,UAAU,aAAa,SAAS,GAAG;GACrD,OAAO;EACT;EACA,IAAI,wBAAwB;EAC5B,MAAM,QAAQ,MAAM,OAAO,KAAK,CAAC,GAAG,UAAU,KAAI,aAAY,SAAS,IAAI,GAAG,gBAAgB,GAAG,GAAG;EACpG,IAAI,UAAU,KAAA,GAAW,MAAM,IAAI,MAAM,oBAAoB;EAC7D,MAAM,WAAW,UAAU;EAC3B,IAAI,UACF,MAAM,OAAO,KAAK,UAAU,aAAa,SAAS,GAAG;OAErD,MAAM,UAAU,KAAK,aAAa,GAAG;EAEvC,OAAO;CACT,SAAS,OAAO;EACd,IAAI,mBAAmB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG;EAC/E,OAAO;CACT,UAAU;EACR,GAAG,MAAM;CACX;AACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
let _mastra_code_sdk_auth_storage = require("@mastra/code-sdk/auth/storage");
|
|
2
|
-
let stream = require("stream");
|
|
3
2
|
let _mastra_code_sdk_utils_open_url = require("@mastra/code-sdk/utils/open-url");
|
|
4
3
|
let util = require("util");
|
|
5
4
|
let _mastra_core_llm = require("@mastra/core/llm");
|
|
6
5
|
let readline = require("readline");
|
|
6
|
+
let stream = require("stream");
|
|
7
7
|
// src/login-command.ts
|
|
8
8
|
async function choose(ask, labels, say) {
|
|
9
9
|
labels.forEach((label, index) => say(` ${index + 1}. ${label}`));
|
|
@@ -94,4 +94,4 @@ async function runLoginCommand({ args = [], input = process.stdin, output = proc
|
|
|
94
94
|
}
|
|
95
95
|
exports.runLoginCommand = runLoginCommand;
|
|
96
96
|
|
|
97
|
-
//# sourceMappingURL=login-command-
|
|
97
|
+
//# sourceMappingURL=login-command-DvbCd7Pz.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-command-
|
|
1
|
+
{"version":3,"file":"login-command-DvbCd7Pz.cjs","names":["PROVIDER_REGISTRY","AuthStorage","openUrlInBrowser","createInterface","Writable","getOAuthProviders","parseArgs"],"sources":["../src/login-command.ts"],"sourcesContent":["import { createInterface } from 'node:readline';\nimport { Writable } from 'node:stream';\nimport type { Readable } from 'node:stream';\nimport { parseArgs } from 'node:util';\nimport { AuthStorage, getOAuthProviders } from '@mastra/code-sdk/auth/storage';\nimport type { OAuthProviderInterface } from '@mastra/code-sdk/auth/types';\nimport { openUrlInBrowser } from '@mastra/code-sdk/utils/open-url';\nimport { PROVIDER_REGISTRY } from '@mastra/core/llm';\n\ntype Ask = (prompt: string, options?: { secret?: boolean }) => Promise<string>;\n\ninterface LoginCommandOptions {\n args?: string[];\n input?: Readable & { isTTY?: boolean };\n output?: NodeJS.WritableStream;\n authStorage?: AuthStorage;\n openUrl?: (url: string) => void;\n}\n\nasync function choose(ask: Ask, labels: string[], say: (line: string) => void): Promise<number | undefined> {\n labels.forEach((label, index) => say(` ${index + 1}. ${label}`));\n const index = Number((await ask('Choose an option: ')).trim()) - 1;\n return Number.isInteger(index) && index >= 0 && index < labels.length ? index : undefined;\n}\n\nasync function signIn(\n ask: Ask,\n provider: OAuthProviderInterface,\n authStorage: AuthStorage,\n openUrl: (url: string) => void,\n say: (line: string) => void,\n): Promise<void> {\n const modes = provider.authModes ?? [];\n let authMode: string | undefined;\n if (modes.length > 1) {\n const index = await choose(\n ask,\n modes.map(mode => mode.name),\n say,\n );\n if (index === undefined) throw new Error('No sign-in method selected');\n authMode = modes[index]!.id;\n }\n await authStorage.login(provider.id, {\n authMode,\n onAuth: ({ url, instructions }) => {\n say(`Open ${url} to sign in`);\n if (instructions) say(instructions);\n openUrl(url);\n },\n onPrompt: ({ message, placeholder }) => ask(`${message}${placeholder ? ` (${placeholder})` : ''} `),\n onProgress: say,\n });\n say(`Signed in to ${provider.name}`);\n}\n\nasync function addApiKey(ask: Ask, authStorage: AuthStorage, say: (line: string) => void): Promise<void> {\n const providerId = (await ask('Provider (for example anthropic, openai, google): ')).trim();\n if (!(providerId in PROVIDER_REGISTRY)) throw new Error(`Unknown provider: ${providerId}`);\n const key = (await ask('API key: ', { secret: true })).trim();\n say('');\n if (!key) throw new Error('No API key entered');\n authStorage.setStoredApiKey(providerId, key);\n say(`Saved the ${providerId} API key`);\n}\n\nexport async function runLoginCommand({\n args = [],\n input = process.stdin,\n output = process.stdout,\n authStorage = new AuthStorage(),\n openUrl = openUrlInBrowser,\n}: LoginCommandOptions = {}): Promise<number> {\n let echo = false;\n const rl = createInterface({\n input,\n output: new Writable({\n write(chunk, encoding, callback) {\n if (echo) output.write(chunk, encoding);\n callback();\n },\n }),\n prompt: '',\n terminal: Boolean(input.isTTY),\n });\n rl.on('line', () => {\n echo = false;\n });\n const lines = rl[Symbol.asyncIterator]();\n const say = (line: string) => output.write(`${line}\\n`);\n const ask: Ask = async (prompt, { secret = false } = {}) => {\n output.write(prompt);\n echo = !secret;\n const line = await lines.next();\n echo = false;\n if (line.done) throw new Error('Input ended before sign-in finished');\n return line.value;\n };\n try {\n const providers = getOAuthProviders();\n const { values } = parseArgs({ args, options: { provider: { type: 'string' } } });\n if (values.provider !== undefined) {\n const provider = providers.find(({ id }) => id === values.provider);\n if (!provider) {\n const ids = providers.map(({ id }) => id).join(', ');\n throw new Error(`Unknown provider: ${values.provider}. Use one of: ${ids}`);\n }\n await signIn(ask, provider, authStorage, openUrl, say);\n return 0;\n }\n say('Sign in to Mastra Code');\n const index = await choose(ask, [...providers.map(provider => provider.name), 'Add an API key'], say);\n if (index === undefined) throw new Error('No option selected');\n const provider = providers[index];\n if (provider) {\n await signIn(ask, provider, authStorage, openUrl, say);\n } else {\n await addApiKey(ask, authStorage, say);\n }\n return 0;\n } catch (error) {\n say(`Sign-in failed: ${error instanceof Error ? error.message : String(error)}`);\n return 1;\n } finally {\n rl.close();\n }\n}\n"],"mappings":";;;;;;;AAmBA,eAAe,OAAO,KAAU,QAAkB,KAA0D;CAC1G,OAAO,SAAS,OAAO,UAAU,IAAI,KAAK,QAAQ,EAAE,IAAI,OAAO,CAAC;CAChE,MAAM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,CAAC,QAAQ,CAAa;IAE7B,2FAA2F;IAC3F,OAAO,CAAC,YAAY,CAAmB;IAEvC,OAAO,CAAC,QAAQ,CAAS;IACzB,IAAI,OAAO,IAAI,OAAO,CAErB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAGzB;IAED,YAAY,OAAO,EAAE,wBAAwB,EA6B5C;IAED,OAAO,CAAC,eAAe;IA+DvB,qFAAqF;IACrF,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,cAAc;IA+CtB,OAAO,CAAC,mBAAmB;IAS3B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAW9B;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-execution-enhanced.d.ts","sourceRoot":"","sources":["../../../src/tui/components/tool-execution-enhanced.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-execution-enhanced.d.ts","sourceRoot":"","sources":["../../../src/tui/components/tool-execution-enhanced.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAqBlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACX,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,YAAY,EAAE,UAAU,EAAE,CAAC;AAgC3B,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qGAAqG;IACrG,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,C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c;IAQtB,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;CA6D1B;AA+FD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAWnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/tui/handlers/tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/tui/handlers/tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAUjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAqBtD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE5D;AAoBD,wBAAgB,wBAAwB,IAAI,IAAI,CAK/C;AAoGD,wBAAgB,qBAAqB,IAAI,IAAI,CAI5C;AAwBD,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,mBAAmB,EACxB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,GACZ,0BAA0B,GAAG,SAAS,CAqCxC;AA2ED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAgCxD;AAED,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,mBAAmB,EACxB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,GACZ,IAAI,CAiEN;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CA+EnH;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI,CAgB3G;AAoBD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,mBAAmB,EACxB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,QAAQ,GAAG,QAAQ,GAC3B,IAAI,CAWN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,mBAAmB,EACxB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,GACf,IAAI,CAKN;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAsFzG;AAyGD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAY9G;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAkBrF;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,mBAAmB,EACxB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,OAAO,EAChB,gBAAgB,CAAC,EAAE,OAAO,GACzB,IAAI,CA6DN"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Live shell output kept for display, in string code units. Matches the controller's display state. */
|
|
2
|
+
export declare const MAX_DISPLAYED_SHELL_OUTPUT: number;
|
|
3
|
+
/**
|
|
4
|
+
* Appends `chunk` to `existing`, keeping only the last `limit` code units. Slices before
|
|
5
|
+
* concatenating so an oversized chunk never builds an even larger intermediate string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function appendBoundedOutput(existing: string, chunk: string, limit?: number): string;
|
|
8
|
+
//# sourceMappingURL=bounded-output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounded-output.d.ts","sourceRoot":"","sources":["../../../src/tui/utils/bounded-output.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,eAAO,MAAM,0BAA0B,QAAc,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,SAA6B,GAAG,MAAM,CAG/G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-engine.d.ts","sourceRoot":"","sources":["../../../../src/tui/voice/engines/cloud-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAKjE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAa7E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;
|
|
1
|
+
{"version":3,"file":"cloud-engine.d.ts","sourceRoot":"","sources":["../../../../src/tui/voice/engines/cloud-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAKjE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAa7E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAiID,qBAAa,cAAe,YAAW,SAAS;IAGlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,QAAQ,CAAC,IAAI,EAAG,OAAO,CAAU;IAEjC,YAA6B,OAAO,EAAE,kBAAkB,EAAI;IAE5D,UAAU,IAAI,MAAM,GAAG,IAAI,CAM1B;IAED,KAAK,CAAC,SAAS,EAAE,mBAAmB,GAAG,UAAU,CAchD;CACF"}
|
|
@@ -1,63 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Speech-to-text transcription for push-to-talk voice input (cloud path).
|
|
3
|
-
*
|
|
4
|
-
* Provider-agnostic: most supported cloud providers speak the OpenAI
|
|
5
|
-
* `/audio/transcriptions` shape (see `stt-registry.ts`), so we drive them
|
|
6
|
-
* through Mastra's own voice abstraction — `OpenAIVoice` (a `MastraVoice`) from
|
|
7
|
-
* `@mastra/voice-openai`. The `openai` provider uses the default endpoint; every
|
|
8
|
-
* other OpenAI-compatible host is reached by pointing the underlying client at
|
|
9
|
-
* its `baseURL`. Deepgram is not OpenAI-compatible, so it is driven through
|
|
10
|
-
* `DeepgramVoice` from `@mastra/voice-deepgram` instead.
|
|
11
|
-
*
|
|
12
|
-
* Using `MastraVoice.listen()` keeps this aligned with the framework's voice
|
|
13
|
-
* ecosystem and normalizes provider responses to a transcript string. The voice
|
|
14
|
-
* package constructs its own SDK client internally, so this avoids coupling to a
|
|
15
|
-
* specific `@ai-sdk/*` model-spec version.
|
|
16
|
-
*
|
|
17
|
-
* Note: OpenAI OAuth (Codex) tokens cannot be used for the audio transcription
|
|
18
|
-
* REST endpoint, so a real provider API key is required.
|
|
19
|
-
*/
|
|
20
1
|
import type { AuthStorage } from '@mastra/code-sdk/auth/storage';
|
|
2
|
+
import type { CloudEngineOptions } from './engines/cloud-engine.js';
|
|
3
|
+
export declare function voiceCredentialMessage(provider: string): string;
|
|
21
4
|
export declare class VoiceCredentialError extends Error {
|
|
22
5
|
constructor(provider: string);
|
|
23
6
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Resolve an API key for a cloud STT provider.
|
|
26
|
-
* Honors the env-overrides-stored-key contract: the provider's env var wins,
|
|
27
|
-
* then the stored credential is used as a fallback.
|
|
28
|
-
*/
|
|
29
|
-
export declare function resolveProviderApiKey(provider: string, authStorage?: AuthStorage): string | undefined;
|
|
30
|
-
export interface TranscribeOptions {
|
|
31
|
-
/** STT provider id (see `stt-registry.ts`). Defaults to the registry default. */
|
|
32
|
-
provider?: string;
|
|
33
|
-
/** Model id within the provider. Defaults to the provider's default model. */
|
|
34
|
-
model?: string;
|
|
35
|
-
authStorage?: AuthStorage;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Transcribe recorded WAV audio to text via the configured cloud provider.
|
|
39
|
-
* Throws VoiceCredentialError if no API key is available for the provider.
|
|
40
|
-
*/
|
|
41
|
-
export declare function transcribeAudio(audio: Buffer, options?: TranscribeOptions): Promise<string>;
|
|
42
|
-
/**
|
|
43
|
-
* A reusable transcriber bound to one provider/model. Building the underlying
|
|
44
|
-
* `MastraVoice` client once and reusing it across calls lets the HTTP client
|
|
45
|
-
* keep its connection to the provider warm (keep-alive), which removes the
|
|
46
|
-
* DNS + TLS handshake cost from every live-partial tick — the main reason the
|
|
47
|
-
* first dictation streams in slowly while later ones feel instant.
|
|
48
|
-
*/
|
|
49
7
|
export interface ReusableTranscriber {
|
|
50
8
|
transcribe(audio: Buffer): Promise<string>;
|
|
51
9
|
}
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
* Resolves the provider/model and API key once up front (throwing
|
|
55
|
-
* `VoiceCredentialError` if no key is available), so a session can build it on
|
|
56
|
-
* start and call `transcribe()` per tick without re-resolving or reconnecting.
|
|
57
|
-
*/
|
|
58
|
-
export declare function createTranscriber(options?: TranscribeOptions): ReusableTranscriber;
|
|
59
|
-
/**
|
|
60
|
-
* Check whether a cloud STT provider has a usable API key, without recording.
|
|
61
|
-
*/
|
|
10
|
+
/** Throws `VoiceCredentialError` up front when the provider has no key. */
|
|
11
|
+
export declare function createTranscriber(options: CloudEngineOptions): ReusableTranscriber;
|
|
62
12
|
export declare function hasProviderCredential(provider: string, authStorage?: AuthStorage): boolean;
|
|
63
13
|
//# sourceMappingURL=transcribe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcribe.d.ts","sourceRoot":"","sources":["../../../src/tui/voice/transcribe.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"transcribe.d.ts","sourceRoot":"","sources":["../../../src/tui/voice/transcribe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAIjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI/D;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,QAAQ,EAAE,MAAM,EAG3B;CACF;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5C;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,mBAAmB,CAYlF;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAE1F"}
|
|
@@ -26,8 +26,8 @@ import { DEFAULT_MAX_TURNS, GoalManager } from "@mastra/code-sdk/goal-manager";
|
|
|
26
26
|
import { buildContextAudit } from "@mastra/code-sdk/agents/context-audit";
|
|
27
27
|
import { getDynamicInstructionSections } from "@mastra/code-sdk/agents/instructions";
|
|
28
28
|
import { formatSkillsCatalog } from "@mastra/core/processors";
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
29
|
+
import { defaultModelForProvider, resolveSTTModel, sttModelsForProvider, sttProviders } from "@mastra/code-sdk/voice/stt-registry";
|
|
30
|
+
import { createSTTTranscriber, resolveSTTApiKey, sttApiKeyEnvVar } from "@mastra/code-sdk/voice/transcribe";
|
|
31
31
|
import { THINK_COMMAND_DESCRIPTOR, isThinkingLevelSetting, parseThinkCommand } from "@mastra/code-sdk/thinking";
|
|
32
32
|
import { getCatalogThinkingLevels, runCatalogThinkingLevel } from "@mastra/code-sdk/thinking-catalog";
|
|
33
33
|
import { VALID_EVENTS } from "@mastra/code-sdk/hooks/index";
|
|
@@ -4262,10 +4262,15 @@ var AskQuestionDialogComponent = class AskQuestionDialogComponent extends Box {
|
|
|
4262
4262
|
else this.buildInputMode();
|
|
4263
4263
|
}
|
|
4264
4264
|
buildSelectMode(opts) {
|
|
4265
|
-
const
|
|
4266
|
-
|
|
4267
|
-
label
|
|
4268
|
-
|
|
4265
|
+
const singleLine = (text) => text.replace(/\s*[\r\n]+\s*/g, " ").trim();
|
|
4266
|
+
const items = opts.map((opt) => {
|
|
4267
|
+
const label = singleLine(opt.label);
|
|
4268
|
+
const description = opt.description ? singleLine(opt.description) : "";
|
|
4269
|
+
return {
|
|
4270
|
+
value: opt.label,
|
|
4271
|
+
label: description ? ` ${label} ${theme.fg("dim", description)}` : ` ${label}`
|
|
4272
|
+
};
|
|
4273
|
+
});
|
|
4269
4274
|
if (this.allowCustomResponse && !this.multiSelect) items.push({
|
|
4270
4275
|
value: AskQuestionDialogComponent.CUSTOM_RESPONSE_VALUE,
|
|
4271
4276
|
label: ` ${theme.fg("dim", "✎ Custom response...")}`
|
|
@@ -4414,111 +4419,29 @@ async function openMacSettings(url) {
|
|
|
4414
4419
|
});
|
|
4415
4420
|
}
|
|
4416
4421
|
// src/tui/voice/transcribe.ts
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
* `/audio/transcriptions` shape (see `stt-registry.ts`), so we drive them
|
|
4422
|
-
* through Mastra's own voice abstraction — `OpenAIVoice` (a `MastraVoice`) from
|
|
4423
|
-
* `@mastra/voice-openai`. The `openai` provider uses the default endpoint; every
|
|
4424
|
-
* other OpenAI-compatible host is reached by pointing the underlying client at
|
|
4425
|
-
* its `baseURL`. Deepgram is not OpenAI-compatible, so it is driven through
|
|
4426
|
-
* `DeepgramVoice` from `@mastra/voice-deepgram` instead.
|
|
4427
|
-
*
|
|
4428
|
-
* Using `MastraVoice.listen()` keeps this aligned with the framework's voice
|
|
4429
|
-
* ecosystem and normalizes provider responses to a transcript string. The voice
|
|
4430
|
-
* package constructs its own SDK client internally, so this avoids coupling to a
|
|
4431
|
-
* specific `@ai-sdk/*` model-spec version.
|
|
4432
|
-
*
|
|
4433
|
-
* Note: OpenAI OAuth (Codex) tokens cannot be used for the audio transcription
|
|
4434
|
-
* REST endpoint, so a real provider API key is required.
|
|
4435
|
-
*/
|
|
4436
|
-
/**
|
|
4437
|
-
* Per-provider environment variable that holds an API key, checked before the
|
|
4438
|
-
* stored credential. Mirrors the key names used elsewhere in MastraCode.
|
|
4439
|
-
*/
|
|
4440
|
-
const PROVIDER_ENV_VAR = {
|
|
4441
|
-
openai: "OPENAI_API_KEY",
|
|
4442
|
-
groq: "GROQ_API_KEY",
|
|
4443
|
-
alibaba: "DASHSCOPE_API_KEY",
|
|
4444
|
-
"alibaba-cn": "DASHSCOPE_API_KEY",
|
|
4445
|
-
scaleway: "SCALEWAY_API_KEY",
|
|
4446
|
-
nvidia: "NVIDIA_API_KEY",
|
|
4447
|
-
nearai: "NEAR_AI_API_KEY",
|
|
4448
|
-
evroc: "EVROC_API_KEY",
|
|
4449
|
-
deepgram: "DEEPGRAM_API_KEY"
|
|
4450
|
-
};
|
|
4422
|
+
function voiceCredentialMessage(provider) {
|
|
4423
|
+
const envVar = sttApiKeyEnvVar(provider);
|
|
4424
|
+
return `Voice input needs a ${provider} API key. ${envVar ? `Set ${envVar} or add one with /api-keys` : "Add one with /api-keys"} (OAuth tokens are not supported for transcription).`;
|
|
4425
|
+
}
|
|
4451
4426
|
var VoiceCredentialError = class extends Error {
|
|
4452
4427
|
constructor(provider) {
|
|
4453
|
-
super(
|
|
4428
|
+
super(voiceCredentialMessage(provider));
|
|
4454
4429
|
this.name = "VoiceCredentialError";
|
|
4455
4430
|
}
|
|
4456
4431
|
};
|
|
4457
|
-
/**
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
*/
|
|
4462
|
-
function resolveProviderApiKey(provider, authStorage) {
|
|
4463
|
-
const envVar = PROVIDER_ENV_VAR[provider];
|
|
4464
|
-
const fromEnv = envVar ? process.env[envVar]?.trim() : void 0;
|
|
4465
|
-
if (fromEnv) return fromEnv;
|
|
4466
|
-
return authStorage?.getStoredApiKey(provider);
|
|
4467
|
-
}
|
|
4468
|
-
/**
|
|
4469
|
-
* Build a `MastraVoice` for an STT registry entry.
|
|
4470
|
-
* - `deepgram`: `DeepgramVoice` (Deepgram SDK; not OpenAI-compatible).
|
|
4471
|
-
* - everything else: `OpenAIVoice`, where `listeningModel.name` is the model id
|
|
4472
|
-
* and `options.baseURL` redirects OpenAI-compatible hosts at their endpoint.
|
|
4473
|
-
*/
|
|
4474
|
-
async function buildVoice(entry, apiKey) {
|
|
4475
|
-
if (entry.resolver === "deepgram") {
|
|
4476
|
-
const { DeepgramVoice } = await import("@mastra/voice-deepgram");
|
|
4477
|
-
return new DeepgramVoice({ listeningModel: {
|
|
4478
|
-
name: entry.model,
|
|
4479
|
-
apiKey
|
|
4480
|
-
} });
|
|
4481
|
-
}
|
|
4482
|
-
const { OpenAIVoice } = await import("@mastra/voice-openai");
|
|
4483
|
-
return new OpenAIVoice({ listeningModel: {
|
|
4484
|
-
name: entry.model,
|
|
4485
|
-
apiKey,
|
|
4486
|
-
...entry.resolver === "openai-compatible" && entry.baseURL ? { options: { baseURL: entry.baseURL } } : {}
|
|
4487
|
-
} });
|
|
4488
|
-
}
|
|
4489
|
-
/**
|
|
4490
|
-
* Create a transcriber that reuses a single provider client across calls.
|
|
4491
|
-
* Resolves the provider/model and API key once up front (throwing
|
|
4492
|
-
* `VoiceCredentialError` if no key is available), so a session can build it on
|
|
4493
|
-
* start and call `transcribe()` per tick without re-resolving or reconnecting.
|
|
4494
|
-
*/
|
|
4495
|
-
function createTranscriber(options = {}) {
|
|
4496
|
-
const entry = resolveSTTModel(options.provider, options.model) ?? DEFAULT_STT_MODEL;
|
|
4497
|
-
const apiKey = resolveProviderApiKey(entry.provider, options.authStorage);
|
|
4432
|
+
/** Throws `VoiceCredentialError` up front when the provider has no key. */
|
|
4433
|
+
function createTranscriber(options) {
|
|
4434
|
+
const entry = resolveSTTModel(options.provider, options.model);
|
|
4435
|
+
const apiKey = resolveSTTApiKey(entry.provider, options.authStorage);
|
|
4498
4436
|
if (!apiKey) throw new VoiceCredentialError(entry.provider);
|
|
4499
|
-
const
|
|
4500
|
-
|
|
4437
|
+
const transcriber = createSTTTranscriber(entry, apiKey);
|
|
4438
|
+
transcriber.catch(() => {});
|
|
4501
4439
|
return { async transcribe(audio) {
|
|
4502
|
-
return
|
|
4440
|
+
return (await transcriber).transcribe(audio, "wav");
|
|
4503
4441
|
} };
|
|
4504
4442
|
}
|
|
4505
|
-
/**
|
|
4506
|
-
* Check whether a cloud STT provider has a usable API key, without recording.
|
|
4507
|
-
*/
|
|
4508
4443
|
function hasProviderCredential(provider, authStorage) {
|
|
4509
|
-
return
|
|
4510
|
-
}
|
|
4511
|
-
/**
|
|
4512
|
-
* `MastraVoice.listen()` returns a string for OpenAI-shaped transcription, but
|
|
4513
|
-
* other provider subclasses may return `{ transcript }` — normalize both.
|
|
4514
|
-
*/
|
|
4515
|
-
function normalizeTranscript(result) {
|
|
4516
|
-
if (typeof result === "string") return result.trim();
|
|
4517
|
-
if (result && typeof result === "object" && "transcript" in result) {
|
|
4518
|
-
const transcript = result.transcript;
|
|
4519
|
-
if (typeof transcript === "string") return transcript.trim();
|
|
4520
|
-
}
|
|
4521
|
-
return "";
|
|
4444
|
+
return resolveSTTApiKey(provider, authStorage) !== void 0;
|
|
4522
4445
|
}
|
|
4523
4446
|
// src/tui/commands/voice.ts
|
|
4524
4447
|
/**
|
|
@@ -8485,6 +8408,24 @@ function highlightCode(code, language, colors = CODE_HIGHLIGHT_THEME) {
|
|
|
8485
8408
|
}).value;
|
|
8486
8409
|
return parseHighlightHtml(html).map((node) => colorize(node, colors, false)).join("");
|
|
8487
8410
|
}
|
|
8411
|
+
// src/tui/utils/bounded-output.ts
|
|
8412
|
+
/** Live shell output kept for display, in string code units. Matches the controller's display state. */
|
|
8413
|
+
const MAX_DISPLAYED_SHELL_OUTPUT = 1048576;
|
|
8414
|
+
/**
|
|
8415
|
+
* Appends `chunk` to `existing`, keeping only the last `limit` code units. Slices before
|
|
8416
|
+
* concatenating so an oversized chunk never builds an even larger intermediate string.
|
|
8417
|
+
*/
|
|
8418
|
+
function appendBoundedOutput(existing, chunk, limit = MAX_DISPLAYED_SHELL_OUTPUT) {
|
|
8419
|
+
if (chunk.length >= limit) return copyTail(chunk, limit);
|
|
8420
|
+
return existing.slice(-(limit - chunk.length)) + chunk;
|
|
8421
|
+
}
|
|
8422
|
+
/**
|
|
8423
|
+
* Returns the last `length` code units as an independent string. A plain `slice` can share the
|
|
8424
|
+
* parent's memory, which would keep an oversized chunk alive after it has been trimmed.
|
|
8425
|
+
*/
|
|
8426
|
+
function copyTail(text, length) {
|
|
8427
|
+
return JSON.parse(JSON.stringify(text.slice(-length)));
|
|
8428
|
+
}
|
|
8488
8429
|
// src/tui/components/collapsible.ts
|
|
8489
8430
|
/**
|
|
8490
8431
|
* Generic collapsible container component.
|
|
@@ -9012,7 +8953,7 @@ var ToolExecutionComponentEnhanced = class extends WidthAwareContainer {
|
|
|
9012
8953
|
*/
|
|
9013
8954
|
appendStreamingOutput(output) {
|
|
9014
8955
|
if (this.toolName !== MC_TOOLS.EXECUTE_COMMAND && this.toolName !== MC_TOOLS.GET_PROCESS_OUTPUT && this.toolName !== MC_TOOLS.KILL_PROCESS) return;
|
|
9015
|
-
this.streamingOutput
|
|
8956
|
+
this.streamingOutput = appendBoundedOutput(this.streamingOutput, sanitizeAnsiForRendering(output));
|
|
9016
8957
|
this.rebuild();
|
|
9017
8958
|
}
|
|
9018
8959
|
setExpanded(expanded) {
|
|
@@ -11107,7 +11048,7 @@ function flushPendingShellOutput(ctx, toolCallId) {
|
|
|
11107
11048
|
function handleShellOutput(ctx, toolCallId, output, _stream) {
|
|
11108
11049
|
const pending = pendingShellOutputs.get(toolCallId);
|
|
11109
11050
|
if (pending) {
|
|
11110
|
-
pending.output
|
|
11051
|
+
pending.output = appendBoundedOutput(pending.output, output);
|
|
11111
11052
|
return;
|
|
11112
11053
|
}
|
|
11113
11054
|
pendingShellOutputs.set(toolCallId, {
|
|
@@ -12474,11 +12415,7 @@ var CloudSession = class {
|
|
|
12474
12415
|
constructor(recorder, options, callbacks) {
|
|
12475
12416
|
this.options = options;
|
|
12476
12417
|
this.callbacks = callbacks;
|
|
12477
|
-
this.transcriber = createTranscriber(
|
|
12478
|
-
provider: this.options.provider,
|
|
12479
|
-
model: this.options.model,
|
|
12480
|
-
authStorage: this.options.authStorage
|
|
12481
|
-
});
|
|
12418
|
+
this.transcriber = createTranscriber(this.options);
|
|
12482
12419
|
try {
|
|
12483
12420
|
this.recording = new MicRecording(recorder);
|
|
12484
12421
|
} catch {
|
|
@@ -12572,10 +12509,7 @@ var CloudSTTEngine = class {
|
|
|
12572
12509
|
}
|
|
12573
12510
|
checkReady() {
|
|
12574
12511
|
if (!detectRecorder()) return missingRecorderMessage();
|
|
12575
|
-
if (!hasProviderCredential(this.options.provider, this.options.authStorage))
|
|
12576
|
-
const env = this.options.provider === "openai" ? "OPENAI_API_KEY" : `${this.options.provider.toUpperCase()}_API_KEY`;
|
|
12577
|
-
return `Voice input needs a ${this.options.provider} API key. Set ${env} or add one with /api-keys.`;
|
|
12578
|
-
}
|
|
12512
|
+
if (!hasProviderCredential(this.options.provider, this.options.authStorage)) return voiceCredentialMessage(this.options.provider);
|
|
12579
12513
|
return null;
|
|
12580
12514
|
}
|
|
12581
12515
|
start(callbacks) {
|
|
@@ -28774,4 +28708,4 @@ var MastraTUI = class MastraTUI {
|
|
|
28774
28708
|
};
|
|
28775
28709
|
export { mastraBrand as C, closeActiveBrowser as D, activeBrowserGeneration as E, discardBrowser as O, mastra as S, TUI_CO_AUTHOR as T, normalizeThemePreference as _, formatUpdateHeader as a, getMarkdownTheme as b, LoginDialogComponent as c, createTUIState as d, UserMessageComponent as f, applyThemePreference as g, AssistantMessageComponent as h, formatUpToDate as i, replaceActiveBrowser as k, OMProgressComponent as l, ModelSelectorComponent as m, formatInstallingLabel as n, formatUpdateOutcome as o, ToolExecutionComponentEnhanced as p, formatRegistryError as r, LoginSelectorComponent as s, MastraTUI as t, formatOMStatus as u, applyThemeMode as v, theme as w, getThemeMode as x, getEditorTheme as y };
|
|
28776
28710
|
|
|
28777
|
-
//# sourceMappingURL=tui-
|
|
28711
|
+
//# sourceMappingURL=tui-Ba0GZdaT.js.map
|