@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.
Files changed (453) hide show
  1. package/README.md +217 -133
  2. package/bin/strands.js +1 -5
  3. package/dist/src/{tui/strands-backend.js → agent/backend.js} +90 -28
  4. package/dist/src/agent/backend.js.map +1 -0
  5. package/dist/src/{tui/background/activity.js → agent/background.js} +173 -6
  6. package/dist/src/agent/background.js.map +1 -0
  7. package/dist/src/{tui/agent-configuration.js → agent/configuration.js} +62 -105
  8. package/dist/src/agent/configuration.js.map +1 -0
  9. package/dist/src/agent/context.js +112 -0
  10. package/dist/src/agent/context.js.map +1 -0
  11. package/dist/src/{tui/chat/sdk-projector.js → agent/events.js} +6 -5
  12. package/dist/src/agent/events.js.map +1 -0
  13. package/dist/src/{tui/permissions/file-change-preview.js → agent/file-changes.js} +10 -8
  14. package/dist/src/agent/file-changes.js.map +1 -0
  15. package/dist/src/agent/mcp.js +436 -0
  16. package/dist/src/agent/mcp.js.map +1 -0
  17. package/dist/src/agent/messaging.js +424 -0
  18. package/dist/src/agent/messaging.js.map +1 -0
  19. package/dist/src/agent/permission-rules.js +267 -0
  20. package/dist/src/agent/permission-rules.js.map +1 -0
  21. package/dist/src/agent/permissions.js +288 -0
  22. package/dist/src/agent/permissions.js.map +1 -0
  23. package/dist/src/agent/runtime.js +524 -0
  24. package/dist/src/agent/runtime.js.map +1 -0
  25. package/dist/src/{tui/workspace → agent}/sandbox.js +92 -25
  26. package/dist/src/agent/sandbox.js.map +1 -0
  27. package/dist/src/{tui/chat → agent}/shell.js +1 -1
  28. package/dist/src/agent/shell.js.map +1 -0
  29. package/dist/src/{tui → agent}/skills.js +37 -56
  30. package/dist/src/agent/skills.js.map +1 -0
  31. package/dist/src/{tui/builtin-tools.js → agent/tools.js} +2 -3
  32. package/dist/src/agent/tools.js.map +1 -0
  33. package/dist/src/agent/types.js.map +1 -0
  34. package/dist/src/{tui/voice/session.js → agent/voice.js} +221 -224
  35. package/dist/src/agent/voice.js.map +1 -0
  36. package/dist/src/{tui/acp/projection.js → cli/acp-events.js} +19 -4
  37. package/dist/src/cli/acp-events.js.map +1 -0
  38. package/dist/src/{tui/project/acp.js → cli/acp-python.js} +41 -18
  39. package/dist/src/cli/acp-python.js.map +1 -0
  40. package/dist/src/{tui/acp/server.js → cli/acp.js} +149 -46
  41. package/dist/src/cli/acp.js.map +1 -0
  42. package/dist/src/cli/arguments.js +8 -3
  43. package/dist/src/cli/arguments.js.map +1 -1
  44. package/dist/src/{console.js → cli/console.js} +69 -4
  45. package/dist/src/cli/console.js.map +1 -0
  46. package/dist/src/cli/invocation.js +75 -44
  47. package/dist/src/cli/invocation.js.map +1 -1
  48. package/dist/src/cli/run.js +66 -38
  49. package/dist/src/cli/run.js.map +1 -1
  50. package/dist/src/{tui → cli}/telemetry.js +2 -2
  51. package/dist/src/{tui → cli}/telemetry.js.map +1 -1
  52. package/dist/src/cli/update.js +35 -7
  53. package/dist/src/cli/update.js.map +1 -1
  54. package/dist/src/{tui/mcp/config.js → config/mcp.js} +25 -35
  55. package/dist/src/config/mcp.js.map +1 -0
  56. package/dist/src/{tui → config}/settings.js +78 -130
  57. package/dist/src/config/settings.js.map +1 -0
  58. package/dist/src/config/source.js +87 -0
  59. package/dist/src/config/source.js.map +1 -0
  60. package/dist/src/{tui/config.js → config/store.js} +178 -49
  61. package/dist/src/config/store.js.map +1 -0
  62. package/dist/src/{tui/workspace → config}/trust.js +12 -16
  63. package/dist/src/config/trust.js.map +1 -0
  64. package/dist/src/logging.js +3 -4
  65. package/dist/src/logging.js.map +1 -1
  66. package/dist/src/{tui/provider → model}/aws-config.js +13 -4
  67. package/dist/src/model/aws-config.js.map +1 -0
  68. package/dist/src/{tui/provider/bedrock-catalog.js → model/bedrock.js} +70 -3
  69. package/dist/src/model/bedrock.js.map +1 -0
  70. package/dist/src/{tui/provider → model}/discovery.js +11 -10
  71. package/dist/src/model/discovery.js.map +1 -0
  72. package/dist/src/{tui/provider → model}/environment.js +19 -16
  73. package/dist/src/model/environment.js.map +1 -0
  74. package/dist/src/{tui/model/display.js → model/metadata.js} +6 -1
  75. package/dist/src/model/metadata.js.map +1 -0
  76. package/dist/src/model/packages.js.map +1 -0
  77. package/dist/src/{tui/model → model}/runtime.js +31 -62
  78. package/dist/src/model/runtime.js.map +1 -0
  79. package/dist/src/{tui/model → model}/selection.js +9 -15
  80. package/dist/src/model/selection.js.map +1 -0
  81. package/dist/src/{tui/package-version.js → package-version.js} +6 -0
  82. package/dist/src/package-version.js.map +1 -0
  83. package/dist/src/paths.js +23 -0
  84. package/dist/src/paths.js.map +1 -0
  85. package/dist/src/project/archive.js +461 -0
  86. package/dist/src/project/archive.js.map +1 -0
  87. package/dist/src/{tui/project → project}/export.js +249 -72
  88. package/dist/src/project/export.js.map +1 -0
  89. package/dist/src/{tui/project → project}/import.js +58 -6
  90. package/dist/src/project/import.js.map +1 -0
  91. package/dist/src/{tui/project → project}/module-loader.js +1 -5
  92. package/dist/src/project/module-loader.js.map +1 -0
  93. package/dist/src/{tui/project → project}/packaging.js +25 -8
  94. package/dist/src/project/packaging.js.map +1 -0
  95. package/dist/src/project/portability.js +455 -0
  96. package/dist/src/project/portability.js.map +1 -0
  97. package/dist/src/{tui/project → project}/python.js +46 -31
  98. package/dist/src/project/python.js.map +1 -0
  99. package/dist/src/{tui/project → project}/source.js +45 -26
  100. package/dist/src/project/source.js.map +1 -0
  101. package/dist/src/project/typescript-backend.js +733 -0
  102. package/dist/src/project/typescript-backend.js.map +1 -0
  103. package/dist/src/project/typescript-worker.js +488 -0
  104. package/dist/src/project/typescript-worker.js.map +1 -0
  105. package/dist/src/{tui/project → project}/typescript.js +19 -7
  106. package/dist/src/project/typescript.js.map +1 -0
  107. package/dist/src/project/watch.js +33 -0
  108. package/dist/src/project/watch.js.map +1 -0
  109. package/dist/src/{tui/project → project}/worker.py +358 -106
  110. package/dist/src/session/agent-definition.js +35 -0
  111. package/dist/src/session/agent-definition.js.map +1 -0
  112. package/dist/src/session/catalog.js +156 -0
  113. package/dist/src/session/catalog.js.map +1 -0
  114. package/dist/src/{tui/session → session}/context.js +45 -5
  115. package/dist/src/session/context.js.map +1 -0
  116. package/dist/src/{tui/session → session}/desktop-profile.js +1 -0
  117. package/dist/src/session/desktop-profile.js.map +1 -0
  118. package/dist/src/{tui/session → session}/sessions.js +126 -27
  119. package/dist/src/session/sessions.js.map +1 -0
  120. package/dist/src/terminal/arguments.js +53 -0
  121. package/dist/src/terminal/arguments.js.map +1 -0
  122. package/dist/src/{tui/terminal → terminal}/composer.js +51 -24
  123. package/dist/src/terminal/composer.js.map +1 -0
  124. package/dist/src/terminal/directory-picker.js +182 -0
  125. package/dist/src/terminal/directory-picker.js.map +1 -0
  126. package/dist/src/terminal/ink.js.map +1 -0
  127. package/dist/src/terminal/mouse-input.js.map +1 -0
  128. package/dist/src/terminal/npm.js.map +1 -0
  129. package/dist/src/terminal/open-editor.js +40 -0
  130. package/dist/src/terminal/open-editor.js.map +1 -0
  131. package/dist/src/terminal/open-url.js +26 -0
  132. package/dist/src/terminal/open-url.js.map +1 -0
  133. package/dist/src/terminal/process-tree.js.map +1 -0
  134. package/dist/src/terminal/shell-output.js.map +1 -0
  135. package/dist/src/{tui/terminal → terminal}/terminal.js +40 -2
  136. package/dist/src/terminal/terminal.js.map +1 -0
  137. package/dist/src/{tui/terminal/sanitize.js → terminal/text.js} +40 -6
  138. package/dist/src/terminal/text.js.map +1 -0
  139. package/dist/src/terminal/theme-detection.js +197 -0
  140. package/dist/src/terminal/theme-detection.js.map +1 -0
  141. package/dist/src/{tui/view/fade-in.js → ui/animation.js} +26 -1
  142. package/dist/src/ui/animation.js.map +1 -0
  143. package/dist/src/ui/app.js +176 -0
  144. package/dist/src/ui/app.js.map +1 -0
  145. package/dist/src/ui/chat/attachments.js +135 -0
  146. package/dist/src/ui/chat/attachments.js.map +1 -0
  147. package/dist/src/{tui → ui}/chat/commands.js +55 -7
  148. package/dist/src/ui/chat/commands.js.map +1 -0
  149. package/dist/src/{tui → ui}/chat/controller.js +1176 -345
  150. package/dist/src/ui/chat/controller.js.map +1 -0
  151. package/dist/src/ui/chat/conversations.js +692 -0
  152. package/dist/src/ui/chat/conversations.js.map +1 -0
  153. package/dist/src/{tui → ui}/chat/help.js +11 -5
  154. package/dist/src/ui/chat/help.js.map +1 -0
  155. package/dist/src/ui/chat/panel-state.js +513 -0
  156. package/dist/src/ui/chat/panel-state.js.map +1 -0
  157. package/dist/src/{tui → ui}/chat/projector.js +93 -8
  158. package/dist/src/ui/chat/projector.js.map +1 -0
  159. package/dist/src/ui/chat/prompt.js +176 -0
  160. package/dist/src/ui/chat/prompt.js.map +1 -0
  161. package/dist/src/ui/chat/runtime.js +589 -0
  162. package/dist/src/ui/chat/runtime.js.map +1 -0
  163. package/dist/src/ui/chat/screen.js +1907 -0
  164. package/dist/src/ui/chat/screen.js.map +1 -0
  165. package/dist/src/{tui/chat/controller-helpers.js → ui/chat/state.js} +39 -3
  166. package/dist/src/ui/chat/state.js.map +1 -0
  167. package/dist/src/ui/chat/stream-presentation.js.map +1 -0
  168. package/dist/src/ui/chat/transcript-turn.js +189 -0
  169. package/dist/src/ui/chat/transcript-turn.js.map +1 -0
  170. package/dist/src/{tui/view → ui/chat}/transcript.js +66 -6
  171. package/dist/src/ui/chat/transcript.js.map +1 -0
  172. package/dist/src/ui/chat/types.js +2 -0
  173. package/dist/src/ui/chat/types.js.map +1 -0
  174. package/dist/src/ui/chat/view.js +249 -0
  175. package/dist/src/ui/chat/view.js.map +1 -0
  176. package/dist/src/ui/chat/voice.js +388 -0
  177. package/dist/src/ui/chat/voice.js.map +1 -0
  178. package/dist/src/ui/footer.js +110 -0
  179. package/dist/src/ui/footer.js.map +1 -0
  180. package/dist/src/{tui/view → ui}/frog-canvas.js +47 -50
  181. package/dist/src/ui/frog-canvas.js.map +1 -0
  182. package/dist/src/{tui/view → ui}/frog-drawing.js +36 -29
  183. package/dist/src/ui/frog-drawing.js.map +1 -0
  184. package/dist/src/{tui/view/frog-intro-renderer.js → ui/frog-renderer.js} +63 -46
  185. package/dist/src/ui/frog-renderer.js.map +1 -0
  186. package/dist/src/{tui/view/frog-easter-egg.js → ui/frog.js} +34 -6
  187. package/dist/src/ui/frog.js.map +1 -0
  188. package/dist/src/ui/interaction.js +525 -0
  189. package/dist/src/ui/interaction.js.map +1 -0
  190. package/dist/src/{tui/view → ui}/markdown.js +12 -9
  191. package/dist/src/ui/markdown.js.map +1 -0
  192. package/dist/src/ui/mcp-diagnostics.js +56 -0
  193. package/dist/src/ui/mcp-diagnostics.js.map +1 -0
  194. package/dist/src/ui/media.js +59 -0
  195. package/dist/src/ui/media.js.map +1 -0
  196. package/dist/src/ui/panels/agents.js +97 -0
  197. package/dist/src/ui/panels/agents.js.map +1 -0
  198. package/dist/src/ui/panels/configuration.js +201 -0
  199. package/dist/src/ui/panels/configuration.js.map +1 -0
  200. package/dist/src/ui/panels/context.js +102 -0
  201. package/dist/src/ui/panels/context.js.map +1 -0
  202. package/dist/src/ui/panels/export.js +17 -0
  203. package/dist/src/ui/panels/export.js.map +1 -0
  204. package/dist/src/ui/panels/help.js +22 -0
  205. package/dist/src/ui/panels/help.js.map +1 -0
  206. package/dist/src/ui/panels/models.js +180 -0
  207. package/dist/src/ui/panels/models.js.map +1 -0
  208. package/dist/src/ui/panels/panel.js +122 -0
  209. package/dist/src/ui/panels/panel.js.map +1 -0
  210. package/dist/src/ui/panels/permissions.js +90 -0
  211. package/dist/src/ui/panels/permissions.js.map +1 -0
  212. package/dist/src/ui/panels/sessions.js +54 -0
  213. package/dist/src/ui/panels/sessions.js.map +1 -0
  214. package/dist/src/ui/panels/settings.js +125 -0
  215. package/dist/src/ui/panels/settings.js.map +1 -0
  216. package/dist/src/ui/panels/shared.js +50 -0
  217. package/dist/src/ui/panels/shared.js.map +1 -0
  218. package/dist/src/ui/panels/tasks.js +15 -0
  219. package/dist/src/ui/panels/tasks.js.map +1 -0
  220. package/dist/src/ui/panels/voice.js +142 -0
  221. package/dist/src/ui/panels/voice.js.map +1 -0
  222. package/dist/src/{tui/permissions/settings.js → ui/permission-options.js} +13 -2
  223. package/dist/src/ui/permission-options.js.map +1 -0
  224. package/dist/src/{tui/view → ui}/presentation.js +170 -112
  225. package/dist/src/ui/presentation.js.map +1 -0
  226. package/dist/src/{tui → ui}/run.js +173 -36
  227. package/dist/src/ui/run.js.map +1 -0
  228. package/dist/src/{tui/view/setup-wizard/settings-panel.js → ui/setup/form.js} +6 -6
  229. package/dist/src/ui/setup/form.js.map +1 -0
  230. package/dist/src/ui/setup/menu.js +133 -0
  231. package/dist/src/ui/setup/menu.js.map +1 -0
  232. package/dist/src/{tui/view/setup-wizard → ui/setup}/providers.js +157 -20
  233. package/dist/src/ui/setup/providers.js.map +1 -0
  234. package/dist/src/{tui/view/setup-wizard → ui/setup}/steps.js +193 -147
  235. package/dist/src/ui/setup/steps.js.map +1 -0
  236. package/dist/src/ui/setup/wizard.js +2075 -0
  237. package/dist/src/ui/setup/wizard.js.map +1 -0
  238. package/dist/src/ui/startup.js +147 -0
  239. package/dist/src/ui/startup.js.map +1 -0
  240. package/dist/src/{tui/terminal/size.js → ui/terminal-size.js} +1 -1
  241. package/dist/src/ui/terminal-size.js.map +1 -0
  242. package/dist/src/ui/text-input.js +50 -0
  243. package/dist/src/ui/text-input.js.map +1 -0
  244. package/dist/src/{tui/view → ui}/theme.js +24 -31
  245. package/dist/src/ui/theme.js.map +1 -0
  246. package/dist/src/ui/update.js +126 -0
  247. package/dist/src/ui/update.js.map +1 -0
  248. package/dist/src/usage.js +0 -5
  249. package/dist/src/usage.js.map +1 -1
  250. package/dist/src/values.js +5 -0
  251. package/dist/src/values.js.map +1 -0
  252. package/package.json +16 -8
  253. package/src/agent/voice-sidecar.py +730 -0
  254. package/dist/src/console.js.map +0 -1
  255. package/dist/src/tui/acp/projection.js.map +0 -1
  256. package/dist/src/tui/acp/server.js.map +0 -1
  257. package/dist/src/tui/agent-configuration.js.map +0 -1
  258. package/dist/src/tui/background/activity.js.map +0 -1
  259. package/dist/src/tui/background/inbox.js +0 -120
  260. package/dist/src/tui/background/inbox.js.map +0 -1
  261. package/dist/src/tui/background/tasks.js +0 -98
  262. package/dist/src/tui/background/tasks.js.map +0 -1
  263. package/dist/src/tui/builtin-tools.js.map +0 -1
  264. package/dist/src/tui/chat/commands.js.map +0 -1
  265. package/dist/src/tui/chat/controller-helpers.js.map +0 -1
  266. package/dist/src/tui/chat/controller.js.map +0 -1
  267. package/dist/src/tui/chat/help.js.map +0 -1
  268. package/dist/src/tui/chat/panels.js +0 -407
  269. package/dist/src/tui/chat/panels.js.map +0 -1
  270. package/dist/src/tui/chat/projector.js.map +0 -1
  271. package/dist/src/tui/chat/sdk-projector.js.map +0 -1
  272. package/dist/src/tui/chat/shell.js.map +0 -1
  273. package/dist/src/tui/chat/types.js +0 -2
  274. package/dist/src/tui/chat/types.js.map +0 -1
  275. package/dist/src/tui/config.js.map +0 -1
  276. package/dist/src/tui/configuration-instructions.js +0 -14
  277. package/dist/src/tui/configuration-instructions.js.map +0 -1
  278. package/dist/src/tui/mcp/config.js.map +0 -1
  279. package/dist/src/tui/mcp.js +0 -98
  280. package/dist/src/tui/mcp.js.map +0 -1
  281. package/dist/src/tui/memory-options.js +0 -10
  282. package/dist/src/tui/memory-options.js.map +0 -1
  283. package/dist/src/tui/messaging.js +0 -193
  284. package/dist/src/tui/messaging.js.map +0 -1
  285. package/dist/src/tui/model/context.js +0 -69
  286. package/dist/src/tui/model/context.js.map +0 -1
  287. package/dist/src/tui/model/display.js.map +0 -1
  288. package/dist/src/tui/model/runtime.js.map +0 -1
  289. package/dist/src/tui/model/selection.js.map +0 -1
  290. package/dist/src/tui/npm.js.map +0 -1
  291. package/dist/src/tui/package-version.js.map +0 -1
  292. package/dist/src/tui/permissions/file-change-preview.js.map +0 -1
  293. package/dist/src/tui/permissions/policy.js +0 -222
  294. package/dist/src/tui/permissions/policy.js.map +0 -1
  295. package/dist/src/tui/permissions/settings.js.map +0 -1
  296. package/dist/src/tui/project/acp.js.map +0 -1
  297. package/dist/src/tui/project/archive.js +0 -241
  298. package/dist/src/tui/project/archive.js.map +0 -1
  299. package/dist/src/tui/project/configuration-secrets.js +0 -107
  300. package/dist/src/tui/project/configuration-secrets.js.map +0 -1
  301. package/dist/src/tui/project/configuration.js +0 -201
  302. package/dist/src/tui/project/configuration.js.map +0 -1
  303. package/dist/src/tui/project/export.js.map +0 -1
  304. package/dist/src/tui/project/import.js.map +0 -1
  305. package/dist/src/tui/project/module-loader.js.map +0 -1
  306. package/dist/src/tui/project/packaging.js.map +0 -1
  307. package/dist/src/tui/project/portable-dependencies.js +0 -34
  308. package/dist/src/tui/project/portable-dependencies.js.map +0 -1
  309. package/dist/src/tui/project/portable-mcp.js +0 -118
  310. package/dist/src/tui/project/portable-mcp.js.map +0 -1
  311. package/dist/src/tui/project/python.js.map +0 -1
  312. package/dist/src/tui/project/run.js +0 -116
  313. package/dist/src/tui/project/run.js.map +0 -1
  314. package/dist/src/tui/project/source.js.map +0 -1
  315. package/dist/src/tui/project/typescript.js.map +0 -1
  316. package/dist/src/tui/provider/aws-client.js +0 -67
  317. package/dist/src/tui/provider/aws-client.js.map +0 -1
  318. package/dist/src/tui/provider/aws-config.js.map +0 -1
  319. package/dist/src/tui/provider/bedrock-catalog.js.map +0 -1
  320. package/dist/src/tui/provider/discovery.js.map +0 -1
  321. package/dist/src/tui/provider/environment.js.map +0 -1
  322. package/dist/src/tui/provider/packages.js.map +0 -1
  323. package/dist/src/tui/run.js.map +0 -1
  324. package/dist/src/tui/runtime.js +0 -524
  325. package/dist/src/tui/runtime.js.map +0 -1
  326. package/dist/src/tui/session/agent-definition.js +0 -100
  327. package/dist/src/tui/session/agent-definition.js.map +0 -1
  328. package/dist/src/tui/session/catalog.js +0 -159
  329. package/dist/src/tui/session/catalog.js.map +0 -1
  330. package/dist/src/tui/session/context.js.map +0 -1
  331. package/dist/src/tui/session/conversation-helpers.js +0 -46
  332. package/dist/src/tui/session/conversation-helpers.js.map +0 -1
  333. package/dist/src/tui/session/conversations.js +0 -471
  334. package/dist/src/tui/session/conversations.js.map +0 -1
  335. package/dist/src/tui/session/desktop-profile.js.map +0 -1
  336. package/dist/src/tui/session/options.js +0 -44
  337. package/dist/src/tui/session/options.js.map +0 -1
  338. package/dist/src/tui/session/sessions.js.map +0 -1
  339. package/dist/src/tui/session/voice.js +0 -353
  340. package/dist/src/tui/session/voice.js.map +0 -1
  341. package/dist/src/tui/settings.js.map +0 -1
  342. package/dist/src/tui/skills.js.map +0 -1
  343. package/dist/src/tui/steering.js +0 -67
  344. package/dist/src/tui/steering.js.map +0 -1
  345. package/dist/src/tui/strands-backend.js.map +0 -1
  346. package/dist/src/tui/stream-presentation.js.map +0 -1
  347. package/dist/src/tui/terminal/composer.js.map +0 -1
  348. package/dist/src/tui/terminal/directory-picker.js +0 -76
  349. package/dist/src/tui/terminal/directory-picker.js.map +0 -1
  350. package/dist/src/tui/terminal/ink.js.map +0 -1
  351. package/dist/src/tui/terminal/mouse-input.js.map +0 -1
  352. package/dist/src/tui/terminal/open-url.js +0 -21
  353. package/dist/src/tui/terminal/open-url.js.map +0 -1
  354. package/dist/src/tui/terminal/process-tree.js.map +0 -1
  355. package/dist/src/tui/terminal/sanitize.js.map +0 -1
  356. package/dist/src/tui/terminal/shell-output.js.map +0 -1
  357. package/dist/src/tui/terminal/size.js.map +0 -1
  358. package/dist/src/tui/terminal/terminal.js.map +0 -1
  359. package/dist/src/tui/update-check.js +0 -37
  360. package/dist/src/tui/update-check.js.map +0 -1
  361. package/dist/src/tui/view/agents-panel.js +0 -21
  362. package/dist/src/tui/view/agents-panel.js.map +0 -1
  363. package/dist/src/tui/view/app.js +0 -1061
  364. package/dist/src/tui/view/app.js.map +0 -1
  365. package/dist/src/tui/view/chat-root.js +0 -49
  366. package/dist/src/tui/view/chat-root.js.map +0 -1
  367. package/dist/src/tui/view/chat-view.js +0 -145
  368. package/dist/src/tui/view/chat-view.js.map +0 -1
  369. package/dist/src/tui/view/command-palette.js +0 -15
  370. package/dist/src/tui/view/command-palette.js.map +0 -1
  371. package/dist/src/tui/view/custom-theme-editor.js +0 -301
  372. package/dist/src/tui/view/custom-theme-editor.js.map +0 -1
  373. package/dist/src/tui/view/effort-panel.js +0 -15
  374. package/dist/src/tui/view/effort-panel.js.map +0 -1
  375. package/dist/src/tui/view/export-panel.js +0 -14
  376. package/dist/src/tui/view/export-panel.js.map +0 -1
  377. package/dist/src/tui/view/fade-in.js.map +0 -1
  378. package/dist/src/tui/view/frog-canvas.js.map +0 -1
  379. package/dist/src/tui/view/frog-drawing.js.map +0 -1
  380. package/dist/src/tui/view/frog-easter-egg.js.map +0 -1
  381. package/dist/src/tui/view/frog-intro-renderer.js.map +0 -1
  382. package/dist/src/tui/view/help-footer.js +0 -48
  383. package/dist/src/tui/view/help-footer.js.map +0 -1
  384. package/dist/src/tui/view/interaction.js +0 -352
  385. package/dist/src/tui/view/interaction.js.map +0 -1
  386. package/dist/src/tui/view/markdown.js.map +0 -1
  387. package/dist/src/tui/view/mcp-trust-prompt.js +0 -17
  388. package/dist/src/tui/view/mcp-trust-prompt.js.map +0 -1
  389. package/dist/src/tui/view/media.js +0 -70
  390. package/dist/src/tui/view/media.js.map +0 -1
  391. package/dist/src/tui/view/model-panel.js +0 -77
  392. package/dist/src/tui/view/model-panel.js.map +0 -1
  393. package/dist/src/tui/view/panel-components.js +0 -17
  394. package/dist/src/tui/view/panel-components.js.map +0 -1
  395. package/dist/src/tui/view/panels.js +0 -139
  396. package/dist/src/tui/view/panels.js.map +0 -1
  397. package/dist/src/tui/view/presentation.js.map +0 -1
  398. package/dist/src/tui/view/prompt-editor.js +0 -82
  399. package/dist/src/tui/view/prompt-editor.js.map +0 -1
  400. package/dist/src/tui/view/provider-list.js +0 -14
  401. package/dist/src/tui/view/provider-list.js.map +0 -1
  402. package/dist/src/tui/view/rename-panel.js +0 -11
  403. package/dist/src/tui/view/rename-panel.js.map +0 -1
  404. package/dist/src/tui/view/sessions-panel.js +0 -15
  405. package/dist/src/tui/view/sessions-panel.js.map +0 -1
  406. package/dist/src/tui/view/settings-panel.js +0 -146
  407. package/dist/src/tui/view/settings-panel.js.map +0 -1
  408. package/dist/src/tui/view/setup-wizard/brand.js +0 -34
  409. package/dist/src/tui/view/setup-wizard/brand.js.map +0 -1
  410. package/dist/src/tui/view/setup-wizard/index.js +0 -1638
  411. package/dist/src/tui/view/setup-wizard/index.js.map +0 -1
  412. package/dist/src/tui/view/setup-wizard/opening-menu.js +0 -99
  413. package/dist/src/tui/view/setup-wizard/opening-menu.js.map +0 -1
  414. package/dist/src/tui/view/setup-wizard/path-completion.js +0 -53
  415. package/dist/src/tui/view/setup-wizard/path-completion.js.map +0 -1
  416. package/dist/src/tui/view/setup-wizard/profile-fields.js +0 -29
  417. package/dist/src/tui/view/setup-wizard/profile-fields.js.map +0 -1
  418. package/dist/src/tui/view/setup-wizard/progress.js +0 -43
  419. package/dist/src/tui/view/setup-wizard/progress.js.map +0 -1
  420. package/dist/src/tui/view/setup-wizard/providers.js.map +0 -1
  421. package/dist/src/tui/view/setup-wizard/settings-panel.js.map +0 -1
  422. package/dist/src/tui/view/setup-wizard/steps.js.map +0 -1
  423. package/dist/src/tui/view/setup-wizard/types.js.map +0 -1
  424. package/dist/src/tui/view/setup-wizard/use-provider-discovery.js +0 -143
  425. package/dist/src/tui/view/setup-wizard/use-provider-discovery.js.map +0 -1
  426. package/dist/src/tui/view/startup-view.js +0 -79
  427. package/dist/src/tui/view/startup-view.js.map +0 -1
  428. package/dist/src/tui/view/text-input.js +0 -33
  429. package/dist/src/tui/view/text-input.js.map +0 -1
  430. package/dist/src/tui/view/theme-detection.js +0 -45
  431. package/dist/src/tui/view/theme-detection.js.map +0 -1
  432. package/dist/src/tui/view/theme.js.map +0 -1
  433. package/dist/src/tui/view/transcript-layout.js +0 -60
  434. package/dist/src/tui/view/transcript-layout.js.map +0 -1
  435. package/dist/src/tui/view/transcript-turn.js +0 -135
  436. package/dist/src/tui/view/transcript-turn.js.map +0 -1
  437. package/dist/src/tui/view/transcript.js.map +0 -1
  438. package/dist/src/tui/view/use-party-frame.js +0 -15
  439. package/dist/src/tui/view/use-party-frame.js.map +0 -1
  440. package/dist/src/tui/view/use-spinner.js +0 -14
  441. package/dist/src/tui/view/use-spinner.js.map +0 -1
  442. package/dist/src/tui/voice/session.js.map +0 -1
  443. package/dist/src/tui/workspace/sandbox.js.map +0 -1
  444. package/dist/src/tui/workspace/trust.js.map +0 -1
  445. package/src/tui/voice/sidecar.py +0 -631
  446. /package/dist/src/{tui/view/setup-wizard → agent}/types.js +0 -0
  447. /package/dist/src/{tui/provider → model}/packages.js +0 -0
  448. /package/dist/src/{tui/terminal → terminal}/ink.js +0 -0
  449. /package/dist/src/{tui/terminal → terminal}/mouse-input.js +0 -0
  450. /package/dist/src/{tui → terminal}/npm.js +0 -0
  451. /package/dist/src/{tui/terminal → terminal}/process-tree.js +0 -0
  452. /package/dist/src/{tui/terminal → terminal}/shell-output.js +0 -0
  453. /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/sanitize.js';
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 VOICE_IDS = [
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
- _transcriptListeners = new Set();
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
- _stopping = false;
46
- _utteranceActive = false;
47
- _speechQueue = [];
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
- onTranscript = (listener) => {
64
- this._transcriptListeners.add(listener);
77
+ onSupervisorRequest = (listener) => {
78
+ this._supervisorListeners.add(listener);
65
79
  return () => {
66
- this._transcriptListeners.delete(listener);
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._process && this._snapshot.status !== 'error' && this._snapshot.status !== 'off') {
83
- return this._startTask ?? Promise.resolve();
90
+ if (this._desired.enabled) {
91
+ return this._lifecycleTask ?? Promise.resolve();
84
92
  }
85
- this._startTask ??= this._start(++this._lifecycleGeneration);
86
- return this._startTask;
93
+ return this._requestSession(true);
87
94
  }
88
95
  stop() {
89
- this._lifecycleGeneration++;
90
- this._stopTask ??= this._stop();
91
- return this._stopTask;
96
+ return this._requestSession(false);
92
97
  }
93
- speak(text) {
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._speechQueue.push(clean);
103
- this._pumpSpeechQueue();
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._process || this._snapshot.status === 'off' || this._snapshot.status === 'error') {
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
- setSpokenReplies(enabled) {
121
- if (this._snapshot.spokenReplies === enabled) {
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
- if (!enabled) {
125
- this._clearSpeechQueue();
126
- this._writeControl({ type: 'stop_speaking' });
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
- setEndpointingSensitivity(sensitivity) {
132
- return this._setModelOption('endpointingSensitivity', sensitivity);
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 (restart) {
144
- await this.stop();
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._transcriptListeners.clear();
156
- this._speechStartListeners.clear();
178
+ this._supervisorListeners.clear();
157
179
  }
158
- async _start(generation) {
159
- await this._stopTask;
160
- await this._failureCleanup;
161
- if (this._disposed || generation !== this._lifecycleGeneration) {
162
- this._startTask = undefined;
163
- return;
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
- if (this._process) {
166
- await this._stop();
219
+ finally {
220
+ this._lifecycleTask = undefined;
167
221
  }
168
- this._stopTask = undefined;
169
- this._stopping = false;
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
- '--sidecar',
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
- this._process = child;
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) => this._readStdout(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._stderr = `${this._stderr}${chunk}`.slice(-STDERR_LIMIT);
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._process === child && !this._stopping) {
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._process === child) {
208
- this._process = undefined;
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
- try {
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 _stop() {
263
- try {
264
- await this._failureCleanup;
265
- const child = this._process;
266
- if (child) {
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 === child) {
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
- return;
315
- }
316
- if (type === 'mute_changed' && typeof event.muted === 'boolean') {
317
- this._setConnectedSnapshot('listening', event.muted);
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 === 'interruption') {
335
- this._clearSpeechQueue();
336
- this._signalSpeechStart();
337
- this._setConnectedSnapshot('interrupted');
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 === 'speech_output_interrupted' || type === 'speech_output_stopped') {
351
- this._clearSpeechQueue();
352
- this._setConnectedSnapshot('listening');
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 === 'connection_close' && !this._stopping) {
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?.stdin.writable) {
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
- const text = this._speechQueue.shift();
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._clearSpeechQueue();
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
- const child = this._process;
430
- if (!child || this._stopping || this._failureCleanup) {
431
- return;
432
- }
433
- this._lifecycleGeneration++;
434
- this._stopping = true;
435
- this._writeControl({ type: 'stop' });
436
- this._failureCleanup = this._terminateChild(child)
437
- .catch((error) => {
438
- const failure = error instanceof Error ? error.message : String(error);
439
- this._setSnapshot({
440
- status: 'error',
441
- muted: false,
442
- inputLevel: 0,
443
- inputLevelDb: -60,
444
- message: `${this._snapshot.message ?? message}\nFailed to stop voice sidecar: ${failure}`,
445
- });
446
- })
447
- .finally(() => {
448
- this._stopping = false;
449
- this._utteranceActive = false;
450
- this._clearSpeechQueue();
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: muted ? 'muted' : 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
- ...(snapshot.model ? { model: snapshot.model } : {}),
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, '../../../../src/tui/voice/sidecar.py'),
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=session.js.map
512
+ //# sourceMappingURL=voice.js.map