mastracode 0.10.0-alpha.7 → 0.10.0-alpha.8

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,16 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.10.0-alpha.8
4
+
5
+ ### Minor Changes
6
+
7
+ - Added a "Custom response..." option to questions with predefined choices. When selected, it switches to a free-text input so you can type an answer not covered by the given options. ([#14845](https://github.com/mastra-ai/mastra/pull/14845))
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`12c647c`](https://github.com/mastra-ai/mastra/commit/12c647cf3a26826eb72d40b42e3c8356ceae16ed), [`819f03c`](https://github.com/mastra-ai/mastra/commit/819f03c25823373b32476413bd76be28a5d8705a)]:
12
+ - @mastra/core@1.18.0-alpha.5
13
+
3
14
  ## 0.10.0-alpha.7
4
15
 
5
16
  ### Patch Changes
@@ -304,19 +304,34 @@ var AskQuestionInlineComponent = class _AskQuestionInlineComponent extends piTui
304
304
  }
305
305
  this.borderedBox.setInteractive(this.selectList, this.input, hintText);
306
306
  }
307
+ static CUSTOM_RESPONSE_VALUE = "__custom_response__";
307
308
  buildSelectMode(opts) {
308
309
  const items = opts.map((opt) => ({
309
310
  value: opt.label,
310
311
  label: opt.description ? ` ${opt.label} ${chunkGE6PEBOR_cjs.theme.fg("dim", opt.description)}` : ` ${opt.label}`
311
312
  }));
313
+ items.push({
314
+ value: _AskQuestionInlineComponent.CUSTOM_RESPONSE_VALUE,
315
+ label: ` ${chunkGE6PEBOR_cjs.theme.fg("dim", "\u270E Custom response...")}`
316
+ });
312
317
  this.selectList = new piTui.SelectList(items, Math.min(items.length, 8), chunkGE6PEBOR_cjs.getSelectListTheme());
313
318
  this.selectList.onSelect = (item) => {
319
+ if (item.value === _AskQuestionInlineComponent.CUSTOM_RESPONSE_VALUE) {
320
+ this.switchToCustomInput();
321
+ return;
322
+ }
314
323
  this.handleAnswer(item.value);
315
324
  };
316
325
  this.selectList.onCancel = () => {
317
326
  this.handleCancel();
318
327
  };
319
328
  }
