@vincemakes/kiso-tui-cells 0.32.0 → 0.32.2

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/dist/render.d.ts CHANGED
@@ -176,6 +176,21 @@ export declare function foldThinking(block: string): string;
176
176
  * the line the pipe has always written, which is what keeps the two
177
177
  * renderings one shape rather than two. */
178
178
  export declare function foldThinkingRow(block: string, room: number): string;
179
+ /**
180
+ * DC-60 (0.32.2) — the words of a turn, whatever shape its content took.
181
+ *
182
+ * A turn that carries an image is an ARRAY of blocks (text, image, text…)
183
+ * in the durable log. Its echo — the user chip while the session runs, the
184
+ * transcript's replay, the session listing — must say the words and mark
185
+ * the image, and it must say them from ONE definition: the live echo used
186
+ * to pass a string through and an array became an empty chip, while the
187
+ * transcript path projected the array on its own. The image mark is
188
+ * "(image)"; the bytes are never shown.
189
+ */
190
+ export declare function echoText(content: string | readonly {
191
+ readonly type?: string;
192
+ readonly text?: string;
193
+ }[]): string;
179
194
  /** v2b — the [result] echo truncates at 160 chars + a /last hint. */
180
195
  export declare function foldResult(content: string): string;
181
196
  /**
@@ -194,6 +209,22 @@ export declare function renderToolSummary(name: string, input: Record<string, un
194
209
  * the summary detail uses, WITHOUT the counts (the header names what
195
210
  * was expanded, not its size). */
196
211
  export declare function toolTarget(name: string, input: Record<string, unknown>): string;
212
+ /**
213
+ * HF-1 (0.32.1) — a head row is ONE row, whatever the model wrote.
214
+ *
215
+ * The owner's 0.32.0 dogfood: the model issued a heredoc shell command
216
+ * (`python3 - <<'EOF' …`), the running card's head carried its newlines
217
+ * into the compositor, invariant ①b threw in the field and the process
218
+ * died. `escapeTerminal` keeps `\n` on purpose (text blocks need it); a
219
+ * HEAD ROW does not — it is one physical row by construction. So every
220
+ * builder that puts a tool's target on a row projects the breaks to a
221
+ * visible mark first: a line break becomes `⏎` (CRLF is one), a tab
222
+ * becomes one cell of space (its width is a property of the column, and
223
+ * a cut row has no column to give it). The full command is still on the
224
+ * approval panel and in the durable log; the row says what ran, in one
225
+ * row.
226
+ */
227
+ export declare function oneRow(text: string): string;
197
228
  /** k-units for the status line: 12345 → 12.3k, 800 → 800, null → ?. */
198
229
  export declare function kUnit(value: number | null): string;
199
230
  /**
package/dist/render.js CHANGED
@@ -142,6 +142,26 @@ export function foldThinkingRow(block, room) {
142
142
  : trimmed.slice(0, 100);
143
143
  return `${p.dim}…${head}${suffix}${p.reset}`;
144
144
  }
145
+ /**
146
+ * DC-60 (0.32.2) — the words of a turn, whatever shape its content took.
147
+ *
148
+ * A turn that carries an image is an ARRAY of blocks (text, image, text…)
149
+ * in the durable log. Its echo — the user chip while the session runs, the
150
+ * transcript's replay, the session listing — must say the words and mark
151
+ * the image, and it must say them from ONE definition: the live echo used
152
+ * to pass a string through and an array became an empty chip, while the
153
+ * transcript path projected the array on its own. The image mark is
154
+ * "(image)"; the bytes are never shown.
155
+ */
156
+ export function echoText(content) {
157
+ if (typeof content === "string")
158
+ return content;
159
+ return content
160
+ .map((b) => (b.type === "text" ? (b.text ?? "") : "(image)"))
161
+ .join(" ")
162
+ .replace(/ +/g, " ")
163
+ .trim();
164
+ }
145
165
  /** v2b — the [result] echo truncates at 160 chars + a /last hint. */
146
166
  export function foldResult(content) {
147
167
  const flat = content.replaceAll("\n", " ");
@@ -167,7 +187,7 @@ export function renderToolSummary(name, input, result, reason = null) {
167
187
  }
168
188
  const mark = result.isError ? `${p.red}✗${p.reset}` : `${p.bold}✓${p.reset}`;
169
189
  const shortName = name.replace("_file", "");
170
- const detail = toolSummaryDetail(name, input, result);
190
+ const detail = oneRow(toolSummaryDetail(name, input, result)); // HF-1: one row, whatever the command
171
191
  return `${mark} ${escapeTerminal(`${shortName} ${detail}`)}`;
172
192
  }
