min-agent 0.2.1 → 0.3.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.
Files changed (81) hide show
  1. package/README.md +146 -18
  2. package/dist/agent.js +293 -408
  3. package/dist/assistant-stream.js +11 -7
  4. package/dist/cli.js +397 -139
  5. package/dist/clipboard.js +59 -23
  6. package/dist/code-mode.js +3 -3
  7. package/dist/compaction.js +182 -81
  8. package/dist/config.js +186 -35
  9. package/dist/confirm.js +55 -6
  10. package/dist/context-window.js +67 -54
  11. package/dist/doom-loop.js +19 -12
  12. package/dist/http.js +119 -0
  13. package/dist/instructions.js +51 -33
  14. package/dist/logger.js +66 -0
  15. package/dist/markdown.js +3 -44
  16. package/dist/mcp.js +547 -100
  17. package/dist/memory.js +48 -6
  18. package/dist/output.js +36 -27
  19. package/dist/paste-handler.js +3 -3
  20. package/dist/plugins.js +33 -6
  21. package/dist/pricing.js +119 -0
  22. package/dist/provider.js +17 -15
  23. package/dist/serve.js +658 -369
  24. package/dist/sessions.js +151 -13
  25. package/dist/skills.js +466 -76
  26. package/dist/synthetic.js +7 -0
  27. package/dist/title-gen.js +2 -1
  28. package/dist/tool-display.js +173 -0
  29. package/dist/tool-output.js +54 -45
  30. package/dist/tools/apply_patch.js +191 -0
  31. package/dist/tools/backend.js +61 -0
  32. package/dist/tools/bash.js +147 -70
  33. package/dist/tools/code_search.js +6 -5
  34. package/dist/tools/edit.js +23 -7
  35. package/dist/tools/explore.js +80 -12
  36. package/dist/tools/glob.js +3 -3
  37. package/dist/tools/grep.js +146 -14
  38. package/dist/tools/index.js +7 -7
  39. package/dist/tools/question.js +4 -22
  40. package/dist/tools/read.js +71 -11
  41. package/dist/tools/task.js +33 -20
  42. package/dist/tools/todo.js +83 -73
  43. package/dist/tools/web_fetch.js +150 -46
  44. package/dist/tools/web_search.js +706 -28
  45. package/dist/tools/write.js +13 -7
  46. package/dist/tui/App.js +40 -6
  47. package/dist/tui/ConfirmBar.js +24 -3
  48. package/dist/tui/InputBar.js +390 -45
  49. package/dist/tui/MessageList.js +533 -20
  50. package/dist/tui/ModelPicker.js +108 -0
  51. package/dist/tui/QuestionBar.js +104 -0
  52. package/dist/tui/StatusBar.js +19 -11
  53. package/dist/tui/agent-runner.js +103 -0
  54. package/dist/tui/caret-pos.js +134 -0
  55. package/dist/tui/caret.js +69 -0
  56. package/dist/tui/diff-view.js +61 -0
  57. package/dist/tui/drag-state.js +44 -0
  58. package/dist/tui/index.js +153 -24
  59. package/dist/tui/input-history.js +44 -0
  60. package/dist/tui/layout.js +17 -0
  61. package/dist/tui/mouse.js +46 -0
  62. package/dist/tui/selection.js +134 -0
  63. package/dist/tui/slash-commands.js +90 -0
  64. package/dist/tui/slash-handler.js +370 -0
  65. package/dist/tui/text-width.js +91 -0
  66. package/dist/tui/theme.js +12 -0
  67. package/dist/tui/undo-stack.js +14 -0
  68. package/dist/tui/use-sgr-mouse.js +27 -0
  69. package/dist/tui-chat.js +111 -331
  70. package/dist/updater.js +57 -0
  71. package/docs/API.md +160 -14
  72. package/docs/superpowers/plans/2026-08-16-batch1-tui-improvements.md +1510 -0
  73. package/docs/superpowers/plans/2026-08-16-batch2-cli-tools-api.md +2105 -0
  74. package/docs/superpowers/plans/2026-08-16-batch3-config-engineering.md +1595 -0
  75. package/docs/superpowers/plans/2026-08-16-input-caret.md +782 -0
  76. package/docs/superpowers/specs/2026-08-16-batch1-tui-improvements-design.md +183 -0
  77. package/docs/superpowers/specs/2026-08-16-batch2-cli-tools-api-design.md +220 -0
  78. package/docs/superpowers/specs/2026-08-16-batch3-config-engineering-design.md +196 -0
  79. package/docs/superpowers/specs/2026-08-16-input-caret-design.md +63 -0
  80. package/docs/superpowers/specs/2026-08-17-mouse-selection-design.md +116 -0
  81. package/package.json +7 -8
@@ -11,6 +11,12 @@ const THINKING_BLOCKS = [
11
11
  ];
12
12
  /** Max tail to keep when looking for a partial opening tag. */
13
13
  const PARTIAL_TAG_HOLD = 72;
14
+ /**
15
+ * If an opening tag never gets closed (truncated / misbehaving model), the
16
+ * buffer would grow without bound. Beyond this size, treat the remainder as
17
+ * thinking text and move on.
18
+ */
19
+ const UNCLOSED_THINK_MAX = 16 * 1024;
14
20
  function lower(s) {
15
21
  return s.toLowerCase();
16
22
  }
@@ -71,10 +77,6 @@ export class ThinkingBodySplitter {
71
77
  this.buf = this.buf.slice(open.index);
72
78
  }
73
79
  const low = lower(this.buf);
74
- if (!low.startsWith(open.tag.open)) {
75
- this.buf = this.buf.slice(1);
76
- continue;
77
- }
78
80
  const afterOpen = open.tag.open.length;
79
81
  const closeRel = low.indexOf(open.tag.close, afterOpen);
80
82
  if (closeRel < 0) {
@@ -82,6 +84,11 @@ export class ThinkingBodySplitter {
82
84
  thinking += this.buf.slice(afterOpen);
83
85
  this.buf = "";
84
86
  }
87
+ else if (this.buf.length - afterOpen > UNCLOSED_THINK_MAX) {
88
+ thinking += this.buf.slice(afterOpen);
89
+ this.buf = "";
90
+ hadThinking = true;
91
+ }
85
92
  break;
86
93
  }
87
94
  const inner = this.buf.slice(afterOpen, closeRel);
@@ -90,9 +97,6 @@ export class ThinkingBodySplitter {
90
97
  this.buf = this.buf.slice(closeRel + open.tag.close.length);
91
98
  }
92
99
  // Strip leading newlines from display that follow a thinking block
93
- if (hadThinking && display.length === 0 && this.buf.startsWith("\n")) {
94
- // Will be handled on next feed
95
- }
96
100
  if (hadThinking) {
97
101
  display = display.replace(/^\n+/, "");
98
102
  }