mastracode 0.21.2-alpha.5 → 0.21.2-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,15 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.21.2-alpha.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed TUI crash on narrow terminals when prompt dialogs render lines wider than terminal width ([#17431](https://github.com/mastra-ai/mastra/pull/17431))
8
+
9
+ - Updated dependencies [[`b0771a4`](https://github.com/mastra-ai/mastra/commit/b0771a48b46e46d270fca208a587922f3b7104a8), [`19a8658`](https://github.com/mastra-ai/mastra/commit/19a86589c788ef48bb6c1b0612cc82a201857379), [`a659a77`](https://github.com/mastra-ai/mastra/commit/a659a779bdebe3a52a518c56d2260592d0240fe0), [`3332be9`](https://github.com/mastra-ai/mastra/commit/3332be9701ecd77aba840959d9a1d1ce7aef02d3)]:
10
+ - @mastra/agent-browser@0.3.0-alpha.1
11
+ - @mastra/core@1.38.0-alpha.6
12
+
3
13
  ## 0.21.2-alpha.5
4
14
 
5
15
  ### Patch Changes
@@ -2,7 +2,7 @@ import { tintHex, mastra, theme, getMarkdownTheme, CHAT_INDENT, BOX_INDENT, getT
2
2
  import { getOAuthProviders, detectProject, DEFAULT_CONFIG_DIR, getUserId, getCurrentGitBranchAsync, getUserName, PROVIDER_DEFAULT_MODELS, getAppDataDir } from './chunk-5FT2NNFO.js';
3
3
  import { MC_TOOLS, getToolCategory, TOOL_CATEGORIES } from './chunk-TTAAM2XR.js';
4
4
  import { exec, spawn, execFile, execSync, execFileSync } from 'child_process';
5
- import { visibleWidth, Box, Text, Spacer, Input, Container, fuzzyFilter, getKeybindings, Markdown, ProcessTerminal, TUI, Editor, matchesKey, CombinedAutocompleteProvider, SelectList, truncateToWidth, wrapTextWithAnsi, SettingsList, parseKey } from '@mariozechner/pi-tui';
5
+ import { visibleWidth, Box, Text, Spacer, Input, Container, fuzzyFilter, getKeybindings, Markdown, ProcessTerminal, TUI, truncateToWidth, Editor, matchesKey, CombinedAutocompleteProvider, SelectList, wrapTextWithAnsi, SettingsList, parseKey } from '@mariozechner/pi-tui';
6
6
  import chalk10 from 'chalk';
7
7
  import fs2, { statSync, readFileSync, realpathSync, promises, unlinkSync } from 'fs';
8
8
  import * as path5 from 'path';
@@ -294,8 +294,14 @@ var AskQuestionBorderedBox = class {
294
294
  const lines = [];
295
295
  lines.push(BOX_INDENT_STR + border(`\u256D${"\u2500".repeat(boxWidth - 2)}\u256E`));
296
296
  const addLine = (content, contentVisWidth) => {
297
- const pad = Math.max(0, innerWidth - contentVisWidth);
298
- lines.push(BOX_INDENT_STR + border("\u2502") + " " + content + " ".repeat(pad) + " " + border("\u2502"));
297
+ let finalContent = content;
298
+ let finalWidth = contentVisWidth;
299
+ if (finalWidth > innerWidth) {
300
+ finalContent = truncateToWidth(content, innerWidth);
301
+ finalWidth = visibleWidth(finalContent);
302
+ }
303
+ const pad = Math.max(0, innerWidth - finalWidth);
304
+ lines.push(BOX_INDENT_STR + border("\u2502") + " " + finalContent + " ".repeat(pad) + " " + border("\u2502"));
299
305
  };
300
306
  const header = theme.bold(theme.fg("accent", "Question"));
301
307
  addLine(header, visibleWidth(header));
@@ -1167,7 +1173,7 @@ function getInstallCommand(pm, version) {
1167
1173
  }
1168
1174
  function getCurrentVersion() {
1169
1175
  {
1170
- return "0.21.2-alpha.5";
1176
+ return "0.21.2-alpha.6";
1171
1177
  }
1172
1178
  }
1173
1179
  async function fetchLatestVersion() {
@@ -4723,8 +4729,14 @@ var PlanContentBox = class {
4723
4729
  const top = `${border("\u256D")}${border("\u2500".repeat(innerWidth + 2))}${border("\u256E")}`;
4724
4730
  const bottom = `${border("\u2570")}${border("\u2500".repeat(innerWidth + 2))}${border("\u256F")}`;
4725
4731
  const body = rendered.map((line) => {
4726
- const padding = " ".repeat(Math.max(0, innerWidth - visibleWidth(line)));
4727
- return `${border("\u2502")} ${line}${padding} ${border("\u2502")}`;
4732
+ let content = line;
4733
+ let contentVis = visibleWidth(content);
4734
+ if (contentVis > innerWidth) {
4735
+ content = truncateToWidth(content, innerWidth);
4736
+ contentVis = visibleWidth(content);
4737
+ }
4738
+ const padding = " ".repeat(Math.max(0, innerWidth - contentVis));
4739
+ return `${border("\u2502")} ${content}${padding} ${border("\u2502")}`;
4728
4740
  });
4729
4741
  return [top, ...body, bottom];
4730
4742
  }
@@ -7892,6 +7904,8 @@ var BorderedBox = class {
7892
7904
  const w = visibleWidth(stripAnsi3(trimmed));
7893
7905
  if (w > maxContentWidth) maxContentWidth = w;
7894
7906
  }
7907
+ const maxAllowedContent = maxInnerWidth;
7908
+ maxContentWidth = Math.min(maxContentWidth, maxAllowedContent);
7895
7909
  let boxInner = maxContentWidth + 2;
7896
7910
  if (this.label) {
7897
7911
  const labelOverhead = ` ${this.label} `.length + 2;
@@ -7913,8 +7927,13 @@ var BorderedBox = class {
7913
7927
  lines.push(borderColor(`\u256D${"\u2500".repeat(boxWidth - 2)}\u256E`));
7914
7928
  }
7915
7929
  for (let i = 0; i < trimmedLines.length; i++) {
7916
- const trimmed = trimmedLines[i];
7917
- const vis = visibleWidth(stripAnsi3(trimmed));
7930
+ let trimmed = trimmedLines[i];
7931
+ let vis = visibleWidth(stripAnsi3(trimmed));
7932
+ const lineMaxWidth = i === 0 ? boxInner - promptWidth : boxInner;
7933
+ if (vis > lineMaxWidth) {
7934
+ trimmed = truncateToWidth(trimmed, lineMaxWidth);
7935
+ vis = visibleWidth(stripAnsi3(trimmed));
7936
+ }
7918
7937
  if (i === 0) {
7919
7938
  const padNeeded = Math.max(0, boxInner - vis - promptWidth);
7920
7939
  lines.push(borderColor("\u2502") + " " + promptPrefix + trimmed + " ".repeat(padNeeded) + " " + borderColor("\u2502"));
@@ -18567,5 +18586,5 @@ Would you like to update now?`;
18567
18586
  };
18568
18587
 
18569
18588
  export { AssistantMessageComponent, LoginDialogComponent, LoginSelectorComponent, MastraTUI, ModelSelectorComponent, OMProgressComponent, ToolExecutionComponentEnhanced, UserMessageComponent, createTUIState, detectTerminalTheme, formatOMStatus, getCurrentVersion };
18570
- //# sourceMappingURL=chunk-HP454OE2.js.map
18571
- //# sourceMappingURL=chunk-HP454OE2.js.map
18589
+ //# sourceMappingURL=chunk-DI26VPRS.js.map
18590
+ //# sourceMappingURL=chunk-DI26VPRS.js.map