mastracode 0.43.0-alpha.10 → 0.43.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/dist/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_tui = require("./tui-D24W4sNj.cjs");
2
+ const require_tui = require("./tui-CMhOuaGl.cjs");
3
3
  let _mastra_code_sdk = require("@mastra/code-sdk");
4
4
  let fs = require("fs");
5
5
  fs = require_tui.__toESM(fs, 1);
@@ -112,7 +112,7 @@ function resolveTuiSubagents(enabled) {
112
112
  //#endregion
113
113
  //#region src/version.ts
114
114
  function getCurrentVersion() {
115
- return "0.43.0-alpha.10";
115
+ return "0.43.0";
116
116
  }
117
117
  //#endregion
118
118
  //#region src/main.ts
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { b as TUI_CO_AUTHOR, d as detectTerminalTheme, f as applyThemeMode, t as MastraTUI, v as restoreTerminalForeground } from "./tui-C1Ara475.js";
2
+ import { b as TUI_CO_AUTHOR, d as detectTerminalTheme, f as applyThemeMode, t as MastraTUI, v as restoreTerminalForeground } from "./tui-BJfQ76dO.js";
3
3
  import { createMastraCode } from "@mastra/code-sdk";
4
4
  import fs from "fs";
5
5
  import { createMastraCodeAnalytics } from "@mastra/code-sdk/analytics";
@@ -111,7 +111,7 @@ function resolveTuiSubagents(enabled) {
111
111
  //#endregion
112
112
  //#region src/version.ts
113
113
  function getCurrentVersion() {
114
- return "0.43.0-alpha.10";
114
+ return "0.43.0";
115
115
  }
116
116
  //#endregion
117
117
  //#region src/main.ts
@@ -3,7 +3,7 @@ name: mastracode
3
3
  description: Documentation for mastracode. Use when working with mastracode APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "mastracode"
6
- version: "0.43.0-alpha.10"
6
+ version: "0.43.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.43.0-alpha.10",
2
+ "version": "0.43.0",
3
3
  "package": "mastracode",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -1 +1 @@
1
- {"version":3,"file":"goal.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/goal.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsG/F;AA8ED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBhF;AAOD,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,mBAAmB,EACxB,SAAS,EAAE,MAAM,EACjB,aAAa,SAAoB,GAChC,OAAO,CAAC,IAAI,CAAC,CAMf;AA2ID,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7D"}
1
+ {"version":3,"file":"goal.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/goal.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6G/F;AAiFD,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBhF;AAOD,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,mBAAmB,EACxB,SAAS,EAAE,MAAM,EACjB,aAAa,SAAoB,GAChC,OAAO,CAAC,IAAI,CAAC,CAMf;AA6ID,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7D"}
@@ -18,7 +18,7 @@ export declare class JudgeDisplayComponent extends WidthAwareContainer {
18
18
  private activity;
19
19
  private streamingReason;
20
20
  constructor(result?: GoalJudgeResult | null, turnsUsed?: number, maxTurns?: number);
21
- addActivity(line: string): void;
21
+ addActivity(rawLine: string): void;
22
22
  setStreamingReason(reason: string): void;
23
23
  setResult(result: GoalJudgeResult, turnsUsed: number, maxTurns: number): void;
24
24
  /** Render the result of an in-loop goal evaluation chunk. */
@@ -1 +1 @@
1
- {"version":3,"file":"judge-display.d.ts","sourceRoot":"","sources":["../../../src/tui/components/judge-display.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAKjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IACrD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,sEAAsE;AACtE,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CASvF;AAOD,qBAAa,qBAAsB,SAAQ,mBAAmB;IAC5D,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,eAAe,CAAM;gBAEjB,MAAM,GAAE,eAAe,GAAG,IAAW,EAAE,SAAS,SAAI,EAAE,QAAQ,SAAI;IAQ9E,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAU/B,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAKxC,SAAS,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ7E,6DAA6D;IAC7D,aAAa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AE,MAAM,GAAG,IAAI;IAQ7E,6DAA6D;IAC7D,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;IAInD,cAAc,IAAI,IAAI;IAItB,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAkClD,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,OAAO;IAQf,kBAAkB,IAAI,eAAe;CAGtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"agent-lifecycle.d.ts","sourceRoot":"","sources":["../../../src/tui/handlers/agent-lifecycle.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAWjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAiB/D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAgC7D;AAqED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAgDjE;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CA2B/D;AAeD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,mBAAmB,EAAE,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAsEnG"}
1
+ {"version":3,"file":"agent-lifecycle.d.ts","sourceRoot":"","sources":["../../../src/tui/handlers/agent-lifecycle.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAWjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAiB/D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAgC7D;AAqED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAgDjE;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CA2B/D;AAeD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,mBAAmB,EAAE,OAAO,EAAE,qBAAqB,GAAG,IAAI,CA0EnG"}
@@ -28,4 +28,10 @@
28
28
  * (bare ESC can confuse terminal state).
29
29
  */
30
30
  export declare function sanitizeAnsiForRendering(text: string): string;
31
+ /**
32
+ * Replace every control character (including ESC, so all escape sequences are
33
+ * neutralised) with a space. Use for untrusted one-line text such as goal
34
+ * fields and provider/scorer error messages, where no styling should survive.
35
+ */
36
+ export declare function stripControlChars(text: string): string;
31
37
  //# sourceMappingURL=sanitize-ansi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize-ansi.d.ts","sourceRoot":"","sources":["../../src/tui/sanitize-ansi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAoBH;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS7D"}
1
+ {"version":3,"file":"sanitize-ansi.d.ts","sourceRoot":"","sources":["../../src/tui/sanitize-ansi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAoBH;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS7D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/tui/setup.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,QAAQ,EAAE,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BAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CA+KvD;AAMD,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B5E;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBtE;AAED,2DAA2D;AAC3D,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9E;AAMD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE;IACT,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC;CACvB,GACA,MAAM,IAAI,CA2CZ;AAMD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CA0C5G;AAMD,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAkG7E;AAMD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAWxE"}
@@ -1106,6 +1106,14 @@ function sanitizeAnsiForRendering(text) {
1106
1106
  return "";
1107
1107
  });
1108
1108
  }
1109
+ /**
1110
+ * Replace every control character (including ESC, so all escape sequences are
1111
+ * neutralised) with a space. Use for untrusted one-line text such as goal
1112
+ * fields and provider/scorer error messages, where no styling should survive.
1113
+ */
1114
+ function stripControlChars(text) {
1115
+ return text.replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ").trim();
1116
+ }
1109
1117
  //#endregion
1110
1118
  //#region src/tui/components/assistant-message.ts
1111
1119
  /**
@@ -2220,7 +2228,7 @@ async function handleGoalCommand(ctx, args) {
2220
2228
  }
2221
2229
  await goalManager.saveToThread(state);
2222
2230
  ctx.updateStatusLine();
2223
- ctx.showInfo(`Goal paused: "${goal.objective}" (${goal.turnsUsed}/${goal.maxTurns} turns used). Use /goal resume to continue.`);
2231
+ ctx.showInfo(`Goal paused: "${stripControlChars(goal.objective)}" (${goal.turnsUsed}/${goal.maxTurns} turns used). Use /goal resume to continue.`);
2224
2232
  return;
2225
2233
  }
2226
2234
  if (subCommand === "resume") {
@@ -2250,14 +2258,20 @@ async function handleGoalCommand(ctx, args) {
2250
2258
  ctx.showInfo("Interrupted");
2251
2259
  return;
2252
2260
  }
2253
- ctx.showError(`Goal paused — failed to send continuation for "${goal.objective}": ${err instanceof Error ? err.message : String(err)}`);
2261
+ ctx.showError(`Goal paused — failed to send continuation for "${stripControlChars(goal.objective)}": ${stripControlChars(err instanceof Error ? err.message : String(err))}`);
2254
2262
  }
2255
2263
  return;
2256
2264
  }
2257
2265
  if (subCommand === "clear") {
2258
2266
  goalManager.clear();
2267
+ if (!await goalManager.deleteFromThread(state)) {
2268
+ if (!await goalManager.loadFromThread(state)) {
2269
+ ctx.updateStatusLine();
2270
+ ctx.showError("Could not clear the goal; it may still be active. Try /goal clear again.");
2271
+ return;
2272
+ }
2273
+ }
2259
2274
  state.planStartedGoalId = void 0;
2260
- await goalManager.saveToThread(state);
2261
2275
  if (state.session.run.isRunning() || state.session.suspensions.hasPending()) {
2262
2276
  state.activeInlineQuestion = void 0;
2263
2277
  state.pendingInlineQuestions.length = 0;
@@ -2276,7 +2290,8 @@ async function handleGoalCommand(ctx, args) {
2276
2290
  await startGoalWithDefaults(ctx, args.join(" "));
2277
2291
  }
2278
2292
  function formatGoalStatus(goal) {
2279
- return `Goal (${goal.status}): "${goal.objective}" — ${goal.turnsUsed}/${goal.maxTurns} turns used [judge: ${goal.judgeModelId}]`;
2293
+ const reason = goal.status === "paused" && goal.pausedReason ? ` — paused: ${goal.pausedReason}` : "";
2294
+ return stripControlChars(`Goal (${goal.status}): "${goal.objective}" — ${goal.turnsUsed}/${goal.maxTurns} turns used [judge: ${goal.judgeModelId}]${reason}`);
2280
2295
  }
2281
2296
  function formatGoalStatusRow(goal) {
2282
2297
  return formatGoalStatus(goal).replace(/\s+/g, " ");
@@ -2460,7 +2475,7 @@ async function startGoal(ctx, objective, judgeModelId, maxTurns) {
2460
2475
  ctx.showInfo("Interrupted");
2461
2476
  return;
2462
2477
  }
2463
- ctx.showError(`Goal paused — failed to start: ${err instanceof Error ? err.message : String(err)}`);
2478
+ ctx.showError(`Goal paused — failed to start: ${stripControlChars(err instanceof Error ? err.message : String(err))}`);
2464
2479
  }
2465
2480
  }
2466
2481
  //#endregion
@@ -5684,7 +5699,8 @@ var JudgeDisplayComponent = class extends WidthAwareContainer {
5684
5699
  this.maxTurns = maxTurns;
5685
5700
  this.rebuild();
5686
5701
  }
5687
- addActivity(line) {
5702
+ addActivity(rawLine) {
5703
+ const line = stripControlChars(rawLine);
5688
5704
  if (this.activity[this.activity.length - 1] !== line) this.activity.push(line);
5689
5705
  if (this.activity.length > 6) this.activity = this.activity.slice(-6);
5690
5706
  this.rebuild();
@@ -5721,7 +5737,7 @@ var JudgeDisplayComponent = class extends WidthAwareContainer {
5721
5737
  if (!this.result && this.activity.length === 0 && !this.streamingReason) this.addChild(new Text(this.renderRow(chalk.dim("evaluating…"), innerWidth, border), 0, 0));
5722
5738
  for (const line of this.activity) this.addChild(new Text(this.renderRow(this.renderActivityLine(line), innerWidth, border), 0, 0));
5723
5739
  if (this.activity.length > 0 && (this.result || this.streamingReason)) this.addChild(new Text(this.renderRow("", innerWidth, border), 0, 0));
5724
- const reason = this.result?.reason ?? this.streamingReason;
5740
+ const reason = stripControlChars(this.result?.reason ?? this.streamingReason);
5725
5741
  if (reason) for (const line of this.wrapLine(reason, innerWidth)) this.addChild(new Text(this.renderRow(chalk.dim(line), innerWidth, border), 0, 0));
5726
5742
  this.addChild(new Text(`${border("╰")}${border(horizontal)}${border("╯")}`, 0, 0));
5727
5743
  }
@@ -21454,7 +21470,8 @@ function handleGoalEvaluation(ctx, payload) {
21454
21470
  activeGoalJudge.component.setEvaluation(payload);
21455
21471
  state.goalManager.applyEvaluation({
21456
21472
  runsUsed: payload.iteration,
21457
- status: payload.status
21473
+ status: payload.status,
21474
+ ...payload.pausedReason ? { pausedReason: payload.pausedReason } : {}
21458
21475
  });
21459
21476
  ctx.updateStatusLine();
21460
21477
  flushRender(state);
@@ -26001,6 +26018,19 @@ function setupKeyboardShortcuts(state, callbacks) {
26001
26018
  return true;
26002
26019
  });
26003
26020
  }
26021
+ async function pauseStoredGoal(state, pausedReason) {
26022
+ const threadId = state.session.thread.getId();
26023
+ if (!threadId) return;
26024
+ try {
26025
+ const agent = state.controller.getCurrentAgent(state.session);
26026
+ if ((await agent.getObjective({ threadId }))?.status !== "active") return;
26027
+ await agent.updateObjectiveOptions({
26028
+ threadId,
26029
+ status: "paused",
26030
+ pausedReason
26031
+ });
26032
+ } catch {}
26033
+ }
26004
26034
  function abortActiveGoalJudge(state) {
26005
26035
  const activeGoalJudge = state.activeGoalJudge;
26006
26036
  if (!activeGoalJudge) return false;
@@ -26009,8 +26039,11 @@ function abortActiveGoalJudge(state) {
26009
26039
  activeGoalJudge.abortController.abort();
26010
26040
  activeGoalJudge.component.setInterrupted();
26011
26041
  state.session.abort();
26012
- state.goalManager.pause("Judge evaluation was interrupted.");
26013
- state.goalManager.saveToThread(state);
26042
+ const pausedReason = "Judge evaluation was interrupted.";
26043
+ if (state.goalManager.getGoal()) {
26044
+ state.goalManager.pause(pausedReason);
26045
+ state.goalManager.saveToThread(state);
26046
+ } else pauseStoredGoal(state, pausedReason);
26014
26047
  state.activeGoalJudge = void 0;
26015
26048
  state.ui.requestRender();
26016
26049
  return true;
@@ -28096,4 +28129,4 @@ var MastraTUI = class MastraTUI {
28096
28129
  //#endregion
28097
28130
  export { mastraBrand as _, OMProgressComponent as a, TUI_CO_AUTHOR as b, ToolExecutionComponentEnhanced as c, detectTerminalTheme as d, applyThemeMode as f, mastra as g, getThemeMode as h, LoginDialogComponent as i, ModelSelectorComponent as l, getMarkdownTheme as m, createTUIState as n, formatOMStatus as o, getEditorTheme as p, LoginSelectorComponent as r, UserMessageComponent as s, MastraTUI as t, AssistantMessageComponent as u, restoreTerminalForeground as v, theme as y };
28098
28131
 
28099
- //# sourceMappingURL=tui-C1Ara475.js.map
28132
+ //# sourceMappingURL=tui-BJfQ76dO.js.map