@strands-agents/cli 0.2.4 → 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
|
@@ -0,0 +1,692 @@
|
|
|
1
|
+
import { ConversationVoice } from './voice.js';
|
|
2
|
+
import { makePanel } from './panel-state.js';
|
|
3
|
+
import { ChatController, } from './controller.js';
|
|
4
|
+
import { parseCommandInvocation, unquote } from './commands.js';
|
|
5
|
+
import { isUnresolvedBackgroundTask, conversationStatus, conversationTitle, readConversationValue } from './state.js';
|
|
6
|
+
import { errorMessage, sanitizeTerminalText } from '../../terminal/text.js';
|
|
7
|
+
import { watchAgentProject } from '../../project/watch.js';
|
|
8
|
+
import { sessionWorkspaceLabel } from '../../session/sessions.js';
|
|
9
|
+
const MANAGER_COMMANDS = new Set(['agents', 'fork', 'voice', 'rename']);
|
|
10
|
+
const AGENTS_PANEL_TITLE = 'Agents';
|
|
11
|
+
export class ConversationManager {
|
|
12
|
+
voice;
|
|
13
|
+
_listeners = new Set();
|
|
14
|
+
_conversations = new Map();
|
|
15
|
+
_fork;
|
|
16
|
+
_resume;
|
|
17
|
+
_disposeShared;
|
|
18
|
+
_agentMessaging;
|
|
19
|
+
_stopAgentMessaging;
|
|
20
|
+
_voice;
|
|
21
|
+
_reloadProject;
|
|
22
|
+
_stopProjectWatch;
|
|
23
|
+
_activeId;
|
|
24
|
+
_panel;
|
|
25
|
+
_taskOwnerId;
|
|
26
|
+
_snapshot;
|
|
27
|
+
_nextConversation = 2;
|
|
28
|
+
_nextPanel = 1;
|
|
29
|
+
_opening;
|
|
30
|
+
_projectReloadPending = false;
|
|
31
|
+
_closed = false;
|
|
32
|
+
_disposed = false;
|
|
33
|
+
constructor(initial, options) {
|
|
34
|
+
if (!('entries' in initial)) {
|
|
35
|
+
initial = {
|
|
36
|
+
activeId: 'agent-1',
|
|
37
|
+
entries: [
|
|
38
|
+
{
|
|
39
|
+
id: 'agent-1',
|
|
40
|
+
title: initial.name,
|
|
41
|
+
description: initial.backend.info?.().description || 'Primary agent',
|
|
42
|
+
controller: initial,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
this._fork = options.fork;
|
|
48
|
+
this._resume = options.resume;
|
|
49
|
+
this._disposeShared = options.dispose;
|
|
50
|
+
this._agentMessaging = options.agentMessaging;
|
|
51
|
+
this._reloadProject = options.reloadProject;
|
|
52
|
+
this._voice = new ConversationVoice(options.voice, () => this._active, {
|
|
53
|
+
panel: (rows) => {
|
|
54
|
+
this._panel = rows ? this._makePanel({ kind: 'voice', title: 'Voice', rows }) : undefined;
|
|
55
|
+
if (!rows) {
|
|
56
|
+
while (this._active.controller.dismissPanel()) {
|
|
57
|
+
if (this._active.controller.getSnapshot().panel?.kind === 'error')
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
this._emit();
|
|
62
|
+
},
|
|
63
|
+
error: (title, label, message) => this._openError(title, label, message),
|
|
64
|
+
});
|
|
65
|
+
if (this._voice.store) {
|
|
66
|
+
this.voice = this._voice.store;
|
|
67
|
+
}
|
|
68
|
+
this._activeId = initial.activeId;
|
|
69
|
+
for (const { id, title, description, controller } of initial.entries) {
|
|
70
|
+
this._addConversation(id, title, controller, description);
|
|
71
|
+
}
|
|
72
|
+
this._snapshot = this._buildSnapshot();
|
|
73
|
+
const project = options.project;
|
|
74
|
+
this._stopProjectWatch =
|
|
75
|
+
project && options.reloadProject && options.projectPrivatePaths !== null
|
|
76
|
+
? watchAgentProject(project, () => {
|
|
77
|
+
for (const { controller } of this._conversations.values()) {
|
|
78
|
+
controller.refreshConfiguration();
|
|
79
|
+
}
|
|
80
|
+
this._projectReloadPending = true;
|
|
81
|
+
this._reloadProjectIfReady();
|
|
82
|
+
}, (error) => this._openError('live reload unavailable', project.root, errorMessage(error)), options.projectPrivatePaths)
|
|
83
|
+
: undefined;
|
|
84
|
+
if (project && options.reloadProject && options.projectPrivatePaths === null) {
|
|
85
|
+
this._openError('live reload unavailable', project.root, 'Private storage could not be located. Automatic reload and export are disabled for this agent.');
|
|
86
|
+
}
|
|
87
|
+
this._stopAgentMessaging = this._agentMessaging?.subscribe(() => {
|
|
88
|
+
this._attachDelegates();
|
|
89
|
+
if (this._panel?.kind === 'agents' && this._panel.title === AGENTS_PANEL_TITLE) {
|
|
90
|
+
this._openAgentsPanel(false);
|
|
91
|
+
}
|
|
92
|
+
this._emit();
|
|
93
|
+
});
|
|
94
|
+
this._voice.connect(() => {
|
|
95
|
+
if (this._panel?.kind === 'voice') {
|
|
96
|
+
const id = this._panel.id;
|
|
97
|
+
this._panel = { ...this._makePanel({ kind: 'voice', title: 'Voice', rows: this._voice.rows() }), id };
|
|
98
|
+
}
|
|
99
|
+
this._emit();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
subscribe = (listener) => {
|
|
103
|
+
this._listeners.add(listener);
|
|
104
|
+
return () => {
|
|
105
|
+
this._listeners.delete(listener);
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
getSnapshot = () => this._snapshot;
|
|
109
|
+
get resumeSession() {
|
|
110
|
+
return this._active.controller.resumeSession;
|
|
111
|
+
}
|
|
112
|
+
async captureConversations() {
|
|
113
|
+
if (this._opening ||
|
|
114
|
+
[...this._conversations.values()].some(({ controller }) => controller.busy || controller.getSnapshot().tasks.some(isUnresolvedBackgroundTask))) {
|
|
115
|
+
throw new Error('Finish or cancel running work in all conversations before applying setup changes.');
|
|
116
|
+
}
|
|
117
|
+
const entries = [];
|
|
118
|
+
for (const { id, description, controller } of this._conversations.values()) {
|
|
119
|
+
if (this._agentMessaging?.getEndpoint(id)?.backgroundTask)
|
|
120
|
+
continue;
|
|
121
|
+
entries.push({ id, title: controller.name, description, conversation: await controller.captureConversation() });
|
|
122
|
+
}
|
|
123
|
+
return { activeId: entries.some(({ id }) => id === this._activeId) ? this._activeId : entries[0].id, entries };
|
|
124
|
+
}
|
|
125
|
+
pauseVoiceInput() {
|
|
126
|
+
return this._voice.pauseInput();
|
|
127
|
+
}
|
|
128
|
+
showError(title, message) {
|
|
129
|
+
this._openError(title, '', message);
|
|
130
|
+
}
|
|
131
|
+
get busy() {
|
|
132
|
+
return this._opening !== undefined || this._active.controller.busy;
|
|
133
|
+
}
|
|
134
|
+
get hardExitCode() {
|
|
135
|
+
for (const conversation of this._conversations.values()) {
|
|
136
|
+
if (conversation.controller.hardExitCode !== undefined) {
|
|
137
|
+
return conversation.controller.hardExitCode;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
toggleVoiceMute() {
|
|
143
|
+
return this._voice.toggleMuted();
|
|
144
|
+
}
|
|
145
|
+
get backend() {
|
|
146
|
+
return this._active.controller.backend;
|
|
147
|
+
}
|
|
148
|
+
actionableCommandToken(input) {
|
|
149
|
+
const invocation = parseCommandInvocation(input);
|
|
150
|
+
if (invocation?.prefix === '/' && MANAGER_COMMANDS.has(invocation.name.toLowerCase())) {
|
|
151
|
+
return invocation.token;
|
|
152
|
+
}
|
|
153
|
+
return this._active.controller.actionableCommandToken(input);
|
|
154
|
+
}
|
|
155
|
+
commandAssistance(input) {
|
|
156
|
+
return this._active.controller.commandAssistance(input);
|
|
157
|
+
}
|
|
158
|
+
start(firstRequest) {
|
|
159
|
+
return this._active.controller.start(firstRequest);
|
|
160
|
+
}
|
|
161
|
+
async submit(input) {
|
|
162
|
+
const prompt = typeof input === 'string' ? input.trim() : input.text.trim();
|
|
163
|
+
const hasAttachments = typeof input !== 'string' && input.attachments.length > 0;
|
|
164
|
+
if ((!prompt && !hasAttachments) || this._closed) {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
if (!hasAttachments && ['exit', 'quit', '/exit'].includes(prompt.toLowerCase())) {
|
|
168
|
+
this.close();
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
if (this._taskOwnerId && !this.dismissPanel())
|
|
172
|
+
return undefined;
|
|
173
|
+
if (hasAttachments) {
|
|
174
|
+
this._panel = undefined;
|
|
175
|
+
this._emit();
|
|
176
|
+
return this._active.controller.submit({ text: prompt, attachments: input.attachments });
|
|
177
|
+
}
|
|
178
|
+
const invocation = parseCommandInvocation(prompt);
|
|
179
|
+
const command = invocation?.prefix === '/' ? invocation.name.toLowerCase() : undefined;
|
|
180
|
+
const argument = invocation?.argument ?? '';
|
|
181
|
+
if (command === 'agents') {
|
|
182
|
+
this._openAgentsPanel();
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
if (command === 'rename') {
|
|
186
|
+
if (argument)
|
|
187
|
+
await this._renameAgent(this._activeId, unquote(argument));
|
|
188
|
+
else
|
|
189
|
+
this._openAgentNameInput(this._activeId);
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
if (command === 'fork') {
|
|
193
|
+
return this._forkConversation(unquote(argument));
|
|
194
|
+
}
|
|
195
|
+
if (command === 'voice') {
|
|
196
|
+
await this._voice.handleCommand(argument);
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
this._panel = undefined;
|
|
200
|
+
this._emit();
|
|
201
|
+
return this._active.controller.submit(prompt);
|
|
202
|
+
}
|
|
203
|
+
steer(input) {
|
|
204
|
+
if (['exit', 'quit', '/exit'].includes(input.trim().toLowerCase())) {
|
|
205
|
+
return this.submit(input);
|
|
206
|
+
}
|
|
207
|
+
const invocation = parseCommandInvocation(input.trim());
|
|
208
|
+
if (invocation?.prefix === '/' && MANAGER_COMMANDS.has(invocation.name.toLowerCase())) {
|
|
209
|
+
return this.submit(input);
|
|
210
|
+
}
|
|
211
|
+
return this._active.controller.steer(input);
|
|
212
|
+
}
|
|
213
|
+
setSettings(settings) {
|
|
214
|
+
return this._active.controller.setSettings(settings);
|
|
215
|
+
}
|
|
216
|
+
updateQueuedPrompt(id, prompt) {
|
|
217
|
+
return this._active.controller.updateQueuedPrompt(id, prompt);
|
|
218
|
+
}
|
|
219
|
+
steerQueued(id) {
|
|
220
|
+
return this._active.controller.steerQueued(id);
|
|
221
|
+
}
|
|
222
|
+
removeQueuedPrompt(id) {
|
|
223
|
+
return this._active.controller.removeQueuedPrompt(id);
|
|
224
|
+
}
|
|
225
|
+
moveQueuedPrompt(id, direction) {
|
|
226
|
+
return this._active.controller.moveQueuedPrompt(id, direction);
|
|
227
|
+
}
|
|
228
|
+
cancel() {
|
|
229
|
+
return this._active.controller.cancel();
|
|
230
|
+
}
|
|
231
|
+
close(exitCode = 0) {
|
|
232
|
+
if (this._closed) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
this._closed = true;
|
|
236
|
+
this._panel = undefined;
|
|
237
|
+
for (const conversation of this._conversations.values()) {
|
|
238
|
+
conversation.controller.close(exitCode);
|
|
239
|
+
}
|
|
240
|
+
void this._voice.stop();
|
|
241
|
+
this._emit();
|
|
242
|
+
}
|
|
243
|
+
async dispose() {
|
|
244
|
+
if (this._disposed) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
this._disposed = true;
|
|
248
|
+
for (const conversation of this._conversations.values()) {
|
|
249
|
+
conversation.unsubscribe();
|
|
250
|
+
}
|
|
251
|
+
this._voice.disconnect();
|
|
252
|
+
this._stopAgentMessaging?.();
|
|
253
|
+
this._stopProjectWatch?.();
|
|
254
|
+
await Promise.allSettled([
|
|
255
|
+
...[...this._conversations.values()].map((conversation) => conversation.controller.dispose()),
|
|
256
|
+
this._voice.dispose(),
|
|
257
|
+
this._disposeShared?.(),
|
|
258
|
+
]);
|
|
259
|
+
this._listeners.clear();
|
|
260
|
+
this._voice.clearListeners();
|
|
261
|
+
}
|
|
262
|
+
dismissPanel() {
|
|
263
|
+
if (this._snapshot.panel?.kind === 'permission')
|
|
264
|
+
return false;
|
|
265
|
+
if (this._taskOwnerId) {
|
|
266
|
+
const owner = this._conversations.get(this._taskOwnerId);
|
|
267
|
+
if (owner?.controller.getSnapshot().panel?.kind === 'permission')
|
|
268
|
+
return false;
|
|
269
|
+
this._taskOwnerId = undefined;
|
|
270
|
+
owner?.controller.dismissPanel();
|
|
271
|
+
this._emit();
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
if (this._panel?.kind === 'agents' && this._panel.renameInput) {
|
|
275
|
+
delete this._panel.renameInput;
|
|
276
|
+
this._openAgentsPanel();
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
if (this._panel) {
|
|
280
|
+
this._panel = undefined;
|
|
281
|
+
this._emit();
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
return this._active.controller.dismissPanel();
|
|
285
|
+
}
|
|
286
|
+
async activatePanelRow(row) {
|
|
287
|
+
if (this._active.controller.getSnapshot().panel?.kind === 'permission') {
|
|
288
|
+
return this._active.controller.activatePanelRow(row);
|
|
289
|
+
}
|
|
290
|
+
if (this._taskOwnerId) {
|
|
291
|
+
return this._conversations.get(this._taskOwnerId)?.controller.activatePanelRow(row) ?? false;
|
|
292
|
+
}
|
|
293
|
+
if (this._panel?.kind === 'voice') {
|
|
294
|
+
return row.value ? this._voice.handlePanelAction(row.value) : false;
|
|
295
|
+
}
|
|
296
|
+
if (this._panel?.kind === 'agents') {
|
|
297
|
+
const editing = this._panel.renameInput;
|
|
298
|
+
if (editing) {
|
|
299
|
+
if (row.value === 'rename:cancel')
|
|
300
|
+
return this.dismissPanel();
|
|
301
|
+
if (row.value?.startsWith('rename:save:')) {
|
|
302
|
+
return this._renameAgent(editing.id, decodeURIComponent(row.value.slice('rename:save:'.length)));
|
|
303
|
+
}
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
if (row.value?.endsWith('=rename')) {
|
|
307
|
+
const id = readConversationValue(row.value.slice(0, -'=rename'.length));
|
|
308
|
+
return id ? this._openAgentNameInput(id) : false;
|
|
309
|
+
}
|
|
310
|
+
const task = this._agentMessaging
|
|
311
|
+
?.list()
|
|
312
|
+
.find((endpoint) => row.value === `delegate:${encodeURIComponent(endpoint.id)}`)?.backgroundTask;
|
|
313
|
+
if (task)
|
|
314
|
+
return this.openTask(task.id, task.ownerId);
|
|
315
|
+
const id = readConversationValue(row.value);
|
|
316
|
+
return id ? this._switchConversation(id) : false;
|
|
317
|
+
}
|
|
318
|
+
if (!this._panel && this._snapshot.panel?.kind === 'sessions' && row.value && this._resume) {
|
|
319
|
+
return this._resumeConversation(row.value);
|
|
320
|
+
}
|
|
321
|
+
return this._active.controller.activatePanelRow(row);
|
|
322
|
+
}
|
|
323
|
+
openModelPanel() {
|
|
324
|
+
if (this._taskOwnerId && !this.dismissPanel())
|
|
325
|
+
return Promise.resolve();
|
|
326
|
+
this._panel = undefined;
|
|
327
|
+
return this._active.controller.openModelPanel();
|
|
328
|
+
}
|
|
329
|
+
openContextPanel() {
|
|
330
|
+
if (this._taskOwnerId && !this.dismissPanel())
|
|
331
|
+
return;
|
|
332
|
+
this._panel = undefined;
|
|
333
|
+
this._active.controller.openContextPanel();
|
|
334
|
+
}
|
|
335
|
+
openTask(taskId, ownerId = this._activeId) {
|
|
336
|
+
if (this._snapshot.panel?.kind === 'permission')
|
|
337
|
+
return false;
|
|
338
|
+
const delegate = this._agentMessaging
|
|
339
|
+
?.list()
|
|
340
|
+
.find((endpoint) => endpoint.backgroundTask?.id === taskId && endpoint.backgroundTask.ownerId === ownerId);
|
|
341
|
+
if (delegate && this._conversations.has(delegate.id))
|
|
342
|
+
return this._switchConversation(delegate.id);
|
|
343
|
+
const owner = this._conversations.get(ownerId);
|
|
344
|
+
if (!owner?.controller.openTask(taskId))
|
|
345
|
+
return false;
|
|
346
|
+
this._taskOwnerId = ownerId;
|
|
347
|
+
this._emit();
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
returnToParent() {
|
|
351
|
+
if (this._snapshot.panel?.kind === 'permission')
|
|
352
|
+
return false;
|
|
353
|
+
const ownerId = this._agentMessaging?.getEndpoint(this._activeId)?.backgroundTask?.ownerId;
|
|
354
|
+
return ownerId !== undefined && this._switchConversation(ownerId);
|
|
355
|
+
}
|
|
356
|
+
openSkillDetail(name) {
|
|
357
|
+
return this._active.controller.openSkillDetail(name);
|
|
358
|
+
}
|
|
359
|
+
openMcpDetail(name) {
|
|
360
|
+
if (this._panel || this._closed || this._opening) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
return this._active.controller.openMcpDetail(name);
|
|
364
|
+
}
|
|
365
|
+
async retryMcpServer(name) {
|
|
366
|
+
if (this._panel || this._closed || this._opening) {
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
return this._active.controller.retryMcpServer(name);
|
|
370
|
+
}
|
|
371
|
+
get _active() {
|
|
372
|
+
return this._conversations.get(this._activeId);
|
|
373
|
+
}
|
|
374
|
+
async _resumeConversation(reference) {
|
|
375
|
+
const source = this._active;
|
|
376
|
+
let target;
|
|
377
|
+
try {
|
|
378
|
+
target = await source.controller.sessionTarget(reference);
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
this._openError('session resume failed', reference, errorMessage(error));
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
if (!target) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
if (target.active) {
|
|
388
|
+
source.controller.dismissPanel();
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
const blocked = source.controller.sessionResumeBlockReason() ??
|
|
392
|
+
(this._opening ? 'Wait for the conversation that is opening to finish.' : undefined);
|
|
393
|
+
if (blocked) {
|
|
394
|
+
this._openError('session resume blocked', target.sessionId, blocked);
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
if (!this._resume) {
|
|
398
|
+
return false;
|
|
399
|
+
}
|
|
400
|
+
this._opening = 'resume';
|
|
401
|
+
const workspace = sessionWorkspaceLabel(target.workspace, target.sessionDirectory);
|
|
402
|
+
const title = target.name ?? target.sessionId;
|
|
403
|
+
this._panel = this._makePanel({
|
|
404
|
+
kind: 'sessions',
|
|
405
|
+
title: 'Opening saved session',
|
|
406
|
+
rows: [
|
|
407
|
+
{
|
|
408
|
+
label: title,
|
|
409
|
+
description: `Starting a separate conversation in ${target.workspace}.`,
|
|
410
|
+
},
|
|
411
|
+
],
|
|
412
|
+
});
|
|
413
|
+
this._emit();
|
|
414
|
+
try {
|
|
415
|
+
const controller = await this._resume(source.controller, target);
|
|
416
|
+
if (this._closed || this._disposed) {
|
|
417
|
+
controller.close();
|
|
418
|
+
await controller.dispose();
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
const id = controller.peerEndpointId ?? `agent-${this._nextConversation++}`;
|
|
422
|
+
this._addConversation(id, target.agentName ?? `${controller.name} · ${workspace}`, controller, 'Saved session');
|
|
423
|
+
this._activeId = id;
|
|
424
|
+
this._panel = undefined;
|
|
425
|
+
this._emit();
|
|
426
|
+
return true;
|
|
427
|
+
}
|
|
428
|
+
catch (error) {
|
|
429
|
+
this._openError('session resume failed', target.sessionId, errorMessage(error));
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
432
|
+
finally {
|
|
433
|
+
this._opening = undefined;
|
|
434
|
+
this._emit();
|
|
435
|
+
this._reloadProjectIfReady();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
async _forkConversation(prompt) {
|
|
439
|
+
const source = this._active;
|
|
440
|
+
if (source.controller.backend.reconstructable?.() === false) {
|
|
441
|
+
this._openError('fork unavailable', source.controller.name, 'This source must expose a reconstructable agent factory before it can be forked.');
|
|
442
|
+
return undefined;
|
|
443
|
+
}
|
|
444
|
+
if (source.controller.busy) {
|
|
445
|
+
this._openError('fork unavailable', source.controller.name, 'Wait for this turn to finish or interrupt it before forking the conversation.');
|
|
446
|
+
return undefined;
|
|
447
|
+
}
|
|
448
|
+
if (this._opening) {
|
|
449
|
+
this._openError('fork unavailable', source.controller.name, 'Wait for the conversation that is opening to finish.');
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
this._opening = 'fork';
|
|
453
|
+
this._panel = undefined;
|
|
454
|
+
this._emit();
|
|
455
|
+
try {
|
|
456
|
+
const controller = await this._fork(source.controller);
|
|
457
|
+
if (this._closed || this._disposed) {
|
|
458
|
+
controller.close();
|
|
459
|
+
await controller.dispose();
|
|
460
|
+
return undefined;
|
|
461
|
+
}
|
|
462
|
+
const id = controller.peerEndpointId ?? `agent-${this._nextConversation++}`;
|
|
463
|
+
const title = prompt ? conversationTitle(prompt) : `Fork ${id.slice('agent-'.length)}`;
|
|
464
|
+
this._addConversation(id, title, controller, `Fork of ${source.controller.name}`);
|
|
465
|
+
this._activeId = id;
|
|
466
|
+
this._panel = undefined;
|
|
467
|
+
this._emit();
|
|
468
|
+
return prompt ? controller.submit(prompt) : undefined;
|
|
469
|
+
}
|
|
470
|
+
catch (error) {
|
|
471
|
+
this._openError('fork failed', source.controller.name, errorMessage(error));
|
|
472
|
+
return undefined;
|
|
473
|
+
}
|
|
474
|
+
finally {
|
|
475
|
+
this._opening = undefined;
|
|
476
|
+
this._emit();
|
|
477
|
+
this._reloadProjectIfReady();
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
_addConversation(id, title, controller, description) {
|
|
481
|
+
const endpointId = controller.peerEndpointId ?? id;
|
|
482
|
+
controller.setAgentName(title);
|
|
483
|
+
this._nextConversation = Math.max(this._nextConversation, (Number(endpointId.slice('agent-'.length)) || 0) + 1);
|
|
484
|
+
const streamSpokenReply = this._voice.followConversation(controller, () => endpointId === this._activeId);
|
|
485
|
+
const record = {
|
|
486
|
+
id: endpointId,
|
|
487
|
+
description: sanitizeTerminalText(description),
|
|
488
|
+
controller,
|
|
489
|
+
unsubscribe: controller.subscribe(() => {
|
|
490
|
+
streamSpokenReply();
|
|
491
|
+
const panel = controller.getSnapshot().panel;
|
|
492
|
+
if (this._taskOwnerId === endpointId && panel?.kind !== 'detail' && panel?.kind !== 'permission') {
|
|
493
|
+
this._taskOwnerId = undefined;
|
|
494
|
+
}
|
|
495
|
+
if (this._panel?.kind === 'agents') {
|
|
496
|
+
this._openAgentsPanel(false);
|
|
497
|
+
}
|
|
498
|
+
this._emit();
|
|
499
|
+
this._reloadProjectIfReady();
|
|
500
|
+
}),
|
|
501
|
+
};
|
|
502
|
+
this._conversations.set(endpointId, record);
|
|
503
|
+
this._agentMessaging?.rename(endpointId, controller.name);
|
|
504
|
+
}
|
|
505
|
+
_attachDelegates() {
|
|
506
|
+
for (const info of this._agentMessaging?.list() ?? []) {
|
|
507
|
+
if (this._conversations.has(info.id))
|
|
508
|
+
continue;
|
|
509
|
+
const endpoint = this._agentMessaging?.getEndpoint(info.id);
|
|
510
|
+
if (!endpoint?.chat)
|
|
511
|
+
continue;
|
|
512
|
+
const owner = this._conversations.get(info.backgroundTask?.ownerId ?? '');
|
|
513
|
+
if (!owner)
|
|
514
|
+
continue;
|
|
515
|
+
endpoint.chat.attached = true;
|
|
516
|
+
const controller = new ChatController(endpoint.chat.backend, {
|
|
517
|
+
peerEndpointId: info.id,
|
|
518
|
+
settings: owner.controller.getSnapshot().settings,
|
|
519
|
+
runtime: {
|
|
520
|
+
cwd: owner.controller.getSnapshot().runtime.cwd,
|
|
521
|
+
version: owner.controller.getSnapshot().runtime.version,
|
|
522
|
+
},
|
|
523
|
+
});
|
|
524
|
+
endpoint.status = () => (controller.busy ? 'working' : 'idle');
|
|
525
|
+
endpoint.enqueue = (message) => controller.enqueuePeerMessage(message, true);
|
|
526
|
+
this._addConversation(info.id, info.name, controller, info.description ?? `Subagent of ${owner.controller.name}`);
|
|
527
|
+
void controller.follow(endpoint.chat.prompt, endpoint.chat.stream);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
_openAgentNameInput(id) {
|
|
531
|
+
const conversation = this._conversations.get(id);
|
|
532
|
+
if (!conversation)
|
|
533
|
+
return false;
|
|
534
|
+
this._openAgentsPanel(false);
|
|
535
|
+
this._panel = this._makePanel({
|
|
536
|
+
...this._panel,
|
|
537
|
+
kind: 'agents',
|
|
538
|
+
renameInput: { id, defaultName: conversation.controller.name },
|
|
539
|
+
});
|
|
540
|
+
this._emit();
|
|
541
|
+
return true;
|
|
542
|
+
}
|
|
543
|
+
async _renameAgent(id, name) {
|
|
544
|
+
const conversation = this._conversations.get(id);
|
|
545
|
+
if (!conversation)
|
|
546
|
+
return false;
|
|
547
|
+
try {
|
|
548
|
+
await conversation.controller.renameAgent(name);
|
|
549
|
+
this._agentMessaging?.rename(id, conversation.controller.name);
|
|
550
|
+
if (this._panel?.kind === 'agents' && this._panel.renameInput?.id === id) {
|
|
551
|
+
delete this._panel.renameInput;
|
|
552
|
+
this._openAgentsPanel(false);
|
|
553
|
+
}
|
|
554
|
+
this._emit();
|
|
555
|
+
return true;
|
|
556
|
+
}
|
|
557
|
+
catch (error) {
|
|
558
|
+
this._openError('agent rename failed', name, errorMessage(error));
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
_reloadProjectIfReady() {
|
|
563
|
+
if (!this._projectReloadPending ||
|
|
564
|
+
!this._reloadProject ||
|
|
565
|
+
this._closed ||
|
|
566
|
+
this._disposed ||
|
|
567
|
+
this._opening ||
|
|
568
|
+
[...this._conversations.values()].some(({ controller }) => controller.busy || controller.getSnapshot().tasks.some(isUnresolvedBackgroundTask))) {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
this._projectReloadPending = false;
|
|
572
|
+
this._reloadProject(this._activeId);
|
|
573
|
+
}
|
|
574
|
+
_switchConversation(id) {
|
|
575
|
+
if (!this._conversations.has(id)) {
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
this._activeId = id;
|
|
579
|
+
this._taskOwnerId = undefined;
|
|
580
|
+
this._panel = undefined;
|
|
581
|
+
this._emit();
|
|
582
|
+
return true;
|
|
583
|
+
}
|
|
584
|
+
_openAgentsPanel(emit = true) {
|
|
585
|
+
const renameInput = this._panel?.kind === 'agents' ? this._panel.renameInput : undefined;
|
|
586
|
+
const existingId = this._panel?.kind === 'agents' && this._panel.title === AGENTS_PANEL_TITLE ? this._panel.id : undefined;
|
|
587
|
+
const conversations = [...this._conversations.values()]
|
|
588
|
+
.sort((left, right) => {
|
|
589
|
+
if (left.id === this._activeId) {
|
|
590
|
+
return -1;
|
|
591
|
+
}
|
|
592
|
+
if (right.id === this._activeId) {
|
|
593
|
+
return 1;
|
|
594
|
+
}
|
|
595
|
+
return left.id.localeCompare(right.id);
|
|
596
|
+
})
|
|
597
|
+
.map((conversation) => {
|
|
598
|
+
const status = conversationStatus(conversation.controller.getSnapshot());
|
|
599
|
+
return {
|
|
600
|
+
label: conversation.controller.name,
|
|
601
|
+
description: conversation.description,
|
|
602
|
+
value: `conversation:${encodeURIComponent(conversation.id)}`,
|
|
603
|
+
bold: true,
|
|
604
|
+
current: conversation.id === this._activeId,
|
|
605
|
+
badge: {
|
|
606
|
+
text: status.label,
|
|
607
|
+
tone: status.tone,
|
|
608
|
+
},
|
|
609
|
+
};
|
|
610
|
+
});
|
|
611
|
+
const generalists = (this._agentMessaging?.list() ?? [])
|
|
612
|
+
.filter((endpoint) => !this._conversations.has(endpoint.id))
|
|
613
|
+
.map((endpoint) => ({
|
|
614
|
+
label: endpoint.name,
|
|
615
|
+
description: endpoint.description ?? 'Live delegate',
|
|
616
|
+
...(endpoint.backgroundTask ? { value: `delegate:${encodeURIComponent(endpoint.id)}` } : {}),
|
|
617
|
+
bold: true,
|
|
618
|
+
current: false,
|
|
619
|
+
badge: {
|
|
620
|
+
text: endpoint.status,
|
|
621
|
+
tone: 'success',
|
|
622
|
+
},
|
|
623
|
+
}));
|
|
624
|
+
this._panel = this._makePanel({
|
|
625
|
+
kind: 'agents',
|
|
626
|
+
title: AGENTS_PANEL_TITLE,
|
|
627
|
+
...(renameInput ? { renameInput } : {}),
|
|
628
|
+
rows: [...conversations, ...generalists],
|
|
629
|
+
});
|
|
630
|
+
if (existingId) {
|
|
631
|
+
this._panel = { ...this._panel, id: existingId };
|
|
632
|
+
}
|
|
633
|
+
if (emit) {
|
|
634
|
+
this._emit();
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
_openError(title, label, description) {
|
|
638
|
+
this._panel = this._makePanel({
|
|
639
|
+
kind: 'error',
|
|
640
|
+
title,
|
|
641
|
+
rows: [{ label, description, tone: 'danger' }],
|
|
642
|
+
});
|
|
643
|
+
this._emit();
|
|
644
|
+
}
|
|
645
|
+
_makePanel(panel) {
|
|
646
|
+
return makePanel(`manager-panel-${this._nextPanel++}`, panel);
|
|
647
|
+
}
|
|
648
|
+
_buildSnapshot() {
|
|
649
|
+
const active = this._active.controller.getSnapshot();
|
|
650
|
+
const { panel: activePanel, ...base } = active;
|
|
651
|
+
const taskPanel = this._taskOwnerId
|
|
652
|
+
? this._conversations.get(this._taskOwnerId)?.controller.getSnapshot().panel
|
|
653
|
+
: undefined;
|
|
654
|
+
const panel = activePanel?.kind === 'permission' ? activePanel : (taskPanel ?? this._panel ?? activePanel);
|
|
655
|
+
const afterTurnId = active.activeTurn?.id ?? active.completedTurns.at(-1)?.id;
|
|
656
|
+
const ownerId = this._agentMessaging?.getEndpoint(this._activeId)?.backgroundTask?.ownerId;
|
|
657
|
+
const parent = ownerId ? this._conversations.get(ownerId) : undefined;
|
|
658
|
+
return {
|
|
659
|
+
...base,
|
|
660
|
+
conversationId: this._activeId,
|
|
661
|
+
...(parent ? { parentAgent: { id: parent.id, name: parent.controller.name } } : {}),
|
|
662
|
+
...(panel ? { panel } : {}),
|
|
663
|
+
notices: this._opening === 'fork' && !this._closed && !this._disposed
|
|
664
|
+
? [
|
|
665
|
+
...active.notices,
|
|
666
|
+
{
|
|
667
|
+
id: 'manager-fork-progress',
|
|
668
|
+
text: 'Forking agent…',
|
|
669
|
+
status: 'running',
|
|
670
|
+
...(afterTurnId ? { afterTurnId } : {}),
|
|
671
|
+
},
|
|
672
|
+
]
|
|
673
|
+
: active.notices,
|
|
674
|
+
status: this._closed ? 'closed' : active.status,
|
|
675
|
+
...(this._voice.snapshot ? { voice: { ...this._voice.snapshot } } : {}),
|
|
676
|
+
runtime: {
|
|
677
|
+
...active.runtime,
|
|
678
|
+
configuration: [
|
|
679
|
+
...(active.runtime.configuration ?? []),
|
|
680
|
+
{ label: 'agent', value: `${this._active.controller.name} (${this._conversations.size} total)` },
|
|
681
|
+
],
|
|
682
|
+
},
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
_emit() {
|
|
686
|
+
this._snapshot = this._buildSnapshot();
|
|
687
|
+
for (const listener of this._listeners) {
|
|
688
|
+
listener();
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
//# sourceMappingURL=conversations.js.map
|