@sagmans/dsh-tui 0.12.1 → 0.14.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/.agents/skills/dsh-tui-dogfood/SKILL.md +18 -2
- package/.agents/skills/dsh-tui-dogfood/references/home-state.md +4 -4
- package/.agents/skills/dsh-tui-dogfood/scripts/clone-links.mjs +19 -11
- package/.agents/skills/dsh-tui-dogfood/scripts/run-plugin-from-worktree.sh +31 -9
- package/.agents/skills/dsh-tui-update-models/SKILL.md +1 -1
- package/.agents/skills/dsh-tui-update-models/references/model-wiring.md +6 -6
- package/.agents/skills/dsh-tui-update-models/scripts/dump-model-catalog.mjs +21 -13
- package/README.md +61 -23
- package/cordis.patch.yml +2 -0
- package/lib/agent/fork.d.ts +3 -1
- package/lib/agent/fork.d.ts.map +1 -1
- package/lib/agent/fork.js +2 -0
- package/lib/agent/fork.js.map +1 -1
- package/lib/agent/history.d.ts +14 -22
- package/lib/agent/history.d.ts.map +1 -1
- package/lib/agent/history.js +20 -14
- package/lib/agent/history.js.map +1 -1
- package/lib/agent/host.d.ts.map +1 -1
- package/lib/agent/host.js +6 -0
- package/lib/agent/host.js.map +1 -1
- package/lib/agent/model.d.ts +10 -8
- package/lib/agent/model.d.ts.map +1 -1
- package/lib/agent/model.js +9 -7
- package/lib/agent/model.js.map +1 -1
- package/lib/agent/present.d.ts +1 -1
- package/lib/agent/present.d.ts.map +1 -1
- package/lib/agent/present.js +1 -1
- package/lib/agent/present.js.map +1 -1
- package/lib/agent/presets.d.ts +4 -1
- package/lib/agent/presets.d.ts.map +1 -1
- package/lib/agent/presets.js +9 -2
- package/lib/agent/presets.js.map +1 -1
- package/lib/agent/projections.d.ts +8 -2
- package/lib/agent/projections.d.ts.map +1 -1
- package/lib/agent/projections.js +8 -2
- package/lib/agent/projections.js.map +1 -1
- package/lib/agent/prompt-history.d.ts +8 -48
- package/lib/agent/prompt-history.d.ts.map +1 -1
- package/lib/agent/prompt-history.js +34 -15
- package/lib/agent/prompt-history.js.map +1 -1
- package/lib/agent/status.d.ts +9 -24
- package/lib/agent/status.d.ts.map +1 -1
- package/lib/agent/status.js +7 -2
- package/lib/agent/status.js.map +1 -1
- package/lib/agent/undo.d.ts +2 -4
- package/lib/agent/undo.d.ts.map +1 -1
- package/lib/agent/undo.js +10 -5
- package/lib/agent/undo.js.map +1 -1
- package/lib/cards/composition.d.ts +7 -7
- package/lib/cards/composition.d.ts.map +1 -1
- package/lib/cards/composition.js +13 -12
- package/lib/cards/composition.js.map +1 -1
- package/lib/cards/presenter.d.ts +11 -14
- package/lib/cards/presenter.d.ts.map +1 -1
- package/lib/cards/presenter.js +40 -19
- package/lib/cards/presenter.js.map +1 -1
- package/lib/cards/preview.d.ts.map +1 -1
- package/lib/cards/preview.js +5 -1
- package/lib/cards/preview.js.map +1 -1
- package/lib/cards.d.ts +17 -23
- package/lib/cards.d.ts.map +1 -1
- package/lib/cards.js +27 -12
- package/lib/cards.js.map +1 -1
- package/lib/compat/probe.d.ts +2 -5
- package/lib/compat/probe.d.ts.map +1 -1
- package/lib/compat/probe.js +2 -2
- package/lib/compat/probe.js.map +1 -1
- package/lib/compat/section.d.ts +5 -4
- package/lib/compat/section.d.ts.map +1 -1
- package/lib/compat/section.js +4 -0
- package/lib/compat/section.js.map +1 -1
- package/lib/config.d.ts +0 -3
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +7 -1
- package/lib/config.js.map +1 -1
- package/lib/export.d.ts +5 -7
- package/lib/export.d.ts.map +1 -1
- package/lib/export.js +48 -10
- package/lib/export.js.map +1 -1
- package/lib/fold-cursor.d.ts +3 -3
- package/lib/fold-cursor.d.ts.map +1 -1
- package/lib/fold-cursor.js +5 -3
- package/lib/fold-cursor.js.map +1 -1
- package/lib/gates/question-card.d.ts +3 -38
- package/lib/gates/question-card.d.ts.map +1 -1
- package/lib/gates/question-card.js +13 -10
- package/lib/gates/question-card.js.map +1 -1
- package/lib/gates/questions.d.ts +14 -8
- package/lib/gates/questions.d.ts.map +1 -1
- package/lib/gates/questions.js +25 -18
- package/lib/gates/questions.js.map +1 -1
- package/lib/gates.d.ts +17 -25
- package/lib/gates.d.ts.map +1 -1
- package/lib/gates.js +2 -4
- package/lib/gates.js.map +1 -1
- package/lib/herdr/client.d.ts +10 -12
- package/lib/herdr/client.d.ts.map +1 -1
- package/lib/herdr/client.js +9 -8
- package/lib/herdr/client.js.map +1 -1
- package/lib/herdr/constants.d.ts +3 -2
- package/lib/herdr/constants.d.ts.map +1 -1
- package/lib/herdr/constants.js +3 -2
- package/lib/herdr/constants.js.map +1 -1
- package/lib/herdr/reporter.d.ts +4 -39
- package/lib/herdr/reporter.d.ts.map +1 -1
- package/lib/herdr/reporter.js +13 -19
- package/lib/herdr/reporter.js.map +1 -1
- package/lib/herdr/state.d.ts +4 -3
- package/lib/herdr/state.d.ts.map +1 -1
- package/lib/herdr/state.js +6 -5
- package/lib/herdr/state.js.map +1 -1
- package/lib/host/preset-files.d.ts +0 -17
- package/lib/host/preset-files.d.ts.map +1 -1
- package/lib/host/preset-files.js +7 -2
- package/lib/host/preset-files.js.map +1 -1
- package/lib/host/roster.d.ts +1 -1
- package/lib/host/roster.d.ts.map +1 -1
- package/lib/host/roster.js +3 -3
- package/lib/host/roster.js.map +1 -1
- package/lib/host/runner.d.ts +2 -5
- package/lib/host/runner.d.ts.map +1 -1
- package/lib/host/runner.js +2 -5
- package/lib/host/runner.js.map +1 -1
- package/lib/identity.d.ts +6 -3
- package/lib/identity.d.ts.map +1 -1
- package/lib/identity.js +18 -3
- package/lib/identity.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +42 -14
- package/lib/index.js.map +1 -1
- package/lib/injection.d.ts.map +1 -1
- package/lib/injection.js +1 -0
- package/lib/injection.js.map +1 -1
- package/lib/input/action-catalog.d.ts.map +1 -1
- package/lib/input/action-catalog.js +4 -0
- package/lib/input/action-catalog.js.map +1 -1
- package/lib/input/actions.d.ts +4 -3
- package/lib/input/actions.d.ts.map +1 -1
- package/lib/input/actions.js +8 -3
- package/lib/input/actions.js.map +1 -1
- package/lib/input/completion.d.ts +3 -11
- package/lib/input/completion.d.ts.map +1 -1
- package/lib/input/completion.js +8 -6
- package/lib/input/completion.js.map +1 -1
- package/lib/input/file-index.d.ts +1 -12
- package/lib/input/file-index.d.ts.map +1 -1
- package/lib/input/file-index.js +21 -17
- package/lib/input/file-index.js.map +1 -1
- package/lib/input/file-search.d.ts +6 -3
- package/lib/input/file-search.d.ts.map +1 -1
- package/lib/input/file-search.js +29 -10
- package/lib/input/file-search.js.map +1 -1
- package/lib/input/fuzzy.d.ts +6 -12
- package/lib/input/fuzzy.d.ts.map +1 -1
- package/lib/input/fuzzy.js +18 -27
- package/lib/input/fuzzy.js.map +1 -1
- package/lib/input/ghost.d.ts +5 -5
- package/lib/input/ghost.d.ts.map +1 -1
- package/lib/input/ghost.js +4 -3
- package/lib/input/ghost.js.map +1 -1
- package/lib/input/key-press.d.ts +8 -7
- package/lib/input/key-press.d.ts.map +1 -1
- package/lib/input/key-press.js +8 -6
- package/lib/input/key-press.js.map +1 -1
- package/lib/input/keymap-conflicts.d.ts +6 -6
- package/lib/input/keymap-conflicts.d.ts.map +1 -1
- package/lib/input/keymap-conflicts.js +6 -6
- package/lib/input/keymap-conflicts.js.map +1 -1
- package/lib/input/keymap.d.ts +6 -18
- package/lib/input/keymap.d.ts.map +1 -1
- package/lib/input/keymap.js +7 -10
- package/lib/input/keymap.js.map +1 -1
- package/lib/input/match.js +4 -4
- package/lib/input/match.js.map +1 -1
- package/lib/input/submission.d.ts +7 -3
- package/lib/input/submission.d.ts.map +1 -1
- package/lib/input/submission.js +2 -2
- package/lib/input/submission.js.map +1 -1
- package/lib/input/workspace-files.d.ts +1 -2
- package/lib/input/workspace-files.d.ts.map +1 -1
- package/lib/input/workspace-files.js +20 -11
- package/lib/input/workspace-files.js.map +1 -1
- package/lib/input.d.ts +6 -0
- package/lib/input.d.ts.map +1 -1
- package/lib/input.js +34 -1
- package/lib/input.js.map +1 -1
- package/lib/install-skills.d.ts +5 -22
- package/lib/install-skills.d.ts.map +1 -1
- package/lib/install-skills.js +18 -18
- package/lib/install-skills.js.map +1 -1
- package/lib/jobs.d.ts +10 -5
- package/lib/jobs.d.ts.map +1 -1
- package/lib/jobs.js +39 -13
- package/lib/jobs.js.map +1 -1
- package/lib/keymaps.d.ts.map +1 -1
- package/lib/keymaps.js +2 -0
- package/lib/keymaps.js.map +1 -1
- package/lib/keys-command.d.ts +1 -1
- package/lib/keys-command.d.ts.map +1 -1
- package/lib/model-list.d.ts +0 -27
- package/lib/model-list.d.ts.map +1 -1
- package/lib/model-list.js +1 -1
- package/lib/model-list.js.map +1 -1
- package/lib/moshi.d.ts +13 -0
- package/lib/moshi.d.ts.map +1 -0
- package/lib/moshi.js +130 -0
- package/lib/moshi.js.map +1 -0
- package/lib/spacing.d.ts +0 -7
- package/lib/spacing.d.ts.map +1 -1
- package/lib/spacing.js +1 -1
- package/lib/spacing.js.map +1 -1
- package/lib/startup.d.ts +1 -1
- package/lib/startup.d.ts.map +1 -1
- package/lib/startup.js +9 -1
- package/lib/startup.js.map +1 -1
- package/lib/stash/lock.d.ts +1 -37
- package/lib/stash/lock.d.ts.map +1 -1
- package/lib/stash/lock.js +41 -35
- package/lib/stash/lock.js.map +1 -1
- package/lib/stash/paths.d.ts +8 -7
- package/lib/stash/paths.d.ts.map +1 -1
- package/lib/stash/paths.js +21 -17
- package/lib/stash/paths.js.map +1 -1
- package/lib/stash/private-fs.d.ts +14 -5
- package/lib/stash/private-fs.d.ts.map +1 -1
- package/lib/stash/private-fs.js +30 -8
- package/lib/stash/private-fs.js.map +1 -1
- package/lib/stash/schema.d.ts +3 -6
- package/lib/stash/schema.d.ts.map +1 -1
- package/lib/stash/schema.js +11 -9
- package/lib/stash/schema.js.map +1 -1
- package/lib/stash/store.d.ts +9 -40
- package/lib/stash/store.d.ts.map +1 -1
- package/lib/stash/store.js +26 -24
- package/lib/stash/store.js.map +1 -1
- package/lib/stash.d.ts +7 -11
- package/lib/stash.d.ts.map +1 -1
- package/lib/stash.js +18 -11
- package/lib/stash.js.map +1 -1
- package/lib/subagents.d.ts +9 -9
- package/lib/subagents.d.ts.map +1 -1
- package/lib/subagents.js +19 -18
- package/lib/subagents.js.map +1 -1
- package/lib/surface/appearance-preferences.d.ts.map +1 -1
- package/lib/surface/appearance-preferences.js +7 -0
- package/lib/surface/appearance-preferences.js.map +1 -1
- package/lib/surface/appearance.d.ts.map +1 -1
- package/lib/surface/appearance.js +7 -2
- package/lib/surface/appearance.js.map +1 -1
- package/lib/surface/background-work.d.ts +2 -0
- package/lib/surface/background-work.d.ts.map +1 -1
- package/lib/surface/background-work.js +45 -36
- package/lib/surface/background-work.js.map +1 -1
- package/lib/surface/commands.d.ts.map +1 -1
- package/lib/surface/commands.js +17 -9
- package/lib/surface/commands.js.map +1 -1
- package/lib/surface/modal-input.d.ts +4 -0
- package/lib/surface/modal-input.d.ts.map +1 -1
- package/lib/surface/modal-input.js +81 -46
- package/lib/surface/modal-input.js.map +1 -1
- package/lib/surface/model-choice.d.ts.map +1 -1
- package/lib/surface/model-choice.js +10 -8
- package/lib/surface/model-choice.js.map +1 -1
- package/lib/surface/plugin-actions.d.ts.map +1 -1
- package/lib/surface/plugin-actions.js +4 -0
- package/lib/surface/plugin-actions.js.map +1 -1
- package/lib/surface/preset-choice.d.ts.map +1 -1
- package/lib/surface/preset-choice.js +15 -17
- package/lib/surface/preset-choice.js.map +1 -1
- package/lib/surface/prompt-input.js +1 -1
- package/lib/surface/prompt-input.js.map +1 -1
- package/lib/surface/prompt-memory.d.ts +7 -6
- package/lib/surface/prompt-memory.d.ts.map +1 -1
- package/lib/surface/prompt-memory.js +3 -3
- package/lib/surface/session-lifecycle.d.ts +7 -1
- package/lib/surface/session-lifecycle.d.ts.map +1 -1
- package/lib/surface/session-lifecycle.js +17 -12
- package/lib/surface/session-lifecycle.js.map +1 -1
- package/lib/surface/session-picker.js +1 -1
- package/lib/surface/session-picker.js.map +1 -1
- package/lib/surface/session-view.d.ts +1 -1
- package/lib/surface/session-view.d.ts.map +1 -1
- package/lib/surface/session-view.js +4 -5
- package/lib/surface/session-view.js.map +1 -1
- package/lib/surface/staged-turns.d.ts.map +1 -1
- package/lib/surface/staged-turns.js +8 -4
- package/lib/surface/staged-turns.js.map +1 -1
- package/lib/surface/terminal-lifecycle.d.ts +1 -1
- package/lib/surface/terminal-lifecycle.d.ts.map +1 -1
- package/lib/surface/terminal-lifecycle.js +8 -5
- package/lib/surface/terminal-lifecycle.js.map +1 -1
- package/lib/terminal/bell.d.ts +0 -2
- package/lib/terminal/bell.d.ts.map +1 -1
- package/lib/terminal/bell.js +2 -1
- package/lib/terminal/bell.js.map +1 -1
- package/lib/terminal/clipboard.d.ts +4 -4
- package/lib/terminal/clipboard.js +4 -4
- package/lib/terminal/external-editor.d.ts +4 -60
- package/lib/terminal/external-editor.d.ts.map +1 -1
- package/lib/terminal/external-editor.js +28 -40
- package/lib/terminal/external-editor.js.map +1 -1
- package/lib/terminal/host-writes.d.ts +7 -18
- package/lib/terminal/host-writes.d.ts.map +1 -1
- package/lib/terminal/host-writes.js +19 -18
- package/lib/terminal/host-writes.js.map +1 -1
- package/lib/terminal/input.d.ts +6 -0
- package/lib/terminal/input.d.ts.map +1 -0
- package/lib/terminal/input.js +15 -0
- package/lib/terminal/input.js.map +1 -0
- package/lib/terminal/restore.d.ts +2 -1
- package/lib/terminal/restore.d.ts.map +1 -1
- package/lib/terminal/signals.d.ts +2 -1
- package/lib/terminal/signals.d.ts.map +1 -1
- package/lib/terminal/signals.js +1 -1
- package/lib/terminal/signals.js.map +1 -1
- package/lib/terminal/title.d.ts +1 -11
- package/lib/terminal/title.d.ts.map +1 -1
- package/lib/terminal/title.js +5 -4
- package/lib/terminal/title.js.map +1 -1
- package/lib/terminal/warning-screen.d.ts +11 -2
- package/lib/terminal/warning-screen.d.ts.map +1 -1
- package/lib/terminal/warning-screen.js +166 -22
- package/lib/terminal/warning-screen.js.map +1 -1
- package/lib/terminal-text/scan.d.ts +4 -5
- package/lib/terminal-text/scan.d.ts.map +1 -1
- package/lib/terminal-text/scan.js +16 -9
- package/lib/terminal-text/scan.js.map +1 -1
- package/lib/terminal-text/sgr.d.ts +4 -3
- package/lib/terminal-text/sgr.d.ts.map +1 -1
- package/lib/terminal-text/sgr.js +9 -14
- package/lib/terminal-text/sgr.js.map +1 -1
- package/lib/terminal-text.d.ts +7 -12
- package/lib/terminal-text.d.ts.map +1 -1
- package/lib/terminal-text.js +32 -23
- package/lib/terminal-text.js.map +1 -1
- package/lib/text.d.ts +8 -14
- package/lib/text.d.ts.map +1 -1
- package/lib/text.js +14 -15
- package/lib/text.js.map +1 -1
- package/lib/theme-capability.d.ts +3 -15
- package/lib/theme-capability.d.ts.map +1 -1
- package/lib/theme-capability.js +18 -15
- package/lib/theme-capability.js.map +1 -1
- package/lib/theme-defaults.d.ts +3 -57
- package/lib/theme-defaults.d.ts.map +1 -1
- package/lib/theme-defaults.js +25 -14
- package/lib/theme-defaults.js.map +1 -1
- package/lib/theme-files.d.ts +16 -32
- package/lib/theme-files.d.ts.map +1 -1
- package/lib/theme-files.js +43 -27
- package/lib/theme-files.js.map +1 -1
- package/lib/theme-resolver.d.ts +3 -3
- package/lib/theme-resolver.d.ts.map +1 -1
- package/lib/theme-resolver.js +9 -6
- package/lib/theme-resolver.js.map +1 -1
- package/lib/theme-schema.d.ts +7 -42
- package/lib/theme-schema.d.ts.map +1 -1
- package/lib/theme-schema.js +9 -11
- package/lib/theme-schema.js.map +1 -1
- package/lib/theme-settings.d.ts +19 -10
- package/lib/theme-settings.d.ts.map +1 -1
- package/lib/theme-settings.js +23 -17
- package/lib/theme-settings.js.map +1 -1
- package/lib/theme-tokens.d.ts +6 -12
- package/lib/theme-tokens.d.ts.map +1 -1
- package/lib/theme-tokens.js +2 -2
- package/lib/theme-tokens.js.map +1 -1
- package/lib/theme.d.ts +5 -10
- package/lib/theme.d.ts.map +1 -1
- package/lib/theme.js +11 -18
- package/lib/theme.js.map +1 -1
- package/lib/todo-guard.d.ts +8 -4
- package/lib/todo-guard.d.ts.map +1 -1
- package/lib/todo-guard.js +17 -6
- package/lib/todo-guard.js.map +1 -1
- package/lib/tokens.d.ts +0 -2
- package/lib/tokens.d.ts.map +1 -1
- package/lib/tokens.js +1 -1
- package/lib/tokens.js.map +1 -1
- package/lib/tool-display.d.ts +1 -13
- package/lib/tool-display.d.ts.map +1 -1
- package/lib/tool-display.js +4 -4
- package/lib/tool-display.js.map +1 -1
- package/lib/transcript/message-content.d.ts.map +1 -1
- package/lib/transcript/message-content.js +31 -9
- package/lib/transcript/message-content.js.map +1 -1
- package/lib/transcript/tool-calls.d.ts +9 -7
- package/lib/transcript/tool-calls.d.ts.map +1 -1
- package/lib/transcript/tool-calls.js +27 -20
- package/lib/transcript/tool-calls.js.map +1 -1
- package/lib/transcript.d.ts +15 -18
- package/lib/transcript.d.ts.map +1 -1
- package/lib/transcript.js +70 -41
- package/lib/transcript.js.map +1 -1
- package/lib/ui/copy.d.ts +5 -4
- package/lib/ui/copy.d.ts.map +1 -1
- package/lib/ui/copy.js +9 -6
- package/lib/ui/copy.js.map +1 -1
- package/lib/ui/diff.d.ts +0 -30
- package/lib/ui/diff.d.ts.map +1 -1
- package/lib/ui/diff.js +16 -9
- package/lib/ui/diff.js.map +1 -1
- package/lib/ui/dock.d.ts +12 -10
- package/lib/ui/dock.d.ts.map +1 -1
- package/lib/ui/dock.js +27 -14
- package/lib/ui/dock.js.map +1 -1
- package/lib/ui/editor.d.ts +5 -4
- package/lib/ui/editor.d.ts.map +1 -1
- package/lib/ui/editor.js +17 -9
- package/lib/ui/editor.js.map +1 -1
- package/lib/ui/frame.d.ts +4 -12
- package/lib/ui/frame.d.ts.map +1 -1
- package/lib/ui/frame.js +6 -6
- package/lib/ui/frame.js.map +1 -1
- package/lib/ui/gap.d.ts +0 -4
- package/lib/ui/gap.d.ts.map +1 -1
- package/lib/ui/gap.js +4 -3
- package/lib/ui/gap.js.map +1 -1
- package/lib/ui/gate-input.d.ts +3 -3
- package/lib/ui/gate-input.d.ts.map +1 -1
- package/lib/ui/gate-input.js +9 -9
- package/lib/ui/gate-input.js.map +1 -1
- package/lib/ui/layout.d.ts +1 -8
- package/lib/ui/layout.d.ts.map +1 -1
- package/lib/ui/layout.js +10 -11
- package/lib/ui/layout.js.map +1 -1
- package/lib/ui/markdown.d.ts +3 -5
- package/lib/ui/markdown.d.ts.map +1 -1
- package/lib/ui/markdown.js +18 -7
- package/lib/ui/markdown.js.map +1 -1
- package/lib/ui/mermaid.d.ts +0 -11
- package/lib/ui/mermaid.d.ts.map +1 -1
- package/lib/ui/mermaid.js +32 -17
- package/lib/ui/mermaid.js.map +1 -1
- package/lib/ui/picker-card.d.ts +4 -8
- package/lib/ui/picker-card.d.ts.map +1 -1
- package/lib/ui/picker-card.js +17 -15
- package/lib/ui/picker-card.js.map +1 -1
- package/lib/ui/picker.d.ts +11 -17
- package/lib/ui/picker.d.ts.map +1 -1
- package/lib/ui/picker.js +36 -17
- package/lib/ui/picker.js.map +1 -1
- package/lib/ui/queue.d.ts.map +1 -1
- package/lib/ui/queue.js +11 -1
- package/lib/ui/queue.js.map +1 -1
- package/lib/ui/stash-picker.d.ts +1 -10
- package/lib/ui/stash-picker.d.ts.map +1 -1
- package/lib/ui/stash-picker.js +4 -4
- package/lib/ui/stash-picker.js.map +1 -1
- package/lib/ui/status.d.ts +2 -19
- package/lib/ui/status.d.ts.map +1 -1
- package/lib/ui/status.js +15 -17
- package/lib/ui/status.js.map +1 -1
- package/lib/ui/view/document.d.ts +33 -0
- package/lib/ui/view/document.d.ts.map +1 -0
- package/lib/ui/view/document.js +96 -0
- package/lib/ui/view/document.js.map +1 -0
- package/lib/ui/view/gate-card.d.ts +2 -0
- package/lib/ui/view/gate-card.d.ts.map +1 -1
- package/lib/ui/view/gate-card.js +12 -10
- package/lib/ui/view/gate-card.js.map +1 -1
- package/lib/ui/view/tool-card.d.ts +7 -4
- package/lib/ui/view/tool-card.d.ts.map +1 -1
- package/lib/ui/view/tool-card.js +12 -17
- package/lib/ui/view/tool-card.js.map +1 -1
- package/lib/ui/view/transcript-message.d.ts +7 -7
- package/lib/ui/view/transcript-message.d.ts.map +1 -1
- package/lib/ui/view/transcript-message.js +19 -10
- package/lib/ui/view/transcript-message.js.map +1 -1
- package/lib/ui/view.d.ts +53 -84
- package/lib/ui/view.d.ts.map +1 -1
- package/lib/ui/view.js +79 -158
- package/lib/ui/view.js.map +1 -1
- package/lib/work.d.ts +13 -10
- package/lib/work.d.ts.map +1 -1
- package/lib/work.js +30 -8
- package/lib/work.js.map +1 -1
- package/package.json +12 -7
- package/presets/cordis.patch.yml +1 -0
- package/presets/minimal.patch.yml +1 -0
- package/presets/ptc.patch.yml +1 -0
- package/presets/standard.patch.yml +1 -0
- package/themes/deepseek-blue.yaml +38 -51
- package/themes/marine-static.yaml +27 -35
- package/themes/pine-slope.yaml +13 -11
- package/themes/polar-drift.yaml +6 -0
- package/themes/violet-orbit.yaml +14 -18
- package/themes/wine-thicket.yaml +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-lifecycle.js","sourceRoot":"","sources":["../../src/surface/terminal-lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"terminal-lifecycle.js","sourceRoot":"","sources":["../../src/surface/terminal-lifecycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAGxD,OAAO,EAAE,mBAAmB,EAAsB,MAAM,sBAAsB,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,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W,KAAK,SAAS;gBAAE,WAAW,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;QAClF,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,OAAO;QACL,QAAQ;QACR,GAAG;QACH,KAAK;QACL,SAAS;QACT,aAAa;QACb,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU;QAC5B,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ;QACxB,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;QACpB,WAAW;QACX,SAAS;QACT,cAAc;KACf,CAAA;AACH,CAAC"}
|
package/lib/terminal/bell.d.ts
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/** The terminal bell character. */
|
|
9
9
|
export declare const BELL = "\u0007";
|
|
10
|
-
/** How long a turn has to run before its end is worth a bell. */
|
|
11
|
-
export declare const BELL_AFTER_MS = 10000;
|
|
12
10
|
/** Whether this turn's end should ring. */
|
|
13
11
|
export declare function shouldRingBell(input: {
|
|
14
12
|
readonly bell: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bell.d.ts","sourceRoot":"","sources":["../../src/terminal/bell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mCAAmC;AACnC,eAAO,MAAM,IAAI,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"bell.d.ts","sourceRoot":"","sources":["../../src/terminal/bell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mCAAmC;AACnC,eAAO,MAAM,IAAI,WAAW,CAAA;AAK5B,2CAA2C;AAC3C,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B,GAAG,OAAO,CAGV"}
|
package/lib/terminal/bell.js
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
/** The terminal bell character. */
|
|
9
9
|
export const BELL = '\u0007';
|
|
10
10
|
/** How long a turn has to run before its end is worth a bell. */
|
|
11
|
-
|
|
11
|
+
const BELL_AFTER_MS = 10_000;
|
|
12
12
|
/** Whether this turn's end should ring. */
|
|
13
13
|
export function shouldRingBell(input) {
|
|
14
|
+
// Keep shutdown quiet instead of announcing a completion while the surface is leaving.
|
|
14
15
|
return input.bell && !input.exiting && input.ranForMs >= BELL_AFTER_MS;
|
|
15
16
|
}
|
|
16
17
|
//# sourceMappingURL=bell.js.map
|
package/lib/terminal/bell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bell.js","sourceRoot":"","sources":["../../src/terminal/bell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mCAAmC;AACnC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAA;AAE5B,iEAAiE;AACjE,MAAM,
|
|
1
|
+
{"version":3,"file":"bell.js","sourceRoot":"","sources":["../../src/terminal/bell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mCAAmC;AACnC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAA;AAE5B,iEAAiE;AACjE,MAAM,aAAa,GAAG,MAAM,CAAA;AAE5B,2CAA2C;AAC3C,MAAM,UAAU,cAAc,CAAC,KAI9B;IACC,uFAAuF;IACvF,OAAO,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QAAQ,IAAI,aAAa,CAAA;AACxE,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Clipboard writes.
|
|
3
3
|
*
|
|
4
|
-
* OSC 52
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* OSC 52 lets the terminal receive copied text over SSH without requiring a
|
|
5
|
+
* clipboard API on the remote host. Base64 keeps copied control characters
|
|
6
|
+
* from ending the sequence early; clipboard access still depends on the
|
|
7
|
+
* terminal accepting the request.
|
|
8
8
|
*/
|
|
9
9
|
/** The sequence that asks the terminal to copy `text`. */
|
|
10
10
|
export declare function clipboardSequence(text: string): string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Clipboard writes.
|
|
3
3
|
*
|
|
4
|
-
* OSC 52
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* OSC 52 lets the terminal receive copied text over SSH without requiring a
|
|
5
|
+
* clipboard API on the remote host. Base64 keeps copied control characters
|
|
6
|
+
* from ending the sequence early; clipboard access still depends on the
|
|
7
|
+
* terminal accepting the request.
|
|
8
8
|
*/
|
|
9
9
|
const OSC_INTRODUCER = '\u001b]';
|
|
10
10
|
const STRING_TERMINATOR = '\u0007';
|
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Where a reader's editor is configured, most specific first.
|
|
3
|
-
*
|
|
4
|
-
* VISUAL is the full-screen editor and EDITOR the line one, which is the
|
|
5
|
-
* distinction a surface that gives up the whole screen cares about; a reader
|
|
6
|
-
* who set only one of them still gets it.
|
|
7
|
-
*/
|
|
8
|
-
export declare const EDITOR_ENV_KEYS: readonly ["VISUAL", "EDITOR"];
|
|
9
|
-
/** A draft larger than this is left where it is rather than handed to the bar. */
|
|
10
|
-
export declare const MAX_DRAFT_BYTES = 1048576;
|
|
11
|
-
/**
|
|
12
|
-
* How long the reader's editor may hold the terminal before it is stopped.
|
|
13
|
-
*
|
|
14
|
-
* A child that never exits is the one failure this handoff cannot report its way
|
|
15
|
-
* out of: the screen is already given up, so nothing can draw, no key is read,
|
|
16
|
-
* and the session ends with the terminal left in the editor's state. Thirty
|
|
17
|
-
* minutes is far past a draft anyone is still writing and firmly inside a
|
|
18
|
-
* morning, which is the line between a slow reader and a stuck process.
|
|
19
|
-
*/
|
|
20
|
-
export declare const EDITOR_TIMEOUT_MS: number;
|
|
21
|
-
/**
|
|
22
|
-
* One configured command line as argv, or undefined when it names nothing.
|
|
23
|
-
*
|
|
24
|
-
* A reader writes an editor the way a shell would take it — `code --wait`,
|
|
25
|
-
* `emacsclient -t` — so the line is split the way a shell would split it:
|
|
26
|
-
* quotes group, and nothing else is special. No shell ever sees the result,
|
|
27
|
-
* because an environment value is data and a shell would execute a typo. An
|
|
28
|
-
* unterminated quote takes the rest of the line rather than refusing the whole
|
|
29
|
-
* binding: a missing quote should not leave the reader with no editor at all.
|
|
30
|
-
*/
|
|
31
|
-
export declare function parseEditorCommand(value: string): readonly string[] | undefined;
|
|
32
|
-
/** The editor this environment configures, or undefined when none is usable. */
|
|
33
|
-
export declare function resolveEditorCommand(env?: NodeJS.ProcessEnv): readonly string[] | undefined;
|
|
34
1
|
/**
|
|
35
2
|
* What this module needs from the surface while a child owns the terminal.
|
|
36
3
|
*
|
|
@@ -44,41 +11,18 @@ export interface EditorTerminalHost {
|
|
|
44
11
|
resume(): void;
|
|
45
12
|
notice(message: string): void;
|
|
46
13
|
}
|
|
47
|
-
/** The slice of a spawned child this module waits on. */
|
|
48
|
-
export interface EditorChild {
|
|
49
|
-
on(event: 'error', listener: (error: Error) => void): void;
|
|
50
|
-
on(event: 'exit', listener: (code: number | null, signal: string | null) => void): void;
|
|
51
|
-
kill(signal?: NodeJS.Signals): boolean;
|
|
52
|
-
}
|
|
53
|
-
export interface EditorSpawnOptions {
|
|
54
|
-
readonly stdio: 'inherit';
|
|
55
|
-
readonly cwd: string;
|
|
56
|
-
readonly env: NodeJS.ProcessEnv;
|
|
57
|
-
}
|
|
58
|
-
/** The one process call this module makes, so a spec can drive it without a terminal. */
|
|
59
|
-
export type EditorSpawn = (file: string, args: readonly string[], options: EditorSpawnOptions) => EditorChild;
|
|
60
|
-
/** How the handoff runs; every part a spec would otherwise have to fake is overridable. */
|
|
61
|
-
export interface ExternalEditorOptions {
|
|
62
|
-
readonly env?: NodeJS.ProcessEnv | undefined;
|
|
63
|
-
/** Where the scratch directory is made; tests keep theirs out of the real tmpdir. */
|
|
64
|
-
readonly tempRoot?: string | undefined;
|
|
65
|
-
readonly spawn?: EditorSpawn | undefined;
|
|
66
|
-
}
|
|
67
14
|
/**
|
|
68
15
|
* The reader's editor, opened over one draft.
|
|
69
16
|
*
|
|
70
|
-
*
|
|
71
|
-
* ("keep what the bar had") rather than thrown,
|
|
72
|
-
* press with nowhere to put an error.
|
|
17
|
+
* A refused handoff or unusable draft is reported through the host and
|
|
18
|
+
* answered with `undefined` ("keep what the bar had") rather than thrown,
|
|
19
|
+
* because the caller is a key press with nowhere to put an error.
|
|
73
20
|
*/
|
|
74
21
|
export declare class ExternalEditor {
|
|
75
22
|
private readonly host;
|
|
76
|
-
private readonly env;
|
|
77
|
-
private readonly tempRoot;
|
|
78
|
-
private readonly spawn;
|
|
79
23
|
/** Whether a child holds the terminal; a second handoff would stop it twice. */
|
|
80
24
|
private running;
|
|
81
|
-
constructor(host: EditorTerminalHost
|
|
25
|
+
constructor(host: EditorTerminalHost);
|
|
82
26
|
/** Edit `text` in the reader's editor, and return what was saved, or undefined to keep the bar. */
|
|
83
27
|
edit(text: string): Promise<string | undefined>;
|
|
84
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-editor.d.ts","sourceRoot":"","sources":["../../src/terminal/external-editor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"external-editor.d.ts","sourceRoot":"","sources":["../../src/terminal/external-editor.ts"],"names":[],"mappings":"AA8HA;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,IAAI,IAAI,CAAA;IACf,MAAM,IAAI,IAAI,CAAA;IACd,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAQD;;;;;;GAMG;AACH,qBAAa,cAAc;IAIb,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHjC,gFAAgF;IAChF,OAAO,CAAC,OAAO,CAAQ;gBAEM,IAAI,EAAE,kBAAkB;IAErD,mGAAmG;IAC7F,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IA0ErD;;;;;;;;OAQG;YACW,SAAS;IAoBvB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,GAAG;CA6BZ"}
|
|
@@ -22,7 +22,7 @@ import { stripControlCharacters } from "../text.js";
|
|
|
22
22
|
* distinction a surface that gives up the whole screen cares about; a reader
|
|
23
23
|
* who set only one of them still gets it.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
const EDITOR_ENV_KEYS = ['VISUAL', 'EDITOR'];
|
|
26
26
|
/** The buffer's name, so the editor's filetype, syntax, and wrap settings see prose. */
|
|
27
27
|
const DRAFT_FILE_NAME = 'draft.md';
|
|
28
28
|
/** A directory the reader's draft is written into must not be readable by others. */
|
|
@@ -30,21 +30,20 @@ const DRAFT_DIR_MODE = 0o700;
|
|
|
30
30
|
const DRAFT_FILE_MODE = 0o600;
|
|
31
31
|
const DRAFT_DIR_PREFIX = 'dsh-tui-draft-';
|
|
32
32
|
/** A draft larger than this is left where it is rather than handed to the bar. */
|
|
33
|
-
|
|
33
|
+
const MAX_DRAFT_BYTES = 1_048_576;
|
|
34
34
|
/** The same budget as a word, so the notice reads as a size and cannot drift from it. */
|
|
35
35
|
const MAX_DRAFT_LABEL = `${Math.round(MAX_DRAFT_BYTES / 1024 / 1024)} MiB`;
|
|
36
36
|
const SECOND_MS = 1000;
|
|
37
37
|
const MINUTE_MS = 60 * SECOND_MS;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* The timeout for requesting termination while the editor owns the terminal.
|
|
40
40
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* morning, which is the line between a slow reader and a stuck process.
|
|
41
|
+
* The surface cannot read its own input during the handoff, so a timeout gives
|
|
42
|
+
* an editor that never exits a recovery path. Restoration still waits for the
|
|
43
|
+
* child after the stop request, and its saved draft is read back after exit
|
|
44
|
+
* so timing out does not itself discard saved work.
|
|
46
45
|
*/
|
|
47
|
-
|
|
46
|
+
const EDITOR_TIMEOUT_MS = 30 * MINUTE_MS;
|
|
48
47
|
const NO_EDITOR_MESSAGE = 'no editor configured: set $VISUAL or $EDITOR to open the draft in one';
|
|
49
48
|
const launchFailureMessage = (command, error) => `could not start ${command}: ${error.message}`;
|
|
50
49
|
const useFailureMessage = (error) => `could not use the edited draft: ${error instanceof Error ? error.message : 'unknown error'}`;
|
|
@@ -61,14 +60,14 @@ const SEPARATORS = new Set([' ', '\t', '\n', '\r']);
|
|
|
61
60
|
/**
|
|
62
61
|
* One configured command line as argv, or undefined when it names nothing.
|
|
63
62
|
*
|
|
64
|
-
*
|
|
65
|
-
* `
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
63
|
+
* Quote grouping and whitespace separation support commands such as
|
|
64
|
+
* `code --wait` without executing editor configuration through a shell.
|
|
65
|
+
* This is not shell parsing: backslashes stay literal, and empty quoted
|
|
66
|
+
* arguments are omitted. An unterminated quote takes the rest of the line
|
|
67
|
+
* rather than refusing the whole binding: a missing quote should not leave
|
|
68
|
+
* the reader with no editor at all.
|
|
70
69
|
*/
|
|
71
|
-
|
|
70
|
+
function parseEditorCommand(value) {
|
|
72
71
|
const argv = [];
|
|
73
72
|
let token = '';
|
|
74
73
|
let started = false;
|
|
@@ -101,9 +100,9 @@ export function parseEditorCommand(value) {
|
|
|
101
100
|
return argv.length === 0 ? undefined : argv;
|
|
102
101
|
}
|
|
103
102
|
/** The editor this environment configures, or undefined when none is usable. */
|
|
104
|
-
|
|
103
|
+
function resolveEditorCommand() {
|
|
105
104
|
for (const name of EDITOR_ENV_KEYS) {
|
|
106
|
-
const configured = env[name];
|
|
105
|
+
const configured = process.env[name];
|
|
107
106
|
if (configured === undefined)
|
|
108
107
|
continue;
|
|
109
108
|
const argv = parseEditorCommand(configured);
|
|
@@ -112,39 +111,25 @@ export function resolveEditorCommand(env = process.env) {
|
|
|
112
111
|
}
|
|
113
112
|
return undefined;
|
|
114
113
|
}
|
|
115
|
-
/**
|
|
116
|
-
* The real spawn, wrapped rather than passed.
|
|
117
|
-
*
|
|
118
|
-
* `child_process.spawn` carries overloads that do not narrow to a single
|
|
119
|
-
* callable signature, and a wrapper keeps the injectable seam honest about
|
|
120
|
-
* which call this module actually makes.
|
|
121
|
-
*/
|
|
122
|
-
const SPAWN = (file, args, options) => spawn(file, [...args], options);
|
|
123
114
|
/**
|
|
124
115
|
* The reader's editor, opened over one draft.
|
|
125
116
|
*
|
|
126
|
-
*
|
|
127
|
-
* ("keep what the bar had") rather than thrown,
|
|
128
|
-
* press with nowhere to put an error.
|
|
117
|
+
* A refused handoff or unusable draft is reported through the host and
|
|
118
|
+
* answered with `undefined` ("keep what the bar had") rather than thrown,
|
|
119
|
+
* because the caller is a key press with nowhere to put an error.
|
|
129
120
|
*/
|
|
130
121
|
export class ExternalEditor {
|
|
131
122
|
host;
|
|
132
|
-
env;
|
|
133
|
-
tempRoot;
|
|
134
|
-
spawn;
|
|
135
123
|
/** Whether a child holds the terminal; a second handoff would stop it twice. */
|
|
136
124
|
running = false;
|
|
137
|
-
constructor(host
|
|
125
|
+
constructor(host) {
|
|
138
126
|
this.host = host;
|
|
139
|
-
this.env = options.env ?? process.env;
|
|
140
|
-
this.tempRoot = options.tempRoot ?? tmpdir();
|
|
141
|
-
this.spawn = options.spawn ?? SPAWN;
|
|
142
127
|
}
|
|
143
128
|
/** Edit `text` in the reader's editor, and return what was saved, or undefined to keep the bar. */
|
|
144
129
|
async edit(text) {
|
|
145
130
|
if (this.running)
|
|
146
131
|
return undefined;
|
|
147
|
-
const argv = resolveEditorCommand(
|
|
132
|
+
const argv = resolveEditorCommand();
|
|
148
133
|
const command = argv?.[0];
|
|
149
134
|
if (argv === undefined || command === undefined) {
|
|
150
135
|
this.host.notice(NO_EDITOR_MESSAGE);
|
|
@@ -168,7 +153,7 @@ export class ExternalEditor {
|
|
|
168
153
|
return undefined;
|
|
169
154
|
}
|
|
170
155
|
try {
|
|
171
|
-
directory = await mkdtemp(join(
|
|
156
|
+
directory = await mkdtemp(join(tmpdir(), DRAFT_DIR_PREFIX));
|
|
172
157
|
// mkdtemp makes the directory owner-only on POSIX; setting it here makes
|
|
173
158
|
// the guarantee this module's rather than the platform's.
|
|
174
159
|
await chmod(directory, DRAFT_DIR_MODE);
|
|
@@ -243,9 +228,11 @@ export class ExternalEditor {
|
|
|
243
228
|
}
|
|
244
229
|
if (filled > MAX_DRAFT_BYTES)
|
|
245
230
|
return { kind: 'too-large' };
|
|
231
|
+
// Prevent edited file content from injecting terminal controls or disguising text in the live prompt.
|
|
246
232
|
return { kind: 'text', text: stripControlCharacters(buffer.subarray(0, filled).toString('utf8')) };
|
|
247
233
|
}
|
|
248
234
|
finally {
|
|
235
|
+
// Closing must not replace the accepted draft or mask the original read failure.
|
|
249
236
|
await handle.close().catch(() => undefined);
|
|
250
237
|
}
|
|
251
238
|
}
|
|
@@ -264,10 +251,11 @@ export class ExternalEditor {
|
|
|
264
251
|
*/
|
|
265
252
|
run(command, args, file) {
|
|
266
253
|
return new Promise(resolve => {
|
|
267
|
-
|
|
254
|
+
// Keep the session's project context and editor environment, not the scratch directory's context.
|
|
255
|
+
const child = spawn(command, [...args, file], {
|
|
268
256
|
stdio: 'inherit',
|
|
269
257
|
cwd: process.cwd(),
|
|
270
|
-
env:
|
|
258
|
+
env: process.env,
|
|
271
259
|
});
|
|
272
260
|
// Armed before the wait so no exit can slip past between the two, and
|
|
273
261
|
// cleared by whichever event settles it, because a pending timer would
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-editor.js","sourceRoot":"","sources":["../../src/terminal/external-editor.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,+EAA+E;AAC/E,y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int. Warnings are deferred separately; this is the
|
|
8
8
|
* channel a library, a stray `console.log`, or an unhandled rejection report
|
|
9
|
-
* writes to directly. Text
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* writes to directly. Text waits until the screen is given back so diagnostics
|
|
10
|
+
* do not ruin a frame. Retained writes preserve order within each stream;
|
|
11
|
+
* streams replay in target order, not in cross-stream arrival order.
|
|
12
12
|
*
|
|
13
13
|
* The surface's own drawing goes through the terminal object, which is wrapped
|
|
14
14
|
* here: a write made inside that call passes through, and everything else waits.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* one write. A write larger than the budget is therefore held whole, because
|
|
20
|
-
* this is the reader's own program's output and half a line is corruption where
|
|
21
|
-
* a bigger hold is only memory.
|
|
16
|
+
* Retained text stays within each stream's byte budget. Oversized writes are
|
|
17
|
+
* rejected whole, and older writes are evicted to make room for later ones:
|
|
18
|
+
* truncating individual writes would present incomplete diagnostics as intact.
|
|
22
19
|
*/
|
|
23
20
|
/** One stream a host may write to without asking the surface. */
|
|
24
21
|
export interface HostWritable {
|
|
25
22
|
write(...args: unknown[]): unknown;
|
|
26
23
|
}
|
|
27
24
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Trimming counts whole writes, so this is the point the oldest write is given
|
|
31
|
-
* up at rather than a ceiling on the bytes a stream holds; the header says what
|
|
32
|
-
* the newest write does to it.
|
|
25
|
+
* A per-stream byte ceiling prevents deferred diagnostics from growing without bound.
|
|
33
26
|
*/
|
|
34
27
|
export declare const HOST_WRITE_LIMIT: number;
|
|
35
|
-
/** What a reader is told when the held text had to be trimmed. */
|
|
36
|
-
export declare const HOST_WRITE_DROPPED = "\u2026 host output dropped";
|
|
37
28
|
/** The streams a host reaches for when it writes without the surface's help. */
|
|
38
29
|
export declare const HOST_WRITE_TARGETS: readonly HostWritable[];
|
|
39
30
|
export interface HostWriteGuard {
|
|
@@ -45,8 +36,6 @@ export interface HostWriteOptions {
|
|
|
45
36
|
terminal: HostWritable;
|
|
46
37
|
/** The streams the host writes to directly. */
|
|
47
38
|
targets: readonly HostWritable[];
|
|
48
|
-
/** Per-stream hold budget; the oldest whole write is dropped past it. */
|
|
49
|
-
limit?: number;
|
|
50
39
|
}
|
|
51
40
|
export declare function holdHostWrites(options: HostWriteOptions): HostWriteGuard;
|
|
52
41
|
//# sourceMappingURL=host-writes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-writes.d.ts","sourceRoot":"","sources":["../../src/terminal/host-writes.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"host-writes.d.ts","sourceRoot":"","sources":["../../src/terminal/host-writes.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;CACnC;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAY,CAAA;AAKzC,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,EAAE,SAAS,YAAY,EAAqC,CAAA;AAE3F,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,kFAAkF;IAClF,QAAQ,EAAE,YAAY,CAAA;IACtB,+CAA+C;IAC/C,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;CACjC;AAoHD,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAwBxE"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Trimming counts whole writes, so this is the point the oldest write is given
|
|
6
|
-
* up at rather than a ceiling on the bytes a stream holds; the header says what
|
|
7
|
-
* the newest write does to it.
|
|
3
|
+
* A per-stream byte ceiling prevents deferred diagnostics from growing without bound.
|
|
8
4
|
*/
|
|
9
5
|
export const HOST_WRITE_LIMIT = 64 * 1024;
|
|
10
6
|
/** What a reader is told when the held text had to be trimmed. */
|
|
11
|
-
|
|
7
|
+
const HOST_WRITE_DROPPED = '… host output dropped';
|
|
12
8
|
/** The streams a host reaches for when it writes without the surface's help. */
|
|
13
9
|
export const HOST_WRITE_TARGETS = [process.stdout, process.stderr];
|
|
14
10
|
/**
|
|
@@ -18,27 +14,33 @@ export const HOST_WRITE_TARGETS = [process.stdout, process.stderr];
|
|
|
18
14
|
* property, an inherited one disappears again — so a host that patched the
|
|
19
15
|
* stream before this ran keeps its own seam.
|
|
20
16
|
*/
|
|
21
|
-
function holdStream(target, held, isSurfaceWrite
|
|
17
|
+
function holdStream(target, held, isSurfaceWrite) {
|
|
22
18
|
const own = Object.getOwnPropertyDescriptor(target, 'write');
|
|
23
19
|
const original = target.write;
|
|
24
20
|
target.write = function (...args) {
|
|
25
21
|
if (isSurfaceWrite())
|
|
26
22
|
return Reflect.apply(original, this, args);
|
|
27
23
|
const [chunk, encoding, callback] = args;
|
|
24
|
+
// Retention and replay share a UTF-8 text budget so held diagnostics have a bounded replay size.
|
|
25
|
+
// This is not byte-preserving: original bytes and write encodings are not preserved.
|
|
28
26
|
const text = typeof chunk === 'string'
|
|
29
27
|
? chunk
|
|
30
28
|
: chunk instanceof Uint8Array
|
|
31
29
|
? Buffer.from(chunk).toString('utf8')
|
|
32
30
|
: String(chunk);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// hold is for, while a write cut in half would corrupt the diagnostic
|
|
37
|
-
// instead of losing it, so one oversized write stays entire.
|
|
38
|
-
while (held.length > limit && held.chunks.length > 1) {
|
|
39
|
-
held.length -= held.chunks.shift()?.length ?? 0;
|
|
31
|
+
const bytes = Buffer.byteLength(text);
|
|
32
|
+
// Cutting a write corrupts diagnostics; an oversized write must be dropped whole, not retained without bound.
|
|
33
|
+
if (bytes > HOST_WRITE_LIMIT)
|
|
40
34
|
held.dropped += 1;
|
|
35
|
+
else if (bytes > 0) {
|
|
36
|
+
held.chunks.push(text);
|
|
37
|
+
held.bytes += bytes;
|
|
38
|
+
while (held.bytes > HOST_WRITE_LIMIT) {
|
|
39
|
+
held.bytes -= Buffer.byteLength(held.chunks.shift() ?? '');
|
|
40
|
+
held.dropped += 1;
|
|
41
|
+
}
|
|
41
42
|
}
|
|
43
|
+
// Producers must not wait for a drain this hold never emits; acknowledgment is not terminal delivery.
|
|
42
44
|
if (typeof encoding === 'function')
|
|
43
45
|
encoding();
|
|
44
46
|
else if (typeof callback === 'function')
|
|
@@ -113,13 +115,12 @@ function markTerminalCalls(terminal, call) {
|
|
|
113
115
|
};
|
|
114
116
|
}
|
|
115
117
|
export function holdHostWrites(options) {
|
|
116
|
-
const limit = options.limit ?? HOST_WRITE_LIMIT;
|
|
117
118
|
const held = new Map();
|
|
118
119
|
for (const target of options.targets)
|
|
119
|
-
held.set(target, { chunks: [],
|
|
120
|
+
held.set(target, { chunks: [], bytes: 0, dropped: 0 });
|
|
120
121
|
const surface = { depth: 0 };
|
|
121
122
|
const restoreTerminal = markTerminalCalls(options.terminal, surface);
|
|
122
|
-
const streams = options.targets.map(target => holdStream(target, held.get(target), () => surface.depth > 0
|
|
123
|
+
const streams = options.targets.map(target => holdStream(target, held.get(target), () => surface.depth > 0));
|
|
123
124
|
let active = true;
|
|
124
125
|
return {
|
|
125
126
|
release() {
|
|
@@ -136,7 +137,7 @@ export function holdHostWrites(options) {
|
|
|
136
137
|
const notice = writes.dropped === 0 ? '' : `${HOST_WRITE_DROPPED} (${writes.dropped} writes)\n`;
|
|
137
138
|
streams[index]?.original(notice + writes.chunks.join(''));
|
|
138
139
|
writes.chunks.length = 0;
|
|
139
|
-
writes.
|
|
140
|
+
writes.bytes = 0;
|
|
140
141
|
writes.dropped = 0;
|
|
141
142
|
}
|
|
142
143
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-writes.js","sourceRoot":"","sources":["../../src/terminal/host-writes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"host-writes.js","sourceRoot":"","sources":["../../src/terminal/host-writes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AA2BpC;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAA;AAEzC,kEAAkE;AAClE,MAAM,kBAAkB,GAAG,uBAAuB,CAAA;AAElD,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAA4B,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;AA2B3F;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,MAAoB,EAAE,IAAgB,EAAE,cAA6B;IACvF,MAAM,GAAG,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5D,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAA;IAC7B,MAAM,CAAC,KAAK,GAAG,UAAyB,GAAG,IAAe;QACxD,IAAI,cAAc,EAAE;YAAE,OAAO,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QAChE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAA;QACxC,iGAAiG;QACjG,qFAAqF;QACrF,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ;YACpC,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,KAAK,YAAY,UAAU;gBAC3B,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACrC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACnB,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;IAC7G,IAAI,MAAM,GAAG,IAAI,CAAA;IACjB,OAAO;QACL,OAAO;YACL,IAAI,CAAC,MAAM;gBAAE,OAAM;YACnB,MAAM,GAAG,KAAK,CAAA;YACd,eAAe,EAAE,CAAA;YACjB,KAAK,MAAM,MAAM,IAAI,OAAO;gBAAE,MAAM,CAAC,OAAO,EAAE,CAAA;YAC9C,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;gBACxD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;gBAC/B,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC;oBAAE,SAAQ;gBAC1F,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,kBAAkB,KAAK,MAAM,CAAC,OAAO,YAAY,CAAA;gBAC/F,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;gBACzD,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;gBACxB,MAAM,CAAC,KAAK,GAAG,CAAC,CAAA;gBAChB,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;YACpB,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ProcessTerminal } from '@earendil-works/pi-tui';
|
|
2
|
+
/** Normalize before viewport, modal, and editor readers so the same physical press keeps one meaning. */
|
|
3
|
+
export declare class EventSafeTerminal extends ProcessTerminal {
|
|
4
|
+
start(onInput: (data: string) => void, onResize: () => void): void;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/terminal/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAMxD,yGAAyG;AACzG,qBAAa,iBAAkB,SAAQ,eAAe;IAC3C,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;CAO5E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ProcessTerminal } from '@earendil-works/pi-tui';
|
|
2
|
+
/** The pinned decoder recognizes SS3 F1–F4, but not their valid unmodified CSI event forms. */
|
|
3
|
+
const FUNCTION_PRESS_EVENT = /^\u001b\[1;1:[12]([PQRS])$/u;
|
|
4
|
+
const SS3_PREFIX = '\u001bO';
|
|
5
|
+
/** Normalize before viewport, modal, and editor readers so the same physical press keeps one meaning. */
|
|
6
|
+
export class EventSafeTerminal extends ProcessTerminal {
|
|
7
|
+
start(onInput, onResize) {
|
|
8
|
+
super.start(data => {
|
|
9
|
+
const match = FUNCTION_PRESS_EVENT.exec(data);
|
|
10
|
+
// Releases and modified keys retain their metadata rather than becoming unmodified presses.
|
|
11
|
+
onInput(match === null ? data : SS3_PREFIX + match[1]);
|
|
12
|
+
}, onResize);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/terminal/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,+FAA+F;AAC/F,MAAM,oBAAoB,GAAG,6BAA6B,CAAA;AAC1D,MAAM,UAAU,GAAG,SAAS,CAAA;AAE5B,yGAAyG;AACzG,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IAC3C,KAAK,CAAC,OAA+B,EAAE,QAAoB;QAClE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YACjB,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC7C,4FAA4F;YAC5F,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,CAAC,EAAE,QAAQ,CAAC,CAAA;IACd,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** One reversible terminal mutation. */
|
|
2
|
-
|
|
2
|
+
type RestoreHook = () => void;
|
|
3
3
|
/** Registry that guarantees every registered hook runs exactly once. */
|
|
4
4
|
export interface RestoreRegistry {
|
|
5
5
|
add(hook: RestoreHook): void;
|
|
@@ -13,4 +13,5 @@ export interface RestoreRegistry {
|
|
|
13
13
|
* a throwing hook must not strand the ones registered before it.
|
|
14
14
|
*/
|
|
15
15
|
export declare function createRestoreRegistry(): RestoreRegistry;
|
|
16
|
+
export {};
|
|
16
17
|
//# sourceMappingURL=restore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restore.d.ts","sourceRoot":"","sources":["../../src/terminal/restore.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"restore.d.ts","sourceRoot":"","sources":["../../src/terminal/restore.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,KAAK,WAAW,GAAG,MAAM,IAAI,CAAA;AAE7B,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;IAC5B,OAAO,IAAI,IAAI,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAyBvD"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* status a shell reports for the signal.
|
|
9
9
|
*/
|
|
10
10
|
/** Signals whose default action ends the process without unwinding the surface. */
|
|
11
|
-
|
|
11
|
+
declare const TERMINATING_SIGNALS: readonly ["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT"];
|
|
12
12
|
export type TerminatingSignal = (typeof TERMINATING_SIGNALS)[number];
|
|
13
13
|
/**
|
|
14
14
|
* Run a shutdown once for the first terminating signal, then leave.
|
|
@@ -21,4 +21,5 @@ export type TerminatingSignal = (typeof TERMINATING_SIGNALS)[number];
|
|
|
21
21
|
export declare function installSignalRestore(options: {
|
|
22
22
|
shutdown(code: number, signal: TerminatingSignal): void;
|
|
23
23
|
}): () => void;
|
|
24
|
+
export {};
|
|
24
25
|
//# sourceMappingURL=signals.d.ts.map
|