mastracode 0.32.5-alpha.4 → 0.32.5-alpha.6

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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.32.5-alpha.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed severe TUI lag on long threads. Threads containing large plan approvals could drop below one frame per second because the plan, user-message, and question boxes re-parsed and re-wrapped their text on every render tick. Their rendered output is now cached until the width or theme changes, keeping long threads responsive (measured: time spent re-wrapping text dropped from 47% of all CPU time to 0.2%). ([#20566](https://github.com/mastra-ai/mastra/pull/20566))
8
+
9
+ - Updated dependencies [[`a19e5b7`](https://github.com/mastra-ai/mastra/commit/a19e5b79b76fffa92f9cf17e0e89c3fa714534e8), [`82201f7`](https://github.com/mastra-ai/mastra/commit/82201f75fae8e050a8de2df08b74875ee74c6b83), [`19ccefa`](https://github.com/mastra-ai/mastra/commit/19ccefa628dc971b4bfa2058a324a6ac9b846358), [`19ccefa`](https://github.com/mastra-ai/mastra/commit/19ccefa628dc971b4bfa2058a324a6ac9b846358), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`d01cac8`](https://github.com/mastra-ai/mastra/commit/d01cac87ef674ae6cdd354e15d39525ff9599170), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`0a6598b`](https://github.com/mastra-ai/mastra/commit/0a6598bde80bde008986ad6616bed9632b9294cb), [`9e1dad8`](https://github.com/mastra-ai/mastra/commit/9e1dad8f7b1cab2bb7ade90e5b7561f24577b88a), [`2f43145`](https://github.com/mastra-ai/mastra/commit/2f4314504c03cbba280414ac81ba3197448ee6b0), [`34d34d8`](https://github.com/mastra-ai/mastra/commit/34d34d8c811df512fef4dd5459f79b7821be1866), [`f6e002c`](https://github.com/mastra-ai/mastra/commit/f6e002c9e15eda94fcb35c350c60f9bba1b823d4), [`34d34d8`](https://github.com/mastra-ai/mastra/commit/34d34d8c811df512fef4dd5459f79b7821be1866)]:
10
+ - @mastra/mcp@1.15.1-alpha.1
11
+ - @mastra/core@1.56.0-alpha.6
12
+ - @mastra/pg@1.19.0-alpha.3
13
+ - @mastra/libsql@1.19.0-alpha.2
14
+ - @mastra/duckdb@1.6.0-alpha.0
15
+ - @mastra/code-sdk@1.1.2-alpha.6
16
+ - @mastra/memory@1.25.0-alpha.2
17
+
18
+ ## 0.32.5-alpha.5
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`db4e6ff`](https://github.com/mastra-ai/mastra/commit/db4e6ff744503112eb64deeaf6c2b54bf26a54c7), [`6d19a65`](https://github.com/mastra-ai/mastra/commit/6d19a6517f5da3911023d446b7e2d5dad8adb1cb)]:
23
+ - @mastra/core@1.56.0-alpha.5
24
+ - @mastra/code-sdk@1.1.2-alpha.5
25
+
3
26
  ## 0.32.5-alpha.4
4
27
 
5
28
  ### Patch Changes
package/dist/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_tui = require("./tui-BvvYgDi_.cjs");
2
+ const require_tui = require("./tui-CdyS5uec.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.32.5-alpha.4";
16
+ return "0.32.5-alpha.6";
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-C5oYYa9R.js";
2
+ import { d as detectTerminalTheme, f as applyThemeMode, t as MastraTUI, v as restoreTerminalForeground } from "./tui-BUEL6cTY.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.32.5-alpha.4";
15
+ return "0.32.5-alpha.6";
16
16
  }
17
17
  //#endregion
18
18
  //#region src/main.ts
@@ -11,9 +11,11 @@
11
11
  * interactive SelectList / Input and the submit/cancel callbacks.
12
12
  * 3. **Answered** — After the user responds, the box freezes with ✓/✗ icons.
13
13
  */
14
- import { Container } from '@earendil-works/pi-tui';
14
+ import { Container, Input } from '@earendil-works/pi-tui';
15
15
  import type { Focusable, TUI } from '@earendil-works/pi-tui';
16
16
  import type { ChatSpacingKind } from './chat-spacing.js';
17
+ import { MultilineInput } from './multiline-input.js';
18
+ import { WrappingSelectList } from './wrapping-select-list.js';
17
19
  /**
18
20
  * Selection mode for option prompts. `single_select` selects one option on Enter
19
21
  * (the default). `multi_select` lets the user toggle several options with Space and
@@ -50,6 +52,44 @@ export interface AskQuestionInlineOptions {
50
52
  onSubmitMulti?: (answers: string[]) => void;
51
53
  onCancel: () => void;
52
54
  }
55
+ /**
56
+ * A renderable that wraps the ask-question content in a full bordered box
57
+ * (┌─┐ / │ │ / └─┘) including the interactive SelectList or Input.
58
+ */
59
+ export declare class AskQuestionBorderedBox {
60
+ questionLines: string[];
61
+ private cachedLines?;
62
+ private cachedWidth?;
63
+ private cachedThemeGeneration?;
64
+ private selectList?;
65
+ private input?;
66
+ private hintText;
67
+ items: Array<{
68
+ label: string;
69
+ description?: string;
70
+ }>;
71
+ private answered;
72
+ private cancelled;
73
+ private selectedValue?;
74
+ /** Selected option labels when the box was answered in multi-select mode. */
75
+ private selectedValues?;
76
+ private answerIsNegative;
77
+ /** True when created during streaming, before activate() is called */
78
+ private streaming;
79
+ constructor(questionLines: string[], hintText: string, items: Array<{
80
+ label: string;
81
+ description?: string;
82
+ }>, selectList?: WrappingSelectList, input?: Input | MultilineInput, streaming?: boolean);
83
+ invalidate(): void;
84
+ private dropCache;
85
+ setInteractive(selectList?: WrappingSelectList, input?: Input | MultilineInput, hintText?: string): void;
86
+ setAnswered(selectedValue: string, isNegative: boolean): void;
87
+ setAnsweredMulti(selectedValues: string[]): void;
88
+ setCancelled(): void;
89
+ render(width: number): string[];
90
+ private renderSafe;
91
+ private _render;
92
+ }
53
93
  export declare class AskQuestionInlineComponent extends Container implements Focusable {
54
94
  private borderedBox;
55
95
  private selectList?;
@@ -1 +1 @@
1
- {"version":3,"file":"ask-question-inline.d.ts","sourceRoot":"","sources":["../../../src/tui/components/ask-question-inline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,SAAS,EAMV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAc,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIzD;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,eAAe,GAAG,cAAc,CAAC;AAExE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzD,uFAAuF;IACvF,aAAa,CAAC,EAAE,wBAAwB,CAAC;IACzC,0FAA0F;IAC1F,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1C,4FAA4F;IAC5F,g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IAAI,IAAI;IAQf,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAe/B,kBAAkB,IAAI,eAAe;CAGtC"}
@@ -7,7 +7,7 @@
7
7
  * revision feedback via a regular chat message rather than inline input.
8
8
  */
9
9
  import { Container } from '@earendil-works/pi-tui';
10
- import type { Focusable, TUI } from '@earendil-works/pi-tui';
10
+ import type { Component, Focusable, TUI } from '@earendil-works/pi-tui';
11
11
  import type { ChatSpacingKind } from './chat-spacing.js';
12
12
  export interface PlanApprovalInlineOptions {
13
13
  toolCallId: string;
@@ -21,6 +21,29 @@ export interface PlanApprovalInlineOptions {
21
21
  onGoal: () => void;
22
22
  onReject: () => void;
23
23
  }
24
+ /** Exported for tests. */
25
+ export declare class PlanContentBox implements Component {
26
+ private plan;
27
+ private cachedLines?;
28
+ private cachedWidth?;
29
+ private cachedThemeGeneration?;
30
+ constructor(plan: string);
31
+ invalidate(): void;
32
+ render(width: number): string[];
33
+ }
34
+ /**
35
+ * Renders a unified diff between two plan texts inside a bordered box.
36
+ * Long lines are wrapped (not truncated) so the full plan text is visible.
37
+ */
38
+ export declare class PlanDiffBox implements Component {
39
+ private diffEntries;
40
+ private cachedLines?;
41
+ private cachedWidth?;
42
+ private cachedThemeGeneration?;
43
+ constructor(oldPlan: string, newPlan: string);
44
+ invalidate(): void;
45
+ render(width: number): string[];
46
+ }
24
47
  export declare class PlanApprovalInlineComponent extends Container implements Focusable {
25
48
  private ui;
26
49
  private contentBox;
@@ -1 +1 @@
1
- {"version":3,"file":"plan-approval-inline.d.ts","sourceRoot":"","sources":["../../../src/tui/components/plan-approval-inline.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,SAAS,EAOV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAa,SAAS,EAAc,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAKpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,WAAW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C,iBAAiB;IAIzB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,UAAU;IAelB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAOhC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,mBAAoB,SAAQ,SAAS;IAChD,kBAAkB,IAAI,eAAe;gBAIzB,OAAO,EAAE,iBAAiB;CAwBvC"}
1
+ {"version":3,"file":"plan-approval-inline.d.ts","sourceRoot":"","sources":["../../../src/tui/components/plan-approval-inline.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,SAAS,EAOV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAc,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAKpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,0BAA0B;AAC1B,qBAAa,cAAe,YAAW,SAAS;IAKlC,OAAO,CAAC,IAAI;IAJxB,OAAO,CA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D,QAAQ,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAalD,kBAAkB,IAAI,eAAe;IAIrC,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAY/B,OAAO,CAAC,gBAAgB;IA4CxB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,UAAU;IAelB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAOhC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,mBAAoB,SAAQ,SAAS;IAChD,kBAAkB,IAAI,eAAe;gBAIzB,OAAO,EAAE,iBAAiB;CAwBvC"}
@@ -4,6 +4,29 @@
4
4
  import { Container } from '@earendil-works/pi-tui';
5
5
  import type { MarkdownTheme } from '@earendil-works/pi-tui';
6
6
  import type { ChatSpacingKind } from './chat-spacing.js';
7
+ /**
8
+ * A renderable wrapper that adds a thin box-drawing border sized to content.
9
+ */
10
+ export declare class BorderedBox {
11
+ private child;
12
+ private pending;
13
+ private borderColor?;
14
+ private label?;
15
+ private cachedLines?;
16
+ private cachedWidth?;
17
+ private cachedThemeGeneration?;
18
+ constructor(child: {
19
+ render(width: number): string[];
20
+ invalidate?(): void;
21
+ }, options?: {
22
+ pending?: boolean;
23
+ borderColor?: string;
24
+ label?: string;
25
+ });
26
+ invalidate(): void;
27
+ render(width: number): string[];
28
+ private renderUncached;
29
+ }
7
30
  export declare class UserMessageComponent extends Container {
8
31
  constructor(text: string, markdownTheme?: MarkdownTheme, options?: {
9
32
  pending?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"user-message.d.ts","sourceRoot":"","sources":["../../../src/tui/components/user-message.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAiD,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAyHzD,qBAAa,oBAAqB,SAAQ,SAAS;gBAE/C,IAAI,EAAE,MAAM,EACZ,aAAa,GAAE,aAAkC,EACjD,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;IAc3E,kBAAkB,IAAI,eAAe;CAGtC;AAED,qBAAa,2BAA4B,SAAQ,SAAS;gBAC5C,IAAI,EAAE,MAAM,EAAE,UAAU,SAAI;IAQxC,kBAAkB,IAAI,eAAe;CAGtC"}
1
+ {"version":3,"file":"user-message.d.ts","sourceRoot":"","sources":["../../../src/tui/components/user-message.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAiD,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AASzD;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAA2D;IACxE,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,KAAK,CAAC,CAAS;IACvB,OAAO,CAAC,WAAW,CAAC,CAAW;IAC/B,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,qBAAqB,CAAC,CAAS;gBAGrC,KAAK,EAAE;QAAE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAAC,UAAU,CAAC,IAAI,IAAI,CAAA;KAAE,EAC/D,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;IAQ3E,UAAU;IAOV,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAa/B,OAAO,CAAC,cAAc;CAuFvB;AAED,qBAAa,oBAAqB,SAAQ,SAAS;gBAE/C,IAAI,EAAE,MAAM,EACZ,aAAa,GAAE,aAAkC,EACjD,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;IAc3E,kBAAkB,IAAI,eAAe;CAGtC;AAED,qBAAa,2BAA4B,SAAQ,SAAS;gBAC5C,IAAI,EAAE,MAAM,EAAE,UAAU,SAAI;IAQxC,kBAAkB,IAAI,eAAe;CAGtC"}
@@ -122,6 +122,7 @@ declare function getTheme(): ThemeColors;
122
122
  * Set the current theme.
123
123
  */
124
124
  declare function setTheme(colors: ThemeColors): void;
125
+ export declare function getThemeGeneration(): number;
125
126
  /**
126
127
  * Apply a theme mode, updating both the surface palette and the theme colors.
127
128
  */
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/tui/theme.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAO7D,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAIzC,wBAAgB,YAAY,IA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,MAAM,CAIhD;AAED;;GAEG;AACH,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElC;AAED;;GAEG;AACH,iBAAS,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpC;AAED;;GAEG;AACH,iBAAS,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjC;AAuBD,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG7C;AAED,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMhE;AAkCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAM,GAAG,MAAM,CAwDnF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAErD;AAKD;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAmB,GAAG,MAAM,CAIhG;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAmB,GAAG,MAAM,CAI9F;AAMD,eAAO,MAAM,KAAK;;;;;;;;CAQjB,CAAC;AAMF,wBAAgB,gBAAgB,IAAI,aAAa,CAmBhD;AAMD,wBAAgB,cAAc,IAAI,WAAW,CAY5C;AAMD,wBAAgB,oBAAoB,IAAI,iBAAiB,CASxD;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CASpD"}
@@ -237,6 +237,16 @@ function getTheme() {
237
237
  */
238
238
  function setTheme(colors) {
239
239
  currentTheme = colors;
240
+ themeGeneration++;
241
+ }
242
+ /**
243
+ * Monotonic counter bumped on every theme change. Components that cache
244
+ * rendered lines key their cache on this so a `/theme` switch invalidates
245
+ * styled output built under the previous palette.
246
+ */
247
+ let themeGeneration = 0;
248
+ function getThemeGeneration() {
249
+ return themeGeneration;
240
250
  }
241
251
  /**
242
252
  * Apply a theme mode, updating both the surface palette and the theme colors.
@@ -245,6 +255,7 @@ function applyThemeMode(mode, terminalBgHex) {
245
255
  currentThemeMode = mode;
246
256
  currentTheme = mode === "light" ? lightTheme : darkTheme;
247
257
  detectedTerminalBg = terminalBgHex;
258
+ themeGeneration++;
248
259
  computeAdaptedColors();
249
260
  if (process.stdout.isTTY) {
250
261
  const textHex = currentTheme.text;
@@ -3710,6 +3721,9 @@ var SlashCommandComponent = class extends WidthAwareContainer {
3710
3721
  */
3711
3722
  var AskQuestionBorderedBox = class {
3712
3723
  questionLines;
3724
+ cachedLines;
3725
+ cachedWidth;
3726
+ cachedThemeGeneration;
3713
3727
  selectList;
3714
3728
  input;
3715
3729
  hintText;
@@ -3731,32 +3745,53 @@ var AskQuestionBorderedBox = class {
3731
3745
  this.streaming = streaming ?? false;
3732
3746
  }
3733
3747
  invalidate() {
3748
+ this.dropCache();
3734
3749
  this.selectList?.invalidate();
3735
3750
  }
3751
+ dropCache() {
3752
+ this.cachedLines = void 0;
3753
+ this.cachedWidth = void 0;
3754
+ this.cachedThemeGeneration = void 0;
3755
+ }
3736
3756
  setInteractive(selectList, input, hintText) {
3737
3757
  this.streaming = false;
3738
3758
  this.selectList = selectList;
3739
3759
  this.input = input;
3740
3760
  if (hintText) this.hintText = hintText;
3761
+ this.dropCache();
3741
3762
  }
3742
3763
  setAnswered(selectedValue, isNegative) {
3743
3764
  this.streaming = false;
3744
3765
  this.answered = true;
3745
3766
  this.selectedValue = selectedValue;
3746
3767
  this.answerIsNegative = isNegative;
3768
+ this.dropCache();
3747
3769
  }
3748
3770
  setAnsweredMulti(selectedValues) {
3749
3771
  this.streaming = false;
3750
3772
  this.answered = true;
3751
3773
  this.selectedValues = selectedValues;
3752
3774
  this.answerIsNegative = false;
3775
+ this.dropCache();
3753
3776
  }
3754
3777
  setCancelled() {
3755
3778
  this.streaming = false;
3756
3779
  this.answered = true;
3757
3780
  this.cancelled = true;
3781
+ this.dropCache();
3758
3782
  }
3759
3783
  render(width) {
3784
+ if (this.answered) {
3785
+ if (this.cachedLines && this.cachedWidth === width && this.cachedThemeGeneration === getThemeGeneration()) return this.cachedLines;
3786
+ const result = this.renderSafe(width);
3787
+ this.cachedLines = result;
3788
+ this.cachedWidth = width;
3789
+ this.cachedThemeGeneration = getThemeGeneration();
3790
+ return result;
3791
+ }
3792
+ return this.renderSafe(width);
3793
+ }
3794
+ renderSafe(width) {
3760
3795
  try {
3761
3796
  return this._render(width);
3762
3797
  } catch {
@@ -4927,13 +4962,22 @@ var OMOutputComponent = class extends WidthAwareContainer {
4927
4962
  * "Request changes" rejects the plan and stops the agent — the user provides
4928
4963
  * revision feedback via a regular chat message rather than inline input.
4929
4964
  */
4965
+ /** Exported for tests. */
4930
4966
  var PlanContentBox = class {
4931
4967
  plan;
4968
+ cachedLines;
4969
+ cachedWidth;
4970
+ cachedThemeGeneration;
4932
4971
  constructor(plan) {
4933
4972
  this.plan = plan;
4934
4973
  }
4935
- invalidate() {}
4974
+ invalidate() {
4975
+ this.cachedLines = void 0;
4976
+ this.cachedWidth = void 0;
4977
+ this.cachedThemeGeneration = void 0;
4978
+ }
4936
4979
  render(width) {
4980
+ if (this.cachedLines && this.cachedWidth === width && this.cachedThemeGeneration === getThemeGeneration()) return this.cachedLines;
4937
4981
  const availableWidth = Math.max(24, width - 0);
4938
4982
  const innerWidth = Math.max(20, availableWidth - 4);
4939
4983
  const rendered = new Markdown(this.plan, 0, 0, getMarkdownTheme(), { color: (text) => theme.fg("text", text) }).render(innerWidth).flatMap((line) => line.length > 0 ? [line] : [""]);
@@ -4949,11 +4993,14 @@ var PlanContentBox = class {
4949
4993
  body.push(`${border("│")} ${chunk}${padding} ${border("│")}`);
4950
4994
  }
4951
4995
  }
4952
- return [
4996
+ this.cachedLines = [
4953
4997
  top,
4954
4998
  ...body,
4955
4999
  bottom
4956
5000
  ];
5001
+ this.cachedWidth = width;
5002
+ this.cachedThemeGeneration = getThemeGeneration();
5003
+ return this.cachedLines;
4957
5004
  }
4958
5005
  };
4959
5006
  /**
@@ -4962,11 +5009,19 @@ var PlanContentBox = class {
4962
5009
  */
4963
5010
  var PlanDiffBox = class {
4964
5011
  diffEntries;
5012
+ cachedLines;
5013
+ cachedWidth;
5014
+ cachedThemeGeneration;
4965
5015
  constructor(oldPlan, newPlan) {
4966
5016
  this.diffEntries = generatePlanDiff(oldPlan, newPlan);
4967
5017
  }
4968
- invalidate() {}
5018
+ invalidate() {
5019
+ this.cachedLines = void 0;
5020
+ this.cachedWidth = void 0;
5021
+ this.cachedThemeGeneration = void 0;
5022
+ }
4969
5023
  render(width) {
5024
+ if (this.cachedLines && this.cachedWidth === width && this.cachedThemeGeneration === getThemeGeneration()) return this.cachedLines;
4970
5025
  const availableWidth = Math.max(24, width - 0);
4971
5026
  const innerWidth = Math.max(20, availableWidth - 4);
4972
5027
  const border = (text) => chalk.hex(mastra.purple)(text);
@@ -4987,11 +5042,14 @@ var PlanDiffBox = class {
4987
5042
  body.push(`${border("│")} ${content}${padding} ${border("│")}`);
4988
5043
  }
4989
5044
  }
4990
- return [
5045
+ this.cachedLines = [
4991
5046
  top,
4992
5047
  ...body,
4993
5048
  bottom
4994
5049
  ];
5050
+ this.cachedWidth = width;
5051
+ this.cachedThemeGeneration = getThemeGeneration();
5052
+ return this.cachedLines;
4995
5053
  }
4996
5054
  };
4997
5055
  var PlanApprovalInlineComponent = class PlanApprovalInlineComponent extends Container {
@@ -7971,6 +8029,9 @@ var BorderedBox = class {
7971
8029
  pending;
7972
8030
  borderColor;
7973
8031
  label;
8032
+ cachedLines;
8033
+ cachedWidth;
8034
+ cachedThemeGeneration;
7974
8035
  constructor(child, options = {}) {
7975
8036
  this.child = child;
7976
8037
  this.pending = options.pending ?? false;
@@ -7978,9 +8039,20 @@ var BorderedBox = class {
7978
8039
  this.label = options.label;
7979
8040
  }
7980
8041
  invalidate() {
8042
+ this.cachedLines = void 0;
8043
+ this.cachedWidth = void 0;
8044
+ this.cachedThemeGeneration = void 0;
7981
8045
  this.child.invalidate?.();
7982
8046
  }
7983
8047
  render(width) {
8048
+ if (this.cachedLines && this.cachedWidth === width && this.cachedThemeGeneration === getThemeGeneration()) return this.cachedLines;
8049
+ const result = this.renderUncached(width);
8050
+ this.cachedLines = result;
8051
+ this.cachedWidth = width;
8052
+ this.cachedThemeGeneration = getThemeGeneration();
8053
+ return result;
8054
+ }
8055
+ renderUncached(width) {
7984
8056
  const borderColor = (s) => this.borderColor ? chalk.hex(this.borderColor)(s) : this.pending ? chalk.hex(theme.getTheme().dim)(s) : chalk.hex(tintHex(mastra.green, 1))(s);
7985
8057
  const maxInnerWidth = Math.max(1, width - 6 - 2 - 0 - 1);
7986
8058
  const childLines = this.child.render(maxInnerWidth);
@@ -21596,4 +21668,4 @@ var MastraTUI = class MastraTUI {
21596
21668
  //#endregion
21597
21669
  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 };
21598
21670
 
21599
- //# sourceMappingURL=tui-C5oYYa9R.js.map
21671
+ //# sourceMappingURL=tui-BUEL6cTY.js.map