173
193
  function toolSummaryDetail(name, input, result) {
@@ -213,6 +233,27 @@ function toolSummaryDetail(name, input, result) {
213
233
  * the summary detail uses, WITHOUT the counts (the header names what
214
234
  * was expanded, not its size). */
215
235
  export function toolTarget(name, input) {
236
+ return oneRow(toolTargetRaw(name, input));
237
+ }
238
+ /**
239
+ * HF-1 (0.32.1) — a head row is ONE row, whatever the model wrote.
240
+ *
241
+ * The owner's 0.32.0 dogfood: the model issued a heredoc shell command
242
+ * (`python3 - <<'EOF' …`), the running card's head carried its newlines
243
+ * into the compositor, invariant ①b threw in the field and the process
244
+ * died. `escapeTerminal` keeps `\n` on purpose (text blocks need it); a
245
+ * HEAD ROW does not — it is one physical row by construction. So every
246
+ * builder that puts a tool's target on a row projects the breaks to a
247
+ * visible mark first: a line break becomes `⏎` (CRLF is one), a tab
248
+ * becomes one cell of space (its width is a property of the column, and
249
+ * a cut row has no column to give it). The full command is still on the
250
+ * approval panel and in the durable log; the row says what ran, in one
251
+ * row.
252
+ */
253
+ export function oneRow(text) {
254
+ return text.replace(/\r\n|\n|\r/g, "\u23ce").replace(/\t/g, " ");
255
+ }
256
+ function toolTargetRaw(name, input) {
216
257
  switch (name) {
217
258
  case "read_file":
218
259
  case "write_file":
package/dist/strings.js CHANGED
@@ -205,6 +205,12 @@ export const KEY_BINDINGS = [
205
205
  { keys: "alt+⌫ / alt+d", what: "delete word (ctrl+w too)" },
206
206
  { keys: "ctrl+x", what: "copy the last answer" },
207
207
  { keys: "ctrl+z / ctrl+y", what: "undo / redo" },
208
+ // REL-0152-D15/D16 — the image paste. It is on the sheet because a
209
+ // terminal's own Cmd+V only ever pastes TEXT: a human with an image on
210
+ // the clipboard has no way to discover this key by trying the obvious
211
+ // one, which is exactly the case the sheet exists for. It pairs with
212
+ // the undo row above and keeps the table's count even.
213
+ { keys: "ctrl+v", what: "attach a clipboard image" },
208
214
  ];
209
215
  /**
210
216
  * TUI2-R2pre ④ — THE display-verb table (the integrator's ruling).
@@ -294,7 +300,10 @@ const SHEET_GRID = [
294
300
  // exactly as its comment predicted it would.
295
301
  [10, 11],
296
302
  [12, 13],
297
- [14],
303
+ // ctrl+v joins the undo row's neighbour: the count is even again, so
304
+ // the last row pairs instead of standing alone. The warning three
305
+ // comments up applies unchanged — this grid does not update itself.
306
+ [14, 15],
298
307
  ];
299
308
  const SHEET_STOPS = [
300
309
  [16, 43],
@@ -310,10 +319,11 @@ const SHEET_STOPS = [
310
319
  // The stop is 39 here because `alt+⌫ / alt+d delete word (ctrl+w too)`
311
320
  // is the widest first cell on the sheet — a narrower stop packs the
312
321
  // two cells together with a single space and the column disappears.
313
- // The last row has ONE binding, so it pads nothing (an empty stop
314
- // list, not a stop of 36, which would leave trailing blanks).
322
+ // The last row PAIRS now that ctrl+v joined (it had one binding and an
323
+ // empty stop list); it takes a stop like its neighbours so the second
324
+ // column lines up rather than following a single space.
325
+ [39],
315
326
  [39],
316
- [],
317
327
  ];
318
328
  /**
319
329
  * TUI2-R1 (D) — the sheet, one screen, static.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-tui-cells",
3
- "version": "0.32.0",
3
+ "version": "0.32.2",
4
4
  "description": "kiso tui-cells — the components cell renderer (components, diff, width, the render slice). Zero runtime dependencies: input is data, output is bytes.",
5
5
  "type": "module",
6
6
  "license": "MIT",