@lingxi-ai-cn/dsh-tui-runtime 0.1.0-rc.8

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.
Files changed (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +109 -0
  3. package/README.zh.md +109 -0
  4. package/lib/index.js +10552 -0
  5. package/lib/invariant.js +9 -0
  6. package/lib/types/agent-view.d.ts +40 -0
  7. package/lib/types/app.d.ts +121 -0
  8. package/lib/types/composer.d.ts +188 -0
  9. package/lib/types/detail.d.ts +24 -0
  10. package/lib/types/footer.d.ts +85 -0
  11. package/lib/types/history-search.d.ts +58 -0
  12. package/lib/types/host.d.ts +210 -0
  13. package/lib/types/index.d.ts +60 -0
  14. package/lib/types/invariant.d.ts +6 -0
  15. package/lib/types/keybindings.d.ts +165 -0
  16. package/lib/types/markdown.d.ts +9 -0
  17. package/lib/types/open-url.d.ts +9 -0
  18. package/lib/types/plugin-hub.d.ts +158 -0
  19. package/lib/types/resume.d.ts +66 -0
  20. package/lib/types/rewind.d.ts +37 -0
  21. package/lib/types/sanitize.d.ts +9 -0
  22. package/lib/types/session-export.d.ts +29 -0
  23. package/lib/types/session-lifecycle.d.ts +20 -0
  24. package/lib/types/startup-logo.d.ts +45 -0
  25. package/lib/types/store.d.ts +88 -0
  26. package/lib/types/suggestion.d.ts +99 -0
  27. package/lib/types/terminal-input.d.ts +69 -0
  28. package/lib/types/terminal-session.d.ts +129 -0
  29. package/lib/types/theme.d.ts +76 -0
  30. package/lib/types/todo-panel.d.ts +12 -0
  31. package/lib/types/tool-card.d.ts +24 -0
  32. package/lib/types/tool-group.d.ts +10 -0
  33. package/lib/types/transcript-search.d.ts +67 -0
  34. package/lib/types/transcript-view.d.ts +32 -0
  35. package/lib/types/transcript.d.ts +159 -0
  36. package/lib/types/viewport.d.ts +211 -0
  37. package/lib/types/work-panel.d.ts +28 -0
  38. package/lib/types/work.d.ts +100 -0
  39. package/package.json +104 -0
@@ -0,0 +1,76 @@
1
+ /** Semantic terminal colors and user settings for the native TUI. */
2
+ import React, { type ReactNode } from 'react';
3
+ import { z } from './host.ts';
4
+ import { type TuiKeybindingOverrides } from './keybindings.ts';
5
+ import type { TuiTerminalColorDepth } from './terminal-session.ts';
6
+ /** Persisted built-in terminal theme names. */
7
+ export declare const TUI_THEME_PREFERENCES: readonly ["dark", "light", "no-color"];
8
+ /** One persisted built-in terminal theme name. */
9
+ export type TuiThemePreference = typeof TUI_THEME_PREFERENCES[number];
10
+ /** Settings namespace owned by the native TUI. */
11
+ export declare const TUI_SETTINGS_NAMESPACE: import("@deepseek-ai/dsh-settings").SettingsNamespace;
12
+ /** User settings consumed live by the native TUI. */
13
+ export interface TuiSettings {
14
+ /** Built-in semantic terminal theme. */
15
+ theme: TuiThemePreference;
16
+ /** Per-action replacements for built-in key gestures. */
17
+ keybindings: TuiKeybindingOverrides;
18
+ }
19
+ /** Defaults used without a settings provider and below its user layer. */
20
+ export declare const DEFAULT_TUI_SETTINGS: TuiSettings;
21
+ /** Persisted native-TUI settings schema, including effective-binding validation. */
22
+ export declare const TUI_SETTINGS_SCHEMA: z<TuiSettings>;
23
+ /** Colors available to every native-TUI renderer. */
24
+ export interface TuiSemanticThemeTokens {
25
+ readonly text: string | undefined;
26
+ readonly muted: string | undefined;
27
+ readonly accent: string | undefined;
28
+ readonly success: string | undefined;
29
+ readonly warning: string | undefined;
30
+ readonly error: string | undefined;
31
+ readonly permission: string | undefined;
32
+ readonly reasoning: string | undefined;
33
+ readonly selection: string | undefined;
34
+ readonly border: string | undefined;
35
+ readonly diffAdd: string | undefined;
36
+ readonly diffDelete: string | undefined;
37
+ }
38
+ /** Resolved theme for one negotiated terminal color depth. */
39
+ export interface TuiTheme {
40
+ readonly preference: TuiThemePreference;
41
+ readonly colorDepth: TuiTerminalColorDepth;
42
+ readonly tokens: TuiSemanticThemeTokens;
43
+ /** Whether secondary text may use ANSI dim styling. */
44
+ readonly dim: boolean;
45
+ }
46
+ /**
47
+ * Omit Ink's optional text color property when a no-color theme resolves it away.
48
+ * @param color - one resolved semantic token.
49
+ * @returns an exact-optional Ink text style.
50
+ */
51
+ export declare function tuiTextStyle(color: string | undefined): Readonly<{
52
+ color?: string;
53
+ }>;
54
+ /**
55
+ * Omit Ink's optional border color property when a no-color theme resolves it away.
56
+ * @param color - one resolved semantic token.
57
+ * @returns an exact-optional Ink box style.
58
+ */
59
+ export declare function tuiBorderStyle(color: string | undefined): Readonly<{
60
+ borderColor?: string;
61
+ }>;
62
+ /**
63
+ * Resolve semantic colors for one persisted preference and terminal precision.
64
+ * @param preference - selected built-in theme.
65
+ * @param colorDepth - color precision negotiated for the active output stream.
66
+ * @returns immutable tokens that never emit colors when either input requires no color.
67
+ */
68
+ export declare function resolveTuiTheme(preference: TuiThemePreference, colorDepth: TuiTerminalColorDepth): TuiTheme;
69
+ /** Provide one resolved theme without changing descendant component identity. */
70
+ export declare function TuiThemeProvider({ theme, children }: {
71
+ readonly theme: TuiTheme;
72
+ readonly children?: ReactNode;
73
+ }): React.ReactElement;
74
+ /** Read the semantic theme selected for the active terminal transaction. */
75
+ export declare function useTuiTheme(): TuiTheme;
76
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1,12 @@
1
+ /** Compact durable todo checklist for the native TUI transcript. */
2
+ import React from 'react';
3
+ import { type TranscriptTodoNode } from './transcript.ts';
4
+ /** Physical rows occupied by the pinned Tasks surface. */
5
+ export declare function todoPanelRows(node: TranscriptTodoNode | undefined): number;
6
+ /** Render the standing todo snapshot beside the composer. */
7
+ export declare function TodoPanel({ node, focused, emphasized, }: {
8
+ node: TranscriptTodoNode;
9
+ focused?: boolean;
10
+ emphasized?: ReadonlySet<string>;
11
+ }): React.ReactElement | null;
12
+ //# sourceMappingURL=todo-panel.d.ts.map
@@ -0,0 +1,24 @@
1
+ /** Ink renderers for provider-neutral tool presentation intents. */
2
+ import React from 'react';
3
+ import type { TranscriptToolNode } from './transcript.ts';
4
+ /** Stable terminal symbol for one tool scheduler state. */
5
+ export declare function toolDisplayState(node: TranscriptToolNode): TranscriptToolNode['state'];
6
+ /** Stable terminal symbol for one tool scheduler state. */
7
+ export declare function toolStateMark(node: TranscriptToolNode): string;
8
+ /**
9
+ * Derive the compact, single-line summary shown on a collapsed tool card.
10
+ * @param node - paired semantic tool node.
11
+ * @returns terminal-safe summary text.
12
+ */
13
+ export declare function toolSummary(node: TranscriptToolNode, workspace?: string): string;
14
+ /** Return a terminal-safe logical detail listing for one tool lifecycle. */
15
+ export declare function toolDetailLines(node: TranscriptToolNode): readonly string[];
16
+ /** Render one paired tool lifecycle as a compact or detailed terminal card. */
17
+ export declare function ToolCard({ node, expanded, detailOffset, detailRows, workspace }: {
18
+ node: TranscriptToolNode;
19
+ expanded: boolean;
20
+ detailOffset?: number;
21
+ detailRows?: number;
22
+ workspace?: string | undefined;
23
+ }): React.ReactElement;
24
+ //# sourceMappingURL=tool-card.d.ts.map
@@ -0,0 +1,10 @@
1
+ /** Hierarchical rendering for consecutive read and search tool activity. */
2
+ import React from 'react';
3
+ import { type TranscriptToolGroupNode } from './transcript.ts';
4
+ /** Render related exploration calls under one tree-like activity heading. */
5
+ export declare function ToolGroup({ node, focusedCallId, workspace }: {
6
+ node: TranscriptToolGroupNode;
7
+ focusedCallId?: string;
8
+ workspace?: string | undefined;
9
+ }): React.ReactElement;
10
+ //# sourceMappingURL=tool-group.d.ts.map
@@ -0,0 +1,67 @@
1
+ /** Cached full-transcript search over the TUI's semantic node projection. */
2
+ import type { TranscriptNode } from './transcript.ts';
3
+ /** One searchable semantic transcript block. */
4
+ export interface TuiTranscriptSearchDocument {
5
+ /** Stable transcript-node identity. */
6
+ readonly key: string;
7
+ /** Current index in the complete folded transcript. */
8
+ readonly nodeIndex: number;
9
+ /** Terminal-safe, whitespace-normalized text used for snippets. */
10
+ readonly text: string;
11
+ /** Unicode-normalized lowercase text used for matching. */
12
+ readonly normalizedText: string;
13
+ }
14
+ /** One matching transcript block. */
15
+ export interface TuiTranscriptSearchHit extends TuiTranscriptSearchDocument {
16
+ /** Start of the first match in `normalizedText`. */
17
+ readonly matchStart: number;
18
+ /** End of the first match in `normalizedText`. */
19
+ readonly matchEnd: number;
20
+ }
21
+ /** One highlighted or ordinary substring for the search-result renderer. */
22
+ export interface TuiTranscriptSearchSegment {
23
+ /** Source text for this segment. */
24
+ readonly text: string;
25
+ /** Whether this segment is the first query match. */
26
+ readonly match: boolean;
27
+ }
28
+ /**
29
+ * Retain lowercase search documents by stable node identity. Updating the
30
+ * complete projection only re-normalizes blocks whose searchable text changed.
31
+ */
32
+ export declare class TuiTranscriptSearchIndex {
33
+ private readonly cache;
34
+ private documents;
35
+ /**
36
+ * Reconcile the index with one complete folded transcript.
37
+ * @param nodes - every semantic transcript node, including unmounted pages.
38
+ */
39
+ update(nodes: readonly TranscriptNode[]): void;
40
+ /**
41
+ * Find every matching semantic block in transcript order.
42
+ * @param query - incremental caller query.
43
+ * @returns one hit per matching block; an empty query has no hits.
44
+ */
45
+ search(query: string): readonly TuiTranscriptSearchHit[];
46
+ }
47
+ /**
48
+ * Normalize terminal search text for case-insensitive incremental matching.
49
+ * @param value - query or projected block text.
50
+ * @returns terminal-safe NFKC lowercase text with collapsed whitespace.
51
+ */
52
+ export declare function normalizeTuiTranscriptSearchText(value: string): string;
53
+ /**
54
+ * Split display text around its first normalized query match.
55
+ * @param text - terminal-safe search document text.
56
+ * @param query - active search query.
57
+ * @returns immutable display segments; normalization-only matches highlight the complete text.
58
+ */
59
+ export declare function tuiTranscriptSearchSegments(text: string, query: string): readonly TuiTranscriptSearchSegment[];
60
+ /**
61
+ * Preserve the selected block across index refreshes while it still matches.
62
+ * @param hits - current transcript-ordered matches.
63
+ * @param selectedKey - previously selected stable node key.
64
+ * @returns the retained hit, the first hit, or `undefined` when no block matches.
65
+ */
66
+ export declare function resolveTuiTranscriptSearchHit(hits: readonly TuiTranscriptSearchHit[], selectedKey: string | undefined): TuiTranscriptSearchHit | undefined;
67
+ //# sourceMappingURL=transcript-search.d.ts.map
@@ -0,0 +1,32 @@
1
+ /** Ink rendering for one bounded semantic transcript frame. */
2
+ import React from 'react';
3
+ import type { TranscriptNode } from './transcript.ts';
4
+ import type { TranscriptWindowEntry } from './viewport.ts';
5
+ interface TuiTranscriptViewProps {
6
+ entries: readonly TranscriptWindowEntry[];
7
+ overscanBefore?: readonly TranscriptWindowEntry[] | undefined;
8
+ overscanAfter?: readonly TranscriptWindowEntry[] | undefined;
9
+ workspace?: string | undefined;
10
+ focusedNode?: TranscriptNode | undefined;
11
+ focusedCallId?: string | undefined;
12
+ rewindSelectedKey?: string | undefined;
13
+ searchSelectedKey?: string | undefined;
14
+ searchQuery?: string | undefined;
15
+ }
16
+ /**
17
+ * Highlight the first normalized transcript-search match inside display text.
18
+ * @param props - visible text and active query.
19
+ * @returns segmented Ink text with the matching segment emphasized.
20
+ */
21
+ export declare function TuiTranscriptSearchText({ text, query }: {
22
+ text: string;
23
+ query: string;
24
+ }): React.ReactElement;
25
+ /**
26
+ * Render the exact transcript blocks selected for one physical terminal frame.
27
+ * @param props - bounded entries plus process-local focus and search state.
28
+ * @returns one fragment containing the mounted transcript rows.
29
+ */
30
+ export declare function TuiTranscriptView({ entries, overscanBefore, overscanAfter, workspace, focusedNode, focusedCallId, rewindSelectedKey, searchSelectedKey, searchQuery, }: TuiTranscriptViewProps): React.ReactElement;
31
+ export {};
32
+ //# sourceMappingURL=transcript-view.d.ts.map
@@ -0,0 +1,159 @@
1
+ /** Pure Session-event to semantic terminal-node projection. */
2
+ import { type SessionEvent, type TodoItem, type ToolCallView, type ToolDefinition, type ToolResultView } from './host.ts';
3
+ /** Maximum child rows mounted inside one compact structured transcript block. */
4
+ export declare const STRUCTURED_CHILD_LIMIT = 6;
5
+ /** Terminal color/semantic class for one projected text node. */
6
+ type TranscriptTone = 'user' | 'assistant' | 'reasoning' | 'status' | 'error';
7
+ /** Immutable terminal projection of one durable non-tool conversation fact. */
8
+ export interface TranscriptTextNode {
9
+ /** Node discriminant. */
10
+ kind: 'text';
11
+ /** Stable React identity derived from Session coordinates. */
12
+ key: string;
13
+ /** Semantic presentation class. */
14
+ tone: TranscriptTone;
15
+ /** Short row heading. */
16
+ label: string;
17
+ /** Terminal-safe display body. */
18
+ text: string;
19
+ /** Elapsed reasoning stream time for a completed Thinking block. */
20
+ durationMs?: number | undefined;
21
+ /** Internal first reasoning event timestamp used while folding a stream. */
22
+ reasoningStartedAt?: number | undefined;
23
+ }
24
+ /** One paired tool call and result, with tool-owned render intents when available. */
25
+ export interface TranscriptToolNode {
26
+ /** Node discriminant. */
27
+ kind: 'tool';
28
+ /** Stable React identity derived from the call id. */
29
+ key: string;
30
+ /** Durable call identity. */
31
+ callId: string;
32
+ /** Registered tool name, or `unknown` for an unpaired result. */
33
+ name: string;
34
+ /** Parsed call arguments when valid JSON, otherwise the original string. */
35
+ args: unknown;
36
+ /** Raw model-produced argument string. */
37
+ rawArguments: string;
38
+ /** Current durable lifecycle state. */
39
+ state: 'queued' | 'running' | 'success' | 'error' | 'cancelled';
40
+ /** Tool-owned pending presentation, with a generic fallback always supplied. */
41
+ callView: ToolCallView;
42
+ /** Tool-owned completed presentation, when one was produced. */
43
+ resultView?: ToolResultView | undefined;
44
+ /** Terminal-safe model-facing result fallback. */
45
+ output?: string | undefined;
46
+ /** Internal failure code when the result event carries one. */
47
+ errorCode?: string | undefined;
48
+ /** Durable call and result timestamps used for terminal duration summaries. */
49
+ startedAt?: number | undefined;
50
+ endedAt?: number | undefined;
51
+ /** Service-owned delegation lifecycle attached to this parent tool call. */
52
+ delegation?: TranscriptDelegation | undefined;
53
+ }
54
+ /** Durable subagent lifecycle attached to one parent tool call. */
55
+ interface TranscriptDelegation {
56
+ /** Service-owned run identity. */
57
+ runId: string;
58
+ /** Published child identity. */
59
+ childId: string;
60
+ /** Provider that established the child. */
61
+ provider: string;
62
+ /** Model-supplied short task label. */
63
+ label?: string | undefined;
64
+ /** Whether the child has an in-process Agent. */
65
+ local: boolean;
66
+ /** Start event timestamp. */
67
+ startedAt: number;
68
+ /** Terminal event timestamp, when settled. */
69
+ endedAt?: number | undefined;
70
+ /** Terminal child reason, when settled. */
71
+ stopReason?: string | undefined;
72
+ /** Terminal-safe final assistant outcome. */
73
+ outcome?: string | undefined;
74
+ }
75
+ /** Latest durable todo snapshot rendered as a checklist block. */
76
+ export interface TranscriptTodoNode {
77
+ /** Node discriminant. */
78
+ kind: 'todo';
79
+ /** Stable identity for the latest snapshot. */
80
+ key: 'todo:latest';
81
+ /** Whole-list todo snapshot. */
82
+ todos: readonly TodoItem[];
83
+ }
84
+ /** Durable compaction lifecycle marker replacing a hidden history range. */
85
+ export interface TranscriptCompactionNode {
86
+ /** Node discriminant. */
87
+ kind: 'compaction';
88
+ /** Stable identity derived from the compaction transaction. */
89
+ key: string;
90
+ /** Durable compaction transaction identity. */
91
+ compactionId: string;
92
+ /** Human command that initiated the compaction, when present. */
93
+ sourceCommandId?: string | undefined;
94
+ /** Current durable lifecycle state. */
95
+ state: 'running' | 'success' | 'failure';
96
+ /** Terminal-safe summary text, when summarization committed. */
97
+ summary?: string | undefined;
98
+ /** Number of surface items shadowed by the replacement. */
99
+ shadowedItemCount: number;
100
+ /** Estimated token count of the shadowed content. */
101
+ shadowedTokenCount: number;
102
+ /** Surface boundary represented by the replacement. */
103
+ shadowedRange?: {
104
+ start: number;
105
+ end: number;
106
+ } | undefined;
107
+ /** Terminal-safe failure text, when the transaction did not commit. */
108
+ error?: string | undefined;
109
+ }
110
+ /** One semantic exploration run or authoritative scheduler group. */
111
+ export interface TranscriptToolGroupNode {
112
+ /** Node discriminant. */
113
+ kind: 'tool-group';
114
+ /** Stable identity derived from the first and last calls. */
115
+ key: string;
116
+ /** Tool nodes retained in chronological order. */
117
+ tools: readonly TranscriptToolNode[];
118
+ /** Group authority and presentation category. */
119
+ activity: 'explore' | 'parallel' | 'exclusive';
120
+ /** Whether every authoritative member is known. */
121
+ closed: boolean;
122
+ }
123
+ /** Semantic terminal transcript node. */
124
+ export type TranscriptNode = TranscriptTextNode | TranscriptToolNode | TranscriptTodoNode | TranscriptToolGroupNode | TranscriptCompactionNode;
125
+ /** Resolve the definition visible to this TUI-owned Agent. */
126
+ export type ToolDefinitionResolver = (name: string) => ToolDefinition | undefined;
127
+ /**
128
+ * Identify a tool whose provider-owned presentation is read/search activity.
129
+ * @param node - folded tool lifecycle node.
130
+ * @returns whether the node belongs to the Explore semantic category.
131
+ */
132
+ export declare function isExplorationTool(node: TranscriptToolNode): boolean;
133
+ /**
134
+ * Fold a complete ordered event prefix into stable semantic transcript nodes.
135
+ * Assistant completion replaces streaming output, and a result updates its
136
+ * `callId`-paired tool node instead of appending a second log row.
137
+ * @param events - ordered durable Session-event prefix.
138
+ * @param resolveTool - optional Agent-scoped tool-definition lookup for render intents.
139
+ * @returns immutable terminal nodes in display order.
140
+ */
141
+ export declare function foldTranscript(events: readonly SessionEvent[], resolveTool?: ToolDefinitionResolver): readonly TranscriptNode[];
142
+ /** Append-oriented, Session-local semantic transcript projection. */
143
+ export declare class TuiTranscriptProjectionCache {
144
+ private state;
145
+ private resolver;
146
+ private eventCount;
147
+ private lastEvent;
148
+ /** Drop all process-local fold state before a Session lifecycle replacement. */
149
+ reset(): void;
150
+ /**
151
+ * Project an ordered durable event prefix, processing only a verified append suffix when possible.
152
+ * @param events - complete current Session-event prefix.
153
+ * @param resolveTool - exact Agent-scoped tool-definition lookup.
154
+ * @returns immutable semantic nodes in durable display order.
155
+ */
156
+ update(events: readonly SessionEvent[], resolveTool?: ToolDefinitionResolver): readonly TranscriptNode[];
157
+ }
158
+ export {};
159
+ //# sourceMappingURL=transcript.d.ts.map
@@ -0,0 +1,211 @@
1
+ /** Line-aware transcript selection for the fixed-height terminal viewport. */
2
+ import { type TranscriptNode } from './transcript.ts';
3
+ /** One transcript node plus the exact text selected for this terminal frame. */
4
+ export interface TranscriptWindowEntry {
5
+ /** Durable semantic node. */
6
+ node: TranscriptNode;
7
+ /** Terminal projection for text nodes; absent for tool nodes. */
8
+ text?: string | undefined;
9
+ }
10
+ /** One navigable transcript frame and its position in the complete projection. */
11
+ export interface TranscriptWindow {
12
+ /** Entries mounted in this frame. */
13
+ entries: readonly TranscriptWindowEntry[];
14
+ /** First mounted node index, or `-1` for an empty transcript. */
15
+ startIndex: number;
16
+ /** Last mounted node index, or `-1` for an empty transcript. */
17
+ endIndex: number;
18
+ /** Whether complete transcript content exists above this frame. */
19
+ hasOlder: boolean;
20
+ /** Whether complete transcript content exists below this frame. */
21
+ hasNewer: boolean;
22
+ }
23
+ /** Stable process-local position for a historical transcript viewport. */
24
+ export interface TuiTranscriptViewportAnchor {
25
+ /** Semantic node key at the top of the viewport. */
26
+ key: string;
27
+ /** Previous semantic index used only when replacement removes the key. */
28
+ index: number;
29
+ }
30
+ /** A visible transcript frame plus bounded blocks mounted as render overscan. */
31
+ export interface TuiTranscriptVirtualWindow extends TranscriptWindow {
32
+ /** Nearby blocks mounted before the visible frame without consuming rows. */
33
+ overscanBefore: readonly TranscriptWindowEntry[];
34
+ /** Nearby blocks mounted after the visible frame without consuming rows. */
35
+ overscanAfter: readonly TranscriptWindowEntry[];
36
+ /** First mounted semantic index including overscan, or `-1` when empty. */
37
+ mountedStartIndex: number;
38
+ /** Last mounted semantic index including overscan, or `-1` when empty. */
39
+ mountedEndIndex: number;
40
+ }
41
+ /** Diagnostic counters for one viewport index and terminal width. */
42
+ export interface TuiTranscriptViewportStats {
43
+ /** Nodes with exact physical heights measured at the current width. */
44
+ measuredBlocks: number;
45
+ /** Nodes still represented by conservative height estimates. */
46
+ estimatedBlocks: number;
47
+ /** Current prefix-index row total, including estimates. */
48
+ indexedRows: number;
49
+ }
50
+ /**
51
+ * Wrap terminal text by grapheme display cells without splitting a grapheme cluster.
52
+ * @param text - logical terminal text to wrap.
53
+ * @param width - available terminal cells per physical row.
54
+ * @returns wrapped physical display rows.
55
+ */
56
+ export declare function terminalWrappedLines(text: string, width: number): string[];
57
+ /**
58
+ * Select the newest complete transcript blocks that fit the available terminal rows.
59
+ * A final oversized text block retains its label and a marked tail instead of letting
60
+ * Ink flex-shrink unrelated tool cards into border fragments.
61
+ * @param nodes - complete semantic transcript.
62
+ * @param maxRows - physical terminal rows available to the transcript region.
63
+ * @param columns - physical columns available inside the transcript padding.
64
+ * @returns display entries in chronological order.
65
+ */
66
+ export declare function selectTranscriptWindow(nodes: readonly TranscriptNode[], maxRows: number, columns: number): readonly TranscriptWindowEntry[];
67
+ /**
68
+ * Select a transcript page from a stable semantic top anchor, or the live tail when absent.
69
+ * @param nodes - complete semantic transcript.
70
+ * @param maxRows - physical rows available to the transcript region.
71
+ * @param columns - physical columns available inside transcript padding.
72
+ * @param startKey - historical page's first node key; absent follows the live tail.
73
+ * @param startIndexHint - previous index used only when node replacement removes `startKey`.
74
+ * @returns mounted entries and navigation boundaries.
75
+ */
76
+ export declare function selectTranscriptPage(nodes: readonly TranscriptNode[], maxRows: number, columns: number, startKey?: string, startIndexHint?: number): TranscriptWindow;
77
+ /**
78
+ * Resolve the preceding page's stable top anchor without skipping a complete node.
79
+ * @param nodes - complete semantic transcript.
80
+ * @param currentStart - first node index in the current frame.
81
+ * @param maxRows - physical rows available to one frame.
82
+ * @param columns - physical columns available inside transcript padding.
83
+ * @returns preceding frame's first node key, or the oldest key.
84
+ */
85
+ export declare function previousTranscriptPageAnchor(nodes: readonly TranscriptNode[], currentStart: number, maxRows: number, columns: number): string | undefined;
86
+ /**
87
+ * Agent-local physical-row index with node-identity and width-aware measurement caches.
88
+ * Unmounted blocks retain conservative estimates until a viewport operation measures them.
89
+ */
90
+ export declare class TuiTranscriptViewportIndex {
91
+ private readonly overscanBlocks;
92
+ private readonly measurementCache;
93
+ private nodes;
94
+ private width;
95
+ private heights;
96
+ private exact;
97
+ private rows;
98
+ private keyIndices;
99
+ private nodeIndices;
100
+ constructor(overscanBlocks?: number);
101
+ /**
102
+ * Reconcile the complete semantic projection and current terminal width.
103
+ * @param nodes - complete immutable semantic projection.
104
+ * @param columns - available terminal cells inside transcript padding.
105
+ */
106
+ update(nodes: readonly TranscriptNode[], columns: number): void;
107
+ /**
108
+ * Select one visible frame and its bounded render overscan.
109
+ * @param maxRows - physical-row budget for visible transcript content.
110
+ * @param anchor - historical semantic top anchor; absent follows the live tail.
111
+ * @returns visible entries, boundaries, and nearby mounted blocks.
112
+ */
113
+ page(maxRows: number, anchor?: TuiTranscriptViewportAnchor): TuiTranscriptVirtualWindow;
114
+ /**
115
+ * Resolve a stable key, falling back to the nearest surviving semantic index.
116
+ * @param key - preferred semantic node key.
117
+ * @param indexHint - previous index used when replacement removes the key.
118
+ * @returns replacement-safe anchor, or undefined for an empty projection.
119
+ */
120
+ anchor(key: string, indexHint: number): TuiTranscriptViewportAnchor | undefined;
121
+ /**
122
+ * Resolve the previous complete physical-row page.
123
+ * @param currentStart - first semantic index in the current frame.
124
+ * @param maxRows - physical-row budget for the preceding frame.
125
+ * @returns preceding semantic anchor, or undefined for an empty projection.
126
+ */
127
+ previousAnchor(currentStart: number, maxRows: number): TuiTranscriptViewportAnchor | undefined;
128
+ /**
129
+ * Read the exact-or-estimated physical-row prefix for a semantic block.
130
+ * @param index - semantic block index.
131
+ * @returns indexed rows before that block.
132
+ */
133
+ physicalRowAt(index: number): number;
134
+ /**
135
+ * Locate the semantic block covering one indexed physical row.
136
+ * @param row - zero-based exact-or-estimated physical row.
137
+ * @returns semantic block index, or `-1` for an empty projection.
138
+ */
139
+ indexAtPhysicalRow(row: number): number;
140
+ /**
141
+ * Perform an O(1) semantic-key lookup for navigation and replacement recovery.
142
+ * @param key - semantic node key.
143
+ * @returns semantic index, or `-1` when absent.
144
+ */
145
+ indexOfKey(key: string): number;
146
+ /**
147
+ * Perform an O(1) immutable-node lookup for focus navigation.
148
+ * @param node - exact node reference from the current projection.
149
+ * @returns semantic index, or `-1` when absent.
150
+ */
151
+ indexOfNode(node: TranscriptNode): number;
152
+ /**
153
+ * Read current measurement coverage for benchmark and regression evidence.
154
+ * @returns exact/estimated block counts and the indexed physical-row total.
155
+ */
156
+ stats(): TuiTranscriptViewportStats;
157
+ private resolveIndex;
158
+ private anchorAt;
159
+ private measure;
160
+ private measuredEntry;
161
+ private overscanEntry;
162
+ private selectFromStart;
163
+ private selectTail;
164
+ private virtualize;
165
+ }
166
+ /** One navigation authority for tail, paging, focus, search, mouse, and boundary jumps. */
167
+ export declare class TuiTranscriptScrollController {
168
+ private readonly viewport;
169
+ constructor(viewport: TuiTranscriptViewportIndex);
170
+ /**
171
+ * Follow the live transcript tail.
172
+ * @returns the absent-anchor representation of tail-follow mode.
173
+ */
174
+ latest(): TuiTranscriptViewportAnchor | undefined;
175
+ /**
176
+ * Anchor the oldest surviving semantic block.
177
+ * @returns oldest anchor, or undefined for an empty projection.
178
+ */
179
+ oldest(): TuiTranscriptViewportAnchor | undefined;
180
+ /**
181
+ * Anchor one key with replacement-safe fallback.
182
+ * @param key - preferred semantic node key.
183
+ * @param indexHint - previous index used when replacement removes the key.
184
+ * @returns resolved anchor, or undefined for an empty projection.
185
+ */
186
+ reveal(key: string, indexHint: number): TuiTranscriptViewportAnchor | undefined;
187
+ /**
188
+ * Move backward by one physical-row page.
189
+ * @param page - current visible frame.
190
+ * @param maxRows - physical-row budget for one frame.
191
+ * @returns preceding anchor, or undefined for an empty projection.
192
+ */
193
+ previous(page: TranscriptWindow, maxRows: number): TuiTranscriptViewportAnchor | undefined;
194
+ /**
195
+ * Move forward by one physical-row page, returning to tail-follow on the final page.
196
+ * @param page - current visible frame.
197
+ * @param maxRows - physical-row budget for one frame.
198
+ * @returns next historical anchor, or undefined for tail-follow mode.
199
+ */
200
+ next(page: TranscriptWindow, maxRows: number): TuiTranscriptViewportAnchor | undefined;
201
+ /**
202
+ * Preserve the current anchor when a target is visible, otherwise reveal it.
203
+ * @param current - current historical anchor, or undefined for tail-follow.
204
+ * @param page - current visible frame.
205
+ * @param key - target semantic key.
206
+ * @param indexHint - target index from the current projection.
207
+ * @returns unchanged current state or a replacement-safe target anchor.
208
+ */
209
+ ensureVisible(current: TuiTranscriptViewportAnchor | undefined, page: TranscriptWindow, key: string, indexHint: number): TuiTranscriptViewportAnchor | undefined;
210
+ }
211
+ //# sourceMappingURL=viewport.d.ts.map
@@ -0,0 +1,28 @@
1
+ /** Bounded native-TUI background-work panel. */
2
+ import React from 'react';
3
+ import type { TuiWorkItemView, TuiWorkSnapshot } from './work.ts';
4
+ /**
5
+ * Format one work duration from authoritative timestamps or durable subagent timing.
6
+ * @param item - projected work row.
7
+ * @param now - current local clock used only for a still-live interval.
8
+ * @returns compact elapsed duration, or `--` when the source exposes none.
9
+ */
10
+ export declare function formatTuiWorkElapsed(item: TuiWorkItemView, now: number): string;
11
+ /**
12
+ * Format the owning Agent fact carried by one work row.
13
+ * @param item - projected work row.
14
+ * @returns the owner Session id, or an explicit absence marker.
15
+ */
16
+ export declare function formatTuiWorkOwner(item: TuiWorkItemView): string;
17
+ /**
18
+ * Render the selectable slice of one work snapshot.
19
+ * @param props - snapshot, selection, dimensions, and current clock.
20
+ * @returns one stable-height panel.
21
+ */
22
+ export declare function TuiWorkPanel(props: {
23
+ readonly snapshot: TuiWorkSnapshot;
24
+ readonly selectedIndex: number;
25
+ readonly maxRows: number;
26
+ readonly now: number;
27
+ }): React.ReactElement;
28
+ //# sourceMappingURL=work-panel.d.ts.map