@strands-agents/cli 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +217 -133
- package/bin/strands.js +1 -5
- package/dist/src/{tui/strands-backend.js → agent/backend.js} +90 -28
- package/dist/src/agent/backend.js.map +1 -0
- package/dist/src/{tui/background/activity.js → agent/background.js} +173 -6
- package/dist/src/agent/background.js.map +1 -0
- package/dist/src/{tui/agent-configuration.js → agent/configuration.js} +62 -105
- package/dist/src/agent/configuration.js.map +1 -0
- package/dist/src/agent/context.js +112 -0
- package/dist/src/agent/context.js.map +1 -0
- package/dist/src/{tui/chat/sdk-projector.js → agent/events.js} +6 -5
- package/dist/src/agent/events.js.map +1 -0
- package/dist/src/{tui/permissions/file-change-preview.js → agent/file-changes.js} +10 -8
- package/dist/src/agent/file-changes.js.map +1 -0
- package/dist/src/agent/mcp.js +436 -0
- package/dist/src/agent/mcp.js.map +1 -0
- package/dist/src/agent/messaging.js +424 -0
- package/dist/src/agent/messaging.js.map +1 -0
- package/dist/src/agent/permission-rules.js +267 -0
- package/dist/src/agent/permission-rules.js.map +1 -0
- package/dist/src/agent/permissions.js +288 -0
- package/dist/src/agent/permissions.js.map +1 -0
- package/dist/src/agent/runtime.js +524 -0
- package/dist/src/agent/runtime.js.map +1 -0
- package/dist/src/{tui/workspace → agent}/sandbox.js +92 -25
- package/dist/src/agent/sandbox.js.map +1 -0
- package/dist/src/{tui/chat → agent}/shell.js +1 -1
- package/dist/src/agent/shell.js.map +1 -0
- package/dist/src/{tui → agent}/skills.js +37 -56
- package/dist/src/agent/skills.js.map +1 -0
- package/dist/src/{tui/builtin-tools.js → agent/tools.js} +2 -3
- package/dist/src/agent/tools.js.map +1 -0
- package/dist/src/agent/types.js.map +1 -0
- package/dist/src/{tui/voice/session.js → agent/voice.js} +221 -224
- package/dist/src/agent/voice.js.map +1 -0
- package/dist/src/{tui/acp/projection.js → cli/acp-events.js} +19 -4
- package/dist/src/cli/acp-events.js.map +1 -0
- package/dist/src/{tui/project/acp.js → cli/acp-python.js} +41 -18
- package/dist/src/cli/acp-python.js.map +1 -0
- package/dist/src/{tui/acp/server.js → cli/acp.js} +149 -46
- package/dist/src/cli/acp.js.map +1 -0
- package/dist/src/cli/arguments.js +8 -3
- package/dist/src/cli/arguments.js.map +1 -1
- package/dist/src/{console.js → cli/console.js} +69 -4
- package/dist/src/cli/console.js.map +1 -0
- package/dist/src/cli/invocation.js +75 -44
- package/dist/src/cli/invocation.js.map +1 -1
- package/dist/src/cli/run.js +66 -38
- package/dist/src/cli/run.js.map +1 -1
- package/dist/src/{tui → cli}/telemetry.js +2 -2
- package/dist/src/{tui → cli}/telemetry.js.map +1 -1
- package/dist/src/cli/update.js +35 -7
- package/dist/src/cli/update.js.map +1 -1
- package/dist/src/{tui/mcp/config.js → config/mcp.js} +25 -35
- package/dist/src/config/mcp.js.map +1 -0
- package/dist/src/{tui → config}/settings.js +78 -130
- package/dist/src/config/settings.js.map +1 -0
- package/dist/src/config/source.js +87 -0
- package/dist/src/config/source.js.map +1 -0
- package/dist/src/{tui/config.js → config/store.js} +178 -49
- package/dist/src/config/store.js.map +1 -0
- package/dist/src/{tui/workspace → config}/trust.js +12 -16
- package/dist/src/config/trust.js.map +1 -0
- package/dist/src/logging.js +3 -4
- package/dist/src/logging.js.map +1 -1
- package/dist/src/{tui/provider → model}/aws-config.js +13 -4
- package/dist/src/model/aws-config.js.map +1 -0
- package/dist/src/{tui/provider/bedrock-catalog.js → model/bedrock.js} +70 -3
- package/dist/src/model/bedrock.js.map +1 -0
- package/dist/src/{tui/provider → model}/discovery.js +11 -10
- package/dist/src/model/discovery.js.map +1 -0
- package/dist/src/{tui/provider → model}/environment.js +19 -16
- package/dist/src/model/environment.js.map +1 -0
- package/dist/src/{tui/model/display.js → model/metadata.js} +6 -1
- package/dist/src/model/metadata.js.map +1 -0
- package/dist/src/model/packages.js.map +1 -0
- package/dist/src/{tui/model → model}/runtime.js +31 -62
- package/dist/src/model/runtime.js.map +1 -0
- package/dist/src/{tui/model → model}/selection.js +9 -15
- package/dist/src/model/selection.js.map +1 -0
- package/dist/src/{tui/package-version.js → package-version.js} +6 -0
- package/dist/src/package-version.js.map +1 -0
- package/dist/src/paths.js +23 -0
- package/dist/src/paths.js.map +1 -0
- package/dist/src/project/archive.js +461 -0
- package/dist/src/project/archive.js.map +1 -0
- package/dist/src/{tui/project → project}/export.js +249 -72
- package/dist/src/project/export.js.map +1 -0
- package/dist/src/{tui/project → project}/import.js +58 -6
- package/dist/src/project/import.js.map +1 -0
- package/dist/src/{tui/project → project}/module-loader.js +1 -5
- package/dist/src/project/module-loader.js.map +1 -0
- package/dist/src/{tui/project → project}/packaging.js +25 -8
- package/dist/src/project/packaging.js.map +1 -0
- package/dist/src/project/portability.js +455 -0
- package/dist/src/project/portability.js.map +1 -0
- package/dist/src/{tui/project → project}/python.js +46 -31
- package/dist/src/project/python.js.map +1 -0
- package/dist/src/{tui/project → project}/source.js +45 -26
- package/dist/src/project/source.js.map +1 -0
- package/dist/src/project/typescript-backend.js +733 -0
- package/dist/src/project/typescript-backend.js.map +1 -0
- package/dist/src/project/typescript-worker.js +488 -0
- package/dist/src/project/typescript-worker.js.map +1 -0
- package/dist/src/{tui/project → project}/typescript.js +19 -7
- package/dist/src/project/typescript.js.map +1 -0
- package/dist/src/project/watch.js +33 -0
- package/dist/src/project/watch.js.map +1 -0
- package/dist/src/{tui/project → project}/worker.py +358 -106
- package/dist/src/session/agent-definition.js +35 -0
- package/dist/src/session/agent-definition.js.map +1 -0
- package/dist/src/session/catalog.js +156 -0
- package/dist/src/session/catalog.js.map +1 -0
- package/dist/src/{tui/session → session}/context.js +45 -5
- package/dist/src/session/context.js.map +1 -0
- package/dist/src/{tui/session → session}/desktop-profile.js +1 -0
- package/dist/src/session/desktop-profile.js.map +1 -0
- package/dist/src/{tui/session → session}/sessions.js +126 -27
- package/dist/src/session/sessions.js.map +1 -0
- package/dist/src/terminal/arguments.js +53 -0
- package/dist/src/terminal/arguments.js.map +1 -0
- package/dist/src/{tui/terminal → terminal}/composer.js +51 -24
- package/dist/src/terminal/composer.js.map +1 -0
- package/dist/src/terminal/directory-picker.js +182 -0
- package/dist/src/terminal/directory-picker.js.map +1 -0
- package/dist/src/terminal/ink.js.map +1 -0
- package/dist/src/terminal/mouse-input.js.map +1 -0
- package/dist/src/terminal/npm.js.map +1 -0
- package/dist/src/terminal/open-editor.js +40 -0
- package/dist/src/terminal/open-editor.js.map +1 -0
- package/dist/src/terminal/open-url.js +26 -0
- package/dist/src/terminal/open-url.js.map +1 -0
- package/dist/src/terminal/process-tree.js.map +1 -0
- package/dist/src/terminal/shell-output.js.map +1 -0
- package/dist/src/{tui/terminal → terminal}/terminal.js +40 -2
- package/dist/src/terminal/terminal.js.map +1 -0
- package/dist/src/{tui/terminal/sanitize.js → terminal/text.js} +40 -6
- package/dist/src/terminal/text.js.map +1 -0
- package/dist/src/terminal/theme-detection.js +197 -0
- package/dist/src/terminal/theme-detection.js.map +1 -0
- package/dist/src/{tui/view/fade-in.js → ui/animation.js} +26 -1
- package/dist/src/ui/animation.js.map +1 -0
- package/dist/src/ui/app.js +176 -0
- package/dist/src/ui/app.js.map +1 -0
- package/dist/src/ui/chat/attachments.js +135 -0
- package/dist/src/ui/chat/attachments.js.map +1 -0
- package/dist/src/{tui → ui}/chat/commands.js +55 -7
- package/dist/src/ui/chat/commands.js.map +1 -0
- package/dist/src/{tui → ui}/chat/controller.js +1176 -345
- package/dist/src/ui/chat/controller.js.map +1 -0
- package/dist/src/ui/chat/conversations.js +692 -0
- package/dist/src/ui/chat/conversations.js.map +1 -0
- package/dist/src/{tui → ui}/chat/help.js +11 -5
- package/dist/src/ui/chat/help.js.map +1 -0
- package/dist/src/ui/chat/panel-state.js +513 -0
- package/dist/src/ui/chat/panel-state.js.map +1 -0
- package/dist/src/{tui → ui}/chat/projector.js +93 -8
- package/dist/src/ui/chat/projector.js.map +1 -0
- package/dist/src/ui/chat/prompt.js +176 -0
- package/dist/src/ui/chat/prompt.js.map +1 -0
- package/dist/src/ui/chat/runtime.js +589 -0
- package/dist/src/ui/chat/runtime.js.map +1 -0
- package/dist/src/ui/chat/screen.js +1907 -0
- package/dist/src/ui/chat/screen.js.map +1 -0
- package/dist/src/{tui/chat/controller-helpers.js → ui/chat/state.js} +39 -3
- package/dist/src/ui/chat/state.js.map +1 -0
- package/dist/src/ui/chat/stream-presentation.js.map +1 -0
- package/dist/src/ui/chat/transcript-turn.js +189 -0
- package/dist/src/ui/chat/transcript-turn.js.map +1 -0
- package/dist/src/{tui/view → ui/chat}/transcript.js +66 -6
- package/dist/src/ui/chat/transcript.js.map +1 -0
- package/dist/src/ui/chat/types.js +2 -0
- package/dist/src/ui/chat/types.js.map +1 -0
- package/dist/src/ui/chat/view.js +249 -0
- package/dist/src/ui/chat/view.js.map +1 -0
- package/dist/src/ui/chat/voice.js +388 -0
- package/dist/src/ui/chat/voice.js.map +1 -0
- package/dist/src/ui/footer.js +110 -0
- package/dist/src/ui/footer.js.map +1 -0
- package/dist/src/{tui/view → ui}/frog-canvas.js +47 -50
- package/dist/src/ui/frog-canvas.js.map +1 -0
- package/dist/src/{tui/view → ui}/frog-drawing.js +36 -29
- package/dist/src/ui/frog-drawing.js.map +1 -0
- package/dist/src/{tui/view/frog-intro-renderer.js → ui/frog-renderer.js} +63 -46
- package/dist/src/ui/frog-renderer.js.map +1 -0
- package/dist/src/{tui/view/frog-easter-egg.js → ui/frog.js} +34 -6
- package/dist/src/ui/frog.js.map +1 -0
- package/dist/src/ui/interaction.js +525 -0
- package/dist/src/ui/interaction.js.map +1 -0
- package/dist/src/{tui/view → ui}/markdown.js +12 -9
- package/dist/src/ui/markdown.js.map +1 -0
- package/dist/src/ui/mcp-diagnostics.js +56 -0
- package/dist/src/ui/mcp-diagnostics.js.map +1 -0
- package/dist/src/ui/media.js +59 -0
- package/dist/src/ui/media.js.map +1 -0
- package/dist/src/ui/panels/agents.js +97 -0
- package/dist/src/ui/panels/agents.js.map +1 -0
- package/dist/src/ui/panels/configuration.js +201 -0
- package/dist/src/ui/panels/configuration.js.map +1 -0
- package/dist/src/ui/panels/context.js +102 -0
- package/dist/src/ui/panels/context.js.map +1 -0
- package/dist/src/ui/panels/export.js +17 -0
- package/dist/src/ui/panels/export.js.map +1 -0
- package/dist/src/ui/panels/help.js +22 -0
- package/dist/src/ui/panels/help.js.map +1 -0
- package/dist/src/ui/panels/models.js +180 -0
- package/dist/src/ui/panels/models.js.map +1 -0
- package/dist/src/ui/panels/panel.js +122 -0
- package/dist/src/ui/panels/panel.js.map +1 -0
- package/dist/src/ui/panels/permissions.js +90 -0
- package/dist/src/ui/panels/permissions.js.map +1 -0
- package/dist/src/ui/panels/sessions.js +54 -0
- package/dist/src/ui/panels/sessions.js.map +1 -0
- package/dist/src/ui/panels/settings.js +125 -0
- package/dist/src/ui/panels/settings.js.map +1 -0
- package/dist/src/ui/panels/shared.js +50 -0
- package/dist/src/ui/panels/shared.js.map +1 -0
- package/dist/src/ui/panels/tasks.js +15 -0
- package/dist/src/ui/panels/tasks.js.map +1 -0
- package/dist/src/ui/panels/voice.js +142 -0
- package/dist/src/ui/panels/voice.js.map +1 -0
- package/dist/src/{tui/permissions/settings.js → ui/permission-options.js} +13 -2
- package/dist/src/ui/permission-options.js.map +1 -0
- package/dist/src/{tui/view → ui}/presentation.js +170 -112
- package/dist/src/ui/presentation.js.map +1 -0
- package/dist/src/{tui → ui}/run.js +173 -36
- package/dist/src/ui/run.js.map +1 -0
- package/dist/src/{tui/view/setup-wizard/settings-panel.js → ui/setup/form.js} +6 -6
- package/dist/src/ui/setup/form.js.map +1 -0
- package/dist/src/ui/setup/menu.js +133 -0
- package/dist/src/ui/setup/menu.js.map +1 -0
- package/dist/src/{tui/view/setup-wizard → ui/setup}/providers.js +157 -20
- package/dist/src/ui/setup/providers.js.map +1 -0
- package/dist/src/{tui/view/setup-wizard → ui/setup}/steps.js +193 -147
- package/dist/src/ui/setup/steps.js.map +1 -0
- package/dist/src/ui/setup/wizard.js +2075 -0
- package/dist/src/ui/setup/wizard.js.map +1 -0
- package/dist/src/ui/startup.js +147 -0
- package/dist/src/ui/startup.js.map +1 -0
- package/dist/src/{tui/terminal/size.js → ui/terminal-size.js} +1 -1
- package/dist/src/ui/terminal-size.js.map +1 -0
- package/dist/src/ui/text-input.js +50 -0
- package/dist/src/ui/text-input.js.map +1 -0
- package/dist/src/{tui/view → ui}/theme.js +24 -31
- package/dist/src/ui/theme.js.map +1 -0
- package/dist/src/ui/update.js +126 -0
- package/dist/src/ui/update.js.map +1 -0
- package/dist/src/usage.js +0 -5
- package/dist/src/usage.js.map +1 -1
- package/dist/src/values.js +5 -0
- package/dist/src/values.js.map +1 -0
- package/package.json +16 -8
- package/src/agent/voice-sidecar.py +730 -0
- package/dist/src/console.js.map +0 -1
- package/dist/src/tui/acp/projection.js.map +0 -1
- package/dist/src/tui/acp/server.js.map +0 -1
- package/dist/src/tui/agent-configuration.js.map +0 -1
- package/dist/src/tui/background/activity.js.map +0 -1
- package/dist/src/tui/background/inbox.js +0 -120
- package/dist/src/tui/background/inbox.js.map +0 -1
- package/dist/src/tui/background/tasks.js +0 -98
- package/dist/src/tui/background/tasks.js.map +0 -1
- package/dist/src/tui/builtin-tools.js.map +0 -1
- package/dist/src/tui/chat/commands.js.map +0 -1
- package/dist/src/tui/chat/controller-helpers.js.map +0 -1
- package/dist/src/tui/chat/controller.js.map +0 -1
- package/dist/src/tui/chat/help.js.map +0 -1
- package/dist/src/tui/chat/panels.js +0 -407
- package/dist/src/tui/chat/panels.js.map +0 -1
- package/dist/src/tui/chat/projector.js.map +0 -1
- package/dist/src/tui/chat/sdk-projector.js.map +0 -1
- package/dist/src/tui/chat/shell.js.map +0 -1
- package/dist/src/tui/chat/types.js +0 -2
- package/dist/src/tui/chat/types.js.map +0 -1
- package/dist/src/tui/config.js.map +0 -1
- package/dist/src/tui/configuration-instructions.js +0 -14
- package/dist/src/tui/configuration-instructions.js.map +0 -1
- package/dist/src/tui/mcp/config.js.map +0 -1
- package/dist/src/tui/mcp.js +0 -98
- package/dist/src/tui/mcp.js.map +0 -1
- package/dist/src/tui/memory-options.js +0 -10
- package/dist/src/tui/memory-options.js.map +0 -1
- package/dist/src/tui/messaging.js +0 -193
- package/dist/src/tui/messaging.js.map +0 -1
- package/dist/src/tui/model/context.js +0 -69
- package/dist/src/tui/model/context.js.map +0 -1
- package/dist/src/tui/model/display.js.map +0 -1
- package/dist/src/tui/model/runtime.js.map +0 -1
- package/dist/src/tui/model/selection.js.map +0 -1
- package/dist/src/tui/npm.js.map +0 -1
- package/dist/src/tui/package-version.js.map +0 -1
- package/dist/src/tui/permissions/file-change-preview.js.map +0 -1
- package/dist/src/tui/permissions/policy.js +0 -222
- package/dist/src/tui/permissions/policy.js.map +0 -1
- package/dist/src/tui/permissions/settings.js.map +0 -1
- package/dist/src/tui/project/acp.js.map +0 -1
- package/dist/src/tui/project/archive.js +0 -241
- package/dist/src/tui/project/archive.js.map +0 -1
- package/dist/src/tui/project/configuration-secrets.js +0 -107
- package/dist/src/tui/project/configuration-secrets.js.map +0 -1
- package/dist/src/tui/project/configuration.js +0 -201
- package/dist/src/tui/project/configuration.js.map +0 -1
- package/dist/src/tui/project/export.js.map +0 -1
- package/dist/src/tui/project/import.js.map +0 -1
- package/dist/src/tui/project/module-loader.js.map +0 -1
- package/dist/src/tui/project/packaging.js.map +0 -1
- package/dist/src/tui/project/portable-dependencies.js +0 -34
- package/dist/src/tui/project/portable-dependencies.js.map +0 -1
- package/dist/src/tui/project/portable-mcp.js +0 -118
- package/dist/src/tui/project/portable-mcp.js.map +0 -1
- package/dist/src/tui/project/python.js.map +0 -1
- package/dist/src/tui/project/run.js +0 -116
- package/dist/src/tui/project/run.js.map +0 -1
- package/dist/src/tui/project/source.js.map +0 -1
- package/dist/src/tui/project/typescript.js.map +0 -1
- package/dist/src/tui/provider/aws-client.js +0 -67
- package/dist/src/tui/provider/aws-client.js.map +0 -1
- package/dist/src/tui/provider/aws-config.js.map +0 -1
- package/dist/src/tui/provider/bedrock-catalog.js.map +0 -1
- package/dist/src/tui/provider/discovery.js.map +0 -1
- package/dist/src/tui/provider/environment.js.map +0 -1
- package/dist/src/tui/provider/packages.js.map +0 -1
- package/dist/src/tui/run.js.map +0 -1
- package/dist/src/tui/runtime.js +0 -524
- package/dist/src/tui/runtime.js.map +0 -1
- package/dist/src/tui/session/agent-definition.js +0 -100
- package/dist/src/tui/session/agent-definition.js.map +0 -1
- package/dist/src/tui/session/catalog.js +0 -159
- package/dist/src/tui/session/catalog.js.map +0 -1
- package/dist/src/tui/session/context.js.map +0 -1
- package/dist/src/tui/session/conversation-helpers.js +0 -46
- package/dist/src/tui/session/conversation-helpers.js.map +0 -1
- package/dist/src/tui/session/conversations.js +0 -471
- package/dist/src/tui/session/conversations.js.map +0 -1
- package/dist/src/tui/session/desktop-profile.js.map +0 -1
- package/dist/src/tui/session/options.js +0 -44
- package/dist/src/tui/session/options.js.map +0 -1
- package/dist/src/tui/session/sessions.js.map +0 -1
- package/dist/src/tui/session/voice.js +0 -353
- package/dist/src/tui/session/voice.js.map +0 -1
- package/dist/src/tui/settings.js.map +0 -1
- package/dist/src/tui/skills.js.map +0 -1
- package/dist/src/tui/steering.js +0 -67
- package/dist/src/tui/steering.js.map +0 -1
- package/dist/src/tui/strands-backend.js.map +0 -1
- package/dist/src/tui/stream-presentation.js.map +0 -1
- package/dist/src/tui/terminal/composer.js.map +0 -1
- package/dist/src/tui/terminal/directory-picker.js +0 -76
- package/dist/src/tui/terminal/directory-picker.js.map +0 -1
- package/dist/src/tui/terminal/ink.js.map +0 -1
- package/dist/src/tui/terminal/mouse-input.js.map +0 -1
- package/dist/src/tui/terminal/open-url.js +0 -21
- package/dist/src/tui/terminal/open-url.js.map +0 -1
- package/dist/src/tui/terminal/process-tree.js.map +0 -1
- package/dist/src/tui/terminal/sanitize.js.map +0 -1
- package/dist/src/tui/terminal/shell-output.js.map +0 -1
- package/dist/src/tui/terminal/size.js.map +0 -1
- package/dist/src/tui/terminal/terminal.js.map +0 -1
- package/dist/src/tui/update-check.js +0 -37
- package/dist/src/tui/update-check.js.map +0 -1
- package/dist/src/tui/view/agents-panel.js +0 -21
- package/dist/src/tui/view/agents-panel.js.map +0 -1
- package/dist/src/tui/view/app.js +0 -1061
- package/dist/src/tui/view/app.js.map +0 -1
- package/dist/src/tui/view/chat-root.js +0 -49
- package/dist/src/tui/view/chat-root.js.map +0 -1
- package/dist/src/tui/view/chat-view.js +0 -145
- package/dist/src/tui/view/chat-view.js.map +0 -1
- package/dist/src/tui/view/command-palette.js +0 -15
- package/dist/src/tui/view/command-palette.js.map +0 -1
- package/dist/src/tui/view/custom-theme-editor.js +0 -301
- package/dist/src/tui/view/custom-theme-editor.js.map +0 -1
- package/dist/src/tui/view/effort-panel.js +0 -15
- package/dist/src/tui/view/effort-panel.js.map +0 -1
- package/dist/src/tui/view/export-panel.js +0 -14
- package/dist/src/tui/view/export-panel.js.map +0 -1
- package/dist/src/tui/view/fade-in.js.map +0 -1
- package/dist/src/tui/view/frog-canvas.js.map +0 -1
- package/dist/src/tui/view/frog-drawing.js.map +0 -1
- package/dist/src/tui/view/frog-easter-egg.js.map +0 -1
- package/dist/src/tui/view/frog-intro-renderer.js.map +0 -1
- package/dist/src/tui/view/help-footer.js +0 -48
- package/dist/src/tui/view/help-footer.js.map +0 -1
- package/dist/src/tui/view/interaction.js +0 -352
- package/dist/src/tui/view/interaction.js.map +0 -1
- package/dist/src/tui/view/markdown.js.map +0 -1
- package/dist/src/tui/view/mcp-trust-prompt.js +0 -17
- package/dist/src/tui/view/mcp-trust-prompt.js.map +0 -1
- package/dist/src/tui/view/media.js +0 -70
- package/dist/src/tui/view/media.js.map +0 -1
- package/dist/src/tui/view/model-panel.js +0 -77
- package/dist/src/tui/view/model-panel.js.map +0 -1
- package/dist/src/tui/view/panel-components.js +0 -17
- package/dist/src/tui/view/panel-components.js.map +0 -1
- package/dist/src/tui/view/panels.js +0 -139
- package/dist/src/tui/view/panels.js.map +0 -1
- package/dist/src/tui/view/presentation.js.map +0 -1
- package/dist/src/tui/view/prompt-editor.js +0 -82
- package/dist/src/tui/view/prompt-editor.js.map +0 -1
- package/dist/src/tui/view/provider-list.js +0 -14
- package/dist/src/tui/view/provider-list.js.map +0 -1
- package/dist/src/tui/view/rename-panel.js +0 -11
- package/dist/src/tui/view/rename-panel.js.map +0 -1
- package/dist/src/tui/view/sessions-panel.js +0 -15
- package/dist/src/tui/view/sessions-panel.js.map +0 -1
- package/dist/src/tui/view/settings-panel.js +0 -146
- package/dist/src/tui/view/settings-panel.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/brand.js +0 -34
- package/dist/src/tui/view/setup-wizard/brand.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/index.js +0 -1638
- package/dist/src/tui/view/setup-wizard/index.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/opening-menu.js +0 -99
- package/dist/src/tui/view/setup-wizard/opening-menu.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/path-completion.js +0 -53
- package/dist/src/tui/view/setup-wizard/path-completion.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/profile-fields.js +0 -29
- package/dist/src/tui/view/setup-wizard/profile-fields.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/progress.js +0 -43
- package/dist/src/tui/view/setup-wizard/progress.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/providers.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/settings-panel.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/steps.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/types.js.map +0 -1
- package/dist/src/tui/view/setup-wizard/use-provider-discovery.js +0 -143
- package/dist/src/tui/view/setup-wizard/use-provider-discovery.js.map +0 -1
- package/dist/src/tui/view/startup-view.js +0 -79
- package/dist/src/tui/view/startup-view.js.map +0 -1
- package/dist/src/tui/view/text-input.js +0 -33
- package/dist/src/tui/view/text-input.js.map +0 -1
- package/dist/src/tui/view/theme-detection.js +0 -45
- package/dist/src/tui/view/theme-detection.js.map +0 -1
- package/dist/src/tui/view/theme.js.map +0 -1
- package/dist/src/tui/view/transcript-layout.js +0 -60
- package/dist/src/tui/view/transcript-layout.js.map +0 -1
- package/dist/src/tui/view/transcript-turn.js +0 -135
- package/dist/src/tui/view/transcript-turn.js.map +0 -1
- package/dist/src/tui/view/transcript.js.map +0 -1
- package/dist/src/tui/view/use-party-frame.js +0 -15
- package/dist/src/tui/view/use-party-frame.js.map +0 -1
- package/dist/src/tui/view/use-spinner.js +0 -14
- package/dist/src/tui/view/use-spinner.js.map +0 -1
- package/dist/src/tui/voice/session.js.map +0 -1
- package/dist/src/tui/workspace/sandbox.js.map +0 -1
- package/dist/src/tui/workspace/trust.js.map +0 -1
- package/src/tui/voice/sidecar.py +0 -631
- /package/dist/src/{tui/view/setup-wizard → agent}/types.js +0 -0
- /package/dist/src/{tui/provider → model}/packages.js +0 -0
- /package/dist/src/{tui/terminal → terminal}/ink.js +0 -0
- /package/dist/src/{tui/terminal → terminal}/mouse-input.js +0 -0
- /package/dist/src/{tui → terminal}/npm.js +0 -0
- /package/dist/src/{tui/terminal → terminal}/process-tree.js +0 -0
- /package/dist/src/{tui/terminal → terminal}/shell-output.js +0 -0
- /package/dist/src/{tui → ui/chat}/stream-presentation.js +0 -0
|
@@ -1,1638 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
|
-
import { Box, useInput, useStdout } from 'ink';
|
|
4
|
-
import { useTerminalSize } from '../../terminal/size.js';
|
|
5
|
-
import stringWidth from 'string-width';
|
|
6
|
-
import { PROVIDER_CREDENTIAL_KEYS, PROVIDER_ENVIRONMENT_KEYS, PROVIDER_LABELS, PROVIDER_IDS, } from '../../config.js';
|
|
7
|
-
import { importAgentProject } from '../../project/import.js';
|
|
8
|
-
import { configurationFromStore } from '../../agent-configuration.js';
|
|
9
|
-
import { DEFAULT_SETTINGS_CATEGORY, SETTINGS_CATEGORIES } from '../../settings.js';
|
|
10
|
-
import { parseMouseInput } from '../../terminal/mouse-input.js';
|
|
11
|
-
import { emptyEditor, graphemes, reduceInputSequence } from '../../terminal/composer.js';
|
|
12
|
-
import { errorMessage, sanitizeTerminalText } from '../../terminal/sanitize.js';
|
|
13
|
-
import { canChooseDirectory, chooseAgentProject, chooseDirectory } from '../../terminal/directory-picker.js';
|
|
14
|
-
import { setTerminalMouseMotion } from '../../terminal/terminal.js';
|
|
15
|
-
import { elementAtMouse, elementContainsMouse, registerElement, mouseScrollDirection, scrollPanelViewport, revealPanelSelection, sliderOptionAtMouse, } from '../interaction.js';
|
|
16
|
-
import { wrapLines } from '../presentation.js';
|
|
17
|
-
import { Text, ThemeProvider, useTheme } from '../theme.js';
|
|
18
|
-
import { BlinkingCursor, EditableText } from '../text-input.js';
|
|
19
|
-
import { CustomThemeEditor } from '../custom-theme-editor.js';
|
|
20
|
-
import { Fade, mixHexColors, useFadeTransition } from '../fade-in.js';
|
|
21
|
-
import { PROVIDERS, compatibleProfile, exaWebSearchActive, providerSupportsWebSearch, providerAssessment, providerFromModel, quickstartDraft, } from './providers.js';
|
|
22
|
-
import { EXA_WEB_SEARCH_WARNING } from '../../builtin-tools.js';
|
|
23
|
-
import { memoryForDir } from './profile-fields.js';
|
|
24
|
-
import { APPEARANCE_STEP, appearanceSettings, CUSTOMIZE_STEPS, OPENING_CHOICES, rowsForStep, setupStepProgress, wizardSettingsRows, } from './steps.js';
|
|
25
|
-
import { useBrandAnimation, useBrandAnimationFrame } from '../startup-view.js';
|
|
26
|
-
import { SetupBrand, setupBrandFrame } from './brand.js';
|
|
27
|
-
import { OpeningMenu, openingGridLayout } from './opening-menu.js';
|
|
28
|
-
import { SetupSettingsPanel } from './settings-panel.js';
|
|
29
|
-
import { EffortSlider } from '../model-panel.js';
|
|
30
|
-
import { ProviderList } from '../provider-list.js';
|
|
31
|
-
import { useProviderDiscovery, useProviderDiscoveryEffects } from './use-provider-discovery.js';
|
|
32
|
-
import { importPathCompletions } from './path-completion.js';
|
|
33
|
-
import { SetupProgress } from './progress.js';
|
|
34
|
-
import { availableCliUpdate } from '../../update-check.js';
|
|
35
|
-
export function SetupWizard(props) {
|
|
36
|
-
const [appearance, setAppearance] = useState(() => appearanceSettings({ ...props.config.snapshot().settings, ...props.initialSettings }));
|
|
37
|
-
return (_jsx(ThemeProvider, { settings: appearance, children: _jsx(SetupWizardContent, { ...props, appearance: appearance, setAppearance: setAppearance }) }));
|
|
38
|
-
}
|
|
39
|
-
function SetupWizardContent({ appearance, setAppearance, config, deferred = false, appearanceOnly = false, onComplete, onCancel, initialSettings, checkForUpdate = availableCliUpdate, }) {
|
|
40
|
-
const { stdout } = useStdout();
|
|
41
|
-
const { columns, rows: terminalRows } = useTerminalSize();
|
|
42
|
-
const [flow, setFlow] = useState();
|
|
43
|
-
const [step, setStep] = useState(appearanceOnly ? APPEARANCE_STEP : 0);
|
|
44
|
-
const [settingsReturn, setSettingsReturn] = useState();
|
|
45
|
-
const [settingsCategory, setSettingsCategory] = useState(DEFAULT_SETTINGS_CATEGORY);
|
|
46
|
-
const [panelSettings, setPanelSettings] = useState(() => globalThis.structuredClone({ ...config.snapshot().settings, ...initialSettings }));
|
|
47
|
-
const [appearanceOpen, setAppearanceOpen] = useState(false);
|
|
48
|
-
const priorAppearance = useRef(appearance);
|
|
49
|
-
const openAppearance = useCallback(() => {
|
|
50
|
-
priorAppearance.current = appearance;
|
|
51
|
-
setAppearanceOpen(true);
|
|
52
|
-
}, [appearance]);
|
|
53
|
-
const previewAppearance = useCallback((next) => {
|
|
54
|
-
setAppearance((current) => ({ ...current, ...next }));
|
|
55
|
-
}, [setAppearance]);
|
|
56
|
-
function closeAppearance() {
|
|
57
|
-
setAppearance(priorAppearance.current);
|
|
58
|
-
setAppearanceOpen(false);
|
|
59
|
-
}
|
|
60
|
-
const palette = useTheme();
|
|
61
|
-
const { surface: COMMAND_DECK_BACKGROUND, panel: PANEL_BACKGROUND, selection: PANEL_SELECTION } = palette;
|
|
62
|
-
const panelTransition = useFadeTransition(appearance.animations);
|
|
63
|
-
const [selection, setSelection] = useState(0);
|
|
64
|
-
const [openingSelectionVisible, setOpeningSelectionVisible] = useState(false);
|
|
65
|
-
const [hoveredControl, setHoveredControl] = useState();
|
|
66
|
-
const [focusedAction, setFocusedAction] = useState();
|
|
67
|
-
const [draft, setDraft] = useState(() => {
|
|
68
|
-
const snapshot = config.snapshot();
|
|
69
|
-
const settings = { ...snapshot.settings, ...initialSettings };
|
|
70
|
-
return {
|
|
71
|
-
providers: [...snapshot.providers.enabled],
|
|
72
|
-
profile: snapshot.profile,
|
|
73
|
-
permissionMode: snapshot.permissions.mode,
|
|
74
|
-
allowedTools: [...snapshot.permissions.allow],
|
|
75
|
-
customPermissions: snapshot.permissions.mode === 'default' && snapshot.permissions.allow.length > 0,
|
|
76
|
-
settings: {
|
|
77
|
-
mcpDiscovery: settings.mcpDiscovery,
|
|
78
|
-
skillDiscovery: settings.skillDiscovery,
|
|
79
|
-
agentMessaging: settings.agentMessaging,
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
const [profileBaseDir] = useState(() => config.snapshot().profileBaseDir);
|
|
84
|
-
const [importPath, setImportPath] = useState('');
|
|
85
|
-
const [editing, setEditing] = useState();
|
|
86
|
-
const [pathCompletionIndex, setPathCompletionIndex] = useState(-1);
|
|
87
|
-
const [error, setError] = useState();
|
|
88
|
-
const [availableUpdate, setAvailableUpdate] = useState();
|
|
89
|
-
const [saving, setSaving] = useState(false);
|
|
90
|
-
const [choosingDirectory, setChoosingDirectory] = useState(false);
|
|
91
|
-
const choosingDirectoryRef = useRef(false);
|
|
92
|
-
const discovery = useProviderDiscovery(config);
|
|
93
|
-
const { detectedEnvironment, providerEnvironment, setProviderEnvironment, awsDiscovery, ollamaDiscovery, liteLlmDiscovery, providerModels, effectiveEnvironment, readyProviders, recheck, } = discovery;
|
|
94
|
-
const [modelViewportStart, setModelViewportStart] = useState(0);
|
|
95
|
-
const [modelQuery, setModelQuery] = useState('');
|
|
96
|
-
const [modelSearchFocused, setModelSearchFocused] = useState(false);
|
|
97
|
-
const [deselectedModel, setDeselectedModel] = useState();
|
|
98
|
-
const modelListElement = useRef(null);
|
|
99
|
-
const modelSearchElement = useRef(null);
|
|
100
|
-
const modelPreviousElement = useRef(null);
|
|
101
|
-
const modelNextElement = useRef(null);
|
|
102
|
-
const setupEffortSliderElement = useRef(null);
|
|
103
|
-
const [quickstartProvider, setQuickstartProvider] = useState('bedrock');
|
|
104
|
-
const [selecting, setSelecting] = useState();
|
|
105
|
-
const [frogAnimationId, setFrogAnimationId] = useState();
|
|
106
|
-
const rowElements = useRef(new Map());
|
|
107
|
-
const directoryElements = useRef(new Map());
|
|
108
|
-
const pathCompletionElements = useRef(new Map());
|
|
109
|
-
const selectOptionElements = useRef(new Map());
|
|
110
|
-
const choiceElements = useRef(new Map());
|
|
111
|
-
const backElement = useRef(undefined);
|
|
112
|
-
const nextElement = useRef(undefined);
|
|
113
|
-
const settingsElement = useRef(undefined);
|
|
114
|
-
const frogElement = useRef(undefined);
|
|
115
|
-
const frogPress = useRef(undefined);
|
|
116
|
-
const hoverPointer = useRef(undefined);
|
|
117
|
-
const pressedElement = useRef(undefined);
|
|
118
|
-
const width = Math.max(1, columns);
|
|
119
|
-
const height = Math.max(1, terminalRows);
|
|
120
|
-
const navigationHeight = width < 32 ? 2 : 3;
|
|
121
|
-
const accent = palette.accent;
|
|
122
|
-
const pathEditing = editing?.field === 'importPath' ? editing : undefined;
|
|
123
|
-
const pathCompletions = useMemo(() => {
|
|
124
|
-
if (!pathEditing ||
|
|
125
|
-
(pathEditing.cursor ?? graphemes(pathEditing.value).length) !== graphemes(pathEditing.value).length) {
|
|
126
|
-
return [];
|
|
127
|
-
}
|
|
128
|
-
return importPathCompletions(pathEditing.value);
|
|
129
|
-
}, [pathEditing]);
|
|
130
|
-
const importCompletionCapacity = Math.min(pathCompletions.length, 4);
|
|
131
|
-
useEffect(() => {
|
|
132
|
-
setPathCompletionIndex(-1);
|
|
133
|
-
}, [pathEditing?.value]);
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
if (appearanceOnly) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
let active = true;
|
|
139
|
-
void checkForUpdate().then((version) => {
|
|
140
|
-
if (active) {
|
|
141
|
-
setAvailableUpdate(version);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
return () => {
|
|
145
|
-
active = false;
|
|
146
|
-
};
|
|
147
|
-
}, [appearanceOnly, checkForUpdate]);
|
|
148
|
-
const isAppearance = step === APPEARANCE_STEP;
|
|
149
|
-
const isSettings = isAppearance && settingsReturn !== undefined;
|
|
150
|
-
const progress = appearanceOnly || isSettings ? undefined : setupStepProgress(flow, step);
|
|
151
|
-
const progressHeight = progress ? 3 : 0;
|
|
152
|
-
const updateAppearance = useCallback((next) => {
|
|
153
|
-
setAppearance(next);
|
|
154
|
-
setPanelSettings((current) => ({ ...current, ...next }));
|
|
155
|
-
if (isSettings) {
|
|
156
|
-
setError(undefined);
|
|
157
|
-
void config
|
|
158
|
-
.setSettings(next)
|
|
159
|
-
.catch((cause) => setError(cause instanceof Error ? cause.message : String(cause)));
|
|
160
|
-
}
|
|
161
|
-
}, [config, isSettings, setAppearance]);
|
|
162
|
-
const updateSettings = useCallback((next) => {
|
|
163
|
-
setPanelSettings(next);
|
|
164
|
-
setAppearance(appearanceSettings(next));
|
|
165
|
-
setDraft((current) => ({
|
|
166
|
-
...current,
|
|
167
|
-
settings: {
|
|
168
|
-
...current.settings,
|
|
169
|
-
mcpDiscovery: next.mcpDiscovery,
|
|
170
|
-
skillDiscovery: next.skillDiscovery,
|
|
171
|
-
agentMessaging: next.agentMessaging,
|
|
172
|
-
},
|
|
173
|
-
}));
|
|
174
|
-
setError(undefined);
|
|
175
|
-
void config
|
|
176
|
-
.setSettings(next)
|
|
177
|
-
.catch((cause) => setError(cause instanceof Error ? cause.message : String(cause)));
|
|
178
|
-
}, [config, setAppearance]);
|
|
179
|
-
const updateSetupSettings = useCallback((next) => {
|
|
180
|
-
setPanelSettings(next);
|
|
181
|
-
setAppearance(appearanceSettings(next));
|
|
182
|
-
setDraft((current) => ({
|
|
183
|
-
...current,
|
|
184
|
-
settings: {
|
|
185
|
-
...current.settings,
|
|
186
|
-
mcpDiscovery: next.mcpDiscovery,
|
|
187
|
-
skillDiscovery: next.skillDiscovery,
|
|
188
|
-
agentMessaging: next.agentMessaging,
|
|
189
|
-
},
|
|
190
|
-
}));
|
|
191
|
-
}, [setAppearance]);
|
|
192
|
-
const isProviderSetup = (flow === 'quickstart' || flow === 'customize') && step === 1;
|
|
193
|
-
const isTools = flow === 'customize' && step === 3;
|
|
194
|
-
const isPlugins = flow === 'customize' && step === 4;
|
|
195
|
-
const isCapabilities = isTools || isPlugins;
|
|
196
|
-
const isPermissions = flow === 'customize' && step === 6;
|
|
197
|
-
const isImport = flow === 'import' && step === 1;
|
|
198
|
-
const hasExternalActions = !isSettings && (isProviderSetup || isImport || isCapabilities || isAppearance || flow === 'customize');
|
|
199
|
-
const bubbleWidth = Math.max(1, Math.min(isProviderSetup ? 144 : 112, width - 2));
|
|
200
|
-
const lockupWidth = Math.max(1, width - 2);
|
|
201
|
-
const brandFrame = setupBrandFrame(lockupWidth, height);
|
|
202
|
-
const lockupHeight = brandFrame.height;
|
|
203
|
-
const showBrand = lockupHeight > 1;
|
|
204
|
-
const brandHeight = showBrand ? lockupHeight + 2 : 0;
|
|
205
|
-
const { columns: openingColumns, rowGap: openingRowGap } = openingGridLayout(lockupWidth);
|
|
206
|
-
const openingRows = Math.ceil(OPENING_CHOICES.length / openingColumns);
|
|
207
|
-
const openingContentHeight = height - brandHeight - navigationHeight - (error ? 2 : 0);
|
|
208
|
-
const openingTopGap = openingContentHeight >= openingRows * (openingColumns === 2 ? 9 : 5) + (openingRows - 1) * openingRowGap + 3
|
|
209
|
-
? 3
|
|
210
|
-
: openingContentHeight >= openingRows * (openingColumns === 2 ? 8 : 5) + (openingRows - 1) * openingRowGap + 2
|
|
211
|
-
? 2
|
|
212
|
-
: openingContentHeight >= openingRows * 3 + (openingRows - 1) * openingRowGap + 1
|
|
213
|
-
? 1
|
|
214
|
-
: 0;
|
|
215
|
-
const openingButtonHeight = Math.max(1, Math.min(openingColumns === 2 ? 9 : 5, Math.floor((openingContentHeight - openingTopGap - (openingRows - 1) * openingRowGap) / openingRows)));
|
|
216
|
-
const actionHeight = height >= 20 ? 3 : 1;
|
|
217
|
-
const actionGap = height >= 24 ? 1 : 0;
|
|
218
|
-
const actionColumnGap = bubbleWidth >= 3 ? 1 : 0;
|
|
219
|
-
const actionWidth = Math.max(1, Math.floor((bubbleWidth - actionColumnGap) / 2));
|
|
220
|
-
const splitQuickstart = isProviderSetup && bubbleWidth >= 38;
|
|
221
|
-
const quickstartProviderColumnWidth = Math.max(16, Math.min(31, Math.floor(bubbleWidth * 0.34)));
|
|
222
|
-
const quickstartDetailColumnWidth = bubbleWidth - quickstartProviderColumnWidth - 2;
|
|
223
|
-
const rowHeight = isAppearance
|
|
224
|
-
? 2
|
|
225
|
-
: isProviderSetup
|
|
226
|
-
? 4
|
|
227
|
-
: isCapabilities
|
|
228
|
-
? 1
|
|
229
|
-
: isPermissions
|
|
230
|
-
? 2
|
|
231
|
-
: flow === 'customize'
|
|
232
|
-
? step === 2
|
|
233
|
-
? 5
|
|
234
|
-
: step === 5
|
|
235
|
-
? 2
|
|
236
|
-
: 3
|
|
237
|
-
: 2;
|
|
238
|
-
const updateProfile = useCallback((update) => {
|
|
239
|
-
setDraft((current) => ({ ...current, profile: { ...current.profile, ...update } }));
|
|
240
|
-
}, []);
|
|
241
|
-
const credentialRejectedProvider = providerModels.provider === quickstartProvider &&
|
|
242
|
-
!providerModels.loading &&
|
|
243
|
-
providerModels.credentialRejected === true
|
|
244
|
-
? quickstartProvider
|
|
245
|
-
: undefined;
|
|
246
|
-
const keyCredentialProvider = ['anthropic', 'openai', 'google'].includes(quickstartProvider);
|
|
247
|
-
const credentialValidationProvider = isProviderSetup &&
|
|
248
|
-
keyCredentialProvider &&
|
|
249
|
-
readyProviders.includes(quickstartProvider) &&
|
|
250
|
-
(providerModels.provider !== quickstartProvider || providerModels.loading)
|
|
251
|
-
? quickstartProvider
|
|
252
|
-
: undefined;
|
|
253
|
-
const unavailableCredentialProvider = credentialRejectedProvider ?? credentialValidationProvider;
|
|
254
|
-
const setupReadyProviders = useMemo(() => unavailableCredentialProvider
|
|
255
|
-
? readyProviders.filter((provider) => provider !== unavailableCredentialProvider)
|
|
256
|
-
: readyProviders, [readyProviders, unavailableCredentialProvider]);
|
|
257
|
-
const rows = useMemo(() => {
|
|
258
|
-
const stepRows = isAppearance
|
|
259
|
-
? wizardSettingsRows({ ...panelSettings, ...draft.settings, ...appearance }, isSettings ? updateSettings : updateSetupSettings, openAppearance, 'all').filter(({ section }) => section === settingsCategory)
|
|
260
|
-
: rowsForStep(step, flow, draft, importPath, providerEnvironment, detectedEnvironment, quickstartProvider, setupReadyProviders, awsDiscovery, ollamaDiscovery, setDraft, updateProfile, setEditing, liteLlmDiscovery, credentialRejectedProvider, credentialValidationProvider, providerModels.error);
|
|
261
|
-
return isProviderSetup
|
|
262
|
-
? [
|
|
263
|
-
...stepRows,
|
|
264
|
-
{
|
|
265
|
-
id: 'refresh-provider',
|
|
266
|
-
label: '↻ Refresh',
|
|
267
|
-
description: '',
|
|
268
|
-
activate: () => {
|
|
269
|
-
try {
|
|
270
|
-
recheck();
|
|
271
|
-
setError(undefined);
|
|
272
|
-
}
|
|
273
|
-
catch (error) {
|
|
274
|
-
setError(errorMessage(error));
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
]
|
|
279
|
-
: stepRows;
|
|
280
|
-
}, [
|
|
281
|
-
appearance,
|
|
282
|
-
panelSettings,
|
|
283
|
-
openAppearance,
|
|
284
|
-
updateSetupSettings,
|
|
285
|
-
updateSettings,
|
|
286
|
-
isAppearance,
|
|
287
|
-
isSettings,
|
|
288
|
-
settingsCategory,
|
|
289
|
-
isProviderSetup,
|
|
290
|
-
awsDiscovery,
|
|
291
|
-
detectedEnvironment,
|
|
292
|
-
draft,
|
|
293
|
-
flow,
|
|
294
|
-
importPath,
|
|
295
|
-
ollamaDiscovery,
|
|
296
|
-
liteLlmDiscovery,
|
|
297
|
-
providerEnvironment,
|
|
298
|
-
quickstartProvider,
|
|
299
|
-
setupReadyProviders,
|
|
300
|
-
credentialRejectedProvider,
|
|
301
|
-
credentialValidationProvider,
|
|
302
|
-
providerModels.error,
|
|
303
|
-
recheck,
|
|
304
|
-
step,
|
|
305
|
-
updateProfile,
|
|
306
|
-
]);
|
|
307
|
-
const selectedModelProvider = providerFromModel(draft.profile.model);
|
|
308
|
-
const hasSelectedModel = deselectedModel !== draft.profile.model;
|
|
309
|
-
const canContinue = step !== 1 ||
|
|
310
|
-
(flow === 'import'
|
|
311
|
-
? importPath.trim().length > 0
|
|
312
|
-
: isProviderSetup
|
|
313
|
-
? hasSelectedModel &&
|
|
314
|
-
selectedModelProvider === quickstartProvider &&
|
|
315
|
-
setupReadyProviders.includes(quickstartProvider)
|
|
316
|
-
: draft.providers.some((provider) => readyProviders.includes(provider)));
|
|
317
|
-
const inspectedProvider = isProviderSetup ? quickstartProvider : undefined;
|
|
318
|
-
const inspectedAssessment = inspectedProvider
|
|
319
|
-
? providerAssessment(inspectedProvider, effectiveEnvironment, awsDiscovery, ollamaDiscovery, liteLlmDiscovery)
|
|
320
|
-
: undefined;
|
|
321
|
-
const warning = keyCredentialProvider ? undefined : inspectedAssessment?.warning;
|
|
322
|
-
const assessmentFacts = inspectedAssessment?.facts ?? [];
|
|
323
|
-
const quickstartExaSearchActive = flow === 'quickstart' && step === 1 && exaWebSearchActive(draft.profile);
|
|
324
|
-
const quickstartWebSearchOffered = rows.some((row) => row.id === 'quickstart-web-search');
|
|
325
|
-
const canShowQuickstartOptionsPanel = splitQuickstart && quickstartDetailColumnWidth >= 62;
|
|
326
|
-
const bannerWarning = warning
|
|
327
|
-
? assessmentFacts.length > 0
|
|
328
|
-
? [
|
|
329
|
-
PROVIDER_LABELS[inspectedProvider],
|
|
330
|
-
...assessmentFacts.map((fact) => `${fact.label}: ${fact.value}`),
|
|
331
|
-
'',
|
|
332
|
-
warning,
|
|
333
|
-
].join('\n')
|
|
334
|
-
: `${PROVIDER_LABELS[inspectedProvider]}: ${warning}`
|
|
335
|
-
: isTools || quickstartExaSearchActive
|
|
336
|
-
? EXA_WEB_SEARCH_WARNING
|
|
337
|
-
: undefined;
|
|
338
|
-
const bannerWarningStatus = warning ? inspectedAssessment.status : 'warning';
|
|
339
|
-
const providerReady = isProviderSetup && setupReadyProviders.includes(quickstartProvider);
|
|
340
|
-
const showProviderConfiguration = isProviderSetup && !providerReady;
|
|
341
|
-
const modelPanelVisible = splitQuickstart && providerReady;
|
|
342
|
-
const availableBubbleHeight = Math.max(1, height - brandHeight - progressHeight - (hasExternalActions ? actionHeight + actionGap : 0) - navigationHeight);
|
|
343
|
-
const bannerLines = (text) => wrapLines(`⚠ ${text}`, Math.max(1, bubbleWidth - 4)).slice(0, Math.max(0, availableBubbleHeight - rowHeight - 1 - Number(error !== undefined)));
|
|
344
|
-
const warningLines = bannerWarning && !splitQuickstart ? bannerLines(bannerWarning) : [];
|
|
345
|
-
// Reserve the Exa banner's space whether or not web_search is on, so toggling it doesn't resize the panel.
|
|
346
|
-
const warningHeight = (isTools || (quickstartWebSearchOffered && !splitQuickstart)) &&
|
|
347
|
-
!warning &&
|
|
348
|
-
!providerSupportsWebSearch(draft.profile.model)
|
|
349
|
-
? bannerLines(EXA_WEB_SEARCH_WARNING).length
|
|
350
|
-
: warningLines.length;
|
|
351
|
-
const warningGap = (isCapabilities || flow === 'quickstart') && warningHeight > 0 ? 1 : 0;
|
|
352
|
-
const extraRows = Number(error !== undefined) + warningGap + warningHeight;
|
|
353
|
-
const capabilityContentHeight = Math.max(0, rows.length - 1) * rowHeight + 2;
|
|
354
|
-
const bubbleHeight = isImport
|
|
355
|
-
? Math.min(9 + extraRows + importCompletionCapacity, availableBubbleHeight)
|
|
356
|
-
: isCapabilities
|
|
357
|
-
? Math.min(capabilityContentHeight + extraRows, availableBubbleHeight)
|
|
358
|
-
: isPermissions
|
|
359
|
-
? Math.min(9 + Math.max(0, rows.length - 3) * rowHeight + extraRows, availableBubbleHeight)
|
|
360
|
-
: isAppearance
|
|
361
|
-
? availableBubbleHeight
|
|
362
|
-
: flow === 'customize' && !isProviderSetup
|
|
363
|
-
? Math.min(rows.length * rowHeight + 3 + extraRows, availableBubbleHeight)
|
|
364
|
-
: availableBubbleHeight;
|
|
365
|
-
const panelChromeHeight = isProviderSetup || isCapabilities ? 0 : isAppearance || flow === 'customize' ? 2 : 4;
|
|
366
|
-
const rowCapacity = isAppearance
|
|
367
|
-
? settingsCategory === 'Appearance' && bubbleHeight < 18
|
|
368
|
-
? 1
|
|
369
|
-
: rows.length
|
|
370
|
-
: Math.max(1, Math.floor((bubbleHeight - panelChromeHeight - extraRows) / rowHeight));
|
|
371
|
-
const firstListRow = isCapabilities ? 1 : 0;
|
|
372
|
-
const viewportStart = Math.max(firstListRow, Math.min(selection - rowCapacity + 1, rows.length - rowCapacity));
|
|
373
|
-
const visibleRows = rows.slice(viewportStart, viewportStart + rowCapacity);
|
|
374
|
-
const hiddenRowsBefore = viewportStart;
|
|
375
|
-
const hiddenRowsAfter = Math.max(0, rows.length - viewportStart - visibleRows.length);
|
|
376
|
-
const customizeOverflowLabel = [
|
|
377
|
-
hiddenRowsBefore > 0 ? `↑ ${hiddenRowsBefore} previous` : '',
|
|
378
|
-
hiddenRowsAfter > 0 ? `↓ ${hiddenRowsAfter} more` : '',
|
|
379
|
-
]
|
|
380
|
-
.filter(Boolean)
|
|
381
|
-
.join(' · ');
|
|
382
|
-
const visibleCapabilityRows = isCapabilities ? visibleRows.filter((row) => row.id !== 'select-all') : [];
|
|
383
|
-
const permissionToolCapacity = Math.max(1, Math.floor((bubbleHeight - 9 - extraRows) / rowHeight));
|
|
384
|
-
const permissionViewportStart = Math.max(3, Math.min(selection - permissionToolCapacity + 1, rows.length - permissionToolCapacity));
|
|
385
|
-
const visiblePermissionTools = rows.slice(permissionViewportStart, permissionViewportStart + permissionToolCapacity);
|
|
386
|
-
const providerRows = isProviderSetup ? rows.slice(0, PROVIDER_IDS.length) : [];
|
|
387
|
-
const providerFieldRows = isProviderSetup ? rows.slice(PROVIDER_IDS.length) : [];
|
|
388
|
-
const refreshRow = providerFieldRows.find((row) => row.id === 'refresh-provider');
|
|
389
|
-
const providerConfigurationRows = providerFieldRows.filter((row) => row.id !== 'refresh-provider');
|
|
390
|
-
const providerWarningStatus = providerConfigurationRows.some((row) => row.input === true && PROVIDER_CREDENTIAL_KEYS.includes(row.field))
|
|
391
|
-
? 'error'
|
|
392
|
-
: bannerWarningStatus;
|
|
393
|
-
const availableReasoningRow = providerConfigurationRows.find((row) => row.id === 'thinking');
|
|
394
|
-
const selectedModelAvailable = hasSelectedModel &&
|
|
395
|
-
providerModels.provider === quickstartProvider &&
|
|
396
|
-
providerModels.available &&
|
|
397
|
-
!providerModels.loading &&
|
|
398
|
-
providerModels.models.some((model) => `${quickstartProvider}/${model.id}` === draft.profile.model);
|
|
399
|
-
const reasoningRow = selectedModelAvailable ? availableReasoningRow : undefined;
|
|
400
|
-
const reasoningRowIndex = reasoningRow ? rows.indexOf(reasoningRow) : -1;
|
|
401
|
-
const hiddenReasoningRowIndex = availableReasoningRow && !reasoningRow ? rows.indexOf(availableReasoningRow) : -1;
|
|
402
|
-
const reasoningSlider = reasoningRow?.choices && reasoningRow.choices.length > 0
|
|
403
|
-
? {
|
|
404
|
-
label: 'Effort',
|
|
405
|
-
options: reasoningRow.choices.map((choice, index) => ({
|
|
406
|
-
id: String(index),
|
|
407
|
-
label: choice.label,
|
|
408
|
-
...(choice.active ? { active: true } : {}),
|
|
409
|
-
})),
|
|
410
|
-
...(reasoningRow.disabled ? { disabled: true } : {}),
|
|
411
|
-
}
|
|
412
|
-
: undefined;
|
|
413
|
-
const webSearchRow = providerConfigurationRows.find((row) => row.id === 'quickstart-web-search');
|
|
414
|
-
const showModelOptionsPanel = modelPanelVisible && canShowQuickstartOptionsPanel && (reasoningSlider !== undefined || webSearchRow !== undefined);
|
|
415
|
-
const showReasoningPanel = showModelOptionsPanel && reasoningSlider !== undefined;
|
|
416
|
-
const readyProviderControlRows = providerConfigurationRows.filter((row) => (row.id !== 'thinking' || (reasoningRow !== undefined && !showReasoningPanel)) &&
|
|
417
|
-
(row.id !== 'quickstart-web-search' || !showModelOptionsPanel));
|
|
418
|
-
const directoryRows = new Map(rows.flatMap((row, index) => canChooseDirectory() && !row.disabled && (row.field === 'memoryDir' || row.field === 'skills')
|
|
419
|
-
? [[index, row.field]]
|
|
420
|
-
: []));
|
|
421
|
-
const quickstartBodyHeight = bubbleHeight - panelChromeHeight - extraRows;
|
|
422
|
-
const providerFooterHeight = refreshRow ? 4 : 0;
|
|
423
|
-
const quickstartProviderListCapacity = Math.max(1, quickstartBodyHeight - 2 - providerFooterHeight);
|
|
424
|
-
const quickstartProviderRowHeight = quickstartProviderListCapacity >= PROVIDER_IDS.length * 3 - 1
|
|
425
|
-
? 3
|
|
426
|
-
: quickstartProviderListCapacity >= PROVIDER_IDS.length * 2
|
|
427
|
-
? 2
|
|
428
|
-
: 1;
|
|
429
|
-
const quickstartProviderListHeight = Math.min(quickstartProviderListCapacity, PROVIDER_IDS.length * quickstartProviderRowHeight);
|
|
430
|
-
const quickstartFieldRowHeight = 5;
|
|
431
|
-
const middleFacts = splitQuickstart && showProviderConfiguration ? assessmentFacts : [];
|
|
432
|
-
const middleFactsHeight = middleFacts.length;
|
|
433
|
-
const middleDetailGap = middleFacts.length > 0 && warning ? 1 : 0;
|
|
434
|
-
const middleFieldGap = warning && providerConfigurationRows.length > 0 ? 1 : 0;
|
|
435
|
-
const quickstartFieldReserve = providerConfigurationRows.length > 0 ? quickstartFieldRowHeight : 0;
|
|
436
|
-
const middleWarningLines = splitQuickstart && showProviderConfiguration && warning
|
|
437
|
-
? wrapLines(warning, quickstartDetailColumnWidth - 3).slice(0, Math.max(0, quickstartBodyHeight - quickstartFieldReserve - middleFactsHeight - middleDetailGap - middleFieldGap))
|
|
438
|
-
: [];
|
|
439
|
-
const middleDetailHeight = middleFactsHeight + middleDetailGap + middleWarningLines.length + middleFieldGap;
|
|
440
|
-
const quickstartFieldCapacity = Math.max(1, Math.floor((quickstartBodyHeight - middleDetailHeight) / quickstartFieldRowHeight));
|
|
441
|
-
const selectedField = providerConfigurationRows.findIndex((row) => row === rows[selection]);
|
|
442
|
-
const quickstartFieldViewportStart = Math.max(0, Math.min(selectedField - quickstartFieldCapacity + 1, providerConfigurationRows.length - quickstartFieldCapacity));
|
|
443
|
-
const visibleProviderFieldRows = providerConfigurationRows.slice(quickstartFieldViewportStart, quickstartFieldViewportStart + quickstartFieldCapacity);
|
|
444
|
-
const filteredProviderModels = useMemo(() => {
|
|
445
|
-
const query = modelQuery.trim().toLowerCase();
|
|
446
|
-
return providerModels.models.filter((model) => `${model.name} ${model.id}`.toLowerCase().includes(query));
|
|
447
|
-
}, [modelQuery, providerModels.models]);
|
|
448
|
-
const quickstartModelOffset = rows.length;
|
|
449
|
-
const defaultModel = quickstartProvider === 'ollama' ? undefined : PROVIDERS[quickstartProvider].model(effectiveEnvironment);
|
|
450
|
-
const quickstartDefaultModel = defaultModel?.slice(defaultModel.indexOf('/') + 1);
|
|
451
|
-
const readyProviderControlsHeight = readyProviderControlRows.length * quickstartFieldRowHeight;
|
|
452
|
-
const quickstartModelRowHeight = 1;
|
|
453
|
-
const quickstartModelCapacity = Math.max(1, Math.floor((quickstartBodyHeight - 5 - readyProviderControlsHeight) / quickstartModelRowHeight));
|
|
454
|
-
const quickstartModelViewportStart = Math.max(0, Math.min(modelViewportStart, filteredProviderModels.length - quickstartModelCapacity));
|
|
455
|
-
const visibleProviderModels = filteredProviderModels.slice(quickstartModelViewportStart, quickstartModelViewportStart + quickstartModelCapacity);
|
|
456
|
-
const previousModelCount = quickstartModelViewportStart;
|
|
457
|
-
const nextModelCount = Math.max(0, filteredProviderModels.length - quickstartModelViewportStart - visibleProviderModels.length);
|
|
458
|
-
const showModelPagination = providerModels.provider === quickstartProvider && providerModels.available && visibleProviderModels.length > 0;
|
|
459
|
-
const quickstartModelContentWidth = Math.max(1, quickstartDetailColumnWidth - 4);
|
|
460
|
-
const quickstartModelNameWidth = Math.min(Math.max(1, ...filteredProviderModels.map((model) => stringWidth(model.name) + (model.id === quickstartDefaultModel ? 2 : 0))), Math.max(1, quickstartModelContentWidth - 15));
|
|
461
|
-
const quickstartModelIdWidth = Math.max(1, quickstartModelContentWidth - quickstartModelNameWidth - 3);
|
|
462
|
-
const quickstartSelectableRows = rows.length + (modelPanelVisible && providerModels.available ? filteredProviderModels.length : 0);
|
|
463
|
-
const controlBackground = (control, focused, disabled = false) => {
|
|
464
|
-
if (disabled || saving) {
|
|
465
|
-
return undefined;
|
|
466
|
-
}
|
|
467
|
-
return hoveredControl === control || focused ? PANEL_SELECTION : undefined;
|
|
468
|
-
};
|
|
469
|
-
const rowBackground = (index) => {
|
|
470
|
-
return controlBackground(index, focusedAction === undefined && !modelSearchFocused && index === selection, rows[index]?.disabled);
|
|
471
|
-
};
|
|
472
|
-
const backHoverBackground = mixHexColors(COMMAND_DECK_BACKGROUND, palette.error, palette.mode === 'dark' ? 0.22 : 0.16);
|
|
473
|
-
const nextHoverBackground = mixHexColors(COMMAND_DECK_BACKGROUND, palette.accent, palette.mode === 'dark' ? 0.22 : 0.16);
|
|
474
|
-
// Sized from every row, not just the visible ones, so descriptions stay aligned while scrolling.
|
|
475
|
-
const capabilityLabelWidth = Math.max(0, ...rows.filter((row) => row.id !== 'select-all').map((row) => graphemes(row.label).length));
|
|
476
|
-
const renderCapabilityRows = (capabilityRows) => (_jsx(Box, { flexGrow: 1, paddingX: 1, flexDirection: "column", overflow: "hidden", children: capabilityRows.map((row) => {
|
|
477
|
-
const index = rows.indexOf(row);
|
|
478
|
-
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), height: 1, paddingX: 1, flexShrink: 0, backgroundColor: rowBackground(index), children: [_jsx(Box, { width: capabilityLabelWidth + 4, flexShrink: 0, children: _jsxs(Text, { color: row.active ? accent : palette.foreground, bold: index === selection, wrap: "truncate-end", children: [row.active ? '☑' : '☐', " ", row.label] }) }), _jsx(Text, { ...(row.descriptionColor ? { color: row.descriptionColor } : { dimColor: true }), wrap: "truncate-end", children: row.description })] }, row.id));
|
|
479
|
-
}) }));
|
|
480
|
-
const renderChoices = (choices, index) => (_jsx(Box, { flexWrap: "wrap", children: choices.map((choice, choiceIndex) => {
|
|
481
|
-
const target = `choice:${index}:${choiceIndex}`;
|
|
482
|
-
return (_jsx(Box, { ref: (element) => registerElement(choiceElements.current, target, element), paddingX: 1, marginRight: 1, backgroundColor: controlBackground(target, choice.active), children: _jsx(Text, { bold: choice.active, ...(choice.active ? { color: accent } : {}), children: choice.label }) }, choice.label));
|
|
483
|
-
}) }));
|
|
484
|
-
const renderRefreshButton = (row, fieldWidth, compact = false) => {
|
|
485
|
-
const index = rows.indexOf(row);
|
|
486
|
-
const buttonWidth = Math.max(10, Math.floor(fieldWidth / 2));
|
|
487
|
-
return (_jsx(Box, { height: compact ? 4 : quickstartFieldRowHeight, flexShrink: 0, flexDirection: "column", justifyContent: compact ? 'flex-end' : 'flex-start', alignItems: "center", children: _jsx(Box, { ref: (element) => registerElement(rowElements.current, index, element), width: buttonWidth, height: 3, backgroundColor: rowBackground(index) ?? COMMAND_DECK_BACKGROUND, flexDirection: "column", justifyContent: "center", alignItems: "center", children: _jsx(Text, { bold: true, color: index === selection ? accent : palette.foreground, children: row.label }) }) }, row.id));
|
|
488
|
-
};
|
|
489
|
-
const renderProviderField = (row, fieldWidth) => {
|
|
490
|
-
const index = rows.indexOf(row);
|
|
491
|
-
const activeEditing = editing?.field === row.field ? editing : undefined;
|
|
492
|
-
const credential = PROVIDER_CREDENTIAL_KEYS.includes(row.field);
|
|
493
|
-
const editable = row.input === true;
|
|
494
|
-
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), height: quickstartFieldRowHeight, flexShrink: 0, flexDirection: "column", backgroundColor: credential && editable ? undefined : rowBackground(index), children: [_jsx(Text, { bold: true, ...(index === selection ? { color: accent } : {}), wrap: "truncate-end", children: row.label }), editable ? (_jsxs(_Fragment, { children: [_jsx(Box, { width: fieldWidth, height: 3, paddingX: 1, alignItems: "center", backgroundColor: rowBackground(index) ?? COMMAND_DECK_BACKGROUND, children: _jsx(EditableText, { value: activeEditing?.value ?? (row.selectOptions ? row.description : ''), cursor: activeEditing?.cursor ?? graphemes(activeEditing?.value ?? '').length, width: Math.max(1, fieldWidth - 4), active: Boolean(activeEditing), animate: appearance.animations, masked: credential }) }), credential ? (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: row.description })) : null] })) : row.choices?.length ? (renderChoices(row.choices, index)) : activeEditing ? (_jsx(EditableText, { value: activeEditing.value, cursor: activeEditing.cursor ?? graphemes(activeEditing.value).length, width: Math.max(1, fieldWidth - 4), active: true, animate: appearance.animations })) : (_jsx(Text, { dimColor: true, children: row.description || ' ' }))] }, row.id));
|
|
495
|
-
};
|
|
496
|
-
// The note keeps a fixed height so toggling Exa never resizes the panel.
|
|
497
|
-
const renderQuickstartWebSearch = (row, panel) => {
|
|
498
|
-
const index = rows.indexOf(row);
|
|
499
|
-
const focused = focusedAction === undefined && !modelSearchFocused && index === selection && !saving;
|
|
500
|
-
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), ...(panel ? {} : { height: quickstartFieldRowHeight }), flexShrink: 0, flexDirection: "column", children: [_jsx(Text, { bold: true, ...(panel || focused ? { color: accent } : {}), children: row.label }), _jsx(Box, { flexShrink: 0, alignSelf: "flex-start", backgroundColor: focused ? PANEL_SELECTION : COMMAND_DECK_BACKGROUND, children: row.choices?.map((choice, choiceIndex) => {
|
|
501
|
-
const target = `choice:${index}:${choiceIndex}`;
|
|
502
|
-
const background = choice.active
|
|
503
|
-
? nextHoverBackground
|
|
504
|
-
: hoveredControl === target && !saving
|
|
505
|
-
? PANEL_SELECTION
|
|
506
|
-
: undefined;
|
|
507
|
-
return (_jsx(Box, { ref: (element) => registerElement(choiceElements.current, target, element), paddingX: 2, backgroundColor: background, children: _jsx(Text, { bold: choice.active, ...(choice.active ? { color: accent } : { dimColor: true }), children: choice.label }) }, choice.label));
|
|
508
|
-
}) }), quickstartExaSearchActive ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: palette.warning, wrap: "truncate-end", children: "\u26A0 Third-party search via Exa" }), _jsx(Text, { dimColor: true, wrap: "truncate-end", children: "https://exa.ai/privacy-policy" })] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, wrap: "truncate-end", children: row.description }), _jsx(Text, { children: " " })] }))] }, row.id));
|
|
509
|
-
};
|
|
510
|
-
const renderProviderSelect = (state) => {
|
|
511
|
-
const capacity = Math.max(1, quickstartBodyHeight - middleDetailHeight - 3);
|
|
512
|
-
const start = Math.max(0, Math.min(state.selection - capacity + 1, state.options.length - capacity));
|
|
513
|
-
return (_jsxs(Box, { width: "100%", flexGrow: 1, backgroundColor: PANEL_BACKGROUND, paddingX: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Text, { bold: true, wrap: "truncate-end", children: providerFieldRows.find((row) => row.field === state.field)?.label ?? 'Choose' }), state.options.slice(start, start + capacity).map((option, index) => {
|
|
514
|
-
const optionIndex = start + index;
|
|
515
|
-
return (_jsx(Box, { ref: (element) => registerElement(selectOptionElements.current, optionIndex, element), flexShrink: 0, backgroundColor: controlBackground(`option:${optionIndex}`, optionIndex === state.selection), children: _jsxs(Text, { ...(optionIndex === state.selection ? { color: accent } : {}), wrap: "truncate-end", children: [optionIndex === state.selection ? '› ' : ' ', option.label] }) }, `${option.label}:${option.value ?? 'custom'}`));
|
|
516
|
-
})] }));
|
|
517
|
-
};
|
|
518
|
-
function setProviderValue(field, value) {
|
|
519
|
-
setProviderEnvironment((current) => {
|
|
520
|
-
const next = { ...current };
|
|
521
|
-
const normalized = value.trim();
|
|
522
|
-
if (normalized) {
|
|
523
|
-
next[field] = normalized;
|
|
524
|
-
}
|
|
525
|
-
else {
|
|
526
|
-
delete next[field];
|
|
527
|
-
}
|
|
528
|
-
return next;
|
|
529
|
-
});
|
|
530
|
-
setError(undefined);
|
|
531
|
-
}
|
|
532
|
-
function focusNextProviderField(field) {
|
|
533
|
-
const current = rows.findIndex((row) => row.field === field);
|
|
534
|
-
const next = rows.findIndex((row, index) => index > current && !row.disabled);
|
|
535
|
-
if (next >= 0) {
|
|
536
|
-
setSelection(next);
|
|
537
|
-
setFocusedAction(undefined);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
function chooseSelectOption(option) {
|
|
541
|
-
if (!selecting) {
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
if (option.custom) {
|
|
545
|
-
const current = providerEnvironment[selecting.field] ?? effectiveEnvironment[selecting.field]?.value ?? '';
|
|
546
|
-
setEditing({ field: selecting.field, value: current });
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
setProviderValue(selecting.field, option.value ?? '');
|
|
550
|
-
focusNextProviderField(selecting.field);
|
|
551
|
-
}
|
|
552
|
-
setSelecting(undefined);
|
|
553
|
-
}
|
|
554
|
-
const selectWizardRow = useCallback((index) => {
|
|
555
|
-
setFocusedAction(undefined);
|
|
556
|
-
setModelSearchFocused(false);
|
|
557
|
-
setSelection(index);
|
|
558
|
-
if (isProviderSetup && index >= quickstartModelOffset) {
|
|
559
|
-
setModelViewportStart((start) => revealPanelSelection(index - quickstartModelOffset, start, quickstartModelCapacity, filteredProviderModels.length));
|
|
560
|
-
}
|
|
561
|
-
if (isProviderSetup && index >= 0 && index < PROVIDER_IDS.length) {
|
|
562
|
-
if (PROVIDER_IDS[index] !== quickstartProvider) {
|
|
563
|
-
setModelQuery('');
|
|
564
|
-
setModelViewportStart(0);
|
|
565
|
-
setDeselectedModel(undefined);
|
|
566
|
-
}
|
|
567
|
-
setQuickstartProvider(PROVIDER_IDS[index]);
|
|
568
|
-
setSelecting(undefined);
|
|
569
|
-
setEditing(undefined);
|
|
570
|
-
}
|
|
571
|
-
}, [isProviderSetup, quickstartModelOffset, quickstartModelCapacity, filteredProviderModels.length, quickstartProvider]);
|
|
572
|
-
const updateModelQuery = (query) => {
|
|
573
|
-
setModelQuery(query);
|
|
574
|
-
setModelSearchFocused(true);
|
|
575
|
-
setFocusedAction(undefined);
|
|
576
|
-
setModelViewportStart(0);
|
|
577
|
-
setSelection(quickstartModelOffset);
|
|
578
|
-
setHoveredControl(undefined);
|
|
579
|
-
};
|
|
580
|
-
function paginateModels(direction) {
|
|
581
|
-
const lastPageStart = Math.max(0, filteredProviderModels.length - quickstartModelCapacity);
|
|
582
|
-
const nextStart = Math.max(0, Math.min(lastPageStart, quickstartModelViewportStart + direction * quickstartModelCapacity));
|
|
583
|
-
setModelViewportStart(nextStart);
|
|
584
|
-
setSelection(quickstartModelOffset + nextStart);
|
|
585
|
-
setModelSearchFocused(false);
|
|
586
|
-
setFocusedAction(undefined);
|
|
587
|
-
}
|
|
588
|
-
function browseForDirectory(field) {
|
|
589
|
-
if (choosingDirectoryRef.current) {
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
choosingDirectoryRef.current = true;
|
|
593
|
-
setChoosingDirectory(true);
|
|
594
|
-
setEditing(undefined);
|
|
595
|
-
setError(undefined);
|
|
596
|
-
const selection = field === 'importPath'
|
|
597
|
-
? chooseAgentProject()
|
|
598
|
-
: chooseDirectory(field === 'memoryDir' ? 'Choose a directory for agent memory' : 'Choose a directory containing agent skills');
|
|
599
|
-
void selection
|
|
600
|
-
.then((path) => {
|
|
601
|
-
if (!path)
|
|
602
|
-
return;
|
|
603
|
-
if (field === 'importPath') {
|
|
604
|
-
setImportPath(path);
|
|
605
|
-
setSelection(0);
|
|
606
|
-
}
|
|
607
|
-
else {
|
|
608
|
-
updateProfile(field === 'skills' ? { skills: [path] } : { memory: memoryForDir(path) });
|
|
609
|
-
}
|
|
610
|
-
})
|
|
611
|
-
.catch((cause) => {
|
|
612
|
-
setError(cause instanceof Error ? cause.message : String(cause));
|
|
613
|
-
})
|
|
614
|
-
.finally(() => {
|
|
615
|
-
choosingDirectoryRef.current = false;
|
|
616
|
-
setChoosingDirectory(false);
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
function chooseFlow(nextFlow) {
|
|
620
|
-
panelTransition.transition(() => {
|
|
621
|
-
setHoveredControl(undefined);
|
|
622
|
-
setFocusedAction(undefined);
|
|
623
|
-
setModelQuery('');
|
|
624
|
-
setModelSearchFocused(false);
|
|
625
|
-
setFlow(nextFlow);
|
|
626
|
-
setStep(1);
|
|
627
|
-
setError(undefined);
|
|
628
|
-
if (nextFlow !== 'import') {
|
|
629
|
-
const provider = providerFromModel(draft.profile.model) ?? 'bedrock';
|
|
630
|
-
if (nextFlow === 'quickstart') {
|
|
631
|
-
setDraft(quickstartDraft(provider, effectiveEnvironment));
|
|
632
|
-
}
|
|
633
|
-
setQuickstartProvider(provider);
|
|
634
|
-
setSelection(PROVIDER_IDS.indexOf(provider));
|
|
635
|
-
}
|
|
636
|
-
else {
|
|
637
|
-
setSelection(0);
|
|
638
|
-
setImportPath('');
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
function chooseOpeningChoice(choice) {
|
|
643
|
-
if (choice !== 'resume') {
|
|
644
|
-
chooseFlow(choice);
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
if (config.needsSetup()) {
|
|
648
|
-
setError('No harness is ready to resume yet. Choose Quickstart or Customize to create one, or Import your own.');
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
651
|
-
onCancel?.(0);
|
|
652
|
-
}
|
|
653
|
-
function completeSetup(completedDraft = draft, agentProject) {
|
|
654
|
-
let saved;
|
|
655
|
-
setSaving(true);
|
|
656
|
-
if (appearanceOnly || agentProject) {
|
|
657
|
-
if (deferred) {
|
|
658
|
-
onComplete({
|
|
659
|
-
configuration: {
|
|
660
|
-
...configurationFromStore(config),
|
|
661
|
-
settings: { ...panelSettings, ...completedDraft.settings, ...appearance },
|
|
662
|
-
},
|
|
663
|
-
...(agentProject ? { agentProject } : {}),
|
|
664
|
-
});
|
|
665
|
-
return;
|
|
666
|
-
}
|
|
667
|
-
saved = appearanceOnly
|
|
668
|
-
? config.setSettings({ ...panelSettings, ...appearance })
|
|
669
|
-
: config.useAgentProject(agentProject, {
|
|
670
|
-
...panelSettings,
|
|
671
|
-
...completedDraft.settings,
|
|
672
|
-
...appearance,
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
else {
|
|
676
|
-
setError(undefined);
|
|
677
|
-
const configuration = {
|
|
678
|
-
providers: completedDraft.providers,
|
|
679
|
-
profile: compatibleProfile(completedDraft.profile),
|
|
680
|
-
...(profileBaseDir !== undefined ? { profileBaseDir } : {}),
|
|
681
|
-
permissionMode: completedDraft.permissionMode,
|
|
682
|
-
allowedTools: completedDraft.customPermissions || completedDraft.permissionMode === 'bypassPermissions'
|
|
683
|
-
? completedDraft.allowedTools
|
|
684
|
-
: [],
|
|
685
|
-
providerEnvironment,
|
|
686
|
-
settings: { ...panelSettings, ...completedDraft.settings, ...appearance },
|
|
687
|
-
};
|
|
688
|
-
if (deferred) {
|
|
689
|
-
onComplete({ configuration });
|
|
690
|
-
return;
|
|
691
|
-
}
|
|
692
|
-
saved = config.saveSetup(configuration);
|
|
693
|
-
}
|
|
694
|
-
void saved
|
|
695
|
-
.then(() => onComplete())
|
|
696
|
-
.catch((cause) => {
|
|
697
|
-
setSaving(false);
|
|
698
|
-
setError(cause instanceof Error ? cause.message : String(cause));
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
function continueFlow() {
|
|
702
|
-
if (editing || selecting || saving) {
|
|
703
|
-
return;
|
|
704
|
-
}
|
|
705
|
-
if (step === 0) {
|
|
706
|
-
chooseOpeningChoice(OPENING_CHOICES[selection].id);
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
if (isAppearance) {
|
|
710
|
-
completeSetup();
|
|
711
|
-
return;
|
|
712
|
-
}
|
|
713
|
-
if (flow === 'import') {
|
|
714
|
-
try {
|
|
715
|
-
const imported = importAgentProject(importPath);
|
|
716
|
-
completeSetup(draft, imported.entrypoint);
|
|
717
|
-
}
|
|
718
|
-
catch (cause) {
|
|
719
|
-
setError(cause instanceof Error ? cause.message : String(cause));
|
|
720
|
-
}
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
|
-
if (!canContinue) {
|
|
724
|
-
setError('Select a provider with detected credentials; follow the provider setup instructions.');
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
if (flow === 'quickstart') {
|
|
728
|
-
const provider = providerFromModel(draft.profile.model);
|
|
729
|
-
if (!provider || !readyProviders.includes(provider)) {
|
|
730
|
-
setError('The selected model provider needs setup.');
|
|
731
|
-
panelTransition.transition(() => setStep(1));
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
const completedDraft = {
|
|
735
|
-
...draft,
|
|
736
|
-
providers: [provider, ...draft.providers.filter((candidate) => candidate !== provider)],
|
|
737
|
-
};
|
|
738
|
-
setDraft(completedDraft);
|
|
739
|
-
completeSetup(completedDraft);
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
if (step < CUSTOMIZE_STEPS.length) {
|
|
743
|
-
panelTransition.transition(() => {
|
|
744
|
-
setStep((current) => current + 1);
|
|
745
|
-
setFocusedAction(undefined);
|
|
746
|
-
setSelection(0);
|
|
747
|
-
setError(undefined);
|
|
748
|
-
setModelSearchFocused(false);
|
|
749
|
-
});
|
|
750
|
-
return;
|
|
751
|
-
}
|
|
752
|
-
const selectedProvider = providerFromModel(draft.profile.model);
|
|
753
|
-
if (selectedProvider && !readyProviders.includes(selectedProvider)) {
|
|
754
|
-
setError('The selected model provider needs setup.');
|
|
755
|
-
panelTransition.transition(() => {
|
|
756
|
-
setStep(1);
|
|
757
|
-
setSelection(PROVIDER_IDS.indexOf(selectedProvider));
|
|
758
|
-
});
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
completeSetup();
|
|
762
|
-
}
|
|
763
|
-
function moveBack() {
|
|
764
|
-
if (editing || selecting || saving) {
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
setFocusedAction(undefined);
|
|
768
|
-
if (isAppearance) {
|
|
769
|
-
if (isSettings) {
|
|
770
|
-
const destination = settingsReturn;
|
|
771
|
-
panelTransition.transition(() => {
|
|
772
|
-
setFlow(destination.flow);
|
|
773
|
-
setStep(destination.step);
|
|
774
|
-
setSelection(destination.selection);
|
|
775
|
-
setSettingsReturn(undefined);
|
|
776
|
-
setError(undefined);
|
|
777
|
-
});
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
if (appearanceOnly) {
|
|
781
|
-
onCancel?.(0);
|
|
782
|
-
}
|
|
783
|
-
return;
|
|
784
|
-
}
|
|
785
|
-
if (step <= 1) {
|
|
786
|
-
if (step === 0) {
|
|
787
|
-
onCancel?.(0);
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
panelTransition.transition(() => {
|
|
791
|
-
setFlow(undefined);
|
|
792
|
-
setStep(0);
|
|
793
|
-
setSelection(0);
|
|
794
|
-
setOpeningSelectionVisible(false);
|
|
795
|
-
setError(undefined);
|
|
796
|
-
});
|
|
797
|
-
return;
|
|
798
|
-
}
|
|
799
|
-
panelTransition.transition(() => {
|
|
800
|
-
setStep((current) => current - 1);
|
|
801
|
-
setSelection(step === 2 ? PROVIDER_IDS.indexOf(quickstartProvider) : 0);
|
|
802
|
-
setError(undefined);
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
function openSettings() {
|
|
806
|
-
if (isAppearance) {
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
panelTransition.transition(() => {
|
|
810
|
-
setSettingsReturn({ flow, step, selection });
|
|
811
|
-
setSettingsCategory(DEFAULT_SETTINGS_CATEGORY);
|
|
812
|
-
setStep(APPEARANCE_STEP);
|
|
813
|
-
setSelection(0);
|
|
814
|
-
setFocusedAction(undefined);
|
|
815
|
-
setError(undefined);
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
function commitEdit() {
|
|
819
|
-
if (!editing) {
|
|
820
|
-
return true;
|
|
821
|
-
}
|
|
822
|
-
const value = editing.value.trim();
|
|
823
|
-
if (isProviderEnvironmentKey(editing.field)) {
|
|
824
|
-
if (PROVIDER_CREDENTIAL_KEYS.includes(editing.field)) {
|
|
825
|
-
if (!value) {
|
|
826
|
-
setError('API key cannot be empty.');
|
|
827
|
-
return false;
|
|
828
|
-
}
|
|
829
|
-
try {
|
|
830
|
-
config.setSessionProviderCredential(editing.field, value);
|
|
831
|
-
recheck();
|
|
832
|
-
}
|
|
833
|
-
catch (cause) {
|
|
834
|
-
setError(cause instanceof Error ? cause.message : String(cause));
|
|
835
|
-
return false;
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
else {
|
|
839
|
-
setProviderValue(editing.field, value);
|
|
840
|
-
focusNextProviderField(editing.field);
|
|
841
|
-
}
|
|
842
|
-
setEditing(undefined);
|
|
843
|
-
setError(undefined);
|
|
844
|
-
return true;
|
|
845
|
-
}
|
|
846
|
-
if (!value && editing.field !== 'instructions') {
|
|
847
|
-
setError('This field cannot be empty.');
|
|
848
|
-
return false;
|
|
849
|
-
}
|
|
850
|
-
if (editing.field === 'importPath') {
|
|
851
|
-
setImportPath(value);
|
|
852
|
-
}
|
|
853
|
-
else if (editing.field === 'memoryDir') {
|
|
854
|
-
updateProfile({ memory: memoryForDir(value) });
|
|
855
|
-
}
|
|
856
|
-
else if (editing.field === 'skills') {
|
|
857
|
-
const paths = value
|
|
858
|
-
.split(',')
|
|
859
|
-
.map((path) => path.trim())
|
|
860
|
-
.filter(Boolean);
|
|
861
|
-
// No directories keeps the library default (`true`) rather than turning skills off.
|
|
862
|
-
updateProfile({ skills: paths.length === 0 ? true : paths });
|
|
863
|
-
}
|
|
864
|
-
else {
|
|
865
|
-
updateProfile({ [editing.field]: value });
|
|
866
|
-
}
|
|
867
|
-
setEditing(undefined);
|
|
868
|
-
setError(undefined);
|
|
869
|
-
return true;
|
|
870
|
-
}
|
|
871
|
-
function leaveEdit() {
|
|
872
|
-
setEditing(undefined);
|
|
873
|
-
setError(undefined);
|
|
874
|
-
}
|
|
875
|
-
function applyPathCompletion(index = pathCompletionIndex < 0 ? 0 : pathCompletionIndex) {
|
|
876
|
-
const completion = pathCompletions[index];
|
|
877
|
-
if (!completion || !pathEditing) {
|
|
878
|
-
return;
|
|
879
|
-
}
|
|
880
|
-
setEditing({
|
|
881
|
-
...pathEditing,
|
|
882
|
-
value: completion.value,
|
|
883
|
-
cursor: graphemes(completion.value).length,
|
|
884
|
-
});
|
|
885
|
-
setError(undefined);
|
|
886
|
-
}
|
|
887
|
-
function activateRow(index) {
|
|
888
|
-
if (step === 0) {
|
|
889
|
-
chooseOpeningChoice(OPENING_CHOICES[index].id);
|
|
890
|
-
return;
|
|
891
|
-
}
|
|
892
|
-
if (isImport && index === 1) {
|
|
893
|
-
browseForDirectory('importPath');
|
|
894
|
-
return;
|
|
895
|
-
}
|
|
896
|
-
if (isProviderSetup && index >= quickstartModelOffset) {
|
|
897
|
-
const model = filteredProviderModels[index - quickstartModelOffset];
|
|
898
|
-
if (!model) {
|
|
899
|
-
return;
|
|
900
|
-
}
|
|
901
|
-
const profile = quickstartDraft(quickstartProvider, effectiveEnvironment).profile;
|
|
902
|
-
const modelSpecifier = `${quickstartProvider}/${model.id}`;
|
|
903
|
-
if (draft.profile.model === modelSpecifier && deselectedModel !== modelSpecifier) {
|
|
904
|
-
setDeselectedModel(modelSpecifier);
|
|
905
|
-
setError(undefined);
|
|
906
|
-
return;
|
|
907
|
-
}
|
|
908
|
-
setDeselectedModel(undefined);
|
|
909
|
-
setDraft((current) => ({
|
|
910
|
-
...current,
|
|
911
|
-
providers: [quickstartProvider, ...current.providers.filter((provider) => provider !== quickstartProvider)],
|
|
912
|
-
profile: compatibleProfile({
|
|
913
|
-
...current.profile,
|
|
914
|
-
effort: profile.effort,
|
|
915
|
-
caching: profile.caching,
|
|
916
|
-
model: modelSpecifier,
|
|
917
|
-
}),
|
|
918
|
-
}));
|
|
919
|
-
setError(undefined);
|
|
920
|
-
return;
|
|
921
|
-
}
|
|
922
|
-
if (isProviderSetup && index < PROVIDER_IDS.length && !readyProviders.includes(PROVIDER_IDS[index])) {
|
|
923
|
-
const fieldIndex = rows.findIndex((row) => row.field !== undefined && row.input === true);
|
|
924
|
-
const field = rows[fieldIndex];
|
|
925
|
-
if (fieldIndex >= PROVIDER_IDS.length && field) {
|
|
926
|
-
setSelection(fieldIndex);
|
|
927
|
-
field.activate();
|
|
928
|
-
}
|
|
929
|
-
return;
|
|
930
|
-
}
|
|
931
|
-
const row = rows[index];
|
|
932
|
-
if (!row || row.disabled) {
|
|
933
|
-
return;
|
|
934
|
-
}
|
|
935
|
-
if (editing && editing.field === row.field) {
|
|
936
|
-
return;
|
|
937
|
-
}
|
|
938
|
-
if (flow === 'customize' && step === CUSTOMIZE_STEPS.length) {
|
|
939
|
-
const destination = [1, 2, 1, 3, 4, 5, 6][index];
|
|
940
|
-
panelTransition.transition(() => {
|
|
941
|
-
setStep(destination);
|
|
942
|
-
setSelection(destination === 1 ? PROVIDER_IDS.indexOf(quickstartProvider) : 0);
|
|
943
|
-
setFocusedAction(undefined);
|
|
944
|
-
});
|
|
945
|
-
return;
|
|
946
|
-
}
|
|
947
|
-
if (row.choices?.length) {
|
|
948
|
-
const selected = row.choices.findIndex((choice) => choice.active);
|
|
949
|
-
row.choices[(selected + 1) % row.choices.length].activate();
|
|
950
|
-
return;
|
|
951
|
-
}
|
|
952
|
-
if (row.selectOptions && row.field && isProviderEnvironmentKey(row.field)) {
|
|
953
|
-
const current = providerEnvironment[row.field] ?? effectiveEnvironment[row.field]?.value;
|
|
954
|
-
const selected = Math.max(0, row.selectOptions.findIndex((option) => !option.custom && option.value === current));
|
|
955
|
-
setSelecting({ field: row.field, options: row.selectOptions, selection: selected });
|
|
956
|
-
setEditing(undefined);
|
|
957
|
-
return;
|
|
958
|
-
}
|
|
959
|
-
row.activate();
|
|
960
|
-
}
|
|
961
|
-
useEffect(() => {
|
|
962
|
-
setTerminalMouseMotion(true, stdout);
|
|
963
|
-
return () => setTerminalMouseMotion(false, stdout);
|
|
964
|
-
}, [stdout]);
|
|
965
|
-
useEffect(() => {
|
|
966
|
-
hoverPointer.current = undefined;
|
|
967
|
-
setHoveredControl(undefined);
|
|
968
|
-
pressedElement.current = undefined;
|
|
969
|
-
}, [step, flow, quickstartProvider, selecting?.field, modelViewportStart]);
|
|
970
|
-
useEffect(() => {
|
|
971
|
-
pressedElement.current = undefined;
|
|
972
|
-
frogPress.current = undefined;
|
|
973
|
-
const mouse = hoverPointer.current;
|
|
974
|
-
if (step !== 0 || !mouse) {
|
|
975
|
-
setHoveredControl(undefined);
|
|
976
|
-
return;
|
|
977
|
-
}
|
|
978
|
-
const row = elementAtMouse(rowElements.current, mouse);
|
|
979
|
-
const settings = settingsElement.current && elementContainsMouse(settingsElement.current, mouse);
|
|
980
|
-
setHoveredControl(row ?? (settings ? 'settings' : undefined));
|
|
981
|
-
}, [width, height]);
|
|
982
|
-
useEffect(() => {
|
|
983
|
-
if (isProviderSetup && !modelPanelVisible && (modelSearchFocused || selection >= quickstartModelOffset)) {
|
|
984
|
-
selectWizardRow(PROVIDER_IDS.indexOf(quickstartProvider));
|
|
985
|
-
}
|
|
986
|
-
}, [
|
|
987
|
-
isProviderSetup,
|
|
988
|
-
modelPanelVisible,
|
|
989
|
-
modelSearchFocused,
|
|
990
|
-
selection,
|
|
991
|
-
quickstartModelOffset,
|
|
992
|
-
quickstartProvider,
|
|
993
|
-
selectWizardRow,
|
|
994
|
-
]);
|
|
995
|
-
useProviderDiscoveryEffects(discovery, isProviderSetup, quickstartProvider);
|
|
996
|
-
useEffect(() => {
|
|
997
|
-
if (!isProviderSetup || awsDiscovery.credentialStatus === undefined || !ollamaDiscovery) {
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
setDraft((current) => {
|
|
1001
|
-
const providers = [
|
|
1002
|
-
...current.providers.filter((provider) => !config.needsSetup() || readyProviders.includes(provider)),
|
|
1003
|
-
...readyProviders.filter((provider) => !current.providers.includes(provider)),
|
|
1004
|
-
];
|
|
1005
|
-
const sameProviders = providers.length === current.providers.length &&
|
|
1006
|
-
providers.every((provider, index) => provider === current.providers[index]);
|
|
1007
|
-
const modelProvider = providerFromModel(current.profile.model);
|
|
1008
|
-
const defaultProvider = providers[0];
|
|
1009
|
-
let profile = current.profile;
|
|
1010
|
-
if (config.needsSetup() && defaultProvider && (!modelProvider || !providers.includes(modelProvider))) {
|
|
1011
|
-
const defaults = quickstartDraft(defaultProvider, effectiveEnvironment).profile;
|
|
1012
|
-
profile = compatibleProfile({
|
|
1013
|
-
...profile,
|
|
1014
|
-
model: defaults.model,
|
|
1015
|
-
effort: defaults.effort,
|
|
1016
|
-
caching: defaults.caching,
|
|
1017
|
-
});
|
|
1018
|
-
}
|
|
1019
|
-
if (sameProviders && profile === current.profile) {
|
|
1020
|
-
return current;
|
|
1021
|
-
}
|
|
1022
|
-
return { ...current, providers, profile };
|
|
1023
|
-
});
|
|
1024
|
-
}, [awsDiscovery.credentialStatus, config, effectiveEnvironment, isProviderSetup, ollamaDiscovery, readyProviders]);
|
|
1025
|
-
const frogClockMs = useBrandAnimation(frogAnimationId);
|
|
1026
|
-
const frogElapsedMs = useBrandAnimationFrame(frogClockMs, brandFrame.width, brandFrame.height);
|
|
1027
|
-
useInput((input, key) => {
|
|
1028
|
-
if (appearanceOpen || panelTransition.transitioning)
|
|
1029
|
-
return;
|
|
1030
|
-
const mouse = parseMouseInput(input);
|
|
1031
|
-
if (mouse) {
|
|
1032
|
-
hoverPointer.current = mouse;
|
|
1033
|
-
const scroll = mouseScrollDirection(mouse);
|
|
1034
|
-
if (scroll !== undefined) {
|
|
1035
|
-
hoverPointer.current = undefined;
|
|
1036
|
-
setHoveredControl(undefined);
|
|
1037
|
-
if (isProviderSetup && modelListElement.current && elementContainsMouse(modelListElement.current, mouse)) {
|
|
1038
|
-
setModelViewportStart((start) => scrollPanelViewport(start, scroll, filteredProviderModels.length, quickstartModelCapacity));
|
|
1039
|
-
}
|
|
1040
|
-
else if (isCapabilities || isAppearance || flow === 'customize') {
|
|
1041
|
-
setFocusedAction(undefined);
|
|
1042
|
-
setSelection((current) => scrollPanelViewport(current, scroll, rows.length, 1));
|
|
1043
|
-
}
|
|
1044
|
-
return;
|
|
1045
|
-
}
|
|
1046
|
-
const selectOption = elementAtMouse(selectOptionElements.current, mouse);
|
|
1047
|
-
const choice = elementAtMouse(choiceElements.current, mouse);
|
|
1048
|
-
const pathCompletion = elementAtMouse(pathCompletionElements.current, mouse);
|
|
1049
|
-
const directory = elementAtMouse(directoryElements.current, mouse);
|
|
1050
|
-
const row = elementAtMouse(rowElements.current, mouse);
|
|
1051
|
-
const back = backElement.current ? elementContainsMouse(backElement.current, mouse) : false;
|
|
1052
|
-
const next = nextElement.current ? elementContainsMouse(nextElement.current, mouse) : false;
|
|
1053
|
-
const settings = settingsElement.current ? elementContainsMouse(settingsElement.current, mouse) : false;
|
|
1054
|
-
const frog = frogElement.current ? elementContainsMouse(frogElement.current, mouse) : false;
|
|
1055
|
-
const search = modelSearchElement.current ? elementContainsMouse(modelSearchElement.current, mouse) : false;
|
|
1056
|
-
const modelsPrevious = previousModelCount > 0 && modelPreviousElement.current
|
|
1057
|
-
? elementContainsMouse(modelPreviousElement.current, mouse)
|
|
1058
|
-
: false;
|
|
1059
|
-
const modelsNext = nextModelCount > 0 && modelNextElement.current ? elementContainsMouse(modelNextElement.current, mouse) : false;
|
|
1060
|
-
const effortSliderHit = setupEffortSliderElement.current
|
|
1061
|
-
? elementContainsMouse(setupEffortSliderElement.current, mouse)
|
|
1062
|
-
: false;
|
|
1063
|
-
const target = modelsPrevious || modelsNext
|
|
1064
|
-
? modelsPrevious
|
|
1065
|
-
? 'models-previous'
|
|
1066
|
-
: 'models-next'
|
|
1067
|
-
: ((pathCompletion !== undefined ? `completion:${pathCompletion}` : undefined) ??
|
|
1068
|
-
(directory !== undefined ? `browse:${directory}` : undefined) ??
|
|
1069
|
-
choice ??
|
|
1070
|
-
(selectOption !== undefined
|
|
1071
|
-
? `option:${selectOption}`
|
|
1072
|
-
: row !== undefined && !rows[row]?.disabled && !(isImport && row === 1 && choosingDirectory)
|
|
1073
|
-
? row
|
|
1074
|
-
: back
|
|
1075
|
-
? 'back'
|
|
1076
|
-
: next && canContinue
|
|
1077
|
-
? 'next'
|
|
1078
|
-
: settings
|
|
1079
|
-
? 'settings'
|
|
1080
|
-
: search
|
|
1081
|
-
? 'search'
|
|
1082
|
-
: undefined));
|
|
1083
|
-
if (saving || choosingDirectory) {
|
|
1084
|
-
return;
|
|
1085
|
-
}
|
|
1086
|
-
if (mouse.action === 'press' && (mouse.button & 3) === 0) {
|
|
1087
|
-
if (editing &&
|
|
1088
|
-
!(typeof target === 'string' && target.startsWith('completion:')) &&
|
|
1089
|
-
(target === undefined || typeof target !== 'number' || rows[target]?.field !== editing.field)) {
|
|
1090
|
-
leaveEdit();
|
|
1091
|
-
}
|
|
1092
|
-
if (selecting && selectOption === undefined) {
|
|
1093
|
-
setSelecting(undefined);
|
|
1094
|
-
}
|
|
1095
|
-
if (effortSliderHit && reasoningSlider && reasoningRow?.choices) {
|
|
1096
|
-
pressedElement.current = undefined;
|
|
1097
|
-
const option = sliderOptionAtMouse(reasoningSlider, setupEffortSliderElement.current, mouse);
|
|
1098
|
-
const choice = option ? reasoningRow.choices[Number(option.id)] : undefined;
|
|
1099
|
-
if (choice) {
|
|
1100
|
-
choice.activate();
|
|
1101
|
-
setSelection(reasoningRowIndex);
|
|
1102
|
-
setFocusedAction(undefined);
|
|
1103
|
-
}
|
|
1104
|
-
return;
|
|
1105
|
-
}
|
|
1106
|
-
frogPress.current = frog ? { column: mouse.column, row: mouse.row } : undefined;
|
|
1107
|
-
pressedElement.current = target;
|
|
1108
|
-
if (selectOption !== undefined && selecting) {
|
|
1109
|
-
setSelecting({ ...selecting, selection: selectOption });
|
|
1110
|
-
}
|
|
1111
|
-
else if (pathCompletion !== undefined) {
|
|
1112
|
-
setPathCompletionIndex(pathCompletion);
|
|
1113
|
-
}
|
|
1114
|
-
else if (typeof target === 'number') {
|
|
1115
|
-
selectWizardRow(target);
|
|
1116
|
-
}
|
|
1117
|
-
else if (typeof target === 'string' && target.startsWith('browse:')) {
|
|
1118
|
-
selectWizardRow(directory);
|
|
1119
|
-
setFocusedAction(`browse:${directory}`);
|
|
1120
|
-
}
|
|
1121
|
-
else if (target === 'back' || target === 'next' || target === 'settings') {
|
|
1122
|
-
setFocusedAction(target);
|
|
1123
|
-
setModelSearchFocused(false);
|
|
1124
|
-
}
|
|
1125
|
-
else if (target === 'search') {
|
|
1126
|
-
setModelSearchFocused(true);
|
|
1127
|
-
setFocusedAction(undefined);
|
|
1128
|
-
setEditing(undefined);
|
|
1129
|
-
}
|
|
1130
|
-
else if (target === 'models-previous' || target === 'models-next') {
|
|
1131
|
-
pressedElement.current = undefined;
|
|
1132
|
-
paginateModels(target === 'models-previous' ? -1 : 1);
|
|
1133
|
-
return;
|
|
1134
|
-
}
|
|
1135
|
-
else if (choice?.startsWith('choice:')) {
|
|
1136
|
-
selectWizardRow(Number(choice.split(':')[1]));
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
else if (mouse.action === 'release') {
|
|
1140
|
-
const frogClicked = frog && frogPress.current?.column === mouse.column && frogPress.current?.row === mouse.row;
|
|
1141
|
-
frogPress.current = undefined;
|
|
1142
|
-
const pressed = pressedElement.current;
|
|
1143
|
-
pressedElement.current = undefined;
|
|
1144
|
-
if (frogClicked && appearance.animations) {
|
|
1145
|
-
setFrogAnimationId((current) => (current ?? 0) + 1);
|
|
1146
|
-
}
|
|
1147
|
-
else if (directory !== undefined && pressed === `browse:${directory}` && directoryRows.has(directory)) {
|
|
1148
|
-
browseForDirectory(directoryRows.get(directory));
|
|
1149
|
-
}
|
|
1150
|
-
else if (typeof pressed === 'string' && pressed.startsWith('choice:') && pressed === choice) {
|
|
1151
|
-
const [, rowIndex, choiceIndex] = pressed.split(':');
|
|
1152
|
-
rows[Number(rowIndex)]?.choices?.[Number(choiceIndex)]?.activate();
|
|
1153
|
-
}
|
|
1154
|
-
else if (typeof pressed === 'string' && pressed.startsWith('category:') && pressed === choice) {
|
|
1155
|
-
setSettingsCategory(pressed.slice('category:'.length));
|
|
1156
|
-
setSelection(0);
|
|
1157
|
-
setFocusedAction(undefined);
|
|
1158
|
-
}
|
|
1159
|
-
else if (typeof pressed === 'string' && pressed.startsWith('option:')) {
|
|
1160
|
-
const optionIndex = Number(pressed.slice('option:'.length));
|
|
1161
|
-
const option = selecting?.options[optionIndex];
|
|
1162
|
-
if (selectOption === optionIndex && option) {
|
|
1163
|
-
chooseSelectOption(option);
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
else if (typeof pressed === 'string' && pressed.startsWith('completion:')) {
|
|
1167
|
-
const completionIndex = Number(pressed.slice('completion:'.length));
|
|
1168
|
-
if (pathCompletion === completionIndex) {
|
|
1169
|
-
applyPathCompletion(completionIndex);
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
else if (typeof pressed === 'number' &&
|
|
1173
|
-
pressed === row &&
|
|
1174
|
-
(!isAppearance || !rows[pressed]?.choices?.length)) {
|
|
1175
|
-
activateRow(pressed);
|
|
1176
|
-
}
|
|
1177
|
-
else if (pressed === 'back' && back) {
|
|
1178
|
-
moveBack();
|
|
1179
|
-
}
|
|
1180
|
-
else if (pressed === 'next' && next) {
|
|
1181
|
-
continueFlow();
|
|
1182
|
-
}
|
|
1183
|
-
else if (pressed === 'settings' && settings) {
|
|
1184
|
-
if (isSettings)
|
|
1185
|
-
moveBack();
|
|
1186
|
-
else
|
|
1187
|
-
openSettings();
|
|
1188
|
-
}
|
|
1189
|
-
else if (pressed === 'models-previous' && modelsPrevious) {
|
|
1190
|
-
paginateModels(-1);
|
|
1191
|
-
}
|
|
1192
|
-
else if (pressed === 'models-next' && modelsNext) {
|
|
1193
|
-
paginateModels(1);
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
else if (mouse.action === 'move') {
|
|
1197
|
-
setHoveredControl(isCapabilities && row !== undefined ? row : target);
|
|
1198
|
-
}
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
hoverPointer.current = undefined;
|
|
1202
|
-
if (key.ctrl && input === 'c') {
|
|
1203
|
-
onCancel?.(130);
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
if (key.ctrl && input === 's' && !appearanceOnly) {
|
|
1207
|
-
if (isSettings)
|
|
1208
|
-
moveBack();
|
|
1209
|
-
else
|
|
1210
|
-
openSettings();
|
|
1211
|
-
return;
|
|
1212
|
-
}
|
|
1213
|
-
setHoveredControl(undefined);
|
|
1214
|
-
if (saving || choosingDirectory) {
|
|
1215
|
-
return;
|
|
1216
|
-
}
|
|
1217
|
-
if (selecting) {
|
|
1218
|
-
if (key.escape) {
|
|
1219
|
-
setSelecting(undefined);
|
|
1220
|
-
}
|
|
1221
|
-
else if (key.tab && selecting.options.length > 0) {
|
|
1222
|
-
setSelecting({
|
|
1223
|
-
...selecting,
|
|
1224
|
-
selection: (selecting.selection + (key.shift ? -1 : 1) + selecting.options.length) % selecting.options.length,
|
|
1225
|
-
});
|
|
1226
|
-
}
|
|
1227
|
-
else if (key.upArrow || key.leftArrow) {
|
|
1228
|
-
setSelecting({
|
|
1229
|
-
...selecting,
|
|
1230
|
-
selection: Math.max(0, selecting.selection - 1),
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
else if (key.downArrow || key.rightArrow) {
|
|
1234
|
-
setSelecting({
|
|
1235
|
-
...selecting,
|
|
1236
|
-
selection: Math.min(selecting.options.length - 1, selecting.selection + 1),
|
|
1237
|
-
});
|
|
1238
|
-
}
|
|
1239
|
-
else if (key.return) {
|
|
1240
|
-
const option = selecting.options[selecting.selection];
|
|
1241
|
-
if (option) {
|
|
1242
|
-
chooseSelectOption(option);
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
return;
|
|
1246
|
-
}
|
|
1247
|
-
if (editing) {
|
|
1248
|
-
if (key.escape) {
|
|
1249
|
-
setEditing(undefined);
|
|
1250
|
-
setError(undefined);
|
|
1251
|
-
return;
|
|
1252
|
-
}
|
|
1253
|
-
if (editing.field === 'importPath' && importCompletionCapacity > 0) {
|
|
1254
|
-
if (key.upArrow) {
|
|
1255
|
-
setPathCompletionIndex((current) => current < 0
|
|
1256
|
-
? importCompletionCapacity - 1
|
|
1257
|
-
: (current - 1 + importCompletionCapacity) % importCompletionCapacity);
|
|
1258
|
-
return;
|
|
1259
|
-
}
|
|
1260
|
-
if (key.downArrow) {
|
|
1261
|
-
setPathCompletionIndex((current) => (current + 1) % importCompletionCapacity);
|
|
1262
|
-
return;
|
|
1263
|
-
}
|
|
1264
|
-
if (key.tab || (key.return && pathCompletionIndex >= 0)) {
|
|
1265
|
-
applyPathCompletion();
|
|
1266
|
-
return;
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
if (key.tab) {
|
|
1270
|
-
leaveEdit();
|
|
1271
|
-
}
|
|
1272
|
-
else if (key.return) {
|
|
1273
|
-
commitEdit();
|
|
1274
|
-
return;
|
|
1275
|
-
}
|
|
1276
|
-
else {
|
|
1277
|
-
const multiline = editing.field === 'instructions';
|
|
1278
|
-
const result = reduceInputSequence({ ...emptyEditor(), input: editing.value, cursor: editing.cursor ?? graphemes(editing.value).length }, multiline ? input : input.replace(/[\r\n]/g, ''), key, 'idle');
|
|
1279
|
-
setEditing({ ...editing, value: result.state.input, cursor: result.state.cursor });
|
|
1280
|
-
setError(undefined);
|
|
1281
|
-
return;
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
if (modelPanelVisible) {
|
|
1285
|
-
if (key.escape && (modelQuery || modelSearchFocused)) {
|
|
1286
|
-
if (modelQuery) {
|
|
1287
|
-
updateModelQuery('');
|
|
1288
|
-
}
|
|
1289
|
-
else {
|
|
1290
|
-
selectWizardRow(PROVIDER_IDS.indexOf(quickstartProvider));
|
|
1291
|
-
}
|
|
1292
|
-
return;
|
|
1293
|
-
}
|
|
1294
|
-
if (modelSearchFocused && (key.downArrow || key.return)) {
|
|
1295
|
-
if (filteredProviderModels.length > 0) {
|
|
1296
|
-
selectWizardRow(quickstartModelOffset);
|
|
1297
|
-
}
|
|
1298
|
-
return;
|
|
1299
|
-
}
|
|
1300
|
-
if (modelSearchFocused && (key.leftArrow || key.rightArrow || key.upArrow)) {
|
|
1301
|
-
return;
|
|
1302
|
-
}
|
|
1303
|
-
if (!focusedAction && key.upArrow && selection === quickstartModelOffset) {
|
|
1304
|
-
setModelSearchFocused(true);
|
|
1305
|
-
return;
|
|
1306
|
-
}
|
|
1307
|
-
if (key.backspace || key.delete) {
|
|
1308
|
-
updateModelQuery([...modelQuery].slice(0, -1).join(''));
|
|
1309
|
-
return;
|
|
1310
|
-
}
|
|
1311
|
-
if (key.ctrl && input === 'u') {
|
|
1312
|
-
updateModelQuery('');
|
|
1313
|
-
return;
|
|
1314
|
-
}
|
|
1315
|
-
if (!key.ctrl &&
|
|
1316
|
-
!key.meta &&
|
|
1317
|
-
input &&
|
|
1318
|
-
!input.startsWith('\u001b') &&
|
|
1319
|
-
[...input].every((character) => (character.codePointAt(0) ?? 0) >= 0x20) &&
|
|
1320
|
-
(input !== ' ' || modelSearchFocused)) {
|
|
1321
|
-
updateModelQuery(input === '/' && !modelSearchFocused
|
|
1322
|
-
? modelQuery
|
|
1323
|
-
: modelQuery + sanitizeTerminalText(input).replaceAll('\n', ''));
|
|
1324
|
-
return;
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
const rowCount = isProviderSetup ? quickstartSelectableRows : rows.length;
|
|
1328
|
-
const focusableRows = Array.from({ length: rowCount }, (_, index) => index).filter((index) => !rows[index]?.disabled && index !== hiddenReasoningRowIndex);
|
|
1329
|
-
const moveRow = (direction, start = 0, end = rowCount - 1) => {
|
|
1330
|
-
const candidates = focusableRows.filter((index) => index >= start && index <= end);
|
|
1331
|
-
const target = direction === 1
|
|
1332
|
-
? candidates.find((index) => index > selection)
|
|
1333
|
-
: candidates.reverse().find((index) => index < selection);
|
|
1334
|
-
if (target !== undefined) {
|
|
1335
|
-
selectWizardRow(target);
|
|
1336
|
-
}
|
|
1337
|
-
};
|
|
1338
|
-
if (key.escape) {
|
|
1339
|
-
moveBack();
|
|
1340
|
-
}
|
|
1341
|
-
else if (key.tab) {
|
|
1342
|
-
if (isSettings) {
|
|
1343
|
-
const categoryIndex = SETTINGS_CATEGORIES.findIndex(({ id }) => id === settingsCategory);
|
|
1344
|
-
const nextCategory = SETTINGS_CATEGORIES[(categoryIndex + (key.shift ? -1 : 1) + SETTINGS_CATEGORIES.length) % SETTINGS_CATEGORIES.length];
|
|
1345
|
-
setSettingsCategory(nextCategory.id);
|
|
1346
|
-
setSelection(0);
|
|
1347
|
-
setFocusedAction(undefined);
|
|
1348
|
-
return;
|
|
1349
|
-
}
|
|
1350
|
-
if (step === 0) {
|
|
1351
|
-
if (focusedAction === 'settings') {
|
|
1352
|
-
setOpeningSelectionVisible(true);
|
|
1353
|
-
}
|
|
1354
|
-
setFocusedAction(focusedAction === 'settings' ? undefined : 'settings');
|
|
1355
|
-
setModelSearchFocused(false);
|
|
1356
|
-
return;
|
|
1357
|
-
}
|
|
1358
|
-
const controls = [
|
|
1359
|
-
...focusableRows
|
|
1360
|
-
.filter((index) => !modelPanelVisible || index < quickstartModelOffset)
|
|
1361
|
-
.flatMap((index) => (directoryRows.has(index) ? [index, `browse:${index}`] : [index])),
|
|
1362
|
-
...(modelPanelVisible
|
|
1363
|
-
? ['search', ...focusableRows.filter((index) => index >= quickstartModelOffset)]
|
|
1364
|
-
: []),
|
|
1365
|
-
...(step > 0 && hasExternalActions ? ['back', ...(canContinue ? ['next'] : [])] : []),
|
|
1366
|
-
];
|
|
1367
|
-
const index = controls.indexOf(modelSearchFocused ? 'search' : (focusedAction ?? selection));
|
|
1368
|
-
const target = controls[(index + (key.shift ? -1 : 1) + controls.length) % controls.length];
|
|
1369
|
-
if (typeof target === 'number') {
|
|
1370
|
-
selectWizardRow(target);
|
|
1371
|
-
if (rows[target]?.field && rows[target]?.input !== false && !rows[target]?.selectOptions) {
|
|
1372
|
-
rows[target].activate();
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
else if (target === 'search') {
|
|
1376
|
-
setModelSearchFocused(true);
|
|
1377
|
-
setFocusedAction(undefined);
|
|
1378
|
-
}
|
|
1379
|
-
else {
|
|
1380
|
-
setFocusedAction(target);
|
|
1381
|
-
setModelSearchFocused(false);
|
|
1382
|
-
if (target?.startsWith('browse:')) {
|
|
1383
|
-
setSelection(Number(target.slice('browse:'.length)));
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
else if (focusedAction) {
|
|
1388
|
-
if (focusedAction === 'settings') {
|
|
1389
|
-
if (key.return || input === ' ') {
|
|
1390
|
-
if (isSettings)
|
|
1391
|
-
moveBack();
|
|
1392
|
-
else
|
|
1393
|
-
openSettings();
|
|
1394
|
-
}
|
|
1395
|
-
else if (key.upArrow && step !== 0) {
|
|
1396
|
-
setFocusedAction(undefined);
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1399
|
-
else if (focusedAction.startsWith('browse:')) {
|
|
1400
|
-
const index = Number(focusedAction.slice('browse:'.length));
|
|
1401
|
-
if (key.return || input === ' ') {
|
|
1402
|
-
browseForDirectory(directoryRows.get(index));
|
|
1403
|
-
}
|
|
1404
|
-
else if (key.leftArrow || key.upArrow) {
|
|
1405
|
-
selectWizardRow(index);
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
else if (key.leftArrow) {
|
|
1409
|
-
setFocusedAction('back');
|
|
1410
|
-
}
|
|
1411
|
-
else if (key.rightArrow) {
|
|
1412
|
-
if (canContinue)
|
|
1413
|
-
setFocusedAction('next');
|
|
1414
|
-
}
|
|
1415
|
-
else if (key.upArrow) {
|
|
1416
|
-
setFocusedAction(undefined);
|
|
1417
|
-
}
|
|
1418
|
-
else if (key.return || input === ' ') {
|
|
1419
|
-
if (focusedAction === 'back')
|
|
1420
|
-
moveBack();
|
|
1421
|
-
else
|
|
1422
|
-
continueFlow();
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
else if ((key.leftArrow || key.rightArrow) && rows[selection]?.choices?.length) {
|
|
1426
|
-
const choices = rows[selection].choices;
|
|
1427
|
-
const selected = choices.findIndex((choice) => choice.active);
|
|
1428
|
-
const next = selected < 0
|
|
1429
|
-
? key.leftArrow
|
|
1430
|
-
? 0
|
|
1431
|
-
: choices.length - 1
|
|
1432
|
-
: (selected + (key.leftArrow ? -1 : 1) + choices.length) % choices.length;
|
|
1433
|
-
choices[next].activate();
|
|
1434
|
-
}
|
|
1435
|
-
else if (splitQuickstart && (key.upArrow || key.leftArrow)) {
|
|
1436
|
-
const columnStart = selection < PROVIDER_IDS.length
|
|
1437
|
-
? 0
|
|
1438
|
-
: selection < quickstartModelOffset
|
|
1439
|
-
? PROVIDER_IDS.length
|
|
1440
|
-
: quickstartModelOffset;
|
|
1441
|
-
moveRow(-1, columnStart);
|
|
1442
|
-
}
|
|
1443
|
-
else if (splitQuickstart && (key.downArrow || key.rightArrow)) {
|
|
1444
|
-
const columnEnd = selection < PROVIDER_IDS.length
|
|
1445
|
-
? PROVIDER_IDS.length - 1
|
|
1446
|
-
: selection < quickstartModelOffset
|
|
1447
|
-
? quickstartModelOffset - 1
|
|
1448
|
-
: quickstartSelectableRows - 1;
|
|
1449
|
-
moveRow(1, 0, columnEnd);
|
|
1450
|
-
}
|
|
1451
|
-
else if (step === 0 &&
|
|
1452
|
-
openingColumns === 2 &&
|
|
1453
|
-
(key.leftArrow || key.rightArrow || key.upArrow || key.downArrow)) {
|
|
1454
|
-
setOpeningSelectionVisible(true);
|
|
1455
|
-
const column = selection % openingColumns;
|
|
1456
|
-
const next = key.leftArrow
|
|
1457
|
-
? column > 0
|
|
1458
|
-
? selection - 1
|
|
1459
|
-
: selection
|
|
1460
|
-
: key.rightArrow
|
|
1461
|
-
? column < openingColumns - 1
|
|
1462
|
-
? selection + 1
|
|
1463
|
-
: selection
|
|
1464
|
-
: key.upArrow
|
|
1465
|
-
? Math.max(0, selection - openingColumns)
|
|
1466
|
-
: Math.min(OPENING_CHOICES.length - 1, selection + openingColumns);
|
|
1467
|
-
selectWizardRow(next);
|
|
1468
|
-
}
|
|
1469
|
-
else if (key.upArrow || key.leftArrow) {
|
|
1470
|
-
if (step === 0)
|
|
1471
|
-
setOpeningSelectionVisible(true);
|
|
1472
|
-
moveRow(-1);
|
|
1473
|
-
}
|
|
1474
|
-
else if (key.downArrow || key.rightArrow) {
|
|
1475
|
-
if (step === 0)
|
|
1476
|
-
setOpeningSelectionVisible(true);
|
|
1477
|
-
moveRow(1);
|
|
1478
|
-
}
|
|
1479
|
-
else if (key.return || input === ' ') {
|
|
1480
|
-
activateRow(selection);
|
|
1481
|
-
}
|
|
1482
|
-
else if (rows[selection]?.field &&
|
|
1483
|
-
rows[selection]?.input !== false &&
|
|
1484
|
-
!rows[selection]?.disabled &&
|
|
1485
|
-
!rows[selection]?.selectOptions &&
|
|
1486
|
-
input &&
|
|
1487
|
-
!key.ctrl &&
|
|
1488
|
-
!key.meta) {
|
|
1489
|
-
rows[selection].activate();
|
|
1490
|
-
setEditing((current) => {
|
|
1491
|
-
if (!current)
|
|
1492
|
-
return current;
|
|
1493
|
-
const result = reduceInputSequence({ ...emptyEditor(), input: current.value, cursor: graphemes(current.value).length }, input, key, 'idle');
|
|
1494
|
-
return { ...current, value: result.state.input, cursor: result.state.cursor };
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1497
|
-
});
|
|
1498
|
-
const isSetupCompletion = isAppearance ||
|
|
1499
|
-
(flow === 'quickstart' && step === 1) ||
|
|
1500
|
-
(flow === 'customize' && step === CUSTOMIZE_STEPS.length) ||
|
|
1501
|
-
(flow === 'import' && step === 1);
|
|
1502
|
-
const primaryLabel = saving
|
|
1503
|
-
? 'Saving...'
|
|
1504
|
-
: isSetupCompletion
|
|
1505
|
-
? deferred || !config.needsSetup()
|
|
1506
|
-
? 'Save and Launch'
|
|
1507
|
-
: 'Launch Strands harness'
|
|
1508
|
-
: 'Continue';
|
|
1509
|
-
const escapeAction = editing || selecting ? 'cancel' : step === 0 ? 'exit' : 'back';
|
|
1510
|
-
const navigationHints = editing
|
|
1511
|
-
? [
|
|
1512
|
-
width < 32 ? 'Enter save · Tab move' : 'Enter save · Tab/Shift+Tab move',
|
|
1513
|
-
editing.field === 'instructions'
|
|
1514
|
-
? 'Ctrl+J newline · Esc cancel'
|
|
1515
|
-
: width < 60
|
|
1516
|
-
? 'Click focus · Esc cancel'
|
|
1517
|
-
: 'Mouse click: switch controls · Ctrl+U: clear · Esc: cancel',
|
|
1518
|
-
]
|
|
1519
|
-
: [
|
|
1520
|
-
width < 32
|
|
1521
|
-
? 'Click/Enter · ↑↓'
|
|
1522
|
-
: width < 60
|
|
1523
|
-
? 'Click/Enter choose · ↑↓ move'
|
|
1524
|
-
: 'Click or Enter to choose · Arrow keys (↑↓) to move',
|
|
1525
|
-
width < 32
|
|
1526
|
-
? 'Shift+Tab'
|
|
1527
|
-
: width < 60
|
|
1528
|
-
? `Tab/Shift+Tab focus · Esc ${escapeAction}`
|
|
1529
|
-
: step === 0
|
|
1530
|
-
? 'Tab / Shift+Tab: grid ↔ Settings · Esc to exit'
|
|
1531
|
-
: `Tab / Shift+Tab to move focus · Esc to ${escapeAction}`,
|
|
1532
|
-
];
|
|
1533
|
-
const settingsHovered = hoveredControl === 'settings';
|
|
1534
|
-
const settingsButton = !appearanceOnly ? (_jsx(Box, { ref: (element) => {
|
|
1535
|
-
settingsElement.current = element ?? undefined;
|
|
1536
|
-
}, height: 1, flexShrink: 0, children: _jsx(Text, { color: settingsHovered || focusedAction === 'settings' ? accent : palette.foreground, children: isSettings ? 'Back' : '/settings' }) })) : null;
|
|
1537
|
-
return (_jsxs(Box, { width: width, height: height, paddingX: 1, flexDirection: "column", overflow: "hidden", backgroundColor: palette.canvas, children: [showBrand ? (_jsx(SetupBrand, { frame: brandFrame, appearance: appearance, animationId: frogAnimationId, elapsedMs: frogElapsedMs, onFrogElement: (element) => {
|
|
1538
|
-
frogElement.current = element ?? undefined;
|
|
1539
|
-
} })) : null, step === 0 ? (_jsx(Fade, { background: palette.background, progress: panelTransition.progress, children: _jsx(OpeningMenu, { width: lockupWidth, buttonHeight: openingButtonHeight, selection: selection, showSelection: openingSelectionVisible, ...(typeof hoveredControl === 'number' ? { hovered: hoveredControl } : {}), topGap: openingTopGap, animate: appearance.animations, ...(error ? { error } : {}), ...(availableUpdate ? { availableUpdate } : {}), onRowElement: (index, element) => registerElement(rowElements.current, index, element) }) })) : null, step === 0 ? null : (_jsx(Fade, { background: palette.background, progress: panelTransition.progress, children: _jsxs(Box, { flexGrow: 1, alignItems: "center", justifyContent: "center", flexDirection: "column", overflow: "hidden", children: [progress ? (_jsxs(Box, { width: bubbleWidth, marginBottom: 1, alignItems: "center", flexDirection: "column", flexShrink: 0, children: [_jsx(Text, { bold: true, color: accent, wrap: "truncate-end", children: progress.instruction }), _jsx(SetupProgress, { current: progress.current, total: progress.total, ...(progress.label ? { label: progress.label } : {}), width: Math.min(bubbleWidth, 48), animate: appearance.animations })] })) : null, _jsxs(Box, { width: bubbleWidth, height: bubbleHeight, flexDirection: "column", overflow: "hidden", backgroundColor: PANEL_BACKGROUND, children: [!isAppearance && flow === 'customize' && !isProviderSetup && !isCapabilities ? (_jsxs(Box, { paddingX: 1, marginBottom: 1, justifyContent: "space-between", flexShrink: 0, children: [_jsx(Text, { bold: true, color: accent, children: isSettings ? 'Settings' : isAppearance ? 'Appearance' : CUSTOMIZE_STEPS[step - 1] }), customizeOverflowLabel ? _jsx(Text, { dimColor: true, children: customizeOverflowLabel }) : null] })) : null, isCapabilities ? (_jsxs(_Fragment, { children: [_jsxs(Box, { paddingX: 1, marginBottom: 1, justifyContent: "space-between", flexShrink: 0, children: [_jsx(Text, { bold: true, color: accent, children: isTools ? 'Tools' : 'Plugins & features' }), _jsx(Box, { ref: (element) => registerElement(rowElements.current, 0, element), paddingX: 1, backgroundColor: rowBackground(0) ?? COMMAND_DECK_BACKGROUND, children: _jsx(Text, { bold: true, children: rows[0].label }) })] }), renderCapabilityRows(visibleCapabilityRows)] })) : isImport ? (_jsxs(Box, { flexGrow: 1, paddingX: 2, paddingY: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Text, { bold: true, wrap: "truncate-end", children: "Import an agent" }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { bold: true, ...(selection === 0 ? { color: accent } : {}), wrap: "truncate-end", children: "Path to ZIP, file, or folder" }) }), _jsxs(Box, { height: 3, flexDirection: "row", children: [_jsx(Box, { ref: (element) => registerElement(rowElements.current, 0, element), flexGrow: 1, paddingX: 1, flexDirection: "column", justifyContent: "center", backgroundColor: rowBackground(0) ?? COMMAND_DECK_BACKGROUND, children: _jsx(EditableText, { value: editing?.field === 'importPath' ? editing.value : importPath, cursor: editing?.field === 'importPath'
|
|
1540
|
-
? (editing.cursor ?? graphemes(editing.value).length)
|
|
1541
|
-
: graphemes(importPath).length, width: Math.max(1, bubbleWidth - (canChooseDirectory() ? 17 : 6)), active: editing?.field === 'importPath', animate: appearance.animations }) }), canChooseDirectory() ? (_jsx(Box, { ref: (element) => registerElement(rowElements.current, 1, element), width: 12, marginLeft: 1, alignItems: "center", justifyContent: "center", backgroundColor: controlBackground(1, focusedAction === undefined && selection === 1, choosingDirectory) ??
|
|
1542
|
-
COMMAND_DECK_BACKGROUND, children: _jsx(Text, { bold: true, ...(selection === 1 && !choosingDirectory ? { color: accent } : {}), dimColor: choosingDirectory, children: choosingDirectory ? 'Opening...' : 'Browse' }) })) : null] }), pathEditing && importCompletionCapacity > 0 ? (_jsxs(Box, { flexDirection: "column", flexShrink: 0, children: [_jsx(Box, { paddingX: 1, height: 1, flexShrink: 0, children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: "Suggestions \u00B7 \u2191\u2193 choose \u00B7 Tab complete" }) }), pathCompletions.slice(0, importCompletionCapacity).map((completion, index) => (_jsx(Box, { ref: (element) => registerElement(pathCompletionElements.current, index, element), height: 1, paddingX: 1, flexShrink: 0, backgroundColor: pathCompletionIndex === index || hoveredControl === `completion:${index}`
|
|
1543
|
-
? PANEL_SELECTION
|
|
1544
|
-
: undefined, children: _jsxs(Text, { color: pathCompletionIndex === index ? accent : palette.foreground, wrap: "truncate-end", children: [pathCompletionIndex === index ? '› ' : ' ', sanitizeTerminalText(completion.label).replaceAll('\n', '\\n').replaceAll('\t', '\\t'), _jsx(Text, { dimColor: true, children: completion.directory ? ' folder' : ' file' })] }) }, completion.value)))] })) : null] })) : splitQuickstart ? (_jsxs(Box, { flexGrow: 1, flexDirection: "row", overflow: "hidden", children: [_jsxs(Box, { width: quickstartProviderColumnWidth, flexShrink: 0, paddingX: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Box, { marginBottom: 1, flexShrink: 0, children: _jsx(Text, { bold: true, color: accent, children: "Providers" }) }), _jsx(Box, { height: quickstartProviderListHeight, flexShrink: 0, flexDirection: "column", overflow: "hidden", children: _jsx(ProviderList, { items: providerRows.map((row) => ({
|
|
1545
|
-
id: row.id,
|
|
1546
|
-
label: row.label,
|
|
1547
|
-
description: row.description,
|
|
1548
|
-
...(row.status ? { status: row.status } : {}),
|
|
1549
|
-
})), selected: quickstartProvider, width: quickstartProviderColumnWidth - 2, rowHeight: quickstartProviderRowHeight, selectedBackground: true, ...(typeof hoveredControl === 'number' &&
|
|
1550
|
-
hoveredControl >= 0 &&
|
|
1551
|
-
hoveredControl < PROVIDER_IDS.length
|
|
1552
|
-
? { hovered: PROVIDER_IDS[hoveredControl] }
|
|
1553
|
-
: {}), onElement: (id, element) => registerElement(rowElements.current, PROVIDER_IDS.indexOf(id), element) }) }), _jsx(Box, { flexGrow: 1 }), refreshRow ? renderRefreshButton(refreshRow, quickstartProviderColumnWidth - 2, true) : null] }), _jsx(Box, { width: quickstartDetailColumnWidth, flexGrow: 1, flexShrink: 0, paddingX: 1, flexDirection: "column", overflow: "hidden", children: showProviderConfiguration ? (_jsxs(_Fragment, { children: [middleFacts.length > 0 || middleWarningLines.length > 0 ? (_jsxs(Box, { paddingX: 1, marginBottom: middleFieldGap, flexShrink: 0, flexDirection: "column", children: [middleFacts.map((fact) => (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [fact.label, ": "] }), _jsx(Text, { bold: true, color: palette[fact.status], children: fact.value })] }, fact.label))), middleWarningLines.length > 0 ? (_jsx(Box, { marginTop: middleFacts.length > 0 ? 1 : 0, children: _jsx(Text, { color: palette[providerWarningStatus], children: middleWarningLines.join('\n') }) })) : null] })) : null, selecting
|
|
1554
|
-
? renderProviderSelect(selecting)
|
|
1555
|
-
: visibleProviderFieldRows.map((row) => renderProviderField(row, quickstartDetailColumnWidth - 3))] })) : (_jsxs(Box, { flexGrow: 1, flexDirection: showModelOptionsPanel ? 'row' : 'column', overflow: "hidden", children: [_jsxs(Box, { ref: modelListElement, flexGrow: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { bold: true, color: accent, children: "Models" }) }), _jsx(Box, { ref: modelSearchElement, marginBottom: 1, flexShrink: 0, backgroundColor: controlBackground('search', modelSearchFocused), children: _jsx(Text, { wrap: "truncate-end", children: modelSearchFocused ? (_jsxs(_Fragment, { children: [modelQuery, _jsx(BlinkingCursor, { animate: appearance.animations })] })) : (_jsxs(Text, { dimColor: true, children: ["/ ", modelQuery || 'Search models'] })) }) }), showModelPagination ? (_jsx(Box, { ref: modelPreviousElement, width: "100%", height: 1, paddingX: 1, flexShrink: 0, backgroundColor: controlBackground('models-previous', false) ?? COMMAND_DECK_BACKGROUND, children: _jsxs(Text, { ...(previousModelCount > 0
|
|
1556
|
-
? {
|
|
1557
|
-
color: hoveredControl === 'models-previous' ? accent : palette.muted,
|
|
1558
|
-
bold: hoveredControl === 'models-previous',
|
|
1559
|
-
}
|
|
1560
|
-
: { dimColor: true }), children: ["\u2191 Previous", previousModelCount > 0 ? ` · ${previousModelCount}` : ''] }) })) : null, _jsx(Box, { flexShrink: 0, flexDirection: "column", overflow: "hidden", children: providerModels.provider !== quickstartProvider || providerModels.loading ? (_jsx(Text, { dimColor: true, children: "Loading model catalog..." })) : !providerModels.available ? (_jsxs(Text, { color: palette.warning, children: ["Model catalog unavailable", providerModels.error ? ` · ${providerModels.error}` : ''] })) : visibleProviderModels.length === 0 ? (_jsx(Text, { dimColor: true, children: modelQuery.trim() ? 'No matching models' : 'No models reported' })) : (_jsx(_Fragment, { children: visibleProviderModels.map((model, visibleIndex) => {
|
|
1561
|
-
const modelIndex = quickstartModelViewportStart + visibleIndex;
|
|
1562
|
-
const index = quickstartModelOffset + modelIndex;
|
|
1563
|
-
const active = `${quickstartProvider}/${model.id}` === draft.profile.model &&
|
|
1564
|
-
deselectedModel !== draft.profile.model;
|
|
1565
|
-
const focused = focusedAction === undefined && !modelSearchFocused && index === selection;
|
|
1566
|
-
const hovered = hoveredControl === index;
|
|
1567
|
-
const highlighted = focused || hovered;
|
|
1568
|
-
const harnessDefault = model.id === quickstartDefaultModel;
|
|
1569
|
-
const modelSpecifier = `${quickstartProvider}/${model.id}`;
|
|
1570
|
-
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), width: "100%", height: quickstartModelRowHeight, paddingX: 1, flexShrink: 0, overflow: "hidden", backgroundColor: rowBackground(index) ?? (active ? COMMAND_DECK_BACKGROUND : undefined), children: [_jsx(Box, { width: 2, flexShrink: 0, children: _jsx(Text, { ...(active || highlighted ? { color: accent, bold: true } : {}), children: active ? '✓ ' : highlighted ? '› ' : ' ' }) }), _jsx(Box, { ...(showModelOptionsPanel
|
|
1571
|
-
? { flexGrow: 1 }
|
|
1572
|
-
: { width: quickstartModelNameWidth, flexShrink: 0 }), overflow: "hidden", children: _jsxs(Text, { ...(active || highlighted ? { color: accent, bold: true } : {}), wrap: "truncate-end", children: [model.name, harnessDefault ? _jsx(Text, { color: accent, children: " \u2605" }) : null] }) }), !showModelOptionsPanel ? (_jsxs(_Fragment, { children: [_jsx(Box, { width: 1, flexShrink: 0 }), _jsx(Box, { width: quickstartModelIdWidth, flexShrink: 0, overflow: "hidden", children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: modelSpecifier }) })] })) : null] }, model.id));
|
|
1573
|
-
}) })) }), showModelPagination ? (_jsx(Box, { ref: modelNextElement, width: "100%", height: 1, paddingX: 1, flexShrink: 0, backgroundColor: controlBackground('models-next', false) ?? COMMAND_DECK_BACKGROUND, children: _jsxs(Text, { ...(nextModelCount > 0
|
|
1574
|
-
? {
|
|
1575
|
-
color: hoveredControl === 'models-next' ? accent : palette.muted,
|
|
1576
|
-
bold: hoveredControl === 'models-next',
|
|
1577
|
-
}
|
|
1578
|
-
: { dimColor: true }), children: ["\u2193 Next", nextModelCount > 0 ? ` · ${nextModelCount} more` : ''] }) })) : null, readyProviderControlRows.length > 0 ? (_jsx(Box, { flexShrink: 0, flexDirection: "column", children: readyProviderControlRows.map((row) => row.id === 'quickstart-web-search'
|
|
1579
|
-
? renderQuickstartWebSearch(row, false)
|
|
1580
|
-
: renderProviderField(row, quickstartDetailColumnWidth - (showModelOptionsPanel ? 36 : 3))) })) : null] }), showModelOptionsPanel ? (_jsxs(Box, { width: 32, marginLeft: 1, paddingLeft: 1, flexDirection: "column", flexShrink: 0, overflow: "hidden", children: [showReasoningPanel ? (_jsxs(_Fragment, { children: [_jsx(Text, { bold: true, color: accent, children: "Reasoning" }), _jsx(EffortSlider, { slider: reasoningSlider, width: 26, compact: false, pressed: false, focused: reasoningRowIndex === selection, onElement: (element) => {
|
|
1581
|
-
setupEffortSliderElement.current = element;
|
|
1582
|
-
registerElement(rowElements.current, reasoningRowIndex, element);
|
|
1583
|
-
} })] })) : null, webSearchRow ? (_jsx(Box, { marginTop: showReasoningPanel ? 1 : 0, flexShrink: 0, children: renderQuickstartWebSearch(webSearchRow, true) })) : null] })) : null] })) })] })) : isAppearance ? (_jsx(SetupSettingsPanel, { rows: visibleRows, category: settingsCategory, settings: { ...panelSettings, ...draft.settings, ...appearance }, start: viewportStart, selected: selection, width: bubbleWidth, height: bubbleHeight, ...(typeof hoveredControl === 'string' ? { hoveredControl } : {}), onRowElement: (index, element) => registerElement(rowElements.current, index, element), onChoiceElement: (target, element) => registerElement(choiceElements.current, target, element) })) : isPermissions ? (_jsxs(Box, { flexGrow: 1, paddingX: 1, flexDirection: "column", overflow: "hidden", children: [_jsx(Box, { height: 7, flexShrink: 0, children: rows.slice(0, 3).map((row, index) => (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), flexGrow: 1, flexBasis: 0, height: 7, marginRight: index < 2 ? 1 : 0, paddingX: 1, borderStyle: "single", borderColor: index === selection ? accent : row.active ? palette.success : palette.muted, flexDirection: "column", justifyContent: "center", backgroundColor: rowBackground(index), children: [_jsxs(Text, { bold: true, color: row.active || index === selection ? accent : palette.foreground, children: [row.active ? '◆ ' : '', row.label] }), _jsx(Text, { dimColor: true, wrap: "wrap", children: row.description })] }, row.id))) }), draft.customPermissions ? (_jsxs(Box, { marginTop: 1, flexGrow: 1, flexDirection: "column", overflow: "hidden", children: [_jsxs(Box, { justifyContent: "space-between", flexShrink: 0, children: [_jsx(Text, { bold: true, children: "Per-tool behavior" }), _jsxs(Text, { dimColor: true, children: [permissionViewportStart > 3 ? `↑ ${permissionViewportStart - 3} ` : '', permissionViewportStart + visiblePermissionTools.length < rows.length
|
|
1584
|
-
? `↓ ${rows.length - permissionViewportStart - visiblePermissionTools.length}`
|
|
1585
|
-
: ''] })] }), visiblePermissionTools.map((row, visibleIndex) => {
|
|
1586
|
-
const index = permissionViewportStart + visibleIndex;
|
|
1587
|
-
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), height: rowHeight, paddingX: 1, flexShrink: 0, flexDirection: "column", backgroundColor: rowBackground(index), children: [_jsxs(Text, { bold: row.active === true, color: row.active || index === selection ? accent : palette.foreground, children: [row.active ? '☑ ' : '☐ ', row.label] }), _jsx(Text, { dimColor: true, wrap: "truncate-end", children: row.description })] }, row.id));
|
|
1588
|
-
})] })) : (_jsx(Box, { marginTop: 1, paddingX: 1, children: _jsx(Text, { dimColor: true, children: "Choose Custom to set per-tool overrides. Unselected tools continue to use the default policy." }) }))] })) : selecting ? (renderProviderSelect(selecting)) : (_jsx(Box, { flexGrow: 1, flexDirection: "column", overflow: "hidden", children: visibleRows.map((row, visibleIndex) => {
|
|
1589
|
-
const index = viewportStart + visibleIndex;
|
|
1590
|
-
if (row.id === 'refresh-provider') {
|
|
1591
|
-
return renderRefreshButton(row, bubbleWidth - 2);
|
|
1592
|
-
}
|
|
1593
|
-
if (isProviderSetup && row.status) {
|
|
1594
|
-
return (_jsx(ProviderList, { items: [
|
|
1595
|
-
{
|
|
1596
|
-
id: row.id,
|
|
1597
|
-
label: row.label,
|
|
1598
|
-
description: row.description,
|
|
1599
|
-
status: row.status,
|
|
1600
|
-
},
|
|
1601
|
-
], selected: quickstartProvider, width: bubbleWidth, rowHeight: rowHeight, selectedBackground: true, ...(hoveredControl === index ? { hovered: row.id } : {}), onElement: (_, element) => registerElement(rowElements.current, index, element) }, row.id));
|
|
1602
|
-
}
|
|
1603
|
-
const activeEditing = editing?.field === row.field ? editing : undefined;
|
|
1604
|
-
return (_jsxs(Box, { ref: (element) => registerElement(rowElements.current, index, element), paddingX: row.field ? 0 : 1, height: rowHeight, flexShrink: 0, flexDirection: "column", backgroundColor: row.field ? undefined : rowBackground(index), children: [_jsxs(Box, { paddingX: row.field ? 1 : 0, justifyContent: "space-between", flexShrink: 0, children: [_jsxs(Text, { bold: row.field !== undefined, ...(!row.disabled && index === selection ? { color: accent } : {}), dimColor: row.disabled === true, wrap: "truncate-end", children: [row.status ? (_jsx(Text, { color: palette[row.status], children: "\u25CF " })) : row.field ? ('') : row.active === undefined ? ('') : row.active ? ('☑ ') : ('☐ '), row.label, flow === 'customize' && step === CUSTOMIZE_STEPS.length ? ' →' : ''] }), directoryRows.has(index) ? (_jsx(Box, { ref: (element) => registerElement(directoryElements.current, index, element), paddingX: 1, flexShrink: 0, backgroundColor: controlBackground(`browse:${index}`, focusedAction === `browse:${index}`) ??
|
|
1605
|
-
COMMAND_DECK_BACKGROUND, children: _jsx(Text, { bold: true, children: choosingDirectory && focusedAction === `browse:${index}` ? 'Opening...' : 'Browse' }) })) : null] }), row.choices?.length ? (renderChoices(row.choices, index)) : row.field ? (_jsx(Box, { flexGrow: 1, paddingX: 1, flexDirection: "column", justifyContent: row.field === 'instructions' ? 'flex-start' : 'center', backgroundColor: rowBackground(index) ?? COMMAND_DECK_BACKGROUND, children: _jsx(EditableText, { value: activeEditing?.value ?? row.description, cursor: activeEditing
|
|
1606
|
-
? (activeEditing.cursor ?? graphemes(activeEditing.value).length)
|
|
1607
|
-
: graphemes(row.description).length, width: Math.max(1, bubbleWidth - 4), maxRows: row.field === 'instructions' ? rowHeight - 2 : 1, active: Boolean(activeEditing), animate: appearance.animations }) })) : (_jsx(Text, { ...(row.descriptionColor
|
|
1608
|
-
? { color: row.descriptionColor }
|
|
1609
|
-
: row.status
|
|
1610
|
-
? { color: palette[row.status] }
|
|
1611
|
-
: { dimColor: true }), wrap: "truncate-end", children: row.description }))] }, row.id));
|
|
1612
|
-
}) })), warningHeight > 0 ? (_jsx(Box, { paddingX: 1, marginTop: warningGap, height: warningHeight, flexShrink: 0, children: _jsx(Text, { color: palette[providerWarningStatus], children: warningLines.join('\n') }) })) : null, error ? (_jsx(Box, { paddingX: 1, height: 1, children: _jsx(Text, { color: "red", wrap: "truncate-end", children: error }) })) : null] }), hasExternalActions ? (_jsx(Box, { width: bubbleWidth, height: actionHeight, marginTop: actionGap, columnGap: actionColumnGap, justifyContent: "space-between", children: [
|
|
1613
|
-
['back', 'Back', backElement],
|
|
1614
|
-
['next', primaryLabel, nextElement],
|
|
1615
|
-
].map(([action, label, elementRef]) => {
|
|
1616
|
-
const primary = action === 'next';
|
|
1617
|
-
const enabled = canContinue && !saving;
|
|
1618
|
-
const active = focusedAction === action;
|
|
1619
|
-
const hovered = hoveredControl === action;
|
|
1620
|
-
const interactiveHover = hovered && (!primary || enabled);
|
|
1621
|
-
return (_jsx(Box, { ref: (element) => {
|
|
1622
|
-
elementRef.current = element ?? undefined;
|
|
1623
|
-
}, width: actionWidth, height: actionHeight, alignItems: "center", justifyContent: "center", backgroundColor: interactiveHover
|
|
1624
|
-
? action === 'back'
|
|
1625
|
-
? backHoverBackground
|
|
1626
|
-
: nextHoverBackground
|
|
1627
|
-
: active
|
|
1628
|
-
? PANEL_SELECTION
|
|
1629
|
-
: (controlBackground(action, active, primary && !canContinue) ?? COMMAND_DECK_BACKGROUND), children: _jsx(Text, { bold: true, ...(interactiveHover ? { color: palette.foreground } : active ? { color: accent } : {}), dimColor: primary ? !enabled : saving, children: label }) }, action));
|
|
1630
|
-
}) })) : null] }) })), width < 32 ? (_jsxs(Box, { height: navigationHeight, flexShrink: 0, flexDirection: "column", paddingX: 1, children: [_jsx(Box, { justifyContent: "center", children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: navigationHints[0] }) }), _jsxs(Box, { height: 1, alignItems: "center", children: [_jsx(Box, { flexGrow: 1, justifyContent: "center", overflow: "hidden", children: _jsx(Text, { dimColor: true, wrap: "truncate-end", children: navigationHints[1] }) }), settingsButton] })] })) : (_jsxs(Box, { height: navigationHeight, flexShrink: 0, alignItems: "flex-end", paddingX: 1, children: [_jsx(Box, { flexGrow: 1, flexDirection: "column", alignItems: "center", overflow: "hidden", children: navigationHints.map((hint) => (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: hint }, hint))) }), settingsButton] })), appearanceOpen ? (_jsx(CustomThemeEditor, { settings: priorAppearance.current, animate: appearance.animations, width: width, height: height, onPreview: previewAppearance, onClose: closeAppearance, onApply: (next) => {
|
|
1631
|
-
priorAppearance.current = { ...appearance, ...next };
|
|
1632
|
-
updateAppearance(priorAppearance.current);
|
|
1633
|
-
} })) : null] }));
|
|
1634
|
-
}
|
|
1635
|
-
function isProviderEnvironmentKey(value) {
|
|
1636
|
-
return PROVIDER_ENVIRONMENT_KEYS.includes(value);
|
|
1637
|
-
}
|
|
1638
|
-
//# sourceMappingURL=index.js.map
|