@vincemakes/kiso-tui 0.9.0 → 0.11.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.
@@ -27,7 +27,7 @@
27
27
  * durability would need a new durable mechanism), no "chat about this"
28
28
  * hand-off, no timeout and no countdown.
29
29
  */
30
- import { type AskAnswer, type AskOption, type AskQuestion, type AskResult, type AskRuntime, type AskSpec, type PanelPhase, type PanelSel, type PanelState, type PanelView } from "./approval-panel.js";
30
+ import { type AskAnswer, type AskOption, type AskQuestion, type AskResult, type AskRuntime, type AskSpec, type PanelPhase, type PanelSel, type PanelState, type PanelView, type PickRuntime } from "./approval-panel.js";
31
31
  /** The schema's own bounds — the registry refuses anything outside them
32
32
  * (extensions/ask validates; these are the numbers it validates to). */
33
33
  export declare const ASK_MAX_QUESTIONS = 4;
@@ -77,13 +77,14 @@ export declare function askStatus(view: PanelView, state: AskRuntime): string;
77
77
  /** The input row's lead: the digit lead while picking, the typing lead
78
78
  * in the custom phase (the rule-input phase's shape, reused). */
79
79
  export declare function askLeadPlain(state: AskRuntime): string;
80
- export declare function panelBlockRows(view: PanelView, phase: PanelPhase, sel: PanelSel, W: number, maxRows: number, ask?: AskRuntime): string[];
81
- export declare function panelLead(view: PanelView, phase: PanelPhase, sel: PanelSel, ask?: AskRuntime): string;
82
- export declare function panelLeadPlain(view: PanelView, phase: PanelPhase, sel: PanelSel, ask?: AskRuntime): string;
83
- export declare function panelStatus(view: PanelView, phase: PanelPhase, sel: PanelSel, ask?: AskRuntime): string;
84
- export declare function panelAffordance(view: PanelView, phase: PanelPhase, sel: PanelSel, ask?: AskRuntime): string;
80
+ export declare function panelBlockRows(view: PanelView, phase: PanelPhase, sel: PanelSel, W: number, maxRows: number, ask?: AskRuntime, pick?: PickRuntime): string[];
81
+ export declare function panelLead(view: PanelView, phase: PanelPhase, sel: PanelSel, ask?: AskRuntime, pick?: PickRuntime): string;
82
+ export declare function panelLeadPlain(view: PanelView, phase: PanelPhase, sel: PanelSel, ask?: AskRuntime, pick?: PickRuntime): string;
83
+ export declare function panelStatus(view: PanelView, phase: PanelPhase, sel: PanelSel, ask?: AskRuntime, pick?: PickRuntime): string;
84
+ export declare function panelAffordance(view: PanelView, phase: PanelPhase, sel: PanelSel, ask?: AskRuntime, pick?: PickRuntime): string;
85
85
  /** The whole panel state in one call — the compositor's four reads share
86
- * one source, so an ask can never render half as an approval. */
86
+ * one source, so an ask can never render half as an approval (TUI2-R2
87
+ * ④: nor a pick as either). */
87
88
  export declare const panelRowsOf: (s: PanelState, W: number, maxRows: number) => string[];
88
89
  export declare const panelLeadOf: (s: PanelState) => string;
89
90
  export declare const panelStatusOf: (s: PanelState) => string;
package/dist/ask-panel.js CHANGED
@@ -27,7 +27,7 @@
27
27
  * durability would need a new durable mechanism), no "chat about this"
28
28
  * hand-off, no timeout and no countdown.
29
29
  */
30
- import { panelAffordance as basePanelAffordance, panelBlockRows as basePanelBlockRows, panelLead as basePanelLead, panelLeadPlain as basePanelLeadPlain, panelStatus as basePanelStatus, } from "./approval-panel.js";
30
+ import { panelAffordance as basePanelAffordance, panelBlockRows as basePanelBlockRows, panelLead as basePanelLead, panelLeadPlain as basePanelLeadPlain, panelStatus as basePanelStatus, pickAffordance, pickBlockRows, pickLead, pickLeadPlain, pickStatus, } from "./approval-panel.js";
31
31
  import { cutLine } from "@vincemakes/kiso-tui-cells/components";
32
32
  import { escapeTerminal, palette } from "./render.js";
