@linxiraos/pi-tui 1.4.4 → 1.4.7
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/CHANGELOG.md +208 -207
- package/README.md +34 -34
- package/dist/types/app-keybindings.d.ts +20 -0
- package/dist/types/apps/session-picker.d.ts +5 -0
- package/dist/types/charts/chart-plan.d.ts +9 -7
- package/dist/types/chat/assistant-message.d.ts +15 -3
- package/dist/types/chat/bash-execution.d.ts +2 -0
- package/dist/types/chat/display-preferences.d.ts +2 -0
- package/dist/types/chat/extension-types.d.ts +31 -0
- package/dist/types/chat/reply-write.d.ts +48 -0
- package/dist/types/chat/table-chart.d.ts +4 -3
- package/dist/types/chat/tool-execution.d.ts +1 -2
- package/dist/types/chat/transcript-outline.d.ts +7 -0
- package/dist/types/chat/transcript-render-helpers.d.ts +2 -0
- package/dist/types/chrome/context-map.d.ts +15 -0
- package/dist/types/chrome/context-presentation.d.ts +48 -0
- package/dist/types/chrome/context-view-model.d.ts +77 -0
- package/dist/types/chrome/index.d.ts +1 -0
- package/dist/types/chrome/transcript-notice.d.ts +35 -0
- package/dist/types/chrome/transcript-status.d.ts +20 -8
- package/dist/types/components/editor.d.ts +8 -0
- package/dist/types/components/image.d.ts +20 -0
- package/dist/types/components/loader.d.ts +1 -1
- package/dist/types/components/markdown.d.ts +7 -0
- package/dist/types/native/blobs.d.ts +11 -1
- package/dist/types/native/picker.d.ts +4 -4
- package/dist/types/overlays/advisor-config.d.ts +6 -0
- package/dist/types/overlays/agent-hub-projection.d.ts +3 -1
- package/dist/types/overlays/annotation-overlay.d.ts +7 -1
- package/dist/types/overlays/annotation-types.d.ts +28 -0
- package/dist/types/overlays/ask-dialog.d.ts +12 -3
- package/dist/types/overlays/btw-history-panel.d.ts +16 -2
- package/dist/types/overlays/btw-history.d.ts +7 -0
- package/dist/types/overlays/btw-panel.d.ts +2 -0
- package/dist/types/overlays/context-viewer-format.d.ts +42 -0
- package/dist/types/overlays/context-viewer-overview.d.ts +70 -0
- package/dist/types/overlays/context-viewer.d.ts +25 -0
- package/dist/types/overlays/hook-input.d.ts +1 -0
- package/dist/types/overlays/login-dialog.d.ts +5 -1
- package/dist/types/overlays/mcp-add-wizard.d.ts +2 -0
- package/dist/types/overlays/model-browser.d.ts +10 -1
- package/dist/types/overlays/oauth-selector.d.ts +23 -0
- package/dist/types/overlays/pause-screen.d.ts +13 -3
- package/dist/types/overlays/plan-review-overlay.d.ts +2 -0
- package/dist/types/overlays/rewind-selector.d.ts +1 -1
- package/dist/types/overlays/running-subagent-badge.d.ts +7 -1
- package/dist/types/overlays/session-selector.d.ts +22 -2
- package/dist/types/prompt/composer.d.ts +43 -0
- package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
- package/dist/types/prompt/macos-spelling.d.ts +2 -2
- package/dist/types/render/extension-links.d.ts +65 -0
- package/dist/types/render/hyperlink.d.ts +38 -7
- package/dist/types/render/index.d.ts +1 -0
- package/dist/types/render/output-pane.d.ts +1 -1
- package/dist/types/render/render-utils.d.ts +7 -1
- package/dist/types/setup/scenes/glyph.d.ts +1 -1
- package/dist/types/setup/scenes/model.d.ts +1 -1
- package/dist/types/setup/scenes/outro.d.ts +5 -4
- package/dist/types/setup/scenes/sign-in.d.ts +13 -8
- package/dist/types/setup/scenes/types.d.ts +16 -1
- package/dist/types/setup/startup-splash.d.ts +1 -1
- package/dist/types/setup/wizard-overlay.d.ts +11 -7
- package/dist/types/setup/wizard.d.ts +5 -1
- package/dist/types/status-line/component.d.ts +3 -3
- package/dist/types/status-line/context-usage.d.ts +42 -35
- package/dist/types/status-line/host.d.ts +6 -2
- package/dist/types/terminal-capabilities.d.ts +7 -0
- package/dist/types/theme/symbols.d.ts +1 -1
- package/dist/types/theme/theme.d.ts +0 -23
- package/dist/types/tools/ask.d.ts +4 -0
- package/dist/types/tools/bash-interactive.d.ts +6 -0
- package/dist/types/tools/bash.d.ts +2 -0
- package/dist/types/tools/default-renderer.d.ts +6 -4
- package/dist/types/tools/edit.d.ts +3 -1
- package/dist/types/tools/fetch.d.ts +1 -0
- package/dist/types/tools/github.d.ts +3 -0
- package/dist/types/tools/grouped-file-output.d.ts +2 -0
- package/dist/types/tools/irc.d.ts +6 -0
- package/dist/types/tools/json-tree.d.ts +23 -4
- package/dist/types/tools/lsp.d.ts +2 -0
- package/dist/types/tools/mcp.d.ts +7 -6
- package/dist/types/tools/native-view.d.ts +1 -1
- package/dist/types/tools/read.d.ts +3 -0
- package/dist/types/tools/renderer.d.ts +2 -0
- package/dist/types/tools/streaming-output.d.ts +11 -0
- package/dist/types/tools/task.d.ts +9 -1
- package/dist/types/tools/url-scheme-host.d.ts +17 -0
- package/dist/types/tools/wait.d.ts +16 -2
- package/dist/types/tools/yield.d.ts +1 -1
- package/dist/types/tui.d.ts +9 -2
- package/dist/types/vim.d.ts +39 -0
- package/package.json +10 -14
- package/src/app-keybindings.d.ts +20 -0
- package/src/app-keybindings.ts +20 -0
- package/src/apps/session-picker.ts +7 -0
- package/src/charts/chart-plan.d.ts +9 -7
- package/src/charts/chart-plan.ts +20 -50
- package/src/chat/advisor-message.ts +2 -0
- package/src/chat/assistant-message.d.ts +15 -3
- package/src/chat/assistant-message.ts +137 -19
- package/src/chat/background-tan-message.ts +4 -0
- package/src/chat/bash-execution.d.ts +2 -0
- package/src/chat/bash-execution.ts +13 -1
- package/src/chat/chat-transcript-builder.ts +58 -28
- package/src/chat/compaction-summary-message.ts +2 -1
- package/src/chat/display-preferences.d.ts +2 -0
- package/src/chat/display-preferences.ts +3 -0
- package/src/chat/extension-types.d.ts +31 -0
- package/src/chat/extension-types.ts +34 -0
- package/src/chat/read-tool-group.ts +1 -2
- package/src/chat/reply-write.d.ts +48 -0
- package/src/chat/reply-write.ts +127 -0
- package/src/chat/skill-message.ts +2 -6
- package/src/chat/table-chart.d.ts +4 -3
- package/src/chat/table-chart.ts +10 -4
- package/src/chat/tool-execution.d.ts +1 -2
- package/src/chat/tool-execution.ts +20 -13
- package/src/chat/transcript-outline.d.ts +7 -0
- package/src/chat/transcript-outline.ts +27 -0
- package/src/chat/transcript-render-helpers.d.ts +2 -0
- package/src/chat/transcript-render-helpers.ts +66 -24
- package/src/chrome/context-map.ts +62 -0
- package/src/chrome/context-presentation.ts +26 -0
- package/src/chrome/context-view-model.ts +73 -0
- package/src/chrome/index.ts +1 -0
- package/src/chrome/transcript-container.ts +89 -59
- package/src/chrome/transcript-notice.d.ts +35 -0
- package/src/chrome/transcript-notice.ts +83 -0
- package/src/chrome/transcript-status.d.ts +20 -8
- package/src/chrome/transcript-status.ts +29 -29
- package/src/components/editor.d.ts +8 -0
- package/src/components/editor.ts +465 -14
- package/src/components/image.d.ts +20 -0
- package/src/components/image.ts +83 -18
- package/src/components/loader.d.ts +1 -1
- package/src/components/loader.ts +1 -1
- package/src/components/markdown.d.ts +7 -0
- package/src/components/markdown.ts +225 -13
- package/src/hotkeys-markdown.ts +2 -0
- package/src/native/backend.ts +5 -66
- package/src/native/blobs.d.ts +11 -1
- package/src/native/blobs.ts +5 -3
- package/src/native/picker.d.ts +4 -4
- package/src/native/picker.ts +4 -4
- package/src/overlays/advisor-config.ts +10 -12
- package/src/overlays/agent-hub-projection.d.ts +3 -1
- package/src/overlays/agent-hub-projection.ts +6 -5
- package/src/overlays/agent-hub.ts +51 -42
- package/src/overlays/annotation-overlay.ts +125 -37
- package/src/overlays/annotation-types.ts +24 -0
- package/src/overlays/ask-dialog.ts +125 -35
- package/src/overlays/btw-history-panel.ts +124 -12
- package/src/overlays/btw-history.ts +11 -0
- package/src/overlays/btw-panel.ts +8 -4
- package/src/overlays/context-viewer-format.ts +145 -0
- package/src/overlays/context-viewer-overview.ts +381 -0
- package/src/overlays/context-viewer.ts +728 -0
- package/src/overlays/hook-input.ts +2 -0
- package/src/overlays/hook-selector.ts +2 -2
- package/src/overlays/login-dialog.ts +31 -5
- package/src/overlays/mcp-add-wizard.ts +6 -1
- package/src/overlays/model-browser.ts +37 -0
- package/src/overlays/model-hub.ts +1 -7
- package/src/overlays/model-picker.ts +1 -10
- package/src/overlays/oauth-selector.ts +44 -6
- package/src/overlays/pause-screen.ts +166 -33
- package/src/overlays/plan-review-overlay.ts +13 -2
- package/src/overlays/rewind-selector.ts +29 -12
- package/src/overlays/running-subagent-badge.ts +12 -1
- package/src/overlays/session-selector.ts +313 -42
- package/src/overlays/settings-defs.ts +1 -0
- package/src/overlays/usage-dashboard.ts +20 -14
- package/src/prompt/composer.ts +216 -1
- package/src/prompt/custom-editor.ts +6 -1
- package/src/prompt/emoji-autocomplete.ts +0 -2
- package/src/prompt/interactive-context-helpers.ts +29 -4
- package/src/prompt/macos-spelling.ts +24 -15
- package/src/render/extension-links.d.ts +65 -0
- package/src/render/extension-links.ts +214 -0
- package/src/render/hyperlink.d.ts +38 -7
- package/src/render/hyperlink.ts +102 -23
- package/src/render/index.d.ts +1 -0
- package/src/render/index.ts +1 -0
- package/src/render/output-pane.d.ts +1 -1
- package/src/render/output-pane.ts +60 -17
- package/src/render/render-utils.d.ts +7 -1
- package/src/render/render-utils.ts +11 -2
- package/src/setup/scenes/composer.ts +2 -0
- package/src/setup/scenes/glyph.ts +3 -1
- package/src/setup/scenes/model.ts +192 -29
- package/src/setup/scenes/outro.ts +33 -15
- package/src/setup/scenes/sign-in.ts +194 -392
- package/src/setup/scenes/theme.ts +2 -0
- package/src/setup/scenes/types.ts +18 -1
- package/src/setup/startup-splash.ts +8 -7
- package/src/setup/wizard-overlay.ts +164 -35
- package/src/setup/wizard.ts +11 -2
- package/src/status-line/component.ts +10 -14
- package/src/status-line/context-usage.ts +122 -597
- package/src/status-line/host.ts +6 -2
- package/src/terminal-capabilities.d.ts +7 -0
- package/src/terminal-capabilities.ts +10 -0
- package/src/terminal.ts +24 -2
- package/src/theme/defaults.json +1 -0
- package/src/theme/loader.ts +1 -1
- package/src/theme/symbols.d.ts +1 -1
- package/src/theme/symbols.ts +16 -0
- package/src/theme/theme.d.ts +0 -23
- package/src/theme/theme.ts +2 -75
- package/src/tools/ask.d.ts +4 -0
- package/src/tools/ask.ts +4 -0
- package/src/tools/ast-grep.ts +3 -2
- package/src/tools/bash-interactive.d.ts +49 -0
- package/src/tools/bash-interactive.ts +6 -1
- package/src/tools/bash.d.ts +2 -0
- package/src/tools/bash.ts +7 -23
- package/src/tools/default-renderer.d.ts +6 -4
- package/src/tools/default-renderer.ts +9 -6
- package/src/tools/edit.d.ts +3 -1
- package/src/tools/edit.ts +8 -4
- package/src/tools/eval.ts +14 -4
- package/src/tools/fetch.d.ts +1 -0
- package/src/tools/fetch.ts +1 -0
- package/src/tools/find.ts +3 -10
- package/src/tools/github.d.ts +3 -0
- package/src/tools/github.ts +23 -3
- package/src/tools/glob.ts +4 -3
- package/src/tools/grep.ts +3 -4
- package/src/tools/grouped-file-output.d.ts +2 -0
- package/src/tools/grouped-file-output.ts +8 -2
- package/src/tools/irc.d.ts +6 -0
- package/src/tools/irc.ts +6 -0
- package/src/tools/job-widget.ts +13 -1
- package/src/tools/json-tree.d.ts +23 -4
- package/src/tools/json-tree.ts +132 -42
- package/src/tools/lsp.d.ts +2 -0
- package/src/tools/lsp.ts +36 -15
- package/src/tools/mcp.d.ts +7 -6
- package/src/tools/mcp.ts +41 -15
- package/src/tools/native-view.d.ts +1 -1
- package/src/tools/native-view.ts +3 -3
- package/src/tools/read.d.ts +3 -0
- package/src/tools/read.ts +3 -1
- package/src/tools/renderer.d.ts +2 -0
- package/src/tools/renderer.ts +2 -0
- package/src/tools/streaming-output.d.ts +11 -0
- package/src/tools/streaming-output.ts +41 -0
- package/src/tools/task.d.ts +9 -1
- package/src/tools/task.ts +59 -16
- package/src/tools/url-scheme-host.d.ts +17 -0
- package/src/tools/url-scheme-host.ts +21 -0
- package/src/tools/vibe.ts +14 -3
- package/src/tools/wait.d.ts +16 -2
- package/src/tools/wait.ts +16 -2
- package/src/tools/yield.d.ts +1 -1
- package/src/tools/yield.ts +18 -9
- package/src/tui.d.ts +9 -2
- package/src/tui.ts +102 -34
- package/src/vim.d.ts +39 -0
- package/src/vim.ts +313 -22
- package/dist/types/theme/defaults/index.d.ts +0 -10289
- package/src/theme/defaults/alabaster.json +0 -103
- package/src/theme/defaults/amethyst.json +0 -106
- package/src/theme/defaults/anthracite.json +0 -103
- package/src/theme/defaults/basalt.json +0 -101
- package/src/theme/defaults/birch.json +0 -105
- package/src/theme/defaults/dark-abyss.json +0 -101
- package/src/theme/defaults/dark-arctic.json +0 -114
- package/src/theme/defaults/dark-aurora.json +0 -105
- package/src/theme/defaults/dark-catppuccin.json +0 -117
- package/src/theme/defaults/dark-cavern.json +0 -101
- package/src/theme/defaults/dark-celestial.json +0 -116
- package/src/theme/defaults/dark-copper.json +0 -105
- package/src/theme/defaults/dark-cosmos.json +0 -100
- package/src/theme/defaults/dark-cyberpunk.json +0 -112
- package/src/theme/defaults/dark-dracula.json +0 -108
- package/src/theme/defaults/dark-eclipse.json +0 -101
- package/src/theme/defaults/dark-ember.json +0 -105
- package/src/theme/defaults/dark-equinox.json +0 -100
- package/src/theme/defaults/dark-forest.json +0 -106
- package/src/theme/defaults/dark-github.json +0 -115
- package/src/theme/defaults/dark-gruvbox.json +0 -122
- package/src/theme/defaults/dark-lavender.json +0 -105
- package/src/theme/defaults/dark-lunar.json +0 -99
- package/src/theme/defaults/dark-midnight.json +0 -105
- package/src/theme/defaults/dark-monochrome.json +0 -104
- package/src/theme/defaults/dark-monokai.json +0 -108
- package/src/theme/defaults/dark-nebula.json +0 -100
- package/src/theme/defaults/dark-neon-noir.json +0 -110
- package/src/theme/defaults/dark-nord.json +0 -108
- package/src/theme/defaults/dark-ocean.json +0 -111
- package/src/theme/defaults/dark-one.json +0 -110
- package/src/theme/defaults/dark-poimandres.json +0 -125
- package/src/theme/defaults/dark-rainforest.json +0 -101
- package/src/theme/defaults/dark-reef.json +0 -101
- package/src/theme/defaults/dark-retro.json +0 -102
- package/src/theme/defaults/dark-rose-pine.json +0 -106
- package/src/theme/defaults/dark-sakura.json +0 -105
- package/src/theme/defaults/dark-slate.json +0 -105
- package/src/theme/defaults/dark-solarized.json +0 -107
- package/src/theme/defaults/dark-solstice.json +0 -100
- package/src/theme/defaults/dark-starfall.json +0 -101
- package/src/theme/defaults/dark-sunset.json +0 -109
- package/src/theme/defaults/dark-swamp.json +0 -100
- package/src/theme/defaults/dark-synthwave.json +0 -113
- package/src/theme/defaults/dark-taiga.json +0 -101
- package/src/theme/defaults/dark-terminal.json +0 -105
- package/src/theme/defaults/dark-tokyo-night.json +0 -111
- package/src/theme/defaults/dark-tundra.json +0 -101
- package/src/theme/defaults/dark-twilight.json +0 -101
- package/src/theme/defaults/dark-volcanic.json +0 -101
- package/src/theme/defaults/graphite.json +0 -102
- package/src/theme/defaults/index.d.ts +0 -10289
- package/src/theme/defaults/index.ts +0 -203
- package/src/theme/defaults/light-arctic.json +0 -117
- package/src/theme/defaults/light-aurora-day.json +0 -101
- package/src/theme/defaults/light-canyon.json +0 -101
- package/src/theme/defaults/light-catppuccin.json +0 -116
- package/src/theme/defaults/light-cirrus.json +0 -100
- package/src/theme/defaults/light-coral.json +0 -105
- package/src/theme/defaults/light-cyberpunk.json +0 -106
- package/src/theme/defaults/light-dawn.json +0 -100
- package/src/theme/defaults/light-dunes.json +0 -101
- package/src/theme/defaults/light-eucalyptus.json +0 -105
- package/src/theme/defaults/light-forest.json +0 -110
- package/src/theme/defaults/light-frost.json +0 -105
- package/src/theme/defaults/light-github.json +0 -125
- package/src/theme/defaults/light-glacier.json +0 -101
- package/src/theme/defaults/light-gruvbox.json +0 -118
- package/src/theme/defaults/light-haze.json +0 -100
- package/src/theme/defaults/light-honeycomb.json +0 -105
- package/src/theme/defaults/light-lagoon.json +0 -101
- package/src/theme/defaults/light-lavender.json +0 -105
- package/src/theme/defaults/light-meadow.json +0 -101
- package/src/theme/defaults/light-mint.json +0 -105
- package/src/theme/defaults/light-monochrome.json +0 -111
- package/src/theme/defaults/light-ocean.json +0 -109
- package/src/theme/defaults/light-one.json +0 -109
- package/src/theme/defaults/light-opal.json +0 -101
- package/src/theme/defaults/light-orchard.json +0 -101
- package/src/theme/defaults/light-paper.json +0 -105
- package/src/theme/defaults/light-poimandres.json +0 -125
- package/src/theme/defaults/light-prism.json +0 -100
- package/src/theme/defaults/light-retro.json +0 -108
- package/src/theme/defaults/light-sand.json +0 -105
- package/src/theme/defaults/light-savanna.json +0 -101
- package/src/theme/defaults/light-solarized.json +0 -112
- package/src/theme/defaults/light-soleil.json +0 -100
- package/src/theme/defaults/light-sunset.json +0 -109
- package/src/theme/defaults/light-synthwave.json +0 -108
- package/src/theme/defaults/light-tokyo-night.json +0 -121
- package/src/theme/defaults/light-wetland.json +0 -101
- package/src/theme/defaults/light-zenith.json +0 -99
- package/src/theme/defaults/limestone.json +0 -104
- package/src/theme/defaults/mahogany.json +0 -107
- package/src/theme/defaults/marble.json +0 -103
- package/src/theme/defaults/obsidian.json +0 -101
- package/src/theme/defaults/onyx.json +0 -101
- package/src/theme/defaults/pearl.json +0 -103
- package/src/theme/defaults/porcelain.json +0 -101
- package/src/theme/defaults/quartz.json +0 -106
- package/src/theme/defaults/sandstone.json +0 -105
- package/src/theme/defaults/titanium.json +0 -100
|
@@ -18,6 +18,7 @@ import { formatBytes, getProjectDir } from "@linxiraos/pi-utils";
|
|
|
18
18
|
import type { TspPickerGroup, TspPickerItem, TspSpan, TspText, TspTone } from "@linxiraos/pi-wire";
|
|
19
19
|
import { compact, kv, md, node, span } from "../native/describe";
|
|
20
20
|
import {
|
|
21
|
+
bindingKeys,
|
|
21
22
|
picker,
|
|
22
23
|
pickerAction,
|
|
23
24
|
pickerAge,
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
pickerHits,
|
|
28
29
|
} from "../native/picker";
|
|
29
30
|
import type { DescribeContext, NativeChild, NativeNode, NativeUiEvent } from "../native/node";
|
|
30
|
-
import { hintsRow, type NativeHint, overlayCard } from "../native/overlay";
|
|
31
|
+
import { actionHint, hintsRow, type NativeHint, overlayCard } from "../native/overlay";
|
|
31
32
|
import { plainText } from "../native/spans";
|
|
32
33
|
import { tuiText, tuiTextFmt } from "../i18n";
|
|
33
34
|
import {
|
|
@@ -45,6 +46,7 @@ import {
|
|
|
45
46
|
import { theme } from "../theme/theme";
|
|
46
47
|
import { contentRowWidth } from "../chrome/selector-helpers";
|
|
47
48
|
import { matchesAppInterrupt, matchesSelectDown, matchesSelectUp } from "../keybinding-matchers";
|
|
49
|
+
import { getKeybindings } from "../keybindings";
|
|
48
50
|
/** Session lifecycle status presented by the picker. */
|
|
49
51
|
export type SessionSelectorStatus = "complete" | "interrupted" | "aborted" | "error" | "pending" | "unknown";
|
|
50
52
|
|
|
@@ -64,6 +66,7 @@ export interface SessionSelectorEntry {
|
|
|
64
66
|
parentSessionPath?: string;
|
|
65
67
|
}
|
|
66
68
|
import { shortenPath } from "../render/render-utils";
|
|
69
|
+
import { formTheme } from "../chrome/form-theme";
|
|
67
70
|
import { HookSelectorComponent } from "./hook-selector";
|
|
68
71
|
import { ResumeTreeComponent, type ResumeTreeSource } from "./resume-tree";
|
|
69
72
|
|
|
@@ -80,6 +83,7 @@ export type {
|
|
|
80
83
|
ResumeWorkspaceLike,
|
|
81
84
|
} from "./resume-picker";
|
|
82
85
|
import { bottomBorder, OverlayPanel, row, topBorder } from "../chrome/overlay-box";
|
|
86
|
+
import { TextFormField } from "../components/form";
|
|
83
87
|
import { MenuSelection, getMenuWindow } from "../components/menu-selection";
|
|
84
88
|
import { formatKeyHint, formatKeyHints } from "../app-keybindings";
|
|
85
89
|
import { boundKeys, interruptKey } from "../chrome/keybinding-hints";
|
|
@@ -545,6 +549,8 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
545
549
|
readonly #getTerminalRows: () => number;
|
|
546
550
|
|
|
547
551
|
onDeleteRequest?: (session: T) => void;
|
|
552
|
+
onRenameRequest?: (session: T) => void;
|
|
553
|
+
onPinRequest?: (session: T, pinned: boolean) => void;
|
|
548
554
|
|
|
549
555
|
#allSessions: T[];
|
|
550
556
|
#showCwd: boolean;
|
|
@@ -618,7 +624,7 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
618
624
|
this.#getCurrentSessionPath =
|
|
619
625
|
typeof currentSessionPath === "function" ? currentSessionPath : () => currentSessionPath;
|
|
620
626
|
this.#historyMatcher = historyMatcher;
|
|
621
|
-
this.#menu = new MenuSelection<T>(sessions, {
|
|
627
|
+
this.#menu = new MenuSelection<T>(this.#pinnedFirst(sessions), {
|
|
622
628
|
getKey: session => session.path,
|
|
623
629
|
getSearchText: sessionSearchText,
|
|
624
630
|
});
|
|
@@ -714,8 +720,9 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
714
720
|
this.#hadFilterQuery = tokens.length > 0;
|
|
715
721
|
this.#lastFilterQuery = query;
|
|
716
722
|
if (tokens.length === 0) {
|
|
717
|
-
const
|
|
718
|
-
this.#menu.
|
|
723
|
+
const items = this.#pinnedFirst(this.#allSessions);
|
|
724
|
+
const keepIndex = Math.min(this.#menu.selectedIndex, Math.max(0, items.length - 1));
|
|
725
|
+
this.#menu.setItems(items, keepIndex >= 0 ? items[keepIndex]?.path : undefined);
|
|
719
726
|
if (hadQuery) this.#selectCurrentSession();
|
|
720
727
|
this.#scheduleHistoryMerge(query);
|
|
721
728
|
return;
|
|
@@ -789,8 +796,9 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
789
796
|
}
|
|
790
797
|
|
|
791
798
|
/**
|
|
792
|
-
* Rebuild the menu's visible list with
|
|
793
|
-
* prompt-history hits, literal matches (recency), and
|
|
799
|
+
* Rebuild the menu's visible list with pinned sessions first, then title
|
|
800
|
+
* matches, other prompt-history hits, literal matches (recency), and
|
|
801
|
+
* fuzzy-only hits (score).
|
|
794
802
|
*/
|
|
795
803
|
#composeFiltered(): void {
|
|
796
804
|
this.#itemsVersion++;
|
|
@@ -798,17 +806,31 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
798
806
|
const base: T[] = [];
|
|
799
807
|
for (const match of this.#literalRanked) base.push(match.session);
|
|
800
808
|
for (const match of this.#fuzzyRanked) base.push(match.session);
|
|
801
|
-
const composed =
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
809
|
+
const composed = this.#pinnedFirst(
|
|
810
|
+
prioritizeTitleMatches(
|
|
811
|
+
this.#historyIds.length > 0 ? mergeSessionRanking(this.#allSessions, base, this.#historyIds) : base,
|
|
812
|
+
tokenizeSessionQuery(this.#searchInput.getValue()),
|
|
813
|
+
this.#literalRanked,
|
|
814
|
+
),
|
|
805
815
|
);
|
|
806
|
-
//
|
|
807
|
-
// selection
|
|
816
|
+
// A late pinned or history match can land above the cursor: a moved
|
|
817
|
+
// selection follows its session, an untouched one keeps the top rank.
|
|
818
|
+
// The query path resets explicitly.
|
|
819
|
+
if (this.#selectionMoved) {
|
|
820
|
+
this.#menu.setItems(composed);
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
808
823
|
const keepIndex = Math.min(this.#menu.selectedIndex, Math.max(0, composed.length - 1));
|
|
809
824
|
this.#menu.setItems(composed, keepIndex >= 0 ? composed[keepIndex]?.path : undefined);
|
|
810
825
|
}
|
|
811
826
|
|
|
827
|
+
/** Stable partition: pinned sessions first, each group in its incoming order. */
|
|
828
|
+
#pinnedFirst(sessions: readonly T[]): readonly T[] {
|
|
829
|
+
const pins = this.#pinnedIds;
|
|
830
|
+
const pinned = pins.size > 0 ? sessions.filter(session => pins.has(session.id)) : [];
|
|
831
|
+
return pinned.length > 0 ? [...pinned, ...sessions.filter(session => !pins.has(session.id))] : sessions;
|
|
832
|
+
}
|
|
833
|
+
|
|
812
834
|
/**
|
|
813
835
|
* Augment ranked results with prompt-history matches without replacing them.
|
|
814
836
|
* The session-list corpus only sees the first 4KB of each session, so a prompt
|
|
@@ -870,6 +892,22 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
870
892
|
}
|
|
871
893
|
}
|
|
872
894
|
|
|
895
|
+
/** Update a session's title in place and refresh the visible list, keeping the selection. */
|
|
896
|
+
renameSessionTitle(sessionPath: string, title: string): void {
|
|
897
|
+
const entry = this.#allSessions.find(s => s.path === sessionPath);
|
|
898
|
+
if (!entry) return;
|
|
899
|
+
this.#datasetVersion++;
|
|
900
|
+
entry.title = title;
|
|
901
|
+
// The cached native item embeds the old title, and the search haystack
|
|
902
|
+
// caches it too: drop both so the next describe rebuilds the row and
|
|
903
|
+
// the literal/fuzzy search paths match the new title. Selection is
|
|
904
|
+
// path-keyed, so the same-query refilter keeps the cursor on the
|
|
905
|
+
// renamed session.
|
|
906
|
+
delete (entry as NativeSessionInfo)[kNativeItem];
|
|
907
|
+
delete (entry as SearchableSessionInfo)[kSearchTextLower];
|
|
908
|
+
this.#filterSessions(this.#searchInput.getValue());
|
|
909
|
+
}
|
|
910
|
+
|
|
873
911
|
/** Resolve a list-local rendered-line index to a filtered-session index. */
|
|
874
912
|
hitTestSession(line: number): number | undefined {
|
|
875
913
|
return this.#hitRows[line];
|
|
@@ -913,6 +951,43 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
913
951
|
if (selected) this.onDeleteRequest?.(selected);
|
|
914
952
|
}
|
|
915
953
|
|
|
954
|
+
/** F2: ask the parent to rename the selected session. */
|
|
955
|
+
requestRename(): void {
|
|
956
|
+
const selected = this.#menu.selectedItem;
|
|
957
|
+
if (selected) this.onRenameRequest?.(selected);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/** Pin keys: ask the parent to pin or unpin the selected session (default: flip it); no-op when already there. */
|
|
961
|
+
requestPin(pinned?: boolean): void {
|
|
962
|
+
const selected = this.#menu.selectedItem;
|
|
963
|
+
if (!selected) return;
|
|
964
|
+
const isPinned = this.#pinnedIds.has(selected.id);
|
|
965
|
+
if (pinned !== isPinned) this.onPinRequest?.(selected, !isPinned);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
/** Apply a persisted pin change; the list re-partitions and the cursor follows the session. */
|
|
969
|
+
setPinned(sessionId: string, pinned: boolean): void {
|
|
970
|
+
const pinnedIds = new Set(this.#pinnedIds);
|
|
971
|
+
if (pinned) pinnedIds.add(sessionId);
|
|
972
|
+
else pinnedIds.delete(sessionId);
|
|
973
|
+
this.#pinnedIds = pinnedIds;
|
|
974
|
+
// Counts as moving the selection: it keeps the cursor on this session
|
|
975
|
+
// and a pending history merge from reordering under it.
|
|
976
|
+
this.#selectionMoved = true;
|
|
977
|
+
if (this.#hadFilterQuery) {
|
|
978
|
+
this.#composeFiltered();
|
|
979
|
+
} else {
|
|
980
|
+
this.#itemsVersion++;
|
|
981
|
+
this.#menu.setItems(this.#pinnedFirst(this.#allSessions));
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/** Whether the selected session is pinned (picks the pin action's direction). */
|
|
986
|
+
get selectedPinned(): boolean {
|
|
987
|
+
const selected = this.#menu.selectedItem;
|
|
988
|
+
return selected !== undefined && this.#pinnedIds.has(selected.id);
|
|
989
|
+
}
|
|
990
|
+
|
|
916
991
|
/** Empty the search query (the empty state's "Clear search"). */
|
|
917
992
|
clearSearch(): void {
|
|
918
993
|
this.#searchInput.setValue("");
|
|
@@ -966,7 +1041,7 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
966
1041
|
if (tokens.length === 0) {
|
|
967
1042
|
const now = new Date();
|
|
968
1043
|
const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
|
|
969
|
-
// Pins lead the listing (`
|
|
1044
|
+
// Pins lead the listing (`#pinnedFirst`), so they get their own group ahead of the days.
|
|
970
1045
|
const groups = visible.map(session =>
|
|
971
1046
|
this.#pinnedIds.has(session.id) ? PINNED_GROUP : sessionDayGroup(session.modified, startOfToday),
|
|
972
1047
|
);
|
|
@@ -1331,6 +1406,21 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
1331
1406
|
this.requestDelete();
|
|
1332
1407
|
return;
|
|
1333
1408
|
}
|
|
1409
|
+
// F2 renames the selected session; as a non-printable key it never
|
|
1410
|
+
// collides with the search input.
|
|
1411
|
+
if (matchesKey(keyData, "f2")) {
|
|
1412
|
+
this.requestRename();
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
const keybindings = getKeybindings();
|
|
1416
|
+
if (keybindings.matches(keyData, "app.session.pin")) {
|
|
1417
|
+
this.requestPin(true);
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
if (keybindings.matches(keyData, "app.session.unpin")) {
|
|
1421
|
+
this.requestPin(false);
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1334
1424
|
// Up arrow
|
|
1335
1425
|
if (matchesSelectUp(keyData)) {
|
|
1336
1426
|
this.#selectionMoved = true;
|
|
@@ -1386,6 +1476,14 @@ class SessionList<T extends SessionSelectorEntry> implements Component {
|
|
|
1386
1476
|
|
|
1387
1477
|
export interface SessionSelectorOptions<T extends SessionSelectorEntry = SessionSelectorEntry> {
|
|
1388
1478
|
onDelete?: (session: T) => Promise<boolean>;
|
|
1479
|
+
/**
|
|
1480
|
+
* Rename the selected session to a user-supplied title; resolve with the
|
|
1481
|
+
* title as stored (the session canonicalizes it) or null when the rename
|
|
1482
|
+
* did not happen.
|
|
1483
|
+
*/
|
|
1484
|
+
onRename?: (session: T, title: string) => Promise<string | null>;
|
|
1485
|
+
/** Persist the selected session's pin state (pin keys / the picker's Pin action). */
|
|
1486
|
+
onSetPinned?: (session: T, pinned: boolean) => Promise<void>;
|
|
1389
1487
|
historyMatcher?: SessionHistoryMatcher;
|
|
1390
1488
|
/** Loads sessions across all projects for the all-projects scope toggle (Tab). */
|
|
1391
1489
|
loadAllSessions?: () => Promise<T[]>;
|
|
@@ -1487,15 +1585,21 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1487
1585
|
#nativePicker = false;
|
|
1488
1586
|
readonly #getTerminalRowsOption: (() => number) | undefined;
|
|
1489
1587
|
#confirmationDialog: HookSelectorComponent | null = null;
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1588
|
+
/** Open rename dialog: an OverlayPanel hosting the rename TextFormField. */
|
|
1589
|
+
#renameDialog: OverlayPanel | null = null;
|
|
1590
|
+
/** The rename dialog's input; keystrokes route here while the dialog is open. */
|
|
1591
|
+
#renameField: TextFormField | null = null;
|
|
1592
|
+
// Hosts whichever of `#sessionList` / `#confirmationDialog` / `#renameDialog`
|
|
1593
|
+
// is live this frame. The delete dialog REPLACES the list in this slot rather
|
|
1594
|
+
// than being appended below the picker chrome, so the picker is always
|
|
1493
1595
|
// `chrome + max(list, dialog) + chrome` and never overflows the viewport
|
|
1494
1596
|
// (issue #3283: an overflowing dialog frame committed the header into
|
|
1495
1597
|
// scrollback, stranding it above the viewport once the dialog closed).
|
|
1496
1598
|
#contentSlot: Container;
|
|
1497
1599
|
#messageContainer: Container;
|
|
1498
1600
|
#onDelete?: (session: T) => Promise<boolean>;
|
|
1601
|
+
#onRename?: (session: T, title: string) => Promise<string | null>;
|
|
1602
|
+
#onSetPinned?: (session: T, pinned: boolean) => Promise<void>;
|
|
1499
1603
|
#onRequestRender?: () => void;
|
|
1500
1604
|
readonly #loadAllSessions?: () => Promise<T[]>;
|
|
1501
1605
|
#folderSessions: T[];
|
|
@@ -1577,6 +1681,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1577
1681
|
message: SessionPickerMessage | undefined;
|
|
1578
1682
|
errorOpen: boolean;
|
|
1579
1683
|
choice: DeleteChoice<T> | null;
|
|
1684
|
+
rename: OverlayPanel | null;
|
|
1580
1685
|
node: NativeNode;
|
|
1581
1686
|
}
|
|
1582
1687
|
| undefined;
|
|
@@ -1585,7 +1690,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1585
1690
|
title: string;
|
|
1586
1691
|
scope: "folder" | "all";
|
|
1587
1692
|
message: SessionPickerMessage | undefined;
|
|
1588
|
-
dialog: HookSelectorComponent | null;
|
|
1693
|
+
dialog: HookSelectorComponent | OverlayPanel | null;
|
|
1589
1694
|
list: NativeNode;
|
|
1590
1695
|
node: NativeNode;
|
|
1591
1696
|
}
|
|
@@ -1602,6 +1707,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1602
1707
|
|
|
1603
1708
|
this.#messageContainer = new Container();
|
|
1604
1709
|
this.#onDelete = options.onDelete;
|
|
1710
|
+
this.#onRename = options.onRename;
|
|
1711
|
+
this.#onSetPinned = options.onSetPinned;
|
|
1605
1712
|
this.#loadAllSessions = options.loadAllSessions;
|
|
1606
1713
|
this.#folderSessions = sessions;
|
|
1607
1714
|
// Storage directory, not recorded cwd: one folder's sessions may record
|
|
@@ -1657,6 +1764,16 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1657
1764
|
this.#showDeleteConfirmation(session);
|
|
1658
1765
|
};
|
|
1659
1766
|
}
|
|
1767
|
+
if (this.#onRename) {
|
|
1768
|
+
this.#sessionList.onRenameRequest = (session: T) => {
|
|
1769
|
+
this.#showRenameDialog(session);
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
if (this.#onSetPinned) {
|
|
1773
|
+
this.#sessionList.onPinRequest = (session: T, pinned: boolean) => {
|
|
1774
|
+
void this.#setPinned(session, pinned);
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1660
1777
|
if (this.#loadAllSessions || this.#globalSessions) {
|
|
1661
1778
|
this.#sessionList.onToggleScope = () => {
|
|
1662
1779
|
void this.#toggleScope();
|
|
@@ -1723,7 +1840,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1723
1840
|
* never pays for the cross-project scan.
|
|
1724
1841
|
*/
|
|
1725
1842
|
async #toggleScope(): Promise<void> {
|
|
1726
|
-
if (this.#toggling || this.#confirmationDialog) return;
|
|
1843
|
+
if (this.#toggling || this.#confirmationDialog || this.#renameDialog) return;
|
|
1727
1844
|
if (this.#scope === "folder") {
|
|
1728
1845
|
let global = this.#globalSessions;
|
|
1729
1846
|
if (!global) {
|
|
@@ -1865,6 +1982,107 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1865
1982
|
this.#onRequestRender?.();
|
|
1866
1983
|
}
|
|
1867
1984
|
|
|
1985
|
+
/**
|
|
1986
|
+
* Mirror a renamed title into the scope caches. The visible list holds
|
|
1987
|
+
* one entry per session, but the folder and all-projects caches can hold
|
|
1988
|
+
* their own copies of the same session, so a rename has to reach all of
|
|
1989
|
+
* them or a scope switch shows the old title again.
|
|
1990
|
+
*/
|
|
1991
|
+
#syncScopeTitles(sessionPath: string, title: string): void {
|
|
1992
|
+
for (const cache of [this.#folderSessions, this.#globalSessions]) {
|
|
1993
|
+
if (!cache) continue;
|
|
1994
|
+
const entry = cache.find(s => s.path === sessionPath);
|
|
1995
|
+
if (!entry) continue;
|
|
1996
|
+
entry.title = title;
|
|
1997
|
+
delete (entry as NativeSessionInfo)[kNativeItem];
|
|
1998
|
+
delete (entry as SearchableSessionInfo)[kSearchTextLower];
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
/** Close the rename dialog without changes, restoring the session list. */
|
|
2003
|
+
#closeRenameDialog(): void {
|
|
2004
|
+
if (!this.#renameDialog) return;
|
|
2005
|
+
this.#renameDialog = null;
|
|
2006
|
+
this.#renameField = null;
|
|
2007
|
+
// Restore the SessionList into the content slot so the picker is back
|
|
2008
|
+
// to its normal layout on the very next render — the same frame the
|
|
2009
|
+
// dialog disappears.
|
|
2010
|
+
this.#contentSlot.clear();
|
|
2011
|
+
this.#contentSlot.addChild(this.#sessionList);
|
|
2012
|
+
this.#onRequestRender?.();
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
#showRenameDialog(session: T): void {
|
|
2016
|
+
if (!this.#onRename || this.#confirmationDialog || this.#renameDialog || this.#toggling) return;
|
|
2017
|
+
// One submit at a time: a second Enter while the rename is still
|
|
2018
|
+
// awaiting disk I/O would queue a second write for the same session.
|
|
2019
|
+
let pending = false;
|
|
2020
|
+
// This editor's own identity: a submit that settles after the user
|
|
2021
|
+
// opened another editor must not close it.
|
|
2022
|
+
const owner = new OverlayPanel("Rename Session");
|
|
2023
|
+
const submit = async (value: string) => {
|
|
2024
|
+
if (pending) return;
|
|
2025
|
+
const title = value.trim();
|
|
2026
|
+
// Empty treated as cancel: Esc and a blank submit both leave the title.
|
|
2027
|
+
if (title.length === 0) {
|
|
2028
|
+
this.#closeRenameDialog();
|
|
2029
|
+
return;
|
|
2030
|
+
}
|
|
2031
|
+
const rename = this.#onRename;
|
|
2032
|
+
if (!rename) {
|
|
2033
|
+
this.#closeRenameDialog();
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
this.#clearError();
|
|
2037
|
+
pending = true;
|
|
2038
|
+
try {
|
|
2039
|
+
const stored = await rename(session, title);
|
|
2040
|
+
if (stored) {
|
|
2041
|
+
// The stored title is the canonical one (the session may
|
|
2042
|
+
// collapse whitespace), so the row and the search index
|
|
2043
|
+
// match what is on disk.
|
|
2044
|
+
this.#sessionList.renameSessionTitle(session.path, stored);
|
|
2045
|
+
this.#syncScopeTitles(session.path, stored);
|
|
2046
|
+
if (this.#preview?.session === session) this.#preview = undefined;
|
|
2047
|
+
} else {
|
|
2048
|
+
this.#showError("Failed to rename session.");
|
|
2049
|
+
}
|
|
2050
|
+
} catch (err) {
|
|
2051
|
+
this.#showError(err instanceof Error ? err.message : String(err));
|
|
2052
|
+
} finally {
|
|
2053
|
+
pending = false;
|
|
2054
|
+
}
|
|
2055
|
+
if (this.#renameDialog === owner) this.#closeRenameDialog();
|
|
2056
|
+
};
|
|
2057
|
+
const field = new TextFormField({
|
|
2058
|
+
theme: formTheme,
|
|
2059
|
+
label: "Rename session",
|
|
2060
|
+
initialValue: session.title ?? "",
|
|
2061
|
+
empty: "cancel",
|
|
2062
|
+
onSubmit: value => {
|
|
2063
|
+
void submit(value);
|
|
2064
|
+
},
|
|
2065
|
+
onCancel: () => {
|
|
2066
|
+
// A cancel while the rename is still in flight must not tear
|
|
2067
|
+
// the editor down underneath it; the submit closes it.
|
|
2068
|
+
if (pending) return;
|
|
2069
|
+
this.#closeRenameDialog();
|
|
2070
|
+
},
|
|
2071
|
+
});
|
|
2072
|
+
field.focused = true;
|
|
2073
|
+
owner.addChild(field);
|
|
2074
|
+
this.#renameDialog = owner;
|
|
2075
|
+
this.#renameField = field;
|
|
2076
|
+
// Swap the SessionList out of the content slot and mount the dialog in its
|
|
2077
|
+
// place: the dialog competes only with the SessionList's rendered budget,
|
|
2078
|
+
// never the SessionList AND the picker chrome, so the picker frame stays
|
|
2079
|
+
// inside the terminal viewport and the TUI never commits the header into
|
|
2080
|
+
// scrollback (issue #3283).
|
|
2081
|
+
this.#contentSlot.clear();
|
|
2082
|
+
this.#contentSlot.addChild(owner);
|
|
2083
|
+
this.#onRequestRender?.();
|
|
2084
|
+
}
|
|
2085
|
+
|
|
1868
2086
|
/**
|
|
1869
2087
|
* Render the panel directly so fill-height mode can keep its footer pinned
|
|
1870
2088
|
* while sharing OverlayPanel's exact rounded-box chrome. Children receive
|
|
@@ -1889,9 +2107,34 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1889
2107
|
return lines;
|
|
1890
2108
|
}
|
|
1891
2109
|
|
|
2110
|
+
/** Persist a pin change, then reorder the list; a failure shows the error and leaves the list as it was. */
|
|
2111
|
+
async #setPinned(session: T, pinned: boolean): Promise<void> {
|
|
2112
|
+
if (!this.#onSetPinned) return;
|
|
2113
|
+
this.#clearError();
|
|
2114
|
+
try {
|
|
2115
|
+
await this.#onSetPinned(session, pinned);
|
|
2116
|
+
this.#sessionList.setPinned(session.id, pinned);
|
|
2117
|
+
} catch (err) {
|
|
2118
|
+
this.#showError(err instanceof Error ? err.message : String(err));
|
|
2119
|
+
}
|
|
2120
|
+
this.#onRequestRender?.();
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
/** The pin action that applies to the selected session: unpin when it is pinned, else pin. */
|
|
2124
|
+
#pinAction(): { binding: "app.session.pin" | "app.session.unpin"; label: string } | undefined {
|
|
2125
|
+
if (!this.#onSetPinned) return undefined;
|
|
2126
|
+
return this.#sessionList.selectedPinned
|
|
2127
|
+
? { binding: "app.session.unpin", label: "unpin" }
|
|
2128
|
+
: { binding: "app.session.pin", label: "pin" };
|
|
2129
|
+
}
|
|
2130
|
+
|
|
1892
2131
|
/** Blank · keybinding hint · bottom border. Rendered by {@link render}. */
|
|
1893
2132
|
#footerLines(width: number): string[] {
|
|
1894
2133
|
const cancel = interruptKey();
|
|
2134
|
+
const scopeHint = this.#scope === "all" ? "current folder" : "all projects";
|
|
2135
|
+
// Keys mirror SessionList#handleInput; cancel is `app.interrupt` (raw Escape when unbound).
|
|
2136
|
+
const pin = this.#pinAction();
|
|
2137
|
+
const pinKey = pin && getKeybindings().getKeys(pin.binding)[0];
|
|
1895
2138
|
const hint = this.#resumeTree
|
|
1896
2139
|
? composeFooter(
|
|
1897
2140
|
width,
|
|
@@ -1918,7 +2161,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1918
2161
|
)
|
|
1919
2162
|
: theme.fg(
|
|
1920
2163
|
"muted",
|
|
1921
|
-
`[${this.#onDelete ? `${formatKeyHints(["delete", "backspace"])} delete · ` : ""}${formatKeyHint("
|
|
2164
|
+
`[${this.#onDelete ? `${formatKeyHints(["delete", "backspace"])} delete · ` : ""}${this.#onRename ? `${formatKeyHint("f2")} rename · ` : ""}${pinKey ? `${formatKeyHint(pinKey)} ${pin.label} · ` : ""}${formatKeyHint("enter")} select · ${formatKeyHint("tab")} ${scopeHint} · ${cancel} cancel]`,
|
|
1922
2165
|
);
|
|
1923
2166
|
return [row("", width), row(hint, width), row("", width), bottomBorder(width)];
|
|
1924
2167
|
}
|
|
@@ -1930,31 +2173,41 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1930
2173
|
|
|
1931
2174
|
/** Over the transcript the picker is its own sheet (`layer`); the standalone app fills the screen surface. */
|
|
1932
2175
|
nativeSheet(cx: DescribeContext): boolean {
|
|
2176
|
+
// A rename editor is a card with a text field, not a picker sheet: it
|
|
2177
|
+
// renders in place, like the generic composition does.
|
|
2178
|
+
if (this.#renameDialog) return false;
|
|
1933
2179
|
return cx.supports("picker") && !this.#standalone;
|
|
1934
2180
|
}
|
|
1935
2181
|
|
|
1936
2182
|
/**
|
|
1937
2183
|
* With the `picker` kind: the data-first session picker (§4.7). Otherwise
|
|
1938
2184
|
* scope `tabs`, loading/error message, then the search `input` and session
|
|
1939
|
-
* `list` — or the delete-confirmation dialog in their place, as on
|
|
1940
|
-
* path — and the key-hint footer.
|
|
2185
|
+
* `list` — or the delete-confirmation / rename dialog in their place, as on
|
|
2186
|
+
* the ANSI path — and the key-hint footer.
|
|
1941
2187
|
*/
|
|
1942
2188
|
override describe(cx: DescribeContext): NativeNode {
|
|
1943
|
-
|
|
2189
|
+
// The picker kind has no text-input affordance, so a rename would
|
|
2190
|
+
// capture every keystroke into an invisible field. While the rename
|
|
2191
|
+
// editor is open, describe the card path instead (the same fallback
|
|
2192
|
+
// the hook selector uses for its slider and countdown).
|
|
2193
|
+
if (cx.supports("picker") && !this.#renameDialog) {
|
|
1944
2194
|
// The native picker owns its own event model; raw keys must keep going
|
|
1945
2195
|
// to the list even though the ANSI tree is constructed.
|
|
1946
2196
|
this.#nativePicker = true;
|
|
1947
2197
|
return this.#describePicker();
|
|
1948
2198
|
}
|
|
1949
2199
|
this.#nativePicker = false;
|
|
1950
|
-
|
|
2200
|
+
// The rename card is an in-place fallback on picker terminals; only a
|
|
2201
|
+
// terminal without the kind swaps the flat list for the ANSI tree.
|
|
2202
|
+
if (!cx.supports("picker")) this.#mountResumeTree();
|
|
1951
2203
|
const list = this.#sessionList.describeList();
|
|
2204
|
+
const dialog = this.#confirmationDialog ?? this.#renameDialog;
|
|
1952
2205
|
const memo = this.#nativeMemo;
|
|
1953
2206
|
if (
|
|
1954
2207
|
memo?.title === this.title &&
|
|
1955
2208
|
memo.scope === this.#scope &&
|
|
1956
2209
|
memo.message === this.#message &&
|
|
1957
|
-
memo.dialog ===
|
|
2210
|
+
memo.dialog === dialog &&
|
|
1958
2211
|
memo.list === list
|
|
1959
2212
|
) {
|
|
1960
2213
|
return memo.node;
|
|
@@ -1968,13 +2221,16 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1968
2221
|
} else if (message) {
|
|
1969
2222
|
children.push(node("text", { spans: [span(message.text, "error")] }, undefined, "message"));
|
|
1970
2223
|
}
|
|
1971
|
-
if (
|
|
1972
|
-
children.push(
|
|
2224
|
+
if (dialog) {
|
|
2225
|
+
children.push(dialog);
|
|
1973
2226
|
} else {
|
|
1974
2227
|
children.push(this.#sessionList.searchInput, list);
|
|
1975
2228
|
}
|
|
1976
2229
|
const hints: (NativeHint | undefined)[] = [];
|
|
1977
2230
|
if (this.#onDelete) hints.push({ keys: ["delete", "backspace"], label: "delete" });
|
|
2231
|
+
if (this.#onRename) hints.push({ keys: ["f2"], label: "rename" });
|
|
2232
|
+
const pin = this.#pinAction();
|
|
2233
|
+
if (pin) hints.push(actionHint(pin.binding, pin.label));
|
|
1978
2234
|
hints.push({ keys: ["enter"], label: "select" });
|
|
1979
2235
|
if (this.#sessionList.onToggleScope) {
|
|
1980
2236
|
hints.push({ keys: ["tab"], label: this.#scope === "all" ? "current folder" : "all projects" });
|
|
@@ -1988,7 +2244,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
1988
2244
|
title: this.title,
|
|
1989
2245
|
scope: this.#scope,
|
|
1990
2246
|
message,
|
|
1991
|
-
dialog
|
|
2247
|
+
dialog,
|
|
1992
2248
|
list,
|
|
1993
2249
|
node: result,
|
|
1994
2250
|
};
|
|
@@ -2276,8 +2532,9 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
2276
2532
|
* `lg` cards sheet (`screen` for the standalone app): sessions grouped by
|
|
2277
2533
|
* day (ranked flat while searching), the selected session's preview, the
|
|
2278
2534
|
* delete confirm strip, and the actions of the keys Enter, Delete/Backspace,
|
|
2279
|
-
*
|
|
2280
|
-
*
|
|
2535
|
+
* F2 (rename), the pin keys (Pin / Unpin, whichever applies to the selected
|
|
2536
|
+
* session), Tab (the scope toggle, labelled with the scope it switches
|
|
2537
|
+
* to) and Esc. Untitled unless the caller named it; the placeholder says the scope.
|
|
2281
2538
|
*/
|
|
2282
2539
|
#describePicker(): NativeNode {
|
|
2283
2540
|
if (this.#resumeSource) return this.#describeResumePicker();
|
|
@@ -2287,6 +2544,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
2287
2544
|
const message = this.#message;
|
|
2288
2545
|
const errorOpen = this.#pickerErrorOpen && message?.kind === "error";
|
|
2289
2546
|
const choice = this.#deleteChoice;
|
|
2547
|
+
const rename = this.#renameDialog;
|
|
2290
2548
|
const memo = this.#pickerMemo;
|
|
2291
2549
|
if (
|
|
2292
2550
|
memo?.view === view &&
|
|
@@ -2294,7 +2552,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
2294
2552
|
memo.scope === this.#scope &&
|
|
2295
2553
|
memo.message === message &&
|
|
2296
2554
|
memo.errorOpen === errorOpen &&
|
|
2297
|
-
memo.choice === choice
|
|
2555
|
+
memo.choice === choice &&
|
|
2556
|
+
memo.rename === rename
|
|
2298
2557
|
) {
|
|
2299
2558
|
return memo.node;
|
|
2300
2559
|
}
|
|
@@ -2302,6 +2561,9 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
2302
2561
|
const toggle = list.onToggleScope !== undefined;
|
|
2303
2562
|
const actions = [pickerAction("resume", this.#actionLabel, "enter", { primary: true })];
|
|
2304
2563
|
if (this.#onDelete) actions.push(pickerAction("delete", "Delete", "backspace"));
|
|
2564
|
+
if (this.#onRename) actions.push(pickerAction("rename", "Rename", "f2"));
|
|
2565
|
+
const pin = this.#pinAction();
|
|
2566
|
+
if (pin) actions.push(pickerAction("pin", pin.label === "pin" ? "Pin" : "Unpin", bindingKeys(pin.binding)));
|
|
2305
2567
|
if (toggle) {
|
|
2306
2568
|
actions.push(pickerAction("scope", this.#scope === "all" ? "This folder" : "All projects", "tab"));
|
|
2307
2569
|
}
|
|
@@ -2352,7 +2614,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
2352
2614
|
},
|
|
2353
2615
|
preview,
|
|
2354
2616
|
);
|
|
2355
|
-
this.#pickerMemo = { view, preview, scope: this.#scope, message, errorOpen, choice, node: result };
|
|
2617
|
+
this.#pickerMemo = { view, preview, scope: this.#scope, message, errorOpen, choice, rename, node: result };
|
|
2356
2618
|
return result;
|
|
2357
2619
|
}
|
|
2358
2620
|
|
|
@@ -2390,31 +2652,37 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
2390
2652
|
|
|
2391
2653
|
/**
|
|
2392
2654
|
* Picker pointer events run the keys' paths: a row click selects (arrows),
|
|
2393
|
-
* a second click or `Resume` resumes (Enter), `Delete` asks (Delete),
|
|
2394
|
-
* tab or `All projects` toggles scope (Tab),
|
|
2395
|
-
* the confirm strip answers the delete dialog (Yes / Esc).
|
|
2655
|
+
* a second click or `Resume` resumes (Enter), `Delete` asks (Delete),
|
|
2656
|
+
* `Rename` renames (F2), `Pin` / `Unpin` flips the pin, the tab or `All projects` toggles scope (Tab),
|
|
2657
|
+
* `Close` cancels (Esc), and the confirm strip answers the delete dialog (Yes / Esc).
|
|
2396
2658
|
*/
|
|
2397
2659
|
#handlePickerEvent(ev: PickerEvent): void {
|
|
2398
2660
|
const list = this.#sessionList;
|
|
2399
2661
|
const choice = this.#deleteChoice;
|
|
2400
2662
|
if (ev.kind !== "action") {
|
|
2401
|
-
if (choice) return;
|
|
2663
|
+
if (choice || this.#renameDialog) return;
|
|
2402
2664
|
if (ev.kind === "select") list.selectSession(ev.item);
|
|
2403
2665
|
else list.confirmSession(ev.item);
|
|
2404
2666
|
return;
|
|
2405
2667
|
}
|
|
2406
2668
|
if (ev.act === "delete-confirm") choice?.confirm();
|
|
2407
|
-
else if (ev.act === "cancel")
|
|
2408
|
-
|
|
2669
|
+
else if (ev.act === "cancel") {
|
|
2670
|
+
if (choice) choice.cancel();
|
|
2671
|
+
else this.#closeRenameDialog();
|
|
2672
|
+
} else if (ev.act === "tab") {
|
|
2409
2673
|
if (this.#resumeSource && ev.value) this.#setResumeScope(ev.value as ResumeScopeKindLike);
|
|
2410
2674
|
} else if (ev.act === "close") {
|
|
2411
2675
|
if (choice) choice.cancel();
|
|
2676
|
+
else if (this.#renameDialog) this.#closeRenameDialog();
|
|
2412
2677
|
else list.onCancel?.();
|
|
2413
|
-
} else if (choice) return;
|
|
2678
|
+
} else if (choice || this.#renameDialog) return;
|
|
2414
2679
|
else if (ev.act === "resume") list.resumeSelected();
|
|
2415
2680
|
else if (ev.act === "delete") list.requestDelete();
|
|
2416
|
-
else if (ev.act === "
|
|
2417
|
-
else if (ev.act === "
|
|
2681
|
+
else if (ev.act === "rename") list.requestRename();
|
|
2682
|
+
else if (ev.act === "pin") {
|
|
2683
|
+
if (this.#resumeSource) this.#toggleResumePin();
|
|
2684
|
+
else list.requestPin();
|
|
2685
|
+
} else if (ev.act === "refresh") this.#refreshResume();
|
|
2418
2686
|
else if (ev.act === "scope") {
|
|
2419
2687
|
list.onToggleScope?.();
|
|
2420
2688
|
} else if (ev.act === "clear") list.clearSearch();
|
|
@@ -2434,7 +2702,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
2434
2702
|
if (event.type === "select" && event.item !== this.#scope) void this.#toggleScope();
|
|
2435
2703
|
return;
|
|
2436
2704
|
}
|
|
2437
|
-
if (event.key === "list" && !this.#confirmationDialog
|
|
2705
|
+
if (event.key === "list" && !this.#confirmationDialog && !this.#renameDialog)
|
|
2706
|
+
this.#sessionList.confirmSession(event.item);
|
|
2438
2707
|
}
|
|
2439
2708
|
|
|
2440
2709
|
handleInput(keyData: string): void {
|
|
@@ -2446,6 +2715,8 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
2446
2715
|
}
|
|
2447
2716
|
if (this.#confirmationDialog) {
|
|
2448
2717
|
this.#confirmationDialog.handleInput(keyData);
|
|
2718
|
+
} else if (this.#renameDialog) {
|
|
2719
|
+
this.#renameField?.handleInput(keyData);
|
|
2449
2720
|
} else if (this.#resumeTree && !this.#nativePicker) {
|
|
2450
2721
|
this.#resumeTree.handleInput(keyData);
|
|
2451
2722
|
} else {
|
|
@@ -2460,7 +2731,7 @@ export class SessionSelectorComponent<T extends SessionSelectorEntry = SessionSe
|
|
|
2460
2731
|
* pointer. Mouse is inert while the delete-confirmation dialog is open.
|
|
2461
2732
|
*/
|
|
2462
2733
|
#handleMouse(data: string): void {
|
|
2463
|
-
if (this.#confirmationDialog) return;
|
|
2734
|
+
if (this.#confirmationDialog || this.#renameDialog) return;
|
|
2464
2735
|
if (this.#resumeTree) {
|
|
2465
2736
|
// The panel paints the tree inside `│ ` … ` │`; rows start at
|
|
2466
2737
|
// #listLineOffset and the first content column is 2.
|