@aria-cli/cli 1.0.56 → 1.0.58
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/bin/aria.mjs +2 -2
- package/package.json +17 -76
- package/dist/.tsbuildinfo +0 -1
- package/dist/attached-local-control-client.js +0 -826
- package/dist/attached-local-control-client.js.map +0 -1
- package/dist/bootstrap-local-control-client.js +0 -2
- package/dist/bootstrap-local-control-client.js.map +0 -1
- package/dist/capability-aware-method-proxy.js +0 -42
- package/dist/capability-aware-method-proxy.js.map +0 -1
- package/dist/cli-context.js +0 -160
- package/dist/cli-context.js.map +0 -1
- package/dist/commands/arions.js +0 -174
- package/dist/commands/arions.js.map +0 -1
- package/dist/commands/auth.js +0 -123
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/daemon.js +0 -367
- package/dist/commands/daemon.js.map +0 -1
- package/dist/commands/definitions.js +0 -176
- package/dist/commands/definitions.js.map +0 -1
- package/dist/commands/index.js +0 -80
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/login-handler.js +0 -1108
- package/dist/commands/login-handler.js.map +0 -1
- package/dist/commands/logout-handler.js +0 -92
- package/dist/commands/logout-handler.js.map +0 -1
- package/dist/commands/memory-handlers.js +0 -89
- package/dist/commands/memory-handlers.js.map +0 -1
- package/dist/commands/pairing.js +0 -60
- package/dist/commands/pairing.js.map +0 -1
- package/dist/commands/runtime-cutover-reset-command.js +0 -12
- package/dist/commands/runtime-cutover-reset-command.js.map +0 -1
- package/dist/commands/runtime-cutover-reset.js +0 -265
- package/dist/commands/runtime-cutover-reset.js.map +0 -1
- package/dist/commands/terminal-setup.js +0 -84
- package/dist/commands/terminal-setup.js.map +0 -1
- package/dist/config/aria-config.js +0 -238
- package/dist/config/aria-config.js.map +0 -1
- package/dist/config/index.js +0 -3
- package/dist/config/index.js.map +0 -1
- package/dist/config/loader.js +0 -97
- package/dist/config/loader.js.map +0 -1
- package/dist/config.js +0 -142
- package/dist/config.js.map +0 -1
- package/dist/daemon-info.js +0 -10
- package/dist/daemon-info.js.map +0 -1
- package/dist/ensure-daemon.js +0 -128
- package/dist/ensure-daemon.js.map +0 -1
- package/dist/entrypoints/command-mode.js +0 -5
- package/dist/entrypoints/command-mode.js.map +0 -1
- package/dist/entrypoints/daemon.js +0 -50
- package/dist/entrypoints/daemon.js.map +0 -1
- package/dist/entrypoints/headless-stdio.js +0 -25
- package/dist/entrypoints/headless-stdio.js.map +0 -1
- package/dist/entrypoints/interactive.d.ts.map +0 -1
- package/dist/entrypoints/interactive.js +0 -80
- package/dist/entrypoints/interactive.js.map +0 -1
- package/dist/event-loop-watchdog.js +0 -73
- package/dist/event-loop-watchdog.js.map +0 -1
- package/dist/headless/auth-orchestrator.js +0 -508
- package/dist/headless/auth-orchestrator.js.map +0 -1
- package/dist/headless/auth-service.js +0 -43
- package/dist/headless/auth-service.js.map +0 -1
- package/dist/headless/bootstrap-fast-path.js +0 -112
- package/dist/headless/bootstrap-fast-path.js.map +0 -1
- package/dist/headless/call-command.js +0 -143
- package/dist/headless/call-command.js.map +0 -1
- package/dist/headless/daemon-service.js +0 -318
- package/dist/headless/daemon-service.js.map +0 -1
- package/dist/headless/hook-actions.js +0 -235
- package/dist/headless/hook-actions.js.map +0 -1
- package/dist/headless/hook-service.js +0 -42
- package/dist/headless/hook-service.js.map +0 -1
- package/dist/headless/kernel-services.js +0 -216
- package/dist/headless/kernel-services.js.map +0 -1
- package/dist/headless/kernel.js +0 -785
- package/dist/headless/kernel.js.map +0 -1
- package/dist/headless/operations/arion.js +0 -119
- package/dist/headless/operations/arion.js.map +0 -1
- package/dist/headless/operations/auth.js +0 -45
- package/dist/headless/operations/auth.js.map +0 -1
- package/dist/headless/operations/client.js +0 -31
- package/dist/headless/operations/client.js.map +0 -1
- package/dist/headless/operations/config.js +0 -69
- package/dist/headless/operations/config.js.map +0 -1
- package/dist/headless/operations/daemon.js +0 -47
- package/dist/headless/operations/daemon.js.map +0 -1
- package/dist/headless/operations/hook.js +0 -56
- package/dist/headless/operations/hook.js.map +0 -1
- package/dist/headless/operations/index.js +0 -11
- package/dist/headless/operations/index.js.map +0 -1
- package/dist/headless/operations/memory.js +0 -102
- package/dist/headless/operations/memory.js.map +0 -1
- package/dist/headless/operations/message.js +0 -279
- package/dist/headless/operations/message.js.map +0 -1
- package/dist/headless/operations/model.js +0 -100
- package/dist/headless/operations/model.js.map +0 -1
- package/dist/headless/operations/peer.js +0 -56
- package/dist/headless/operations/peer.js.map +0 -1
- package/dist/headless/operations/run.js +0 -24
- package/dist/headless/operations/run.js.map +0 -1
- package/dist/headless/operations/session.js +0 -90
- package/dist/headless/operations/session.js.map +0 -1
- package/dist/headless/operations/system.js +0 -19
- package/dist/headless/operations/system.js.map +0 -1
- package/dist/headless/operations/utils.js +0 -35
- package/dist/headless/operations/utils.js.map +0 -1
- package/dist/headless/run-orchestrator.js +0 -703
- package/dist/headless/run-orchestrator.js.map +0 -1
- package/dist/headless/stdio-server.js +0 -439
- package/dist/headless/stdio-server.js.map +0 -1
- package/dist/history/SessionHistory.js +0 -8
- package/dist/history/SessionHistory.js.map +0 -1
- package/dist/history/SessionHistoryClient.js +0 -186
- package/dist/history/SessionHistoryClient.js.map +0 -1
- package/dist/history/conversation-message.js +0 -112
- package/dist/history/conversation-message.js.map +0 -1
- package/dist/history/index.js +0 -8
- package/dist/history/index.js.map +0 -1
- package/dist/history/jsonl-replay.js +0 -154
- package/dist/history/jsonl-replay.js.map +0 -1
- package/dist/history/repair-tool-pairing.js +0 -84
- package/dist/history/repair-tool-pairing.js.map +0 -1
- package/dist/history/stall-phase-bridge.js +0 -11
- package/dist/history/stall-phase-bridge.js.map +0 -1
- package/dist/history/turn-accumulator.js +0 -427
- package/dist/history/turn-accumulator.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/ink-repl.d.ts.map +0 -1
- package/dist/ink-repl.js +0 -4183
- package/dist/ink-repl.js.map +0 -1
- package/dist/local-control-bootstrap.js +0 -26
- package/dist/local-control-bootstrap.js.map +0 -1
- package/dist/local-control-client.js +0 -2
- package/dist/local-control-client.js.map +0 -1
- package/dist/local-control-error-reporting.js +0 -34
- package/dist/local-control-error-reporting.js.map +0 -1
- package/dist/local-control-http-client.js +0 -362
- package/dist/local-control-http-client.js.map +0 -1
- package/dist/local-control-lazy-wrapper.js +0 -363
- package/dist/local-control-lazy-wrapper.js.map +0 -1
- package/dist/local-control-manager.js +0 -146
- package/dist/local-control-manager.js.map +0 -1
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -62
- package/dist/main.js.map +0 -1
- package/dist/network-security.js +0 -62
- package/dist/network-security.js.map +0 -1
- package/dist/networking-server.js +0 -38
- package/dist/networking-server.js.map +0 -1
- package/dist/peer-identity.js +0 -23
- package/dist/peer-identity.js.map +0 -1
- package/dist/polling-subscription.js +0 -34
- package/dist/polling-subscription.js.map +0 -1
- package/dist/relaunch.d.ts +0 -63
- package/dist/relaunch.d.ts.map +0 -1
- package/dist/relaunch.js +0 -617
- package/dist/relaunch.js.map +0 -1
- package/dist/release-notes.js +0 -35
- package/dist/release-notes.js.map +0 -1
- package/dist/repl-cleanup.js +0 -47
- package/dist/repl-cleanup.js.map +0 -1
- package/dist/runtime/configure-bun-sqlite.js +0 -3
- package/dist/runtime/configure-bun-sqlite.js.map +0 -1
- package/dist/runtime/crash-handlers.js +0 -111
- package/dist/runtime/crash-handlers.js.map +0 -1
- package/dist/runtime/interactive-invocation.js +0 -39
- package/dist/runtime/interactive-invocation.js.map +0 -1
- package/dist/runtime/internal-mode.js +0 -14
- package/dist/runtime/internal-mode.js.map +0 -1
- package/dist/runtime/launch-spec.js +0 -64
- package/dist/runtime/launch-spec.js.map +0 -1
- package/dist/runtime/owner-lease.js +0 -44
- package/dist/runtime/owner-lease.js.map +0 -1
- package/dist/runtime/public-mode.js +0 -20
- package/dist/runtime/public-mode.js.map +0 -1
- package/dist/runtime/run-internal-mode.d.ts.map +0 -1
- package/dist/runtime/run-internal-mode.js +0 -18
- package/dist/runtime/run-internal-mode.js.map +0 -1
- package/dist/runtime/runtime-kind.js +0 -32
- package/dist/runtime/runtime-kind.js.map +0 -1
- package/dist/runtime/spawn-aria.js +0 -38
- package/dist/runtime/spawn-aria.js.map +0 -1
- package/dist/selectable-client.js +0 -2
- package/dist/selectable-client.js.map +0 -1
- package/dist/selectable-peer.js +0 -2
- package/dist/selectable-peer.js.map +0 -1
- package/dist/session.js +0 -203
- package/dist/session.js.map +0 -1
- package/dist/slash-commands.js +0 -80
- package/dist/slash-commands.js.map +0 -1
- package/dist/sounds.js +0 -210
- package/dist/sounds.js.map +0 -1
- package/dist/ui/App.js +0 -526
- package/dist/ui/App.js.map +0 -1
- package/dist/ui/components/AnthropicMethodPicker.js +0 -6
- package/dist/ui/components/AnthropicMethodPicker.js.map +0 -1
- package/dist/ui/components/ArionPrompt.js +0 -15
- package/dist/ui/components/ArionPrompt.js.map +0 -1
- package/dist/ui/components/AutocompleteDropdown.js +0 -23
- package/dist/ui/components/AutocompleteDropdown.js.map +0 -1
- package/dist/ui/components/AutonomySelector.js +0 -55
- package/dist/ui/components/AutonomySelector.js.map +0 -1
- package/dist/ui/components/Banner.js +0 -98
- package/dist/ui/components/Banner.js.map +0 -1
- package/dist/ui/components/ConversationHistory.js +0 -175
- package/dist/ui/components/ConversationHistory.js.map +0 -1
- package/dist/ui/components/CopilotDeviceLoginFlow.js +0 -88
- package/dist/ui/components/CopilotDeviceLoginFlow.js.map +0 -1
- package/dist/ui/components/CopilotSourcePicker.js +0 -50
- package/dist/ui/components/CopilotSourcePicker.js.map +0 -1
- package/dist/ui/components/Cost.js +0 -10
- package/dist/ui/components/Cost.js.map +0 -1
- package/dist/ui/components/CustomSelect/option-map.js +0 -30
- package/dist/ui/components/CustomSelect/option-map.js.map +0 -1
- package/dist/ui/components/CustomSelect/select-option.js +0 -13
- package/dist/ui/components/CustomSelect/select-option.js.map +0 -1
- package/dist/ui/components/CustomSelect/select.js +0 -42
- package/dist/ui/components/CustomSelect/select.js.map +0 -1
- package/dist/ui/components/CustomSelect/use-select-state.js +0 -179
- package/dist/ui/components/CustomSelect/use-select-state.js.map +0 -1
- package/dist/ui/components/CustomSelect/use-select.js +0 -15
- package/dist/ui/components/CustomSelect/use-select.js.map +0 -1
- package/dist/ui/components/ErrorDisplay.js +0 -35
- package/dist/ui/components/ErrorDisplay.js.map +0 -1
- package/dist/ui/components/FallbackToolUseRejectedMessage.js +0 -7
- package/dist/ui/components/FallbackToolUseRejectedMessage.js.map +0 -1
- package/dist/ui/components/FileEditToolUpdatedMessage.js +0 -57
- package/dist/ui/components/FileEditToolUpdatedMessage.js.map +0 -1
- package/dist/ui/components/HandoffMarker.js +0 -18
- package/dist/ui/components/HandoffMarker.js.map +0 -1
- package/dist/ui/components/HighlightedCode.js +0 -21
- package/dist/ui/components/HighlightedCode.js.map +0 -1
- package/dist/ui/components/InputArea.js +0 -187
- package/dist/ui/components/InputArea.js.map +0 -1
- package/dist/ui/components/Message.js +0 -25
- package/dist/ui/components/Message.js.map +0 -1
- package/dist/ui/components/OAuthLoginFlow.js +0 -113
- package/dist/ui/components/OAuthLoginFlow.js.map +0 -1
- package/dist/ui/components/OutputTruncation.js +0 -35
- package/dist/ui/components/OutputTruncation.js.map +0 -1
- package/dist/ui/components/PermissionPrompt.js +0 -79
- package/dist/ui/components/PermissionPrompt.js.map +0 -1
- package/dist/ui/components/PipelineTimingPanel.js +0 -15
- package/dist/ui/components/PipelineTimingPanel.js.map +0 -1
- package/dist/ui/components/ProviderMethodPicker.js +0 -61
- package/dist/ui/components/ProviderMethodPicker.js.map +0 -1
- package/dist/ui/components/ProviderPicker.js +0 -63
- package/dist/ui/components/ProviderPicker.js.map +0 -1
- package/dist/ui/components/RenderItemView.js +0 -71
- package/dist/ui/components/RenderItemView.js.map +0 -1
- package/dist/ui/components/Spinner.js +0 -46
- package/dist/ui/components/Spinner.js.map +0 -1
- package/dist/ui/components/StatusBar.js +0 -95
- package/dist/ui/components/StatusBar.js.map +0 -1
- package/dist/ui/components/StreamingIndicator.js +0 -55
- package/dist/ui/components/StreamingIndicator.js.map +0 -1
- package/dist/ui/components/StructuredDiff.js +0 -168
- package/dist/ui/components/StructuredDiff.js.map +0 -1
- package/dist/ui/components/TextInputOverlay.js +0 -43
- package/dist/ui/components/TextInputOverlay.js.map +0 -1
- package/dist/ui/components/ThinkingBlock.js +0 -82
- package/dist/ui/components/ThinkingBlock.js.map +0 -1
- package/dist/ui/components/ToolCost.js +0 -17
- package/dist/ui/components/ToolCost.js.map +0 -1
- package/dist/ui/components/ToolExecution.js +0 -61
- package/dist/ui/components/ToolExecution.js.map +0 -1
- package/dist/ui/components/ToolHeader.js +0 -51
- package/dist/ui/components/ToolHeader.js.map +0 -1
- package/dist/ui/components/ToolRenderLayoutContext.js +0 -14
- package/dist/ui/components/ToolRenderLayoutContext.js.map +0 -1
- package/dist/ui/components/ToolResultWrapper.js +0 -6
- package/dist/ui/components/ToolResultWrapper.js.map +0 -1
- package/dist/ui/components/ToolUseLoader.js +0 -35
- package/dist/ui/components/ToolUseLoader.js.map +0 -1
- package/dist/ui/components/TraceWaterfall.js +0 -91
- package/dist/ui/components/TraceWaterfall.js.map +0 -1
- package/dist/ui/components/index.js +0 -33
- package/dist/ui/components/index.js.map +0 -1
- package/dist/ui/components/messages/AssistantTextMessage.js +0 -25
- package/dist/ui/components/messages/AssistantTextMessage.js.map +0 -1
- package/dist/ui/components/messages/UserImageMessage.js +0 -12
- package/dist/ui/components/messages/UserImageMessage.js.map +0 -1
- package/dist/ui/components/messages/UserTextMessage.js +0 -12
- package/dist/ui/components/messages/UserTextMessage.js.map +0 -1
- package/dist/ui/components/overlays/ArionSelector.js +0 -68
- package/dist/ui/components/overlays/ArionSelector.js.map +0 -1
- package/dist/ui/components/overlays/ClientSelector.js +0 -62
- package/dist/ui/components/overlays/ClientSelector.js.map +0 -1
- package/dist/ui/components/overlays/CommandPalette.js +0 -67
- package/dist/ui/components/overlays/CommandPalette.js.map +0 -1
- package/dist/ui/components/overlays/DaemonControl.js +0 -87
- package/dist/ui/components/overlays/DaemonControl.js.map +0 -1
- package/dist/ui/components/overlays/InviteShareOverlay.js +0 -15
- package/dist/ui/components/overlays/InviteShareOverlay.js.map +0 -1
- package/dist/ui/components/overlays/JoinInviteOverlay.js +0 -32
- package/dist/ui/components/overlays/JoinInviteOverlay.js.map +0 -1
- package/dist/ui/components/overlays/MemoryBrowser.js +0 -100
- package/dist/ui/components/overlays/MemoryBrowser.js.map +0 -1
- package/dist/ui/components/overlays/MessageSelector.js +0 -123
- package/dist/ui/components/overlays/MessageSelector.js.map +0 -1
- package/dist/ui/components/overlays/ModelSelector.js +0 -211
- package/dist/ui/components/overlays/ModelSelector.js.map +0 -1
- package/dist/ui/components/overlays/PairRequestOverlay.js +0 -42
- package/dist/ui/components/overlays/PairRequestOverlay.js.map +0 -1
- package/dist/ui/components/overlays/PeerSelector.js +0 -84
- package/dist/ui/components/overlays/PeerSelector.js.map +0 -1
- package/dist/ui/components/overlays/SessionSelector.js +0 -102
- package/dist/ui/components/overlays/SessionSelector.js.map +0 -1
- package/dist/ui/components/overlays/SoundSelector.js +0 -86
- package/dist/ui/components/overlays/SoundSelector.js.map +0 -1
- package/dist/ui/components/overlays/ThemeSelector.js +0 -139
- package/dist/ui/components/overlays/ThemeSelector.js.map +0 -1
- package/dist/ui/components/overlays/index.js +0 -15
- package/dist/ui/components/overlays/index.js.map +0 -1
- package/dist/ui/components/permissions/BashPermissionRequest/BashPermissionRequest.js +0 -53
- package/dist/ui/components/permissions/BashPermissionRequest/BashPermissionRequest.js.map +0 -1
- package/dist/ui/components/permissions/FallbackPermissionRequest.js +0 -56
- package/dist/ui/components/permissions/FallbackPermissionRequest.js.map +0 -1
- package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +0 -76
- package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js.map +0 -1
- package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditToolDiff.js +0 -18
- package/dist/ui/components/permissions/FileEditPermissionRequest/FileEditToolDiff.js.map +0 -1
- package/dist/ui/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +0 -64
- package/dist/ui/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js.map +0 -1
- package/dist/ui/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +0 -26
- package/dist/ui/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js.map +0 -1
- package/dist/ui/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +0 -141
- package/dist/ui/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js.map +0 -1
- package/dist/ui/components/permissions/PermissionRequest.js +0 -70
- package/dist/ui/components/permissions/PermissionRequest.js.map +0 -1
- package/dist/ui/components/permissions/PermissionRequestTitle.js +0 -41
- package/dist/ui/components/permissions/PermissionRequestTitle.js.map +0 -1
- package/dist/ui/components/permissions/hooks.js +0 -10
- package/dist/ui/components/permissions/hooks.js.map +0 -1
- package/dist/ui/components/permissions/toolUseOptions.js +0 -68
- package/dist/ui/components/permissions/toolUseOptions.js.map +0 -1
- package/dist/ui/components/permissions/utils.js +0 -10
- package/dist/ui/components/permissions/utils.js.map +0 -1
- package/dist/ui/components/text-input/Cursor.js +0 -326
- package/dist/ui/components/text-input/Cursor.js.map +0 -1
- package/dist/ui/components/text-input/TextInput.js +0 -231
- package/dist/ui/components/text-input/TextInput.js.map +0 -1
- package/dist/ui/components/text-input/imagePaste.js +0 -28
- package/dist/ui/components/text-input/imagePaste.js.map +0 -1
- package/dist/ui/components/text-input/index.js +0 -6
- package/dist/ui/components/text-input/index.js.map +0 -1
- package/dist/ui/components/text-input/useDoublePress.js +0 -30
- package/dist/ui/components/text-input/useDoublePress.js.map +0 -1
- package/dist/ui/components/text-input/useTextInput.js +0 -245
- package/dist/ui/components/text-input/useTextInput.js.map +0 -1
- package/dist/ui/components/tool-types.js +0 -9
- package/dist/ui/components/tool-types.js.map +0 -1
- package/dist/ui/constants/figures.js +0 -4
- package/dist/ui/constants/figures.js.map +0 -1
- package/dist/ui/constants/index.js +0 -3
- package/dist/ui/constants/index.js.map +0 -1
- package/dist/ui/display-mode.js +0 -93
- package/dist/ui/display-mode.js.map +0 -1
- package/dist/ui/display-policy.js +0 -19
- package/dist/ui/display-policy.js.map +0 -1
- package/dist/ui/hooks/index.js +0 -6
- package/dist/ui/hooks/index.js.map +0 -1
- package/dist/ui/hooks/useCommandAutocomplete.js +0 -93
- package/dist/ui/hooks/useCommandAutocomplete.js.map +0 -1
- package/dist/ui/hooks/useDoublePress.js +0 -37
- package/dist/ui/hooks/useDoublePress.js.map +0 -1
- package/dist/ui/hooks/useIndicatorState.js +0 -55
- package/dist/ui/hooks/useIndicatorState.js.map +0 -1
- package/dist/ui/hooks/useInterval.js +0 -23
- package/dist/ui/hooks/useInterval.js.map +0 -1
- package/dist/ui/hooks/useKeyboardShortcuts.js +0 -127
- package/dist/ui/hooks/useKeyboardShortcuts.js.map +0 -1
- package/dist/ui/hooks/useTerminalSize.js +0 -55
- package/dist/ui/hooks/useTerminalSize.js.map +0 -1
- package/dist/ui/hooks/useUnifiedMessages.js +0 -117
- package/dist/ui/hooks/useUnifiedMessages.js.map +0 -1
- package/dist/ui/indicator-state.js +0 -44
- package/dist/ui/indicator-state.js.map +0 -1
- package/dist/ui/markdown/highlight.js +0 -44
- package/dist/ui/markdown/highlight.js.map +0 -1
- package/dist/ui/markdown/index.js +0 -1460
- package/dist/ui/markdown/index.js.map +0 -1
- package/dist/ui/markdown/tokenizer.js +0 -24
- package/dist/ui/markdown/tokenizer.js.map +0 -1
- package/dist/ui/render-item.js +0 -5
- package/dist/ui/render-item.js.map +0 -1
- package/dist/ui/screens/REPL.js +0 -119
- package/dist/ui/screens/REPL.js.map +0 -1
- package/dist/ui/screens/approval-lifecycle.js +0 -38
- package/dist/ui/screens/approval-lifecycle.js.map +0 -1
- package/dist/ui/status-line.js +0 -72
- package/dist/ui/status-line.js.map +0 -1
- package/dist/ui/theme/index.js +0 -51
- package/dist/ui/theme/index.js.map +0 -1
- package/dist/ui/theme/themes/claude-dark-daltonized.js +0 -51
- package/dist/ui/theme/themes/claude-dark-daltonized.js.map +0 -1
- package/dist/ui/theme/themes/claude-dark.js +0 -50
- package/dist/ui/theme/themes/claude-dark.js.map +0 -1
- package/dist/ui/theme/themes/claude-light-daltonized.js +0 -51
- package/dist/ui/theme/themes/claude-light-daltonized.js.map +0 -1
- package/dist/ui/theme/themes/claude-light.js +0 -50
- package/dist/ui/theme/themes/claude-light.js.map +0 -1
- package/dist/ui/theme/themes/dark-accessible.js +0 -18
- package/dist/ui/theme/themes/dark-accessible.js.map +0 -1
- package/dist/ui/theme/themes/dark.js +0 -49
- package/dist/ui/theme/themes/dark.js.map +0 -1
- package/dist/ui/theme/themes/light-accessible.js +0 -18
- package/dist/ui/theme/themes/light-accessible.js.map +0 -1
- package/dist/ui/theme/themes/light.js +0 -49
- package/dist/ui/theme/themes/light.js.map +0 -1
- package/dist/ui/theme/types.js +0 -3
- package/dist/ui/theme/types.js.map +0 -1
- package/dist/ui/theme.js +0 -142
- package/dist/ui/theme.js.map +0 -1
- package/dist/ui/to-render-items.js +0 -145
- package/dist/ui/to-render-items.js.map +0 -1
- package/dist/ui/tools/AgentTool/index.js +0 -30
- package/dist/ui/tools/AgentTool/index.js.map +0 -1
- package/dist/ui/tools/ArchitectTool/index.js +0 -31
- package/dist/ui/tools/ArchitectTool/index.js.map +0 -1
- package/dist/ui/tools/AskUserTool/index.js +0 -46
- package/dist/ui/tools/AskUserTool/index.js.map +0 -1
- package/dist/ui/tools/BashTool/BashToolResultMessage.js +0 -11
- package/dist/ui/tools/BashTool/BashToolResultMessage.js.map +0 -1
- package/dist/ui/tools/BashTool/OutputLine.js +0 -21
- package/dist/ui/tools/BashTool/OutputLine.js.map +0 -1
- package/dist/ui/tools/BashTool/index.js +0 -91
- package/dist/ui/tools/BashTool/index.js.map +0 -1
- package/dist/ui/tools/BrowseTool/index.js +0 -43
- package/dist/ui/tools/BrowseTool/index.js.map +0 -1
- package/dist/ui/tools/BrowserTool/index.js +0 -47
- package/dist/ui/tools/BrowserTool/index.js.map +0 -1
- package/dist/ui/tools/CbmTool/index.js +0 -188
- package/dist/ui/tools/CbmTool/index.js.map +0 -1
- package/dist/ui/tools/CheckDelegationTool/index.js +0 -46
- package/dist/ui/tools/CheckDelegationTool/index.js.map +0 -1
- package/dist/ui/tools/CheckMessagesTool/index.js +0 -85
- package/dist/ui/tools/CheckMessagesTool/index.js.map +0 -1
- package/dist/ui/tools/CreateQuipTool/index.js +0 -30
- package/dist/ui/tools/CreateQuipTool/index.js.map +0 -1
- package/dist/ui/tools/CreateSkillTool/index.js +0 -22
- package/dist/ui/tools/CreateSkillTool/index.js.map +0 -1
- package/dist/ui/tools/CreateToolTool/index.js +0 -31
- package/dist/ui/tools/CreateToolTool/index.js.map +0 -1
- package/dist/ui/tools/DelegateRemoteTool/index.js +0 -42
- package/dist/ui/tools/DelegateRemoteTool/index.js.map +0 -1
- package/dist/ui/tools/DeployTool/index.js +0 -47
- package/dist/ui/tools/DeployTool/index.js.map +0 -1
- package/dist/ui/tools/FffTool/index.js +0 -103
- package/dist/ui/tools/FffTool/index.js.map +0 -1
- package/dist/ui/tools/FileEditTool/index.js +0 -67
- package/dist/ui/tools/FileEditTool/index.js.map +0 -1
- package/dist/ui/tools/FileReadTool/index.js +0 -68
- package/dist/ui/tools/FileReadTool/index.js.map +0 -1
- package/dist/ui/tools/FileWriteTool/index.js +0 -61
- package/dist/ui/tools/FileWriteTool/index.js.map +0 -1
- package/dist/ui/tools/ForkTool/index.js +0 -47
- package/dist/ui/tools/ForkTool/index.js.map +0 -1
- package/dist/ui/tools/FrgTool/index.js +0 -96
- package/dist/ui/tools/FrgTool/index.js.map +0 -1
- package/dist/ui/tools/GetThreadTool/index.js +0 -39
- package/dist/ui/tools/GetThreadTool/index.js.map +0 -1
- package/dist/ui/tools/GlobTool/index.js +0 -50
- package/dist/ui/tools/GlobTool/index.js.map +0 -1
- package/dist/ui/tools/GrepTool/index.js +0 -84
- package/dist/ui/tools/GrepTool/index.js.map +0 -1
- package/dist/ui/tools/HatchArionTool/index.js +0 -36
- package/dist/ui/tools/HatchArionTool/index.js.map +0 -1
- package/dist/ui/tools/LearnSkillTool/index.js +0 -22
- package/dist/ui/tools/LearnSkillTool/index.js.map +0 -1
- package/dist/ui/tools/LearnTool/index.js +0 -43
- package/dist/ui/tools/LearnTool/index.js.map +0 -1
- package/dist/ui/tools/LearnToolTool/index.js +0 -22
- package/dist/ui/tools/LearnToolTool/index.js.map +0 -1
- package/dist/ui/tools/ListClientsTool/index.js +0 -39
- package/dist/ui/tools/ListClientsTool/index.js.map +0 -1
- package/dist/ui/tools/LspTool/index.js +0 -261
- package/dist/ui/tools/LspTool/index.js.map +0 -1
- package/dist/ui/tools/MCPTool/index.js +0 -33
- package/dist/ui/tools/MCPTool/index.js.map +0 -1
- package/dist/ui/tools/ManageNetworkTool/index.js +0 -53
- package/dist/ui/tools/ManageNetworkTool/index.js.map +0 -1
- package/dist/ui/tools/MemoryReadTool/index.js +0 -64
- package/dist/ui/tools/MemoryReadTool/index.js.map +0 -1
- package/dist/ui/tools/MemoryWriteTool/index.js +0 -20
- package/dist/ui/tools/MemoryWriteTool/index.js.map +0 -1
- package/dist/ui/tools/NotebookEditTool/index.js +0 -33
- package/dist/ui/tools/NotebookEditTool/index.js.map +0 -1
- package/dist/ui/tools/NotebookReadTool/index.js +0 -25
- package/dist/ui/tools/NotebookReadTool/index.js.map +0 -1
- package/dist/ui/tools/OutlookReadTool/index.js +0 -66
- package/dist/ui/tools/OutlookReadTool/index.js.map +0 -1
- package/dist/ui/tools/OutlookReplyTool/index.js +0 -49
- package/dist/ui/tools/OutlookReplyTool/index.js.map +0 -1
- package/dist/ui/tools/OutlookSendTool/index.js +0 -49
- package/dist/ui/tools/OutlookSendTool/index.js.map +0 -1
- package/dist/ui/tools/PauseDelegationTool/index.js +0 -35
- package/dist/ui/tools/PauseDelegationTool/index.js.map +0 -1
- package/dist/ui/tools/ProbeTool/index.js +0 -121
- package/dist/ui/tools/ProbeTool/index.js.map +0 -1
- package/dist/ui/tools/ProcessTool/index.js +0 -66
- package/dist/ui/tools/ProcessTool/index.js.map +0 -1
- package/dist/ui/tools/QuestListTool/index.js +0 -46
- package/dist/ui/tools/QuestListTool/index.js.map +0 -1
- package/dist/ui/tools/QuestReportTool/index.js +0 -49
- package/dist/ui/tools/QuestReportTool/index.js.map +0 -1
- package/dist/ui/tools/QuestUpdateTool/index.js +0 -87
- package/dist/ui/tools/QuestUpdateTool/index.js.map +0 -1
- package/dist/ui/tools/QuipCommentTool/index.js +0 -69
- package/dist/ui/tools/QuipCommentTool/index.js.map +0 -1
- package/dist/ui/tools/QuipReadTool/index.js +0 -71
- package/dist/ui/tools/QuipReadTool/index.js.map +0 -1
- package/dist/ui/tools/RestArionTool/index.js +0 -32
- package/dist/ui/tools/RestArionTool/index.js.map +0 -1
- package/dist/ui/tools/RestartTool/index.js +0 -35
- package/dist/ui/tools/RestartTool/index.js.map +0 -1
- package/dist/ui/tools/ResumeDelegationTool/index.js +0 -35
- package/dist/ui/tools/ResumeDelegationTool/index.js.map +0 -1
- package/dist/ui/tools/RetireArionTool/index.js +0 -32
- package/dist/ui/tools/RetireArionTool/index.js.map +0 -1
- package/dist/ui/tools/RgTool/index.js +0 -73
- package/dist/ui/tools/RgTool/index.js.map +0 -1
- package/dist/ui/tools/SearchKnowledgeTool/index.js +0 -43
- package/dist/ui/tools/SearchKnowledgeTool/index.js.map +0 -1
- package/dist/ui/tools/SearchMessagesTool/index.js +0 -43
- package/dist/ui/tools/SearchMessagesTool/index.js.map +0 -1
- package/dist/ui/tools/SelfDiagnoseTool/index.js +0 -61
- package/dist/ui/tools/SelfDiagnoseTool/index.js.map +0 -1
- package/dist/ui/tools/SendMessageTool/index.js +0 -45
- package/dist/ui/tools/SendMessageTool/index.js.map +0 -1
- package/dist/ui/tools/SerenaTool/index.js +0 -124
- package/dist/ui/tools/SerenaTool/index.js.map +0 -1
- package/dist/ui/tools/SessionHistoryTool/index.js +0 -52
- package/dist/ui/tools/SessionHistoryTool/index.js.map +0 -1
- package/dist/ui/tools/SgTool/index.js +0 -80
- package/dist/ui/tools/SgTool/index.js.map +0 -1
- package/dist/ui/tools/SlackReactTool/index.js +0 -41
- package/dist/ui/tools/SlackReactTool/index.js.map +0 -1
- package/dist/ui/tools/SlackReadTool/index.js +0 -48
- package/dist/ui/tools/SlackReadTool/index.js.map +0 -1
- package/dist/ui/tools/SlackSendTool/index.js +0 -45
- package/dist/ui/tools/SlackSendTool/index.js.map +0 -1
- package/dist/ui/tools/SpawnWorkerTool/index.js +0 -33
- package/dist/ui/tools/SpawnWorkerTool/index.js.map +0 -1
- package/dist/ui/tools/StickerRequestTool/index.js +0 -19
- package/dist/ui/tools/StickerRequestTool/index.js.map +0 -1
- package/dist/ui/tools/ThinkTool/index.js +0 -17
- package/dist/ui/tools/ThinkTool/index.js.map +0 -1
- package/dist/ui/tools/UgTool/index.js +0 -108
- package/dist/ui/tools/UgTool/index.js.map +0 -1
- package/dist/ui/tools/UseSkillTool/index.js +0 -22
- package/dist/ui/tools/UseSkillTool/index.js.map +0 -1
- package/dist/ui/tools/WakeArionTool/index.js +0 -32
- package/dist/ui/tools/WakeArionTool/index.js.map +0 -1
- package/dist/ui/tools/WebFetchTool/index.js +0 -56
- package/dist/ui/tools/WebFetchTool/index.js.map +0 -1
- package/dist/ui/tools/WebSearchTool/index.js +0 -44
- package/dist/ui/tools/WebSearchTool/index.js.map +0 -1
- package/dist/ui/tools/lsTool/index.js +0 -58
- package/dist/ui/tools/lsTool/index.js.map +0 -1
- package/dist/ui/tools/registry.js +0 -197
- package/dist/ui/tools/registry.js.map +0 -1
- package/dist/ui/tools/tool-renderer.js +0 -11
- package/dist/ui/tools/tool-renderer.js.map +0 -1
- package/dist/ui/tools/truncation.js +0 -35
- package/dist/ui/tools/truncation.js.map +0 -1
- package/dist/ui/types/anthropic.js +0 -4
- package/dist/ui/types/anthropic.js.map +0 -1
- package/dist/ui/types/index.js +0 -2
- package/dist/ui/types/index.js.map +0 -1
- package/dist/ui/types/message.js +0 -3
- package/dist/ui/types/message.js.map +0 -1
- package/dist/ui/types/tool.js +0 -4
- package/dist/ui/types/tool.js.map +0 -1
- package/dist/ui/utils/array.js +0 -4
- package/dist/ui/utils/array.js.map +0 -1
- package/dist/ui/utils/cursor.js +0 -131
- package/dist/ui/utils/cursor.js.map +0 -1
- package/dist/ui/utils/diff.js +0 -120
- package/dist/ui/utils/diff.js.map +0 -1
- package/dist/ui/utils/format.js +0 -42
- package/dist/ui/utils/format.js.map +0 -1
- package/dist/ui/utils/fuzzy.js +0 -59
- package/dist/ui/utils/fuzzy.js.map +0 -1
- package/dist/ui/utils/index.js +0 -11
- package/dist/ui/utils/index.js.map +0 -1
- package/dist/ui/utils/keys.js +0 -8
- package/dist/ui/utils/keys.js.map +0 -1
- package/dist/ui/utils/patch.js +0 -17
- package/dist/ui/utils/patch.js.map +0 -1
- package/dist/ui/utils/risk.js +0 -114
- package/dist/ui/utils/risk.js.map +0 -1
- package/dist/ui/utils/terminal-image.js +0 -70
- package/dist/ui/utils/terminal-image.js.map +0 -1
- package/dist/ui/utils/validation.js +0 -48
- package/dist/ui/utils/validation.js.map +0 -1
- package/dist/ui/verb-pairs.js +0 -248
- package/dist/ui/verb-pairs.js.map +0 -1
- package/dist/ui.js +0 -131
- package/dist/ui.js.map +0 -1
- package/src/entrypoints/command-mode.ts +0 -5
- package/src/entrypoints/daemon.ts +0 -54
- package/src/entrypoints/headless-stdio.ts +0 -27
- package/src/entrypoints/interactive.ts +0 -112
- package/src/main.ts +0 -72
- package/src/runtime/configure-bun-sqlite.ts +0 -3
- package/src/runtime/crash-handlers.ts +0 -128
- package/src/runtime/interactive-invocation.test.ts +0 -42
- package/src/runtime/interactive-invocation.ts +0 -51
- package/src/runtime/internal-mode.test.ts +0 -19
- package/src/runtime/internal-mode.ts +0 -24
- package/src/runtime/launch-spec.test.ts +0 -26
- package/src/runtime/launch-spec.ts +0 -84
- package/src/runtime/owner-lease.ts +0 -52
- package/src/runtime/public-mode.test.ts +0 -18
- package/src/runtime/public-mode.ts +0 -19
- package/src/runtime/run-internal-mode.ts +0 -19
- package/src/runtime/runtime-kind.test.ts +0 -23
- package/src/runtime/runtime-kind.ts +0 -41
- package/src/runtime/spawn-aria.ts +0 -62
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** Shared truncation constants for all tool renderers. */
|
|
2
|
-
export const MAX_LINE_CHARS = 80;
|
|
3
|
-
export const MAX_OUTPUT_LINES = 6;
|
|
4
|
-
export const MAX_VERBOSE_LINES = 50;
|
|
5
|
-
/** Cap a single line to MAX_LINE_CHARS, appending "…" if truncated. */
|
|
6
|
-
export function capLine(line) {
|
|
7
|
-
return line.length > MAX_LINE_CHARS ? line.slice(0, MAX_LINE_CHARS) + "…" : line;
|
|
8
|
-
}
|
|
9
|
-
/** Cap every line in a multi-line string. */
|
|
10
|
-
export function capLines(text) {
|
|
11
|
-
return text.split("\n").map(capLine).join("\n");
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Truncate multi-line output to a safe number of lines.
|
|
15
|
-
* In verbose mode, allows more lines but still caps to prevent flooding.
|
|
16
|
-
* Returns [truncatedText, wasOverLimit].
|
|
17
|
-
*/
|
|
18
|
-
export function truncateOutput(text, verbose = false) {
|
|
19
|
-
const maxLines = verbose ? MAX_VERBOSE_LINES : MAX_OUTPUT_LINES;
|
|
20
|
-
const lines = text.split("\n");
|
|
21
|
-
if (lines.length <= maxLines) {
|
|
22
|
-
return [text, false];
|
|
23
|
-
}
|
|
24
|
-
return [lines.slice(0, maxLines).join("\n") + `\n… (+${lines.length - maxLines} lines)`, true];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Truncate a raw string or JSON.stringify fallback to safe terminal limits.
|
|
28
|
-
* Used as a safety net for renderers that dump unknown output shapes.
|
|
29
|
-
*/
|
|
30
|
-
export function safeFallbackText(output, verbose = false) {
|
|
31
|
-
const str = typeof output === "string" ? output : JSON.stringify(output);
|
|
32
|
-
const [truncated] = truncateOutput(str, verbose);
|
|
33
|
-
return capLines(truncated);
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=truncation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"truncation.js","sourceRoot":"","sources":["../../../src/ui/tools/truncation.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,uEAAuE;AACvE,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACnF,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,OAAO,GAAG,KAAK;IAC1D,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,KAAK,CAAC,MAAM,GAAG,QAAQ,SAAS,EAAE,IAAI,CAAC,CAAC;AACjG,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAe,EAAE,OAAO,GAAG,KAAK;IAC/D,MAAM,GAAG,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACzE,MAAM,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../src/ui/types/anthropic.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,wFAAwF"}
|
package/dist/ui/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/types/index.ts"],"names":[],"mappings":""}
|
package/dist/ui/types/message.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/ui/types/message.ts"],"names":[],"mappings":"AAAA,0CAA0C"}
|
package/dist/ui/types/tool.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/ui/types/tool.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,mEAAmE"}
|
package/dist/ui/utils/array.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/ui/utils/array.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAI,EAAO,EAAE,SAA+B;IACrE,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
|
package/dist/ui/utils/cursor.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
// packages/cli/src/ui/utils/cursor.ts
|
|
2
|
-
/**
|
|
3
|
-
* Immutable cursor for text manipulation
|
|
4
|
-
* All operations return new Cursor instances
|
|
5
|
-
*/
|
|
6
|
-
export class Cursor {
|
|
7
|
-
text;
|
|
8
|
-
position;
|
|
9
|
-
constructor(text, position) {
|
|
10
|
-
this.text = text;
|
|
11
|
-
// Clamp position to valid range
|
|
12
|
-
this.position = Math.max(0, Math.min(position, text.length));
|
|
13
|
-
}
|
|
14
|
-
// ─────────────────────────────────────────────────
|
|
15
|
-
// Navigation
|
|
16
|
-
// ─────────────────────────────────────────────────
|
|
17
|
-
moveToStart() {
|
|
18
|
-
return new Cursor(this.text, 0);
|
|
19
|
-
}
|
|
20
|
-
moveToEnd() {
|
|
21
|
-
return new Cursor(this.text, this.text.length);
|
|
22
|
-
}
|
|
23
|
-
moveLeft(count = 1) {
|
|
24
|
-
return new Cursor(this.text, this.position - count);
|
|
25
|
-
}
|
|
26
|
-
moveRight(count = 1) {
|
|
27
|
-
return new Cursor(this.text, this.position + count);
|
|
28
|
-
}
|
|
29
|
-
moveToPrevWord() {
|
|
30
|
-
if (this.position === 0)
|
|
31
|
-
return this;
|
|
32
|
-
const before = this.text.slice(0, this.position);
|
|
33
|
-
// Skip trailing whitespace
|
|
34
|
-
const trimmed = before.trimEnd();
|
|
35
|
-
if (trimmed.length === 0)
|
|
36
|
-
return new Cursor(this.text, 0);
|
|
37
|
-
// Find start of previous word (search for last whitespace in trimmed text)
|
|
38
|
-
const lastWsMatch = trimmed.match(/[\s\S]*\s(\S+)$/);
|
|
39
|
-
const newPos = lastWsMatch ? trimmed.length - lastWsMatch[1].length : 0;
|
|
40
|
-
return new Cursor(this.text, newPos);
|
|
41
|
-
}
|
|
42
|
-
moveToNextWord() {
|
|
43
|
-
if (this.position >= this.text.length)
|
|
44
|
-
return this;
|
|
45
|
-
const after = this.text.slice(this.position);
|
|
46
|
-
// Skip current word
|
|
47
|
-
const match = after.match(/^\S*\s*/);
|
|
48
|
-
if (!match)
|
|
49
|
-
return new Cursor(this.text, this.text.length);
|
|
50
|
-
return new Cursor(this.text, this.position + match[0].length);
|
|
51
|
-
}
|
|
52
|
-
// ─────────────────────────────────────────────────
|
|
53
|
-
// Deletion
|
|
54
|
-
// ─────────────────────────────────────────────────
|
|
55
|
-
deleteToEnd() {
|
|
56
|
-
const newText = this.text.slice(0, this.position);
|
|
57
|
-
return new Cursor(newText, this.position);
|
|
58
|
-
}
|
|
59
|
-
deleteToStart() {
|
|
60
|
-
const newText = this.text.slice(this.position);
|
|
61
|
-
return new Cursor(newText, 0);
|
|
62
|
-
}
|
|
63
|
-
deleteLeft(count = 1) {
|
|
64
|
-
if (this.position === 0)
|
|
65
|
-
return this;
|
|
66
|
-
const deleteCount = Math.min(count, this.position);
|
|
67
|
-
const newText = this.text.slice(0, this.position - deleteCount) + this.text.slice(this.position);
|
|
68
|
-
return new Cursor(newText, this.position - deleteCount);
|
|
69
|
-
}
|
|
70
|
-
deleteRight(count = 1) {
|
|
71
|
-
if (this.position >= this.text.length)
|
|
72
|
-
return this;
|
|
73
|
-
const deleteCount = Math.min(count, this.text.length - this.position);
|
|
74
|
-
const newText = this.text.slice(0, this.position) + this.text.slice(this.position + deleteCount);
|
|
75
|
-
return new Cursor(newText, this.position);
|
|
76
|
-
}
|
|
77
|
-
deletePrevWord() {
|
|
78
|
-
if (this.position === 0)
|
|
79
|
-
return this;
|
|
80
|
-
const before = this.text.slice(0, this.position);
|
|
81
|
-
const after = this.text.slice(this.position);
|
|
82
|
-
// Find word boundary
|
|
83
|
-
const match = before.match(/\S*\s*$/);
|
|
84
|
-
if (!match)
|
|
85
|
-
return this;
|
|
86
|
-
const deleteLength = match[0].length;
|
|
87
|
-
const newText = before.slice(0, -deleteLength) + after;
|
|
88
|
-
return new Cursor(newText, this.position - deleteLength);
|
|
89
|
-
}
|
|
90
|
-
deleteNextWord() {
|
|
91
|
-
if (this.position >= this.text.length)
|
|
92
|
-
return this;
|
|
93
|
-
const before = this.text.slice(0, this.position);
|
|
94
|
-
const after = this.text.slice(this.position);
|
|
95
|
-
// Find word boundary
|
|
96
|
-
const match = after.match(/^\s*\S*/);
|
|
97
|
-
if (!match)
|
|
98
|
-
return this;
|
|
99
|
-
const newText = before + after.slice(match[0].length);
|
|
100
|
-
return new Cursor(newText, this.position);
|
|
101
|
-
}
|
|
102
|
-
// ─────────────────────────────────────────────────
|
|
103
|
-
// Insertion
|
|
104
|
-
// ─────────────────────────────────────────────────
|
|
105
|
-
insert(chars) {
|
|
106
|
-
const newText = this.text.slice(0, this.position) + chars + this.text.slice(this.position);
|
|
107
|
-
return new Cursor(newText, this.position + chars.length);
|
|
108
|
-
}
|
|
109
|
-
clear() {
|
|
110
|
-
return new Cursor("", 0);
|
|
111
|
-
}
|
|
112
|
-
// ─────────────────────────────────────────────────
|
|
113
|
-
// State
|
|
114
|
-
// ─────────────────────────────────────────────────
|
|
115
|
-
get beforeCursor() {
|
|
116
|
-
return this.text.slice(0, this.position);
|
|
117
|
-
}
|
|
118
|
-
get afterCursor() {
|
|
119
|
-
return this.text.slice(this.position);
|
|
120
|
-
}
|
|
121
|
-
get isEmpty() {
|
|
122
|
-
return this.text.length === 0;
|
|
123
|
-
}
|
|
124
|
-
get isAtStart() {
|
|
125
|
-
return this.position === 0;
|
|
126
|
-
}
|
|
127
|
-
get isAtEnd() {
|
|
128
|
-
return this.position >= this.text.length;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
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;IACZ,oDAAoD;IAEpD,MAAM,CAAC,KAAa;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE3F,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK;QACH,OAAO,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED,oDAAoD;IACpD,QAAQ;IACR,oDAAoD;IAEpD,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC3C,CAAC;CACF"}
|
package/dist/ui/utils/diff.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
// packages/cli/src/ui/utils/diff.ts
|
|
2
|
-
import { structuredPatch } from "diff";
|
|
3
|
-
export function generateDiff(filePath, oldContent, newContent, contextLines = 3) {
|
|
4
|
-
const patch = structuredPatch(filePath, filePath, oldContent, newContent, "", "", {
|
|
5
|
-
context: contextLines,
|
|
6
|
-
});
|
|
7
|
-
let additions = 0;
|
|
8
|
-
let deletions = 0;
|
|
9
|
-
const hunks = patch.hunks.map((hunk) => {
|
|
10
|
-
const lines = [];
|
|
11
|
-
let oldLineNo = hunk.oldStart;
|
|
12
|
-
let newLineNo = hunk.newStart;
|
|
13
|
-
for (const line of hunk.lines) {
|
|
14
|
-
const content = line.slice(1); // Remove +/- prefix
|
|
15
|
-
if (line.startsWith("+")) {
|
|
16
|
-
lines.push({
|
|
17
|
-
type: "added",
|
|
18
|
-
content,
|
|
19
|
-
newLineNo: newLineNo++,
|
|
20
|
-
});
|
|
21
|
-
additions++;
|
|
22
|
-
}
|
|
23
|
-
else if (line.startsWith("-")) {
|
|
24
|
-
lines.push({
|
|
25
|
-
type: "removed",
|
|
26
|
-
content,
|
|
27
|
-
oldLineNo: oldLineNo++,
|
|
28
|
-
});
|
|
29
|
-
deletions++;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
lines.push({
|
|
33
|
-
type: "unchanged",
|
|
34
|
-
content,
|
|
35
|
-
oldLineNo: oldLineNo++,
|
|
36
|
-
newLineNo: newLineNo++,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
oldStart: hunk.oldStart,
|
|
42
|
-
oldLines: hunk.oldLines,
|
|
43
|
-
newStart: hunk.newStart,
|
|
44
|
-
newLines: hunk.newLines,
|
|
45
|
-
lines,
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
return {
|
|
49
|
-
filePath,
|
|
50
|
-
hunks,
|
|
51
|
-
additions,
|
|
52
|
-
deletions,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function splitContentLines(content) {
|
|
56
|
-
if (content === "")
|
|
57
|
-
return [];
|
|
58
|
-
const lines = content.split("\n");
|
|
59
|
-
if (lines[lines.length - 1] === "") {
|
|
60
|
-
lines.pop();
|
|
61
|
-
}
|
|
62
|
-
return lines;
|
|
63
|
-
}
|
|
64
|
-
export function generateNewFileDiff(filePath, content) {
|
|
65
|
-
const lines = splitContentLines(content);
|
|
66
|
-
return {
|
|
67
|
-
filePath,
|
|
68
|
-
hunks: [
|
|
69
|
-
{
|
|
70
|
-
oldStart: 0,
|
|
71
|
-
oldLines: 0,
|
|
72
|
-
newStart: 1,
|
|
73
|
-
newLines: lines.length,
|
|
74
|
-
lines: lines.map((line, index) => ({
|
|
75
|
-
type: "added",
|
|
76
|
-
content: line,
|
|
77
|
-
newLineNo: index + 1,
|
|
78
|
-
})),
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
additions: lines.length,
|
|
82
|
-
deletions: 0,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
export function generateDeletedFileDiff(filePath, content) {
|
|
86
|
-
const lines = splitContentLines(content);
|
|
87
|
-
return {
|
|
88
|
-
filePath,
|
|
89
|
-
hunks: [
|
|
90
|
-
{
|
|
91
|
-
oldStart: 1,
|
|
92
|
-
oldLines: lines.length,
|
|
93
|
-
newStart: 0,
|
|
94
|
-
newLines: 0,
|
|
95
|
-
lines: lines.map((line, index) => ({
|
|
96
|
-
type: "removed",
|
|
97
|
-
content: line,
|
|
98
|
-
oldLineNo: index + 1,
|
|
99
|
-
})),
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
additions: 0,
|
|
103
|
-
deletions: lines.length,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
export function formatLineNumber(lineNo, width) {
|
|
107
|
-
if (lineNo === undefined)
|
|
108
|
-
return " ".repeat(width);
|
|
109
|
-
return String(lineNo).padStart(width, " ");
|
|
110
|
-
}
|
|
111
|
-
export function calculateLineNumberWidth(diff) {
|
|
112
|
-
let maxLine = 0;
|
|
113
|
-
for (const hunk of diff.hunks) {
|
|
114
|
-
const lastOldLine = hunk.oldStart + hunk.oldLines;
|
|
115
|
-
const lastNewLine = hunk.newStart + hunk.newLines;
|
|
116
|
-
maxLine = Math.max(maxLine, lastOldLine, lastNewLine);
|
|
117
|
-
}
|
|
118
|
-
return Math.max(3, String(maxLine).length);
|
|
119
|
-
}
|
|
120
|
-
//# sourceMappingURL=diff.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/ui/utils/diff.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAwBvC,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,UAAkB,EAClB,UAAkB,EAClB,YAAY,GAAG,CAAC;IAEhB,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE;QAChF,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC;IAEH,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,MAAM,KAAK,GAAe,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACjD,MAAM,KAAK,GAAe,EAAE,CAAC;QAC7B,IAAI,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE9B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB;YAEnD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAE,OAAO;oBACb,OAAO;oBACP,SAAS,EAAE,SAAS,EAAE;iBACvB,CAAC,CAAC;gBACH,SAAS,EAAE,CAAC;YACd,CAAC;iBAAM,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChC,KAAK,CAAC,IAAI,CAAC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Q,CAAC;QAClD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAClD,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
package/dist/ui/utils/format.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Change: renamed .tsx to .ts (no JSX in this file)
|
|
2
|
-
export function wrapText(text, width) {
|
|
3
|
-
const lines = [];
|
|
4
|
-
let currentLine = "";
|
|
5
|
-
for (const char of text) {
|
|
6
|
-
// Important: we need the spread to properly count multi-plane UTF-8 characters (eg. \u{11696})
|
|
7
|
-
if ([...currentLine].length < width) {
|
|
8
|
-
currentLine += char;
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
lines.push(currentLine);
|
|
12
|
-
currentLine = char;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
if (currentLine)
|
|
16
|
-
lines.push(currentLine);
|
|
17
|
-
return lines;
|
|
18
|
-
}
|
|
19
|
-
export function formatDuration(ms) {
|
|
20
|
-
if (ms < 60000) {
|
|
21
|
-
return `${(ms / 1000).toFixed(1)}s`;
|
|
22
|
-
}
|
|
23
|
-
const hours = Math.floor(ms / 3600000);
|
|
24
|
-
const minutes = Math.floor((ms % 3600000) / 60000);
|
|
25
|
-
const seconds = ((ms % 60000) / 1000).toFixed(1);
|
|
26
|
-
if (hours > 0) {
|
|
27
|
-
return `${hours}h ${minutes}m ${seconds}s`;
|
|
28
|
-
}
|
|
29
|
-
if (minutes > 0) {
|
|
30
|
-
return `${minutes}m ${seconds}s`;
|
|
31
|
-
}
|
|
32
|
-
return `${seconds}s`;
|
|
33
|
-
}
|
|
34
|
-
export function formatNumber(number) {
|
|
35
|
-
return new Intl.NumberFormat("en", {
|
|
36
|
-
notation: "compact",
|
|
37
|
-
maximumFractionDigits: 1,
|
|
38
|
-
})
|
|
39
|
-
.format(number) // eg. "1321" => "1.3K"
|
|
40
|
-
.toLowerCase(); // eg. "1.3K" => "1.3k"
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=format.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/ui/utils/format.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAEpD,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,KAAa;IAClD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,WAAW,GAAG,EAAE,CAAC;IAErB,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,+FAA+F;QAC/F,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;YACpC,WAAW,IAAI,IAAI,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACxB,WAAW,GAAG,IAAI,CAAC;QACrB,CAAC;IACH,CAAC;IAED,IAAI,WAAW;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACzC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC;QACf,OAAO,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACtC,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEjD,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,OAAO,GAAG,KAAK,KAAK,OAAO,KAAK,OAAO,GAAG,CAAC;IAC7C,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO,GAAG,OAAO,KAAK,OAAO,GAAG,CAAC;IACnC,CAAC;IACD,OAAO,GAAG,OAAO,GAAG,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;QACjC,QAAQ,EAAE,SAAS;QACnB,qBAAqB,EAAE,CAAC;KACzB,CAAC;SACC,MAAM,CAAC,MAAM,CAAC,CAAC,uBAAuB;SACtC,WAAW,EAAE,CAAC,CAAC,uBAAuB;AAC3C,CAAC"}
|
package/dist/ui/utils/fuzzy.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// packages/cli/src/ui/utils/fuzzy.ts
|
|
2
|
-
/**
|
|
3
|
-
* Calculate fuzzy match score between query and target
|
|
4
|
-
* Returns 0-1 where 1 is exact match, 0 is no match
|
|
5
|
-
*/
|
|
6
|
-
export function fuzzyScore(target, query) {
|
|
7
|
-
if (!query)
|
|
8
|
-
return 1;
|
|
9
|
-
if (!target)
|
|
10
|
-
return 0;
|
|
11
|
-
const targetLower = target.toLowerCase();
|
|
12
|
-
const queryLower = query.toLowerCase();
|
|
13
|
-
// Exact match
|
|
14
|
-
if (targetLower === queryLower)
|
|
15
|
-
return 1;
|
|
16
|
-
// Prefix match (high score)
|
|
17
|
-
if (targetLower.startsWith(queryLower)) {
|
|
18
|
-
return 0.9 + (0.1 * queryLower.length) / targetLower.length;
|
|
19
|
-
}
|
|
20
|
-
// Contains match
|
|
21
|
-
if (targetLower.includes(queryLower)) {
|
|
22
|
-
const index = targetLower.indexOf(queryLower);
|
|
23
|
-
// Earlier matches score higher
|
|
24
|
-
return 0.7 - (0.1 * index) / targetLower.length;
|
|
25
|
-
}
|
|
26
|
-
// Character sequence match (fuzzy)
|
|
27
|
-
let queryIndex = 0;
|
|
28
|
-
let score = 0;
|
|
29
|
-
let consecutiveBonus = 0;
|
|
30
|
-
for (let i = 0; i < targetLower.length && queryIndex < queryLower.length; i++) {
|
|
31
|
-
if (targetLower[i] === queryLower[queryIndex]) {
|
|
32
|
-
score += 1 + consecutiveBonus;
|
|
33
|
-
consecutiveBonus += 0.5; // Bonus for consecutive matches
|
|
34
|
-
queryIndex++;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
consecutiveBonus = 0;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// All query characters must be found
|
|
41
|
-
if (queryIndex < queryLower.length)
|
|
42
|
-
return 0;
|
|
43
|
-
// Normalize score
|
|
44
|
-
const maxScore = queryLower.length * 2;
|
|
45
|
-
return Math.min(0.6, (score / maxScore) * 0.6);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Sort items by fuzzy match score
|
|
49
|
-
*/
|
|
50
|
-
export function fuzzySort(items, query, getKey) {
|
|
51
|
-
return items
|
|
52
|
-
.map((item) => ({
|
|
53
|
-
...item,
|
|
54
|
-
score: fuzzyScore(getKey(item), query),
|
|
55
|
-
}))
|
|
56
|
-
.filter((item) => item.score > 0)
|
|
57
|
-
.sort((a, b) => b.score - a.score);
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=fuzzy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fuzzy.js","sourceRoot":"","sources":["../../../src/ui/utils/fuzzy.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,KAAa;IACtD,IAAI,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC;IACrB,IAAI,CAAC,MAAM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;QAAE,OAAO,CAAC,CAAC;IAE7C,kBAAkB;IAClB,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CACvB,KAAU,EACV,KAAa,EACb,MAA2B;IAE3B,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACd,GAAG,IAAI;QACP,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;KACvC,CAAC,CAAC;SACF,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;SAChC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/ui/utils/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// packages/cli/src/ui/utils/index.ts
|
|
2
|
-
export { Cursor } from "./cursor.js";
|
|
3
|
-
export { fuzzyScore, fuzzySort } from "./fuzzy.js";
|
|
4
|
-
export { findSimilar, success, failure } from "./validation.js";
|
|
5
|
-
export { generateDiff, generateNewFileDiff, generateDeletedFileDiff, formatLineNumber, calculateLineNumberWidth, } from "./diff.js";
|
|
6
|
-
export { assessToolRisk, getRiskColor } from "./risk.js";
|
|
7
|
-
export { intersperse } from "./array.js";
|
|
8
|
-
export { wrapText, formatDuration, formatNumber } from "./format.js";
|
|
9
|
-
export { getPatch } from "./patch.js";
|
|
10
|
-
export { isITerm2Terminal, supportsInlineImages, parseImageDataUri, terminalInlineImage, terminalInlineImageFromDataUri, terminalInlineImageFromPath, splitTextByInlineImages, } from "./terminal-image.js";
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/utils/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAyB,MAAM,iBAAiB,CAAC;AACvF,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,GAIzB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAuC,MAAM,WAAW,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,8BAA8B,EAC9B,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,qBAAqB,CAAC"}
|
package/dist/ui/utils/keys.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ink can surface Escape as either key.escape or the raw ESC byte.
|
|
3
|
-
* Normalizing this keeps key handling deterministic across environments.
|
|
4
|
-
*/
|
|
5
|
-
export function isEscapeInput(input, key) {
|
|
6
|
-
return key.escape || input === "\x1B";
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=keys.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../src/ui/utils/keys.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,GAAwB;IACnE,OAAO,GAAG,CAAC,MAAM,IAAI,KAAK,KAAK,MAAM,CAAC;AACxC,CAAC"}
|
package/dist/ui/utils/patch.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Change: renamed to patch.ts to avoid conflict with ARIA's existing diff.ts
|
|
2
|
-
import { structuredPatch } from "diff";
|
|
3
|
-
const CONTEXT_LINES = 3;
|
|
4
|
-
// For some reason, & confuses the diff library, so we replace it with a token,
|
|
5
|
-
// then substitute it back in after the diff is computed.
|
|
6
|
-
const AMPERSAND_TOKEN = "<<:AMPERSAND_TOKEN:>>";
|
|
7
|
-
const DOLLAR_TOKEN = "<<:DOLLAR_TOKEN:>>";
|
|
8
|
-
export function getPatch({ filePath, fileContents, oldStr, newStr, }) {
|
|
9
|
-
return structuredPatch(filePath, filePath, fileContents.replaceAll("&", AMPERSAND_TOKEN).replaceAll("$", DOLLAR_TOKEN), fileContents
|
|
10
|
-
.replaceAll("&", AMPERSAND_TOKEN)
|
|
11
|
-
.replaceAll("$", DOLLAR_TOKEN)
|
|
12
|
-
.replace(oldStr.replaceAll("&", AMPERSAND_TOKEN).replaceAll("$", DOLLAR_TOKEN), newStr.replaceAll("&", AMPERSAND_TOKEN).replaceAll("$", DOLLAR_TOKEN)), undefined, undefined, { context: CONTEXT_LINES }).hunks.map((_) => ({
|
|
13
|
-
..._,
|
|
14
|
-
lines: _.lines.map((_) => _.replaceAll(AMPERSAND_TOKEN, "&").replaceAll(DOLLAR_TOKEN, "$")),
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=patch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../../../src/ui/utils/patch.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,EAA4B,eAAe,EAAE,MAAM,MAAM,CAAC;AAIjE,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,+EAA+E;AAC/E,yDAAyD;AACzD,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEhD,MAAM,YAAY,GAAG,oBAAoB,CAAC;AAE1C,MAAM,UAAU,QAAQ,CAAC,EACvB,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,MAAM,GAMP;IACC,OAAO,eAAe,CACpB,QAAQ,EACR,QAAQ,EACR,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,EAC3E,YAAY;SACT,UAAU,CAAC,GAAG,EAAE,eAAe,CAAC;SAChC,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC;SAC7B,OAAO,CACN,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,EACrE,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,CACtE,EACH,SAAS,EACT,SAAS,EACT,EAAE,OAAO,EAAE,aAAa,EAAE,CAC3B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClB,GAAG,CAAC;QACJ,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;KAC5F,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/dist/ui/utils/risk.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// packages/cli/src/ui/utils/risk.ts
|
|
2
|
-
export function assessToolRisk(toolName, args) {
|
|
3
|
-
const reasons = [];
|
|
4
|
-
let score = 30; // Base score (moderate)
|
|
5
|
-
// Tool-specific risk assessment
|
|
6
|
-
switch (toolName.toLowerCase()) {
|
|
7
|
-
case "fileread":
|
|
8
|
-
case "glob":
|
|
9
|
-
case "grep":
|
|
10
|
-
case "ls":
|
|
11
|
-
case "read":
|
|
12
|
-
score = 10; // Low risk - read-only
|
|
13
|
-
break;
|
|
14
|
-
case "fileedit":
|
|
15
|
-
case "edit":
|
|
16
|
-
score = 40; // Moderate - modifies existing files
|
|
17
|
-
reasons.push("Modifies existing file");
|
|
18
|
-
break;
|
|
19
|
-
case "filewrite":
|
|
20
|
-
case "write":
|
|
21
|
-
score = 50; // Moderate-high - creates/overwrites files
|
|
22
|
-
reasons.push("Creates or overwrites file");
|
|
23
|
-
break;
|
|
24
|
-
case "bash":
|
|
25
|
-
score = assessBashRisk(typeof args.command === "string" ? args.command : undefined, reasons);
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
score = 50; // Unknown tools default to moderate-high
|
|
29
|
-
reasons.push("Unknown tool type");
|
|
30
|
-
}
|
|
31
|
-
// Determine level from score
|
|
32
|
-
let level;
|
|
33
|
-
if (score < 30) {
|
|
34
|
-
level = "low";
|
|
35
|
-
}
|
|
36
|
-
else if (score < 70) {
|
|
37
|
-
level = "moderate";
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
level = "high";
|
|
41
|
-
}
|
|
42
|
-
return { level, score, reasons };
|
|
43
|
-
}
|
|
44
|
-
function assessBashRisk(command, reasons) {
|
|
45
|
-
if (!command)
|
|
46
|
-
return 50;
|
|
47
|
-
const cmd = command.toLowerCase();
|
|
48
|
-
let score = 40;
|
|
49
|
-
// High-risk patterns
|
|
50
|
-
const highRiskPatterns = [
|
|
51
|
-
{ pattern: /\brm\s+-(rf|fr|r\b)|\brm\s+--recursive/, reason: "Recursive delete command" },
|
|
52
|
-
{ pattern: /\bsudo\b/, reason: "Elevated privileges" },
|
|
53
|
-
{ pattern: /\bchmod\b.*777/, reason: "Insecure permissions" },
|
|
54
|
-
{ pattern: /\|\s*(bash|sh|zsh)\b/, reason: "Piped to shell execution" },
|
|
55
|
-
{ pattern: /\b(curl|wget)\b.*\|\s*(bash|sh)/, reason: "Remote script execution" },
|
|
56
|
-
{ pattern: /\bdd\b/, reason: "Low-level disk operation" },
|
|
57
|
-
{ pattern: /\bmkfs\b/, reason: "Filesystem creation" },
|
|
58
|
-
{ pattern: />\s*\/dev\//, reason: "Device file write" },
|
|
59
|
-
{ pattern: /\bchmod\s+000/, reason: "Removes all file permissions" },
|
|
60
|
-
{ pattern: /(?:^|[;&|])\s*>/, reason: "File truncation via redirect" },
|
|
61
|
-
{
|
|
62
|
-
pattern: /\b(curl|wget)\b.*-o.*&&\s*(bash|sh|chmod)/,
|
|
63
|
-
reason: "Download and execute pattern",
|
|
64
|
-
},
|
|
65
|
-
];
|
|
66
|
-
for (const { pattern, reason } of highRiskPatterns) {
|
|
67
|
-
if (pattern.test(cmd)) {
|
|
68
|
-
score = Math.max(score, 80);
|
|
69
|
-
reasons.push(reason);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Moderate-risk patterns
|
|
73
|
-
const moderateRiskPatterns = [
|
|
74
|
-
{ pattern: /\brm\b/, reason: "Delete command" },
|
|
75
|
-
{ pattern: /\bmv\b/, reason: "Move/rename command" },
|
|
76
|
-
{ pattern: /\bcp\b.*-r/, reason: "Recursive copy" },
|
|
77
|
-
{ pattern: /\bnpm\s+(install|i)\b/, reason: "Package installation" },
|
|
78
|
-
{ pattern: /\bgit\s+(push|reset|rebase)/, reason: "Git write operation" },
|
|
79
|
-
{ pattern: /\btruncate\b/, reason: "File truncation command" },
|
|
80
|
-
{ pattern: /\bkill\s+-9\b|\bpkill\b/, reason: "Force kill process" },
|
|
81
|
-
];
|
|
82
|
-
for (const { pattern, reason } of moderateRiskPatterns) {
|
|
83
|
-
if (pattern.test(cmd) && score < 60) {
|
|
84
|
-
score = Math.max(score, 50);
|
|
85
|
-
reasons.push(reason);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
// Low-risk patterns
|
|
89
|
-
const lowRiskPatterns = [
|
|
90
|
-
/\bls\b/,
|
|
91
|
-
/\bcat\b/,
|
|
92
|
-
/\bgrep\b/,
|
|
93
|
-
/\bfind\b/,
|
|
94
|
-
/\becho\b/,
|
|
95
|
-
/\bpwd\b/,
|
|
96
|
-
/\bwhoami\b/,
|
|
97
|
-
/\bgit\s+(status|log|diff|branch)\b/,
|
|
98
|
-
];
|
|
99
|
-
if (lowRiskPatterns.some((p) => p.test(cmd)) && reasons.length === 0) {
|
|
100
|
-
score = 20;
|
|
101
|
-
}
|
|
102
|
-
return score;
|
|
103
|
-
}
|
|
104
|
-
export function getRiskColor(level, theme) {
|
|
105
|
-
switch (level) {
|
|
106
|
-
case "low":
|
|
107
|
-
return theme.colors.success;
|
|
108
|
-
case "moderate":
|
|
109
|
-
return theme.colors.warning;
|
|
110
|
-
case "high":
|
|
111
|
-
return theme.colors.error;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=risk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"risk.js","sourceRoot":"","sources":["../../../src/ui/utils/risk.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAUpC,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,IAA6B;IAC5E,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,wBAAwB;IAExC,gCAAgC;IAChC,QAAQ,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAC/B,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,IAAI,CAAC;QACV,KAAK,MAAM;YACT,KAAK,GAAG,EAAE,CAAC,CAAC,uBAAuB;YACnC,MAAM;QAER,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM;YACT,KAAK,GAAG,EAAE,CAAC,CAAC,qCAAqC;YACjD,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;Y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