mastracode 0.20.1-alpha.4 → 0.20.1-alpha.5

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,16 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.20.1-alpha.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed mode switching delay — Shift+Tab now updates instantly. Fixed modal lag when opening /om and /models. Fixed duplicate messages appearing when queueing with Ctrl+F. Blocked mode switching while agent is active. ([#17008](https://github.com/mastra-ai/mastra/pull/17008))
8
+
9
+ - Fix Mastra Code TUI crash when ask_user option labels are wider than the terminal — long labels now wrap inside the bordered box, matching how question text already wraps. Reported in #17002. ([#17005](https://github.com/mastra-ai/mastra/pull/17005))
10
+
11
+ - Updated dependencies [[`6096445`](https://github.com/mastra-ai/mastra/commit/60964459733f0ab384584d95e19c36607ffdf7b0), [`91cf0e0`](https://github.com/mastra-ai/mastra/commit/91cf0e027e511b871481a8576b56b7af83b15afd)]:
12
+ - @mastra/core@1.37.0-alpha.5
13
+
3
14
  ## 0.20.1-alpha.4
4
15
 
5
16
  ### Patch Changes
@@ -205,32 +205,40 @@ var AskQuestionBorderedBox = class {
205
205
  }
206
206
  }
207
207
  addLine("", 0);
208
+ const continuationPrefix = " ";
209
+ const addWrappedOptionLine = (prefix, label, style) => {
210
+ const prefixVis = piTui.visibleWidth(prefix);
211
+ const wrapped = piTui.wrapTextWithAnsi(label, Math.max(1, innerWidth - prefixVis));
212
+ wrapped.forEach((line, index) => {
213
+ const linePrefix = index === 0 ? prefix : continuationPrefix;
214
+ const content = `${linePrefix}${style(line)}`;
215
+ addLine(content, piTui.visibleWidth(linePrefix) + piTui.visibleWidth(line));
216
+ });
217
+ };
208
218
  if (this.streaming) {
219
+ const dim = (s) => chunk5SWBONRN_cjs.theme.fg("dim", s);
209
220
  for (const item of this.items) {
210
- const line = chunk5SWBONRN_cjs.theme.fg("dim", ` ${item.label}`);
211
- addLine(line, piTui.visibleWidth(line));
221
+ addWrappedOptionLine(continuationPrefix, item.label, dim);
212
222
  }
213
223
  const waiting = chunk5SWBONRN_cjs.theme.fg("dim", "\u2026");
214
224
  addLine(waiting, piTui.visibleWidth(waiting));
215
225
  } else if (this.answered && this.items.length > 0) {
226
+ const dim = (s) => chunk5SWBONRN_cjs.theme.fg("dim", s);
216
227
  if (this.cancelled) {
217
228
  for (const item of this.items) {
218
- const line = chunk5SWBONRN_cjs.theme.fg("dim", ` ${item.label}`);
219
- addLine(line, piTui.visibleWidth(line));
229
+ addWrappedOptionLine(continuationPrefix, item.label, dim);
220
230
  }
221
231
  const cancelLine = `${chunk5SWBONRN_cjs.theme.fg("error", "\u2717")} ${chunk5SWBONRN_cjs.theme.fg("dim", "(cancelled)")}`;
222
232
  addLine(cancelLine, piTui.visibleWidth(cancelLine));
223
233
  } else {
234
+ const text = (s) => chunk5SWBONRN_cjs.theme.fg("text", s);
224
235
  for (const item of this.items) {
225
236
  const isSelected = item.label === this.selectedValue;
226
237
  if (isSelected) {
227
238
  const icon = this.answerIsNegative ? chunk5SWBONRN_cjs.theme.fg("error", "\u2717") : chunk5SWBONRN_cjs.theme.fg("success", "\u2713");
228
- const label = chunk5SWBONRN_cjs.theme.fg("text", item.label);
229
- const line = `${icon} ${label}`;
230
- addLine(line, piTui.visibleWidth(line));
239
+ addWrappedOptionLine(`${icon} `, item.label, text);
231
240
  } else {
232
- const line = chunk5SWBONRN_cjs.theme.fg("dim", ` ${item.label}`);
233
- addLine(line, piTui.visibleWidth(line));
241
+ addWrappedOptionLine(continuationPrefix, item.label, dim);
234
242
  }
235
243
  }
236
244
  }
@@ -238,10 +246,10 @@ var AskQuestionBorderedBox = class {
238
246
  } else if (this.answered && this.selectedValue != null) {
239
247
  const icon = this.answerIsNegative ? chunk5SWBONRN_cjs.theme.fg("error", "\u2717") : chunk5SWBONRN_cjs.theme.fg("success", "\u2713");
240
248
  const iconPrefix = `${icon} `;
241
- const continuationPrefix = " ";
249
+ const continuationPrefix2 = " ";
242
250
  const wrappedAnswer = piTui.wrapTextWithAnsi(this.selectedValue, Math.max(1, innerWidth - piTui.visibleWidth(iconPrefix)));
243
251
  wrappedAnswer.forEach((line, index) => {
244
- const prefix = index === 0 ? iconPrefix : continuationPrefix;
252
+ const prefix = index === 0 ? iconPrefix : continuationPrefix2;
245
253
  const content = `${prefix}${chunk5SWBONRN_cjs.theme.fg("text", line)}`;
246
254
  addLine(content, piTui.visibleWidth(prefix) + piTui.visibleWidth(line));
247
255
  });
@@ -1031,7 +1039,7 @@ function getInstallCommand(pm, version) {
1031
1039
  }
1032
1040
  function getCurrentVersion() {
1033
1041
  {
1034
- return "0.20.1-alpha.4";
1042
+ return "0.20.1-alpha.5";
1035
1043
  }
1036
1044
  }
1037
1045
  async function fetchLatestVersion() {
@@ -8375,6 +8383,14 @@ function addUserMessage(state, message, options) {
8375
8383
  if (confirmMatchingPendingUserMessage(state, message.id, displayText)) {
8376
8384
  return;
8377
8385
  }
8386
+ const dedupKey = displayText.trim();
8387
+ const pendingEchoCounts = state.firedQueuedMessageTexts;
8388
+ const dedupCount = pendingEchoCounts?.get(dedupKey) ?? 0;
8389
+ if (dedupCount > 0) {
8390
+ if (dedupCount === 1) pendingEchoCounts.delete(dedupKey);
8391
+ else pendingEchoCounts.set(dedupKey, dedupCount - 1);
8392
+ return;
8393
+ }
8378
8394
  const legacyReminderMatch = exactDisplayText.match(
8379
8395
  /^<system-reminder(?<attrs>\s+[^>]*)?>(?<body>[\s\S]*?)<\/system-reminder>$/
8380
8396
  );
@@ -14234,6 +14250,9 @@ function drainQueuedAction(ctx) {
14234
14250
  ],
14235
14251
  createdAt: /* @__PURE__ */ new Date()
14236
14252
  });
14253
+ const key = nextMessage.content.trim();
14254
+ const counts = state.firedQueuedMessageTexts ??= /* @__PURE__ */ new Map();
14255
+ counts.set(key, (counts.get(key) ?? 0) + 1);
14237
14256
  state.ui.requestRender();
14238
14257
  ctx.fireMessage(nextMessage.content, nextMessage.images);
14239
14258
  return true;
@@ -15847,6 +15866,10 @@ function setupKeyboardShortcuts(state, callbacks) {
15847
15866
  state.ui.requestRender();
15848
15867
  });
15849
15868
  state.editor.onAction("cycleMode", async () => {
15869
+ if (state.harness.isRunning()) {
15870
+ showInfo(state, "Wait for the agent to finish first");
15871
+ return;
15872
+ }
15850
15873
  if (state.activeInlinePlanApproval) {
15851
15874
  showInfo(state, "Resolve the plan approval first");
15852
15875
  return;
@@ -18016,5 +18039,5 @@ exports.createTUIState = createTUIState;
18016
18039
  exports.detectTerminalTheme = detectTerminalTheme;
18017
18040
  exports.formatOMStatus = formatOMStatus;
18018
18041
  exports.getCurrentVersion = getCurrentVersion;
18019
- //# sourceMappingURL=chunk-VSPSFM7I.cjs.map
18020
- //# sourceMappingURL=chunk-VSPSFM7I.cjs.map
18042
+ //# sourceMappingURL=chunk-7454RWHB.cjs.map
18043
+ //# sourceMappingURL=chunk-7454RWHB.cjs.map