mastracode 0.48.1 → 0.48.2-alpha.0
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 +23 -0
- package/dist/browser-lifecycle.d.ts +17 -0
- package/dist/browser-lifecycle.d.ts.map +1 -0
- package/dist/cli.cjs +15 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +15 -4
- package/dist/cli.js.map +1 -1
- package/dist/commit-attribution.d.ts +1 -1
- package/dist/commit-attribution.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/initial-prompt.d.ts +3 -3
- package/dist/tui/assistant-render-registry.d.ts.map +1 -1
- package/dist/tui/background-tool-result.d.ts +1 -1
- package/dist/tui/commands/browser.d.ts.map +1 -1
- package/dist/tui/components/account-switch-notice.d.ts.map +1 -1
- package/dist/tui/components/api-key-dialog.d.ts.map +1 -1
- package/dist/tui/components/ask-question-dialog.d.ts.map +1 -1
- package/dist/tui/components/ask-question-inline.d.ts.map +1 -1
- package/dist/tui/components/assistant-message.d.ts.map +1 -1
- package/dist/tui/components/background-activity-selector.d.ts.map +1 -1
- package/dist/tui/components/banner.d.ts.map +1 -1
- package/dist/tui/components/chat-boundary-spacer.d.ts.map +1 -1
- package/dist/tui/components/collapsible.d.ts.map +1 -1
- package/dist/tui/components/custom-editor.d.ts.map +1 -1
- package/dist/tui/components/diff-output.d.ts.map +1 -1
- package/dist/tui/components/error-display.d.ts.map +1 -1
- package/dist/tui/components/github-pr-picker.d.ts.map +1 -1
- package/dist/tui/components/global-background-notice.d.ts.map +1 -1
- package/dist/tui/components/goal-cycles-dialog.d.ts.map +1 -1
- package/dist/tui/components/idle-counter.d.ts.map +1 -1
- package/dist/tui/components/judge-display.d.ts.map +1 -1
- package/dist/tui/components/knowledge-browser.d.ts.map +1 -1
- package/dist/tui/components/login-account-manager.d.ts.map +1 -1
- package/dist/tui/components/login-dialog.d.ts.map +1 -1
- package/dist/tui/components/login-mode-selector.d.ts.map +1 -1
- package/dist/tui/components/login-selector.d.ts.map +1 -1
- package/dist/tui/components/masked-input.d.ts.map +1 -1
- package/dist/tui/components/mcp-selector.d.ts.map +1 -1
- package/dist/tui/components/model-selector.d.ts.map +1 -1
- package/dist/tui/components/multi-step-progress.d.ts.map +1 -1
- package/dist/tui/components/multiline-input.d.ts.map +1 -1
- package/dist/tui/components/notification-summary.d.ts.map +1 -1
- package/dist/tui/components/notification.d.ts.map +1 -1
- package/dist/tui/components/obi-loader.d.ts.map +1 -1
- package/dist/tui/components/om-marker.d.ts.map +1 -1
- package/dist/tui/components/om-output.d.ts.map +1 -1
- package/dist/tui/components/om-progress.d.ts.map +1 -1
- package/dist/tui/components/om-settings.d.ts.map +1 -1
- package/dist/tui/components/plan-approval-inline.d.ts.map +1 -1
- package/dist/tui/components/reactive-signal.d.ts.map +1 -1
- package/dist/tui/components/schedule-fire.d.ts.map +1 -1
- package/dist/tui/components/settings.d.ts.map +1 -1
- package/dist/tui/components/shell-output.d.ts.map +1 -1
- package/dist/tui/components/simple-progress.d.ts.map +1 -1
- package/dist/tui/components/slash-command.d.ts.map +1 -1
- package/dist/tui/components/state-signal.d.ts.map +1 -1
- package/dist/tui/components/subagent-execution.d.ts.map +1 -1
- package/dist/tui/components/subconscious-activity.d.ts.map +1 -1
- package/dist/tui/components/system-reminder.d.ts.map +1 -1
- package/dist/tui/components/task-progress.d.ts.map +1 -1
- package/dist/tui/components/temporal-gap.d.ts.map +1 -1
- package/dist/tui/components/thinking-settings.d.ts.map +1 -1
- package/dist/tui/components/thread-selector.d.ts.map +1 -1
- package/dist/tui/components/tool-approval-dialog.d.ts.map +1 -1
- package/dist/tui/components/tool-execution-enhanced.d.ts.map +1 -1
- package/dist/tui/components/tool-validation-error.d.ts.map +1 -1
- package/dist/tui/components/user-message.d.ts.map +1 -1
- package/dist/tui/components/width-aware-container.d.ts.map +1 -1
- package/dist/tui/components/wrapping-autocomplete-list.d.ts.map +1 -1
- package/dist/tui/components/wrapping-select-list.d.ts.map +1 -1
- package/dist/tui/footer-animation-renderer.d.ts.map +1 -1
- package/dist/tui/mastra-tui.d.ts.map +1 -1
- package/dist/tui/onboarding-inline.d.ts.map +1 -1
- package/dist/tui/render-scheduler.d.ts.map +1 -1
- package/dist/tui/shell-runner.d.ts +3 -3
- package/dist/tui/theme.d.ts +36 -36
- package/dist/tui/theme.d.ts.map +1 -1
- package/dist/tui/voice/engines/cloud-engine.d.ts +1 -1
- package/dist/tui/voice/engines/cloud-engine.d.ts.map +1 -1
- package/dist/tui/voice/engines/macos-native-engine.d.ts +1 -1
- package/dist/tui/voice/engines/macos-native-engine.d.ts.map +1 -1
- package/dist/tui/voice/mic-capture.d.ts.map +1 -1
- package/dist/tui/voice/transcribe.d.ts.map +1 -1
- package/dist/tui/voice/voice-controller.d.ts.map +1 -1
- package/dist/{tui-ByXZNoag.cjs → tui-4Evog5Ks.cjs} +150 -21
- package/dist/tui-4Evog5Ks.cjs.map +1 -0
- package/dist/{tui-CEuwbh2h.js → tui-Db51Stlv.js} +127 -22
- package/dist/tui-Db51Stlv.js.map +1 -0
- package/dist/tui.cjs +1 -1
- package/dist/tui.js +1 -1
- package/package.json +15 -15
- package/dist/tui-ByXZNoag.cjs.map +0 -1
- package/dist/tui-CEuwbh2h.js.map +0 -1
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { PermissionGuidance, STTEngine, STTSession, STTSessionCallbacks } from './types.js';
|
|
17
17
|
export declare class MacosNativeSTTEngine implements STTEngine {
|
|
18
|
-
readonly kind:
|
|
18
|
+
readonly kind: 'macos-native';
|
|
19
19
|
checkReady(): string | null;
|
|
20
20
|
/**
|
|
21
21
|
* Deeper preflight: confirm the Swift toolchain compiles the recognizer, then
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macos-native-engine.d.ts","sourceRoot":"","sources":["../../../../src/tui/voice/engines/macos-native-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAqcjG,qBAAa,oBAAqB,YAAW,SAAS;IACpD,QAAQ,CAAC,IAAI,EAAG,cAAc,CAAU;IAExC,UAAU,IAAI,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"macos-native-engine.d.ts","sourceRoot":"","sources":["../../../../src/tui/voice/engines/macos-native-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAqcjG,qBAAa,oBAAqB,YAAW,SAAS;IACpD,QAAQ,CAAC,IAAI,EAAG,cAAc,CAAU;IAExC,UAAU,IAAI,MAAM,GAAG,IAAI,CAK1B;IAED;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAarC;IAED;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAyB/C;IAED,KAAK,CAAC,SAAS,EAAE,mBAAmB,GAAG,UAAU,CAEhD;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mic-capture.d.ts","sourceRoot":"","sources":["../../../src/tui/voice/mic-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,uDAAuD;IACvD,GAAG,EAAE,MAAM,CAAC;CACb;AAKD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,YAAY,GAAG,IAAI,CAsBpD;AAYD;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,OAAO,CAAS;
|
|
1
|
+
{"version":3,"file":"mic-capture.d.ts","sourceRoot":"","sources":["../../../src/tui/voice/mic-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,uDAAuD;IACvD,GAAG,EAAE,MAAM,CAAC;CACb;AAKD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,YAAY,GAAG,IAAI,CAsBpD;AAYD;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,OAAO,CAAS;IAExB,YAAY,QAAQ,EAAE,YAAY,EAoBjC;IAED;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA8BnC;IAED;;;;;;;OAOG;IACH,QAAQ,IAAI,MAAM,GAAG,IAAI,CAWxB;IAED;;OAEG;IACH,MAAM,IAAI,IAAI,CASb;IAED,OAAO,CAAC,OAAO;CAOhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcribe.d.ts","sourceRoot":"","sources":["../../../src/tui/voice/transcribe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AA6BjE,qBAAa,oBAAqB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"transcribe.d.ts","sourceRoot":"","sources":["../../../src/tui/voice/transcribe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AA6BjE,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,QAAQ,EAAE,MAAM,EAO3B;CACF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAKrG;AA6BD,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAUrG;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,iBAAsB,GAAG,mBAAmB,CAetF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAE1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-controller.d.ts","sourceRoot":"","sources":["../../../src/tui/voice/voice-controller.ts"],"names":[],"mappings":"AAAA;;;;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AErB;IAED,WAAW,IAAI,OAAO,CAErB;IAED;;;;OAIG;IACH,MAAM,IAAI,OAAO,CAMhB;IAED,MAAM,IAAI,OAAO,CAShB;IAED;;;;OAIG;IACH,cAAc,IAAI,IAAI,CAIrB;IAED,OAAO,IAAI,IAAI,CAId;IAED;;;;OAIG;IACH,cAAc,IAAI,IAAI,CA4BrB;IAED;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAWnC;IAED;;OAEG;IACH,eAAe,IAAI,IAAI,CAStB;IAED;;;;OAIG;YACW,kBAAkB;IAmBhC;;;;OAIG;YACW,gBAAgB;CAW/B"}
|
|
@@ -88,6 +88,70 @@ let _mastra_core_request_context = require("@mastra/core/request-context");
|
|
|
88
88
|
let _mastra_code_sdk_utils_maintenance_lock = require("@mastra/code-sdk/utils/maintenance-lock");
|
|
89
89
|
let _mastra_code_sdk_utils_storage_maintenance = require("@mastra/code-sdk/utils/storage-maintenance");
|
|
90
90
|
let _mastra_code_sdk_utils_slash_command_loader = require("@mastra/code-sdk/utils/slash-command-loader");
|
|
91
|
+
// src/browser-lifecycle.ts
|
|
92
|
+
/**
|
|
93
|
+
* The browser Mastra Code's agents currently use. Mastra Code owns it: a local
|
|
94
|
+
* browser keeps running (and holds its profile's lock) until it is closed, so
|
|
95
|
+
* it must be closed when replaced and when Mastra Code exits.
|
|
96
|
+
*/
|
|
97
|
+
let activeBrowser;
|
|
98
|
+
const CLOSE_TIMEOUT_MS = 5e3;
|
|
99
|
+
/**
|
|
100
|
+
* Retire a browser: it closes and never relaunches, even for a tool call that
|
|
101
|
+
* still holds it. If close fails or takes longer than CLOSE_TIMEOUT_MS, its
|
|
102
|
+
* processes are killed so the old Chrome cannot keep holding the profile.
|
|
103
|
+
*/
|
|
104
|
+
async function closeBrowser(browser) {
|
|
105
|
+
let timer;
|
|
106
|
+
const closed = await Promise.race([browser.retire().then(() => true, () => false), new Promise((resolve) => {
|
|
107
|
+
timer = setTimeout(() => resolve(false), CLOSE_TIMEOUT_MS);
|
|
108
|
+
timer.unref?.();
|
|
109
|
+
})]);
|
|
110
|
+
clearTimeout(timer);
|
|
111
|
+
if (!closed) browser.killProcesses();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Counts replacements, so a caller that started creating a browser can tell
|
|
115
|
+
* whether another caller replaced the active browser in the meantime.
|
|
116
|
+
*/
|
|
117
|
+
let generation = 0;
|
|
118
|
+
function activeBrowserGeneration() {
|
|
119
|
+
return generation;
|
|
120
|
+
}
|
|
121
|
+
/** Close a browser that never became active. Bounded like any other close. */
|
|
122
|
+
function discardBrowser(browser) {
|
|
123
|
+
return closeBrowser(browser);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Every close still in flight, chained so a later replacement (or exit) waits
|
|
127
|
+
* for all of them, not just the browser it replaced. Each browser is retired once.
|
|
128
|
+
*/
|
|
129
|
+
let retiring = Promise.resolve();
|
|
130
|
+
let retiringBrowser;
|
|
131
|
+
/**
|
|
132
|
+
* Make `next` the active browser, closing the previous one first so it
|
|
133
|
+
* releases its profile before `next` launches on it. Also waits for any
|
|
134
|
+
* browser an earlier replacement is still closing.
|
|
135
|
+
*
|
|
136
|
+
* Returns whether `next` is still the active browser once those closes finish.
|
|
137
|
+
* False means a later call replaced (and closed) it meanwhile, so the caller
|
|
138
|
+
* must not hand `next` to agents.
|
|
139
|
+
*/
|
|
140
|
+
async function replaceActiveBrowser(next) {
|
|
141
|
+
const previous = activeBrowser;
|
|
142
|
+
activeBrowser = next;
|
|
143
|
+
const mine = ++generation;
|
|
144
|
+
if (previous && previous !== next && previous !== retiringBrowser) {
|
|
145
|
+
retiringBrowser = previous;
|
|
146
|
+
retiring = Promise.all([retiring, closeBrowser(previous)]).then(() => {});
|
|
147
|
+
}
|
|
148
|
+
await retiring;
|
|
149
|
+
return generation === mine;
|
|
150
|
+
}
|
|
151
|
+
/** Close the active browser. Bounded so a hung browser cannot block exit. */
|
|
152
|
+
async function closeActiveBrowser() {
|
|
153
|
+
await replaceActiveBrowser(void 0);
|
|
154
|
+
}
|
|
91
155
|
// src/commit-attribution.ts
|
|
92
156
|
const TUI_CO_AUTHOR = { name: "mastracode" };
|
|
93
157
|
// src/tui/bundled-themes.ts
|
|
@@ -19822,16 +19886,28 @@ function resolveModeAgent(mode, agentControllerState) {
|
|
|
19822
19886
|
/**
|
|
19823
19887
|
* @param chatModelId the chat model passed to `createBrowserFromSettings` for
|
|
19824
19888
|
* this browser, so the recorded model matches what was really launched.
|
|
19889
|
+
* @param startedAt `activeBrowserGeneration()` read before this call started
|
|
19890
|
+
* creating `browser`. If another /browser call replaced the active browser
|
|
19891
|
+
* since then, that call owns the agents: `browser` is discarded and false returned.
|
|
19825
19892
|
*/
|
|
19826
|
-
function applyBrowserToAgents(ctx, browser, browserSettings, chatModelId) {
|
|
19827
|
-
|
|
19828
|
-
|
|
19829
|
-
|
|
19830
|
-
|
|
19893
|
+
async function applyBrowserToAgents(ctx, browser, browserSettings, chatModelId, startedAt) {
|
|
19894
|
+
if (startedAt !== void 0 && activeBrowserGeneration() !== startedAt) {
|
|
19895
|
+
if (browser) await discardBrowser(browser);
|
|
19896
|
+
return false;
|
|
19897
|
+
}
|
|
19898
|
+
setAgentsBrowser(ctx, void 0);
|
|
19899
|
+
if (!await replaceActiveBrowser(browser)) return false;
|
|
19900
|
+
setAgentsBrowser(ctx, browser);
|
|
19831
19901
|
ctx.state.session.state.set({
|
|
19832
19902
|
[ACTIVE_BROWSER_KEY]: browserSettings ? (0, _mastra_code_sdk_onboarding_settings.toActiveBrowserSettings)(browserSettings) : void 0,
|
|
19833
19903
|
[ACTIVE_BROWSER_MODEL_KEY]: browserSettings?.enabled ? (0, _mastra_code_sdk_onboarding_settings.resolveStagehandModel)(browserSettings, { chatModelId }) : void 0
|
|
19834
19904
|
});
|
|
19905
|
+
return true;
|
|
19906
|
+
}
|
|
19907
|
+
function setAgentsBrowser(ctx, browser) {
|
|
19908
|
+
let agentControllerState;
|
|
19909
|
+
for (const mode of ctx.controller.listModes()) resolveModeAgent(mode, agentControllerState ??= ctx.state.session.state.get())?.setBrowser?.(browser);
|
|
19910
|
+
ctx.state.local?.controller.setBrowser(browser);
|
|
19835
19911
|
}
|
|
19836
19912
|
/**
|
|
19837
19913
|
* Get a summary key for browser settings to detect config drift.
|
|
@@ -20039,9 +20115,12 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
20039
20115
|
...settings.browser,
|
|
20040
20116
|
enabled: false
|
|
20041
20117
|
};
|
|
20118
|
+
if (!await applyBrowserToAgents(ctx, void 0, disabledSettings)) {
|
|
20119
|
+
ctx.showInfo("Another /browser command replaced this browser.");
|
|
20120
|
+
return;
|
|
20121
|
+
}
|
|
20042
20122
|
settings.browser = disabledSettings;
|
|
20043
20123
|
(0, _mastra_code_sdk_onboarding_settings.saveSettings)(settings);
|
|
20044
|
-
applyBrowserToAgents(ctx, void 0, disabledSettings);
|
|
20045
20124
|
ctx.showInfo("Browser disabled.");
|
|
20046
20125
|
return;
|
|
20047
20126
|
}
|
|
@@ -20056,7 +20135,11 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
20056
20135
|
}
|
|
20057
20136
|
try {
|
|
20058
20137
|
const chatModelId = launchChatModelId(ctx);
|
|
20059
|
-
|
|
20138
|
+
const startedAt = activeBrowserGeneration();
|
|
20139
|
+
if (!await applyBrowserToAgents(ctx, await (0, _mastra_code_sdk_onboarding_settings.createBrowserFromSettings)(nextBrowser, { chatModelId }), nextBrowser, chatModelId, startedAt)) {
|
|
20140
|
+
ctx.showInfo("Another /browser command replaced this browser.");
|
|
20141
|
+
return;
|
|
20142
|
+
}
|
|
20060
20143
|
if (nextBrowser.profile && nextBrowser.provider) (0, _mastra_code_sdk_onboarding_settings.setProfileProvider)(nextBrowser.profile, nextBrowser.provider);
|
|
20061
20144
|
settings.browser = nextBrowser;
|
|
20062
20145
|
(0, _mastra_code_sdk_onboarding_settings.saveSettings)(settings);
|
|
@@ -20080,18 +20163,29 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
20080
20163
|
height: 720
|
|
20081
20164
|
}
|
|
20082
20165
|
};
|
|
20083
|
-
|
|
20084
|
-
|
|
20085
|
-
|
|
20086
|
-
|
|
20087
|
-
|
|
20088
|
-
|
|
20089
|
-
|
|
20090
|
-
|
|
20091
|
-
|
|
20166
|
+
if (wasEnabled) {
|
|
20167
|
+
const startedAt = activeBrowserGeneration();
|
|
20168
|
+
try {
|
|
20169
|
+
const chatModelId = launchChatModelId(ctx);
|
|
20170
|
+
if (!await applyBrowserToAgents(ctx, await (0, _mastra_code_sdk_onboarding_settings.createBrowserFromSettings)(settings.browser, { chatModelId }), settings.browser, chatModelId, startedAt)) {
|
|
20171
|
+
ctx.showInfo("Another /browser command replaced this browser.");
|
|
20172
|
+
return;
|
|
20173
|
+
}
|
|
20174
|
+
} catch (err) {
|
|
20175
|
+
if (!await applyBrowserToAgents(ctx, void 0, void 0, void 0, startedAt)) {
|
|
20176
|
+
ctx.showInfo("Another /browser command replaced this browser.");
|
|
20177
|
+
return;
|
|
20178
|
+
}
|
|
20179
|
+
settings.browser.enabled = false;
|
|
20180
|
+
(0, _mastra_code_sdk_onboarding_settings.saveSettings)(settings);
|
|
20181
|
+
ctx.showError(`Browser settings reset, but failed to restart: ${err instanceof Error ? err.message : String(err)}`);
|
|
20182
|
+
return;
|
|
20183
|
+
}
|
|
20184
|
+
} else if (!await applyBrowserToAgents(ctx, void 0)) {
|
|
20185
|
+
ctx.showInfo("Another /browser command replaced this browser.");
|
|
20092
20186
|
return;
|
|
20093
20187
|
}
|
|
20094
|
-
|
|
20188
|
+
(0, _mastra_code_sdk_onboarding_settings.saveSettings)(settings);
|
|
20095
20189
|
ctx.showInfo("Browser settings reset to defaults.");
|
|
20096
20190
|
return;
|
|
20097
20191
|
}
|
|
@@ -20141,8 +20235,12 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
20141
20235
|
let browserInstance = resolveModeAgent(ctx.state.session.mode.resolve(), ctx.state.session.state.get())?.browser;
|
|
20142
20236
|
if (!browserInstance && browser.enabled) {
|
|
20143
20237
|
const chatModelId = launchChatModelId(ctx);
|
|
20238
|
+
const startedAt = activeBrowserGeneration();
|
|
20144
20239
|
browserInstance = await (0, _mastra_code_sdk_onboarding_settings.createBrowserFromSettings)(browser, { chatModelId });
|
|
20145
|
-
applyBrowserToAgents(ctx, browserInstance, browser, chatModelId)
|
|
20240
|
+
if (!await applyBrowserToAgents(ctx, browserInstance, browser, chatModelId, startedAt)) {
|
|
20241
|
+
ctx.showError("Another /browser command replaced the browser. Run the export again.");
|
|
20242
|
+
return;
|
|
20243
|
+
}
|
|
20146
20244
|
}
|
|
20147
20245
|
if (!browserInstance) {
|
|
20148
20246
|
ctx.showError("Browser not enabled. Run /browser on first.");
|
|
@@ -20200,9 +20298,12 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
20200
20298
|
}
|
|
20201
20299
|
if (enableChoice === "No") {
|
|
20202
20300
|
if (browser.enabled) {
|
|
20301
|
+
if (!await applyBrowserToAgents(ctx, void 0)) {
|
|
20302
|
+
ctx.showInfo("Another /browser command replaced this browser.");
|
|
20303
|
+
return;
|
|
20304
|
+
}
|
|
20203
20305
|
settings.browser.enabled = false;
|
|
20204
20306
|
(0, _mastra_code_sdk_onboarding_settings.saveSettings)(settings);
|
|
20205
|
-
applyBrowserToAgents(ctx, void 0);
|
|
20206
20307
|
ctx.showInfo("Browser automation disabled.");
|
|
20207
20308
|
} else ctx.showInfo("Browser automation remains disabled.");
|
|
20208
20309
|
return;
|
|
@@ -20348,7 +20449,11 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
20348
20449
|
}
|
|
20349
20450
|
const chatModelId = launchChatModelId(ctx);
|
|
20350
20451
|
try {
|
|
20351
|
-
|
|
20452
|
+
const startedAt = activeBrowserGeneration();
|
|
20453
|
+
if (!await applyBrowserToAgents(ctx, await (0, _mastra_code_sdk_onboarding_settings.createBrowserFromSettings)(nextBrowser, { chatModelId }), nextBrowser, chatModelId, startedAt)) {
|
|
20454
|
+
ctx.showInfo("Another /browser command replaced this browser.");
|
|
20455
|
+
return;
|
|
20456
|
+
}
|
|
20352
20457
|
if (nextBrowser.profile && nextBrowser.provider) (0, _mastra_code_sdk_onboarding_settings.setProfileProvider)(nextBrowser.profile, nextBrowser.provider);
|
|
20353
20458
|
settings.browser = nextBrowser;
|
|
20354
20459
|
(0, _mastra_code_sdk_onboarding_settings.saveSettings)(settings);
|
|
@@ -28796,6 +28901,12 @@ Object.defineProperty(exports, "__toESM", {
|
|
|
28796
28901
|
return __toESM;
|
|
28797
28902
|
}
|
|
28798
28903
|
});
|
|
28904
|
+
Object.defineProperty(exports, "activeBrowserGeneration", {
|
|
28905
|
+
enumerable: true,
|
|
28906
|
+
get: function() {
|
|
28907
|
+
return activeBrowserGeneration;
|
|
28908
|
+
}
|
|
28909
|
+
});
|
|
28799
28910
|
Object.defineProperty(exports, "applyThemeMode", {
|
|
28800
28911
|
enumerable: true,
|
|
28801
28912
|
get: function() {
|
|
@@ -28808,12 +28919,24 @@ Object.defineProperty(exports, "applyThemePreference", {
|
|
|
28808
28919
|
return applyThemePreference;
|
|
28809
28920
|
}
|
|
28810
28921
|
});
|
|
28922
|
+
Object.defineProperty(exports, "closeActiveBrowser", {
|
|
28923
|
+
enumerable: true,
|
|
28924
|
+
get: function() {
|
|
28925
|
+
return closeActiveBrowser;
|
|
28926
|
+
}
|
|
28927
|
+
});
|
|
28811
28928
|
Object.defineProperty(exports, "createTUIState", {
|
|
28812
28929
|
enumerable: true,
|
|
28813
28930
|
get: function() {
|
|
28814
28931
|
return createTUIState;
|
|
28815
28932
|
}
|
|
28816
28933
|
});
|
|
28934
|
+
Object.defineProperty(exports, "discardBrowser", {
|
|
28935
|
+
enumerable: true,
|
|
28936
|
+
get: function() {
|
|
28937
|
+
return discardBrowser;
|
|
28938
|
+
}
|
|
28939
|
+
});
|
|
28817
28940
|
Object.defineProperty(exports, "formatInstallingLabel", {
|
|
28818
28941
|
enumerable: true,
|
|
28819
28942
|
get: function() {
|
|
@@ -28880,6 +29003,12 @@ Object.defineProperty(exports, "normalizeThemePreference", {
|
|
|
28880
29003
|
return normalizeThemePreference;
|
|
28881
29004
|
}
|
|
28882
29005
|
});
|
|
29006
|
+
Object.defineProperty(exports, "replaceActiveBrowser", {
|
|
29007
|
+
enumerable: true,
|
|
29008
|
+
get: function() {
|
|
29009
|
+
return replaceActiveBrowser;
|
|
29010
|
+
}
|
|
29011
|
+
});
|
|
28883
29012
|
Object.defineProperty(exports, "theme", {
|
|
28884
29013
|
enumerable: true,
|
|
28885
29014
|
get: function() {
|
|
@@ -28887,4 +29016,4 @@ Object.defineProperty(exports, "theme", {
|
|
|
28887
29016
|
}
|
|
28888
29017
|
});
|
|
28889
29018
|
|
|
28890
|
-
//# sourceMappingURL=tui-
|
|
29019
|
+
//# sourceMappingURL=tui-4Evog5Ks.cjs.map
|