@tuan_son.dinh/gsd 2.6.2 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cli.js +24 -10
- package/dist/loader.js +21 -3
- package/dist/logo.d.ts +3 -3
- package/dist/logo.js +2 -2
- package/dist/onboarding.d.ts +3 -3
- package/dist/onboarding.js +3 -4
- package/dist/pi-migration.d.ts +5 -1
- package/dist/pi-migration.js +19 -2
- package/dist/resource-loader.d.ts +2 -1
- package/dist/resource-loader.js +60 -4
- package/dist/wizard.d.ts +1 -1
- package/package.json +12 -6
- package/packages/pi-agent-core/dist/agent-loop.d.ts +21 -0
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/agent-loop.js +308 -0
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -0
- package/packages/pi-agent-core/dist/agent.d.ts +162 -0
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/agent.js +399 -0
- package/packages/pi-agent-core/dist/agent.js.map +1 -0
- package/packages/pi-agent-core/dist/index.d.ts +5 -0
- package/packages/pi-agent-core/dist/index.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/index.js +9 -0
- package/packages/pi-agent-core/dist/index.js.map +1 -0
- package/packages/pi-agent-core/dist/proxy.d.ts +85 -0
- package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/proxy.js +268 -0
- package/packages/pi-agent-core/dist/proxy.js.map +1 -0
- package/packages/pi-agent-core/dist/types.d.ts +178 -0
- package/packages/pi-agent-core/dist/types.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/types.js +2 -0
- package/packages/pi-agent-core/dist/types.js.map +1 -0
- package/packages/pi-agent-core/package.json +14 -0
- package/packages/pi-agent-core/src/agent-loop.ts +417 -0
- package/packages/pi-agent-core/src/agent.ts +568 -0
- package/packages/pi-agent-core/src/index.ts +8 -0
- package/packages/pi-agent-core/src/proxy.ts +340 -0
- package/packages/pi-agent-core/src/types.ts +194 -0
- package/packages/pi-agent-core/tsconfig.json +27 -0
- package/packages/pi-ai/bedrock-provider.d.ts +1 -0
- package/packages/pi-ai/bedrock-provider.js +1 -0
- package/packages/pi-ai/dist/api-registry.d.ts +20 -0
- package/packages/pi-ai/dist/api-registry.d.ts.map +1 -0
- package/packages/pi-ai/dist/api-registry.js +44 -0
- package/packages/pi-ai/dist/api-registry.js.map +1 -0
- package/packages/pi-ai/dist/bedrock-provider.d.ts +5 -0
- package/packages/pi-ai/dist/bedrock-provider.d.ts.map +1 -0
- package/packages/pi-ai/dist/bedrock-provider.js +6 -0
- package/packages/pi-ai/dist/bedrock-provider.js.map +1 -0
- package/packages/pi-ai/dist/cli.d.ts +3 -0
- package/packages/pi-ai/dist/cli.d.ts.map +1 -0
- package/packages/pi-ai/dist/cli.js +116 -0
- package/packages/pi-ai/dist/cli.js.map +1 -0
- package/packages/pi-ai/dist/env-api-keys.d.ts +9 -0
- package/packages/pi-ai/dist/env-api-keys.d.ts.map +1 -0
- package/packages/pi-ai/dist/env-api-keys.js +104 -0
- package/packages/pi-ai/dist/env-api-keys.js.map +1 -0
- package/packages/pi-ai/dist/index.d.ts +23 -0
- package/packages/pi-ai/dist/index.d.ts.map +1 -0
- package/packages/pi-ai/dist/index.js +21 -0
- package/packages/pi-ai/dist/index.js.map +1 -0
- package/packages/pi-ai/dist/models.d.ts +24 -0
- package/packages/pi-ai/dist/models.d.ts.map +1 -0
- package/packages/pi-ai/dist/models.generated.d.ts +13572 -0
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -0
- package/packages/pi-ai/dist/models.generated.js +13368 -0
- package/packages/pi-ai/dist/models.generated.js.map +1 -0
- package/packages/pi-ai/dist/models.js +55 -0
- package/packages/pi-ai/dist/models.js.map +1 -0
- package/packages/pi-ai/dist/oauth.d.ts +2 -0
- package/packages/pi-ai/dist/oauth.d.ts.map +1 -0
- package/packages/pi-ai/dist/oauth.js +2 -0
- package/packages/pi-ai/dist/oauth.js.map +1 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts +15 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +600 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic.d.ts +33 -0
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic.js +732 -0
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -0
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts +15 -0
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/azure-openai-responses.js +187 -0
- package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -0
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts +8 -0
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/github-copilot-headers.js +29 -0
- package/packages/pi-ai/dist/providers/github-copilot-headers.js.map +1 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts +74 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +757 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -0
- package/packages/pi-ai/dist/providers/google-shared.d.ts +65 -0
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google-shared.js +300 -0
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -0
- package/packages/pi-ai/dist/providers/google-vertex.d.ts +15 -0
- package/packages/pi-ai/dist/providers/google-vertex.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google-vertex.js +374 -0
- package/packages/pi-ai/dist/providers/google-vertex.js.map +1 -0
- package/packages/pi-ai/dist/providers/google.d.ts +13 -0
- package/packages/pi-ai/dist/providers/google.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google.js +355 -0
- package/packages/pi-ai/dist/providers/google.js.map +1 -0
- package/packages/pi-ai/dist/providers/mistral.d.ts +22 -0
- package/packages/pi-ai/dist/providers/mistral.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/mistral.js +498 -0
- package/packages/pi-ai/dist/providers/mistral.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts +9 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.js +704 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-completions.d.ts +15 -0
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-completions.js +705 -0
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-responses-shared.d.ts +17 -0
- package/packages/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-responses-shared.js +442 -0
- package/packages/pi-ai/dist/providers/openai-responses-shared.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-responses.d.ts +13 -0
- package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-responses.js +201 -0
- package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -0
- package/packages/pi-ai/dist/providers/register-builtins.d.ts +11 -0
- package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/register-builtins.js +138 -0
- package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts +8 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.js +35 -0
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -0
- package/packages/pi-ai/dist/providers/transform-messages.d.ts +8 -0
- package/packages/pi-ai/dist/providers/transform-messages.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/transform-messages.js +155 -0
- package/packages/pi-ai/dist/providers/transform-messages.js.map +1 -0
- package/packages/pi-ai/dist/stream.d.ts +8 -0
- package/packages/pi-ai/dist/stream.d.ts.map +1 -0
- package/packages/pi-ai/dist/stream.js +27 -0
- package/packages/pi-ai/dist/stream.js.map +1 -0
- package/packages/pi-ai/dist/types.d.ts +285 -0
- package/packages/pi-ai/dist/types.d.ts.map +1 -0
- package/packages/pi-ai/dist/types.js +2 -0
- package/packages/pi-ai/dist/types.js.map +1 -0
- package/packages/pi-ai/dist/utils/event-stream.d.ts +21 -0
- package/packages/pi-ai/dist/utils/event-stream.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/event-stream.js +77 -0
- package/packages/pi-ai/dist/utils/event-stream.js.map +1 -0
- package/packages/pi-ai/dist/utils/hash.d.ts +3 -0
- package/packages/pi-ai/dist/utils/hash.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/hash.js +14 -0
- package/packages/pi-ai/dist/utils/hash.js.map +1 -0
- package/packages/pi-ai/dist/utils/json-parse.d.ts +9 -0
- package/packages/pi-ai/dist/utils/json-parse.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/json-parse.js +29 -0
- package/packages/pi-ai/dist/utils/json-parse.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/anthropic.d.ts +17 -0
- package/packages/pi-ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/anthropic.js +104 -0
- package/packages/pi-ai/dist/utils/oauth/anthropic.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts +30 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js +281 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts +26 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +373 -0
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts +26 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +478 -0
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/index.d.ts +61 -0
- package/packages/pi-ai/dist/utils/oauth/index.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/index.js +131 -0
- package/packages/pi-ai/dist/utils/oauth/index.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.d.ts +34 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.js +380 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/pkce.d.ts +13 -0
- package/packages/pi-ai/dist/utils/oauth/pkce.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/pkce.js +31 -0
- package/packages/pi-ai/dist/utils/oauth/pkce.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/types.d.ts +47 -0
- package/packages/pi-ai/dist/utils/oauth/types.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/types.js +2 -0
- package/packages/pi-ai/dist/utils/oauth/types.js.map +1 -0
- package/packages/pi-ai/dist/utils/overflow.d.ts +52 -0
- package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/overflow.js +117 -0
- package/packages/pi-ai/dist/utils/overflow.js.map +1 -0
- package/packages/pi-ai/dist/utils/sanitize-unicode.d.ts +22 -0
- package/packages/pi-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/sanitize-unicode.js +26 -0
- package/packages/pi-ai/dist/utils/sanitize-unicode.js.map +1 -0
- package/packages/pi-ai/dist/utils/typebox-helpers.d.ts +17 -0
- package/packages/pi-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/typebox-helpers.js +21 -0
- package/packages/pi-ai/dist/utils/typebox-helpers.js.map +1 -0
- package/packages/pi-ai/dist/utils/validation.d.ts +18 -0
- package/packages/pi-ai/dist/utils/validation.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/validation.js +72 -0
- package/packages/pi-ai/dist/utils/validation.js.map +1 -0
- package/packages/pi-ai/package.json +40 -0
- package/packages/pi-ai/src/api-registry.ts +98 -0
- package/packages/pi-ai/src/bedrock-provider.ts +6 -0
- package/packages/pi-ai/src/cli.ts +133 -0
- package/packages/pi-ai/src/env-api-keys.ts +129 -0
- package/packages/pi-ai/src/index.ts +32 -0
- package/packages/pi-ai/src/models.generated.ts +13370 -0
- package/packages/pi-ai/src/models.ts +77 -0
- package/packages/pi-ai/src/oauth.ts +1 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.ts +751 -0
- package/packages/pi-ai/src/providers/anthropic.ts +883 -0
- package/packages/pi-ai/src/providers/azure-openai-responses.ts +259 -0
- package/packages/pi-ai/src/providers/github-copilot-headers.ts +37 -0
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +967 -0
- package/packages/pi-ai/src/providers/google-shared.ts +313 -0
- package/packages/pi-ai/src/providers/google-vertex.ts +485 -0
- package/packages/pi-ai/src/providers/google.ts +455 -0
- package/packages/pi-ai/src/providers/mistral.ts +582 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.ts +875 -0
- package/packages/pi-ai/src/providers/openai-completions.ts +820 -0
- package/packages/pi-ai/src/providers/openai-responses-shared.ts +496 -0
- package/packages/pi-ai/src/providers/openai-responses.ts +262 -0
- package/packages/pi-ai/src/providers/register-builtins.ts +186 -0
- package/packages/pi-ai/src/providers/simple-options.ts +46 -0
- package/packages/pi-ai/src/providers/transform-messages.ts +172 -0
- package/packages/pi-ai/src/stream.ts +59 -0
- package/packages/pi-ai/src/types.ts +321 -0
- package/packages/pi-ai/src/utils/event-stream.ts +87 -0
- package/packages/pi-ai/src/utils/hash.ts +13 -0
- package/packages/pi-ai/src/utils/json-parse.ts +28 -0
- package/packages/pi-ai/src/utils/oauth/anthropic.ts +138 -0
- package/packages/pi-ai/src/utils/oauth/github-copilot.ts +381 -0
- package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +457 -0
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +599 -0
- package/packages/pi-ai/src/utils/oauth/index.ts +162 -0
- package/packages/pi-ai/src/utils/oauth/openai-codex.ts +455 -0
- package/packages/pi-ai/src/utils/oauth/pkce.ts +34 -0
- package/packages/pi-ai/src/utils/oauth/types.ts +59 -0
- package/packages/pi-ai/src/utils/overflow.ts +123 -0
- package/packages/pi-ai/src/utils/sanitize-unicode.ts +25 -0
- package/packages/pi-ai/src/utils/typebox-helpers.ts +24 -0
- package/packages/pi-ai/src/utils/validation.ts +84 -0
- package/packages/pi-ai/tsconfig.json +27 -0
- package/packages/pi-coding-agent/dist/cli/args.d.ts +48 -0
- package/packages/pi-coding-agent/dist/cli/args.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/args.js +299 -0
- package/packages/pi-coding-agent/dist/cli/args.js.map +1 -0
- package/packages/pi-coding-agent/dist/cli/config-selector.d.ts +14 -0
- package/packages/pi-coding-agent/dist/cli/config-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/config-selector.js +31 -0
- package/packages/pi-coding-agent/dist/cli/config-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/cli/file-processor.d.ts +15 -0
- package/packages/pi-coding-agent/dist/cli/file-processor.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/file-processor.js +79 -0
- package/packages/pi-coding-agent/dist/cli/file-processor.js.map +1 -0
- package/packages/pi-coding-agent/dist/cli/list-models.d.ts +9 -0
- package/packages/pi-coding-agent/dist/cli/list-models.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/list-models.js +92 -0
- package/packages/pi-coding-agent/dist/cli/list-models.js.map +1 -0
- package/packages/pi-coding-agent/dist/cli/session-picker.d.ts +9 -0
- package/packages/pi-coding-agent/dist/cli/session-picker.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/session-picker.js +34 -0
- package/packages/pi-coding-agent/dist/cli/session-picker.js.map +1 -0
- package/packages/pi-coding-agent/dist/cli.d.ts +3 -0
- package/packages/pi-coding-agent/dist/cli.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli.js +16 -0
- package/packages/pi-coding-agent/dist/cli.js.map +1 -0
- package/packages/pi-coding-agent/dist/config.d.ts +68 -0
- package/packages/pi-coding-agent/dist/config.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/config.js +203 -0
- package/packages/pi-coding-agent/dist/config.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +618 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js +2481 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +134 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.js +415 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/bash-executor.d.ts +47 -0
- package/packages/pi-coding-agent/dist/core/bash-executor.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/bash-executor.js +212 -0
- package/packages/pi-coding-agent/dist/core/bash-executor.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts +86 -0
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js +242 -0
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +121 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +610 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/index.d.ts +7 -0
- package/packages/pi-coding-agent/dist/core/compaction/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/index.js +7 -0
- package/packages/pi-coding-agent/dist/core/compaction/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts +38 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.js +153 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/defaults.d.ts +3 -0
- package/packages/pi-coding-agent/dist/core/defaults.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/defaults.js +2 -0
- package/packages/pi-coding-agent/dist/core/defaults.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/diagnostics.d.ts +15 -0
- package/packages/pi-coding-agent/dist/core/diagnostics.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/diagnostics.js +2 -0
- package/packages/pi-coding-agent/dist/core/diagnostics.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/event-bus.d.ts +9 -0
- package/packages/pi-coding-agent/dist/core/event-bus.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/event-bus.js +25 -0
- package/packages/pi-coding-agent/dist/core/event-bus.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/exec.d.ts +29 -0
- package/packages/pi-coding-agent/dist/core/exec.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/exec.js +71 -0
- package/packages/pi-coding-agent/dist/core/exec.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js +249 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/index.d.ts +37 -0
- package/packages/pi-coding-agent/dist/core/export-html/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/index.js +223 -0
- package/packages/pi-coding-agent/dist/core/export-html/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/template.css +971 -0
- package/packages/pi-coding-agent/dist/core/export-html/template.html +54 -0
- package/packages/pi-coding-agent/dist/core/export-html/template.js +1583 -0
- package/packages/pi-coding-agent/dist/core/export-html/tool-renderer.d.ts +38 -0
- package/packages/pi-coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/tool-renderer.js +70 -0
- package/packages/pi-coding-agent/dist/core/export-html/tool-renderer.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/vendor/.gitkeep +0 -0
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +11 -0
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/index.js +9 -0
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +25 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +426 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +147 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +672 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +1040 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.js +35 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/wrapper.d.ts +27 -0
- package/packages/pi-coding-agent/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/wrapper.js +102 -0
- package/packages/pi-coding-agent/dist/core/extensions/wrapper.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/footer-data-provider.d.ts +32 -0
- package/packages/pi-coding-agent/dist/core/footer-data-provider.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/footer-data-provider.js +134 -0
- package/packages/pi-coding-agent/dist/core/footer-data-provider.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/index.d.ts +9 -0
- package/packages/pi-coding-agent/dist/core/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/index.js +9 -0
- package/packages/pi-coding-agent/dist/core/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts +55 -0
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/keybindings.js +151 -0
- package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/messages.d.ts +77 -0
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/messages.js +123 -0
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +113 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js +537 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts +104 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.js +462 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts +156 -0
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/package-manager.js +1442 -0
- package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts +50 -0
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/prompt-templates.js +251 -0
- package/packages/pi-coding-agent/dist/core/prompt-templates.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.d.ts +17 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.js +59 -0
- package/packages/pi-coding-agent/dist/core/resolve-config-value.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +184 -0
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/resource-loader.js +633 -0
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/sdk.d.ts +90 -0
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/sdk.js +242 -0
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +323 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.js +1094 -0
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +232 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js +682 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/skills.d.ts +58 -0
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/skills.js +364 -0
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/slash-commands.d.ts +15 -0
- package/packages/pi-coding-agent/dist/core/slash-commands.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/slash-commands.js +22 -0
- package/packages/pi-coding-agent/dist/core/slash-commands.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +28 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.js +159 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/timings.d.ts +7 -0
- package/packages/pi-coding-agent/dist/core/timings.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/timings.js +25 -0
- package/packages/pi-coding-agent/dist/core/timings.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts +55 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.js +269 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.d.ts +63 -0
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.js +243 -0
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.js +146 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/find.js +206 -0
- package/packages/pi-coding-agent/dist/core/tools/find.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.d.ts +45 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.js +239 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts +73 -0
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.js +61 -0
- package/packages/pi-coding-agent/dist/core/tools/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.d.ts +40 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.js +118 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/path-utils.d.ts +8 -0
- package/packages/pi-coding-agent/dist/core/tools/path-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/path-utils.js +81 -0
- package/packages/pi-coding-agent/dist/core/tools/path-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/read.js +166 -0
- package/packages/pi-coding-agent/dist/core/tools/read.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/truncate.d.ts +70 -0
- package/packages/pi-coding-agent/dist/core/tools/truncate.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/truncate.js +205 -0
- package/packages/pi-coding-agent/dist/core/tools/truncate.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts +29 -0
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/write.js +78 -0
- package/packages/pi-coding-agent/dist/core/tools/write.js.map +1 -0
- package/packages/pi-coding-agent/dist/index.d.ts +27 -0
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/index.js +42 -0
- package/packages/pi-coding-agent/dist/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/main.d.ts +8 -0
- package/packages/pi-coding-agent/dist/main.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/main.js +691 -0
- package/packages/pi-coding-agent/dist/main.js.map +1 -0
- package/packages/pi-coding-agent/dist/migrations.d.ts +33 -0
- package/packages/pi-coding-agent/dist/migrations.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/migrations.js +261 -0
- package/packages/pi-coding-agent/dist/migrations.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/index.d.ts +9 -0
- package/packages/pi-coding-agent/dist/modes/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/index.js +8 -0
- package/packages/pi-coding-agent/dist/modes/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/armin.d.ts +34 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/armin.js +329 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/armin.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts +16 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +92 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts +35 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +156 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bordered-loader.js +48 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +42 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +43 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.d.ts +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.js +470 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js +28 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-editor.js +63 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-message.js +74 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.js +138 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.js +133 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +20 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.d.ts +20 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +106 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.js +55 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.d.ts +24 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.js +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts +26 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +196 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/index.d.ts +32 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/index.js +33 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/index.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts +41 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js +61 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts +42 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +139 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts +47 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js +259 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/oauth-selector.d.ts +19 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js +92 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts +49 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js +271 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +155 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js +825 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +58 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +295 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/show-images-selector.js +34 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +45 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/theme-selector.js +44 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/thinking-selector.js +46 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +77 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +773 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts +87 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +1026 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.js +110 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts +9 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js +27 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +330 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +3755 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/dark.json +86 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/light.json +85 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +78 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +944 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.d.ts +28 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.js +101 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/jsonl.d.ts +17 -0
- package/packages/pi-coding-agent/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/jsonl.js +49 -0
- package/packages/pi-coding-agent/dist/modes/rpc/jsonl.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-client.d.ts +217 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-client.js +400 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-client.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js +509 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts +409 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.js +8 -0
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-types.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts +21 -0
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/changelog.js +87 -0
- package/packages/pi-coding-agent/dist/utils/changelog.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts +11 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js +162 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-native.d.ts +7 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-native.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-native.js +14 -0
- package/packages/pi-coding-agent/dist/utils/clipboard-native.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard.d.ts +2 -0
- package/packages/pi-coding-agent/dist/utils/clipboard.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/clipboard.js +67 -0
- package/packages/pi-coding-agent/dist/utils/clipboard.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/frontmatter.d.ts +8 -0
- package/packages/pi-coding-agent/dist/utils/frontmatter.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/frontmatter.js +26 -0
- package/packages/pi-coding-agent/dist/utils/frontmatter.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/git.d.ts +26 -0
- package/packages/pi-coding-agent/dist/utils/git.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/git.js +163 -0
- package/packages/pi-coding-agent/dist/utils/git.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/image-convert.d.ts +9 -0
- package/packages/pi-coding-agent/dist/utils/image-convert.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/image-convert.js +35 -0
- package/packages/pi-coding-agent/dist/utils/image-convert.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/image-resize.d.ts +36 -0
- package/packages/pi-coding-agent/dist/utils/image-resize.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/image-resize.js +181 -0
- package/packages/pi-coding-agent/dist/utils/image-resize.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/mime.d.ts +2 -0
- package/packages/pi-coding-agent/dist/utils/mime.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/mime.js +26 -0
- package/packages/pi-coding-agent/dist/utils/mime.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/photon.d.ts +21 -0
- package/packages/pi-coding-agent/dist/utils/photon.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/photon.js +121 -0
- package/packages/pi-coding-agent/dist/utils/photon.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/shell.d.ts +26 -0
- package/packages/pi-coding-agent/dist/utils/shell.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/shell.js +186 -0
- package/packages/pi-coding-agent/dist/utils/shell.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/sleep.d.ts +5 -0
- package/packages/pi-coding-agent/dist/utils/sleep.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/sleep.js +17 -0
- package/packages/pi-coding-agent/dist/utils/sleep.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts +3 -0
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/tools-manager.js +251 -0
- package/packages/pi-coding-agent/dist/utils/tools-manager.js.map +1 -0
- package/packages/pi-coding-agent/package.json +55 -0
- package/packages/pi-coding-agent/src/cli/args.ts +316 -0
- package/packages/pi-coding-agent/src/cli/config-selector.ts +52 -0
- package/packages/pi-coding-agent/src/cli/file-processor.ts +96 -0
- package/packages/pi-coding-agent/src/cli/list-models.ts +104 -0
- package/packages/pi-coding-agent/src/cli/session-picker.ts +51 -0
- package/packages/pi-coding-agent/src/cli.ts +18 -0
- package/packages/pi-coding-agent/src/config.ts +241 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +3050 -0
- package/packages/pi-coding-agent/src/core/auth-storage.ts +489 -0
- package/packages/pi-coding-agent/src/core/bash-executor.ts +278 -0
- package/packages/pi-coding-agent/src/core/compaction/branch-summarization.ts +352 -0
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +813 -0
- package/packages/pi-coding-agent/src/core/compaction/index.ts +7 -0
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +170 -0
- package/packages/pi-coding-agent/src/core/defaults.ts +3 -0
- package/packages/pi-coding-agent/src/core/diagnostics.ts +15 -0
- package/packages/pi-coding-agent/src/core/event-bus.ts +33 -0
- package/packages/pi-coding-agent/src/core/exec.ts +104 -0
- package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +258 -0
- package/packages/pi-coding-agent/src/core/export-html/index.ts +306 -0
- package/packages/pi-coding-agent/src/core/export-html/template.css +971 -0
- package/packages/pi-coding-agent/src/core/export-html/template.html +54 -0
- package/packages/pi-coding-agent/src/core/export-html/template.js +1583 -0
- package/packages/pi-coding-agent/src/core/export-html/tool-renderer.ts +114 -0
- package/packages/pi-coding-agent/src/core/export-html/vendor/.gitkeep +0 -0
- package/packages/pi-coding-agent/src/core/extensions/index.ts +171 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +545 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +884 -0
- package/packages/pi-coding-agent/src/core/extensions/types.ts +1411 -0
- package/packages/pi-coding-agent/src/core/extensions/wrapper.ts +118 -0
- package/packages/pi-coding-agent/src/core/footer-data-provider.ts +144 -0
- package/packages/pi-coding-agent/src/core/index.ts +61 -0
- package/packages/pi-coding-agent/src/core/keybindings.ts +211 -0
- package/packages/pi-coding-agent/src/core/messages.ts +195 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +694 -0
- package/packages/pi-coding-agent/src/core/model-resolver.ts +594 -0
- package/packages/pi-coding-agent/src/core/package-manager.ts +1794 -0
- package/packages/pi-coding-agent/src/core/prompt-templates.ts +299 -0
- package/packages/pi-coding-agent/src/core/resolve-config-value.ts +64 -0
- package/packages/pi-coding-agent/src/core/resource-loader.ts +868 -0
- package/packages/pi-coding-agent/src/core/sdk.ts +373 -0
- package/packages/pi-coding-agent/src/core/session-manager.ts +1410 -0
- package/packages/pi-coding-agent/src/core/settings-manager.ts +942 -0
- package/packages/pi-coding-agent/src/core/skills.ts +459 -0
- package/packages/pi-coding-agent/src/core/slash-commands.ts +38 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +218 -0
- package/packages/pi-coding-agent/src/core/timings.ts +25 -0
- package/packages/pi-coding-agent/src/core/tools/bash.ts +347 -0
- package/packages/pi-coding-agent/src/core/tools/edit-diff.ts +308 -0
- package/packages/pi-coding-agent/src/core/tools/edit.ts +227 -0
- package/packages/pi-coding-agent/src/core/tools/find.ts +273 -0
- package/packages/pi-coding-agent/src/core/tools/grep.ts +346 -0
- package/packages/pi-coding-agent/src/core/tools/index.ts +139 -0
- package/packages/pi-coding-agent/src/core/tools/ls.ts +170 -0
- package/packages/pi-coding-agent/src/core/tools/path-utils.ts +94 -0
- package/packages/pi-coding-agent/src/core/tools/read.ts +222 -0
- package/packages/pi-coding-agent/src/core/tools/truncate.ts +265 -0
- package/packages/pi-coding-agent/src/core/tools/write.ts +118 -0
- package/packages/pi-coding-agent/src/index.ts +333 -0
- package/packages/pi-coding-agent/src/main.ts +821 -0
- package/packages/pi-coding-agent/src/migrations.ts +295 -0
- package/packages/pi-coding-agent/src/modes/index.ts +9 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/armin.ts +382 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +115 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/bash-execution.ts +210 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/bordered-loader.ts +66 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/branch-summary-message.ts +58 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/compaction-summary-message.ts +59 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/config-selector.ts +592 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/countdown-timer.ts +38 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/custom-editor.ts +80 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/custom-message.ts +99 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/daxnuts.ts +164 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/diff.ts +147 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.ts +25 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/extension-editor.ts +147 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/extension-input.ts +85 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/extension-selector.ts +107 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +216 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/index.ts +32 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/keybinding-hints.ts +66 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/login-dialog.ts +174 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +329 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/oauth-selector.ts +121 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/scoped-models-selector.ts +346 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +194 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector.ts +1019 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/settings-selector.ts +421 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/show-images-selector.ts +45 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/skill-invocation-message.ts +55 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/theme-selector.ts +62 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/thinking-selector.ts +64 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +916 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-selector.ts +1184 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message-selector.ts +143 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message.ts +32 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/visual-truncate.ts +50 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +4464 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/dark.json +86 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/light.json +85 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.json +335 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +1105 -0
- package/packages/pi-coding-agent/src/modes/print-mode.ts +124 -0
- package/packages/pi-coding-agent/src/modes/rpc/jsonl.ts +58 -0
- package/packages/pi-coding-agent/src/modes/rpc/rpc-client.ts +505 -0
- package/packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts +638 -0
- package/packages/pi-coding-agent/src/modes/rpc/rpc-types.ts +263 -0
- package/packages/pi-coding-agent/src/utils/changelog.ts +99 -0
- package/packages/pi-coding-agent/src/utils/clipboard-image.ts +207 -0
- package/packages/pi-coding-agent/src/utils/clipboard-native.ts +21 -0
- package/packages/pi-coding-agent/src/utils/clipboard.ts +62 -0
- package/packages/pi-coding-agent/src/utils/frontmatter.ts +39 -0
- package/packages/pi-coding-agent/src/utils/git.ts +192 -0
- package/packages/pi-coding-agent/src/utils/image-convert.ts +38 -0
- package/packages/pi-coding-agent/src/utils/image-resize.ts +231 -0
- package/packages/pi-coding-agent/src/utils/mime.ts +30 -0
- package/packages/pi-coding-agent/src/utils/photon.ts +139 -0
- package/packages/pi-coding-agent/src/utils/shell.ts +202 -0
- package/packages/pi-coding-agent/src/utils/sleep.ts +18 -0
- package/packages/pi-coding-agent/src/utils/tools-manager.ts +286 -0
- package/packages/pi-coding-agent/tsconfig.json +27 -0
- package/packages/pi-tui/dist/autocomplete.d.ts +50 -0
- package/packages/pi-tui/dist/autocomplete.d.ts.map +1 -0
- package/packages/pi-tui/dist/autocomplete.js +593 -0
- package/packages/pi-tui/dist/autocomplete.js.map +1 -0
- package/packages/pi-tui/dist/components/box.d.ts +22 -0
- package/packages/pi-tui/dist/components/box.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/box.js +99 -0
- package/packages/pi-tui/dist/components/box.js.map +1 -0
- package/packages/pi-tui/dist/components/cancellable-loader.d.ts +22 -0
- package/packages/pi-tui/dist/components/cancellable-loader.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/cancellable-loader.js +36 -0
- package/packages/pi-tui/dist/components/cancellable-loader.js.map +1 -0
- package/packages/pi-tui/dist/components/editor.d.ts +219 -0
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/editor.js +1693 -0
- package/packages/pi-tui/dist/components/editor.js.map +1 -0
- package/packages/pi-tui/dist/components/image.d.ts +28 -0
- package/packages/pi-tui/dist/components/image.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/image.js +61 -0
- package/packages/pi-tui/dist/components/image.js.map +1 -0
- package/packages/pi-tui/dist/components/input.d.ts +37 -0
- package/packages/pi-tui/dist/components/input.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/input.js +443 -0
- package/packages/pi-tui/dist/components/input.js.map +1 -0
- package/packages/pi-tui/dist/components/loader.d.ts +21 -0
- package/packages/pi-tui/dist/components/loader.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/loader.js +46 -0
- package/packages/pi-tui/dist/components/loader.js.map +1 -0
- package/packages/pi-tui/dist/components/markdown.d.ts +95 -0
- package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/markdown.js +641 -0
- package/packages/pi-tui/dist/components/markdown.js.map +1 -0
- package/packages/pi-tui/dist/components/select-list.d.ts +32 -0
- package/packages/pi-tui/dist/components/select-list.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/select-list.js +148 -0
- package/packages/pi-tui/dist/components/select-list.js.map +1 -0
- package/packages/pi-tui/dist/components/settings-list.d.ts +50 -0
- package/packages/pi-tui/dist/components/settings-list.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/settings-list.js +177 -0
- package/packages/pi-tui/dist/components/settings-list.js.map +1 -0
- package/packages/pi-tui/dist/components/spacer.d.ts +12 -0
- package/packages/pi-tui/dist/components/spacer.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/spacer.js +22 -0
- package/packages/pi-tui/dist/components/spacer.js.map +1 -0
- package/packages/pi-tui/dist/components/text.d.ts +19 -0
- package/packages/pi-tui/dist/components/text.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/text.js +81 -0
- package/packages/pi-tui/dist/components/text.js.map +1 -0
- package/packages/pi-tui/dist/components/truncated-text.d.ts +13 -0
- package/packages/pi-tui/dist/components/truncated-text.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/truncated-text.js +48 -0
- package/packages/pi-tui/dist/components/truncated-text.js.map +1 -0
- package/packages/pi-tui/dist/editor-component.d.ts +39 -0
- package/packages/pi-tui/dist/editor-component.d.ts.map +1 -0
- package/packages/pi-tui/dist/editor-component.js +2 -0
- package/packages/pi-tui/dist/editor-component.js.map +1 -0
- package/packages/pi-tui/dist/fuzzy.d.ts +16 -0
- package/packages/pi-tui/dist/fuzzy.d.ts.map +1 -0
- package/packages/pi-tui/dist/fuzzy.js +107 -0
- package/packages/pi-tui/dist/fuzzy.js.map +1 -0
- package/packages/pi-tui/dist/index.d.ts +23 -0
- package/packages/pi-tui/dist/index.d.ts.map +1 -0
- package/packages/pi-tui/dist/index.js +32 -0
- package/packages/pi-tui/dist/index.js.map +1 -0
- package/packages/pi-tui/dist/keybindings.d.ts +39 -0
- package/packages/pi-tui/dist/keybindings.d.ts.map +1 -0
- package/packages/pi-tui/dist/keybindings.js +116 -0
- package/packages/pi-tui/dist/keybindings.js.map +1 -0
- package/packages/pi-tui/dist/keys.d.ts +170 -0
- package/packages/pi-tui/dist/keys.d.ts.map +1 -0
- package/packages/pi-tui/dist/keys.js +1046 -0
- package/packages/pi-tui/dist/keys.js.map +1 -0
- package/packages/pi-tui/dist/kill-ring.d.ts +28 -0
- package/packages/pi-tui/dist/kill-ring.d.ts.map +1 -0
- package/packages/pi-tui/dist/kill-ring.js +46 -0
- package/packages/pi-tui/dist/kill-ring.js.map +1 -0
- package/packages/pi-tui/dist/stdin-buffer.d.ts +48 -0
- package/packages/pi-tui/dist/stdin-buffer.d.ts.map +1 -0
- package/packages/pi-tui/dist/stdin-buffer.js +316 -0
- package/packages/pi-tui/dist/stdin-buffer.js.map +1 -0
- package/packages/pi-tui/dist/terminal-image.d.ts +68 -0
- package/packages/pi-tui/dist/terminal-image.d.ts.map +1 -0
- package/packages/pi-tui/dist/terminal-image.js +288 -0
- package/packages/pi-tui/dist/terminal-image.js.map +1 -0
- package/packages/pi-tui/dist/terminal.d.ts +85 -0
- package/packages/pi-tui/dist/terminal.d.ts.map +1 -0
- package/packages/pi-tui/dist/terminal.js +271 -0
- package/packages/pi-tui/dist/terminal.js.map +1 -0
- package/packages/pi-tui/dist/tui.d.ts +220 -0
- package/packages/pi-tui/dist/tui.d.ts.map +1 -0
- package/packages/pi-tui/dist/tui.js +976 -0
- package/packages/pi-tui/dist/tui.js.map +1 -0
- package/packages/pi-tui/dist/undo-stack.d.ts +17 -0
- package/packages/pi-tui/dist/undo-stack.d.ts.map +1 -0
- package/packages/pi-tui/dist/undo-stack.js +27 -0
- package/packages/pi-tui/dist/undo-stack.js.map +1 -0
- package/packages/pi-tui/dist/utils.d.ts +78 -0
- package/packages/pi-tui/dist/utils.d.ts.map +1 -0
- package/packages/pi-tui/dist/utils.js +817 -0
- package/packages/pi-tui/dist/utils.js.map +1 -0
- package/packages/pi-tui/package.json +21 -0
- package/packages/pi-tui/src/autocomplete.ts +736 -0
- package/packages/pi-tui/src/components/box.ts +137 -0
- package/packages/pi-tui/src/components/cancellable-loader.ts +40 -0
- package/packages/pi-tui/src/components/editor.ts +2035 -0
- package/packages/pi-tui/src/components/image.ts +104 -0
- package/packages/pi-tui/src/components/input.ts +521 -0
- package/packages/pi-tui/src/components/loader.ts +55 -0
- package/packages/pi-tui/src/components/markdown.ts +806 -0
- package/packages/pi-tui/src/components/select-list.ts +188 -0
- package/packages/pi-tui/src/components/settings-list.ts +250 -0
- package/packages/pi-tui/src/components/spacer.ts +28 -0
- package/packages/pi-tui/src/components/text.ts +106 -0
- package/packages/pi-tui/src/components/truncated-text.ts +65 -0
- package/packages/pi-tui/src/editor-component.ts +74 -0
- package/packages/pi-tui/src/fuzzy.ts +133 -0
- package/packages/pi-tui/src/index.ts +93 -0
- package/packages/pi-tui/src/keybindings.ts +189 -0
- package/packages/pi-tui/src/keys.ts +1255 -0
- package/packages/pi-tui/src/kill-ring.ts +46 -0
- package/packages/pi-tui/src/stdin-buffer.ts +386 -0
- package/packages/pi-tui/src/terminal-image.ts +381 -0
- package/packages/pi-tui/src/terminal.ts +349 -0
- package/packages/pi-tui/src/tui.ts +1212 -0
- package/packages/pi-tui/src/undo-stack.ts +28 -0
- package/packages/pi-tui/src/utils.ts +905 -0
- package/packages/pi-tui/tsconfig.json +27 -0
- package/pkg/dist/modes/interactive/theme/dark.json +6 -6
- package/pkg/dist/modes/interactive/theme/light.json +6 -5
- package/pkg/dist/modes/interactive/theme/theme.d.ts +2 -2
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +1 -6
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/scripts/postinstall.js +2 -17
- package/src/resources/extensions/ask-user-questions.ts +2 -2
- package/src/resources/extensions/bg-shell/index.ts +4 -4
- package/src/resources/extensions/browser-tools/index.ts +3 -3
- package/src/resources/extensions/context7/index.ts +3 -3
- package/src/resources/extensions/get-secrets-from-user.ts +331 -59
- package/src/resources/extensions/google-search/index.ts +20 -7
- package/src/resources/extensions/gsd/activity-log.ts +1 -1
- package/src/resources/extensions/gsd/auto.ts +106 -21
- package/src/resources/extensions/gsd/commands.ts +2 -2
- package/src/resources/extensions/gsd/dashboard-overlay.ts +2 -2
- package/src/resources/extensions/gsd/docs/preferences-reference.md +45 -1
- package/src/resources/extensions/gsd/doctor.ts +23 -4
- package/src/resources/extensions/gsd/files.ts +115 -1
- package/src/resources/extensions/gsd/git-service.ts +64 -111
- package/src/resources/extensions/gsd/guided-flow.ts +3 -2
- package/src/resources/extensions/gsd/index.ts +18 -7
- package/src/resources/extensions/gsd/metrics.ts +1 -1
- package/src/resources/extensions/gsd/migrate/command.ts +1 -1
- package/src/resources/extensions/gsd/preferences.ts +72 -10
- package/src/resources/extensions/gsd/prompts/guided-plan-milestone.md +4 -0
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +17 -0
- package/src/resources/extensions/gsd/session-forensics.ts +19 -6
- package/src/resources/extensions/gsd/skill-discovery.ts +1 -1
- package/src/resources/extensions/gsd/templates/secrets-manifest.md +22 -0
- package/src/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +196 -0
- package/src/resources/extensions/gsd/tests/collect-from-manifest.test.ts +469 -0
- package/src/resources/extensions/gsd/tests/doctor-fixlevel.test.ts +170 -0
- package/src/resources/extensions/gsd/tests/git-service.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/manifest-status.test.ts +283 -0
- package/src/resources/extensions/gsd/tests/parsers.test.ts +401 -65
- package/src/resources/extensions/gsd/tests/resolve-ts-hooks.mjs +2 -1
- package/src/resources/extensions/gsd/tests/secure-env-collect.test.ts +185 -0
- package/src/resources/extensions/gsd/types.ts +27 -0
- package/src/resources/extensions/gsd/worktree-command.ts +2 -2
- package/src/resources/extensions/mac-tools/index.ts +2 -2
- package/src/resources/extensions/mcporter/index.ts +3 -3
- package/src/resources/extensions/remote-questions/remote-command.ts +3 -3
- package/src/resources/extensions/search-the-web/command-search-provider.ts +2 -2
- package/src/resources/extensions/search-the-web/index.ts +1 -1
- package/src/resources/extensions/search-the-web/provider.ts +1 -1
- package/src/resources/extensions/search-the-web/tool-fetch-page.ts +3 -3
- package/src/resources/extensions/search-the-web/tool-llm-context.ts +4 -4
- package/src/resources/extensions/search-the-web/tool-search.ts +4 -4
- package/src/resources/extensions/shared/confirm-ui.ts +3 -3
- package/src/resources/extensions/shared/interview-ui.ts +3 -3
- package/src/resources/extensions/shared/next-action-ui.ts +3 -3
- package/src/resources/extensions/shared/progress-widget.ts +2 -2
- package/src/resources/extensions/shared/thinking-widget.ts +3 -3
- package/src/resources/extensions/shared/ui.ts +4 -4
- package/src/resources/extensions/shared/wizard-ui.ts +4 -4
- package/src/resources/extensions/slash-commands/audit.ts +1 -1
- package/src/resources/extensions/slash-commands/clear.ts +1 -1
- package/src/resources/extensions/slash-commands/create-extension.ts +2 -2
- package/src/resources/extensions/slash-commands/create-slash-command.ts +2 -2
- package/src/resources/extensions/slash-commands/index.ts +1 -1
- package/src/resources/extensions/subagent/agents.ts +1 -1
- package/src/resources/extensions/subagent/index.ts +5 -5
- package/src/resources/extensions/voice/index.ts +3 -3
- package/patches/@mariozechner+pi-coding-agent+0.57.1.patch +0 -78
- package/patches/@mariozechner+pi-tui+0.57.1.patch +0 -47
|
@@ -0,0 +1,1255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard input handling for terminal applications.
|
|
3
|
+
*
|
|
4
|
+
* Supports both legacy terminal sequences and Kitty keyboard protocol.
|
|
5
|
+
* See: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
|
|
6
|
+
* Reference: https://github.com/sst/opentui/blob/7da92b4088aebfe27b9f691c04163a48821e49fd/packages/core/src/lib/parse.keypress.ts
|
|
7
|
+
*
|
|
8
|
+
* Symbol keys are also supported, however some ctrl+symbol combos
|
|
9
|
+
* overlap with ASCII codes, e.g. ctrl+[ = ESC.
|
|
10
|
+
* See: https://sw.kovidgoyal.net/kitty/keyboard-protocol/#legacy-ctrl-mapping-of-ascii-keys
|
|
11
|
+
* Those can still be * used for ctrl+shift combos
|
|
12
|
+
*
|
|
13
|
+
* API:
|
|
14
|
+
* - matchesKey(data, keyId) - Check if input matches a key identifier
|
|
15
|
+
* - parseKey(data) - Parse input and return the key identifier
|
|
16
|
+
* - Key - Helper object for creating typed key identifiers
|
|
17
|
+
* - setKittyProtocolActive(active) - Set global Kitty protocol state
|
|
18
|
+
* - isKittyProtocolActive() - Query global Kitty protocol state
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
// =============================================================================
|
|
22
|
+
// Global Kitty Protocol State
|
|
23
|
+
// =============================================================================
|
|
24
|
+
|
|
25
|
+
let _kittyProtocolActive = false;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Set the global Kitty keyboard protocol state.
|
|
29
|
+
* Called by ProcessTerminal after detecting protocol support.
|
|
30
|
+
*/
|
|
31
|
+
export function setKittyProtocolActive(active: boolean): void {
|
|
32
|
+
_kittyProtocolActive = active;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Query whether Kitty keyboard protocol is currently active.
|
|
37
|
+
*/
|
|
38
|
+
export function isKittyProtocolActive(): boolean {
|
|
39
|
+
return _kittyProtocolActive;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// =============================================================================
|
|
43
|
+
// Type-Safe Key Identifiers
|
|
44
|
+
// =============================================================================
|
|
45
|
+
|
|
46
|
+
type Letter =
|
|
47
|
+
| "a"
|
|
48
|
+
| "b"
|
|
49
|
+
| "c"
|
|
50
|
+
| "d"
|
|
51
|
+
| "e"
|
|
52
|
+
| "f"
|
|
53
|
+
| "g"
|
|
54
|
+
| "h"
|
|
55
|
+
| "i"
|
|
56
|
+
| "j"
|
|
57
|
+
| "k"
|
|
58
|
+
| "l"
|
|
59
|
+
| "m"
|
|
60
|
+
| "n"
|
|
61
|
+
| "o"
|
|
62
|
+
| "p"
|
|
63
|
+
| "q"
|
|
64
|
+
| "r"
|
|
65
|
+
| "s"
|
|
66
|
+
| "t"
|
|
67
|
+
| "u"
|
|
68
|
+
| "v"
|
|
69
|
+
| "w"
|
|
70
|
+
| "x"
|
|
71
|
+
| "y"
|
|
72
|
+
| "z";
|
|
73
|
+
|
|
74
|
+
type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
|
|
75
|
+
|
|
76
|
+
type SymbolKey =
|
|
77
|
+
| "`"
|
|
78
|
+
| "-"
|
|
79
|
+
| "="
|
|
80
|
+
| "["
|
|
81
|
+
| "]"
|
|
82
|
+
| "\\"
|
|
83
|
+
| ";"
|
|
84
|
+
| "'"
|
|
85
|
+
| ","
|
|
86
|
+
| "."
|
|
87
|
+
| "/"
|
|
88
|
+
| "!"
|
|
89
|
+
| "@"
|
|
90
|
+
| "#"
|
|
91
|
+
| "$"
|
|
92
|
+
| "%"
|
|
93
|
+
| "^"
|
|
94
|
+
| "&"
|
|
95
|
+
| "*"
|
|
96
|
+
| "("
|
|
97
|
+
| ")"
|
|
98
|
+
| "_"
|
|
99
|
+
| "+"
|
|
100
|
+
| "|"
|
|
101
|
+
| "~"
|
|
102
|
+
| "{"
|
|
103
|
+
| "}"
|
|
104
|
+
| ":"
|
|
105
|
+
| "<"
|
|
106
|
+
| ">"
|
|
107
|
+
| "?";
|
|
108
|
+
|
|
109
|
+
type SpecialKey =
|
|
110
|
+
| "escape"
|
|
111
|
+
| "esc"
|
|
112
|
+
| "enter"
|
|
113
|
+
| "return"
|
|
114
|
+
| "tab"
|
|
115
|
+
| "space"
|
|
116
|
+
| "backspace"
|
|
117
|
+
| "delete"
|
|
118
|
+
| "insert"
|
|
119
|
+
| "clear"
|
|
120
|
+
| "home"
|
|
121
|
+
| "end"
|
|
122
|
+
| "pageUp"
|
|
123
|
+
| "pageDown"
|
|
124
|
+
| "up"
|
|
125
|
+
| "down"
|
|
126
|
+
| "left"
|
|
127
|
+
| "right"
|
|
128
|
+
| "f1"
|
|
129
|
+
| "f2"
|
|
130
|
+
| "f3"
|
|
131
|
+
| "f4"
|
|
132
|
+
| "f5"
|
|
133
|
+
| "f6"
|
|
134
|
+
| "f7"
|
|
135
|
+
| "f8"
|
|
136
|
+
| "f9"
|
|
137
|
+
| "f10"
|
|
138
|
+
| "f11"
|
|
139
|
+
| "f12";
|
|
140
|
+
|
|
141
|
+
type BaseKey = Letter | Digit | SymbolKey | SpecialKey;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Union type of all valid key identifiers.
|
|
145
|
+
* Provides autocomplete and catches typos at compile time.
|
|
146
|
+
*/
|
|
147
|
+
export type KeyId =
|
|
148
|
+
| BaseKey
|
|
149
|
+
| `ctrl+${BaseKey}`
|
|
150
|
+
| `shift+${BaseKey}`
|
|
151
|
+
| `alt+${BaseKey}`
|
|
152
|
+
| `ctrl+shift+${BaseKey}`
|
|
153
|
+
| `shift+ctrl+${BaseKey}`
|
|
154
|
+
| `ctrl+alt+${BaseKey}`
|
|
155
|
+
| `alt+ctrl+${BaseKey}`
|
|
156
|
+
| `shift+alt+${BaseKey}`
|
|
157
|
+
| `alt+shift+${BaseKey}`
|
|
158
|
+
| `ctrl+shift+alt+${BaseKey}`
|
|
159
|
+
| `ctrl+alt+shift+${BaseKey}`
|
|
160
|
+
| `shift+ctrl+alt+${BaseKey}`
|
|
161
|
+
| `shift+alt+ctrl+${BaseKey}`
|
|
162
|
+
| `alt+ctrl+shift+${BaseKey}`
|
|
163
|
+
| `alt+shift+ctrl+${BaseKey}`;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Helper object for creating typed key identifiers with autocomplete.
|
|
167
|
+
*
|
|
168
|
+
* Usage:
|
|
169
|
+
* - Key.escape, Key.enter, Key.tab, etc. for special keys
|
|
170
|
+
* - Key.backtick, Key.comma, Key.period, etc. for symbol keys
|
|
171
|
+
* - Key.ctrl("c"), Key.alt("x") for single modifier
|
|
172
|
+
* - Key.ctrlShift("p"), Key.ctrlAlt("x") for combined modifiers
|
|
173
|
+
*/
|
|
174
|
+
export const Key = {
|
|
175
|
+
// Special keys
|
|
176
|
+
escape: "escape" as const,
|
|
177
|
+
esc: "esc" as const,
|
|
178
|
+
enter: "enter" as const,
|
|
179
|
+
return: "return" as const,
|
|
180
|
+
tab: "tab" as const,
|
|
181
|
+
space: "space" as const,
|
|
182
|
+
backspace: "backspace" as const,
|
|
183
|
+
delete: "delete" as const,
|
|
184
|
+
insert: "insert" as const,
|
|
185
|
+
clear: "clear" as const,
|
|
186
|
+
home: "home" as const,
|
|
187
|
+
end: "end" as const,
|
|
188
|
+
pageUp: "pageUp" as const,
|
|
189
|
+
pageDown: "pageDown" as const,
|
|
190
|
+
up: "up" as const,
|
|
191
|
+
down: "down" as const,
|
|
192
|
+
left: "left" as const,
|
|
193
|
+
right: "right" as const,
|
|
194
|
+
f1: "f1" as const,
|
|
195
|
+
f2: "f2" as const,
|
|
196
|
+
f3: "f3" as const,
|
|
197
|
+
f4: "f4" as const,
|
|
198
|
+
f5: "f5" as const,
|
|
199
|
+
f6: "f6" as const,
|
|
200
|
+
f7: "f7" as const,
|
|
201
|
+
f8: "f8" as const,
|
|
202
|
+
f9: "f9" as const,
|
|
203
|
+
f10: "f10" as const,
|
|
204
|
+
f11: "f11" as const,
|
|
205
|
+
f12: "f12" as const,
|
|
206
|
+
|
|
207
|
+
// Symbol keys
|
|
208
|
+
backtick: "`" as const,
|
|
209
|
+
hyphen: "-" as const,
|
|
210
|
+
equals: "=" as const,
|
|
211
|
+
leftbracket: "[" as const,
|
|
212
|
+
rightbracket: "]" as const,
|
|
213
|
+
backslash: "\\" as const,
|
|
214
|
+
semicolon: ";" as const,
|
|
215
|
+
quote: "'" as const,
|
|
216
|
+
comma: "," as const,
|
|
217
|
+
period: "." as const,
|
|
218
|
+
slash: "/" as const,
|
|
219
|
+
exclamation: "!" as const,
|
|
220
|
+
at: "@" as const,
|
|
221
|
+
hash: "#" as const,
|
|
222
|
+
dollar: "$" as const,
|
|
223
|
+
percent: "%" as const,
|
|
224
|
+
caret: "^" as const,
|
|
225
|
+
ampersand: "&" as const,
|
|
226
|
+
asterisk: "*" as const,
|
|
227
|
+
leftparen: "(" as const,
|
|
228
|
+
rightparen: ")" as const,
|
|
229
|
+
underscore: "_" as const,
|
|
230
|
+
plus: "+" as const,
|
|
231
|
+
pipe: "|" as const,
|
|
232
|
+
tilde: "~" as const,
|
|
233
|
+
leftbrace: "{" as const,
|
|
234
|
+
rightbrace: "}" as const,
|
|
235
|
+
colon: ":" as const,
|
|
236
|
+
lessthan: "<" as const,
|
|
237
|
+
greaterthan: ">" as const,
|
|
238
|
+
question: "?" as const,
|
|
239
|
+
|
|
240
|
+
// Single modifiers
|
|
241
|
+
ctrl: <K extends BaseKey>(key: K): `ctrl+${K}` => `ctrl+${key}`,
|
|
242
|
+
shift: <K extends BaseKey>(key: K): `shift+${K}` => `shift+${key}`,
|
|
243
|
+
alt: <K extends BaseKey>(key: K): `alt+${K}` => `alt+${key}`,
|
|
244
|
+
|
|
245
|
+
// Combined modifiers
|
|
246
|
+
ctrlShift: <K extends BaseKey>(key: K): `ctrl+shift+${K}` => `ctrl+shift+${key}`,
|
|
247
|
+
shiftCtrl: <K extends BaseKey>(key: K): `shift+ctrl+${K}` => `shift+ctrl+${key}`,
|
|
248
|
+
ctrlAlt: <K extends BaseKey>(key: K): `ctrl+alt+${K}` => `ctrl+alt+${key}`,
|
|
249
|
+
altCtrl: <K extends BaseKey>(key: K): `alt+ctrl+${K}` => `alt+ctrl+${key}`,
|
|
250
|
+
shiftAlt: <K extends BaseKey>(key: K): `shift+alt+${K}` => `shift+alt+${key}`,
|
|
251
|
+
altShift: <K extends BaseKey>(key: K): `alt+shift+${K}` => `alt+shift+${key}`,
|
|
252
|
+
|
|
253
|
+
// Triple modifiers
|
|
254
|
+
ctrlShiftAlt: <K extends BaseKey>(key: K): `ctrl+shift+alt+${K}` => `ctrl+shift+alt+${key}`,
|
|
255
|
+
} as const;
|
|
256
|
+
|
|
257
|
+
// =============================================================================
|
|
258
|
+
// Constants
|
|
259
|
+
// =============================================================================
|
|
260
|
+
|
|
261
|
+
const SYMBOL_KEYS = new Set([
|
|
262
|
+
"`",
|
|
263
|
+
"-",
|
|
264
|
+
"=",
|
|
265
|
+
"[",
|
|
266
|
+
"]",
|
|
267
|
+
"\\",
|
|
268
|
+
";",
|
|
269
|
+
"'",
|
|
270
|
+
",",
|
|
271
|
+
".",
|
|
272
|
+
"/",
|
|
273
|
+
"!",
|
|
274
|
+
"@",
|
|
275
|
+
"#",
|
|
276
|
+
"$",
|
|
277
|
+
"%",
|
|
278
|
+
"^",
|
|
279
|
+
"&",
|
|
280
|
+
"*",
|
|
281
|
+
"(",
|
|
282
|
+
")",
|
|
283
|
+
"_",
|
|
284
|
+
"+",
|
|
285
|
+
"|",
|
|
286
|
+
"~",
|
|
287
|
+
"{",
|
|
288
|
+
"}",
|
|
289
|
+
":",
|
|
290
|
+
"<",
|
|
291
|
+
">",
|
|
292
|
+
"?",
|
|
293
|
+
]);
|
|
294
|
+
|
|
295
|
+
const MODIFIERS = {
|
|
296
|
+
shift: 1,
|
|
297
|
+
alt: 2,
|
|
298
|
+
ctrl: 4,
|
|
299
|
+
} as const;
|
|
300
|
+
|
|
301
|
+
const LOCK_MASK = 64 + 128; // Caps Lock + Num Lock
|
|
302
|
+
|
|
303
|
+
const CODEPOINTS = {
|
|
304
|
+
escape: 27,
|
|
305
|
+
tab: 9,
|
|
306
|
+
enter: 13,
|
|
307
|
+
space: 32,
|
|
308
|
+
backspace: 127,
|
|
309
|
+
kpEnter: 57414, // Numpad Enter (Kitty protocol)
|
|
310
|
+
} as const;
|
|
311
|
+
|
|
312
|
+
const ARROW_CODEPOINTS = {
|
|
313
|
+
up: -1,
|
|
314
|
+
down: -2,
|
|
315
|
+
right: -3,
|
|
316
|
+
left: -4,
|
|
317
|
+
} as const;
|
|
318
|
+
|
|
319
|
+
const FUNCTIONAL_CODEPOINTS = {
|
|
320
|
+
delete: -10,
|
|
321
|
+
insert: -11,
|
|
322
|
+
pageUp: -12,
|
|
323
|
+
pageDown: -13,
|
|
324
|
+
home: -14,
|
|
325
|
+
end: -15,
|
|
326
|
+
} as const;
|
|
327
|
+
|
|
328
|
+
const LEGACY_KEY_SEQUENCES = {
|
|
329
|
+
up: ["\x1b[A", "\x1bOA"],
|
|
330
|
+
down: ["\x1b[B", "\x1bOB"],
|
|
331
|
+
right: ["\x1b[C", "\x1bOC"],
|
|
332
|
+
left: ["\x1b[D", "\x1bOD"],
|
|
333
|
+
home: ["\x1b[H", "\x1bOH", "\x1b[1~", "\x1b[7~"],
|
|
334
|
+
end: ["\x1b[F", "\x1bOF", "\x1b[4~", "\x1b[8~"],
|
|
335
|
+
insert: ["\x1b[2~"],
|
|
336
|
+
delete: ["\x1b[3~"],
|
|
337
|
+
pageUp: ["\x1b[5~", "\x1b[[5~"],
|
|
338
|
+
pageDown: ["\x1b[6~", "\x1b[[6~"],
|
|
339
|
+
clear: ["\x1b[E", "\x1bOE"],
|
|
340
|
+
f1: ["\x1bOP", "\x1b[11~", "\x1b[[A"],
|
|
341
|
+
f2: ["\x1bOQ", "\x1b[12~", "\x1b[[B"],
|
|
342
|
+
f3: ["\x1bOR", "\x1b[13~", "\x1b[[C"],
|
|
343
|
+
f4: ["\x1bOS", "\x1b[14~", "\x1b[[D"],
|
|
344
|
+
f5: ["\x1b[15~", "\x1b[[E"],
|
|
345
|
+
f6: ["\x1b[17~"],
|
|
346
|
+
f7: ["\x1b[18~"],
|
|
347
|
+
f8: ["\x1b[19~"],
|
|
348
|
+
f9: ["\x1b[20~"],
|
|
349
|
+
f10: ["\x1b[21~"],
|
|
350
|
+
f11: ["\x1b[23~"],
|
|
351
|
+
f12: ["\x1b[24~"],
|
|
352
|
+
} as const;
|
|
353
|
+
|
|
354
|
+
const LEGACY_SHIFT_SEQUENCES = {
|
|
355
|
+
up: ["\x1b[a"],
|
|
356
|
+
down: ["\x1b[b"],
|
|
357
|
+
right: ["\x1b[c"],
|
|
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",
|
|
441
|
+
} as const;
|
|
442
|
+
|
|
443
|
+
type LegacyModifierKey = keyof typeof LEGACY_SHIFT_SEQUENCES;
|
|
444
|
+
|
|
445
|
+
const matchesLegacySequence = (data: string, sequences: readonly string[]): boolean => sequences.includes(data);
|
|
446
|
+
|
|
447
|
+
const matchesLegacyModifierSequence = (data: string, key: LegacyModifierKey, modifier: number): boolean => {
|
|
448
|
+
if (modifier === MODIFIERS.shift) {
|
|
449
|
+
return matchesLegacySequence(data, LEGACY_SHIFT_SEQUENCES[key]);
|
|
450
|
+
}
|
|
451
|
+
if (modifier === MODIFIERS.ctrl) {
|
|
452
|
+
return matchesLegacySequence(data, LEGACY_CTRL_SEQUENCES[key]);
|
|
453
|
+
}
|
|
454
|
+
return false;
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
// =============================================================================
|
|
458
|
+
// Kitty Protocol Parsing
|
|
459
|
+
// =============================================================================
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Event types from Kitty keyboard protocol (flag 2)
|
|
463
|
+
* 1 = key press, 2 = key repeat, 3 = key release
|
|
464
|
+
*/
|
|
465
|
+
export type KeyEventType = "press" | "repeat" | "release";
|
|
466
|
+
|
|
467
|
+
interface ParsedKittySequence {
|
|
468
|
+
codepoint: number;
|
|
469
|
+
shiftedKey?: number; // Shifted version of the key (when shift is pressed)
|
|
470
|
+
baseLayoutKey?: number; // Key in standard PC-101 layout (for non-Latin layouts)
|
|
471
|
+
modifier: number;
|
|
472
|
+
eventType: KeyEventType;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
interface ParsedModifyOtherKeysSequence {
|
|
476
|
+
codepoint: number;
|
|
477
|
+
modifier: number;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Store the last parsed event type for isKeyRelease() to query
|
|
481
|
+
let _lastEventType: KeyEventType = "press";
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Check if the last parsed key event was a key release.
|
|
485
|
+
* Only meaningful when Kitty keyboard protocol with flag 2 is active.
|
|
486
|
+
*/
|
|
487
|
+
export function isKeyRelease(data: string): boolean {
|
|
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~.
|
|
492
|
+
if (data.includes("\x1b[200~")) {
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// Quick check: release events with flag 2 contain ":3"
|
|
497
|
+
// Format: \x1b[<codepoint>;<modifier>:3u
|
|
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;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Check if the last parsed key event was a key repeat.
|
|
515
|
+
* Only meaningful when Kitty keyboard protocol with flag 2 is active.
|
|
516
|
+
*/
|
|
517
|
+
export function isKeyRepeat(data: string): boolean {
|
|
518
|
+
// Don't treat bracketed paste content as key repeat, even if it contains
|
|
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;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function parseEventType(eventTypeStr: string | undefined): KeyEventType {
|
|
540
|
+
if (!eventTypeStr) return "press";
|
|
541
|
+
const eventType = parseInt(eventTypeStr, 10);
|
|
542
|
+
if (eventType === 2) return "repeat";
|
|
543
|
+
if (eventType === 3) return "release";
|
|
544
|
+
return "press";
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
function parseKittySequence(data: string): ParsedKittySequence | null {
|
|
548
|
+
// CSI u format with alternate keys (flag 4):
|
|
549
|
+
// \x1b[<codepoint>u
|
|
550
|
+
// \x1b[<codepoint>;<mod>u
|
|
551
|
+
// \x1b[<codepoint>;<mod>:<event>u
|
|
552
|
+
// \x1b[<codepoint>:<shifted>;<mod>u
|
|
553
|
+
// \x1b[<codepoint>:<shifted>:<base>;<mod>u
|
|
554
|
+
// \x1b[<codepoint>::<base>;<mod>u (no shifted key, only base)
|
|
555
|
+
//
|
|
556
|
+
// With flag 2, event type is appended after modifier colon: 1=press, 2=repeat, 3=release
|
|
557
|
+
// With flag 4, alternate keys are appended after codepoint with colons
|
|
558
|
+
const csiUMatch = data.match(/^\x1b\[(\d+)(?::(\d*))?(?::(\d+))?(?:;(\d+))?(?::(\d+))?u$/);
|
|
559
|
+
if (csiUMatch) {
|
|
560
|
+
const codepoint = parseInt(csiUMatch[1]!, 10);
|
|
561
|
+
const shiftedKey = csiUMatch[2] && csiUMatch[2].length > 0 ? parseInt(csiUMatch[2], 10) : undefined;
|
|
562
|
+
const baseLayoutKey = csiUMatch[3] ? parseInt(csiUMatch[3], 10) : undefined;
|
|
563
|
+
const modValue = csiUMatch[4] ? parseInt(csiUMatch[4], 10) : 1;
|
|
564
|
+
const eventType = parseEventType(csiUMatch[5]);
|
|
565
|
+
_lastEventType = eventType;
|
|
566
|
+
return { codepoint, shiftedKey, baseLayoutKey, modifier: modValue - 1, eventType };
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// Arrow keys with modifier: \x1b[1;<mod>A/B/C/D or \x1b[1;<mod>:<event>A/B/C/D
|
|
570
|
+
const arrowMatch = data.match(/^\x1b\[1;(\d+)(?::(\d+))?([ABCD])$/);
|
|
571
|
+
if (arrowMatch) {
|
|
572
|
+
const modValue = parseInt(arrowMatch[1]!, 10);
|
|
573
|
+
const eventType = parseEventType(arrowMatch[2]);
|
|
574
|
+
const arrowCodes: Record<string, number> = { A: -1, B: -2, C: -3, D: -4 };
|
|
575
|
+
_lastEventType = eventType;
|
|
576
|
+
return { codepoint: arrowCodes[arrowMatch[3]!]!, modifier: modValue - 1, eventType };
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// Functional keys: \x1b[<num>~ or \x1b[<num>;<mod>~ or \x1b[<num>;<mod>:<event>~
|
|
580
|
+
const funcMatch = data.match(/^\x1b\[(\d+)(?:;(\d+))?(?::(\d+))?~$/);
|
|
581
|
+
if (funcMatch) {
|
|
582
|
+
const keyNum = parseInt(funcMatch[1]!, 10);
|
|
583
|
+
const modValue = funcMatch[2] ? parseInt(funcMatch[2], 10) : 1;
|
|
584
|
+
const eventType = parseEventType(funcMatch[3]);
|
|
585
|
+
const funcCodes: Record<number, number> = {
|
|
586
|
+
2: FUNCTIONAL_CODEPOINTS.insert,
|
|
587
|
+
3: FUNCTIONAL_CODEPOINTS.delete,
|
|
588
|
+
5: FUNCTIONAL_CODEPOINTS.pageUp,
|
|
589
|
+
6: FUNCTIONAL_CODEPOINTS.pageDown,
|
|
590
|
+
7: FUNCTIONAL_CODEPOINTS.home,
|
|
591
|
+
8: FUNCTIONAL_CODEPOINTS.end,
|
|
592
|
+
};
|
|
593
|
+
const codepoint = funcCodes[keyNum];
|
|
594
|
+
if (codepoint !== undefined) {
|
|
595
|
+
_lastEventType = eventType;
|
|
596
|
+
return { codepoint, modifier: modValue - 1, eventType };
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// Home/End with modifier: \x1b[1;<mod>H/F or \x1b[1;<mod>:<event>H/F
|
|
601
|
+
const homeEndMatch = data.match(/^\x1b\[1;(\d+)(?::(\d+))?([HF])$/);
|
|
602
|
+
if (homeEndMatch) {
|
|
603
|
+
const modValue = parseInt(homeEndMatch[1]!, 10);
|
|
604
|
+
const eventType = parseEventType(homeEndMatch[2]);
|
|
605
|
+
const codepoint = homeEndMatch[3] === "H" ? FUNCTIONAL_CODEPOINTS.home : FUNCTIONAL_CODEPOINTS.end;
|
|
606
|
+
_lastEventType = eventType;
|
|
607
|
+
return { codepoint, modifier: modValue - 1, eventType };
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
return null;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
function matchesKittySequence(data: string, expectedCodepoint: number, expectedModifier: number): boolean {
|
|
614
|
+
const parsed = parseKittySequence(data);
|
|
615
|
+
if (!parsed) return false;
|
|
616
|
+
const actualMod = parsed.modifier & ~LOCK_MASK;
|
|
617
|
+
const expectedMod = expectedModifier & ~LOCK_MASK;
|
|
618
|
+
|
|
619
|
+
// Check if modifiers match
|
|
620
|
+
if (actualMod !== expectedMod) return false;
|
|
621
|
+
|
|
622
|
+
// Primary match: codepoint matches directly
|
|
623
|
+
if (parsed.codepoint === expectedCodepoint) return true;
|
|
624
|
+
|
|
625
|
+
// Alternate match: use base layout key for non-Latin keyboard layouts.
|
|
626
|
+
// This allows Ctrl+С (Cyrillic) to match Ctrl+c (Latin) when terminal reports
|
|
627
|
+
// the base layout key (the key in standard PC-101 layout).
|
|
628
|
+
//
|
|
629
|
+
// Only fall back to base layout key when the codepoint is NOT already a
|
|
630
|
+
// recognized Latin letter (a-z) or symbol (e.g., /, -, [, ;, etc.).
|
|
631
|
+
// When the codepoint is a recognized key, it is authoritative regardless
|
|
632
|
+
// of physical key position. This prevents remapped layouts (Dvorak, Colemak,
|
|
633
|
+
// xremap, etc.) from causing false matches: both letters and symbols move
|
|
634
|
+
// to different physical positions, so Ctrl+K could falsely match Ctrl+V
|
|
635
|
+
// (letter remapping) and Ctrl+/ could falsely match Ctrl+[ (symbol remapping)
|
|
636
|
+
// if the base layout key were always considered.
|
|
637
|
+
if (parsed.baseLayoutKey !== undefined && parsed.baseLayoutKey === expectedCodepoint) {
|
|
638
|
+
const cp = parsed.codepoint;
|
|
639
|
+
const isLatinLetter = cp >= 97 && cp <= 122; // a-z
|
|
640
|
+
const isKnownSymbol = SYMBOL_KEYS.has(String.fromCharCode(cp));
|
|
641
|
+
if (!isLatinLetter && !isKnownSymbol) return true;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
function parseModifyOtherKeysSequence(data: string): ParsedModifyOtherKeysSequence | null {
|
|
648
|
+
const match = data.match(/^\x1b\[27;(\d+);(\d+)~$/);
|
|
649
|
+
if (!match) return null;
|
|
650
|
+
const modValue = parseInt(match[1]!, 10);
|
|
651
|
+
const codepoint = parseInt(match[2]!, 10);
|
|
652
|
+
return { codepoint, modifier: modValue - 1 };
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Match xterm modifyOtherKeys format: CSI 27 ; modifiers ; keycode ~
|
|
657
|
+
* This is used by terminals when Kitty protocol is not enabled.
|
|
658
|
+
* Modifier values are 1-indexed: 2=shift, 3=alt, 5=ctrl, etc.
|
|
659
|
+
*/
|
|
660
|
+
function matchesModifyOtherKeys(data: string, expectedKeycode: number, expectedModifier: number): boolean {
|
|
661
|
+
const parsed = parseModifyOtherKeysSequence(data);
|
|
662
|
+
if (!parsed) return false;
|
|
663
|
+
return parsed.codepoint === expectedKeycode && parsed.modifier === expectedModifier;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// =============================================================================
|
|
667
|
+
// Generic Key Matching
|
|
668
|
+
// =============================================================================
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Get the control character for a key.
|
|
672
|
+
* Uses the universal formula: code & 0x1f (mask to lower 5 bits)
|
|
673
|
+
*
|
|
674
|
+
* Works for:
|
|
675
|
+
* - Letters a-z → 1-26
|
|
676
|
+
* - Symbols [\]_ → 27, 28, 29, 31
|
|
677
|
+
* - Also maps - to same as _ (same physical key on US keyboards)
|
|
678
|
+
*/
|
|
679
|
+
function rawCtrlChar(key: string): string | null {
|
|
680
|
+
const char = key.toLowerCase();
|
|
681
|
+
const code = char.charCodeAt(0);
|
|
682
|
+
if ((code >= 97 && code <= 122) || char === "[" || char === "\\" || char === "]" || char === "_") {
|
|
683
|
+
return String.fromCharCode(code & 0x1f);
|
|
684
|
+
}
|
|
685
|
+
// Handle - as _ (same physical key on US keyboards)
|
|
686
|
+
if (char === "-") {
|
|
687
|
+
return String.fromCharCode(31); // Same as Ctrl+_
|
|
688
|
+
}
|
|
689
|
+
return null;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function isDigitKey(key: string): boolean {
|
|
693
|
+
return key >= "0" && key <= "9";
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
function matchesPrintableModifyOtherKeys(data: string, expectedKeycode: number, expectedModifier: number): boolean {
|
|
697
|
+
if (expectedModifier === 0) return false;
|
|
698
|
+
return matchesModifyOtherKeys(data, expectedKeycode, expectedModifier);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function formatKeyNameWithModifiers(keyName: string, modifier: number): string | undefined {
|
|
702
|
+
const mods: string[] = [];
|
|
703
|
+
const effectiveMod = modifier & ~LOCK_MASK;
|
|
704
|
+
const supportedModifierMask = MODIFIERS.shift | MODIFIERS.ctrl | MODIFIERS.alt;
|
|
705
|
+
if ((effectiveMod & ~supportedModifierMask) !== 0) return undefined;
|
|
706
|
+
if (effectiveMod & MODIFIERS.shift) mods.push("shift");
|
|
707
|
+
if (effectiveMod & MODIFIERS.ctrl) mods.push("ctrl");
|
|
708
|
+
if (effectiveMod & MODIFIERS.alt) mods.push("alt");
|
|
709
|
+
return mods.length > 0 ? `${mods.join("+")}+${keyName}` : keyName;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
function parseKeyId(keyId: string): { key: string; ctrl: boolean; shift: boolean; alt: boolean } | null {
|
|
713
|
+
const parts = keyId.toLowerCase().split("+");
|
|
714
|
+
const key = parts[parts.length - 1];
|
|
715
|
+
if (!key) return null;
|
|
716
|
+
return {
|
|
717
|
+
key,
|
|
718
|
+
ctrl: parts.includes("ctrl"),
|
|
719
|
+
shift: parts.includes("shift"),
|
|
720
|
+
alt: parts.includes("alt"),
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Match input data against a key identifier string.
|
|
726
|
+
*
|
|
727
|
+
* Supported key identifiers:
|
|
728
|
+
* - Single keys: "escape", "tab", "enter", "backspace", "delete", "home", "end", "space"
|
|
729
|
+
* - Arrow keys: "up", "down", "left", "right"
|
|
730
|
+
* - Ctrl combinations: "ctrl+c", "ctrl+z", etc.
|
|
731
|
+
* - Shift combinations: "shift+tab", "shift+enter"
|
|
732
|
+
* - Alt combinations: "alt+enter", "alt+backspace"
|
|
733
|
+
* - Combined modifiers: "shift+ctrl+p", "ctrl+alt+x"
|
|
734
|
+
*
|
|
735
|
+
* Use the Key helper for autocomplete: Key.ctrl("c"), Key.escape, Key.ctrlShift("p")
|
|
736
|
+
*
|
|
737
|
+
* @param data - Raw input data from terminal
|
|
738
|
+
* @param keyId - Key identifier (e.g., "ctrl+c", "escape", Key.ctrl("c"))
|
|
739
|
+
*/
|
|
740
|
+
export function matchesKey(data: string, keyId: KeyId): boolean {
|
|
741
|
+
const parsed = parseKeyId(keyId);
|
|
742
|
+
if (!parsed) return false;
|
|
743
|
+
|
|
744
|
+
const { key, ctrl, shift, alt } = parsed;
|
|
745
|
+
let modifier = 0;
|
|
746
|
+
if (shift) modifier |= MODIFIERS.shift;
|
|
747
|
+
if (alt) modifier |= MODIFIERS.alt;
|
|
748
|
+
if (ctrl) modifier |= MODIFIERS.ctrl;
|
|
749
|
+
|
|
750
|
+
switch (key) {
|
|
751
|
+
case "escape":
|
|
752
|
+
case "esc":
|
|
753
|
+
if (modifier !== 0) return false;
|
|
754
|
+
return data === "\x1b" || matchesKittySequence(data, CODEPOINTS.escape, 0);
|
|
755
|
+
|
|
756
|
+
case "space":
|
|
757
|
+
if (!_kittyProtocolActive) {
|
|
758
|
+
if (ctrl && !alt && !shift && data === "\x00") {
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
761
|
+
if (alt && !ctrl && !shift && data === "\x1b ") {
|
|
762
|
+
return true;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
if (modifier === 0) {
|
|
766
|
+
return data === " " || matchesKittySequence(data, CODEPOINTS.space, 0);
|
|
767
|
+
}
|
|
768
|
+
return matchesKittySequence(data, CODEPOINTS.space, modifier);
|
|
769
|
+
|
|
770
|
+
case "tab":
|
|
771
|
+
if (shift && !ctrl && !alt) {
|
|
772
|
+
return data === "\x1b[Z" || matchesKittySequence(data, CODEPOINTS.tab, MODIFIERS.shift);
|
|
773
|
+
}
|
|
774
|
+
if (modifier === 0) {
|
|
775
|
+
return data === "\t" || matchesKittySequence(data, CODEPOINTS.tab, 0);
|
|
776
|
+
}
|
|
777
|
+
return matchesKittySequence(data, CODEPOINTS.tab, modifier);
|
|
778
|
+
|
|
779
|
+
case "enter":
|
|
780
|
+
case "return":
|
|
781
|
+
if (shift && !ctrl && !alt) {
|
|
782
|
+
// CSI u sequences (standard Kitty protocol)
|
|
783
|
+
if (
|
|
784
|
+
matchesKittySequence(data, CODEPOINTS.enter, MODIFIERS.shift) ||
|
|
785
|
+
matchesKittySequence(data, CODEPOINTS.kpEnter, MODIFIERS.shift)
|
|
786
|
+
) {
|
|
787
|
+
return true;
|
|
788
|
+
}
|
|
789
|
+
// xterm modifyOtherKeys format (fallback when Kitty protocol not enabled)
|
|
790
|
+
if (matchesModifyOtherKeys(data, CODEPOINTS.enter, MODIFIERS.shift)) {
|
|
791
|
+
return true;
|
|
792
|
+
}
|
|
793
|
+
// When Kitty protocol is active, legacy sequences are custom terminal mappings
|
|
794
|
+
// \x1b\r = Kitty's "map shift+enter send_text all \e\r"
|
|
795
|
+
// \n = Ghostty's "keybind = shift+enter=text:\n"
|
|
796
|
+
if (_kittyProtocolActive) {
|
|
797
|
+
return data === "\x1b\r" || data === "\n";
|
|
798
|
+
}
|
|
799
|
+
return false;
|
|
800
|
+
}
|
|
801
|
+
if (alt && !ctrl && !shift) {
|
|
802
|
+
// CSI u sequences (standard Kitty protocol)
|
|
803
|
+
if (
|
|
804
|
+
matchesKittySequence(data, CODEPOINTS.enter, MODIFIERS.alt) ||
|
|
805
|
+
matchesKittySequence(data, CODEPOINTS.kpEnter, MODIFIERS.alt)
|
|
806
|
+
) {
|
|
807
|
+
return true;
|
|
808
|
+
}
|
|
809
|
+
// xterm modifyOtherKeys format (fallback when Kitty protocol not enabled)
|
|
810
|
+
if (matchesModifyOtherKeys(data, CODEPOINTS.enter, MODIFIERS.alt)) {
|
|
811
|
+
return true;
|
|
812
|
+
}
|
|
813
|
+
// \x1b\r is alt+enter only in legacy mode (no Kitty protocol)
|
|
814
|
+
// When Kitty protocol is active, alt+enter comes as CSI u sequence
|
|
815
|
+
if (!_kittyProtocolActive) {
|
|
816
|
+
return data === "\x1b\r";
|
|
817
|
+
}
|
|
818
|
+
return false;
|
|
819
|
+
}
|
|
820
|
+
if (modifier === 0) {
|
|
821
|
+
return (
|
|
822
|
+
data === "\r" ||
|
|
823
|
+
(!_kittyProtocolActive && data === "\n") ||
|
|
824
|
+
data === "\x1bOM" || // SS3 M (numpad enter in some terminals)
|
|
825
|
+
matchesKittySequence(data, CODEPOINTS.enter, 0) ||
|
|
826
|
+
matchesKittySequence(data, CODEPOINTS.kpEnter, 0)
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
return (
|
|
830
|
+
matchesKittySequence(data, CODEPOINTS.enter, modifier) ||
|
|
831
|
+
matchesKittySequence(data, CODEPOINTS.kpEnter, modifier) ||
|
|
832
|
+
matchesModifyOtherKeys(data, CODEPOINTS.enter, modifier)
|
|
833
|
+
);
|
|
834
|
+
|
|
835
|
+
case "backspace":
|
|
836
|
+
if (alt && !ctrl && !shift) {
|
|
837
|
+
if (data === "\x1b\x7f" || data === "\x1b\b") {
|
|
838
|
+
return true;
|
|
839
|
+
}
|
|
840
|
+
return matchesKittySequence(data, CODEPOINTS.backspace, MODIFIERS.alt);
|
|
841
|
+
}
|
|
842
|
+
if (modifier === 0) {
|
|
843
|
+
return data === "\x7f" || data === "\x08" || matchesKittySequence(data, CODEPOINTS.backspace, 0);
|
|
844
|
+
}
|
|
845
|
+
return matchesKittySequence(data, CODEPOINTS.backspace, modifier);
|
|
846
|
+
|
|
847
|
+
case "insert":
|
|
848
|
+
if (modifier === 0) {
|
|
849
|
+
return (
|
|
850
|
+
matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.insert) ||
|
|
851
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.insert, 0)
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
if (matchesLegacyModifierSequence(data, "insert", modifier)) {
|
|
855
|
+
return true;
|
|
856
|
+
}
|
|
857
|
+
return matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.insert, modifier);
|
|
858
|
+
|
|
859
|
+
case "delete":
|
|
860
|
+
if (modifier === 0) {
|
|
861
|
+
return (
|
|
862
|
+
matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.delete) ||
|
|
863
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.delete, 0)
|
|
864
|
+
);
|
|
865
|
+
}
|
|
866
|
+
if (matchesLegacyModifierSequence(data, "delete", modifier)) {
|
|
867
|
+
return true;
|
|
868
|
+
}
|
|
869
|
+
return matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.delete, modifier);
|
|
870
|
+
|
|
871
|
+
case "clear":
|
|
872
|
+
if (modifier === 0) {
|
|
873
|
+
return matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.clear);
|
|
874
|
+
}
|
|
875
|
+
return matchesLegacyModifierSequence(data, "clear", modifier);
|
|
876
|
+
|
|
877
|
+
case "home":
|
|
878
|
+
if (modifier === 0) {
|
|
879
|
+
return (
|
|
880
|
+
matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.home) ||
|
|
881
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.home, 0)
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
if (matchesLegacyModifierSequence(data, "home", modifier)) {
|
|
885
|
+
return true;
|
|
886
|
+
}
|
|
887
|
+
return matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.home, modifier);
|
|
888
|
+
|
|
889
|
+
case "end":
|
|
890
|
+
if (modifier === 0) {
|
|
891
|
+
return (
|
|
892
|
+
matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.end) ||
|
|
893
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.end, 0)
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
if (matchesLegacyModifierSequence(data, "end", modifier)) {
|
|
897
|
+
return true;
|
|
898
|
+
}
|
|
899
|
+
return matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.end, modifier);
|
|
900
|
+
|
|
901
|
+
case "pageup":
|
|
902
|
+
if (modifier === 0) {
|
|
903
|
+
return (
|
|
904
|
+
matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.pageUp) ||
|
|
905
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.pageUp, 0)
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
if (matchesLegacyModifierSequence(data, "pageUp", modifier)) {
|
|
909
|
+
return true;
|
|
910
|
+
}
|
|
911
|
+
return matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.pageUp, modifier);
|
|
912
|
+
|
|
913
|
+
case "pagedown":
|
|
914
|
+
if (modifier === 0) {
|
|
915
|
+
return (
|
|
916
|
+
matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.pageDown) ||
|
|
917
|
+
matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.pageDown, 0)
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
if (matchesLegacyModifierSequence(data, "pageDown", modifier)) {
|
|
921
|
+
return true;
|
|
922
|
+
}
|
|
923
|
+
return matchesKittySequence(data, FUNCTIONAL_CODEPOINTS.pageDown, modifier);
|
|
924
|
+
|
|
925
|
+
case "up":
|
|
926
|
+
if (alt && !ctrl && !shift) {
|
|
927
|
+
return data === "\x1bp" || matchesKittySequence(data, ARROW_CODEPOINTS.up, MODIFIERS.alt);
|
|
928
|
+
}
|
|
929
|
+
if (modifier === 0) {
|
|
930
|
+
return (
|
|
931
|
+
matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.up) ||
|
|
932
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.up, 0)
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
if (matchesLegacyModifierSequence(data, "up", modifier)) {
|
|
936
|
+
return true;
|
|
937
|
+
}
|
|
938
|
+
return matchesKittySequence(data, ARROW_CODEPOINTS.up, modifier);
|
|
939
|
+
|
|
940
|
+
case "down":
|
|
941
|
+
if (alt && !ctrl && !shift) {
|
|
942
|
+
return data === "\x1bn" || matchesKittySequence(data, ARROW_CODEPOINTS.down, MODIFIERS.alt);
|
|
943
|
+
}
|
|
944
|
+
if (modifier === 0) {
|
|
945
|
+
return (
|
|
946
|
+
matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.down) ||
|
|
947
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.down, 0)
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
if (matchesLegacyModifierSequence(data, "down", modifier)) {
|
|
951
|
+
return true;
|
|
952
|
+
}
|
|
953
|
+
return matchesKittySequence(data, ARROW_CODEPOINTS.down, modifier);
|
|
954
|
+
|
|
955
|
+
case "left":
|
|
956
|
+
if (alt && !ctrl && !shift) {
|
|
957
|
+
return (
|
|
958
|
+
data === "\x1b[1;3D" ||
|
|
959
|
+
(!_kittyProtocolActive && data === "\x1bB") ||
|
|
960
|
+
data === "\x1bb" ||
|
|
961
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.left, MODIFIERS.alt)
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
if (ctrl && !alt && !shift) {
|
|
965
|
+
return (
|
|
966
|
+
data === "\x1b[1;5D" ||
|
|
967
|
+
matchesLegacyModifierSequence(data, "left", MODIFIERS.ctrl) ||
|
|
968
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.left, MODIFIERS.ctrl)
|
|
969
|
+
);
|
|
970
|
+
}
|
|
971
|
+
if (modifier === 0) {
|
|
972
|
+
return (
|
|
973
|
+
matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.left) ||
|
|
974
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.left, 0)
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
if (matchesLegacyModifierSequence(data, "left", modifier)) {
|
|
978
|
+
return true;
|
|
979
|
+
}
|
|
980
|
+
return matchesKittySequence(data, ARROW_CODEPOINTS.left, modifier);
|
|
981
|
+
|
|
982
|
+
case "right":
|
|
983
|
+
if (alt && !ctrl && !shift) {
|
|
984
|
+
return (
|
|
985
|
+
data === "\x1b[1;3C" ||
|
|
986
|
+
(!_kittyProtocolActive && data === "\x1bF") ||
|
|
987
|
+
data === "\x1bf" ||
|
|
988
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.right, MODIFIERS.alt)
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
if (ctrl && !alt && !shift) {
|
|
992
|
+
return (
|
|
993
|
+
data === "\x1b[1;5C" ||
|
|
994
|
+
matchesLegacyModifierSequence(data, "right", MODIFIERS.ctrl) ||
|
|
995
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.right, MODIFIERS.ctrl)
|
|
996
|
+
);
|
|
997
|
+
}
|
|
998
|
+
if (modifier === 0) {
|
|
999
|
+
return (
|
|
1000
|
+
matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.right) ||
|
|
1001
|
+
matchesKittySequence(data, ARROW_CODEPOINTS.right, 0)
|
|
1002
|
+
);
|
|
1003
|
+
}
|
|
1004
|
+
if (matchesLegacyModifierSequence(data, "right", modifier)) {
|
|
1005
|
+
return true;
|
|
1006
|
+
}
|
|
1007
|
+
return matchesKittySequence(data, ARROW_CODEPOINTS.right, modifier);
|
|
1008
|
+
|
|
1009
|
+
case "f1":
|
|
1010
|
+
case "f2":
|
|
1011
|
+
case "f3":
|
|
1012
|
+
case "f4":
|
|
1013
|
+
case "f5":
|
|
1014
|
+
case "f6":
|
|
1015
|
+
case "f7":
|
|
1016
|
+
case "f8":
|
|
1017
|
+
case "f9":
|
|
1018
|
+
case "f10":
|
|
1019
|
+
case "f11":
|
|
1020
|
+
case "f12": {
|
|
1021
|
+
if (modifier !== 0) {
|
|
1022
|
+
return false;
|
|
1023
|
+
}
|
|
1024
|
+
const functionKey = key as keyof typeof LEGACY_KEY_SEQUENCES;
|
|
1025
|
+
return matchesLegacySequence(data, LEGACY_KEY_SEQUENCES[functionKey]);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
// Handle single letter/digit keys and symbols
|
|
1030
|
+
if (key.length === 1 && ((key >= "a" && key <= "z") || isDigitKey(key) || SYMBOL_KEYS.has(key))) {
|
|
1031
|
+
const codepoint = key.charCodeAt(0);
|
|
1032
|
+
const rawCtrl = rawCtrlChar(key);
|
|
1033
|
+
const isLetter = key >= "a" && key <= "z";
|
|
1034
|
+
const isDigit = isDigitKey(key);
|
|
1035
|
+
|
|
1036
|
+
if (ctrl && alt && !shift && !_kittyProtocolActive && rawCtrl) {
|
|
1037
|
+
// Legacy: ctrl+alt+key is ESC followed by the control character
|
|
1038
|
+
return data === `\x1b${rawCtrl}`;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
if (alt && !ctrl && !shift && !_kittyProtocolActive && (isLetter || isDigit)) {
|
|
1042
|
+
// Legacy: alt+letter/digit is ESC followed by the key
|
|
1043
|
+
if (data === `\x1b${key}`) return true;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
if (ctrl && !shift && !alt) {
|
|
1047
|
+
// Legacy: ctrl+key sends the control character
|
|
1048
|
+
if (rawCtrl && data === rawCtrl) return true;
|
|
1049
|
+
return (
|
|
1050
|
+
matchesKittySequence(data, codepoint, MODIFIERS.ctrl) ||
|
|
1051
|
+
matchesPrintableModifyOtherKeys(data, codepoint, MODIFIERS.ctrl)
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
if (ctrl && shift && !alt) {
|
|
1056
|
+
return (
|
|
1057
|
+
matchesKittySequence(data, codepoint, MODIFIERS.shift + MODIFIERS.ctrl) ||
|
|
1058
|
+
matchesPrintableModifyOtherKeys(data, codepoint, MODIFIERS.shift + MODIFIERS.ctrl)
|
|
1059
|
+
);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
if (shift && !ctrl && !alt) {
|
|
1063
|
+
// Legacy: shift+letter produces uppercase
|
|
1064
|
+
if (isLetter && data === key.toUpperCase()) return true;
|
|
1065
|
+
return (
|
|
1066
|
+
matchesKittySequence(data, codepoint, MODIFIERS.shift) ||
|
|
1067
|
+
matchesPrintableModifyOtherKeys(data, codepoint, MODIFIERS.shift)
|
|
1068
|
+
);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
if (modifier !== 0) {
|
|
1072
|
+
return (
|
|
1073
|
+
matchesKittySequence(data, codepoint, modifier) ||
|
|
1074
|
+
matchesPrintableModifyOtherKeys(data, codepoint, modifier)
|
|
1075
|
+
);
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// Check both raw char and Kitty sequence (needed for release events)
|
|
1079
|
+
return data === key || matchesKittySequence(data, codepoint, 0);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
return false;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Parse input data and return the key identifier if recognized.
|
|
1087
|
+
*
|
|
1088
|
+
* @param data - Raw input data from terminal
|
|
1089
|
+
* @returns Key identifier string (e.g., "ctrl+c") or undefined
|
|
1090
|
+
*/
|
|
1091
|
+
function formatParsedKey(codepoint: number, modifier: number, baseLayoutKey?: number): string | undefined {
|
|
1092
|
+
// Use base layout key only when codepoint is not a recognized Latin
|
|
1093
|
+
// letter (a-z), digit (0-9), or symbol (/, -, [, ;, etc.). For those,
|
|
1094
|
+
// the codepoint is authoritative regardless of physical key position.
|
|
1095
|
+
// This prevents remapped layouts (Dvorak, Colemak, xremap, etc.) from
|
|
1096
|
+
// reporting the wrong key name based on the QWERTY physical position.
|
|
1097
|
+
const isLatinLetter = codepoint >= 97 && codepoint <= 122; // a-z
|
|
1098
|
+
const isDigit = codepoint >= 48 && codepoint <= 57; // 0-9
|
|
1099
|
+
const isKnownSymbol = SYMBOL_KEYS.has(String.fromCharCode(codepoint));
|
|
1100
|
+
const effectiveCodepoint = isLatinLetter || isDigit || isKnownSymbol ? codepoint : (baseLayoutKey ?? codepoint);
|
|
1101
|
+
|
|
1102
|
+
let keyName: string | undefined;
|
|
1103
|
+
if (effectiveCodepoint === CODEPOINTS.escape) keyName = "escape";
|
|
1104
|
+
else if (effectiveCodepoint === CODEPOINTS.tab) keyName = "tab";
|
|
1105
|
+
else if (effectiveCodepoint === CODEPOINTS.enter || effectiveCodepoint === CODEPOINTS.kpEnter) keyName = "enter";
|
|
1106
|
+
else if (effectiveCodepoint === CODEPOINTS.space) keyName = "space";
|
|
1107
|
+
else if (effectiveCodepoint === CODEPOINTS.backspace) keyName = "backspace";
|
|
1108
|
+
else if (effectiveCodepoint === FUNCTIONAL_CODEPOINTS.delete) keyName = "delete";
|
|
1109
|
+
else if (effectiveCodepoint === FUNCTIONAL_CODEPOINTS.insert) keyName = "insert";
|
|
1110
|
+
else if (effectiveCodepoint === FUNCTIONAL_CODEPOINTS.home) keyName = "home";
|
|
1111
|
+
else if (effectiveCodepoint === FUNCTIONAL_CODEPOINTS.end) keyName = "end";
|
|
1112
|
+
else if (effectiveCodepoint === FUNCTIONAL_CODEPOINTS.pageUp) keyName = "pageUp";
|
|
1113
|
+
else if (effectiveCodepoint === FUNCTIONAL_CODEPOINTS.pageDown) keyName = "pageDown";
|
|
1114
|
+
else if (effectiveCodepoint === ARROW_CODEPOINTS.up) keyName = "up";
|
|
1115
|
+
else if (effectiveCodepoint === ARROW_CODEPOINTS.down) keyName = "down";
|
|
1116
|
+
else if (effectiveCodepoint === ARROW_CODEPOINTS.left) keyName = "left";
|
|
1117
|
+
else if (effectiveCodepoint === ARROW_CODEPOINTS.right) keyName = "right";
|
|
1118
|
+
else if (effectiveCodepoint >= 48 && effectiveCodepoint <= 57) keyName = String.fromCharCode(effectiveCodepoint);
|
|
1119
|
+
else if (effectiveCodepoint >= 97 && effectiveCodepoint <= 122) keyName = String.fromCharCode(effectiveCodepoint);
|
|
1120
|
+
else if (SYMBOL_KEYS.has(String.fromCharCode(effectiveCodepoint))) keyName = String.fromCharCode(effectiveCodepoint);
|
|
1121
|
+
|
|
1122
|
+
if (!keyName) return undefined;
|
|
1123
|
+
return formatKeyNameWithModifiers(keyName, modifier);
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
export function parseKey(data: string): string | undefined {
|
|
1127
|
+
const kitty = parseKittySequence(data);
|
|
1128
|
+
if (kitty) {
|
|
1129
|
+
return formatParsedKey(kitty.codepoint, kitty.modifier, kitty.baseLayoutKey);
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
const modifyOtherKeys = parseModifyOtherKeysSequence(data);
|
|
1133
|
+
if (modifyOtherKeys) {
|
|
1134
|
+
return formatParsedKey(modifyOtherKeys.codepoint, modifyOtherKeys.modifier);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// Mode-aware legacy sequences
|
|
1138
|
+
// When Kitty protocol is active, ambiguous sequences are interpreted as custom terminal mappings:
|
|
1139
|
+
// - \x1b\r = shift+enter (Kitty mapping), not alt+enter
|
|
1140
|
+
// - \n = shift+enter (Ghostty mapping)
|
|
1141
|
+
if (_kittyProtocolActive) {
|
|
1142
|
+
if (data === "\x1b\r" || data === "\n") return "shift+enter";
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
const legacySequenceKeyId = LEGACY_SEQUENCE_KEY_IDS[data];
|
|
1146
|
+
if (legacySequenceKeyId) return legacySequenceKeyId;
|
|
1147
|
+
|
|
1148
|
+
// Legacy sequences (used when Kitty protocol is not active, or for unambiguous sequences)
|
|
1149
|
+
if (data === "\x1b") return "escape";
|
|
1150
|
+
if (data === "\x1c") return "ctrl+\\";
|
|
1151
|
+
if (data === "\x1d") return "ctrl+]";
|
|
1152
|
+
if (data === "\x1f") return "ctrl+-";
|
|
1153
|
+
if (data === "\x1b\x1b") return "ctrl+alt+[";
|
|
1154
|
+
if (data === "\x1b\x1c") return "ctrl+alt+\\";
|
|
1155
|
+
if (data === "\x1b\x1d") return "ctrl+alt+]";
|
|
1156
|
+
if (data === "\x1b\x1f") return "ctrl+alt+-";
|
|
1157
|
+
if (data === "\t") return "tab";
|
|
1158
|
+
if (data === "\r" || (!_kittyProtocolActive && data === "\n") || data === "\x1bOM") return "enter";
|
|
1159
|
+
if (data === "\x00") return "ctrl+space";
|
|
1160
|
+
if (data === " ") return "space";
|
|
1161
|
+
if (data === "\x7f" || data === "\x08") return "backspace";
|
|
1162
|
+
if (data === "\x1b[Z") return "shift+tab";
|
|
1163
|
+
if (!_kittyProtocolActive && data === "\x1b\r") return "alt+enter";
|
|
1164
|
+
if (!_kittyProtocolActive && data === "\x1b ") return "alt+space";
|
|
1165
|
+
if (data === "\x1b\x7f" || data === "\x1b\b") return "alt+backspace";
|
|
1166
|
+
if (!_kittyProtocolActive && data === "\x1bB") return "alt+left";
|
|
1167
|
+
if (!_kittyProtocolActive && data === "\x1bF") return "alt+right";
|
|
1168
|
+
if (!_kittyProtocolActive && data.length === 2 && data[0] === "\x1b") {
|
|
1169
|
+
const code = data.charCodeAt(1);
|
|
1170
|
+
if (code >= 1 && code <= 26) {
|
|
1171
|
+
return `ctrl+alt+${String.fromCharCode(code + 96)}`;
|
|
1172
|
+
}
|
|
1173
|
+
// Legacy alt+letter/digit (ESC followed by the key)
|
|
1174
|
+
if ((code >= 97 && code <= 122) || (code >= 48 && code <= 57)) {
|
|
1175
|
+
return `alt+${String.fromCharCode(code)}`;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
if (data === "\x1b[A") return "up";
|
|
1179
|
+
if (data === "\x1b[B") return "down";
|
|
1180
|
+
if (data === "\x1b[C") return "right";
|
|
1181
|
+
if (data === "\x1b[D") return "left";
|
|
1182
|
+
if (data === "\x1b[H" || data === "\x1bOH") return "home";
|
|
1183
|
+
if (data === "\x1b[F" || data === "\x1bOF") return "end";
|
|
1184
|
+
if (data === "\x1b[3~") return "delete";
|
|
1185
|
+
if (data === "\x1b[5~") return "pageUp";
|
|
1186
|
+
if (data === "\x1b[6~") return "pageDown";
|
|
1187
|
+
|
|
1188
|
+
// Raw Ctrl+letter
|
|
1189
|
+
if (data.length === 1) {
|
|
1190
|
+
const code = data.charCodeAt(0);
|
|
1191
|
+
if (code >= 1 && code <= 26) {
|
|
1192
|
+
return `ctrl+${String.fromCharCode(code + 96)}`;
|
|
1193
|
+
}
|
|
1194
|
+
if (code >= 32 && code <= 126) {
|
|
1195
|
+
return data;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
return undefined;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
// =============================================================================
|
|
1203
|
+
// Kitty CSI-u Printable Decoding
|
|
1204
|
+
// =============================================================================
|
|
1205
|
+
|
|
1206
|
+
const KITTY_CSI_U_REGEX = /^\x1b\[(\d+)(?::(\d*))?(?::(\d+))?(?:;(\d+))?(?::(\d+))?u$/;
|
|
1207
|
+
const KITTY_PRINTABLE_ALLOWED_MODIFIERS = MODIFIERS.shift | LOCK_MASK;
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* Decode a Kitty CSI-u sequence into a printable character, if applicable.
|
|
1211
|
+
*
|
|
1212
|
+
* When Kitty keyboard protocol flag 1 (disambiguate) is active, terminals send
|
|
1213
|
+
* CSI-u sequences for all keys, including plain printable characters. This
|
|
1214
|
+
* function extracts the printable character from such sequences.
|
|
1215
|
+
*
|
|
1216
|
+
* Only accepts plain or Shift-modified keys. Rejects Ctrl, Alt, and unsupported
|
|
1217
|
+
* modifier combinations (those are handled by keybinding matching instead).
|
|
1218
|
+
* Prefers the shifted keycode when Shift is held and a shifted key is reported.
|
|
1219
|
+
*
|
|
1220
|
+
* @param data - Raw input data from terminal
|
|
1221
|
+
* @returns The printable character, or undefined if not a printable CSI-u sequence
|
|
1222
|
+
*/
|
|
1223
|
+
export function decodeKittyPrintable(data: string): string | undefined {
|
|
1224
|
+
const match = data.match(KITTY_CSI_U_REGEX);
|
|
1225
|
+
if (!match) return undefined;
|
|
1226
|
+
|
|
1227
|
+
// CSI-u groups: <codepoint>[:<shifted>[:<base>]];<mod>[:<event>]u
|
|
1228
|
+
const codepoint = Number.parseInt(match[1] ?? "", 10);
|
|
1229
|
+
if (!Number.isFinite(codepoint)) return undefined;
|
|
1230
|
+
|
|
1231
|
+
const shiftedKey = match[2] && match[2].length > 0 ? Number.parseInt(match[2], 10) : undefined;
|
|
1232
|
+
const modValue = match[4] ? Number.parseInt(match[4], 10) : 1;
|
|
1233
|
+
// Modifiers are 1-indexed in CSI-u; normalize to our bitmask.
|
|
1234
|
+
const modifier = Number.isFinite(modValue) ? modValue - 1 : 0;
|
|
1235
|
+
|
|
1236
|
+
// Only accept printable CSI-u input for plain or Shift-modified text keys.
|
|
1237
|
+
// Reject unsupported modifier bits (e.g. Super/Meta) to avoid inserting
|
|
1238
|
+
// characters from modifier-only terminal events.
|
|
1239
|
+
if ((modifier & ~KITTY_PRINTABLE_ALLOWED_MODIFIERS) !== 0) return undefined;
|
|
1240
|
+
if (modifier & (MODIFIERS.alt | MODIFIERS.ctrl)) return undefined;
|
|
1241
|
+
|
|
1242
|
+
// Prefer the shifted keycode when Shift is held.
|
|
1243
|
+
let effectiveCodepoint = codepoint;
|
|
1244
|
+
if (modifier & MODIFIERS.shift && typeof shiftedKey === "number") {
|
|
1245
|
+
effectiveCodepoint = shiftedKey;
|
|
1246
|
+
}
|
|
1247
|
+
// Drop control characters or invalid codepoints.
|
|
1248
|
+
if (!Number.isFinite(effectiveCodepoint) || effectiveCodepoint < 32) return undefined;
|
|
1249
|
+
|
|
1250
|
+
try {
|
|
1251
|
+
return String.fromCodePoint(effectiveCodepoint);
|
|
1252
|
+
} catch {
|
|
1253
|
+
return undefined;
|
|
1254
|
+
}
|
|
1255
|
+
}
|