@vincemakes/kiso-tui 0.12.0 → 0.13.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/dist/editor.d.ts CHANGED
@@ -23,7 +23,7 @@
23
23
  */
24
24
  import { charWidth, displayWidth, widthOf } from "./width.js";
25
25
  export { charWidth, displayWidth, widthOf };
26
- import { type PanelState, type PanelVerdict, type PanelView, type SaferOption } from "./approval-panel.js";
26
+ import { type PanelState, type PanelVerdict, type PanelView, type SaferAnswer } from "./approval-panel.js";
27
27
  import { type AtItem, type AtMatch } from "./at-picker.js";
28
28
  import { type SessionCardView, type SessionPickState } from "./session-picker.js";
29
29
  /**
@@ -128,7 +128,7 @@ export declare class Editor {
128
128
  * (restored at close — commit AND cancel), the panel takes the
129
129
  * keys and the input row's lead, the menu closes. */
130
130
  beginPanel(view: PanelView, onCommit: (v: PanelVerdict) => void, opts?: {
131
- safer?: () => Promise<readonly SaferOption[] | null>;
131
+ safer?: () => Promise<SaferAnswer>;
132
132
  }): void;
133
133
  /** W21: cancel the panel — the SIGINT path's pair to beginPanel. */
134
134
  cancelPanel(): void;
package/dist/editor.js CHANGED
@@ -26,7 +26,7 @@ import { charWidth, displayWidth, leadWidth, widthOf } from "./width.js";
26
26
  // authority) — re-exported so the editor's public surface is unchanged.
27
27
  export { charWidth, displayWidth, widthOf };
28
28
  import { palette } from "./render.js";
29
- import { PICK_MAX, panelOptions, SAFER_DEGRADED, } from "./approval-panel.js";
29
+ import { PICK_MAX, panelOptions, saferDegradedNote, } from "./approval-panel.js";
30
30
  // KC3.5: the panel-slot dispatchers — the ask branch folded into the
31
31
  // W21 lead/rows, so this file keeps ONE panel and one key owner.
32
32
  import { askCommitCustom, askKey, askStart, panelLead } from "./ask-panel.js";
