mastracode 0.20.0-alpha.4 → 0.20.0-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,18 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.20.0-alpha.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Restore MastraCode local command execution to inherit parent environment variables while redacting env-shaped and secret-looking workspace trace data. ([#16691](https://github.com/mastra-ai/mastra/pull/16691))
8
+
9
+ - Fixed goal pursuit timers so they only count active work and stay paused while waiting for user input. ([#16690](https://github.com/mastra-ai/mastra/pull/16690))
10
+
11
+ - Updated dependencies [[`5556cc1`](https://github.com/mastra-ai/mastra/commit/5556cc1befec71518d84f826b3bfe3a079a9daf7), [`5499303`](https://github.com/mastra-ai/mastra/commit/54993032c1ebc09642625b78d2014e0cf84a3cae), [`e47bca7`](https://github.com/mastra-ai/mastra/commit/e47bca7b72866d3abd173b9f530ac4318113a8ff), [`0031d0f`](https://github.com/mastra-ai/mastra/commit/0031d0f13831d7843ac5d498734a7d92862e2ce3), [`3498b49`](https://github.com/mastra-ai/mastra/commit/3498b4946be94f4313cd817733589680dcda5278), [`359439b`](https://github.com/mastra-ai/mastra/commit/359439bb8c635e048176306828195f8297f50021), [`3552b1c`](https://github.com/mastra-ai/mastra/commit/3552b1c872988885f1c33d97122323567e2aff8e)]:
12
+ - @mastra/core@1.36.0-alpha.3
13
+ - @mastra/duckdb@1.4.0-alpha.0
14
+ - @mastra/observability@1.13.0-alpha.1
15
+
3
16
  ## 0.20.0-alpha.4
4
17
 
5
18
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/agents/workspace.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAkHlF,eAAO,MAAM,UAAU,UAOtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAa,CAAC;AA6B5C,wBAAgB,mBAAmB,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE;IAAE,cAAc,EAAE,cAAc,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,uDAgElH"}
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/agents/workspace.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAgDlF,eAAO,MAAM,UAAU,UAOtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAa,CAAC;AA6B5C,wBAAgB,mBAAmB,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE;IAAE,cAAc,EAAE,cAAc,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,uDAgElH"}
@@ -998,7 +998,7 @@ function getInstallCommand(pm, version) {
998
998
  }
999
999
  function getCurrentVersion() {
1000
1000
  {
1001
- return "0.20.0-alpha.4";
1001
+ return "0.20.0-alpha.5";
1002
1002
  }
1003
1003
  }
1004
1004
  async function fetchLatestVersion() {
@@ -1427,6 +1427,7 @@ var GoalManager = class {
1427
1427
  * Set a new goal objective. Resets turn counter.
1428
1428
  */
1429
1429
  setGoal(objective, judgeModelId, maxTurns = DEFAULT_MAX_TURNS) {
1430
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1430
1431
  this.goal = {
1431
1432
  id: randomUUID(),
1432
1433
  objective,
@@ -1434,7 +1435,9 @@ var GoalManager = class {
1434
1435
  turnsUsed: 0,
1435
1436
  maxTurns,
1436
1437
  judgeModelId,
1437
- startedAt: (/* @__PURE__ */ new Date()).toISOString()
1438
+ startedAt: now,
1439
+ activeStartedAt: now,
1440
+ activeDurationMs: 0
1438
1441
  };
1439
1442
  return this.goal;
1440
1443
  }
@@ -1444,7 +1447,13 @@ var GoalManager = class {
1444
1447
  loadFromThreadMetadata(metadata) {
1445
1448
  const saved = metadata?.[THREAD_GOAL_KEY];
1446
1449
  if (saved && saved.objective && saved.status) {
1447
- this.goal = { ...saved, id: saved.id ?? randomUUID(), startedAt: saved.startedAt ?? (/* @__PURE__ */ new Date()).toISOString() };
1450
+ this.goal = {
1451
+ ...saved,
1452
+ id: saved.id ?? randomUUID(),
1453
+ startedAt: saved.startedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
1454
+ activeStartedAt: void 0,
1455
+ activeDurationMs: saved.activeDurationMs ?? 0
1456
+ };
1448
1457
  } else {
1449
1458
  this.goal = null;
1450
1459
  }
@@ -1465,6 +1474,7 @@ var GoalManager = class {
1465
1474
  }
1466
1475
  pause() {
1467
1476
  if (this.goal && this.goal.status === "active") {
1477
+ this.stopActiveTimer();
1468
1478
  this.goal.status = "paused";
1469
1479
  }
1470
1480
  return this.goal;
@@ -1472,9 +1482,23 @@ var GoalManager = class {
1472
1482
  resume() {
1473
1483
  if (this.goal && this.goal.status === "paused") {
1474
1484
  this.goal.status = "active";
1485
+ this.startActiveTimer();
1475
1486
  }
1476
1487
  return this.goal;
1477
1488
  }
1489
+ startActiveTimer() {
1490
+ if (this.goal?.status === "active" && !this.goal.activeStartedAt) {
1491
+ this.goal.activeStartedAt = (/* @__PURE__ */ new Date()).toISOString();
1492
+ }
1493
+ }
1494
+ stopActiveTimer() {
1495
+ if (!this.goal?.activeStartedAt) return;
1496
+ const activeStartedMs = Date.parse(this.goal.activeStartedAt);
1497
+ if (Number.isFinite(activeStartedMs)) {
1498
+ this.goal.activeDurationMs = (this.goal.activeDurationMs ?? 0) + Math.max(0, Date.now() - activeStartedMs);
1499
+ }
1500
+ this.goal.activeStartedAt = void 0;
1501
+ }
1478
1502
  updateJudgeDefaults(judgeModelId, maxTurns) {
1479
1503
  if (this.goal) {
1480
1504
  this.goal.judgeModelId = judgeModelId;
@@ -1488,6 +1512,7 @@ var GoalManager = class {
1488
1512
  }
1489
1513
  markDone() {
1490
1514
  if (this.goal) {
1515
+ this.stopActiveTimer();
1491
1516
  this.goal.status = "done";
1492
1517
  }
1493
1518
  }
@@ -1506,6 +1531,7 @@ var GoalManager = class {
1506
1531
  }
1507
1532
  if (!context.lastAssistantContent) {
1508
1533
  if (this.goal.turnsUsed >= this.goal.maxTurns) {
1534
+ this.stopActiveTimer();
1509
1535
  this.goal.status = "paused";
1510
1536
  await this.saveToThread(state);
1511
1537
  return { continuation: null, judgeResult: null };
@@ -1529,24 +1555,29 @@ var GoalManager = class {
1529
1555
  this.goal.turnsUsed++;
1530
1556
  }
1531
1557
  if (result.decision === "paused") {
1558
+ this.stopActiveTimer();
1532
1559
  this.goal.status = "paused";
1533
1560
  await this.saveToThread(state);
1534
1561
  return { continuation: null, judgeResult: result };
1535
1562
  }
1536
1563
  if (result.decision === "done") {
1564
+ this.stopActiveTimer();
1537
1565
  this.goal.status = "done";
1538
1566
  await this.saveToThread(state);
1539
1567
  return { continuation: null, judgeResult: result };
1540
1568
  }
1541
1569
  if (result.decision === "waiting") {
1570
+ this.stopActiveTimer();
1542
1571
  await this.saveToThread(state);
1543
1572
  return { continuation: null, judgeResult: result };
1544
1573
  }
1545
1574
  if (this.goal.turnsUsed >= this.goal.maxTurns) {
1575
+ this.stopActiveTimer();
1546
1576
  this.goal.status = "paused";
1547
1577
  await this.saveToThread(state);
1548
1578
  return { continuation: null, judgeResult: result };
1549
1579
  }
1580
+ this.startActiveTimer();
1550
1581
  await this.saveToThread(state);
1551
1582
  return { continuation: this.buildContinuationPrompt(result.reason), judgeResult: result };
1552
1583
  }
@@ -2152,6 +2183,10 @@ async function startGoal(ctx, objective, judgeModelId, maxTurns, options = {}) {
2152
2183
  }
2153
2184
  const shouldPersistToCreatedThread = !state.harness.getCurrentThreadId();
2154
2185
  const goal = goalManager.setGoal(objective, judgeModelId, maxTurns);
2186
+ if (options.trigger === "none") {
2187
+ goal.activeStartedAt = void 0;
2188
+ goal.activeDurationMs = 0;
2189
+ }
2155
2190
  if (shouldPersistToCreatedThread) {
2156
2191
  goalManager.persistOnNextThreadCreate();
2157
2192
  }
@@ -4987,10 +5022,11 @@ function isGenericTitle(title) {
4987
5022
  const lower = title.toLowerCase().trim();
4988
5023
  return lower === "new thread" || lower.startsWith("new thread") || lower.startsWith("clone of") || lower.startsWith("untitled");
4989
5024
  }
4990
- function formatGoalDuration(startedAt) {
4991
- const startedMs = Date.parse(startedAt);
4992
- if (!Number.isFinite(startedMs)) return "<1m";
4993
- const elapsedMinutes = Math.floor(Math.max(0, Date.now() - startedMs) / 6e4);
5025
+ function formatGoalDuration(goal) {
5026
+ const activeStartedAt = goal.activeStartedAt ?? (goal.activeDurationMs === void 0 ? goal.startedAt : void 0);
5027
+ const startedMs = activeStartedAt ? Date.parse(activeStartedAt) : NaN;
5028
+ const activeRunMs = Number.isFinite(startedMs) ? Math.max(0, Date.now() - startedMs) : 0;
5029
+ const elapsedMinutes = Math.floor(((goal.activeDurationMs ?? 0) + activeRunMs) / 6e4);
4994
5030
  if (elapsedMinutes < 1) return "<1m";
4995
5031
  const days = Math.floor(elapsedMinutes / 1440);
4996
5032
  const hours = Math.floor(elapsedMinutes % 1440 / 60);
@@ -5066,7 +5102,7 @@ function updateStatusLine(state) {
5066
5102
  const queuedCount = state.pendingQueuedActions.length + state.harness.getFollowUpCount();
5067
5103
  const queuedLabel = queuedCount > 0 ? `${queuedCount} queued` : null;
5068
5104
  const goalState = state.goalManager?.getGoal();
5069
- const goalDuration = goalState?.status === "active" ? formatGoalDuration(goalState.startedAt) : null;
5105
+ const goalDuration = goalState?.status === "active" ? formatGoalDuration(goalState) : null;
5070
5106
  const goalLabel = goalDuration ? `pursuing goal (${goalDuration})` : null;
5071
5107
  const shortGoalLabel = goalDuration ? `goal (${goalDuration})` : null;
5072
5108
  const dirFull = !threadTitle && branch ? `${displayPath} (${branch})` : displayPath;
@@ -12596,6 +12632,7 @@ function unescapeSystemReminderText(text) {
12596
12632
  // src/tui/handlers/agent-lifecycle.ts
12597
12633
  function handleAgentStart(ctx) {
12598
12634
  const { state } = ctx;
12635
+ state.goalManager.startActiveTimer();
12599
12636
  const freshBranch = getCurrentGitBranch(state.projectInfo.rootPath);
12600
12637
  if (freshBranch) {
12601
12638
  state.projectInfo.gitBranch = freshBranch;
@@ -12675,6 +12712,7 @@ function drainQueuedAction(ctx) {
12675
12712
  }
12676
12713
  function handleAgentAborted(ctx) {
12677
12714
  const { state } = ctx;
12715
+ state.goalManager.stopActiveTimer();
12678
12716
  if (state.gradientAnimator) {
12679
12717
  state.gradientAnimator.fadeOut();
12680
12718
  }
@@ -12703,6 +12741,7 @@ function handleAgentAborted(ctx) {
12703
12741
  }
12704
12742
  function handleAgentError(ctx) {
12705
12743
  const { state } = ctx;
12744
+ state.goalManager.stopActiveTimer();
12706
12745
  if (state.gradientAnimator) {
12707
12746
  state.gradientAnimator.fadeOut();
12708
12747
  }
@@ -16011,5 +16050,5 @@ Would you like to update now?`;
16011
16050
  };
16012
16051
 
16013
16052
  export { AssistantMessageComponent, LoginDialogComponent, LoginSelectorComponent, MastraTUI, ModelSelectorComponent, OMProgressComponent, ToolExecutionComponentEnhanced, UserMessageComponent, createTUIState, detectTerminalTheme, formatOMStatus, getCurrentVersion };
16014
- //# sourceMappingURL=chunk-KYBJFVCW.js.map
16015
- //# sourceMappingURL=chunk-KYBJFVCW.js.map
16053
+ //# sourceMappingURL=chunk-DRUKVGKO.js.map
16054
+ //# sourceMappingURL=chunk-DRUKVGKO.js.map