@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
|
@@ -31,6 +31,21 @@ export interface ImageOptions {
|
|
|
31
31
|
* synchronously instead of committing its reserved blank rows.
|
|
32
32
|
*/
|
|
33
33
|
export declare function renderForScrollback<T>(render: () => T): T;
|
|
34
|
+
/**
|
|
35
|
+
* Run `render` to measure rows outside display order — a newest-first height
|
|
36
|
+
* walk, say. {@link ImageBudget} derives demotion from the order images are
|
|
37
|
+
* observed in, so a budgeted {@link Image} inside this scope claims no display
|
|
38
|
+
* slot: it replays the decision its slot in the surface's last full pass
|
|
39
|
+
* implies. `images` reports whether any budgeted image was observed; the caller
|
|
40
|
+
* MUST render every such block it lays out again, outside this scope and in
|
|
41
|
+
* display order, or its images keep no slot in the pass.
|
|
42
|
+
*/
|
|
43
|
+
export declare function measureRender<T>(render: () => T): {
|
|
44
|
+
value: T;
|
|
45
|
+
images: boolean;
|
|
46
|
+
demoted: boolean;
|
|
47
|
+
unresolved: boolean;
|
|
48
|
+
};
|
|
34
49
|
/** Widest an {@link Image} rendered at `width` columns draws; callers sizing a raster for it (`SvgFigure`) match it. */
|
|
35
50
|
export declare function imageMaxColumns(width: number): number;
|
|
36
51
|
/** Default count of inline images kept as live graphics before older ones fall back to text. */
|
|
@@ -118,6 +133,11 @@ export declare class ImageBudget {
|
|
|
118
133
|
* During a `stable` pass ({@link beginPass}) the call order and visible subset
|
|
119
134
|
* are not authoritative, so the decision is the surface's committed
|
|
120
135
|
* on-terminal split, keyed by id — order- and partiality-independent.
|
|
136
|
+
*
|
|
137
|
+
* Inside {@link measureRender} the call claims no slot: it answers what the
|
|
138
|
+
* image's slot in the last full pass implies under the planned threshold,
|
|
139
|
+
* which is what the display-order render that follows will decide once the
|
|
140
|
+
* split has converged.
|
|
121
141
|
*/
|
|
122
142
|
observe(imageId: number): boolean;
|
|
123
143
|
/**
|
package/src/components/image.ts
CHANGED
|
@@ -67,6 +67,47 @@ export function renderForScrollback<T>(render: () => T): T {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/** Renders in progress that measure rows outside display order; see {@link measureRender}. */
|
|
71
|
+
let measureRenderDepth = 0;
|
|
72
|
+
/** Budgeted image observations made under {@link measureRender}; only differences are meaningful. */
|
|
73
|
+
let measuredImageObservations = 0;
|
|
74
|
+
/** Those observations that the planned split demotes to the text fallback. */
|
|
75
|
+
let measuredDemotedObservations = 0;
|
|
76
|
+
/** Those observations with no slot yet from a full pass, so their fate is unknown. */
|
|
77
|
+
let measuredUnresolvedObservations = 0;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Run `render` to measure rows outside display order — a newest-first height
|
|
81
|
+
* walk, say. {@link ImageBudget} derives demotion from the order images are
|
|
82
|
+
* observed in, so a budgeted {@link Image} inside this scope claims no display
|
|
83
|
+
* slot: it replays the decision its slot in the surface's last full pass
|
|
84
|
+
* implies. `images` reports whether any budgeted image was observed; the caller
|
|
85
|
+
* MUST render every such block it lays out again, outside this scope and in
|
|
86
|
+
* display order, or its images keep no slot in the pass.
|
|
87
|
+
*/
|
|
88
|
+
export function measureRender<T>(render: () => T): {
|
|
89
|
+
value: T;
|
|
90
|
+
images: boolean;
|
|
91
|
+
demoted: boolean;
|
|
92
|
+
unresolved: boolean;
|
|
93
|
+
} {
|
|
94
|
+
const before = measuredImageObservations;
|
|
95
|
+
const beforeDemoted = measuredDemotedObservations;
|
|
96
|
+
const beforeUnresolved = measuredUnresolvedObservations;
|
|
97
|
+
measureRenderDepth++;
|
|
98
|
+
try {
|
|
99
|
+
const value = render();
|
|
100
|
+
return {
|
|
101
|
+
value,
|
|
102
|
+
images: measuredImageObservations !== before,
|
|
103
|
+
demoted: measuredDemotedObservations !== beforeDemoted,
|
|
104
|
+
unresolved: measuredUnresolvedObservations !== beforeUnresolved,
|
|
105
|
+
};
|
|
106
|
+
} finally {
|
|
107
|
+
measureRenderDepth--;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
70
111
|
const EMPTY_IDS: readonly number[] = [];
|
|
71
112
|
const EMPTY_TRANSMITS: readonly string[] = [];
|
|
72
113
|
const SAVE_CURSOR = "\x1b7";
|
|
@@ -104,16 +145,16 @@ interface SurfaceSplit {
|
|
|
104
145
|
/** Images the last full pass on this surface observed. */
|
|
105
146
|
lastTotal: number;
|
|
106
147
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
148
|
+
* Display slot of every image the last full pass on this surface observed,
|
|
149
|
+
* keyed by id. A pass that cannot derive display order from its own walk — a
|
|
150
|
+
* partial `stable` pass, or a {@link measureRender} scope — replays its
|
|
151
|
+
* decisions from these slots instead.
|
|
111
152
|
*/
|
|
112
|
-
readonly
|
|
153
|
+
readonly slots: Map<number, number>;
|
|
113
154
|
}
|
|
114
155
|
|
|
115
156
|
function newSurfaceSplit(): SurfaceSplit {
|
|
116
|
-
return { onTerminal: 0, planned: 0, lastTotal: 0,
|
|
157
|
+
return { onTerminal: 0, planned: 0, lastTotal: 0, slots: new Map() };
|
|
117
158
|
}
|
|
118
159
|
|
|
119
160
|
/** Return a split to "nothing has been painted on this surface yet", in place. */
|
|
@@ -121,7 +162,7 @@ function resetSurfaceSplit(split: SurfaceSplit): void {
|
|
|
121
162
|
split.onTerminal = 0;
|
|
122
163
|
split.planned = 0;
|
|
123
164
|
split.lastTotal = 0;
|
|
124
|
-
if (split.
|
|
165
|
+
if (split.slots.size > 0) split.slots.clear();
|
|
125
166
|
}
|
|
126
167
|
|
|
127
168
|
let nextImageBudgetSeed = Math.floor(Math.random() * 0xffffff);
|
|
@@ -336,14 +377,34 @@ export class ImageBudget {
|
|
|
336
377
|
* During a `stable` pass ({@link beginPass}) the call order and visible subset
|
|
337
378
|
* are not authoritative, so the decision is the surface's committed
|
|
338
379
|
* on-terminal split, keyed by id — order- and partiality-independent.
|
|
380
|
+
*
|
|
381
|
+
* Inside {@link measureRender} the call claims no slot: it answers what the
|
|
382
|
+
* image's slot in the last full pass implies under the planned threshold,
|
|
383
|
+
* which is what the display-order render that follows will decide once the
|
|
384
|
+
* split has converged.
|
|
339
385
|
*/
|
|
340
386
|
observe(imageId: number): boolean {
|
|
387
|
+
if (measureRenderDepth > 0) {
|
|
388
|
+
measuredImageObservations++;
|
|
389
|
+
if (this.#split.slots.get(imageId) === undefined) measuredUnresolvedObservations++;
|
|
390
|
+
}
|
|
341
391
|
const existing = this.#passSuppression.get(imageId);
|
|
342
|
-
if (existing !== undefined)
|
|
392
|
+
if (existing !== undefined) {
|
|
393
|
+
if (measureRenderDepth > 0 && existing) measuredDemotedObservations++;
|
|
394
|
+
return existing;
|
|
395
|
+
}
|
|
343
396
|
if (this.#stablePass) {
|
|
344
|
-
const suppressed = this.#cap > 0 && this.#split.
|
|
397
|
+
const suppressed = this.#cap > 0 && this.#lastSlotBelow(imageId, this.#split.onTerminal);
|
|
345
398
|
this.#passSuppression.set(imageId, suppressed);
|
|
346
|
-
if (suppressed)
|
|
399
|
+
if (suppressed) {
|
|
400
|
+
this.#forgetKeyForId(imageId);
|
|
401
|
+
if (measureRenderDepth > 0) measuredDemotedObservations++;
|
|
402
|
+
}
|
|
403
|
+
return suppressed;
|
|
404
|
+
}
|
|
405
|
+
if (measureRenderDepth > 0) {
|
|
406
|
+
const suppressed = this.#cap > 0 && this.#lastSlotBelow(imageId, this.#split.planned);
|
|
407
|
+
if (suppressed) measuredDemotedObservations++;
|
|
347
408
|
return suppressed;
|
|
348
409
|
}
|
|
349
410
|
const index = this.#passIds.length;
|
|
@@ -355,6 +416,12 @@ export class ImageBudget {
|
|
|
355
416
|
return suppressed;
|
|
356
417
|
}
|
|
357
418
|
|
|
419
|
+
/** Whether `imageId` held a display slot below `threshold` in the last full pass on this surface. */
|
|
420
|
+
#lastSlotBelow(imageId: number, threshold: number): boolean {
|
|
421
|
+
const slot = this.#split.slots.get(imageId);
|
|
422
|
+
return slot !== undefined && slot < threshold;
|
|
423
|
+
}
|
|
424
|
+
|
|
358
425
|
/**
|
|
359
426
|
* End a render pass. Returns true when the pass discovered a stricter budget
|
|
360
427
|
* and must be repeated before its terminal frame is emitted.
|
|
@@ -373,14 +440,12 @@ export class ImageBudget {
|
|
|
373
440
|
this.#applyingReset = false;
|
|
374
441
|
}
|
|
375
442
|
const retry = this.#reconcile(total);
|
|
376
|
-
// Snapshot
|
|
377
|
-
//
|
|
378
|
-
//
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const suppressedCount = Math.min(total, split.onTerminal);
|
|
383
|
-
for (let i = 0; i < suppressedCount; i++) suppressedIds.add(this.#passIds[i]);
|
|
443
|
+
// Snapshot display order by id. Partial passes (see #stablePass) and
|
|
444
|
+
// measuring renders replay their decisions from it instead of
|
|
445
|
+
// re-deriving them from a reversed or tail-only walk.
|
|
446
|
+
const slots = split.slots;
|
|
447
|
+
if (slots.size > 0) slots.clear();
|
|
448
|
+
for (let i = 0; i < total; i++) slots.set(this.#passIds[i], i);
|
|
384
449
|
return retry;
|
|
385
450
|
}
|
|
386
451
|
|
|
@@ -75,6 +75,6 @@ export declare class Loader extends Text {
|
|
|
75
75
|
* session title). Re-evaluated every paint; dropped when the row leaves
|
|
76
76
|
* less than a two-cell gap. */
|
|
77
77
|
setTrailer(trailer: (() => string | undefined) | undefined): void;
|
|
78
|
-
setMessage(message: string): void;
|
|
78
|
+
setMessage(message: string | (() => string)): void;
|
|
79
79
|
}
|
|
80
80
|
export {};
|
package/src/components/loader.ts
CHANGED
|
@@ -10,6 +10,13 @@ import type { Component } from "../tui";
|
|
|
10
10
|
* byte-identical to rendering `text`.
|
|
11
11
|
*/
|
|
12
12
|
export declare function streamingMarkdownSource(text: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether `text` ends inside a code fence the source never closed. The
|
|
15
|
+
* renderer still draws such a fence's closing border, so a caller publishing a
|
|
16
|
+
* settled source prefix must drop that fabricated row: it is not a prefix of
|
|
17
|
+
* the live block, which reaches the border only once the closer arrives.
|
|
18
|
+
*/
|
|
19
|
+
export declare function endsInsideOpenFence(text: string): boolean;
|
|
13
20
|
/**
|
|
14
21
|
* Streaming `md` source for a native terminal, minus a still-growing table row:
|
|
15
22
|
* the unterminated last line when a GFM table (a run of pipe lines holding a
|