@deepseek-harness-tui/dsh-tui 0.8.0 → 0.8.2
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/README.md +32 -15
- package/cordis.patch.yml +21 -2
- package/cordis.yml +12 -1
- package/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -0
- package/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -0
- package/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -0
- package/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -0
- package/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -0
- package/dsh-ecosystem-spec/protocols/tui-channel.js +166 -0
- package/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -0
- package/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -0
- package/dsh-ecosystem-spec/registry/README.md +14 -0
- package/dsh-ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
- package/dsh-ecosystem-spec/registry/contracts/scene-v1alpha1.json +13 -0
- package/dsh-ecosystem-spec/registry/contracts/settings-section-v1alpha1.json +13 -0
- package/dsh-ecosystem-spec/registry/contracts/tui-channel-v1alpha1.json +30 -0
- package/dsh-ecosystem-spec/registry/contracts/workspace-provider-v1alpha1.json +6 -0
- package/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
- package/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -0
- package/dsh-ecosystem-spec/registry/registry-0.15.json +149 -0
- package/dsh-ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
- package/dsh-ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
- package/dsh-ecosystem-spec/schemas/host-descriptor.schema.json +26 -0
- package/lib/types/cc/figures.d.ts +4 -0
- package/lib/types/cc/figures.d.ts.map +1 -1
- package/lib/types/cc/figures.js +4 -0
- package/lib/types/command-trees.d.ts +2 -1
- package/lib/types/command-trees.d.ts.map +1 -1
- package/lib/types/command-trees.js +1 -1
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +2 -0
- package/lib/types/components/ExtensionDialog.d.ts +40 -0
- package/lib/types/components/ExtensionDialog.d.ts.map +1 -0
- package/lib/types/components/ExtensionDialog.js +210 -0
- package/lib/types/components/HelpMenu.js +1 -1
- package/lib/types/components/LoadedContextPanel.d.ts +5 -5
- package/lib/types/components/LoadedContextPanel.js +6 -6
- package/lib/types/components/LogoV2.d.ts.map +1 -1
- package/lib/types/components/LogoV2.js +16 -8
- package/lib/types/components/Markdown.d.ts +13 -1
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +15 -1
- package/lib/types/components/MessageList.d.ts +3 -1
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +111 -6
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +26 -12
- package/lib/types/components/RewindPicker.d.ts +13 -1
- package/lib/types/components/RewindPicker.d.ts.map +1 -1
- package/lib/types/components/RewindPicker.js +26 -2
- package/lib/types/components/StreamingMarkdown.d.ts +2 -8
- package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
- package/lib/types/components/StreamingMarkdown.js +51 -9
- package/lib/types/components/ToolUseLoader.d.ts +8 -3
- package/lib/types/components/ToolUseLoader.d.ts.map +1 -1
- package/lib/types/components/ToolUseLoader.js +43 -9
- package/lib/types/components/activityFrames.d.ts +1 -1
- package/lib/types/components/activityFrames.d.ts.map +1 -1
- package/lib/types/components/activityFrames.js +4 -1
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts +5 -1
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantThinkingMessage.js +26 -3
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +13 -2
- package/lib/types/dsh-adapter/channel.d.ts +61 -11
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +767 -120
- package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -1
- package/lib/types/dsh-adapter/childStderr.js +10 -0
- package/lib/types/dsh-adapter/command-attribution.d.ts +51 -0
- package/lib/types/dsh-adapter/command-attribution.d.ts.map +1 -0
- package/lib/types/dsh-adapter/command-attribution.js +93 -0
- package/lib/types/dsh-adapter/command-errors.d.ts +42 -0
- package/lib/types/dsh-adapter/command-errors.d.ts.map +1 -0
- package/lib/types/dsh-adapter/command-errors.js +63 -0
- package/lib/types/dsh-adapter/command-trees.d.ts +7 -1
- package/lib/types/dsh-adapter/command-trees.d.ts.map +1 -1
- package/lib/types/dsh-adapter/command-trees.js +70 -20
- package/lib/types/dsh-adapter/component-identity.d.ts +33 -0
- package/lib/types/dsh-adapter/component-identity.d.ts.map +1 -0
- package/lib/types/dsh-adapter/component-identity.js +108 -0
- package/lib/types/dsh-adapter/contract.d.ts +1 -1
- package/lib/types/dsh-adapter/contract.js +2 -2
- package/lib/types/dsh-adapter/decision-guard.d.ts +84 -0
- package/lib/types/dsh-adapter/decision-guard.d.ts.map +1 -0
- package/lib/types/dsh-adapter/decision-guard.js +348 -0
- package/lib/types/dsh-adapter/dialogs.d.ts +145 -0
- package/lib/types/dsh-adapter/dialogs.d.ts.map +1 -0
- package/lib/types/dsh-adapter/dialogs.js +316 -0
- package/lib/types/dsh-adapter/effect-ledger.d.ts +91 -0
- package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -0
- package/lib/types/dsh-adapter/effect-ledger.js +251 -0
- package/lib/types/dsh-adapter/extension-events.d.ts +193 -0
- package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -0
- package/lib/types/dsh-adapter/extension-events.js +207 -0
- package/lib/types/dsh-adapter/extensions.d.ts +32 -0
- package/lib/types/dsh-adapter/extensions.d.ts.map +1 -0
- package/lib/types/dsh-adapter/extensions.js +42 -0
- package/lib/types/dsh-adapter/grants.d.ts +25 -0
- package/lib/types/dsh-adapter/grants.d.ts.map +1 -0
- package/lib/types/dsh-adapter/grants.js +213 -0
- package/lib/types/dsh-adapter/host-access.d.ts +37 -0
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -0
- package/lib/types/dsh-adapter/host-access.js +652 -0
- package/lib/types/dsh-adapter/host-descriptor.d.ts +24 -0
- package/lib/types/dsh-adapter/host-descriptor.d.ts.map +1 -0
- package/lib/types/dsh-adapter/host-descriptor.js +169 -0
- package/lib/types/dsh-adapter/index.d.ts +4 -0
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +1 -0
- package/lib/types/dsh-adapter/message-observer.d.ts +173 -0
- package/lib/types/dsh-adapter/message-observer.d.ts.map +1 -0
- package/lib/types/dsh-adapter/message-observer.js +553 -0
- package/lib/types/dsh-adapter/plugin-host.d.ts +136 -0
- package/lib/types/dsh-adapter/plugin-host.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugin-host.js +365 -0
- package/lib/types/dsh-adapter/plugin-storage.d.ts +108 -0
- package/lib/types/dsh-adapter/plugin-storage.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugin-storage.js +397 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +124 -14
- package/lib/types/dsh-adapter/plugins-info.d.ts +43 -0
- package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugins-info.js +276 -0
- package/lib/types/dsh-adapter/promptDebug.d.ts +0 -6
- package/lib/types/dsh-adapter/promptDebug.d.ts.map +1 -1
- package/lib/types/dsh-adapter/promptDebug.js +13 -4
- package/lib/types/dsh-adapter/renderers.d.ts +57 -0
- package/lib/types/dsh-adapter/renderers.d.ts.map +1 -0
- package/lib/types/dsh-adapter/renderers.js +173 -0
- package/lib/types/dsh-adapter/sanitize.d.ts +36 -0
- package/lib/types/dsh-adapter/sanitize.d.ts.map +1 -0
- package/lib/types/dsh-adapter/sanitize.js +65 -0
- package/lib/types/dsh-adapter/scenes.d.ts +15 -5
- package/lib/types/dsh-adapter/scenes.d.ts.map +1 -1
- package/lib/types/dsh-adapter/scenes.js +149 -35
- package/lib/types/dsh-adapter/settings-sections.d.ts +7 -3
- package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +106 -26
- package/lib/types/dsh-adapter/shortcuts.d.ts +107 -0
- package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -0
- package/lib/types/dsh-adapter/shortcuts.js +340 -0
- package/lib/types/dsh-adapter/status.d.ts +74 -0
- package/lib/types/dsh-adapter/status.d.ts.map +1 -0
- package/lib/types/dsh-adapter/status.js +234 -0
- package/lib/types/dsh-adapter/workspaces.d.ts +16 -5
- package/lib/types/dsh-adapter/workspaces.d.ts.map +1 -1
- package/lib/types/dsh-adapter/workspaces.js +287 -170
- package/lib/types/extensions.d.ts +13 -0
- package/lib/types/extensions.d.ts.map +1 -0
- package/lib/types/extensions.js +21 -0
- package/lib/types/force-production-react.d.ts +1 -0
- package/lib/types/force-production-react.d.ts.map +1 -0
- package/lib/types/force-production-react.js +12 -0
- package/lib/types/i18n.d.ts +174 -20
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +56 -6
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +1 -0
- package/lib/types/ink/components/App.d.ts +2 -0
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +4 -0
- package/lib/types/ink/ink.d.ts +31 -3
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +90 -5
- package/lib/types/ink/log-update.d.ts.map +1 -1
- package/lib/types/ink/log-update.js +225 -56
- package/lib/types/ink/output.d.ts +35 -2
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +281 -14
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +14 -6
- package/lib/types/ink/screen.d.ts +39 -0
- package/lib/types/ink/screen.d.ts.map +1 -1
- package/lib/types/ink/screen.js +117 -0
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +26 -6
- package/lib/types/ink/wrapAnsi.d.ts +1 -1
- package/lib/types/ink/wrapAnsi.d.ts.map +1 -1
- package/lib/types/ink/wrapAnsi.js +29 -2
- package/lib/types/plugin-host.d.ts +15 -0
- package/lib/types/plugin-host.d.ts.map +1 -0
- package/lib/types/plugin-host.js +17 -0
- package/lib/types/plugin-spec/negotiate.d.ts +11 -0
- package/lib/types/plugin-spec/negotiate.d.ts.map +1 -0
- package/lib/types/plugin-spec/negotiate.js +97 -0
- package/lib/types/plugin-spec/permission-scope.d.ts +32 -0
- package/lib/types/plugin-spec/permission-scope.d.ts.map +1 -0
- package/lib/types/plugin-spec/permission-scope.js +90 -0
- package/lib/types/plugin-spec/registry.d.ts +23 -0
- package/lib/types/plugin-spec/registry.d.ts.map +1 -0
- package/lib/types/plugin-spec/registry.js +252 -0
- package/lib/types/plugin-spec/schema-check.d.ts +17 -0
- package/lib/types/plugin-spec/schema-check.d.ts.map +1 -0
- package/lib/types/plugin-spec/schema-check.js +165 -0
- package/lib/types/plugin-spec/tui-extension.d.ts +16 -0
- package/lib/types/plugin-spec/tui-extension.d.ts.map +1 -0
- package/lib/types/plugin-spec/tui-extension.js +79 -0
- package/lib/types/plugin-spec/types.d.ts +114 -0
- package/lib/types/plugin-spec/types.d.ts.map +1 -0
- package/lib/types/plugin-spec/types.js +10 -0
- package/lib/types/plugin-spec/validate.d.ts +21 -0
- package/lib/types/plugin-spec/validate.d.ts.map +1 -0
- package/lib/types/plugin-spec/validate.js +138 -0
- package/lib/types/scenes.d.ts +2 -1
- package/lib/types/scenes.d.ts.map +1 -1
- package/lib/types/scenes.js +1 -1
- package/lib/types/screens/Chat.d.ts +14 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +173 -49
- package/lib/types/screens/SessionBrowser.d.ts.map +1 -1
- package/lib/types/screens/SessionBrowser.js +10 -3
- package/lib/types/sessions/view.d.ts +3 -2
- package/lib/types/sessions/view.d.ts.map +1 -1
- package/lib/types/sessions/view.js +18 -0
- package/lib/types/settings-sections.d.ts +2 -1
- package/lib/types/settings-sections.d.ts.map +1 -1
- package/lib/types/settings-sections.js +1 -1
- package/lib/types/theme.d.ts +5 -0
- package/lib/types/theme.d.ts.map +1 -1
- package/lib/types/theme.js +15 -0
- package/lib/types/update.d.ts +20 -0
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +54 -7
- package/lib/types/utils/execFileNoThrow.d.ts.map +1 -1
- package/lib/types/utils/execFileNoThrow.js +3 -0
- package/lib/types/utils/loaded-context.d.ts +8 -3
- package/lib/types/utils/loaded-context.d.ts.map +1 -1
- package/lib/types/utils/loaded-context.js +39 -3
- package/lib/types/utils/modifiers.d.ts.map +1 -1
- package/lib/types/utils/modifiers.js +3 -2
- package/lib/types/working-activity.d.ts +12 -0
- package/lib/types/working-activity.d.ts.map +1 -1
- package/lib/types/working-activity.js +13 -0
- package/lib/types/workspaces.d.ts +2 -1
- package/lib/types/workspaces.d.ts.map +1 -1
- package/lib/types/workspaces.js +1 -1
- package/node_modules/@dsh-std/command/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/command/LICENSE +21 -0
- package/node_modules/@dsh-std/command/README.md +26 -0
- package/node_modules/@dsh-std/command/README.zh.md +28 -0
- package/node_modules/@dsh-std/command/lib/index.d.ts +144 -0
- package/node_modules/@dsh-std/command/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/command/lib/index.js +252 -0
- package/node_modules/@dsh-std/command/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/command/package.json +22 -0
- package/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/connection/LICENSE +21 -0
- package/node_modules/@dsh-std/connection/README.md +42 -0
- package/node_modules/@dsh-std/connection/README.zh.md +42 -0
- package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
- package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
- package/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
- package/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/connection/lib/index.js +158 -0
- package/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
- package/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
- package/node_modules/@dsh-std/connection/lib/memory.js +258 -0
- package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
- package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
- package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
- package/node_modules/@dsh-std/connection/package.json +20 -0
- package/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/core/LICENSE +21 -0
- package/node_modules/@dsh-std/core/README.md +13 -0
- package/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/core/package.json +21 -0
- package/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -0
- package/node_modules/@dsh-std/manifest/LICENSE +21 -0
- package/node_modules/@dsh-std/manifest/README.md +5 -0
- package/node_modules/@dsh-std/manifest/README.zh.md +5 -0
- package/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
- package/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/manifest/lib/index.js +625 -0
- package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/manifest/package.json +20 -0
- package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
- package/node_modules/@dsh-std/messages/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/messages/LICENSE +21 -0
- package/node_modules/@dsh-std/messages/README.md +5 -0
- package/node_modules/@dsh-std/messages/README.zh.md +7 -0
- package/node_modules/@dsh-std/messages/lib/index.d.ts +50 -0
- package/node_modules/@dsh-std/messages/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/messages/lib/index.js +151 -0
- package/node_modules/@dsh-std/messages/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/messages/package.json +20 -0
- package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -0
- package/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -0
- package/node_modules/@dsh-std/presentation/LICENSE +21 -0
- package/node_modules/@dsh-std/presentation/README.md +27 -0
- package/node_modules/@dsh-std/presentation/README.zh.md +29 -0
- package/node_modules/@dsh-std/presentation/lib/callback.d.ts +2 -0
- package/node_modules/@dsh-std/presentation/lib/callback.js +179 -0
- package/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -0
- package/node_modules/@dsh-std/presentation/lib/index.d.ts +262 -0
- package/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/presentation/lib/index.js +550 -0
- package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
- package/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
- package/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
- package/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
- package/node_modules/@dsh-std/presentation/package.json +25 -0
- package/node_modules/@dsh-std/storage/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/storage/LICENSE +21 -0
- package/node_modules/@dsh-std/storage/README.md +5 -0
- package/node_modules/@dsh-std/storage/README.zh.md +7 -0
- package/node_modules/@dsh-std/storage/lib/index.d.ts +48 -0
- package/node_modules/@dsh-std/storage/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/storage/lib/index.js +104 -0
- package/node_modules/@dsh-std/storage/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/storage/package.json +20 -0
- package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -0
- package/package.json +110 -70
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js +158 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js +258 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js +625 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +27 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +29 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.d.ts +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js +179 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts +262 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js +550 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +25 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js +158 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js +258 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -0
package/lib/types/ink/output.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { styledCharsFromTokens, tokenize, } from '@alcalzone/ansi-tokenize';
|
|
1
|
+
import { ansiCodesToString, styledCharsFromTokens, tokenize, } from '@alcalzone/ansi-tokenize';
|
|
2
2
|
import { logForDebugging } from '../utils/debug.js';
|
|
3
3
|
import { getGraphemeSegmenter } from '../utils/intl.js';
|
|
4
4
|
import sliceAnsi from '../utils/sliceAnsi.js';
|
|
5
5
|
import { reorderBidi } from './bidi.js';
|
|
6
6
|
import { unionRect } from './layout/geometry.js';
|
|
7
|
-
import { blitRegion, extractHyperlinkFromStyles, filterOutHyperlinkStyles, markNoSelectRegion, OSC8_PREFIX, resetScreen, setCellAt, shiftRows, } from './screen.js';
|
|
7
|
+
import { blitRegion, cellRunSpan, createCellRun, extractHyperlinkFromStyles, filterOutHyperlinkStyles, markNoSelectRegion, OSC8_PREFIX, recordCellRunEntry, recordSpacerRunEntry, replayCellRun, resetScreen, setCellAt, shiftRows, } from './screen.js';
|
|
8
8
|
import { stringWidth } from './stringWidth.js';
|
|
9
9
|
import { widestLine } from './widest-line.js';
|
|
10
10
|
/**
|
|
@@ -29,6 +29,11 @@ import { widestLine } from './widest-line.js';
|
|
|
29
29
|
const MAX_CACHEABLE_LINE = 500;
|
|
30
30
|
const CHAR_CACHE_MAX_ENTRIES = 16384;
|
|
31
31
|
const CHAR_CACHE_MAX_CHARS = 100_000;
|
|
32
|
+
/** Packed-run line cap: runs are three integers per cell (no per-char
|
|
33
|
+
* objects like charCache entries), so long ANSI-art lines (the whale
|
|
34
|
+
* logo, ~700 chars) are worth caching — they would otherwise
|
|
35
|
+
* re-tokenize and re-cluster every frame. */
|
|
36
|
+
const PACKED_MAX_LINE = 4000;
|
|
32
37
|
/** Copy a string into a fresh flat string with no parent references. */
|
|
33
38
|
function detachString(s) {
|
|
34
39
|
// Buffer round-trip guarantees a newly allocated flat string; cheaper
|
|
@@ -41,28 +46,58 @@ function detachString(s) {
|
|
|
41
46
|
* no caller can accidentally grow it unboundedly.
|
|
42
47
|
*/
|
|
43
48
|
export class CharCache {
|
|
49
|
+
/**
|
|
50
|
+
* LRU of line → clustered characters. A full clear on overflow
|
|
51
|
+
* (the original behavior) thrashes during long-session streaming: the
|
|
52
|
+
* mounted window's static lines alone approach the char budget, so the
|
|
53
|
+
* streaming row's per-frame new keys tip it over every frame or two,
|
|
54
|
+
* nuking the cache and forcing ~1800 line re-tokenizations per frame
|
|
55
|
+
* (measured ~100ms/frame at a 175-row session). Evicting oldest-first
|
|
56
|
+
* keeps the hot mounted lines resident while streaming churn falls out
|
|
57
|
+
* the back. Recency is refreshed on hit (delete + re-insert) so lines
|
|
58
|
+
* read every frame are never evicted by one-shot churn.
|
|
59
|
+
*/
|
|
44
60
|
map = new Map();
|
|
45
61
|
chars = 0;
|
|
46
62
|
/**
|
|
47
|
-
* Return the cached clustered characters for a line, if present
|
|
63
|
+
* Return the cached clustered characters for a line, if present, and
|
|
64
|
+
* refresh the entry's recency.
|
|
48
65
|
* @param line - the line to look up.
|
|
49
66
|
* @returns the cached characters, or undefined on a miss.
|
|
50
67
|
*/
|
|
51
68
|
get(line) {
|
|
52
|
-
|
|
69
|
+
const hit = this.map.get(line);
|
|
70
|
+
if (hit !== undefined) {
|
|
71
|
+
this.map.delete(line);
|
|
72
|
+
this.map.set(line, hit);
|
|
73
|
+
}
|
|
74
|
+
return hit;
|
|
53
75
|
}
|
|
54
76
|
/**
|
|
55
|
-
* Cache clustered characters for a line, enforcing the cache bounds
|
|
77
|
+
* Cache clustered characters for a line, enforcing the cache bounds by
|
|
78
|
+
* evicting least-recently-used entries (never a full clear).
|
|
56
79
|
* @param line - the line key.
|
|
57
80
|
* @param characters - the clustered characters to cache.
|
|
58
81
|
*/
|
|
59
82
|
set(line, characters) {
|
|
60
83
|
if (line.length > MAX_CACHEABLE_LINE)
|
|
61
84
|
return;
|
|
62
|
-
if (this.map.
|
|
85
|
+
if (this.map.has(line)) {
|
|
86
|
+
this.map.delete(line);
|
|
87
|
+
this.chars -= line.length;
|
|
88
|
+
}
|
|
89
|
+
// Evict oldest entries until the new one fits. A single line longer
|
|
90
|
+
// than the whole budget cannot fit even empty — skip caching it.
|
|
91
|
+
if (line.length > CHAR_CACHE_MAX_CHARS)
|
|
92
|
+
return;
|
|
93
|
+
while (this.map.size >= CHAR_CACHE_MAX_ENTRIES ||
|
|
63
94
|
this.chars + line.length > CHAR_CACHE_MAX_CHARS) {
|
|
64
|
-
this.map.
|
|
65
|
-
|
|
95
|
+
const oldest = this.map.keys().next();
|
|
96
|
+
if (oldest.done === true)
|
|
97
|
+
break;
|
|
98
|
+
const oldestKey = oldest.value;
|
|
99
|
+
this.chars -= oldestKey.length;
|
|
100
|
+
this.map.delete(oldestKey);
|
|
66
101
|
}
|
|
67
102
|
this.map.set(detachString(line), characters);
|
|
68
103
|
this.chars += line.length;
|
|
@@ -106,6 +141,128 @@ function minDefined(a, b) {
|
|
|
106
141
|
return a;
|
|
107
142
|
return Math.min(a, b);
|
|
108
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Slot-reuse ceiling: the clustered array is a second full memory image of
|
|
146
|
+
* the line, and pathological single-line output (base64 blobs, minified
|
|
147
|
+
* code) would pin it across frames on top of the string itself. Past this
|
|
148
|
+
* length every frame takes the full path — transient, GC-able.
|
|
149
|
+
*/
|
|
150
|
+
const STREAMING_SLOT_MAX_LINE = 65_536;
|
|
151
|
+
/**
|
|
152
|
+
* Classify the tail of the line relative to its LAST ESC character.
|
|
153
|
+
* - 'none': no ESC at all
|
|
154
|
+
* - 'dangling': the last ESC starts an escape sequence that is cut off at
|
|
155
|
+
* end-of-line - next frame's continuation completes it, so the prefix
|
|
156
|
+
* clustering cannot be reused (the partial sequence was clustered as text)
|
|
157
|
+
* - 'bare': the last ESC's sequence is complete but ends exactly at
|
|
158
|
+
* end-of-line - the SGR state after it never applied to any character, so
|
|
159
|
+
* trailingStyles (derived from the last char) would be stale next frame
|
|
160
|
+
* - 'complete': last sequence terminated with plain text after it
|
|
161
|
+
*/
|
|
162
|
+
function escapeTailState(line) {
|
|
163
|
+
const i = line.lastIndexOf('\x1b');
|
|
164
|
+
if (i === -1)
|
|
165
|
+
return 'none';
|
|
166
|
+
const rest = line.slice(i);
|
|
167
|
+
const c1 = rest[1];
|
|
168
|
+
if (c1 === undefined)
|
|
169
|
+
return 'dangling';
|
|
170
|
+
if (c1 === '[') {
|
|
171
|
+
for (let k = 2; k < rest.length; k++) {
|
|
172
|
+
const ch = rest.charCodeAt(k);
|
|
173
|
+
if (ch >= 0x40 && ch <= 0x7e)
|
|
174
|
+
return k === rest.length - 1 ? 'bare' : 'complete';
|
|
175
|
+
if (ch < 0x20 || ch > 0x3f)
|
|
176
|
+
return 'complete';
|
|
177
|
+
}
|
|
178
|
+
return 'dangling';
|
|
179
|
+
}
|
|
180
|
+
if (c1 === ']' || c1 === 'P' || c1 === '_' || c1 === '^' || c1 === 'X') {
|
|
181
|
+
for (let k = 2; k < rest.length; k++) {
|
|
182
|
+
if (rest[k] === '\x07')
|
|
183
|
+
return k === rest.length - 1 ? 'bare' : 'complete';
|
|
184
|
+
if (rest[k] === '\x1b' && rest[k + 1] === '\\') {
|
|
185
|
+
return k + 1 === rest.length - 1 ? 'bare' : 'complete';
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return 'dangling';
|
|
189
|
+
}
|
|
190
|
+
// Two-character sequence ESC <0x30-0x7E>: rest.length >= 2 means complete.
|
|
191
|
+
return rest.length === 2 ? 'bare' : 'complete';
|
|
192
|
+
}
|
|
193
|
+
/** True when the line's last code point may continue into a multi-codepoint
|
|
194
|
+
* grapheme (ZWJ, variation selectors, combining marks, skin tones, regional
|
|
195
|
+
* indicators) - appending to it would change the last grapheme's clustering. */
|
|
196
|
+
function endsWithOpenGrapheme(line) {
|
|
197
|
+
const cp = line.codePointAt(line.length - 1);
|
|
198
|
+
if (cp === undefined)
|
|
199
|
+
return false;
|
|
200
|
+
return (cp === 0x200d ||
|
|
201
|
+
cp === 0xfe0f ||
|
|
202
|
+
cp === 0xfe0e ||
|
|
203
|
+
(cp >= 0x0300 && cp <= 0x036f) ||
|
|
204
|
+
(cp >= 0x1f3fb && cp <= 0x1f3ff) ||
|
|
205
|
+
(cp >= 0x1f1e6 && cp <= 0x1f1ff));
|
|
206
|
+
}
|
|
207
|
+
/** Hebrew / Arabic / Syriac and related RTL blocks - bidirectional reordering
|
|
208
|
+
* is line-global, so prefix-reuse (which reorders only the suffix) is not
|
|
209
|
+
* safe for these; take the full path. */
|
|
210
|
+
function hasRtlChars(text) {
|
|
211
|
+
return /[\u0590-\u05FF\u0600-\u06FF\u0700-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/.test(text);
|
|
212
|
+
}
|
|
213
|
+
/** Update (or clear) the streaming slot after a full-path build of `line`.
|
|
214
|
+
* The slot is only kept when the line can safely be extended next frame. */
|
|
215
|
+
function updateStreamingSlot(slot, line, clustered, chars) {
|
|
216
|
+
if (line.length <= MAX_CACHEABLE_LINE ||
|
|
217
|
+
line.length > STREAMING_SLOT_MAX_LINE ||
|
|
218
|
+
endsWithOpenGrapheme(line) ||
|
|
219
|
+
hasRtlChars(line)) {
|
|
220
|
+
// Short lines are served by CharCache; complex tails always take the
|
|
221
|
+
// full path. Drop a stale slot when the stream settles.
|
|
222
|
+
if (slot.current)
|
|
223
|
+
slot.current = null;
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const tail = escapeTailState(line);
|
|
227
|
+
if (tail === 'dangling' || tail === 'bare') {
|
|
228
|
+
if (slot.current)
|
|
229
|
+
slot.current = null;
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
slot.current = {
|
|
233
|
+
line: detachString(line),
|
|
234
|
+
clustered,
|
|
235
|
+
trailingStyles: chars.length > 0 ? chars[chars.length - 1].styles : [],
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Build the clustered characters for one line, taking the streaming-prefix
|
|
240
|
+
* fast path when possible. `slot` is the instance-level streaming slot;
|
|
241
|
+
* `prevChars`/`fullChars` wiring is handled by updateStreamingSlot.
|
|
242
|
+
*/
|
|
243
|
+
function buildClusteredChars(line, stylePool, slot) {
|
|
244
|
+
const prev = slot.current;
|
|
245
|
+
if (prev &&
|
|
246
|
+
line.length > MAX_CACHEABLE_LINE &&
|
|
247
|
+
line.length > prev.line.length &&
|
|
248
|
+
line.startsWith(prev.line) &&
|
|
249
|
+
!endsWithOpenGrapheme(prev.line) &&
|
|
250
|
+
!hasRtlChars(line.slice(prev.line.length))) {
|
|
251
|
+
// Reuse the prefix clustering verbatim; tokenize only the appended
|
|
252
|
+
// suffix, replaying the line-end SGR state so new characters inherit
|
|
253
|
+
// the correct style. Bidi runs on the suffix alone (line verified RTL-free).
|
|
254
|
+
const suffix = line.slice(prev.line.length);
|
|
255
|
+
const replay = styledCharsFromTokens(tokenize(ansiCodesToString(prev.trailingStyles) + suffix));
|
|
256
|
+
const clustered = styledCharsWithGraphemeClustering(replay, stylePool);
|
|
257
|
+
const result = prev.clustered.concat(reorderBidi(clustered));
|
|
258
|
+
updateStreamingSlot(slot, line, result, replay);
|
|
259
|
+
return result;
|
|
260
|
+
}
|
|
261
|
+
const chars = styledCharsFromTokens(tokenize(line));
|
|
262
|
+
const clustered = reorderBidi(styledCharsWithGraphemeClustering(chars, stylePool));
|
|
263
|
+
updateStreamingSlot(slot, line, clustered, chars);
|
|
264
|
+
return clustered;
|
|
265
|
+
}
|
|
109
266
|
/**
|
|
110
267
|
* Collects write/blit/clear/clip operations from the render tree, then
|
|
111
268
|
* applies them to a Screen buffer in get(). The Screen is what gets
|
|
@@ -120,6 +277,48 @@ export default class Output {
|
|
|
120
277
|
screen;
|
|
121
278
|
operations = [];
|
|
122
279
|
charCache = new CharCache();
|
|
280
|
+
/**
|
|
281
|
+
* LRU of line → recorded packed cell run, mirroring charCache's bounds.
|
|
282
|
+
* The main-screen architecture repaints every settled line each frame;
|
|
283
|
+
* the recorded run replays as raw two-word stores (no interning, no
|
|
284
|
+
* packing, no guard branches) — the long-session streaming fix. Runs are
|
|
285
|
+
* validated against the screen they were interned on and die with it.
|
|
286
|
+
*/
|
|
287
|
+
packedLines = new Map();
|
|
288
|
+
packedChars = 0;
|
|
289
|
+
/** Stable owner handle passed to writeLineToScreen (no per-call closure). */
|
|
290
|
+
packedOwner = {
|
|
291
|
+
lines: this.packedLines,
|
|
292
|
+
commit: (line, run) => {
|
|
293
|
+
this.setPackedLine(line, run);
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
/** Insert into the packed-lines LRU, evicting oldest entries on budget. */
|
|
297
|
+
setPackedLine(line, run) {
|
|
298
|
+
if (line.length > PACKED_MAX_LINE)
|
|
299
|
+
return;
|
|
300
|
+
if (this.packedLines.has(line)) {
|
|
301
|
+
this.packedLines.delete(line);
|
|
302
|
+
this.packedChars -= line.length;
|
|
303
|
+
}
|
|
304
|
+
while (this.packedLines.size >= CHAR_CACHE_MAX_ENTRIES ||
|
|
305
|
+
this.packedChars + line.length > CHAR_CACHE_MAX_CHARS) {
|
|
306
|
+
const oldest = this.packedLines.keys().next();
|
|
307
|
+
if (oldest.done === true)
|
|
308
|
+
break;
|
|
309
|
+
this.packedChars -= oldest.value.length;
|
|
310
|
+
this.packedLines.delete(oldest.value);
|
|
311
|
+
}
|
|
312
|
+
this.packedLines.set(detachString(line), run);
|
|
313
|
+
this.packedChars += line.length;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Streaming-tail slot, shared by every writeLineToScreen call of this
|
|
317
|
+
* Output (only one line grows per frame during streaming). Survives reset()
|
|
318
|
+
* like charCache - it is keyed by strict line extension, so stale entries
|
|
319
|
+
* can never produce a wrong hit.
|
|
320
|
+
*/
|
|
321
|
+
streamingSlot = { current: null };
|
|
123
322
|
constructor(options) {
|
|
124
323
|
const { width, height, stylePool, screen } = options;
|
|
125
324
|
this.width = width;
|
|
@@ -361,6 +560,12 @@ export default class Output {
|
|
|
361
560
|
const from = x < clip.x1 ? clip.x1 - x : 0;
|
|
362
561
|
const width = stringWidth(line);
|
|
363
562
|
const to = x + width > clip.x2 ? clip.x2 - x : width;
|
|
563
|
+
// Fast path: the line sits entirely inside the clip — no
|
|
564
|
+
// slice needed. sliceAnsi re-tokenizes the line (the
|
|
565
|
+
// dominant per-frame cost of long sessions otherwise:
|
|
566
|
+
// every settled line, every frame).
|
|
567
|
+
if (from === 0 && to === width)
|
|
568
|
+
return line;
|
|
364
569
|
let sliced = sliceAnsi(line, from, to);
|
|
365
570
|
// Wide chars (CJK, emoji) occupy 2 cells. When `to` lands
|
|
366
571
|
// on the first cell of a wide char, sliceAnsi includes the
|
|
@@ -403,7 +608,7 @@ export default class Output {
|
|
|
403
608
|
if (lineY >= screenHeight) {
|
|
404
609
|
break;
|
|
405
610
|
}
|
|
406
|
-
const contentEnd = writeLineToScreen(screen, line, x, lineY, screenWidth, this.stylePool, this.charCache);
|
|
611
|
+
const contentEnd = writeLineToScreen(screen, line, x, lineY, screenWidth, this.stylePool, this.charCache, this.streamingSlot, this.packedOwner);
|
|
407
612
|
writeCells += contentEnd - x;
|
|
408
613
|
// See Screen.softWrap docstring for the encoding. contentEnd
|
|
409
614
|
// from writeLineToScreen is tab-expansion-aware, unlike
|
|
@@ -520,12 +725,45 @@ function flushBuffer(buffer, styles, stylePool, out) {
|
|
|
520
725
|
* the caller can record it in screen.softWrap without re-walking the
|
|
521
726
|
* line via stringWidth(). Caller computes the debug cell-count as end-x.
|
|
522
727
|
*/
|
|
523
|
-
function writeLineToScreen(screen, line, x, y, screenWidth, stylePool, charCache) {
|
|
728
|
+
function writeLineToScreen(screen, line, x, y, screenWidth, stylePool, charCache, streamingSlot, packed) {
|
|
729
|
+
// Fast path: replay the recorded packed run for this exact line — two
|
|
730
|
+
// typed-array stores per cell, no interning/packing/guard work. The run
|
|
731
|
+
// dies with its screen; a width transition needs the slow path's guards
|
|
732
|
+
// and replayCellRun reports that.
|
|
733
|
+
if (packed !== undefined) {
|
|
734
|
+
const run = packed.lines.get(line);
|
|
735
|
+
if (run !== undefined &&
|
|
736
|
+
run.charPool === screen.charPool &&
|
|
737
|
+
x >= 0 &&
|
|
738
|
+
x + cellRunSpan(run) <= screenWidth) {
|
|
739
|
+
if (replayCellRun(screen, x, y, run)) {
|
|
740
|
+
// LRU refresh (chars budget unchanged: same key length).
|
|
741
|
+
packed.lines.delete(line);
|
|
742
|
+
packed.lines.set(line, run);
|
|
743
|
+
return x + cellRunSpan(run);
|
|
744
|
+
}
|
|
745
|
+
// fall through to the slow path for this line this frame
|
|
746
|
+
}
|
|
747
|
+
}
|
|
524
748
|
let characters = charCache.get(line);
|
|
525
749
|
if (!characters) {
|
|
526
|
-
characters =
|
|
750
|
+
characters = buildClusteredChars(line, stylePool, streamingSlot);
|
|
527
751
|
charCache.set(line, characters);
|
|
528
752
|
}
|
|
753
|
+
// Recording for the packed fast path: only plain single/wide char cells
|
|
754
|
+
// are recordable — control chars (tab expansion is x-relative), edge
|
|
755
|
+
// SpacerHead substitution, and y/x off-screen abort it. The packed-run
|
|
756
|
+
// limit is far above the charCache's MAX_CACHEABLE_LINE: a run costs
|
|
757
|
+
// three small integers per cell (no per-char objects), so even the
|
|
758
|
+
// ~700-char ANSI-art whale lines belong — without this they
|
|
759
|
+
// re-tokenize and re-cluster EVERY frame.
|
|
760
|
+
const recordable = packed !== undefined &&
|
|
761
|
+
line.length <= PACKED_MAX_LINE &&
|
|
762
|
+
x >= 0 &&
|
|
763
|
+
y >= 0 &&
|
|
764
|
+
y < screen.height;
|
|
765
|
+
let run = recordable ? createCellRun(screen) : undefined;
|
|
766
|
+
let runAlive = run !== undefined;
|
|
529
767
|
let offsetX = x;
|
|
530
768
|
for (let charIdx = 0; charIdx < characters.length; charIdx++) {
|
|
531
769
|
const character = characters[charIdx];
|
|
@@ -534,6 +772,8 @@ function writeLineToScreen(screen, line, x, y, screenWidth, stylePool, charCache
|
|
|
534
772
|
// mismatches. stringWidth treats these as width 0, but terminals may
|
|
535
773
|
// move the cursor differently.
|
|
536
774
|
if (codePoint !== undefined && codePoint <= 0x1f) {
|
|
775
|
+
// Not recordable: tab expansion is x-relative, ESC handling varies.
|
|
776
|
+
runAlive = false;
|
|
537
777
|
// Tab (0x09): expand to spaces to reach next tab stop
|
|
538
778
|
if (codePoint === 0x09) {
|
|
539
779
|
const tabWidth = 8;
|
|
@@ -636,9 +876,10 @@ function writeLineToScreen(screen, line, x, y, screenWidth, stylePool, charCache
|
|
|
636
876
|
}
|
|
637
877
|
const isWideCharacter = charWidth >= 2;
|
|
638
878
|
// Wide char at last column can't fit — terminal would wrap it to
|
|
639
|
-
// the next line, desyncing our cursor model. Place a SpacerHead
|
|
640
|
-
//
|
|
879
|
+
// the next line, desyncing our cursor model. Place a SpacerHead to
|
|
880
|
+
// mark the blank column, matching terminal behavior.
|
|
641
881
|
if (isWideCharacter && offsetX + 2 > screenWidth) {
|
|
882
|
+
runAlive = false;
|
|
642
883
|
setCellAt(screen, offsetX, y, {
|
|
643
884
|
char: ' ',
|
|
644
885
|
styleId: stylePool.none,
|
|
@@ -651,13 +892,39 @@ function writeLineToScreen(screen, line, x, y, screenWidth, stylePool, charCache
|
|
|
651
892
|
// styleId + hyperlink were precomputed during clustering (once per
|
|
652
893
|
// style run, cached via charCache). Hot loop is now just property
|
|
653
894
|
// reads — no intern, no extract, no filter per frame.
|
|
895
|
+
const cellWidth = isWideCharacter ? 1 /* CellWidth.Wide */ : 0 /* CellWidth.Narrow */;
|
|
654
896
|
setCellAt(screen, offsetX, y, {
|
|
655
897
|
char: character.value,
|
|
656
898
|
styleId: character.styleId,
|
|
657
|
-
width:
|
|
899
|
+
width: cellWidth,
|
|
658
900
|
hyperlink: character.hyperlink,
|
|
659
901
|
});
|
|
902
|
+
if (runAlive && run !== undefined) {
|
|
903
|
+
recordCellRunEntry(run, screen, offsetX, {
|
|
904
|
+
char: character.value,
|
|
905
|
+
styleId: character.styleId,
|
|
906
|
+
width: cellWidth,
|
|
907
|
+
hyperlink: character.hyperlink,
|
|
908
|
+
});
|
|
909
|
+
// setCellAt also writes a SpacerTail after a wide char (when it
|
|
910
|
+
// fits); record that deterministic write too, or abort at the edge.
|
|
911
|
+
if (isWideCharacter) {
|
|
912
|
+
if (offsetX + 1 < screenWidth) {
|
|
913
|
+
recordSpacerRunEntry(run, offsetX + 1);
|
|
914
|
+
}
|
|
915
|
+
else {
|
|
916
|
+
runAlive = false;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
660
920
|
offsetX += isWideCharacter ? 2 : 1;
|
|
661
921
|
}
|
|
922
|
+
// Commit the recording for the packed fast path. Complete NON-EMPTY
|
|
923
|
+
// runs only: an empty line ('' from split('\n'), zero-width-only lines)
|
|
924
|
+
// records zero entries and would commit a degenerate run whose replay
|
|
925
|
+
// writes NaN damage (gaps[0] undefined) and poisons the whole frame diff.
|
|
926
|
+
if (runAlive && run !== undefined && packed !== undefined && run.gaps.length > 0) {
|
|
927
|
+
packed.commit(line, run);
|
|
928
|
+
}
|
|
662
929
|
return offsetX;
|
|
663
930
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-node-to-output.d.ts","sourceRoot":"","sources":["../../../src/ink/render-node-to-output.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAK1C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAqBxC,6CAA6C;AAC7C,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAOD;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAWvE,qFAAqF;AACrF,wBAAgB,eAAe,IAAI,IAAI,CAItC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,UAAU,GAAG,IAAI,CAEjD;AASD,8DAA8D;AAC9D,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,UAAU,GAAG,IAAI,CAEtD;AAUD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAGD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,GAAG,IAAI,CAIzD;AAoFD;;;;;GAKG;AACH,iBAAS,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CASlE;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,wBAAwB,CAC/B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,aAAa,EAAE,EACzB,aAAa,EAAE,MAAM,EAAE,EACvB,aAAa,EAAE,MAAM,EACrB,WAAW,GAAE,OAAe,GAC3B,MAAM,CA0GR;AA+DD;;;;;;;;;GASG;AACH,iBAAS,kBAAkB,CACzB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAM9B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,wBAAwB,CAAC,EAAE,KAAK,CAAA;CACjC,GACA,IAAI,
|
|
1
|
+
{"version":3,"file":"render-node-to-output.d.ts","sourceRoot":"","sources":["../../../src/ink/render-node-to-output.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAK1C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAqBxC,6CAA6C;AAC7C,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAOD;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAWvE,qFAAqF;AACrF,wBAAgB,eAAe,IAAI,IAAI,CAItC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,UAAU,GAAG,IAAI,CAEjD;AASD,8DAA8D;AAC9D,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,UAAU,GAAG,IAAI,CAEtD;AAUD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAGD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,GAAG,IAAI,CAIzD;AAoFD;;;;;GAKG;AACH,iBAAS,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CASlE;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,wBAAwB,CAC/B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,aAAa,EAAE,EACzB,aAAa,EAAE,MAAM,EAAE,EACvB,aAAa,EAAE,MAAM,EACrB,WAAW,GAAE,OAAe,GAC3B,MAAM,CA0GR;AA+DD;;;;;;;;;GASG;AACH,iBAAS,kBAAkB,CACzB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAM9B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,wBAAwB,CAAC,EAAE,KAAK,CAAA;CACjC,GACA,IAAI,CA62BN;AAyOD,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,CAAA;AAE1D,eAAe,kBAAkB,CAAA"}
|
|
@@ -701,7 +701,9 @@ function renderNodeToOutput(node, output, options) {
|
|
|
701
701
|
const pending = node.pendingScrollDelta;
|
|
702
702
|
const cMin = node.scrollClampMin;
|
|
703
703
|
const cMax = node.scrollClampMax;
|
|
704
|
-
|
|
704
|
+
// Single-sided clamps are valid: sticky virtualization sets only the
|
|
705
|
+
// min (scroll-up protection during the sticky->manual transition)
|
|
706
|
+
// and leaves the max open for bottom-follow.
|
|
705
707
|
if (pending !== undefined && pending !== 0) {
|
|
706
708
|
// Drain continues even past the clamp — the render-clamp below
|
|
707
709
|
// holds the VISUAL at the mounted edge regardless. Hard-stopping
|
|
@@ -715,8 +717,8 @@ function renderNodeToOutput(node, output, options) {
|
|
|
715
717
|
// perceived stall at the edge). Past-clamp drain caps at ~4 rows/
|
|
716
718
|
// frame, roughly matching React's slide rate so the gap stays
|
|
717
719
|
// bounded and catch-up is quick once input stops.
|
|
718
|
-
const pastClamp =
|
|
719
|
-
(
|
|
720
|
+
const pastClamp = (pending < 0 && cMin !== undefined && cur < cMin) ||
|
|
721
|
+
(pending > 0 && cMax !== undefined && cur > cMax);
|
|
720
722
|
const eff = pastClamp ? Math.min(4, innerHeight >> 3) : innerHeight;
|
|
721
723
|
cur += isXtermJsHost()
|
|
722
724
|
? drainAdaptive(node, pending, eff)
|
|
@@ -739,9 +741,7 @@ function renderNodeToOutput(node, output, options) {
|
|
|
739
741
|
// the right range. Not scheduling scrollDrainNode here keeps the
|
|
740
742
|
// clamp passive — React's commit → resetAfterCommit → onRender will
|
|
741
743
|
// paint again with fresh bounds.
|
|
742
|
-
const clamped =
|
|
743
|
-
? Math.max(cMin, Math.min(scrollTop, cMax))
|
|
744
|
-
: scrollTop;
|
|
744
|
+
const clamped = Math.max(cMin ?? -Infinity, Math.min(scrollTop, cMax ?? Infinity));
|
|
745
745
|
node.scrollTop = scrollTop;
|
|
746
746
|
// Clamp hitting top/bottom consumes any remainder. Set drainPending
|
|
747
747
|
// only after clamp so a wasted no-op frame isn't scheduled.
|
|
@@ -819,6 +819,14 @@ function renderNodeToOutput(node, output, options) {
|
|
|
819
819
|
const scrollHeight = contentYoga.getComputedHeight();
|
|
820
820
|
const prevHeight = contentCached?.height ?? scrollHeight;
|
|
821
821
|
const heightDelta = scrollHeight - prevHeight;
|
|
822
|
+
// NOTE: scroll-up + streaming growth (delta < 0, heightDelta > 0)
|
|
823
|
+
// deliberately stays OUT of the fast path. Virtualization moves the
|
|
824
|
+
// topPad spacer on the same frame (every mounted row's yogaTop
|
|
825
|
+
// shifts), so the appended-content screen mapping is not derivable
|
|
826
|
+
// from prevHeight - a widened edge region misses rows and leaves
|
|
827
|
+
// blitted stale copies next to the new ones (content duplication).
|
|
828
|
+
// Upstream observed the same class of bug ("content bleeding
|
|
829
|
+
// through during scroll-up + streaming") and chose the full path.
|
|
822
830
|
const safeForFastPath = !hint ||
|
|
823
831
|
heightDelta === 0 ||
|
|
824
832
|
(hint.delta > 0 && heightDelta === hint.delta);
|
|
@@ -339,6 +339,45 @@ export declare function charInCellAt(screen: Screen, x: number, y: number): stri
|
|
|
339
339
|
* @param cell - the cell data to write.
|
|
340
340
|
*/
|
|
341
341
|
export declare function setCellAt(screen: Screen, x: number, y: number, cell: Cell): void;
|
|
342
|
+
/** A recorded run of packed cell writes for one screen line. */
|
|
343
|
+
export interface CellRun {
|
|
344
|
+
/** Char pool the words were interned against. Screens ping-pong
|
|
345
|
+
* (front/back double buffering) but SHARE their pools for a whole
|
|
346
|
+
* session, so pool identity — not screen identity — is the validation
|
|
347
|
+
* token; runs survive the screen swap and die only with the pools
|
|
348
|
+
* (renderer recreation/resize). */
|
|
349
|
+
charPool: CharPool;
|
|
350
|
+
/** The shared stylePool.none — the spacer cells' style word. */
|
|
351
|
+
emptyStyleId: number;
|
|
352
|
+
/** Column gap from the previous written cell; the first entry's gap is
|
|
353
|
+
* 0 (its absolute column is the run's base). */
|
|
354
|
+
gaps: number[];
|
|
355
|
+
charIdxs: number[];
|
|
356
|
+
word1s: number[];
|
|
357
|
+
/** Absolute column of the first written cell (record time). */
|
|
358
|
+
baseX: number;
|
|
359
|
+
/** Absolute column of the last written cell (record time). */
|
|
360
|
+
lastX: number;
|
|
361
|
+
}
|
|
362
|
+
/** Begin recording a run for the given screen. */
|
|
363
|
+
export declare function createCellRun(screen: Screen): CellRun;
|
|
364
|
+
/** Record the cell the slow path is about to write at column x. */
|
|
365
|
+
export declare function recordCellRunEntry(run: CellRun, screen: Screen, x: number, cell: Cell): void;
|
|
366
|
+
/** Record the deterministic SpacerTail that setCellAt writes after a wide
|
|
367
|
+
* char at column x (only when x < screen.width - 1). */
|
|
368
|
+
export declare function recordSpacerRunEntry(run: CellRun, x: number): void;
|
|
369
|
+
/**
|
|
370
|
+
* Replay a recorded run at (x, y): plain two-word stores, with the damage
|
|
371
|
+
* rect extended over the written span. Mirrors setCellAt's guard-fire
|
|
372
|
+
* conditions exactly — a replay is only valid when none of the three
|
|
373
|
+
* state-dependent fixups (wide-overwrite spacer cleanup, spacer-tail
|
|
374
|
+
* orphan cleanup, wide's next-cell orphan cleanup) would trigger; any
|
|
375
|
+
* other width transition is a plain overwrite. Returns false so the
|
|
376
|
+
* caller falls back to the slow path when a guard WOULD fire.
|
|
377
|
+
*/
|
|
378
|
+
export declare function replayCellRun(screen: Screen, x: number, y: number, run: CellRun): boolean;
|
|
379
|
+
/** Column just past the last written cell — the run's content end. */
|
|
380
|
+
export declare function cellRunSpan(run: CellRun): number;
|
|
342
381
|
/**
|
|
343
382
|
* Replace the styleId of a cell in-place without disturbing char, width,
|
|
344
383
|
* or hyperlink. Preserves empty cells as-is (char stays ' '). Tracks damage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../../src/ink/screen.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAGd,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,IAAI,EAEV,MAAM,sBAAsB,CAAA;AAM7B;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,SAAS,CAGf;IACF,OAAO,CAAC,KAAK,CAA8B;IAE3C;;;;OAIG;IACH,MAAM,CAA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G,SAAS,KACpB,OAAO,GAAG,IAAI,CAAA;AAEnB;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,YAAY,GACf,OAAO,CA8CT;AAmQD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,IAAI,CASN"}
|
package/lib/types/ink/screen.js
CHANGED
|
@@ -721,6 +721,123 @@ export function setCellAt(screen, x, y, cell) {
|
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
+
/** Begin recording a run for the given screen. */
|
|
725
|
+
export function createCellRun(screen) {
|
|
726
|
+
return {
|
|
727
|
+
charPool: screen.charPool,
|
|
728
|
+
emptyStyleId: screen.emptyStyleId,
|
|
729
|
+
gaps: [],
|
|
730
|
+
charIdxs: [],
|
|
731
|
+
word1s: [],
|
|
732
|
+
baseX: -1,
|
|
733
|
+
lastX: -1,
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
/** Record the cell the slow path is about to write at column x. */
|
|
737
|
+
export function recordCellRunEntry(run, screen, x, cell) {
|
|
738
|
+
if (run.baseX < 0)
|
|
739
|
+
run.baseX = x;
|
|
740
|
+
run.gaps.push(run.lastX < 0 ? 0 : x - run.lastX);
|
|
741
|
+
run.charIdxs.push(internCharString(screen, cell.char));
|
|
742
|
+
run.word1s.push(packWord1(cell.styleId, internHyperlink(screen, cell.hyperlink), cell.width));
|
|
743
|
+
run.lastX = x;
|
|
744
|
+
}
|
|
745
|
+
/** Record the deterministic SpacerTail that setCellAt writes after a wide
|
|
746
|
+
* char at column x (only when x < screen.width - 1). */
|
|
747
|
+
export function recordSpacerRunEntry(run, x) {
|
|
748
|
+
run.gaps.push(x - run.lastX);
|
|
749
|
+
run.charIdxs.push(SPACER_CHAR_INDEX);
|
|
750
|
+
run.word1s.push(packWord1(run.emptyStyleId, 0, 2 /* CellWidth.SpacerTail */));
|
|
751
|
+
run.lastX = x;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Replay a recorded run at (x, y): plain two-word stores, with the damage
|
|
755
|
+
* rect extended over the written span. Mirrors setCellAt's guard-fire
|
|
756
|
+
* conditions exactly — a replay is only valid when none of the three
|
|
757
|
+
* state-dependent fixups (wide-overwrite spacer cleanup, spacer-tail
|
|
758
|
+
* orphan cleanup, wide's next-cell orphan cleanup) would trigger; any
|
|
759
|
+
* other width transition is a plain overwrite. Returns false so the
|
|
760
|
+
* caller falls back to the slow path when a guard WOULD fire.
|
|
761
|
+
*/
|
|
762
|
+
export function replayCellRun(screen, x, y, run) {
|
|
763
|
+
if (x < 0 || y < 0 || y >= screen.height || x >= screen.width)
|
|
764
|
+
return false;
|
|
765
|
+
// Defensive: an empty run has no cells and no span — its damage math
|
|
766
|
+
// would be NaN. Callers never cache empty runs, but a future one might.
|
|
767
|
+
if (run.gaps.length === 0)
|
|
768
|
+
return false;
|
|
769
|
+
const cells = screen.cells;
|
|
770
|
+
const width = screen.width;
|
|
771
|
+
let ox = x;
|
|
772
|
+
const gaps = run.gaps;
|
|
773
|
+
for (let i = 0; i < gaps.length; i++) {
|
|
774
|
+
ox += gaps[i];
|
|
775
|
+
if (ox >= width)
|
|
776
|
+
return false;
|
|
777
|
+
const ci = ((y * width) + ox) << 1;
|
|
778
|
+
const w1 = run.word1s[i];
|
|
779
|
+
const newW = w1 & WIDTH_MASK;
|
|
780
|
+
const prevW = cells[ci + 1] & WIDTH_MASK;
|
|
781
|
+
if (newW === 0 /* CellWidth.Narrow */) {
|
|
782
|
+
// G1 (prev Wide → narrow overwrite cleans the spacer at x+1) and
|
|
783
|
+
// G2 (prev SpacerTail → clears the orphan wide at x-1) would fire.
|
|
784
|
+
if (prevW !== 0 /* CellWidth.Narrow */)
|
|
785
|
+
return false;
|
|
786
|
+
}
|
|
787
|
+
else if (newW === 1 /* CellWidth.Wide */) {
|
|
788
|
+
// G2: a SpacerTail under a Wide write clears the orphan at x-1.
|
|
789
|
+
if (prevW === 2 /* CellWidth.SpacerTail */)
|
|
790
|
+
return false;
|
|
791
|
+
// G3: the spacer this write puts at x+1 would stomp a Wide cell
|
|
792
|
+
// and needs its orphan cleanup.
|
|
793
|
+
if (ox + 1 < width && (cells[ci + 3] & WIDTH_MASK) === 1 /* CellWidth.Wide */) {
|
|
794
|
+
return false;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
else {
|
|
798
|
+
// SpacerTail: G1 fires when it overwrites a Wide cell; G2's
|
|
799
|
+
// SpacerHead variant (prev SpacerTail under a non-SpacerTail write)
|
|
800
|
+
// can't occur in a recorded run — SpacerHead is never recorded — but
|
|
801
|
+
// keep the guard honest for that day soft-wrap starts recording it.
|
|
802
|
+
if (prevW === 1 /* CellWidth.Wide */ ||
|
|
803
|
+
(newW !== 2 /* CellWidth.SpacerTail */ && prevW === 2 /* CellWidth.SpacerTail */)) {
|
|
804
|
+
return false;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
cells[ci] = run.charIdxs[i];
|
|
808
|
+
cells[ci + 1] = w1;
|
|
809
|
+
}
|
|
810
|
+
// Damage: the full written span, matching what per-cell updates in
|
|
811
|
+
// setCellAt would have accumulated.
|
|
812
|
+
const firstX = x + gaps[0];
|
|
813
|
+
const endX = ox + 1;
|
|
814
|
+
const damage = screen.damage;
|
|
815
|
+
if (damage !== undefined) {
|
|
816
|
+
const right = damage.x + damage.width;
|
|
817
|
+
if (firstX < damage.x) {
|
|
818
|
+
damage.width += damage.x - firstX;
|
|
819
|
+
damage.x = firstX;
|
|
820
|
+
}
|
|
821
|
+
else if (endX > right) {
|
|
822
|
+
damage.width += endX - right;
|
|
823
|
+
}
|
|
824
|
+
if (y < damage.y) {
|
|
825
|
+
damage.height += damage.y - y;
|
|
826
|
+
damage.y = y;
|
|
827
|
+
}
|
|
828
|
+
else if (y >= damage.y + damage.height) {
|
|
829
|
+
damage.height = y - damage.y + 1;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
screen.damage = { x: firstX, y, width: endX - firstX, height: 1 };
|
|
834
|
+
}
|
|
835
|
+
return true;
|
|
836
|
+
}
|
|
837
|
+
/** Column just past the last written cell — the run's content end. */
|
|
838
|
+
export function cellRunSpan(run) {
|
|
839
|
+
return run.lastX - run.baseX + 1;
|
|
840
|
+
}
|
|
724
841
|
/**
|
|
725
842
|
* Replace the styleId of a cell in-place without disturbing char, width,
|
|
726
843
|
* or hyperlink. Preserves empty cells as-is (char stays ' '). Tracks damage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../../src/ink/terminal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAKtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../../src/ink/terminal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAKtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAYtC;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,eAAe,CAAA;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,IAAI,OAAO,CAuCtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAwDvD;AAcD;;;;GAIG;AACH,wBAAgB,gBAAg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