@vincemakes/kiso-tui 0.1.39 → 0.1.41

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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * W21 — the approval panel shim: the components cell moved to the 9th
3
+ * package (ADR-0043 Amendment 4); the tui re-exports it so its own
4
+ * consumers (the compositor, the cli) import a stable path.
5
+ */
6
+ export * from "@vincemakes/kiso-tui-cells/approval-panel";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * W21 — the approval panel shim: the components cell moved to the 9th
3
+ * package (ADR-0043 Amendment 4); the tui re-exports it so its own
4
+ * consumers (the compositor, the cli) import a stable path.
5
+ */
6
+ export * from "@vincemakes/kiso-tui-cells/approval-panel";
@@ -1,222 +1,4 @@
1
- /**
2
- * TUI v6 (ADR-0046) — the components: EVERY screen line's renderer.
3
- *
4
- * Each component turns one piece of state into display lines (SGR
5
- * included, raw — the compositor writes them verbatim). The folding
6
- * lives HERE: every line a component returns must fit the terminal
7
- * width — the compositor's crash-on-violation invariant backs it up
8
- * (a component that forgets to fold CRASHES with a diagnostic, never
9
- * silently truncates — pi tui-main-screen.ts:447-473).
10
- *
11
- * The fold is SGR-AWARE: a line whose bold/dim span would straddle a
12
- * fold boundary closes the span at the break and reopens it on the
13
- * next row — the #16b contract (no literal "[2m" fragments) survives
14
- * folding. displayWidth/charWidth (editor.ts) are the width primitives
15
- * (untouched); render.ts supplies the original text (palette, escape,
16
- * tint, fold wording).
17
- */
18
- import { foldThinking, foldResult, renderToolSummary, type ResumeMeta } from "./render.js";
19
- /** The spinner glyphs, cycled by the compositor's on-demand tick. */
20
- export declare const SPINNER: string[];
21
- /** The frame context the compositor passes down — the pieces of time
22
- * that make a live render non-deterministic (the running tool's glyph
23
- * and elapsed). Everything else is a pure function of the cell. */
24
- export interface FrameCtx {
25
- readonly spinnerI: number;
26
- readonly now: number;
27
- /** The terminal height (rows) — the banner cell's tier input (W1:
28
- * the tier table reads H, so a resize RE-TIERS instead of
29
- * re-folding frozen rows). */
30
- readonly height: number;
31
- }
32
- /** ONE screen line a component emits (raw, SGR included). */
33
- export type RenderLine = string;
34
- /**
35
- * The fold — split a display-width line into ≤W rows, preserving SGR
36
- * spans across the break: a span open at the break closes (reset) at
37
- * the row's end and reopens on the next row. The rows are what the
38
- * terminal's own soft-wrap would have produced — except the compositor
39
- * folds FIRST, so the terminal never reflows a component's line (the
40
- * #17 merge class cannot reach committed content).
41
- */
42
- export declare function foldLine(line: string, W: number): string[];
43
- /** The visible width of a rendered line (SGR stripped — the invariant
44
- * the compositor enforces on every emitted line). */
45
- export declare function visibleWidth(line: string): number;
46
- /** A component: render the display lines for one piece of state. */
47
- export interface Component {
48
- render(width: number, ctx: FrameCtx): string[];
49
- }
50
- /** The W11 spacing formula — "a row gets one blank line above it when
51
- * the row is itself a block, or when the previous sibling was taller
52
- * than one row". One-row siblings pack tight; anything multi-row
53
- * breathes on both sides. The FIRST cell never gets the blank (it sits
54
- * at the body's top — the banner would otherwise start one row down).
55
- * `prev` is the previous sibling's OWN rows (raw — a cell's own blank
56
- * must never count toward its height). The blank is a JOIN artifact:
57
- * the cell's own render stays blank-free, so per-cell accounting
58
- * (heights, the fold cache) never sees a fake row. */
59
- export declare function bodySpacing(prev: readonly string[] | null, rows: readonly string[]): string[];
60
- /** The container — vertical concatenation with the W11 formula. No
61
- * component decides its own spacing: every blank in the body is the
62
- * container's. */
63
- export declare class Container implements Component {
64
- private readonly children;
65
- constructor(children: Component[]);
66
- render(width: number, ctx: FrameCtx): string[];
67
- }
68
- export type BodyCell = {
69
- kind: "user";
70
- text: string;
71
- done: true;
72
- turn: number;
73
- } | {
74
- kind: "thinking";
75
- text: string;
76
- done: boolean;
77
- turn: number;
78
- } | {
79
- kind: "tool";
80
- name: string;
81
- input: string;
82
- /** W15: the FULL input JSON (pretty-printed) — the display
83
- * summary above is sliced at 60 chars; the expanded block's
84
- * "--- input ---" section mirrors /last and needs it all. */
85
- inputFull: string;
86
- childRoles: string[];
87
- state: "pending" | "approval" | "running" | "done";
88
- isError: boolean;
89
- resultText: string;
90
- diff: import("./diff.js").DiffLine[] | null;
91
- added: number;
92
- removed: number;
93
- startedAt: number | null;
94
- doneAt: number | null;
95
- done: boolean;
96
- /** W15: the live-region expand toggle — while the cell is live
97
- * the FULL body renders in place (the compositor owns those
98
- * rows and redraws them); a committed cell can never toggle
99
- * (history is never rewritten — ADR-0046). */
100
- expanded: boolean;
101
- /** W14: the turn boundary — the index of the turn record that
102
- * created this cell (the fold-hold's owner; −1 when no turn
103
- * exists yet — the pre-turn cells never hold). */
104
- turn: number;
105
- /** W13: the rolled-up group summary — set at COMMIT time when
106
- * the head of an N > 2 same-tool run renders the group (the
107
- * work order's claimed shape: "✓ read 5 files (2.4k lines,
108
- * 1.1s)" + the target children). The members carry null — the
109
- * compositor's rolled-heads bookkeeping renders them []. */
110
- rolled: null | {
111
- count: number;
112
- lines: number;
113
- elapsed: string;
114
- targets: string[];
115
- };
116
- /** W19: a DENIED call's reason (the CLI extracted it from the
117
- * result's "[Permission denied] " prefix, keyed on the "denied"
118
- * tag). Non-null renders the pinned row — the full call name,
119
- * the target, the reason in the W4 parentheses idiom, NO timing
120
- * metadata (the call never ran). */
121
- reason: string | null;
122
- } | {
123
- kind: "text";
124
- text: string;
125
- done: boolean;
126
- } | {
127
- kind: "notice";
128
- text: string;
129
- done: true;
130
- } | {
131
- kind: "banner";
132
- version: string;
133
- extensionsText: string;
134
- resume: ResumeMeta[];
135
- done: true;
136
- } | {
137
- kind: "raw";
138
- lines: string[];
139
- done: true;
140
- } | {
141
- kind: "terminal";
142
- label: string;
143
- line: string;
144
- done: true;
145
- } | {
146
- kind: "checklist";
147
- /** the model-authored header tail (parseChecklist's count line —
148
- * chat.ts). The compositor's fixed "task" prefix rides BEFORE it
149
- * (W20 naming ruling: never model-controlled). */
150
- header: string;
151
- items: {
152
- text: string;
153
- status: "pending" | "active" | "done";
154
- }[];
155
- /** W20: false while LIVE — the current turn's ONE in-place block
156
- * (the commit loop only takes done cells, so it stays in the
157
- * live region); true once SETTLED — endTurn committed it as the
158
- * turn's one recap block. */
159
- done: boolean;
160
- /** W20: the LIVE block's ctrl+r toggle (W15) — the capped form
161
- * flips to the full list in place. The settled render ignores
162
- * it (already full). */
163
- expanded: boolean;
164
- /** W20: the wall clock of the block's FIRST call — the settled
165
- * header's duration is clocked from here, compositor-side (the
166
- * CLI stays unchanged). */
167
- startedAt: number;
168
- /** W20: the run's duration at the settle — the `2h 14m` form. */
169
- durationSeconds: number;
170
- turn: number;
171
- };
172
- declare const TOOL_SUMMARY_MAX = 60;
173
- /** The component for one cell — the mapping table lives here so the
174
- * compositor stays a pure writer. */
175
- export declare function cellComponent(cell: BodyCell): Component;
176
- /** W13 — the rollup opt-in table: which tools collapse, and the count
177
- * NOUN (read_file calls → "5 files", list_dir → "5 dirs", search_text
178
- * → "5 matches"). Only these tools opt in — a shell burst is never
179
- * rolled up (its rows carry meaning). The folded-turn line (W14) reuses
180
- * the plurals for its other-tool terms ("2 dirs", "1 match"). */
181
- export declare const ROLLUP_NOUN: Readonly<Record<string, string>>;
182
- /** W14 — the folded-turn line: a whole QUIET turn (no text), once it is
183
- * scrollback, becomes ONE line — the work order's claimed shape
184
- * (`▞ thought 19s · 5 reads · no edits`), the counts accumulated at
185
- * toolStart: read_file → "reads", edit_file → "edits", the other tools
186
- * as first-call-order terms (the ROLLUP_NOUN plurals when the tool opts
187
- * in, the verb + "s" otherwise). */
188
- export declare function turnFold(t: {
189
- thoughtSeconds: number;
190
- reads: number;
191
- edits: number;
192
- others: [string, number][];
193
- }): string[];
194
- /** W20 — the task block's fixed-window height: the whole live block
195
- * (header + rows) in POST-FOLD screen rows at EVERY width: the header,
196
- * the active row, up to 2 pending, the overflow-pending fold, the
197
- * done-collapse. Every live row CUTS at W (never folds) — the block's
198
- * height is its row count. */
199
- export declare const CAP_TASK_LIVE = 6;
200
- /** W20 — the settled block's duration, the `2h 14m` form (the task
201
- * narrative's long-horizon idiom): minutes+seconds under an hour,
202
- * hours+minutes past it. */
203
- export declare function formatDuration(totalSeconds: number): string;
204
- /** The status container's row: the status text (+ the tail) with the
205
- * right-aligned "/ commands · ↑ history" hint in the idle state —
206
- * the hint CUT FIRST when the width is short (the #16g rule); when
207
- * the STATUS ITSELF cannot fit, it cuts with a "…" — the last resort,
208
- * enforced by invariant ① (the old code let the status soft-wrap). */
209
- export declare function statusLine(status: string, tail: string, question: boolean, W: number, hint?: string): string;
210
- /** W6 — the box: the chrome's top rail. The two ╌ dotted rows become
211
- * a rounded box (the box already says "input lives here"); the rails
212
- * stay dim, the width is still the full W (the box is a rail with
213
- * corners — the menu/gap rows above and the status below are
214
- * untouched). */
215
- export declare function boxTop(W: number): string;
216
- /** W6 — the box: the chrome's bottom rail. */
217
- export declare function boxBottom(W: number): string;
218
- /** The terminal label + rhythm gap (the pipe path's v2c bytes — the
219
- * exact render the passthrough needs). */
220
- export declare function terminalPipe(label: string, statusLineText: string): string;
221
- /** The pipe-path pieces the passthrough reuses (byte-identical). */
222
- export { foldThinking, foldResult, renderToolSummary, TOOL_SUMMARY_MAX };
1
+ /** The components cell renderer moved to tui-cells (ADR-0043
2
+ * Amendment 4) — this module is the re-export shim: the compositor's
3
+ * and index.ts's imports (./components.js) stay verbatim. */
4
+ export * from "@vincemakes/kiso-tui-cells/components";