mastracode 0.30.1-alpha.2 → 0.31.0-alpha.4
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 +36 -0
- package/dist/{chunk-73PDBQZY.js → chunk-TDSXKHR5.js} +59 -2
- package/dist/chunk-TDSXKHR5.js.map +1 -0
- package/dist/{chunk-SYQIV27J.cjs → chunk-TWIBIHJ5.cjs} +60 -3
- package/dist/chunk-TWIBIHJ5.cjs.map +1 -0
- package/dist/cli.cjs +6 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/tui/command-dispatch.d.ts.map +1 -1
- package/dist/tui/commands/index.d.ts +1 -0
- package/dist/tui/commands/index.d.ts.map +1 -1
- package/dist/tui/commands/prune.d.ts +3 -0
- package/dist/tui/commands/prune.d.ts.map +1 -0
- package/dist/tui/components/help-overlay.d.ts.map +1 -1
- package/dist/tui/setup.d.ts.map +1 -1
- package/dist/tui/state.d.ts +3 -0
- package/dist/tui/state.d.ts.map +1 -1
- package/dist/tui.cjs +18 -18
- package/dist/tui.js +1 -1
- package/package.json +11 -11
- package/dist/chunk-73PDBQZY.js.map +0 -1
- package/dist/chunk-SYQIV27J.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# mastracode
|
|
2
2
|
|
|
3
|
+
## 0.31.0-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`177010f`](https://github.com/mastra-ai/mastra/commit/177010ff096d2e4b28d89803be5b1a4cad2a0d6b), [`54a51e0`](https://github.com/mastra-ai/mastra/commit/54a51e0a484fe1ebad3fb1f7ef5282a075709eb7)]:
|
|
8
|
+
- @mastra/core@1.51.0-alpha.3
|
|
9
|
+
- @mastra/code-sdk@0.1.0-alpha.3
|
|
10
|
+
|
|
11
|
+
## 0.31.0-alpha.3
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Added storage retention and a new `/prune` command to keep the local database from growing without bound. ([#19059](https://github.com/mastra-ai/mastra/pull/19059))
|
|
16
|
+
|
|
17
|
+
**Default retention policies** are now applied to Mastra Code storage: chat messages and threads are kept for 90 days, observability spans and logs for 14 days, scores and workflow snapshots for 30 days. Rows older than these limits are only removed when you run `/prune` — nothing is deleted automatically.
|
|
18
|
+
|
|
19
|
+
**New `/prune` command:**
|
|
20
|
+
- `/prune` closes the TUI, hands the terminal over to a maintenance run that deletes rows older than the retention policies with live progress output, then exits (start `mastracode` again for a new session)
|
|
21
|
+
- `/prune vacuum` additionally compacts local libsql database files to return the freed space to your disk, and reports the reclaimed size. Compaction streams a `VACUUM INTO` copy and swaps it into place — bounded memory and no WAL growth even on multi-GB databases — and refuses to start without enough free disk space for the copy
|
|
22
|
+
- `/prune keep-memory` skips chat history (messages and threads) so conversations are preserved for later use (fine-tuning, evals) while telemetry and run records are still deleted. Flags combine in any order, e.g. `/prune vacuum keep-memory`
|
|
23
|
+
- Compaction proves it has exclusive access to each database file before swapping. If another Mastra Code session still has the file open, `/prune vacuum` refuses with a clear message instead of silently orphaning that session's writes
|
|
24
|
+
|
|
25
|
+
Maintenance runs outside the TUI so retention deletes and `VACUUM` never contend with a live session for the database.
|
|
26
|
+
|
|
27
|
+
Also, when local tracing is disabled, observability data is no longer written to the libsql database at all.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`e955965`](https://github.com/mastra-ai/mastra/commit/e955965dce575a903e37cf054d28ea99aa48785e), [`bc1121a`](https://github.com/mastra-ai/mastra/commit/bc1121a7bb98f7cd73e82e3a7913a667a9fa9911), [`860ef7e`](https://github.com/mastra-ai/mastra/commit/860ef7e77d92b63469cbe5857aa1e626197e43e9), [`17e818c`](https://github.com/mastra-ai/mastra/commit/17e818c51a958ba90641b1a959dc38faf8c034e9), [`4451dfe`](https://github.com/mastra-ai/mastra/commit/4451dfe857428e7abcc0261a507a2e186dae6d47), [`4451dfe`](https://github.com/mastra-ai/mastra/commit/4451dfe857428e7abcc0261a507a2e186dae6d47), [`1d39058`](https://github.com/mastra-ai/mastra/commit/1d39058e548efd691799985d5c8af2737f1c3bd2)]:
|
|
32
|
+
- @mastra/core@1.51.0-alpha.2
|
|
33
|
+
- @mastra/schema-compat@1.3.4-alpha.1
|
|
34
|
+
- @mastra/libsql@1.16.0-alpha.0
|
|
35
|
+
- @mastra/code-sdk@0.1.0-alpha.2
|
|
36
|
+
- @mastra/mcp@1.13.1
|
|
37
|
+
- @mastra/memory@1.23.0-alpha.2
|
|
38
|
+
|
|
3
39
|
## 0.30.1-alpha.2
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
|
@@ -43,6 +43,7 @@ import { getOAuthProviders } from '@mastra/code-sdk/auth/index';
|
|
|
43
43
|
import { GatewayRegistry } from '@mastra/core/llm';
|
|
44
44
|
import { detectProject, getUserId, getCurrentGitBranchAsync, getUserName } from '@mastra/code-sdk/utils/project';
|
|
45
45
|
import { GITHUB_SIGNALS_METADATA_KEY } from '@mastra/github-signals';
|
|
46
|
+
import { runStorageMaintenance } from '@mastra/code-sdk/utils/storage-maintenance';
|
|
46
47
|
import { fileURLToPath } from 'url';
|
|
47
48
|
import { loadCustomCommands } from '@mastra/code-sdk/utils/slash-command-loader';
|
|
48
49
|
|
|
@@ -1559,6 +1560,10 @@ function getCommands(modes) {
|
|
|
1559
1560
|
{ key: "/review", description: "Review a GitHub pull request" },
|
|
1560
1561
|
{ key: "/report-issue", description: "Open or browse mastracode issues" },
|
|
1561
1562
|
{ key: "/cost", description: "Token usage and costs" },
|
|
1563
|
+
{
|
|
1564
|
+
key: "/prune",
|
|
1565
|
+
description: 'Prune old storage data \u2014 closes the TUI ("vacuum" reclaims disk, "keep-memory" keeps chats)'
|
|
1566
|
+
},
|
|
1562
1567
|
{ key: "/diff", description: "Modified files or git diff" },
|
|
1563
1568
|
{ key: "/sandbox", description: "Manage sandbox allowed paths" },
|
|
1564
1569
|
{ key: "/hooks", description: "Show/reload configured hooks" },
|
|
@@ -14984,6 +14989,47 @@ async function handleGithubCommand(ctx, args = []) {
|
|
|
14984
14989
|
ctx.showError(`Failed to ${action} GitHub PR: ${error instanceof Error ? error.message : String(error)}`);
|
|
14985
14990
|
}
|
|
14986
14991
|
}
|
|
14992
|
+
async function handlePruneCommand(ctx, args = []) {
|
|
14993
|
+
const maintenance = ctx.state.options.storageMaintenance;
|
|
14994
|
+
if (!maintenance) {
|
|
14995
|
+
ctx.showError("Storage maintenance is not available in this session.");
|
|
14996
|
+
return;
|
|
14997
|
+
}
|
|
14998
|
+
const flags = new Set(args.map((a) => a.toLowerCase()));
|
|
14999
|
+
const unknown = [...flags].filter((f) => f !== "vacuum" && f !== "keep-memory");
|
|
15000
|
+
if (unknown.length > 0) {
|
|
15001
|
+
ctx.showError(`Unknown /prune option: ${unknown.join(", ")}
|
|
15002
|
+
Usage: /prune [vacuum] [keep-memory]`);
|
|
15003
|
+
return;
|
|
15004
|
+
}
|
|
15005
|
+
const vacuum = flags.has("vacuum");
|
|
15006
|
+
const keepMemory = flags.has("keep-memory");
|
|
15007
|
+
ctx.stop();
|
|
15008
|
+
const log = (line) => console.info(line);
|
|
15009
|
+
log("Closing the TUI to run storage maintenance\u2026");
|
|
15010
|
+
let exitCode = 0;
|
|
15011
|
+
try {
|
|
15012
|
+
const quiesceSteps = ["MCP disconnect", "stop workers", "stop intervals"];
|
|
15013
|
+
const quiesceResults = await Promise.allSettled([
|
|
15014
|
+
ctx.mcpManager?.disconnect(),
|
|
15015
|
+
ctx.controller.getMastra()?.stopWorkers(),
|
|
15016
|
+
ctx.controller.stopIntervals()
|
|
15017
|
+
]);
|
|
15018
|
+
for (const [i, result] of quiesceResults.entries()) {
|
|
15019
|
+
if (result.status === "rejected") {
|
|
15020
|
+
log(
|
|
15021
|
+
`Warning: failed to quiesce a background writer (${quiesceSteps[i]}): ${result.reason instanceof Error ? result.reason.message : String(result.reason)}`
|
|
15022
|
+
);
|
|
15023
|
+
}
|
|
15024
|
+
}
|
|
15025
|
+
await runStorageMaintenance({ maintenance, vacuum, keepMemory, log });
|
|
15026
|
+
log("Storage maintenance complete. Run mastracode to start a new session.");
|
|
15027
|
+
} catch (err) {
|
|
15028
|
+
log(`Storage maintenance failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
15029
|
+
exitCode = 1;
|
|
15030
|
+
}
|
|
15031
|
+
process.exit(exitCode);
|
|
15032
|
+
}
|
|
14987
15033
|
|
|
14988
15034
|
// src/tui/goal-input-lock.ts
|
|
14989
15035
|
var GOAL_JUDGE_INPUT_LOCK_MESSAGE = "Goal judge is evaluating; wait a moment or press Esc to pause the goal.";
|
|
@@ -15122,6 +15168,9 @@ async function dispatchSlashCommand(input, state, buildCtx) {
|
|
|
15122
15168
|
case "cost":
|
|
15123
15169
|
handleCostCommand(ctx);
|
|
15124
15170
|
return true;
|
|
15171
|
+
case "prune":
|
|
15172
|
+
await handlePruneCommand(ctx, args);
|
|
15173
|
+
return true;
|
|
15125
15174
|
case "diff":
|
|
15126
15175
|
await handleDiffCommand(ctx, args[0]);
|
|
15127
15176
|
return true;
|
|
@@ -19799,6 +19848,14 @@ function setupAutocomplete(state) {
|
|
|
19799
19848
|
{ value: "judge", label: "judge", description: "Set the goal judge model and max attempts" }
|
|
19800
19849
|
].filter((command) => command.value.startsWith(argumentPrefix.toLowerCase()))
|
|
19801
19850
|
},
|
|
19851
|
+
{
|
|
19852
|
+
name: "prune",
|
|
19853
|
+
description: "Prune old storage data (closes the TUI, shows progress)",
|
|
19854
|
+
getArgumentCompletions: (argumentPrefix) => [
|
|
19855
|
+
{ value: "vacuum", label: "vacuum", description: "Prune, then VACUUM to reclaim disk space" },
|
|
19856
|
+
{ value: "keep-memory", label: "keep-memory", description: "Keep chat history (messages/threads)" }
|
|
19857
|
+
].filter((command) => command.value.startsWith(argumentPrefix.toLowerCase()))
|
|
19858
|
+
},
|
|
19802
19859
|
{ name: "exit", description: "Exit the TUI" },
|
|
19803
19860
|
{ name: "help", description: "Show available commands" }
|
|
19804
19861
|
];
|
|
@@ -21498,5 +21555,5 @@ Would you like to update now?`;
|
|
|
21498
21555
|
};
|
|
21499
21556
|
|
|
21500
21557
|
export { AssistantMessageComponent, LoginDialogComponent, LoginSelectorComponent, MastraTUI, ModelSelectorComponent, OMProgressComponent, ToolExecutionComponentEnhanced, UserMessageComponent, applyThemeMode, createTUIState, detectTerminalTheme, formatOMStatus, getEditorTheme, getMarkdownTheme, getThemeMode, mastra, restoreTerminalForeground, theme };
|
|
21501
|
-
//# sourceMappingURL=chunk-
|
|
21502
|
-
//# sourceMappingURL=chunk-
|
|
21558
|
+
//# sourceMappingURL=chunk-TDSXKHR5.js.map
|
|
21559
|
+
//# sourceMappingURL=chunk-TDSXKHR5.js.map
|