@agi-fans/dsh-tui 0.20.0 → 0.22.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/lib/CHANGELOG.md +249 -3
- package/lib/chrome/box.d.ts +47 -16
- package/lib/chrome/box.js +172 -130
- package/lib/chrome/box.js.map +1 -1
- package/lib/chrome/code-highlight.d.ts +15 -0
- package/lib/chrome/code-highlight.js +60 -4
- package/lib/chrome/code-highlight.js.map +1 -1
- package/lib/chrome/command-output.d.ts +29 -2
- package/lib/chrome/command-output.js +100 -4
- package/lib/chrome/command-output.js.map +1 -1
- package/lib/chrome/main-screen-renderer.d.ts +18 -0
- package/lib/chrome/main-screen-renderer.js +58 -5
- package/lib/chrome/main-screen-renderer.js.map +1 -1
- package/lib/chrome/markdown.js +30 -10
- package/lib/chrome/markdown.js.map +1 -1
- package/lib/chrome/relative-time.d.ts +17 -0
- package/lib/chrome/relative-time.js +36 -0
- package/lib/chrome/relative-time.js.map +1 -1
- package/lib/chrome/renderer.d.ts +9 -0
- package/lib/chrome/renderer.js +1 -1
- package/lib/chrome/renderer.js.map +1 -1
- package/lib/chrome/secret-mask.d.ts +35 -0
- package/lib/chrome/secret-mask.js +180 -0
- package/lib/chrome/secret-mask.js.map +1 -0
- package/lib/chrome/status-config.d.ts +161 -51
- package/lib/chrome/status-config.js +237 -126
- package/lib/chrome/status-config.js.map +1 -1
- package/lib/chrome/status-line.d.ts +3 -2
- package/lib/chrome/status-line.js +105 -63
- package/lib/chrome/status-line.js.map +1 -1
- package/lib/chrome/terminal-colors.d.ts +85 -0
- package/lib/chrome/terminal-colors.js +230 -0
- package/lib/chrome/terminal-colors.js.map +1 -0
- package/lib/chrome/terminal-images.d.ts +9 -1
- package/lib/chrome/terminal-images.js +27 -4
- package/lib/chrome/terminal-images.js.map +1 -1
- package/lib/chrome/theme.d.ts +32 -9
- package/lib/chrome/theme.js +616 -520
- package/lib/chrome/theme.js.map +1 -1
- package/lib/chrome/tool-args.d.ts +1 -1
- package/lib/chrome/tool-args.js +3 -1
- package/lib/chrome/tool-args.js.map +1 -1
- package/lib/chrome/tool-renderers.d.ts +2 -0
- package/lib/chrome/tool-renderers.js +69 -3
- package/lib/chrome/tool-renderers.js.map +1 -1
- package/lib/chrome/tools-list.d.ts +1 -4
- package/lib/chrome/tools-list.js +1 -41
- package/lib/chrome/tools-list.js.map +1 -1
- package/lib/chrome/welcome-tips.d.ts +20 -7
- package/lib/chrome/welcome-tips.js +22 -41
- package/lib/chrome/welcome-tips.js.map +1 -1
- package/lib/commands/auth-ids.d.ts +25 -0
- package/lib/commands/auth-ids.js +27 -0
- package/lib/commands/auth-ids.js.map +1 -0
- package/lib/commands/auth-input.d.ts +34 -0
- package/lib/commands/auth-input.js +96 -0
- package/lib/commands/auth-input.js.map +1 -0
- package/lib/commands/auth-providers.d.ts +39 -0
- package/lib/commands/auth-providers.js +125 -0
- package/lib/commands/auth-providers.js.map +1 -0
- package/lib/commands/auth.d.ts +16 -22
- package/lib/commands/auth.js +346 -299
- package/lib/commands/auth.js.map +1 -1
- package/lib/commands/btw.d.ts +27 -0
- package/lib/commands/btw.js +59 -0
- package/lib/commands/btw.js.map +1 -0
- package/lib/commands/diff.js +30 -5
- package/lib/commands/diff.js.map +1 -1
- package/lib/commands/export.d.ts +1 -1
- package/lib/commands/export.js +5 -3
- package/lib/commands/export.js.map +1 -1
- package/lib/commands/files.d.ts +17 -1
- package/lib/commands/files.js +69 -61
- package/lib/commands/files.js.map +1 -1
- package/lib/commands/integrations.js +18 -6
- package/lib/commands/integrations.js.map +1 -1
- package/lib/commands/jobs.d.ts +19 -4
- package/lib/commands/jobs.js +50 -7
- package/lib/commands/jobs.js.map +1 -1
- package/lib/commands/model.js +109 -76
- package/lib/commands/model.js.map +1 -1
- package/lib/commands/permission.js +46 -13
- package/lib/commands/permission.js.map +1 -1
- package/lib/commands/plugins.js +196 -42
- package/lib/commands/plugins.js.map +1 -1
- package/lib/commands/schedule.d.ts +29 -0
- package/lib/commands/schedule.js +228 -0
- package/lib/commands/schedule.js.map +1 -0
- package/lib/commands/session-configuration.d.ts +1 -1
- package/lib/commands/session-configuration.js +29 -28
- package/lib/commands/session-configuration.js.map +1 -1
- package/lib/commands/session.js +75 -80
- package/lib/commands/session.js.map +1 -1
- package/lib/commands/terminal.d.ts +24 -4
- package/lib/commands/terminal.js +38 -94
- package/lib/commands/terminal.js.map +1 -1
- package/lib/commands/trajectory.js +4 -1
- package/lib/commands/trajectory.js.map +1 -1
- package/lib/definition.d.ts +150 -11
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/input/actions.d.ts +51 -0
- package/lib/input/actions.js +120 -0
- package/lib/input/actions.js.map +1 -0
- package/lib/input/editor-discovery.js +2 -2
- package/lib/input/editor-discovery.js.map +1 -1
- package/lib/input/editor.d.ts +0 -10
- package/lib/input/editor.js +11 -9
- package/lib/input/editor.js.map +1 -1
- package/lib/input/image-paste.d.ts +19 -1
- package/lib/input/image-paste.js +82 -1
- package/lib/input/image-paste.js.map +1 -1
- package/lib/input/keybindings-config.d.ts +15 -4
- package/lib/input/keybindings-config.js +57 -35
- package/lib/input/keybindings-config.js.map +1 -1
- package/lib/input/keys.d.ts +18 -0
- package/lib/input/keys.js +48 -3
- package/lib/input/keys.js.map +1 -1
- package/lib/input/wheel-scroll.d.ts +46 -0
- package/lib/input/wheel-scroll.js +69 -0
- package/lib/input/wheel-scroll.js.map +1 -0
- package/lib/prompt-intents.d.ts +182 -0
- package/lib/prompt-intents.js +127 -0
- package/lib/prompt-intents.js.map +1 -0
- package/lib/runtime/agent-profile.d.ts +5 -0
- package/lib/runtime/agent-profile.js +12 -0
- package/lib/runtime/agent-profile.js.map +1 -1
- package/lib/runtime/approval-rules.d.ts +59 -0
- package/lib/runtime/approval-rules.js +179 -0
- package/lib/runtime/approval-rules.js.map +1 -0
- package/lib/runtime/btw-policy.d.ts +7 -0
- package/lib/runtime/btw-policy.js +18 -0
- package/lib/runtime/btw-policy.js.map +1 -0
- package/lib/runtime/btw.d.ts +47 -0
- package/lib/runtime/btw.js +200 -0
- package/lib/runtime/btw.js.map +1 -0
- package/lib/runtime/cancellable.d.ts +75 -0
- package/lib/runtime/cancellable.js +76 -0
- package/lib/runtime/cancellable.js.map +1 -0
- package/lib/runtime/composer-images.js +5 -4
- package/lib/runtime/composer-images.js.map +1 -1
- package/lib/runtime/composer-shell.d.ts +30 -0
- package/lib/runtime/composer-shell.js +150 -0
- package/lib/runtime/composer-shell.js.map +1 -0
- package/lib/runtime/file-recovery-local.d.ts +73 -0
- package/lib/runtime/file-recovery-local.js +351 -0
- package/lib/runtime/file-recovery-local.js.map +1 -0
- package/lib/runtime/file-recovery-recording.d.ts +23 -0
- package/lib/runtime/file-recovery-recording.js +131 -0
- package/lib/runtime/file-recovery-recording.js.map +1 -0
- package/lib/runtime/file-recovery-review.d.ts +3 -0
- package/lib/runtime/file-recovery-review.js +130 -0
- package/lib/runtime/file-recovery-review.js.map +1 -0
- package/lib/runtime/file-recovery-store.d.ts +83 -0
- package/lib/runtime/file-recovery-store.js +329 -0
- package/lib/runtime/file-recovery-store.js.map +1 -0
- package/lib/runtime/file-recovery-worker.d.ts +22 -0
- package/lib/runtime/file-recovery-worker.js +153 -0
- package/lib/runtime/file-recovery-worker.js.map +1 -0
- package/lib/runtime/file-review.d.ts +6 -3
- package/lib/runtime/file-review.js +44 -7
- package/lib/runtime/file-review.js.map +1 -1
- package/lib/runtime/herdr-agent.d.ts +4 -13
- package/lib/runtime/herdr-agent.js +19 -63
- package/lib/runtime/herdr-agent.js.map +1 -1
- package/lib/runtime/plain-tui.d.ts +2 -0
- package/lib/runtime/plain-tui.js +7 -1
- package/lib/runtime/plain-tui.js.map +1 -1
- package/lib/runtime/plugin-settings.d.ts +25 -2
- package/lib/runtime/plugin-settings.js +329 -31
- package/lib/runtime/plugin-settings.js.map +1 -1
- package/lib/runtime/provider-local.d.ts +81 -24
- package/lib/runtime/provider-local.js +1807 -608
- package/lib/runtime/provider-local.js.map +1 -1
- package/lib/runtime/runner.js +52 -12
- package/lib/runtime/runner.js.map +1 -1
- package/lib/runtime/session-archive.d.ts +6 -0
- package/lib/runtime/session-archive.js +129 -3
- package/lib/runtime/session-archive.js.map +1 -1
- package/lib/runtime/session-runtime.js +1 -1
- package/lib/runtime/session-runtime.js.map +1 -1
- package/lib/runtime/settings-preferences.d.ts +5 -0
- package/lib/runtime/settings-preferences.js +34 -0
- package/lib/runtime/settings-preferences.js.map +1 -0
- package/lib/runtime/startup-notices.js +2 -0
- package/lib/runtime/startup-notices.js.map +1 -1
- package/lib/runtime/terminal-modes.d.ts +47 -0
- package/lib/runtime/terminal-modes.js +86 -0
- package/lib/runtime/terminal-modes.js.map +1 -0
- package/lib/runtime/terminal-notifications.d.ts +3 -5
- package/lib/runtime/terminal-notifications.js +4 -8
- package/lib/runtime/terminal-notifications.js.map +1 -1
- package/lib/runtime/terminal-probe.d.ts +36 -0
- package/lib/runtime/terminal-probe.js +37 -0
- package/lib/runtime/terminal-probe.js.map +1 -0
- package/lib/runtime/terminal-session.d.ts +57 -0
- package/lib/runtime/terminal-session.js +164 -0
- package/lib/runtime/terminal-session.js.map +1 -0
- package/lib/runtime/terminal-state.d.ts +29 -0
- package/lib/runtime/terminal-state.js +62 -0
- package/lib/runtime/terminal-state.js.map +1 -0
- package/lib/runtime/tool-presentation.js +50 -14
- package/lib/runtime/tool-presentation.js.map +1 -1
- package/lib/session/external-agents.d.ts +5 -0
- package/lib/session/external-agents.js +27 -0
- package/lib/session/external-agents.js.map +1 -0
- package/lib/session/feature-toggles.d.ts +1 -1
- package/lib/session/feature-toggles.js +1 -1
- package/lib/session/interaction-adapter.d.ts +1 -6
- package/lib/session/interaction-adapter.js +95 -18
- package/lib/session/interaction-adapter.js.map +1 -1
- package/lib/session/message-queue.js +1 -1
- package/lib/session/message-queue.js.map +1 -1
- package/lib/session/model-readiness.d.ts +16 -0
- package/lib/session/model-readiness.js +43 -0
- package/lib/session/model-readiness.js.map +1 -0
- package/lib/session/package-metadata.d.ts +8 -0
- package/lib/session/package-metadata.js +8 -0
- package/lib/session/package-metadata.js.map +1 -1
- package/lib/session/project-context.d.ts +5 -0
- package/lib/session/project-context.js +36 -0
- package/lib/session/project-context.js.map +1 -1
- package/lib/session/session-controller.d.ts +10 -13
- package/lib/session/session-controller.js +183 -98
- package/lib/session/session-controller.js.map +1 -1
- package/lib/session/session-library.js +2 -0
- package/lib/session/session-library.js.map +1 -1
- package/lib/session/session-tree.d.ts +3 -0
- package/lib/session/session-tree.js +3 -1
- package/lib/session/session-tree.js.map +1 -1
- package/lib/session/subagent-roster.d.ts +2 -1
- package/lib/session/subagent-roster.js +24 -3
- package/lib/session/subagent-roster.js.map +1 -1
- package/lib/session/subagent-tracker.d.ts +6 -2
- package/lib/session/subagent-tracker.js +49 -2
- package/lib/session/subagent-tracker.js.map +1 -1
- package/lib/session/tui-settings.d.ts +47 -13
- package/lib/session/tui-settings.js +76 -34
- package/lib/session/tui-settings.js.map +1 -1
- package/lib/session/working-directory.d.ts +4 -0
- package/lib/session/working-directory.js +4 -0
- package/lib/session/working-directory.js.map +1 -0
- package/lib/session/worktrees.d.ts +13 -0
- package/lib/session/worktrees.js +49 -0
- package/lib/session/worktrees.js.map +1 -0
- package/lib/views/approval-rule.d.ts +3 -0
- package/lib/views/approval-rule.js +4 -0
- package/lib/views/approval-rule.js.map +1 -0
- package/lib/views/at-complete.d.ts +8 -0
- package/lib/views/at-complete.js +64 -2
- package/lib/views/at-complete.js.map +1 -1
- package/lib/views/autocomplete.d.ts +22 -2
- package/lib/views/autocomplete.js +70 -40
- package/lib/views/autocomplete.js.map +1 -1
- package/lib/views/copy-targets.d.ts +13 -14
- package/lib/views/copy-targets.js +42 -54
- package/lib/views/copy-targets.js.map +1 -1
- package/lib/views/document-reader.js +18 -5
- package/lib/views/document-reader.js.map +1 -1
- package/lib/views/event-views.d.ts +1 -1
- package/lib/views/event-views.js +60 -6
- package/lib/views/event-views.js.map +1 -1
- package/lib/views/file-actions.d.ts +12 -0
- package/lib/views/file-actions.js +72 -0
- package/lib/views/file-actions.js.map +1 -0
- package/lib/views/history-search.js +15 -21
- package/lib/views/history-search.js.map +1 -1
- package/lib/views/hotkeys.d.ts +8 -1
- package/lib/views/hotkeys.js +53 -26
- package/lib/views/hotkeys.js.map +1 -1
- package/lib/views/list-navigation.d.ts +62 -0
- package/lib/views/list-navigation.js +73 -0
- package/lib/views/list-navigation.js.map +1 -0
- package/lib/views/list-view.d.ts +99 -0
- package/lib/views/list-view.js +165 -0
- package/lib/views/list-view.js.map +1 -0
- package/lib/views/prompt-selector.d.ts +34 -4
- package/lib/views/prompt-selector.js +270 -134
- package/lib/views/prompt-selector.js.map +1 -1
- package/lib/views/session-files.d.ts +1 -2
- package/lib/views/session-files.js +1 -11
- package/lib/views/session-files.js.map +1 -1
- package/lib/views/settings-list.d.ts +51 -10
- package/lib/views/settings-list.js +267 -315
- package/lib/views/settings-list.js.map +1 -1
- package/lib/views/trajectory-timeline.d.ts +72 -0
- package/lib/views/trajectory-timeline.js +133 -0
- package/lib/views/trajectory-timeline.js.map +1 -0
- package/lib/views/trajectory.d.ts +15 -4
- package/lib/views/trajectory.js +557 -123
- package/lib/views/trajectory.js.map +1 -1
- package/lib/views/transcript-export.js +9 -0
- package/lib/views/transcript-export.js.map +1 -1
- package/lib/views/transcript-render.d.ts +97 -25
- package/lib/views/transcript-render.js +542 -170
- package/lib/views/transcript-render.js.map +1 -1
- package/lib/views/transcript-search.d.ts +39 -6
- package/lib/views/transcript-search.js +46 -11
- package/lib/views/transcript-search.js.map +1 -1
- package/lib/views/transcript-types.d.ts +63 -5
- package/lib/views/transcript-types.js +23 -11
- package/lib/views/transcript-types.js.map +1 -1
- package/package.json +95 -65
- package/lib/commands/loop.d.ts +0 -52
- package/lib/commands/loop.js +0 -307
- package/lib/commands/loop.js.map +0 -1
- package/lib/commands/steer.d.ts +0 -5
- package/lib/commands/steer.js +0 -24
- package/lib/commands/steer.js.map +0 -1
- package/lib/runtime/terminal-reader.d.ts +0 -11
- package/lib/runtime/terminal-reader.js +0 -87
- package/lib/runtime/terminal-reader.js.map +0 -1
- package/lib/views/agent-hub.d.ts +0 -32
- package/lib/views/agent-hub.js +0 -206
- package/lib/views/agent-hub.js.map +0 -1
- package/lib/views/copy-selector.d.ts +0 -51
- package/lib/views/copy-selector.js +0 -139
- package/lib/views/copy-selector.js.map +0 -1
|
@@ -1,36 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
'ctrl+p': 'cycle-model-forward',
|
|
16
|
-
'alt+p': 'cycle-model-backward',
|
|
17
|
-
'ctrl+t': 'cycle-reasoning',
|
|
18
|
-
'ctrl+o': 'toggle-tools',
|
|
19
|
-
'alt+o': 'toggle-tool-details',
|
|
20
|
-
'pageup': 'scroll-page-up',
|
|
21
|
-
'pagedown': 'scroll-page-down',
|
|
22
|
-
'shift+up': 'scroll-fast-up',
|
|
23
|
-
'shift+down': 'scroll-fast-down',
|
|
24
|
-
'ctrl+r': 'search-history',
|
|
25
|
-
'ctrl+f': 'search-transcript',
|
|
26
|
-
});
|
|
27
|
-
const ACTIONS = [
|
|
28
|
-
'external-editor', 'retry', 'paste-clipboard', 'copy-prompt', 'copy-line', 'inspect-subagent',
|
|
29
|
-
'cycle-model-forward', 'cycle-model-backward', 'cycle-reasoning',
|
|
30
|
-
'toggle-tools', 'scroll-page-up', 'scroll-page-down', 'scroll-fast-up', 'scroll-fast-down', 'search-history',
|
|
31
|
-
'search-transcript', 'toggle-tool-details', 'review-changes', 'expand-paste', 'steer-turn', 'manage-queue', 'preview-images',
|
|
32
|
-
];
|
|
33
|
-
/** Load `{ "key-id": "action" }`; invalid rows are ignored independently. */
|
|
1
|
+
/**
|
|
2
|
+
* User-overridable application keybindings loaded from one JSON document.
|
|
3
|
+
*
|
|
4
|
+
* The catalog in `./actions.ts` is the single source of truth: it supplies the
|
|
5
|
+
* shipped chords, the accepted aliases, and the wording every surface prints.
|
|
6
|
+
* This module only layers a user's `{ "key-id": "action" }` document on top and
|
|
7
|
+
* reports the chords that document makes ambiguous.
|
|
8
|
+
* @module @agi-fans/dsh-tui
|
|
9
|
+
*/
|
|
10
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import { dirname } from 'node:path';
|
|
12
|
+
import { DEFAULT_KEYBINDINGS, isPrimaryKey, TUI_ACTIONS, } from "./actions.js";
|
|
13
|
+
export { DEFAULT_KEYBINDINGS, TUI_ACTIONS, TUI_ACTION_CATALOG, TUI_ACTION_LABELS, } from "./actions.js";
|
|
14
|
+
/** Load `{ "key-id": "action" }`; invalid rows are ignored independently, and `null` unbinds a default key. */
|
|
34
15
|
export function loadKeybindings(path) {
|
|
35
16
|
const result = { ...DEFAULT_KEYBINDINGS };
|
|
36
17
|
if (path === undefined)
|
|
@@ -40,11 +21,52 @@ export function loadKeybindings(path) {
|
|
|
40
21
|
if (typeof parsed !== 'object' || parsed === null)
|
|
41
22
|
return result;
|
|
42
23
|
for (const [key, action] of Object.entries(parsed)) {
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
const normalized = key.toLowerCase();
|
|
25
|
+
if (action === null)
|
|
26
|
+
delete result[normalized];
|
|
27
|
+
else if (typeof action === 'string' && TUI_ACTIONS.includes(action))
|
|
28
|
+
result[normalized] = action;
|
|
45
29
|
}
|
|
46
30
|
}
|
|
47
31
|
catch { /* missing/malformed user config falls back to shipped bindings */ }
|
|
48
32
|
return result;
|
|
49
33
|
}
|
|
34
|
+
/** Persist user keybinding overrides relative to {@link DEFAULT_KEYBINDINGS}. */
|
|
35
|
+
export function saveKeybindings(path, bindings) {
|
|
36
|
+
const overrides = {};
|
|
37
|
+
for (const [key, defaultAction] of Object.entries(DEFAULT_KEYBINDINGS)) {
|
|
38
|
+
const current = bindings[key];
|
|
39
|
+
if (current === undefined)
|
|
40
|
+
overrides[key] = null;
|
|
41
|
+
else if (current !== defaultAction)
|
|
42
|
+
overrides[key] = current;
|
|
43
|
+
}
|
|
44
|
+
for (const [key, action] of Object.entries(bindings)) {
|
|
45
|
+
const normalized = key.toLowerCase();
|
|
46
|
+
if (!(normalized in DEFAULT_KEYBINDINGS) && TUI_ACTIONS.includes(action)) {
|
|
47
|
+
overrides[normalized] = action;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
51
|
+
writeFileSync(path, JSON.stringify(overrides, null, 2) + '\n', 'utf8');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The bindings a hint is allowed to print.
|
|
55
|
+
*
|
|
56
|
+
* A resolved table also names the aliases a migration kept working, and a hint
|
|
57
|
+
* that printed `Ctrl+F / Ctrl+Shift+F` for one action would be telling the user
|
|
58
|
+
* about a chord the interface does not want them to learn. Only chords that are
|
|
59
|
+
* a shipped primary for their action survive, so an override that deliberately
|
|
60
|
+
* moves an action is still printed and a straggler alias is not.
|
|
61
|
+
*/
|
|
62
|
+
export function displayBindings(bindings) {
|
|
63
|
+
const shown = {};
|
|
64
|
+
for (const [key, action] of Object.entries(bindings)) {
|
|
65
|
+
// Shipped primary: always shown. Shipped alias for this same action: hidden.
|
|
66
|
+
// Any key the catalog does not give this action — a user override — is theirs to see.
|
|
67
|
+
if (isPrimaryKey(action, key) || DEFAULT_KEYBINDINGS[key] !== action)
|
|
68
|
+
shown[key] = action;
|
|
69
|
+
}
|
|
70
|
+
return shown;
|
|
71
|
+
}
|
|
50
72
|
//# sourceMappingURL=keybindings-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keybindings-config.js","sourceRoot":"","sources":["../../src/input/keybindings-config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":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AAG,CAAC,IAAI,mBAAmB,CAAC,GAAG,CAAC,KAAK,MAAM;YAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA;IAC3F,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/lib/input/keys.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* `enter`, `ctrl+a`, `alt+left`, `shift+enter`, …
|
|
5
5
|
* @module @agi-fans/dsh-tui
|
|
6
6
|
*/
|
|
7
|
+
import { type OscColorReply } from '../chrome/terminal-colors.ts';
|
|
7
8
|
/** One decoded input event. */
|
|
8
9
|
export type KeyEvent = {
|
|
9
10
|
type: 'key';
|
|
@@ -14,6 +15,23 @@ export type KeyEvent = {
|
|
|
14
15
|
} | {
|
|
15
16
|
type: 'focus';
|
|
16
17
|
focused: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'program-status-support';
|
|
20
|
+
} | {
|
|
21
|
+
type: 'color-reply';
|
|
22
|
+
reply: OscColorReply;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'color-scheme';
|
|
25
|
+
scheme: 'dark' | 'light';
|
|
26
|
+
} | {
|
|
27
|
+
type: 'kitty-flags';
|
|
28
|
+
flags: number;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'device-attributes';
|
|
31
|
+
} | {
|
|
32
|
+
type: 'mode-report';
|
|
33
|
+
mode: number;
|
|
34
|
+
state: number;
|
|
17
35
|
} | {
|
|
18
36
|
type: 'cell-size';
|
|
19
37
|
width: number;
|
package/lib/input/keys.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* `enter`, `ctrl+a`, `alt+left`, `shift+enter`, …
|
|
5
5
|
* @module @agi-fans/dsh-tui
|
|
6
6
|
*/
|
|
7
|
+
import { parseOscColorReply } from "../chrome/terminal-colors.js";
|
|
7
8
|
const CTRL = {
|
|
8
9
|
0x01: 'ctrl+a',
|
|
9
10
|
0x02: 'ctrl+b',
|
|
@@ -121,6 +122,30 @@ function parseCsi(seq) {
|
|
|
121
122
|
const body = seq.slice(1);
|
|
122
123
|
if (body === '')
|
|
123
124
|
return 'partial';
|
|
125
|
+
// Replies to our capability queries can arrive back to back in one read, so
|
|
126
|
+
// every one of these matches a PREFIX: anchoring on the end of the buffer
|
|
127
|
+
// would fail as soon as the terminal answered two queries at once, and the
|
|
128
|
+
// reply would be echoed into the composer as text.
|
|
129
|
+
// CSI ?997;N n reports whether the terminal describes itself as dark or light.
|
|
130
|
+
const scheme = /^\?997;([12])n/u.exec(body);
|
|
131
|
+
if (scheme !== null)
|
|
132
|
+
return { event: { type: 'color-scheme', scheme: scheme[1] === '2' ? 'light' : 'dark' }, used: 1 + scheme[0].length };
|
|
133
|
+
// `CSI ? u` with no flags answers "supported, none enabled"; treat it as zero
|
|
134
|
+
// rather than letting the bytes fall through as text.
|
|
135
|
+
if (body.startsWith('?u') || body.startsWith('>u'))
|
|
136
|
+
return { event: { type: 'kitty-flags', flags: 0 }, used: 1 + 2 };
|
|
137
|
+
// CSI >|? flags u is the Kitty keyboard protocol's answer to our query.
|
|
138
|
+
const kittyFlags = /^[>?](\d+)u/u.exec(body);
|
|
139
|
+
if (kittyFlags !== null)
|
|
140
|
+
return { event: { type: 'kitty-flags', flags: Number(kittyFlags[1]) }, used: 1 + kittyFlags[0].length };
|
|
141
|
+
// CSI ? ... c is the primary device-attributes reply, our negotiation sentinel.
|
|
142
|
+
const attributes = /^\?[\d;]*c/u.exec(body);
|
|
143
|
+
if (attributes !== null)
|
|
144
|
+
return { event: { type: 'device-attributes' }, used: 1 + attributes[0].length };
|
|
145
|
+
// DECRPM: CSI ? mode ; state $ y reports a private mode's support.
|
|
146
|
+
const decrpm = /^\?(\d+);(\d+)\$y/u.exec(body);
|
|
147
|
+
if (decrpm !== null)
|
|
148
|
+
return { event: { type: 'mode-report', mode: Number(decrpm[1]), state: Number(decrpm[2]) }, used: 1 + decrpm[0].length };
|
|
124
149
|
if (body[0] === '<') {
|
|
125
150
|
const parsed = parseSgr(body);
|
|
126
151
|
if (parsed === 'partial')
|
|
@@ -129,9 +154,11 @@ function parseCsi(seq) {
|
|
|
129
154
|
return null;
|
|
130
155
|
return { event: parsed.event, used: parsed.used };
|
|
131
156
|
}
|
|
132
|
-
|
|
157
|
+
// Kitty may attach colon sub-parameters (shifted/base key, event type) to the
|
|
158
|
+
// key code and the modifier; the first value of each field is what we decode.
|
|
159
|
+
const match = /^(?:(\d+)?(?::\d*)*(?:;(\d+)?(?::\d*)*)?(?:;(\d+))?)?([A-Za-z~u])/.exec(body);
|
|
133
160
|
if (match === null) {
|
|
134
|
-
if (/^[\d
|
|
161
|
+
if ((/^[\d;:]*$/.test(body) || /^[>?][\d;]*\$?$/u.test(body)) && body.length < 32)
|
|
135
162
|
return 'partial';
|
|
136
163
|
return null;
|
|
137
164
|
}
|
|
@@ -187,12 +214,30 @@ export function parseKeys(input) {
|
|
|
187
214
|
const second = tail[1];
|
|
188
215
|
if (second === undefined)
|
|
189
216
|
return { events, rest: tail };
|
|
217
|
+
if (second === ']') {
|
|
218
|
+
const end = /\x07|\x1b\\/u.exec(tail.slice(2));
|
|
219
|
+
if (end === null)
|
|
220
|
+
return tail.length < 4096 ? { events, rest: tail } : { events, rest: '' };
|
|
221
|
+
const body = tail.slice(2, 2 + end.index);
|
|
222
|
+
if (/^7501;\?(?:[:;].*)?$/u.test(body))
|
|
223
|
+
events.push({ type: 'program-status-support' });
|
|
224
|
+
else {
|
|
225
|
+
const reply = parseOscColorReply(body);
|
|
226
|
+
if (reply !== undefined)
|
|
227
|
+
events.push({ type: 'color-reply', reply });
|
|
228
|
+
}
|
|
229
|
+
i += 2 + end.index + end[0].length;
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
190
232
|
if (second === '[') {
|
|
191
233
|
const parsed = parseCsi(tail.slice(1));
|
|
192
234
|
if (parsed === 'partial')
|
|
193
235
|
return { events, rest: tail };
|
|
194
236
|
if (parsed === null) {
|
|
195
|
-
|
|
237
|
+
// A complete CSI we do not decode is still control data. Dropping only
|
|
238
|
+
// the ESC would type its parameters into the composer.
|
|
239
|
+
const complete = /^\x1b\[[\d;:?<=>]*[\x20-\x2f]*[\x40-\x7e]/u.exec(tail);
|
|
240
|
+
i += complete === null ? 1 : complete[0].length;
|
|
196
241
|
continue;
|
|
197
242
|
}
|
|
198
243
|
if (parsed.event !== undefined)
|
package/lib/input/keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/input/keys.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,MAAM,IAAI,GAA2B;IACnC,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,WAAW;CAClB,CAAA;AAED,MAAM,UAAU,GAA2B;IACzC,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,MAA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AAG,CAAC,CAAA;IACP,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAA;AAC7B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC3D,OAAO,EAAE,CAAA;AACX,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wheel scrolling that follows one physical gesture instead of counting
|
|
3
|
+
* events. Terminals disagree about what a "wheel event" is: a high-resolution
|
|
4
|
+
* device can split one notch into several reports a few milliseconds apart,
|
|
5
|
+
* while a classic mouse sends exactly one, and one terminal read can also
|
|
6
|
+
* batch several real notches together. A notch keeps the familiar three lines;
|
|
7
|
+
* a near-simultaneous follow-up report moves one line, so a split notch no
|
|
8
|
+
* longer triples its distance while a batched spin still travels; and a fast
|
|
9
|
+
* spin earns up to twice the distance per notch. Fractions carry into the next
|
|
10
|
+
* event so the acceleration stays smooth.
|
|
11
|
+
*
|
|
12
|
+
* Local macOS terminals are the exception: the OS already accelerates wheel
|
|
13
|
+
* and trackpad deltas and reports one event per line, so the TUI keeps a flat
|
|
14
|
+
* three lines per event there instead of accelerating twice.
|
|
15
|
+
* @module @agi-fans/dsh-tui/wheel-scroll
|
|
16
|
+
*/
|
|
17
|
+
/** Accumulated state of one wheel gesture. */
|
|
18
|
+
export interface WheelGesture {
|
|
19
|
+
/** When the most recent report arrived. */
|
|
20
|
+
countedAt: number;
|
|
21
|
+
/** Direction of the gesture: -1 up, 1 down, 0 idle. */
|
|
22
|
+
direction: -1 | 0 | 1;
|
|
23
|
+
/** Fractional lines not yet scrolled, signed like the direction. */
|
|
24
|
+
carry: number;
|
|
25
|
+
}
|
|
26
|
+
/** The gesture to start with. */
|
|
27
|
+
export declare const IDLE_WHEEL: WheelGesture;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the terminal already accelerates wheel input. Local macOS terminals
|
|
30
|
+
* receive deltas the OS accelerated and emit one event per line; other
|
|
31
|
+
* platforms, and SSH sessions where the client platform is unknown, usually
|
|
32
|
+
* send one event per wheel notch.
|
|
33
|
+
*/
|
|
34
|
+
export declare function terminalAcceleratesWheel(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* How far one wheel event should scroll.
|
|
37
|
+
* @param gesture - state returned by the previous call.
|
|
38
|
+
* @param now - this event's timestamp in milliseconds.
|
|
39
|
+
* @param direction - `-1` for up, `1` for down.
|
|
40
|
+
* @param terminalAccelerates - the terminal already accelerates deltas, so every event moves a flat {@link BASE_LINES}.
|
|
41
|
+
* @returns the signed line count to move and the state to carry into the next event.
|
|
42
|
+
*/
|
|
43
|
+
export declare function wheelStep(gesture: WheelGesture, now: number, direction: -1 | 1, terminalAccelerates?: boolean): {
|
|
44
|
+
lines: number;
|
|
45
|
+
gesture: WheelGesture;
|
|
46
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wheel scrolling that follows one physical gesture instead of counting
|
|
3
|
+
* events. Terminals disagree about what a "wheel event" is: a high-resolution
|
|
4
|
+
* device can split one notch into several reports a few milliseconds apart,
|
|
5
|
+
* while a classic mouse sends exactly one, and one terminal read can also
|
|
6
|
+
* batch several real notches together. A notch keeps the familiar three lines;
|
|
7
|
+
* a near-simultaneous follow-up report moves one line, so a split notch no
|
|
8
|
+
* longer triples its distance while a batched spin still travels; and a fast
|
|
9
|
+
* spin earns up to twice the distance per notch. Fractions carry into the next
|
|
10
|
+
* event so the acceleration stays smooth.
|
|
11
|
+
*
|
|
12
|
+
* Local macOS terminals are the exception: the OS already accelerates wheel
|
|
13
|
+
* and trackpad deltas and reports one event per line, so the TUI keeps a flat
|
|
14
|
+
* three lines per event there instead of accelerating twice.
|
|
15
|
+
* @module @agi-fans/dsh-tui/wheel-scroll
|
|
16
|
+
*/
|
|
17
|
+
/** Lines one notch moves at a deliberate pace, the distance the TUI always used. */
|
|
18
|
+
const BASE_LINES = 3;
|
|
19
|
+
/** Reports closer than this to the previous one are follow-ups, not new notches. */
|
|
20
|
+
const BURST_GAP_MS = 5;
|
|
21
|
+
/** Lines a follow-up report moves. */
|
|
22
|
+
const BURST_LINES = 1;
|
|
23
|
+
/** A pause this long, or a change of direction, ends the gesture. */
|
|
24
|
+
const GESTURE_GAP_MS = 200;
|
|
25
|
+
/** Notch spacing at or below which a spin reaches full acceleration. */
|
|
26
|
+
const FAST_GAP_MS = 40;
|
|
27
|
+
/** Notch spacing at or above which a spin is deliberate and not accelerated. */
|
|
28
|
+
const SLOW_GAP_MS = 120;
|
|
29
|
+
/** Most a fast spin may multiply one notch's distance. */
|
|
30
|
+
const MAX_ACCELERATION = 2;
|
|
31
|
+
/** The gesture to start with. */
|
|
32
|
+
export const IDLE_WHEEL = { countedAt: 0, direction: 0, carry: 0 };
|
|
33
|
+
/**
|
|
34
|
+
* Whether the terminal already accelerates wheel input. Local macOS terminals
|
|
35
|
+
* receive deltas the OS accelerated and emit one event per line; other
|
|
36
|
+
* platforms, and SSH sessions where the client platform is unknown, usually
|
|
37
|
+
* send one event per wheel notch.
|
|
38
|
+
*/
|
|
39
|
+
export function terminalAcceleratesWheel(env = process.env, platform = process.platform) {
|
|
40
|
+
return platform === 'darwin'
|
|
41
|
+
&& env.SSH_CONNECTION === undefined
|
|
42
|
+
&& env.SSH_CLIENT === undefined
|
|
43
|
+
&& env.SSH_TTY === undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* How far one wheel event should scroll.
|
|
47
|
+
* @param gesture - state returned by the previous call.
|
|
48
|
+
* @param now - this event's timestamp in milliseconds.
|
|
49
|
+
* @param direction - `-1` for up, `1` for down.
|
|
50
|
+
* @param terminalAccelerates - the terminal already accelerates deltas, so every event moves a flat {@link BASE_LINES}.
|
|
51
|
+
* @returns the signed line count to move and the state to carry into the next event.
|
|
52
|
+
*/
|
|
53
|
+
export function wheelStep(gesture, now, direction, terminalAccelerates = false) {
|
|
54
|
+
if (terminalAccelerates)
|
|
55
|
+
return { lines: direction * BASE_LINES, gesture: IDLE_WHEEL };
|
|
56
|
+
const gap = now - gesture.countedAt;
|
|
57
|
+
const fresh = gesture.direction !== direction || gap > GESTURE_GAP_MS;
|
|
58
|
+
// A follow-up report: part of a split notch, or one of several batched
|
|
59
|
+
// notches. Either way it moves a single line, without acceleration.
|
|
60
|
+
if (!fresh && gap < BURST_GAP_MS) {
|
|
61
|
+
return { lines: direction * BURST_LINES, gesture: { countedAt: now, direction, carry: gesture.carry } };
|
|
62
|
+
}
|
|
63
|
+
const acceleration = fresh ? 1 : 1 + (MAX_ACCELERATION - 1)
|
|
64
|
+
* Math.max(0, Math.min(1, (SLOW_GAP_MS - gap) / (SLOW_GAP_MS - FAST_GAP_MS)));
|
|
65
|
+
const total = (fresh ? 0 : gesture.carry) + direction * BASE_LINES * acceleration;
|
|
66
|
+
const lines = Math.trunc(total);
|
|
67
|
+
return { lines, gesture: { countedAt: now, direction, carry: total - lines } };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=wheel-scroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wheel-scroll.js","sourceRoot":"","sources":["../../src/input/wheel-scroll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,oFAAoF;AACpF,MAAM,UAAU,GAAG,CAAC,CAAA;AACpB,oFAAoF;AACpF,MAAM,YAAY,GAAG,CAAC,CAAA;AACtB,sCAAsC;AACtC,MAAM,WAAW,GAAG,CAAC,CAAA;AACrB,qEAAqE;AACrE,MAAM,cAAc,GAAG,GAAG,CAAA;AAC1B,wEAAwE;AACxE,MAAM,WAAW,GAAG,EAAE,CAAA;AACtB,gFAAgF;AAChF,MAAM,WAAW,GAAG,GAAG,CAAA;AACvB,0DAA0D;A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CAAC,CAAC,EAAE,CAAC,WAAW,GAAG,GAAG,CAAC,GAAG,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IAC/E,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAA;IACjF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC/B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,EAAE,EAAE,CAAA;AAChF,CAAC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The four intents a caller actually has when it asks the reader something.
|
|
3
|
+
*
|
|
4
|
+
* `TuiPrompt` grew to forty-six optional fields because every new surface added
|
|
5
|
+
* one: `presentation`, `filterable`, `approveValue`,
|
|
6
|
+
* `dismissLabel`, `skippable`, `wait`, `interrupt`, `onSuperseded`,
|
|
7
|
+
* `refreshDocument`, `refreshOptions` … A caller passing `{ title, question,
|
|
8
|
+
* allowCustom: true }` had to know that omitting `options` means "free text" and
|
|
9
|
+
* that `allowCustom: false` is what makes a list non-editable. Nothing in the
|
|
10
|
+
* type said which fields belong together, so each new caller assembled its own
|
|
11
|
+
* combination and the interface kept widening.
|
|
12
|
+
*
|
|
13
|
+
* These four intents are measured, not invented: across 196 call sites, 109 ask
|
|
14
|
+
* for free text, 45 offer a list, 14 read a document, and the rest are those
|
|
15
|
+
* shapes with one extra field. Each function below names the intent, defaults
|
|
16
|
+
* what the intent always wants, and leaves the escape hatch — {@link TuiService.prompt}
|
|
17
|
+
* with the full type — for the handful of surfaces that genuinely need it.
|
|
18
|
+
*
|
|
19
|
+
* @module @agi-fans/dsh-tui/prompt-intents
|
|
20
|
+
*/
|
|
21
|
+
import type { TuiDocumentPosition, TuiDocumentSource, TuiPrompt } from './definition.ts';
|
|
22
|
+
/** One choice a {@link choose} offers. */
|
|
23
|
+
export interface PromptChoice {
|
|
24
|
+
label: string;
|
|
25
|
+
/** Answer returned to the caller; defaults to {@link label}. */
|
|
26
|
+
value?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
/** Parent value when the list is a tree; a missing parent makes a root. */
|
|
29
|
+
parentValue?: string;
|
|
30
|
+
/** Secondary content shown above the metadata in a spacious list. */
|
|
31
|
+
preview?: string;
|
|
32
|
+
/** Verb shown for Enter on this row. */
|
|
33
|
+
submitLabel?: string;
|
|
34
|
+
/** Semantic badge painted after the description. */
|
|
35
|
+
badge?: {
|
|
36
|
+
label: string;
|
|
37
|
+
tone: 'success' | 'warning' | 'error' | 'muted';
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** One keyboard chord a {@link choose} list accepts besides Enter and the arrows. */
|
|
41
|
+
export interface PromptAction {
|
|
42
|
+
key: string;
|
|
43
|
+
label: string;
|
|
44
|
+
/** Returned before the selected value, so the caller can tell which chord fired. */
|
|
45
|
+
valuePrefix: string;
|
|
46
|
+
/** `list` returns only the prefix, even with no row selected. */
|
|
47
|
+
scope?: 'selection' | 'list';
|
|
48
|
+
}
|
|
49
|
+
/** A surface that needs no answer, only a decision to stop. */
|
|
50
|
+
export interface CancelSurface {
|
|
51
|
+
/** Label of the option that cancels; defaults to `Cancel`. */
|
|
52
|
+
cancelLabel?: string;
|
|
53
|
+
/** What cancelling does and does not undo. */
|
|
54
|
+
detail?: string;
|
|
55
|
+
signal?: AbortSignal;
|
|
56
|
+
/**
|
|
57
|
+
* The work behind the surface, so `Esc` and `Ctrl+C` can stop it.
|
|
58
|
+
*
|
|
59
|
+
* Returning true keeps a primary turn running: a progress surface belongs to
|
|
60
|
+
* one operation, not to the session.
|
|
61
|
+
*/
|
|
62
|
+
interrupt?: () => boolean | void;
|
|
63
|
+
/** The surface was taken by something with a stronger claim on the screen. */
|
|
64
|
+
onSuperseded?: (input: string) => void;
|
|
65
|
+
/** Repaint an open document; read on every refresh. */
|
|
66
|
+
refreshDocument?: () => string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Ask for free text.
|
|
70
|
+
*
|
|
71
|
+
* This is the shape 109 of 196 call sites wanted and had to spell as
|
|
72
|
+
* `{ allowCustom: true, notify: false }`. A bare input needs no `options` array
|
|
73
|
+
* and no `presentation`; both are supplied here so the caller states one thing.
|
|
74
|
+
*/
|
|
75
|
+
export declare function askPrompt(request: {
|
|
76
|
+
title: string;
|
|
77
|
+
question: string;
|
|
78
|
+
detail?: string;
|
|
79
|
+
/** Prefilled text the reader can edit. */
|
|
80
|
+
initialInput?: string;
|
|
81
|
+
/** Keep indentation and trailing newlines, for message-shaped input. */
|
|
82
|
+
preserveWhitespace?: boolean;
|
|
83
|
+
/** Mask what is typed; the real value stays in the editor only. */
|
|
84
|
+
secret?: boolean;
|
|
85
|
+
/** Rescue partially typed text when the prompt is dismissed or aborted. */
|
|
86
|
+
onCancelDraft?: (draft: string) => void;
|
|
87
|
+
/** Verb shown for Enter, such as `validate`; the input is still free text. */
|
|
88
|
+
submitLabel?: string;
|
|
89
|
+
signal?: AbortSignal;
|
|
90
|
+
/** Announce this prompt; off for user-initiated surfaces the reader just opened. */
|
|
91
|
+
notify?: boolean;
|
|
92
|
+
}): TuiPrompt;
|
|
93
|
+
/**
|
|
94
|
+
* Offer a list of choices.
|
|
95
|
+
*
|
|
96
|
+
* The list is not editable: a caller that wants both a list and free text wants
|
|
97
|
+
* {@link askPrompt} with `detail`, or the full {@link TuiPrompt} if it really
|
|
98
|
+
* needs both. Keeping the two apart is what lets this function state the shape
|
|
99
|
+
* without an `allowCustom` flag the caller has to reason about.
|
|
100
|
+
*/
|
|
101
|
+
export declare function choosePrompt<const T extends PromptChoice>(request: {
|
|
102
|
+
title: string;
|
|
103
|
+
question: string;
|
|
104
|
+
detail?: string;
|
|
105
|
+
options: readonly T[];
|
|
106
|
+
/** Value selected when the list opens. */
|
|
107
|
+
initialValue?: string;
|
|
108
|
+
/** Let typed text filter the rows. */
|
|
109
|
+
filterable?: boolean;
|
|
110
|
+
/** Text shown when the list has no rows; the caller owns this wording. */
|
|
111
|
+
emptyText?: string;
|
|
112
|
+
/** Keyboard chords the list accepts besides Enter and the arrows. */
|
|
113
|
+
actions?: readonly PromptAction[];
|
|
114
|
+
/** Allow more than one row to be checked. */
|
|
115
|
+
multiSelect?: boolean;
|
|
116
|
+
/** Values checked when a multi-select list opens. */
|
|
117
|
+
initialValues?: readonly string[];
|
|
118
|
+
/** Submit an empty answer when every choice is unchecked. */
|
|
119
|
+
allowEmptySelection?: boolean;
|
|
120
|
+
/** Verb shown after Enter in the navigation hint. */
|
|
121
|
+
submitLabel?: string;
|
|
122
|
+
signal?: AbortSignal;
|
|
123
|
+
notify?: boolean;
|
|
124
|
+
}): TuiPrompt;
|
|
125
|
+
/**
|
|
126
|
+
* Ask one yes/no question.
|
|
127
|
+
*
|
|
128
|
+
* Returns a boolean rather than a string or null, because "dismissed" and "no"
|
|
129
|
+
* are the same answer: a reader who presses Escape has not agreed to anything.
|
|
130
|
+
* Callers that need to tell those apart use the full prompt.
|
|
131
|
+
*/
|
|
132
|
+
export declare function confirmPrompt(prompt: (request: TuiPrompt) => Promise<string | null>, request: {
|
|
133
|
+
title: string;
|
|
134
|
+
question: string;
|
|
135
|
+
detail?: string;
|
|
136
|
+
/** Verb on the accepting row; the declining row is always a cancel. */
|
|
137
|
+
acceptLabel?: string;
|
|
138
|
+
/** One line under the accepting row saying what accepting does. */
|
|
139
|
+
acceptDescription?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Label of the declining row; defaults to `Cancel`.
|
|
142
|
+
*
|
|
143
|
+
* Pass `null` for a one-way door: the reader either proceeds or dismisses.
|
|
144
|
+
* That is a different intent from a yes/no question — "install and enable"
|
|
145
|
+
* has no meaningful opposite to put beside it — and it is what 24 call sites
|
|
146
|
+
* meant by a list with a single row.
|
|
147
|
+
*/
|
|
148
|
+
cancelLabel?: string | null;
|
|
149
|
+
/** One line under the declining row; usually what staying put means. */
|
|
150
|
+
cancelDescription?: string;
|
|
151
|
+
signal?: AbortSignal;
|
|
152
|
+
notify?: boolean;
|
|
153
|
+
}): Promise<boolean>;
|
|
154
|
+
/**
|
|
155
|
+
* Show a document the reader can scroll, search, and leave.
|
|
156
|
+
*
|
|
157
|
+
* The surface is dropped automatically when the work it describes ends, so the
|
|
158
|
+
* caller does not have to pair an open with a close.
|
|
159
|
+
*/
|
|
160
|
+
export declare function readPrompt(request: {
|
|
161
|
+
title: string;
|
|
162
|
+
question: string;
|
|
163
|
+
/** The text to read; wrapped by default. */
|
|
164
|
+
text?: string;
|
|
165
|
+
/** A prepared source reader with line numbers and search. */
|
|
166
|
+
source?: TuiDocumentSource;
|
|
167
|
+
/** Open at this position. */
|
|
168
|
+
position?: TuiDocumentPosition;
|
|
169
|
+
/** Open at the latest row, for output that is still arriving. */
|
|
170
|
+
tail?: boolean;
|
|
171
|
+
/** A prepared image shown in the dedicated reader. */
|
|
172
|
+
image?: TuiPrompt['documentImage'];
|
|
173
|
+
/** Repaint while open; read on every refresh. */
|
|
174
|
+
refresh?: () => string;
|
|
175
|
+
/** Told the last visible position when the reader leaves. */
|
|
176
|
+
onPosition?: (position: TuiDocumentPosition) => void;
|
|
177
|
+
cancelLabel?: string;
|
|
178
|
+
detail?: string;
|
|
179
|
+
signal?: AbortSignal;
|
|
180
|
+
interrupt?: () => boolean | void;
|
|
181
|
+
onSuperseded?: (input: string) => void;
|
|
182
|
+
}): TuiPrompt;
|