@agi-fans/dsh-tui 0.1.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/LICENSE +21 -0
- package/README.md +13 -0
- package/lib/autocomplete.d.ts +80 -0
- package/lib/autocomplete.js +320 -0
- package/lib/autocomplete.js.map +1 -0
- package/lib/box.d.ts +79 -0
- package/lib/box.js +276 -0
- package/lib/box.js.map +1 -0
- package/lib/clipboard.d.ts +19 -0
- package/lib/clipboard.js +77 -0
- package/lib/clipboard.js.map +1 -0
- package/lib/command-integrations.d.ts +10 -0
- package/lib/command-integrations.js +49 -0
- package/lib/command-integrations.js.map +1 -0
- package/lib/command-mode.d.ts +5 -0
- package/lib/command-mode.js +73 -0
- package/lib/command-mode.js.map +1 -0
- package/lib/command-model.d.ts +5 -0
- package/lib/command-model.js +87 -0
- package/lib/command-model.js.map +1 -0
- package/lib/command-output.d.ts +6 -0
- package/lib/command-output.js +33 -0
- package/lib/command-output.js.map +1 -0
- package/lib/command-queue.d.ts +5 -0
- package/lib/command-queue.js +62 -0
- package/lib/command-queue.js.map +1 -0
- package/lib/command-registration.d.ts +5 -0
- package/lib/command-registration.js +20 -0
- package/lib/command-registration.js.map +1 -0
- package/lib/command-session.d.ts +5 -0
- package/lib/command-session.js +153 -0
- package/lib/command-session.js.map +1 -0
- package/lib/command-transcript.d.ts +5 -0
- package/lib/command-transcript.js +85 -0
- package/lib/command-transcript.js.map +1 -0
- package/lib/copy-selector.d.ts +52 -0
- package/lib/copy-selector.js +136 -0
- package/lib/copy-selector.js.map +1 -0
- package/lib/copy-targets.d.ts +34 -0
- package/lib/copy-targets.js +170 -0
- package/lib/copy-targets.js.map +1 -0
- package/lib/definition.d.ts +171 -0
- package/lib/definition.js +14 -0
- package/lib/definition.js.map +1 -0
- package/lib/editor.d.ts +66 -0
- package/lib/editor.js +365 -0
- package/lib/editor.js.map +1 -0
- package/lib/event-views.d.ts +188 -0
- package/lib/event-views.js +678 -0
- package/lib/event-views.js.map +1 -0
- package/lib/external-editor.d.ts +2 -0
- package/lib/external-editor.js +31 -0
- package/lib/external-editor.js.map +1 -0
- package/lib/history-search.d.ts +61 -0
- package/lib/history-search.js +239 -0
- package/lib/history-search.js.map +1 -0
- package/lib/history-store.d.ts +8 -0
- package/lib/history-store.js +36 -0
- package/lib/history-store.js.map +1 -0
- package/lib/hotkeys.d.ts +14 -0
- package/lib/hotkeys.js +115 -0
- package/lib/hotkeys.js.map +1 -0
- package/lib/human-interaction.d.ts +5 -0
- package/lib/human-interaction.js +8 -0
- package/lib/human-interaction.js.map +1 -0
- package/lib/image-paste.d.ts +21 -0
- package/lib/image-paste.js +277 -0
- package/lib/image-paste.js.map +1 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/interaction-adapter.d.ts +18 -0
- package/lib/interaction-adapter.js +93 -0
- package/lib/interaction-adapter.js.map +1 -0
- package/lib/keybindings-config.d.ts +5 -0
- package/lib/keybindings-config.js +28 -0
- package/lib/keybindings-config.js.map +1 -0
- package/lib/keys.d.ts +59 -0
- package/lib/keys.js +263 -0
- package/lib/keys.js.map +1 -0
- package/lib/markdown.d.ts +13 -0
- package/lib/markdown.js +453 -0
- package/lib/markdown.js.map +1 -0
- package/lib/path-complete.d.ts +85 -0
- package/lib/path-complete.js +231 -0
- package/lib/path-complete.js.map +1 -0
- package/lib/path-mentions.d.ts +4 -0
- package/lib/path-mentions.js +50 -0
- package/lib/path-mentions.js.map +1 -0
- package/lib/project-context.d.ts +13 -0
- package/lib/project-context.js +52 -0
- package/lib/project-context.js.map +1 -0
- package/lib/project-file-search.d.ts +25 -0
- package/lib/project-file-search.js +207 -0
- package/lib/project-file-search.js.map +1 -0
- package/lib/prompt-selector.d.ts +56 -0
- package/lib/prompt-selector.js +297 -0
- package/lib/prompt-selector.js.map +1 -0
- package/lib/provider-local.d.ts +115 -0
- package/lib/provider-local.js +1760 -0
- package/lib/provider-local.js.map +1 -0
- package/lib/pwd.d.ts +13 -0
- package/lib/pwd.js +14 -0
- package/lib/pwd.js.map +1 -0
- package/lib/relative-time.d.ts +2 -0
- package/lib/relative-time.js +11 -0
- package/lib/relative-time.js.map +1 -0
- package/lib/renderer.d.ts +112 -0
- package/lib/renderer.js +181 -0
- package/lib/renderer.js.map +1 -0
- package/lib/runner.d.ts +9 -0
- package/lib/runner.js +94 -0
- package/lib/runner.js.map +1 -0
- package/lib/session-controller.d.ts +92 -0
- package/lib/session-controller.js +571 -0
- package/lib/session-controller.js.map +1 -0
- package/lib/session-runtime.d.ts +16 -0
- package/lib/session-runtime.js +17 -0
- package/lib/session-runtime.js.map +1 -0
- package/lib/settings-list.d.ts +67 -0
- package/lib/settings-list.js +380 -0
- package/lib/settings-list.js.map +1 -0
- package/lib/status-config.d.ts +32 -0
- package/lib/status-config.js +52 -0
- package/lib/status-config.js.map +1 -0
- package/lib/status-line.d.ts +41 -0
- package/lib/status-line.js +351 -0
- package/lib/status-line.js.map +1 -0
- package/lib/style.d.ts +22 -0
- package/lib/style.js +23 -0
- package/lib/style.js.map +1 -0
- package/lib/theme.d.ts +83 -0
- package/lib/theme.js +317 -0
- package/lib/theme.js.map +1 -0
- package/lib/tool-presentation.d.ts +20 -0
- package/lib/tool-presentation.js +79 -0
- package/lib/tool-presentation.js.map +1 -0
- package/lib/tool-renderers.d.ts +21 -0
- package/lib/tool-renderers.js +133 -0
- package/lib/tool-renderers.js.map +1 -0
- package/lib/tools-list.d.ts +14 -0
- package/lib/tools-list.js +61 -0
- package/lib/tools-list.js.map +1 -0
- package/lib/transcript-export.d.ts +4 -0
- package/lib/transcript-export.js +66 -0
- package/lib/transcript-export.js.map +1 -0
- package/lib/tui-settings.d.ts +20 -0
- package/lib/tui-settings.js +23 -0
- package/lib/tui-settings.js.map +1 -0
- package/lib/welcome-tips.d.ts +10 -0
- package/lib/welcome-tips.js +36 -0
- package/lib/welcome-tips.js.map +1 -0
- package/lib/width.d.ts +54 -0
- package/lib/width.js +323 -0
- package/lib/width.js.map +1 -0
- package/package.json +119 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Interactive terminal selector used by resume, approval, and user questions. */
|
|
2
|
+
import type { TuiPrompt } from './definition.ts';
|
|
3
|
+
import { type Theme } from './theme.ts';
|
|
4
|
+
/** Presentation state owned by the terminal while a human prompt is active. */
|
|
5
|
+
export interface PromptSelectorState {
|
|
6
|
+
request: TuiPrompt;
|
|
7
|
+
selected: number;
|
|
8
|
+
checked: ReadonlySet<number>;
|
|
9
|
+
/** Requested first document row for full-screen review surfaces. */
|
|
10
|
+
documentScroll?: number;
|
|
11
|
+
/** Whether a rejected plan is collecting optional revision feedback. */
|
|
12
|
+
feedback?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PromptSelectorFrame {
|
|
15
|
+
lines: string[];
|
|
16
|
+
cursor: {
|
|
17
|
+
row: number;
|
|
18
|
+
column: number;
|
|
19
|
+
};
|
|
20
|
+
editor?: {
|
|
21
|
+
start: number;
|
|
22
|
+
rows: number;
|
|
23
|
+
};
|
|
24
|
+
itemRows?: readonly (number | undefined)[];
|
|
25
|
+
document?: {
|
|
26
|
+
start: number;
|
|
27
|
+
maxStart: number;
|
|
28
|
+
pageSize: number;
|
|
29
|
+
};
|
|
30
|
+
cursorVisible?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Maximum option rows retained in the prompt overlay before it windows. */
|
|
33
|
+
export declare const PROMPT_SELECTOR_MAX_VISIBLE = 10;
|
|
34
|
+
type PromptOption = NonNullable<TuiPrompt['options']>[number];
|
|
35
|
+
/** Options matching the current full-screen selector query. */
|
|
36
|
+
export declare function filteredPromptOptions(request: TuiPrompt, query: string): readonly PromptOption[];
|
|
37
|
+
/** Visible option window centered around the selected row. */
|
|
38
|
+
export declare function promptSelectorVisibleRange(count: number, selected: number, maxVisible?: number): {
|
|
39
|
+
start: number;
|
|
40
|
+
end: number;
|
|
41
|
+
};
|
|
42
|
+
/** Render an OMP-style full-height searchable selector with one outer frame. */
|
|
43
|
+
export declare function renderPromptSelectorPage(state: PromptSelectorState, theme: Theme, width: number, height: number, input: string, inputCursor: number, appName: string): PromptSelectorFrame;
|
|
44
|
+
/** Render a bounded, scrollable Markdown plan with fixed review actions. */
|
|
45
|
+
export declare function renderPlanReviewPage(state: PromptSelectorState, theme: Theme, width: number, height: number, input: string, inputCursor: number, appName: string): PromptSelectorFrame;
|
|
46
|
+
/** Render the prompt card and its answer editor as one bottom-of-screen overlay. */
|
|
47
|
+
export declare function renderPromptSelector(state: PromptSelectorState, theme: Theme, width: number, input: string, inputCursor: number, maxVisible?: number): PromptSelectorFrame;
|
|
48
|
+
/** Keep a selected option index within the available prompt options. */
|
|
49
|
+
export declare function movePromptSelection(state: PromptSelectorState, next: number, count?: number): PromptSelectorState;
|
|
50
|
+
/** Toggle the active row for a multi-select prompt. */
|
|
51
|
+
export declare function togglePromptSelection(state: PromptSelectorState): PromptSelectorState;
|
|
52
|
+
/** Resolve the selected labels in stable option order. */
|
|
53
|
+
export declare function selectedPromptAnswer(state: PromptSelectorState): string | null;
|
|
54
|
+
/** Resolve the selected answer after applying a full-screen selector query. */
|
|
55
|
+
export declare function selectedFilteredPromptAnswer(state: PromptSelectorState, query: string): string | null;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/** Interactive terminal selector used by resume, approval, and user questions. */
|
|
2
|
+
import { renderEditor, renderFramedBlock } from "./box.js";
|
|
3
|
+
import { renderMarkdown } from "./markdown.js";
|
|
4
|
+
import { BOX, SYMBOL } from "./theme.js";
|
|
5
|
+
import { padToWidth, truncateToWidth, visibleWidth } from "./width.js";
|
|
6
|
+
/** Maximum option rows retained in the prompt overlay before it windows. */
|
|
7
|
+
export const PROMPT_SELECTOR_MAX_VISIBLE = 10;
|
|
8
|
+
/** Options matching the current full-screen selector query. */
|
|
9
|
+
export function filteredPromptOptions(request, query) {
|
|
10
|
+
const options = request.options ?? [];
|
|
11
|
+
const needle = query.trim().toLocaleLowerCase();
|
|
12
|
+
if (request.filterable !== true || needle === '')
|
|
13
|
+
return options;
|
|
14
|
+
return options.filter((option) => [option.label, option.value, option.preview, option.description, option.badge?.label]
|
|
15
|
+
.some(value => value?.toLocaleLowerCase().includes(needle) === true));
|
|
16
|
+
}
|
|
17
|
+
/** Visible option window centered around the selected row. */
|
|
18
|
+
export function promptSelectorVisibleRange(count, selected, maxVisible = PROMPT_SELECTOR_MAX_VISIBLE) {
|
|
19
|
+
const max = Math.max(1, maxVisible);
|
|
20
|
+
const index = Math.max(0, Math.min(selected, Math.max(0, count - 1)));
|
|
21
|
+
const start = Math.max(0, Math.min(index - Math.floor(max / 2), Math.max(0, count - max)));
|
|
22
|
+
return { start, end: Math.min(count, start + max) };
|
|
23
|
+
}
|
|
24
|
+
function optionRow(option, index, state, theme, width) {
|
|
25
|
+
const active = index === state.selected;
|
|
26
|
+
const cursor = active ? theme.fg('accent', SYMBOL.cursor + ' ') : ' ';
|
|
27
|
+
const marker = state.request.multiSelect === true
|
|
28
|
+
? theme.fg(state.checked.has(index) ? 'success' : 'dim', state.checked.has(index) ? '[x] ' : '[ ] ')
|
|
29
|
+
: '';
|
|
30
|
+
const label = active ? theme.bold(theme.fg('accent', option.label)) : option.label;
|
|
31
|
+
const description = option.description === undefined ? '' : theme.fg('dim', ' — ' + option.description);
|
|
32
|
+
return truncateToWidth(cursor + marker + label + description, Math.max(1, width));
|
|
33
|
+
}
|
|
34
|
+
function fit(text, width) {
|
|
35
|
+
if (width <= 0)
|
|
36
|
+
return '';
|
|
37
|
+
return padToWidth(truncateToWidth(text, width), width);
|
|
38
|
+
}
|
|
39
|
+
function pageBorder(theme, text) {
|
|
40
|
+
return theme.fg('border', text);
|
|
41
|
+
}
|
|
42
|
+
function pageRow(theme, content, width) {
|
|
43
|
+
const inner = Math.max(0, width - 4);
|
|
44
|
+
return pageBorder(theme, BOX.vertical) + ' ' + fit(content, inner) + ' ' + pageBorder(theme, BOX.vertical);
|
|
45
|
+
}
|
|
46
|
+
function pageTop(theme, width, appName) {
|
|
47
|
+
const inner = Math.max(0, width - 2);
|
|
48
|
+
const title = truncateToWidth(` ${appName} `, Math.max(0, inner - 1));
|
|
49
|
+
const fill = Math.max(0, inner - 1 - visibleWidth(title));
|
|
50
|
+
return pageBorder(theme, BOX.topLeft + BOX.horizontal)
|
|
51
|
+
+ theme.fg('muted', title)
|
|
52
|
+
+ pageBorder(theme, BOX.horizontal.repeat(fill) + BOX.topRight);
|
|
53
|
+
}
|
|
54
|
+
function pageDivider(theme, width) {
|
|
55
|
+
return pageBorder(theme, BOX.teeRight + BOX.horizontal.repeat(Math.max(0, width - 2)) + BOX.teeLeft);
|
|
56
|
+
}
|
|
57
|
+
function pageBottom(theme, width) {
|
|
58
|
+
return pageBorder(theme, BOX.bottomLeft + BOX.horizontal.repeat(Math.max(0, width - 2)) + BOX.bottomRight);
|
|
59
|
+
}
|
|
60
|
+
function optionBadge(option, theme) {
|
|
61
|
+
const badge = option.badge;
|
|
62
|
+
if (badge === undefined)
|
|
63
|
+
return '';
|
|
64
|
+
const icon = badge.tone === 'success'
|
|
65
|
+
? SYMBOL.success
|
|
66
|
+
: badge.tone === 'error'
|
|
67
|
+
? SYMBOL.error
|
|
68
|
+
: badge.tone === 'warning'
|
|
69
|
+
? SYMBOL.warning
|
|
70
|
+
: SYMBOL.done;
|
|
71
|
+
return theme.fg(badge.tone === 'muted' ? 'dim' : badge.tone, `${icon} ${badge.label}`);
|
|
72
|
+
}
|
|
73
|
+
/** Render an OMP-style full-height searchable selector with one outer frame. */
|
|
74
|
+
export function renderPromptSelectorPage(state, theme, width, height, input, inputCursor, appName) {
|
|
75
|
+
const pageHeight = Math.max(1, height);
|
|
76
|
+
if (pageHeight < 10 || width < 16) {
|
|
77
|
+
return renderPromptSelector(state, theme, width, input, inputCursor, Math.max(1, pageHeight - 8));
|
|
78
|
+
}
|
|
79
|
+
const options = filteredPromptOptions(state.request, input);
|
|
80
|
+
const selected = Math.max(0, Math.min(state.selected, Math.max(0, options.length - 1)));
|
|
81
|
+
const fixedRows = 11;
|
|
82
|
+
const visibleCount = Math.max(1, Math.floor((pageHeight - fixedRows) / 4));
|
|
83
|
+
const { start, end } = promptSelectorVisibleRange(options.length, selected, visibleCount);
|
|
84
|
+
const itemRows = Array.from({ length: pageHeight });
|
|
85
|
+
const detail = state.request.detail === undefined || state.request.detail === ''
|
|
86
|
+
? ''
|
|
87
|
+
: ' ' + theme.fg('muted', `(${state.request.detail})`);
|
|
88
|
+
const heading = theme.bold(state.request.title) + detail;
|
|
89
|
+
const lines = [
|
|
90
|
+
pageTop(theme, width, appName),
|
|
91
|
+
pageRow(theme, '', width),
|
|
92
|
+
pageRow(theme, ' ' + heading, width),
|
|
93
|
+
pageRow(theme, '', width),
|
|
94
|
+
pageDivider(theme, width),
|
|
95
|
+
];
|
|
96
|
+
const searchPrefix = theme.fg('dim', '> ');
|
|
97
|
+
const searchText = truncateToWidth(input, Math.max(1, width - 8));
|
|
98
|
+
const searchRow = lines.length;
|
|
99
|
+
lines.push(pageRow(theme, searchPrefix + searchText, width), pageRow(theme, '', width));
|
|
100
|
+
if (options.length === 0) {
|
|
101
|
+
const empty = input === '' ? 'No sessions found.' : `No sessions match “${input}”.`;
|
|
102
|
+
lines.push(pageRow(theme, ' ' + theme.fg('muted', empty), width));
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
for (let index = start; index < end; index += 1) {
|
|
106
|
+
const option = options[index];
|
|
107
|
+
if (option === undefined)
|
|
108
|
+
continue;
|
|
109
|
+
const active = index === selected;
|
|
110
|
+
const marker = active ? theme.fg('accent', SYMBOL.cursor + ' ') : ' ';
|
|
111
|
+
const label = active ? theme.bold(option.label) : option.label;
|
|
112
|
+
const row = lines.length;
|
|
113
|
+
itemRows[row] = index;
|
|
114
|
+
itemRows[row + 1] = index;
|
|
115
|
+
itemRows[row + 2] = index;
|
|
116
|
+
lines.push(pageRow(theme, marker + label, width));
|
|
117
|
+
lines.push(pageRow(theme, ' ' + theme.fg('dim', option.preview ?? ''), width));
|
|
118
|
+
const badge = optionBadge(option, theme);
|
|
119
|
+
const description = option.description === undefined ? '' : theme.fg('dim', option.description);
|
|
120
|
+
const separator = description !== '' && badge !== '' ? theme.fg('dim', ' · ') : '';
|
|
121
|
+
lines.push(pageRow(theme, ' ' + description + separator + badge, width), pageRow(theme, '', width));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const footerRows = 4;
|
|
125
|
+
const targetBeforeFooter = Math.max(0, pageHeight - footerRows);
|
|
126
|
+
if (lines.length > targetBeforeFooter)
|
|
127
|
+
lines.length = targetBeforeFooter;
|
|
128
|
+
while (lines.length < targetBeforeFooter)
|
|
129
|
+
lines.push(pageRow(theme, '', width));
|
|
130
|
+
const position = options.length === 0 ? '' : ` · ${selected + 1}/${options.length}`;
|
|
131
|
+
const hint = `[type to filter · ↑↓ navigate · Enter select · Esc cancel${position}]`;
|
|
132
|
+
lines.push(pageRow(theme, '', width), pageRow(theme, theme.fg('dim', hint), width), pageRow(theme, '', width), pageBottom(theme, width));
|
|
133
|
+
const cursorColumn = Math.min(Math.max(1, width - 3), 4 + visibleWidth(input.slice(0, inputCursor)));
|
|
134
|
+
return {
|
|
135
|
+
lines,
|
|
136
|
+
cursor: { row: searchRow, column: cursorColumn },
|
|
137
|
+
editor: { start: searchRow, rows: 1 },
|
|
138
|
+
itemRows,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** Render a bounded, scrollable Markdown plan with fixed review actions. */
|
|
142
|
+
export function renderPlanReviewPage(state, theme, width, height, input, inputCursor, appName) {
|
|
143
|
+
const pageHeight = Math.max(1, height);
|
|
144
|
+
if (pageHeight < 10 || width < 24) {
|
|
145
|
+
return renderPromptSelector(state, theme, width, input, inputCursor, Math.max(1, pageHeight - 8));
|
|
146
|
+
}
|
|
147
|
+
const feedback = state.feedback === true;
|
|
148
|
+
const footerRows = feedback ? 5 : 4;
|
|
149
|
+
const bodyRows = Math.max(1, pageHeight - 5 - footerRows);
|
|
150
|
+
const markdownWidth = Math.max(1, width - 6);
|
|
151
|
+
const document = renderMarkdown(state.request.detail ?? '', theme, markdownWidth);
|
|
152
|
+
const maxStart = Math.max(0, document.length - bodyRows);
|
|
153
|
+
const start = Math.max(0, Math.min(state.documentScroll ?? 0, maxStart));
|
|
154
|
+
const visible = document.slice(start, start + bodyRows);
|
|
155
|
+
while (visible.length < bodyRows)
|
|
156
|
+
visible.push('');
|
|
157
|
+
if (start > 0)
|
|
158
|
+
visible[0] = theme.fg('dim', `… ↑ ${start} earlier plan lines`);
|
|
159
|
+
if (start + bodyRows < document.length) {
|
|
160
|
+
visible[Math.max(0, visible.length - 1)] = theme.fg('dim', `… ↓ ${document.length - start - bodyRows} later plan lines`);
|
|
161
|
+
}
|
|
162
|
+
const lines = [
|
|
163
|
+
pageTop(theme, width, `${appName} · ${state.request.title}`),
|
|
164
|
+
pageRow(theme, '', width),
|
|
165
|
+
pageRow(theme, ' ' + theme.bold(state.request.question), width),
|
|
166
|
+
pageRow(theme, '', width),
|
|
167
|
+
pageDivider(theme, width),
|
|
168
|
+
...visible.map(line => pageRow(theme, ' ' + line, width)),
|
|
169
|
+
pageDivider(theme, width),
|
|
170
|
+
];
|
|
171
|
+
let cursor = { row: Math.max(0, lines.length - 1), column: 1 };
|
|
172
|
+
let editor;
|
|
173
|
+
if (feedback) {
|
|
174
|
+
lines.push(pageRow(theme, ' ' + theme.bold('Revision feedback') + theme.fg('dim', ' · optional'), width));
|
|
175
|
+
const prefix = theme.fg('accent', '> ');
|
|
176
|
+
const available = Math.max(1, width - 8);
|
|
177
|
+
const displayInput = input.replace(/\r?\n/gu, ' ↵ ');
|
|
178
|
+
const displayBeforeCursor = input.slice(0, inputCursor).replace(/\r?\n/gu, ' ↵ ');
|
|
179
|
+
const value = truncateToWidth(displayInput, available);
|
|
180
|
+
const inputRow = lines.length;
|
|
181
|
+
lines.push(pageRow(theme, ' ' + prefix + value, width));
|
|
182
|
+
lines.push(pageRow(theme, theme.fg('dim', '[Enter send feedback · empty Enter keeps planning · Esc back · Ctrl+C cancel]'), width));
|
|
183
|
+
lines.push(pageBottom(theme, width));
|
|
184
|
+
cursor = {
|
|
185
|
+
row: inputRow,
|
|
186
|
+
column: Math.min(Math.max(1, width - 3), 5 + visibleWidth(displayBeforeCursor)),
|
|
187
|
+
};
|
|
188
|
+
editor = { start: inputRow, rows: 1 };
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
const options = state.request.options ?? [];
|
|
192
|
+
const actions = options.map((option, index) => {
|
|
193
|
+
const label = `[ ${option.label} ]`;
|
|
194
|
+
return index === state.selected
|
|
195
|
+
? theme.bold(theme.fg('accent', label))
|
|
196
|
+
: theme.fg('muted', label);
|
|
197
|
+
}).join(theme.fg('dim', ' '));
|
|
198
|
+
lines.push(pageRow(theme, ' ' + actions, width));
|
|
199
|
+
lines.push(pageRow(theme, theme.fg('dim', '[PgUp/PgDn scroll · Tab choose · Enter select · Esc cancel]'), width));
|
|
200
|
+
lines.push(pageBottom(theme, width));
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
lines,
|
|
204
|
+
cursor,
|
|
205
|
+
...(editor === undefined ? {} : { editor }),
|
|
206
|
+
document: { start, maxStart, pageSize: Math.max(1, bodyRows - 1) },
|
|
207
|
+
cursorVisible: feedback,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/** Render the prompt card and its answer editor as one bottom-of-screen overlay. */
|
|
211
|
+
export function renderPromptSelector(state, theme, width, input, inputCursor, maxVisible = PROMPT_SELECTOR_MAX_VISIBLE) {
|
|
212
|
+
const options = state.request.options ?? [];
|
|
213
|
+
const contentWidth = Math.max(1, width - 4);
|
|
214
|
+
const body = [state.request.question];
|
|
215
|
+
if (state.request.detail !== undefined && state.request.detail !== '')
|
|
216
|
+
body.push('', state.request.detail);
|
|
217
|
+
if (options.length > 0) {
|
|
218
|
+
const { start, end } = promptSelectorVisibleRange(options.length, state.selected, maxVisible);
|
|
219
|
+
body.push('', ...options.slice(start, end).map((option, offset) => optionRow(option, start + offset, state, theme, contentWidth)));
|
|
220
|
+
if (options.length > maxVisible) {
|
|
221
|
+
body.push(theme.fg('dim', ` ${state.selected + 1}/${options.length} · scroll for more`));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const submit = state.request.submitLabel?.trim() || (state.request.multiSelect === true ? 'confirm' : 'select');
|
|
225
|
+
const navigation = options.length === 0
|
|
226
|
+
? 'enter answer · esc cancel'
|
|
227
|
+
: state.request.multiSelect === true
|
|
228
|
+
? `↑↓ navigate · space toggle · enter ${submit} · esc cancel`
|
|
229
|
+
: `↑↓ navigate · enter ${submit} · esc cancel`;
|
|
230
|
+
body.push('', theme.fg('dim', navigation));
|
|
231
|
+
const card = renderFramedBlock({
|
|
232
|
+
header: state.request.title,
|
|
233
|
+
state: 'warning',
|
|
234
|
+
lines: body,
|
|
235
|
+
width,
|
|
236
|
+
applyBg: false,
|
|
237
|
+
}, theme);
|
|
238
|
+
if (state.request.allowCustom === false) {
|
|
239
|
+
return {
|
|
240
|
+
lines: card,
|
|
241
|
+
// Keep the terminal caret on body padding; the visible selector glyph
|
|
242
|
+
// owns focus while no text editor is present.
|
|
243
|
+
cursor: { row: Math.min(1, Math.max(0, card.length - 1)), column: 1 },
|
|
244
|
+
cursorVisible: false,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
const editor = renderEditor({
|
|
248
|
+
width,
|
|
249
|
+
input,
|
|
250
|
+
inputCursor,
|
|
251
|
+
status: theme.fg('muted', input === '' ? 'answer' : 'custom answer'),
|
|
252
|
+
border: 'accent',
|
|
253
|
+
}, theme);
|
|
254
|
+
const editorStart = card.length + 1;
|
|
255
|
+
return {
|
|
256
|
+
lines: [...card, '', ...editor.lines],
|
|
257
|
+
cursor: { row: editorStart + editor.cursor.row, column: editor.cursor.column },
|
|
258
|
+
editor: { start: editorStart, rows: editor.lines.length },
|
|
259
|
+
cursorVisible: true,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
/** Keep a selected option index within the available prompt options. */
|
|
263
|
+
export function movePromptSelection(state, next, count = state.request.options?.length ?? 0) {
|
|
264
|
+
if (count === 0)
|
|
265
|
+
return state;
|
|
266
|
+
const selected = (next % count + count) % count;
|
|
267
|
+
return selected === state.selected ? state : { ...state, selected };
|
|
268
|
+
}
|
|
269
|
+
/** Toggle the active row for a multi-select prompt. */
|
|
270
|
+
export function togglePromptSelection(state) {
|
|
271
|
+
if (state.request.multiSelect !== true || state.request.options?.[state.selected] === undefined)
|
|
272
|
+
return state;
|
|
273
|
+
const checked = new Set(state.checked);
|
|
274
|
+
if (checked.has(state.selected))
|
|
275
|
+
checked.delete(state.selected);
|
|
276
|
+
else
|
|
277
|
+
checked.add(state.selected);
|
|
278
|
+
return { ...state, checked };
|
|
279
|
+
}
|
|
280
|
+
/** Resolve the selected labels in stable option order. */
|
|
281
|
+
export function selectedPromptAnswer(state) {
|
|
282
|
+
const options = state.request.options ?? [];
|
|
283
|
+
if (options.length === 0)
|
|
284
|
+
return null;
|
|
285
|
+
if (state.request.multiSelect !== true) {
|
|
286
|
+
const option = options[state.selected];
|
|
287
|
+
return option?.value ?? option?.label ?? null;
|
|
288
|
+
}
|
|
289
|
+
const labels = options.flatMap((option, index) => state.checked.has(index) ? [option.value ?? option.label] : []);
|
|
290
|
+
return labels.length === 0 ? null : labels.join(', ');
|
|
291
|
+
}
|
|
292
|
+
/** Resolve the selected answer after applying a full-screen selector query. */
|
|
293
|
+
export function selectedFilteredPromptAnswer(state, query) {
|
|
294
|
+
const option = filteredPromptOptions(state.request, query)[state.selected];
|
|
295
|
+
return option?.value ?? option?.label ?? null;
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=prompt-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-selector.js","sourceRoot":"","sources":["../src/prompt-selector.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAGlF,OAAO,EAAE,Y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AAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAA;IAC3C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACrC,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QACtC,OAAO,MAAM,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,IAAI,IAAI,CAAA;IAC/C,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IACjH,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACvD,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,4BAA4B,CAAC,KAA0B,EAAE,KAAa;IACpF,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAC1E,OAAO,MAAM,EAAE,KAAK,IAAI,MAAM,EAAE,KAAK,IAAI,IAAI,CAAA;AAC/C,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI capability seam — local terminal provider.
|
|
3
|
+
|
|
4
|
+
* Owns the tty: raw-mode key input (editing, history, slash/tab
|
|
5
|
+
* autocomplete, /settings overlay, /copy picker, Ctrl-R history search, PgUp/PgDn
|
|
6
|
+
* and mouse-wheel transcript scroll, click-to-caret, Ctrl-O tool
|
|
7
|
+
* expand, bracketed paste, double Ctrl-C exit, Ctrl-D quit),
|
|
8
|
+
* SIGWINCH reflow, and the differential renderer. In non-tty mode
|
|
9
|
+
* (pipes, CI) it degrades to line-based input with plain append-only
|
|
10
|
+
* printing of settled blocks.
|
|
11
|
+
* @module @agi-fans/dsh-tui
|
|
12
|
+
*/
|
|
13
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
14
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
15
|
+
import { type TuiCommand, type TuiPrompt, type TuiRecentSession, type TuiService, type TuiSessionControls, type TuiSessionStats, type TuiStatus, type TuiSubmission } from './definition.ts';
|
|
16
|
+
import { type DirReader, type PathSearcher } from './path-complete.ts';
|
|
17
|
+
import { type ClipboardReader, type ClipboardWriter } from './clipboard.ts';
|
|
18
|
+
import { type TuiPrefs } from './settings-list.ts';
|
|
19
|
+
import { type RenderSink } from './renderer.ts';
|
|
20
|
+
import { type ThemeName } from './theme.ts';
|
|
21
|
+
import type { ToolInfo } from './tools-list.ts';
|
|
22
|
+
import type { TuiToolPresentation } from './tool-renderers.ts';
|
|
23
|
+
import { type ClipboardFileReader, type ClipboardImageReader, type ImagePathReader } from './image-paste.ts';
|
|
24
|
+
export declare const name = "omdsh-tui";
|
|
25
|
+
/** Plugin config: the model label shown on the status line. */
|
|
26
|
+
export interface Config {
|
|
27
|
+
/** Model name for the status line. */
|
|
28
|
+
model: string;
|
|
29
|
+
/** Emit SGR color sequences; defaults to the output stream's tty-ness. */
|
|
30
|
+
colors?: boolean;
|
|
31
|
+
/** Shipped palette; defaults to dark. */
|
|
32
|
+
theme?: string;
|
|
33
|
+
/** Optional JSONL prompt-history path. */
|
|
34
|
+
historyPath?: string;
|
|
35
|
+
/** Optional `{ key-id: action }` JSON file. */
|
|
36
|
+
keybindingsPath?: string;
|
|
37
|
+
}
|
|
38
|
+
/** The minimal terminal surface a LocalTui drives (process streams satisfy it). */
|
|
39
|
+
export interface TerminalLike {
|
|
40
|
+
output: RenderSink & {
|
|
41
|
+
isTTY?: boolean;
|
|
42
|
+
};
|
|
43
|
+
input: NodeJS.ReadableStream & {
|
|
44
|
+
isTTY?: boolean;
|
|
45
|
+
setRawMode?(on: boolean): void;
|
|
46
|
+
destroy?(): void;
|
|
47
|
+
};
|
|
48
|
+
/** Current width in columns. */
|
|
49
|
+
width(): number;
|
|
50
|
+
/** Current height in rows. */
|
|
51
|
+
height(): number;
|
|
52
|
+
/** Optional resize subscription; returns a disposer. */
|
|
53
|
+
onResize?(listener: () => void): () => void;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Local terminal presentation service.
|
|
57
|
+
*/
|
|
58
|
+
export declare class LocalTui implements TuiService {
|
|
59
|
+
#private;
|
|
60
|
+
/**
|
|
61
|
+
* @param term - terminal surface (injectable for tests).
|
|
62
|
+
* @param model - model label for the status line.
|
|
63
|
+
* @param colors - SGR styling switch.
|
|
64
|
+
* @param themeName - shipped palette.
|
|
65
|
+
* @param copy - clipboard writer (defaults to the platform tool).
|
|
66
|
+
* @param paths - cwd/home/listing used by `@` and path autocomplete.
|
|
67
|
+
*/
|
|
68
|
+
constructor(term: TerminalLike, model: string, colors: boolean, themeName?: ThemeName, copy?: ClipboardWriter, paths?: {
|
|
69
|
+
cwd?: string;
|
|
70
|
+
projectRoot?: string;
|
|
71
|
+
home?: string;
|
|
72
|
+
listDir?: DirReader;
|
|
73
|
+
searchFiles?: PathSearcher;
|
|
74
|
+
autocompleteDebounceMs?: number;
|
|
75
|
+
historyPath?: string;
|
|
76
|
+
keybindingsPath?: string;
|
|
77
|
+
readClipboard?: ClipboardReader;
|
|
78
|
+
readClipboardImage?: ClipboardImageReader;
|
|
79
|
+
readClipboardFiles?: ClipboardFileReader;
|
|
80
|
+
readImagePath?: ImagePathReader;
|
|
81
|
+
});
|
|
82
|
+
event(event: SessionEvent, presentation?: TuiToolPresentation): void;
|
|
83
|
+
setStatus(status: TuiStatus): void;
|
|
84
|
+
setModel(model: string, reasoningEffort?: string): void;
|
|
85
|
+
setTools(tools: readonly ToolInfo[]): void;
|
|
86
|
+
setCommands(commands: readonly TuiCommand[]): void;
|
|
87
|
+
notice(text: string, level?: 'info' | 'error'): void;
|
|
88
|
+
commandOutput(command: string, text: string): void;
|
|
89
|
+
prompt(request: TuiPrompt): Promise<string | null>;
|
|
90
|
+
replaceSession(events: readonly SessionEvent[], presentations?: ReadonlyMap<number, TuiToolPresentation>): void;
|
|
91
|
+
setSession(info: {
|
|
92
|
+
id: string;
|
|
93
|
+
recent: readonly TuiRecentSession[];
|
|
94
|
+
stats?: TuiSessionStats;
|
|
95
|
+
controls?: TuiSessionControls;
|
|
96
|
+
}): void;
|
|
97
|
+
/** Apply prefs loaded from the settings document (does not persist). */
|
|
98
|
+
applyStoredPrefs(prefs: TuiPrefs): void;
|
|
99
|
+
/** Called after a live `/settings` change. */
|
|
100
|
+
setPrefsPersist(persist: (prefs: TuiPrefs) => void): void;
|
|
101
|
+
readInput(): Promise<TuiSubmission | null>;
|
|
102
|
+
/** Compatibility helper for provider-level text editing tests and embedders. */
|
|
103
|
+
readline(): Promise<string | null>;
|
|
104
|
+
restoreInput(submission: TuiSubmission): void;
|
|
105
|
+
onInterrupt(listener: () => void): () => void;
|
|
106
|
+
dispose(): void;
|
|
107
|
+
/** Re-render the current frame (resize reflow). */
|
|
108
|
+
refresh(): void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Mount the local terminal provider as the tui service.
|
|
112
|
+
* @param ctx - plugin context.
|
|
113
|
+
* @param config - model label and color switch.
|
|
114
|
+
*/
|
|
115
|
+
export declare function apply(ctx: Context, config: Config): void;
|