@iaforged/context-code 1.0.72 → 1.0.74
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/context-bootstrap.js +7 -8
- package/dist/src/QueryEngine.js +928 -0
- package/dist/src/Task.js +49 -0
- package/dist/src/Tool.js +56 -0
- package/dist/src/assistant/AssistantSessionChooser.js +16 -0
- package/dist/src/assistant/index.js +16 -0
- package/dist/src/assistant/sessionDiscovery.js +16 -0
- package/dist/src/assistant/sessionHistory.js +47 -0
- package/dist/src/bootstrap/state.js +1165 -0
- package/dist/src/bridge/bridgeApi.js +304 -0
- package/dist/src/bridge/bridgeConfig.js +39 -0
- package/dist/src/bridge/bridgeDebug.js +73 -0
- package/dist/src/bridge/bridgeEnabled.js +187 -0
- package/dist/src/bridge/bridgeMain.js +2289 -0
- package/dist/src/bridge/bridgeMessaging.js +353 -0
- package/dist/src/bridge/bridgePermissionCallbacks.js +10 -0
- package/dist/src/bridge/bridgePointer.js +175 -0
- package/dist/src/bridge/bridgeStatusUtil.js +105 -0
- package/dist/src/bridge/bridgeUI.js +412 -0
- package/dist/src/bridge/capacityWake.js +35 -0
- package/dist/src/bridge/codeSessionApi.js +111 -0
- package/dist/src/bridge/createSession.js +273 -0
- package/dist/src/bridge/debugUtils.js +115 -0
- package/dist/src/bridge/envLessBridgeConfig.js +121 -0
- package/dist/src/bridge/flushGate.js +65 -0
- package/dist/src/bridge/inboundAttachments.js +152 -0
- package/dist/src/bridge/inboundMessages.js +63 -0
- package/dist/src/bridge/initReplBridge.js +428 -0
- package/dist/src/bridge/jwtUtils.js +185 -0
- package/dist/src/bridge/pollConfig.js +85 -0
- package/dist/src/bridge/pollConfigDefaults.js +62 -0
- package/dist/src/bridge/remoteBridgeCore.js +712 -0
- package/dist/src/bridge/replBridge.js +1720 -0
- package/dist/src/bridge/replBridgeHandle.js +30 -0
- package/dist/src/bridge/replBridgeTransport.js +236 -0
- package/dist/src/bridge/sessionIdCompat.js +56 -0
- package/dist/src/bridge/sessionRunner.js +421 -0
- package/dist/src/bridge/trustedDevice.js +172 -0
- package/dist/src/bridge/types.js +9 -0
- package/dist/src/bridge/workSecret.js +99 -0
- package/dist/src/buddy/CompanionSprite.js +349 -0
- package/dist/src/buddy/companion.js +107 -0
- package/dist/src/buddy/prompt.js +33 -0
- package/dist/src/buddy/sprites.js +488 -0
- package/dist/src/buddy/types.js +90 -0
- package/dist/src/buddy/useBuddyNotification.js +90 -0
- package/dist/src/cli/bg.js +16 -0
- package/dist/src/cli/exit.js +30 -0
- package/dist/src/cli/handlers/agents.js +55 -0
- package/dist/src/cli/handlers/ant.js +16 -0
- package/dist/src/cli/handlers/auth.js +315 -0
- package/dist/src/cli/handlers/autoMode.js +128 -0
- package/dist/src/cli/handlers/mcp.js +334 -0
- package/dist/src/cli/handlers/plugins.js +634 -0
- package/dist/src/cli/handlers/projects_bridge.js +40 -0
- package/dist/src/cli/handlers/provider.js +42 -0
- package/dist/src/cli/handlers/templateJobs.js +16 -0
- package/dist/src/cli/handlers/util.js +76 -0
- package/dist/src/cli/ndjsonSafeStringify.js +27 -0
- package/dist/src/cli/print.js +4225 -0
- package/dist/src/cli/remoteIO.js +208 -0
- package/dist/src/cli/rollback.js +16 -0
- package/dist/src/cli/structuredIO.js +644 -0
- package/dist/src/cli/transports/HybridTransport.js +233 -0
- package/dist/src/cli/transports/SSETransport.js +538 -0
- package/dist/src/cli/transports/SerialBatchEventUploader.js +224 -0
- package/dist/src/cli/transports/Transport.js +1 -0
- package/dist/src/cli/transports/WebSocketTransport.js +613 -0
- package/dist/src/cli/transports/WorkerStateUploader.js +88 -0
- package/dist/src/cli/transports/ccrClient.js +711 -0
- package/dist/src/cli/transports/transportUtils.js +39 -0
- package/dist/src/cli/up.js +16 -0
- package/dist/src/cli/update.js +315 -0
- package/dist/src/commands/add-dir/add-dir.js +121 -0
- package/dist/src/commands/add-dir/index.js +8 -0
- package/dist/src/commands/add-dir/validation.js +76 -0
- package/dist/src/commands/advisor.js +88 -0
- package/dist/src/commands/agent/agent.js +283 -0
- package/dist/src/commands/agent/agentStore.js +120 -0
- package/dist/src/commands/agent/index.js +9 -0
- package/dist/src/commands/agents/agents.js +9 -0
- package/dist/src/commands/agents/index.js +7 -0
- package/dist/src/commands/ant-trace/index.js +1 -0
- package/dist/src/commands/assistant/assistant.js +16 -0
- package/dist/src/commands/autofix-pr/index.js +1 -0
- package/dist/src/commands/backfill-sessions/index.js +1 -0
- package/dist/src/commands/branch/branch.js +205 -0
- package/dist/src/commands/branch/index.js +11 -0
- package/dist/src/commands/break-cache/index.js +1 -0
- package/dist/src/commands/bridge/bridge.js +512 -0
- package/dist/src/commands/bridge/index.js +22 -0
- package/dist/src/commands/bridge-kick.js +179 -0
- package/dist/src/commands/brief.js +94 -0
- package/dist/src/commands/btw/btw.js +234 -0
- package/dist/src/commands/btw/index.js +9 -0
- package/dist/src/commands/bughunter/index.js +1 -0
- package/dist/src/commands/chrome/chrome.js +291 -0
- package/dist/src/commands/chrome/index.js +11 -0
- package/dist/src/commands/clear/caches.js +116 -0
- package/dist/src/commands/clear/clear.js +5 -0
- package/dist/src/commands/clear/conversation.js +191 -0
- package/dist/src/commands/clear/index.js +9 -0
- package/dist/src/commands/color/color.js +58 -0
- package/dist/src/commands/color/index.js +9 -0
- package/dist/src/commands/commit-push-pr.js +137 -0
- package/dist/src/commands/commit.js +80 -0
- package/dist/src/commands/compact/compact.js +196 -0
- package/dist/src/commands/compact/index.js +11 -0
- package/dist/src/commands/config/config.js +5 -0
- package/dist/src/commands/config/index.js +8 -0
- package/dist/src/commands/context/context-noninteractive.js +221 -0
- package/dist/src/commands/context/context.js +46 -0
- package/dist/src/commands/context/index.js +21 -0
- package/dist/src/commands/copy/copy.js +366 -0
- package/dist/src/commands/copy/index.js +7 -0
- package/dist/src/commands/cost/cost.js +21 -0
- package/dist/src/commands/cost/index.js +16 -0
- package/dist/src/commands/createMovedToPluginCommand.js +33 -0
- package/dist/src/commands/ctx_viz/index.js +1 -0
- package/dist/src/commands/debug-tool-call/index.js +1 -0
- package/dist/src/commands/desktop/desktop.js +5 -0
- package/dist/src/commands/desktop/index.js +22 -0
- package/dist/src/commands/diff/diff.js +5 -0
- package/dist/src/commands/diff/index.js +6 -0
- package/dist/src/commands/doctor/doctor.js +5 -0
- package/dist/src/commands/doctor/index.js +9 -0
- package/dist/src/commands/effort/effort.js +166 -0
- package/dist/src/commands/effort/index.js +11 -0
- package/dist/src/commands/env/index.js +1 -0
- package/dist/src/commands/exit/exit.js +31 -0
- package/dist/src/commands/exit/index.js +9 -0
- package/dist/src/commands/export/export.js +86 -0
- package/dist/src/commands/export/index.js +8 -0
- package/dist/src/commands/extra-usage/extra-usage-core.js +99 -0
- package/dist/src/commands/extra-usage/extra-usage-noninteractive.js +13 -0
- package/dist/src/commands/extra-usage/extra-usage.js +14 -0
- package/dist/src/commands/extra-usage/index.js +27 -0
- package/dist/src/commands/fast/fast.js +275 -0
- package/dist/src/commands/fast/index.js +20 -0
- package/dist/src/commands/feedback/feedback.js +10 -0
- package/dist/src/commands/feedback/index.js +21 -0
- package/dist/src/commands/files/files.js +11 -0
- package/dist/src/commands/files/index.js +9 -0
- package/dist/src/commands/good-claude/index.js +1 -0
- package/dist/src/commands/heapdump/heapdump.js +14 -0
- package/dist/src/commands/heapdump/index.js +9 -0
- package/dist/src/commands/help/help.js +5 -0
- package/dist/src/commands/help/index.js +7 -0
- package/dist/src/commands/hooks/hooks.js +11 -0
- package/dist/src/commands/hooks/index.js +8 -0
- package/dist/src/commands/ide/ide.js +615 -0
- package/dist/src/commands/ide/index.js +8 -0
- package/dist/src/commands/init-verifiers.js +258 -0
- package/dist/src/commands/init.js +249 -0
- package/dist/src/commands/insights.js +2555 -0
- package/dist/src/commands/install-github-app/ApiKeyStep.js +230 -0
- package/dist/src/commands/install-github-app/CheckExistingSecretStep.js +194 -0
- package/dist/src/commands/install-github-app/CheckGitHubStep.js +15 -0
- package/dist/src/commands/install-github-app/ChooseRepoStep.js +211 -0
- package/dist/src/commands/install-github-app/CreatingStep.js +52 -0
- package/dist/src/commands/install-github-app/ErrorStep.js +83 -0
- package/dist/src/commands/install-github-app/ExistingWorkflowStep.js +104 -0
- package/dist/src/commands/install-github-app/InstallAppStep.js +96 -0
- package/dist/src/commands/install-github-app/OAuthFlowStep.js +190 -0
- package/dist/src/commands/install-github-app/SuccessStep.js +93 -0
- package/dist/src/commands/install-github-app/WarningsStep.js +70 -0
- package/dist/src/commands/install-github-app/index.js +10 -0
- package/dist/src/commands/install-github-app/install-github-app.js +593 -0
- package/dist/src/commands/install-github-app/setupGitHubActions.js +227 -0
- package/dist/src/commands/install-slack-app/index.js +9 -0
- package/dist/src/commands/install-slack-app/install-slack-app.js +25 -0
- package/dist/src/commands/install.js +118 -0
- package/dist/src/commands/issue/index.js +1 -0
- package/dist/src/commands/keybindings/index.js +10 -0
- package/dist/src/commands/keybindings/keybindings.js +47 -0
- package/dist/src/commands/limites/index.js +8 -0
- package/dist/src/commands/limites/limites.js +214 -0
- package/dist/src/commands/login/index.js +11 -0
- package/dist/src/commands/login/login.js +120 -0
- package/dist/src/commands/login-openai/index.js +7 -0
- package/dist/src/commands/login-openai/login-openai.js +54 -0
- package/dist/src/commands/logout/index.js +8 -0
- package/dist/src/commands/logout/logout.js +72 -0
- package/dist/src/commands/mcp/addCommand.js +183 -0
- package/dist/src/commands/mcp/index.js +9 -0
- package/dist/src/commands/mcp/mcp.js +78 -0
- package/dist/src/commands/mcp/xaaIdpCommand.js +193 -0
- package/dist/src/commands/memory/index.js +7 -0
- package/dist/src/commands/memory/memory.js +71 -0
- package/dist/src/commands/mobile/index.js +9 -0
- package/dist/src/commands/mobile/mobile.js +278 -0
- package/dist/src/commands/mock-limits/index.js +1 -0
- package/dist/src/commands/model/index.js +14 -0
- package/dist/src/commands/model/model.js +297 -0
- package/dist/src/commands/oauth-refresh/index.js +1 -0
- package/dist/src/commands/onboarding/index.js +1 -0
- package/dist/src/commands/orchestrate/index.js +8 -0
- package/dist/src/commands/orchestrate/orchestrate.js +542 -0
- package/dist/src/commands/output-style/index.js +8 -0
- package/dist/src/commands/output-style/output-style.js +6 -0
- package/dist/src/commands/passes/index.js +17 -0
- package/dist/src/commands/passes/passes.js +22 -0
- package/dist/src/commands/perf-issue/index.js +1 -0
- package/dist/src/commands/permissions/index.js +8 -0
- package/dist/src/commands/permissions/permissions.js +8 -0
- package/dist/src/commands/plan/index.js +8 -0
- package/dist/src/commands/plan/plan.js +115 -0
- package/dist/src/commands/plugin/AddMarketplace.js +95 -0
- package/dist/src/commands/plugin/BrowseMarketplace.js +576 -0
- package/dist/src/commands/plugin/DiscoverPlugins.js +613 -0
- package/dist/src/commands/plugin/ManageMarketplaces.js +582 -0
- package/dist/src/commands/plugin/ManagePlugins.js +1783 -0
- package/dist/src/commands/plugin/PluginErrors.js +124 -0
- package/dist/src/commands/plugin/PluginOptionsDialog.js +367 -0
- package/dist/src/commands/plugin/PluginOptionsFlow.js +97 -0
- package/dist/src/commands/plugin/PluginSettings.js +1042 -0
- package/dist/src/commands/plugin/PluginTrustWarning.js +34 -0
- package/dist/src/commands/plugin/UnifiedInstalledCell.js +615 -0
- package/dist/src/commands/plugin/ValidatePlugin.js +95 -0
- package/dist/src/commands/plugin/index.js +10 -0
- package/dist/src/commands/plugin/parseArgs.js +71 -0
- package/dist/src/commands/plugin/plugin.js +5 -0
- package/dist/src/commands/plugin/pluginDetailsHelpers.js +89 -0
- package/dist/src/commands/plugin/usePagination.js +89 -0
- package/dist/src/commands/policy/index.js +9 -0
- package/dist/src/commands/policy/policy.js +84 -0
- package/dist/src/commands/pr_comments/index.js +49 -0
- package/dist/src/commands/privacy-settings/index.js +11 -0
- package/dist/src/commands/privacy-settings/privacy-settings.js +54 -0
- package/dist/src/commands/profile/index.js +9 -0
- package/dist/src/commands/profile/profile.js +482 -0
- package/dist/src/commands/provider/index.js +8 -0
- package/dist/src/commands/provider/provider.js +457 -0
- package/dist/src/commands/rate-limit-options/index.js +15 -0
- package/dist/src/commands/rate-limit-options/rate-limit-options.js +213 -0
- package/dist/src/commands/release-notes/index.js +9 -0
- package/dist/src/commands/release-notes/release-notes.js +38 -0
- package/dist/src/commands/reload-plugins/index.js +11 -0
- package/dist/src/commands/reload-plugins/reload-plugins.js +52 -0
- package/dist/src/commands/remote-env/index.js +12 -0
- package/dist/src/commands/remote-env/remote-env.js +5 -0
- package/dist/src/commands/remote-setup/api.js +155 -0
- package/dist/src/commands/remote-setup/index.js +15 -0
- package/dist/src/commands/remote-setup/remote-setup.js +149 -0
- package/dist/src/commands/rename/generateSessionName.js +58 -0
- package/dist/src/commands/rename/index.js +9 -0
- package/dist/src/commands/rename/rename.js +52 -0
- package/dist/src/commands/reset-limits/index.js +4 -0
- package/dist/src/commands/resume/index.js +9 -0
- package/dist/src/commands/resume/resume.js +239 -0
- package/dist/src/commands/review/UltrareviewOverageDialog.js +97 -0
- package/dist/src/commands/review/reviewRemote.js +259 -0
- package/dist/src/commands/review/ultrareviewCommand.js +57 -0
- package/dist/src/commands/review/ultrareviewEnabled.js +10 -0
- package/dist/src/commands/review.js +50 -0
- package/dist/src/commands/rewind/index.js +10 -0
- package/dist/src/commands/rewind/rewind.js +7 -0
- package/dist/src/commands/run/index.js +9 -0
- package/dist/src/commands/run/run.js +1126 -0
- package/dist/src/commands/sandbox-toggle/index.js +41 -0
- package/dist/src/commands/sandbox-toggle/sandbox-toggle.js +72 -0
- package/dist/src/commands/security-review.js +231 -0
- package/dist/src/commands/session/index.js +13 -0
- package/dist/src/commands/session/session.js +142 -0
- package/dist/src/commands/share/index.js +1 -0
- package/dist/src/commands/skills/index.js +8 -0
- package/dist/src/commands/skills/skills.js +97 -0
- package/dist/src/commands/stats/index.js +7 -0
- package/dist/src/commands/stats/stats.js +5 -0
- package/dist/src/commands/status/index.js +8 -0
- package/dist/src/commands/status/status.js +5 -0
- package/dist/src/commands/statusline.js +22 -0
- package/dist/src/commands/stickers/index.js +9 -0
- package/dist/src/commands/stickers/stickers.js +14 -0
- package/dist/src/commands/summary/index.js +1 -0
- package/dist/src/commands/tag/index.js +9 -0
- package/dist/src/commands/tag/tag.js +215 -0
- package/dist/src/commands/tasks/index.js +8 -0
- package/dist/src/commands/tasks/tasks.js +5 -0
- package/dist/src/commands/team/index.js +9 -0
- package/dist/src/commands/team/team.js +582 -0
- package/dist/src/commands/team-auto/index.js +9 -0
- package/dist/src/commands/team-auto/teamAuto.js +340 -0
- package/dist/src/commands/telegram/index.js +9 -0
- package/dist/src/commands/telegram/telegram.js +118 -0
- package/dist/src/commands/teleport/index.js +1 -0
- package/dist/src/commands/terminalSetup/index.js +18 -0
- package/dist/src/commands/terminalSetup/terminalSetup.js +491 -0
- package/dist/src/commands/theme/index.js +7 -0
- package/dist/src/commands/theme/theme.js +50 -0
- package/dist/src/commands/thinkback/index.js +9 -0
- package/dist/src/commands/thinkback/thinkback.js +527 -0
- package/dist/src/commands/thinkback-play/index.js +13 -0
- package/dist/src/commands/thinkback-play/thinkback-play.js +34 -0
- package/dist/src/commands/ultraplan.js +418 -0
- package/dist/src/commands/upgrade/index.js +12 -0
- package/dist/src/commands/upgrade/upgrade.js +37 -0
- package/dist/src/commands/version.js +18 -0
- package/dist/src/commands/vim/index.js +8 -0
- package/dist/src/commands/vim/vim.js +25 -0
- package/dist/src/commands/voice/index.js +14 -0
- package/dist/src/commands/voice/voice.js +130 -0
- package/dist/src/commands/whatsapp/index.js +9 -0
- package/dist/src/commands/whatsapp/whatsapp.js +326 -0
- package/dist/src/commands/workspace/index.js +9 -0
- package/dist/src/commands/workspace/workspace.js +701 -0
- package/dist/src/commands.js +635 -0
- package/dist/src/components/AgentProgressLine.js +111 -0
- package/dist/src/components/App.js +45 -0
- package/dist/src/components/ApproveApiKey.js +124 -0
- package/dist/src/components/AutoModeOptInDialog.js +140 -0
- package/dist/src/components/AutoUpdater.js +157 -0
- package/dist/src/components/AutoUpdaterWrapper.js +78 -0
- package/dist/src/components/AwsAuthStatusBox.js +88 -0
- package/dist/src/components/BaseTextInput.js +105 -0
- package/dist/src/components/BashModeProgress.js +48 -0
- package/dist/src/components/BridgeDialog.js +414 -0
- package/dist/src/components/BypassPermissionsModeDialog.js +87 -0
- package/dist/src/components/ChannelDowngradeDialog.js +100 -0
- package/dist/src/components/ClaudeCodeHint/PluginHintMenu.js +37 -0
- package/dist/src/components/ClaudeInChromeOnboarding.js +126 -0
- package/dist/src/components/ClaudeMdExternalIncludesDialog.js +137 -0
- package/dist/src/components/ClickableImageRef.js +64 -0
- package/dist/src/components/CompactSummary.js +119 -0
- package/dist/src/components/ConfigurableShortcutHint.js +34 -0
- package/dist/src/components/ConsoleOAuthFlow.js +758 -0
- package/dist/src/components/ContextSuggestions.js +43 -0
- package/dist/src/components/ContextVisualization.js +483 -0
- package/dist/src/components/CoordinatorAgentStatus.js +261 -0
- package/dist/src/components/CostThresholdDialog.js +48 -0
- package/dist/src/components/CtrlOToExpand.js +50 -0
- package/dist/src/components/CustomSelect/SelectMulti.js +149 -0
- package/dist/src/components/CustomSelect/index.js +2 -0
- package/dist/src/components/CustomSelect/option-map.js +32 -0
- package/dist/src/components/CustomSelect/select-input-option.js +426 -0
- package/dist/src/components/CustomSelect/select-option.js +23 -0
- package/dist/src/components/CustomSelect/select.js +518 -0
- package/dist/src/components/CustomSelect/use-multi-select-state.js +214 -0
- package/dist/src/components/CustomSelect/use-select-input.js +170 -0
- package/dist/src/components/CustomSelect/use-select-navigation.js +366 -0
- package/dist/src/components/CustomSelect/use-select-state.js +22 -0
- package/dist/src/components/DesktopHandoff.js +195 -0
- package/dist/src/components/DesktopUpsell/DesktopUpsellStartup.js +173 -0
- package/dist/src/components/DevBar.js +50 -0
- package/dist/src/components/DevChannelsDialog.js +103 -0
- package/dist/src/components/DiagnosticsDisplay.js +91 -0
- package/dist/src/components/EffortCallout.js +264 -0
- package/dist/src/components/EffortIndicator.js +29 -0
- package/dist/src/components/ExitFlow.js +40 -0
- package/dist/src/components/ExportDialog.js +101 -0
- package/dist/src/components/FallbackToolUseErrorMessage.js +115 -0
- package/dist/src/components/FallbackToolUseRejectedMessage.js +16 -0
- package/dist/src/components/FastIcon.js +42 -0
- package/dist/src/components/Feedback.js +439 -0
- package/dist/src/components/FeedbackSurvey/FeedbackSurvey.js +150 -0
- package/dist/src/components/FeedbackSurvey/FeedbackSurveyView.js +103 -0
- package/dist/src/components/FeedbackSurvey/TranscriptSharePrompt.js +83 -0
- package/dist/src/components/FeedbackSurvey/submitTranscriptShare.js +81 -0
- package/dist/src/components/FeedbackSurvey/useDebouncedDigitInput.js +51 -0
- package/dist/src/components/FeedbackSurvey/useFeedbackSurvey.js +258 -0
- package/dist/src/components/FeedbackSurvey/useMemorySurvey.js +191 -0
- package/dist/src/components/FeedbackSurvey/usePostCompactSurvey.js +202 -0
- package/dist/src/components/FeedbackSurvey/useSurveyState.js +80 -0
- package/dist/src/components/FileEditToolDiff.js +166 -0
- package/dist/src/components/FileEditToolUpdatedMessage.js +111 -0
- package/dist/src/components/FileEditToolUseRejectedMessage.js +157 -0
- package/dist/src/components/FilePathLink.js +34 -0
- package/dist/src/components/FullscreenLayout.js +578 -0
- package/dist/src/components/GlobalSearchDialog.js +339 -0
- package/dist/src/components/HelpV2/Commands.js +65 -0
- package/dist/src/components/HelpV2/General.js +24 -0
- package/dist/src/components/HelpV2/HelpV2.js +186 -0
- package/dist/src/components/HighlightedCode/Fallback.js +193 -0
- package/dist/src/components/HighlightedCode.js +184 -0
- package/dist/src/components/HistorySearchDialog.js +92 -0
- package/dist/src/components/IdeAutoConnectDialog.js +153 -0
- package/dist/src/components/IdeOnboardingDialog.js +174 -0
- package/dist/src/components/IdeStatusIndicator.js +49 -0
- package/dist/src/components/IdleReturnDialog.js +116 -0
- package/dist/src/components/InterruptedByUser.js +15 -0
- package/dist/src/components/InvalidConfigDialog.js +134 -0
- package/dist/src/components/InvalidSettingsDialog.js +84 -0
- package/dist/src/components/KeybindingWarnings.js +54 -0
- package/dist/src/components/LanguagePicker.js +84 -0
- package/dist/src/components/LogSelector.js +1579 -0
- package/dist/src/components/LogoV2/AnimatedAsterisk.js +42 -0
- package/dist/src/components/LogoV2/AnimatedClawd.js +111 -0
- package/dist/src/components/LogoV2/ChannelsNotice.js +258 -0
- package/dist/src/components/LogoV2/Clawd.js +12 -0
- package/dist/src/components/LogoV2/CondensedLogo.js +144 -0
- package/dist/src/components/LogoV2/EmergencyTip.js +47 -0
- package/dist/src/components/LogoV2/Feed.js +84 -0
- package/dist/src/components/LogoV2/FeedColumn.js +55 -0
- package/dist/src/components/LogoV2/GuestPassesUpsell.js +71 -0
- package/dist/src/components/LogoV2/LogoV2.js +564 -0
- package/dist/src/components/LogoV2/Opus1mMergeNotice.js +56 -0
- package/dist/src/components/LogoV2/OverageCreditUpsell.js +160 -0
- package/dist/src/components/LogoV2/VoiceModeNotice.js +70 -0
- package/dist/src/components/LogoV2/WelcomeV2.js +8 -0
- package/dist/src/components/LogoV2/feedConfigs.js +78 -0
- package/dist/src/components/LspRecommendation/LspRecommendationMenu.js +46 -0
- package/dist/src/components/MCPServerApprovalDialog.js +113 -0
- package/dist/src/components/MCPServerDesktopImportDialog.js +206 -0
- package/dist/src/components/MCPServerDialogCopy.js +15 -0
- package/dist/src/components/MCPServerMultiselectDialog.js +133 -0
- package/dist/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.js +149 -0
- package/dist/src/components/ManagedSettingsSecurityDialog/utils.js +105 -0
- package/dist/src/components/Markdown.js +217 -0
- package/dist/src/components/MarkdownTable.js +279 -0
- package/dist/src/components/MemoryUsageIndicator.js +27 -0
- package/dist/src/components/Message.js +566 -0
- package/dist/src/components/MessageModel.js +36 -0
- package/dist/src/components/MessageResponse.js +73 -0
- package/dist/src/components/MessageRow.js +346 -0
- package/dist/src/components/MessageSelector.js +743 -0
- package/dist/src/components/MessageTimestamp.js +57 -0
- package/dist/src/components/Messages.js +637 -0
- package/dist/src/components/ModelPicker.js +493 -0
- package/dist/src/components/NativeAutoUpdater.js +153 -0
- package/dist/src/components/NotebookEditToolUseRejectedMessage.js +83 -0
- package/dist/src/components/OffscreenFreeze.js +35 -0
- package/dist/src/components/Onboarding.js +174 -0
- package/dist/src/components/OutputStylePicker.js +102 -0
- package/dist/src/components/PackageManagerAutoUpdater.js +100 -0
- package/dist/src/components/Passes/Passes.js +113 -0
- package/dist/src/components/PrBadge.js +90 -0
- package/dist/src/components/PressEnterToContinue.js +15 -0
- package/dist/src/components/PromptInput/HistorySearchInput.js +44 -0
- package/dist/src/components/PromptInput/IssueFlagBanner.js +8 -0
- package/dist/src/components/PromptInput/Notifications.js +221 -0
- package/dist/src/components/PromptInput/PromptInput.js +1998 -0
- package/dist/src/components/PromptInput/PromptInputFooter.js +84 -0
- package/dist/src/components/PromptInput/PromptInputFooterLeftSide.js +409 -0
- package/dist/src/components/PromptInput/PromptInputFooterSuggestions.js +280 -0
- package/dist/src/components/PromptInput/PromptInputHelpMenu.js +379 -0
- package/dist/src/components/PromptInput/PromptInputModeIndicator.js +72 -0
- package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +105 -0
- package/dist/src/components/PromptInput/PromptInputStashNotice.js +20 -0
- package/dist/src/components/PromptInput/SandboxPromptFooterHint.js +65 -0
- package/dist/src/components/PromptInput/ShimmeredInput.js +132 -0
- package/dist/src/components/PromptInput/VoiceIndicator.js +136 -0
- package/dist/src/components/PromptInput/inputModes.js +24 -0
- package/dist/src/components/PromptInput/inputPaste.js +62 -0
- package/dist/src/components/PromptInput/useMaybeTruncateInput.js +33 -0
- package/dist/src/components/PromptInput/usePromptInputPlaceholder.js +55 -0
- package/dist/src/components/PromptInput/useShowFastIconHint.js +23 -0
- package/dist/src/components/PromptInput/useSwarmBanner.js +112 -0
- package/dist/src/components/PromptInput/utils.js +50 -0
- package/dist/src/components/QuickOpenDialog.js +243 -0
- package/dist/src/components/RemoteCallout.js +53 -0
- package/dist/src/components/RemoteEnvironmentDialog.js +345 -0
- package/dist/src/components/ResumeTask.js +173 -0
- package/dist/src/components/SandboxViolationExpandedView.js +102 -0
- package/dist/src/components/ScrollKeybindingHandler.js +982 -0
- package/dist/src/components/SearchBox.js +55 -0
- package/dist/src/components/SentryErrorBoundary.js +16 -0
- package/dist/src/components/SessionBackgroundHint.js +104 -0
- package/dist/src/components/SessionPreview.js +200 -0
- package/dist/src/components/Settings/Config.js +1628 -0
- package/dist/src/components/Settings/Settings.js +129 -0
- package/dist/src/components/Settings/Status.js +239 -0
- package/dist/src/components/Settings/Usage.js +341 -0
- package/dist/src/components/ShowInIDEPrompt.js +151 -0
- package/dist/src/components/SkillImprovementSurvey.js +130 -0
- package/dist/src/components/Spinner/FlashingChar.js +51 -0
- package/dist/src/components/Spinner/GlimmerMessage.js +328 -0
- package/dist/src/components/Spinner/ShimmerChar.js +22 -0
- package/dist/src/components/Spinner/SpinnerAnimationRow.js +169 -0
- package/dist/src/components/Spinner/SpinnerGlyph.js +69 -0
- package/dist/src/components/Spinner/TeammateSpinnerLine.js +170 -0
- package/dist/src/components/Spinner/TeammateSpinnerTree.js +268 -0
- package/dist/src/components/Spinner/index.js +11 -0
- package/dist/src/components/Spinner/teammateSelectHint.js +1 -0
- package/dist/src/components/Spinner/useShimmerAnimation.js +22 -0
- package/dist/src/components/Spinner/useStalledAnimation.js +63 -0
- package/dist/src/components/Spinner/utils.js +77 -0
- package/dist/src/components/Spinner.js +470 -0
- package/dist/src/components/Stats.js +1000 -0
- package/dist/src/components/StatusLine.js +288 -0
- package/dist/src/components/StatusNotices.js +50 -0
- package/dist/src/components/StructuredDiff/Fallback.js +335 -0
- package/dist/src/components/StructuredDiff/colorDiff.js +26 -0
- package/dist/src/components/StructuredDiff.js +152 -0
- package/dist/src/components/StructuredDiffList.js +8 -0
- package/dist/src/components/TagTabs.js +100 -0
- package/dist/src/components/TaskListV2.js +333 -0
- package/dist/src/components/TeammateViewHeader.js +87 -0
- package/dist/src/components/TeleportError.js +191 -0
- package/dist/src/components/TeleportProgress.js +130 -0
- package/dist/src/components/TeleportRepoMismatchDialog.js +98 -0
- package/dist/src/components/TeleportResumeWrapper.js +158 -0
- package/dist/src/components/TeleportStash.js +82 -0
- package/dist/src/components/TextInput.js +108 -0
- package/dist/src/components/ThemePicker.js +330 -0
- package/dist/src/components/ThinkingToggle.js +153 -0
- package/dist/src/components/TokenWarning.js +172 -0
- package/dist/src/components/ToolUseLoader.js +34 -0
- package/dist/src/components/TrustDialog/TrustDialog.js +113 -0
- package/dist/src/components/TrustDialog/utils.js +199 -0
- package/dist/src/components/ValidationErrorsList.js +146 -0
- package/dist/src/components/VimTextInput.js +136 -0
- package/dist/src/components/VirtualMessageList.js +892 -0
- package/dist/src/components/WorkflowMultiselectDialog.js +118 -0
- package/dist/src/components/WorktreeExitDialog.js +222 -0
- package/dist/src/components/agents/AgentDetail.js +226 -0
- package/dist/src/components/agents/AgentEditor.js +146 -0
- package/dist/src/components/agents/AgentNavigationFooter.js +21 -0
- package/dist/src/components/agents/AgentsList.js +436 -0
- package/dist/src/components/agents/AgentsMenu.js +848 -0
- package/dist/src/components/agents/ColorPicker.js +110 -0
- package/dist/src/components/agents/ModelSelector.js +62 -0
- package/dist/src/components/agents/SnapshotUpdateDialog.js +16 -0
- package/dist/src/components/agents/ToolSelector.js +557 -0
- package/dist/src/components/agents/agentFileUtils.js +187 -0
- package/dist/src/components/agents/generateAgent.js +161 -0
- package/dist/src/components/agents/new-agent-creation/CreateAgentWizard.js +88 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +80 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +386 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +63 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +126 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +118 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +92 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +120 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +79 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +48 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +131 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +51 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +100 -0
- package/dist/src/components/agents/types.js +4 -0
- package/dist/src/components/agents/utils.js +14 -0
- package/dist/src/components/agents/validateAgent.js +79 -0
- package/dist/src/components/design-system/Byline.js +72 -0
- package/dist/src/components/design-system/Dialog.js +116 -0
- package/dist/src/components/design-system/Divider.js +109 -0
- package/dist/src/components/design-system/FuzzyPicker.js +187 -0
- package/dist/src/components/design-system/KeyboardShortcutHint.js +67 -0
- package/dist/src/components/design-system/ListItem.js +183 -0
- package/dist/src/components/design-system/LoadingState.js +68 -0
- package/dist/src/components/design-system/Pane.js +68 -0
- package/dist/src/components/design-system/ProgressBar.js +62 -0
- package/dist/src/components/design-system/Ratchet.js +71 -0
- package/dist/src/components/design-system/StatusIcon.js +69 -0
- package/dist/src/components/design-system/Tabs.js +269 -0
- package/dist/src/components/design-system/ThemeProvider.js +137 -0
- package/dist/src/components/design-system/ThemedBox.js +125 -0
- package/dist/src/components/design-system/ThemedText.js +60 -0
- package/dist/src/components/design-system/color.js +22 -0
- package/dist/src/components/diff/DiffDetailView.js +284 -0
- package/dist/src/components/diff/DiffDialog.js +387 -0
- package/dist/src/components/diff/DiffFileList.js +291 -0
- package/dist/src/components/grove/Grove.js +483 -0
- package/dist/src/components/hooks/HooksConfigMenu.js +570 -0
- package/dist/src/components/hooks/PromptDialog.js +81 -0
- package/dist/src/components/hooks/SelectEventMode.js +117 -0
- package/dist/src/components/hooks/SelectHookMode.js +93 -0
- package/dist/src/components/hooks/SelectMatcherMode.js +124 -0
- package/dist/src/components/hooks/ViewHookMode.js +197 -0
- package/dist/src/components/mcp/CapabilitiesSection.js +55 -0
- package/dist/src/components/mcp/ElicitationDialog.js +945 -0
- package/dist/src/components/mcp/MCPAgentServerMenu.js +95 -0
- package/dist/src/components/mcp/MCPListPanel.js +504 -0
- package/dist/src/components/mcp/MCPReconnect.js +168 -0
- package/dist/src/components/mcp/MCPRemoteServerMenu.js +460 -0
- package/dist/src/components/mcp/MCPSettings.js +414 -0
- package/dist/src/components/mcp/MCPStdioServerMenu.js +95 -0
- package/dist/src/components/mcp/MCPToolDetailView.js +219 -0
- package/dist/src/components/mcp/MCPToolListView.js +136 -0
- package/dist/src/components/mcp/McpParsingWarnings.js +211 -0
- package/dist/src/components/mcp/index.js +8 -0
- package/dist/src/components/mcp/types.js +3 -0
- package/dist/src/components/mcp/utils/reconnectHelpers.js +35 -0
- package/dist/src/components/memory/MemoryFileSelector.js +455 -0
- package/dist/src/components/memory/MemoryUpdateNotification.js +42 -0
- package/dist/src/components/messageActions.js +418 -0
- package/dist/src/components/messages/AdvisorMessage.js +151 -0
- package/dist/src/components/messages/AssistantRedactedThinkingMessage.js +27 -0
- package/dist/src/components/messages/AssistantTextMessage.js +274 -0
- package/dist/src/components/messages/AssistantThinkingMessage.js +69 -0
- package/dist/src/components/messages/AssistantToolUseMessage.js +323 -0
- package/dist/src/components/messages/AttachmentMessage.js +418 -0
- package/dist/src/components/messages/CollapsedReadSearchContent.js +362 -0
- package/dist/src/components/messages/CompactBoundaryMessage.js +18 -0
- package/dist/src/components/messages/GroupedToolUseContent.js +37 -0
- package/dist/src/components/messages/HighlightedThinkingText.js +164 -0
- package/dist/src/components/messages/HookProgressMessage.js +110 -0
- package/dist/src/components/messages/PlanApprovalMessage.js +212 -0
- package/dist/src/components/messages/RateLimitMessage.js +149 -0
- package/dist/src/components/messages/ShutdownMessage.js +123 -0
- package/dist/src/components/messages/SystemAPIErrorMessage.js +135 -0
- package/dist/src/components/messages/SystemTextMessage.js +843 -0
- package/dist/src/components/messages/TaskAssignmentMessage.js +71 -0
- package/dist/src/components/messages/UserAgentNotificationMessage.js +77 -0
- package/dist/src/components/messages/UserBashInputMessage.js +51 -0
- package/dist/src/components/messages/UserBashOutputMessage.js +54 -0
- package/dist/src/components/messages/UserChannelMessage.js +129 -0
- package/dist/src/components/messages/UserCommandMessage.js +106 -0
- package/dist/src/components/messages/UserImageMessage.js +53 -0
- package/dist/src/components/messages/UserLocalCommandOutputMessage.js +169 -0
- package/dist/src/components/messages/UserMemoryInputMessage.js +72 -0
- package/dist/src/components/messages/UserPlanMessage.js +37 -0
- package/dist/src/components/messages/UserPromptMessage.js +63 -0
- package/dist/src/components/messages/UserResourceUpdateMessage.js +101 -0
- package/dist/src/components/messages/UserTeammateMessage.js +156 -0
- package/dist/src/components/messages/UserTextMessage.js +271 -0
- package/dist/src/components/messages/UserToolResultMessage/RejectedPlanMessage.js +27 -0
- package/dist/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.js +16 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +16 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolErrorMessage.js +91 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolRejectMessage.js +73 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolResultMessage.js +83 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +58 -0
- package/dist/src/components/messages/UserToolResultMessage/utils.js +43 -0
- package/dist/src/components/messages/nullRenderingAttachments.js +58 -0
- package/dist/src/components/messages/teamMemCollapsed.js +142 -0
- package/dist/src/components/messages/teamMemSaved.js +17 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +654 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.js +219 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.js +227 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.js +174 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.js +444 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.js +136 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.js +100 -0
- package/dist/src/components/permissions/BashPermissionRequest/BashPermissionRequest.js +404 -0
- package/dist/src/components/permissions/BashPermissionRequest/bashToolUseOptions.js +110 -0
- package/dist/src/components/permissions/ComputerUseApproval/ComputerUseApproval.js +448 -0
- package/dist/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.js +125 -0
- package/dist/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js +649 -0
- package/dist/src/components/permissions/FallbackPermissionRequest.js +348 -0
- package/dist/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +184 -0
- package/dist/src/components/permissions/FilePermissionDialog/FilePermissionDialog.js +108 -0
- package/dist/src/components/permissions/FilePermissionDialog/ideDiffConfig.js +13 -0
- package/dist/src/components/permissions/FilePermissionDialog/permissionOptions.js +136 -0
- package/dist/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.js +131 -0
- package/dist/src/components/permissions/FilePermissionDialog/usePermissionHandler.js +86 -0
- package/dist/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +163 -0
- package/dist/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +78 -0
- package/dist/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +112 -0
- package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.js +163 -0
- package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.js +217 -0
- package/dist/src/components/permissions/PermissionDecisionDebugInfo.js +466 -0
- package/dist/src/components/permissions/PermissionDialog.js +54 -0
- package/dist/src/components/permissions/PermissionExplanation.js +269 -0
- package/dist/src/components/permissions/PermissionPrompt.js +316 -0
- package/dist/src/components/permissions/PermissionRequest.js +160 -0
- package/dist/src/components/permissions/PermissionRequestTitle.js +57 -0
- package/dist/src/components/permissions/PermissionRuleExplanation.js +116 -0
- package/dist/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.js +178 -0
- package/dist/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.js +73 -0
- package/dist/src/components/permissions/SandboxPermissionRequest.js +161 -0
- package/dist/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.js +228 -0
- package/dist/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.js +384 -0
- package/dist/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.js +258 -0
- package/dist/src/components/permissions/WorkerBadge.js +43 -0
- package/dist/src/components/permissions/WorkerPendingPermission.js +106 -0
- package/dist/src/components/permissions/hooks.js +163 -0
- package/dist/src/components/permissions/rules/AddPermissionRules.js +172 -0
- package/dist/src/components/permissions/rules/AddWorkspaceDirectory.js +334 -0
- package/dist/src/components/permissions/rules/PermissionRuleDescription.js +77 -0
- package/dist/src/components/permissions/rules/PermissionRuleInput.js +135 -0
- package/dist/src/components/permissions/rules/PermissionRuleList.js +1189 -0
- package/dist/src/components/permissions/rules/RecentDenialsTab.js +204 -0
- package/dist/src/components/permissions/rules/RemoveWorkspaceDirectory.js +102 -0
- package/dist/src/components/permissions/rules/WorkspaceTab.js +132 -0
- package/dist/src/components/permissions/shellPermissionHelpers.js +111 -0
- package/dist/src/components/permissions/useShellPermissionFeedback.js +108 -0
- package/dist/src/components/permissions/utils.js +14 -0
- package/dist/src/components/sandbox/SandboxConfigTab.js +47 -0
- package/dist/src/components/sandbox/SandboxDependenciesTab.js +122 -0
- package/dist/src/components/sandbox/SandboxDoctorSection.js +46 -0
- package/dist/src/components/sandbox/SandboxOverridesTab.js +192 -0
- package/dist/src/components/sandbox/SandboxSettings.js +296 -0
- package/dist/src/components/shell/ExpandShellOutputContext.js +33 -0
- package/dist/src/components/shell/OutputLine.js +110 -0
- package/dist/src/components/shell/ShellProgressMessage.js +143 -0
- package/dist/src/components/shell/ShellTimeDisplay.js +71 -0
- package/dist/src/components/skills/SkillsMenu.js +238 -0
- package/dist/src/components/tasks/AsyncAgentDetailDialog.js +234 -0
- package/dist/src/components/tasks/BackgroundTask.js +363 -0
- package/dist/src/components/tasks/BackgroundTaskStatus.js +419 -0
- package/dist/src/components/tasks/BackgroundTasksDialog.js +496 -0
- package/dist/src/components/tasks/DreamDetailDialog.js +250 -0
- package/dist/src/components/tasks/InProcessTeammateDetailDialog.js +274 -0
- package/dist/src/components/tasks/RemoteSessionDetailDialog.js +868 -0
- package/dist/src/components/tasks/RemoteSessionProgress.js +249 -0
- package/dist/src/components/tasks/ShellDetailDialog.js +403 -0
- package/dist/src/components/tasks/ShellProgress.js +76 -0
- package/dist/src/components/tasks/renderToolActivity.js +28 -0
- package/dist/src/components/tasks/taskStatusUtils.js +94 -0
- package/dist/src/components/teams/TeamStatus.js +76 -0
- package/dist/src/components/teams/TeamsDialog.js +672 -0
- package/dist/src/components/ui/ContextCard.js +5 -0
- package/dist/src/components/ui/OrderedList.js +66 -0
- package/dist/src/components/ui/OrderedListItem.js +41 -0
- package/dist/src/components/ui/TreeSelect.js +300 -0
- package/dist/src/components/wizard/WizardDialogLayout.js +47 -0
- package/dist/src/components/wizard/WizardNavigationFooter.js +10 -0
- package/dist/src/components/wizard/WizardProvider.js +217 -0
- package/dist/src/components/wizard/index.js +4 -0
- package/dist/src/components/wizard/useWizard.js +9 -0
- package/dist/src/constants/apiLimits.js +81 -0
- package/dist/src/constants/betas.js +45 -0
- package/dist/src/constants/common.js +29 -0
- package/dist/src/constants/cyberRiskInstruction.js +24 -0
- package/dist/src/constants/errorIds.js +14 -0
- package/dist/src/constants/figures.js +38 -0
- package/dist/src/constants/files.js +150 -0
- package/dist/src/constants/github-app.js +139 -0
- package/dist/src/constants/keys.js +10 -0
- package/dist/src/constants/messages.js +1 -0
- package/dist/src/constants/oauth.js +221 -0
- package/dist/src/constants/outputStyles.js +162 -0
- package/dist/src/constants/product.js +56 -0
- package/dist/src/constants/prompts.js +752 -0
- package/dist/src/constants/spinnerVerbs.js +202 -0
- package/dist/src/constants/system.js +77 -0
- package/dist/src/constants/systemPromptSections.js +39 -0
- package/dist/src/constants/toolLimits.js +50 -0
- package/dist/src/constants/tools.js +103 -0
- package/dist/src/constants/turnCompletionVerbs.js +12 -0
- package/dist/src/constants/xml.js +73 -0
- package/dist/src/context/QueuedMessageContext.js +51 -0
- package/dist/src/context/fpsMetrics.js +22 -0
- package/dist/src/context/mailbox.js +35 -0
- package/dist/src/context/modalContext.js +34 -0
- package/dist/src/context/notifications.js +199 -0
- package/dist/src/context/overlayContext.js +149 -0
- package/dist/src/context/promptOverlayContext.js +118 -0
- package/dist/src/context/stats.js +207 -0
- package/dist/src/context/voice.js +74 -0
- package/dist/src/context.js +146 -0
- package/dist/src/coordinator/coordinatorMode.js +349 -0
- package/dist/src/cost-tracker.js +208 -0
- package/dist/src/costHook.js +17 -0
- package/dist/src/daemon/main.js +16 -0
- package/dist/src/daemon/workerRegistry.js +16 -0
- package/dist/src/dialogLaunchers.js +68 -0
- package/dist/src/entrypoints/agentSdkTypes.js +202 -0
- package/dist/src/entrypoints/cli.js +252 -0
- package/dist/src/entrypoints/init.js +265 -0
- package/dist/src/entrypoints/mcp.js +142 -0
- package/dist/src/entrypoints/sandboxTypes.js +112 -0
- package/dist/src/entrypoints/sdk/controlSchemas.js +452 -0
- package/dist/src/entrypoints/sdk/controlTypes.js +1 -0
- package/dist/src/entrypoints/sdk/coreSchemas.js +1331 -0
- package/dist/src/entrypoints/sdk/coreTypes.generated.js +1 -0
- package/dist/src/entrypoints/sdk/coreTypes.js +49 -0
- package/dist/src/entrypoints/sdk/runtimeTypes.js +1 -0
- package/dist/src/entrypoints/sdk/toolTypes.js +1 -0
- package/dist/src/environment-runner/main.js +16 -0
- package/dist/src/history.js +386 -0
- package/dist/src/hooks/fileSuggestions.js +635 -0
- package/dist/src/hooks/notifs/useAutoModeUnavailableNotification.js +47 -0
- package/dist/src/hooks/notifs/useCanSwitchToExistingSubscription.js +57 -0
- package/dist/src/hooks/notifs/useDeprecationWarningNotification.js +43 -0
- package/dist/src/hooks/notifs/useFastModeNotification.js +164 -0
- package/dist/src/hooks/notifs/useIDEStatusIndicator.js +174 -0
- package/dist/src/hooks/notifs/useInstallMessages.js +27 -0
- package/dist/src/hooks/notifs/useLspInitializationNotification.js +144 -0
- package/dist/src/hooks/notifs/useMcpConnectivityStatus.js +80 -0
- package/dist/src/hooks/notifs/useModelMigrationNotifications.js +53 -0
- package/dist/src/hooks/notifs/useNpmDeprecationNotification.js +24 -0
- package/dist/src/hooks/notifs/usePluginAutoupdateNotification.js +82 -0
- package/dist/src/hooks/notifs/usePluginInstallationStatus.js +127 -0
- package/dist/src/hooks/notifs/useRateLimitWarningNotification.js +118 -0
- package/dist/src/hooks/notifs/useSettingsErrors.js +64 -0
- package/dist/src/hooks/notifs/useStartupNotification.js +33 -0
- package/dist/src/hooks/notifs/useTeammateShutdownNotification.js +64 -0
- package/dist/src/hooks/renderPlaceholder.js +26 -0
- package/dist/src/hooks/toolPermission/PermissionContext.js +211 -0
- package/dist/src/hooks/toolPermission/handlers/coordinatorHandler.js +44 -0
- package/dist/src/hooks/toolPermission/handlers/interactiveHandler.js +397 -0
- package/dist/src/hooks/toolPermission/handlers/swarmWorkerHandler.js +108 -0
- package/dist/src/hooks/toolPermission/permissionLogging.js +145 -0
- package/dist/src/hooks/unifiedSuggestions.js +130 -0
- package/dist/src/hooks/useAfterFirstRender.js +12 -0
- package/dist/src/hooks/useApiKeyVerification.js +63 -0
- package/dist/src/hooks/useArrowKeyHistory.js +203 -0
- package/dist/src/hooks/useAssistantHistory.js +194 -0
- package/dist/src/hooks/useAwaySummary.js +105 -0
- package/dist/src/hooks/useBackgroundTaskNavigation.js +204 -0
- package/dist/src/hooks/useBlink.js +28 -0
- package/dist/src/hooks/useCanUseTool.js +192 -0
- package/dist/src/hooks/useCancelRequest.js +195 -0
- package/dist/src/hooks/useChromeExtensionNotification.js +49 -0
- package/dist/src/hooks/useClaudeCodeHintRecommendation.js +117 -0
- package/dist/src/hooks/useClipboardImageHint.js +59 -0
- package/dist/src/hooks/useCommandKeybindings.js +87 -0
- package/dist/src/hooks/useCommandQueue.js +10 -0
- package/dist/src/hooks/useCopyOnSelect.js +88 -0
- package/dist/src/hooks/useDeferredHookMessages.js +43 -0
- package/dist/src/hooks/useDiffData.js +69 -0
- package/dist/src/hooks/useDiffInIDE.js +252 -0
- package/dist/src/hooks/useDirectConnect.js +150 -0
- package/dist/src/hooks/useDoublePress.js +44 -0
- package/dist/src/hooks/useDynamicConfig.js +17 -0
- package/dist/src/hooks/useElapsedTime.js +25 -0
- package/dist/src/hooks/useExitOnCtrlCD.js +57 -0
- package/dist/src/hooks/useExitOnCtrlCDWithKeybindings.js +17 -0
- package/dist/src/hooks/useFileHistorySnapshotInit.js +14 -0
- package/dist/src/hooks/useGlobalKeybindings.js +215 -0
- package/dist/src/hooks/useHistorySearch.js +241 -0
- package/dist/src/hooks/useIDEIntegration.js +56 -0
- package/dist/src/hooks/useIdeAtMentioned.js +51 -0
- package/dist/src/hooks/useIdeConnectionStatus.js +21 -0
- package/dist/src/hooks/useIdeLogging.js +29 -0
- package/dist/src/hooks/useIdeSelection.js +106 -0
- package/dist/src/hooks/useInboxPoller.js +709 -0
- package/dist/src/hooks/useInputBuffer.js +73 -0
- package/dist/src/hooks/useIssueFlagBanner.js +115 -0
- package/dist/src/hooks/useLogMessages.js +98 -0
- package/dist/src/hooks/useLspPluginRecommendation.js +176 -0
- package/dist/src/hooks/useMailboxBridge.js +15 -0
- package/dist/src/hooks/useMainLoopModel.js +25 -0
- package/dist/src/hooks/useManagePlugins.js +261 -0
- package/dist/src/hooks/useMemoryUsage.js +28 -0
- package/dist/src/hooks/useMergedClients.js +11 -0
- package/dist/src/hooks/useMergedCommands.js +10 -0
- package/dist/src/hooks/useMergedTools.js +32 -0
- package/dist/src/hooks/useMinDisplayTime.js +26 -0
- package/dist/src/hooks/useNotifyAfterTimeout.js +51 -0
- package/dist/src/hooks/useOfficialMarketplaceNotification.js +46 -0
- package/dist/src/hooks/usePasteHandler.js +188 -0
- package/dist/src/hooks/usePluginRecommendationBase.js +101 -0
- package/dist/src/hooks/usePrStatus.js +91 -0
- package/dist/src/hooks/usePromptSuggestion.js +128 -0
- package/dist/src/hooks/usePromptsFromClaudeInChrome.js +66 -0
- package/dist/src/hooks/useQueueProcessor.js +46 -0
- package/dist/src/hooks/useRemoteSession.js +431 -0
- package/dist/src/hooks/useReplBridge.js +717 -0
- package/dist/src/hooks/useSSHSession.js +167 -0
- package/dist/src/hooks/useScheduledTasks.js +104 -0
- package/dist/src/hooks/useSearchInput.js +302 -0
- package/dist/src/hooks/useSessionBackgrounding.js +132 -0
- package/dist/src/hooks/useSettings.js +10 -0
- package/dist/src/hooks/useSettingsChange.js +13 -0
- package/dist/src/hooks/useSkillImprovementSurvey.js +69 -0
- package/dist/src/hooks/useSkillsChange.js +51 -0
- package/dist/src/hooks/useSwarmInitialization.js +67 -0
- package/dist/src/hooks/useSwarmPermissionPoller.js +215 -0
- package/dist/src/hooks/useTaskListWatcher.js +157 -0
- package/dist/src/hooks/useTasksV2.js +220 -0
- package/dist/src/hooks/useTeammateViewAutoExit.js +55 -0
- package/dist/src/hooks/useTelegramMirror.js +47 -0
- package/dist/src/hooks/useTeleportResume.js +81 -0
- package/dist/src/hooks/useTerminalSize.js +9 -0
- package/dist/src/hooks/useTextInput.js +397 -0
- package/dist/src/hooks/useTimeout.js +10 -0
- package/dist/src/hooks/useTurnDiffs.js +160 -0
- package/dist/src/hooks/useTypeahead.js +1617 -0
- package/dist/src/hooks/useUpdateNotification.js +22 -0
- package/dist/src/hooks/useVimInput.js +232 -0
- package/dist/src/hooks/useVirtualScroll.js +627 -0
- package/dist/src/hooks/useVoice.js +954 -0
- package/dist/src/hooks/useVoiceEnabled.js +21 -0
- package/dist/src/hooks/useVoiceIntegration.js +631 -0
- package/dist/src/hooks/useWhatsAppMirror.js +46 -0
- package/dist/src/index.js +18 -0
- package/dist/src/ink/Ansi.js +269 -0
- package/dist/src/ink/bidi.js +117 -0
- package/dist/src/ink/clearTerminal.js +58 -0
- package/dist/src/ink/colorize.js +198 -0
- package/dist/src/ink/components/AlternateScreen.js +74 -0
- package/dist/src/ink/components/App.js +558 -0
- package/dist/src/ink/components/AppContext.js +11 -0
- package/dist/src/ink/components/Box.js +153 -0
- package/dist/src/ink/components/Button.js +166 -0
- package/dist/src/ink/components/ClockContext.js +108 -0
- package/dist/src/ink/components/CursorDeclarationContext.js +3 -0
- package/dist/src/ink/components/ErrorOverview.js +49 -0
- package/dist/src/ink/components/Link.js +33 -0
- package/dist/src/ink/components/Newline.js +29 -0
- package/dist/src/ink/components/NoSelect.js +56 -0
- package/dist/src/ink/components/RawAnsi.js +45 -0
- package/dist/src/ink/components/ScrollBox.js +170 -0
- package/dist/src/ink/components/Spacer.js +19 -0
- package/dist/src/ink/components/StdinContext.js +16 -0
- package/dist/src/ink/components/TerminalFocusContext.js +45 -0
- package/dist/src/ink/components/TerminalSizeContext.js +3 -0
- package/dist/src/ink/components/Text.js +194 -0
- package/dist/src/ink/constants.js +2 -0
- package/dist/src/ink/devtools.js +16 -0
- package/dist/src/ink/dom.js +298 -0
- package/dist/src/ink/events/click-event.js +36 -0
- package/dist/src/ink/events/dispatcher.js +172 -0
- package/dist/src/ink/events/emitter.js +31 -0
- package/dist/src/ink/events/event-handlers.js +30 -0
- package/dist/src/ink/events/event.js +9 -0
- package/dist/src/ink/events/focus-event.js +16 -0
- package/dist/src/ink/events/input-event.js +161 -0
- package/dist/src/ink/events/keyboard-event.js +45 -0
- package/dist/src/ink/events/terminal-event.js +78 -0
- package/dist/src/ink/events/terminal-focus-event.js +15 -0
- package/dist/src/ink/focus.js +158 -0
- package/dist/src/ink/frame.js +30 -0
- package/dist/src/ink/get-max-width.js +23 -0
- package/dist/src/ink/hit-test.js +113 -0
- package/dist/src/ink/hooks/use-animation-frame.js +48 -0
- package/dist/src/ink/hooks/use-app.js +7 -0
- package/dist/src/ink/hooks/use-declared-cursor.js +60 -0
- package/dist/src/ink/hooks/use-input.js +70 -0
- package/dist/src/ink/hooks/use-interval.js +54 -0
- package/dist/src/ink/hooks/use-search-highlight.js +32 -0
- package/dist/src/ink/hooks/use-selection.js +60 -0
- package/dist/src/ink/hooks/use-stdin.js +7 -0
- package/dist/src/ink/hooks/use-tab-status.js +57 -0
- package/dist/src/ink/hooks/use-terminal-focus.js +15 -0
- package/dist/src/ink/hooks/use-terminal-title.js +29 -0
- package/dist/src/ink/hooks/use-terminal-viewport.js +77 -0
- package/dist/src/ink/ink.js +1644 -0
- package/dist/src/ink/instances.js +7 -0
- package/dist/src/ink/layout/engine.js +4 -0
- package/dist/src/ink/layout/geometry.js +61 -0
- package/dist/src/ink/layout/node.js +62 -0
- package/dist/src/ink/layout/yoga.js +237 -0
- package/dist/src/ink/line-width-cache.js +19 -0
- package/dist/src/ink/log-update.js +583 -0
- package/dist/src/ink/measure-element.js +8 -0
- package/dist/src/ink/measure-text.js +35 -0
- package/dist/src/ink/node-cache.js +30 -0
- package/dist/src/ink/optimizer.js +81 -0
- package/dist/src/ink/output.js +556 -0
- package/dist/src/ink/parse-keypress.js +695 -0
- package/dist/src/ink/reconciler.js +384 -0
- package/dist/src/ink/render-border.js +134 -0
- package/dist/src/ink/render-node-to-output.js +1216 -0
- package/dist/src/ink/render-to-screen.js +171 -0
- package/dist/src/ink/renderer.js +129 -0
- package/dist/src/ink/root.js +80 -0
- package/dist/src/ink/screen.js +1132 -0
- package/dist/src/ink/searchHighlight.js +78 -0
- package/dist/src/ink/selection.js +792 -0
- package/dist/src/ink/squash-text-nodes.js +56 -0
- package/dist/src/ink/stringWidth.js +200 -0
- package/dist/src/ink/styles.js +299 -0
- package/dist/src/ink/supports-hyperlinks.js +40 -0
- package/dist/src/ink/tabstops.js +39 -0
- package/dist/src/ink/terminal-focus-state.js +35 -0
- package/dist/src/ink/terminal-querier.js +173 -0
- package/dist/src/ink/terminal.js +208 -0
- package/dist/src/ink/termio/ansi.js +70 -0
- package/dist/src/ink/termio/csi.js +260 -0
- package/dist/src/ink/termio/dec.js +53 -0
- package/dist/src/ink/termio/esc.js +55 -0
- package/dist/src/ink/termio/osc.js +432 -0
- package/dist/src/ink/termio/parser.js +356 -0
- package/dist/src/ink/termio/sgr.js +292 -0
- package/dist/src/ink/termio/tokenize.js +264 -0
- package/dist/src/ink/termio/types.js +55 -0
- package/dist/src/ink/termio.js +24 -0
- package/dist/src/ink/useTerminalNotification.js +57 -0
- package/dist/src/ink/warn.js +10 -0
- package/dist/src/ink/widest-line.js +14 -0
- package/dist/src/ink/wrap-text.js +54 -0
- package/dist/src/ink/wrapAnsi.js +6 -0
- package/dist/src/ink.js +50 -0
- package/dist/src/interactiveHelpers.js +317 -0
- package/dist/src/keybindings/KeybindingContext.js +184 -0
- package/dist/src/keybindings/KeybindingProviderSetup.js +259 -0
- package/dist/src/keybindings/defaultBindings.js +333 -0
- package/dist/src/keybindings/loadUserBindings.js +393 -0
- package/dist/src/keybindings/match.js +111 -0
- package/dist/src/keybindings/parser.js +184 -0
- package/dist/src/keybindings/reservedShortcuts.js +109 -0
- package/dist/src/keybindings/resolver.js +182 -0
- package/dist/src/keybindings/schema.js +205 -0
- package/dist/src/keybindings/shortcutFormat.js +48 -0
- package/dist/src/keybindings/template.js +40 -0
- package/dist/src/keybindings/useKeybinding.js +161 -0
- package/dist/src/keybindings/useShortcutDisplay.js +43 -0
- package/dist/src/keybindings/validate.js +395 -0
- package/dist/src/main.js +4080 -0
- package/dist/src/memdir/findRelevantMemories.js +101 -0
- package/dist/src/memdir/memdir.js +408 -0
- package/dist/src/memdir/memoryAge.js +52 -0
- package/dist/src/memdir/memoryScan.js +65 -0
- package/dist/src/memdir/memoryTypes.js +260 -0
- package/dist/src/memdir/paths.js +236 -0
- package/dist/src/memdir/teamMemPaths.js +261 -0
- package/dist/src/memdir/teamMemPrompts.js +82 -0
- package/dist/src/migrations/migrateAutoUpdatesToSettings.js +47 -0
- package/dist/src/migrations/migrateBypassPermissionsAcceptedToSettings.js +32 -0
- package/dist/src/migrations/migrateEnableAllProjectMcpServersToSettings.js +83 -0
- package/dist/src/migrations/migrateFennecToOpus.js +39 -0
- package/dist/src/migrations/migrateLegacyOpusToCurrent.js +44 -0
- package/dist/src/migrations/migrateOpusToOpus1m.js +31 -0
- package/dist/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js +23 -0
- package/dist/src/migrations/migrateSonnet1mToSonnet45.js +38 -0
- package/dist/src/migrations/migrateSonnet45ToSonnet46.js +48 -0
- package/dist/src/migrations/resetAutoModeOptInForDefaultOffer.js +47 -0
- package/dist/src/migrations/resetProToOpusDefault.js +46 -0
- package/dist/src/mirrors/shared.js +186 -0
- package/dist/src/moreright/useMoreRight.js +13 -0
- package/dist/src/native-ts/color-diff/index.js +821 -0
- package/dist/src/native-ts/file-index/index.js +328 -0
- package/dist/src/native-ts/yoga-layout/enums.js +101 -0
- package/dist/src/native-ts/yoga-layout/index.js +2113 -0
- package/dist/src/outputStyles/loadOutputStylesDir.js +73 -0
- package/dist/src/plugins/builtinPlugins.js +132 -0
- package/dist/src/plugins/bundled/index.js +22 -0
- package/dist/src/projectOnboardingState.js +61 -0
- package/dist/src/query/config.js +17 -0
- package/dist/src/query/deps.js +12 -0
- package/dist/src/query/stopHooks.js +334 -0
- package/dist/src/query/tokenBudget.js +49 -0
- package/dist/src/query.js +1330 -0
- package/dist/src/recovery/bunBundleShim.js +11 -0
- package/dist/src/remote/RemoteSessionManager.js +195 -0
- package/dist/src/remote/SessionsWebSocket.js +305 -0
- package/dist/src/remote/remotePermissionBridge.js +70 -0
- package/dist/src/remote/sdkMessageAdapter.js +227 -0
- package/dist/src/replLauncher.js +6 -0
- package/dist/src/schemas/hooks.js +174 -0
- package/dist/src/screens/Doctor.js +581 -0
- package/dist/src/screens/REPL.js +4434 -0
- package/dist/src/screens/ResumeConversation.js +341 -0
- package/dist/src/self-hosted-runner/main.js +16 -0
- package/dist/src/server/backends/dangerousBackend.js +16 -0
- package/dist/src/server/connectHeadless.js +16 -0
- package/dist/src/server/createDirectConnectSession.js +62 -0
- package/dist/src/server/directConnectManager.js +153 -0
- package/dist/src/server/lockfile.js +16 -0
- package/dist/src/server/parseConnectUrl.js +16 -0
- package/dist/src/server/server.js +16 -0
- package/dist/src/server/serverBanner.js +16 -0
- package/dist/src/server/serverLog.js +16 -0
- package/dist/src/server/sessionManager.js +16 -0
- package/dist/src/server/types.js +7 -0
- package/dist/src/services/AgentSummary/agentSummary.js +147 -0
- package/dist/src/services/MagicDocs/magicDocs.js +193 -0
- package/dist/src/services/MagicDocs/prompts.js +110 -0
- package/dist/src/services/PromptSuggestion/promptSuggestion.js +402 -0
- package/dist/src/services/PromptSuggestion/speculation.js +643 -0
- package/dist/src/services/SessionMemory/prompts.js +254 -0
- package/dist/src/services/SessionMemory/sessionMemory.js +358 -0
- package/dist/src/services/SessionMemory/sessionMemoryUtils.js +157 -0
- package/dist/src/services/analytics/config.js +33 -0
- package/dist/src/services/analytics/datadog.js +259 -0
- package/dist/src/services/analytics/firstPartyEventLogger.js +342 -0
- package/dist/src/services/analytics/firstPartyEventLoggingExporter.js +594 -0
- package/dist/src/services/analytics/growthbook.js +952 -0
- package/dist/src/services/analytics/index.js +114 -0
- package/dist/src/services/analytics/metadata.js +698 -0
- package/dist/src/services/analytics/sink.js +95 -0
- package/dist/src/services/analytics/sinkKillswitch.js +19 -0
- package/dist/src/services/api/adminRequests.js +57 -0
- package/dist/src/services/api/bootstrap.js +149 -0
- package/dist/src/services/api/claude.js +2461 -0
- package/dist/src/services/api/client.js +325 -0
- package/dist/src/services/api/dumpPrompts.js +174 -0
- package/dist/src/services/api/emptyUsage.js +20 -0
- package/dist/src/services/api/errorUtils.js +203 -0
- package/dist/src/services/api/errors.js +934 -0
- package/dist/src/services/api/filesApi.js +523 -0
- package/dist/src/services/api/firstTokenDate.js +49 -0
- package/dist/src/services/api/grove.js +272 -0
- package/dist/src/services/api/index.js +23 -0
- package/dist/src/services/api/logging.js +484 -0
- package/dist/src/services/api/metricsOptOut.js +129 -0
- package/dist/src/services/api/openai.js +1187 -0
- package/dist/src/services/api/openrouter.js +30 -0
- package/dist/src/services/api/overageCreditGrant.js +123 -0
- package/dist/src/services/api/promptCacheBreakDetection.js +510 -0
- package/dist/src/services/api/referral.js +219 -0
- package/dist/src/services/api/sessionIngress.js +358 -0
- package/dist/src/services/api/ultrareviewQuota.js +29 -0
- package/dist/src/services/api/usage.js +31 -0
- package/dist/src/services/api/withRetry.js +599 -0
- package/dist/src/services/autoDream/autoDream.js +244 -0
- package/dist/src/services/autoDream/config.js +17 -0
- package/dist/src/services/autoDream/consolidationLock.js +122 -0
- package/dist/src/services/autoDream/consolidationPrompt.js +56 -0
- package/dist/src/services/awaySummary.js +61 -0
- package/dist/src/services/claudeAiLimits.js +331 -0
- package/dist/src/services/claudeAiLimitsHook.js +15 -0
- package/dist/src/services/compact/apiMicrocompact.js +97 -0
- package/dist/src/services/compact/autoCompact.js +236 -0
- package/dist/src/services/compact/cachedMicrocompact.js +16 -0
- package/dist/src/services/compact/compact.js +1258 -0
- package/dist/src/services/compact/compactWarningHook.js +12 -0
- package/dist/src/services/compact/compactWarningState.js +15 -0
- package/dist/src/services/compact/grouping.js +58 -0
- package/dist/src/services/compact/microCompact.js +414 -0
- package/dist/src/services/compact/postCompactCleanup.js +72 -0
- package/dist/src/services/compact/prompt.js +327 -0
- package/dist/src/services/compact/sessionMemoryCompact.js +467 -0
- package/dist/src/services/compact/timeBasedMCConfig.js +11 -0
- package/dist/src/services/diagnosticTracking.js +282 -0
- package/dist/src/services/extractMemories/extractMemories.js +444 -0
- package/dist/src/services/extractMemories/prompts.js +129 -0
- package/dist/src/services/internalLogging.js +68 -0
- package/dist/src/services/limits/adapters/claude.js +219 -0
- package/dist/src/services/limits/adapters/minimax.js +177 -0
- package/dist/src/services/limits/adapters/ollama.js +189 -0
- package/dist/src/services/limits/adapters/openai.js +167 -0
- package/dist/src/services/limits/adapters/openrouter.js +166 -0
- package/dist/src/services/limits/adapters/zai.js +154 -0
- package/dist/src/services/limits/index.js +2 -0
- package/dist/src/services/limits/registry.js +179 -0
- package/dist/src/services/limits/sessionCounter.js +168 -0
- package/dist/src/services/limits/types.js +1 -0
- package/dist/src/services/lsp/LSPClient.js +306 -0
- package/dist/src/services/lsp/LSPDiagnosticRegistry.js +277 -0
- package/dist/src/services/lsp/LSPServerInstance.js +390 -0
- package/dist/src/services/lsp/LSPServerManager.js +305 -0
- package/dist/src/services/lsp/config.js +57 -0
- package/dist/src/services/lsp/manager.js +246 -0
- package/dist/src/services/lsp/passiveFeedback.js +226 -0
- package/dist/src/services/mcp/InProcessTransport.js +54 -0
- package/dist/src/services/mcp/MCPConnectionManager.js +50 -0
- package/dist/src/services/mcp/SdkControlTransport.js +115 -0
- package/dist/src/services/mcp/auth.js +1882 -0
- package/dist/src/services/mcp/channelAllowlist.js +57 -0
- package/dist/src/services/mcp/channelNotification.js +236 -0
- package/dist/src/services/mcp/channelPermissions.js +192 -0
- package/dist/src/services/mcp/claudeai.js +123 -0
- package/dist/src/services/mcp/client.js +2480 -0
- package/dist/src/services/mcp/config.js +1277 -0
- package/dist/src/services/mcp/elicitationHandler.js +192 -0
- package/dist/src/services/mcp/envExpansion.js +30 -0
- package/dist/src/services/mcp/headersHelper.js +94 -0
- package/dist/src/services/mcp/mcpStringUtils.js +85 -0
- package/dist/src/services/mcp/normalization.js +21 -0
- package/dist/src/services/mcp/oauthPort.js +69 -0
- package/dist/src/services/mcp/officialRegistry.js +58 -0
- package/dist/src/services/mcp/types.js +94 -0
- package/dist/src/services/mcp/useManageMCPConnections.js +820 -0
- package/dist/src/services/mcp/utils.js +433 -0
- package/dist/src/services/mcp/vscodeSdkMcp.js +69 -0
- package/dist/src/services/mcp/xaa.js +342 -0
- package/dist/src/services/mcp/xaaIdpLogin.js +377 -0
- package/dist/src/services/mcpServerApproval.js +29 -0
- package/dist/src/services/mockRateLimits.js +666 -0
- package/dist/src/services/notifier.js +114 -0
- package/dist/src/services/oauth/auth-code-listener.js +236 -0
- package/dist/src/services/oauth/client.js +545 -0
- package/dist/src/services/oauth/crypto.js +19 -0
- package/dist/src/services/oauth/getOauthProfile.js +48 -0
- package/dist/src/services/oauth/index.js +152 -0
- package/dist/src/services/oauth/types.js +1 -0
- package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +315 -0
- package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +1147 -0
- package/dist/src/services/orchestration/execution/index.js +2 -0
- package/dist/src/services/orchestration/execution/types.js +1 -0
- package/dist/src/services/orchestration/global/GlobalOrchestratorRuntime.js +140 -0
- package/dist/src/services/orchestration/global/index.js +3 -0
- package/dist/src/services/orchestration/global/reporting.js +541 -0
- package/dist/src/services/orchestration/global/types.js +1 -0
- package/dist/src/services/orchestration/index.js +4 -0
- package/dist/src/services/orchestration/policy/index.js +2 -0
- package/dist/src/services/orchestration/policy/scoring.js +291 -0
- package/dist/src/services/orchestration/policy/types.js +1 -0
- package/dist/src/services/orchestration/squad/SquadOrchestratorRuntime.js +198 -0
- package/dist/src/services/orchestration/squad/index.js +3 -0
- package/dist/src/services/orchestration/squad/reporting.js +525 -0
- package/dist/src/services/orchestration/squad/types.js +1 -0
- package/dist/src/services/plugins/PluginInstallationManager.js +139 -0
- package/dist/src/services/plugins/pluginCliCommands.js +230 -0
- package/dist/src/services/plugins/pluginOperations.js +826 -0
- package/dist/src/services/policyLimits/index.js +547 -0
- package/dist/src/services/policyLimits/types.js +9 -0
- package/dist/src/services/preventSleep.js +143 -0
- package/dist/src/services/rateLimitMessages.js +271 -0
- package/dist/src/services/rateLimitMocking.js +91 -0
- package/dist/src/services/remoteManagedSettings/index.js +534 -0
- package/dist/src/services/remoteManagedSettings/securityCheck.js +59 -0
- package/dist/src/services/remoteManagedSettings/syncCache.js +90 -0
- package/dist/src/services/remoteManagedSettings/syncCacheState.js +89 -0
- package/dist/src/services/remoteManagedSettings/types.js +12 -0
- package/dist/src/services/settingsSync/index.js +478 -0
- package/dist/src/services/settingsSync/types.js +35 -0
- package/dist/src/services/teamMemorySync/index.js +976 -0
- package/dist/src/services/teamMemorySync/secretScanner.js +275 -0
- package/dist/src/services/teamMemorySync/teamMemSecretGuard.js +35 -0
- package/dist/src/services/teamMemorySync/types.js +47 -0
- package/dist/src/services/teamMemorySync/watcher.js +326 -0
- package/dist/src/services/tips/tipHistory.js +17 -0
- package/dist/src/services/tips/tipRegistry.js +589 -0
- package/dist/src/services/tips/tipScheduler.js +40 -0
- package/dist/src/services/tokenEstimation.js +365 -0
- package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +87 -0
- package/dist/src/services/tools/StreamingToolExecutor.js +413 -0
- package/dist/src/services/tools/toolExecution.js +1218 -0
- package/dist/src/services/tools/toolHooks.js +454 -0
- package/dist/src/services/tools/toolOrchestration.js +110 -0
- package/dist/src/services/vcr.js +291 -0
- package/dist/src/services/voice.js +394 -0
- package/dist/src/services/voiceKeyterms.js +94 -0
- package/dist/src/services/voiceStreamSTT.js +406 -0
- package/dist/src/setup.js +349 -0
- package/dist/src/skills/bundled/batch.js +114 -0
- package/dist/src/skills/bundled/claudeApi.js +145 -0
- package/dist/src/skills/bundled/claudeApiContent.js +14 -0
- package/dist/src/skills/bundled/claudeInChrome.js +27 -0
- package/dist/src/skills/bundled/debug.js +99 -0
- package/dist/src/skills/bundled/index.js +5 -0
- package/dist/src/skills/bundled/keybindings.js +292 -0
- package/dist/src/skills/bundled/loop.js +81 -0
- package/dist/src/skills/bundled/loremIpsum.js +266 -0
- package/dist/src/skills/bundled/remember.js +75 -0
- package/dist/src/skills/bundled/scheduleRemoteAgents.js +373 -0
- package/dist/src/skills/bundled/simplify.js +66 -0
- package/dist/src/skills/bundled/skillify.js +184 -0
- package/dist/src/skills/bundled/stuck.js +75 -0
- package/dist/src/skills/bundled/updateConfig.js +463 -0
- package/dist/src/skills/bundled/verify.js +25 -0
- package/dist/src/skills/bundled/verifyContent.js +7 -0
- package/dist/src/skills/bundledSkills.js +159 -0
- package/dist/src/skills/loadSkillsDir.js +751 -0
- package/dist/src/skills/mcpSkillBuilders.js +10 -0
- package/dist/src/ssh/createSSHSession.js +16 -0
- package/dist/src/state/AppState.js +184 -0
- package/dist/src/state/AppStateStore.js +120 -0
- package/dist/src/state/onChangeAppState.js +132 -0
- package/dist/src/state/selectors.js +51 -0
- package/dist/src/state/store.js +21 -0
- package/dist/src/state/teammateViewHelpers.js +124 -0
- package/dist/src/tasks/DreamTask/DreamTask.js +99 -0
- package/dist/src/tasks/InProcessTeammateTask/InProcessTeammateTask.js +116 -0
- package/dist/src/tasks/InProcessTeammateTask/types.js +35 -0
- package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +507 -0
- package/dist/src/tasks/LocalMainSessionTask.js +338 -0
- package/dist/src/tasks/LocalShellTask/LocalShellTask.js +475 -0
- package/dist/src/tasks/LocalShellTask/guards.js +9 -0
- package/dist/src/tasks/LocalShellTask/killShellTasks.js +59 -0
- package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +742 -0
- package/dist/src/tasks/pillLabel.js +69 -0
- package/dist/src/tasks/stopTask.js +67 -0
- package/dist/src/tasks/types.js +18 -0
- package/dist/src/tasks.js +39 -0
- package/dist/src/telegram/bridge.js +329 -0
- package/dist/src/telegram/config.js +89 -0
- package/dist/src/telegram/mirror.js +91 -0
- package/dist/src/tools/AgentTool/AgentTool.js +1222 -0
- package/dist/src/tools/AgentTool/UI.js +592 -0
- package/dist/src/tools/AgentTool/agentColorManager.js +43 -0
- package/dist/src/tools/AgentTool/agentDisplay.js +72 -0
- package/dist/src/tools/AgentTool/agentMemory.js +139 -0
- package/dist/src/tools/AgentTool/agentMemorySnapshot.js +136 -0
- package/dist/src/tools/AgentTool/agentToolUtils.js +456 -0
- package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +175 -0
- package/dist/src/tools/AgentTool/built-in/exploreAgent.js +76 -0
- package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +28 -0
- package/dist/src/tools/AgentTool/built-in/planAgent.js +87 -0
- package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +140 -0
- package/dist/src/tools/AgentTool/built-in/verificationAgent.js +146 -0
- package/dist/src/tools/AgentTool/builtInAgents.js +59 -0
- package/dist/src/tools/AgentTool/constants.js +11 -0
- package/dist/src/tools/AgentTool/forkSubagent.js +177 -0
- package/dist/src/tools/AgentTool/loadAgentsDir.js +497 -0
- package/dist/src/tools/AgentTool/prompt.js +262 -0
- package/dist/src/tools/AgentTool/resumeAgent.js +182 -0
- package/dist/src/tools/AgentTool/runAgent.js +629 -0
- package/dist/src/tools/AskUserQuestionTool/AskUserQuestionTool.js +237 -0
- package/dist/src/tools/AskUserQuestionTool/prompt.js +38 -0
- package/dist/src/tools/BashTool/BashTool.js +1008 -0
- package/dist/src/tools/BashTool/BashToolResultMessage.js +168 -0
- package/dist/src/tools/BashTool/UI.js +133 -0
- package/dist/src/tools/BashTool/bashCommandHelpers.js +184 -0
- package/dist/src/tools/BashTool/bashPermissions.js +2023 -0
- package/dist/src/tools/BashTool/bashSecurity.js +2267 -0
- package/dist/src/tools/BashTool/commandSemantics.js +105 -0
- package/dist/src/tools/BashTool/commentLabel.js +14 -0
- package/dist/src/tools/BashTool/destructiveCommandWarning.js +88 -0
- package/dist/src/tools/BashTool/modeValidation.js +86 -0
- package/dist/src/tools/BashTool/pathValidation.js +1080 -0
- package/dist/src/tools/BashTool/prompt.js +334 -0
- package/dist/src/tools/BashTool/readOnlyValidation.js +1794 -0
- package/dist/src/tools/BashTool/sedEditParser.js +282 -0
- package/dist/src/tools/BashTool/sedValidation.js +580 -0
- package/dist/src/tools/BashTool/shouldUseSandbox.js +125 -0
- package/dist/src/tools/BashTool/toolName.js +2 -0
- package/dist/src/tools/BashTool/utils.js +180 -0
- package/dist/src/tools/BriefTool/BriefTool.js +172 -0
- package/dist/src/tools/BriefTool/UI.js +66 -0
- package/dist/src/tools/BriefTool/attachments.js +86 -0
- package/dist/src/tools/BriefTool/prompt.js +19 -0
- package/dist/src/tools/BriefTool/upload.js +136 -0
- package/dist/src/tools/ConfigTool/ConfigTool.js +398 -0
- package/dist/src/tools/ConfigTool/UI.js +24 -0
- package/dist/src/tools/ConfigTool/constants.js +1 -0
- package/dist/src/tools/ConfigTool/prompt.js +82 -0
- package/dist/src/tools/ConfigTool/supportedSettings.js +180 -0
- package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +98 -0
- package/dist/src/tools/EnterPlanModeTool/UI.js +13 -0
- package/dist/src/tools/EnterPlanModeTool/constants.js +1 -0
- package/dist/src/tools/EnterPlanModeTool/prompt.js +164 -0
- package/dist/src/tools/EnterWorktreeTool/EnterWorktreeTool.js +104 -0
- package/dist/src/tools/EnterWorktreeTool/UI.js +8 -0
- package/dist/src/tools/EnterWorktreeTool/constants.js +1 -0
- package/dist/src/tools/EnterWorktreeTool/prompt.js +30 -0
- package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +385 -0
- package/dist/src/tools/ExitPlanModeTool/UI.js +31 -0
- package/dist/src/tools/ExitPlanModeTool/constants.js +2 -0
- package/dist/src/tools/ExitPlanModeTool/prompt.js +27 -0
- package/dist/src/tools/ExitWorktreeTool/ExitWorktreeTool.js +257 -0
- package/dist/src/tools/ExitWorktreeTool/UI.js +9 -0
- package/dist/src/tools/ExitWorktreeTool/constants.js +1 -0
- package/dist/src/tools/ExitWorktreeTool/prompt.js +32 -0
- package/dist/src/tools/FileEditTool/FileEditTool.js +480 -0
- package/dist/src/tools/FileEditTool/UI.js +201 -0
- package/dist/src/tools/FileEditTool/constants.js +7 -0
- package/dist/src/tools/FileEditTool/prompt.js +24 -0
- package/dist/src/tools/FileEditTool/types.js +50 -0
- package/dist/src/tools/FileEditTool/utils.js +579 -0
- package/dist/src/tools/FileReadTool/FileReadTool.js +889 -0
- package/dist/src/tools/FileReadTool/UI.js +125 -0
- package/dist/src/tools/FileReadTool/imageProcessor.js +46 -0
- package/dist/src/tools/FileReadTool/limits.js +70 -0
- package/dist/src/tools/FileReadTool/prompt.js +31 -0
- package/dist/src/tools/FileWriteTool/FileWriteTool.js +341 -0
- package/dist/src/tools/FileWriteTool/UI.js +338 -0
- package/dist/src/tools/FileWriteTool/prompt.js +15 -0
- package/dist/src/tools/GlobTool/GlobTool.js +161 -0
- package/dist/src/tools/GlobTool/UI.js +39 -0
- package/dist/src/tools/GlobTool/prompt.js +6 -0
- package/dist/src/tools/GrepTool/GrepTool.js +439 -0
- package/dist/src/tools/GrepTool/UI.js +154 -0
- package/dist/src/tools/GrepTool/prompt.js +16 -0
- package/dist/src/tools/LSPTool/LSPTool.js +660 -0
- package/dist/src/tools/LSPTool/UI.js +204 -0
- package/dist/src/tools/LSPTool/formatters.js +445 -0
- package/dist/src/tools/LSPTool/prompt.js +20 -0
- package/dist/src/tools/LSPTool/schemas.js +197 -0
- package/dist/src/tools/LSPTool/symbolContext.js +75 -0
- package/dist/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +100 -0
- package/dist/src/tools/ListMcpResourcesTool/UI.js +16 -0
- package/dist/src/tools/ListMcpResourcesTool/prompt.js +18 -0
- package/dist/src/tools/MCPTool/MCPTool.js +60 -0
- package/dist/src/tools/MCPTool/UI.js +342 -0
- package/dist/src/tools/MCPTool/classifyForCollapse.js +597 -0
- package/dist/src/tools/MCPTool/prompt.js +3 -0
- package/dist/src/tools/McpAuthTool/McpAuthTool.js +162 -0
- package/dist/src/tools/NotebookEditTool/NotebookEditTool.js +421 -0
- package/dist/src/tools/NotebookEditTool/UI.js +40 -0
- package/dist/src/tools/NotebookEditTool/constants.js +2 -0
- package/dist/src/tools/NotebookEditTool/prompt.js +2 -0
- package/dist/src/tools/PowerShellTool/PowerShellTool.js +899 -0
- package/dist/src/tools/PowerShellTool/UI.js +57 -0
- package/dist/src/tools/PowerShellTool/clmTypes.js +207 -0
- package/dist/src/tools/PowerShellTool/commandSemantics.js +115 -0
- package/dist/src/tools/PowerShellTool/commonParameters.js +27 -0
- package/dist/src/tools/PowerShellTool/destructiveCommandWarning.js +92 -0
- package/dist/src/tools/PowerShellTool/gitSafety.js +185 -0
- package/dist/src/tools/PowerShellTool/modeValidation.js +357 -0
- package/dist/src/tools/PowerShellTool/pathValidation.js +1712 -0
- package/dist/src/tools/PowerShellTool/powershellPermissions.js +1351 -0
- package/dist/src/tools/PowerShellTool/powershellSecurity.js +942 -0
- package/dist/src/tools/PowerShellTool/prompt.js +134 -0
- package/dist/src/tools/PowerShellTool/readOnlyValidation.js +1633 -0
- package/dist/src/tools/PowerShellTool/toolName.js +2 -0
- package/dist/src/tools/REPLTool/constants.js +43 -0
- package/dist/src/tools/REPLTool/primitiveTools.js +36 -0
- package/dist/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +112 -0
- package/dist/src/tools/ReadMcpResourceTool/UI.js +23 -0
- package/dist/src/tools/ReadMcpResourceTool/prompt.js +15 -0
- package/dist/src/tools/RemoteTriggerTool/RemoteTriggerTool.js +142 -0
- package/dist/src/tools/RemoteTriggerTool/UI.js +11 -0
- package/dist/src/tools/RemoteTriggerTool/prompt.js +12 -0
- package/dist/src/tools/ScheduleCronTool/CronCreateTool.js +120 -0
- package/dist/src/tools/ScheduleCronTool/CronDeleteTool.js +74 -0
- package/dist/src/tools/ScheduleCronTool/CronListTool.js +77 -0
- package/dist/src/tools/ScheduleCronTool/UI.js +28 -0
- package/dist/src/tools/ScheduleCronTool/prompt.js +115 -0
- package/dist/src/tools/SendMessageTool/SendMessageTool.js +675 -0
- package/dist/src/tools/SendMessageTool/UI.js +23 -0
- package/dist/src/tools/SendMessageTool/constants.js +1 -0
- package/dist/src/tools/SendMessageTool/prompt.js +47 -0
- package/dist/src/tools/SkillTool/SkillTool.js +827 -0
- package/dist/src/tools/SkillTool/UI.js +60 -0
- package/dist/src/tools/SkillTool/constants.js +1 -0
- package/dist/src/tools/SkillTool/prompt.js +184 -0
- package/dist/src/tools/SleepTool/prompt.js +14 -0
- package/dist/src/tools/SyntheticOutputTool/SyntheticOutputTool.js +138 -0
- package/dist/src/tools/TaskCreateTool/TaskCreateTool.js +104 -0
- package/dist/src/tools/TaskCreateTool/constants.js +1 -0
- package/dist/src/tools/TaskCreateTool/prompt.js +52 -0
- package/dist/src/tools/TaskGetTool/TaskGetTool.js +106 -0
- package/dist/src/tools/TaskGetTool/constants.js +1 -0
- package/dist/src/tools/TaskGetTool/prompt.js +23 -0
- package/dist/src/tools/TaskListTool/TaskListTool.js +89 -0
- package/dist/src/tools/TaskListTool/constants.js +1 -0
- package/dist/src/tools/TaskListTool/prompt.js +44 -0
- package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +535 -0
- package/dist/src/tools/TaskOutputTool/constants.js +1 -0
- package/dist/src/tools/TaskStopTool/TaskStopTool.js +110 -0
- package/dist/src/tools/TaskStopTool/UI.js +30 -0
- package/dist/src/tools/TaskStopTool/prompt.js +7 -0
- package/dist/src/tools/TaskUpdateTool/TaskUpdateTool.js +301 -0
- package/dist/src/tools/TaskUpdateTool/constants.js +1 -0
- package/dist/src/tools/TaskUpdateTool/prompt.js +76 -0
- package/dist/src/tools/TeamCreateTool/TeamCreateTool.js +177 -0
- package/dist/src/tools/TeamCreateTool/UI.js +4 -0
- package/dist/src/tools/TeamCreateTool/constants.js +1 -0
- package/dist/src/tools/TeamCreateTool/prompt.js +113 -0
- package/dist/src/tools/TeamDeleteTool/TeamDeleteTool.js +102 -0
- package/dist/src/tools/TeamDeleteTool/UI.js +13 -0
- package/dist/src/tools/TeamDeleteTool/constants.js +1 -0
- package/dist/src/tools/TeamDeleteTool/prompt.js +16 -0
- package/dist/src/tools/TodoWriteTool/TodoWriteTool.js +99 -0
- package/dist/src/tools/TodoWriteTool/constants.js +1 -0
- package/dist/src/tools/TodoWriteTool/prompt.js +181 -0
- package/dist/src/tools/ToolSearchTool/ToolSearchTool.js +357 -0
- package/dist/src/tools/ToolSearchTool/constants.js +1 -0
- package/dist/src/tools/ToolSearchTool/prompt.js +99 -0
- package/dist/src/tools/TungstenTool/TungstenLiveMonitor.js +7 -0
- package/dist/src/tools/TungstenTool/TungstenTool.js +3 -0
- package/dist/src/tools/WebFetchTool/UI.js +30 -0
- package/dist/src/tools/WebFetchTool/WebFetchTool.js +246 -0
- package/dist/src/tools/WebFetchTool/preapproved.js +155 -0
- package/dist/src/tools/WebFetchTool/prompt.js +39 -0
- package/dist/src/tools/WebFetchTool/utils.js +381 -0
- package/dist/src/tools/WebSearchTool/UI.js +66 -0
- package/dist/src/tools/WebSearchTool/WebSearchTool.js +352 -0
- package/dist/src/tools/WebSearchTool/prompt.js +32 -0
- package/dist/src/tools/WorkflowTool/constants.js +2 -0
- package/dist/src/tools/shared/gitOperationTracking.js +220 -0
- package/dist/src/tools/shared/spawnMultiAgent.js +805 -0
- package/dist/src/tools/testing/TestingPermissionTool.js +72 -0
- package/dist/src/tools/utils.js +24 -0
- package/dist/src/tools.js +332 -0
- package/dist/src/types/command.js +10 -0
- package/dist/src/types/connectorText.js +2 -0
- package/dist/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.js +673 -0
- package/dist/src/types/generated/events_mono/common/v1/auth.js +49 -0
- package/dist/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.js +147 -0
- package/dist/src/types/generated/google/protobuf/timestamp.js +38 -0
- package/dist/src/types/hooks.js +153 -0
- package/dist/src/types/ids.js +27 -0
- package/dist/src/types/logs.js +11 -0
- package/dist/src/types/message.js +1 -0
- package/dist/src/types/permissions.js +25 -0
- package/dist/src/types/plugin.js +72 -0
- package/dist/src/types/textInputTypes.js +20 -0
- package/dist/src/types/utils.js +5 -0
- package/dist/src/upstreamproxy/relay.js +346 -0
- package/dist/src/upstreamproxy/upstreamproxy.js +236 -0
- package/dist/src/utils/CircularBuffer.js +75 -0
- package/dist/src/utils/Cursor.js +1229 -0
- package/dist/src/utils/QueryGuard.js +115 -0
- package/dist/src/utils/Shell.js +374 -0
- package/dist/src/utils/ShellCommand.js +338 -0
- package/dist/src/utils/abortController.js +74 -0
- package/dist/src/utils/activityManager.js +127 -0
- package/dist/src/utils/advisor.js +77 -0
- package/dist/src/utils/agentContext.js +91 -0
- package/dist/src/utils/agentId.js +83 -0
- package/dist/src/utils/agentSwarmsEnabled.js +37 -0
- package/dist/src/utils/agenticSessionSearch.js +255 -0
- package/dist/src/utils/analyzeContext.js +848 -0
- package/dist/src/utils/ansiToPng.js +259 -0
- package/dist/src/utils/ansiToSvg.js +207 -0
- package/dist/src/utils/api.js +555 -0
- package/dist/src/utils/apiPreconnect.js +62 -0
- package/dist/src/utils/appleTerminalBackup.js +95 -0
- package/dist/src/utils/argumentSubstitution.js +114 -0
- package/dist/src/utils/array.js +12 -0
- package/dist/src/utils/asciicast.js +200 -0
- package/dist/src/utils/attachments.js +2514 -0
- package/dist/src/utils/attribution.js +308 -0
- package/dist/src/utils/attributionHooks.js +16 -0
- package/dist/src/utils/attributionTrailer.js +16 -0
- package/dist/src/utils/auth.js +2022 -0
- package/dist/src/utils/authFileDescriptor.js +152 -0
- package/dist/src/utils/authPortable.js +14 -0
- package/dist/src/utils/autoModeDenials.js +15 -0
- package/dist/src/utils/autoRunIssue.js +112 -0
- package/dist/src/utils/autoUpdater.js +461 -0
- package/dist/src/utils/aws.js +44 -0
- package/dist/src/utils/awsAuthStatusManager.js +66 -0
- package/dist/src/utils/background/remote/preconditions.js +175 -0
- package/dist/src/utils/background/remote/remoteSession.js +53 -0
- package/dist/src/utils/backgroundHousekeeping.js +66 -0
- package/dist/src/utils/bash/ParsedCommand.js +241 -0
- package/dist/src/utils/bash/ShellSnapshot.js +489 -0
- package/dist/src/utils/bash/ast.js +2590 -0
- package/dist/src/utils/bash/bashParser.js +4355 -0
- package/dist/src/utils/bash/bashPipeCommand.js +249 -0
- package/dist/src/utils/bash/commands.js +1131 -0
- package/dist/src/utils/bash/heredoc.js +647 -0
- package/dist/src/utils/bash/parser.js +195 -0
- package/dist/src/utils/bash/prefix.js +154 -0
- package/dist/src/utils/bash/registry.js +23 -0
- package/dist/src/utils/bash/shellCompletion.js +196 -0
- package/dist/src/utils/bash/shellPrefix.js +25 -0
- package/dist/src/utils/bash/shellQuote.js +253 -0
- package/dist/src/utils/bash/shellQuoting.js +106 -0
- package/dist/src/utils/bash/specs/alias.js +11 -0
- package/dist/src/utils/bash/specs/index.js +16 -0
- package/dist/src/utils/bash/specs/nohup.js +10 -0
- package/dist/src/utils/bash/specs/pyright.js +88 -0
- package/dist/src/utils/bash/specs/sleep.js +10 -0
- package/dist/src/utils/bash/specs/srun.js +28 -0
- package/dist/src/utils/bash/specs/time.js +10 -0
- package/dist/src/utils/bash/specs/timeout.js +17 -0
- package/dist/src/utils/bash/treeSitterAnalysis.js +407 -0
- package/dist/src/utils/betas.js +332 -0
- package/dist/src/utils/billing.js +54 -0
- package/dist/src/utils/binaryCheck.js +40 -0
- package/dist/src/utils/browser.js +58 -0
- package/dist/src/utils/bufferedWriter.js +77 -0
- package/dist/src/utils/bundledMode.js +19 -0
- package/dist/src/utils/caCerts.js +93 -0
- package/dist/src/utils/caCertsConfig.js +77 -0
- package/dist/src/utils/cachePaths.js +28 -0
- package/dist/src/utils/ccshareResume.js +16 -0
- package/dist/src/utils/classifierApprovals.js +66 -0
- package/dist/src/utils/classifierApprovalsHook.js +10 -0
- package/dist/src/utils/claudeCodeHints.js +142 -0
- package/dist/src/utils/claudeDesktop.js +108 -0
- package/dist/src/utils/claudeInChrome/chromeNativeHost.js +416 -0
- package/dist/src/utils/claudeInChrome/common.js +466 -0
- package/dist/src/utils/claudeInChrome/mcpServer.js +237 -0
- package/dist/src/utils/claudeInChrome/prompt.js +79 -0
- package/dist/src/utils/claudeInChrome/setup.js +320 -0
- package/dist/src/utils/claudeInChrome/setupPortable.js +172 -0
- package/dist/src/utils/claudeInChrome/toolRendering.js +234 -0
- package/dist/src/utils/claudemd.js +1054 -0
- package/dist/src/utils/cleanup.js +514 -0
- package/dist/src/utils/cleanupRegistry.js +22 -0
- package/dist/src/utils/cliArgs.js +53 -0
- package/dist/src/utils/cliHighlight.js +45 -0
- package/dist/src/utils/codeIndexing.js +149 -0
- package/dist/src/utils/collapseBackgroundBashNotifications.js +70 -0
- package/dist/src/utils/collapseHookSummaries.js +48 -0
- package/dist/src/utils/collapseReadSearch.js +871 -0
- package/dist/src/utils/collapseTeammateShutdowns.js +44 -0
- package/dist/src/utils/combinedAbortSignal.js +40 -0
- package/dist/src/utils/commandLifecycle.js +7 -0
- package/dist/src/utils/commitAttribution.js +720 -0
- package/dist/src/utils/completionCache.js +138 -0
- package/dist/src/utils/computerUse/appNames.js +170 -0
- package/dist/src/utils/computerUse/cleanup.js +66 -0
- package/dist/src/utils/computerUse/common.js +56 -0
- package/dist/src/utils/computerUse/computerUseLock.js +183 -0
- package/dist/src/utils/computerUse/drainRunLoop.js +71 -0
- package/dist/src/utils/computerUse/escHotkey.js +53 -0
- package/dist/src/utils/computerUse/executor.js +480 -0
- package/dist/src/utils/computerUse/gates.js +55 -0
- package/dist/src/utils/computerUse/hostAdapter.js +62 -0
- package/dist/src/utils/computerUse/inputLoader.js +27 -0
- package/dist/src/utils/computerUse/mcpServer.js +84 -0
- package/dist/src/utils/computerUse/setup.js +42 -0
- package/dist/src/utils/computerUse/swiftLoader.js +20 -0
- package/dist/src/utils/computerUse/toolRendering.js +100 -0
- package/dist/src/utils/computerUse/wrapper.js +318 -0
- package/dist/src/utils/concurrentSessions.js +179 -0
- package/dist/src/utils/config.js +1084 -0
- package/dist/src/utils/configConstants.js +18 -0
- package/dist/src/utils/contentArray.js +45 -0
- package/dist/src/utils/context.js +185 -0
- package/dist/src/utils/contextAnalysis.js +171 -0
- package/dist/src/utils/contextSuggestions.js +158 -0
- package/dist/src/utils/controlMessageCompat.js +31 -0
- package/dist/src/utils/conversationRecovery.js +436 -0
- package/dist/src/utils/cron.js +260 -0
- package/dist/src/utils/cronJitterConfig.js +62 -0
- package/dist/src/utils/cronScheduler.js +388 -0
- package/dist/src/utils/cronTasks.js +332 -0
- package/dist/src/utils/cronTasksLock.js +164 -0
- package/dist/src/utils/crossProjectResume.js +46 -0
- package/dist/src/utils/crypto.js +13 -0
- package/dist/src/utils/cwd.js +29 -0
- package/dist/src/utils/databaseMcp/common.js +48 -0
- package/dist/src/utils/databaseMcp/mcpServer.js +2 -0
- package/dist/src/utils/databaseMcp/server/connection.js +243 -0
- package/dist/src/utils/databaseMcp/server/index.js +1442 -0
- package/dist/src/utils/databaseMcp/server/queries.js +683 -0
- package/dist/src/utils/databaseMcp/server/types.js +7 -0
- package/dist/src/utils/databaseMcp/setup.js +28 -0
- package/dist/src/utils/debug.js +220 -0
- package/dist/src/utils/debugFilter.js +125 -0
- package/dist/src/utils/deepLink/banner.js +103 -0
- package/dist/src/utils/deepLink/parseDeepLink.js +138 -0
- package/dist/src/utils/deepLink/protocolHandler.js +119 -0
- package/dist/src/utils/deepLink/registerProtocol.js +291 -0
- package/dist/src/utils/deepLink/terminalLauncher.js +455 -0
- package/dist/src/utils/deepLink/terminalPreference.js +51 -0
- package/dist/src/utils/desktopDeepLink.js +208 -0
- package/dist/src/utils/detectRepository.js +157 -0
- package/dist/src/utils/diagLogs.js +74 -0
- package/dist/src/utils/diff.js +108 -0
- package/dist/src/utils/directMemberMessage.js +34 -0
- package/dist/src/utils/displayTags.js +46 -0
- package/dist/src/utils/doctorContextWarnings.js +179 -0
- package/dist/src/utils/doctorDiagnostic.js +495 -0
- package/dist/src/utils/dxt/helpers.js +64 -0
- package/dist/src/utils/dxt/zip.js +167 -0
- package/dist/src/utils/earlyInput.js +166 -0
- package/dist/src/utils/editor.js +163 -0
- package/dist/src/utils/effort.js +278 -0
- package/dist/src/utils/embeddedTools.js +26 -0
- package/dist/src/utils/env.js +358 -0
- package/dist/src/utils/envDynamic.js +130 -0
- package/dist/src/utils/envUtils.js +192 -0
- package/dist/src/utils/envValidation.js +26 -0
- package/dist/src/utils/errorLogSink.js +197 -0
- package/dist/src/utils/errors.js +207 -0
- package/dist/src/utils/eventLoopStallDetector.js +16 -0
- package/dist/src/utils/exampleCommands.js +165 -0
- package/dist/src/utils/execFileNoThrow.js +93 -0
- package/dist/src/utils/execFileNoThrowPortable.js +111 -0
- package/dist/src/utils/execSyncWrapper.js +68 -0
- package/dist/src/utils/exportRenderer.js +71 -0
- package/dist/src/utils/extraUsage.js +19 -0
- package/dist/src/utils/fastMode.js +393 -0
- package/dist/src/utils/file.js +467 -0
- package/dist/src/utils/fileHistory.js +851 -0
- package/dist/src/utils/fileOperationAnalytics.js +45 -0
- package/dist/src/utils/filePersistence/filePersistence.js +212 -0
- package/dist/src/utils/filePersistence/outputsScanner.js +104 -0
- package/dist/src/utils/filePersistence/types.js +5 -0
- package/dist/src/utils/fileRead.js +81 -0
- package/dist/src/utils/fileReadCache.js +78 -0
- package/dist/src/utils/fileStateCache.js +99 -0
- package/dist/src/utils/findExecutable.js +13 -0
- package/dist/src/utils/fingerprint.js +59 -0
- package/dist/src/utils/forkedAgent.js +410 -0
- package/dist/src/utils/format.js +238 -0
- package/dist/src/utils/formatBriefTimestamp.js +72 -0
- package/dist/src/utils/fpsTracker.js +34 -0
- package/dist/src/utils/frontmatterParser.js +260 -0
- package/dist/src/utils/fsOperations.js +834 -0
- package/dist/src/utils/fullscreen.js +194 -0
- package/dist/src/utils/generatedFiles.js +122 -0
- package/dist/src/utils/generators.js +67 -0
- package/dist/src/utils/genericProcessUtils.js +155 -0
- package/dist/src/utils/getWorktreePaths.js +56 -0
- package/dist/src/utils/getWorktreePathsPortable.js +23 -0
- package/dist/src/utils/ghPrStatus.js +71 -0
- package/dist/src/utils/git/gitConfigParser.js +226 -0
- package/dist/src/utils/git/gitFilesystem.js +606 -0
- package/dist/src/utils/git/gitignore.js +84 -0
- package/dist/src/utils/git.js +725 -0
- package/dist/src/utils/gitDiff.js +395 -0
- package/dist/src/utils/gitSettings.js +18 -0
- package/dist/src/utils/github/ghAuthStatus.js +23 -0
- package/dist/src/utils/githubRepoPathMapping.js +135 -0
- package/dist/src/utils/glob.js +90 -0
- package/dist/src/utils/gracefulShutdown.js +447 -0
- package/dist/src/utils/groupToolUses.js +126 -0
- package/dist/src/utils/handlePromptSubmit.js +398 -0
- package/dist/src/utils/hash.js +46 -0
- package/dist/src/utils/headlessProfiler.js +147 -0
- package/dist/src/utils/heapDumpService.js +202 -0
- package/dist/src/utils/heatmap.js +151 -0
- package/dist/src/utils/highlightMatch.js +28 -0
- package/dist/src/utils/hooks/AsyncHookRegistry.js +187 -0
- package/dist/src/utils/hooks/apiQueryHookHelper.js +77 -0
- package/dist/src/utils/hooks/execAgentHook.js +257 -0
- package/dist/src/utils/hooks/execHttpHook.js +184 -0
- package/dist/src/utils/hooks/execPromptHook.js +171 -0
- package/dist/src/utils/hooks/fileChangedWatcher.js +161 -0
- package/dist/src/utils/hooks/hookEvents.js +111 -0
- package/dist/src/utils/hooks/hookHelpers.js +60 -0
- package/dist/src/utils/hooks/hooksConfigManager.js +323 -0
- package/dist/src/utils/hooks/hooksConfigSnapshot.js +114 -0
- package/dist/src/utils/hooks/hooksSettings.js +204 -0
- package/dist/src/utils/hooks/postSamplingHooks.js +39 -0
- package/dist/src/utils/hooks/registerFrontmatterHooks.js +47 -0
- package/dist/src/utils/hooks/registerSkillHooks.js +40 -0
- package/dist/src/utils/hooks/sessionHooks.js +252 -0
- package/dist/src/utils/hooks/skillImprovement.js +211 -0
- package/dist/src/utils/hooks/ssrfGuard.js +258 -0
- package/dist/src/utils/hooks.js +3668 -0
- package/dist/src/utils/horizontalScroll.js +108 -0
- package/dist/src/utils/http.js +121 -0
- package/dist/src/utils/hyperlink.js +28 -0
- package/dist/src/utils/iTermBackup.js +48 -0
- package/dist/src/utils/ide.js +1235 -0
- package/dist/src/utils/idePathConversion.js +66 -0
- package/dist/src/utils/idleTimeout.js +44 -0
- package/dist/src/utils/imagePaste.js +329 -0
- package/dist/src/utils/imageResizer.js +664 -0
- package/dist/src/utils/imageStore.js +150 -0
- package/dist/src/utils/imageValidation.js +92 -0
- package/dist/src/utils/immediateCommand.js +12 -0
- package/dist/src/utils/inProcessTeammateHelpers.js +71 -0
- package/dist/src/utils/ink.js +20 -0
- package/dist/src/utils/intl.js +83 -0
- package/dist/src/utils/jetbrains.js +152 -0
- package/dist/src/utils/json.js +295 -0
- package/dist/src/utils/jsonRead.js +14 -0
- package/dist/src/utils/keyboardShortcuts.js +11 -0
- package/dist/src/utils/lazySchema.js +8 -0
- package/dist/src/utils/listSessionsImpl.js +332 -0
- package/dist/src/utils/localInstaller.js +131 -0
- package/dist/src/utils/lockfile.js +22 -0
- package/dist/src/utils/log.js +280 -0
- package/dist/src/utils/logoV2Utils.js +290 -0
- package/dist/src/utils/mailbox.js +50 -0
- package/dist/src/utils/managedEnv.js +160 -0
- package/dist/src/utils/managedEnvConstants.js +200 -0
- package/dist/src/utils/markdown.js +300 -0
- package/dist/src/utils/markdownConfigLoader.js +494 -0
- package/dist/src/utils/mcp/dateTimeParser.js +102 -0
- package/dist/src/utils/mcp/elicitationValidation.js +259 -0
- package/dist/src/utils/mcpInstructionsDelta.js +97 -0
- package/dist/src/utils/mcpOutputStorage.js +159 -0
- package/dist/src/utils/mcpValidation.js +165 -0
- package/dist/src/utils/mcpWebSocketTransport.js +180 -0
- package/dist/src/utils/memoize.js +205 -0
- package/dist/src/utils/memory/types.js +9 -0
- package/dist/src/utils/memory/versions.js +7 -0
- package/dist/src/utils/memoryFileDetection.js +247 -0
- package/dist/src/utils/messagePredicates.js +6 -0
- package/dist/src/utils/messageQueueManager.js +430 -0
- package/dist/src/utils/messages/mappers.js +240 -0
- package/dist/src/utils/messages/systemInit.js +74 -0
- package/dist/src/utils/messages.js +4273 -0
- package/dist/src/utils/model/agent.js +128 -0
- package/dist/src/utils/model/aliases.js +21 -0
- package/dist/src/utils/model/antModels.js +25 -0
- package/dist/src/utils/model/bedrock.js +220 -0
- package/dist/src/utils/model/check1mAccess.js +64 -0
- package/dist/src/utils/model/configs.js +93 -0
- package/dist/src/utils/model/contextWindowUpgradeCheck.js +41 -0
- package/dist/src/utils/model/deprecation.js +72 -0
- package/dist/src/utils/model/model.js +641 -0
- package/dist/src/utils/model/modelAllowlist.js +148 -0
- package/dist/src/utils/model/modelCapabilities.js +107 -0
- package/dist/src/utils/model/modelOptions.js +645 -0
- package/dist/src/utils/model/modelStrings.js +144 -0
- package/dist/src/utils/model/modelSupportOverrides.js +40 -0
- package/dist/src/utils/model/openrouter.js +51 -0
- package/dist/src/utils/model/providerBaseUrls.js +77 -0
- package/dist/src/utils/model/providerCatalog.js +81 -0
- package/dist/src/utils/model/providerModels.js +334 -0
- package/dist/src/utils/model/providerProfiles.js +392 -0
- package/dist/src/utils/model/providerProfilesDb.js +886 -0
- package/dist/src/utils/model/providerSwitch.js +50 -0
- package/dist/src/utils/model/providerWorkspaces.js +36 -0
- package/dist/src/utils/model/providers.js +199 -0
- package/dist/src/utils/model/validateModel.js +257 -0
- package/dist/src/utils/modelCost.js +160 -0
- package/dist/src/utils/modifiers.js +35 -0
- package/dist/src/utils/mtls.js +134 -0
- package/dist/src/utils/nativeInstaller/download.js +370 -0
- package/dist/src/utils/nativeInstaller/index.js +8 -0
- package/dist/src/utils/nativeInstaller/installer.js +1396 -0
- package/dist/src/utils/nativeInstaller/packageManagers.js +258 -0
- package/dist/src/utils/nativeInstaller/pidLock.js +347 -0
- package/dist/src/utils/notebook.js +176 -0
- package/dist/src/utils/objectGroupBy.js +15 -0
- package/dist/src/utils/orchestration/store/index.js +6 -0
- package/dist/src/utils/orchestration/store/orchestrationDb.js +42 -0
- package/dist/src/utils/orchestration/store/providerAgentStore.js +244 -0
- package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +125 -0
- package/dist/src/utils/orchestration/store/runStore.js +486 -0
- package/dist/src/utils/orchestration/store/teamStore.js +285 -0
- package/dist/src/utils/orchestration/store/types.js +1 -0
- package/dist/src/utils/pasteStore.js +93 -0
- package/dist/src/utils/path.js +140 -0
- package/dist/src/utils/pdf.js +236 -0
- package/dist/src/utils/pdfUtils.js +61 -0
- package/dist/src/utils/peerAddress.js +20 -0
- package/dist/src/utils/permissions/PermissionMode.js +95 -0
- package/dist/src/utils/permissions/PermissionPromptToolResultSchema.js +85 -0
- package/dist/src/utils/permissions/PermissionResult.js +11 -0
- package/dist/src/utils/permissions/PermissionRule.js +19 -0
- package/dist/src/utils/permissions/PermissionUpdate.js +330 -0
- package/dist/src/utils/permissions/PermissionUpdateSchema.js +61 -0
- package/dist/src/utils/permissions/autoModeState.js +34 -0
- package/dist/src/utils/permissions/bashClassifier.js +30 -0
- package/dist/src/utils/permissions/bypassPermissionsKillswitch.js +115 -0
- package/dist/src/utils/permissions/classifierDecision.js +88 -0
- package/dist/src/utils/permissions/classifierShared.js +28 -0
- package/dist/src/utils/permissions/dangerousPatterns.js +78 -0
- package/dist/src/utils/permissions/denialTracking.js +34 -0
- package/dist/src/utils/permissions/filesystem.js +1426 -0
- package/dist/src/utils/permissions/getNextPermissionMode.js +74 -0
- package/dist/src/utils/permissions/pathValidation.js +351 -0
- package/dist/src/utils/permissions/permissionExplainer.js +188 -0
- package/dist/src/utils/permissions/permissionRuleParser.js +177 -0
- package/dist/src/utils/permissions/permissionSetup.js +1164 -0
- package/dist/src/utils/permissions/permissions.js +1106 -0
- package/dist/src/utils/permissions/permissionsDb.js +322 -0
- package/dist/src/utils/permissions/permissionsLoader.js +217 -0
- package/dist/src/utils/permissions/shadowedRuleDetection.js +149 -0
- package/dist/src/utils/permissions/shellRuleMatching.js +174 -0
- package/dist/src/utils/permissions/yoloClassifier.js +1195 -0
- package/dist/src/utils/planModeV2.js +75 -0
- package/dist/src/utils/plans.js +334 -0
- package/dist/src/utils/platform.js +122 -0
- package/dist/src/utils/plugins/addDirPluginSettings.js +53 -0
- package/dist/src/utils/plugins/cacheUtils.js +174 -0
- package/dist/src/utils/plugins/dependencyResolver.js +244 -0
- package/dist/src/utils/plugins/fetchTelemetry.js +108 -0
- package/dist/src/utils/plugins/gitAvailability.js +65 -0
- package/dist/src/utils/plugins/headlessPluginInstall.js +136 -0
- package/dist/src/utils/plugins/hintRecommendation.js +136 -0
- package/dist/src/utils/plugins/installCounts.js +218 -0
- package/dist/src/utils/plugins/installedPluginsManager.js +1003 -0
- package/dist/src/utils/plugins/loadPluginAgents.js +219 -0
- package/dist/src/utils/plugins/loadPluginCommands.js +595 -0
- package/dist/src/utils/plugins/loadPluginHooks.js +239 -0
- package/dist/src/utils/plugins/loadPluginOutputStyles.js +112 -0
- package/dist/src/utils/plugins/lspPluginIntegration.js +293 -0
- package/dist/src/utils/plugins/lspRecommendation.js +278 -0
- package/dist/src/utils/plugins/managedPlugins.js +26 -0
- package/dist/src/utils/plugins/marketplaceHelpers.js +470 -0
- package/dist/src/utils/plugins/marketplaceManager.js +1939 -0
- package/dist/src/utils/plugins/mcpPluginIntegration.js +465 -0
- package/dist/src/utils/plugins/mcpbHandler.js +708 -0
- package/dist/src/utils/plugins/officialMarketplace.js +21 -0
- package/dist/src/utils/plugins/officialMarketplaceGcs.js +195 -0
- package/dist/src/utils/plugins/officialMarketplaceStartupCheck.js +338 -0
- package/dist/src/utils/plugins/orphanedPluginFilter.js +96 -0
- package/dist/src/utils/plugins/parseMarketplaceInput.js +143 -0
- package/dist/src/utils/plugins/performStartupChecks.js +66 -0
- package/dist/src/utils/plugins/pluginAutoupdate.js +210 -0
- package/dist/src/utils/plugins/pluginBlocklist.js +93 -0
- package/dist/src/utils/plugins/pluginDirectories.js +172 -0
- package/dist/src/utils/plugins/pluginFlagging.js +173 -0
- package/dist/src/utils/plugins/pluginIdentifier.js +78 -0
- package/dist/src/utils/plugins/pluginInstallationHelpers.js +400 -0
- package/dist/src/utils/plugins/pluginLoader.js +2426 -0
- package/dist/src/utils/plugins/pluginOptionsStorage.js +311 -0
- package/dist/src/utils/plugins/pluginPolicy.js +18 -0
- package/dist/src/utils/plugins/pluginStartupCheck.js +261 -0
- package/dist/src/utils/plugins/pluginVersioning.js +128 -0
- package/dist/src/utils/plugins/reconciler.js +181 -0
- package/dist/src/utils/plugins/refresh.js +162 -0
- package/dist/src/utils/plugins/schemas.js +1283 -0
- package/dist/src/utils/plugins/validatePlugin.js +765 -0
- package/dist/src/utils/plugins/walkPluginMarkdown.js +49 -0
- package/dist/src/utils/plugins/zipCache.js +346 -0
- package/dist/src/utils/plugins/zipCacheAdapters.js +133 -0
- package/dist/src/utils/postCommitAttribution.js +16 -0
- package/dist/src/utils/powershell/dangerousCmdlets.js +174 -0
- package/dist/src/utils/powershell/parser.js +1357 -0
- package/dist/src/utils/powershell/staticPrefix.js +277 -0
- package/dist/src/utils/preflightChecks.js +147 -0
- package/dist/src/utils/privacyLevel.js +49 -0
- package/dist/src/utils/process.js +56 -0
- package/dist/src/utils/processUserInput/processBashCommand.js +119 -0
- package/dist/src/utils/processUserInput/processSlashCommand.js +859 -0
- package/dist/src/utils/processUserInput/processTextPrompt.js +68 -0
- package/dist/src/utils/processUserInput/processUserInput.js +326 -0
- package/dist/src/utils/profilerBase.js +29 -0
- package/dist/src/utils/promptCategory.js +39 -0
- package/dist/src/utils/promptEditor.js +151 -0
- package/dist/src/utils/promptShellExecution.js +119 -0
- package/dist/src/utils/proxy.js +347 -0
- package/dist/src/utils/queryContext.js +110 -0
- package/dist/src/utils/queryHelpers.js +436 -0
- package/dist/src/utils/queryProfiler.js +242 -0
- package/dist/src/utils/queueProcessor.js +70 -0
- package/dist/src/utils/readEditContext.js +176 -0
- package/dist/src/utils/readFileInRange.js +278 -0
- package/dist/src/utils/releaseNotes.js +304 -0
- package/dist/src/utils/renderOptions.js +67 -0
- package/dist/src/utils/ripgrep.js +540 -0
- package/dist/src/utils/sandbox/sandbox-adapter.js +751 -0
- package/dist/src/utils/sandbox/sandbox-ui-utils.js +11 -0
- package/dist/src/utils/sanitization.js +72 -0
- package/dist/src/utils/screenshotClipboard.js +89 -0
- package/dist/src/utils/sdkEventQueue.js +49 -0
- package/dist/src/utils/sdkHeapDumpMonitor.js +16 -0
- package/dist/src/utils/secureStorage/fallbackStorage.js +59 -0
- package/dist/src/utils/secureStorage/index.js +14 -0
- package/dist/src/utils/secureStorage/keychainPrefetch.js +91 -0
- package/dist/src/utils/secureStorage/macOsKeychainHelpers.js +91 -0
- package/dist/src/utils/secureStorage/macOsKeychainStorage.js +192 -0
- package/dist/src/utils/secureStorage/plainTextStorage.js +81 -0
- package/dist/src/utils/secureStorage/secureStoreDefs.js +1 -0
- package/dist/src/utils/secureStorage/sqliteStorage.js +224 -0
- package/dist/src/utils/secureStorage/types.js +1 -0
- package/dist/src/utils/semanticBoolean.js +23 -0
- package/dist/src/utils/semanticNumber.js +34 -0
- package/dist/src/utils/semver.js +53 -0
- package/dist/src/utils/sequential.js +43 -0
- package/dist/src/utils/sessionActivity.js +120 -0
- package/dist/src/utils/sessionDataUploader.js +16 -0
- package/dist/src/utils/sessionEnvVars.js +18 -0
- package/dist/src/utils/sessionEnvironment.js +131 -0
- package/dist/src/utils/sessionFileAccessHooks.js +207 -0
- package/dist/src/utils/sessionIngressAuth.js +113 -0
- package/dist/src/utils/sessionRestore.js +359 -0
- package/dist/src/utils/sessionStart.js +165 -0
- package/dist/src/utils/sessionState.js +76 -0
- package/dist/src/utils/sessionStorage.js +4162 -0
- package/dist/src/utils/sessionStoragePortable.js +665 -0
- package/dist/src/utils/sessionTitle.js +120 -0
- package/dist/src/utils/sessionUrl.js +50 -0
- package/dist/src/utils/set.js +50 -0
- package/dist/src/utils/settings/allErrors.js +29 -0
- package/dist/src/utils/settings/applySettingsChange.js +65 -0
- package/dist/src/utils/settings/changeDetector.js +409 -0
- package/dist/src/utils/settings/constants.js +166 -0
- package/dist/src/utils/settings/internalWrites.js +33 -0
- package/dist/src/utils/settings/managedPath.js +29 -0
- package/dist/src/utils/settings/mdm/constants.js +62 -0
- package/dist/src/utils/settings/mdm/rawRead.js +97 -0
- package/dist/src/utils/settings/mdm/settings.js +254 -0
- package/dist/src/utils/settings/permissionValidation.js +224 -0
- package/dist/src/utils/settings/pluginOnlyPolicy.js +53 -0
- package/dist/src/utils/settings/schemaOutput.js +7 -0
- package/dist/src/utils/settings/settings.js +844 -0
- package/dist/src/utils/settings/settingsCache.js +47 -0
- package/dist/src/utils/settings/toolValidationConfig.js +76 -0
- package/dist/src/utils/settings/types.js +846 -0
- package/dist/src/utils/settings/validateEditTool.js +34 -0
- package/dist/src/utils/settings/validation.js +192 -0
- package/dist/src/utils/settings/validationTips.js +111 -0
- package/dist/src/utils/shell/bashProvider.js +202 -0
- package/dist/src/utils/shell/outputLimits.js +7 -0
- package/dist/src/utils/shell/powershellDetection.js +96 -0
- package/dist/src/utils/shell/powershellProvider.js +104 -0
- package/dist/src/utils/shell/prefix.js +246 -0
- package/dist/src/utils/shell/readOnlyCommandValidation.js +1776 -0
- package/dist/src/utils/shell/resolveDefaultShell.js +13 -0
- package/dist/src/utils/shell/shellProvider.js +2 -0
- package/dist/src/utils/shell/shellToolUtils.js +21 -0
- package/dist/src/utils/shell/specPrefix.js +198 -0
- package/dist/src/utils/shellConfig.js +136 -0
- package/dist/src/utils/sideQuery.js +195 -0
- package/dist/src/utils/sideQuestion.js +121 -0
- package/dist/src/utils/signal.js +34 -0
- package/dist/src/utils/sinks.js +15 -0
- package/dist/src/utils/skills/skillChangeDetector.js +266 -0
- package/dist/src/utils/slashCommandParsing.js +46 -0
- package/dist/src/utils/sleep.js +72 -0
- package/dist/src/utils/sliceAnsi.js +74 -0
- package/dist/src/utils/slowOperations.js +323 -0
- package/dist/src/utils/standaloneAgent.js +20 -0
- package/dist/src/utils/startupProfiler.js +158 -0
- package/dist/src/utils/staticRender.js +103 -0
- package/dist/src/utils/stats.js +802 -0
- package/dist/src/utils/statsCache.js +330 -0
- package/dist/src/utils/status.js +552 -0
- package/dist/src/utils/statusNoticeDefinitions.js +112 -0
- package/dist/src/utils/statusNoticeHelpers.js +15 -0
- package/dist/src/utils/stream.js +73 -0
- package/dist/src/utils/streamJsonStdoutGuard.js +107 -0
- package/dist/src/utils/streamlinedTransform.js +162 -0
- package/dist/src/utils/stringUtils.js +202 -0
- package/dist/src/utils/subprocessEnv.js +87 -0
- package/dist/src/utils/suggestions/commandSuggestions.js +458 -0
- package/dist/src/utils/suggestions/directoryCompletion.js +191 -0
- package/dist/src/utils/suggestions/shellHistoryCompletion.js +95 -0
- package/dist/src/utils/suggestions/skillUsageTracking.js +50 -0
- package/dist/src/utils/suggestions/slackChannelSuggestions.js +169 -0
- package/dist/src/utils/swarm/It2SetupPrompt.js +386 -0
- package/dist/src/utils/swarm/backends/ITermBackend.js +276 -0
- package/dist/src/utils/swarm/backends/InProcessBackend.js +237 -0
- package/dist/src/utils/swarm/backends/PaneBackendExecutor.js +250 -0
- package/dist/src/utils/swarm/backends/TmuxBackend.js +574 -0
- package/dist/src/utils/swarm/backends/detection.js +112 -0
- package/dist/src/utils/swarm/backends/it2Setup.js +185 -0
- package/dist/src/utils/swarm/backends/registry.js +369 -0
- package/dist/src/utils/swarm/backends/teammateModeSnapshot.js +68 -0
- package/dist/src/utils/swarm/backends/types.js +9 -0
- package/dist/src/utils/swarm/constants.js +29 -0
- package/dist/src/utils/swarm/inProcessRunner.js +1021 -0
- package/dist/src/utils/swarm/leaderPermissionBridge.js +31 -0
- package/dist/src/utils/swarm/permissionSync.js +667 -0
- package/dist/src/utils/swarm/reconnection.js +82 -0
- package/dist/src/utils/swarm/spawnInProcess.js +218 -0
- package/dist/src/utils/swarm/spawnUtils.js +123 -0
- package/dist/src/utils/swarm/teamHelpers.js +484 -0
- package/dist/src/utils/swarm/teammateInit.js +87 -0
- package/dist/src/utils/swarm/teammateLayoutManager.js +82 -0
- package/dist/src/utils/swarm/teammateModel.js +9 -0
- package/dist/src/utils/swarm/teammatePromptAddendum.js +17 -0
- package/dist/src/utils/systemDirectories.js +51 -0
- package/dist/src/utils/systemPrompt.js +91 -0
- package/dist/src/utils/systemPromptType.js +9 -0
- package/dist/src/utils/systemTheme.js +108 -0
- package/dist/src/utils/systemThemeWatcher.js +16 -0
- package/dist/src/utils/taggedId.js +49 -0
- package/dist/src/utils/task/TaskOutput.js +320 -0
- package/dist/src/utils/task/diskOutput.js +387 -0
- package/dist/src/utils/task/framework.js +236 -0
- package/dist/src/utils/task/outputFormatting.js +24 -0
- package/dist/src/utils/task/sdkProgress.js +24 -0
- package/dist/src/utils/tasks.js +672 -0
- package/dist/src/utils/teamDiscovery.js +48 -0
- package/dist/src/utils/teamMemoryOps.js +67 -0
- package/dist/src/utils/teammate.js +237 -0
- package/dist/src/utils/teammateContext.js +56 -0
- package/dist/src/utils/teammateMailbox.js +793 -0
- package/dist/src/utils/telemetry/betaSessionTracing.js +371 -0
- package/dist/src/utils/telemetry/bigqueryExporter.js +181 -0
- package/dist/src/utils/telemetry/events.js +57 -0
- package/dist/src/utils/telemetry/instrumentation.js +617 -0
- package/dist/src/utils/telemetry/logger.js +25 -0
- package/dist/src/utils/telemetry/perfettoTracing.js +882 -0
- package/dist/src/utils/telemetry/pluginTelemetry.js +157 -0
- package/dist/src/utils/telemetry/sessionTracing.js +693 -0
- package/dist/src/utils/telemetry/skillLoadedEvent.js +26 -0
- package/dist/src/utils/telemetryAttributes.js +57 -0
- package/dist/src/utils/teleport/api.js +299 -0
- package/dist/src/utils/teleport/environmentSelection.js +55 -0
- package/dist/src/utils/teleport/environments.js +84 -0
- package/dist/src/utils/teleport/gitBundle.js +192 -0
- package/dist/src/utils/teleport.js +1041 -0
- package/dist/src/utils/tempfile.js +26 -0
- package/dist/src/utils/terminal.js +105 -0
- package/dist/src/utils/terminalPanel.js +155 -0
- package/dist/src/utils/textHighlighting.js +113 -0
- package/dist/src/utils/theme.js +525 -0
- package/dist/src/utils/thinking.js +130 -0
- package/dist/src/utils/timeouts.js +35 -0
- package/dist/src/utils/tmuxSocket.js +373 -0
- package/dist/src/utils/todo/types.js +9 -0
- package/dist/src/utils/tokenBudget.js +62 -0
- package/dist/src/utils/tokens.js +223 -0
- package/dist/src/utils/toolErrors.js +101 -0
- package/dist/src/utils/toolPool.js +63 -0
- package/dist/src/utils/toolResultStorage.js +769 -0
- package/dist/src/utils/toolSchemaCache.js +7 -0
- package/dist/src/utils/toolSearch.js +551 -0
- package/dist/src/utils/transcriptSearch.js +200 -0
- package/dist/src/utils/treeify.js +111 -0
- package/dist/src/utils/truncate.js +164 -0
- package/dist/src/utils/udsClient.js +16 -0
- package/dist/src/utils/udsMessaging.js +16 -0
- package/dist/src/utils/ultraplan/ccrSession.js +264 -0
- package/dist/src/utils/ultraplan/keyword.js +122 -0
- package/dist/src/utils/ultraplan/prompt.txt +1 -0
- package/dist/src/utils/unaryLogging.js +16 -0
- package/dist/src/utils/undercover.js +89 -0
- package/dist/src/utils/user.js +138 -0
- package/dist/src/utils/userAgent.js +13 -0
- package/dist/src/utils/userPromptKeywords.js +21 -0
- package/dist/src/utils/uuid.js +22 -0
- package/dist/src/utils/warningHandler.js +97 -0
- package/dist/src/utils/which.js +75 -0
- package/dist/src/utils/windowsPaths.js +150 -0
- package/dist/src/utils/withResolvers.js +13 -0
- package/dist/src/utils/words.js +793 -0
- package/dist/src/utils/workloadContext.js +42 -0
- package/dist/src/utils/worktree.js +1145 -0
- package/dist/src/utils/worktreeModeEnabled.js +11 -0
- package/dist/src/utils/xdg.js +52 -0
- package/dist/src/utils/xml.js +15 -0
- package/dist/src/utils/yaml.js +16 -0
- package/dist/src/utils/zodToJsonSchema.js +19 -0
- package/dist/src/vim/motions.js +73 -0
- package/dist/src/vim/operators.js +401 -0
- package/dist/src/vim/textObjects.js +153 -0
- package/dist/src/vim/transitions.js +340 -0
- package/dist/src/vim/types.js +93 -0
- package/dist/src/voice/voiceModeEnabled.js +48 -0
- package/dist/src/whatsapp/bridge.js +267 -0
- package/dist/src/whatsapp/config.js +153 -0
- package/dist/src/whatsapp/markdown.js +37 -0
- package/dist/src/whatsapp/mirror.js +74 -0
- package/dist/src/whatsapp/session.js +142 -0
- package/package.json +2 -1
|
@@ -0,0 +1,1229 @@
|
|
|
1
|
+
import { stringWidth } from '../ink/stringWidth.js';
|
|
2
|
+
import { wrapAnsi } from '../ink/wrapAnsi.js';
|
|
3
|
+
import { firstGrapheme, getGraphemeSegmenter, getWordSegmenter, } from './intl.js';
|
|
4
|
+
/**
|
|
5
|
+
* Kill ring for storing killed (cut) text that can be yanked (pasted) with Ctrl+Y.
|
|
6
|
+
* This is global state that shares one kill ring across all input fields.
|
|
7
|
+
*
|
|
8
|
+
* Consecutive kills accumulate in the kill ring until the user types some
|
|
9
|
+
* other key. Alt+Y cycles through previous kills after a yank.
|
|
10
|
+
*/
|
|
11
|
+
const KILL_RING_MAX_SIZE = 10;
|
|
12
|
+
let killRing = [];
|
|
13
|
+
let killRingIndex = 0;
|
|
14
|
+
let lastActionWasKill = false;
|
|
15
|
+
// Track yank state for yank-pop (alt-y)
|
|
16
|
+
let lastYankStart = 0;
|
|
17
|
+
let lastYankLength = 0;
|
|
18
|
+
let lastActionWasYank = false;
|
|
19
|
+
export function pushToKillRing(text, direction = 'append') {
|
|
20
|
+
if (text.length > 0) {
|
|
21
|
+
if (lastActionWasKill && killRing.length > 0) {
|
|
22
|
+
// Accumulate with the most recent kill
|
|
23
|
+
if (direction === 'prepend') {
|
|
24
|
+
killRing[0] = text + killRing[0];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
killRing[0] = killRing[0] + text;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// Add new entry to front of ring
|
|
32
|
+
killRing.unshift(text);
|
|
33
|
+
if (killRing.length > KILL_RING_MAX_SIZE) {
|
|
34
|
+
killRing.pop();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
lastActionWasKill = true;
|
|
38
|
+
// Reset yank state when killing new text
|
|
39
|
+
lastActionWasYank = false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function getLastKill() {
|
|
43
|
+
return killRing[0] ?? '';
|
|
44
|
+
}
|
|
45
|
+
export function getKillRingItem(index) {
|
|
46
|
+
if (killRing.length === 0)
|
|
47
|
+
return '';
|
|
48
|
+
const normalizedIndex = ((index % killRing.length) + killRing.length) % killRing.length;
|
|
49
|
+
return killRing[normalizedIndex] ?? '';
|
|
50
|
+
}
|
|
51
|
+
export function getKillRingSize() {
|
|
52
|
+
return killRing.length;
|
|
53
|
+
}
|
|
54
|
+
export function clearKillRing() {
|
|
55
|
+
killRing = [];
|
|
56
|
+
killRingIndex = 0;
|
|
57
|
+
lastActionWasKill = false;
|
|
58
|
+
lastActionWasYank = false;
|
|
59
|
+
lastYankStart = 0;
|
|
60
|
+
lastYankLength = 0;
|
|
61
|
+
}
|
|
62
|
+
export function resetKillAccumulation() {
|
|
63
|
+
lastActionWasKill = false;
|
|
64
|
+
}
|
|
65
|
+
// Yank tracking for yank-pop
|
|
66
|
+
export function recordYank(start, length) {
|
|
67
|
+
lastYankStart = start;
|
|
68
|
+
lastYankLength = length;
|
|
69
|
+
lastActionWasYank = true;
|
|
70
|
+
killRingIndex = 0;
|
|
71
|
+
}
|
|
72
|
+
export function canYankPop() {
|
|
73
|
+
return lastActionWasYank && killRing.length > 1;
|
|
74
|
+
}
|
|
75
|
+
export function yankPop() {
|
|
76
|
+
if (!lastActionWasYank || killRing.length <= 1) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
// Cycle to next item in kill ring
|
|
80
|
+
killRingIndex = (killRingIndex + 1) % killRing.length;
|
|
81
|
+
const text = killRing[killRingIndex] ?? '';
|
|
82
|
+
return { text, start: lastYankStart, length: lastYankLength };
|
|
83
|
+
}
|
|
84
|
+
export function updateYankLength(length) {
|
|
85
|
+
lastYankLength = length;
|
|
86
|
+
}
|
|
87
|
+
export function resetYankState() {
|
|
88
|
+
lastActionWasYank = false;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Text Processing Flow for Unicode Normalization:
|
|
92
|
+
*
|
|
93
|
+
* User Input (raw text, potentially mixed NFD/NFC)
|
|
94
|
+
* ↓
|
|
95
|
+
* MeasuredText (normalizes to NFC + builds grapheme info)
|
|
96
|
+
* ↓
|
|
97
|
+
* All cursor operations use normalized text/offsets
|
|
98
|
+
* ↓
|
|
99
|
+
* Display uses normalized text from wrappedLines
|
|
100
|
+
*
|
|
101
|
+
* This flow ensures consistent Unicode handling:
|
|
102
|
+
* - NFD/NFC normalization differences don't break cursor movement
|
|
103
|
+
* - Grapheme clusters (like 👨👩👧👦) are treated as single units
|
|
104
|
+
* - Display width calculations are accurate for CJK characters
|
|
105
|
+
*
|
|
106
|
+
* RULE: Once text enters MeasuredText, all operations
|
|
107
|
+
* work on the normalized version.
|
|
108
|
+
*/
|
|
109
|
+
// Pre-compiled regex patterns for Vim word detection (avoid creating in hot loops)
|
|
110
|
+
export const VIM_WORD_CHAR_REGEX = /^[\p{L}\p{N}\p{M}_]$/u;
|
|
111
|
+
export const WHITESPACE_REGEX = /\s/;
|
|
112
|
+
// Exported helper functions for Vim character classification
|
|
113
|
+
export const isVimWordChar = (ch) => VIM_WORD_CHAR_REGEX.test(ch);
|
|
114
|
+
export const isVimWhitespace = (ch) => WHITESPACE_REGEX.test(ch);
|
|
115
|
+
export const isVimPunctuation = (ch) => ch.length > 0 && !isVimWhitespace(ch) && !isVimWordChar(ch);
|
|
116
|
+
export class Cursor {
|
|
117
|
+
measuredText;
|
|
118
|
+
selection;
|
|
119
|
+
offset;
|
|
120
|
+
constructor(measuredText, offset = 0, selection = 0) {
|
|
121
|
+
this.measuredText = measuredText;
|
|
122
|
+
this.selection = selection;
|
|
123
|
+
// it's ok for the cursor to be 1 char beyond the end of the string
|
|
124
|
+
this.offset = Math.max(0, Math.min(this.text.length, offset));
|
|
125
|
+
}
|
|
126
|
+
static fromText(text, columns, offset = 0, selection = 0) {
|
|
127
|
+
// make MeasuredText on less than columns width, to account for cursor
|
|
128
|
+
return new Cursor(new MeasuredText(text, columns - 1), offset, selection);
|
|
129
|
+
}
|
|
130
|
+
getViewportStartLine(maxVisibleLines) {
|
|
131
|
+
if (maxVisibleLines === undefined || maxVisibleLines <= 0)
|
|
132
|
+
return 0;
|
|
133
|
+
const { line } = this.getPosition();
|
|
134
|
+
const allLines = this.measuredText.getWrappedText();
|
|
135
|
+
if (allLines.length <= maxVisibleLines)
|
|
136
|
+
return 0;
|
|
137
|
+
const half = Math.floor(maxVisibleLines / 2);
|
|
138
|
+
let startLine = Math.max(0, line - half);
|
|
139
|
+
const endLine = Math.min(allLines.length, startLine + maxVisibleLines);
|
|
140
|
+
if (endLine - startLine < maxVisibleLines) {
|
|
141
|
+
startLine = Math.max(0, endLine - maxVisibleLines);
|
|
142
|
+
}
|
|
143
|
+
return startLine;
|
|
144
|
+
}
|
|
145
|
+
getViewportCharOffset(maxVisibleLines) {
|
|
146
|
+
const startLine = this.getViewportStartLine(maxVisibleLines);
|
|
147
|
+
if (startLine === 0)
|
|
148
|
+
return 0;
|
|
149
|
+
const wrappedLines = this.measuredText.getWrappedLines();
|
|
150
|
+
return wrappedLines[startLine]?.startOffset ?? 0;
|
|
151
|
+
}
|
|
152
|
+
getViewportCharEnd(maxVisibleLines) {
|
|
153
|
+
const startLine = this.getViewportStartLine(maxVisibleLines);
|
|
154
|
+
const allLines = this.measuredText.getWrappedLines();
|
|
155
|
+
if (maxVisibleLines === undefined || maxVisibleLines <= 0)
|
|
156
|
+
return this.text.length;
|
|
157
|
+
const endLine = Math.min(allLines.length, startLine + maxVisibleLines);
|
|
158
|
+
if (endLine >= allLines.length)
|
|
159
|
+
return this.text.length;
|
|
160
|
+
return allLines[endLine]?.startOffset ?? this.text.length;
|
|
161
|
+
}
|
|
162
|
+
render(cursorChar, mask, invert, ghostText, maxVisibleLines) {
|
|
163
|
+
const { line, column } = this.getPosition();
|
|
164
|
+
const allLines = this.measuredText.getWrappedText();
|
|
165
|
+
const startLine = this.getViewportStartLine(maxVisibleLines);
|
|
166
|
+
const endLine = maxVisibleLines !== undefined && maxVisibleLines > 0
|
|
167
|
+
? Math.min(allLines.length, startLine + maxVisibleLines)
|
|
168
|
+
: allLines.length;
|
|
169
|
+
return allLines
|
|
170
|
+
.slice(startLine, endLine)
|
|
171
|
+
.map((text, i) => {
|
|
172
|
+
const currentLine = i + startLine;
|
|
173
|
+
let displayText = text;
|
|
174
|
+
if (mask) {
|
|
175
|
+
const graphemes = Array.from(getGraphemeSegmenter().segment(text));
|
|
176
|
+
if (currentLine === allLines.length - 1) {
|
|
177
|
+
// Last line: mask all but the trailing 6 chars so the user can
|
|
178
|
+
// confirm they pasted the right thing without exposing the full token
|
|
179
|
+
const visibleCount = Math.min(6, graphemes.length);
|
|
180
|
+
const maskCount = graphemes.length - visibleCount;
|
|
181
|
+
const splitOffset = graphemes.length > visibleCount ? graphemes[maskCount].index : 0;
|
|
182
|
+
displayText = mask.repeat(maskCount) + text.slice(splitOffset);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// Earlier wrapped lines: fully mask. Previously only the last line
|
|
186
|
+
// was masked, leaking the start of the token on narrow terminals
|
|
187
|
+
// where the pasted OAuth code wraps across multiple lines.
|
|
188
|
+
displayText = mask.repeat(graphemes.length);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// looking for the line with the cursor
|
|
192
|
+
if (line !== currentLine)
|
|
193
|
+
return displayText.trimEnd();
|
|
194
|
+
// Split the line into before/at/after cursor in a single pass over the
|
|
195
|
+
// graphemes, accumulating display width until we reach the cursor column.
|
|
196
|
+
// This replaces a two-pass approach (displayWidthToStringIndex + a second
|
|
197
|
+
// segmenter pass) — the intermediate stringIndex from that approach is
|
|
198
|
+
// always a grapheme boundary, so the "cursor in the middle of a
|
|
199
|
+
// multi-codepoint character" branch was unreachable.
|
|
200
|
+
let beforeCursor = '';
|
|
201
|
+
let atCursor = cursorChar;
|
|
202
|
+
let afterCursor = '';
|
|
203
|
+
let currentWidth = 0;
|
|
204
|
+
let cursorFound = false;
|
|
205
|
+
for (const { segment } of getGraphemeSegmenter().segment(displayText)) {
|
|
206
|
+
if (cursorFound) {
|
|
207
|
+
afterCursor += segment;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
const nextWidth = currentWidth + stringWidth(segment);
|
|
211
|
+
if (nextWidth > column) {
|
|
212
|
+
atCursor = segment;
|
|
213
|
+
cursorFound = true;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
currentWidth = nextWidth;
|
|
217
|
+
beforeCursor += segment;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// Only invert the cursor if we have a cursor character to show
|
|
221
|
+
// When ghost text is present and cursor is at end, show first ghost char in cursor
|
|
222
|
+
let renderedCursor;
|
|
223
|
+
let ghostSuffix = '';
|
|
224
|
+
if (ghostText &&
|
|
225
|
+
currentLine === allLines.length - 1 &&
|
|
226
|
+
this.isAtEnd() &&
|
|
227
|
+
ghostText.text.length > 0) {
|
|
228
|
+
// First ghost character goes in the inverted cursor (grapheme-safe)
|
|
229
|
+
const firstGhostChar = firstGrapheme(ghostText.text) || ghostText.text[0];
|
|
230
|
+
renderedCursor = cursorChar ? invert(firstGhostChar) : firstGhostChar;
|
|
231
|
+
// Rest of ghost text is dimmed after cursor
|
|
232
|
+
const ghostRest = ghostText.text.slice(firstGhostChar.length);
|
|
233
|
+
if (ghostRest.length > 0) {
|
|
234
|
+
ghostSuffix = ghostText.dim(ghostRest);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
renderedCursor = cursorChar ? invert(atCursor) : atCursor;
|
|
239
|
+
}
|
|
240
|
+
return (beforeCursor + renderedCursor + ghostSuffix + afterCursor.trimEnd());
|
|
241
|
+
})
|
|
242
|
+
.join('\n');
|
|
243
|
+
}
|
|
244
|
+
left() {
|
|
245
|
+
if (this.offset === 0)
|
|
246
|
+
return this;
|
|
247
|
+
const chip = this.imageRefEndingAt(this.offset);
|
|
248
|
+
if (chip)
|
|
249
|
+
return new Cursor(this.measuredText, chip.start);
|
|
250
|
+
const prevOffset = this.measuredText.prevOffset(this.offset);
|
|
251
|
+
return new Cursor(this.measuredText, prevOffset);
|
|
252
|
+
}
|
|
253
|
+
right() {
|
|
254
|
+
if (this.offset >= this.text.length)
|
|
255
|
+
return this;
|
|
256
|
+
const chip = this.imageRefStartingAt(this.offset);
|
|
257
|
+
if (chip)
|
|
258
|
+
return new Cursor(this.measuredText, chip.end);
|
|
259
|
+
const nextOffset = this.measuredText.nextOffset(this.offset);
|
|
260
|
+
return new Cursor(this.measuredText, Math.min(nextOffset, this.text.length));
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* If an [Image #N] chip ends at `offset`, return its bounds. Used by left()
|
|
264
|
+
* to hop the cursor over the chip instead of stepping into it.
|
|
265
|
+
*/
|
|
266
|
+
imageRefEndingAt(offset) {
|
|
267
|
+
const m = this.text.slice(0, offset).match(/\[Image #\d+\]$/);
|
|
268
|
+
return m ? { start: offset - m[0].length, end: offset } : null;
|
|
269
|
+
}
|
|
270
|
+
imageRefStartingAt(offset) {
|
|
271
|
+
const m = this.text.slice(offset).match(/^\[Image #\d+\]/);
|
|
272
|
+
return m ? { start: offset, end: offset + m[0].length } : null;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* If offset lands strictly inside an [Image #N] chip, snap it to the given
|
|
276
|
+
* boundary. Used by word-movement methods so Ctrl+W / Alt+D never leave a
|
|
277
|
+
* partial chip.
|
|
278
|
+
*/
|
|
279
|
+
snapOutOfImageRef(offset, toward) {
|
|
280
|
+
const re = /\[Image #\d+\]/g;
|
|
281
|
+
let m;
|
|
282
|
+
while ((m = re.exec(this.text)) !== null) {
|
|
283
|
+
const start = m.index;
|
|
284
|
+
const end = start + m[0].length;
|
|
285
|
+
if (offset > start && offset < end) {
|
|
286
|
+
return toward === 'start' ? start : end;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return offset;
|
|
290
|
+
}
|
|
291
|
+
up() {
|
|
292
|
+
const { line, column } = this.getPosition();
|
|
293
|
+
if (line === 0) {
|
|
294
|
+
return this;
|
|
295
|
+
}
|
|
296
|
+
const prevLine = this.measuredText.getWrappedText()[line - 1];
|
|
297
|
+
if (prevLine === undefined) {
|
|
298
|
+
return this;
|
|
299
|
+
}
|
|
300
|
+
const prevLineDisplayWidth = stringWidth(prevLine);
|
|
301
|
+
if (column > prevLineDisplayWidth) {
|
|
302
|
+
const newOffset = this.getOffset({
|
|
303
|
+
line: line - 1,
|
|
304
|
+
column: prevLineDisplayWidth,
|
|
305
|
+
});
|
|
306
|
+
return new Cursor(this.measuredText, newOffset, 0);
|
|
307
|
+
}
|
|
308
|
+
const newOffset = this.getOffset({ line: line - 1, column });
|
|
309
|
+
return new Cursor(this.measuredText, newOffset, 0);
|
|
310
|
+
}
|
|
311
|
+
down() {
|
|
312
|
+
const { line, column } = this.getPosition();
|
|
313
|
+
if (line >= this.measuredText.lineCount - 1) {
|
|
314
|
+
return this;
|
|
315
|
+
}
|
|
316
|
+
// If there is no next line, stay on the current line,
|
|
317
|
+
// and let the caller handle it (e.g. for prompt input,
|
|
318
|
+
// we move to the next history entry)
|
|
319
|
+
const nextLine = this.measuredText.getWrappedText()[line + 1];
|
|
320
|
+
if (nextLine === undefined) {
|
|
321
|
+
return this;
|
|
322
|
+
}
|
|
323
|
+
// If the current column is past the end of the next line,
|
|
324
|
+
// move to the end of the next line
|
|
325
|
+
const nextLineDisplayWidth = stringWidth(nextLine);
|
|
326
|
+
if (column > nextLineDisplayWidth) {
|
|
327
|
+
const newOffset = this.getOffset({
|
|
328
|
+
line: line + 1,
|
|
329
|
+
column: nextLineDisplayWidth,
|
|
330
|
+
});
|
|
331
|
+
return new Cursor(this.measuredText, newOffset, 0);
|
|
332
|
+
}
|
|
333
|
+
// Otherwise, move to the same column on the next line
|
|
334
|
+
const newOffset = this.getOffset({
|
|
335
|
+
line: line + 1,
|
|
336
|
+
column,
|
|
337
|
+
});
|
|
338
|
+
return new Cursor(this.measuredText, newOffset, 0);
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Move to the start of the current line (column 0).
|
|
342
|
+
* This is the raw version used internally by startOfLine.
|
|
343
|
+
*/
|
|
344
|
+
startOfCurrentLine() {
|
|
345
|
+
const { line } = this.getPosition();
|
|
346
|
+
return new Cursor(this.measuredText, this.getOffset({
|
|
347
|
+
line,
|
|
348
|
+
column: 0,
|
|
349
|
+
}), 0);
|
|
350
|
+
}
|
|
351
|
+
startOfLine() {
|
|
352
|
+
const { line, column } = this.getPosition();
|
|
353
|
+
// If already at start of line and not at first line, move to previous line
|
|
354
|
+
if (column === 0 && line > 0) {
|
|
355
|
+
return new Cursor(this.measuredText, this.getOffset({
|
|
356
|
+
line: line - 1,
|
|
357
|
+
column: 0,
|
|
358
|
+
}), 0);
|
|
359
|
+
}
|
|
360
|
+
return this.startOfCurrentLine();
|
|
361
|
+
}
|
|
362
|
+
firstNonBlankInLine() {
|
|
363
|
+
const { line } = this.getPosition();
|
|
364
|
+
const lineText = this.measuredText.getWrappedText()[line] || '';
|
|
365
|
+
const match = lineText.match(/^\s*\S/);
|
|
366
|
+
const column = match?.index ? match.index + match[0].length - 1 : 0;
|
|
367
|
+
const offset = this.getOffset({ line, column });
|
|
368
|
+
return new Cursor(this.measuredText, offset, 0);
|
|
369
|
+
}
|
|
370
|
+
endOfLine() {
|
|
371
|
+
const { line } = this.getPosition();
|
|
372
|
+
const column = this.measuredText.getLineLength(line);
|
|
373
|
+
const offset = this.getOffset({ line, column });
|
|
374
|
+
return new Cursor(this.measuredText, offset, 0);
|
|
375
|
+
}
|
|
376
|
+
// Helper methods for finding logical line boundaries
|
|
377
|
+
findLogicalLineStart(fromOffset = this.offset) {
|
|
378
|
+
const prevNewline = this.text.lastIndexOf('\n', fromOffset - 1);
|
|
379
|
+
return prevNewline === -1 ? 0 : prevNewline + 1;
|
|
380
|
+
}
|
|
381
|
+
findLogicalLineEnd(fromOffset = this.offset) {
|
|
382
|
+
const nextNewline = this.text.indexOf('\n', fromOffset);
|
|
383
|
+
return nextNewline === -1 ? this.text.length : nextNewline;
|
|
384
|
+
}
|
|
385
|
+
// Helper to get logical line bounds for current position
|
|
386
|
+
getLogicalLineBounds() {
|
|
387
|
+
return {
|
|
388
|
+
start: this.findLogicalLineStart(),
|
|
389
|
+
end: this.findLogicalLineEnd(),
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
// Helper to create cursor with preserved column, clamped to line length
|
|
393
|
+
// Snaps to grapheme boundary to avoid landing mid-grapheme
|
|
394
|
+
createCursorWithColumn(lineStart, lineEnd, targetColumn) {
|
|
395
|
+
const lineLength = lineEnd - lineStart;
|
|
396
|
+
const clampedColumn = Math.min(targetColumn, lineLength);
|
|
397
|
+
const rawOffset = lineStart + clampedColumn;
|
|
398
|
+
const offset = this.measuredText.snapToGraphemeBoundary(rawOffset);
|
|
399
|
+
return new Cursor(this.measuredText, offset, 0);
|
|
400
|
+
}
|
|
401
|
+
endOfLogicalLine() {
|
|
402
|
+
return new Cursor(this.measuredText, this.findLogicalLineEnd(), 0);
|
|
403
|
+
}
|
|
404
|
+
startOfLogicalLine() {
|
|
405
|
+
return new Cursor(this.measuredText, this.findLogicalLineStart(), 0);
|
|
406
|
+
}
|
|
407
|
+
firstNonBlankInLogicalLine() {
|
|
408
|
+
const { start, end } = this.getLogicalLineBounds();
|
|
409
|
+
const lineText = this.text.slice(start, end);
|
|
410
|
+
const match = lineText.match(/\S/);
|
|
411
|
+
const offset = start + (match?.index ?? 0);
|
|
412
|
+
return new Cursor(this.measuredText, offset, 0);
|
|
413
|
+
}
|
|
414
|
+
upLogicalLine() {
|
|
415
|
+
const { start: currentStart } = this.getLogicalLineBounds();
|
|
416
|
+
// At first line - stay at beginning
|
|
417
|
+
if (currentStart === 0) {
|
|
418
|
+
return new Cursor(this.measuredText, 0, 0);
|
|
419
|
+
}
|
|
420
|
+
// Calculate target column position
|
|
421
|
+
const currentColumn = this.offset - currentStart;
|
|
422
|
+
// Find previous line bounds
|
|
423
|
+
const prevLineEnd = currentStart - 1;
|
|
424
|
+
const prevLineStart = this.findLogicalLineStart(prevLineEnd);
|
|
425
|
+
return this.createCursorWithColumn(prevLineStart, prevLineEnd, currentColumn);
|
|
426
|
+
}
|
|
427
|
+
downLogicalLine() {
|
|
428
|
+
const { start: currentStart, end: currentEnd } = this.getLogicalLineBounds();
|
|
429
|
+
// At last line - stay at end
|
|
430
|
+
if (currentEnd >= this.text.length) {
|
|
431
|
+
return new Cursor(this.measuredText, this.text.length, 0);
|
|
432
|
+
}
|
|
433
|
+
// Calculate target column position
|
|
434
|
+
const currentColumn = this.offset - currentStart;
|
|
435
|
+
// Find next line bounds
|
|
436
|
+
const nextLineStart = currentEnd + 1;
|
|
437
|
+
const nextLineEnd = this.findLogicalLineEnd(nextLineStart);
|
|
438
|
+
return this.createCursorWithColumn(nextLineStart, nextLineEnd, currentColumn);
|
|
439
|
+
}
|
|
440
|
+
// Vim word vs WORD movements:
|
|
441
|
+
// - word (lowercase w/b/e): sequences of letters, digits, and underscores
|
|
442
|
+
// - WORD (uppercase W/B/E): sequences of non-whitespace characters
|
|
443
|
+
// For example, in "hello-world!", word movements see 3 words: "hello", "world", and nothing
|
|
444
|
+
// But WORD movements see 1 WORD: "hello-world!"
|
|
445
|
+
nextWord() {
|
|
446
|
+
if (this.isAtEnd()) {
|
|
447
|
+
return this;
|
|
448
|
+
}
|
|
449
|
+
// Use Intl.Segmenter for proper word boundary detection (including CJK)
|
|
450
|
+
const wordBoundaries = this.measuredText.getWordBoundaries();
|
|
451
|
+
// Find the next word start boundary after current position
|
|
452
|
+
for (const boundary of wordBoundaries) {
|
|
453
|
+
if (boundary.isWordLike && boundary.start > this.offset) {
|
|
454
|
+
return new Cursor(this.measuredText, boundary.start);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
// If no next word found, go to end
|
|
458
|
+
return new Cursor(this.measuredText, this.text.length);
|
|
459
|
+
}
|
|
460
|
+
endOfWord() {
|
|
461
|
+
if (this.isAtEnd()) {
|
|
462
|
+
return this;
|
|
463
|
+
}
|
|
464
|
+
// Use Intl.Segmenter for proper word boundary detection (including CJK)
|
|
465
|
+
const wordBoundaries = this.measuredText.getWordBoundaries();
|
|
466
|
+
// Find the current word boundary we're in
|
|
467
|
+
for (const boundary of wordBoundaries) {
|
|
468
|
+
if (!boundary.isWordLike)
|
|
469
|
+
continue;
|
|
470
|
+
// If we're inside this word but NOT at the last character
|
|
471
|
+
if (this.offset >= boundary.start && this.offset < boundary.end - 1) {
|
|
472
|
+
// Move to end of this word (last character position)
|
|
473
|
+
return new Cursor(this.measuredText, boundary.end - 1);
|
|
474
|
+
}
|
|
475
|
+
// If we're at the last character of a word (end - 1), find the next word's end
|
|
476
|
+
if (this.offset === boundary.end - 1) {
|
|
477
|
+
// Find next word
|
|
478
|
+
for (const nextBoundary of wordBoundaries) {
|
|
479
|
+
if (nextBoundary.isWordLike && nextBoundary.start > this.offset) {
|
|
480
|
+
return new Cursor(this.measuredText, nextBoundary.end - 1);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return this;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
// If not in a word, find the next word and go to its end
|
|
487
|
+
for (const boundary of wordBoundaries) {
|
|
488
|
+
if (boundary.isWordLike && boundary.start > this.offset) {
|
|
489
|
+
return new Cursor(this.measuredText, boundary.end - 1);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
return this;
|
|
493
|
+
}
|
|
494
|
+
prevWord() {
|
|
495
|
+
if (this.isAtStart()) {
|
|
496
|
+
return this;
|
|
497
|
+
}
|
|
498
|
+
// Use Intl.Segmenter for proper word boundary detection (including CJK)
|
|
499
|
+
const wordBoundaries = this.measuredText.getWordBoundaries();
|
|
500
|
+
// Find the previous word start boundary before current position
|
|
501
|
+
// We need to iterate in reverse to find the previous word
|
|
502
|
+
let prevWordStart = null;
|
|
503
|
+
for (const boundary of wordBoundaries) {
|
|
504
|
+
if (!boundary.isWordLike)
|
|
505
|
+
continue;
|
|
506
|
+
// If we're at or after the start of this word, but this word starts before us
|
|
507
|
+
if (boundary.start < this.offset) {
|
|
508
|
+
// If we're inside this word (not at the start), go to its start
|
|
509
|
+
if (this.offset > boundary.start && this.offset <= boundary.end) {
|
|
510
|
+
return new Cursor(this.measuredText, boundary.start);
|
|
511
|
+
}
|
|
512
|
+
// Otherwise, remember this as a candidate for previous word
|
|
513
|
+
prevWordStart = boundary.start;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (prevWordStart !== null) {
|
|
517
|
+
return new Cursor(this.measuredText, prevWordStart);
|
|
518
|
+
}
|
|
519
|
+
return new Cursor(this.measuredText, 0);
|
|
520
|
+
}
|
|
521
|
+
// Vim-specific word methods
|
|
522
|
+
// In Vim, a "word" is either:
|
|
523
|
+
// 1. A sequence of word characters (letters, digits, underscore) - including Unicode
|
|
524
|
+
// 2. A sequence of non-blank, non-word characters (punctuation/symbols)
|
|
525
|
+
nextVimWord() {
|
|
526
|
+
if (this.isAtEnd()) {
|
|
527
|
+
return this;
|
|
528
|
+
}
|
|
529
|
+
let pos = this.offset;
|
|
530
|
+
const advance = (p) => this.measuredText.nextOffset(p);
|
|
531
|
+
const currentGrapheme = this.graphemeAt(pos);
|
|
532
|
+
if (!currentGrapheme) {
|
|
533
|
+
return this;
|
|
534
|
+
}
|
|
535
|
+
if (isVimWordChar(currentGrapheme)) {
|
|
536
|
+
while (pos < this.text.length && isVimWordChar(this.graphemeAt(pos))) {
|
|
537
|
+
pos = advance(pos);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
else if (isVimPunctuation(currentGrapheme)) {
|
|
541
|
+
while (pos < this.text.length && isVimPunctuation(this.graphemeAt(pos))) {
|
|
542
|
+
pos = advance(pos);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
while (pos < this.text.length &&
|
|
546
|
+
WHITESPACE_REGEX.test(this.graphemeAt(pos))) {
|
|
547
|
+
pos = advance(pos);
|
|
548
|
+
}
|
|
549
|
+
return new Cursor(this.measuredText, pos);
|
|
550
|
+
}
|
|
551
|
+
endOfVimWord() {
|
|
552
|
+
if (this.isAtEnd()) {
|
|
553
|
+
return this;
|
|
554
|
+
}
|
|
555
|
+
const text = this.text;
|
|
556
|
+
let pos = this.offset;
|
|
557
|
+
const advance = (p) => this.measuredText.nextOffset(p);
|
|
558
|
+
if (this.graphemeAt(pos) === '') {
|
|
559
|
+
return this;
|
|
560
|
+
}
|
|
561
|
+
pos = advance(pos);
|
|
562
|
+
while (pos < text.length && WHITESPACE_REGEX.test(this.graphemeAt(pos))) {
|
|
563
|
+
pos = advance(pos);
|
|
564
|
+
}
|
|
565
|
+
if (pos >= text.length) {
|
|
566
|
+
return new Cursor(this.measuredText, text.length);
|
|
567
|
+
}
|
|
568
|
+
const charAtPos = this.graphemeAt(pos);
|
|
569
|
+
if (isVimWordChar(charAtPos)) {
|
|
570
|
+
while (pos < text.length) {
|
|
571
|
+
const nextPos = advance(pos);
|
|
572
|
+
if (nextPos >= text.length || !isVimWordChar(this.graphemeAt(nextPos)))
|
|
573
|
+
break;
|
|
574
|
+
pos = nextPos;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
else if (isVimPunctuation(charAtPos)) {
|
|
578
|
+
while (pos < text.length) {
|
|
579
|
+
const nextPos = advance(pos);
|
|
580
|
+
if (nextPos >= text.length ||
|
|
581
|
+
!isVimPunctuation(this.graphemeAt(nextPos)))
|
|
582
|
+
break;
|
|
583
|
+
pos = nextPos;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return new Cursor(this.measuredText, pos);
|
|
587
|
+
}
|
|
588
|
+
prevVimWord() {
|
|
589
|
+
if (this.isAtStart()) {
|
|
590
|
+
return this;
|
|
591
|
+
}
|
|
592
|
+
let pos = this.offset;
|
|
593
|
+
const retreat = (p) => this.measuredText.prevOffset(p);
|
|
594
|
+
pos = retreat(pos);
|
|
595
|
+
while (pos > 0 && WHITESPACE_REGEX.test(this.graphemeAt(pos))) {
|
|
596
|
+
pos = retreat(pos);
|
|
597
|
+
}
|
|
598
|
+
// At position 0 with whitespace means no previous word exists, go to start
|
|
599
|
+
if (pos === 0 && WHITESPACE_REGEX.test(this.graphemeAt(0))) {
|
|
600
|
+
return new Cursor(this.measuredText, 0);
|
|
601
|
+
}
|
|
602
|
+
const charAtPos = this.graphemeAt(pos);
|
|
603
|
+
if (isVimWordChar(charAtPos)) {
|
|
604
|
+
while (pos > 0) {
|
|
605
|
+
const prevPos = retreat(pos);
|
|
606
|
+
if (!isVimWordChar(this.graphemeAt(prevPos)))
|
|
607
|
+
break;
|
|
608
|
+
pos = prevPos;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
else if (isVimPunctuation(charAtPos)) {
|
|
612
|
+
while (pos > 0) {
|
|
613
|
+
const prevPos = retreat(pos);
|
|
614
|
+
if (!isVimPunctuation(this.graphemeAt(prevPos)))
|
|
615
|
+
break;
|
|
616
|
+
pos = prevPos;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
return new Cursor(this.measuredText, pos);
|
|
620
|
+
}
|
|
621
|
+
nextWORD() {
|
|
622
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
623
|
+
let nextCursor = this;
|
|
624
|
+
// If we're on a non-whitespace character, move to the next whitespace
|
|
625
|
+
while (!nextCursor.isOverWhitespace() && !nextCursor.isAtEnd()) {
|
|
626
|
+
nextCursor = nextCursor.right();
|
|
627
|
+
}
|
|
628
|
+
// now move to the next non-whitespace character
|
|
629
|
+
while (nextCursor.isOverWhitespace() && !nextCursor.isAtEnd()) {
|
|
630
|
+
nextCursor = nextCursor.right();
|
|
631
|
+
}
|
|
632
|
+
return nextCursor;
|
|
633
|
+
}
|
|
634
|
+
endOfWORD() {
|
|
635
|
+
if (this.isAtEnd()) {
|
|
636
|
+
return this;
|
|
637
|
+
}
|
|
638
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
639
|
+
let cursor = this;
|
|
640
|
+
// Check if we're already at the end of a WORD
|
|
641
|
+
// (current character is non-whitespace, but next character is whitespace or we're at the end)
|
|
642
|
+
const atEndOfWORD = !cursor.isOverWhitespace() &&
|
|
643
|
+
(cursor.right().isOverWhitespace() || cursor.right().isAtEnd());
|
|
644
|
+
if (atEndOfWORD) {
|
|
645
|
+
// We're already at the end of a WORD, move to the next WORD
|
|
646
|
+
cursor = cursor.right();
|
|
647
|
+
return cursor.endOfWORD();
|
|
648
|
+
}
|
|
649
|
+
// If we're on a whitespace character, find the next WORD
|
|
650
|
+
if (cursor.isOverWhitespace()) {
|
|
651
|
+
cursor = cursor.nextWORD();
|
|
652
|
+
}
|
|
653
|
+
// Now move to the end of the current WORD
|
|
654
|
+
while (!cursor.right().isOverWhitespace() && !cursor.isAtEnd()) {
|
|
655
|
+
cursor = cursor.right();
|
|
656
|
+
}
|
|
657
|
+
return cursor;
|
|
658
|
+
}
|
|
659
|
+
prevWORD() {
|
|
660
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
661
|
+
let cursor = this;
|
|
662
|
+
// if we are already at the beginning of a WORD, step off it
|
|
663
|
+
if (cursor.left().isOverWhitespace()) {
|
|
664
|
+
cursor = cursor.left();
|
|
665
|
+
}
|
|
666
|
+
// Move left over any whitespace characters
|
|
667
|
+
while (cursor.isOverWhitespace() && !cursor.isAtStart()) {
|
|
668
|
+
cursor = cursor.left();
|
|
669
|
+
}
|
|
670
|
+
// If we're over a non-whitespace character, move to the start of this WORD
|
|
671
|
+
if (!cursor.isOverWhitespace()) {
|
|
672
|
+
while (!cursor.left().isOverWhitespace() && !cursor.isAtStart()) {
|
|
673
|
+
cursor = cursor.left();
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
return cursor;
|
|
677
|
+
}
|
|
678
|
+
modifyText(end, insertString = '') {
|
|
679
|
+
const startOffset = this.offset;
|
|
680
|
+
const endOffset = end.offset;
|
|
681
|
+
const newText = this.text.slice(0, startOffset) +
|
|
682
|
+
insertString +
|
|
683
|
+
this.text.slice(endOffset);
|
|
684
|
+
return Cursor.fromText(newText, this.columns, startOffset + insertString.normalize('NFC').length);
|
|
685
|
+
}
|
|
686
|
+
insert(insertString) {
|
|
687
|
+
const newCursor = this.modifyText(this, insertString);
|
|
688
|
+
return newCursor;
|
|
689
|
+
}
|
|
690
|
+
del() {
|
|
691
|
+
if (this.isAtEnd()) {
|
|
692
|
+
return this;
|
|
693
|
+
}
|
|
694
|
+
return this.modifyText(this.right());
|
|
695
|
+
}
|
|
696
|
+
backspace() {
|
|
697
|
+
if (this.isAtStart()) {
|
|
698
|
+
return this;
|
|
699
|
+
}
|
|
700
|
+
return this.left().modifyText(this);
|
|
701
|
+
}
|
|
702
|
+
deleteToLineStart() {
|
|
703
|
+
// If cursor is right after a newline (at start of line), delete just that
|
|
704
|
+
// newline — symmetric with deleteToLineEnd's newline handling. This lets
|
|
705
|
+
// repeated ctrl+u clear across lines.
|
|
706
|
+
if (this.offset > 0 && this.text[this.offset - 1] === '\n') {
|
|
707
|
+
return { cursor: this.left().modifyText(this), killed: '\n' };
|
|
708
|
+
}
|
|
709
|
+
// Use startOfLine() so that at column 0 of a wrapped visual line,
|
|
710
|
+
// the cursor moves to the previous visual line's start instead of
|
|
711
|
+
// getting stuck.
|
|
712
|
+
const startCursor = this.startOfLine();
|
|
713
|
+
const killed = this.text.slice(startCursor.offset, this.offset);
|
|
714
|
+
return { cursor: startCursor.modifyText(this), killed };
|
|
715
|
+
}
|
|
716
|
+
deleteToLineEnd() {
|
|
717
|
+
// If cursor is on a newline character, delete just that character
|
|
718
|
+
if (this.text[this.offset] === '\n') {
|
|
719
|
+
return { cursor: this.modifyText(this.right()), killed: '\n' };
|
|
720
|
+
}
|
|
721
|
+
const endCursor = this.endOfLine();
|
|
722
|
+
const killed = this.text.slice(this.offset, endCursor.offset);
|
|
723
|
+
return { cursor: this.modifyText(endCursor), killed };
|
|
724
|
+
}
|
|
725
|
+
deleteToLogicalLineEnd() {
|
|
726
|
+
// If cursor is on a newline character, delete just that character
|
|
727
|
+
if (this.text[this.offset] === '\n') {
|
|
728
|
+
return this.modifyText(this.right());
|
|
729
|
+
}
|
|
730
|
+
return this.modifyText(this.endOfLogicalLine());
|
|
731
|
+
}
|
|
732
|
+
deleteWordBefore() {
|
|
733
|
+
if (this.isAtStart()) {
|
|
734
|
+
return { cursor: this, killed: '' };
|
|
735
|
+
}
|
|
736
|
+
const target = this.snapOutOfImageRef(this.prevWord().offset, 'start');
|
|
737
|
+
const prevWordCursor = new Cursor(this.measuredText, target);
|
|
738
|
+
const killed = this.text.slice(prevWordCursor.offset, this.offset);
|
|
739
|
+
return { cursor: prevWordCursor.modifyText(this), killed };
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Deletes a token before the cursor if one exists.
|
|
743
|
+
* Supports pasted text refs: [Pasted text #1], [Pasted text #1 +10 lines],
|
|
744
|
+
* [...Truncated text #1 +10 lines...]
|
|
745
|
+
*
|
|
746
|
+
* Note: @mentions are NOT tokenized since users may want to correct typos
|
|
747
|
+
* in file paths. Use Ctrl/Cmd+backspace for word-deletion on mentions.
|
|
748
|
+
*
|
|
749
|
+
* Returns null if no token found at cursor position.
|
|
750
|
+
* Only triggers when cursor is at end of token (followed by whitespace or EOL).
|
|
751
|
+
*/
|
|
752
|
+
deleteTokenBefore() {
|
|
753
|
+
// Cursor at chip.start is the "selected" state — backspace deletes the
|
|
754
|
+
// chip forward, not the char before it.
|
|
755
|
+
const chipAfter = this.imageRefStartingAt(this.offset);
|
|
756
|
+
if (chipAfter) {
|
|
757
|
+
const end = this.text[chipAfter.end] === ' ' ? chipAfter.end + 1 : chipAfter.end;
|
|
758
|
+
return this.modifyText(new Cursor(this.measuredText, end));
|
|
759
|
+
}
|
|
760
|
+
if (this.isAtStart()) {
|
|
761
|
+
return null;
|
|
762
|
+
}
|
|
763
|
+
// Only trigger if cursor is at a word boundary (whitespace or end of string after cursor)
|
|
764
|
+
const charAfter = this.text[this.offset];
|
|
765
|
+
if (charAfter !== undefined && !/\s/.test(charAfter)) {
|
|
766
|
+
return null;
|
|
767
|
+
}
|
|
768
|
+
const textBefore = this.text.slice(0, this.offset);
|
|
769
|
+
// Check for pasted/truncated text refs: [Pasted text #1] or [...Truncated text #1 +50 lines...]
|
|
770
|
+
const pasteMatch = textBefore.match(/(^|\s)\[(Pasted text #\d+(?: \+\d+ lines)?|Image #\d+|\.\.\.Truncated text #\d+ \+\d+ lines\.\.\.)\]$/);
|
|
771
|
+
if (pasteMatch) {
|
|
772
|
+
const matchStart = pasteMatch.index + pasteMatch[1].length;
|
|
773
|
+
return new Cursor(this.measuredText, matchStart).modifyText(this);
|
|
774
|
+
}
|
|
775
|
+
return null;
|
|
776
|
+
}
|
|
777
|
+
deleteWordAfter() {
|
|
778
|
+
if (this.isAtEnd()) {
|
|
779
|
+
return this;
|
|
780
|
+
}
|
|
781
|
+
const target = this.snapOutOfImageRef(this.nextWord().offset, 'end');
|
|
782
|
+
return this.modifyText(new Cursor(this.measuredText, target));
|
|
783
|
+
}
|
|
784
|
+
graphemeAt(pos) {
|
|
785
|
+
if (pos >= this.text.length)
|
|
786
|
+
return '';
|
|
787
|
+
const nextOff = this.measuredText.nextOffset(pos);
|
|
788
|
+
return this.text.slice(pos, nextOff);
|
|
789
|
+
}
|
|
790
|
+
isOverWhitespace() {
|
|
791
|
+
const currentChar = this.text[this.offset] ?? '';
|
|
792
|
+
return /\s/.test(currentChar);
|
|
793
|
+
}
|
|
794
|
+
equals(other) {
|
|
795
|
+
return (this.offset === other.offset && this.measuredText === other.measuredText);
|
|
796
|
+
}
|
|
797
|
+
isAtStart() {
|
|
798
|
+
return this.offset === 0;
|
|
799
|
+
}
|
|
800
|
+
isAtEnd() {
|
|
801
|
+
return this.offset >= this.text.length;
|
|
802
|
+
}
|
|
803
|
+
startOfFirstLine() {
|
|
804
|
+
// Go to the very beginning of the text (first character of first line)
|
|
805
|
+
return new Cursor(this.measuredText, 0, 0);
|
|
806
|
+
}
|
|
807
|
+
startOfLastLine() {
|
|
808
|
+
// Go to the beginning of the last line
|
|
809
|
+
const lastNewlineIndex = this.text.lastIndexOf('\n');
|
|
810
|
+
if (lastNewlineIndex === -1) {
|
|
811
|
+
// If there are no newlines, the text is a single line
|
|
812
|
+
return this.startOfLine();
|
|
813
|
+
}
|
|
814
|
+
// Position after the last newline character
|
|
815
|
+
return new Cursor(this.measuredText, lastNewlineIndex + 1, 0);
|
|
816
|
+
}
|
|
817
|
+
goToLine(lineNumber) {
|
|
818
|
+
// Go to the beginning of the specified logical line (1-indexed, like vim)
|
|
819
|
+
// Uses logical lines (separated by \n), not wrapped display lines
|
|
820
|
+
const lines = this.text.split('\n');
|
|
821
|
+
const targetLine = Math.min(Math.max(0, lineNumber - 1), lines.length - 1);
|
|
822
|
+
let offset = 0;
|
|
823
|
+
for (let i = 0; i < targetLine; i++) {
|
|
824
|
+
offset += (lines[i]?.length ?? 0) + 1; // +1 for newline
|
|
825
|
+
}
|
|
826
|
+
return new Cursor(this.measuredText, offset, 0);
|
|
827
|
+
}
|
|
828
|
+
endOfFile() {
|
|
829
|
+
return new Cursor(this.measuredText, this.text.length, 0);
|
|
830
|
+
}
|
|
831
|
+
get text() {
|
|
832
|
+
return this.measuredText.text;
|
|
833
|
+
}
|
|
834
|
+
get columns() {
|
|
835
|
+
return this.measuredText.columns + 1;
|
|
836
|
+
}
|
|
837
|
+
getPosition() {
|
|
838
|
+
return this.measuredText.getPositionFromOffset(this.offset);
|
|
839
|
+
}
|
|
840
|
+
getOffset(position) {
|
|
841
|
+
return this.measuredText.getOffsetFromPosition(position);
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Find a character using vim f/F/t/T semantics.
|
|
845
|
+
*
|
|
846
|
+
* @param char - The character to find
|
|
847
|
+
* @param type - 'f' (forward to), 'F' (backward to), 't' (forward till), 'T' (backward till)
|
|
848
|
+
* @param count - Find the Nth occurrence
|
|
849
|
+
* @returns The target offset, or null if not found
|
|
850
|
+
*/
|
|
851
|
+
findCharacter(char, type, count = 1) {
|
|
852
|
+
const text = this.text;
|
|
853
|
+
const forward = type === 'f' || type === 't';
|
|
854
|
+
const till = type === 't' || type === 'T';
|
|
855
|
+
let found = 0;
|
|
856
|
+
if (forward) {
|
|
857
|
+
let pos = this.measuredText.nextOffset(this.offset);
|
|
858
|
+
while (pos < text.length) {
|
|
859
|
+
const grapheme = this.graphemeAt(pos);
|
|
860
|
+
if (grapheme === char) {
|
|
861
|
+
found++;
|
|
862
|
+
if (found === count) {
|
|
863
|
+
return till
|
|
864
|
+
? Math.max(this.offset, this.measuredText.prevOffset(pos))
|
|
865
|
+
: pos;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
pos = this.measuredText.nextOffset(pos);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
if (this.offset === 0)
|
|
873
|
+
return null;
|
|
874
|
+
let pos = this.measuredText.prevOffset(this.offset);
|
|
875
|
+
while (pos >= 0) {
|
|
876
|
+
const grapheme = this.graphemeAt(pos);
|
|
877
|
+
if (grapheme === char) {
|
|
878
|
+
found++;
|
|
879
|
+
if (found === count) {
|
|
880
|
+
return till
|
|
881
|
+
? Math.min(this.offset, this.measuredText.nextOffset(pos))
|
|
882
|
+
: pos;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
if (pos === 0)
|
|
886
|
+
break;
|
|
887
|
+
pos = this.measuredText.prevOffset(pos);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
return null;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
class WrappedLine {
|
|
894
|
+
text;
|
|
895
|
+
startOffset;
|
|
896
|
+
isPrecededByNewline;
|
|
897
|
+
endsWithNewline;
|
|
898
|
+
constructor(text, startOffset, isPrecededByNewline, endsWithNewline = false) {
|
|
899
|
+
this.text = text;
|
|
900
|
+
this.startOffset = startOffset;
|
|
901
|
+
this.isPrecededByNewline = isPrecededByNewline;
|
|
902
|
+
this.endsWithNewline = endsWithNewline;
|
|
903
|
+
}
|
|
904
|
+
equals(other) {
|
|
905
|
+
return this.text === other.text && this.startOffset === other.startOffset;
|
|
906
|
+
}
|
|
907
|
+
get length() {
|
|
908
|
+
return this.text.length + (this.endsWithNewline ? 1 : 0);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
export class MeasuredText {
|
|
912
|
+
columns;
|
|
913
|
+
_wrappedLines;
|
|
914
|
+
text;
|
|
915
|
+
navigationCache;
|
|
916
|
+
graphemeBoundaries;
|
|
917
|
+
constructor(text, columns) {
|
|
918
|
+
this.columns = columns;
|
|
919
|
+
this.text = text.normalize('NFC');
|
|
920
|
+
this.navigationCache = new Map();
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Lazily computes and caches wrapped lines.
|
|
924
|
+
* This expensive operation is deferred until actually needed.
|
|
925
|
+
*/
|
|
926
|
+
get wrappedLines() {
|
|
927
|
+
if (!this._wrappedLines) {
|
|
928
|
+
this._wrappedLines = this.measureWrappedText();
|
|
929
|
+
}
|
|
930
|
+
return this._wrappedLines;
|
|
931
|
+
}
|
|
932
|
+
getGraphemeBoundaries() {
|
|
933
|
+
if (!this.graphemeBoundaries) {
|
|
934
|
+
this.graphemeBoundaries = [];
|
|
935
|
+
for (const { index } of getGraphemeSegmenter().segment(this.text)) {
|
|
936
|
+
this.graphemeBoundaries.push(index);
|
|
937
|
+
}
|
|
938
|
+
// Add the end of text as a boundary
|
|
939
|
+
this.graphemeBoundaries.push(this.text.length);
|
|
940
|
+
}
|
|
941
|
+
return this.graphemeBoundaries;
|
|
942
|
+
}
|
|
943
|
+
wordBoundariesCache;
|
|
944
|
+
/**
|
|
945
|
+
* Get word boundaries using Intl.Segmenter for proper Unicode word segmentation.
|
|
946
|
+
* This correctly handles CJK (Chinese, Japanese, Korean) text where each character
|
|
947
|
+
* is typically its own word, as well as scripts that use spaces between words.
|
|
948
|
+
*/
|
|
949
|
+
getWordBoundaries() {
|
|
950
|
+
if (!this.wordBoundariesCache) {
|
|
951
|
+
this.wordBoundariesCache = [];
|
|
952
|
+
for (const segment of getWordSegmenter().segment(this.text)) {
|
|
953
|
+
this.wordBoundariesCache.push({
|
|
954
|
+
start: segment.index,
|
|
955
|
+
end: segment.index + segment.segment.length,
|
|
956
|
+
isWordLike: segment.isWordLike ?? false,
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
return this.wordBoundariesCache;
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Binary search for boundaries.
|
|
964
|
+
* @param boundaries: Sorted array of boundaries
|
|
965
|
+
* @param target: Target offset
|
|
966
|
+
* @param findNext: If true, finds first boundary > target. If false, finds last boundary < target.
|
|
967
|
+
* @returns The found boundary index, or appropriate default
|
|
968
|
+
*/
|
|
969
|
+
binarySearchBoundary(boundaries, target, findNext) {
|
|
970
|
+
let left = 0;
|
|
971
|
+
let right = boundaries.length - 1;
|
|
972
|
+
let result = findNext ? this.text.length : 0;
|
|
973
|
+
while (left <= right) {
|
|
974
|
+
const mid = Math.floor((left + right) / 2);
|
|
975
|
+
const boundary = boundaries[mid];
|
|
976
|
+
if (boundary === undefined)
|
|
977
|
+
break;
|
|
978
|
+
if (findNext) {
|
|
979
|
+
if (boundary > target) {
|
|
980
|
+
result = boundary;
|
|
981
|
+
right = mid - 1;
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
left = mid + 1;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
else {
|
|
988
|
+
if (boundary < target) {
|
|
989
|
+
result = boundary;
|
|
990
|
+
left = mid + 1;
|
|
991
|
+
}
|
|
992
|
+
else {
|
|
993
|
+
right = mid - 1;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
return result;
|
|
998
|
+
}
|
|
999
|
+
// Convert string index to display width
|
|
1000
|
+
stringIndexToDisplayWidth(text, index) {
|
|
1001
|
+
if (index <= 0)
|
|
1002
|
+
return 0;
|
|
1003
|
+
if (index >= text.length)
|
|
1004
|
+
return stringWidth(text);
|
|
1005
|
+
return stringWidth(text.substring(0, index));
|
|
1006
|
+
}
|
|
1007
|
+
// Convert display width to string index
|
|
1008
|
+
displayWidthToStringIndex(text, targetWidth) {
|
|
1009
|
+
if (targetWidth <= 0)
|
|
1010
|
+
return 0;
|
|
1011
|
+
if (!text)
|
|
1012
|
+
return 0;
|
|
1013
|
+
// If the text matches our text, use the precomputed graphemes
|
|
1014
|
+
if (text === this.text) {
|
|
1015
|
+
return this.offsetAtDisplayWidth(targetWidth);
|
|
1016
|
+
}
|
|
1017
|
+
// Otherwise compute on the fly
|
|
1018
|
+
let currentWidth = 0;
|
|
1019
|
+
let currentOffset = 0;
|
|
1020
|
+
for (const { segment, index } of getGraphemeSegmenter().segment(text)) {
|
|
1021
|
+
const segmentWidth = stringWidth(segment);
|
|
1022
|
+
if (currentWidth + segmentWidth > targetWidth) {
|
|
1023
|
+
break;
|
|
1024
|
+
}
|
|
1025
|
+
currentWidth += segmentWidth;
|
|
1026
|
+
currentOffset = index + segment.length;
|
|
1027
|
+
}
|
|
1028
|
+
return currentOffset;
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Find the string offset that corresponds to a target display width.
|
|
1032
|
+
*/
|
|
1033
|
+
offsetAtDisplayWidth(targetWidth) {
|
|
1034
|
+
if (targetWidth <= 0)
|
|
1035
|
+
return 0;
|
|
1036
|
+
let currentWidth = 0;
|
|
1037
|
+
const boundaries = this.getGraphemeBoundaries();
|
|
1038
|
+
// Iterate through grapheme boundaries
|
|
1039
|
+
for (let i = 0; i < boundaries.length - 1; i++) {
|
|
1040
|
+
const start = boundaries[i];
|
|
1041
|
+
const end = boundaries[i + 1];
|
|
1042
|
+
if (start === undefined || end === undefined)
|
|
1043
|
+
continue;
|
|
1044
|
+
const segment = this.text.substring(start, end);
|
|
1045
|
+
const segmentWidth = stringWidth(segment);
|
|
1046
|
+
if (currentWidth + segmentWidth > targetWidth) {
|
|
1047
|
+
return start;
|
|
1048
|
+
}
|
|
1049
|
+
currentWidth += segmentWidth;
|
|
1050
|
+
}
|
|
1051
|
+
return this.text.length;
|
|
1052
|
+
}
|
|
1053
|
+
measureWrappedText() {
|
|
1054
|
+
const wrappedText = wrapAnsi(this.text, this.columns, {
|
|
1055
|
+
hard: true,
|
|
1056
|
+
trim: false,
|
|
1057
|
+
});
|
|
1058
|
+
const wrappedLines = [];
|
|
1059
|
+
let searchOffset = 0;
|
|
1060
|
+
let lastNewLinePos = -1;
|
|
1061
|
+
const lines = wrappedText.split('\n');
|
|
1062
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1063
|
+
const text = lines[i];
|
|
1064
|
+
const isPrecededByNewline = (startOffset) => i === 0 || (startOffset > 0 && this.text[startOffset - 1] === '\n');
|
|
1065
|
+
if (text.length === 0) {
|
|
1066
|
+
// For blank lines, find the next newline character after the last one
|
|
1067
|
+
lastNewLinePos = this.text.indexOf('\n', lastNewLinePos + 1);
|
|
1068
|
+
if (lastNewLinePos !== -1) {
|
|
1069
|
+
const startOffset = lastNewLinePos;
|
|
1070
|
+
const endsWithNewline = true;
|
|
1071
|
+
wrappedLines.push(new WrappedLine(text, startOffset, isPrecededByNewline(startOffset), endsWithNewline));
|
|
1072
|
+
}
|
|
1073
|
+
else {
|
|
1074
|
+
// If we can't find another newline, this must be the end of text
|
|
1075
|
+
const startOffset = this.text.length;
|
|
1076
|
+
wrappedLines.push(new WrappedLine(text, startOffset, isPrecededByNewline(startOffset), false));
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
else {
|
|
1080
|
+
// For non-blank lines, find the text in this.text
|
|
1081
|
+
const startOffset = this.text.indexOf(text, searchOffset);
|
|
1082
|
+
if (startOffset === -1) {
|
|
1083
|
+
throw new Error('Failed to find wrapped line in text');
|
|
1084
|
+
}
|
|
1085
|
+
searchOffset = startOffset + text.length;
|
|
1086
|
+
// Check if this line ends with a newline in this.text
|
|
1087
|
+
const potentialNewlinePos = startOffset + text.length;
|
|
1088
|
+
const endsWithNewline = potentialNewlinePos < this.text.length &&
|
|
1089
|
+
this.text[potentialNewlinePos] === '\n';
|
|
1090
|
+
if (endsWithNewline) {
|
|
1091
|
+
lastNewLinePos = potentialNewlinePos;
|
|
1092
|
+
}
|
|
1093
|
+
wrappedLines.push(new WrappedLine(text, startOffset, isPrecededByNewline(startOffset), endsWithNewline));
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return wrappedLines;
|
|
1097
|
+
}
|
|
1098
|
+
getWrappedText() {
|
|
1099
|
+
return this.wrappedLines.map(line => line.isPrecededByNewline ? line.text : line.text.trimStart());
|
|
1100
|
+
}
|
|
1101
|
+
getWrappedLines() {
|
|
1102
|
+
return this.wrappedLines;
|
|
1103
|
+
}
|
|
1104
|
+
getLine(line) {
|
|
1105
|
+
const lines = this.wrappedLines;
|
|
1106
|
+
return lines[Math.max(0, Math.min(line, lines.length - 1))];
|
|
1107
|
+
}
|
|
1108
|
+
getOffsetFromPosition(position) {
|
|
1109
|
+
const wrappedLine = this.getLine(position.line);
|
|
1110
|
+
// Handle blank lines specially
|
|
1111
|
+
if (wrappedLine.text.length === 0 && wrappedLine.endsWithNewline) {
|
|
1112
|
+
return wrappedLine.startOffset;
|
|
1113
|
+
}
|
|
1114
|
+
// Account for leading whitespace
|
|
1115
|
+
const leadingWhitespace = wrappedLine.isPrecededByNewline
|
|
1116
|
+
? 0
|
|
1117
|
+
: wrappedLine.text.length - wrappedLine.text.trimStart().length;
|
|
1118
|
+
// Convert display column to string index
|
|
1119
|
+
const displayColumnWithLeading = position.column + leadingWhitespace;
|
|
1120
|
+
const stringIndex = this.displayWidthToStringIndex(wrappedLine.text, displayColumnWithLeading);
|
|
1121
|
+
// Calculate the actual offset
|
|
1122
|
+
const offset = wrappedLine.startOffset + stringIndex;
|
|
1123
|
+
// For normal lines
|
|
1124
|
+
const lineEnd = wrappedLine.startOffset + wrappedLine.text.length;
|
|
1125
|
+
// Don't allow going past the end of the current line into the next line
|
|
1126
|
+
// unless we're at the very end of the text
|
|
1127
|
+
let maxOffset = lineEnd;
|
|
1128
|
+
const lineDisplayWidth = stringWidth(wrappedLine.text);
|
|
1129
|
+
if (wrappedLine.endsWithNewline && position.column > lineDisplayWidth) {
|
|
1130
|
+
// Allow positioning after the newline
|
|
1131
|
+
maxOffset = lineEnd + 1;
|
|
1132
|
+
}
|
|
1133
|
+
return Math.min(offset, maxOffset);
|
|
1134
|
+
}
|
|
1135
|
+
getLineLength(line) {
|
|
1136
|
+
const wrappedLine = this.getLine(line);
|
|
1137
|
+
return stringWidth(wrappedLine.text);
|
|
1138
|
+
}
|
|
1139
|
+
getPositionFromOffset(offset) {
|
|
1140
|
+
const lines = this.wrappedLines;
|
|
1141
|
+
for (let line = 0; line < lines.length; line++) {
|
|
1142
|
+
const currentLine = lines[line];
|
|
1143
|
+
const nextLine = lines[line + 1];
|
|
1144
|
+
if (offset >= currentLine.startOffset &&
|
|
1145
|
+
(!nextLine || offset < nextLine.startOffset)) {
|
|
1146
|
+
// Calculate string position within the line
|
|
1147
|
+
const stringPosInLine = offset - currentLine.startOffset;
|
|
1148
|
+
// Handle leading whitespace for wrapped lines
|
|
1149
|
+
let displayColumn;
|
|
1150
|
+
if (currentLine.isPrecededByNewline) {
|
|
1151
|
+
// For lines preceded by newline, calculate display width directly
|
|
1152
|
+
displayColumn = this.stringIndexToDisplayWidth(currentLine.text, stringPosInLine);
|
|
1153
|
+
}
|
|
1154
|
+
else {
|
|
1155
|
+
// For wrapped lines, we need to account for trimmed whitespace
|
|
1156
|
+
const leadingWhitespace = currentLine.text.length - currentLine.text.trimStart().length;
|
|
1157
|
+
if (stringPosInLine < leadingWhitespace) {
|
|
1158
|
+
// Cursor is in the trimmed whitespace area, position at start
|
|
1159
|
+
displayColumn = 0;
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
// Calculate display width from the trimmed text
|
|
1163
|
+
const trimmedText = currentLine.text.trimStart();
|
|
1164
|
+
const posInTrimmed = stringPosInLine - leadingWhitespace;
|
|
1165
|
+
displayColumn = this.stringIndexToDisplayWidth(trimmedText, posInTrimmed);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
return {
|
|
1169
|
+
line,
|
|
1170
|
+
column: Math.max(0, displayColumn),
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
// If we're past the last character, return the end of the last line
|
|
1175
|
+
const line = lines.length - 1;
|
|
1176
|
+
const lastLine = this.wrappedLines[line];
|
|
1177
|
+
return {
|
|
1178
|
+
line,
|
|
1179
|
+
column: stringWidth(lastLine.text),
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
get lineCount() {
|
|
1183
|
+
return this.wrappedLines.length;
|
|
1184
|
+
}
|
|
1185
|
+
withCache(key, compute) {
|
|
1186
|
+
const cached = this.navigationCache.get(key);
|
|
1187
|
+
if (cached !== undefined)
|
|
1188
|
+
return cached;
|
|
1189
|
+
const result = compute();
|
|
1190
|
+
this.navigationCache.set(key, result);
|
|
1191
|
+
return result;
|
|
1192
|
+
}
|
|
1193
|
+
nextOffset(offset) {
|
|
1194
|
+
return this.withCache(`next:${offset}`, () => {
|
|
1195
|
+
const boundaries = this.getGraphemeBoundaries();
|
|
1196
|
+
return this.binarySearchBoundary(boundaries, offset, true);
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
prevOffset(offset) {
|
|
1200
|
+
if (offset <= 0)
|
|
1201
|
+
return 0;
|
|
1202
|
+
return this.withCache(`prev:${offset}`, () => {
|
|
1203
|
+
const boundaries = this.getGraphemeBoundaries();
|
|
1204
|
+
return this.binarySearchBoundary(boundaries, offset, false);
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Snap an arbitrary code-unit offset to the start of the containing grapheme.
|
|
1209
|
+
* If offset is already on a boundary, returns it unchanged.
|
|
1210
|
+
*/
|
|
1211
|
+
snapToGraphemeBoundary(offset) {
|
|
1212
|
+
if (offset <= 0)
|
|
1213
|
+
return 0;
|
|
1214
|
+
if (offset >= this.text.length)
|
|
1215
|
+
return this.text.length;
|
|
1216
|
+
const boundaries = this.getGraphemeBoundaries();
|
|
1217
|
+
// Binary search for largest boundary <= offset
|
|
1218
|
+
let lo = 0;
|
|
1219
|
+
let hi = boundaries.length - 1;
|
|
1220
|
+
while (lo < hi) {
|
|
1221
|
+
const mid = (lo + hi + 1) >> 1;
|
|
1222
|
+
if (boundaries[mid] <= offset)
|
|
1223
|
+
lo = mid;
|
|
1224
|
+
else
|
|
1225
|
+
hi = mid - 1;
|
|
1226
|
+
}
|
|
1227
|
+
return boundaries[lo];
|
|
1228
|
+
}
|
|
1229
|
+
}
|