mastracode 0.16.1 → 0.16.2-alpha.0
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 +12 -0
- package/dist/{chunk-STEXDXRO.cjs → chunk-GYPBM5OA.cjs} +101 -18
- package/dist/chunk-GYPBM5OA.cjs.map +1 -0
- package/dist/{chunk-BAPSA5PR.js → chunk-RJS6HQF7.js} +101 -18
- package/dist/chunk-RJS6HQF7.js.map +1 -0
- package/dist/cli.cjs +4 -4
- package/dist/cli.js +1 -1
- package/dist/tui/commands/update.d.ts.map +1 -1
- package/dist/tui/mastra-tui.d.ts.map +1 -1
- package/dist/tui.cjs +11 -11
- package/dist/tui.js +1 -1
- package/dist/utils/update-check.d.ts +11 -0
- package/dist/utils/update-check.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-BAPSA5PR.js.map +0 -1
- package/dist/chunk-STEXDXRO.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# mastracode
|
|
2
2
|
|
|
3
|
+
## 0.16.2-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Show user message in TUI immediately before async work (thread creation, hooks, sending) for instant feedback regardless of GC pressure or I/O delays ([#15942](https://github.com/mastra-ai/mastra/pull/15942))
|
|
8
|
+
|
|
9
|
+
- Added changelog display to the update prompt. When a new version is available, the update screen now shows a summary of what's changed, fetched from the published npm package's CHANGELOG.md. ([#15924](https://github.com/mastra-ai/mastra/pull/15924))
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`d587199`](https://github.com/mastra-ai/mastra/commit/d5871993c0371bde2b0717d6b47194755baa1443), [`4b2e4f3`](https://github.com/mastra-ai/mastra/commit/4b2e4f3bc9f5a63dcbfccfa54f9474340c3cea58)]:
|
|
12
|
+
- @mastra/core@1.29.2-alpha.0
|
|
13
|
+
- @mastra/memory@1.17.4-alpha.0
|
|
14
|
+
|
|
3
15
|
## 0.16.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -906,7 +906,7 @@ function getInstallCommand(pm, version) {
|
|
|
906
906
|
}
|
|
907
907
|
function getCurrentVersion() {
|
|
908
908
|
{
|
|
909
|
-
return "0.16.
|
|
909
|
+
return "0.16.2-alpha.0";
|
|
910
910
|
}
|
|
911
911
|
}
|
|
912
912
|
async function fetchLatestVersion() {
|
|
@@ -933,6 +933,62 @@ function isNewerVersion(current, latest) {
|
|
|
933
933
|
if (lMinor !== cMinor) return lMinor > cMinor;
|
|
934
934
|
return lPatch > cPatch;
|
|
935
935
|
}
|
|
936
|
+
var MAX_CHANGELOG_ENTRIES = 10;
|
|
937
|
+
async function fetchChangelog(version) {
|
|
938
|
+
try {
|
|
939
|
+
const url = `https://unpkg.com/${PACKAGE_NAME}@${version}/CHANGELOG.md`;
|
|
940
|
+
const controller = new AbortController();
|
|
941
|
+
const timeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
942
|
+
const res = await fetch(url, { signal: controller.signal });
|
|
943
|
+
clearTimeout(timeout);
|
|
944
|
+
if (!res.ok) return null;
|
|
945
|
+
const text = await res.text();
|
|
946
|
+
return parseChangelog(text, version);
|
|
947
|
+
} catch {
|
|
948
|
+
return null;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
function parseChangelog(markdown, version) {
|
|
952
|
+
const versionHeader = `## ${version}`;
|
|
953
|
+
const startIdx = markdown.indexOf(versionHeader);
|
|
954
|
+
if (startIdx === -1) return null;
|
|
955
|
+
const afterHeader = startIdx + versionHeader.length;
|
|
956
|
+
const nextHeaderIdx = markdown.indexOf("\n## ", afterHeader);
|
|
957
|
+
const section = nextHeaderIdx === -1 ? markdown.slice(afterHeader) : markdown.slice(afterHeader, nextHeaderIdx);
|
|
958
|
+
const lines = section.split("\n");
|
|
959
|
+
const entries = [];
|
|
960
|
+
let skipIndented = false;
|
|
961
|
+
for (let i = 0; i < lines.length; i++) {
|
|
962
|
+
const raw = lines[i];
|
|
963
|
+
const trimmed = raw.trim();
|
|
964
|
+
const isTopLevel = raw === trimmed && trimmed.startsWith("- ");
|
|
965
|
+
if (!isTopLevel) {
|
|
966
|
+
if (skipIndented && /^\s+-\s/.test(raw)) continue;
|
|
967
|
+
skipIndented = false;
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
970
|
+
if (/^- Updated dependenc/i.test(trimmed)) {
|
|
971
|
+
skipIndented = true;
|
|
972
|
+
continue;
|
|
973
|
+
}
|
|
974
|
+
skipIndented = false;
|
|
975
|
+
let entry = trimmed.slice(2);
|
|
976
|
+
entry = entry.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
|
|
977
|
+
entry = entry.replace(/\s*\(#\d+\)\s*/g, " ");
|
|
978
|
+
entry = entry.replace(/\s*\(`[a-f0-9]+`\)\s*/g, " ");
|
|
979
|
+
const sentenceEnd = entry.search(/\.\s/);
|
|
980
|
+
if (sentenceEnd !== -1 && sentenceEnd < 100) {
|
|
981
|
+
entry = entry.slice(0, sentenceEnd + 1);
|
|
982
|
+
} else if (entry.length > 120) {
|
|
983
|
+
entry = entry.slice(0, 117).trimEnd() + "\u2026";
|
|
984
|
+
}
|
|
985
|
+
entry = entry.trim();
|
|
986
|
+
if (entry) entries.push(entry);
|
|
987
|
+
if (entries.length >= MAX_CHANGELOG_ENTRIES) break;
|
|
988
|
+
}
|
|
989
|
+
if (entries.length === 0) return null;
|
|
990
|
+
return entries.map((e) => ` \u2022 ${e}`).join("\n");
|
|
991
|
+
}
|
|
936
992
|
function runUpdate(pm, targetVersion) {
|
|
937
993
|
const args = buildInstallArgs(pm, targetVersion);
|
|
938
994
|
return new Promise((resolve3) => {
|
|
@@ -7156,16 +7212,26 @@ async function handleUpdateCommand(ctx) {
|
|
|
7156
7212
|
ctx.showInfo(`You are already on the latest version (v${currentVersion}).`);
|
|
7157
7213
|
return;
|
|
7158
7214
|
}
|
|
7159
|
-
const pm = await detectPackageManager();
|
|
7215
|
+
const [pm, changelog] = await Promise.all([detectPackageManager(), fetchChangelog(latestVersion)]);
|
|
7160
7216
|
const settings = chunkP6EKFEJB_cjs.loadSettings();
|
|
7161
7217
|
if (settings.updateDismissedVersion) {
|
|
7162
7218
|
settings.updateDismissedVersion = null;
|
|
7163
7219
|
chunkP6EKFEJB_cjs.saveSettings(settings);
|
|
7164
7220
|
}
|
|
7221
|
+
let question = `A new version is available: v${latestVersion} (current: v${currentVersion}).`;
|
|
7222
|
+
if (changelog) {
|
|
7223
|
+
question += `
|
|
7224
|
+
|
|
7225
|
+
What's new:
|
|
7226
|
+
${changelog}`;
|
|
7227
|
+
}
|
|
7228
|
+
question += `
|
|
7229
|
+
|
|
7230
|
+
Would you like to update now?`;
|
|
7165
7231
|
return new Promise((resolve3) => {
|
|
7166
7232
|
const questionComponent = new AskQuestionInlineComponent(
|
|
7167
7233
|
{
|
|
7168
|
-
question
|
|
7234
|
+
question,
|
|
7169
7235
|
options: [
|
|
7170
7236
|
{ label: "Yes", description: "Update and restart" },
|
|
7171
7237
|
{ label: "No", description: "Skip this version" }
|
|
@@ -13484,22 +13550,15 @@ var MastraTUI = class _MastraTUI {
|
|
|
13484
13550
|
await handleShellPassthrough(this.state, userInput.slice(1).trim());
|
|
13485
13551
|
continue;
|
|
13486
13552
|
}
|
|
13487
|
-
if (this.state.pendingNewThread) {
|
|
13488
|
-
await this.state.harness.createThread();
|
|
13489
|
-
this.state.pendingNewThread = false;
|
|
13490
|
-
}
|
|
13491
13553
|
if (!this.state.harness.hasModelSelected()) {
|
|
13492
13554
|
showInfo(this.state, "No model selected. Use /models to select a model, or /login to authenticate.");
|
|
13493
13555
|
continue;
|
|
13494
13556
|
}
|
|
13495
|
-
const allowed = await this.runUserPromptHook(userInput);
|
|
13496
|
-
if (!allowed) {
|
|
13497
|
-
continue;
|
|
13498
|
-
}
|
|
13499
13557
|
const { content, images } = consumePendingImages(userInput, this.state.pendingImages);
|
|
13500
13558
|
this.state.pendingImages = [];
|
|
13559
|
+
const messageId = `user-${Date.now()}`;
|
|
13501
13560
|
addUserMessage(this.state, {
|
|
13502
|
-
id:
|
|
13561
|
+
id: messageId,
|
|
13503
13562
|
content: [
|
|
13504
13563
|
{ type: "text", text: content },
|
|
13505
13564
|
...images?.map((img) => ({
|
|
@@ -13509,6 +13568,20 @@ var MastraTUI = class _MastraTUI {
|
|
|
13509
13568
|
})) ?? []
|
|
13510
13569
|
]});
|
|
13511
13570
|
this.state.ui.requestRender();
|
|
13571
|
+
const allowed = await this.runUserPromptHook(userInput);
|
|
13572
|
+
if (!allowed) {
|
|
13573
|
+
const comp = this.state.messageComponentsById.get(messageId);
|
|
13574
|
+
if (comp) {
|
|
13575
|
+
this.state.chatContainer.removeChild(comp);
|
|
13576
|
+
this.state.messageComponentsById.delete(messageId);
|
|
13577
|
+
this.state.ui.requestRender();
|
|
13578
|
+
}
|
|
13579
|
+
continue;
|
|
13580
|
+
}
|
|
13581
|
+
if (this.state.pendingNewThread) {
|
|
13582
|
+
await this.state.harness.createThread();
|
|
13583
|
+
this.state.pendingNewThread = false;
|
|
13584
|
+
}
|
|
13512
13585
|
this.fireMessage(content, images);
|
|
13513
13586
|
} catch (error) {
|
|
13514
13587
|
showError(this.state, error instanceof Error ? error.message : "Unknown error");
|
|
@@ -14169,18 +14242,28 @@ var MastraTUI = class _MastraTUI {
|
|
|
14169
14242
|
}
|
|
14170
14243
|
return;
|
|
14171
14244
|
}
|
|
14172
|
-
const pm = await detectPackageManager();
|
|
14245
|
+
const [pm, changelog] = await Promise.all([detectPackageManager(), fetchChangelog(latestVersion)]);
|
|
14173
14246
|
this.hasShownUpdateBanner = true;
|
|
14174
|
-
await this.showUpdatePrompt(currentVersion, latestVersion, pm);
|
|
14247
|
+
await this.showUpdatePrompt(currentVersion, latestVersion, pm, changelog);
|
|
14175
14248
|
}
|
|
14176
14249
|
/**
|
|
14177
14250
|
* Show an inline Y/N prompt offering to auto-update.
|
|
14178
14251
|
*/
|
|
14179
|
-
showUpdatePrompt(currentVersion, latestVersion, pm) {
|
|
14252
|
+
showUpdatePrompt(currentVersion, latestVersion, pm, changelog) {
|
|
14253
|
+
let question = `A new version of Mastra Code is available: v${latestVersion} (current: v${currentVersion}).`;
|
|
14254
|
+
if (changelog) {
|
|
14255
|
+
question += `
|
|
14256
|
+
|
|
14257
|
+
What's new:
|
|
14258
|
+
${changelog}`;
|
|
14259
|
+
}
|
|
14260
|
+
question += `
|
|
14261
|
+
|
|
14262
|
+
Would you like to update now?`;
|
|
14180
14263
|
return new Promise((resolve3) => {
|
|
14181
14264
|
const questionComponent = new AskQuestionInlineComponent(
|
|
14182
14265
|
{
|
|
14183
|
-
question
|
|
14266
|
+
question,
|
|
14184
14267
|
options: [
|
|
14185
14268
|
{ label: "Yes", description: "Update and restart" },
|
|
14186
14269
|
{ label: "No", description: "Skip this version" }
|
|
@@ -14304,5 +14387,5 @@ exports.createTUIState = createTUIState;
|
|
|
14304
14387
|
exports.detectTerminalTheme = detectTerminalTheme;
|
|
14305
14388
|
exports.formatOMStatus = formatOMStatus;
|
|
14306
14389
|
exports.getCurrentVersion = getCurrentVersion;
|
|
14307
|
-
//# sourceMappingURL=chunk-
|
|
14308
|
-
//# sourceMappingURL=chunk-
|
|
14390
|
+
//# sourceMappingURL=chunk-GYPBM5OA.cjs.map
|
|
14391
|
+
//# sourceMappingURL=chunk-GYPBM5OA.cjs.map
|