gsd-pi 2.34.0 → 2.35.0-dev.cd3b7ea
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/dist/resources/extensions/gsd/changelog.js +162 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +1 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +5 -1
- package/dist/resources/extensions/gsd/commands.js +8 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/dist/resources/extensions/gsd/doctor-checks.js +113 -5
- package/dist/resources/extensions/gsd/doctor-proactive.js +22 -0
- package/dist/resources/extensions/gsd/doctor.js +36 -0
- package/dist/resources/extensions/gsd/guided-flow.js +4 -2
- package/dist/resources/extensions/gsd/preferences-validation.js +38 -0
- package/dist/resources/extensions/gsd/preferences.js +2 -0
- package/dist/resources/extensions/mcp-client/index.js +2 -1
- package/dist/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
- package/package.json +1 -1
- package/packages/native/dist/native.d.ts +0 -2
- package/packages/native/dist/native.js +0 -2
- package/packages/native/src/native.ts +0 -3
- package/packages/pi-agent-core/dist/agent-loop.d.ts +14 -0
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +24 -27
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +1 -0
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +11 -22
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/dist/proxy.d.ts +1 -25
- package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/proxy.js +3 -9
- package/packages/pi-agent-core/dist/proxy.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.ts +30 -27
- package/packages/pi-agent-core/src/agent.ts +12 -23
- package/packages/pi-agent-core/src/proxy.ts +3 -9
- package/packages/pi-ai/dist/api-registry.d.ts +0 -2
- package/packages/pi-ai/dist/api-registry.d.ts.map +1 -1
- package/packages/pi-ai/dist/api-registry.js +0 -10
- package/packages/pi-ai/dist/api-registry.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts +0 -8
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.js +5 -41
- package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts +0 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts +1 -43
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +2 -2
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.d.ts +0 -4
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +10 -73
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.js +8 -79
- package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-shared.d.ts +65 -0
- package/packages/pi-ai/dist/providers/openai-shared.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-shared.js +146 -0
- package/packages/pi-ai/dist/providers/openai-shared.js.map +1 -0
- package/packages/pi-ai/dist/providers/register-builtins.d.ts +0 -1
- package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.d.ts +0 -2
- package/packages/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.js +0 -4
- package/packages/pi-ai/dist/utils/event-stream.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +7 -135
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +7 -135
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts +46 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js +160 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js.map +1 -0
- package/packages/pi-ai/dist/utils/overflow.d.ts +0 -4
- package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.js +0 -6
- package/packages/pi-ai/dist/utils/overflow.js.map +1 -1
- package/packages/pi-ai/dist/utils/validation.d.ts +0 -8
- package/packages/pi-ai/dist/utils/validation.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/validation.js +0 -14
- package/packages/pi-ai/dist/utils/validation.js.map +1 -1
- package/packages/pi-ai/src/api-registry.ts +0 -12
- package/packages/pi-ai/src/providers/anthropic.ts +1 -1
- package/packages/pi-ai/src/providers/azure-openai-responses.ts +11 -45
- package/packages/pi-ai/src/providers/github-copilot-headers.ts +1 -1
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +2 -2
- package/packages/pi-ai/src/providers/google-shared.ts +1 -1
- package/packages/pi-ai/src/providers/openai-completions.ts +16 -86
- package/packages/pi-ai/src/providers/openai-responses.ts +15 -95
- package/packages/pi-ai/src/providers/openai-shared.ts +193 -0
- package/packages/pi-ai/src/providers/register-builtins.ts +1 -1
- package/packages/pi-ai/src/utils/event-stream.ts +0 -5
- package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +14 -162
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +13 -161
- package/packages/pi-ai/src/utils/oauth/google-oauth-utils.ts +201 -0
- package/packages/pi-ai/src/utils/overflow.ts +1 -8
- package/packages/pi-ai/src/utils/validation.ts +0 -15
- package/packages/pi-coding-agent/dist/config.d.ts +0 -9
- package/packages/pi-coding-agent/dist/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/config.js +4 -8
- package/packages/pi-coding-agent/dist/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +16 -63
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +104 -641
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +4 -35
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js +5 -43
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +11 -69
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts +40 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.js +78 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts +77 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js +331 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +2 -2
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +15 -5
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +129 -256
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +49 -42
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js +2 -21
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.js +2 -2
- package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lock-utils.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.js +89 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -62
- package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.js +2 -6
- package/packages/pi-coding-agent/dist/core/lsp/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/index.js +52 -107
- package/packages/pi-coding-agent/dist/core/lsp/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js +3 -22
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.js +0 -28
- package/packages/pi-coding-agent/dist/core/lsp/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts +1 -6
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.js +1 -28
- package/packages/pi-coding-agent/dist/core/lsp/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.js +5 -5
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +0 -3
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +1 -3
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts +1 -26
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -59
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.js +2 -4
- package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.js +2 -2
- package/packages/pi-coding-agent/dist/core/prompt-templates.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +2 -4
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js +33 -58
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +87 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.js +295 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +5 -32
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +8 -12
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +78 -168
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.js +1 -3
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.d.ts +0 -16
- package/packages/pi-coding-agent/dist/migrations.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.js +2 -2
- package/packages/pi-coding-agent/dist/migrations.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +0 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js +9 -26
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -13
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts +44 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js +61 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +6 -9
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -24
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +50 -512
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +514 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +6 -23
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +175 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts +6 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js +15 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/print-mode.js +2 -30
- package/packages/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js +2 -28
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts +19 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js +45 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts +0 -4
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/error.d.ts +5 -0
- package/packages/pi-coding-agent/dist/utils/error.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/error.js +7 -0
- package/packages/pi-coding-agent/dist/utils/error.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/photon.d.ts +0 -19
- package/packages/pi-coding-agent/dist/utils/photon.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/photon.js +1 -120
- package/packages/pi-coding-agent/dist/utils/photon.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/config.ts +5 -10
- package/packages/pi-coding-agent/src/core/agent-session.ts +117 -745
- package/packages/pi-coding-agent/src/core/auth-storage.ts +4 -38
- package/packages/pi-coding-agent/src/core/compaction/branch-summarization.ts +7 -53
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +14 -74
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +100 -0
- package/packages/pi-coding-agent/src/core/compaction-orchestrator.ts +424 -0
- package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +1 -1
- package/packages/pi-coding-agent/src/core/extensions/index.ts +1 -21
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +119 -256
- package/packages/pi-coding-agent/src/core/extensions/types.ts +50 -69
- package/packages/pi-coding-agent/src/core/keybindings.ts +2 -2
- package/packages/pi-coding-agent/src/core/lock-utils.ts +113 -0
- package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -73
- package/packages/pi-coding-agent/src/core/lsp/config.ts +2 -10
- package/packages/pi-coding-agent/src/core/lsp/edits.ts +1 -1
- package/packages/pi-coding-agent/src/core/lsp/index.ts +83 -152
- package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +3 -23
- package/packages/pi-coding-agent/src/core/lsp/types.ts +0 -29
- package/packages/pi-coding-agent/src/core/lsp/utils.ts +1 -33
- package/packages/pi-coding-agent/src/core/messages.ts +5 -5
- package/packages/pi-coding-agent/src/core/model-registry.ts +0 -2
- package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -77
- package/packages/pi-coding-agent/src/core/package-manager.ts +1 -4
- package/packages/pi-coding-agent/src/core/prompt-templates.ts +2 -2
- package/packages/pi-coding-agent/src/core/resource-loader.ts +43 -67
- package/packages/pi-coding-agent/src/core/retry-handler.ts +359 -0
- package/packages/pi-coding-agent/src/core/session-manager.ts +5 -34
- package/packages/pi-coding-agent/src/core/settings-manager.ts +87 -166
- package/packages/pi-coding-agent/src/core/skills.ts +1 -4
- package/packages/pi-coding-agent/src/index.ts +1 -7
- package/packages/pi-coding-agent/src/migrations.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector.ts +17 -29
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +1 -13
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-render-utils.ts +81 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-selector.ts +14 -19
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +50 -561
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +653 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +7 -26
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +196 -0
- package/packages/pi-coding-agent/src/modes/interactive/utils/shorten-path.ts +14 -0
- package/packages/pi-coding-agent/src/modes/print-mode.ts +2 -30
- package/packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts +2 -28
- package/packages/pi-coding-agent/src/modes/shared/command-context-actions.ts +53 -0
- package/packages/pi-coding-agent/src/utils/changelog.ts +1 -1
- package/packages/pi-coding-agent/src/utils/clipboard-image.ts +1 -1
- package/packages/pi-coding-agent/src/utils/error.ts +6 -0
- package/packages/pi-coding-agent/src/utils/photon.ts +0 -137
- package/packages/pi-coding-agent/src/utils/tools-manager.ts +1 -1
- package/packages/pi-tui/dist/components/editor.d.ts +0 -10
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +1 -1
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/dist/components/markdown.d.ts +5 -0
- package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/markdown.js +25 -31
- package/packages/pi-tui/dist/components/markdown.js.map +1 -1
- package/packages/pi-tui/dist/keys.d.ts +0 -4
- package/packages/pi-tui/dist/keys.d.ts.map +1 -1
- package/packages/pi-tui/dist/keys.js +94 -162
- package/packages/pi-tui/dist/keys.js.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.d.ts +55 -0
- package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -0
- package/packages/pi-tui/dist/overlay-layout.js +288 -0
- package/packages/pi-tui/dist/overlay-layout.js.map +1 -0
- package/packages/pi-tui/dist/tui.d.ts +0 -22
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +6 -272
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/dist/utils.d.ts +0 -7
- package/packages/pi-tui/dist/utils.d.ts.map +1 -1
- package/packages/pi-tui/dist/utils.js +0 -44
- package/packages/pi-tui/dist/utils.js.map +1 -1
- package/packages/pi-tui/src/components/editor.ts +1 -1
- package/packages/pi-tui/src/components/markdown.ts +25 -29
- package/packages/pi-tui/src/keys.ts +94 -173
- package/packages/pi-tui/src/overlay-layout.ts +372 -0
- package/packages/pi-tui/src/tui.ts +11 -312
- package/packages/pi-tui/src/utils.ts +0 -43
- package/pkg/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/pkg/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +6 -23
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/themes.js +175 -0
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/gsd/changelog.ts +213 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +1 -0
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +5 -1
- package/src/resources/extensions/gsd/commands.ts +9 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/src/resources/extensions/gsd/doctor-checks.ts +107 -5
- package/src/resources/extensions/gsd/doctor-proactive.ts +24 -0
- package/src/resources/extensions/gsd/doctor-types.ts +9 -1
- package/src/resources/extensions/gsd/doctor.ts +35 -0
- package/src/resources/extensions/gsd/guided-flow.ts +4 -2
- package/src/resources/extensions/gsd/preferences-validation.ts +38 -0
- package/src/resources/extensions/gsd/preferences.ts +2 -0
- package/src/resources/extensions/gsd/tests/doctor-git.test.ts +98 -2
- package/src/resources/extensions/gsd/tests/doctor-runtime.test.ts +59 -3
- package/src/resources/extensions/gsd/tests/preferences.test.ts +28 -0
- package/src/resources/extensions/mcp-client/index.ts +2 -1
- package/src/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
- package/packages/pi-coding-agent/dist/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/dist/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/packages/pi-coding-agent/src/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/src/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.json +0 -335
- package/pkg/dist/modes/interactive/theme/dark.json +0 -85
- package/pkg/dist/modes/interactive/theme/light.json +0 -84
- package/pkg/dist/modes/interactive/theme/theme-schema.json +0 -335
|
@@ -10,13 +10,6 @@ export declare function isWhitespaceChar(char: string): boolean;
|
|
|
10
10
|
* Check if a character is punctuation.
|
|
11
11
|
*/
|
|
12
12
|
export declare function isPunctuationChar(char: string): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Extract ANSI escape sequences from a string at the given position.
|
|
15
|
-
*/
|
|
16
|
-
export declare function extractAnsiCode(str: string, pos: number): {
|
|
17
|
-
code: string;
|
|
18
|
-
length: number;
|
|
19
|
-
} | null;
|
|
20
13
|
/**
|
|
21
14
|
* Calculate the visible width of a string in terminal columns.
|
|
22
15
|
* Delegates to the native Rust implementation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAAC,SAAS,CAE7C;AAID;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAAC,SAAS,CAE7C;AAID;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAMD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAA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
|
|
24
|
-
* Extract ANSI escape sequences from a string at the given position.
|
|
25
|
-
*/
|
|
26
|
-
export function extractAnsiCode(str, pos) {
|
|
27
|
-
if (pos >= str.length || str[pos] !== "\x1b")
|
|
28
|
-
return null;
|
|
29
|
-
const next = str[pos + 1];
|
|
30
|
-
// CSI sequence: ESC [ ... m/G/K/H/J
|
|
31
|
-
if (next === "[") {
|
|
32
|
-
let j = pos + 2;
|
|
33
|
-
while (j < str.length && !/[mGKHJ]/.test(str[j]))
|
|
34
|
-
j++;
|
|
35
|
-
if (j < str.length)
|
|
36
|
-
return { code: str.substring(pos, j + 1), length: j + 1 - pos };
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
// OSC sequence: ESC ] ... BEL or ESC ] ... ST (ESC \)
|
|
40
|
-
// Used for hyperlinks (OSC 8), window titles, etc.
|
|
41
|
-
if (next === "]") {
|
|
42
|
-
let j = pos + 2;
|
|
43
|
-
while (j < str.length) {
|
|
44
|
-
if (str[j] === "\x07")
|
|
45
|
-
return { code: str.substring(pos, j + 1), length: j + 1 - pos };
|
|
46
|
-
if (str[j] === "\x1b" && str[j + 1] === "\\")
|
|
47
|
-
return { code: str.substring(pos, j + 2), length: j + 2 - pos };
|
|
48
|
-
j++;
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
// APC sequence: ESC _ ... BEL or ESC _ ... ST (ESC \)
|
|
53
|
-
// Used for cursor marker and application-specific commands
|
|
54
|
-
if (next === "_") {
|
|
55
|
-
let j = pos + 2;
|
|
56
|
-
while (j < str.length) {
|
|
57
|
-
if (str[j] === "\x07")
|
|
58
|
-
return { code: str.substring(pos, j + 1), length: j + 1 - pos };
|
|
59
|
-
if (str[j] === "\x1b" && str[j + 1] === "\\")
|
|
60
|
-
return { code: str.substring(pos, j + 2), length: j + 2 - pos };
|
|
61
|
-
j++;
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
23
|
// ---------------------------------------------------------------------------
|
|
68
24
|
// Native text module wrappers
|
|
69
25
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,IAAI,kBAAkB,EAClC,gBAAgB,IAAI,sBAAsB,EAC1C,eAAe,IAAI,qBAAqB,EACxC,cAAc,IAAI,oBAAoB,EACtC,eAAe,IAAI,qBAAqB,EACxC,YAAY,GACZ,MAAM,kBAAkB,CAAC;AAE1B,uCAAuC;AACvC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,UAAU,YAAY;IAC3B,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,iBAAiB,GAAG,sCAAsC,CAAC;AAEjE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC7C,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,GAAW;IACvD,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAE1D,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAE1B,oCAAoC;IACpC,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,IA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ToWidth as nativeTruncateToWidth,\n\tsliceWithWidth as nativeSliceWithWidth,\n\textractSegments as nativeExtractSegments,\n\tEllipsisKind,\n} from \"@gsd/native/text\";\n\n// Grapheme segmenter (shared instance)\nconst segmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\n\n/**\n * Get the shared grapheme segmenter instance.\n */\nexport function getSegmenter(): Intl.Segmenter {\n\treturn segmenter;\n}\n\nconst PUNCTUATION_REGEX = /[(){}[\\]<>.,;:'\"!?+\\-=*/\\\\|&%^$#@~`]/;\n\n/**\n * Check if a character is whitespace.\n */\nexport function isWhitespaceChar(char: string): boolean {\n\treturn /\\s/.test(char);\n}\n\n/**\n * Check if a character is punctuation.\n */\nexport function isPunctuationChar(char: string): boolean {\n\treturn PUNCTUATION_REGEX.test(char);\n}\n\n/**\n * Extract ANSI escape sequences from a string at the given position.\n */\nexport function extractAnsiCode(str: string, pos: number): { code: string; length: number } | null {\n\tif (pos >= str.length || str[pos] !== \"\\x1b\") return null;\n\n\tconst next = str[pos + 1];\n\n\t// CSI sequence: ESC [ ... m/G/K/H/J\n\tif (next === \"[\") {\n\t\tlet j = pos + 2;\n\t\twhile (j < str.length && !/[mGKHJ]/.test(str[j]!)) j++;\n\t\tif (j < str.length) return { code: str.substring(pos, j + 1), length: j + 1 - pos };\n\t\treturn null;\n\t}\n\n\t// OSC sequence: ESC ] ... BEL or ESC ] ... ST (ESC \\)\n\t// Used for hyperlinks (OSC 8), window titles, etc.\n\tif (next === \"]\") {\n\t\tlet j = pos + 2;\n\t\twhile (j < str.length) {\n\t\t\tif (str[j] === \"\\x07\") return { code: str.substring(pos, j + 1), length: j + 1 - pos };\n\t\t\tif (str[j] === \"\\x1b\" && str[j + 1] === \"\\\\\") return { code: str.substring(pos, j + 2), length: j + 2 - pos };\n\t\t\tj++;\n\t\t}\n\t\treturn null;\n\t}\n\n\t// APC sequence: ESC _ ... BEL or ESC _ ... ST (ESC \\)\n\t// Used for cursor marker and application-specific commands\n\tif (next === \"_\") {\n\t\tlet j = pos + 2;\n\t\twhile (j < str.length) {\n\t\t\tif (str[j] === \"\\x07\") return { code: str.substring(pos, j + 1), length: j + 1 - pos };\n\t\t\tif (str[j] === \"\\x1b\" && str[j + 1] === \"\\\\\") return { code: str.substring(pos, j + 2), length: j + 2 - pos };\n\t\t\tj++;\n\t\t}\n\t\treturn null;\n\t}\n\n\treturn null;\n}\n\n// ---------------------------------------------------------------------------\n// Native text module wrappers\n// ---------------------------------------------------------------------------\n\n/**\n * Calculate the visible width of a string in terminal columns.\n * Delegates to the native Rust implementation.\n */\nexport function visibleWidth(str: string): number {\n\treturn nativeVisibleWidth(str);\n}\n\n/**\n * Wrap text with ANSI codes preserved.\n * Delegates to the native Rust implementation.\n *\n * @param text - Text to wrap (may contain ANSI codes and newlines)\n * @param width - Maximum visible width per line\n * @returns Array of wrapped lines (NOT padded to width)\n */\nexport function wrapTextWithAnsi(text: string, width: number): string[] {\n\treturn nativeWrapTextWithAnsi(text, width);\n}\n\n/**\n * Map an ellipsis string to the native EllipsisKind enum value.\n */\nfunction ellipsisStringToKind(ellipsis: string): number {\n\tif (ellipsis === \"\\u2026\") return EllipsisKind.Unicode;\n\tif (ellipsis === \"...\" || ellipsis === undefined) return EllipsisKind.Ascii;\n\tif (ellipsis === \"\") return EllipsisKind.None;\n\t// Default: \"...\" maps to Ascii\n\treturn EllipsisKind.Ascii;\n}\n\n/**\n * Truncate text to fit within a maximum visible width, adding ellipsis if needed.\n * Optionally pad with spaces to reach exactly maxWidth.\n * Delegates to the native Rust implementation.\n *\n * @param text - Text to truncate (may contain ANSI codes)\n * @param maxWidth - Maximum visible width\n * @param ellipsis - Ellipsis string to append when truncating (default: \"...\")\n * @param pad - If true, pad result with spaces to exactly maxWidth (default: false)\n * @returns Truncated text, optionally padded to exactly maxWidth\n */\nexport function truncateToWidth(\n\ttext: string,\n\tmaxWidth: number,\n\tellipsis: string = \"...\",\n\tpad: boolean = false,\n): string {\n\treturn nativeTruncateToWidth(text, maxWidth, ellipsisStringToKind(ellipsis), pad);\n}\n\n/**\n * Extract a range of visible columns from a line. Handles ANSI codes and wide chars.\n * @param strict - If true, exclude wide chars at boundary that would extend past the range\n */\nexport function sliceByColumn(line: string, startCol: number, length: number, strict = false): string {\n\treturn sliceWithWidth(line, startCol, length, strict).text;\n}\n\n/** Like sliceByColumn but also returns the actual visible width of the result. */\nexport function sliceWithWidth(\n\tline: string,\n\tstartCol: number,\n\tlength: number,\n\tstrict = false,\n): { text: string; width: number } {\n\treturn nativeSliceWithWidth(line, startCol, length, strict);\n}\n\n/**\n * Extract \"before\" and \"after\" segments from a line in a single pass.\n * Delegates to the native Rust implementation.\n */\nexport function extractSegments(\n\tline: string,\n\tbeforeEnd: number,\n\tafterStart: number,\n\tafterLen: number,\n\tstrictAfter = false,\n): { before: string; beforeWidth: number; after: string; afterWidth: number } {\n\treturn nativeExtractSegments(line, beforeEnd, afterStart, afterLen, strictAfter);\n}\n\n/**\n * Apply background color to a line, padding to full width.\n *\n * @param line - Line of text (may contain ANSI codes)\n * @param width - Total width to pad to\n * @param bgFn - Background color function\n * @returns Line with background applied and padded to width\n */\nexport function applyBackgroundToLine(line: string, width: number, bgFn: (text: string) => string): string {\n\tconst visibleLen = visibleWidth(line);\n\tconst paddingNeeded = Math.max(0, width - visibleLen);\n\tconst padding = \" \".repeat(paddingNeeded);\n\n\tconst withPadding = line + padding;\n\treturn bgFn(withPadding);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,IAAI,kBAAkB,EAClC,gBAAgB,IAAI,sBAAsB,EAC1C,eAAe,IAAI,qBAAqB,EACxC,cAAc,IAAI,oBAAoB,EACtC,eAAe,IAAI,qBAAqB,EACxC,YAAY,GACZ,MAAM,kBAAkB,CAAC;AAE1B,uCAAuC;AACvC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE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C;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,QAAgB,EAAE,MAAc,EAAE,MAAM,GAAG,KAAK;IAC3F,OAAO,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,cAAc,CAC7B,IAAY,EACZ,QAAgB,EAChB,MAAc,EACd,MAAM,GAAG,KAAK;IAEd,OAAO,oBAAoB,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAY,EACZ,SAAiB,EACjB,UAAkB,EAClB,QAAgB,EAChB,WAAW,GAAG,KAAK;IAEnB,OAAO,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAClF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,KAAa,EAAE,IAA8B;IAChG,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAE1C,MAAM,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC;IACnC,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import {\n\tvisibleWidth as nativeVisibleWidth,\n\twrapTextWithAnsi as nativeWrapTextWithAnsi,\n\ttruncateToWidth as nativeTruncateToWidth,\n\tsliceWithWidth as nativeSliceWithWidth,\n\textractSegments as nativeExtractSegments,\n\tEllipsisKind,\n} from \"@gsd/native/text\";\n\n// Grapheme segmenter (shared instance)\nconst segmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\n\n/**\n * Get the shared grapheme segmenter instance.\n */\nexport function getSegmenter(): Intl.Segmenter {\n\treturn segmenter;\n}\n\nconst PUNCTUATION_REGEX = /[(){}[\\]<>.,;:'\"!?+\\-=*/\\\\|&%^$#@~`]/;\n\n/**\n * Check if a character is whitespace.\n */\nexport function isWhitespaceChar(char: string): boolean {\n\treturn /\\s/.test(char);\n}\n\n/**\n * Check if a character is punctuation.\n */\nexport function isPunctuationChar(char: string): boolean {\n\treturn PUNCTUATION_REGEX.test(char);\n}\n\n// ---------------------------------------------------------------------------\n// Native text module wrappers\n// ---------------------------------------------------------------------------\n\n/**\n * Calculate the visible width of a string in terminal columns.\n * Delegates to the native Rust implementation.\n */\nexport function visibleWidth(str: string): number {\n\treturn nativeVisibleWidth(str);\n}\n\n/**\n * Wrap text with ANSI codes preserved.\n * Delegates to the native Rust implementation.\n *\n * @param text - Text to wrap (may contain ANSI codes and newlines)\n * @param width - Maximum visible width per line\n * @returns Array of wrapped lines (NOT padded to width)\n */\nexport function wrapTextWithAnsi(text: string, width: number): string[] {\n\treturn nativeWrapTextWithAnsi(text, width);\n}\n\n/**\n * Map an ellipsis string to the native EllipsisKind enum value.\n */\nfunction ellipsisStringToKind(ellipsis: string): number {\n\tif (ellipsis === \"\\u2026\") return EllipsisKind.Unicode;\n\tif (ellipsis === \"...\" || ellipsis === undefined) return EllipsisKind.Ascii;\n\tif (ellipsis === \"\") return EllipsisKind.None;\n\t// Default: \"...\" maps to Ascii\n\treturn EllipsisKind.Ascii;\n}\n\n/**\n * Truncate text to fit within a maximum visible width, adding ellipsis if needed.\n * Optionally pad with spaces to reach exactly maxWidth.\n * Delegates to the native Rust implementation.\n *\n * @param text - Text to truncate (may contain ANSI codes)\n * @param maxWidth - Maximum visible width\n * @param ellipsis - Ellipsis string to append when truncating (default: \"...\")\n * @param pad - If true, pad result with spaces to exactly maxWidth (default: false)\n * @returns Truncated text, optionally padded to exactly maxWidth\n */\nexport function truncateToWidth(\n\ttext: string,\n\tmaxWidth: number,\n\tellipsis: string = \"...\",\n\tpad: boolean = false,\n): string {\n\treturn nativeTruncateToWidth(text, maxWidth, ellipsisStringToKind(ellipsis), pad);\n}\n\n/**\n * Extract a range of visible columns from a line. Handles ANSI codes and wide chars.\n * @param strict - If true, exclude wide chars at boundary that would extend past the range\n */\nexport function sliceByColumn(line: string, startCol: number, length: number, strict = false): string {\n\treturn sliceWithWidth(line, startCol, length, strict).text;\n}\n\n/** Like sliceByColumn but also returns the actual visible width of the result. */\nexport function sliceWithWidth(\n\tline: string,\n\tstartCol: number,\n\tlength: number,\n\tstrict = false,\n): { text: string; width: number } {\n\treturn nativeSliceWithWidth(line, startCol, length, strict);\n}\n\n/**\n * Extract \"before\" and \"after\" segments from a line in a single pass.\n * Delegates to the native Rust implementation.\n */\nexport function extractSegments(\n\tline: string,\n\tbeforeEnd: number,\n\tafterStart: number,\n\tafterLen: number,\n\tstrictAfter = false,\n): { before: string; beforeWidth: number; after: string; afterWidth: number } {\n\treturn nativeExtractSegments(line, beforeEnd, afterStart, afterLen, strictAfter);\n}\n\n/**\n * Apply background color to a line, padding to full width.\n *\n * @param line - Line of text (may contain ANSI codes)\n * @param width - Total width to pad to\n * @param bgFn - Background color function\n * @returns Line with background applied and padded to width\n */\nexport function applyBackgroundToLine(line: string, width: number, bgFn: (text: string) => string): string {\n\tconst visibleLen = visibleWidth(line);\n\tconst paddingNeeded = Math.max(0, width - visibleLen);\n\tconst padding = \" \".repeat(paddingNeeded);\n\n\tconst withPadding = line + padding;\n\treturn bgFn(withPadding);\n}\n"]}
|
|
@@ -28,7 +28,7 @@ export interface TextChunk {
|
|
|
28
28
|
* @param maxWidth - Maximum visible width per chunk
|
|
29
29
|
* @returns Array of chunks with text and position information
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
function wordWrapLine(line: string, maxWidth: number): TextChunk[] {
|
|
32
32
|
if (!line || maxWidth <= 0) {
|
|
33
33
|
return [{ text: "", startIndex: 0, endIndex: 0 }];
|
|
34
34
|
}
|
|
@@ -308,21 +308,7 @@ export class Markdown implements Component {
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
case "code": {
|
|
311
|
-
|
|
312
|
-
lines.push(this.theme.codeBlockBorder(`\`\`\`${token.lang || ""}`));
|
|
313
|
-
if (this.theme.highlightCode) {
|
|
314
|
-
const highlightedLines = this.theme.highlightCode(token.text, token.lang);
|
|
315
|
-
for (const hlLine of highlightedLines) {
|
|
316
|
-
lines.push(`${indent}${hlLine}`);
|
|
317
|
-
}
|
|
318
|
-
} else {
|
|
319
|
-
// Split code by newlines and style each line
|
|
320
|
-
const codeLines = token.text.split("\n");
|
|
321
|
-
for (const codeLine of codeLines) {
|
|
322
|
-
lines.push(`${indent}${this.theme.codeBlock(codeLine)}`);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
lines.push(this.theme.codeBlockBorder("```"));
|
|
311
|
+
lines.push(...this.renderCodeBlock(token.text, token.lang));
|
|
326
312
|
if (nextTokenType !== "space") {
|
|
327
313
|
lines.push(""); // Add spacing after code blocks (unless space token follows)
|
|
328
314
|
}
|
|
@@ -589,20 +575,7 @@ export class Markdown implements Component {
|
|
|
589
575
|
lines.push(text);
|
|
590
576
|
} else if (token.type === "code") {
|
|
591
577
|
// Code block in list item
|
|
592
|
-
|
|
593
|
-
lines.push(this.theme.codeBlockBorder(`\`\`\`${token.lang || ""}`));
|
|
594
|
-
if (this.theme.highlightCode) {
|
|
595
|
-
const highlightedLines = this.theme.highlightCode(token.text, token.lang);
|
|
596
|
-
for (const hlLine of highlightedLines) {
|
|
597
|
-
lines.push(`${indent}${hlLine}`);
|
|
598
|
-
}
|
|
599
|
-
} else {
|
|
600
|
-
const codeLines = token.text.split("\n");
|
|
601
|
-
for (const codeLine of codeLines) {
|
|
602
|
-
lines.push(`${indent}${this.theme.codeBlock(codeLine)}`);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
lines.push(this.theme.codeBlockBorder("```"));
|
|
578
|
+
lines.push(...this.renderCodeBlock(token.text, token.lang));
|
|
606
579
|
} else {
|
|
607
580
|
// Other token types - try to render as inline
|
|
608
581
|
const text = this.renderInlineTokens([token], styleContext);
|
|
@@ -615,6 +588,29 @@ export class Markdown implements Component {
|
|
|
615
588
|
return lines;
|
|
616
589
|
}
|
|
617
590
|
|
|
591
|
+
/**
|
|
592
|
+
* Render a fenced code block with syntax highlighting support.
|
|
593
|
+
* Used by both renderToken (top-level code blocks) and renderListItem (code blocks inside lists).
|
|
594
|
+
*/
|
|
595
|
+
private renderCodeBlock(code: string, lang?: string): string[] {
|
|
596
|
+
const lines: string[] = [];
|
|
597
|
+
const indent = this.theme.codeBlockIndent ?? " ";
|
|
598
|
+
lines.push(this.theme.codeBlockBorder(`\`\`\`${lang || ""}`));
|
|
599
|
+
if (this.theme.highlightCode) {
|
|
600
|
+
const highlightedLines = this.theme.highlightCode(code, lang);
|
|
601
|
+
for (const hlLine of highlightedLines) {
|
|
602
|
+
lines.push(`${indent}${hlLine}`);
|
|
603
|
+
}
|
|
604
|
+
} else {
|
|
605
|
+
const codeLines = code.split("\n");
|
|
606
|
+
for (const codeLine of codeLines) {
|
|
607
|
+
lines.push(`${indent}${this.theme.codeBlock(codeLine)}`);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
lines.push(this.theme.codeBlockBorder("```"));
|
|
611
|
+
return lines;
|
|
612
|
+
}
|
|
613
|
+
|
|
618
614
|
/**
|
|
619
615
|
* Get the visible width of the longest word in a string.
|
|
620
616
|
*/
|
|
@@ -325,131 +325,74 @@ const FUNCTIONAL_CODEPOINTS = {
|
|
|
325
325
|
end: -15,
|
|
326
326
|
} as const;
|
|
327
327
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
left: ["\x1b[d"],
|
|
359
|
-
clear: ["\x1b[e"],
|
|
360
|
-
insert: ["\x1b[2$"],
|
|
361
|
-
delete: ["\x1b[3$"],
|
|
362
|
-
pageUp: ["\x1b[5$"],
|
|
363
|
-
pageDown: ["\x1b[6$"],
|
|
364
|
-
home: ["\x1b[7$"],
|
|
365
|
-
end: ["\x1b[8$"],
|
|
366
|
-
} as const;
|
|
367
|
-
|
|
368
|
-
const LEGACY_CTRL_SEQUENCES = {
|
|
369
|
-
up: ["\x1bOa"],
|
|
370
|
-
down: ["\x1bOb"],
|
|
371
|
-
right: ["\x1bOc"],
|
|
372
|
-
left: ["\x1bOd"],
|
|
373
|
-
clear: ["\x1bOe"],
|
|
374
|
-
insert: ["\x1b[2^"],
|
|
375
|
-
delete: ["\x1b[3^"],
|
|
376
|
-
pageUp: ["\x1b[5^"],
|
|
377
|
-
pageDown: ["\x1b[6^"],
|
|
378
|
-
home: ["\x1b[7^"],
|
|
379
|
-
end: ["\x1b[8^"],
|
|
380
|
-
} as const;
|
|
381
|
-
|
|
382
|
-
const LEGACY_SEQUENCE_KEY_IDS: Record<string, KeyId> = {
|
|
383
|
-
"\x1bOA": "up",
|
|
384
|
-
"\x1bOB": "down",
|
|
385
|
-
"\x1bOC": "right",
|
|
386
|
-
"\x1bOD": "left",
|
|
387
|
-
"\x1bOH": "home",
|
|
388
|
-
"\x1bOF": "end",
|
|
389
|
-
"\x1b[E": "clear",
|
|
390
|
-
"\x1bOE": "clear",
|
|
391
|
-
"\x1bOe": "ctrl+clear",
|
|
392
|
-
"\x1b[e": "shift+clear",
|
|
393
|
-
"\x1b[2~": "insert",
|
|
394
|
-
"\x1b[2$": "shift+insert",
|
|
395
|
-
"\x1b[2^": "ctrl+insert",
|
|
396
|
-
"\x1b[3$": "shift+delete",
|
|
397
|
-
"\x1b[3^": "ctrl+delete",
|
|
398
|
-
"\x1b[[5~": "pageUp",
|
|
399
|
-
"\x1b[[6~": "pageDown",
|
|
400
|
-
"\x1b[a": "shift+up",
|
|
401
|
-
"\x1b[b": "shift+down",
|
|
402
|
-
"\x1b[c": "shift+right",
|
|
403
|
-
"\x1b[d": "shift+left",
|
|
404
|
-
"\x1bOa": "ctrl+up",
|
|
405
|
-
"\x1bOb": "ctrl+down",
|
|
406
|
-
"\x1bOc": "ctrl+right",
|
|
407
|
-
"\x1bOd": "ctrl+left",
|
|
408
|
-
"\x1b[5$": "shift+pageUp",
|
|
409
|
-
"\x1b[6$": "shift+pageDown",
|
|
410
|
-
"\x1b[7$": "shift+home",
|
|
411
|
-
"\x1b[8$": "shift+end",
|
|
412
|
-
"\x1b[5^": "ctrl+pageUp",
|
|
413
|
-
"\x1b[6^": "ctrl+pageDown",
|
|
414
|
-
"\x1b[7^": "ctrl+home",
|
|
415
|
-
"\x1b[8^": "ctrl+end",
|
|
416
|
-
"\x1bOP": "f1",
|
|
417
|
-
"\x1bOQ": "f2",
|
|
418
|
-
"\x1bOR": "f3",
|
|
419
|
-
"\x1bOS": "f4",
|
|
420
|
-
"\x1b[11~": "f1",
|
|
421
|
-
"\x1b[12~": "f2",
|
|
422
|
-
"\x1b[13~": "f3",
|
|
423
|
-
"\x1b[14~": "f4",
|
|
424
|
-
"\x1b[[A": "f1",
|
|
425
|
-
"\x1b[[B": "f2",
|
|
426
|
-
"\x1b[[C": "f3",
|
|
427
|
-
"\x1b[[D": "f4",
|
|
428
|
-
"\x1b[[E": "f5",
|
|
429
|
-
"\x1b[15~": "f5",
|
|
430
|
-
"\x1b[17~": "f6",
|
|
431
|
-
"\x1b[18~": "f7",
|
|
432
|
-
"\x1b[19~": "f8",
|
|
433
|
-
"\x1b[20~": "f9",
|
|
434
|
-
"\x1b[21~": "f10",
|
|
435
|
-
"\x1b[23~": "f11",
|
|
436
|
-
"\x1b[24~": "f12",
|
|
437
|
-
"\x1bb": "alt+left",
|
|
438
|
-
"\x1bf": "alt+right",
|
|
439
|
-
"\x1bp": "alt+up",
|
|
440
|
-
"\x1bn": "alt+down",
|
|
328
|
+
/**
|
|
329
|
+
* Consolidated legacy terminal key sequences.
|
|
330
|
+
* Each key maps to its sequences for unmodified, shift-modified, and ctrl-modified variants.
|
|
331
|
+
* This single structure replaces three separate maps (LEGACY_KEY_SEQUENCES,
|
|
332
|
+
* LEGACY_SHIFT_SEQUENCES, LEGACY_CTRL_SEQUENCES) that shared the same key sets.
|
|
333
|
+
*/
|
|
334
|
+
const LEGACY_SEQUENCES: Record<string, { plain?: readonly string[]; shift?: readonly string[]; ctrl?: readonly string[] }> = {
|
|
335
|
+
up: { plain: ["\x1b[A", "\x1bOA"], shift: ["\x1b[a"], ctrl: ["\x1bOa"] },
|
|
336
|
+
down: { plain: ["\x1b[B", "\x1bOB"], shift: ["\x1b[b"], ctrl: ["\x1bOb"] },
|
|
337
|
+
right: { plain: ["\x1b[C", "\x1bOC"], shift: ["\x1b[c"], ctrl: ["\x1bOc"] },
|
|
338
|
+
left: { plain: ["\x1b[D", "\x1bOD"], shift: ["\x1b[d"], ctrl: ["\x1bOd"] },
|
|
339
|
+
home: { plain: ["\x1b[H", "\x1bOH", "\x1b[1~", "\x1b[7~"], shift: ["\x1b[7$"], ctrl: ["\x1b[7^"] },
|
|
340
|
+
end: { plain: ["\x1b[F", "\x1bOF", "\x1b[4~", "\x1b[8~"], shift: ["\x1b[8$"], ctrl: ["\x1b[8^"] },
|
|
341
|
+
insert: { plain: ["\x1b[2~"], shift: ["\x1b[2$"], ctrl: ["\x1b[2^"] },
|
|
342
|
+
delete: { plain: ["\x1b[3~"], shift: ["\x1b[3$"], ctrl: ["\x1b[3^"] },
|
|
343
|
+
pageUp: { plain: ["\x1b[5~", "\x1b[[5~"], shift: ["\x1b[5$"], ctrl: ["\x1b[5^"] },
|
|
344
|
+
pageDown: { plain: ["\x1b[6~", "\x1b[[6~"], shift: ["\x1b[6$"], ctrl: ["\x1b[6^"] },
|
|
345
|
+
clear: { plain: ["\x1b[E", "\x1bOE"], shift: ["\x1b[e"], ctrl: ["\x1bOe"] },
|
|
346
|
+
f1: { plain: ["\x1bOP", "\x1b[11~", "\x1b[[A"] },
|
|
347
|
+
f2: { plain: ["\x1bOQ", "\x1b[12~", "\x1b[[B"] },
|
|
348
|
+
f3: { plain: ["\x1bOR", "\x1b[13~", "\x1b[[C"] },
|
|
349
|
+
f4: { plain: ["\x1bOS", "\x1b[14~", "\x1b[[D"] },
|
|
350
|
+
f5: { plain: ["\x1b[15~", "\x1b[[E"] },
|
|
351
|
+
f6: { plain: ["\x1b[17~"] },
|
|
352
|
+
f7: { plain: ["\x1b[18~"] },
|
|
353
|
+
f8: { plain: ["\x1b[19~"] },
|
|
354
|
+
f9: { plain: ["\x1b[20~"] },
|
|
355
|
+
f10: { plain: ["\x1b[21~"] },
|
|
356
|
+
f11: { plain: ["\x1b[23~"] },
|
|
357
|
+
f12: { plain: ["\x1b[24~"] },
|
|
441
358
|
} as const;
|
|
442
359
|
|
|
443
|
-
|
|
360
|
+
/**
|
|
361
|
+
* Reverse lookup from escape sequence to key identifier, auto-generated from LEGACY_SEQUENCES.
|
|
362
|
+
* Additional non-standard sequences (alt+arrow aliases) are appended after generation.
|
|
363
|
+
*/
|
|
364
|
+
const LEGACY_SEQUENCE_KEY_IDS: Record<string, KeyId> = (() => {
|
|
365
|
+
const map: Record<string, KeyId> = {};
|
|
366
|
+
for (const [key, entry] of Object.entries(LEGACY_SEQUENCES)) {
|
|
367
|
+
const keyId = key as KeyId;
|
|
368
|
+
if (entry.plain) {
|
|
369
|
+
for (const seq of entry.plain) map[seq] = keyId;
|
|
370
|
+
}
|
|
371
|
+
if (entry.shift) {
|
|
372
|
+
for (const seq of entry.shift) map[seq] = `shift+${keyId}` as KeyId;
|
|
373
|
+
}
|
|
374
|
+
if (entry.ctrl) {
|
|
375
|
+
for (const seq of entry.ctrl) map[seq] = `ctrl+${keyId}` as KeyId;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
// Non-standard alt+arrow aliases not derivable from the table
|
|
379
|
+
map["\x1bb"] = "alt+left";
|
|
380
|
+
map["\x1bf"] = "alt+right";
|
|
381
|
+
map["\x1bp"] = "alt+up";
|
|
382
|
+
map["\x1bn"] = "alt+down";
|
|
383
|
+
return map;
|
|
384
|
+
})();
|
|
444
385
|
|
|
445
386
|
const matchesLegacySequence = (data: string, sequences: readonly string[]): boolean => sequences.includes(data);
|
|
446
387
|
|
|
447
|
-
const matchesLegacyModifierSequence = (data: string, key:
|
|
448
|
-
|
|
449
|
-
|
|
388
|
+
const matchesLegacyModifierSequence = (data: string, key: string, modifier: number): boolean => {
|
|
389
|
+
const entry = LEGACY_SEQUENCES[key];
|
|
390
|
+
if (!entry) return false;
|
|
391
|
+
if (modifier === MODIFIERS.shift && entry.shift) {
|
|
392
|
+
return matchesLegacySequence(data, entry.shift);
|
|
450
393
|
}
|
|
451
|
-
if (modifier === MODIFIERS.ctrl) {
|
|
452
|
-
return matchesLegacySequence(data,
|
|
394
|
+
if (modifier === MODIFIERS.ctrl && entry.ctrl) {
|
|
395
|
+
return matchesLegacySequence(data, entry.ctrl);
|
|
453
396
|
}
|
|
454
397
|
return false;
|
|
455
398
|
};
|
|
@@ -481,33 +424,29 @@ interface ParsedModifyOtherKeysSequence {
|
|
|
481
424
|
let _lastEventType: KeyEventType = "press";
|
|
482
425
|
|
|
483
426
|
/**
|
|
484
|
-
* Check if
|
|
485
|
-
*
|
|
427
|
+
* Check if input data contains a Kitty event type marker.
|
|
428
|
+
* Event type markers appear as ":<eventType>" followed by a sequence terminator (u, ~, A-D, H, F).
|
|
429
|
+
* Ignores bracketed paste content which may contain similar patterns.
|
|
486
430
|
*/
|
|
487
|
-
|
|
488
|
-
// Don't treat bracketed paste content as key release, even if it contains
|
|
489
|
-
// patterns like ":3F" (e.g., bluetooth MAC addresses like "90:62:3F:A5").
|
|
490
|
-
// Terminal.ts re-wraps paste content with bracketed paste markers before
|
|
491
|
-
// passing to TUI, so pasted data will always contain \x1b[200~.
|
|
431
|
+
function hasKittyEventType(data: string, eventType: number): boolean {
|
|
492
432
|
if (data.includes("\x1b[200~")) {
|
|
493
433
|
return false;
|
|
494
434
|
}
|
|
435
|
+
const marker = `:${eventType}`;
|
|
436
|
+
return (
|
|
437
|
+
data.includes(`${marker}u`) ||
|
|
438
|
+
data.includes(`${marker}~`) ||
|
|
439
|
+
data.includes(`${marker}A`) ||
|
|
440
|
+
data.includes(`${marker}B`) ||
|
|
441
|
+
data.includes(`${marker}C`) ||
|
|
442
|
+
data.includes(`${marker}D`) ||
|
|
443
|
+
data.includes(`${marker}H`) ||
|
|
444
|
+
data.includes(`${marker}F`)
|
|
445
|
+
);
|
|
446
|
+
}
|
|
495
447
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
if (
|
|
499
|
-
data.includes(":3u") ||
|
|
500
|
-
data.includes(":3~") ||
|
|
501
|
-
data.includes(":3A") ||
|
|
502
|
-
data.includes(":3B") ||
|
|
503
|
-
data.includes(":3C") ||
|
|
504
|
-
data.includes(":3D") ||
|
|
505
|
-
data.includes(":3H") ||
|
|
506
|
-
data.includes(":3F")
|
|
507
|
-
) {
|
|
508
|
-
return true;
|
|
509
|
-
}
|
|
510
|
-
return false;
|
|
448
|
+
export function isKeyRelease(data: string): boolean {
|
|
449
|
+
return hasKittyEventType(data, 3);
|
|
511
450
|
}
|
|
512
451
|
|
|
513
452
|
/**
|
|
@@ -515,25 +454,7 @@ export function isKeyRelease(data: string): boolean {
|
|
|
515
454
|
* Only meaningful when Kitty keyboard protocol with flag 2 is active.
|
|
516
455
|
*/
|
|
517
456
|
export function isKeyRepeat(data: string): boolean {
|
|
518
|
-
|
|
519
|
-
// patterns like ":2F". See isKeyRelease() for details.
|
|
520
|
-
if (data.includes("\x1b[200~")) {
|
|
521
|
-
return false;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
if (
|
|
525
|
-
data.includes(":2u") ||
|
|
526
|
-
data.includes(":2~") ||
|
|
527
|
-
data.includes(":2A") ||
|
|
528
|
-
data.includes(":2B") ||
|
|
529
|
-
data.includes(":2C") ||
|
|
530
|
-
data.includes(":2D") ||
|
|
531
|
-
data.includes(":2H") ||
|
|
532
|
-
data.includes(":2F")
|
|
533
|
-
) {
|
|
534
|
-
return true;
|
|
535
|
-
}
|
|
536
|
-
return false;
|
|
457
|
+
return hasKittyEventType(data, 2);
|
|
537
458
|
}
|
|
538
459
|
|
|
539
460
|
function parseEventType(eventTypeStr: string | undefined): KeyEventType {
|
|
@@ -847,7 +768,7 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
847
768
|
case "insert":
|
|
848
769
|
if (modifier === 0) {
|
|
849
770
|
return (
|
|
850
|
-
matchesLegacySequence(data,
|
|
771
|
+
matchesLegacySequence(data, LEGACY_SEQUENCES.insert.plain!) ||
|
|
851
772
|
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.insert, 0)
|
|
852
773
|
);
|
|
853
774
|
}
|
|
@@ -859,7 +780,7 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
859
780
|
case "delete":
|
|
860
781
|
if (modifier === 0) {
|
|
861
782
|
return (
|
|
862
|
-
matchesLegacySequence(data,
|
|
783
|
+
matchesLegacySequence(data, LEGACY_SEQUENCES.delete.plain!) ||
|
|
863
784
|
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.delete, 0)
|
|
864
785
|
);
|
|
865
786
|
}
|
|
@@ -870,14 +791,14 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
870
791
|
|
|
871
792
|
case "clear":
|
|
872
793
|
if (modifier === 0) {
|
|
873
|
-
return matchesLegacySequence(data,
|
|
794
|
+
return matchesLegacySequence(data, LEGACY_SEQUENCES.clear.plain!);
|
|
874
795
|
}
|
|
875
796
|
return matchesLegacyModifierSequence(data, "clear", modifier);
|
|
876
797
|
|
|
877
798
|
case "home":
|
|
878
799
|
if (modifier === 0) {
|
|
879
800
|
return (
|
|
880
|
-
matchesLegacySequence(data,
|
|
801
|
+
matchesLegacySequence(data, LEGACY_SEQUENCES.home.plain!) ||
|
|
881
802
|
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.home, 0)
|
|
882
803
|
);
|
|
883
804
|
}
|
|
@@ -889,7 +810,7 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
889
810
|
case "end":
|
|
890
811
|
if (modifier === 0) {
|
|
891
812
|
return (
|
|
892
|
-
matchesLegacySequence(data,
|
|
813
|
+
matchesLegacySequence(data, LEGACY_SEQUENCES.end.plain!) ||
|
|
893
814
|
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.end, 0)
|
|
894
815
|
);
|
|
895
816
|
}
|
|
@@ -901,7 +822,7 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
901
822
|
case "pageup":
|
|
902
823
|
if (modifier === 0) {
|
|
903
824
|
return (
|
|
904
|
-
matchesLegacySequence(data,
|
|
825
|
+
matchesLegacySequence(data, LEGACY_SEQUENCES.pageUp.plain!) ||
|
|
905
826
|
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.pageUp, 0)
|
|
906
827
|
);
|
|
907
828
|
}
|
|
@@ -913,7 +834,7 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
913
834
|
case "pagedown":
|
|
914
835
|
if (modifier === 0) {
|
|
915
836
|
return (
|
|
916
|
-
matchesLegacySequence(data,
|
|
837
|
+
matchesLegacySequence(data, LEGACY_SEQUENCES.pageDown.plain!) ||
|
|
917
838
|
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.pageDown, 0)
|
|
918
839
|
);
|
|
919
840
|
}
|
|
@@ -928,7 +849,7 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
928
849
|
}
|
|
929
850
|
if (modifier === 0) {
|
|
930
851
|
return (
|
|
931
|
-
matchesLegacySequence(data,
|
|
852
|
+
matchesLegacySequence(data, LEGACY_SEQUENCES.up.plain!) ||
|
|
932
853
|
matchesKittySequence(data, ARROW_CODEPOINTS.up, 0)
|
|
933
854
|
);
|
|
934
855
|
}
|
|
@@ -943,7 +864,7 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
943
864
|
}
|
|
944
865
|
if (modifier === 0) {
|
|
945
866
|
return (
|
|
946
|
-
matchesLegacySequence(data,
|
|
867
|
+
matchesLegacySequence(data, LEGACY_SEQUENCES.down.plain!) ||
|
|
947
868
|
matchesKittySequence(data, ARROW_CODEPOINTS.down, 0)
|
|
948
869
|
);
|
|
949
870
|
}
|
|
@@ -970,7 +891,7 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
970
891
|
}
|
|
971
892
|
if (modifier === 0) {
|
|
972
893
|
return (
|
|
973
|
-
matchesLegacySequence(data,
|
|
894
|
+
matchesLegacySequence(data, LEGACY_SEQUENCES.left.plain!) ||
|
|
974
895
|
matchesKittySequence(data, ARROW_CODEPOINTS.left, 0)
|
|
975
896
|
);
|
|
976
897
|
}
|
|
@@ -997,7 +918,7 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
997
918
|
}
|
|
998
919
|
if (modifier === 0) {
|
|
999
920
|
return (
|
|
1000
|
-
matchesLegacySequence(data,
|
|
921
|
+
matchesLegacySequence(data, LEGACY_SEQUENCES.right.plain!) ||
|
|
1001
922
|
matchesKittySequence(data, ARROW_CODEPOINTS.right, 0)
|
|
1002
923
|
);
|
|
1003
924
|
}
|
|
@@ -1021,8 +942,8 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
|
1021
942
|
if (modifier !== 0) {
|
|
1022
943
|
return false;
|
|
1023
944
|
}
|
|
1024
|
-
const functionKey = key as keyof typeof
|
|
1025
|
-
return matchesLegacySequence(data,
|
|
945
|
+
const functionKey = key as keyof typeof LEGACY_SEQUENCES;
|
|
946
|
+
return matchesLegacySequence(data, LEGACY_SEQUENCES[functionKey]!.plain!);
|
|
1026
947
|
}
|
|
1027
948
|
}
|
|
1028
949
|
|