mastracode 0.31.1-alpha.4 → 0.31.1-alpha.8

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,53 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.31.1-alpha.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`3b77e77`](https://github.com/mastra-ai/mastra/commit/3b77e7704936522e4769d29de1b5ea6901f302bd), [`6b1bf3b`](https://github.com/mastra-ai/mastra/commit/6b1bf3b9494bd51aa8f654c68c9355d6046fa2a1), [`72e437c`](https://github.com/mastra-ai/mastra/commit/72e437c515942c80b9def5b026e0bdee61b469d9), [`72e437c`](https://github.com/mastra-ai/mastra/commit/72e437c515942c80b9def5b026e0bdee61b469d9), [`72e437c`](https://github.com/mastra-ai/mastra/commit/72e437c515942c80b9def5b026e0bdee61b469d9)]:
8
+ - @mastra/core@1.52.0-alpha.8
9
+ - @mastra/pg@1.17.0-alpha.1
10
+ - @mastra/libsql@1.17.0-alpha.1
11
+ - @mastra/code-sdk@0.2.0-alpha.8
12
+
13
+ ## 0.31.1-alpha.7
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`b7e79c3`](https://github.com/mastra-ai/mastra/commit/b7e79c3c02ac5cd415db34ba0975ceafc1464333), [`b75d749`](https://github.com/mastra-ai/mastra/commit/b75d749621ff5d17e86bcb4ee809d301fb4f7cf3), [`67dd8b5`](https://github.com/mastra-ai/mastra/commit/67dd8b594d8b87a3a4d4ca7659f57d89fe8312a6), [`c46bb46`](https://github.com/mastra-ai/mastra/commit/c46bb461636ce3a8d45ecd7fc5d4a58803360cd0), [`a8799bb`](https://github.com/mastra-ai/mastra/commit/a8799bb8e44f4a60d01e4e2acd3448ff80bf14f8)]:
18
+ - @mastra/core@1.52.0-alpha.7
19
+ - @mastra/code-sdk@0.2.0-alpha.7
20
+
21
+ ## 0.31.1-alpha.6
22
+
23
+ ### Patch Changes
24
+
25
+ - Fixed quiet-mode tool previews jumping during streamed updates. ([#19651](https://github.com/mastra-ai/mastra/pull/19651))
26
+
27
+ - Updated dependencies [[`a40adeb`](https://github.com/mastra-ai/mastra/commit/a40adeb222b961a56a58af56a106106525721b74), [`dfc7769`](https://github.com/mastra-ai/mastra/commit/dfc77695549e4434873051ddd1f6065330ed5ab8), [`821648b`](https://github.com/mastra-ai/mastra/commit/821648bf2871ef840100c7bacbecf676010bd12a), [`11f6cd9`](https://github.com/mastra-ai/mastra/commit/11f6cd96fe42582403416608beb212cc1a2cc79e)]:
28
+ - @mastra/core@1.52.0-alpha.6
29
+ - @mastra/code-sdk@0.2.0-alpha.6
30
+
31
+ ## 0.31.1-alpha.5
32
+
33
+ ### Patch Changes
34
+
35
+ - Fixed goal judge results rendering more than once during live goal runs. ([#19613](https://github.com/mastra-ai/mastra/pull/19613))
36
+
37
+ - dependencies updates: ([#19611](https://github.com/mastra-ai/mastra/pull/19611))
38
+ - Updated dependency [`ai@^6.0.225` ↗︎](https://www.npmjs.com/package/ai/v/6.0.225) (from `^6.0.224`, in `dependencies`)
39
+
40
+ - Fixed delivered steer messages disappearing from the chat after replacing their pending state. ([#19613](https://github.com/mastra-ai/mastra/pull/19613))
41
+
42
+ - Updated dependencies [[`ec857fc`](https://github.com/mastra-ai/mastra/commit/ec857fc79c264b53b38e16478c789b7177f2ad59), [`ec857fc`](https://github.com/mastra-ai/mastra/commit/ec857fc79c264b53b38e16478c789b7177f2ad59), [`e1f2fae`](https://github.com/mastra-ai/mastra/commit/e1f2faebaf048c3d4c2e2c01d293767c195d5794), [`63aa799`](https://github.com/mastra-ai/mastra/commit/63aa799c6b44eacc7806cda6846b7c5bbee06b37), [`d2ff897`](https://github.com/mastra-ai/mastra/commit/d2ff8979d3069c6101108cdb7815792b0cc1c1b3), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`bb92559`](https://github.com/mastra-ai/mastra/commit/bb9255954be8323a5ecab7595fe5365c564b3f52), [`89da3cd`](https://github.com/mastra-ai/mastra/commit/89da3cd80c7c9936791ff0c31e244bcc41b0dd12), [`73db8db`](https://github.com/mastra-ai/mastra/commit/73db8db90d69ab6153c7942749f624db0d96952d), [`76b7181`](https://github.com/mastra-ai/mastra/commit/76b71810366e6d90b9d3973149d1c7ba3659ffb9), [`0c0e8d7`](https://github.com/mastra-ai/mastra/commit/0c0e8d7becd4d1445c656b78d5d845f606c1ff9d), [`d7f5f9e`](https://github.com/mastra-ai/mastra/commit/d7f5f9e5d76ed588842bce30fac076ec9e3ad98a), [`9f7c67a`](https://github.com/mastra-ai/mastra/commit/9f7c67abeeb52c41c51a9b5edee60b62afe7cd8d), [`0c52047`](https://github.com/mastra-ai/mastra/commit/0c520470a4547666156b2f18eb794eb8bd2676c8), [`3b65e68`](https://github.com/mastra-ai/mastra/commit/3b65e68d7f1c771c7a70eea42d83fefdd28cad88), [`ec17152`](https://github.com/mastra-ai/mastra/commit/ec17152e7514b5fad37d6ed50f90a937b4bb87a2), [`e3868e2`](https://github.com/mastra-ai/mastra/commit/e3868e22babfffd0133771669ca724501c2dd58e)]:
43
+ - @mastra/code-sdk@0.2.0-alpha.5
44
+ - @mastra/core@1.52.0-alpha.5
45
+ - @mastra/tavily@1.1.1-alpha.0
46
+ - @mastra/libsql@1.16.1-alpha.0
47
+ - @mastra/memory@1.23.1-alpha.1
48
+ - @mastra/observability@1.16.2-alpha.0
49
+ - @mastra/mcp@1.15.0-alpha.0
50
+
3
51
  ## 0.31.1-alpha.4
4
52
 
5
53
  ### Patch Changes
@@ -3749,6 +3749,24 @@ function contentsToText(contents) {
3749
3749
  if (typeof contents === "string") return contents;
3750
3750
  return contents.filter((part) => part.type === "text").map((part) => part.text).join("\n");
3751
3751
  }
3752
+ function getUserSignalView(message) {
3753
+ const contents = getSignalView(message).contents;
3754
+ if (typeof contents === "string") {
3755
+ return { message: contents, imageCount: 0, fileCount: 0 };
3756
+ }
3757
+ let imageCount = 0;
3758
+ let fileCount = 0;
3759
+ for (const part of contents) {
3760
+ if (part.type !== "file") continue;
3761
+ if (part.mediaType.startsWith("image/")) imageCount++;
3762
+ else fileCount++;
3763
+ }
3764
+ return {
3765
+ message: contentsToText(contents),
3766
+ imageCount,
3767
+ fileCount
3768
+ };
3769
+ }
3752
3770
  function asRecord(value) {
3753
3771
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
3754
3772
  }
@@ -3773,6 +3791,11 @@ function getReminderView(message) {
3773
3791
  goalEvaluation: metadata.goalEvaluation
3774
3792
  };
3775
3793
  }
3794
+ function isGoalJudgeEvaluationSignal(message) {
3795
+ if (!isSignalMessage(message) || getSignalKind(message) !== "reminder") return false;
3796
+ const reminder = getReminderView(message);
3797
+ return reminder.reminderType === "goal-judge" && reminder.goalEvaluation !== void 0;
3798
+ }
3776
3799
  function getStateSignalView(message) {
3777
3800
  const signal = getSignalView(message);
3778
3801
  const stateMeta = asRecord(asRecord(signal.metadata)?.state) ?? {};
@@ -5845,6 +5868,7 @@ var ToolExecutionComponentEnhanced = class extends WidthAwareContainer {
5845
5868
  // Buffer for streaming shell output
5846
5869
  quietDisplayMode;
5847
5870
  quietPreviewLineLimit;
5871
+ quietPreviewRowFloor = 0;
5848
5872
  compactToolContinuation = false;
5849
5873
  compactToolHasFollowingContinuation = false;
5850
5874
  compactToolPreviousSummary;
@@ -5904,6 +5928,7 @@ var ToolExecutionComponentEnhanced = class extends WidthAwareContainer {
5904
5928
  setQuietPreviewLineLimit(limit) {
5905
5929
  const normalizedLimit = Number.isFinite(limit) ? limit : 2;
5906
5930
  this.quietPreviewLineLimit = Math.min(8, Math.max(0, Math.floor(normalizedLimit)));
5931
+ this.quietPreviewRowFloor = Math.min(this.quietPreviewRowFloor, this.quietPreviewLineLimit);
5907
5932
  this.rebuild();
5908
5933
  }
5909
5934
  setCompactToolModeColor(color) {
@@ -5927,7 +5952,7 @@ var ToolExecutionComponentEnhanced = class extends WidthAwareContainer {
5927
5952
  return this.getCompactToolSummary();
5928
5953
  }
5929
5954
  hasQuietStreamingPreview() {
5930
- return this.quietDisplayMode === "quiet" && this.quietPreviewLineLimit > 0 && this.getQuietActivePreview() !== "";
5955
+ return this.quietDisplayMode === "quiet" && this.toolName !== toolNames.MC_TOOLS.EXECUTE_COMMAND && this.quietPreviewLineLimit > 0 && (this.quietPreviewRowFloor > 0 || this.getQuietActivePreview() !== "");
5931
5956
  }
5932
5957
  setCompactToolContinuation(continuation, previousSummary) {
5933
5958
  if (this.compactToolContinuation === continuation && this.compactToolPreviousSummary === previousSummary) return;
@@ -6040,19 +6065,28 @@ var ToolExecutionComponentEnhanced = class extends WidthAwareContainer {
6040
6065
  if (this.quietDisplayMode !== "quiet" || this.toolName === toolNames.MC_TOOLS.EXECUTE_COMMAND || this.quietPreviewLineLimit <= 0)
6041
6066
  return [];
6042
6067
  const preview = this.getQuietActivePreview();
6043
- if (!preview) return [];
6044
- if (this.isQuietCodePreviewTool()) {
6045
- return this.getQuietCodePreviewLines(preview, maxLineWidth);
6046
- }
6047
- const firstLineWidth = Math.max(10, maxLineWidth - 4);
6048
- const continuationWidth = Math.max(10, maxLineWidth - 4);
6049
- const wrapped = this.wrapPreviewLines(preview, firstLineWidth, continuationWidth).slice(
6050
- -this.quietPreviewLineLimit
6051
- );
6052
- return wrapped.map((line) => {
6068
+ let lines = [];
6069
+ if (preview) {
6070
+ if (this.isQuietCodePreviewTool()) {
6071
+ lines = this.getQuietCodePreviewLines(preview, maxLineWidth);
6072
+ } else {
6073
+ const firstLineWidth = Math.max(10, maxLineWidth - 4);
6074
+ const continuationWidth = Math.max(10, maxLineWidth - 4);
6075
+ const wrapped = this.wrapPreviewLines(preview, firstLineWidth, continuationWidth).slice(
6076
+ -this.quietPreviewLineLimit
6077
+ );
6078
+ lines = wrapped.map((line) => {
6079
+ const linePrefix = ` ${chalk15__default.default.hex(this.getQuietToolRailColor())("\u2502")} `;
6080
+ return truncateAnsi2(`${linePrefix}${this.formatQuietActivePreview(line)}`, maxLineWidth);
6081
+ });
6082
+ }
6083
+ }
6084
+ this.quietPreviewRowFloor = Math.min(this.quietPreviewLineLimit, Math.max(this.quietPreviewRowFloor, lines.length));
6085
+ const padding = Array.from({ length: this.quietPreviewRowFloor - lines.length }, () => {
6053
6086
  const linePrefix = ` ${chalk15__default.default.hex(this.getQuietToolRailColor())("\u2502")} `;
6054
- return truncateAnsi2(`${linePrefix}${this.formatQuietActivePreview(line)}`, maxLineWidth);
6087
+ return truncateAnsi2(linePrefix, maxLineWidth);
6055
6088
  });
6089
+ return [...padding, ...lines];
6056
6090
  }
6057
6091
  getQuietCodePreviewLines(preview, maxLineWidth) {
6058
6092
  const linePrefix = ` ${chalk15__default.default.hex(this.getQuietToolRailColor())("\u2502")} `;
@@ -8830,20 +8864,22 @@ function addPendingUserMessage(state, messageId, text, images, options) {
8830
8864
  reconcileChatBoundarySpacers(state.chatContainer);
8831
8865
  state.ui.requestRender();
8832
8866
  }
8833
- function confirmPendingUserMessage(state, messageId, text) {
8867
+ function confirmPendingUserMessage(state, messageId, text, attachments) {
8834
8868
  const pending = state.pendingSignalMessageComponentsById.get(messageId);
8835
8869
  if (!pending) return;
8836
8870
  if (state.streamingComponent && state.session.displayState.get().isRunning) {
8837
8871
  state.streamingComponent = void 0;
8838
8872
  state.streamingMessage = void 0;
8839
8873
  }
8840
- replacePendingUserMessage(state, messageId, text);
8874
+ replacePendingUserMessage(state, messageId, text, attachments);
8841
8875
  }
8842
- function replacePendingUserMessage(state, messageId, text) {
8876
+ function replacePendingUserMessage(state, messageId, text, attachments) {
8843
8877
  const pending = state.pendingSignalMessageComponentsById.get(messageId);
8844
8878
  if (!pending) return;
8845
- const imageCount = pending.images?.length ?? 0;
8846
- const prefix = imageCount > 0 ? `[${imageCount} image${imageCount > 1 ? "s" : ""}] ` : "";
8879
+ const prefix = formatAttachmentPrefix(
8880
+ attachments?.imageCount ?? pending.images?.length ?? 0,
8881
+ attachments?.fileCount ?? 0
8882
+ );
8847
8883
  const label = getPendingUserMessageLabel(pending.isInterjection);
8848
8884
  const confirmed = new UserMessageComponent(prefix + text, getMarkdownTheme(), {
8849
8885
  ...label ? { label } : {}
@@ -8873,14 +8909,18 @@ function clearPendingUserMessages(state) {
8873
8909
  state.pendingSignalMessageComponentsById.clear();
8874
8910
  state.ui.requestRender();
8875
8911
  }
8876
- function confirmMatchingPendingUserMessage(state, messageId, text) {
8912
+ function confirmMatchingPendingUserMessage(state, messageId, text, attachments) {
8877
8913
  const normalizedText = text.trim();
8878
8914
  for (const [pendingId, pending] of state.pendingSignalMessageComponentsById) {
8879
8915
  if (pending.text.trim() !== normalizedText) continue;
8880
8916
  const label = getPendingUserMessageLabel(pending.isInterjection);
8881
- const confirmed = new UserMessageComponent(text, getMarkdownTheme(), {
8882
- ...label ? { label } : {}
8883
- });
8917
+ const confirmed = new UserMessageComponent(
8918
+ formatAttachmentPrefix(attachments.imageCount, attachments.fileCount) + text,
8919
+ getMarkdownTheme(),
8920
+ {
8921
+ ...label ? { label } : {}
8922
+ }
8923
+ );
8884
8924
  const idx = state.chatContainer.children.indexOf(pending.component);
8885
8925
  if (idx >= 0) {
8886
8926
  state.chatContainer.children.splice(idx, 1, confirmed);
@@ -8909,6 +8949,13 @@ function isImagePart(part) {
8909
8949
  const media = part.mediaType ?? part.mimeType ?? "";
8910
8950
  return media.startsWith("image/");
8911
8951
  }
8952
+ function formatAttachmentPrefix(imageCount, fileCount) {
8953
+ const labels = [
8954
+ imageCount > 0 ? `[${imageCount} image${imageCount > 1 ? "s" : ""}]` : "",
8955
+ fileCount > 0 ? `[${fileCount} file${fileCount > 1 ? "s" : ""}]` : ""
8956
+ ].filter(Boolean);
8957
+ return labels.length > 0 ? `${labels.join(" ")} ` : "";
8958
+ }
8912
8959
  function renderSignalMessage(state, message) {
8913
8960
  const kind = getSignalKind(message);
8914
8961
  if (kind === "reminder") {
@@ -9016,13 +9063,21 @@ function addUserMessage(state, message, options) {
9016
9063
  if (state.messageComponentsById.has(message.id)) {
9017
9064
  return;
9018
9065
  }
9066
+ let textContent;
9067
+ let imageCount;
9068
+ let fileCount;
9019
9069
  if (isSignalMessage(message)) {
9020
9070
  if (renderSignalMessage(state, message)) return;
9071
+ const userSignal = getUserSignalView(message);
9072
+ textContent = userSignal.message;
9073
+ imageCount = userSignal.imageCount;
9074
+ fileCount = userSignal.fileCount;
9075
+ } else {
9076
+ const parts = getUserContentParts(message);
9077
+ textContent = getMessageText(message);
9078
+ imageCount = parts.filter((part) => isImagePart(part)).length;
9079
+ fileCount = parts.filter((part) => part.type === "file" && !isImagePart(part)).length;
9021
9080
  }
9022
- const parts = getUserContentParts(message);
9023
- const textContent = getMessageText(message);
9024
- const imageCount = parts.filter((part) => isImagePart(part)).length;
9025
- const fileCount = parts.filter((part) => part.type === "file" && !isImagePart(part)).length;
9026
9081
  const displayText = imageCount > 0 ? textContent.replace(/\[image\]\s*/g, "").trim() : textContent.trim();
9027
9082
  const exactDisplayText = displayText.trim();
9028
9083
  const slashCommandMatch = exactDisplayText.match(/^<slash-command\s+name="([^"]*)">([\s\S]*?)<\/slash-command>$/);
@@ -9073,11 +9128,12 @@ function addUserMessage(state, message, options) {
9073
9128
  state.ui.requestRender();
9074
9129
  return;
9075
9130
  }
9131
+ const attachments = { imageCount, fileCount };
9076
9132
  if (state.pendingSignalMessageComponentsById.has(message.id)) {
9077
- confirmPendingUserMessage(state, message.id, displayText);
9133
+ confirmPendingUserMessage(state, message.id, displayText, attachments);
9078
9134
  return;
9079
9135
  }
9080
- if (confirmMatchingPendingUserMessage(state, message.id, displayText)) {
9136
+ if (confirmMatchingPendingUserMessage(state, message.id, displayText, attachments)) {
9081
9137
  return;
9082
9138
  }
9083
9139
  const dedupKey = displayText.trim();
@@ -9108,11 +9164,7 @@ function addUserMessage(state, message, options) {
9108
9164
  state.ui.requestRender();
9109
9165
  return;
9110
9166
  }
9111
- const attachmentLabels = [
9112
- imageCount > 0 ? `[${imageCount} image${imageCount > 1 ? "s" : ""}]` : "",
9113
- fileCount > 0 ? `[${fileCount} file${fileCount > 1 ? "s" : ""}]` : ""
9114
- ].filter(Boolean);
9115
- const prefix = attachmentLabels.length > 0 ? `${attachmentLabels.join(" ")} ` : "";
9167
+ const prefix = formatAttachmentPrefix(imageCount, fileCount);
9116
9168
  if (displayText || prefix) {
9117
9169
  const label = getUserMessageLabel(message, options?.label);
9118
9170
  const userComponent = new UserMessageComponent(prefix + displayText, getMarkdownTheme(), {
@@ -15802,6 +15854,7 @@ function handleMessageStart(ctx, message) {
15802
15854
  if (message.role === "signal") {
15803
15855
  if (state.currentRunSystemReminderKeys.has(message.id)) return;
15804
15856
  state.currentRunSystemReminderKeys.add(message.id);
15857
+ if (isGoalJudgeEvaluationSignal(message)) return;
15805
15858
  }
15806
15859
  ctx.addUserMessage(message);
15807
15860
  return;
@@ -15822,6 +15875,7 @@ function handleMessageStart(ctx, message) {
15822
15875
  function handleMessageUpdate(ctx, message) {
15823
15876
  const { state } = ctx;
15824
15877
  if (message.role === "signal") {
15878
+ if (isGoalJudgeEvaluationSignal(message)) return;
15825
15879
  ctx.addUserMessage(message);
15826
15880
  return;
15827
15881
  }
@@ -17764,7 +17818,7 @@ function inertSession() {
17764
17818
  };
17765
17819
  }
17766
17820
  function resolveAsset(name) {
17767
- const here = path2.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-EAGGG466.cjs', document.baseURI).href))));
17821
+ const here = path2.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-D7H6UQ7E.cjs', document.baseURI).href))));
17768
17822
  const candidates = [
17769
17823
  path2.join(here, name),
17770
17824
  // dev: src/tui/voice/native/<name>
@@ -21639,5 +21693,5 @@ exports.getThemeMode = getThemeMode;
21639
21693
  exports.mastra = mastra;
21640
21694
  exports.restoreTerminalForeground = restoreTerminalForeground;
21641
21695
  exports.theme = theme;
21642
- //# sourceMappingURL=chunk-EAGGG466.cjs.map
21643
- //# sourceMappingURL=chunk-EAGGG466.cjs.map
21696
+ //# sourceMappingURL=chunk-D7H6UQ7E.cjs.map
21697
+ //# sourceMappingURL=chunk-D7H6UQ7E.cjs.map