@mmmbuto/gemini-cli-termux 0.30.3-termux → 0.30.5-termux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -193
- package/bundle/docs/cli/settings.md +8 -9
- package/bundle/docs/extensions/reference.md +14 -38
- package/bundle/docs/hooks/reference.md +0 -8
- package/bundle/docs/reference/configuration.md +0 -8
- package/bundle/gemini.js +10730 -11704
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/package.json +2 -1
- package/package.json +67 -5
- package/packages/cli/dist/index.js +0 -0
- package/packages/cli/dist/package.json +2 -2
- package/packages/cli/dist/src/commands/extensions/examples/custom-commands/gemini-extension.json +2 -2
- package/packages/cli/dist/src/commands/extensions/examples/exclude-tools/gemini-extension.json +3 -3
- package/packages/cli/dist/src/commands/extensions/examples/hooks/gemini-extension.json +2 -2
- package/packages/cli/dist/src/commands/extensions/examples/hooks/hooks/hooks.json +11 -11
- package/packages/cli/dist/src/commands/extensions/examples/mcp-server/example.js +1 -1
- package/packages/cli/dist/src/commands/extensions/examples/mcp-server/gemini-extension.json +8 -8
- package/packages/cli/dist/src/commands/extensions/examples/mcp-server/package.json +9 -9
- package/packages/cli/dist/src/commands/extensions/examples/skills/gemini-extension.json +2 -2
- package/packages/cli/dist/src/commands/extensions/examples/themes-example/README.md +8 -5
- package/packages/cli/dist/src/commands/extensions/examples/themes-example/gemini-extension.json +27 -27
- package/packages/cli/dist/src/config/config.js +4 -65
- package/packages/cli/dist/src/config/config.js.map +1 -1
- package/packages/cli/dist/src/config/settingsSchema.d.ts +1 -235
- package/packages/cli/dist/src/config/settingsSchema.js +1 -235
- package/packages/cli/dist/src/config/settingsSchema.js.map +1 -1
- package/packages/cli/dist/src/gemini.js +0 -2
- package/packages/cli/dist/src/gemini.js.map +1 -1
- package/packages/cli/dist/src/generated/git-commit.d.ts +2 -2
- package/packages/cli/dist/src/generated/git-commit.js +2 -2
- package/packages/cli/dist/src/patches/empty-module.d.ts +2 -0
- package/packages/cli/dist/src/patches/empty-module.js +2 -0
- package/packages/cli/dist/src/patches/empty-module.js.map +1 -0
- package/packages/cli/dist/src/services/McpPromptLoader.js +3 -6
- package/packages/cli/dist/src/services/McpPromptLoader.js.map +1 -1
- package/packages/cli/dist/src/ui/components/AgentConfigDialog.js +19 -5
- package/packages/cli/dist/src/ui/components/AgentConfigDialog.js.map +1 -1
- package/packages/cli/dist/src/ui/components/AgentConfigDialog.test.js +41 -19
- package/packages/cli/dist/src/ui/components/AgentConfigDialog.test.js.map +1 -1
- package/packages/cli/dist/src/ui/components/DialogManager.d.ts +1 -1
- package/packages/cli/dist/src/ui/components/DialogManager.js +34 -7
- package/packages/cli/dist/src/ui/components/DialogManager.js.map +1 -1
- package/packages/cli/dist/src/ui/components/InputPrompt.d.ts +9 -0
- package/packages/cli/dist/src/ui/components/InputPrompt.js +350 -125
- package/packages/cli/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/packages/cli/dist/src/ui/components/InputPrompt.test.js +788 -35
- package/packages/cli/dist/src/ui/components/InputPrompt.test.js.map +1 -1
- package/packages/cli/dist/src/ui/components/messages/ShellToolMessage.js +2 -2
- package/packages/cli/dist/src/ui/components/messages/ShellToolMessage.js.map +1 -1
- package/packages/cli/dist/src/ui/components/messages/ToolConfirmationMessage.js +4 -77
- package/packages/cli/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
- package/packages/cli/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +0 -51
- package/packages/cli/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +1 -1
- package/packages/cli/dist/src/ui/components/messages/ToolMessage.js +2 -2
- package/packages/cli/dist/src/ui/components/messages/ToolMessage.js.map +1 -1
- package/packages/cli/dist/src/ui/components/messages/ToolShared.d.ts +0 -1
- package/packages/cli/dist/src/ui/components/messages/ToolShared.js +2 -2
- package/packages/cli/dist/src/ui/components/messages/ToolShared.js.map +1 -1
- package/packages/cli/dist/src/ui/components/shared/BaseSettingsDialog.js +4 -1
- package/packages/cli/dist/src/ui/components/shared/BaseSettingsDialog.js.map +1 -1
- package/packages/cli/dist/src/ui/components/shared/BaseSettingsDialog.test.js +139 -40
- package/packages/cli/dist/src/ui/components/shared/BaseSettingsDialog.test.js.map +1 -1
- package/packages/cli/dist/src/ui/components/shared/TextInput.js +2 -1
- package/packages/cli/dist/src/ui/components/shared/TextInput.js.map +1 -1
- package/packages/cli/dist/src/ui/hooks/toolMapping.js +0 -1
- package/packages/cli/dist/src/ui/hooks/toolMapping.js.map +1 -1
- package/packages/cli/dist/src/ui/hooks/toolMapping.test.js +0 -13
- package/packages/cli/dist/src/ui/hooks/toolMapping.test.js.map +1 -1
- package/packages/cli/dist/src/ui/hooks/useToolScheduler.js +2 -18
- package/packages/cli/dist/src/ui/hooks/useToolScheduler.js.map +1 -1
- package/packages/cli/dist/src/ui/hooks/useToolScheduler.test.js +0 -44
- package/packages/cli/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
- package/packages/cli/dist/src/ui/keyMatchers.test.js.map +1 -1
- package/packages/cli/dist/src/ui/types.d.ts +0 -1
- package/packages/cli/dist/src/ui/types.js.map +1 -1
- package/packages/cli/dist/src/ui/utils/commandUtils.js +4 -1
- package/packages/cli/dist/src/ui/utils/commandUtils.js.map +1 -1
- package/packages/cli/dist/src/utils/activityLogger.js +23 -94
- package/packages/cli/dist/src/utils/activityLogger.js.map +1 -1
- package/packages/cli/dist/src/utils/handleAutoUpdate.d.ts +1 -1
- package/packages/cli/dist/src/utils/handleAutoUpdate.js +1 -1
- package/packages/cli/dist/src/utils/handleAutoUpdate.js.map +1 -1
- package/packages/cli/dist/src/utils/handleAutoUpdate.test.js +11 -11
- package/packages/cli/dist/src/utils/handleAutoUpdate.test.js.map +1 -1
- package/{bundle/sandbox-macos-restrictive-closed.sb → packages/cli/dist/src/utils/sandbox-macos-strict-open.sb} +42 -4
- package/packages/cli/dist/src/utils/{sandbox-macos-restrictive-closed.sb → sandbox-macos-strict-proxied.sb} +44 -4
- package/packages/cli/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/core/dist/docs/admin/enterprise-controls.md +115 -0
- package/packages/core/dist/docs/changelogs/index.md +57 -1
- package/packages/core/dist/docs/changelogs/latest.md +357 -314
- package/packages/core/dist/docs/changelogs/preview.md +288 -411
- package/packages/core/dist/docs/cli/checkpointing.md +2 -3
- package/packages/core/dist/docs/cli/cli-reference.md +42 -28
- package/packages/core/dist/docs/cli/custom-commands.md +3 -0
- package/packages/core/dist/docs/cli/enterprise.md +28 -8
- package/packages/core/dist/docs/cli/gemini-md.md +21 -13
- package/packages/core/dist/docs/cli/headless.md +34 -372
- package/packages/core/dist/docs/cli/model.md +1 -1
- package/packages/core/dist/docs/cli/plan-mode.md +245 -0
- package/packages/core/dist/docs/cli/rewind.md +11 -11
- package/packages/core/dist/docs/cli/sandbox.md +6 -5
- package/packages/core/dist/docs/cli/session-management.md +61 -44
- package/packages/core/dist/docs/cli/settings.md +64 -49
- package/packages/core/dist/docs/cli/skills.md +29 -7
- package/packages/core/dist/docs/cli/telemetry.md +41 -5
- package/packages/core/dist/docs/cli/themes.md +88 -54
- package/packages/core/dist/docs/cli/trusted-folders.md +31 -0
- package/packages/core/dist/docs/cli/tutorials/automation.md +187 -0
- package/packages/core/dist/docs/cli/tutorials/file-management.md +142 -0
- package/packages/core/dist/docs/cli/tutorials/mcp-setup.md +105 -0
- package/packages/core/dist/docs/cli/tutorials/memory-management.md +126 -0
- package/packages/core/dist/docs/cli/tutorials/session-management.md +105 -0
- package/packages/core/dist/docs/cli/tutorials/shell-commands.md +107 -0
- package/packages/core/dist/docs/cli/tutorials/skills-getting-started.md +36 -31
- package/packages/core/dist/docs/cli/tutorials/task-planning.md +93 -0
- package/packages/core/dist/docs/cli/tutorials/web-tools.md +78 -0
- package/packages/core/dist/docs/core/index.md +7 -7
- package/packages/core/dist/docs/core/subagents.md +40 -40
- package/packages/core/dist/docs/extensions/best-practices.md +102 -53
- package/packages/core/dist/docs/extensions/index.md +37 -21
- package/packages/core/dist/docs/extensions/reference.md +148 -219
- package/packages/core/dist/docs/extensions/releasing.md +93 -122
- package/packages/core/dist/docs/extensions/writing-extensions.md +87 -76
- package/packages/core/dist/docs/get-started/authentication.md +4 -4
- package/packages/core/dist/docs/get-started/examples.md +39 -119
- package/packages/core/dist/docs/get-started/gemini-3.md +17 -3
- package/packages/core/dist/docs/get-started/index.md +16 -5
- package/packages/core/dist/docs/get-started/installation.md +110 -77
- package/packages/core/dist/docs/hooks/best-practices.md +1 -1
- package/packages/core/dist/docs/hooks/reference.md +2 -2
- package/packages/core/dist/docs/index.md +142 -149
- package/packages/core/dist/docs/redirects.json +19 -0
- package/packages/core/dist/docs/reference/commands.md +523 -0
- package/{bundle/docs/get-started → packages/core/dist/docs/reference}/configuration.md +180 -71
- package/packages/core/dist/docs/{cli → reference}/keyboard-shortcuts.md +49 -35
- package/packages/core/dist/docs/{core → reference}/policy-engine.md +76 -32
- package/packages/core/dist/docs/releases.md +2 -2
- package/{bundle/docs → packages/core/dist/docs/resources}/faq.md +1 -1
- package/packages/core/dist/docs/{quota-and-pricing.md → resources/quota-and-pricing.md} +12 -5
- package/{bundle/docs → packages/core/dist/docs/resources}/tos-privacy.md +3 -3
- package/packages/core/dist/docs/{troubleshooting.md → resources/troubleshooting.md} +1 -1
- package/packages/core/dist/docs/sidebar.json +194 -113
- package/packages/core/dist/docs/tools/activate-skill.md +43 -0
- package/packages/core/dist/docs/tools/ask-user.md +95 -0
- package/packages/core/dist/docs/tools/file-system.md +55 -143
- package/packages/core/dist/docs/tools/index.md +97 -93
- package/packages/core/dist/docs/tools/internal-docs.md +46 -0
- package/packages/core/dist/docs/tools/mcp-server.md +65 -16
- package/packages/core/dist/docs/tools/memory.md +21 -40
- package/packages/core/dist/docs/tools/planning.md +57 -0
- package/packages/core/dist/docs/tools/shell.md +44 -88
- package/packages/core/dist/docs/tools/todos.md +22 -44
- package/packages/core/dist/docs/tools/web-fetch.md +22 -46
- package/packages/core/dist/docs/tools/web-search.md +19 -29
- package/packages/core/dist/src/code_assist/types.d.ts +14 -14
- package/packages/core/dist/src/config/config.d.ts +1 -13
- package/packages/core/dist/src/config/config.js +6 -39
- package/packages/core/dist/src/config/config.js.map +1 -1
- package/packages/core/dist/src/confirmation-bus/types.d.ts +0 -3
- package/packages/core/dist/src/confirmation-bus/types.js.map +1 -1
- package/packages/core/dist/src/core/coreToolHookTriggers.d.ts +1 -1
- package/packages/core/dist/src/core/coreToolHookTriggers.js +3 -8
- package/packages/core/dist/src/core/coreToolHookTriggers.js.map +1 -1
- package/packages/core/dist/src/generated/git-commit.d.ts +2 -2
- package/packages/core/dist/src/generated/git-commit.js +2 -2
- package/packages/core/dist/src/hooks/hookEventHandler.d.ts +2 -2
- package/packages/core/dist/src/hooks/hookEventHandler.js +2 -8
- package/packages/core/dist/src/hooks/hookEventHandler.js.map +1 -1
- package/packages/core/dist/src/hooks/hookSystem.d.ts +2 -2
- package/packages/core/dist/src/hooks/hookSystem.js +4 -4
- package/packages/core/dist/src/hooks/hookSystem.js.map +1 -1
- package/packages/core/dist/src/hooks/types.d.ts +0 -18
- package/packages/core/dist/src/hooks/types.js +0 -17
- package/packages/core/dist/src/hooks/types.js.map +1 -1
- package/packages/core/dist/src/ide/ide-client.js +1 -1
- package/packages/core/dist/src/ide/ide-client.js.map +1 -1
- package/packages/core/dist/src/ide/types.d.ts +8 -8
- package/packages/core/dist/src/index.d.ts +2 -0
- package/packages/core/dist/src/index.js +2 -0
- package/packages/core/dist/src/index.js.map +1 -1
- package/packages/core/dist/src/policy/policies/plan.toml +29 -43
- package/packages/core/dist/src/policy/policies/read-only.toml +12 -11
- package/packages/core/dist/src/policy/policies/write.toml +11 -10
- package/packages/core/dist/src/policy/policies/yolo.toml +24 -12
- package/packages/core/dist/src/policy/policy-engine.js +1 -5
- package/packages/core/dist/src/policy/policy-engine.js.map +1 -1
- package/packages/core/dist/src/policy/types.d.ts +1 -2
- package/packages/core/dist/src/policy/types.js +0 -1
- package/packages/core/dist/src/policy/types.js.map +1 -1
- package/packages/core/dist/src/safety/context-builder.d.ts +3 -3
- package/packages/core/dist/src/safety/context-builder.js +4 -60
- package/packages/core/dist/src/safety/context-builder.js.map +1 -1
- package/packages/core/dist/src/safety/context-builder.test.js +18 -98
- package/packages/core/dist/src/safety/context-builder.test.js.map +1 -1
- package/packages/core/dist/src/safety/protocol.d.ts +0 -4
- package/packages/core/dist/src/safety/registry.d.ts +1 -2
- package/packages/core/dist/src/safety/registry.js +4 -14
- package/packages/core/dist/src/safety/registry.js.map +1 -1
- package/packages/core/dist/src/safety/registry.test.js +2 -5
- package/packages/core/dist/src/safety/registry.test.js.map +1 -1
- package/packages/core/dist/src/scheduler/scheduler.d.ts +1 -1
- package/packages/core/dist/src/scheduler/scheduler.js +4 -49
- package/packages/core/dist/src/scheduler/scheduler.js.map +1 -1
- package/packages/core/dist/src/scheduler/scheduler.test.js +0 -91
- package/packages/core/dist/src/scheduler/scheduler.test.js.map +1 -1
- package/packages/core/dist/src/scheduler/state-manager.d.ts +0 -6
- package/packages/core/dist/src/scheduler/state-manager.js +0 -12
- package/packages/core/dist/src/scheduler/state-manager.js.map +1 -1
- package/packages/core/dist/src/scheduler/tool-executor.js +7 -9
- package/packages/core/dist/src/scheduler/tool-executor.js.map +1 -1
- package/packages/core/dist/src/scheduler/tool-executor.test.js +1 -1
- package/packages/core/dist/src/scheduler/tool-executor.test.js.map +1 -1
- package/packages/core/dist/src/scheduler/types.d.ts +0 -13
- package/packages/core/dist/src/services/shellExecutionService.d.ts +1 -1
- package/packages/core/dist/src/services/shellExecutionService.js +7 -8
- package/packages/core/dist/src/services/shellExecutionService.js.map +1 -1
- package/packages/core/dist/src/services/shellExecutionService.test.js +5 -5
- package/packages/core/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/packages/core/dist/src/services/test-data/resolved-aliases-retry.golden.json +251 -251
- package/packages/core/dist/src/services/test-data/resolved-aliases.golden.json +251 -251
- package/packages/core/dist/src/skills/builtin/skill-creator/scripts/init_skill.cjs +5 -1
- package/packages/core/dist/src/skills/builtin/skill-creator/scripts/package_skill.cjs +5 -1
- package/packages/core/dist/src/skills/builtin/skill-creator/scripts/validate_skill.cjs +5 -1
- package/packages/core/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +1 -3
- package/packages/core/dist/src/telemetry/clearcut-logger/clearcut-logger.js +0 -2
- package/packages/core/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/packages/core/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +1 -9
- package/packages/core/dist/src/telemetry/clearcut-logger/event-metadata-key.js +1 -19
- package/packages/core/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/packages/core/dist/src/telemetry/index.d.ts +1 -2
- package/packages/core/dist/src/telemetry/index.js +1 -2
- package/packages/core/dist/src/telemetry/index.js.map +1 -1
- package/packages/core/dist/src/telemetry/loggers.js +0 -4
- package/packages/core/dist/src/telemetry/loggers.js.map +1 -1
- package/packages/core/dist/src/telemetry/trace.js.map +1 -1
- package/packages/core/dist/src/telemetry/types.d.ts +0 -26
- package/packages/core/dist/src/telemetry/types.js +2 -76
- package/packages/core/dist/src/telemetry/types.js.map +1 -1
- package/packages/core/dist/src/tools/diffOptions.d.ts +2 -2
- package/packages/core/dist/src/tools/diffOptions.js.map +1 -1
- package/packages/core/dist/src/tools/mcp-client.test.js.map +1 -1
- package/packages/core/dist/src/tools/mcp-tool.d.ts +1 -3
- package/packages/core/dist/src/tools/mcp-tool.js +2 -9
- package/packages/core/dist/src/tools/mcp-tool.js.map +1 -1
- package/packages/core/dist/src/tools/memoryTool.d.ts +0 -10
- package/packages/core/dist/src/tools/memoryTool.js +30 -25
- package/packages/core/dist/src/tools/memoryTool.js.map +1 -1
- package/packages/core/dist/src/tools/tool-names.d.ts +6 -0
- package/packages/core/dist/src/tools/tool-names.js +16 -1
- package/packages/core/dist/src/tools/tool-names.js.map +1 -1
- package/packages/core/dist/src/tools/tools.d.ts +0 -11
- package/packages/core/dist/src/tools/tools.js.map +1 -1
- package/packages/core/dist/src/utils/getPty.d.ts +14 -1
- package/packages/core/dist/src/utils/getPty.js +67 -2
- package/packages/core/dist/src/utils/getPty.js.map +1 -1
- package/packages/core/dist/src/utils/memoryDiscovery.d.ts +11 -3
- package/packages/core/dist/src/utils/memoryDiscovery.js +56 -21
- package/packages/core/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/packages/core/dist/src/utils/secure-browser-launcher.js +40 -29
- package/packages/core/dist/src/utils/secure-browser-launcher.js.map +1 -1
- package/packages/core/dist/src/utils/textUtils.d.ts +0 -9
- package/packages/core/dist/src/utils/textUtils.js +0 -15
- package/packages/core/dist/src/utils/textUtils.js.map +1 -1
- package/packages/core/dist/src/utils/textUtils.test.js +1 -42
- package/packages/core/dist/src/utils/textUtils.test.js.map +1 -1
- package/packages/core/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/test-utils/dist/tsconfig.tsbuildinfo +1 -1
- package/bundle/docs/ROADMAP.md +0 -113
- package/bundle/docs/TERMUX.md +0 -95
- package/bundle/docs/architecture.md +0 -80
- package/bundle/docs/assets/hero.png +0 -0
- package/bundle/docs/cli/authentication.md +0 -3
- package/bundle/docs/cli/commands.md +0 -430
- package/bundle/docs/cli/context-memory.md +0 -69
- package/bundle/docs/cli/index.md +0 -65
- package/bundle/docs/cli/keyboard-shortcuts.md +0 -140
- package/bundle/docs/cli/tutorials.md +0 -87
- package/bundle/docs/core/policy-engine.md +0 -305
- package/bundle/docs/get-started/configuration-v1.md +0 -888
- package/bundle/docs/patches/README.md +0 -74
- package/bundle/docs/patches/mcp-sdk-typings-shim.md +0 -27
- package/bundle/docs/quota-and-pricing.md +0 -158
- package/bundle/docs/termux-api/COMMANDS.md +0 -592
- package/bundle/docs/termux-api/DISCOVERY_SETUP.md +0 -670
- package/bundle/docs/termux-api/EXECUTION_PLAN.md +0 -532
- package/bundle/docs/termux-api/MERGE_STRATEGY.md +0 -365
- package/bundle/docs/termux-api/PATCHES.md +0 -480
- package/bundle/docs/termux-api/README.md +0 -416
- package/bundle/docs/troubleshooting.md +0 -173
- package/bundle/policies/conseca.toml +0 -6
- package/bundle/sandbox-macos-permissive-closed.sb +0 -32
- package/packages/cli/README.md +0 -173
- package/packages/cli/dist/src/commands/extensions/examples/mcp-server/example.d.ts +0 -6
- package/packages/cli/dist/src/commands/extensions/examples/mcp-server/example.js.map +0 -1
- package/packages/cli/dist/src/commands/extensions/examples/mcp-server/example.test.d.ts +0 -6
- package/packages/cli/dist/src/commands/extensions/examples/mcp-server/example.test.js +0 -111
- package/packages/cli/dist/src/commands/extensions/examples/mcp-server/example.test.js.map +0 -1
- package/packages/cli/dist/src/ui/components/messages/ToolConfirmationMessageOverflow.test.d.ts +0 -6
- package/packages/cli/dist/src/ui/components/messages/ToolConfirmationMessageOverflow.test.js +0 -93
- package/packages/cli/dist/src/ui/components/messages/ToolConfirmationMessageOverflow.test.js.map +0 -1
- package/packages/cli/dist/src/ui/hooks/useReactToolScheduler.d.ts +0 -42
- package/packages/cli/dist/src/ui/hooks/useReactToolScheduler.js +0 -105
- package/packages/cli/dist/src/ui/hooks/useReactToolScheduler.js.map +0 -1
- package/packages/cli/dist/src/ui/hooks/useReactToolScheduler.test.d.ts +0 -6
- package/packages/cli/dist/src/ui/hooks/useReactToolScheduler.test.js +0 -58
- package/packages/cli/dist/src/ui/hooks/useReactToolScheduler.test.js.map +0 -1
- package/packages/cli/dist/src/ui/hooks/useRefreshMemoryCommand.d.ts +0 -6
- package/packages/cli/dist/src/ui/hooks/useRefreshMemoryCommand.js +0 -7
- package/packages/cli/dist/src/ui/hooks/useRefreshMemoryCommand.js.map +0 -1
- package/packages/cli/dist/src/ui/hooks/useShowMemoryCommand.d.ts +0 -9
- package/packages/cli/dist/src/ui/hooks/useShowMemoryCommand.js +0 -59
- package/packages/cli/dist/src/ui/hooks/useShowMemoryCommand.js.map +0 -1
- package/packages/cli/dist/src/ui/hooks/useToolExecutionScheduler.d.ts +0 -30
- package/packages/cli/dist/src/ui/hooks/useToolExecutionScheduler.js +0 -149
- package/packages/cli/dist/src/ui/hooks/useToolExecutionScheduler.js.map +0 -1
- package/packages/cli/dist/src/ui/hooks/useToolExecutionScheduler.test.d.ts +0 -6
- package/packages/cli/dist/src/ui/hooks/useToolExecutionScheduler.test.js +0 -376
- package/packages/cli/dist/src/ui/hooks/useToolExecutionScheduler.test.js.map +0 -1
- package/packages/cli/dist/src/ui/hooks/useToolSchedulerFacade.test.d.ts +0 -6
- package/packages/cli/dist/src/ui/hooks/useToolSchedulerFacade.test.js +0 -45
- package/packages/cli/dist/src/ui/hooks/useToolSchedulerFacade.test.js.map +0 -1
- package/packages/cli/dist/src/ui/utils/InlineMarkdownRenderer.test.d.ts +0 -6
- package/packages/cli/dist/src/ui/utils/InlineMarkdownRenderer.test.js +0 -21
- package/packages/cli/dist/src/ui/utils/InlineMarkdownRenderer.test.js.map +0 -1
- package/packages/cli/dist/src/ui/utils/terminalUtils.test.d.ts +0 -6
- package/packages/cli/dist/src/ui/utils/terminalUtils.test.js +0 -40
- package/packages/cli/dist/src/ui/utils/terminalUtils.test.js.map +0 -1
- package/packages/cli/dist/src/utils/checks.d.ts +0 -19
- package/packages/cli/dist/src/utils/checks.js +0 -24
- package/packages/cli/dist/src/utils/checks.js.map +0 -1
- package/packages/cli/dist/src/utils/checks.test.d.ts +0 -6
- package/packages/cli/dist/src/utils/checks.test.js +0 -29
- package/packages/cli/dist/src/utils/checks.test.js.map +0 -1
- package/packages/cli/dist/src/utils/sandbox-macos-permissive-closed.sb +0 -32
- package/packages/cli/index.js +0 -2
- package/packages/core/dist/docs/TERMUX.md +0 -95
- package/packages/core/dist/docs/architecture.md +0 -80
- package/packages/core/dist/docs/assets/hero.png +0 -0
- package/packages/core/dist/docs/cli/authentication.md +0 -3
- package/packages/core/dist/docs/cli/commands.md +0 -430
- package/packages/core/dist/docs/cli/context-memory.md +0 -69
- package/packages/core/dist/docs/cli/index.md +0 -65
- package/packages/core/dist/docs/cli/tutorials.md +0 -87
- package/packages/core/dist/docs/cli/uninstall.md +0 -65
- package/packages/core/dist/docs/core/memport.md +0 -246
- package/packages/core/dist/docs/core/tools-api.md +0 -131
- package/packages/core/dist/docs/faq.md +0 -154
- package/packages/core/dist/docs/get-started/configuration-v1.md +0 -888
- package/packages/core/dist/docs/get-started/configuration.md +0 -1585
- package/packages/core/dist/docs/patches/README.md +0 -74
- package/packages/core/dist/docs/patches/mcp-sdk-typings-shim.md +0 -27
- package/packages/core/dist/docs/termux-api/COMMANDS.md +0 -592
- package/packages/core/dist/docs/termux-api/DISCOVERY_SETUP.md +0 -670
- package/packages/core/dist/docs/termux-api/EXECUTION_PLAN.md +0 -532
- package/packages/core/dist/docs/termux-api/MERGE_STRATEGY.md +0 -365
- package/packages/core/dist/docs/termux-api/PATCHES.md +0 -480
- package/packages/core/dist/docs/termux-api/README.md +0 -416
- package/packages/core/dist/docs/tos-privacy.md +0 -96
- package/packages/core/dist/src/safety/conseca/conseca.d.ts +0 -31
- package/packages/core/dist/src/safety/conseca/conseca.js +0 -105
- package/packages/core/dist/src/safety/conseca/conseca.js.map +0 -1
- package/packages/core/dist/src/safety/conseca/conseca.test.d.ts +0 -6
- package/packages/core/dist/src/safety/conseca/conseca.test.js +0 -226
- package/packages/core/dist/src/safety/conseca/conseca.test.js.map +0 -1
- package/packages/core/dist/src/safety/conseca/integration.test.d.ts +0 -6
- package/packages/core/dist/src/safety/conseca/integration.test.js +0 -19
- package/packages/core/dist/src/safety/conseca/integration.test.js.map +0 -1
- package/packages/core/dist/src/safety/conseca/policy-enforcer.d.ts +0 -13
- package/packages/core/dist/src/safety/conseca/policy-enforcer.js +0 -135
- package/packages/core/dist/src/safety/conseca/policy-enforcer.js.map +0 -1
- package/packages/core/dist/src/safety/conseca/policy-enforcer.test.d.ts +0 -6
- package/packages/core/dist/src/safety/conseca/policy-enforcer.test.js +0 -141
- package/packages/core/dist/src/safety/conseca/policy-enforcer.test.js.map +0 -1
- package/packages/core/dist/src/safety/conseca/policy-generator.d.ts +0 -15
- package/packages/core/dist/src/safety/conseca/policy-generator.js +0 -144
- package/packages/core/dist/src/safety/conseca/policy-generator.js.map +0 -1
- package/packages/core/dist/src/safety/conseca/policy-generator.test.d.ts +0 -6
- package/packages/core/dist/src/safety/conseca/policy-generator.test.js +0 -84
- package/packages/core/dist/src/safety/conseca/policy-generator.test.js.map +0 -1
- package/packages/core/dist/src/safety/conseca/types.d.ts +0 -15
- package/packages/core/dist/src/safety/conseca/types.js +0 -7
- package/packages/core/dist/src/safety/conseca/types.js.map +0 -1
- package/packages/core/dist/src/telemetry/conseca-logger.d.ts +0 -9
- package/packages/core/dist/src/telemetry/conseca-logger.js +0 -91
- package/packages/core/dist/src/telemetry/conseca-logger.js.map +0 -1
- package/packages/core/dist/src/telemetry/conseca-logger.test.d.ts +0 -6
- package/packages/core/dist/src/telemetry/conseca-logger.test.js +0 -89
- package/packages/core/dist/src/telemetry/conseca-logger.test.js.map +0 -1
- package/packages/core/dist/src/tools/mcpImportTool.d.ts +0 -31
- package/packages/core/dist/src/tools/mcpImportTool.js +0 -143
- package/packages/core/dist/src/tools/mcpImportTool.js.map +0 -1
- package/packages/core/dist/src/utils/contextMemory.d.ts +0 -67
- package/packages/core/dist/src/utils/contextMemory.js +0 -493
- package/packages/core/dist/src/utils/contextMemory.js.map +0 -1
- package/packages/core/dist/src/utils/contextMemory.test.d.ts +0 -6
- package/packages/core/dist/src/utils/contextMemory.test.js +0 -183
- package/packages/core/dist/src/utils/contextMemory.test.js.map +0 -1
- /package/{bundle/docs/core → packages/core/dist/docs/reference}/memport.md +0 -0
- /package/{bundle/docs/core → packages/core/dist/docs/reference}/tools-api.md +0 -0
- /package/{bundle/docs/cli → packages/core/dist/docs/resources}/uninstall.md +0 -0
|
@@ -6,7 +6,7 @@ import { SuggestionsDisplay, MAX_WIDTH } from './SuggestionsDisplay.js';
|
|
|
6
6
|
import { theme } from '../semantic-colors.js';
|
|
7
7
|
import { useInputHistory } from '../hooks/useInputHistory.js';
|
|
8
8
|
import { HalfLinePaddedBox } from './shared/HalfLinePaddedBox.js';
|
|
9
|
-
import { logicalPosToOffset, PASTED_TEXT_PLACEHOLDER_REGEX, getTransformUnderCursor, } from './shared/text-buffer.js';
|
|
9
|
+
import { logicalPosToOffset, PASTED_TEXT_PLACEHOLDER_REGEX, getTransformUnderCursor, LARGE_PASTE_LINE_THRESHOLD, LARGE_PASTE_CHAR_THRESHOLD, } from './shared/text-buffer.js';
|
|
10
10
|
import { cpSlice, cpLen, toCodePoints, cpIndexToOffset, } from '../utils/textUtils.js';
|
|
11
11
|
import chalk from 'chalk';
|
|
12
12
|
import stringWidth from 'string-width';
|
|
@@ -22,17 +22,20 @@ import { clipboardHasImage, saveClipboardImage, cleanupOldClipboardImages, } fro
|
|
|
22
22
|
import { isAutoExecutableCommand, isSlashCommand, } from '../utils/commandUtils.js';
|
|
23
23
|
import * as path from 'node:path';
|
|
24
24
|
import { SCREEN_READER_USER_PREFIX } from '../textConstants.js';
|
|
25
|
-
import { DEFAULT_BACKGROUND_OPACITY } from '../constants.js';
|
|
25
|
+
import { DEFAULT_BACKGROUND_OPACITY, DEFAULT_INPUT_BACKGROUND_OPACITY, } from '../constants.js';
|
|
26
26
|
import { getSafeLowColorBackground } from '../themes/color-utils.js';
|
|
27
27
|
import { isLowColorDepth } from '../utils/terminalUtils.js';
|
|
28
28
|
import { useShellFocusState } from '../contexts/ShellFocusContext.js';
|
|
29
29
|
import { useUIState } from '../contexts/UIStateContext.js';
|
|
30
|
+
import { appEvents, AppEvent, TransientMessageType, } from '../../utils/events.js';
|
|
30
31
|
import { useSettings } from '../contexts/SettingsContext.js';
|
|
31
32
|
import { StreamingState } from '../types.js';
|
|
32
33
|
import { useMouseClick } from '../hooks/useMouseClick.js';
|
|
33
34
|
import { useMouse } from '../contexts/MouseContext.js';
|
|
34
35
|
import { useUIActions } from '../contexts/UIActionsContext.js';
|
|
35
36
|
import { useAlternateBuffer } from '../hooks/useAlternateBuffer.js';
|
|
37
|
+
import { shouldDismissShortcutsHelpOnHotkey } from '../utils/shortcutsHelp.js';
|
|
38
|
+
import { useRepeatedKeyPress } from '../hooks/useRepeatedKeyPress.js';
|
|
36
39
|
/**
|
|
37
40
|
* Returns if the terminal can be trusted to handle paste events atomically
|
|
38
41
|
* rather than potentially sending multiple paste events separated by line
|
|
@@ -57,17 +60,77 @@ export const calculatePromptWidths = (mainContentWidth) => {
|
|
|
57
60
|
frameOverhead: FRAME_OVERHEAD,
|
|
58
61
|
};
|
|
59
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Returns true if the given text exceeds the thresholds for being considered a "large paste".
|
|
65
|
+
*/
|
|
66
|
+
export function isLargePaste(text) {
|
|
67
|
+
const pasteLineCount = text.split('\n').length;
|
|
68
|
+
return (pasteLineCount > LARGE_PASTE_LINE_THRESHOLD ||
|
|
69
|
+
text.length > LARGE_PASTE_CHAR_THRESHOLD);
|
|
70
|
+
}
|
|
71
|
+
const DOUBLE_TAB_CLEAN_UI_TOGGLE_WINDOW_MS = 350;
|
|
72
|
+
/**
|
|
73
|
+
* Attempt to toggle expansion of a paste placeholder in the buffer.
|
|
74
|
+
* Returns true if a toggle action was performed or hint was shown, false otherwise.
|
|
75
|
+
*/
|
|
76
|
+
export function tryTogglePasteExpansion(buffer) {
|
|
77
|
+
if (!buffer.pastedContent || Object.keys(buffer.pastedContent).length === 0) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const [row, col] = buffer.cursor;
|
|
81
|
+
// 1. Check if cursor is on or immediately after a collapsed placeholder
|
|
82
|
+
const transform = getTransformUnderCursor(row, col, buffer.transformationsByLine, { includeEdge: true });
|
|
83
|
+
if (transform?.type === 'paste' && transform.id) {
|
|
84
|
+
buffer.togglePasteExpansion(transform.id, row, col);
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
// 2. Check if cursor is inside an expanded paste region — collapse it
|
|
88
|
+
const expandedId = buffer.getExpandedPasteAtLine(row);
|
|
89
|
+
if (expandedId) {
|
|
90
|
+
buffer.togglePasteExpansion(expandedId, row, col);
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
// 3. Placeholders exist but cursor isn't on one — show hint
|
|
94
|
+
appEvents.emit(AppEvent.TransientMessage, {
|
|
95
|
+
message: 'Move cursor within placeholder to expand',
|
|
96
|
+
type: TransientMessageType.Hint,
|
|
97
|
+
});
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
60
100
|
export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, config, slashCommands, commandContext, placeholder = ' Type your message or @path/to/file', focus = true, inputWidth, suggestionsWidth, shellModeActive, setShellModeActive, approvalMode, onEscapePromptChange, onSuggestionsVisibilityChange, vimHandleInput, isEmbeddedShellFocused, setQueueErrorMessage, streamingState, popAllMessages, suggestionsPosition = 'below', setBannerVisible, }) => {
|
|
61
101
|
const { stdout } = useStdout();
|
|
62
102
|
const { merged: settings } = useSettings();
|
|
63
103
|
const kittyProtocol = useKittyKeyboardProtocol();
|
|
64
104
|
const isShellFocused = useShellFocusState();
|
|
65
|
-
const { setEmbeddedShellFocused } = useUIActions();
|
|
66
|
-
const { terminalWidth, activePtyId, history,
|
|
67
|
-
const [
|
|
68
|
-
const
|
|
105
|
+
const { setEmbeddedShellFocused, setShortcutsHelpVisible, toggleCleanUiDetailsVisible, } = useUIActions();
|
|
106
|
+
const { terminalWidth, activePtyId, history, backgroundShells, backgroundShellHeight, shortcutsHelpVisible, hintMode, } = useUIState();
|
|
107
|
+
const [suppressCompletion, setSuppressCompletion] = useState(false);
|
|
108
|
+
const { handlePress: registerPlainTabPress, resetCount: resetPlainTabPress } = useRepeatedKeyPress({
|
|
109
|
+
windowMs: DOUBLE_TAB_CLEAN_UI_TOGGLE_WINDOW_MS,
|
|
110
|
+
});
|
|
69
111
|
const [showEscapePrompt, setShowEscapePrompt] = useState(false);
|
|
70
|
-
const
|
|
112
|
+
const { handlePress: handleEscPress, resetCount: resetEscapeState } = useRepeatedKeyPress({
|
|
113
|
+
windowMs: 500,
|
|
114
|
+
onRepeat: (count) => {
|
|
115
|
+
if (count === 1) {
|
|
116
|
+
setShowEscapePrompt(true);
|
|
117
|
+
}
|
|
118
|
+
else if (count === 2) {
|
|
119
|
+
resetEscapeState();
|
|
120
|
+
if (buffer.text.length > 0) {
|
|
121
|
+
buffer.setText('');
|
|
122
|
+
resetCompletionState();
|
|
123
|
+
}
|
|
124
|
+
else if (history.length > 0) {
|
|
125
|
+
onSubmit('/rewind');
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
coreEvents.emitFeedback('info', 'Nothing to rewind to');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
onReset: () => setShowEscapePrompt(false),
|
|
133
|
+
});
|
|
71
134
|
const [recentUnsafePasteTime, setRecentUnsafePasteTime] = useState(null);
|
|
72
135
|
const pasteTimeoutRef = useRef(null);
|
|
73
136
|
const innerBoxRef = useRef(null);
|
|
@@ -78,34 +141,33 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
78
141
|
0, 0,
|
|
79
142
|
]);
|
|
80
143
|
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = useState(-1);
|
|
81
|
-
const shellHistory = useShellHistory(config.getProjectRoot());
|
|
144
|
+
const shellHistory = useShellHistory(config.getProjectRoot(), config.storage);
|
|
82
145
|
const shellHistoryData = shellHistory.history;
|
|
83
|
-
const completion = useCommandCompletion(
|
|
146
|
+
const completion = useCommandCompletion({
|
|
147
|
+
buffer,
|
|
148
|
+
cwd: config.getTargetDir(),
|
|
149
|
+
slashCommands,
|
|
150
|
+
commandContext,
|
|
151
|
+
reverseSearchActive,
|
|
152
|
+
shellModeActive,
|
|
153
|
+
config,
|
|
154
|
+
active: !suppressCompletion,
|
|
155
|
+
});
|
|
84
156
|
const reverseSearchCompletion = useReverseSearchCompletion(buffer, shellHistoryData, reverseSearchActive);
|
|
85
|
-
const
|
|
157
|
+
const reversedUserMessages = useMemo(() => [...userMessages].reverse(), [userMessages]);
|
|
158
|
+
const commandSearchCompletion = useReverseSearchCompletion(buffer, reversedUserMessages, commandSearchActive);
|
|
86
159
|
const resetCompletionState = completion.resetCompletionState;
|
|
87
160
|
const resetReverseSearchCompletionState = reverseSearchCompletion.resetCompletionState;
|
|
88
161
|
const resetCommandSearchCompletionState = commandSearchCompletion.resetCompletionState;
|
|
89
162
|
const showCursor = focus && isShellFocused && !isEmbeddedShellFocused;
|
|
90
|
-
const resetEscapeState = useCallback(() => {
|
|
91
|
-
if (escapeTimerRef.current) {
|
|
92
|
-
clearTimeout(escapeTimerRef.current);
|
|
93
|
-
escapeTimerRef.current = null;
|
|
94
|
-
}
|
|
95
|
-
escPressCount.current = 0;
|
|
96
|
-
setShowEscapePrompt(false);
|
|
97
|
-
}, []);
|
|
98
163
|
// Notify parent component about escape prompt state changes
|
|
99
164
|
useEffect(() => {
|
|
100
165
|
if (onEscapePromptChange) {
|
|
101
166
|
onEscapePromptChange(showEscapePrompt);
|
|
102
167
|
}
|
|
103
168
|
}, [showEscapePrompt, onEscapePromptChange]);
|
|
104
|
-
// Clear
|
|
169
|
+
// Clear paste timeout on unmount
|
|
105
170
|
useEffect(() => () => {
|
|
106
|
-
if (escapeTimerRef.current) {
|
|
107
|
-
clearTimeout(escapeTimerRef.current);
|
|
108
|
-
}
|
|
109
171
|
if (pasteTimeoutRef.current) {
|
|
110
172
|
clearTimeout(pasteTimeoutRef.current);
|
|
111
173
|
}
|
|
@@ -126,13 +188,26 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
126
188
|
resetCompletionState();
|
|
127
189
|
resetReverseSearchCompletionState();
|
|
128
190
|
}, [
|
|
129
|
-
onSubmit,
|
|
130
191
|
buffer,
|
|
192
|
+
onSubmit,
|
|
131
193
|
resetCompletionState,
|
|
132
194
|
shellModeActive,
|
|
133
195
|
shellHistory,
|
|
134
196
|
resetReverseSearchCompletionState,
|
|
135
197
|
]);
|
|
198
|
+
const customSetTextAndResetCompletionSignal = useCallback((newText, cursorPosition) => {
|
|
199
|
+
buffer.setText(newText, cursorPosition);
|
|
200
|
+
setSuppressCompletion(true);
|
|
201
|
+
}, [buffer, setSuppressCompletion]);
|
|
202
|
+
const inputHistory = useInputHistory({
|
|
203
|
+
userMessages,
|
|
204
|
+
onSubmit: handleSubmitAndClear,
|
|
205
|
+
isActive: (!completion.showSuggestions || completion.suggestions.length === 1) &&
|
|
206
|
+
!shellModeActive,
|
|
207
|
+
currentQuery: buffer.text,
|
|
208
|
+
currentCursorOffset: buffer.getOffset(),
|
|
209
|
+
onChange: customSetTextAndResetCompletionSignal,
|
|
210
|
+
});
|
|
136
211
|
const handleSubmit = useCallback((submittedValue) => {
|
|
137
212
|
const trimmedMessage = submittedValue.trim();
|
|
138
213
|
const isSlash = isSlashCommand(trimmedMessage);
|
|
@@ -142,41 +217,24 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
142
217
|
setQueueErrorMessage(`${isShell ? 'Shell' : 'Slash'} commands cannot be queued`);
|
|
143
218
|
return;
|
|
144
219
|
}
|
|
145
|
-
|
|
146
|
-
}, [
|
|
147
|
-
handleSubmitAndClear,
|
|
148
|
-
shellModeActive,
|
|
149
|
-
streamingState,
|
|
150
|
-
setQueueErrorMessage,
|
|
151
|
-
]);
|
|
152
|
-
const customSetTextAndResetCompletionSignal = useCallback((newText) => {
|
|
153
|
-
buffer.setText(newText);
|
|
154
|
-
setJustNavigatedHistory(true);
|
|
155
|
-
}, [buffer, setJustNavigatedHistory]);
|
|
156
|
-
const inputHistory = useInputHistory({
|
|
157
|
-
userMessages,
|
|
158
|
-
onSubmit: handleSubmitAndClear,
|
|
159
|
-
isActive: (!completion.showSuggestions || completion.suggestions.length === 1) &&
|
|
160
|
-
!shellModeActive,
|
|
161
|
-
currentQuery: buffer.text,
|
|
162
|
-
onChange: customSetTextAndResetCompletionSignal,
|
|
163
|
-
});
|
|
220
|
+
inputHistory.handleSubmit(trimmedMessage);
|
|
221
|
+
}, [inputHistory, shellModeActive, streamingState, setQueueErrorMessage]);
|
|
164
222
|
// Effect to reset completion if history navigation just occurred and set the text
|
|
165
223
|
useEffect(() => {
|
|
166
|
-
if (
|
|
224
|
+
if (suppressCompletion) {
|
|
167
225
|
resetCompletionState();
|
|
168
226
|
resetReverseSearchCompletionState();
|
|
169
227
|
resetCommandSearchCompletionState();
|
|
170
228
|
setExpandedSuggestionIndex(-1);
|
|
171
|
-
setJustNavigatedHistory(false);
|
|
172
229
|
}
|
|
173
230
|
}, [
|
|
174
|
-
|
|
231
|
+
suppressCompletion,
|
|
175
232
|
buffer.text,
|
|
176
233
|
resetCompletionState,
|
|
177
|
-
|
|
234
|
+
setSuppressCompletion,
|
|
178
235
|
resetReverseSearchCompletionState,
|
|
179
236
|
resetCommandSearchCompletionState,
|
|
237
|
+
setExpandedSuggestionIndex,
|
|
180
238
|
]);
|
|
181
239
|
// Helper function to handle loading queued messages into input
|
|
182
240
|
// Returns true if we should continue with input history navigation
|
|
@@ -197,6 +255,9 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
197
255
|
}, [buffer, popAllMessages, inputHistory]);
|
|
198
256
|
// Handle clipboard image pasting with Ctrl+V
|
|
199
257
|
const handleClipboardPaste = useCallback(async () => {
|
|
258
|
+
if (shortcutsHelpVisible) {
|
|
259
|
+
setShortcutsHelpVisible(false);
|
|
260
|
+
}
|
|
200
261
|
try {
|
|
201
262
|
if (await clipboardHasImage()) {
|
|
202
263
|
const imagePath = await saveClipboardImage(config.getTargetDir());
|
|
@@ -231,13 +292,27 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
231
292
|
else {
|
|
232
293
|
const textToInsert = await clipboardy.read();
|
|
233
294
|
buffer.insert(textToInsert, { paste: true });
|
|
295
|
+
if (isLargePaste(textToInsert)) {
|
|
296
|
+
appEvents.emit(AppEvent.TransientMessage, {
|
|
297
|
+
message: 'Press Ctrl+O to expand pasted text',
|
|
298
|
+
type: TransientMessageType.Hint,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
234
301
|
}
|
|
235
302
|
}
|
|
236
303
|
catch (error) {
|
|
237
304
|
debugLogger.error('Error handling paste:', error);
|
|
238
305
|
}
|
|
239
|
-
}, [
|
|
306
|
+
}, [
|
|
307
|
+
buffer,
|
|
308
|
+
config,
|
|
309
|
+
stdout,
|
|
310
|
+
settings,
|
|
311
|
+
shortcutsHelpVisible,
|
|
312
|
+
setShortcutsHelpVisible,
|
|
313
|
+
]);
|
|
240
314
|
useMouseClick(innerBoxRef, (_event, relX, relY) => {
|
|
315
|
+
setSuppressCompletion(true);
|
|
241
316
|
if (isEmbeddedShellFocused) {
|
|
242
317
|
setEmbeddedShellFocused(false);
|
|
243
318
|
}
|
|
@@ -259,7 +334,7 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
259
334
|
: buffer.getLogicalPositionFromVisual(buffer.visualScrollRow + relY, relX);
|
|
260
335
|
// Check for paste placeholder (collapsed state)
|
|
261
336
|
if (logicalPos) {
|
|
262
|
-
const transform = getTransformUnderCursor(logicalPos.row, logicalPos.col, buffer.transformationsByLine);
|
|
337
|
+
const transform = getTransformUnderCursor(logicalPos.row, logicalPos.col, buffer.transformationsByLine, { includeEdge: true });
|
|
263
338
|
if (transform?.type === 'paste' && transform.id) {
|
|
264
339
|
buffer.togglePasteExpansion(transform.id, logicalPos.row, logicalPos.col);
|
|
265
340
|
return;
|
|
@@ -275,11 +350,46 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
275
350
|
}, { isActive: focus, name: 'double-click' });
|
|
276
351
|
useMouse((event) => {
|
|
277
352
|
if (event.name === 'right-release') {
|
|
353
|
+
setSuppressCompletion(false);
|
|
278
354
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
279
355
|
handleClipboardPaste();
|
|
280
356
|
}
|
|
281
357
|
}, { isActive: focus });
|
|
282
358
|
const handleInput = useCallback((key) => {
|
|
359
|
+
// Determine if this keypress is a history navigation command
|
|
360
|
+
const isHistoryUp = !shellModeActive &&
|
|
361
|
+
(keyMatchers[Command.HISTORY_UP](key) ||
|
|
362
|
+
(keyMatchers[Command.NAVIGATION_UP](key) &&
|
|
363
|
+
(buffer.allVisualLines.length === 1 ||
|
|
364
|
+
(buffer.visualCursor[0] === 0 && buffer.visualScrollRow === 0))));
|
|
365
|
+
const isHistoryDown = !shellModeActive &&
|
|
366
|
+
(keyMatchers[Command.HISTORY_DOWN](key) ||
|
|
367
|
+
(keyMatchers[Command.NAVIGATION_DOWN](key) &&
|
|
368
|
+
(buffer.allVisualLines.length === 1 ||
|
|
369
|
+
buffer.visualCursor[0] === buffer.allVisualLines.length - 1)));
|
|
370
|
+
const isHistoryNav = isHistoryUp || isHistoryDown;
|
|
371
|
+
const isCursorMovement = keyMatchers[Command.MOVE_LEFT](key) ||
|
|
372
|
+
keyMatchers[Command.MOVE_RIGHT](key) ||
|
|
373
|
+
keyMatchers[Command.MOVE_UP](key) ||
|
|
374
|
+
keyMatchers[Command.MOVE_DOWN](key) ||
|
|
375
|
+
keyMatchers[Command.MOVE_WORD_LEFT](key) ||
|
|
376
|
+
keyMatchers[Command.MOVE_WORD_RIGHT](key) ||
|
|
377
|
+
keyMatchers[Command.HOME](key) ||
|
|
378
|
+
keyMatchers[Command.END](key);
|
|
379
|
+
const isSuggestionsNav = (completion.showSuggestions ||
|
|
380
|
+
reverseSearchCompletion.showSuggestions ||
|
|
381
|
+
commandSearchCompletion.showSuggestions) &&
|
|
382
|
+
(keyMatchers[Command.COMPLETION_UP](key) ||
|
|
383
|
+
keyMatchers[Command.COMPLETION_DOWN](key) ||
|
|
384
|
+
keyMatchers[Command.EXPAND_SUGGESTION](key) ||
|
|
385
|
+
keyMatchers[Command.COLLAPSE_SUGGESTION](key) ||
|
|
386
|
+
keyMatchers[Command.ACCEPT_SUGGESTION](key));
|
|
387
|
+
// Reset completion suppression if the user performs any action other than
|
|
388
|
+
// history navigation or cursor movement.
|
|
389
|
+
// We explicitly skip this if we are currently navigating suggestions.
|
|
390
|
+
if (!isSuggestionsNav) {
|
|
391
|
+
setSuppressCompletion(isHistoryNav || isCursorMovement || keyMatchers[Command.ESCAPE](key));
|
|
392
|
+
}
|
|
283
393
|
// TODO(jacobr): this special case is likely not needed anymore.
|
|
284
394
|
// We should probably stop supporting paste if the InputPrompt is not
|
|
285
395
|
// focused.
|
|
@@ -287,7 +397,42 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
287
397
|
if (!focus && key.name !== 'paste') {
|
|
288
398
|
return false;
|
|
289
399
|
}
|
|
400
|
+
// Handle escape to close shortcuts panel first, before letting it bubble
|
|
401
|
+
// up for cancellation. This ensures pressing Escape once closes the panel,
|
|
402
|
+
// and pressing again cancels the operation.
|
|
403
|
+
if (shortcutsHelpVisible && key.name === 'escape') {
|
|
404
|
+
setShortcutsHelpVisible(false);
|
|
405
|
+
return true;
|
|
406
|
+
}
|
|
407
|
+
if (key.name === 'escape' &&
|
|
408
|
+
(streamingState === StreamingState.Responding ||
|
|
409
|
+
streamingState === StreamingState.WaitingForConfirmation)) {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
const isPlainTab = key.name === 'tab' && !key.shift && !key.alt && !key.ctrl && !key.cmd;
|
|
413
|
+
const hasTabCompletionInteraction = completion.showSuggestions ||
|
|
414
|
+
Boolean(completion.promptCompletion.text) ||
|
|
415
|
+
reverseSearchActive ||
|
|
416
|
+
commandSearchActive;
|
|
417
|
+
if (isPlainTab) {
|
|
418
|
+
if (!hasTabCompletionInteraction) {
|
|
419
|
+
if (registerPlainTabPress() === 2) {
|
|
420
|
+
toggleCleanUiDetailsVisible();
|
|
421
|
+
resetPlainTabPress();
|
|
422
|
+
return true;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
resetPlainTabPress();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
resetPlainTabPress();
|
|
431
|
+
}
|
|
290
432
|
if (key.name === 'paste') {
|
|
433
|
+
if (shortcutsHelpVisible) {
|
|
434
|
+
setShortcutsHelpVisible(false);
|
|
435
|
+
}
|
|
291
436
|
// Record paste time to prevent accidental auto-submission
|
|
292
437
|
if (!isTerminalPasteTrusted(kittyProtocol.enabled)) {
|
|
293
438
|
setRecentUnsafePasteTime(Date.now());
|
|
@@ -311,6 +456,38 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
311
456
|
}
|
|
312
457
|
// Ensure we never accidentally interpret paste as regular input.
|
|
313
458
|
buffer.handleInput(key);
|
|
459
|
+
if (key.sequence && isLargePaste(key.sequence)) {
|
|
460
|
+
appEvents.emit(AppEvent.TransientMessage, {
|
|
461
|
+
message: 'Press Ctrl+O to expand pasted text',
|
|
462
|
+
type: TransientMessageType.Hint,
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
if (shortcutsHelpVisible && shouldDismissShortcutsHelpOnHotkey(key)) {
|
|
468
|
+
setShortcutsHelpVisible(false);
|
|
469
|
+
}
|
|
470
|
+
if (shortcutsHelpVisible) {
|
|
471
|
+
if (key.sequence === '?' && key.insertable) {
|
|
472
|
+
setShortcutsHelpVisible(false);
|
|
473
|
+
buffer.handleInput(key);
|
|
474
|
+
return true;
|
|
475
|
+
}
|
|
476
|
+
// Escape is handled earlier to ensure it closes the panel before
|
|
477
|
+
// potentially cancelling an operation
|
|
478
|
+
if (key.name === 'backspace' || key.sequence === '\b') {
|
|
479
|
+
setShortcutsHelpVisible(false);
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
if (key.insertable) {
|
|
483
|
+
setShortcutsHelpVisible(false);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
if (key.sequence === '?' &&
|
|
487
|
+
key.insertable &&
|
|
488
|
+
!shortcutsHelpVisible &&
|
|
489
|
+
buffer.text.length === 0) {
|
|
490
|
+
setShortcutsHelpVisible(true);
|
|
314
491
|
return true;
|
|
315
492
|
}
|
|
316
493
|
if (vimHandleInput && vimHandleInput(key)) {
|
|
@@ -318,9 +495,13 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
318
495
|
}
|
|
319
496
|
// Reset ESC count and hide prompt on any non-ESC key
|
|
320
497
|
if (key.name !== 'escape') {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
498
|
+
resetEscapeState();
|
|
499
|
+
}
|
|
500
|
+
// Ctrl+O to expand/collapse paste placeholders
|
|
501
|
+
if (keyMatchers[Command.EXPAND_PASTE](key)) {
|
|
502
|
+
const handled = tryTogglePasteExpansion(buffer);
|
|
503
|
+
if (handled)
|
|
504
|
+
return true;
|
|
324
505
|
}
|
|
325
506
|
if (key.sequence === '!' &&
|
|
326
507
|
buffer.text === '' &&
|
|
@@ -357,30 +538,7 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
357
538
|
resetEscapeState();
|
|
358
539
|
return true;
|
|
359
540
|
}
|
|
360
|
-
|
|
361
|
-
if (escPressCount.current === 0) {
|
|
362
|
-
escPressCount.current = 1;
|
|
363
|
-
setShowEscapePrompt(true);
|
|
364
|
-
if (escapeTimerRef.current) {
|
|
365
|
-
clearTimeout(escapeTimerRef.current);
|
|
366
|
-
}
|
|
367
|
-
escapeTimerRef.current = setTimeout(() => {
|
|
368
|
-
resetEscapeState();
|
|
369
|
-
}, 500);
|
|
370
|
-
return true;
|
|
371
|
-
}
|
|
372
|
-
// Second ESC
|
|
373
|
-
resetEscapeState();
|
|
374
|
-
if (buffer.text.length > 0) {
|
|
375
|
-
buffer.setText('');
|
|
376
|
-
resetCompletionState();
|
|
377
|
-
return true;
|
|
378
|
-
}
|
|
379
|
-
else if (history.length > 0) {
|
|
380
|
-
onSubmit('/rewind');
|
|
381
|
-
return true;
|
|
382
|
-
}
|
|
383
|
-
coreEvents.emitFeedback('info', 'Nothing to rewind to');
|
|
541
|
+
handleEscPress();
|
|
384
542
|
return true;
|
|
385
543
|
}
|
|
386
544
|
if (keyMatchers[Command.CLEAR_SCREEN](key)) {
|
|
@@ -436,7 +594,7 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
436
594
|
const textToSubmit = showSuggestions && activeSuggestionIndex > -1
|
|
437
595
|
? suggestions[activeSuggestionIndex].value
|
|
438
596
|
: buffer.text;
|
|
439
|
-
|
|
597
|
+
handleSubmit(textToSubmit);
|
|
440
598
|
resetState();
|
|
441
599
|
setActive(false);
|
|
442
600
|
return true;
|
|
@@ -450,11 +608,17 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
450
608
|
// If the command is a perfect match, pressing enter should execute it.
|
|
451
609
|
// We prioritize execution unless the user is explicitly selecting a different suggestion.
|
|
452
610
|
if (completion.isPerfectMatch &&
|
|
453
|
-
keyMatchers[Command.
|
|
611
|
+
keyMatchers[Command.SUBMIT](key) &&
|
|
612
|
+
recentUnsafePasteTime === null &&
|
|
454
613
|
(!completion.showSuggestions || completion.activeSuggestionIndex <= 0)) {
|
|
455
614
|
handleSubmit(buffer.text);
|
|
456
615
|
return true;
|
|
457
616
|
}
|
|
617
|
+
// Newline insertion
|
|
618
|
+
if (keyMatchers[Command.NEWLINE](key)) {
|
|
619
|
+
buffer.newline();
|
|
620
|
+
return true;
|
|
621
|
+
}
|
|
458
622
|
if (completion.showSuggestions) {
|
|
459
623
|
if (completion.suggestions.length > 1) {
|
|
460
624
|
if (keyMatchers[Command.COMPLETION_UP](key)) {
|
|
@@ -515,6 +679,7 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
515
679
|
}
|
|
516
680
|
// Handle Tab key for ghost text acceptance
|
|
517
681
|
if (key.name === 'tab' &&
|
|
682
|
+
!key.shift &&
|
|
518
683
|
!completion.showSuggestions &&
|
|
519
684
|
completion.promptCompletion.text) {
|
|
520
685
|
completion.promptCompletion.accept();
|
|
@@ -527,24 +692,12 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
527
692
|
setCursorPosition(buffer.cursor);
|
|
528
693
|
return true;
|
|
529
694
|
}
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
695
|
+
if (isHistoryUp) {
|
|
696
|
+
if (keyMatchers[Command.NAVIGATION_UP](key) &&
|
|
697
|
+
buffer.visualCursor[1] > 0) {
|
|
698
|
+
buffer.move('home');
|
|
534
699
|
return true;
|
|
535
700
|
}
|
|
536
|
-
// Only navigate history if popAllMessages doesn't exist
|
|
537
|
-
inputHistory.navigateUp();
|
|
538
|
-
return true;
|
|
539
|
-
}
|
|
540
|
-
if (keyMatchers[Command.HISTORY_DOWN](key)) {
|
|
541
|
-
inputHistory.navigateDown();
|
|
542
|
-
return true;
|
|
543
|
-
}
|
|
544
|
-
// Handle arrow-up/down for history on single-line or at edges
|
|
545
|
-
if (keyMatchers[Command.NAVIGATION_UP](key) &&
|
|
546
|
-
(buffer.allVisualLines.length === 1 ||
|
|
547
|
-
(buffer.visualCursor[0] === 0 && buffer.visualScrollRow === 0))) {
|
|
548
701
|
// Check for queued messages first when input is empty
|
|
549
702
|
// If no queued messages, inputHistory.navigateUp() is called inside tryLoadQueuedMessages
|
|
550
703
|
if (tryLoadQueuedMessages()) {
|
|
@@ -554,9 +707,13 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
554
707
|
inputHistory.navigateUp();
|
|
555
708
|
return true;
|
|
556
709
|
}
|
|
557
|
-
if (
|
|
558
|
-
(
|
|
559
|
-
buffer.visualCursor[
|
|
710
|
+
if (isHistoryDown) {
|
|
711
|
+
if (keyMatchers[Command.NAVIGATION_DOWN](key) &&
|
|
712
|
+
buffer.visualCursor[1] <
|
|
713
|
+
cpLen(buffer.allVisualLines[buffer.visualCursor[0]] || '')) {
|
|
714
|
+
buffer.move('end');
|
|
715
|
+
return true;
|
|
716
|
+
}
|
|
560
717
|
inputHistory.navigateDown();
|
|
561
718
|
return true;
|
|
562
719
|
}
|
|
@@ -564,12 +721,25 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
564
721
|
else {
|
|
565
722
|
// Shell History Navigation
|
|
566
723
|
if (keyMatchers[Command.NAVIGATION_UP](key)) {
|
|
724
|
+
if ((buffer.allVisualLines.length === 1 ||
|
|
725
|
+
(buffer.visualCursor[0] === 0 && buffer.visualScrollRow === 0)) &&
|
|
726
|
+
buffer.visualCursor[1] > 0) {
|
|
727
|
+
buffer.move('home');
|
|
728
|
+
return true;
|
|
729
|
+
}
|
|
567
730
|
const prevCommand = shellHistory.getPreviousCommand();
|
|
568
731
|
if (prevCommand !== null)
|
|
569
732
|
buffer.setText(prevCommand);
|
|
570
733
|
return true;
|
|
571
734
|
}
|
|
572
735
|
if (keyMatchers[Command.NAVIGATION_DOWN](key)) {
|
|
736
|
+
if ((buffer.allVisualLines.length === 1 ||
|
|
737
|
+
buffer.visualCursor[0] === buffer.allVisualLines.length - 1) &&
|
|
738
|
+
buffer.visualCursor[1] <
|
|
739
|
+
cpLen(buffer.allVisualLines[buffer.visualCursor[0]] || '')) {
|
|
740
|
+
buffer.move('end');
|
|
741
|
+
return true;
|
|
742
|
+
}
|
|
573
743
|
const nextCommand = shellHistory.getNextCommand();
|
|
574
744
|
if (nextCommand !== null)
|
|
575
745
|
buffer.setText(nextCommand);
|
|
@@ -602,11 +772,6 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
602
772
|
}
|
|
603
773
|
return true;
|
|
604
774
|
}
|
|
605
|
-
// Newline insertion
|
|
606
|
-
if (keyMatchers[Command.NEWLINE](key)) {
|
|
607
|
-
buffer.newline();
|
|
608
|
-
return true;
|
|
609
|
-
}
|
|
610
775
|
// Ctrl+A (Home) / Ctrl+E (End)
|
|
611
776
|
if (keyMatchers[Command.HOME](key)) {
|
|
612
777
|
buffer.move('home');
|
|
@@ -641,13 +806,16 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
641
806
|
handleClipboardPaste();
|
|
642
807
|
return true;
|
|
643
808
|
}
|
|
809
|
+
if (keyMatchers[Command.TOGGLE_BACKGROUND_SHELL](key)) {
|
|
810
|
+
return false;
|
|
811
|
+
}
|
|
644
812
|
if (keyMatchers[Command.FOCUS_SHELL_INPUT](key)) {
|
|
645
|
-
// If we got here, Autocomplete didn't handle the key (e.g. no suggestions).
|
|
646
813
|
if (activePtyId ||
|
|
647
814
|
(backgroundShells.size > 0 && backgroundShellHeight > 0)) {
|
|
648
815
|
setEmbeddedShellFocused(true);
|
|
816
|
+
return true;
|
|
649
817
|
}
|
|
650
|
-
return
|
|
818
|
+
return false;
|
|
651
819
|
}
|
|
652
820
|
// Fall back to the text buffer's default input handling for all other keys
|
|
653
821
|
const handled = buffer.handleInput(key);
|
|
@@ -675,13 +843,11 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
675
843
|
setShellModeActive,
|
|
676
844
|
onClearScreen,
|
|
677
845
|
inputHistory,
|
|
678
|
-
handleSubmitAndClear,
|
|
679
846
|
handleSubmit,
|
|
680
847
|
shellHistory,
|
|
681
848
|
reverseSearchCompletion,
|
|
682
849
|
handleClipboardPaste,
|
|
683
850
|
resetCompletionState,
|
|
684
|
-
showEscapePrompt,
|
|
685
851
|
resetEscapeState,
|
|
686
852
|
vimHandleInput,
|
|
687
853
|
reverseSearchActive,
|
|
@@ -691,14 +857,19 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
691
857
|
commandSearchActive,
|
|
692
858
|
commandSearchCompletion,
|
|
693
859
|
kittyProtocol.enabled,
|
|
860
|
+
shortcutsHelpVisible,
|
|
861
|
+
setShortcutsHelpVisible,
|
|
694
862
|
tryLoadQueuedMessages,
|
|
695
863
|
setBannerVisible,
|
|
696
|
-
onSubmit,
|
|
697
864
|
activePtyId,
|
|
698
865
|
setEmbeddedShellFocused,
|
|
699
866
|
backgroundShells.size,
|
|
700
867
|
backgroundShellHeight,
|
|
701
|
-
|
|
868
|
+
streamingState,
|
|
869
|
+
handleEscPress,
|
|
870
|
+
registerPlainTabPress,
|
|
871
|
+
resetPlainTabPress,
|
|
872
|
+
toggleCleanUiDetailsVisible,
|
|
702
873
|
]);
|
|
703
874
|
useKeypress(handleInput, {
|
|
704
875
|
isActive: !isEmbeddedShellFocused,
|
|
@@ -815,7 +986,7 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
815
986
|
const shouldShowSuggestions = activeCompletion.showSuggestions;
|
|
816
987
|
const useBackgroundColor = config.getUseBackgroundColor();
|
|
817
988
|
const isLowColor = isLowColorDepth();
|
|
818
|
-
const terminalBg =
|
|
989
|
+
const terminalBg = theme.background.primary || 'black';
|
|
819
990
|
// We should fallback to lines if the background color is disabled OR if it is
|
|
820
991
|
// enabled but we are in a low color depth terminal where we don't have a safe
|
|
821
992
|
// background color to use.
|
|
@@ -864,22 +1035,76 @@ export const InputPrompt = ({ buffer, onSubmit, userMessages, onClearScreen, con
|
|
|
864
1035
|
const borderColor = isShellFocused && !isEmbeddedShellFocused
|
|
865
1036
|
? (statusColor ?? theme.border.focused)
|
|
866
1037
|
: theme.border.default;
|
|
867
|
-
return (_jsxs(_Fragment, { children: [suggestionsPosition === 'above' && suggestionsNode, useLineFallback ? (_jsx(Box, { borderStyle: "round", borderTop: true, borderBottom: false, borderLeft: false, borderRight: false, borderColor: borderColor, width: terminalWidth, flexDirection: "row", alignItems: "flex-start", height: 0 })) : null,
|
|
868
|
-
?
|
|
869
|
-
:
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
1038
|
+
return (_jsxs(_Fragment, { children: [suggestionsPosition === 'above' && suggestionsNode, useLineFallback ? (_jsx(Box, { borderStyle: "round", borderTop: true, borderBottom: false, borderLeft: false, borderRight: false, borderColor: borderColor, width: terminalWidth, flexDirection: "row", alignItems: "flex-start", height: 0 })) : null, _jsx(HalfLinePaddedBox, { backgroundBaseColor: hintMode ? theme.text.accent : theme.text.secondary, backgroundOpacity: showCursor
|
|
1039
|
+
? DEFAULT_INPUT_BACKGROUND_OPACITY
|
|
1040
|
+
: DEFAULT_BACKGROUND_OPACITY, useBackgroundColor: useBackgroundColor, children: _jsxs(Box, { flexGrow: 1, flexDirection: "row", paddingX: 1, borderColor: borderColor, borderStyle: useLineFallback ? 'round' : undefined, borderTop: false, borderBottom: false, borderLeft: !useBackgroundColor, borderRight: !useBackgroundColor, children: [_jsxs(Text, { color: statusColor ?? theme.text.accent, "aria-label": statusText || undefined, children: [shellModeActive ? (reverseSearchActive ? (_jsxs(Text, { color: theme.text.link, "aria-label": SCREEN_READER_USER_PREFIX, children: ["(r:)", ' '] })) : ('!')) : commandSearchActive ? (_jsx(Text, { color: theme.text.accent, children: "(r:) " })) : showYoloStyling ? ('*') : ('>'), ' '] }), _jsx(Box, { flexGrow: 1, flexDirection: "column", ref: innerBoxRef, children: buffer.text.length === 0 && placeholder ? (showCursor ? (_jsxs(Text, { terminalCursorFocus: showCursor, terminalCursorPosition: 0, children: [chalk.inverse(placeholder.slice(0, 1)), _jsx(Text, { color: theme.text.secondary, children: placeholder.slice(1) })] })) : (_jsx(Text, { color: theme.text.secondary, children: placeholder }))) : (linesToRender
|
|
1041
|
+
.map((lineText, visualIdxInRenderedSet) => {
|
|
1042
|
+
const absoluteVisualIdx = scrollVisualRow + visualIdxInRenderedSet;
|
|
1043
|
+
const mapEntry = buffer.visualToLogicalMap[absoluteVisualIdx];
|
|
1044
|
+
if (!mapEntry)
|
|
1045
|
+
return null;
|
|
1046
|
+
const cursorVisualRow = cursorVisualRowAbsolute - scrollVisualRow;
|
|
1047
|
+
const isOnCursorLine = focus && visualIdxInRenderedSet === cursorVisualRow;
|
|
1048
|
+
const renderedLine = [];
|
|
1049
|
+
const [logicalLineIdx] = mapEntry;
|
|
1050
|
+
const logicalLine = buffer.lines[logicalLineIdx] || '';
|
|
1051
|
+
const transformations = buffer.transformationsByLine[logicalLineIdx] ?? [];
|
|
1052
|
+
const tokens = parseInputForHighlighting(logicalLine, logicalLineIdx, transformations, ...(focus && buffer.cursor[0] === logicalLineIdx
|
|
1053
|
+
? [buffer.cursor[1]]
|
|
1054
|
+
: []));
|
|
1055
|
+
const startColInTransformed = buffer.visualToTransformedMap[absoluteVisualIdx] ?? 0;
|
|
1056
|
+
const visualStartCol = startColInTransformed;
|
|
1057
|
+
const visualEndCol = visualStartCol + cpLen(lineText);
|
|
1058
|
+
const segments = parseSegmentsFromTokens(tokens, visualStartCol, visualEndCol);
|
|
1059
|
+
let charCount = 0;
|
|
1060
|
+
segments.forEach((seg, segIdx) => {
|
|
1061
|
+
const segLen = cpLen(seg.text);
|
|
1062
|
+
let display = seg.text;
|
|
1063
|
+
if (isOnCursorLine) {
|
|
1064
|
+
const relativeVisualColForHighlight = cursorVisualColAbsolute;
|
|
1065
|
+
const segStart = charCount;
|
|
1066
|
+
const segEnd = segStart + segLen;
|
|
1067
|
+
if (relativeVisualColForHighlight >= segStart &&
|
|
1068
|
+
relativeVisualColForHighlight < segEnd) {
|
|
1069
|
+
const charToHighlight = cpSlice(display, relativeVisualColForHighlight - segStart, relativeVisualColForHighlight - segStart + 1);
|
|
1070
|
+
const highlighted = showCursor
|
|
1071
|
+
? chalk.inverse(charToHighlight)
|
|
1072
|
+
: charToHighlight;
|
|
1073
|
+
display =
|
|
1074
|
+
cpSlice(display, 0, relativeVisualColForHighlight - segStart) +
|
|
1075
|
+
highlighted +
|
|
1076
|
+
cpSlice(display, relativeVisualColForHighlight - segStart + 1);
|
|
1077
|
+
}
|
|
1078
|
+
charCount = segEnd;
|
|
1079
|
+
}
|
|
1080
|
+
else {
|
|
1081
|
+
// Advance the running counter even when not on cursor line
|
|
1082
|
+
charCount += segLen;
|
|
1083
|
+
}
|
|
1084
|
+
const color = seg.type === 'command' ||
|
|
1085
|
+
seg.type === 'file' ||
|
|
1086
|
+
seg.type === 'paste'
|
|
1087
|
+
? theme.text.accent
|
|
1088
|
+
: theme.text.primary;
|
|
1089
|
+
renderedLine.push(_jsx(Text, { color: color, children: display }, `token-${segIdx}`));
|
|
1090
|
+
});
|
|
1091
|
+
const currentLineGhost = isOnCursorLine ? inlineGhost : '';
|
|
1092
|
+
if (isOnCursorLine &&
|
|
1093
|
+
cursorVisualColAbsolute === cpLen(lineText)) {
|
|
1094
|
+
if (!currentLineGhost) {
|
|
1095
|
+
renderedLine.push(_jsx(Text, { children: showCursor ? chalk.inverse(' ') : ' ' }, `cursor-end-${cursorVisualColAbsolute}`));
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
const showCursorBeforeGhost = focus &&
|
|
1099
|
+
isOnCursorLine &&
|
|
1100
|
+
cursorVisualColAbsolute === cpLen(lineText) &&
|
|
1101
|
+
currentLineGhost;
|
|
1102
|
+
return (_jsx(Box, { height: 1, children: _jsxs(Text, { terminalCursorFocus: showCursor && isOnCursorLine, terminalCursorPosition: cpIndexToOffset(lineText, cursorVisualColAbsolute), children: [renderedLine, showCursorBeforeGhost &&
|
|
1103
|
+
(showCursor ? chalk.inverse(' ') : ' '), currentLineGhost && (_jsx(Text, { color: theme.text.secondary, children: currentLineGhost }))] }) }, `line-${visualIdxInRenderedSet}`));
|
|
1104
|
+
})
|
|
1105
|
+
.concat(additionalLines.map((ghostLine, index) => {
|
|
1106
|
+
const padding = Math.max(0, inputWidth - stringWidth(ghostLine));
|
|
1107
|
+
return (_jsxs(Text, { color: theme.text.secondary, children: [ghostLine, ' '.repeat(padding)] }, `ghost-line-${index}`));
|
|
1108
|
+
}))) })] }) }), useLineFallback ? (_jsx(Box, { borderStyle: "round", borderTop: false, borderBottom: true, borderLeft: false, borderRight: false, borderColor: borderColor, width: terminalWidth, flexDirection: "row", alignItems: "flex-start", height: 0 })) : null, suggestionsPosition === 'below' && suggestionsNode] }));
|
|
875
1109
|
};
|
|
876
|
-
HalfLinePaddedBox >
|
|
877
|
-
{};
|
|
878
|
-
{
|
|
879
|
-
suggestionsPosition === 'below' && suggestionsNode;
|
|
880
|
-
}
|
|
881
|
-
>
|
|
882
|
-
;
|
|
883
|
-
;
|
|
884
|
-
;
|
|
885
1110
|
//# sourceMappingURL=InputPrompt.js.map
|