kronk-cli 0.1.2 → 0.2.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/src/ui.js CHANGED
@@ -52,12 +52,13 @@ export function fmtUsage(u, window) {
52
52
  * attached, and how full the window is. Rendered fresh before every prompt so
53
53
  * it always reflects the current state rather than the state at startup.
54
54
  */
55
- export function statusLine({ model, auto, yes, noThink, mcp, steps, used, window }) {
55
+ export function statusLine({ model, auto, yes, noThink, noPreserve, mcp, steps, used, window }) {
56
56
  const bits = [];
57
57
  bits.push(c.grey(model.split('/').pop()));
58
58
  if (auto) bits.push(c.magenta('auto'));
59
59
  else if (yes) bits.push(c.yellow('yes'));
60
60
  if (noThink) bits.push(c.grey('no-think'));
61
+ if (noPreserve) bits.push(c.grey('no-preserve'));
61
62
  if (mcp) bits.push(c.cyan(`mcp ${mcp}`));
62
63
  if (Number.isFinite(steps)) bits.push(c.grey(`steps ${steps}`));
63
64
  const ctx = fmtContext(used, window);
@@ -105,6 +106,32 @@ export function liveLine() {
105
106
  };
106
107
  }
107
108
 
109
+ /**
110
+ * Render a failed tool result for the screen: the first line whole (however
111
+ * long), the rest indented four spaces and capped, so one runaway command
112
+ * cannot scroll the actionable part — the `stderr:` block — off the top of
113
+ * the terminal. Pure: `src/agent.js` prints whatever comes back. The model's
114
+ * own copy in `messages` is never touched; only the screen is bounded.
115
+ */
116
+ export function toolResultLines(result, { maxLines = 20, maxWidth = 200 } = {}) {
117
+ const [first, ...rest] = result.split('\n');
118
+ const lines = [c.red(` ✗ ${first}`)];
119
+
120
+ const shown = rest.slice(0, maxLines);
121
+ for (const line of shown) {
122
+ const body = line.length > maxWidth ? `${line.slice(0, maxWidth)}…` : line;
123
+ lines.push(c.grey(` ${body}`));
124
+ }
125
+
126
+ const hidden = rest.length - shown.length;
127
+ if (hidden > 0) {
128
+ const noun = hidden === 1 ? 'line' : 'lines';
129
+ lines.push(c.grey(` …${hidden} more ${noun} (the model received all of it)`));
130
+ }
131
+
132
+ return lines;
133
+ }
134
+
108
135
  /** A one-line spinner that does not fight with streamed output. */
109
136
  export function spinner(label) {
110
137
  if (!process.stdout.isTTY) return { stop() {} };