@alisio/alisio-code 0.1.0-alpha.14 → 0.1.0-alpha.16

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.
@@ -1,20 +1,38 @@
1
- import type { PanelNode } from "@alisio/sdk";
1
+ import type { PanelNode, TreeNode, UiBlock } from "@alisio/sdk";
2
2
  import { type Component, Container } from "@earendil-works/pi-tui";
3
3
  import { type PendingAttachment } from "./attachments.ts";
4
4
  import { type QuestionPanelState, type QuestionSpec } from "./questions.ts";
5
- import { type ContextBudget, type TranscriptItem, type ViewState } from "./state.ts";
5
+ import { type ContextBudget, type FoldableKind, type FoldCandidate, type GroupedTool, type IdentityInput, type TranscriptEntry, type TranscriptItem, type ViewState } from "./state.ts";
6
6
  export declare const SPINNER: string[];
7
7
  /** Shared animation clock advanced by the app while work is running. */
8
8
  export declare const clock: {
9
9
  frame: number;
10
10
  now: number;
11
11
  };
12
+ /** Fold state the components receive: neither knows keys nor defaults (components stay dumb). */
13
+ export interface FoldInfo {
14
+ expanded: boolean;
15
+ kind: FoldableKind;
16
+ }
17
+ /** `Command exited with code 0.` (green) / `Command exited with code N.` (red) when known. */
18
+ export declare const exitCodeLine: (code: number | undefined, indent?: string) => string | undefined;
19
+ /**
20
+ * Tree rendering with branch glyphs: `├─`/`└─`/`│` when the terminal supports Unicode, ASCII
21
+ * `|-`/`` `- ``/`|` otherwise.
22
+ */
23
+ export declare function renderTreeLines(nodes: TreeNode[], unicode: boolean): string[];
24
+ /** Renders a `{type:"ui"}` block to styled lines for the given inner width. */
25
+ export declare function renderUiBlock(block: UiBlock, width: number, unicode: boolean): string[];
12
26
  export type PermissionState = "on" | "ask" | "off";
13
27
  export interface HeaderInfo {
14
28
  version: string;
15
29
  host: string;
16
30
  apiMode: string;
17
31
  provider?: string;
32
+ /** Model display name (catalog `name`), falling back to the session model id. */
33
+ modelName?: string;
34
+ /** Effective reasoning effort of the active model, when it advertises supported levels. */
35
+ effort?: string;
18
36
  cwd: string;
19
37
  session: string;
20
38
  /** Git branch (or short SHA on a detached HEAD) of the session workspace; undefined when unavailable. */
@@ -36,7 +54,8 @@ export declare class Footer implements Component {
36
54
  private budget;
37
55
  private hint;
38
56
  private statuses;
39
- constructor(view: () => ViewState, budget: () => ContextBudget | undefined, hint: () => string | undefined, statuses?: () => string[]);
57
+ private identity?;
58
+ constructor(view: () => ViewState, budget: () => ContextBudget | undefined, hint: () => string | undefined, statuses?: () => string[], identity?: (() => IdentityInput | undefined) | undefined);
40
59
  invalidate(): void;
41
60
  render(width: number): string[];
42
61
  }
@@ -48,13 +67,17 @@ export declare class UserBlock implements Component {
48
67
  }
49
68
  export declare class AssistantBlock implements Component {
50
69
  private markdown;
70
+ /** Bumped by TranscriptSync when this row's content changes; render caches on it. */
71
+ version: number;
72
+ fold?: FoldInfo;
51
73
  private item;
74
+ private cache?;
52
75
  constructor(item: Extract<TranscriptItem, {
53
76
  kind: "assistant";
54
77
  }>);
55
78
  update(item: Extract<TranscriptItem, {
56
79
  kind: "assistant";
57
- }>): void;
80
+ }>, fold?: FoldInfo | undefined): void;
58
81
  invalidate(): void;
59
82
  render(width: number): string[];
60
83
  }
