mastracode 0.33.0-alpha.1 → 0.33.0-alpha.3
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 +53 -0
- package/dist/cli.cjs +2 -2
- package/dist/cli.js +2 -2
- package/dist/tui/commands/models-pack.d.ts.map +1 -1
- package/dist/tui/commands/settings.d.ts.map +1 -1
- package/dist/tui/commands/think.d.ts.map +1 -1
- package/dist/tui/components/thinking-settings.d.ts +2 -2
- package/dist/tui/components/thinking-settings.d.ts.map +1 -1
- package/dist/tui/display.d.ts +30 -3
- package/dist/tui/display.d.ts.map +1 -1
- package/dist/tui/handlers/agent-lifecycle.d.ts.map +1 -1
- package/dist/tui/mastra-tui.d.ts.map +1 -1
- package/dist/tui/setup.d.ts.map +1 -1
- package/dist/{tui-PMpovaIn.js → tui-CzFanVr8.js} +128 -51
- package/dist/tui-CzFanVr8.js.map +1 -0
- package/dist/{tui-Bqf7lCPV.cjs → tui-aAxigfCH.cjs} +127 -50
- package/dist/tui-aAxigfCH.cjs.map +1 -0
- package/dist/tui.cjs +1 -1
- package/dist/tui.js +1 -1
- package/package.json +12 -12
- package/dist/tui-Bqf7lCPV.cjs.map +0 -1
- package/dist/tui-PMpovaIn.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# mastracode
|
|
2
2
|
|
|
3
|
+
## 0.33.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add a reasoning-effort configuration surface across mastracode and Factory (fixes #20766): ([#20884](https://github.com/mastra-ai/mastra/pull/20884))
|
|
8
|
+
|
|
9
|
+
- New `max` thinking level (mapped to `reasoning effort: max` for OpenAI Codex and Anthropic `effort`).
|
|
10
|
+
- Anthropic extended-thinking wiring: the session thinking level now applies to anthropic/claude-opus-4-7 and other Anthropic models via provider thinking/effort options (previously OpenAI-only).
|
|
11
|
+
- New `models.modeThinkingDefaults` setting: per-mode (build/plan/fast) default thinking levels, resolved at request time with precedence session override → mode default → global `preferences.thinkingLevel`. Configuration changes now apply to the next request of every session, including automated Factory runs.
|
|
12
|
+
- Factory: new Settings → Defaults controls for editing global and per-mode thinking defaults in local deployments.
|
|
13
|
+
- TUI: `/think` now sets a session-only override, supports `/think default` to clear it, and `/think status` reports the effective level with provenance (session override / mode default / global default).
|
|
14
|
+
|
|
15
|
+
Example `settings.json` configuration:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"preferences": { "thinkingLevel": "medium" },
|
|
20
|
+
"models": {
|
|
21
|
+
"modeThinkingDefaults": {
|
|
22
|
+
"build": "high",
|
|
23
|
+
"plan": "max",
|
|
24
|
+
"fast": "off"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [[`cdd5c33`](https://github.com/mastra-ai/mastra/commit/cdd5c33ac6c7118a9f139e6dc0e14e6a8ae31658), [`cdd5c33`](https://github.com/mastra-ai/mastra/commit/cdd5c33ac6c7118a9f139e6dc0e14e6a8ae31658), [`6bff877`](https://github.com/mastra-ai/mastra/commit/6bff877e214695ff8d9c84b06c13a6e6bcf9f1ed), [`d7cf7fa`](https://github.com/mastra-ai/mastra/commit/d7cf7fafc1ae1b50bd8462dd0e6c671a8606db93), [`0f9a448`](https://github.com/mastra-ai/mastra/commit/0f9a448502157e59f7b76f24360ad497168f5ef8), [`289f4ce`](https://github.com/mastra-ai/mastra/commit/289f4ce16e3293370440172132c52ee787cbc09f), [`4f16ff8`](https://github.com/mastra-ai/mastra/commit/4f16ff824bf2f9b0ddc93f210477c10c8a4fb1ab), [`1c67d85`](https://github.com/mastra-ai/mastra/commit/1c67d85e9da8285662f4dbbf47e0378c3fee0747), [`03ebe06`](https://github.com/mastra-ai/mastra/commit/03ebe06aeb671d7127b700e53853ed0759e4c19f), [`ba24be6`](https://github.com/mastra-ai/mastra/commit/ba24be662439c331ab23a600041f93803c89eca8), [`842b5fe`](https://github.com/mastra-ai/mastra/commit/842b5fe22b6a7fa811bd14e48eb9af523ac989f2), [`80bdf3a`](https://github.com/mastra-ai/mastra/commit/80bdf3ae16ade6ff63bde0cb16fa2df8ab7dd4dd), [`195e83c`](https://github.com/mastra-ai/mastra/commit/195e83c077687f6016fd8090324975c8d8cea50b), [`9ba1247`](https://github.com/mastra-ai/mastra/commit/9ba12470c77f1c03642d720ce67e517e878f666e), [`fd96298`](https://github.com/mastra-ai/mastra/commit/fd96298a8367622f4ebfcaa97b5b6c1fbbd14564), [`9168b80`](https://github.com/mastra-ai/mastra/commit/9168b80120a82816b1b9f2385e788bf86fa5d9cd), [`6a84954`](https://github.com/mastra-ai/mastra/commit/6a84954a2667f85b6d59da652dab1bbff007ccb0), [`52d8ef0`](https://github.com/mastra-ai/mastra/commit/52d8ef03801f1deb7ee48532fc4190dd4a33916c), [`cdd5c33`](https://github.com/mastra-ai/mastra/commit/cdd5c33ac6c7118a9f139e6dc0e14e6a8ae31658), [`289f4ce`](https://github.com/mastra-ai/mastra/commit/289f4ce16e3293370440172132c52ee787cbc09f), [`87db0e4`](https://github.com/mastra-ai/mastra/commit/87db0e49a8c04030eb74fff7f051fac330678839), [`edfe906`](https://github.com/mastra-ai/mastra/commit/edfe906f7926faf8c63c21b3c87e797985557feb), [`efd5c81`](https://github.com/mastra-ai/mastra/commit/efd5c81cc25fde3c2ddd86fc1178deb4ec176e19), [`43ea2a1`](https://github.com/mastra-ai/mastra/commit/43ea2a1f5c5867d0f41254047a786e96cd00798b), [`0976933`](https://github.com/mastra-ai/mastra/commit/0976933142333ec78451feef265b68bcb45aa5e7), [`242b945`](https://github.com/mastra-ai/mastra/commit/242b94558777bfbdeb42cbfea84afff0b6ad0633), [`fea5cae`](https://github.com/mastra-ai/mastra/commit/fea5caedc7e2cfea51784a15e015952692027abf), [`4b59f78`](https://github.com/mastra-ai/mastra/commit/4b59f786cbc9a7d1ef07a07517dbd4b96865e99d), [`9ba1247`](https://github.com/mastra-ai/mastra/commit/9ba12470c77f1c03642d720ce67e517e878f666e), [`7010c5d`](https://github.com/mastra-ai/mastra/commit/7010c5d15728bf9c5dfe4fb6b1bf80ce23bf143a)]:
|
|
33
|
+
- @mastra/core@1.58.0-alpha.3
|
|
34
|
+
- @mastra/observability@1.16.6-alpha.2
|
|
35
|
+
- @mastra/schema-compat@1.3.6-alpha.2
|
|
36
|
+
- @mastra/pg@1.20.0-alpha.1
|
|
37
|
+
- @mastra/memory@1.26.1-alpha.2
|
|
38
|
+
- @mastra/github-signals@0.2.5-alpha.0
|
|
39
|
+
- @mastra/mcp@1.16.0-alpha.1
|
|
40
|
+
- @mastra/code-sdk@1.2.0-alpha.3
|
|
41
|
+
|
|
42
|
+
## 0.33.0-alpha.2
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Dispatch PermissionRequest hooks and the agent_done notification at event receipt instead of from the TUI's serialized event queue, so external integrations hear about new permission prompts and finished runs even while an earlier prompt is pending. Also removes the spurious agent_done ping that fired after answering a suspended run's prompt. ([#20923](https://github.com/mastra-ai/mastra/pull/20923))
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [[`1bdfde1`](https://github.com/mastra-ai/mastra/commit/1bdfde1f4061b7c0550253a1512a2118debe7996), [`b4c89b4`](https://github.com/mastra-ai/mastra/commit/b4c89b4371b0c86da57403ad1a3b3ef0681f3128), [`e44e8f3`](https://github.com/mastra-ai/mastra/commit/e44e8f370b66c339ddcaba946d33da6d3c3f06cd), [`c967a5e`](https://github.com/mastra-ai/mastra/commit/c967a5eec150c5dc5418c4a4388982d1fb7ad27c), [`f53d5bd`](https://github.com/mastra-ai/mastra/commit/f53d5bd4885b29e4ac29a428a6044088ea8d6aa3), [`bda2235`](https://github.com/mastra-ai/mastra/commit/bda22353ee28f2df0eaea555f7cae1549f979c0b), [`a7eb4a1`](https://github.com/mastra-ai/mastra/commit/a7eb4a11450f6170274ed5141bffe821d4fdd5a6), [`2f9ef3f`](https://github.com/mastra-ai/mastra/commit/2f9ef3f4ca06fc2dcdd5088c26b7f4da6a016791), [`e7eefcb`](https://github.com/mastra-ai/mastra/commit/e7eefcb162cda7c493e8c3bf43050ead0efbcb2c), [`4d7aca2`](https://github.com/mastra-ai/mastra/commit/4d7aca2fe75f225c83d1502d63079568e6ec163f), [`c4ec889`](https://github.com/mastra-ai/mastra/commit/c4ec889561c0264c43f66d04d587bee4ce35e792), [`9be8878`](https://github.com/mastra-ai/mastra/commit/9be8878dcf0388e84fc4873e0eec27bd49b881a4)]:
|
|
49
|
+
- @mastra/observability@1.16.6-alpha.1
|
|
50
|
+
- @mastra/core@1.58.0-alpha.2
|
|
51
|
+
- @mastra/schema-compat@1.3.6-alpha.1
|
|
52
|
+
- @mastra/code-sdk@1.2.0-alpha.2
|
|
53
|
+
- @mastra/mcp@1.16.0-alpha.0
|
|
54
|
+
- @mastra/memory@1.26.1-alpha.1
|
|
55
|
+
|
|
3
56
|
## 0.33.0-alpha.1
|
|
4
57
|
|
|
5
58
|
### 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-aAxigfCH.cjs");
|
|
3
3
|
let _mastra_code_sdk = require("@mastra/code-sdk");
|
|
4
4
|
let fs = require("fs");
|
|
5
5
|
fs = require_tui.__toESM(fs, 1);
|
|
@@ -13,7 +13,7 @@ let _mastra_code_sdk_utils_stdin_pipe = require("@mastra/code-sdk/utils/stdin-pi
|
|
|
13
13
|
let _mastra_code_sdk_utils_thread_lock = require("@mastra/code-sdk/utils/thread-lock");
|
|
14
14
|
//#region src/version.ts
|
|
15
15
|
function getCurrentVersion() {
|
|
16
|
-
return "0.33.0-alpha.
|
|
16
|
+
return "0.33.0-alpha.3";
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/main.ts
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { d as detectTerminalTheme, f as applyThemeMode, t as MastraTUI, v as restoreTerminalForeground } from "./tui-
|
|
2
|
+
import { d as detectTerminalTheme, f as applyThemeMode, t as MastraTUI, v as restoreTerminalForeground } from "./tui-CzFanVr8.js";
|
|
3
3
|
import { createMastraCode } from "@mastra/code-sdk";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import { createMastraCodeAnalytics } from "@mastra/code-sdk/analytics";
|
|
@@ -12,7 +12,7 @@ import { drainPipedStdin, reopenStdinFromTTY } from "@mastra/code-sdk/utils/stdi
|
|
|
12
12
|
import { releaseAllThreadLocks } from "@mastra/code-sdk/utils/thread-lock";
|
|
13
13
|
//#region src/version.ts
|
|
14
14
|
function getCurrentVersion() {
|
|
15
|
-
return "0.33.0-alpha.
|
|
15
|
+
return "0.33.0-alpha.3";
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/main.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models-pack.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/models-pack.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAuC,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"models-pack.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/models-pack.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAuC,MAAM,mCAAmC,CAAC;AAUvG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAS3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAItD,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAaxC,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAMpD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CA2B9D;AAmQD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,cAAc,CAAC,EAAE,MAAM,EACvB,SAAS,UAAO,GACf,IAAI,CAmBN;AA+MD,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyNrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/settings.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAgLtD,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/settings.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAgLtD,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4FnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"think.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/think.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"think.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/think.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAyDtD,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAyGrG"}
|
|
@@ -10,11 +10,11 @@ export interface ThinkingSettingsCallbacks {
|
|
|
10
10
|
onLevelChange: (level: string) => void;
|
|
11
11
|
onClose: () => void;
|
|
12
12
|
}
|
|
13
|
-
export type ThinkingLevelId = 'off' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
13
|
+
export type ThinkingLevelId = 'off' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
14
14
|
export interface ThinkingLevelOption {
|
|
15
15
|
id: ThinkingLevelId;
|
|
16
16
|
label: string;
|
|
17
|
-
providerValue: 'none' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
17
|
+
providerValue: 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
18
18
|
description: string;
|
|
19
19
|
}
|
|
20
20
|
export declare function getThinkingLevelsForModel(modelId: string): ThinkingLevelOption[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinking-settings.d.ts","sourceRoot":"","sources":["../../../src/tui/components/thinking-settings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAA4B,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"thinking-settings.d.ts","sourceRoot":"","sources":["../../../src/tui/components/thinking-settings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAA4B,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAQpE,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAMD,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAElF,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,eAAe,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IACpE,WAAW,EAAE,MAAM,CAAC;CACrB;AAeD,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAchF;AAED,eAAO,MAAM,eAAe,uBAAgC,CAAC;AAE7D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAI9F;AAMD,qBAAa,yBAA0B,SAAQ,GAAI,YAAW,SAAS;IACrE,OAAO,CAAC,UAAU,CAAa;IAG/B,OAAO,CAAC,QAAQ,CAAS;IACzB,IAAI,OAAO,IAAI,OAAO,CAErB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAEzB;gBAEW,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,yBAAyB;IAkCtE,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAGhC"}
|
package/dist/tui/display.d.ts
CHANGED
|
@@ -13,14 +13,41 @@ export declare function showFormattedError(state: TUIState, event: {
|
|
|
13
13
|
} | Error): void;
|
|
14
14
|
export declare function notify(state: TUIState, reason: NotificationReason, message?: string): void;
|
|
15
15
|
/**
|
|
16
|
-
* Fire the notification for an
|
|
16
|
+
* Fire the user-facing notification for an event the moment it is received,
|
|
17
17
|
* before the event enters the TUI's serialized dispatch queue. A pending prompt
|
|
18
18
|
* blocks that queue until the user answers, so any notify call living inside a
|
|
19
19
|
* queued handler is starved exactly when the user has walked away. This helper
|
|
20
20
|
* runs synchronously in the controller subscription listener instead.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* Covers two kinds of pings: input-request events (prompts that need the
|
|
23
|
+
* user's answer, #20398) and the agent_done lifecycle ping when a run
|
|
24
|
+
* finishes (#20860). The name predates the agent_end mapping and is kept for
|
|
25
|
+
* continuity with the #20857 call sites and tests.
|
|
26
|
+
*
|
|
27
|
+
* All other events are a no-op. Never throws: a notification failure must not
|
|
28
|
+
* break event delivery.
|
|
24
29
|
*/
|
|
25
30
|
export declare function notifyForInputRequest(state: TUIState, event: AgentControllerEvent): void;
|
|
31
|
+
/**
|
|
32
|
+
* Dispatch PermissionRequest hooks for a permission-prompt event the moment it
|
|
33
|
+
* is received, before the event enters the TUI's serialized dispatch queue.
|
|
34
|
+
* A pending prompt blocks that queue until the user answers, so a hook
|
|
35
|
+
* dispatched from inside a queued handler is starved exactly when its external
|
|
36
|
+
* integration needs to hear about the new prompt (#20861). This helper runs
|
|
37
|
+
* synchronously in the controller subscription listener instead — the sibling
|
|
38
|
+
* of notifyForInputRequest for hook dispatch rather than user pings.
|
|
39
|
+
*
|
|
40
|
+
* runId semantics (accepted, not handled): HookManager.runPermissionRequest
|
|
41
|
+
* silently bails when no run id is set, and setRunId/clearRunId both run
|
|
42
|
+
* inside the QUEUED agent_start/agent_end handling. Two cross-run microtask
|
|
43
|
+
* edges therefore exist at receipt time: a permission event arriving before
|
|
44
|
+
* its run's queued agent_start has been processed (hook silently skipped),
|
|
45
|
+
* and a stale run id left over from the previous run (no constructible
|
|
46
|
+
* trigger found — a new run cannot start while a prompt blocks the queue).
|
|
47
|
+
* In the real starvation scenario the blocking run's id IS set, because its
|
|
48
|
+
* agent_end cannot have been processed while its prompt blocks the queue.
|
|
49
|
+
*
|
|
50
|
+
* Never throws: a hook failure must not break event delivery.
|
|
51
|
+
*/
|
|
52
|
+
export declare function runPermissionHooksForEvent(state: TUIState, event: AgentControllerEvent): void;
|
|
26
53
|
//# sourceMappingURL=display.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/tui/display.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAG1E,OAAO,KAAK,EAAoB,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgB3C,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAI/D;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,QAAQ,EACf,KAAK,EACD;IACE,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACD,KAAK,GACR,IAAI,CAoCN;AA0BD,wBAAgB,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAO1F;AAED
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/tui/display.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAG1E,OAAO,KAAK,EAAoB,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgB3C,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAI/D;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,QAAQ,EACf,KAAK,EACD;IACE,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACD,KAAK,GACR,IAAI,CAoCN;AA0BD,wBAAgB,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAO1F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAwCxF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAqB7F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-lifecycle.d.ts","sourceRoot":"","sources":["../../../src/tui/handlers/agent-lifecycle.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AASjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAkB/D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"agent-lifecycle.d.ts","sourceRoot":"","sources":["../../../src/tui/handlers/agent-lifecycle.ts"],"names":[],"mappings":"AAKA,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MASTRA_GATEWAY_PROVIDER, OBSERVABILITY_AUTH_PREFIX, THREAD_ACTIVE_MODEL_PACK_ID_KEY, checkProfileProviderMismatch, createBrowserFromSettings, getCustomProviderId, loadSettings, resolveThreadActiveModelPackId, saveSettings, setProfileProvider, stripMastraCodeCustomProviderPrefix, toCustomProviderModelId } from "@mastra/code-sdk/onboarding/settings";
|
|
2
|
+
import { MASTRA_GATEWAY_DEFAULT_URL, MASTRA_GATEWAY_PROVIDER, OBSERVABILITY_AUTH_PREFIX, THREAD_ACTIVE_MODEL_PACK_ID_KEY, checkProfileProviderMismatch, createBrowserFromSettings, getCustomProviderId, loadSettings, resolveDefaultThinkingLevel, resolveThreadActiveModelPackId, saveSettings, setProfileProvider, stripMastraCodeCustomProviderPrefix, toCustomProviderModelId } from "@mastra/code-sdk/onboarding/settings";
|
|
3
3
|
import { ThreadLockError } from "@mastra/code-sdk/utils/thread-lock";
|
|
4
4
|
import { mastraBrand } from "@mastra/code-sdk/theme-palette";
|
|
5
5
|
import chalk from "chalk";
|
|
@@ -17,6 +17,7 @@ import { DEFAULT_STT_MODEL, defaultModelForProvider, resolveSTTModel, sttModelsF
|
|
|
17
17
|
import { Readable } from "stream";
|
|
18
18
|
import { DeepgramVoice } from "@mastra/voice-deepgram";
|
|
19
19
|
import { OpenAIVoice } from "@mastra/voice-openai";
|
|
20
|
+
import { supportsMaxReasoningEffort } from "@mastra/code-sdk/providers/openai-codex";
|
|
20
21
|
import { VALID_EVENTS } from "@mastra/code-sdk/hooks/index";
|
|
21
22
|
import { parseError } from "@mastra/code-sdk/utils/errors";
|
|
22
23
|
import { formatSkillActivation } from "@mastra/core/workspace";
|
|
@@ -2615,6 +2616,12 @@ const BASE_THINKING_LEVELS = [
|
|
|
2615
2616
|
label: "Very High",
|
|
2616
2617
|
providerValue: "xhigh",
|
|
2617
2618
|
description: "Maximum reasoning depth"
|
|
2619
|
+
},
|
|
2620
|
+
{
|
|
2621
|
+
id: "max",
|
|
2622
|
+
label: "Max",
|
|
2623
|
+
providerValue: "max",
|
|
2624
|
+
description: "Unbounded reasoning (Anthropic, GPT-5.6+)"
|
|
2618
2625
|
}
|
|
2619
2626
|
];
|
|
2620
2627
|
function isOpenAIModel(modelId) {
|
|
@@ -2622,7 +2629,7 @@ function isOpenAIModel(modelId) {
|
|
|
2622
2629
|
}
|
|
2623
2630
|
function getThinkingLevelsForModel(modelId) {
|
|
2624
2631
|
if (!isOpenAIModel(modelId)) return [...BASE_THINKING_LEVELS];
|
|
2625
|
-
return BASE_THINKING_LEVELS.map((level) => ({
|
|
2632
|
+
return (supportsMaxReasoningEffort(modelId.slice(7)) ? BASE_THINKING_LEVELS : BASE_THINKING_LEVELS.filter((level) => level.id !== "max")).map((level) => ({
|
|
2626
2633
|
...level,
|
|
2627
2634
|
label: level.providerValue
|
|
2628
2635
|
}));
|
|
@@ -2633,20 +2640,41 @@ function getThinkingLevelForModel(modelId, levelId) {
|
|
|
2633
2640
|
}
|
|
2634
2641
|
//#endregion
|
|
2635
2642
|
//#region src/tui/commands/think.ts
|
|
2643
|
+
/** Sentinel value used by the selector for "clear the session override". */
|
|
2644
|
+
const DEFAULT_ITEM_VALUE = "__default__";
|
|
2636
2645
|
/** Models that support reasoning effort. */
|
|
2637
2646
|
function supportsThinking(modelId) {
|
|
2638
|
-
return modelId.startsWith("openai/");
|
|
2639
|
-
}
|
|
2640
|
-
function getThinkingStatusLine(modelId, levelId) {
|
|
2641
|
-
return `Thinking: ${getThinkingLevelForModel(modelId, levelId).label}`;
|
|
2647
|
+
return modelId.startsWith("openai/") || modelId.startsWith("anthropic/");
|
|
2642
2648
|
}
|
|
2643
2649
|
function isThinkingLevelSetting(level) {
|
|
2644
2650
|
return THINKING_LEVELS.some((option) => option.id === level);
|
|
2645
2651
|
}
|
|
2646
|
-
function
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2652
|
+
function levelLabel(levelId) {
|
|
2653
|
+
return THINKING_LEVELS.find((l) => l.id === levelId)?.label ?? levelId;
|
|
2654
|
+
}
|
|
2655
|
+
function sourceLabel(source, modeId) {
|
|
2656
|
+
return source === "mode-default" && modeId ? `${modeId} mode default` : "global default";
|
|
2657
|
+
}
|
|
2658
|
+
/** The session override, or undefined when the session inherits the defaults. */
|
|
2659
|
+
function getSessionOverride(ctx) {
|
|
2660
|
+
const level = ctx.state.session.state.get()?.thinkingLevel;
|
|
2661
|
+
return level !== void 0 && isThinkingLevelSetting(level) ? level : void 0;
|
|
2662
|
+
}
|
|
2663
|
+
/** Resolve the configured default (mode default → global default) for display. */
|
|
2664
|
+
function getConfiguredDefault(ctx) {
|
|
2665
|
+
const modeId = ctx.state.session.mode.get() ?? null;
|
|
2666
|
+
const { level, source } = resolveDefaultThinkingLevel(loadSettings(), modeId);
|
|
2667
|
+
return {
|
|
2668
|
+
level,
|
|
2669
|
+
source,
|
|
2670
|
+
modeId
|
|
2671
|
+
};
|
|
2672
|
+
}
|
|
2673
|
+
function getThinkingStatusLine(ctx) {
|
|
2674
|
+
const override = getSessionOverride(ctx);
|
|
2675
|
+
const fallback = getConfiguredDefault(ctx);
|
|
2676
|
+
if (override !== void 0) return `Thinking: ${levelLabel(override)} (session override) · default: ${levelLabel(fallback.level)} (${sourceLabel(fallback.source, fallback.modeId)})`;
|
|
2677
|
+
return `Thinking: ${levelLabel(fallback.level)} (${sourceLabel(fallback.source, fallback.modeId)})`;
|
|
2650
2678
|
}
|
|
2651
2679
|
function getModelNote(ctx) {
|
|
2652
2680
|
const modelId = ctx.state.session.model.get() ?? "";
|
|
@@ -2655,35 +2683,46 @@ function getModelNote(ctx) {
|
|
|
2655
2683
|
return null;
|
|
2656
2684
|
}
|
|
2657
2685
|
async function handleThinkCommand(ctx, args = []) {
|
|
2658
|
-
const currentLevel = ctx.state.session.state.get()?.thinkingLevel ?? "off";
|
|
2659
2686
|
const modelId = ctx.state.session.model.get() ?? "";
|
|
2660
2687
|
const thinkingLevels = getThinkingLevelsForModel(modelId);
|
|
2688
|
+
const override = getSessionOverride(ctx);
|
|
2689
|
+
const configuredDefault = getConfiguredDefault(ctx);
|
|
2661
2690
|
const arg = args[0]?.toLowerCase();
|
|
2662
2691
|
if (arg === "status") {
|
|
2663
|
-
ctx.showInfo(getThinkingStatusLine(
|
|
2692
|
+
ctx.showInfo(getThinkingStatusLine(ctx));
|
|
2693
|
+
return;
|
|
2694
|
+
}
|
|
2695
|
+
if (arg === "default" || arg === "clear") {
|
|
2696
|
+
await ctx.state.session.state.set({ thinkingLevel: void 0 });
|
|
2697
|
+
ctx.showInfo(`Thinking → ${levelLabel(configuredDefault.level)} (${sourceLabel(configuredDefault.source, configuredDefault.modeId)})`);
|
|
2664
2698
|
return;
|
|
2665
2699
|
}
|
|
2666
2700
|
if (arg) {
|
|
2667
2701
|
const selected = thinkingLevels.find((l) => l.id === arg);
|
|
2668
2702
|
if (!selected) {
|
|
2669
|
-
ctx.showInfo(`Invalid thinking level: ${arg}. Use one of: ${
|
|
2703
|
+
ctx.showInfo(`Invalid thinking level: ${arg}. Use one of: ${thinkingLevels.map((l) => l.id).join(", ")}, 'default', or 'status'.`);
|
|
2670
2704
|
return;
|
|
2671
2705
|
}
|
|
2672
2706
|
const note = getModelNote(ctx);
|
|
2673
2707
|
await ctx.state.session.state.set({ thinkingLevel: selected.id });
|
|
2674
|
-
|
|
2675
|
-
ctx.showInfo(getThinkingStatusLine(modelId, selected.id) + (note ? ` (${note})` : ""));
|
|
2708
|
+
ctx.showInfo(`Thinking: ${selected.label} (session override)` + (note ? ` (${note})` : ""));
|
|
2676
2709
|
return;
|
|
2677
2710
|
}
|
|
2678
|
-
const
|
|
2711
|
+
const defaultDescription = `${levelLabel(configuredDefault.level)} · ${sourceLabel(configuredDefault.source, configuredDefault.modeId)}`;
|
|
2712
|
+
const items = [{
|
|
2713
|
+
value: DEFAULT_ITEM_VALUE,
|
|
2714
|
+
label: ` Default ${theme.fg("dim", defaultDescription)}${override === void 0 ? theme.fg("dim", " (current)") : ""}`
|
|
2715
|
+
}, ...thinkingLevels.map((l) => ({
|
|
2679
2716
|
value: l.id,
|
|
2680
|
-
label: ` ${l.label} ${theme.fg("dim", l.description)}${l.id ===
|
|
2681
|
-
}));
|
|
2717
|
+
label: ` ${l.label} ${theme.fg("dim", l.description)}${l.id === override ? theme.fg("dim", " (current)") : ""}`
|
|
2718
|
+
}))];
|
|
2682
2719
|
const modelNote = getModelNote(ctx);
|
|
2683
2720
|
return new Promise((resolve) => {
|
|
2684
2721
|
const container = new Box(4, 2, (text) => theme.bg("overlayBg", text));
|
|
2685
2722
|
container.addChild(new Text(theme.bold(theme.fg("accent", "Thinking Level")), 0, 0));
|
|
2686
2723
|
container.addChild(new Spacer(1));
|
|
2724
|
+
container.addChild(new Text(theme.fg("dim", "Session override — \"Default\" inherits mode/global defaults."), 0, 0));
|
|
2725
|
+
container.addChild(new Spacer(1));
|
|
2687
2726
|
if (modelNote) {
|
|
2688
2727
|
container.addChild(new Text(theme.fg("warning", modelNote), 0, 0));
|
|
2689
2728
|
container.addChild(new Spacer(1));
|
|
@@ -2691,16 +2730,16 @@ async function handleThinkCommand(ctx, args = []) {
|
|
|
2691
2730
|
const selectList = new SelectList(items, items.length, getSelectListTheme());
|
|
2692
2731
|
selectList.onSelect = async (item) => {
|
|
2693
2732
|
ctx.state.ui.hideOverlay();
|
|
2694
|
-
const
|
|
2695
|
-
if (!isThinkingLevelSetting(selectedLevel)) {
|
|
2696
|
-
resolve();
|
|
2697
|
-
return;
|
|
2698
|
-
}
|
|
2733
|
+
const selectedValue = item.value;
|
|
2699
2734
|
try {
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2735
|
+
if (selectedValue === DEFAULT_ITEM_VALUE) {
|
|
2736
|
+
await ctx.state.session.state.set({ thinkingLevel: void 0 });
|
|
2737
|
+
ctx.showInfo(`Thinking → ${levelLabel(configuredDefault.level)} (${sourceLabel(configuredDefault.source, configuredDefault.modeId)})`);
|
|
2738
|
+
} else if (isThinkingLevelSetting(selectedValue)) {
|
|
2739
|
+
await ctx.state.session.state.set({ thinkingLevel: selectedValue });
|
|
2740
|
+
const selectedLabel = getThinkingLevelForModel(modelId, selectedValue).label;
|
|
2741
|
+
ctx.showInfo(`Thinking → ${selectedValue === override ? `${selectedLabel} (unchanged)` : `${selectedLabel} (session override)`}`);
|
|
2742
|
+
}
|
|
2704
2743
|
} catch {} finally {
|
|
2705
2744
|
resolve();
|
|
2706
2745
|
}
|
|
@@ -2712,7 +2751,7 @@ async function handleThinkCommand(ctx, args = []) {
|
|
|
2712
2751
|
container.addChild(selectList);
|
|
2713
2752
|
container.addChild(new Spacer(1));
|
|
2714
2753
|
container.addChild(new Text(theme.fg("dim", "↑↓ navigate · Enter select · Esc cancel"), 0, 0));
|
|
2715
|
-
const currentIdx = thinkingLevels.findIndex((l) => l.id ===
|
|
2754
|
+
const currentIdx = override === void 0 ? 0 : thinkingLevels.findIndex((l) => l.id === override) + 1;
|
|
2716
2755
|
if (currentIdx > 0) selectList.setSelectedIndex(currentIdx);
|
|
2717
2756
|
const modal = container;
|
|
2718
2757
|
modal.handleInput = (data) => selectList.handleInput(data);
|
|
@@ -3520,14 +3559,19 @@ function notify(state, reason, message) {
|
|
|
3520
3559
|
});
|
|
3521
3560
|
}
|
|
3522
3561
|
/**
|
|
3523
|
-
* Fire the notification for an
|
|
3562
|
+
* Fire the user-facing notification for an event the moment it is received,
|
|
3524
3563
|
* before the event enters the TUI's serialized dispatch queue. A pending prompt
|
|
3525
3564
|
* blocks that queue until the user answers, so any notify call living inside a
|
|
3526
3565
|
* queued handler is starved exactly when the user has walked away. This helper
|
|
3527
3566
|
* runs synchronously in the controller subscription listener instead.
|
|
3528
3567
|
*
|
|
3529
|
-
*
|
|
3530
|
-
*
|
|
3568
|
+
* Covers two kinds of pings: input-request events (prompts that need the
|
|
3569
|
+
* user's answer, #20398) and the agent_done lifecycle ping when a run
|
|
3570
|
+
* finishes (#20860). The name predates the agent_end mapping and is kept for
|
|
3571
|
+
* continuity with the #20857 call sites and tests.
|
|
3572
|
+
*
|
|
3573
|
+
* All other events are a no-op. Never throws: a notification failure must not
|
|
3574
|
+
* break event delivery.
|
|
3531
3575
|
*/
|
|
3532
3576
|
function notifyForInputRequest(state, event) {
|
|
3533
3577
|
try {
|
|
@@ -3535,6 +3579,10 @@ function notifyForInputRequest(state, event) {
|
|
|
3535
3579
|
notify(state, "tool_approval", `Approve ${event.toolName}?`);
|
|
3536
3580
|
return;
|
|
3537
3581
|
}
|
|
3582
|
+
if (event.type === "agent_end") {
|
|
3583
|
+
if (event.reason === "complete" || event.reason === void 0) notify(state, "agent_done");
|
|
3584
|
+
return;
|
|
3585
|
+
}
|
|
3538
3586
|
if (event.type === "tool_suspended") {
|
|
3539
3587
|
const payload = event.suspendPayload ?? {};
|
|
3540
3588
|
if (event.toolName === "request_access" || payload.kind === "sandbox_access_request") notify(state, "sandbox_access", `Sandbox access requested: ${String(payload.path ?? "")}`);
|
|
@@ -3549,6 +3597,45 @@ function notifyForInputRequest(state, event) {
|
|
|
3549
3597
|
process.stderr.write(`[notify error] ${msg}\n`);
|
|
3550
3598
|
}
|
|
3551
3599
|
}
|
|
3600
|
+
/**
|
|
3601
|
+
* Dispatch PermissionRequest hooks for a permission-prompt event the moment it
|
|
3602
|
+
* is received, before the event enters the TUI's serialized dispatch queue.
|
|
3603
|
+
* A pending prompt blocks that queue until the user answers, so a hook
|
|
3604
|
+
* dispatched from inside a queued handler is starved exactly when its external
|
|
3605
|
+
* integration needs to hear about the new prompt (#20861). This helper runs
|
|
3606
|
+
* synchronously in the controller subscription listener instead — the sibling
|
|
3607
|
+
* of notifyForInputRequest for hook dispatch rather than user pings.
|
|
3608
|
+
*
|
|
3609
|
+
* runId semantics (accepted, not handled): HookManager.runPermissionRequest
|
|
3610
|
+
* silently bails when no run id is set, and setRunId/clearRunId both run
|
|
3611
|
+
* inside the QUEUED agent_start/agent_end handling. Two cross-run microtask
|
|
3612
|
+
* edges therefore exist at receipt time: a permission event arriving before
|
|
3613
|
+
* its run's queued agent_start has been processed (hook silently skipped),
|
|
3614
|
+
* and a stale run id left over from the previous run (no constructible
|
|
3615
|
+
* trigger found — a new run cannot start while a prompt blocks the queue).
|
|
3616
|
+
* In the real starvation scenario the blocking run's id IS set, because its
|
|
3617
|
+
* agent_end cannot have been processed while its prompt blocks the queue.
|
|
3618
|
+
*
|
|
3619
|
+
* Never throws: a hook failure must not break event delivery.
|
|
3620
|
+
*/
|
|
3621
|
+
function runPermissionHooksForEvent(state, event) {
|
|
3622
|
+
try {
|
|
3623
|
+
const hookMgr = state.hookManager;
|
|
3624
|
+
if (!hookMgr) return;
|
|
3625
|
+
if (event.type === "tool_approval_required") {
|
|
3626
|
+
hookMgr.runPermissionRequest("tool_approval", event.toolCallId, event.toolName, event.args).catch(() => {});
|
|
3627
|
+
return;
|
|
3628
|
+
}
|
|
3629
|
+
if (event.type === "tool_suspended") {
|
|
3630
|
+
const payload = event.suspendPayload ?? {};
|
|
3631
|
+
if (event.toolName === "request_access" || payload.kind === "sandbox_access_request") hookMgr.runPermissionRequest("sandbox_access", event.toolCallId, event.toolName, payload).catch(() => {});
|
|
3632
|
+
else if (event.toolName === "submit_plan") hookMgr.runPermissionRequest("plan_approval", event.toolCallId, event.toolName, payload).catch(() => {});
|
|
3633
|
+
}
|
|
3634
|
+
} catch (err) {
|
|
3635
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
3636
|
+
process.stderr.write(`[permission hook error] ${msg}\n`);
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3552
3639
|
//#endregion
|
|
3553
3640
|
//#region src/tui/open-url.ts
|
|
3554
3641
|
/**
|
|
@@ -11679,12 +11766,12 @@ async function applyPack(ctx, pack, previousPackId) {
|
|
|
11679
11766
|
s.models.modeDefaults = {};
|
|
11680
11767
|
}
|
|
11681
11768
|
s.models.subagentModels = {};
|
|
11682
|
-
const hasOpenAI = Object.values(pack.models).some((
|
|
11683
|
-
const
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
}
|
|
11769
|
+
const hasOpenAI = Object.values(pack.models).some((modelId) => modelId.startsWith("openai/"));
|
|
11770
|
+
const sessionOverride = ctx.state.session.state.get()?.thinkingLevel;
|
|
11771
|
+
const defaultThinking = resolveDefaultThinkingLevel(s, currentModeId);
|
|
11772
|
+
const effectiveThinking = sessionOverride ?? defaultThinking.level;
|
|
11773
|
+
if (hasOpenAI && sessionOverride === void 0 && defaultThinking.source === "global" && defaultThinking.level === "off") s.preferences.thinkingLevel = "low";
|
|
11774
|
+
else if (currentModeModel?.startsWith("openai/") && effectiveThinking === "max") await ctx.state.session.state.set({ thinkingLevel: "xhigh" });
|
|
11688
11775
|
saveSettings(s);
|
|
11689
11776
|
updateStatusLine(ctx.state);
|
|
11690
11777
|
}
|
|
@@ -13249,7 +13336,7 @@ async function handleSettingsCommand(ctx) {
|
|
|
13249
13336
|
const config = {
|
|
13250
13337
|
notifications: state?.notifications ?? "off",
|
|
13251
13338
|
yolo: state?.yolo === true,
|
|
13252
|
-
thinkingLevel: state?.thinkingLevel ??
|
|
13339
|
+
thinkingLevel: state?.thinkingLevel ?? globalSettings.preferences.thinkingLevel,
|
|
13253
13340
|
currentModelId: ctx.state.session.model.get() ?? "",
|
|
13254
13341
|
escapeAsCancel: ctx.state.editor.escapeEnabled,
|
|
13255
13342
|
quietMode: globalSettings.preferences.quietMode,
|
|
@@ -13269,7 +13356,6 @@ async function handleSettingsCommand(ctx) {
|
|
|
13269
13356
|
await ctx.state.session.state.set({ yolo: enabled });
|
|
13270
13357
|
},
|
|
13271
13358
|
onThinkingLevelChange: async (level) => {
|
|
13272
|
-
await ctx.state.session.state.set({ thinkingLevel: level });
|
|
13273
13359
|
const current = loadSettings();
|
|
13274
13360
|
current.preferences.thinkingLevel = level;
|
|
13275
13361
|
saveSettings(current);
|
|
@@ -15679,7 +15765,6 @@ function handleAgentEnd(ctx) {
|
|
|
15679
15765
|
pruneChatContainer(state);
|
|
15680
15766
|
ctx.updateStatusLine();
|
|
15681
15767
|
flushRender(state);
|
|
15682
|
-
ctx.notify("agent_done");
|
|
15683
15768
|
drainQueuedAction(ctx);
|
|
15684
15769
|
}
|
|
15685
15770
|
function drainQueuedAction(ctx) {
|
|
@@ -20059,7 +20144,7 @@ function setupAutocomplete(state) {
|
|
|
20059
20144
|
},
|
|
20060
20145
|
{
|
|
20061
20146
|
name: "think",
|
|
20062
|
-
description: "
|
|
20147
|
+
description: "Session thinking override (off|low|medium|high|xhigh|max|default|status)"
|
|
20063
20148
|
},
|
|
20064
20149
|
{
|
|
20065
20150
|
name: "login",
|
|
@@ -20365,6 +20450,7 @@ function subscribeToAgentController(state, handleEvent) {
|
|
|
20365
20450
|
let eventQueue = Promise.resolve();
|
|
20366
20451
|
const listener = (event) => {
|
|
20367
20452
|
notifyForInputRequest(state, event);
|
|
20453
|
+
runPermissionHooksForEvent(state, event);
|
|
20368
20454
|
eventQueue = eventQueue.then(async () => {
|
|
20369
20455
|
try {
|
|
20370
20456
|
await handleEvent(event);
|
|
@@ -21308,15 +21394,6 @@ var MastraTUI = class MastraTUI {
|
|
|
21308
21394
|
const hookMgr = this.state.hookManager;
|
|
21309
21395
|
if (!hookMgr) return;
|
|
21310
21396
|
switch (event.type) {
|
|
21311
|
-
case "tool_approval_required":
|
|
21312
|
-
hookMgr.runPermissionRequest("tool_approval", event.toolCallId, event.toolName, event.args).catch(() => {});
|
|
21313
|
-
break;
|
|
21314
|
-
case "tool_suspended": {
|
|
21315
|
-
const payload = event.suspendPayload ?? {};
|
|
21316
|
-
if (event.toolName === "request_access" || payload.kind === "sandbox_access_request") hookMgr.runPermissionRequest("sandbox_access", event.toolCallId, event.toolName, payload).catch(() => {});
|
|
21317
|
-
else if (event.toolName === "submit_plan") hookMgr.runPermissionRequest("plan_approval", event.toolCallId, event.toolName, payload).catch(() => {});
|
|
21318
|
-
break;
|
|
21319
|
-
}
|
|
21320
21397
|
case "subagent_start":
|
|
21321
21398
|
hookMgr.runSubagentStart(event.toolCallId, event.agentType, event.task, event.modelId, event.forked).catch(() => {});
|
|
21322
21399
|
break;
|
|
@@ -21841,4 +21918,4 @@ var MastraTUI = class MastraTUI {
|
|
|
21841
21918
|
//#endregion
|
|
21842
21919
|
export { mastraBrand as _, OMProgressComponent as a, ToolExecutionComponentEnhanced as c, detectTerminalTheme as d, applyThemeMode as f, mastra as g, getThemeMode as h, LoginDialogComponent as i, AssistantMessageComponent as l, getMarkdownTheme as m, createTUIState as n, formatOMStatus as o, getEditorTheme as p, LoginSelectorComponent as r, UserMessageComponent as s, MastraTUI as t, ModelSelectorComponent as u, restoreTerminalForeground as v, theme as y };
|
|
21843
21920
|
|
|
21844
|
-
//# sourceMappingURL=tui-
|
|
21921
|
+
//# sourceMappingURL=tui-CzFanVr8.js.map
|