329
+ switchToCustomInput() {
330
+ this.selectList = void 0;
331
+ this.buildInputMode();
332
+ this.borderedBox.items = [];
333
+ this.borderedBox.setInteractive(void 0, this.input, "Enter to submit \xB7 Esc to skip");
334
+ }
320
335
  buildInputMode() {
321
336
  this.input = new piTui.Input();
322
337
  this.input.onSubmit = (value) => {
@@ -889,7 +904,7 @@ function getInstallCommand(pm, version) {
889
904
  }
890
905
  function getCurrentVersion() {
891
906
  {
892
- return "0.10.0-alpha.7";
907
+ return "0.10.0-alpha.8";
893
908
  }
894
909
  }
895
910
  async function fetchLatestVersion() {
@@ -8819,11 +8834,14 @@ ${plan}
8819
8834
  `;
8820
8835
  await fs4__default.default.writeFile(path5__namespace.default.join(dir, filename), content, "utf-8");
8821
8836
  }
8822
- var AskQuestionDialogComponent = class extends piTui.Box {
8837
+ var AskQuestionDialogComponent = class _AskQuestionDialogComponent extends piTui.Box {
8838
+ static CUSTOM_RESPONSE_VALUE = "__custom_response__";
8823
8839
  selectList;
8824
8840
  input;
8825
8841
  onSubmit;
8826
8842
  onCancel;
8843
+ /** Children added by buildSelectMode/buildInputMode, tracked for removal on mode switch */
8844
+ modeChildren = [];
8827
8845
  _focused = false;
8828
8846
  get focused() {
8829
8847
  return this._focused;
@@ -8853,14 +8871,29 @@ var AskQuestionDialogComponent = class extends piTui.Box {
8853
8871
  value: opt.label,
8854
8872
  label: opt.description ? ` ${opt.label} ${chunkGE6PEBOR_cjs.theme.fg("dim", opt.description)}` : ` ${opt.label}`
8855
8873
  }));
8874
+ items.push({
8875
+ value: _AskQuestionDialogComponent.CUSTOM_RESPONSE_VALUE,
8876
+ label: ` ${chunkGE6PEBOR_cjs.theme.fg("dim", "\u270E Custom response...")}`
8877
+ });
8856
8878
  this.selectList = new piTui.SelectList(items, Math.min(items.length, 8), chunkGE6PEBOR_cjs.getSelectListTheme());
8857
8879
  this.selectList.onSelect = (item) => {
8880
+ if (item.value === _AskQuestionDialogComponent.CUSTOM_RESPONSE_VALUE) {
8881
+ this.switchToCustomInput();
8882
+ return;
8883
+ }
8858
8884
  this.onSubmit(item.value);
8859
8885
  };
8860
8886
  this.selectList.onCancel = this.onCancel;
8861
- this.addChild(this.selectList);
8862
- this.addChild(new piTui.Spacer(1));
8863
- this.addChild(new piTui.Text(chunkGE6PEBOR_cjs.theme.fg("dim", " \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to skip"), 0, 0));
8887
+ this.modeChildren = [];
8888
+ const selectChild = this.selectList;
8889
+ this.addChild(selectChild);
8890
+ this.modeChildren.push(selectChild);
8891
+ const spacer = new piTui.Spacer(1);
8892
+ this.addChild(spacer);
8893
+ this.modeChildren.push(spacer);
8894
+ const hint = new piTui.Text(chunkGE6PEBOR_cjs.theme.fg("dim", " \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to skip"), 0, 0);
8895
+ this.addChild(hint);
8896
+ this.modeChildren.push(hint);
8864
8897
  }
8865
8898
  buildInputMode() {
8866
8899
  this.input = new piTui.Input();
@@ -8870,9 +8903,24 @@ var AskQuestionDialogComponent = class extends piTui.Box {
8870
8903
  this.onSubmit(trimmed);
8871
8904
  }
8872
8905
  };
8873
- this.addChild(this.input);
8874
- this.addChild(new piTui.Spacer(1));
8875
- this.addChild(new piTui.Text(chunkGE6PEBOR_cjs.theme.fg("dim", " Enter to submit \xB7 Esc to skip"), 0, 0));
8906
+ this.modeChildren = [];
8907
+ const inputChild = this.input;
8908
+ this.addChild(inputChild);
8909
+ this.modeChildren.push(inputChild);
8910
+ const spacer = new piTui.Spacer(1);
8911
+ this.addChild(spacer);
8912
+ this.modeChildren.push(spacer);
8913
+ const hint = new piTui.Text(chunkGE6PEBOR_cjs.theme.fg("dim", " Enter to submit \xB7 Esc to skip"), 0, 0);
8914
+ this.addChild(hint);
8915
+ this.modeChildren.push(hint);
8916
+ }
8917
+ switchToCustomInput() {
8918
+ for (const child of this.modeChildren) {
8919
+ this.removeChild(child);
8920
+ }
8921
+ this.selectList = void 0;
8922
+ this.buildInputMode();
8923
+ if (this.input) this.input.focused = this._focused;
8876
8924
  }
8877
8925
  handleInput(data) {
8878
8926
  if (this.selectList) {
@@ -12597,5 +12645,5 @@ exports.createTUIState = createTUIState;
12597
12645
  exports.detectTerminalTheme = detectTerminalTheme;
12598
12646
  exports.formatOMStatus = formatOMStatus;
12599
12647
  exports.getCurrentVersion = getCurrentVersion;
12600
- //# sourceMappingURL=chunk-IMN65LLI.cjs.map
12601
- //# sourceMappingURL=chunk-IMN65LLI.cjs.map
12648
+ //# sourceMappingURL=chunk-AOZDIBVE.cjs.map
12649
+ //# sourceMappingURL=chunk-AOZDIBVE.cjs.map