mastracode 0.18.0-alpha.6 → 0.18.0-alpha.7

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,13 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.18.0-alpha.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`a68d854`](https://github.com/mastra-ai/mastra/commit/a68d854bf3d042bef7d5e2f6b7d35e311673888b), [`00ef282`](https://github.com/mastra-ai/mastra/commit/00ef2826034d006b984b3f19cd33ba0bba14d6c6)]:
8
+ - @mastra/duckdb@1.3.1-alpha.0
9
+ - @mastra/observability@1.12.0-alpha.0
10
+
3
11
  ## 0.18.0-alpha.6
4
12
 
5
13
  ### Minor Changes
@@ -1025,7 +1025,7 @@ function getInstallCommand(pm, version) {
1025
1025
  }
1026
1026
  function getCurrentVersion() {
1027
1027
  {
1028
- return "0.18.0-alpha.6";
1028
+ return "0.18.0-alpha.7";
1029
1029
  }
1030
1030
  }
1031
1031
  async function fetchLatestVersion() {
@@ -1432,9 +1432,6 @@ var judgeSchema = zod.z.object({
1432
1432
  ),
1433
1433
  reason: zod.z.string().describe("Brief explanation of what was accomplished or what remains to be done")
1434
1434
  });
1435
- var questionAnswerSchema = zod.z.object({
1436
- answer: zod.z.string().describe("The answer to give the assistant. If choices are provided, use exactly one choice label.")
1437
- });
1438
1435
  var GoalManager = class {
1439
1436
  goal = null;
1440
1437
  persistGoalOnNextThreadCreate = false;
@@ -1523,13 +1520,6 @@ var GoalManager = class {
1523
1520
  * Called after each agent turn completes. Evaluates whether to continue.
1524
1521
  * Returns a GoalEvaluationResult with continuation prompt and judge result.
1525
1522
  */
1526
- async answerQuestion(state, question, options) {
1527
- if (!this.goal || this.goal.status !== "active") {
1528
- return "(skipped)";
1529
- }
1530
- const result = await this.callJudgeForQuestion(state, question, options);
1531
- return result.answer;
1532
- }
1533
1523
  async evaluateAfterTurn(state) {
1534
1524
  if (!this.goal || this.goal.status !== "active") {
1535
1525
  return { continuation: null, judgeResult: null };
@@ -1613,48 +1603,6 @@ var GoalManager = class {
1613
1603
  }
1614
1604
  return String(content ?? "");
1615
1605
  }
1616
- async callJudgeForQuestion(state, question, options) {
1617
- try {
1618
- const memory = await this.getJudgeMemory(state);
1619
- const judgeAgent = this.createJudgeAgent(memory);
1620
- if (!judgeAgent) {
1621
- return { answer: "(judge could not answer: Judge model could not be initialized.)" };
1622
- }
1623
- const optionLabels = options?.map((option) => option.label) ?? [];
1624
- const optionsText = optionLabels.length ? `
1625
-
1626
- Available answers (choose exactly one label):
1627
- ${options.map((option) => `- ${option.label}${option.description ? `: ${option.description}` : ""}`).join("\n")}` : "";
1628
- const answerSchema = optionLabels.length ? zod.z.object({
1629
- answer: zod.z.enum(optionLabels).describe("Exactly one label from the available answers.")
1630
- }) : questionAnswerSchema;
1631
- const stream = await judgeAgent.stream(
1632
- `Goal: ${this.goal.objective}
1633
-
1634
- The assistant asked a question while goal mode is active. Answer it as the goal judge so the assistant can continue without waiting for the human user. If the question asks for verification, verify it yourself unless the goal explicitly requires human/user verification.
1635
-
1636
- Question:
1637
- ${question}${optionsText}`,
1638
- {
1639
- ...memory ? { memory: { thread: this.getJudgeThreadId(state), resource: state.harness.getResourceId() } } : {},
1640
- structuredOutput: {
1641
- schema: answerSchema
1642
- }
1643
- }
1644
- );
1645
- await stream.consumeStream();
1646
- const output = (await stream.getFullOutput()).object;
1647
- if (!output?.answer) {
1648
- return { answer: "(judge could not answer: no structured answer returned.)" };
1649
- }
1650
- if (optionLabels.length && !optionLabels.includes(output.answer)) {
1651
- return { answer: `(judge could not answer: returned "${output.answer}" outside available answers.)` };
1652
- }
1653
- return { answer: output.answer };
1654
- } catch (error) {
1655
- return { answer: `(judge could not answer: ${formatError(error)})` };
1656
- }
1657
- }
1658
1606
  async callJudge(state, context) {
1659
1607
  try {
1660
1608
  const memory = await this.getJudgeMemory(state);
@@ -8720,12 +8668,6 @@ function handleAgentAborted(ctx) {
8720
8668
  if (state.gradientAnimator) {
8721
8669
  state.gradientAnimator.fadeOut();
8722
8670
  }
8723
- if (state.userInitiatedAbort && state.goalManager.isActive()) {
8724
- state.goalManager.pause();
8725
- state.goalManager.saveToThread(state).catch(() => {
8726
- });
8727
- showInfo(state, "Goal paused (interrupted). Use /goal resume to continue.");
8728
- }
8729
8671
  if (state.streamingComponent && state.streamingMessage) {
8730
8672
  state.streamingMessage.stopReason = "aborted";
8731
8673
  state.streamingMessage.errorMessage = "Interrupted";
@@ -12512,40 +12454,6 @@ function processNextInlineQuestion(state) {
12512
12454
  }
12513
12455
  async function handleAskQuestion(ctx, questionId, question, options) {
12514
12456
  const { state } = ctx;
12515
- const activeGoal = state.goalManager?.getGoal();
12516
- if (activeGoal?.status === "active") {
12517
- state.activeGoalJudge = { modelId: activeGoal.judgeModelId };
12518
- state.gradientAnimator?.start();
12519
- ctx.updateStatusLine();
12520
- try {
12521
- const answer = await state.goalManager.answerQuestion(state, question, options);
12522
- const questionComponent = new AskQuestionInlineComponent(
12523
- {
12524
- question,
12525
- options,
12526
- multiline: true,
12527
- onSubmit: () => {
12528
- },
12529
- onCancel: () => {
12530
- }
12531
- },
12532
- state.ui
12533
- );
12534
- questionComponent.answer(Array.isArray(answer) ? answer.join(", ") : answer);
12535
- ctx.addChildBeforeFollowUps(questionComponent);
12536
- state.streamingComponent = new AssistantMessageComponent(void 0, state.hideThinkingBlock, chunkH3UXL3U6_cjs.getMarkdownTheme());
12537
- ctx.addChildBeforeFollowUps(state.streamingComponent);
12538
- state.ui.requestRender();
12539
- state.harness.respondToQuestion({ questionId, answer });
12540
- } finally {
12541
- state.activeGoalJudge = void 0;
12542
- if (!state.harness.getDisplayState().isRunning) {
12543
- state.gradientAnimator?.stop();
12544
- }
12545
- ctx.updateStatusLine();
12546
- }
12547
- return;
12548
- }
12549
12457
  return new Promise((resolve3) => {
12550
12458
  if (state.options.inlineQuestions) {
12551
12459
  const askUserComponent = state.lastAskUserComponent;
@@ -13287,11 +13195,6 @@ function setupKeyboardShortcuts(state, callbacks) {
13287
13195
  if (current.length > 0) {
13288
13196
  state.lastClearedText = current;
13289
13197
  state.editor.setText("");
13290
- } else if (state.goalManager.isActive()) {
13291
- state.goalManager.pause();
13292
- state.goalManager.saveToThread(state).catch(() => {
13293
- });
13294
- showInfo(state, "Goal paused (interrupted). Use /goal resume to continue.");
13295
13198
  }
13296
13199
  state.ui.requestRender();
13297
13200
  }
@@ -14188,8 +14091,13 @@ var CustomEditor = class extends piTui.Editor {
14188
14091
  const handler = this.actionHandlers.get("followUp");
14189
14092
  if (handler) {
14190
14093
  if (this.isShowingAutocomplete()) {
14094
+ const wasSlashCommand = this.getText().trimStart().startsWith("/");
14191
14095
  super.handleInput(" ");
14192
- if (this.getText().trimStart().startsWith("/") && handler() !== false) {
14096
+ const completedText = this.getText();
14097
+ if (wasSlashCommand && !completedText.trimStart().startsWith("/")) {
14098
+ this.setText(`/${completedText.trimStart()}`);
14099
+ }
14100
+ if (wasSlashCommand && handler() !== false) {
14193
14101
  return;
14194
14102
  }
14195
14103
  return;
@@ -15163,5 +15071,5 @@ exports.createTUIState = createTUIState;
15163
15071
  exports.detectTerminalTheme = detectTerminalTheme;
15164
15072
  exports.formatOMStatus = formatOMStatus;
15165
15073
  exports.getCurrentVersion = getCurrentVersion;
15166
- //# sourceMappingURL=chunk-NPRL34D6.cjs.map
15167
- //# sourceMappingURL=chunk-NPRL34D6.cjs.map
15074
+ //# sourceMappingURL=chunk-P4Z7TFM3.cjs.map
15075
+ //# sourceMappingURL=chunk-P4Z7TFM3.cjs.map