@@ -62,9 +85,34 @@ export declare class ToolBlock implements Component {
62
85
  item: Extract<TranscriptItem, {
63
86
  kind: "tool";
64
87
  }>;
88
+ /** Bumped by TranscriptSync when this row's content changes; render caches on it. */
89
+ version: number;
90
+ fold?: FoldInfo;
91
+ private markdown?;
92
+ private cache?;
65
93
  constructor(item: Extract<TranscriptItem, {
66
94
  kind: "tool";
67
95
  }>);
96
+ update(item: Extract<TranscriptItem, {
97
+ kind: "tool";
98
+ }>, fold?: FoldInfo | undefined): void;
99
+ invalidate(): void;
100
+ render(width: number): string[];
101
+ }
102
+ /**
103
+ * One collapsible row for a GROUPED batch of finished tool calls (e.g. `✓ Read File — 3 reads`).
104
+ * Collapsed it shows the aggregate header; expanded, each call with its status, duration,
105
+ * summary and capped preview/rich body. All members are terminal, so lines are cached per
106
+ * version/width/fold just like the other terminal rows.
107
+ */
108
+ export declare class ToolGroupBlock implements Component {
109
+ group: GroupedTool;
110
+ /** Bumped by TranscriptSync when this row's content changes; render caches on it. */
111
+ version: number;
112
+ fold?: FoldInfo;
113
+ private cache?;
114
+ constructor(group: GroupedTool);
115
+ update(group: GroupedTool, fold?: FoldInfo | undefined): void;
68
116
  invalidate(): void;
69
117
  render(width: number): string[];
70
118
  }
@@ -81,7 +129,31 @@ export declare class InfoBlock implements Component {
81
129
  invalidate(): void;
82
130
  render(width: number): string[];
83
131
  }
84
- export declare function componentFor(item: TranscriptItem): Component;
132
+ export declare function componentFor(entry: TranscriptEntry): Component;
133
+ /**
134
+ * Keeps a container of transcript components in step with view-model items. Rows are keyed
135
+ * (stable per fold candidate: tool ids, group ids, append-only item indices) and reused across
136
+ * syncs; batch groups replace their members' singleton components with one row once all of them
137
+ * finish. Content versions bump only when a row's entry actually changed, so clock frames
138
+ * between events reuse each component's cached lines instead of re-rendering. `setFoldResolver`
139
+ * supplies the effective expanded state; the same resolution feeds `entryAt`, so keybindings
140
+ * and mouse clicks agree with the renderer.
141
+ */
142
+ export declare class TranscriptSync {
143
+ readonly container: Container;
144
+ private rows;
145
+ private order;
146
+ private foldOf;
147
+ setFoldResolver(resolver: (candidate: FoldCandidate) => boolean): void;
148
+ sync(items: TranscriptItem[]): void;
149
+ /**
150
+ * Fold candidate at a transcript content row, when the click landed on the row's header
151
+ * (assistant entries start with a blank spacer line, so their first two rows count). Used by
152
+ * click-to-toggle; keyboard toggling uses `foldCandidates` instead and needs no heights.
153
+ */
154
+ entryAt(contentY: number, width: number): FoldCandidate | undefined;
155
+ reset(): void;
156
+ }
85
157
  /** Startup screen rendered by core for the current width (cached until the width changes). */
86
158
  export declare class BannerBlock implements Component {
87
159
  private renderLines;
@@ -90,13 +162,6 @@ export declare class BannerBlock implements Component {
90
162
  invalidate(): void;
91
163
  render(width: number): string[];
92
164
  }
93
- /** Keeps a container of transcript components in step with view-model items. */
94
- export declare class TranscriptSync {
95
- readonly container: Container;
96
- private rendered;
97
- sync(items: TranscriptItem[]): void;
98
- reset(): void;
99
- }
100
165
  /** Renders one of several components (main conversation or a read-only child view). */
101
166
  export declare class Switch implements Component {
102
167
  private pick;