@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
|
@@ -2,8 +2,9 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import { terminateProcessTree } from '../terminal/process-tree.js';
|
|
5
|
-
import { sanitizeTerminalText } from '../terminal/
|
|
5
|
+
import { sanitizeTerminalText } from '../terminal/text.js';
|
|
6
6
|
const DEFAULT_START_TIMEOUT_MS = 30_000;
|
|
7
|
+
const DEFAULT_INPUT_TIMEOUT_MS = 30_000;
|
|
7
8
|
const DEFAULT_STOP_TIMEOUT_MS = 2_000;
|
|
8
9
|
const STDERR_LIMIT = 8_000;
|
|
9
10
|
const SIDECAR_ERROR_LINE_LIMIT = 6;
|
|
@@ -12,7 +13,15 @@ export const VOICE_METER_WIDTH = 14;
|
|
|
12
13
|
export function voiceMeterFill(inputLevel) {
|
|
13
14
|
return Math.max(0, Math.min(VOICE_METER_WIDTH, Math.round(inputLevel * VOICE_METER_WIDTH)));
|
|
14
15
|
}
|
|
15
|
-
export const
|
|
16
|
+
export const VOICE_PROVIDERS = ['bedrock', 'openai'];
|
|
17
|
+
export const BEDROCK_VOICE_MODEL_IDS = ['amazon.nova-2-5-sonic'];
|
|
18
|
+
export const OPENAI_VOICE_MODEL_IDS = ['gpt-realtime-2.1'];
|
|
19
|
+
export const VOICE_MODEL_IDS = [...BEDROCK_VOICE_MODEL_IDS, ...OPENAI_VOICE_MODEL_IDS];
|
|
20
|
+
export const VOICE_MODEL_OPTIONS = {
|
|
21
|
+
bedrock: [{ label: 'Nova 2.5 Sonic', value: 'amazon.nova-2-5-sonic' }],
|
|
22
|
+
openai: [{ label: 'GPT Realtime 2.1', value: 'gpt-realtime-2.1' }],
|
|
23
|
+
};
|
|
24
|
+
export const BEDROCK_VOICE_IDS = [
|
|
16
25
|
'tiffany',
|
|
17
26
|
'matthew',
|
|
18
27
|
'amy',
|
|
@@ -25,31 +34,36 @@ export const VOICE_IDS = [
|
|
|
25
34
|
'lupe',
|
|
26
35
|
'carlos',
|
|
27
36
|
];
|
|
37
|
+
export const OPENAI_VOICE_IDS = ['alloy', 'coral', 'sage', 'verse'];
|
|
38
|
+
export const VOICE_IDS = [...BEDROCK_VOICE_IDS, ...OPENAI_VOICE_IDS];
|
|
39
|
+
const DEFAULT_VOICE_BY_PROVIDER = {
|
|
40
|
+
bedrock: 'tiffany',
|
|
41
|
+
openai: 'coral',
|
|
42
|
+
};
|
|
43
|
+
const DEFAULT_MODEL_BY_PROVIDER = {
|
|
44
|
+
bedrock: BEDROCK_VOICE_MODEL_IDS[0],
|
|
45
|
+
openai: OPENAI_VOICE_MODEL_IDS[0],
|
|
46
|
+
};
|
|
28
47
|
export class PythonVoiceSession {
|
|
29
48
|
_options;
|
|
30
49
|
_listeners = new Set();
|
|
31
|
-
|
|
32
|
-
_speechStartListeners = new Set();
|
|
50
|
+
_supervisorListeners = new Set();
|
|
33
51
|
_snapshot = {
|
|
34
52
|
status: 'off',
|
|
35
53
|
muted: false,
|
|
36
54
|
inputLevel: 0,
|
|
37
55
|
inputLevelDb: -60,
|
|
38
|
-
spokenReplies: false,
|
|
39
56
|
endpointingSensitivity: 'LOW',
|
|
57
|
+
provider: 'bedrock',
|
|
40
58
|
voice: 'tiffany',
|
|
59
|
+
model: DEFAULT_MODEL_BY_PROVIDER.bedrock,
|
|
41
60
|
};
|
|
42
61
|
_process;
|
|
43
62
|
_stdoutBuffer = '';
|
|
44
63
|
_stderr = '';
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
_speechInFlight = false;
|
|
49
|
-
_startTask;
|
|
50
|
-
_stopTask;
|
|
51
|
-
_failureCleanup;
|
|
52
|
-
_lifecycleGeneration = 0;
|
|
64
|
+
_desired = { enabled: false, generation: 0 };
|
|
65
|
+
_lifecycleTask;
|
|
66
|
+
_pendingNarrations = [];
|
|
53
67
|
_disposed = false;
|
|
54
68
|
constructor(_options = {}) {
|
|
55
69
|
this._options = _options;
|
|
@@ -60,16 +74,10 @@ export class PythonVoiceSession {
|
|
|
60
74
|
this._listeners.delete(listener);
|
|
61
75
|
};
|
|
62
76
|
};
|
|
63
|
-
|
|
64
|
-
this.
|
|
77
|
+
onSupervisorRequest = (listener) => {
|
|
78
|
+
this._supervisorListeners.add(listener);
|
|
65
79
|
return () => {
|
|
66
|
-
this.
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
onSpeechStart = (listener) => {
|
|
70
|
-
this._speechStartListeners.add(listener);
|
|
71
|
-
return () => {
|
|
72
|
-
this._speechStartListeners.delete(listener);
|
|
80
|
+
this._supervisorListeners.delete(listener);
|
|
73
81
|
};
|
|
74
82
|
};
|
|
75
83
|
getSnapshot() {
|
|
@@ -79,35 +87,39 @@ export class PythonVoiceSession {
|
|
|
79
87
|
if (this._disposed) {
|
|
80
88
|
return Promise.reject(new Error('Voice session has been disposed.'));
|
|
81
89
|
}
|
|
82
|
-
if (this.
|
|
83
|
-
return this.
|
|
90
|
+
if (this._desired.enabled) {
|
|
91
|
+
return this._lifecycleTask ?? Promise.resolve();
|
|
84
92
|
}
|
|
85
|
-
|
|
86
|
-
return this._startTask;
|
|
93
|
+
return this._requestSession(true);
|
|
87
94
|
}
|
|
88
95
|
stop() {
|
|
89
|
-
this.
|
|
90
|
-
this._stopTask ??= this._stop();
|
|
91
|
-
return this._stopTask;
|
|
96
|
+
return this._requestSession(false);
|
|
92
97
|
}
|
|
93
|
-
|
|
98
|
+
narrate(text) {
|
|
94
99
|
const clean = text.trim();
|
|
95
|
-
if (!clean ||
|
|
96
|
-
!this._process ||
|
|
97
|
-
!this._snapshot.spokenReplies ||
|
|
98
|
-
this._snapshot.status === 'off' ||
|
|
99
|
-
this._snapshot.status === 'error') {
|
|
100
|
+
if (!clean || !this._desired.enabled) {
|
|
100
101
|
return false;
|
|
101
102
|
}
|
|
102
|
-
this.
|
|
103
|
-
|
|
103
|
+
if (this._pendingNarrations.length || !this._isCurrent(this._process)) {
|
|
104
|
+
this._pendingNarrations.push(clean);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this._writeControl({ type: 'narrate', text: clean });
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
resolveSupervisorRequest(requestId, response) {
|
|
112
|
+
if (!this._isCurrent(this._process)) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
this._writeControl({ type: 'supervisor_result', request_id: requestId, ...response });
|
|
104
116
|
return true;
|
|
105
117
|
}
|
|
106
118
|
toggleMuted() {
|
|
107
119
|
return this.setMuted(!this._snapshot.muted);
|
|
108
120
|
}
|
|
109
121
|
setMuted(muted) {
|
|
110
|
-
if (!this.
|
|
122
|
+
if (!this._desired.enabled) {
|
|
111
123
|
return false;
|
|
112
124
|
}
|
|
113
125
|
if (this._snapshot.muted === muted) {
|
|
@@ -117,72 +129,115 @@ export class PythonVoiceSession {
|
|
|
117
129
|
this._setConnectedSnapshot('listening', muted);
|
|
118
130
|
return true;
|
|
119
131
|
}
|
|
120
|
-
|
|
121
|
-
|
|
132
|
+
setEndpointingSensitivity(sensitivity) {
|
|
133
|
+
return this._setModelOption('endpointingSensitivity', sensitivity);
|
|
134
|
+
}
|
|
135
|
+
async setProvider(provider) {
|
|
136
|
+
if (this._snapshot.provider === provider) {
|
|
122
137
|
return true;
|
|
123
138
|
}
|
|
124
|
-
|
|
125
|
-
this.
|
|
126
|
-
this.
|
|
139
|
+
this._setSnapshot({
|
|
140
|
+
status: this._snapshot.status,
|
|
141
|
+
muted: this._snapshot.muted,
|
|
142
|
+
provider,
|
|
143
|
+
voice: DEFAULT_VOICE_BY_PROVIDER[provider],
|
|
144
|
+
model: DEFAULT_MODEL_BY_PROVIDER[provider],
|
|
145
|
+
});
|
|
146
|
+
if (this._desired.enabled) {
|
|
147
|
+
await this._requestSession(true);
|
|
127
148
|
}
|
|
128
|
-
this._setSnapshot({ ...this._snapshot, spokenReplies: enabled });
|
|
129
149
|
return true;
|
|
130
150
|
}
|
|
131
|
-
|
|
132
|
-
|
|
151
|
+
setModel(model) {
|
|
152
|
+
if (!VOICE_MODEL_OPTIONS[this._snapshot.provider].some((option) => option.value === model)) {
|
|
153
|
+
return Promise.resolve(false);
|
|
154
|
+
}
|
|
155
|
+
return this._setModelOption('model', model);
|
|
133
156
|
}
|
|
134
157
|
setVoice(voice) {
|
|
158
|
+
const choices = this._snapshot.provider === 'bedrock' ? BEDROCK_VOICE_IDS : OPENAI_VOICE_IDS;
|
|
159
|
+
if (!choices.includes(voice)) {
|
|
160
|
+
return Promise.resolve(false);
|
|
161
|
+
}
|
|
135
162
|
return this._setModelOption('voice', voice);
|
|
136
163
|
}
|
|
137
164
|
async _setModelOption(key, value) {
|
|
138
165
|
if (this._snapshot[key] === value) {
|
|
139
166
|
return true;
|
|
140
167
|
}
|
|
141
|
-
const restart = this._snapshot.status !== 'off' && this._snapshot.status !== 'error';
|
|
142
168
|
this._setSnapshot({ ...this._snapshot, [key]: value });
|
|
143
|
-
if (
|
|
144
|
-
await this.
|
|
145
|
-
await this.start();
|
|
169
|
+
if (this._desired.enabled) {
|
|
170
|
+
await this._requestSession(true);
|
|
146
171
|
}
|
|
147
172
|
return true;
|
|
148
173
|
}
|
|
149
174
|
async dispose() {
|
|
150
175
|
this._disposed = true;
|
|
151
|
-
const startTask = this._startTask;
|
|
152
176
|
await this.stop();
|
|
153
|
-
await startTask?.catch(() => { });
|
|
154
177
|
this._listeners.clear();
|
|
155
|
-
this.
|
|
156
|
-
this._speechStartListeners.clear();
|
|
178
|
+
this._supervisorListeners.clear();
|
|
157
179
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
180
|
+
_requestSession(enabled) {
|
|
181
|
+
this._desired = { enabled, generation: this._desired.generation + 1 };
|
|
182
|
+
if (!enabled)
|
|
183
|
+
this._pendingNarrations.length = 0;
|
|
184
|
+
this._process?.finishStart();
|
|
185
|
+
clearTimeout(this._process?.timeout);
|
|
186
|
+
this._setSnapshot({
|
|
187
|
+
status: enabled ? 'connecting' : 'off',
|
|
188
|
+
muted: enabled && this._snapshot.muted,
|
|
189
|
+
inputLevel: 0,
|
|
190
|
+
inputLevelDb: -60,
|
|
191
|
+
});
|
|
192
|
+
this._lifecycleTask ??= this._reconcile();
|
|
193
|
+
return this._lifecycleTask;
|
|
194
|
+
}
|
|
195
|
+
async _reconcile() {
|
|
196
|
+
await Promise.resolve();
|
|
197
|
+
try {
|
|
198
|
+
while (true) {
|
|
199
|
+
const current = this._process;
|
|
200
|
+
if (current && !this._isCurrent(current)) {
|
|
201
|
+
await this._terminateChild(current);
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (!this._desired.enabled || current) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const attempt = this._startProcess(this._desired.generation);
|
|
208
|
+
try {
|
|
209
|
+
await attempt.ready;
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
await this._terminateChild(attempt);
|
|
213
|
+
if (attempt.generation === this._desired.generation) {
|
|
214
|
+
throw error;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
164
218
|
}
|
|
165
|
-
|
|
166
|
-
|
|
219
|
+
finally {
|
|
220
|
+
this._lifecycleTask = undefined;
|
|
167
221
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
this._utteranceActive = false;
|
|
171
|
-
this._clearSpeechQueue();
|
|
222
|
+
}
|
|
223
|
+
_startProcess(generation) {
|
|
172
224
|
this._stdoutBuffer = '';
|
|
173
225
|
this._stderr = '';
|
|
174
|
-
this._setSnapshot({ status: 'connecting', muted: false, inputLevel: 0, inputLevelDb: -60 });
|
|
175
226
|
const command = this._options.command ?? 'uv';
|
|
176
227
|
const args = this._options.args ?? [
|
|
177
228
|
'run',
|
|
178
229
|
'--python',
|
|
179
230
|
'3.13',
|
|
180
231
|
resolveVoiceSidecarPath(),
|
|
181
|
-
'--
|
|
232
|
+
'--provider',
|
|
233
|
+
this._snapshot.provider,
|
|
182
234
|
'--endpointing-sensitivity',
|
|
183
235
|
this._snapshot.endpointingSensitivity,
|
|
236
|
+
'--model',
|
|
237
|
+
this._snapshot.model,
|
|
184
238
|
'--voice',
|
|
185
239
|
this._snapshot.voice,
|
|
240
|
+
...(this._snapshot.muted ? ['--muted'] : []),
|
|
186
241
|
];
|
|
187
242
|
const child = spawn(command, [...args], {
|
|
188
243
|
cwd: this._options.cwd ?? process.cwd(),
|
|
@@ -190,99 +245,53 @@ export class PythonVoiceSession {
|
|
|
190
245
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
191
246
|
detached: process.platform !== 'win32',
|
|
192
247
|
});
|
|
193
|
-
|
|
248
|
+
let finishStart;
|
|
249
|
+
const ready = new Promise((resolveStart, rejectStart) => {
|
|
250
|
+
finishStart = (error) => {
|
|
251
|
+
if (error) {
|
|
252
|
+
rejectStart(error);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
resolveStart();
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
});
|
|
259
|
+
const attempt = { child, generation, phase: 'connecting', ready, finishStart };
|
|
260
|
+
this._process = attempt;
|
|
261
|
+
this._watchProgress(attempt);
|
|
194
262
|
child.stdin.on('error', () => { });
|
|
195
263
|
child.stdout.setEncoding('utf8');
|
|
196
264
|
child.stderr.setEncoding('utf8');
|
|
197
|
-
child.stdout.on('data', (chunk) =>
|
|
265
|
+
child.stdout.on('data', (chunk) => {
|
|
266
|
+
if (this._isCurrent(attempt))
|
|
267
|
+
this._readStdout(chunk);
|
|
268
|
+
});
|
|
198
269
|
child.stderr.on('data', (chunk) => {
|
|
199
|
-
this.
|
|
270
|
+
if (this._process === attempt)
|
|
271
|
+
this._stderr = `${this._stderr}${chunk}`.slice(-STDERR_LIMIT);
|
|
200
272
|
});
|
|
201
273
|
child.once('error', (error) => {
|
|
202
|
-
if (this.
|
|
274
|
+
if (this._isCurrent(attempt)) {
|
|
203
275
|
this._fail(error.message);
|
|
204
276
|
}
|
|
205
277
|
});
|
|
206
278
|
child.once('exit', (code, signal) => {
|
|
207
|
-
if (this.
|
|
208
|
-
this.
|
|
209
|
-
if (!this._stopping) {
|
|
210
|
-
this._fail(this._processExitMessage(code, signal));
|
|
211
|
-
}
|
|
279
|
+
if (this._isCurrent(attempt)) {
|
|
280
|
+
this._fail(this._processExitMessage(code, signal));
|
|
212
281
|
}
|
|
213
282
|
});
|
|
214
|
-
|
|
215
|
-
await new Promise((resolveStart, rejectStart) => {
|
|
216
|
-
let settled = false;
|
|
217
|
-
const finish = (error) => {
|
|
218
|
-
if (settled) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
settled = true;
|
|
222
|
-
clearTimeout(timeout);
|
|
223
|
-
unsubscribe();
|
|
224
|
-
child.off('error', finish);
|
|
225
|
-
child.off('exit', onExit);
|
|
226
|
-
if (error) {
|
|
227
|
-
rejectStart(error);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
resolveStart();
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
const unsubscribe = this.subscribe(() => {
|
|
234
|
-
if (this._snapshot.status === 'listening' || this._snapshot.status === 'muted') {
|
|
235
|
-
finish();
|
|
236
|
-
}
|
|
237
|
-
else if (this._snapshot.status === 'error') {
|
|
238
|
-
finish(new Error(this._snapshot.message ?? 'Voice input failed to start.'));
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
const onExit = (code, signal) => {
|
|
242
|
-
if (this._stopping) {
|
|
243
|
-
finish();
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
finish(new Error(this._processExitMessage(code, signal)));
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
const timeout = setTimeout(() => finish(new Error('Voice input timed out while connecting.')), this._options.startTimeoutMs ?? DEFAULT_START_TIMEOUT_MS);
|
|
250
|
-
child.once('error', finish);
|
|
251
|
-
child.once('exit', onExit);
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
catch (error) {
|
|
255
|
-
await this._stop();
|
|
256
|
-
throw error;
|
|
257
|
-
}
|
|
258
|
-
finally {
|
|
259
|
-
this._startTask = undefined;
|
|
260
|
-
}
|
|
283
|
+
return attempt;
|
|
261
284
|
}
|
|
262
|
-
async
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this._stopping = true;
|
|
268
|
-
this._writeControl({ type: 'stop' });
|
|
269
|
-
await this._terminateChild(child);
|
|
270
|
-
}
|
|
271
|
-
this._stopping = false;
|
|
272
|
-
this._utteranceActive = false;
|
|
273
|
-
this._clearSpeechQueue();
|
|
274
|
-
this._setSnapshot({ status: 'off', muted: false, inputLevel: 0, inputLevelDb: -60 });
|
|
275
|
-
}
|
|
276
|
-
finally {
|
|
277
|
-
this._stopTask = undefined;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
async _terminateChild(child) {
|
|
285
|
+
async _terminateChild(attempt) {
|
|
286
|
+
clearTimeout(attempt.timeout);
|
|
287
|
+
const { child } = attempt;
|
|
288
|
+
if (child.stdin.writable)
|
|
289
|
+
child.stdin.write(`${JSON.stringify({ type: 'stop' })}\n`);
|
|
281
290
|
const timeout = this._options.stopTimeoutMs ?? DEFAULT_STOP_TIMEOUT_MS;
|
|
282
291
|
if (!(await waitForExit(child, timeout))) {
|
|
283
292
|
await terminateProcessTree(child, timeout);
|
|
284
293
|
}
|
|
285
|
-
if (this._process ===
|
|
294
|
+
if (this._process === attempt) {
|
|
286
295
|
this._process = undefined;
|
|
287
296
|
}
|
|
288
297
|
}
|
|
@@ -291,6 +300,8 @@ export class PythonVoiceSession {
|
|
|
291
300
|
const lines = this._stdoutBuffer.split('\n');
|
|
292
301
|
this._stdoutBuffer = lines.pop() ?? '';
|
|
293
302
|
for (const line of lines) {
|
|
303
|
+
if (!this._isCurrent(this._process))
|
|
304
|
+
return;
|
|
294
305
|
const trimmed = line.trim();
|
|
295
306
|
if (!trimmed) {
|
|
296
307
|
continue;
|
|
@@ -306,18 +317,24 @@ export class PythonVoiceSession {
|
|
|
306
317
|
_handleEvent(event) {
|
|
307
318
|
const { type } = event;
|
|
308
319
|
if (type === 'connection_start') {
|
|
320
|
+
this._process.phase = 'connected';
|
|
321
|
+
this._process.finishStart();
|
|
322
|
+
this._watchProgress(this._process);
|
|
309
323
|
this._setSnapshot({
|
|
310
324
|
status: this._snapshot.muted ? 'muted' : 'listening',
|
|
311
325
|
muted: this._snapshot.muted,
|
|
312
326
|
...(typeof event.model === 'string' ? { model: event.model } : {}),
|
|
313
327
|
});
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
328
|
+
if (this._isCurrent(this._process)) {
|
|
329
|
+
for (const text of this._pendingNarrations.splice(0)) {
|
|
330
|
+
this._writeControl({ type: 'narrate', text });
|
|
331
|
+
}
|
|
332
|
+
}
|
|
318
333
|
return;
|
|
319
334
|
}
|
|
320
335
|
if (type === 'input_level' && typeof event.level === 'number' && Number.isFinite(event.level)) {
|
|
336
|
+
if (this._process?.phase === 'connected')
|
|
337
|
+
this._watchProgress(this._process);
|
|
321
338
|
const inputLevel = Math.max(0, Math.min(1, event.level));
|
|
322
339
|
const inputLevelDb = typeof event.db === 'number' && Number.isFinite(event.db) ? Math.max(-60, Math.min(0, event.db)) : -60;
|
|
323
340
|
const displayedInputLevel = this._snapshot.muted ? 0 : inputLevel;
|
|
@@ -331,25 +348,31 @@ export class PythonVoiceSession {
|
|
|
331
348
|
});
|
|
332
349
|
return;
|
|
333
350
|
}
|
|
334
|
-
if (type === '
|
|
335
|
-
this.
|
|
336
|
-
this.
|
|
337
|
-
this._setConnectedSnapshot('
|
|
351
|
+
if (type === 'connection_restart') {
|
|
352
|
+
this._process.phase = 'connecting';
|
|
353
|
+
this._watchProgress(this._process);
|
|
354
|
+
this._setConnectedSnapshot('connecting');
|
|
338
355
|
return;
|
|
339
356
|
}
|
|
340
357
|
if (type === 'speech_output_start') {
|
|
341
358
|
this._setConnectedSnapshot('speaking');
|
|
342
359
|
return;
|
|
343
360
|
}
|
|
344
|
-
if (type === 'speech_output_complete') {
|
|
345
|
-
this._speechInFlight = false;
|
|
361
|
+
if (type === 'speech_output_complete' || type === 'speech_output_interrupted' || type === 'speech_output_stopped') {
|
|
346
362
|
this._setConnectedSnapshot('listening');
|
|
347
|
-
this._pumpSpeechQueue();
|
|
348
363
|
return;
|
|
349
364
|
}
|
|
350
|
-
if (type === '
|
|
351
|
-
|
|
352
|
-
|
|
365
|
+
if (type === 'supervisor_request' &&
|
|
366
|
+
typeof event.request_id === 'string' &&
|
|
367
|
+
isVoiceSupervisorAction(event.action)) {
|
|
368
|
+
const request = {
|
|
369
|
+
requestId: event.request_id,
|
|
370
|
+
action: event.action,
|
|
371
|
+
...(typeof event.instruction === 'string' ? { instruction: event.instruction } : {}),
|
|
372
|
+
};
|
|
373
|
+
for (const listener of this._supervisorListeners) {
|
|
374
|
+
listener(request);
|
|
375
|
+
}
|
|
353
376
|
return;
|
|
354
377
|
}
|
|
355
378
|
if (type === 'transcript' && event.role === 'user') {
|
|
@@ -362,15 +385,10 @@ export class PythonVoiceSession {
|
|
|
362
385
|
return;
|
|
363
386
|
}
|
|
364
387
|
if (event.is_final !== true) {
|
|
365
|
-
this._signalSpeechStart();
|
|
366
388
|
this._setConnectedSnapshot('hearing');
|
|
367
389
|
return;
|
|
368
390
|
}
|
|
369
|
-
this._utteranceActive = false;
|
|
370
391
|
this._setConnectedSnapshot('listening');
|
|
371
|
-
for (const listener of this._transcriptListeners) {
|
|
372
|
-
listener(transcript);
|
|
373
|
-
}
|
|
374
392
|
return;
|
|
375
393
|
}
|
|
376
394
|
if (type === 'fatal_error' || type === 'error') {
|
|
@@ -379,45 +397,20 @@ export class PythonVoiceSession {
|
|
|
379
397
|
this._fail(`${code}${message}`);
|
|
380
398
|
return;
|
|
381
399
|
}
|
|
382
|
-
if (type === '
|
|
400
|
+
if (type === 'connection_stop') {
|
|
383
401
|
const reason = typeof event.reason === 'string' ? `: ${event.reason}` : '';
|
|
384
402
|
this._fail(`Voice connection closed${reason}`);
|
|
385
403
|
}
|
|
386
404
|
}
|
|
387
|
-
_signalSpeechStart() {
|
|
388
|
-
if (this._utteranceActive || this._snapshot.muted) {
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
this._utteranceActive = true;
|
|
392
|
-
for (const listener of this._speechStartListeners) {
|
|
393
|
-
listener();
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
405
|
_writeControl(command) {
|
|
397
|
-
if (!this._process
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
this._process.stdin.write(`${JSON.stringify(command)}\n`);
|
|
401
|
-
}
|
|
402
|
-
_pumpSpeechQueue() {
|
|
403
|
-
if (this._speechInFlight ||
|
|
404
|
-
this._speechQueue.length === 0 ||
|
|
405
|
-
!this._process ||
|
|
406
|
-
!this._snapshot.spokenReplies ||
|
|
407
|
-
this._snapshot.status === 'off' ||
|
|
408
|
-
this._snapshot.status === 'error') {
|
|
406
|
+
if (!this._isCurrent(this._process) || !this._process.child.stdin.writable) {
|
|
409
407
|
return;
|
|
410
408
|
}
|
|
411
|
-
|
|
412
|
-
this._speechInFlight = true;
|
|
413
|
-
this._writeControl({ type: 'speak', text });
|
|
414
|
-
}
|
|
415
|
-
_clearSpeechQueue() {
|
|
416
|
-
this._speechQueue.length = 0;
|
|
417
|
-
this._speechInFlight = false;
|
|
409
|
+
this._process.child.stdin.write(`${JSON.stringify(command)}\n`);
|
|
418
410
|
}
|
|
419
411
|
_fail(message) {
|
|
420
|
-
this.
|
|
412
|
+
this._desired = { ...this._desired, enabled: false };
|
|
413
|
+
this._pendingNarrations.length = 0;
|
|
421
414
|
const detail = summarizeSidecarError(this._stderr);
|
|
422
415
|
this._setSnapshot({
|
|
423
416
|
status: 'error',
|
|
@@ -426,38 +419,39 @@ export class PythonVoiceSession {
|
|
|
426
419
|
inputLevelDb: -60,
|
|
427
420
|
message: detail ? `${message}\n${detail}` : message,
|
|
428
421
|
});
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
.
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
this.
|
|
450
|
-
this.
|
|
451
|
-
this._failureCleanup = undefined;
|
|
452
|
-
});
|
|
422
|
+
this._process?.finishStart(new Error(this._snapshot.message ?? message));
|
|
423
|
+
this._lifecycleTask ??= this._reconcile();
|
|
424
|
+
void this._lifecycleTask.catch(() => { });
|
|
425
|
+
}
|
|
426
|
+
_isCurrent(attempt) {
|
|
427
|
+
return (attempt !== undefined &&
|
|
428
|
+
this._process === attempt &&
|
|
429
|
+
this._desired.enabled &&
|
|
430
|
+
attempt.generation === this._desired.generation);
|
|
431
|
+
}
|
|
432
|
+
_watchProgress(attempt) {
|
|
433
|
+
clearTimeout(attempt.timeout);
|
|
434
|
+
const connected = attempt.phase === 'connected';
|
|
435
|
+
attempt.timeout = setTimeout(() => {
|
|
436
|
+
if (this._isCurrent(attempt)) {
|
|
437
|
+
this._fail(connected
|
|
438
|
+
? 'Voice audio stopped making progress. Restart with /voice on.'
|
|
439
|
+
: 'Voice input timed out while connecting.');
|
|
440
|
+
}
|
|
441
|
+
}, connected
|
|
442
|
+
? (this._options.inputTimeoutMs ?? DEFAULT_INPUT_TIMEOUT_MS)
|
|
443
|
+
: (this._options.startTimeoutMs ?? DEFAULT_START_TIMEOUT_MS));
|
|
453
444
|
}
|
|
454
445
|
_setConnectedSnapshot(status, muted = this._snapshot.muted) {
|
|
455
446
|
this._setSnapshot({
|
|
456
|
-
status:
|
|
447
|
+
status: this._isCurrent(this._process) && this._process.phase === 'connected'
|
|
448
|
+
? muted
|
|
449
|
+
? 'muted'
|
|
450
|
+
: status
|
|
451
|
+
: 'connecting',
|
|
457
452
|
muted,
|
|
458
453
|
inputLevel: muted ? 0 : this._snapshot.inputLevel,
|
|
459
454
|
inputLevelDb: muted ? -60 : this._snapshot.inputLevelDb,
|
|
460
|
-
...(this._snapshot.model ? { model: this._snapshot.model } : {}),
|
|
461
455
|
});
|
|
462
456
|
}
|
|
463
457
|
_processExitMessage(code, signal) {
|
|
@@ -470,10 +464,10 @@ export class PythonVoiceSession {
|
|
|
470
464
|
muted: snapshot.muted,
|
|
471
465
|
inputLevel: snapshot.inputLevel ?? this._snapshot.inputLevel,
|
|
472
466
|
inputLevelDb: snapshot.inputLevelDb ?? this._snapshot.inputLevelDb,
|
|
473
|
-
spokenReplies: snapshot.spokenReplies ?? this._snapshot.spokenReplies,
|
|
474
467
|
endpointingSensitivity: snapshot.endpointingSensitivity ?? this._snapshot.endpointingSensitivity,
|
|
468
|
+
provider: snapshot.provider ?? this._snapshot.provider,
|
|
475
469
|
voice: snapshot.voice ?? this._snapshot.voice,
|
|
476
|
-
|
|
470
|
+
model: snapshot.model ?? this._snapshot.model,
|
|
477
471
|
...(snapshot.message ? { message: snapshot.message } : {}),
|
|
478
472
|
};
|
|
479
473
|
for (const listener of this._listeners) {
|
|
@@ -481,10 +475,13 @@ export class PythonVoiceSession {
|
|
|
481
475
|
}
|
|
482
476
|
}
|
|
483
477
|
}
|
|
478
|
+
function isVoiceSupervisorAction(value) {
|
|
479
|
+
return value === 'get_current_work' || value === 'send_instruction' || value === 'cancel_current_work';
|
|
480
|
+
}
|
|
484
481
|
export function resolveVoiceSidecarPath(moduleDirectory = import.meta.dirname) {
|
|
485
482
|
const candidates = [
|
|
486
|
-
resolve(moduleDirectory, 'sidecar.py'),
|
|
487
|
-
resolve(moduleDirectory, '
|
|
483
|
+
resolve(moduleDirectory, 'voice-sidecar.py'),
|
|
484
|
+
resolve(moduleDirectory, '../../../src/agent/voice-sidecar.py'),
|
|
488
485
|
];
|
|
489
486
|
return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0];
|
|
490
487
|
}
|
|
@@ -512,4 +509,4 @@ function waitForExit(child, timeoutMs) {
|
|
|
512
509
|
}
|
|
513
510
|
});
|
|
514
511
|
}
|
|
515
|
-
//# sourceMappingURL=
|
|
512
|
+
//# sourceMappingURL=voice.js.map
|