@@ -1360,10 +1360,19 @@ export class Editor {
1360
1360
  * human is standing in front of a paused run.
1361
1361
  *
1362
1362
  * Every failure — a throw, a null, an empty list, no provider bound
1363
- * at all — lands on the SAME honest line and puts back every original
1364
- * choice. There is deliberately no retry and no partial state: the
1365
- * alternative to "I could not get them" is either a lie or a spinner
1366
- * that never ends, and both are worse than the sentence.
1363
+ * at all — lands on the SAME honest branch and puts back every
1364
+ * original choice. There is deliberately no retry and no partial
1365
+ * state: the alternative to "I could not get them" is either a lie or
1366
+ * a spinner that never ends, and both are worse than the sentence.
1367
+ *
1368
+ * R3v2-F1: one of those failures can now name its cause, and the
1369
+ * sentence says it. That is a widening of the COPY, not of the
1370
+ * branch — there is still exactly one failure path, it still restores
1371
+ * every original choice, and a provider that has nothing to add still
1372
+ * resolves `null` and still gets the line it always got. A cause is
1373
+ * only ever spoken when the caller could prove it; a diagnosis the
1374
+ * product cannot prove would be worse than the unqualified line it
1375
+ * replaced.
1367
1376
  *
1368
1377
  * The generation token is the guard against a late answer: a panel
1369
1378
  * the human escaped (or that a SIGINT cancelled) must not be
@@ -1378,13 +1387,18 @@ export class Editor {
1378
1387
  panel.note = null;
1379
1388
  this.#onRender();
1380
1389
  const token = ++this.#saferToken;
1381
- const settle = (options) => {
1390
+ const settle = (answer) => {
1382
1391
  // the panel that asked must still be the panel on screen
1383
1392
  if (this.#panel !== panel || token !== this.#saferToken)
1384
1393
  return;
1394
+ // R3v2-F1: a non-list answer is a failure, and it may name its
1395
+ // cause. Which sentence that earns is decided where the
1396
+ // sentences live; here we only route to the same one branch
1397
+ // every failure has always taken.
1398
+ const options = Array.isArray(answer) ? answer : null;
1385
1399
  if (options === null || options.length === 0) {
1386
1400
  panel.phase = "options";
1387
- panel.note = SAFER_DEGRADED;
1401
+ panel.note = saferDegradedNote(answer);
1388
1402
  panel.cursor = 0;
1389
1403
  this.#onRender();
1390
1404
  return;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * editor, the diff renderer, and the palette.
8
8
  */
9
9
  export { Body, Dock, CURSOR_MARKER, type BodyOptions } from "./compositor.js";
10
- export { panelAffordance, panelBlockRows, panelLead, panelLeadPlain, panelLeadWidth, panelStatus, PICK_MAX, modelPickView, pickAffordance, pickBlockRows, pickLeadPlain, type PickOption, type PickResult, type PickRuntime, type PickSpec, type PanelArgs, type PanelFlavor, type PanelPhase, deletionRiskHint, SAFER_BACK, SAFER_DEGRADED, type SaferOption, type SaferRuntime, panelOptions, type PanelOption, type PanelOptionKind, type PanelState, type PanelVerdict, type PanelView, } from "./approval-panel.js";
10
+ export { panelAffordance, panelBlockRows, panelLead, panelLeadPlain, panelLeadWidth, panelStatus, PICK_MAX, modelPickView, pickAffordance, pickBlockRows, pickLeadPlain, type PickOption, type PickResult, type PickRuntime, type PickSpec, type PanelArgs, type PanelFlavor, type PanelPhase, deletionRiskHint, SAFER_BACK, SAFER_DEGRADED, SAFER_DEGRADED_TRUNCATED, saferDegradedNote, type SaferAnswer, type SaferFailure, type SaferOption, type SaferRuntime, panelOptions, type PanelOption, type PanelOptionKind, type PanelState, type PanelVerdict, type PanelView, } from "./approval-panel.js";
11
11
  export { Container, foldLine, foldWords, visibleWidth, SPINNER, type Component, type FrameCtx } from "./components.js";
12
12
  export { Editor, MENU_ITEMS, PROMPT, PROMPT_WIDTH, displayWidth, charWidth, widthOf, type MenuItem, } from "./editor.js";
13
13
  export { bannerLines, COLOR_OFF, COLOR_ON, escapeTerminal, foldResult, foldThinking, kUnit, palette, renderEvent, renderRecap, renderResumeList, renderSessionLine, renderStatusLine, relativeTime, renderTerminalGap, renderToolSummary, TAGLINE, toolTarget, truncateRow, type Palette, type PathResolver, type RecapStats, type ResumeMeta, type RenderInput, type RenderResult, type RunUsage, } from "./render.js";
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ export { Body, Dock, CURSOR_MARKER } from "./compositor.js";
12
12
  // approval is pending (the shape authority is the committed preview).
13
13
  export { panelAffordance, panelBlockRows, panelLead, panelLeadPlain, panelLeadWidth, panelStatus,
14
14
  // TUI2-R2 ④: the pick payload — the panel slot's third occupant.
15
- PICK_MAX, modelPickView, pickAffordance, pickBlockRows, pickLeadPlain, deletionRiskHint, SAFER_BACK, SAFER_DEGRADED, panelOptions, } from "./approval-panel.js";
15
+ PICK_MAX, modelPickView, pickAffordance, pickBlockRows, pickLeadPlain, deletionRiskHint, SAFER_BACK, SAFER_DEGRADED, SAFER_DEGRADED_TRUNCATED, saferDegradedNote, panelOptions, } from "./approval-panel.js";
16
16
  export { Container, foldLine, foldWords, visibleWidth, SPINNER } from "./components.js";
17
17
  export { Editor, MENU_ITEMS, PROMPT, PROMPT_WIDTH, displayWidth, charWidth, widthOf, } from "./editor.js";
18
18
  export { bannerLines, COLOR_OFF, COLOR_ON, escapeTerminal, foldResult, foldThinking, kUnit, palette, renderEvent, renderRecap, renderResumeList, renderSessionLine, renderStatusLine, relativeTime, renderTerminalGap, renderToolSummary, TAGLINE, toolTarget, truncateRow, } from "./render.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-tui",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "kiso tui — the pure terminal layer (cell renderer, dock, raw editor, diff, palette). Zero runtime dependencies: input is data, output is bytes.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -35,6 +35,6 @@
35
35
  },
36
36
  "homepage": "https://github.com/vincemakes/kiso/tree/main/packages/tui#readme",
37
37
  "dependencies": {
38
- "@vincemakes/kiso-tui-cells": "0.12.0"
38
+ "@vincemakes/kiso-tui-cells": "0.13.0"
39
39
  }
40
40
  }