33
33
  /** The schema's own bounds — the registry refuses anything outside them
@@ -225,38 +225,49 @@ export function askLeadPlain(state) {
225
225
  return state.phase === "custom" ? "your answer: " : "1-4> ";
226
226
  }
227
227
  // ── the dispatchers: the panel slot, with the ask branch folded in ────
228
- export function panelBlockRows(view, phase, sel, W, maxRows, ask) {
228
+ export function panelBlockRows(view, phase, sel, W, maxRows, ask, pick) {
229
+ if (view.pick !== undefined && pick !== undefined)
230
+ return pickBlockRows(view, pick, W, maxRows);
229
231
  if (view.ask !== undefined && ask !== undefined)
230
232
  return askBlockRows(view, ask, W, maxRows);
231
233
  return basePanelBlockRows(view, phase, sel, W, maxRows);
232
234
  }
233
- export function panelLead(view, phase, sel, ask) {
235
+ export function panelLead(view, phase, sel, ask, pick) {
234
236
  const p = palette();
237
+ if (view.pick !== undefined && pick !== undefined)
238
+ return pickLead(view, pick);
235
239
  if (view.ask !== undefined && ask !== undefined)
236
240
  return `${p.bold}${askLeadPlain(ask)}${p.reset}`;
237
241
  return basePanelLead(view, phase, sel);
238
242
  }
239
- export function panelLeadPlain(view, phase, sel, ask) {
243
+ export function panelLeadPlain(view, phase, sel, ask, pick) {
244
+ if (view.pick !== undefined && pick !== undefined)
245
+ return pickLeadPlain(view, pick);
240
246
  if (view.ask !== undefined && ask !== undefined)
241
247
  return askLeadPlain(ask);
242
248
  return basePanelLeadPlain(view, phase, sel);
243
249
  }
244
- export function panelStatus(view, phase, sel, ask) {
250
+ export function panelStatus(view, phase, sel, ask, pick) {
251
+ if (view.pick !== undefined && pick !== undefined)
252
+ return pickStatus(view);
245
253
  if (view.ask !== undefined && ask !== undefined)
246
254
  return askStatus(view, ask);
247
255
  return basePanelStatus(view, phase, sel);
248
256
  }
249
- export function panelAffordance(view, phase, sel, ask) {
257
+ export function panelAffordance(view, phase, sel, ask, pick) {
258
+ if (view.pick !== undefined && pick !== undefined)
259
+ return pickAffordance(pick);
250
260
  if (view.ask !== undefined && ask !== undefined)
251
261
  return askAffordance(ask);
252
262
  return basePanelAffordance(view, phase, sel);
253
263
  }
254
264
  /** The whole panel state in one call — the compositor's four reads share
255
- * one source, so an ask can never render half as an approval. */
256
- export const panelRowsOf = (s, W, maxRows) => panelBlockRows(s.view, s.phase, s.sel, W, maxRows, s.ask);
257
- export const panelLeadOf = (s) => panelLead(s.view, s.phase, s.sel, s.ask);
258
- export const panelStatusOf = (s) => panelStatus(s.view, s.phase, s.sel, s.ask);
259
- export const panelAffordanceOf = (s) => panelAffordance(s.view, s.phase, s.sel, s.ask);
265
+ * one source, so an ask can never render half as an approval (TUI2-R2
266
+ * ④: nor a pick as either). */
267
+ export const panelRowsOf = (s, W, maxRows) => panelBlockRows(s.view, s.phase, s.sel, W, maxRows, s.ask, s.pick);
268
+ export const panelLeadOf = (s) => panelLead(s.view, s.phase, s.sel, s.ask, s.pick);
269
+ export const panelStatusOf = (s) => panelStatus(s.view, s.phase, s.sel, s.ask, s.pick);
270
+ export const panelAffordanceOf = (s) => panelAffordance(s.view, s.phase, s.sel, s.ask, s.pick);
260
271
  // ── the view: what the human reads when the model asks ────────────────
261
272
  /** The ask's PanelView. The dock-less fallback question is HONEST: a
262
273
  * terminal without a panel cannot walk options, so it says the ask is
@@ -45,6 +45,7 @@
45
45
  import { type MenuItem } from "./editor.js";
46
46
  import type { PanelState } from "./approval-panel.js";
47
47
  import { type AtMatch } from "./at-picker.js";
48
+ import { type SessionPickState } from "./session-picker.js";
48
49
  /** KC3 §4 — the @ picker's bound state (the editor's atState()). */
49
50
  export interface AtPanelState {
50
51
  readonly matches: readonly AtMatch[];
@@ -178,15 +179,6 @@ export declare class Body {
178
179
  isError: boolean;
179
180
  };
180
181
  } | null;
181
- /** W15 — the expand key's target (ctrl+r). A cell still in the LIVE
182
- * region (the newest live tool) TOGGLES in place — the compositor
183
- * owns those rows and redraws them (the body flips to the full
184
- * form, no cap). A committed cell can never toggle — history is
185
- * never rewritten (ADR-0046) — so the key APPENDS a fresh expanded
186
- * block at the bottom instead, the /last idiom aimed at a chosen
187
- * cell: the pointer cycles the collapsed history, newest first, and
188
- * the header names the target ("N turns back" — the user cells
189
- * after it), so every press tells the user what they got. */
190
182
  expandNext(): {
191
183
  kind: "toggled";
192
184
  } | {
@@ -232,6 +224,9 @@ export declare class Body {
232
224
  * band — see #menuRows for why that is a decision and not a
233
225
  * shortcut. */
234
226
  bindAt(state: () => AtPanelState | null): void;
227
+ /** TUI2-R2 ②: bind the editor's session picker — the band's third
228
+ * occupant (see #menuRows for why they share one). */
229
+ bindPick(state: () => SessionPickState | null): void;
235
230
  /** Bind the pending-turn queue — the CLI's live slots (chat.ts):
236
231
  * the chips render in the menu-rows family, the live caps shrink
237
232
  * by their rows, and the +N queued hint rides the status row. */
@@ -280,6 +275,10 @@ export declare class Dock {
280
275
  * menu (see Body#menuRows). Unbound, the picker cannot render, and
281
276
  * every frame is byte-identical to before the round. */
282
277
  bindAt(state: () => AtPanelState | null): void;
278
+ /** TUI2-R2 ②: bind the editor's session picker — the band's third
279
+ * occupant. Unbound (every path but bare `kiso resume`), the picker
280
+ * cannot render and every frame is byte-identical to before. */
281
+ bindPick(state: () => SessionPickState | null): void;
283
282
  /** W22: bind the pending-turn queue — the chips + the +N queued
284
283
  * hint (the CLI binds it from chat(); the editor's pop keys ride
285
284
  * the LineInput's own bindQueue). */