indusagi 0.12.32 → 0.12.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +340 -0
- package/CREDITS.md +22 -0
- package/NOTICE +17 -0
- package/README.md +47 -388
- package/dist/agent.js +27512 -0
- package/dist/ai.js +19758 -0
- package/dist/capabilities.js +2663 -0
- package/dist/cli.js +11653 -0
- package/dist/connectors-saas.js +3289 -0
- package/dist/index.js +16533 -0
- package/dist/interop.js +3181 -0
- package/dist/knowledge/guides/authoring-an-agent.md +53 -0
- package/dist/knowledge/guides/choosing-tools.md +49 -0
- package/dist/knowledge/guides/model-selection.md +51 -0
- package/dist/knowledge/guides/writing-system-prompts.md +53 -0
- package/dist/knowledge/index.ts +19 -0
- package/dist/knowledge/loader.ts +200 -0
- package/dist/knowledge/manifest.json +29 -0
- package/dist/llmgateway.js +3209 -0
- package/dist/mcp.js +1732 -0
- package/dist/memory.js +0 -0
- package/dist/react-host/index.js +101 -0
- package/dist/react-host/ink.js +97 -0
- package/dist/react-host/jsx-runtime.js +95 -0
- package/dist/react-ink.js +3821 -0
- package/dist/runtime.js +4387 -0
- package/dist/shell-app.js +12222 -0
- package/dist/smithy.js +7932 -0
- package/dist/swarm.js +8717 -0
- package/dist/tracing.js +724 -0
- package/dist/tui.js +2213 -0
- package/dist/types/capabilities/backends/index.d.ts +10 -0
- package/dist/types/capabilities/backends/node-backends.d.ts +28 -0
- package/dist/types/capabilities/capabilities.test.d.ts +14 -0
- package/dist/types/capabilities/files/diff.d.ts +49 -0
- package/dist/types/capabilities/files/edit.d.ts +21 -0
- package/dist/types/capabilities/files/ls.d.ts +16 -0
- package/dist/types/capabilities/files/read.d.ts +15 -0
- package/dist/types/capabilities/files/write.d.ts +16 -0
- package/dist/types/capabilities/index.d.ts +29 -0
- package/dist/types/capabilities/kernel/backends.d.ts +119 -0
- package/dist/types/capabilities/kernel/context.d.ts +48 -0
- package/dist/types/capabilities/kernel/index.d.ts +24 -0
- package/dist/types/capabilities/kernel/output.d.ts +40 -0
- package/dist/types/capabilities/kernel/registry.d.ts +61 -0
- package/dist/types/capabilities/kernel/spec.d.ts +113 -0
- package/dist/types/capabilities/planning/todo.d.ts +62 -0
- package/dist/types/capabilities/registry.d.ts +44 -0
- package/dist/types/capabilities/search/find.d.ts +33 -0
- package/dist/types/capabilities/search/grep.d.ts +30 -0
- package/dist/types/capabilities/shell/bash.d.ts +18 -0
- package/dist/types/capabilities/shell/process.d.ts +33 -0
- package/dist/types/capabilities/web/webfetch.d.ts +25 -0
- package/dist/types/capabilities/web/websearch.d.ts +23 -0
- package/dist/types/connectors-saas/connectors-saas.test.d.ts +12 -0
- package/dist/types/connectors-saas/index.d.ts +16 -0
- package/dist/types/connectors-saas/saas/adapter/composio-backend.d.ts +60 -0
- package/dist/types/connectors-saas/saas/control/connect.d.ts +114 -0
- package/dist/types/connectors-saas/saas/control/tools.d.ts +67 -0
- package/dist/types/connectors-saas/saas/core/builder.d.ts +86 -0
- package/dist/types/connectors-saas/saas/core/cache.d.ts +53 -0
- package/dist/types/connectors-saas/saas/core/index.d.ts +14 -0
- package/dist/types/connectors-saas/saas/core/port.d.ts +157 -0
- package/dist/types/connectors-saas/saas/core/scope-planner.d.ts +74 -0
- package/dist/types/connectors-saas/saas/gateway.d.ts +133 -0
- package/dist/types/connectors-saas/saas/render/format.d.ts +54 -0
- package/dist/types/connectors-saas/saas/render/index.d.ts +19 -0
- package/dist/types/connectors-saas/saas/render/summarizers.d.ts +58 -0
- package/dist/types/facade/agent.d.ts +1 -0
- package/dist/types/facade/ai.d.ts +1 -0
- package/dist/types/facade/bot/actions/bash.d.ts +56 -0
- package/dist/types/facade/bot/actions/composio/accounts.d.ts +22 -0
- package/dist/types/facade/bot/actions/composio/client.d.ts +39 -0
- package/dist/types/facade/bot/actions/composio/connect.d.ts +19 -0
- package/dist/types/facade/bot/actions/composio/enable.d.ts +25 -0
- package/dist/types/facade/bot/actions/composio/execute.d.ts +26 -0
- package/dist/types/facade/bot/actions/composio/helpers.d.ts +16 -0
- package/dist/types/facade/bot/actions/composio/index.d.ts +9 -0
- package/dist/types/facade/bot/actions/composio/provider.d.ts +8 -0
- package/dist/types/facade/bot/actions/composio/toolkits.d.ts +22 -0
- package/dist/types/facade/bot/actions/composio/tools.d.ts +28 -0
- package/dist/types/facade/bot/actions/composio/types.d.ts +137 -0
- package/dist/types/facade/bot/actions/crew/activity-tracker.d.ts +65 -0
- package/dist/types/facade/bot/actions/crew/cleanup.d.ts +50 -0
- package/dist/types/facade/bot/actions/crew/fs-lock.d.ts +11 -0
- package/dist/types/facade/bot/actions/crew/index.d.ts +11 -0
- package/dist/types/facade/bot/actions/crew/mailbox.d.ts +20 -0
- package/dist/types/facade/bot/actions/crew/model-policy.d.ts +22 -0
- package/dist/types/facade/bot/actions/crew/names.d.ts +27 -0
- package/dist/types/facade/bot/actions/crew/protocol.d.ts +74 -0
- package/dist/types/facade/bot/actions/crew/task-store.d.ts +88 -0
- package/dist/types/facade/bot/actions/crew/team-attach-claim.d.ts +35 -0
- package/dist/types/facade/bot/actions/crew/team-config.d.ts +54 -0
- package/dist/types/facade/bot/actions/crew/worktree.d.ts +39 -0
- package/dist/types/facade/bot/actions/edit-diff.d.ts +66 -0
- package/dist/types/facade/bot/actions/edit.d.ts +41 -0
- package/dist/types/facade/bot/actions/find.d.ts +25 -0
- package/dist/types/facade/bot/actions/grep.d.ts +43 -0
- package/dist/types/facade/bot/actions/index.d.ts +300 -0
- package/dist/types/facade/bot/actions/kit/hook-runner.d.ts +12 -0
- package/dist/types/facade/bot/actions/kit/image-resize.d.ts +19 -0
- package/dist/types/facade/bot/actions/kit/mime.d.ts +1 -0
- package/dist/types/facade/bot/actions/kit/shell.d.ts +12 -0
- package/dist/types/facade/bot/actions/ls.d.ts +41 -0
- package/dist/types/facade/bot/actions/path-utils.d.ts +8 -0
- package/dist/types/facade/bot/actions/process-controller.d.ts +14 -0
- package/dist/types/facade/bot/actions/process-manager.d.ts +59 -0
- package/dist/types/facade/bot/actions/process-types.d.ts +73 -0
- package/dist/types/facade/bot/actions/process.d.ts +37 -0
- package/dist/types/facade/bot/actions/read.d.ts +36 -0
- package/dist/types/facade/bot/actions/registry.d.ts +20 -0
- package/dist/types/facade/bot/actions/todo-store.d.ts +76 -0
- package/dist/types/facade/bot/actions/todo-types.d.ts +72 -0
- package/dist/types/facade/bot/actions/todo.d.ts +76 -0
- package/dist/types/facade/bot/actions/truncate.d.ts +78 -0
- package/dist/types/facade/bot/actions/webfetch.d.ts +35 -0
- package/dist/types/facade/bot/actions/websearch.d.ts +34 -0
- package/dist/types/facade/bot/actions/write.d.ts +30 -0
- package/dist/types/facade/bot/agent-loop.d.ts +20 -0
- package/dist/types/facade/bot/agent.d.ts +132 -0
- package/dist/types/facade/bot/error-handler.d.ts +7 -0
- package/dist/types/facade/bot/event-bus.d.ts +8 -0
- package/dist/types/facade/bot/index.d.ts +7 -0
- package/dist/types/facade/bot/messages.d.ts +83 -0
- package/dist/types/facade/bot/proxy.d.ts +70 -0
- package/dist/types/facade/bot/session-manager.d.ts +409 -0
- package/dist/types/facade/bot/state-manager.d.ts +21 -0
- package/dist/types/facade/bot/telemetry.d.ts +6 -0
- package/dist/types/facade/bot/types.d.ts +207 -0
- package/dist/types/facade/mcp-core/client-pool.d.ts +105 -0
- package/dist/types/facade/mcp-core/client.d.ts +157 -0
- package/dist/types/facade/mcp-core/config.d.ts +60 -0
- package/dist/types/facade/mcp-core/errors.d.ts +103 -0
- package/dist/types/facade/mcp-core/index.d.ts +55 -0
- package/dist/types/facade/mcp-core/schema-converter.d.ts +67 -0
- package/dist/types/facade/mcp-core/server.d.ts +110 -0
- package/dist/types/facade/mcp-core/tool-factory.d.ts +62 -0
- package/dist/types/facade/mcp-core/types.d.ts +288 -0
- package/dist/types/facade/mcp.d.ts +1 -0
- package/dist/types/facade/memory.d.ts +1 -0
- package/dist/types/facade/ml/adapters/amazon-bedrock.d.ts +32 -0
- package/dist/types/facade/ml/adapters/anthropic.d.ts +61 -0
- package/dist/types/facade/ml/adapters/azure-openai-responses.d.ts +14 -0
- package/dist/types/facade/ml/adapters/google-shared.d.ts +99 -0
- package/dist/types/facade/ml/adapters/google-vertex.d.ts +14 -0
- package/dist/types/facade/ml/adapters/google.d.ts +15 -0
- package/dist/types/facade/ml/adapters/kimi.d.ts +21 -0
- package/dist/types/facade/ml/adapters/mock.d.ts +9 -0
- package/dist/types/facade/ml/adapters/nvidia.d.ts +12 -0
- package/dist/types/facade/ml/adapters/openai-codex-responses.d.ts +8 -0
- package/dist/types/facade/ml/adapters/openai-completions.d.ts +24 -0
- package/dist/types/facade/ml/adapters/openai-responses-shared.d.ts +25 -0
- package/dist/types/facade/ml/adapters/openai-responses.d.ts +12 -0
- package/dist/types/facade/ml/adapters/openai-scaffold.d.ts +3 -0
- package/dist/types/facade/ml/adapters/register-builtins.d.ts +2 -0
- package/dist/types/facade/ml/adapters/simple-options.d.ts +26 -0
- package/dist/types/facade/ml/adapters/transform-messages.d.ts +23 -0
- package/dist/types/facade/ml/api-registry.d.ts +49 -0
- package/dist/types/facade/ml/cli.d.ts +2 -0
- package/dist/types/facade/ml/env-api-keys.d.ts +19 -0
- package/dist/types/facade/ml/index.d.ts +27 -0
- package/dist/types/facade/ml/kit/auth/anthropic.d.ts +17 -0
- package/dist/types/facade/ml/kit/auth/github-copilot.d.ts +22 -0
- package/dist/types/facade/ml/kit/auth/index.d.ts +50 -0
- package/dist/types/facade/ml/kit/auth/kimi.d.ts +23 -0
- package/dist/types/facade/ml/kit/auth/oauth-page.d.ts +2 -0
- package/dist/types/facade/ml/kit/auth/openai-codex.d.ts +36 -0
- package/dist/types/facade/ml/kit/auth/pkce.d.ts +12 -0
- package/dist/types/facade/ml/kit/auth/types.d.ts +67 -0
- package/dist/types/facade/ml/kit/base-stream-handler.d.ts +30 -0
- package/dist/types/facade/ml/kit/event-stream.d.ts +63 -0
- package/dist/types/facade/ml/kit/index.d.ts +14 -0
- package/dist/types/facade/ml/kit/json-parse.d.ts +23 -0
- package/dist/types/facade/ml/kit/message-transform.d.ts +32 -0
- package/dist/types/facade/ml/kit/output-factory.d.ts +8 -0
- package/dist/types/facade/ml/kit/overflow.d.ts +9 -0
- package/dist/types/facade/ml/kit/provider-adapter.d.ts +56 -0
- package/dist/types/facade/ml/kit/provider-client-builder.d.ts +36 -0
- package/dist/types/facade/ml/kit/provider-consolidation.d.ts +3 -0
- package/dist/types/facade/ml/kit/provider-constants.d.ts +34 -0
- package/dist/types/facade/ml/kit/provider-errors.d.ts +52 -0
- package/dist/types/facade/ml/kit/sanitize-unicode.d.ts +2 -0
- package/dist/types/facade/ml/kit/stream-event-helper.d.ts +38 -0
- package/dist/types/facade/ml/kit/stream-handler-types.d.ts +46 -0
- package/dist/types/facade/ml/kit/streaming-state-manager.d.ts +42 -0
- package/dist/types/facade/ml/kit/tool-converter.d.ts +49 -0
- package/dist/types/facade/ml/kit/typebox-helpers.d.ts +24 -0
- package/dist/types/facade/ml/kit/validation.d.ts +26 -0
- package/dist/types/facade/ml/models.d.ts +41 -0
- package/dist/types/facade/ml/models.generated.d.ts +12261 -0
- package/dist/types/facade/ml/stream.d.ts +27 -0
- package/dist/types/facade/ml/types.d.ts +269 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/interop/index.d.ts +12 -0
- package/dist/types/interop/interop.test.d.ts +19 -0
- package/dist/types/interop/protocol-bridge/bridge.d.ts +52 -0
- package/dist/types/interop/protocol-bridge/contract.d.ts +249 -0
- package/dist/types/interop/protocol-bridge/endpoint.d.ts +124 -0
- package/dist/types/interop/protocol-bridge/fleet.d.ts +92 -0
- package/dist/types/interop/protocol-bridge/host.d.ts +61 -0
- package/dist/types/interop/protocol-bridge/index.d.ts +16 -0
- package/dist/types/interop/protocol-bridge/schema.d.ts +29 -0
- package/dist/types/llmgateway/catalog/cards.d.ts +18 -0
- package/dist/types/llmgateway/catalog/cost.d.ts +15 -0
- package/dist/types/llmgateway/catalog/index.d.ts +7 -0
- package/dist/types/llmgateway/catalog/query.d.ts +40 -0
- package/dist/types/llmgateway/connectors/anthropic.d.ts +35 -0
- package/dist/types/llmgateway/connectors/azure-openai.d.ts +33 -0
- package/dist/types/llmgateway/connectors/bedrock.d.ts +113 -0
- package/dist/types/llmgateway/connectors/google-vertex.d.ts +38 -0
- package/dist/types/llmgateway/connectors/google.d.ts +40 -0
- package/dist/types/llmgateway/connectors/index.d.ts +26 -0
- package/dist/types/llmgateway/connectors/kimi.d.ts +28 -0
- package/dist/types/llmgateway/connectors/mock.d.ts +37 -0
- package/dist/types/llmgateway/connectors/nvidia.d.ts +27 -0
- package/dist/types/llmgateway/connectors/ollama.d.ts +45 -0
- package/dist/types/llmgateway/connectors/openai-chat.d.ts +25 -0
- package/dist/types/llmgateway/connectors/openai-responses.d.ts +49 -0
- package/dist/types/llmgateway/contract/connector.d.ts +32 -0
- package/dist/types/llmgateway/contract/conversation.d.ts +86 -0
- package/dist/types/llmgateway/contract/emission.d.ts +55 -0
- package/dist/types/llmgateway/contract/errors.d.ts +27 -0
- package/dist/types/llmgateway/contract/index.d.ts +13 -0
- package/dist/types/llmgateway/contract/model-card.d.ts +42 -0
- package/dist/types/llmgateway/contract/options.d.ts +31 -0
- package/dist/types/llmgateway/contract/reply.d.ts +33 -0
- package/dist/types/llmgateway/conversion/index.d.ts +10 -0
- package/dist/types/llmgateway/conversion/mappers.d.ts +65 -0
- package/dist/types/llmgateway/conversion/openai-compatible.d.ts +46 -0
- package/dist/types/llmgateway/conversion/reduce.d.ts +20 -0
- package/dist/types/llmgateway/credentials/oauth.d.ts +73 -0
- package/dist/types/llmgateway/credentials/pkce.d.ts +52 -0
- package/dist/types/llmgateway/credentials/secrets.d.ts +74 -0
- package/dist/types/llmgateway/gateway.d.ts +34 -0
- package/dist/types/llmgateway/gateway.test.d.ts +14 -0
- package/dist/types/llmgateway/index.d.ts +11 -0
- package/dist/types/llmgateway/streaming/channel.d.ts +24 -0
- package/dist/types/llmgateway/streaming/index.d.ts +10 -0
- package/dist/types/llmgateway/streaming/ndjson.d.ts +17 -0
- package/dist/types/llmgateway/streaming/sse.d.ts +31 -0
- package/dist/types/react-host/index.d.ts +9 -0
- package/dist/types/react-host/ink.d.ts +5 -0
- package/dist/types/react-host/jsx-runtime.d.ts +4 -0
- package/dist/types/react-host/loader.d.ts +3 -0
- package/dist/types/react-ink/components/ChangelogBlock.d.ts +8 -0
- package/dist/types/react-ink/components/DisplayBlockView.d.ts +8 -0
- package/dist/types/react-ink/components/Footer.d.ts +11 -0
- package/dist/types/react-ink/components/MessageList.d.ts +14 -0
- package/dist/types/react-ink/components/MessageRow.d.ts +13 -0
- package/dist/types/react-ink/components/StatusLine.d.ts +9 -0
- package/dist/types/react-ink/components/TaskPanel.d.ts +11 -0
- package/dist/types/react-ink/components/ToolEventBlock.d.ts +24 -0
- package/dist/types/react-ink/components/dialogs/DialogFrame.d.ts +8 -0
- package/dist/types/react-ink/components/dialogs/LoginDialog.d.ts +14 -0
- package/dist/types/react-ink/components/dialogs/ModelDialog.d.ts +9 -0
- package/dist/types/react-ink/components/dialogs/OAuthDialog.d.ts +9 -0
- package/dist/types/react-ink/components/dialogs/ScopedModelsDialog.d.ts +9 -0
- package/dist/types/react-ink/components/dialogs/SelectableDialog.d.ts +22 -0
- package/dist/types/react-ink/components/dialogs/SessionDialog.d.ts +13 -0
- package/dist/types/react-ink/components/dialogs/SettingsDialog.d.ts +14 -0
- package/dist/types/react-ink/components/dialogs/StartupSessionPicker.d.ts +9 -0
- package/dist/types/react-ink/components/dialogs/ThemeDialog.d.ts +26 -0
- package/dist/types/react-ink/components/dialogs/TreeDialog.d.ts +8 -0
- package/dist/types/react-ink/components/dialogs/UserMessageDialog.d.ts +8 -0
- package/dist/types/react-ink/components/messages/AssistantMessage.d.ts +12 -0
- package/dist/types/react-ink/components/messages/BashMessage.d.ts +8 -0
- package/dist/types/react-ink/components/messages/BranchSummaryMessage.d.ts +8 -0
- package/dist/types/react-ink/components/messages/CompactionMessage.d.ts +8 -0
- package/dist/types/react-ink/components/messages/CustomMessage.d.ts +9 -0
- package/dist/types/react-ink/components/messages/SkillInvocationMessage.d.ts +7 -0
- package/dist/types/react-ink/components/messages/ToolCallMessage.d.ts +8 -0
- package/dist/types/react-ink/components/messages/ToolResultBlock.d.ts +12 -0
- package/dist/types/react-ink/components/messages/UserMessage.d.ts +9 -0
- package/dist/types/react-ink/diff/Diff.d.ts +22 -0
- package/dist/types/react-ink/diff/diff.test.d.ts +1 -0
- package/dist/types/react-ink/diff/structured.d.ts +41 -0
- package/dist/types/react-ink/diff/word-diff.d.ts +27 -0
- package/dist/types/react-ink/index.d.ts +42 -0
- package/dist/types/react-ink/markdown/Markdown.d.ts +23 -0
- package/dist/types/react-ink/markdown/MarkdownTable.d.ts +19 -0
- package/dist/types/react-ink/markdown/StreamingMarkdown.d.ts +34 -0
- package/dist/types/react-ink/markdown/format-token.d.ts +39 -0
- package/dist/types/react-ink/markdown/highlight.d.ts +31 -0
- package/dist/types/react-ink/theme-adapter.d.ts +66 -0
- package/dist/types/react-ink/types.d.ts +133 -0
- package/dist/types/react-ink/utils/message-groups.d.ts +25 -0
- package/dist/types/react-ink/utils/selection-dialog.d.ts +2 -0
- package/dist/types/react-ink/utils/session-browser.d.ts +27 -0
- package/dist/types/react-ink/utils/tool-display.d.ts +37 -0
- package/dist/types/runtime/cadence/cadence.test.d.ts +6 -0
- package/dist/types/runtime/cadence/fold.d.ts +48 -0
- package/dist/types/runtime/cadence/index.d.ts +12 -0
- package/dist/types/runtime/cadence/reducer.d.ts +44 -0
- package/dist/types/runtime/conductor/agent.d.ts +71 -0
- package/dist/types/runtime/conductor/index.d.ts +11 -0
- package/dist/types/runtime/contract/config.d.ts +44 -0
- package/dist/types/runtime/contract/effect.d.ts +41 -0
- package/dist/types/runtime/contract/errors.d.ts +22 -0
- package/dist/types/runtime/contract/events.d.ts +63 -0
- package/dist/types/runtime/contract/index.d.ts +18 -0
- package/dist/types/runtime/contract/run-state.d.ts +57 -0
- package/dist/types/runtime/contract/session.d.ts +42 -0
- package/dist/types/runtime/contract/signal.d.ts +49 -0
- package/dist/types/runtime/contract/tools.d.ts +45 -0
- package/dist/types/runtime/dispatch/index.d.ts +9 -0
- package/dist/types/runtime/dispatch/scheduler.d.ts +53 -0
- package/dist/types/runtime/index.d.ts +22 -0
- package/dist/types/runtime/ledger/accumulator.d.ts +44 -0
- package/dist/types/runtime/ledger/bus.d.ts +50 -0
- package/dist/types/runtime/ledger/index.d.ts +11 -0
- package/dist/types/runtime/memory/compactor.d.ts +56 -0
- package/dist/types/runtime/memory/estimate.d.ts +21 -0
- package/dist/types/runtime/memory/index.d.ts +8 -0
- package/dist/types/runtime/runtime.test.d.ts +15 -0
- package/dist/types/runtime/store/dag.d.ts +72 -0
- package/dist/types/runtime/store/hash.d.ts +18 -0
- package/dist/types/runtime/store/index.d.ts +12 -0
- package/dist/types/runtime/store/persist.d.ts +49 -0
- package/dist/types/runtime/turn/driver.d.ts +32 -0
- package/dist/types/runtime/turn/index.d.ts +8 -0
- package/dist/types/runtime/wire/index.d.ts +10 -0
- package/dist/types/runtime/wire/projectors.d.ts +53 -0
- package/dist/types/shell-app/auth-cli/index.d.ts +9 -0
- package/dist/types/shell-app/auth-cli/oauth-cli.d.ts +73 -0
- package/dist/types/shell-app/boot/context.d.ts +108 -0
- package/dist/types/shell-app/boot/index.d.ts +13 -0
- package/dist/types/shell-app/boot/pipeline.d.ts +66 -0
- package/dist/types/shell-app/boot/stages.d.ts +77 -0
- package/dist/types/shell-app/cli.d.ts +75 -0
- package/dist/types/shell-app/config/index.d.ts +11 -0
- package/dist/types/shell-app/config/locator.d.ts +85 -0
- package/dist/types/shell-app/config/settings.d.ts +91 -0
- package/dist/types/shell-app/index.d.ts +26 -0
- package/dist/types/shell-app/invocation/flags.d.ts +89 -0
- package/dist/types/shell-app/invocation/parse.d.ts +89 -0
- package/dist/types/shell-app/locate/brand.d.ts +71 -0
- package/dist/types/shell-app/locate/index.d.ts +12 -0
- package/dist/types/shell-app/locate/locator.d.ts +122 -0
- package/dist/types/shell-app/runners/contract.d.ts +116 -0
- package/dist/types/shell-app/runners/index.d.ts +15 -0
- package/dist/types/shell-app/runners/one-shot.d.ts +21 -0
- package/dist/types/shell-app/runners/registry.d.ts +34 -0
- package/dist/types/shell-app/runners/repl.d.ts +51 -0
- package/dist/types/shell-app/runners/wire.d.ts +34 -0
- package/dist/types/shell-app/shell-app.test.d.ts +14 -0
- package/dist/types/shell-app/upgrade/index.d.ts +9 -0
- package/dist/types/shell-app/upgrade/upgrades.d.ts +62 -0
- package/dist/types/smithy/config/flag-reader.d.ts +128 -0
- package/dist/types/smithy/config/index.d.ts +9 -0
- package/dist/types/smithy/forge.d.ts +135 -0
- package/dist/types/smithy/index.d.ts +36 -0
- package/dist/types/smithy/knowledge/index.d.ts +10 -0
- package/dist/types/smithy/knowledge/loader.d.ts +64 -0
- package/dist/types/smithy/persona/blueprint.d.ts +75 -0
- package/dist/types/smithy/persona/define-agent.d.ts +51 -0
- package/dist/types/smithy/persona/index.d.ts +14 -0
- package/dist/types/smithy/persona/profiles.d.ts +44 -0
- package/dist/types/smithy/runtime/index.d.ts +9 -0
- package/dist/types/smithy/runtime/tool-ledger.d.ts +130 -0
- package/dist/types/smithy/smithy.test.d.ts +20 -0
- package/dist/types/smithy/ui/index.d.ts +11 -0
- package/dist/types/smithy/ui/transcript.d.ts +183 -0
- package/dist/types/swarm/coordinator.d.ts +192 -0
- package/dist/types/swarm/index.d.ts +33 -0
- package/dist/types/swarm/isolation/index.d.ts +14 -0
- package/dist/types/swarm/isolation/runner.d.ts +61 -0
- package/dist/types/swarm/isolation/worktree.d.ts +142 -0
- package/dist/types/swarm/kernel/faults.d.ts +52 -0
- package/dist/types/swarm/kernel/ids.d.ts +25 -0
- package/dist/types/swarm/kernel/index.d.ts +26 -0
- package/dist/types/swarm/kernel/json-cell.d.ts +113 -0
- package/dist/types/swarm/kernel/jsonl-log.d.ts +81 -0
- package/dist/types/swarm/postbox/channel.d.ts +88 -0
- package/dist/types/swarm/postbox/codecs.d.ts +253 -0
- package/dist/types/swarm/postbox/index.d.ts +16 -0
- package/dist/types/swarm/roster/index.d.ts +16 -0
- package/dist/types/swarm/roster/manifest.d.ts +185 -0
- package/dist/types/swarm/swarm.test.d.ts +24 -0
- package/dist/types/swarm/telemetry/activity.d.ts +143 -0
- package/dist/types/swarm/workboard/board.d.ts +174 -0
- package/dist/types/swarm/workboard/dep-graph.d.ts +77 -0
- package/dist/types/swarm/workboard/index.d.ts +12 -0
- package/dist/types/tracing/adapter/index.d.ts +12 -0
- package/dist/types/tracing/adapter/runtime-trace.d.ts +54 -0
- package/dist/types/tracing/channel/index.d.ts +9 -0
- package/dist/types/tracing/channel/signal.d.ts +93 -0
- package/dist/types/tracing/index.d.ts +25 -0
- package/dist/types/tracing/recorder/index.d.ts +12 -0
- package/dist/types/tracing/recorder/recorder.d.ts +75 -0
- package/dist/types/tracing/recorder/sampling.d.ts +55 -0
- package/dist/types/tracing/redaction/index.d.ts +8 -0
- package/dist/types/tracing/redaction/secret-scrubber.d.ts +95 -0
- package/dist/types/tracing/registry/hub.d.ts +57 -0
- package/dist/types/tracing/registry/index.d.ts +7 -0
- package/dist/types/tracing/signal/handle.d.ts +73 -0
- package/dist/types/tracing/signal/index.d.ts +12 -0
- package/dist/types/tracing/signal/segment.d.ts +124 -0
- package/dist/types/tracing/sinks/base.d.ts +51 -0
- package/dist/types/tracing/sinks/console.d.ts +44 -0
- package/dist/types/tracing/sinks/file.d.ts +47 -0
- package/dist/types/tracing/sinks/index.d.ts +16 -0
- package/dist/types/tracing/sinks/stream.d.ts +46 -0
- package/dist/types/tracing/tracing.test.d.ts +7 -0
- package/dist/types/ui/autocomplete.d.ts +59 -0
- package/dist/types/ui/contracts.d.ts +38 -0
- package/dist/types/ui/editor-component.d.ts +100 -0
- package/dist/types/ui/fuzzy.d.ts +29 -0
- package/dist/types/ui/index.d.ts +8 -0
- package/dist/types/ui/keybindings.d.ts +62 -0
- package/dist/types/ui/keys.d.ts +171 -0
- package/dist/types/ui/theme-types.d.ts +36 -0
- package/dist/types/ui/utils.d.ts +101 -0
- package/dist/types/ui-bridge/InteractiveApp.d.ts +38 -0
- package/dist/types/ui-bridge/adapter.d.ts +90 -0
- package/dist/types/ui-bridge/index.d.ts +37 -0
- package/package.json +120 -107
- package/LICENSE +0 -8
- package/LICENSE-THIRD-PARTY.txt +0 -30
- package/local-dist-new/IndusForge/examples/research-agent.d.ts +0 -3
- package/local-dist-new/IndusForge/examples/research-agent.d.ts.map +0 -1
- package/local-dist-new/IndusForge/examples/research-agent.js +0 -18
- package/local-dist-new/IndusForge/examples/research-agent.js.map +0 -1
- package/local-dist-new/IndusForge/examples/review-agent.d.ts +0 -3
- package/local-dist-new/IndusForge/examples/review-agent.d.ts.map +0 -1
- package/local-dist-new/IndusForge/examples/review-agent.js +0 -18
- package/local-dist-new/IndusForge/examples/review-agent.js.map +0 -1
- package/local-dist-new/IndusForge/examples/terminal-builder-agent.d.ts +0 -3
- package/local-dist-new/IndusForge/examples/terminal-builder-agent.d.ts.map +0 -1
- package/local-dist-new/IndusForge/examples/terminal-builder-agent.js +0 -18
- package/local-dist-new/IndusForge/examples/terminal-builder-agent.js.map +0 -1
- package/local-dist-new/IndusForge/terminal-chat.d.ts +0 -2
- package/local-dist-new/IndusForge/terminal-chat.d.ts.map +0 -1
- package/local-dist-new/IndusForge/terminal-chat.js +0 -557
- package/local-dist-new/IndusForge/terminal-chat.js.map +0 -1
- package/local-dist-new/agent.d.ts +0 -6
- package/local-dist-new/agent.d.ts.map +0 -1
- package/local-dist-new/agent.js +0 -6
- package/local-dist-new/agent.js.map +0 -1
- package/local-dist-new/ai.d.ts +0 -6
- package/local-dist-new/ai.d.ts.map +0 -1
- package/local-dist-new/ai.js +0 -6
- package/local-dist-new/ai.js.map +0 -1
- package/local-dist-new/bot/actions/bash.d.ts +0 -56
- package/local-dist-new/bot/actions/bash.d.ts.map +0 -1
- package/local-dist-new/bot/actions/bash.js +0 -275
- package/local-dist-new/bot/actions/bash.js.map +0 -1
- package/local-dist-new/bot/actions/composio/accounts.d.ts +0 -23
- package/local-dist-new/bot/actions/composio/accounts.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/accounts.js +0 -40
- package/local-dist-new/bot/actions/composio/accounts.js.map +0 -1
- package/local-dist-new/bot/actions/composio/client.d.ts +0 -40
- package/local-dist-new/bot/actions/composio/client.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/client.js +0 -361
- package/local-dist-new/bot/actions/composio/client.js.map +0 -1
- package/local-dist-new/bot/actions/composio/connect.d.ts +0 -20
- package/local-dist-new/bot/actions/composio/connect.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/connect.js +0 -41
- package/local-dist-new/bot/actions/composio/connect.js.map +0 -1
- package/local-dist-new/bot/actions/composio/enable.d.ts +0 -26
- package/local-dist-new/bot/actions/composio/enable.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/enable.js +0 -66
- package/local-dist-new/bot/actions/composio/enable.js.map +0 -1
- package/local-dist-new/bot/actions/composio/execute.d.ts +0 -27
- package/local-dist-new/bot/actions/composio/execute.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/execute.js +0 -46
- package/local-dist-new/bot/actions/composio/execute.js.map +0 -1
- package/local-dist-new/bot/actions/composio/helpers.d.ts +0 -17
- package/local-dist-new/bot/actions/composio/helpers.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/helpers.js +0 -533
- package/local-dist-new/bot/actions/composio/helpers.js.map +0 -1
- package/local-dist-new/bot/actions/composio/index.d.ts +0 -10
- package/local-dist-new/bot/actions/composio/index.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/index.js +0 -9
- package/local-dist-new/bot/actions/composio/index.js.map +0 -1
- package/local-dist-new/bot/actions/composio/provider.d.ts +0 -9
- package/local-dist-new/bot/actions/composio/provider.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/provider.js +0 -54
- package/local-dist-new/bot/actions/composio/provider.js.map +0 -1
- package/local-dist-new/bot/actions/composio/toolkits.d.ts +0 -23
- package/local-dist-new/bot/actions/composio/toolkits.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/toolkits.js +0 -40
- package/local-dist-new/bot/actions/composio/toolkits.js.map +0 -1
- package/local-dist-new/bot/actions/composio/tools.d.ts +0 -29
- package/local-dist-new/bot/actions/composio/tools.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/tools.js +0 -72
- package/local-dist-new/bot/actions/composio/tools.js.map +0 -1
- package/local-dist-new/bot/actions/composio/types.d.ts +0 -138
- package/local-dist-new/bot/actions/composio/types.d.ts.map +0 -1
- package/local-dist-new/bot/actions/composio/types.js +0 -2
- package/local-dist-new/bot/actions/composio/types.js.map +0 -1
- package/local-dist-new/bot/actions/crew/activity-tracker.d.ts +0 -66
- package/local-dist-new/bot/actions/crew/activity-tracker.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/activity-tracker.js +0 -480
- package/local-dist-new/bot/actions/crew/activity-tracker.js.map +0 -1
- package/local-dist-new/bot/actions/crew/cleanup.d.ts +0 -51
- package/local-dist-new/bot/actions/crew/cleanup.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/cleanup.js +0 -219
- package/local-dist-new/bot/actions/crew/cleanup.js.map +0 -1
- package/local-dist-new/bot/actions/crew/fs-lock.d.ts +0 -12
- package/local-dist-new/bot/actions/crew/fs-lock.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/fs-lock.js +0 -74
- package/local-dist-new/bot/actions/crew/fs-lock.js.map +0 -1
- package/local-dist-new/bot/actions/crew/index.d.ts +0 -12
- package/local-dist-new/bot/actions/crew/index.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/index.js +0 -12
- package/local-dist-new/bot/actions/crew/index.js.map +0 -1
- package/local-dist-new/bot/actions/crew/mailbox.d.ts +0 -21
- package/local-dist-new/bot/actions/crew/mailbox.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/mailbox.js +0 -106
- package/local-dist-new/bot/actions/crew/mailbox.js.map +0 -1
- package/local-dist-new/bot/actions/crew/model-policy.d.ts +0 -23
- package/local-dist-new/bot/actions/crew/model-policy.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/model-policy.js +0 -113
- package/local-dist-new/bot/actions/crew/model-policy.js.map +0 -1
- package/local-dist-new/bot/actions/crew/names.d.ts +0 -28
- package/local-dist-new/bot/actions/crew/names.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/names.js +0 -109
- package/local-dist-new/bot/actions/crew/names.js.map +0 -1
- package/local-dist-new/bot/actions/crew/protocol.d.ts +0 -75
- package/local-dist-new/bot/actions/crew/protocol.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/protocol.js +0 -205
- package/local-dist-new/bot/actions/crew/protocol.js.map +0 -1
- package/local-dist-new/bot/actions/crew/task-store.d.ts +0 -89
- package/local-dist-new/bot/actions/crew/task-store.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/task-store.js +0 -445
- package/local-dist-new/bot/actions/crew/task-store.js.map +0 -1
- package/local-dist-new/bot/actions/crew/team-attach-claim.d.ts +0 -36
- package/local-dist-new/bot/actions/crew/team-attach-claim.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/team-attach-claim.js +0 -144
- package/local-dist-new/bot/actions/crew/team-attach-claim.js.map +0 -1
- package/local-dist-new/bot/actions/crew/team-config.d.ts +0 -55
- package/local-dist-new/bot/actions/crew/team-config.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/team-config.js +0 -252
- package/local-dist-new/bot/actions/crew/team-config.js.map +0 -1
- package/local-dist-new/bot/actions/crew/worktree.d.ts +0 -40
- package/local-dist-new/bot/actions/crew/worktree.d.ts.map +0 -1
- package/local-dist-new/bot/actions/crew/worktree.js +0 -213
- package/local-dist-new/bot/actions/crew/worktree.js.map +0 -1
- package/local-dist-new/bot/actions/edit-diff.d.ts +0 -63
- package/local-dist-new/bot/actions/edit-diff.d.ts.map +0 -1
- package/local-dist-new/bot/actions/edit-diff.js +0 -255
- package/local-dist-new/bot/actions/edit-diff.js.map +0 -1
- package/local-dist-new/bot/actions/edit.d.ts +0 -42
- package/local-dist-new/bot/actions/edit.d.ts.map +0 -1
- package/local-dist-new/bot/actions/edit.js +0 -176
- package/local-dist-new/bot/actions/edit.js.map +0 -1
- package/local-dist-new/bot/actions/find.d.ts +0 -26
- package/local-dist-new/bot/actions/find.d.ts.map +0 -1
- package/local-dist-new/bot/actions/find.js +0 -170
- package/local-dist-new/bot/actions/find.js.map +0 -1
- package/local-dist-new/bot/actions/grep.d.ts +0 -43
- package/local-dist-new/bot/actions/grep.d.ts.map +0 -1
- package/local-dist-new/bot/actions/grep.js +0 -218
- package/local-dist-new/bot/actions/grep.js.map +0 -1
- package/local-dist-new/bot/actions/index.d.ts +0 -301
- package/local-dist-new/bot/actions/index.d.ts.map +0 -1
- package/local-dist-new/bot/actions/index.js +0 -255
- package/local-dist-new/bot/actions/index.js.map +0 -1
- package/local-dist-new/bot/actions/kit/hook-runner.d.ts +0 -13
- package/local-dist-new/bot/actions/kit/hook-runner.d.ts.map +0 -1
- package/local-dist-new/bot/actions/kit/hook-runner.js +0 -33
- package/local-dist-new/bot/actions/kit/hook-runner.js.map +0 -1
- package/local-dist-new/bot/actions/kit/image-resize.d.ts +0 -20
- package/local-dist-new/bot/actions/kit/image-resize.d.ts.map +0 -1
- package/local-dist-new/bot/actions/kit/image-resize.js +0 -93
- package/local-dist-new/bot/actions/kit/image-resize.js.map +0 -1
- package/local-dist-new/bot/actions/kit/mime.d.ts +0 -2
- package/local-dist-new/bot/actions/kit/mime.d.ts.map +0 -1
- package/local-dist-new/bot/actions/kit/mime.js +0 -65
- package/local-dist-new/bot/actions/kit/mime.js.map +0 -1
- package/local-dist-new/bot/actions/kit/shell.d.ts +0 -13
- package/local-dist-new/bot/actions/kit/shell.d.ts.map +0 -1
- package/local-dist-new/bot/actions/kit/shell.js +0 -103
- package/local-dist-new/bot/actions/kit/shell.js.map +0 -1
- package/local-dist-new/bot/actions/ls.d.ts +0 -41
- package/local-dist-new/bot/actions/ls.d.ts.map +0 -1
- package/local-dist-new/bot/actions/ls.js +0 -174
- package/local-dist-new/bot/actions/ls.js.map +0 -1
- package/local-dist-new/bot/actions/path-utils.d.ts +0 -8
- package/local-dist-new/bot/actions/path-utils.d.ts.map +0 -1
- package/local-dist-new/bot/actions/path-utils.js +0 -75
- package/local-dist-new/bot/actions/path-utils.js.map +0 -1
- package/local-dist-new/bot/actions/process-controller.d.ts +0 -15
- package/local-dist-new/bot/actions/process-controller.d.ts.map +0 -1
- package/local-dist-new/bot/actions/process-controller.js +0 -39
- package/local-dist-new/bot/actions/process-controller.js.map +0 -1
- package/local-dist-new/bot/actions/process-manager.d.ts +0 -60
- package/local-dist-new/bot/actions/process-manager.d.ts.map +0 -1
- package/local-dist-new/bot/actions/process-manager.js +0 -485
- package/local-dist-new/bot/actions/process-manager.js.map +0 -1
- package/local-dist-new/bot/actions/process-types.d.ts +0 -74
- package/local-dist-new/bot/actions/process-types.d.ts.map +0 -1
- package/local-dist-new/bot/actions/process-types.js +0 -7
- package/local-dist-new/bot/actions/process-types.js.map +0 -1
- package/local-dist-new/bot/actions/process.d.ts +0 -38
- package/local-dist-new/bot/actions/process.d.ts.map +0 -1
- package/local-dist-new/bot/actions/process.js +0 -360
- package/local-dist-new/bot/actions/process.js.map +0 -1
- package/local-dist-new/bot/actions/read.d.ts +0 -37
- package/local-dist-new/bot/actions/read.d.ts.map +0 -1
- package/local-dist-new/bot/actions/read.js +0 -190
- package/local-dist-new/bot/actions/read.js.map +0 -1
- package/local-dist-new/bot/actions/registry.d.ts +0 -21
- package/local-dist-new/bot/actions/registry.d.ts.map +0 -1
- package/local-dist-new/bot/actions/registry.js +0 -23
- package/local-dist-new/bot/actions/registry.js.map +0 -1
- package/local-dist-new/bot/actions/todo-store.d.ts +0 -77
- package/local-dist-new/bot/actions/todo-store.d.ts.map +0 -1
- package/local-dist-new/bot/actions/todo-store.js +0 -137
- package/local-dist-new/bot/actions/todo-store.js.map +0 -1
- package/local-dist-new/bot/actions/todo-types.d.ts +0 -73
- package/local-dist-new/bot/actions/todo-types.d.ts.map +0 -1
- package/local-dist-new/bot/actions/todo-types.js +0 -8
- package/local-dist-new/bot/actions/todo-types.js.map +0 -1
- package/local-dist-new/bot/actions/todo.d.ts +0 -77
- package/local-dist-new/bot/actions/todo.d.ts.map +0 -1
- package/local-dist-new/bot/actions/todo.js +0 -122
- package/local-dist-new/bot/actions/todo.js.map +0 -1
- package/local-dist-new/bot/actions/truncate.d.ts +0 -73
- package/local-dist-new/bot/actions/truncate.d.ts.map +0 -1
- package/local-dist-new/bot/actions/truncate.js +0 -221
- package/local-dist-new/bot/actions/truncate.js.map +0 -1
- package/local-dist-new/bot/actions/webfetch.d.ts +0 -36
- package/local-dist-new/bot/actions/webfetch.d.ts.map +0 -1
- package/local-dist-new/bot/actions/webfetch.js +0 -247
- package/local-dist-new/bot/actions/webfetch.js.map +0 -1
- package/local-dist-new/bot/actions/websearch.d.ts +0 -35
- package/local-dist-new/bot/actions/websearch.d.ts.map +0 -1
- package/local-dist-new/bot/actions/websearch.js +0 -132
- package/local-dist-new/bot/actions/websearch.js.map +0 -1
- package/local-dist-new/bot/actions/write.d.ts +0 -31
- package/local-dist-new/bot/actions/write.d.ts.map +0 -1
- package/local-dist-new/bot/actions/write.js +0 -139
- package/local-dist-new/bot/actions/write.js.map +0 -1
- package/local-dist-new/bot/agent-loop.d.ts +0 -15
- package/local-dist-new/bot/agent-loop.d.ts.map +0 -1
- package/local-dist-new/bot/agent-loop.js +0 -293
- package/local-dist-new/bot/agent-loop.js.map +0 -1
- package/local-dist-new/bot/agent.d.ts +0 -122
- package/local-dist-new/bot/agent.d.ts.map +0 -1
- package/local-dist-new/bot/agent.js +0 -393
- package/local-dist-new/bot/agent.js.map +0 -1
- package/local-dist-new/bot/error-handler.d.ts +0 -8
- package/local-dist-new/bot/error-handler.d.ts.map +0 -1
- package/local-dist-new/bot/error-handler.js +0 -8
- package/local-dist-new/bot/error-handler.js.map +0 -1
- package/local-dist-new/bot/event-bus.d.ts +0 -9
- package/local-dist-new/bot/event-bus.d.ts.map +0 -1
- package/local-dist-new/bot/event-bus.js +0 -15
- package/local-dist-new/bot/event-bus.js.map +0 -1
- package/local-dist-new/bot/index.d.ts +0 -8
- package/local-dist-new/bot/index.d.ts.map +0 -1
- package/local-dist-new/bot/index.js +0 -8
- package/local-dist-new/bot/index.js.map +0 -1
- package/local-dist-new/bot/messages.d.ts +0 -77
- package/local-dist-new/bot/messages.d.ts.map +0 -1
- package/local-dist-new/bot/messages.js +0 -116
- package/local-dist-new/bot/messages.js.map +0 -1
- package/local-dist-new/bot/proxy.d.ts +0 -66
- package/local-dist-new/bot/proxy.d.ts.map +0 -1
- package/local-dist-new/bot/proxy.js +0 -228
- package/local-dist-new/bot/proxy.js.map +0 -1
- package/local-dist-new/bot/session-manager.d.ts +0 -448
- package/local-dist-new/bot/session-manager.d.ts.map +0 -1
- package/local-dist-new/bot/session-manager.js +0 -1232
- package/local-dist-new/bot/session-manager.js.map +0 -1
- package/local-dist-new/bot/state-manager.d.ts +0 -22
- package/local-dist-new/bot/state-manager.d.ts.map +0 -1
- package/local-dist-new/bot/state-manager.js +0 -60
- package/local-dist-new/bot/state-manager.js.map +0 -1
- package/local-dist-new/bot/telemetry.d.ts +0 -7
- package/local-dist-new/bot/telemetry.d.ts.map +0 -1
- package/local-dist-new/bot/telemetry.js +0 -18
- package/local-dist-new/bot/telemetry.js.map +0 -1
- package/local-dist-new/bot/types.d.ts +0 -205
- package/local-dist-new/bot/types.d.ts.map +0 -1
- package/local-dist-new/bot/types.js +0 -60
- package/local-dist-new/bot/types.js.map +0 -1
- package/local-dist-new/cli.d.ts +0 -3
- package/local-dist-new/cli.d.ts.map +0 -1
- package/local-dist-new/cli.js +0 -3
- package/local-dist-new/cli.js.map +0 -1
- package/local-dist-new/index.d.ts +0 -7
- package/local-dist-new/index.d.ts.map +0 -1
- package/local-dist-new/index.js +0 -7
- package/local-dist-new/index.js.map +0 -1
- package/local-dist-new/mcp/client-pool.d.ts +0 -106
- package/local-dist-new/mcp/client-pool.d.ts.map +0 -1
- package/local-dist-new/mcp/client-pool.js +0 -234
- package/local-dist-new/mcp/client-pool.js.map +0 -1
- package/local-dist-new/mcp/client.d.ts +0 -158
- package/local-dist-new/mcp/client.d.ts.map +0 -1
- package/local-dist-new/mcp/client.js +0 -611
- package/local-dist-new/mcp/client.js.map +0 -1
- package/local-dist-new/mcp/config.d.ts +0 -61
- package/local-dist-new/mcp/config.d.ts.map +0 -1
- package/local-dist-new/mcp/config.js +0 -250
- package/local-dist-new/mcp/config.js.map +0 -1
- package/local-dist-new/mcp/errors.d.ts +0 -104
- package/local-dist-new/mcp/errors.d.ts.map +0 -1
- package/local-dist-new/mcp/errors.js +0 -146
- package/local-dist-new/mcp/errors.js.map +0 -1
- package/local-dist-new/mcp/index.d.ts +0 -56
- package/local-dist-new/mcp/index.d.ts.map +0 -1
- package/local-dist-new/mcp/index.js +0 -83
- package/local-dist-new/mcp/index.js.map +0 -1
- package/local-dist-new/mcp/schema-converter.d.ts +0 -68
- package/local-dist-new/mcp/schema-converter.d.ts.map +0 -1
- package/local-dist-new/mcp/schema-converter.js +0 -230
- package/local-dist-new/mcp/schema-converter.js.map +0 -1
- package/local-dist-new/mcp/server.d.ts +0 -111
- package/local-dist-new/mcp/server.d.ts.map +0 -1
- package/local-dist-new/mcp/server.js +0 -305
- package/local-dist-new/mcp/server.js.map +0 -1
- package/local-dist-new/mcp/tool-factory.d.ts +0 -63
- package/local-dist-new/mcp/tool-factory.d.ts.map +0 -1
- package/local-dist-new/mcp/tool-factory.js +0 -228
- package/local-dist-new/mcp/tool-factory.js.map +0 -1
- package/local-dist-new/mcp/types.d.ts +0 -289
- package/local-dist-new/mcp/types.d.ts.map +0 -1
- package/local-dist-new/mcp/types.js +0 -8
- package/local-dist-new/mcp/types.js.map +0 -1
- package/local-dist-new/mcp.d.ts +0 -2
- package/local-dist-new/mcp.d.ts.map +0 -1
- package/local-dist-new/mcp.js +0 -2
- package/local-dist-new/mcp.js.map +0 -1
- package/local-dist-new/ml/adapters/amazon-bedrock.d.ts +0 -33
- package/local-dist-new/ml/adapters/amazon-bedrock.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/amazon-bedrock.js +0 -610
- package/local-dist-new/ml/adapters/amazon-bedrock.js.map +0 -1
- package/local-dist-new/ml/adapters/anthropic.d.ts +0 -62
- package/local-dist-new/ml/adapters/anthropic.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/anthropic.js +0 -682
- package/local-dist-new/ml/adapters/anthropic.js.map +0 -1
- package/local-dist-new/ml/adapters/azure-openai-responses.d.ts +0 -15
- package/local-dist-new/ml/adapters/azure-openai-responses.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/azure-openai-responses.js +0 -233
- package/local-dist-new/ml/adapters/azure-openai-responses.js.map +0 -1
- package/local-dist-new/ml/adapters/google-shared.d.ts +0 -60
- package/local-dist-new/ml/adapters/google-shared.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/google-shared.js +0 -316
- package/local-dist-new/ml/adapters/google-shared.js.map +0 -1
- package/local-dist-new/ml/adapters/google-vertex.d.ts +0 -15
- package/local-dist-new/ml/adapters/google-vertex.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/google-vertex.js +0 -396
- package/local-dist-new/ml/adapters/google-vertex.js.map +0 -1
- package/local-dist-new/ml/adapters/google.d.ts +0 -16
- package/local-dist-new/ml/adapters/google.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/google.js +0 -381
- package/local-dist-new/ml/adapters/google.js.map +0 -1
- package/local-dist-new/ml/adapters/kimi.d.ts +0 -22
- package/local-dist-new/ml/adapters/kimi.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/kimi.js +0 -249
- package/local-dist-new/ml/adapters/kimi.js.map +0 -1
- package/local-dist-new/ml/adapters/mock.d.ts +0 -10
- package/local-dist-new/ml/adapters/mock.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/mock.js +0 -64
- package/local-dist-new/ml/adapters/mock.js.map +0 -1
- package/local-dist-new/ml/adapters/nvidia.d.ts +0 -14
- package/local-dist-new/ml/adapters/nvidia.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/nvidia.js +0 -377
- package/local-dist-new/ml/adapters/nvidia.js.map +0 -1
- package/local-dist-new/ml/adapters/openai-codex-responses.d.ts +0 -9
- package/local-dist-new/ml/adapters/openai-codex-responses.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/openai-codex-responses.js +0 -397
- package/local-dist-new/ml/adapters/openai-codex-responses.js.map +0 -1
- package/local-dist-new/ml/adapters/openai-completions.d.ts +0 -25
- package/local-dist-new/ml/adapters/openai-completions.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/openai-completions.js +0 -831
- package/local-dist-new/ml/adapters/openai-completions.js.map +0 -1
- package/local-dist-new/ml/adapters/openai-responses-shared.d.ts +0 -26
- package/local-dist-new/ml/adapters/openai-responses-shared.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/openai-responses-shared.js +0 -461
- package/local-dist-new/ml/adapters/openai-responses-shared.js.map +0 -1
- package/local-dist-new/ml/adapters/openai-responses.d.ts +0 -13
- package/local-dist-new/ml/adapters/openai-responses.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/openai-responses.js +0 -209
- package/local-dist-new/ml/adapters/openai-responses.js.map +0 -1
- package/local-dist-new/ml/adapters/openai-scaffold.d.ts +0 -4
- package/local-dist-new/ml/adapters/openai-scaffold.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/openai-scaffold.js +0 -33
- package/local-dist-new/ml/adapters/openai-scaffold.js.map +0 -1
- package/local-dist-new/ml/adapters/register-builtins.d.ts +0 -3
- package/local-dist-new/ml/adapters/register-builtins.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/register-builtins.js +0 -143
- package/local-dist-new/ml/adapters/register-builtins.js.map +0 -1
- package/local-dist-new/ml/adapters/simple-options.d.ts +0 -27
- package/local-dist-new/ml/adapters/simple-options.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/simple-options.js +0 -96
- package/local-dist-new/ml/adapters/simple-options.js.map +0 -1
- package/local-dist-new/ml/adapters/transform-messages.d.ts +0 -22
- package/local-dist-new/ml/adapters/transform-messages.d.ts.map +0 -1
- package/local-dist-new/ml/adapters/transform-messages.js +0 -147
- package/local-dist-new/ml/adapters/transform-messages.js.map +0 -1
- package/local-dist-new/ml/api-registry.d.ts +0 -50
- package/local-dist-new/ml/api-registry.d.ts.map +0 -1
- package/local-dist-new/ml/api-registry.js +0 -121
- package/local-dist-new/ml/api-registry.js.map +0 -1
- package/local-dist-new/ml/cli.d.ts +0 -3
- package/local-dist-new/ml/cli.d.ts.map +0 -1
- package/local-dist-new/ml/cli.js +0 -117
- package/local-dist-new/ml/cli.js.map +0 -1
- package/local-dist-new/ml/env-api-keys.d.ts +0 -18
- package/local-dist-new/ml/env-api-keys.d.ts.map +0 -1
- package/local-dist-new/ml/env-api-keys.js +0 -122
- package/local-dist-new/ml/env-api-keys.js.map +0 -1
- package/local-dist-new/ml/index.d.ts +0 -28
- package/local-dist-new/ml/index.d.ts.map +0 -1
- package/local-dist-new/ml/index.js +0 -28
- package/local-dist-new/ml/index.js.map +0 -1
- package/local-dist-new/ml/kit/auth/anthropic.d.ts +0 -18
- package/local-dist-new/ml/kit/auth/anthropic.d.ts.map +0 -1
- package/local-dist-new/ml/kit/auth/anthropic.js +0 -152
- package/local-dist-new/ml/kit/auth/anthropic.js.map +0 -1
- package/local-dist-new/ml/kit/auth/github-copilot.d.ts +0 -23
- package/local-dist-new/ml/kit/auth/github-copilot.d.ts.map +0 -1
- package/local-dist-new/ml/kit/auth/github-copilot.js +0 -275
- package/local-dist-new/ml/kit/auth/github-copilot.js.map +0 -1
- package/local-dist-new/ml/kit/auth/index.d.ts +0 -50
- package/local-dist-new/ml/kit/auth/index.d.ts.map +0 -1
- package/local-dist-new/ml/kit/auth/index.js +0 -112
- package/local-dist-new/ml/kit/auth/index.js.map +0 -1
- package/local-dist-new/ml/kit/auth/kimi.d.ts +0 -24
- package/local-dist-new/ml/kit/auth/kimi.d.ts.map +0 -1
- package/local-dist-new/ml/kit/auth/kimi.js +0 -30
- package/local-dist-new/ml/kit/auth/kimi.js.map +0 -1
- package/local-dist-new/ml/kit/auth/oauth-page.d.ts +0 -3
- package/local-dist-new/ml/kit/auth/oauth-page.d.ts.map +0 -1
- package/local-dist-new/ml/kit/auth/oauth-page.js +0 -105
- package/local-dist-new/ml/kit/auth/oauth-page.js.map +0 -1
- package/local-dist-new/ml/kit/auth/openai-codex.d.ts +0 -34
- package/local-dist-new/ml/kit/auth/openai-codex.d.ts.map +0 -1
- package/local-dist-new/ml/kit/auth/openai-codex.js +0 -373
- package/local-dist-new/ml/kit/auth/openai-codex.js.map +0 -1
- package/local-dist-new/ml/kit/auth/pkce.d.ts +0 -13
- package/local-dist-new/ml/kit/auth/pkce.d.ts.map +0 -1
- package/local-dist-new/ml/kit/auth/pkce.js +0 -31
- package/local-dist-new/ml/kit/auth/pkce.js.map +0 -1
- package/local-dist-new/ml/kit/auth/types.d.ts +0 -72
- package/local-dist-new/ml/kit/auth/types.d.ts.map +0 -1
- package/local-dist-new/ml/kit/auth/types.js +0 -11
- package/local-dist-new/ml/kit/auth/types.js.map +0 -1
- package/local-dist-new/ml/kit/base-stream-handler.d.ts +0 -16
- package/local-dist-new/ml/kit/base-stream-handler.d.ts.map +0 -1
- package/local-dist-new/ml/kit/base-stream-handler.js +0 -25
- package/local-dist-new/ml/kit/base-stream-handler.js.map +0 -1
- package/local-dist-new/ml/kit/event-stream.d.ts +0 -45
- package/local-dist-new/ml/kit/event-stream.d.ts.map +0 -1
- package/local-dist-new/ml/kit/event-stream.js +0 -178
- package/local-dist-new/ml/kit/event-stream.js.map +0 -1
- package/local-dist-new/ml/kit/index.d.ts +0 -15
- package/local-dist-new/ml/kit/index.d.ts.map +0 -1
- package/local-dist-new/ml/kit/index.js +0 -15
- package/local-dist-new/ml/kit/index.js.map +0 -1
- package/local-dist-new/ml/kit/json-parse.d.ts +0 -21
- package/local-dist-new/ml/kit/json-parse.d.ts.map +0 -1
- package/local-dist-new/ml/kit/json-parse.js +0 -44
- package/local-dist-new/ml/kit/json-parse.js.map +0 -1
- package/local-dist-new/ml/kit/message-transform.d.ts +0 -29
- package/local-dist-new/ml/kit/message-transform.d.ts.map +0 -1
- package/local-dist-new/ml/kit/message-transform.js +0 -55
- package/local-dist-new/ml/kit/message-transform.js.map +0 -1
- package/local-dist-new/ml/kit/output-factory.d.ts +0 -3
- package/local-dist-new/ml/kit/output-factory.d.ts.map +0 -1
- package/local-dist-new/ml/kit/output-factory.js +0 -23
- package/local-dist-new/ml/kit/output-factory.js.map +0 -1
- package/local-dist-new/ml/kit/overflow.d.ts +0 -10
- package/local-dist-new/ml/kit/overflow.d.ts.map +0 -1
- package/local-dist-new/ml/kit/overflow.js +0 -76
- package/local-dist-new/ml/kit/overflow.js.map +0 -1
- package/local-dist-new/ml/kit/provider-adapter.d.ts +0 -57
- package/local-dist-new/ml/kit/provider-adapter.d.ts.map +0 -1
- package/local-dist-new/ml/kit/provider-adapter.js +0 -37
- package/local-dist-new/ml/kit/provider-adapter.js.map +0 -1
- package/local-dist-new/ml/kit/provider-client-builder.d.ts +0 -37
- package/local-dist-new/ml/kit/provider-client-builder.d.ts.map +0 -1
- package/local-dist-new/ml/kit/provider-client-builder.js +0 -50
- package/local-dist-new/ml/kit/provider-client-builder.js.map +0 -1
- package/local-dist-new/ml/kit/provider-consolidation.d.ts +0 -4
- package/local-dist-new/ml/kit/provider-consolidation.d.ts.map +0 -1
- package/local-dist-new/ml/kit/provider-consolidation.js +0 -33
- package/local-dist-new/ml/kit/provider-consolidation.js.map +0 -1
- package/local-dist-new/ml/kit/provider-constants.d.ts +0 -35
- package/local-dist-new/ml/kit/provider-constants.d.ts.map +0 -1
- package/local-dist-new/ml/kit/provider-constants.js +0 -35
- package/local-dist-new/ml/kit/provider-constants.js.map +0 -1
- package/local-dist-new/ml/kit/provider-errors.d.ts +0 -46
- package/local-dist-new/ml/kit/provider-errors.d.ts.map +0 -1
- package/local-dist-new/ml/kit/provider-errors.js +0 -103
- package/local-dist-new/ml/kit/provider-errors.js.map +0 -1
- package/local-dist-new/ml/kit/sanitize-unicode.d.ts +0 -3
- package/local-dist-new/ml/kit/sanitize-unicode.d.ts.map +0 -1
- package/local-dist-new/ml/kit/sanitize-unicode.js +0 -60
- package/local-dist-new/ml/kit/sanitize-unicode.js.map +0 -1
- package/local-dist-new/ml/kit/stream-event-helper.d.ts +0 -28
- package/local-dist-new/ml/kit/stream-event-helper.d.ts.map +0 -1
- package/local-dist-new/ml/kit/stream-event-helper.js +0 -52
- package/local-dist-new/ml/kit/stream-event-helper.js.map +0 -1
- package/local-dist-new/ml/kit/stream-handler-types.d.ts +0 -43
- package/local-dist-new/ml/kit/stream-handler-types.d.ts.map +0 -1
- package/local-dist-new/ml/kit/stream-handler-types.js +0 -23
- package/local-dist-new/ml/kit/stream-handler-types.js.map +0 -1
- package/local-dist-new/ml/kit/streaming-state-manager.d.ts +0 -50
- package/local-dist-new/ml/kit/streaming-state-manager.d.ts.map +0 -1
- package/local-dist-new/ml/kit/streaming-state-manager.js +0 -67
- package/local-dist-new/ml/kit/streaming-state-manager.js.map +0 -1
- package/local-dist-new/ml/kit/tool-converter.d.ts +0 -50
- package/local-dist-new/ml/kit/tool-converter.d.ts.map +0 -1
- package/local-dist-new/ml/kit/tool-converter.js +0 -54
- package/local-dist-new/ml/kit/tool-converter.js.map +0 -1
- package/local-dist-new/ml/kit/typebox-helpers.d.ts +0 -24
- package/local-dist-new/ml/kit/typebox-helpers.d.ts.map +0 -1
- package/local-dist-new/ml/kit/typebox-helpers.js +0 -46
- package/local-dist-new/ml/kit/typebox-helpers.js.map +0 -1
- package/local-dist-new/ml/kit/validation.d.ts +0 -24
- package/local-dist-new/ml/kit/validation.d.ts.map +0 -1
- package/local-dist-new/ml/kit/validation.js +0 -119
- package/local-dist-new/ml/kit/validation.js.map +0 -1
- package/local-dist-new/ml/models.d.ts +0 -41
- package/local-dist-new/ml/models.d.ts.map +0 -1
- package/local-dist-new/ml/models.generated.d.ts +0 -12245
- package/local-dist-new/ml/models.generated.d.ts.map +0 -1
- package/local-dist-new/ml/models.generated.js +0 -12080
- package/local-dist-new/ml/models.generated.js.map +0 -1
- package/local-dist-new/ml/models.js +0 -126
- package/local-dist-new/ml/models.js.map +0 -1
- package/local-dist-new/ml/stream.d.ts +0 -12
- package/local-dist-new/ml/stream.d.ts.map +0 -1
- package/local-dist-new/ml/stream.js +0 -54
- package/local-dist-new/ml/stream.js.map +0 -1
- package/local-dist-new/ml/types.d.ts +0 -270
- package/local-dist-new/ml/types.d.ts.map +0 -1
- package/local-dist-new/ml/types.js +0 -169
- package/local-dist-new/ml/types.js.map +0 -1
- package/local-dist-new/observability.d.ts +0 -2
- package/local-dist-new/observability.d.ts.map +0 -1
- package/local-dist-new/observability.js +0 -2
- package/local-dist-new/observability.js.map +0 -1
- package/local-dist-new/react-host/index.d.ts +0 -10
- package/local-dist-new/react-host/index.d.ts.map +0 -1
- package/local-dist-new/react-host/index.js +0 -9
- package/local-dist-new/react-host/index.js.map +0 -1
- package/local-dist-new/react-host/ink.d.ts +0 -6
- package/local-dist-new/react-host/ink.d.ts.map +0 -1
- package/local-dist-new/react-host/ink.js +0 -7
- package/local-dist-new/react-host/ink.js.map +0 -1
- package/local-dist-new/react-host/jsx-runtime.d.ts +0 -5
- package/local-dist-new/react-host/jsx-runtime.d.ts.map +0 -1
- package/local-dist-new/react-host/jsx-runtime.js +0 -6
- package/local-dist-new/react-host/jsx-runtime.js.map +0 -1
- package/local-dist-new/react-host/loader.d.ts +0 -4
- package/local-dist-new/react-host/loader.d.ts.map +0 -1
- package/local-dist-new/react-host/loader.js +0 -108
- package/local-dist-new/react-host/loader.js.map +0 -1
- package/local-dist-new/react-ink/components/ChangelogBlock.d.ts +0 -9
- package/local-dist-new/react-ink/components/ChangelogBlock.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/ChangelogBlock.js +0 -58
- package/local-dist-new/react-ink/components/ChangelogBlock.js.map +0 -1
- package/local-dist-new/react-ink/components/DisplayBlockView.d.ts +0 -9
- package/local-dist-new/react-ink/components/DisplayBlockView.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/DisplayBlockView.js +0 -11
- package/local-dist-new/react-ink/components/DisplayBlockView.js.map +0 -1
- package/local-dist-new/react-ink/components/Footer.d.ts +0 -12
- package/local-dist-new/react-ink/components/Footer.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/Footer.js +0 -113
- package/local-dist-new/react-ink/components/Footer.js.map +0 -1
- package/local-dist-new/react-ink/components/MessageList.d.ts +0 -15
- package/local-dist-new/react-ink/components/MessageList.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/MessageList.js +0 -43
- package/local-dist-new/react-ink/components/MessageList.js.map +0 -1
- package/local-dist-new/react-ink/components/MessageRow.d.ts +0 -14
- package/local-dist-new/react-ink/components/MessageRow.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/MessageRow.js +0 -35
- package/local-dist-new/react-ink/components/MessageRow.js.map +0 -1
- package/local-dist-new/react-ink/components/StatusLine.d.ts +0 -10
- package/local-dist-new/react-ink/components/StatusLine.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/StatusLine.js +0 -39
- package/local-dist-new/react-ink/components/StatusLine.js.map +0 -1
- package/local-dist-new/react-ink/components/TaskPanel.d.ts +0 -12
- package/local-dist-new/react-ink/components/TaskPanel.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/TaskPanel.js +0 -23
- package/local-dist-new/react-ink/components/TaskPanel.js.map +0 -1
- package/local-dist-new/react-ink/components/ToolEventBlock.d.ts +0 -18
- package/local-dist-new/react-ink/components/ToolEventBlock.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/ToolEventBlock.js +0 -61
- package/local-dist-new/react-ink/components/ToolEventBlock.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/DialogFrame.d.ts +0 -9
- package/local-dist-new/react-ink/components/dialogs/DialogFrame.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/DialogFrame.js +0 -6
- package/local-dist-new/react-ink/components/dialogs/DialogFrame.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/LoginDialog.d.ts +0 -15
- package/local-dist-new/react-ink/components/dialogs/LoginDialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/LoginDialog.js +0 -10
- package/local-dist-new/react-ink/components/dialogs/LoginDialog.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/ModelDialog.d.ts +0 -10
- package/local-dist-new/react-ink/components/dialogs/ModelDialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/ModelDialog.js +0 -64
- package/local-dist-new/react-ink/components/dialogs/ModelDialog.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/OAuthDialog.d.ts +0 -10
- package/local-dist-new/react-ink/components/dialogs/OAuthDialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/OAuthDialog.js +0 -24
- package/local-dist-new/react-ink/components/dialogs/OAuthDialog.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/ScopedModelsDialog.d.ts +0 -10
- package/local-dist-new/react-ink/components/dialogs/ScopedModelsDialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/ScopedModelsDialog.js +0 -95
- package/local-dist-new/react-ink/components/dialogs/ScopedModelsDialog.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/SelectableDialog.d.ts +0 -17
- package/local-dist-new/react-ink/components/dialogs/SelectableDialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/SelectableDialog.js +0 -66
- package/local-dist-new/react-ink/components/dialogs/SelectableDialog.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/SessionDialog.d.ts +0 -14
- package/local-dist-new/react-ink/components/dialogs/SessionDialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/SessionDialog.js +0 -201
- package/local-dist-new/react-ink/components/dialogs/SessionDialog.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/SettingsDialog.d.ts +0 -15
- package/local-dist-new/react-ink/components/dialogs/SettingsDialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/SettingsDialog.js +0 -79
- package/local-dist-new/react-ink/components/dialogs/SettingsDialog.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/StartupSessionPicker.d.ts +0 -10
- package/local-dist-new/react-ink/components/dialogs/StartupSessionPicker.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/StartupSessionPicker.js +0 -100
- package/local-dist-new/react-ink/components/dialogs/StartupSessionPicker.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/ThemeDialog.d.ts +0 -8
- package/local-dist-new/react-ink/components/dialogs/ThemeDialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/ThemeDialog.js +0 -7
- package/local-dist-new/react-ink/components/dialogs/ThemeDialog.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/TreeDialog.d.ts +0 -9
- package/local-dist-new/react-ink/components/dialogs/TreeDialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/TreeDialog.js +0 -7
- package/local-dist-new/react-ink/components/dialogs/TreeDialog.js.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/UserMessageDialog.d.ts +0 -9
- package/local-dist-new/react-ink/components/dialogs/UserMessageDialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/dialogs/UserMessageDialog.js +0 -7
- package/local-dist-new/react-ink/components/dialogs/UserMessageDialog.js.map +0 -1
- package/local-dist-new/react-ink/components/messages/AssistantMessage.d.ts +0 -13
- package/local-dist-new/react-ink/components/messages/AssistantMessage.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/messages/AssistantMessage.js +0 -20
- package/local-dist-new/react-ink/components/messages/AssistantMessage.js.map +0 -1
- package/local-dist-new/react-ink/components/messages/BashMessage.d.ts +0 -9
- package/local-dist-new/react-ink/components/messages/BashMessage.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/messages/BashMessage.js +0 -11
- package/local-dist-new/react-ink/components/messages/BashMessage.js.map +0 -1
- package/local-dist-new/react-ink/components/messages/BranchSummaryMessage.d.ts +0 -9
- package/local-dist-new/react-ink/components/messages/BranchSummaryMessage.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/messages/BranchSummaryMessage.js +0 -6
- package/local-dist-new/react-ink/components/messages/BranchSummaryMessage.js.map +0 -1
- package/local-dist-new/react-ink/components/messages/CompactionMessage.d.ts +0 -9
- package/local-dist-new/react-ink/components/messages/CompactionMessage.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/messages/CompactionMessage.js +0 -6
- package/local-dist-new/react-ink/components/messages/CompactionMessage.js.map +0 -1
- package/local-dist-new/react-ink/components/messages/CustomMessage.d.ts +0 -10
- package/local-dist-new/react-ink/components/messages/CustomMessage.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/messages/CustomMessage.js +0 -9
- package/local-dist-new/react-ink/components/messages/CustomMessage.js.map +0 -1
- package/local-dist-new/react-ink/components/messages/SkillInvocationMessage.d.ts +0 -8
- package/local-dist-new/react-ink/components/messages/SkillInvocationMessage.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/messages/SkillInvocationMessage.js +0 -10
- package/local-dist-new/react-ink/components/messages/SkillInvocationMessage.js.map +0 -1
- package/local-dist-new/react-ink/components/messages/ToolCallMessage.d.ts +0 -9
- package/local-dist-new/react-ink/components/messages/ToolCallMessage.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/messages/ToolCallMessage.js +0 -8
- package/local-dist-new/react-ink/components/messages/ToolCallMessage.js.map +0 -1
- package/local-dist-new/react-ink/components/messages/ToolResultBlock.d.ts +0 -13
- package/local-dist-new/react-ink/components/messages/ToolResultBlock.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/messages/ToolResultBlock.js +0 -8
- package/local-dist-new/react-ink/components/messages/ToolResultBlock.js.map +0 -1
- package/local-dist-new/react-ink/components/messages/UserMessage.d.ts +0 -10
- package/local-dist-new/react-ink/components/messages/UserMessage.d.ts.map +0 -1
- package/local-dist-new/react-ink/components/messages/UserMessage.js +0 -9
- package/local-dist-new/react-ink/components/messages/UserMessage.js.map +0 -1
- package/local-dist-new/react-ink/index.d.ts +0 -35
- package/local-dist-new/react-ink/index.d.ts.map +0 -1
- package/local-dist-new/react-ink/index.js +0 -35
- package/local-dist-new/react-ink/index.js.map +0 -1
- package/local-dist-new/react-ink/theme-adapter.d.ts +0 -10
- package/local-dist-new/react-ink/theme-adapter.d.ts.map +0 -1
- package/local-dist-new/react-ink/theme-adapter.js +0 -44
- package/local-dist-new/react-ink/theme-adapter.js.map +0 -1
- package/local-dist-new/react-ink/types.d.ts +0 -134
- package/local-dist-new/react-ink/types.d.ts.map +0 -1
- package/local-dist-new/react-ink/types.js +0 -2
- package/local-dist-new/react-ink/types.js.map +0 -1
- package/local-dist-new/react-ink/utils/message-groups.d.ts +0 -26
- package/local-dist-new/react-ink/utils/message-groups.d.ts.map +0 -1
- package/local-dist-new/react-ink/utils/message-groups.js +0 -240
- package/local-dist-new/react-ink/utils/message-groups.js.map +0 -1
- package/local-dist-new/react-ink/utils/selection-dialog.d.ts +0 -3
- package/local-dist-new/react-ink/utils/selection-dialog.d.ts.map +0 -1
- package/local-dist-new/react-ink/utils/selection-dialog.js +0 -18
- package/local-dist-new/react-ink/utils/selection-dialog.js.map +0 -1
- package/local-dist-new/react-ink/utils/session-browser.d.ts +0 -28
- package/local-dist-new/react-ink/utils/session-browser.d.ts.map +0 -1
- package/local-dist-new/react-ink/utils/session-browser.js +0 -191
- package/local-dist-new/react-ink/utils/session-browser.js.map +0 -1
- package/local-dist-new/react-ink/utils/tool-display.d.ts +0 -22
- package/local-dist-new/react-ink/utils/tool-display.d.ts.map +0 -1
- package/local-dist-new/react-ink/utils/tool-display.js +0 -349
- package/local-dist-new/react-ink/utils/tool-display.js.map +0 -1
- package/local-dist-new/react-ink.d.ts +0 -3
- package/local-dist-new/react-ink.d.ts.map +0 -1
- package/local-dist-new/react-ink.js +0 -2
- package/local-dist-new/react-ink.js.map +0 -1
- package/local-dist-new/tui.d.ts +0 -9
- package/local-dist-new/tui.d.ts.map +0 -1
- package/local-dist-new/tui.js +0 -8
- package/local-dist-new/tui.js.map +0 -1
- package/local-dist-new/ui/autocomplete.d.ts +0 -60
- package/local-dist-new/ui/autocomplete.d.ts.map +0 -1
- package/local-dist-new/ui/autocomplete.js +0 -393
- package/local-dist-new/ui/autocomplete.js.map +0 -1
- package/local-dist-new/ui/contracts.d.ts +0 -39
- package/local-dist-new/ui/contracts.d.ts.map +0 -1
- package/local-dist-new/ui/contracts.js +0 -2
- package/local-dist-new/ui/contracts.js.map +0 -1
- package/local-dist-new/ui/editor-component.d.ts +0 -101
- package/local-dist-new/ui/editor-component.d.ts.map +0 -1
- package/local-dist-new/ui/editor-component.js +0 -2
- package/local-dist-new/ui/editor-component.js.map +0 -1
- package/local-dist-new/ui/fuzzy.d.ts +0 -26
- package/local-dist-new/ui/fuzzy.d.ts.map +0 -1
- package/local-dist-new/ui/fuzzy.js +0 -177
- package/local-dist-new/ui/fuzzy.js.map +0 -1
- package/local-dist-new/ui/index.d.ts +0 -9
- package/local-dist-new/ui/index.d.ts.map +0 -1
- package/local-dist-new/ui/index.js +0 -6
- package/local-dist-new/ui/index.js.map +0 -1
- package/local-dist-new/ui/keybindings.d.ts +0 -52
- package/local-dist-new/ui/keybindings.d.ts.map +0 -1
- package/local-dist-new/ui/keybindings.js +0 -193
- package/local-dist-new/ui/keybindings.js.map +0 -1
- package/local-dist-new/ui/keys.d.ts +0 -168
- package/local-dist-new/ui/keys.d.ts.map +0 -1
- package/local-dist-new/ui/keys.js +0 -1093
- package/local-dist-new/ui/keys.js.map +0 -1
- package/local-dist-new/ui/theme-types.d.ts +0 -37
- package/local-dist-new/ui/theme-types.d.ts.map +0 -1
- package/local-dist-new/ui/theme-types.js +0 -2
- package/local-dist-new/ui/theme-types.js.map +0 -1
- package/local-dist-new/ui/utils.d.ts +0 -97
- package/local-dist-new/ui/utils.d.ts.map +0 -1
- package/local-dist-new/ui/utils.js +0 -860
- package/local-dist-new/ui/utils.js.map +0 -1
- package/observe.d.ts +0 -1
- package/observe.js +0 -1
package/dist/tui.js
ADDED
|
@@ -0,0 +1,2213 @@
|
|
|
1
|
+
// src/ui/autocomplete.ts
|
|
2
|
+
import { spawnSync } from "child_process";
|
|
3
|
+
import { readdirSync, statSync } from "fs";
|
|
4
|
+
import { homedir } from "os";
|
|
5
|
+
import { basename, dirname, join } from "path";
|
|
6
|
+
|
|
7
|
+
// src/ui/fuzzy.ts
|
|
8
|
+
var DEFAULT_FUZZY_CONFIG = {
|
|
9
|
+
gapPenalty: 3,
|
|
10
|
+
consecutiveReward: 4,
|
|
11
|
+
wordBoundaryReward: 12,
|
|
12
|
+
lateMatchPenalty: 0.15,
|
|
13
|
+
swappedTokenPenalty: 6
|
|
14
|
+
};
|
|
15
|
+
var WORD_BOUNDARY = /[\s\-_./:\\@~]/;
|
|
16
|
+
function locateMatchColumns(queryLower, textLower) {
|
|
17
|
+
const columns = [];
|
|
18
|
+
let cursor = 0;
|
|
19
|
+
for (let needle = 0; needle < queryLower.length; needle++) {
|
|
20
|
+
const wanted = queryLower[needle];
|
|
21
|
+
let found = -1;
|
|
22
|
+
while (cursor < textLower.length) {
|
|
23
|
+
const here = cursor++;
|
|
24
|
+
if (textLower[here] === wanted) {
|
|
25
|
+
found = here;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (found < 0) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
columns.push(found);
|
|
33
|
+
}
|
|
34
|
+
return columns;
|
|
35
|
+
}
|
|
36
|
+
function scoreMatchColumns(textLower, columns, config) {
|
|
37
|
+
let total = 0;
|
|
38
|
+
let previous = -1;
|
|
39
|
+
let streak = 0;
|
|
40
|
+
for (const column of columns) {
|
|
41
|
+
const adjacent = previous === column - 1;
|
|
42
|
+
if (adjacent) {
|
|
43
|
+
streak += 1;
|
|
44
|
+
total -= streak * config.consecutiveReward;
|
|
45
|
+
} else {
|
|
46
|
+
streak = 0;
|
|
47
|
+
if (previous >= 0) {
|
|
48
|
+
total += (column - previous - 1) * config.gapPenalty;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const startsWord = column === 0 || WORD_BOUNDARY.test(textLower[column - 1]);
|
|
52
|
+
if (startsWord) {
|
|
53
|
+
total -= config.wordBoundaryReward;
|
|
54
|
+
}
|
|
55
|
+
total += column * config.lateMatchPenalty;
|
|
56
|
+
previous = column;
|
|
57
|
+
}
|
|
58
|
+
return total;
|
|
59
|
+
}
|
|
60
|
+
var SequentialScanEngine = class {
|
|
61
|
+
static match(queryLower, textLower, config) {
|
|
62
|
+
if (queryLower.length === 0) {
|
|
63
|
+
return { matches: true, score: 0 };
|
|
64
|
+
}
|
|
65
|
+
if (queryLower.length > textLower.length) {
|
|
66
|
+
return { matches: false, score: 0 };
|
|
67
|
+
}
|
|
68
|
+
const columns = locateMatchColumns(queryLower, textLower);
|
|
69
|
+
if (columns === null) {
|
|
70
|
+
return { matches: false, score: 0 };
|
|
71
|
+
}
|
|
72
|
+
return { matches: true, score: scoreMatchColumns(textLower, columns, config) };
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var SequentialFuzzyStrategy = class {
|
|
76
|
+
match(query, text, config) {
|
|
77
|
+
return SequentialScanEngine.match(query.toLowerCase(), text.toLowerCase(), config);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var CacheEvictionPolicy = class {
|
|
81
|
+
constructor(maxSize) {
|
|
82
|
+
this.maxSize = maxSize;
|
|
83
|
+
}
|
|
84
|
+
maxSize;
|
|
85
|
+
evictIfNeeded(cache) {
|
|
86
|
+
if (cache.size < this.maxSize) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const oldest = cache.keys().next().value;
|
|
90
|
+
if (oldest) {
|
|
91
|
+
cache.delete(oldest);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var CachedFuzzyMatcher = class {
|
|
96
|
+
constructor(strategy, config, maxSize = 2e3) {
|
|
97
|
+
this.strategy = strategy;
|
|
98
|
+
this.config = config;
|
|
99
|
+
this.eviction = new CacheEvictionPolicy(maxSize);
|
|
100
|
+
}
|
|
101
|
+
strategy;
|
|
102
|
+
config;
|
|
103
|
+
cache = /* @__PURE__ */ new Map();
|
|
104
|
+
eviction;
|
|
105
|
+
match(query, text) {
|
|
106
|
+
const key = `${query}${text}`;
|
|
107
|
+
const cached = this.cache.get(key);
|
|
108
|
+
if (cached) {
|
|
109
|
+
return cached;
|
|
110
|
+
}
|
|
111
|
+
const result = this.strategy.match(query, text, this.config);
|
|
112
|
+
this.eviction.evictIfNeeded(this.cache);
|
|
113
|
+
this.cache.set(key, result);
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
clear() {
|
|
117
|
+
this.cache.clear();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
var FuzzyQuerySwapResolver = class {
|
|
121
|
+
// When a query is a single run of letters glued to a single run of digits
|
|
122
|
+
// (or vice-versa), produce the variant with the two runs swapped. Anything
|
|
123
|
+
// else yields an empty string, meaning "no alternative to try".
|
|
124
|
+
static toSwappedQuery(query) {
|
|
125
|
+
const normalized = query.toLowerCase();
|
|
126
|
+
const letterThenDigit = /^(?<letters>[a-z]+)(?<digits>[0-9]+)$/.exec(normalized);
|
|
127
|
+
if (letterThenDigit) {
|
|
128
|
+
const { letters = "", digits = "" } = letterThenDigit.groups ?? {};
|
|
129
|
+
return `${digits}${letters}`;
|
|
130
|
+
}
|
|
131
|
+
const digitThenLetter = /^(?<digits>[0-9]+)(?<letters>[a-z]+)$/.exec(normalized);
|
|
132
|
+
if (digitThenLetter) {
|
|
133
|
+
const { letters = "", digits = "" } = digitThenLetter.groups ?? {};
|
|
134
|
+
return `${letters}${digits}`;
|
|
135
|
+
}
|
|
136
|
+
return "";
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var FuzzyTokenMatcher = class {
|
|
140
|
+
static tokenize(query) {
|
|
141
|
+
const trimmed = query.trim();
|
|
142
|
+
if (trimmed.length === 0) {
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
return trimmed.split(/\s+/).filter((piece) => piece.length > 0);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var defaultMatcher = new CachedFuzzyMatcher(new SequentialFuzzyStrategy(), DEFAULT_FUZZY_CONFIG);
|
|
149
|
+
function fuzzyMatch(query, text) {
|
|
150
|
+
const direct = defaultMatcher.match(query, text);
|
|
151
|
+
if (direct.matches) {
|
|
152
|
+
return direct;
|
|
153
|
+
}
|
|
154
|
+
const alternative = FuzzyQuerySwapResolver.toSwappedQuery(query);
|
|
155
|
+
if (alternative.length === 0) {
|
|
156
|
+
return direct;
|
|
157
|
+
}
|
|
158
|
+
const swapped = defaultMatcher.match(alternative, text);
|
|
159
|
+
if (!swapped.matches) {
|
|
160
|
+
return direct;
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
matches: true,
|
|
164
|
+
score: swapped.score + DEFAULT_FUZZY_CONFIG.swappedTokenPenalty
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function fuzzyFilter(items, query, getText) {
|
|
168
|
+
const tokens = FuzzyTokenMatcher.tokenize(query);
|
|
169
|
+
if (tokens.length === 0) {
|
|
170
|
+
return items;
|
|
171
|
+
}
|
|
172
|
+
const ranked = [];
|
|
173
|
+
for (const item of items) {
|
|
174
|
+
const text = getText(item);
|
|
175
|
+
let aggregate = 0;
|
|
176
|
+
let qualifies = true;
|
|
177
|
+
for (const token of tokens) {
|
|
178
|
+
const outcome = fuzzyMatch(token, text);
|
|
179
|
+
if (!outcome.matches) {
|
|
180
|
+
qualifies = false;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
aggregate += outcome.score;
|
|
184
|
+
}
|
|
185
|
+
if (qualifies) {
|
|
186
|
+
ranked.push({ item, rank: aggregate });
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
ranked.sort((left, right) => left.rank - right.rank);
|
|
190
|
+
return ranked.map((entry) => entry.item);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/ui/autocomplete.ts
|
|
194
|
+
function walkDirectoryWithFd(baseDir, fdPath, query, maxResults) {
|
|
195
|
+
const invocation = ["--base-directory", baseDir];
|
|
196
|
+
invocation.push("--max-results", String(maxResults));
|
|
197
|
+
invocation.push("--type", "f", "--type", "d");
|
|
198
|
+
invocation.push("--full-path");
|
|
199
|
+
if (query) {
|
|
200
|
+
invocation.push(query);
|
|
201
|
+
}
|
|
202
|
+
const child = spawnSync(fdPath, invocation, {
|
|
203
|
+
encoding: "utf-8",
|
|
204
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
205
|
+
maxBuffer: 10 * 1024 * 1024
|
|
206
|
+
});
|
|
207
|
+
const exitedCleanly = child.status === 0 && Boolean(child.stdout);
|
|
208
|
+
if (!exitedCleanly) {
|
|
209
|
+
return [];
|
|
210
|
+
}
|
|
211
|
+
const lines = child.stdout.trim().split("\n");
|
|
212
|
+
const entries = [];
|
|
213
|
+
for (const line of lines) {
|
|
214
|
+
if (!line) {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
entries.push({ path: line, isDirectory: line.endsWith("/") });
|
|
218
|
+
}
|
|
219
|
+
return entries;
|
|
220
|
+
}
|
|
221
|
+
var SuggestionCache = class {
|
|
222
|
+
store = /* @__PURE__ */ new Map();
|
|
223
|
+
getOrLoad(key, loader) {
|
|
224
|
+
const cached = this.store.get(key);
|
|
225
|
+
if (cached) return cached;
|
|
226
|
+
const loaded = loader();
|
|
227
|
+
this.evictIfNeeded();
|
|
228
|
+
this.store.set(key, loaded);
|
|
229
|
+
return loaded;
|
|
230
|
+
}
|
|
231
|
+
clear() {
|
|
232
|
+
this.store.clear();
|
|
233
|
+
}
|
|
234
|
+
evictIfNeeded() {
|
|
235
|
+
if (this.store.size <= 200) return;
|
|
236
|
+
const oldest = this.store.keys().next().value;
|
|
237
|
+
if (oldest) this.store.delete(oldest);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
var CommandAutocompleteEngine = class {
|
|
241
|
+
constructor(commands) {
|
|
242
|
+
this.commands = commands;
|
|
243
|
+
}
|
|
244
|
+
commands;
|
|
245
|
+
getSuggestions(textBeforeCursor) {
|
|
246
|
+
if (!textBeforeCursor.startsWith("/")) return null;
|
|
247
|
+
const spaceIndex = textBeforeCursor.indexOf(" ");
|
|
248
|
+
if (spaceIndex === -1) {
|
|
249
|
+
return this.completeCommandName(textBeforeCursor);
|
|
250
|
+
}
|
|
251
|
+
return this.completeCommandArgument(textBeforeCursor, spaceIndex);
|
|
252
|
+
}
|
|
253
|
+
completeCommandName(textBeforeCursor) {
|
|
254
|
+
const typed = textBeforeCursor.slice(1);
|
|
255
|
+
const searchable = this.commands.map((entry) => {
|
|
256
|
+
const isSlash = "name" in entry;
|
|
257
|
+
return {
|
|
258
|
+
name: isSlash ? entry.name : entry.value,
|
|
259
|
+
label: isSlash ? entry.name : entry.label,
|
|
260
|
+
description: entry.description
|
|
261
|
+
};
|
|
262
|
+
});
|
|
263
|
+
const ranked = fuzzyFilter(searchable, typed, (entry) => entry.name);
|
|
264
|
+
const items = ranked.map((entry) => {
|
|
265
|
+
const suggestion = { value: entry.name, label: entry.label };
|
|
266
|
+
if (entry.description) {
|
|
267
|
+
suggestion.description = entry.description;
|
|
268
|
+
}
|
|
269
|
+
return suggestion;
|
|
270
|
+
});
|
|
271
|
+
if (items.length === 0) return null;
|
|
272
|
+
return { items, prefix: textBeforeCursor };
|
|
273
|
+
}
|
|
274
|
+
completeCommandArgument(textBeforeCursor, spaceIndex) {
|
|
275
|
+
const commandName = textBeforeCursor.slice(1, spaceIndex);
|
|
276
|
+
const argumentPrefix = textBeforeCursor.slice(spaceIndex + 1);
|
|
277
|
+
const command = this.commands.find((cmd) => {
|
|
278
|
+
const name = "name" in cmd ? cmd.name : cmd.value;
|
|
279
|
+
return name === commandName;
|
|
280
|
+
});
|
|
281
|
+
if (!command || !("getArgumentCompletions" in command) || !command.getArgumentCompletions) {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
const items = command.getArgumentCompletions(argumentPrefix);
|
|
285
|
+
if (!items || items.length === 0) return null;
|
|
286
|
+
return { items, prefix: argumentPrefix };
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
var AttachmentAutocompleteEngine = class {
|
|
290
|
+
getAttachmentPrefix(textBeforeCursor) {
|
|
291
|
+
const match = textBeforeCursor.match(/(?:^|[\s])(@[^\s]*)$/);
|
|
292
|
+
return match?.[1] ?? null;
|
|
293
|
+
}
|
|
294
|
+
toQuery(prefix) {
|
|
295
|
+
return prefix.slice(1);
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
var PathAutocompleteEngine = class {
|
|
299
|
+
constructor(basePath, fdPath) {
|
|
300
|
+
this.basePath = basePath;
|
|
301
|
+
this.fdPath = fdPath;
|
|
302
|
+
}
|
|
303
|
+
basePath;
|
|
304
|
+
fdPath;
|
|
305
|
+
extractPathPrefix(text, forceExtract = false) {
|
|
306
|
+
const atMatch = text.match(/@([^\s]*)$/);
|
|
307
|
+
if (atMatch) return atMatch[0];
|
|
308
|
+
const delimiters = [" ", " ", '"', "'", "="];
|
|
309
|
+
let cut = -1;
|
|
310
|
+
for (const delimiter of delimiters) {
|
|
311
|
+
const at = text.lastIndexOf(delimiter);
|
|
312
|
+
if (at > cut) cut = at;
|
|
313
|
+
}
|
|
314
|
+
const fragment = cut === -1 ? text : text.slice(cut + 1);
|
|
315
|
+
if (forceExtract) return fragment;
|
|
316
|
+
const looksLikePath = fragment.includes("/") || fragment.startsWith(".") || fragment.startsWith("~/");
|
|
317
|
+
if (looksLikePath) return fragment;
|
|
318
|
+
const atFreshToken = fragment === "" && (text === "" || text.endsWith(" "));
|
|
319
|
+
if (atFreshToken) return fragment;
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
shouldTriggerForTab(textBeforeCursor) {
|
|
323
|
+
const trimmed = textBeforeCursor.trim();
|
|
324
|
+
const isBareCommandName = trimmed.startsWith("/") && !trimmed.includes(" ");
|
|
325
|
+
return !isBareCommandName;
|
|
326
|
+
}
|
|
327
|
+
getFileSuggestions(prefix) {
|
|
328
|
+
try {
|
|
329
|
+
const plan = this.resolveSearchPlan(prefix);
|
|
330
|
+
const entries = readdirSync(plan.searchDir, { withFileTypes: true });
|
|
331
|
+
const suggestions = [];
|
|
332
|
+
for (const entry of entries) {
|
|
333
|
+
if (!entry.name.toLowerCase().startsWith(plan.searchPrefix.toLowerCase())) continue;
|
|
334
|
+
const isDirectory = this.resolveDirectoryFlag(plan.searchDir, entry.name, entry.isDirectory(), entry.isSymbolicLink());
|
|
335
|
+
const relativePath = this.toRelativePath(prefix, plan.expandedPrefix, entry.name, plan.isAtPrefix);
|
|
336
|
+
suggestions.push({
|
|
337
|
+
value: isDirectory ? `${relativePath}/` : relativePath,
|
|
338
|
+
label: entry.name + (isDirectory ? "/" : "")
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
return suggestions.sort((a, b) => {
|
|
342
|
+
const aDir = a.value.endsWith("/");
|
|
343
|
+
const bDir = b.value.endsWith("/");
|
|
344
|
+
if (aDir && !bDir) return -1;
|
|
345
|
+
if (!aDir && bDir) return 1;
|
|
346
|
+
return a.label.localeCompare(b.label);
|
|
347
|
+
});
|
|
348
|
+
} catch {
|
|
349
|
+
return [];
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
getFuzzyFileSuggestions(query) {
|
|
353
|
+
if (!this.fdPath) return [];
|
|
354
|
+
try {
|
|
355
|
+
const found = walkDirectoryWithFd(this.basePath, this.fdPath, query, 100);
|
|
356
|
+
const withScores = found.map((entry) => ({
|
|
357
|
+
...entry,
|
|
358
|
+
score: query ? this.scoreEntry(entry.path, query, entry.isDirectory) : 1
|
|
359
|
+
}));
|
|
360
|
+
const top = withScores.filter((entry) => entry.score > 0).sort((a, b) => b.score - a.score).slice(0, 20);
|
|
361
|
+
return top.map(({ path: entryPath, isDirectory }) => {
|
|
362
|
+
const bare = isDirectory ? entryPath.slice(0, -1) : entryPath;
|
|
363
|
+
return {
|
|
364
|
+
value: `@${entryPath}`,
|
|
365
|
+
label: basename(bare) + (isDirectory ? "/" : ""),
|
|
366
|
+
description: bare
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
} catch {
|
|
370
|
+
return [];
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
resolveSearchPlan(prefix) {
|
|
374
|
+
const isAtPrefix = prefix.startsWith("@");
|
|
375
|
+
let expandedPrefix = isAtPrefix ? prefix.slice(1) : prefix;
|
|
376
|
+
if (expandedPrefix.startsWith("~")) expandedPrefix = this.expandHomePath(expandedPrefix);
|
|
377
|
+
const rootLike = expandedPrefix === "" || expandedPrefix === "./" || expandedPrefix === "../" || expandedPrefix === "~" || expandedPrefix === "~/" || expandedPrefix === "/" || prefix === "@";
|
|
378
|
+
if (rootLike) {
|
|
379
|
+
const searchDir2 = prefix.startsWith("~") || expandedPrefix === "/" ? expandedPrefix : join(this.basePath, expandedPrefix);
|
|
380
|
+
return { searchDir: searchDir2, searchPrefix: "", expandedPrefix, isAtPrefix };
|
|
381
|
+
}
|
|
382
|
+
if (expandedPrefix.endsWith("/")) {
|
|
383
|
+
const searchDir2 = prefix.startsWith("~") || expandedPrefix.startsWith("/") ? expandedPrefix : join(this.basePath, expandedPrefix);
|
|
384
|
+
return { searchDir: searchDir2, searchPrefix: "", expandedPrefix, isAtPrefix };
|
|
385
|
+
}
|
|
386
|
+
const dir = dirname(expandedPrefix);
|
|
387
|
+
const file = basename(expandedPrefix);
|
|
388
|
+
const searchDir = prefix.startsWith("~") || expandedPrefix.startsWith("/") ? dir : join(this.basePath, dir);
|
|
389
|
+
return { searchDir, searchPrefix: file, expandedPrefix, isAtPrefix };
|
|
390
|
+
}
|
|
391
|
+
toRelativePath(prefix, expandedPrefix, name, isAtPrefix) {
|
|
392
|
+
if (isAtPrefix) return this.buildAtPath(expandedPrefix, name);
|
|
393
|
+
if (prefix.endsWith("/")) return prefix + name;
|
|
394
|
+
if (prefix.includes("/")) {
|
|
395
|
+
if (prefix.startsWith("~/")) {
|
|
396
|
+
const homeRelativeDir = prefix.slice(2);
|
|
397
|
+
const dir = dirname(homeRelativeDir);
|
|
398
|
+
return `~/${dir === "." ? name : join(dir, name)}`;
|
|
399
|
+
}
|
|
400
|
+
if (prefix.startsWith("/")) {
|
|
401
|
+
const dir = dirname(prefix);
|
|
402
|
+
return dir === "/" ? `/${name}` : `${dir}/${name}`;
|
|
403
|
+
}
|
|
404
|
+
return join(dirname(prefix), name);
|
|
405
|
+
}
|
|
406
|
+
return prefix.startsWith("~") ? `~/${name}` : name;
|
|
407
|
+
}
|
|
408
|
+
buildAtPath(pathWithoutAt, name) {
|
|
409
|
+
if (pathWithoutAt.endsWith("/")) {
|
|
410
|
+
return `@${pathWithoutAt}${name}`;
|
|
411
|
+
}
|
|
412
|
+
if (pathWithoutAt.includes("/")) {
|
|
413
|
+
if (pathWithoutAt.startsWith("~/")) {
|
|
414
|
+
const homeRelativeDir = pathWithoutAt.slice(2);
|
|
415
|
+
const dir = dirname(homeRelativeDir);
|
|
416
|
+
return `@~/${dir === "." ? name : join(dir, name)}`;
|
|
417
|
+
}
|
|
418
|
+
return `@${join(dirname(pathWithoutAt), name)}`;
|
|
419
|
+
}
|
|
420
|
+
return pathWithoutAt.startsWith("~") ? `@~/${name}` : `@${name}`;
|
|
421
|
+
}
|
|
422
|
+
resolveDirectoryFlag(searchDir, name, isDirectory, isSymlink) {
|
|
423
|
+
if (isDirectory || !isSymlink) return isDirectory;
|
|
424
|
+
try {
|
|
425
|
+
return statSync(join(searchDir, name)).isDirectory();
|
|
426
|
+
} catch {
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
expandHomePath(pathValue) {
|
|
431
|
+
if (pathValue.startsWith("~/")) {
|
|
432
|
+
const expanded = join(homedir(), pathValue.slice(2));
|
|
433
|
+
return pathValue.endsWith("/") && !expanded.endsWith("/") ? `${expanded}/` : expanded;
|
|
434
|
+
}
|
|
435
|
+
if (pathValue === "~") return homedir();
|
|
436
|
+
return pathValue;
|
|
437
|
+
}
|
|
438
|
+
scoreEntry(filePath, query, isDirectory) {
|
|
439
|
+
const fileName = basename(filePath).toLowerCase();
|
|
440
|
+
const queryLower = query.toLowerCase();
|
|
441
|
+
let score = 0;
|
|
442
|
+
if (fileName === queryLower) score = 100;
|
|
443
|
+
else if (fileName.startsWith(queryLower)) score = 80;
|
|
444
|
+
else if (fileName.includes(queryLower)) score = 50;
|
|
445
|
+
else if (filePath.toLowerCase().includes(queryLower)) score = 30;
|
|
446
|
+
if (isDirectory && score > 0) score += 10;
|
|
447
|
+
return score;
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
var CompletionApplyStrategy = class {
|
|
451
|
+
apply(lines, cursorLine, cursorCol, item, prefix) {
|
|
452
|
+
const currentLine = lines[cursorLine] || "";
|
|
453
|
+
const head = currentLine.slice(0, cursorCol - prefix.length);
|
|
454
|
+
const tail = currentLine.slice(cursorCol);
|
|
455
|
+
if (this.isCommandName(prefix, head)) {
|
|
456
|
+
const rebuilt2 = `${head}/${item.value} ${tail}`;
|
|
457
|
+
const caret2 = head.length + item.value.length + 2;
|
|
458
|
+
return this.writeLine(lines, cursorLine, rebuilt2, caret2);
|
|
459
|
+
}
|
|
460
|
+
if (prefix.startsWith("@")) {
|
|
461
|
+
const trailing = item.value.endsWith("/") ? "" : " ";
|
|
462
|
+
const rebuilt2 = `${head}${item.value}${trailing}${tail}`;
|
|
463
|
+
const caret2 = head.length + item.value.length + trailing.length;
|
|
464
|
+
return this.writeLine(lines, cursorLine, rebuilt2, caret2);
|
|
465
|
+
}
|
|
466
|
+
const rebuilt = `${head}${item.value}${tail}`;
|
|
467
|
+
const caret = head.length + item.value.length;
|
|
468
|
+
return this.writeLine(lines, cursorLine, rebuilt, caret);
|
|
469
|
+
}
|
|
470
|
+
isCommandName(prefix, head) {
|
|
471
|
+
return prefix.startsWith("/") && head.trim() === "" && !prefix.slice(1).includes("/");
|
|
472
|
+
}
|
|
473
|
+
writeLine(lines, cursorLine, line, cursorCol) {
|
|
474
|
+
const newLines = [...lines];
|
|
475
|
+
newLines[cursorLine] = line;
|
|
476
|
+
return { lines: newLines, cursorLine, cursorCol };
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
var CombinedAutocompleteProvider = class {
|
|
480
|
+
constructor(commands = [], basePath = process.cwd(), fdPath = null) {
|
|
481
|
+
this.basePath = basePath;
|
|
482
|
+
this.fdPath = fdPath;
|
|
483
|
+
this.commandEngine = new CommandAutocompleteEngine(commands);
|
|
484
|
+
this.pathEngine = new PathAutocompleteEngine(this.basePath, this.fdPath);
|
|
485
|
+
}
|
|
486
|
+
basePath;
|
|
487
|
+
fdPath;
|
|
488
|
+
cache = new SuggestionCache();
|
|
489
|
+
commandEngine;
|
|
490
|
+
attachmentEngine = new AttachmentAutocompleteEngine();
|
|
491
|
+
pathEngine;
|
|
492
|
+
applyStrategy = new CompletionApplyStrategy();
|
|
493
|
+
getSuggestions(lines, cursorLine, cursorCol) {
|
|
494
|
+
const currentLine = lines[cursorLine] || "";
|
|
495
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
496
|
+
const attachmentPrefix = this.attachmentEngine.getAttachmentPrefix(textBeforeCursor);
|
|
497
|
+
if (attachmentPrefix) {
|
|
498
|
+
const query = this.attachmentEngine.toQuery(attachmentPrefix);
|
|
499
|
+
const items2 = this.cache.getOrLoad(`fuzzy:${query}`, () => this.pathEngine.getFuzzyFileSuggestions(query));
|
|
500
|
+
if (items2.length > 0) return { items: items2, prefix: attachmentPrefix };
|
|
501
|
+
}
|
|
502
|
+
const commandSuggestions = this.commandEngine.getSuggestions(textBeforeCursor);
|
|
503
|
+
if (commandSuggestions) return commandSuggestions;
|
|
504
|
+
const pathPrefix = this.pathEngine.extractPathPrefix(textBeforeCursor, false);
|
|
505
|
+
if (pathPrefix === null) return null;
|
|
506
|
+
const items = this.cache.getOrLoad(`path:${pathPrefix}`, () => this.pathEngine.getFileSuggestions(pathPrefix));
|
|
507
|
+
if (items.length === 0) return null;
|
|
508
|
+
return { items, prefix: pathPrefix };
|
|
509
|
+
}
|
|
510
|
+
applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
|
|
511
|
+
return this.applyStrategy.apply(lines, cursorLine, cursorCol, item, prefix);
|
|
512
|
+
}
|
|
513
|
+
clearCache() {
|
|
514
|
+
this.cache.clear();
|
|
515
|
+
}
|
|
516
|
+
// Force file completion (called on Tab key) - always returns suggestions
|
|
517
|
+
getForceFileSuggestions(lines, cursorLine, cursorCol) {
|
|
518
|
+
const currentLine = lines[cursorLine] || "";
|
|
519
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
520
|
+
if (!this.pathEngine.shouldTriggerForTab(textBeforeCursor)) return null;
|
|
521
|
+
const pathPrefix = this.pathEngine.extractPathPrefix(textBeforeCursor, true);
|
|
522
|
+
if (pathPrefix === null) return null;
|
|
523
|
+
const items = this.cache.getOrLoad(`path:${pathPrefix}`, () => this.pathEngine.getFileSuggestions(pathPrefix));
|
|
524
|
+
if (items.length === 0) return null;
|
|
525
|
+
return { items, prefix: pathPrefix };
|
|
526
|
+
}
|
|
527
|
+
// Check if we should trigger file completion (called on Tab key)
|
|
528
|
+
shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
|
|
529
|
+
const currentLine = lines[cursorLine] || "";
|
|
530
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
531
|
+
return this.pathEngine.shouldTriggerForTab(textBeforeCursor);
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
// src/ui/keys.ts
|
|
536
|
+
var _kittyProtocolActive = false;
|
|
537
|
+
function setKittyProtocolActive(active) {
|
|
538
|
+
_kittyProtocolActive = active;
|
|
539
|
+
}
|
|
540
|
+
function isKittyProtocolActive() {
|
|
541
|
+
return _kittyProtocolActive;
|
|
542
|
+
}
|
|
543
|
+
var SPECIAL_KEY_LITERAL_MAP = {
|
|
544
|
+
escape: "escape",
|
|
545
|
+
esc: "esc",
|
|
546
|
+
enter: "enter",
|
|
547
|
+
return: "return",
|
|
548
|
+
tab: "tab",
|
|
549
|
+
space: "space",
|
|
550
|
+
backspace: "backspace",
|
|
551
|
+
delete: "delete",
|
|
552
|
+
insert: "insert",
|
|
553
|
+
clear: "clear",
|
|
554
|
+
home: "home",
|
|
555
|
+
end: "end",
|
|
556
|
+
pageUp: "pageUp",
|
|
557
|
+
pageDown: "pageDown",
|
|
558
|
+
up: "up",
|
|
559
|
+
down: "down",
|
|
560
|
+
left: "left",
|
|
561
|
+
right: "right",
|
|
562
|
+
f1: "f1",
|
|
563
|
+
f2: "f2",
|
|
564
|
+
f3: "f3",
|
|
565
|
+
f4: "f4",
|
|
566
|
+
f5: "f5",
|
|
567
|
+
f6: "f6",
|
|
568
|
+
f7: "f7",
|
|
569
|
+
f8: "f8",
|
|
570
|
+
f9: "f9",
|
|
571
|
+
f10: "f10",
|
|
572
|
+
f11: "f11",
|
|
573
|
+
f12: "f12"
|
|
574
|
+
};
|
|
575
|
+
var SYMBOL_KEY_LITERAL_MAP = {
|
|
576
|
+
backtick: "`",
|
|
577
|
+
hyphen: "-",
|
|
578
|
+
equals: "=",
|
|
579
|
+
leftbracket: "[",
|
|
580
|
+
rightbracket: "]",
|
|
581
|
+
backslash: "\\",
|
|
582
|
+
semicolon: ";",
|
|
583
|
+
quote: "'",
|
|
584
|
+
comma: ",",
|
|
585
|
+
period: ".",
|
|
586
|
+
slash: "/",
|
|
587
|
+
exclamation: "!",
|
|
588
|
+
at: "@",
|
|
589
|
+
hash: "#",
|
|
590
|
+
dollar: "$",
|
|
591
|
+
percent: "%",
|
|
592
|
+
caret: "^",
|
|
593
|
+
ampersand: "&",
|
|
594
|
+
asterisk: "*",
|
|
595
|
+
leftparen: "(",
|
|
596
|
+
rightparen: ")",
|
|
597
|
+
underscore: "_",
|
|
598
|
+
plus: "+",
|
|
599
|
+
pipe: "|",
|
|
600
|
+
tilde: "~",
|
|
601
|
+
leftbrace: "{",
|
|
602
|
+
rightbrace: "}",
|
|
603
|
+
colon: ":",
|
|
604
|
+
lessthan: "<",
|
|
605
|
+
greaterthan: ">",
|
|
606
|
+
question: "?"
|
|
607
|
+
};
|
|
608
|
+
var Key = {
|
|
609
|
+
...SPECIAL_KEY_LITERAL_MAP,
|
|
610
|
+
...SYMBOL_KEY_LITERAL_MAP,
|
|
611
|
+
ctrl: (key) => `ctrl+${key}`,
|
|
612
|
+
shift: (key) => `shift+${key}`,
|
|
613
|
+
alt: (key) => `alt+${key}`,
|
|
614
|
+
ctrlShift: (key) => `ctrl+shift+${key}`,
|
|
615
|
+
shiftCtrl: (key) => `shift+ctrl+${key}`,
|
|
616
|
+
ctrlAlt: (key) => `ctrl+alt+${key}`,
|
|
617
|
+
altCtrl: (key) => `alt+ctrl+${key}`,
|
|
618
|
+
shiftAlt: (key) => `shift+alt+${key}`,
|
|
619
|
+
altShift: (key) => `alt+shift+${key}`,
|
|
620
|
+
ctrlShiftAlt: (key) => `ctrl+shift+alt+${key}`
|
|
621
|
+
};
|
|
622
|
+
var SYMBOL_KEYS = /* @__PURE__ */ new Set([
|
|
623
|
+
"`",
|
|
624
|
+
"-",
|
|
625
|
+
"=",
|
|
626
|
+
"[",
|
|
627
|
+
"]",
|
|
628
|
+
"\\",
|
|
629
|
+
";",
|
|
630
|
+
"'",
|
|
631
|
+
",",
|
|
632
|
+
".",
|
|
633
|
+
"/",
|
|
634
|
+
"!",
|
|
635
|
+
"@",
|
|
636
|
+
"#",
|
|
637
|
+
"$",
|
|
638
|
+
"%",
|
|
639
|
+
"^",
|
|
640
|
+
"&",
|
|
641
|
+
"*",
|
|
642
|
+
"(",
|
|
643
|
+
")",
|
|
644
|
+
"_",
|
|
645
|
+
"+",
|
|
646
|
+
"|",
|
|
647
|
+
"~",
|
|
648
|
+
"{",
|
|
649
|
+
"}",
|
|
650
|
+
":",
|
|
651
|
+
"<",
|
|
652
|
+
">",
|
|
653
|
+
"?"
|
|
654
|
+
]);
|
|
655
|
+
var MODIFIERS = {
|
|
656
|
+
shift: 1,
|
|
657
|
+
alt: 2,
|
|
658
|
+
ctrl: 4,
|
|
659
|
+
super: 8,
|
|
660
|
+
hyper: 16,
|
|
661
|
+
meta: 32,
|
|
662
|
+
capsLock: 64,
|
|
663
|
+
numLock: 128
|
|
664
|
+
};
|
|
665
|
+
var LOCK_MASK = MODIFIERS.capsLock | MODIFIERS.numLock;
|
|
666
|
+
var CODEPOINTS = {
|
|
667
|
+
escape: 27,
|
|
668
|
+
tab: 9,
|
|
669
|
+
enter: 13,
|
|
670
|
+
space: 32,
|
|
671
|
+
backspace: 127,
|
|
672
|
+
kpEnter: 57414
|
|
673
|
+
// the keypad Enter key as reported under Kitty
|
|
674
|
+
};
|
|
675
|
+
var ARROW_CODEPOINTS = {
|
|
676
|
+
up: -101,
|
|
677
|
+
down: -102,
|
|
678
|
+
right: -103,
|
|
679
|
+
left: -104
|
|
680
|
+
};
|
|
681
|
+
var FUNCTIONAL_CODEPOINTS = {
|
|
682
|
+
delete: -110,
|
|
683
|
+
insert: -111,
|
|
684
|
+
pageUp: -112,
|
|
685
|
+
pageDown: -113,
|
|
686
|
+
home: -114,
|
|
687
|
+
end: -115
|
|
688
|
+
};
|
|
689
|
+
var LEGACY_KEY_SEQUENCES = {
|
|
690
|
+
arrowDown: ["\x1B[B", "\x1BOB"],
|
|
691
|
+
arrowLeft: ["\x1B[D", "\x1BOD"],
|
|
692
|
+
arrowRight: ["\x1B[C", "\x1BOC"],
|
|
693
|
+
arrowUp: ["\x1B[A", "\x1BOA"],
|
|
694
|
+
clear: ["\x1B[E", "\x1BOE"],
|
|
695
|
+
delete: ["\x1B[3~"],
|
|
696
|
+
end: ["\x1B[F", "\x1BOF", "\x1B[4~", "\x1B[8~"],
|
|
697
|
+
f1: ["\x1BOP", "\x1B[11~", "\x1B[[A"],
|
|
698
|
+
f10: ["\x1B[21~"],
|
|
699
|
+
f11: ["\x1B[23~"],
|
|
700
|
+
f12: ["\x1B[24~"],
|
|
701
|
+
f2: ["\x1BOQ", "\x1B[12~", "\x1B[[B"],
|
|
702
|
+
f3: ["\x1BOR", "\x1B[13~", "\x1B[[C"],
|
|
703
|
+
f4: ["\x1BOS", "\x1B[14~", "\x1B[[D"],
|
|
704
|
+
f5: ["\x1B[15~", "\x1B[[E"],
|
|
705
|
+
f6: ["\x1B[17~"],
|
|
706
|
+
f7: ["\x1B[18~"],
|
|
707
|
+
f8: ["\x1B[19~"],
|
|
708
|
+
f9: ["\x1B[20~"],
|
|
709
|
+
home: ["\x1B[H", "\x1BOH", "\x1B[1~", "\x1B[7~"],
|
|
710
|
+
insert: ["\x1B[2~"],
|
|
711
|
+
pageDown: ["\x1B[6~", "\x1B[[6~"],
|
|
712
|
+
pageUp: ["\x1B[5~", "\x1B[[5~"]
|
|
713
|
+
};
|
|
714
|
+
var LEGACY_SHIFT_SEQUENCES = {
|
|
715
|
+
arrowDown: ["\x1B[b"],
|
|
716
|
+
arrowLeft: ["\x1B[d"],
|
|
717
|
+
arrowRight: ["\x1B[c"],
|
|
718
|
+
arrowUp: ["\x1B[a"],
|
|
719
|
+
clear: ["\x1B[e"],
|
|
720
|
+
delete: ["\x1B[3$"],
|
|
721
|
+
end: ["\x1B[8$"],
|
|
722
|
+
home: ["\x1B[7$"],
|
|
723
|
+
insert: ["\x1B[2$"],
|
|
724
|
+
pageDown: ["\x1B[6$"],
|
|
725
|
+
pageUp: ["\x1B[5$"]
|
|
726
|
+
};
|
|
727
|
+
var LEGACY_CTRL_SEQUENCES = {
|
|
728
|
+
arrowDown: ["\x1BOb"],
|
|
729
|
+
arrowLeft: ["\x1BOd"],
|
|
730
|
+
arrowRight: ["\x1BOc"],
|
|
731
|
+
arrowUp: ["\x1BOa"],
|
|
732
|
+
clear: ["\x1BOe"],
|
|
733
|
+
delete: ["\x1B[3^"],
|
|
734
|
+
end: ["\x1B[8^"],
|
|
735
|
+
home: ["\x1B[7^"],
|
|
736
|
+
insert: ["\x1B[2^"],
|
|
737
|
+
pageDown: ["\x1B[6^"],
|
|
738
|
+
pageUp: ["\x1B[5^"]
|
|
739
|
+
};
|
|
740
|
+
var LEGACY_SEQUENCE_KEY_IDS = {
|
|
741
|
+
"\x1BOA": "up",
|
|
742
|
+
"\x1BOB": "down",
|
|
743
|
+
"\x1BOC": "right",
|
|
744
|
+
"\x1BOD": "left",
|
|
745
|
+
"\x1BOH": "home",
|
|
746
|
+
"\x1BOF": "end",
|
|
747
|
+
"\x1B[E": "clear",
|
|
748
|
+
"\x1BOE": "clear",
|
|
749
|
+
"\x1BOe": "ctrl+clear",
|
|
750
|
+
"\x1B[e": "shift+clear",
|
|
751
|
+
"\x1B[2~": "insert",
|
|
752
|
+
"\x1B[2$": "shift+insert",
|
|
753
|
+
"\x1B[2^": "ctrl+insert",
|
|
754
|
+
"\x1B[3$": "shift+delete",
|
|
755
|
+
"\x1B[3^": "ctrl+delete",
|
|
756
|
+
"\x1B[[5~": "pageUp",
|
|
757
|
+
"\x1B[[6~": "pageDown",
|
|
758
|
+
"\x1B[a": "shift+up",
|
|
759
|
+
"\x1B[b": "shift+down",
|
|
760
|
+
"\x1B[c": "shift+right",
|
|
761
|
+
"\x1B[d": "shift+left",
|
|
762
|
+
"\x1BOa": "ctrl+up",
|
|
763
|
+
"\x1BOb": "ctrl+down",
|
|
764
|
+
"\x1BOc": "ctrl+right",
|
|
765
|
+
"\x1BOd": "ctrl+left",
|
|
766
|
+
"\x1B[5$": "shift+pageUp",
|
|
767
|
+
"\x1B[6$": "shift+pageDown",
|
|
768
|
+
"\x1B[7$": "shift+home",
|
|
769
|
+
"\x1B[8$": "shift+end",
|
|
770
|
+
"\x1B[5^": "ctrl+pageUp",
|
|
771
|
+
"\x1B[6^": "ctrl+pageDown",
|
|
772
|
+
"\x1B[7^": "ctrl+home",
|
|
773
|
+
"\x1B[8^": "ctrl+end",
|
|
774
|
+
"\x1BOP": "f1",
|
|
775
|
+
"\x1BOQ": "f2",
|
|
776
|
+
"\x1BOR": "f3",
|
|
777
|
+
"\x1BOS": "f4",
|
|
778
|
+
"\x1B[11~": "f1",
|
|
779
|
+
"\x1B[12~": "f2",
|
|
780
|
+
"\x1B[13~": "f3",
|
|
781
|
+
"\x1B[14~": "f4",
|
|
782
|
+
"\x1B[[A": "f1",
|
|
783
|
+
"\x1B[[B": "f2",
|
|
784
|
+
"\x1B[[C": "f3",
|
|
785
|
+
"\x1B[[D": "f4",
|
|
786
|
+
"\x1B[[E": "f5",
|
|
787
|
+
"\x1B[15~": "f5",
|
|
788
|
+
"\x1B[17~": "f6",
|
|
789
|
+
"\x1B[18~": "f7",
|
|
790
|
+
"\x1B[19~": "f8",
|
|
791
|
+
"\x1B[20~": "f9",
|
|
792
|
+
"\x1B[21~": "f10",
|
|
793
|
+
"\x1B[23~": "f11",
|
|
794
|
+
"\x1B[24~": "f12",
|
|
795
|
+
"\x1Bb": "alt+left",
|
|
796
|
+
"\x1Bf": "alt+right",
|
|
797
|
+
"\x1Bp": "alt+up",
|
|
798
|
+
"\x1Bn": "alt+down"
|
|
799
|
+
};
|
|
800
|
+
var matchesLegacySequence = (data, sequences) => sequences.includes(data);
|
|
801
|
+
var matchesLegacyModifierSequence = (data, key, modifier) => {
|
|
802
|
+
if (modifier === MODIFIERS.shift) {
|
|
803
|
+
return matchesLegacySequence(data, LEGACY_SHIFT_SEQUENCES[key]);
|
|
804
|
+
}
|
|
805
|
+
if (modifier === MODIFIERS.ctrl) {
|
|
806
|
+
return matchesLegacySequence(data, LEGACY_CTRL_SEQUENCES[key]);
|
|
807
|
+
}
|
|
808
|
+
return false;
|
|
809
|
+
};
|
|
810
|
+
var _lastEventType = "press";
|
|
811
|
+
function isKeyRelease(data) {
|
|
812
|
+
if (data.includes("\x1B[200~")) {
|
|
813
|
+
return false;
|
|
814
|
+
}
|
|
815
|
+
if (data.includes(":3u") || data.includes(":3~") || data.includes(":3A") || data.includes(":3B") || data.includes(":3C") || data.includes(":3D") || data.includes(":3H") || data.includes(":3F")) {
|
|
816
|
+
return true;
|
|
817
|
+
}
|
|
818
|
+
return false;
|
|
819
|
+
}
|
|
820
|
+
function isKeyRepeat(data) {
|
|
821
|
+
if (data.includes("\x1B[200~")) {
|
|
822
|
+
return false;
|
|
823
|
+
}
|
|
824
|
+
if (data.includes(":2u") || data.includes(":2~") || data.includes(":2A") || data.includes(":2B") || data.includes(":2C") || data.includes(":2D") || data.includes(":2H") || data.includes(":2F")) {
|
|
825
|
+
return true;
|
|
826
|
+
}
|
|
827
|
+
return false;
|
|
828
|
+
}
|
|
829
|
+
var EVENT_TYPE_BY_CODE = {
|
|
830
|
+
2: "repeat",
|
|
831
|
+
3: "release"
|
|
832
|
+
};
|
|
833
|
+
function parseEventType(eventTypeStr) {
|
|
834
|
+
if (!eventTypeStr) {
|
|
835
|
+
return "press";
|
|
836
|
+
}
|
|
837
|
+
const code = Number.parseInt(eventTypeStr, 10);
|
|
838
|
+
return EVENT_TYPE_BY_CODE[code] ?? "press";
|
|
839
|
+
}
|
|
840
|
+
function scanDigits(text, from) {
|
|
841
|
+
let cursor = from;
|
|
842
|
+
while (cursor < text.length) {
|
|
843
|
+
const ch = text.charCodeAt(cursor);
|
|
844
|
+
if (ch < 48 || ch > 57) {
|
|
845
|
+
break;
|
|
846
|
+
}
|
|
847
|
+
cursor += 1;
|
|
848
|
+
}
|
|
849
|
+
return { text: text.slice(from, cursor), next: cursor };
|
|
850
|
+
}
|
|
851
|
+
function takeTrailer(text, cursor, separator, requireDigit) {
|
|
852
|
+
if (text[cursor] !== separator) {
|
|
853
|
+
return { value: null, next: cursor };
|
|
854
|
+
}
|
|
855
|
+
const afterSep = cursor + 1;
|
|
856
|
+
const digits = scanDigits(text, afterSep);
|
|
857
|
+
if (requireDigit && digits.text.length === 0) {
|
|
858
|
+
return { value: null, next: cursor };
|
|
859
|
+
}
|
|
860
|
+
return { value: digits.text, next: digits.next };
|
|
861
|
+
}
|
|
862
|
+
function decodeCsiUBody(body) {
|
|
863
|
+
const codepoint = scanDigits(body, 0);
|
|
864
|
+
if (codepoint.text.length === 0) {
|
|
865
|
+
return null;
|
|
866
|
+
}
|
|
867
|
+
let cursor = codepoint.next;
|
|
868
|
+
let shifted = null;
|
|
869
|
+
if (body[cursor] === ":") {
|
|
870
|
+
const afterColon = cursor + 1;
|
|
871
|
+
const digits = scanDigits(body, afterColon);
|
|
872
|
+
shifted = digits.text;
|
|
873
|
+
cursor = digits.next;
|
|
874
|
+
}
|
|
875
|
+
const baseTrailer = takeTrailer(body, cursor, ":", true);
|
|
876
|
+
cursor = baseTrailer.next;
|
|
877
|
+
const modTrailer = takeTrailer(body, cursor, ";", true);
|
|
878
|
+
cursor = modTrailer.next;
|
|
879
|
+
const eventTrailer = takeTrailer(body, cursor, ":", true);
|
|
880
|
+
cursor = eventTrailer.next;
|
|
881
|
+
if (cursor !== body.length) {
|
|
882
|
+
return null;
|
|
883
|
+
}
|
|
884
|
+
return {
|
|
885
|
+
codepoint: codepoint.text,
|
|
886
|
+
shifted,
|
|
887
|
+
base: baseTrailer.value,
|
|
888
|
+
mod: modTrailer.value,
|
|
889
|
+
event: eventTrailer.value
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
function modifierMaskFromField(field) {
|
|
893
|
+
const reported = field === null ? 1 : Number.parseInt(field, 10);
|
|
894
|
+
return reported - 1;
|
|
895
|
+
}
|
|
896
|
+
var NAV_LETTER_CODEPOINTS = {
|
|
897
|
+
A: ARROW_CODEPOINTS.up,
|
|
898
|
+
B: ARROW_CODEPOINTS.down,
|
|
899
|
+
C: ARROW_CODEPOINTS.right,
|
|
900
|
+
D: ARROW_CODEPOINTS.left,
|
|
901
|
+
H: FUNCTIONAL_CODEPOINTS.home,
|
|
902
|
+
F: FUNCTIONAL_CODEPOINTS.end
|
|
903
|
+
};
|
|
904
|
+
var TILDE_NUMBER_CODEPOINTS = {
|
|
905
|
+
2: FUNCTIONAL_CODEPOINTS.insert,
|
|
906
|
+
3: FUNCTIONAL_CODEPOINTS.delete,
|
|
907
|
+
5: FUNCTIONAL_CODEPOINTS.pageUp,
|
|
908
|
+
6: FUNCTIONAL_CODEPOINTS.pageDown,
|
|
909
|
+
7: FUNCTIONAL_CODEPOINTS.home,
|
|
910
|
+
8: FUNCTIONAL_CODEPOINTS.end
|
|
911
|
+
};
|
|
912
|
+
function decodeNavLetterSequence(data) {
|
|
913
|
+
const navMatch = /^\x1b\[1;(\d+)(?::(\d+))?([ABCDHF])$/.exec(data);
|
|
914
|
+
if (!navMatch) {
|
|
915
|
+
return null;
|
|
916
|
+
}
|
|
917
|
+
const codepoint = NAV_LETTER_CODEPOINTS[navMatch[3]];
|
|
918
|
+
const eventType = parseEventType(navMatch[2]);
|
|
919
|
+
_lastEventType = eventType;
|
|
920
|
+
return { codepoint, modifier: modifierMaskFromField(navMatch[1]), eventType };
|
|
921
|
+
}
|
|
922
|
+
function decodeTildeSequence(data) {
|
|
923
|
+
const tildeMatch = /^\x1b\[(\d+)(?:;(\d+))?(?::(\d+))?~$/.exec(data);
|
|
924
|
+
if (!tildeMatch) {
|
|
925
|
+
return null;
|
|
926
|
+
}
|
|
927
|
+
const codepoint = TILDE_NUMBER_CODEPOINTS[Number.parseInt(tildeMatch[1], 10)];
|
|
928
|
+
if (codepoint === void 0) {
|
|
929
|
+
return null;
|
|
930
|
+
}
|
|
931
|
+
const eventType = parseEventType(tildeMatch[3]);
|
|
932
|
+
_lastEventType = eventType;
|
|
933
|
+
return { codepoint, modifier: modifierMaskFromField(tildeMatch[2] ?? null), eventType };
|
|
934
|
+
}
|
|
935
|
+
function decodeCsiUSequence(data) {
|
|
936
|
+
if (!data.startsWith("\x1B[") || !data.endsWith("u")) {
|
|
937
|
+
return null;
|
|
938
|
+
}
|
|
939
|
+
const fields = decodeCsiUBody(data.slice(2, -1));
|
|
940
|
+
if (!fields) {
|
|
941
|
+
return null;
|
|
942
|
+
}
|
|
943
|
+
const codepoint = Number.parseInt(fields.codepoint, 10);
|
|
944
|
+
const shiftedKey = fields.shifted && fields.shifted.length > 0 ? Number.parseInt(fields.shifted, 10) : void 0;
|
|
945
|
+
const baseLayoutKey = fields.base !== null ? Number.parseInt(fields.base, 10) : void 0;
|
|
946
|
+
const eventType = parseEventType(fields.event ?? void 0);
|
|
947
|
+
_lastEventType = eventType;
|
|
948
|
+
return {
|
|
949
|
+
codepoint,
|
|
950
|
+
shiftedKey,
|
|
951
|
+
baseLayoutKey,
|
|
952
|
+
modifier: modifierMaskFromField(fields.mod),
|
|
953
|
+
eventType
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
function parseKittySequence(data) {
|
|
957
|
+
return decodeCsiUSequence(data) ?? decodeNavLetterSequence(data) ?? decodeTildeSequence(data);
|
|
958
|
+
}
|
|
959
|
+
function matchesKittySequence(data, expectedCodepoint, expectedModifier) {
|
|
960
|
+
const parsed = parseKittySequence(data);
|
|
961
|
+
if (!parsed) return false;
|
|
962
|
+
const actualMod = parsed.modifier & ~LOCK_MASK;
|
|
963
|
+
const expectedMod = expectedModifier & ~LOCK_MASK;
|
|
964
|
+
if (actualMod !== expectedMod) return false;
|
|
965
|
+
if (parsed.codepoint === expectedCodepoint) return true;
|
|
966
|
+
if (parsed.baseLayoutKey !== void 0 && parsed.baseLayoutKey === expectedCodepoint) return true;
|
|
967
|
+
return false;
|
|
968
|
+
}
|
|
969
|
+
function matchesModifyOtherKeys(data, expectedKeycode, expectedModifier) {
|
|
970
|
+
const match = data.match(/^\x1b\[27;(\d+);(\d+)~$/);
|
|
971
|
+
if (!match) return false;
|
|
972
|
+
const modValue = parseInt(match[1], 10);
|
|
973
|
+
const keycode = parseInt(match[2], 10);
|
|
974
|
+
const actualMod = modValue - 1;
|
|
975
|
+
return keycode === expectedKeycode && actualMod === expectedModifier;
|
|
976
|
+
}
|
|
977
|
+
function rawCtrlChar(key) {
|
|
978
|
+
const char = key.toLowerCase();
|
|
979
|
+
const code = char.charCodeAt(0);
|
|
980
|
+
if (code >= 97 && code <= 122 || char === "[" || char === "\\" || char === "]" || char === "_") {
|
|
981
|
+
return String.fromCharCode(code & 31);
|
|
982
|
+
}
|
|
983
|
+
if (char === "-") {
|
|
984
|
+
return String.fromCharCode(31);
|
|
985
|
+
}
|
|
986
|
+
return null;
|
|
987
|
+
}
|
|
988
|
+
var SPECIAL_KEY_ALIASES = {
|
|
989
|
+
esc: "escape",
|
|
990
|
+
return: "enter",
|
|
991
|
+
pageup: "pageUp",
|
|
992
|
+
pagedown: "pageDown"
|
|
993
|
+
};
|
|
994
|
+
var SPECIAL_KEY_SET = /* @__PURE__ */ new Set([
|
|
995
|
+
"escape",
|
|
996
|
+
"enter",
|
|
997
|
+
"tab",
|
|
998
|
+
"space",
|
|
999
|
+
"backspace",
|
|
1000
|
+
"delete",
|
|
1001
|
+
"insert",
|
|
1002
|
+
"clear",
|
|
1003
|
+
"home",
|
|
1004
|
+
"end",
|
|
1005
|
+
"pageUp",
|
|
1006
|
+
"pageDown",
|
|
1007
|
+
"up",
|
|
1008
|
+
"down",
|
|
1009
|
+
"left",
|
|
1010
|
+
"right",
|
|
1011
|
+
"f1",
|
|
1012
|
+
"f2",
|
|
1013
|
+
"f3",
|
|
1014
|
+
"f4",
|
|
1015
|
+
"f5",
|
|
1016
|
+
"f6",
|
|
1017
|
+
"f7",
|
|
1018
|
+
"f8",
|
|
1019
|
+
"f9",
|
|
1020
|
+
"f10",
|
|
1021
|
+
"f11",
|
|
1022
|
+
"f12"
|
|
1023
|
+
]);
|
|
1024
|
+
function normalizeKeyId(keyId) {
|
|
1025
|
+
const parts = keyId.split("+").map((p) => p.trim()).filter(Boolean);
|
|
1026
|
+
if (parts.length === 0) return "";
|
|
1027
|
+
const key = parts[parts.length - 1].toLowerCase();
|
|
1028
|
+
const normalizedKey = SPECIAL_KEY_ALIASES[key] ?? key;
|
|
1029
|
+
const modifierSet = new Set(parts.slice(0, -1).map((p) => p.toLowerCase()));
|
|
1030
|
+
const modifiers = [];
|
|
1031
|
+
if (modifierSet.has("ctrl")) modifiers.push("ctrl");
|
|
1032
|
+
if (modifierSet.has("shift")) modifiers.push("shift");
|
|
1033
|
+
if (modifierSet.has("alt")) modifiers.push("alt");
|
|
1034
|
+
return modifiers.length > 0 ? `${modifiers.join("+")}+${normalizedKey}` : normalizedKey;
|
|
1035
|
+
}
|
|
1036
|
+
var KeyValidator = class {
|
|
1037
|
+
normalize(keyId) {
|
|
1038
|
+
return normalizeKeyId(keyId);
|
|
1039
|
+
}
|
|
1040
|
+
isValid(keyId) {
|
|
1041
|
+
const normalized = normalizeKeyId(keyId);
|
|
1042
|
+
if (!normalized) return false;
|
|
1043
|
+
const parts = normalized.split("+");
|
|
1044
|
+
const key = parts[parts.length - 1];
|
|
1045
|
+
if (key.length === 1) return key >= "a" && key <= "z" || SYMBOL_KEYS.has(key);
|
|
1046
|
+
return SPECIAL_KEY_SET.has(key);
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
var keyValidator = new KeyValidator();
|
|
1050
|
+
function parseKeyId(keyId) {
|
|
1051
|
+
const normalized = normalizeKeyId(keyId);
|
|
1052
|
+
if (!normalized || !keyValidator.isValid(normalized)) return null;
|
|
1053
|
+
const parts = normalized.split("+");
|
|
1054
|
+
const key = parts[parts.length - 1];
|
|
1055
|
+
if (!key) return null;
|
|
1056
|
+
return {
|
|
1057
|
+
key,
|
|
1058
|
+
ctrl: parts.includes("ctrl"),
|
|
1059
|
+
shift: parts.includes("shift"),
|
|
1060
|
+
alt: parts.includes("alt")
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
var KeyMatchEngine = class {
|
|
1064
|
+
specialKeyResolverRegistry;
|
|
1065
|
+
constructor() {
|
|
1066
|
+
this.specialKeyResolverRegistry = {
|
|
1067
|
+
escape: (data, _decodedKeyId, modifierBits) => {
|
|
1068
|
+
if (modifierBits !== 0) return false;
|
|
1069
|
+
return data === "\x1B" || matchesKittySequence(data, CODEPOINTS.escape, 0);
|
|
1070
|
+
},
|
|
1071
|
+
esc: (data, _decodedKeyId, modifierBits) => {
|
|
1072
|
+
if (modifierBits !== 0) return false;
|
|
1073
|
+
return data === "\x1B" || matchesKittySequence(data, CODEPOINTS.escape, 0);
|
|
1074
|
+
},
|
|
1075
|
+
space: (data, decodedKeyId, modifierBits) => {
|
|
1076
|
+
const { ctrl, shift, alt } = decodedKeyId;
|
|
1077
|
+
if (!_kittyProtocolActive) {
|
|
1078
|
+
if (ctrl && !alt && !shift && data === "\0") return true;
|
|
1079
|
+
if (alt && !ctrl && !shift && data === "\x1B ") return true;
|
|
1080
|
+
}
|
|
1081
|
+
if (modifierBits === 0) return data === " " || matchesKittySequence(data, CODEPOINTS.space, 0);
|
|
1082
|
+
return matchesKittySequence(data, CODEPOINTS.space, modifierBits);
|
|
1083
|
+
},
|
|
1084
|
+
tab: (data, decodedKeyId, modifierBits) => {
|
|
1085
|
+
const { ctrl, shift, alt } = decodedKeyId;
|
|
1086
|
+
if (shift && !ctrl && !alt) {
|
|
1087
|
+
return data === "\x1B[Z" || matchesKittySequence(data, CODEPOINTS.tab, MODIFIERS.shift);
|
|
1088
|
+
}
|
|
1089
|
+
if (modifierBits === 0) return data === " " || matchesKittySequence(data, CODEPOINTS.tab, 0);
|
|
1090
|
+
return matchesKittySequence(data, CODEPOINTS.tab, modifierBits);
|
|
1091
|
+
},
|
|
1092
|
+
enter: (data, decodedKeyId, modifierBits) => this.matchEnterLikeKey(data, decodedKeyId, modifierBits),
|
|
1093
|
+
return: (data, decodedKeyId, modifierBits) => this.matchEnterLikeKey(data, decodedKeyId, modifierBits),
|
|
1094
|
+
backspace: (data, decodedKeyId, modifierBits) => {
|
|
1095
|
+
const { ctrl, shift, alt } = decodedKeyId;
|
|
1096
|
+
if (alt && !ctrl && !shift) {
|
|
1097
|
+
if (data === "\x1B\x7F" || data === "\x1B\b") return true;
|
|
1098
|
+
return matchesKittySequence(data, CODEPOINTS.backspace, MODIFIERS.alt);
|
|
1099
|
+
}
|
|
1100
|
+
if (modifierBits === 0) {
|
|
1101
|
+
return data === "\x7F" || data === "\b" || matchesKittySequence(data, CODEPOINTS.backspace, 0);
|
|
1102
|
+
}
|
|
1103
|
+
return matchesKittySequence(data, CODEPOINTS.backspace, modifierBits);
|
|
1104
|
+
},
|
|
1105
|
+
insert: (data, _decodedKeyId, modifierBits) => this.matchFunctionalKey(data, "insert", FUNCTIONAL_CODEPOINTS.insert, modifierBits),
|
|
1106
|
+
delete: (data, _decodedKeyId, modifierBits) => this.matchFunctionalKey(data, "delete", FUNCTIONAL_CODEPOINTS.delete, modifierBits),
|
|
1107
|
+
clear: (data, _decodedKeyId, modifierBits) => {
|
|
1108
|
+
if (modifierBits === 0) return matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.clear);
|
|
1109
|
+
return matchesLegacyModifierSequence(data, "clear", modifierBits);
|
|
1110
|
+
},
|
|
1111
|
+
home: (data, _decodedKeyId, modifierBits) => this.matchFunctionalKey(data, "home", FUNCTIONAL_CODEPOINTS.home, modifierBits),
|
|
1112
|
+
end: (data, _decodedKeyId, modifierBits) => this.matchFunctionalKey(data, "end", FUNCTIONAL_CODEPOINTS.end, modifierBits),
|
|
1113
|
+
pageup: (data, _decodedKeyId, modifierBits) => this.matchFunctionalKey(data, "pageUp", FUNCTIONAL_CODEPOINTS.pageUp, modifierBits),
|
|
1114
|
+
pagedown: (data, _decodedKeyId, modifierBits) => this.matchFunctionalKey(data, "pageDown", FUNCTIONAL_CODEPOINTS.pageDown, modifierBits),
|
|
1115
|
+
up: (data, decodedKeyId, modifierBits) => this.matchArrowKey(data, "arrowUp", ARROW_CODEPOINTS.up, decodedKeyId, modifierBits),
|
|
1116
|
+
down: (data, decodedKeyId, modifierBits) => this.matchArrowKey(data, "arrowDown", ARROW_CODEPOINTS.down, decodedKeyId, modifierBits),
|
|
1117
|
+
left: (data, decodedKeyId, modifierBits) => this.matchLeftArrow(data, decodedKeyId, modifierBits),
|
|
1118
|
+
right: (data, decodedKeyId, modifierBits) => this.matchRightArrow(data, decodedKeyId, modifierBits),
|
|
1119
|
+
f1: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f1", modifierBits),
|
|
1120
|
+
f2: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f2", modifierBits),
|
|
1121
|
+
f3: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f3", modifierBits),
|
|
1122
|
+
f4: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f4", modifierBits),
|
|
1123
|
+
f5: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f5", modifierBits),
|
|
1124
|
+
f6: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f6", modifierBits),
|
|
1125
|
+
f7: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f7", modifierBits),
|
|
1126
|
+
f8: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f8", modifierBits),
|
|
1127
|
+
f9: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f9", modifierBits),
|
|
1128
|
+
f10: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f10", modifierBits),
|
|
1129
|
+
f11: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f11", modifierBits),
|
|
1130
|
+
f12: (data, _decodedKeyId, modifierBits) => this.matchFunctionKey(data, "f12", modifierBits)
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
matches(data, keyId) {
|
|
1134
|
+
const decodedKeyId = parseKeyId(keyId);
|
|
1135
|
+
if (!decodedKeyId) return false;
|
|
1136
|
+
const modifierBits = this.computeModifierMask(decodedKeyId);
|
|
1137
|
+
const specialKeyResolver = this.specialKeyResolverRegistry[decodedKeyId.key];
|
|
1138
|
+
if (specialKeyResolver) {
|
|
1139
|
+
return specialKeyResolver(data, decodedKeyId, modifierBits);
|
|
1140
|
+
}
|
|
1141
|
+
return this.matchPrintableKey(data, decodedKeyId, modifierBits);
|
|
1142
|
+
}
|
|
1143
|
+
computeModifierMask(decodedKeyId) {
|
|
1144
|
+
let modifierBits = 0;
|
|
1145
|
+
if (decodedKeyId.shift) modifierBits |= MODIFIERS.shift;
|
|
1146
|
+
if (decodedKeyId.alt) modifierBits |= MODIFIERS.alt;
|
|
1147
|
+
if (decodedKeyId.ctrl) modifierBits |= MODIFIERS.ctrl;
|
|
1148
|
+
return modifierBits;
|
|
1149
|
+
}
|
|
1150
|
+
matchFunctionKey(data, functionKey, modifierBits) {
|
|
1151
|
+
if (modifierBits !== 0) return false;
|
|
1152
|
+
return matchesLegacySequence(data, LEGACY_KEY_SEQUENCES[functionKey]);
|
|
1153
|
+
}
|
|
1154
|
+
matchEnterLikeKey(data, decodedKeyId, modifierBits) {
|
|
1155
|
+
const { ctrl, shift, alt } = decodedKeyId;
|
|
1156
|
+
if (shift && !ctrl && !alt) {
|
|
1157
|
+
if (matchesKittySequence(data, CODEPOINTS.enter, MODIFIERS.shift) || matchesKittySequence(data, CODEPOINTS.kpEnter, MODIFIERS.shift)) {
|
|
1158
|
+
return true;
|
|
1159
|
+
}
|
|
1160
|
+
if (matchesModifyOtherKeys(data, CODEPOINTS.enter, MODIFIERS.shift)) {
|
|
1161
|
+
return true;
|
|
1162
|
+
}
|
|
1163
|
+
if (_kittyProtocolActive) {
|
|
1164
|
+
return data === "\x1B\r" || data === "\n";
|
|
1165
|
+
}
|
|
1166
|
+
return false;
|
|
1167
|
+
}
|
|
1168
|
+
if (alt && !ctrl && !shift) {
|
|
1169
|
+
if (matchesKittySequence(data, CODEPOINTS.enter, MODIFIERS.alt) || matchesKittySequence(data, CODEPOINTS.kpEnter, MODIFIERS.alt)) {
|
|
1170
|
+
return true;
|
|
1171
|
+
}
|
|
1172
|
+
if (matchesModifyOtherKeys(data, CODEPOINTS.enter, MODIFIERS.alt)) {
|
|
1173
|
+
return true;
|
|
1174
|
+
}
|
|
1175
|
+
if (!_kittyProtocolActive) {
|
|
1176
|
+
return data === "\x1B\r";
|
|
1177
|
+
}
|
|
1178
|
+
return false;
|
|
1179
|
+
}
|
|
1180
|
+
if (modifierBits === 0) {
|
|
1181
|
+
return data === "\r" || !_kittyProtocolActive && data === "\n" || data === "\x1BOM" || matchesKittySequence(data, CODEPOINTS.enter, 0) || matchesKittySequence(data, CODEPOINTS.kpEnter, 0);
|
|
1182
|
+
}
|
|
1183
|
+
return matchesKittySequence(data, CODEPOINTS.enter, modifierBits) || matchesKittySequence(data, CODEPOINTS.kpEnter, modifierBits);
|
|
1184
|
+
}
|
|
1185
|
+
matchFunctionalKey(data, legacyName, codepoint, modifierBits) {
|
|
1186
|
+
if (modifierBits === 0) {
|
|
1187
|
+
return matchesLegacySequence(data, LEGACY_KEY_SEQUENCES[legacyName]) || matchesKittySequence(data, codepoint, 0);
|
|
1188
|
+
}
|
|
1189
|
+
if (matchesLegacyModifierSequence(data, legacyName, modifierBits)) {
|
|
1190
|
+
return true;
|
|
1191
|
+
}
|
|
1192
|
+
return matchesKittySequence(data, codepoint, modifierBits);
|
|
1193
|
+
}
|
|
1194
|
+
matchArrowKey(data, arrowName, codepoint, decodedKeyId, modifierBits) {
|
|
1195
|
+
const { ctrl, shift, alt } = decodedKeyId;
|
|
1196
|
+
if (alt && !ctrl && !shift) {
|
|
1197
|
+
const altLegacy = arrowName === "arrowUp" ? "\x1Bp" : "\x1Bn";
|
|
1198
|
+
return data === altLegacy || matchesKittySequence(data, codepoint, MODIFIERS.alt);
|
|
1199
|
+
}
|
|
1200
|
+
if (modifierBits === 0) {
|
|
1201
|
+
return matchesLegacySequence(data, LEGACY_KEY_SEQUENCES[arrowName]) || matchesKittySequence(data, codepoint, 0);
|
|
1202
|
+
}
|
|
1203
|
+
if (matchesLegacyModifierSequence(data, arrowName, modifierBits)) {
|
|
1204
|
+
return true;
|
|
1205
|
+
}
|
|
1206
|
+
return matchesKittySequence(data, codepoint, modifierBits);
|
|
1207
|
+
}
|
|
1208
|
+
matchLeftArrow(data, decodedKeyId, modifierBits) {
|
|
1209
|
+
const { ctrl, shift, alt } = decodedKeyId;
|
|
1210
|
+
if (alt && !ctrl && !shift) {
|
|
1211
|
+
return data === "\x1B[1;3D" || !_kittyProtocolActive && data === "\x1BB" || data === "\x1Bb" || matchesKittySequence(data, ARROW_CODEPOINTS.left, MODIFIERS.alt);
|
|
1212
|
+
}
|
|
1213
|
+
if (ctrl && !alt && !shift) {
|
|
1214
|
+
return data === "\x1B[1;5D" || matchesLegacyModifierSequence(data, "arrowLeft", MODIFIERS.ctrl) || matchesKittySequence(data, ARROW_CODEPOINTS.left, MODIFIERS.ctrl);
|
|
1215
|
+
}
|
|
1216
|
+
if (modifierBits === 0) {
|
|
1217
|
+
return matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.arrowLeft) || matchesKittySequence(data, ARROW_CODEPOINTS.left, 0);
|
|
1218
|
+
}
|
|
1219
|
+
if (matchesLegacyModifierSequence(data, "arrowLeft", modifierBits)) {
|
|
1220
|
+
return true;
|
|
1221
|
+
}
|
|
1222
|
+
return matchesKittySequence(data, ARROW_CODEPOINTS.left, modifierBits);
|
|
1223
|
+
}
|
|
1224
|
+
matchRightArrow(data, decodedKeyId, modifierBits) {
|
|
1225
|
+
const { ctrl, shift, alt } = decodedKeyId;
|
|
1226
|
+
if (alt && !ctrl && !shift) {
|
|
1227
|
+
return data === "\x1B[1;3C" || !_kittyProtocolActive && data === "\x1BF" || data === "\x1Bf" || matchesKittySequence(data, ARROW_CODEPOINTS.right, MODIFIERS.alt);
|
|
1228
|
+
}
|
|
1229
|
+
if (ctrl && !alt && !shift) {
|
|
1230
|
+
return data === "\x1B[1;5C" || matchesLegacyModifierSequence(data, "arrowRight", MODIFIERS.ctrl) || matchesKittySequence(data, ARROW_CODEPOINTS.right, MODIFIERS.ctrl);
|
|
1231
|
+
}
|
|
1232
|
+
if (modifierBits === 0) {
|
|
1233
|
+
return matchesLegacySequence(data, LEGACY_KEY_SEQUENCES.arrowRight) || matchesKittySequence(data, ARROW_CODEPOINTS.right, 0);
|
|
1234
|
+
}
|
|
1235
|
+
if (matchesLegacyModifierSequence(data, "arrowRight", modifierBits)) {
|
|
1236
|
+
return true;
|
|
1237
|
+
}
|
|
1238
|
+
return matchesKittySequence(data, ARROW_CODEPOINTS.right, modifierBits);
|
|
1239
|
+
}
|
|
1240
|
+
matchPrintableKey(data, decodedKeyId, modifierBits) {
|
|
1241
|
+
const { key, ctrl, shift, alt } = decodedKeyId;
|
|
1242
|
+
if (!(key.length === 1 && (key >= "a" && key <= "z" || SYMBOL_KEYS.has(key)))) {
|
|
1243
|
+
return false;
|
|
1244
|
+
}
|
|
1245
|
+
const codepoint = key.charCodeAt(0);
|
|
1246
|
+
const controlCharacter = rawCtrlChar(key);
|
|
1247
|
+
if (ctrl && alt && !shift && !_kittyProtocolActive && controlCharacter) {
|
|
1248
|
+
return data === `\x1B${controlCharacter}`;
|
|
1249
|
+
}
|
|
1250
|
+
if (alt && !ctrl && !shift && !_kittyProtocolActive && key >= "a" && key <= "z") {
|
|
1251
|
+
if (data === `\x1B${key}`) {
|
|
1252
|
+
return true;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
if (ctrl && !shift && !alt) {
|
|
1256
|
+
if (controlCharacter && data === controlCharacter) {
|
|
1257
|
+
return true;
|
|
1258
|
+
}
|
|
1259
|
+
return matchesKittySequence(data, codepoint, MODIFIERS.ctrl);
|
|
1260
|
+
}
|
|
1261
|
+
if (ctrl && shift && !alt) {
|
|
1262
|
+
return matchesKittySequence(data, codepoint, MODIFIERS.shift + MODIFIERS.ctrl);
|
|
1263
|
+
}
|
|
1264
|
+
if (shift && !ctrl && !alt) {
|
|
1265
|
+
if (data === key.toUpperCase()) {
|
|
1266
|
+
return true;
|
|
1267
|
+
}
|
|
1268
|
+
return matchesKittySequence(data, codepoint, MODIFIERS.shift);
|
|
1269
|
+
}
|
|
1270
|
+
if (modifierBits !== 0) {
|
|
1271
|
+
return matchesKittySequence(data, codepoint, modifierBits);
|
|
1272
|
+
}
|
|
1273
|
+
return data === key || matchesKittySequence(data, codepoint, 0);
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
var KeyParseEngine = class {
|
|
1277
|
+
legacyLiteralParseTable = {
|
|
1278
|
+
"\x1B": "escape",
|
|
1279
|
+
"": "ctrl+\\",
|
|
1280
|
+
"": "ctrl+]",
|
|
1281
|
+
"": "ctrl+-",
|
|
1282
|
+
"\x1B\x1B": "ctrl+alt+[",
|
|
1283
|
+
"\x1B": "ctrl+alt+\\",
|
|
1284
|
+
"\x1B": "ctrl+alt+]",
|
|
1285
|
+
"\x1B": "ctrl+alt+-",
|
|
1286
|
+
" ": "tab",
|
|
1287
|
+
"\0": "ctrl+space",
|
|
1288
|
+
" ": "space",
|
|
1289
|
+
"\x1B[Z": "shift+tab",
|
|
1290
|
+
"\x1B[A": "up",
|
|
1291
|
+
"\x1B[B": "down",
|
|
1292
|
+
"\x1B[C": "right",
|
|
1293
|
+
"\x1B[D": "left",
|
|
1294
|
+
"\x1B[3~": "delete",
|
|
1295
|
+
"\x1B[5~": "pageUp",
|
|
1296
|
+
"\x1B[6~": "pageDown"
|
|
1297
|
+
};
|
|
1298
|
+
parse(data) {
|
|
1299
|
+
const kittyDerivedKeyId = this.parseFromKitty(data);
|
|
1300
|
+
if (kittyDerivedKeyId) {
|
|
1301
|
+
return kittyDerivedKeyId;
|
|
1302
|
+
}
|
|
1303
|
+
return this.parseFromLegacy(data);
|
|
1304
|
+
}
|
|
1305
|
+
parseFromKitty(data) {
|
|
1306
|
+
const parsedKitty = parseKittySequence(data);
|
|
1307
|
+
if (!parsedKitty) {
|
|
1308
|
+
return void 0;
|
|
1309
|
+
}
|
|
1310
|
+
const orderedModifiers = this.formatModifierNames(parsedKitty.modifier & ~LOCK_MASK);
|
|
1311
|
+
const lookupCodepoint = parsedKitty.baseLayoutKey ?? parsedKitty.codepoint;
|
|
1312
|
+
const keyName = this.resolveKeyName(lookupCodepoint);
|
|
1313
|
+
if (!keyName) return void 0;
|
|
1314
|
+
return orderedModifiers.length > 0 ? `${orderedModifiers.join("+")}+${keyName}` : keyName;
|
|
1315
|
+
}
|
|
1316
|
+
parseFromLegacy(data) {
|
|
1317
|
+
if (_kittyProtocolActive && (data === "\x1B\r" || data === "\n")) {
|
|
1318
|
+
return "shift+enter";
|
|
1319
|
+
}
|
|
1320
|
+
const mappedLegacyIdentifier = LEGACY_SEQUENCE_KEY_IDS[data];
|
|
1321
|
+
if (mappedLegacyIdentifier) {
|
|
1322
|
+
return mappedLegacyIdentifier;
|
|
1323
|
+
}
|
|
1324
|
+
if (data === "\r" || !_kittyProtocolActive && data === "\n" || data === "\x1BOM") {
|
|
1325
|
+
return "enter";
|
|
1326
|
+
}
|
|
1327
|
+
if (data === "\x7F" || data === "\b") {
|
|
1328
|
+
return "backspace";
|
|
1329
|
+
}
|
|
1330
|
+
if (!_kittyProtocolActive && data === "\x1B\r") {
|
|
1331
|
+
return "alt+enter";
|
|
1332
|
+
}
|
|
1333
|
+
if (!_kittyProtocolActive && data === "\x1B ") {
|
|
1334
|
+
return "alt+space";
|
|
1335
|
+
}
|
|
1336
|
+
if (data === "\x1B\x7F" || data === "\x1B\b") {
|
|
1337
|
+
return "alt+backspace";
|
|
1338
|
+
}
|
|
1339
|
+
if (!_kittyProtocolActive && data === "\x1BB") {
|
|
1340
|
+
return "alt+left";
|
|
1341
|
+
}
|
|
1342
|
+
if (!_kittyProtocolActive && data === "\x1BF") {
|
|
1343
|
+
return "alt+right";
|
|
1344
|
+
}
|
|
1345
|
+
if (data === "\x1B[H" || data === "\x1BOH") {
|
|
1346
|
+
return "home";
|
|
1347
|
+
}
|
|
1348
|
+
if (data === "\x1B[F" || data === "\x1BOF") {
|
|
1349
|
+
return "end";
|
|
1350
|
+
}
|
|
1351
|
+
const exactMatch = this.legacyLiteralParseTable[data];
|
|
1352
|
+
if (exactMatch) {
|
|
1353
|
+
return exactMatch;
|
|
1354
|
+
}
|
|
1355
|
+
if (!_kittyProtocolActive && data.length === 2 && data[0] === "\x1B") {
|
|
1356
|
+
const legacyCode = data.charCodeAt(1);
|
|
1357
|
+
if (legacyCode >= 1 && legacyCode <= 26) {
|
|
1358
|
+
return `ctrl+alt+${String.fromCharCode(legacyCode + 96)}`;
|
|
1359
|
+
}
|
|
1360
|
+
if (legacyCode >= 97 && legacyCode <= 122) {
|
|
1361
|
+
return `alt+${String.fromCharCode(legacyCode)}`;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
if (data.length === 1) {
|
|
1365
|
+
const rawCode = data.charCodeAt(0);
|
|
1366
|
+
if (rawCode >= 1 && rawCode <= 26) {
|
|
1367
|
+
return `ctrl+${String.fromCharCode(rawCode + 96)}`;
|
|
1368
|
+
}
|
|
1369
|
+
if (rawCode >= 32 && rawCode <= 126) {
|
|
1370
|
+
return data;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
return void 0;
|
|
1374
|
+
}
|
|
1375
|
+
resolveKeyName(codepoint) {
|
|
1376
|
+
if (codepoint === CODEPOINTS.escape) return "escape";
|
|
1377
|
+
if (codepoint === CODEPOINTS.tab) return "tab";
|
|
1378
|
+
if (codepoint === CODEPOINTS.enter || codepoint === CODEPOINTS.kpEnter) return "enter";
|
|
1379
|
+
if (codepoint === CODEPOINTS.space) return "space";
|
|
1380
|
+
if (codepoint === CODEPOINTS.backspace) return "backspace";
|
|
1381
|
+
if (codepoint === FUNCTIONAL_CODEPOINTS.delete) return "delete";
|
|
1382
|
+
if (codepoint === FUNCTIONAL_CODEPOINTS.insert) return "insert";
|
|
1383
|
+
if (codepoint === FUNCTIONAL_CODEPOINTS.home) return "home";
|
|
1384
|
+
if (codepoint === FUNCTIONAL_CODEPOINTS.end) return "end";
|
|
1385
|
+
if (codepoint === FUNCTIONAL_CODEPOINTS.pageUp) return "pageUp";
|
|
1386
|
+
if (codepoint === FUNCTIONAL_CODEPOINTS.pageDown) return "pageDown";
|
|
1387
|
+
if (codepoint === ARROW_CODEPOINTS.up) return "up";
|
|
1388
|
+
if (codepoint === ARROW_CODEPOINTS.down) return "down";
|
|
1389
|
+
if (codepoint === ARROW_CODEPOINTS.left) return "left";
|
|
1390
|
+
if (codepoint === ARROW_CODEPOINTS.right) return "right";
|
|
1391
|
+
if (codepoint >= 97 && codepoint <= 122) return String.fromCharCode(codepoint);
|
|
1392
|
+
const char = String.fromCharCode(codepoint);
|
|
1393
|
+
if (SYMBOL_KEYS.has(char)) {
|
|
1394
|
+
return char;
|
|
1395
|
+
}
|
|
1396
|
+
return void 0;
|
|
1397
|
+
}
|
|
1398
|
+
formatModifierNames(modifierBits) {
|
|
1399
|
+
const orderedModifiers = [];
|
|
1400
|
+
if (modifierBits & MODIFIERS.shift) orderedModifiers.push("shift");
|
|
1401
|
+
if (modifierBits & MODIFIERS.ctrl) orderedModifiers.push("ctrl");
|
|
1402
|
+
if (modifierBits & MODIFIERS.alt) orderedModifiers.push("alt");
|
|
1403
|
+
return orderedModifiers;
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1406
|
+
var keyMatcherEngine = new KeyMatchEngine();
|
|
1407
|
+
var keyParserEngine = new KeyParseEngine();
|
|
1408
|
+
function matchesKey(data, keyId) {
|
|
1409
|
+
return keyMatcherEngine.matches(data, keyId);
|
|
1410
|
+
}
|
|
1411
|
+
function parseKey(data) {
|
|
1412
|
+
return keyParserEngine.parse(data);
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
// src/ui/keybindings.ts
|
|
1416
|
+
function flattenBindingBlocks(...blocks) {
|
|
1417
|
+
const assembled = {};
|
|
1418
|
+
for (const block of blocks) {
|
|
1419
|
+
for (const action of Object.keys(block)) {
|
|
1420
|
+
assembled[action] = block[action];
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
return assembled;
|
|
1424
|
+
}
|
|
1425
|
+
var DEFAULT_EDITOR_KEYBINDINGS = flattenBindingBlocks(
|
|
1426
|
+
// caret motion
|
|
1427
|
+
// [readline] ctrl+a -> beginning-of-line (cursorLineStart)
|
|
1428
|
+
// [readline] ctrl+e -> end-of-line (cursorLineEnd)
|
|
1429
|
+
// [readline] alt+b/f -> backward/forward-word (cursorWordLeft/Right;
|
|
1430
|
+
// we accept alt+arrows and ctrl+arrows as the visible chord)
|
|
1431
|
+
// [indus-original] arrow keys, home/end, pageUp/pageDown -- terminal
|
|
1432
|
+
// conventions readline does not standardize on its own
|
|
1433
|
+
{
|
|
1434
|
+
cursorUp: "up",
|
|
1435
|
+
cursorDown: "down",
|
|
1436
|
+
cursorLeft: "left",
|
|
1437
|
+
cursorRight: "right",
|
|
1438
|
+
cursorWordLeft: ["alt+left", "ctrl+left"],
|
|
1439
|
+
cursorWordRight: ["alt+right", "ctrl+right"],
|
|
1440
|
+
cursorLineStart: ["home", "ctrl+a"],
|
|
1441
|
+
cursorLineEnd: ["end", "ctrl+e"],
|
|
1442
|
+
pageUp: "pageUp",
|
|
1443
|
+
pageDown: "pageDown"
|
|
1444
|
+
},
|
|
1445
|
+
// deletion
|
|
1446
|
+
// [readline] ctrl+w -> unix-word-rubout (deleteWordBackward)
|
|
1447
|
+
// [readline] alt+d -> kill-word (deleteWordForward)
|
|
1448
|
+
// [readline] ctrl+u -> unix-line-discard (deleteToLineStart)
|
|
1449
|
+
// [readline] ctrl+k -> kill-line (deleteToLineEnd)
|
|
1450
|
+
// [indus-original] backspace/delete + alt+backspace/alt+delete
|
|
1451
|
+
{
|
|
1452
|
+
deleteCharBackward: "backspace",
|
|
1453
|
+
deleteCharForward: "delete",
|
|
1454
|
+
deleteWordBackward: ["ctrl+w", "alt+backspace"],
|
|
1455
|
+
deleteWordForward: ["alt+d", "alt+delete"],
|
|
1456
|
+
deleteToLineStart: "ctrl+u",
|
|
1457
|
+
deleteToLineEnd: "ctrl+k"
|
|
1458
|
+
},
|
|
1459
|
+
// text entry
|
|
1460
|
+
// [readline] enter -> accept-line (submit)
|
|
1461
|
+
// [indus-original] shift+enter inserts a literal newline; tab is reserved
|
|
1462
|
+
// for completion (readline binds tab to complete itself)
|
|
1463
|
+
{
|
|
1464
|
+
newLine: "shift+enter",
|
|
1465
|
+
submit: "enter",
|
|
1466
|
+
tab: "tab"
|
|
1467
|
+
},
|
|
1468
|
+
// completion popup -- all [indus-original]; readline's completion is a
|
|
1469
|
+
// single-shot menu, not a navigable popup, so it has no analogue.
|
|
1470
|
+
{
|
|
1471
|
+
selectUp: "up",
|
|
1472
|
+
selectDown: "down",
|
|
1473
|
+
selectPageUp: "pageUp",
|
|
1474
|
+
selectPageDown: "pageDown",
|
|
1475
|
+
selectConfirm: "enter",
|
|
1476
|
+
selectCancel: ["escape", "ctrl+c"]
|
|
1477
|
+
},
|
|
1478
|
+
// clipboard + kill ring
|
|
1479
|
+
// [readline] ctrl+y -> yank (yank)
|
|
1480
|
+
// [readline] alt+y -> yank-pop (yankPop)
|
|
1481
|
+
// [indus-original] ctrl+c -> copy selection to the OS clipboard
|
|
1482
|
+
{
|
|
1483
|
+
copy: "ctrl+c",
|
|
1484
|
+
yank: "ctrl+y",
|
|
1485
|
+
yankPop: "alt+y"
|
|
1486
|
+
},
|
|
1487
|
+
// history
|
|
1488
|
+
// [indus-original] ctrl+- -> undo (readline binds ctrl+_ to undo; we
|
|
1489
|
+
// accept the more terminal-portable ctrl+- chord)
|
|
1490
|
+
{
|
|
1491
|
+
undo: "ctrl+-"
|
|
1492
|
+
},
|
|
1493
|
+
// tool expansion -- [indus-original], no readline analogue
|
|
1494
|
+
{
|
|
1495
|
+
expandTools: "ctrl+o"
|
|
1496
|
+
},
|
|
1497
|
+
// session management -- all [indus-original], no readline analogue
|
|
1498
|
+
{
|
|
1499
|
+
toggleSessionPath: "ctrl+p",
|
|
1500
|
+
toggleSessionSort: "ctrl+s",
|
|
1501
|
+
renameSession: "ctrl+r",
|
|
1502
|
+
deleteSession: "ctrl+d",
|
|
1503
|
+
deleteSessionNoninvasive: "ctrl+backspace"
|
|
1504
|
+
}
|
|
1505
|
+
);
|
|
1506
|
+
var VIM_EDITOR_KEYBINDINGS = flattenBindingBlocks({
|
|
1507
|
+
cursorUp: ["up", "k"],
|
|
1508
|
+
cursorDown: ["down", "j"],
|
|
1509
|
+
cursorLeft: ["left", "h"],
|
|
1510
|
+
cursorRight: ["right", "l"],
|
|
1511
|
+
deleteCharBackward: ["backspace", "x"]
|
|
1512
|
+
});
|
|
1513
|
+
function toKeyIdArray(keys) {
|
|
1514
|
+
const source = Array.isArray(keys) ? keys : [keys];
|
|
1515
|
+
return source.map((key) => normalizeKeyId(key));
|
|
1516
|
+
}
|
|
1517
|
+
var KeybindingRegistry = class {
|
|
1518
|
+
actionToKeys = /* @__PURE__ */ new Map();
|
|
1519
|
+
registeredActions = /* @__PURE__ */ new Set();
|
|
1520
|
+
reset() {
|
|
1521
|
+
this.actionToKeys.clear();
|
|
1522
|
+
this.registeredActions.clear();
|
|
1523
|
+
}
|
|
1524
|
+
setAction(action, keys) {
|
|
1525
|
+
this.actionToKeys.set(action, toKeyIdArray(keys));
|
|
1526
|
+
this.registeredActions.add(action);
|
|
1527
|
+
}
|
|
1528
|
+
getActionKeys(action) {
|
|
1529
|
+
return this.actionToKeys.get(action) ?? [];
|
|
1530
|
+
}
|
|
1531
|
+
entries() {
|
|
1532
|
+
return this.actionToKeys.entries();
|
|
1533
|
+
}
|
|
1534
|
+
actions() {
|
|
1535
|
+
return [...this.registeredActions];
|
|
1536
|
+
}
|
|
1537
|
+
};
|
|
1538
|
+
var PresetResolver = class {
|
|
1539
|
+
static layersFor(preset) {
|
|
1540
|
+
const layers = [DEFAULT_EDITOR_KEYBINDINGS];
|
|
1541
|
+
if (preset === "vim") layers.push(VIM_EDITOR_KEYBINDINGS);
|
|
1542
|
+
return layers;
|
|
1543
|
+
}
|
|
1544
|
+
static mergeInto(registry, preset, config) {
|
|
1545
|
+
for (const layer of this.layersFor(preset)) {
|
|
1546
|
+
this.applyLayer(registry, layer);
|
|
1547
|
+
}
|
|
1548
|
+
this.applyLayer(registry, config);
|
|
1549
|
+
}
|
|
1550
|
+
static applyLayer(registry, layer) {
|
|
1551
|
+
for (const [action, keys] of Object.entries(layer)) {
|
|
1552
|
+
if (keys === void 0) continue;
|
|
1553
|
+
registry.setAction(action, keys);
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
};
|
|
1557
|
+
var ConflictScanner = class {
|
|
1558
|
+
static scan(entries) {
|
|
1559
|
+
const keyToActions = /* @__PURE__ */ new Map();
|
|
1560
|
+
for (const [action, keys] of entries) {
|
|
1561
|
+
for (const key of keys) {
|
|
1562
|
+
const normalized = normalizeKeyId(key);
|
|
1563
|
+
if (!keyToActions.has(normalized)) keyToActions.set(normalized, /* @__PURE__ */ new Set());
|
|
1564
|
+
keyToActions.get(normalized).add(action);
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
const conflicts = [];
|
|
1568
|
+
for (const [key, actions] of keyToActions.entries()) {
|
|
1569
|
+
if (actions.size > 1) conflicts.push({ key, actions: [...actions] });
|
|
1570
|
+
}
|
|
1571
|
+
return conflicts;
|
|
1572
|
+
}
|
|
1573
|
+
};
|
|
1574
|
+
var EditorKeybindingsManager = class {
|
|
1575
|
+
registry = new KeybindingRegistry();
|
|
1576
|
+
componentOverrides = /* @__PURE__ */ new Map();
|
|
1577
|
+
constructor(config = {}, preset = "default") {
|
|
1578
|
+
this.rebuildRegistry(config, preset);
|
|
1579
|
+
}
|
|
1580
|
+
rebuildRegistry(config, preset = "default") {
|
|
1581
|
+
this.registry.reset();
|
|
1582
|
+
PresetResolver.mergeInto(this.registry, preset, config);
|
|
1583
|
+
}
|
|
1584
|
+
resolveKeys(action, componentId) {
|
|
1585
|
+
if (componentId) {
|
|
1586
|
+
const overrideValue = this.componentOverrides.get(componentId)?.[action];
|
|
1587
|
+
if (overrideValue !== void 0) return toKeyIdArray(overrideValue);
|
|
1588
|
+
}
|
|
1589
|
+
return this.registry.getActionKeys(action);
|
|
1590
|
+
}
|
|
1591
|
+
/**
|
|
1592
|
+
* Report whether the given raw key data triggers the named action.
|
|
1593
|
+
*/
|
|
1594
|
+
matches(data, action, componentId) {
|
|
1595
|
+
for (const key of this.resolveKeys(action, componentId)) {
|
|
1596
|
+
if (matchesKey(data, key)) return true;
|
|
1597
|
+
}
|
|
1598
|
+
return false;
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* List every key currently wired to the given action.
|
|
1602
|
+
*/
|
|
1603
|
+
getKeys(action) {
|
|
1604
|
+
return this.registry.getActionKeys(action);
|
|
1605
|
+
}
|
|
1606
|
+
registerAction(action, keys) {
|
|
1607
|
+
this.registry.setAction(action, keys);
|
|
1608
|
+
}
|
|
1609
|
+
getRegisteredActions() {
|
|
1610
|
+
return this.registry.actions();
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Swap in a fresh config (and optional preset), rebuilding the bindings.
|
|
1614
|
+
*/
|
|
1615
|
+
setConfig(config, preset = "default") {
|
|
1616
|
+
this.rebuildRegistry(config, preset);
|
|
1617
|
+
}
|
|
1618
|
+
setComponentOverride(componentId, config) {
|
|
1619
|
+
this.componentOverrides.set(componentId, config);
|
|
1620
|
+
}
|
|
1621
|
+
clearComponentOverride(componentId) {
|
|
1622
|
+
this.componentOverrides.delete(componentId);
|
|
1623
|
+
}
|
|
1624
|
+
detectConflicts() {
|
|
1625
|
+
return ConflictScanner.scan(this.registry.entries());
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
var globalEditorKeybindings = null;
|
|
1629
|
+
function getEditorKeybindings() {
|
|
1630
|
+
if (!globalEditorKeybindings) {
|
|
1631
|
+
globalEditorKeybindings = new EditorKeybindingsManager();
|
|
1632
|
+
}
|
|
1633
|
+
return globalEditorKeybindings;
|
|
1634
|
+
}
|
|
1635
|
+
function setEditorKeybindings(manager) {
|
|
1636
|
+
globalEditorKeybindings = manager;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
// src/ui/utils.ts
|
|
1640
|
+
import { eastAsianWidth } from "get-east-asian-width";
|
|
1641
|
+
var segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
1642
|
+
var TextWidthCalculator = class {
|
|
1643
|
+
getWidth(text) {
|
|
1644
|
+
return visibleWidth(text);
|
|
1645
|
+
}
|
|
1646
|
+
clearCache() {
|
|
1647
|
+
widthCache.clear();
|
|
1648
|
+
}
|
|
1649
|
+
};
|
|
1650
|
+
var textWidthCalculator = new TextWidthCalculator();
|
|
1651
|
+
function looksLikeEmojiCandidate(segment) {
|
|
1652
|
+
const cp = segment.codePointAt(0);
|
|
1653
|
+
return cp >= 126976 && cp <= 130047 || // pictographs and emoji proper
|
|
1654
|
+
cp >= 8960 && cp <= 9215 || // miscellaneous technical glyphs
|
|
1655
|
+
cp >= 9728 && cp <= 10175 || // assorted symbols and dingbats
|
|
1656
|
+
cp >= 11088 && cp <= 11093 || // a few star/circle characters
|
|
1657
|
+
segment.includes("\uFE0F") || // carries VS16, the emoji-presentation selector
|
|
1658
|
+
segment.length > 2;
|
|
1659
|
+
}
|
|
1660
|
+
function createUnicodeRegex(vPattern, uFallback) {
|
|
1661
|
+
try {
|
|
1662
|
+
return new RegExp(vPattern, "v");
|
|
1663
|
+
} catch {
|
|
1664
|
+
return new RegExp(uFallback, "u");
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
var zeroWidthRegex = createUnicodeRegex(
|
|
1668
|
+
"^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark}|\\p{Surrogate})+$",
|
|
1669
|
+
"^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Mark}|\\p{Surrogate})+$"
|
|
1670
|
+
);
|
|
1671
|
+
var leadingNonPrintingRegex = createUnicodeRegex(
|
|
1672
|
+
"^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+",
|
|
1673
|
+
"^[\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Mark}\\p{Surrogate}]+"
|
|
1674
|
+
);
|
|
1675
|
+
var rgiEmojiRegex = createUnicodeRegex("^\\p{RGI_Emoji}$", "^\\p{Extended_Pictographic}$");
|
|
1676
|
+
var AnsiStripper = {
|
|
1677
|
+
strip(text) {
|
|
1678
|
+
if (!text.includes("\x1B")) {
|
|
1679
|
+
return text;
|
|
1680
|
+
}
|
|
1681
|
+
let cleaned = text;
|
|
1682
|
+
cleaned = cleaned.replace(/\x1b\[[0-9;]*[mGKHJ]/g, "");
|
|
1683
|
+
cleaned = cleaned.replace(/\x1b\]8;;[^\x07]*\x07/g, "");
|
|
1684
|
+
cleaned = cleaned.replace(/\x1b_[^\x07\x1b]*(?:\x07|\x1b\\)/g, "");
|
|
1685
|
+
return cleaned;
|
|
1686
|
+
}
|
|
1687
|
+
};
|
|
1688
|
+
var WIDTH_CACHE_SIZE = 512;
|
|
1689
|
+
var widthCache = /* @__PURE__ */ new Map();
|
|
1690
|
+
function measureClusterWidth(segment) {
|
|
1691
|
+
if (zeroWidthRegex.test(segment)) {
|
|
1692
|
+
return 0;
|
|
1693
|
+
}
|
|
1694
|
+
if (looksLikeEmojiCandidate(segment) && rgiEmojiRegex.test(segment)) {
|
|
1695
|
+
return 2;
|
|
1696
|
+
}
|
|
1697
|
+
const base = segment.replace(leadingNonPrintingRegex, "");
|
|
1698
|
+
const cp = base.codePointAt(0);
|
|
1699
|
+
if (cp === void 0) {
|
|
1700
|
+
return 0;
|
|
1701
|
+
}
|
|
1702
|
+
let width = eastAsianWidth(cp);
|
|
1703
|
+
if (segment.length > 1) {
|
|
1704
|
+
for (const char of segment.slice(1)) {
|
|
1705
|
+
const c = char.codePointAt(0);
|
|
1706
|
+
if (c >= 65280 && c <= 65519) {
|
|
1707
|
+
width += eastAsianWidth(c);
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
return width;
|
|
1712
|
+
}
|
|
1713
|
+
function visibleWidth(str) {
|
|
1714
|
+
if (str.length === 0) {
|
|
1715
|
+
return 0;
|
|
1716
|
+
}
|
|
1717
|
+
let isPureAscii = true;
|
|
1718
|
+
for (let i = 0; i < str.length; i++) {
|
|
1719
|
+
const code = str.charCodeAt(i);
|
|
1720
|
+
if (code < 32 || code > 126) {
|
|
1721
|
+
isPureAscii = false;
|
|
1722
|
+
break;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
if (isPureAscii) {
|
|
1726
|
+
return str.length;
|
|
1727
|
+
}
|
|
1728
|
+
const cached = widthCache.get(str);
|
|
1729
|
+
if (cached !== void 0) {
|
|
1730
|
+
return cached;
|
|
1731
|
+
}
|
|
1732
|
+
let clean = str;
|
|
1733
|
+
if (str.includes(" ")) {
|
|
1734
|
+
clean = clean.replace(/\t/g, " ");
|
|
1735
|
+
}
|
|
1736
|
+
clean = AnsiStripper.strip(clean);
|
|
1737
|
+
let width = 0;
|
|
1738
|
+
for (const { segment } of segmenter.segment(clean)) {
|
|
1739
|
+
width += measureClusterWidth(segment);
|
|
1740
|
+
}
|
|
1741
|
+
if (widthCache.size >= WIDTH_CACHE_SIZE) {
|
|
1742
|
+
const firstKey = widthCache.keys().next().value;
|
|
1743
|
+
if (firstKey !== void 0) {
|
|
1744
|
+
widthCache.delete(firstKey);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
widthCache.set(str, width);
|
|
1748
|
+
return width;
|
|
1749
|
+
}
|
|
1750
|
+
function extractAnsiCode(str, pos) {
|
|
1751
|
+
if (pos >= str.length || str[pos] !== "\x1B") return null;
|
|
1752
|
+
const next = str[pos + 1];
|
|
1753
|
+
if (next === "[") {
|
|
1754
|
+
let j = pos + 2;
|
|
1755
|
+
while (j < str.length && !/[mGKHJ]/.test(str[j])) j++;
|
|
1756
|
+
if (j < str.length) return { code: str.substring(pos, j + 1), length: j + 1 - pos };
|
|
1757
|
+
return null;
|
|
1758
|
+
}
|
|
1759
|
+
if (next === "]") {
|
|
1760
|
+
let j = pos + 2;
|
|
1761
|
+
while (j < str.length) {
|
|
1762
|
+
if (str[j] === "\x07") return { code: str.substring(pos, j + 1), length: j + 1 - pos };
|
|
1763
|
+
if (str[j] === "\x1B" && str[j + 1] === "\\") return { code: str.substring(pos, j + 2), length: j + 2 - pos };
|
|
1764
|
+
j++;
|
|
1765
|
+
}
|
|
1766
|
+
return null;
|
|
1767
|
+
}
|
|
1768
|
+
if (next === "_") {
|
|
1769
|
+
let j = pos + 2;
|
|
1770
|
+
while (j < str.length) {
|
|
1771
|
+
if (str[j] === "\x07") return { code: str.substring(pos, j + 1), length: j + 1 - pos };
|
|
1772
|
+
if (str[j] === "\x1B" && str[j + 1] === "\\") return { code: str.substring(pos, j + 2), length: j + 2 - pos };
|
|
1773
|
+
j++;
|
|
1774
|
+
}
|
|
1775
|
+
return null;
|
|
1776
|
+
}
|
|
1777
|
+
return null;
|
|
1778
|
+
}
|
|
1779
|
+
var AnsiStateTracker = class {
|
|
1780
|
+
// Each attribute is kept on its own flag, which lets us clear them one at a time.
|
|
1781
|
+
_bold = false;
|
|
1782
|
+
_dim = false;
|
|
1783
|
+
italic = false;
|
|
1784
|
+
underline = false;
|
|
1785
|
+
blink = false;
|
|
1786
|
+
inverse = false;
|
|
1787
|
+
hidden = false;
|
|
1788
|
+
strikethrough = false;
|
|
1789
|
+
_colors = { fg: null, bg: null };
|
|
1790
|
+
process(ansiCode) {
|
|
1791
|
+
if (!ansiCode.endsWith("m")) {
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
const match = ansiCode.match(/\x1b\[([\d;]*)m/);
|
|
1795
|
+
if (!match) return;
|
|
1796
|
+
const params = match[1];
|
|
1797
|
+
if (params === "" || params === "0") {
|
|
1798
|
+
this.reset();
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
const parts = params.split(";");
|
|
1802
|
+
let i = 0;
|
|
1803
|
+
while (i < parts.length) {
|
|
1804
|
+
const code = Number.parseInt(parts[i] ?? "", 10);
|
|
1805
|
+
if (Number.isNaN(code)) {
|
|
1806
|
+
i++;
|
|
1807
|
+
continue;
|
|
1808
|
+
}
|
|
1809
|
+
const consumed = this.tryConsumeColorCode(parts, i, code);
|
|
1810
|
+
if (consumed > 0) {
|
|
1811
|
+
i += consumed;
|
|
1812
|
+
continue;
|
|
1813
|
+
}
|
|
1814
|
+
this.applyStandardCode(code);
|
|
1815
|
+
i++;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
tryConsumeColorCode(parts, index, code) {
|
|
1819
|
+
if (code !== 38 && code !== 48) {
|
|
1820
|
+
return 0;
|
|
1821
|
+
}
|
|
1822
|
+
if (parts[index + 1] === "5" && parts[index + 2] !== void 0) {
|
|
1823
|
+
const colorCode = `${parts[index]};${parts[index + 1]};${parts[index + 2]}`;
|
|
1824
|
+
if (code === 38) {
|
|
1825
|
+
this._colors.fg = colorCode;
|
|
1826
|
+
} else {
|
|
1827
|
+
this._colors.bg = colorCode;
|
|
1828
|
+
}
|
|
1829
|
+
return 3;
|
|
1830
|
+
}
|
|
1831
|
+
if (parts[index + 1] === "2" && parts[index + 4] !== void 0) {
|
|
1832
|
+
const colorCode = `${parts[index]};${parts[index + 1]};${parts[index + 2]};${parts[index + 3]};${parts[index + 4]}`;
|
|
1833
|
+
if (code === 38) {
|
|
1834
|
+
this._colors.fg = colorCode;
|
|
1835
|
+
} else {
|
|
1836
|
+
this._colors.bg = colorCode;
|
|
1837
|
+
}
|
|
1838
|
+
return 5;
|
|
1839
|
+
}
|
|
1840
|
+
return 0;
|
|
1841
|
+
}
|
|
1842
|
+
applyStandardCode(code) {
|
|
1843
|
+
switch (code) {
|
|
1844
|
+
case 0:
|
|
1845
|
+
this.reset();
|
|
1846
|
+
return;
|
|
1847
|
+
case 1:
|
|
1848
|
+
this._bold = true;
|
|
1849
|
+
return;
|
|
1850
|
+
case 2:
|
|
1851
|
+
this._dim = true;
|
|
1852
|
+
return;
|
|
1853
|
+
case 3:
|
|
1854
|
+
this.italic = true;
|
|
1855
|
+
return;
|
|
1856
|
+
case 4:
|
|
1857
|
+
this.underline = true;
|
|
1858
|
+
return;
|
|
1859
|
+
case 5:
|
|
1860
|
+
this.blink = true;
|
|
1861
|
+
return;
|
|
1862
|
+
case 7:
|
|
1863
|
+
this.inverse = true;
|
|
1864
|
+
return;
|
|
1865
|
+
case 8:
|
|
1866
|
+
this.hidden = true;
|
|
1867
|
+
return;
|
|
1868
|
+
case 9:
|
|
1869
|
+
this.strikethrough = true;
|
|
1870
|
+
return;
|
|
1871
|
+
case 21:
|
|
1872
|
+
this._bold = false;
|
|
1873
|
+
return;
|
|
1874
|
+
case 22:
|
|
1875
|
+
this._bold = false;
|
|
1876
|
+
this._dim = false;
|
|
1877
|
+
return;
|
|
1878
|
+
case 23:
|
|
1879
|
+
this.italic = false;
|
|
1880
|
+
return;
|
|
1881
|
+
case 24:
|
|
1882
|
+
this.underline = false;
|
|
1883
|
+
return;
|
|
1884
|
+
case 25:
|
|
1885
|
+
this.blink = false;
|
|
1886
|
+
return;
|
|
1887
|
+
case 27:
|
|
1888
|
+
this.inverse = false;
|
|
1889
|
+
return;
|
|
1890
|
+
case 28:
|
|
1891
|
+
this.hidden = false;
|
|
1892
|
+
return;
|
|
1893
|
+
case 29:
|
|
1894
|
+
this.strikethrough = false;
|
|
1895
|
+
return;
|
|
1896
|
+
case 39:
|
|
1897
|
+
this._colors.fg = null;
|
|
1898
|
+
return;
|
|
1899
|
+
case 49:
|
|
1900
|
+
this._colors.bg = null;
|
|
1901
|
+
return;
|
|
1902
|
+
default:
|
|
1903
|
+
if (code >= 30 && code <= 37 || code >= 90 && code <= 97) {
|
|
1904
|
+
this._colors.fg = String(code);
|
|
1905
|
+
return;
|
|
1906
|
+
}
|
|
1907
|
+
if (code >= 40 && code <= 47 || code >= 100 && code <= 107) {
|
|
1908
|
+
this._colors.bg = String(code);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
reset() {
|
|
1913
|
+
this._bold = false;
|
|
1914
|
+
this._dim = false;
|
|
1915
|
+
this.italic = false;
|
|
1916
|
+
this.underline = false;
|
|
1917
|
+
this.blink = false;
|
|
1918
|
+
this.inverse = false;
|
|
1919
|
+
this.hidden = false;
|
|
1920
|
+
this.strikethrough = false;
|
|
1921
|
+
this._colors.fg = null;
|
|
1922
|
+
this._colors.bg = null;
|
|
1923
|
+
}
|
|
1924
|
+
/** Wipe all tracked state so the instance can be reused. */
|
|
1925
|
+
clear() {
|
|
1926
|
+
this.reset();
|
|
1927
|
+
}
|
|
1928
|
+
getActiveCodes() {
|
|
1929
|
+
const codes = [];
|
|
1930
|
+
if (this._bold) codes.push("1");
|
|
1931
|
+
if (this._dim) codes.push("2");
|
|
1932
|
+
if (this.italic) codes.push("3");
|
|
1933
|
+
if (this.underline) codes.push("4");
|
|
1934
|
+
if (this.blink) codes.push("5");
|
|
1935
|
+
if (this.inverse) codes.push("7");
|
|
1936
|
+
if (this.hidden) codes.push("8");
|
|
1937
|
+
if (this.strikethrough) codes.push("9");
|
|
1938
|
+
if (this._colors.fg) codes.push(this._colors.fg);
|
|
1939
|
+
if (this._colors.bg) codes.push(this._colors.bg);
|
|
1940
|
+
if (codes.length === 0) return "";
|
|
1941
|
+
return `\x1B[${codes.join(";")}m`;
|
|
1942
|
+
}
|
|
1943
|
+
hasActiveCodes() {
|
|
1944
|
+
return this._bold || this._dim || this.italic || this.underline || this.blink || this.inverse || this.hidden || this.strikethrough || this._colors.fg !== null || this._colors.bg !== null;
|
|
1945
|
+
}
|
|
1946
|
+
/**
|
|
1947
|
+
* Produce the escape code needed to switch off any attribute that would
|
|
1948
|
+
* otherwise smear into the padding at the end of a line. In practice that
|
|
1949
|
+
* is just underline. Yields an empty string when nothing needs disabling.
|
|
1950
|
+
*/
|
|
1951
|
+
getLineEndReset() {
|
|
1952
|
+
if (this.underline) {
|
|
1953
|
+
return "\x1B[24m";
|
|
1954
|
+
}
|
|
1955
|
+
return "";
|
|
1956
|
+
}
|
|
1957
|
+
};
|
|
1958
|
+
function mergeTextIntoTracker(text, tracker) {
|
|
1959
|
+
let i = 0;
|
|
1960
|
+
while (i < text.length) {
|
|
1961
|
+
const ansiResult = extractAnsiCode(text, i);
|
|
1962
|
+
if (ansiResult) {
|
|
1963
|
+
tracker.process(ansiResult.code);
|
|
1964
|
+
i += ansiResult.length;
|
|
1965
|
+
} else {
|
|
1966
|
+
i++;
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
function tokenizeTextWithAnsi(text) {
|
|
1971
|
+
const tokens = [];
|
|
1972
|
+
let current = "";
|
|
1973
|
+
let pendingAnsi = "";
|
|
1974
|
+
let inWhitespace = false;
|
|
1975
|
+
let i = 0;
|
|
1976
|
+
while (i < text.length) {
|
|
1977
|
+
const ansiResult = extractAnsiCode(text, i);
|
|
1978
|
+
if (ansiResult) {
|
|
1979
|
+
pendingAnsi += ansiResult.code;
|
|
1980
|
+
i += ansiResult.length;
|
|
1981
|
+
continue;
|
|
1982
|
+
}
|
|
1983
|
+
const char = text[i];
|
|
1984
|
+
const charIsSpace = char === " ";
|
|
1985
|
+
if (charIsSpace !== inWhitespace && current) {
|
|
1986
|
+
tokens.push(current);
|
|
1987
|
+
current = "";
|
|
1988
|
+
}
|
|
1989
|
+
if (pendingAnsi) {
|
|
1990
|
+
current += pendingAnsi;
|
|
1991
|
+
pendingAnsi = "";
|
|
1992
|
+
}
|
|
1993
|
+
inWhitespace = charIsSpace;
|
|
1994
|
+
current += char;
|
|
1995
|
+
i++;
|
|
1996
|
+
}
|
|
1997
|
+
if (pendingAnsi) {
|
|
1998
|
+
current += pendingAnsi;
|
|
1999
|
+
}
|
|
2000
|
+
if (current) {
|
|
2001
|
+
tokens.push(current);
|
|
2002
|
+
}
|
|
2003
|
+
return tokens;
|
|
2004
|
+
}
|
|
2005
|
+
var TextWrapper = class {
|
|
2006
|
+
wrap(text, width) {
|
|
2007
|
+
return wrapTextWithAnsi(text, width);
|
|
2008
|
+
}
|
|
2009
|
+
};
|
|
2010
|
+
var textWrapper = new TextWrapper();
|
|
2011
|
+
var TokenWrapEngine = {
|
|
2012
|
+
wrap(tokens, width, tracker) {
|
|
2013
|
+
const wrapped = [];
|
|
2014
|
+
let currentLine = "";
|
|
2015
|
+
let currentVisibleLength = 0;
|
|
2016
|
+
for (const token of tokens) {
|
|
2017
|
+
const tokenVisibleLength = visibleWidth(token);
|
|
2018
|
+
const isWhitespace = token.trim() === "";
|
|
2019
|
+
if (tokenVisibleLength > width && !isWhitespace) {
|
|
2020
|
+
if (currentLine) {
|
|
2021
|
+
const lineEndReset = tracker.getLineEndReset();
|
|
2022
|
+
if (lineEndReset) {
|
|
2023
|
+
currentLine += lineEndReset;
|
|
2024
|
+
}
|
|
2025
|
+
wrapped.push(currentLine);
|
|
2026
|
+
currentLine = "";
|
|
2027
|
+
currentVisibleLength = 0;
|
|
2028
|
+
}
|
|
2029
|
+
const broken = splitLongToken(token, width, tracker);
|
|
2030
|
+
wrapped.push(...broken.slice(0, -1));
|
|
2031
|
+
currentLine = broken[broken.length - 1];
|
|
2032
|
+
currentVisibleLength = visibleWidth(currentLine);
|
|
2033
|
+
continue;
|
|
2034
|
+
}
|
|
2035
|
+
const totalNeeded = currentVisibleLength + tokenVisibleLength;
|
|
2036
|
+
if (totalNeeded > width && currentVisibleLength > 0) {
|
|
2037
|
+
let lineToWrap = currentLine.trimEnd();
|
|
2038
|
+
const lineEndReset = tracker.getLineEndReset();
|
|
2039
|
+
if (lineEndReset) {
|
|
2040
|
+
lineToWrap += lineEndReset;
|
|
2041
|
+
}
|
|
2042
|
+
wrapped.push(lineToWrap);
|
|
2043
|
+
if (isWhitespace) {
|
|
2044
|
+
currentLine = tracker.getActiveCodes();
|
|
2045
|
+
currentVisibleLength = 0;
|
|
2046
|
+
} else {
|
|
2047
|
+
currentLine = tracker.getActiveCodes() + token;
|
|
2048
|
+
currentVisibleLength = tokenVisibleLength;
|
|
2049
|
+
}
|
|
2050
|
+
} else {
|
|
2051
|
+
currentLine += token;
|
|
2052
|
+
currentVisibleLength += tokenVisibleLength;
|
|
2053
|
+
}
|
|
2054
|
+
mergeTextIntoTracker(token, tracker);
|
|
2055
|
+
}
|
|
2056
|
+
return { wrapped, currentLine, currentVisibleLength };
|
|
2057
|
+
}
|
|
2058
|
+
};
|
|
2059
|
+
function wrapTextWithAnsi(text, width) {
|
|
2060
|
+
if (!text) {
|
|
2061
|
+
return [""];
|
|
2062
|
+
}
|
|
2063
|
+
const inputLines = text.split("\n");
|
|
2064
|
+
const result = [];
|
|
2065
|
+
const tracker = new AnsiStateTracker();
|
|
2066
|
+
for (const inputLine of inputLines) {
|
|
2067
|
+
const prefix = result.length > 0 ? tracker.getActiveCodes() : "";
|
|
2068
|
+
result.push(...wrapLinePreservingAnsi(prefix + inputLine, width));
|
|
2069
|
+
mergeTextIntoTracker(inputLine, tracker);
|
|
2070
|
+
}
|
|
2071
|
+
return result.length > 0 ? result : [""];
|
|
2072
|
+
}
|
|
2073
|
+
function wrapLinePreservingAnsi(line, width) {
|
|
2074
|
+
if (!line) {
|
|
2075
|
+
return [""];
|
|
2076
|
+
}
|
|
2077
|
+
const visibleLength = visibleWidth(line);
|
|
2078
|
+
if (visibleLength <= width) {
|
|
2079
|
+
return [line];
|
|
2080
|
+
}
|
|
2081
|
+
const tracker = new AnsiStateTracker();
|
|
2082
|
+
const tokens = tokenizeTextWithAnsi(line);
|
|
2083
|
+
const { wrapped, currentLine } = TokenWrapEngine.wrap(tokens, width, tracker);
|
|
2084
|
+
if (currentLine) {
|
|
2085
|
+
wrapped.push(currentLine);
|
|
2086
|
+
}
|
|
2087
|
+
return wrapped.length > 0 ? wrapped.map((segmentLine) => segmentLine.trimEnd()) : [""];
|
|
2088
|
+
}
|
|
2089
|
+
function splitLongToken(word, width, tracker) {
|
|
2090
|
+
const lines = [];
|
|
2091
|
+
let currentLine = tracker.getActiveCodes();
|
|
2092
|
+
let currentWidth = 0;
|
|
2093
|
+
let i = 0;
|
|
2094
|
+
const segments = [];
|
|
2095
|
+
while (i < word.length) {
|
|
2096
|
+
const ansiResult = extractAnsiCode(word, i);
|
|
2097
|
+
if (ansiResult) {
|
|
2098
|
+
segments.push({ type: "ansi", value: ansiResult.code });
|
|
2099
|
+
i += ansiResult.length;
|
|
2100
|
+
} else {
|
|
2101
|
+
let end = i;
|
|
2102
|
+
while (end < word.length) {
|
|
2103
|
+
const nextAnsi = extractAnsiCode(word, end);
|
|
2104
|
+
if (nextAnsi) break;
|
|
2105
|
+
end++;
|
|
2106
|
+
}
|
|
2107
|
+
const textPortion = word.slice(i, end);
|
|
2108
|
+
for (const seg of segmenter.segment(textPortion)) {
|
|
2109
|
+
segments.push({ type: "grapheme", value: seg.segment });
|
|
2110
|
+
}
|
|
2111
|
+
i = end;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
for (const seg of segments) {
|
|
2115
|
+
if (seg.type === "ansi") {
|
|
2116
|
+
currentLine += seg.value;
|
|
2117
|
+
tracker.process(seg.value);
|
|
2118
|
+
continue;
|
|
2119
|
+
}
|
|
2120
|
+
const grapheme = seg.value;
|
|
2121
|
+
if (!grapheme) continue;
|
|
2122
|
+
const clusterWidth = visibleWidth(grapheme);
|
|
2123
|
+
if (currentWidth + clusterWidth > width) {
|
|
2124
|
+
const lineEndReset = tracker.getLineEndReset();
|
|
2125
|
+
if (lineEndReset) {
|
|
2126
|
+
currentLine += lineEndReset;
|
|
2127
|
+
}
|
|
2128
|
+
lines.push(currentLine);
|
|
2129
|
+
currentLine = tracker.getActiveCodes();
|
|
2130
|
+
currentWidth = 0;
|
|
2131
|
+
}
|
|
2132
|
+
currentLine += grapheme;
|
|
2133
|
+
currentWidth += clusterWidth;
|
|
2134
|
+
}
|
|
2135
|
+
if (currentLine) {
|
|
2136
|
+
lines.push(currentLine);
|
|
2137
|
+
}
|
|
2138
|
+
return lines.length > 0 ? lines : [""];
|
|
2139
|
+
}
|
|
2140
|
+
function truncateToWidth(text, maxWidth, ellipsis = "...", pad = false) {
|
|
2141
|
+
const textVisibleWidth = visibleWidth(text);
|
|
2142
|
+
if (textVisibleWidth <= maxWidth) {
|
|
2143
|
+
return pad ? text + " ".repeat(maxWidth - textVisibleWidth) : text;
|
|
2144
|
+
}
|
|
2145
|
+
const ellipsisWidth = visibleWidth(ellipsis);
|
|
2146
|
+
const targetWidth = maxWidth - ellipsisWidth;
|
|
2147
|
+
if (targetWidth <= 0) {
|
|
2148
|
+
return ellipsis.substring(0, maxWidth);
|
|
2149
|
+
}
|
|
2150
|
+
let i = 0;
|
|
2151
|
+
const segments = [];
|
|
2152
|
+
while (i < text.length) {
|
|
2153
|
+
const ansiResult = extractAnsiCode(text, i);
|
|
2154
|
+
if (ansiResult) {
|
|
2155
|
+
segments.push({ type: "ansi", value: ansiResult.code });
|
|
2156
|
+
i += ansiResult.length;
|
|
2157
|
+
} else {
|
|
2158
|
+
let end = i;
|
|
2159
|
+
while (end < text.length) {
|
|
2160
|
+
const nextAnsi = extractAnsiCode(text, end);
|
|
2161
|
+
if (nextAnsi) break;
|
|
2162
|
+
end++;
|
|
2163
|
+
}
|
|
2164
|
+
const textPortion = text.slice(i, end);
|
|
2165
|
+
for (const seg of segmenter.segment(textPortion)) {
|
|
2166
|
+
segments.push({ type: "grapheme", value: seg.segment });
|
|
2167
|
+
}
|
|
2168
|
+
i = end;
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
let result = "";
|
|
2172
|
+
let currentWidth = 0;
|
|
2173
|
+
for (const seg of segments) {
|
|
2174
|
+
if (seg.type === "ansi") {
|
|
2175
|
+
result += seg.value;
|
|
2176
|
+
continue;
|
|
2177
|
+
}
|
|
2178
|
+
const grapheme = seg.value;
|
|
2179
|
+
if (!grapheme) continue;
|
|
2180
|
+
const clusterWidth = visibleWidth(grapheme);
|
|
2181
|
+
if (currentWidth + clusterWidth > targetWidth) {
|
|
2182
|
+
break;
|
|
2183
|
+
}
|
|
2184
|
+
result += grapheme;
|
|
2185
|
+
currentWidth += clusterWidth;
|
|
2186
|
+
}
|
|
2187
|
+
const truncated = `${result}\x1B[0m${ellipsis}`;
|
|
2188
|
+
if (pad) {
|
|
2189
|
+
const truncatedWidth = visibleWidth(truncated);
|
|
2190
|
+
return truncated + " ".repeat(Math.max(0, maxWidth - truncatedWidth));
|
|
2191
|
+
}
|
|
2192
|
+
return truncated;
|
|
2193
|
+
}
|
|
2194
|
+
var pooledStyleTracker = new AnsiStateTracker();
|
|
2195
|
+
export {
|
|
2196
|
+
CombinedAutocompleteProvider,
|
|
2197
|
+
DEFAULT_EDITOR_KEYBINDINGS,
|
|
2198
|
+
EditorKeybindingsManager,
|
|
2199
|
+
Key,
|
|
2200
|
+
fuzzyFilter,
|
|
2201
|
+
fuzzyMatch,
|
|
2202
|
+
getEditorKeybindings,
|
|
2203
|
+
isKeyRelease,
|
|
2204
|
+
isKeyRepeat,
|
|
2205
|
+
isKittyProtocolActive,
|
|
2206
|
+
matchesKey,
|
|
2207
|
+
parseKey,
|
|
2208
|
+
setEditorKeybindings,
|
|
2209
|
+
setKittyProtocolActive,
|
|
2210
|
+
truncateToWidth,
|
|
2211
|
+
visibleWidth,
|
|
2212
|
+
wrapTextWithAnsi
|
|
2213
|
+
};
|