@bastani/atomic 0.9.74-alpha.1 → 0.9.75-alpha.1

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 (383) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/dist/builtin/intercom/package.json +2 -2
  3. package/dist/builtin/mcp/package.json +1 -1
  4. package/dist/builtin/subagents/CHANGELOG.md +8 -0
  5. package/dist/builtin/subagents/package.json +3 -3
  6. package/dist/builtin/subagents/skills/agent-browser/SKILL.md +8 -10
  7. package/dist/builtin/subagents/skills/agent-desktop/SKILL.md +9 -5
  8. package/dist/builtin/subagents/src/extension/index.bundle.mjs +7 -1
  9. package/dist/builtin/web-access/package.json +2 -2
  10. package/dist/builtin/workflows/CHANGELOG.md +48 -0
  11. package/dist/builtin/workflows/README.md +5 -2
  12. package/dist/builtin/workflows/builtin/{chunk-m8eg152f.js → chunk-89we7r4p.js} +1 -1
  13. package/dist/builtin/workflows/builtin/{chunk-a4fdm2cw.js → chunk-8yfssw01.js} +1 -1
  14. package/dist/builtin/workflows/builtin/{chunk-774myqzs.js → chunk-v8mb0005.js} +366 -45
  15. package/dist/builtin/workflows/builtin/{chunk-d5cxskkp.js → chunk-wh2p4qjg.js} +2 -2
  16. package/dist/builtin/workflows/builtin/goal.js +2 -2
  17. package/dist/builtin/workflows/builtin/index.d.ts +10 -0
  18. package/dist/builtin/workflows/builtin/index.js +4 -4
  19. package/dist/builtin/workflows/builtin/open-claude-design.d.ts +12 -0
  20. package/dist/builtin/workflows/builtin/open-claude-design.js +1 -1
  21. package/dist/builtin/workflows/builtin/ralph.js +2 -2
  22. package/dist/builtin/workflows/package.json +2 -2
  23. package/dist/builtin/workflows/skills/impeccable/SKILL.md +4 -4
  24. package/dist/builtin/workflows/skills/impeccable/reference/android.md +1 -1
  25. package/dist/builtin/workflows/skills/impeccable/reference/audit.md +2 -2
  26. package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +1 -1
  27. package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +1 -1
  28. package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +4 -4
  29. package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +2 -2
  30. package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +3 -2
  31. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +3 -3
  32. package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +1 -1
  33. package/dist/builtin/workflows/skills/impeccable/reference/document.md +3 -3
  34. package/dist/builtin/workflows/skills/impeccable/reference/harden.md +19 -0
  35. package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +15 -8
  36. package/dist/builtin/workflows/skills/impeccable/reference/init.md +2 -0
  37. package/dist/builtin/workflows/skills/impeccable/reference/live.md +8 -6
  38. package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +4 -4
  39. package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +0 -1
  40. package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +1 -1
  41. package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -1
  42. package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +2 -2
  43. package/dist/builtin/workflows/skills/impeccable/scripts/engine-checksums.txt +9 -0
  44. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable +98 -44
  45. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable.cmd +101 -34
  46. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-ignores.js +6 -2
  47. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-session.js +4 -1
  48. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +444 -144
  49. package/dist/builtin/workflows/skills/prompt-engineer/SKILL.md +3 -1
  50. package/dist/builtin/workflows/skills/prompt-engineer/references/advanced_patterns.md +2 -2
  51. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5.md +13 -11
  52. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_1.md +10 -8
  53. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_2.md +143 -0
  54. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_haiku_5_5.md +11 -7
  55. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_4_8.md +3 -3
  56. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5.md +6 -2
  57. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5_5.md +7 -7
  58. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_sonnet_5.md +2 -2
  59. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_sonnet_5_5.md +3 -3
  60. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_5_5.md +2 -2
  61. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_5_6.md +2 -2
  62. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6.md +6 -5
  63. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_sol.md +4 -4
  64. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_terra.md +2 -2
  65. package/dist/builtin/workflows/skills/prompt-engineer/references/quality_improvement.md +4 -3
  66. package/dist/builtin/workflows/skills/skill-creator/scripts/aggregate_benchmark.py +0 -0
  67. package/dist/builtin/workflows/skills/skill-creator/scripts/generate_report.py +0 -0
  68. package/dist/builtin/workflows/skills/skill-creator/scripts/improve_description.py +0 -0
  69. package/dist/builtin/workflows/skills/skill-creator/scripts/package_skill.py +0 -0
  70. package/dist/builtin/workflows/skills/skill-creator/scripts/quick_validate.py +0 -0
  71. package/dist/builtin/workflows/skills/skill-creator/scripts/run_eval.py +0 -0
  72. package/dist/builtin/workflows/skills/skill-creator/scripts/run_loop.py +0 -0
  73. package/dist/builtin/workflows/skills/unslop/SKILL.md +15 -34
  74. package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +1 -0
  75. package/dist/builtin/workflows/src/durable/journal/values.d.ts +2 -0
  76. package/dist/builtin/workflows/src/extension/index.bundle.mjs +809 -410
  77. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +695 -305
  78. package/dist/builtin/workflows/src/index.js +685 -295
  79. package/dist/builtin/workflows/src/local-worker-entry.mjs +695 -305
  80. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +6 -6
  81. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +2 -2
  82. package/dist/builtin/workflows/src/shared/serializable-error-families.d.ts +2 -0
  83. package/dist/bun/app-host-modules.d.ts +1 -1
  84. package/dist/bun/app-host-modules.d.ts.map +1 -1
  85. package/dist/bun/app-host-modules.js.map +1 -1
  86. package/dist/bun/internal-workflow-worker.d.ts +2 -0
  87. package/dist/bun/internal-workflow-worker.d.ts.map +1 -1
  88. package/dist/bun/internal-workflow-worker.js +2 -1
  89. package/dist/bun/internal-workflow-worker.js.map +1 -1
  90. package/dist/codemode-worker.js +2 -0
  91. package/dist/config.d.ts +8 -0
  92. package/dist/config.d.ts.map +1 -1
  93. package/dist/config.js +14 -0
  94. package/dist/config.js.map +1 -1
  95. package/dist/core/agent-session-bash.d.ts.map +1 -1
  96. package/dist/core/agent-session-bash.js +2 -1
  97. package/dist/core/agent-session-bash.js.map +1 -1
  98. package/dist/core/agent-session-blueprint-environment.d.ts +10 -0
  99. package/dist/core/agent-session-blueprint-environment.d.ts.map +1 -0
  100. package/dist/core/agent-session-blueprint-environment.js +28 -0
  101. package/dist/core/agent-session-blueprint-environment.js.map +1 -0
  102. package/dist/core/agent-session-events.d.ts.map +1 -1
  103. package/dist/core/agent-session-events.js +2 -0
  104. package/dist/core/agent-session-events.js.map +1 -1
  105. package/dist/core/agent-session-methods.d.ts +1 -0
  106. package/dist/core/agent-session-methods.d.ts.map +1 -1
  107. package/dist/core/agent-session-methods.js.map +1 -1
  108. package/dist/core/agent-session-retry.d.ts.map +1 -1
  109. package/dist/core/agent-session-retry.js +14 -4
  110. package/dist/core/agent-session-retry.js.map +1 -1
  111. package/dist/core/agent-session-runtime.d.ts +20 -0
  112. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  113. package/dist/core/agent-session-runtime.js +55 -6
  114. package/dist/core/agent-session-runtime.js.map +1 -1
  115. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  116. package/dist/core/agent-session-tool-registry.js +2 -1
  117. package/dist/core/agent-session-tool-registry.js.map +1 -1
  118. package/dist/core/agent-session.d.ts +2 -0
  119. package/dist/core/agent-session.d.ts.map +1 -1
  120. package/dist/core/agent-session.js +2 -0
  121. package/dist/core/agent-session.js.map +1 -1
  122. package/dist/core/async-scope.d.ts +13 -0
  123. package/dist/core/async-scope.d.ts.map +1 -0
  124. package/dist/core/async-scope.js +20 -0
  125. package/dist/core/async-scope.js.map +1 -0
  126. package/dist/core/cache-warmer.d.ts +3 -14
  127. package/dist/core/cache-warmer.d.ts.map +1 -1
  128. package/dist/core/cache-warmer.js +8 -60
  129. package/dist/core/cache-warmer.js.map +1 -1
  130. package/dist/core/extensions/extension-work.js +2 -2
  131. package/dist/core/extensions/extension-work.js.map +1 -1
  132. package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
  133. package/dist/core/extensions/loader-host-modules.js +3 -1
  134. package/dist/core/extensions/loader-host-modules.js.map +1 -1
  135. package/dist/core/extensions/ui-types.d.ts +2 -1
  136. package/dist/core/extensions/ui-types.d.ts.map +1 -1
  137. package/dist/core/extensions/ui-types.js.map +1 -1
  138. package/dist/core/extensions/workflow-events.d.ts +1 -1
  139. package/dist/core/extensions/workflow-events.d.ts.map +1 -1
  140. package/dist/core/extensions/workflow-events.js.map +1 -1
  141. package/dist/core/extensions/workflow-run-control.d.ts +4 -2
  142. package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
  143. package/dist/core/extensions/workflow-run-control.js.map +1 -1
  144. package/dist/core/model-fallback-failures.d.ts +6 -0
  145. package/dist/core/model-fallback-failures.d.ts.map +1 -1
  146. package/dist/core/model-fallback-failures.js +10 -1
  147. package/dist/core/model-fallback-failures.js.map +1 -1
  148. package/dist/core/preferred-providers.d.ts +19 -0
  149. package/dist/core/preferred-providers.d.ts.map +1 -0
  150. package/dist/core/preferred-providers.js +25 -0
  151. package/dist/core/preferred-providers.js.map +1 -0
  152. package/dist/core/provider-alias.d.ts.map +1 -1
  153. package/dist/core/provider-alias.js +4 -0
  154. package/dist/core/provider-alias.js.map +1 -1
  155. package/dist/core/provider-composer.d.ts.map +1 -1
  156. package/dist/core/provider-composer.js +1 -0
  157. package/dist/core/provider-composer.js.map +1 -1
  158. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  159. package/dist/core/remote-catalog-provider.js +3 -0
  160. package/dist/core/remote-catalog-provider.js.map +1 -1
  161. package/dist/core/resume/blueprint/action-expressions.d.ts +32 -0
  162. package/dist/core/resume/blueprint/action-expressions.d.ts.map +1 -0
  163. package/dist/core/resume/blueprint/action-expressions.js +389 -0
  164. package/dist/core/resume/blueprint/action-expressions.js.map +1 -0
  165. package/dist/core/resume/blueprint/actions.d.ts +90 -0
  166. package/dist/core/resume/blueprint/actions.d.ts.map +1 -0
  167. package/dist/core/resume/blueprint/actions.js +818 -0
  168. package/dist/core/resume/blueprint/actions.js.map +1 -0
  169. package/dist/core/resume/blueprint/build.d.ts +102 -0
  170. package/dist/core/resume/blueprint/build.d.ts.map +1 -0
  171. package/dist/core/resume/blueprint/build.js +535 -0
  172. package/dist/core/resume/blueprint/build.js.map +1 -0
  173. package/dist/core/resume/blueprint/context.d.ts +11 -0
  174. package/dist/core/resume/blueprint/context.d.ts.map +1 -0
  175. package/dist/core/resume/blueprint/context.js +106 -0
  176. package/dist/core/resume/blueprint/context.js.map +1 -0
  177. package/dist/core/resume/blueprint/envrc.d.ts +19 -0
  178. package/dist/core/resume/blueprint/envrc.d.ts.map +1 -0
  179. package/dist/core/resume/blueprint/envrc.js +77 -0
  180. package/dist/core/resume/blueprint/envrc.js.map +1 -0
  181. package/dist/core/resume/blueprint/errors.d.ts +179 -0
  182. package/dist/core/resume/blueprint/errors.d.ts.map +1 -0
  183. package/dist/core/resume/blueprint/errors.js +169 -0
  184. package/dist/core/resume/blueprint/errors.js.map +1 -0
  185. package/dist/core/resume/blueprint/ledger.d.ts +51 -0
  186. package/dist/core/resume/blueprint/ledger.d.ts.map +1 -0
  187. package/dist/core/resume/blueprint/ledger.js +119 -0
  188. package/dist/core/resume/blueprint/ledger.js.map +1 -0
  189. package/dist/core/resume/blueprint/notices.d.ts +14 -0
  190. package/dist/core/resume/blueprint/notices.d.ts.map +1 -0
  191. package/dist/core/resume/blueprint/notices.js +44 -0
  192. package/dist/core/resume/blueprint/notices.js.map +1 -0
  193. package/dist/core/resume/blueprint/process.d.ts +44 -0
  194. package/dist/core/resume/blueprint/process.d.ts.map +1 -0
  195. package/dist/core/resume/blueprint/process.js +142 -0
  196. package/dist/core/resume/blueprint/process.js.map +1 -0
  197. package/dist/core/resume/blueprint/resume.d.ts +73 -0
  198. package/dist/core/resume/blueprint/resume.d.ts.map +1 -0
  199. package/dist/core/resume/blueprint/resume.js +206 -0
  200. package/dist/core/resume/blueprint/resume.js.map +1 -0
  201. package/dist/core/resume/blueprint/schema.d.ts +26 -0
  202. package/dist/core/resume/blueprint/schema.d.ts.map +1 -0
  203. package/dist/core/resume/blueprint/schema.js +243 -0
  204. package/dist/core/resume/blueprint/schema.js.map +1 -0
  205. package/dist/core/resume/blueprint/steps.d.ts +54 -0
  206. package/dist/core/resume/blueprint/steps.d.ts.map +1 -0
  207. package/dist/core/resume/blueprint/steps.js +155 -0
  208. package/dist/core/resume/blueprint/steps.js.map +1 -0
  209. package/dist/core/resume/blueprint/types.d.ts +63 -0
  210. package/dist/core/resume/blueprint/types.d.ts.map +1 -0
  211. package/dist/core/resume/blueprint/types.js +2 -0
  212. package/dist/core/resume/blueprint/types.js.map +1 -0
  213. package/dist/core/resume/errors.d.ts +7 -35
  214. package/dist/core/resume/errors.d.ts.map +1 -1
  215. package/dist/core/resume/errors.js +1 -21
  216. package/dist/core/resume/errors.js.map +1 -1
  217. package/dist/core/resume/index.d.ts +12 -4
  218. package/dist/core/resume/index.d.ts.map +1 -1
  219. package/dist/core/resume/index.js +11 -4
  220. package/dist/core/resume/index.js.map +1 -1
  221. package/dist/core/resume/run-setup.d.ts +36 -15
  222. package/dist/core/resume/run-setup.d.ts.map +1 -1
  223. package/dist/core/resume/run-setup.js +70 -54
  224. package/dist/core/resume/run-setup.js.map +1 -1
  225. package/dist/core/resume/session-resume.d.ts +34 -20
  226. package/dist/core/resume/session-resume.d.ts.map +1 -1
  227. package/dist/core/resume/session-resume.js +244 -106
  228. package/dist/core/resume/session-resume.js.map +1 -1
  229. package/dist/core/retry-policy.d.ts +19 -1
  230. package/dist/core/retry-policy.d.ts.map +1 -1
  231. package/dist/core/retry-policy.js +26 -1
  232. package/dist/core/retry-policy.js.map +1 -1
  233. package/dist/core/sdk.js +1 -1
  234. package/dist/core/sdk.js.map +1 -1
  235. package/dist/core/session-cwd.d.ts +56 -1
  236. package/dist/core/session-cwd.d.ts.map +1 -1
  237. package/dist/core/session-cwd.js +94 -4
  238. package/dist/core/session-cwd.js.map +1 -1
  239. package/dist/core/session-manager-core.d.ts +1 -1
  240. package/dist/core/session-manager-core.d.ts.map +1 -1
  241. package/dist/core/session-manager-core.js +10 -5
  242. package/dist/core/session-manager-core.js.map +1 -1
  243. package/dist/core/session-worktree-snapshots.d.ts +11 -0
  244. package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
  245. package/dist/core/session-worktree-snapshots.js +10 -4
  246. package/dist/core/session-worktree-snapshots.js.map +1 -1
  247. package/dist/core/settings-defaults.d.ts +1 -1
  248. package/dist/core/settings-defaults.d.ts.map +1 -1
  249. package/dist/core/settings-defaults.js +1 -1
  250. package/dist/core/settings-defaults.js.map +1 -1
  251. package/dist/core/settings-manager-basic-accessors.d.ts +3 -2
  252. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  253. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  254. package/dist/core/settings-schema.d.ts.map +1 -1
  255. package/dist/core/settings-schema.js +2 -1
  256. package/dist/core/settings-schema.js.map +1 -1
  257. package/dist/core/slash-commands.d.ts.map +1 -1
  258. package/dist/core/slash-commands.js +4 -0
  259. package/dist/core/slash-commands.js.map +1 -1
  260. package/dist/core/storage/write-ahead-log.d.ts +2 -1
  261. package/dist/core/storage/write-ahead-log.d.ts.map +1 -1
  262. package/dist/core/storage/write-ahead-log.js +27 -6
  263. package/dist/core/storage/write-ahead-log.js.map +1 -1
  264. package/dist/core/system-prompt.d.ts.map +1 -1
  265. package/dist/core/system-prompt.js +10 -0
  266. package/dist/core/system-prompt.js.map +1 -1
  267. package/dist/core/tools/file-tool-errors.d.ts +1 -1
  268. package/dist/core/tools/file-tool-errors.js +1 -1
  269. package/dist/core/tools/file-tool-errors.js.map +1 -1
  270. package/dist/core/tools/find.d.ts.map +1 -1
  271. package/dist/core/tools/find.js +52 -26
  272. package/dist/core/tools/find.js.map +1 -1
  273. package/dist/core/tools/grep.d.ts +2 -0
  274. package/dist/core/tools/grep.d.ts.map +1 -1
  275. package/dist/core/tools/grep.js.map +1 -1
  276. package/dist/core/tools/powershell.d.ts.map +1 -1
  277. package/dist/core/tools/powershell.js +10 -2
  278. package/dist/core/tools/powershell.js.map +1 -1
  279. package/dist/core/tools/tool-concurrency.d.ts.map +1 -1
  280. package/dist/core/tools/tool-concurrency.js +2 -2
  281. package/dist/core/tools/tool-concurrency.js.map +1 -1
  282. package/dist/index.d.ts +3 -2
  283. package/dist/index.d.ts.map +1 -1
  284. package/dist/index.js +2 -1
  285. package/dist/index.js.map +1 -1
  286. package/dist/main-session.d.ts +12 -4
  287. package/dist/main-session.d.ts.map +1 -1
  288. package/dist/main-session.js +28 -4
  289. package/dist/main-session.js.map +1 -1
  290. package/dist/main.d.ts.map +1 -1
  291. package/dist/main.js +6 -8
  292. package/dist/main.js.map +1 -1
  293. package/dist/modes/interactive/components/chat-session-host.d.ts +5 -1
  294. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  295. package/dist/modes/interactive/components/chat-session-host.js +6 -1
  296. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  297. package/dist/modes/interactive/components/oauth-selector.d.ts +10 -3
  298. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  299. package/dist/modes/interactive/components/oauth-selector.js +34 -13
  300. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  301. package/dist/modes/interactive/components/provider-brand.d.ts +16 -0
  302. package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -0
  303. package/dist/modes/interactive/components/provider-brand.js +67 -0
  304. package/dist/modes/interactive/components/provider-brand.js.map +1 -0
  305. package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
  306. package/dist/modes/interactive/interactive-auth-routing.js +8 -6
  307. package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
  308. package/dist/modes/interactive/interactive-extension-dialogs.js +4 -3
  309. package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
  310. package/dist/modes/interactive/interactive-extension-runtime.js +8 -3
  311. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  312. package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
  313. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  314. package/dist/modes/interactive/interactive-mode-deps.js +1 -1
  315. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
  316. package/dist/modes/interactive/interactive-mode-surface.d.ts +12 -2
  317. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  318. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  319. package/dist/modes/interactive/interactive-session-routing.js +59 -21
  320. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  321. package/dist/modes/interactive/interactive-slash-commands.js +23 -12
  322. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  323. package/dist/modes/interactive/login-provider-options.d.ts.map +1 -1
  324. package/dist/modes/interactive/login-provider-options.js +2 -1
  325. package/dist/modes/interactive/login-provider-options.js.map +1 -1
  326. package/dist/modes/interactive-engine/isolated-runtime.d.ts +2 -0
  327. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  328. package/dist/modes/interactive-engine/isolated-runtime.js +8 -3
  329. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  330. package/dist/modes/rpc/rpc-client-api.d.ts +2 -1
  331. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  332. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  333. package/dist/modes/rpc/rpc-client.d.ts +0 -1
  334. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  335. package/dist/modes/rpc/rpc-client.js +2 -18
  336. package/dist/modes/rpc/rpc-client.js.map +1 -1
  337. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  338. package/dist/modes/rpc/rpc-command-handler.js +8 -2
  339. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  340. package/dist/modes/rpc/rpc-error-decoding.d.ts +7 -0
  341. package/dist/modes/rpc/rpc-error-decoding.d.ts.map +1 -0
  342. package/dist/modes/rpc/rpc-error-decoding.js +25 -0
  343. package/dist/modes/rpc/rpc-error-decoding.js.map +1 -0
  344. package/dist/modes/rpc/rpc-responses.d.ts.map +1 -1
  345. package/dist/modes/rpc/rpc-responses.js +12 -0
  346. package/dist/modes/rpc/rpc-responses.js.map +1 -1
  347. package/dist/modes/rpc/rpc-types.d.ts +11 -0
  348. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  349. package/dist/modes/rpc/rpc-types.js.map +1 -1
  350. package/dist/package-manager-cli.d.ts.map +1 -1
  351. package/dist/package-manager-cli.js +12 -3
  352. package/dist/package-manager-cli.js.map +1 -1
  353. package/docs/background-tasks.md +1 -1
  354. package/docs/codemode.md +22 -0
  355. package/docs/extensions/api-reference.md +27 -1
  356. package/docs/extensions/authoring.md +1 -1
  357. package/docs/extensions/ui.md +1 -1
  358. package/docs/getting-started/first-session.md +1 -1
  359. package/docs/guides/resume-on-any-machine.md +72 -19
  360. package/docs/models/evals.md +85 -17
  361. package/docs/models/reference.md +1 -1
  362. package/docs/providers.md +38 -5
  363. package/docs/reference/cli.md +2 -0
  364. package/docs/rpc/protocol.md +11 -1
  365. package/docs/sdk/reference.md +36 -4
  366. package/docs/sdk.md +2 -2
  367. package/docs/sessions.md +11 -1
  368. package/docs/settings.md +7 -2
  369. package/docs/skills.md +3 -3
  370. package/docs/storage.md +1 -1
  371. package/docs/tools.md +3 -1
  372. package/docs/workflows/api-reference.md +14 -12
  373. package/docs/workflows/authoring.md +29 -1
  374. package/docs/workflows/builtins.md +9 -1
  375. package/docs/workflows/operations.md +8 -8
  376. package/docs/worktree-snapshots.md +3 -2
  377. package/npm-shrinkwrap.json +83 -67
  378. package/package.json +7 -7
  379. package/schemas/settings.schema.json +3 -2
  380. package/dist/core/resume/setup-hook.d.ts +0 -69
  381. package/dist/core/resume/setup-hook.d.ts.map +0 -1
  382. package/dist/core/resume/setup-hook.js +0 -261
  383. package/dist/core/resume/setup-hook.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"chat-session-host.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,EAAE,iBAAiB,EAAuB,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACxH,OAAO,EAAE,mBAAmB,EAAuB,MAAM,yCAAyC,CAAC;AACnG,OAAO,EACN,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,6BAA6B,EAC7B,iBAAiB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,GACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,+B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BAA6B,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,6BAA6B,EAAE;YACzE,eAAe,EAAE,GAAG,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC;YAC7D,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC/C,SAAS,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;SACjD,CAAC;IACH,CAAC;CACD","sourcesContent":["import type { Component, Focusable } from \"@earendil-works/pi-tui\";\nimport type { AgentSessionEvent, CompactionReason } from \"../../../core/agent-session.js\";\nimport { repairOrphanToolResults } from \"../../../core/messages.ts\";\nimport { SessionManager } from \"../../../core/session-manager.ts\";\nimport type { SessionStore } from \"../../../core/storage/session/types.js\";\nimport type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { getOwnerTaskStore, type OwnerTaskStore, watchOwnerTaskStoreBinding } from \"../../../core/tasks/owner-store.js\";\nimport { ownerTaskViewSource, type TaskViewSource } from \"../../../core/tasks/task-view-source.js\";\nimport {\n\tabortChatSessionBash,\n\tabortChatSessionCompaction,\n\tinterruptChatSession,\n\trestoreQueuedMessagesToEditor,\n\tsubmitChatSession,\n} from \"./chat-session-host-actions.ts\";\nimport {\n\tcreateChatSessionEditor,\n\thandleChatSessionInput,\n\tsetChatSessionEditorText,\n} from \"./chat-session-host-editor.ts\";\nimport { applyChatSessionAgentEvent, compactionStatusMessage } from \"./chat-session-host-events.ts\";\nimport {\n\trenderChatSessionBody,\n\trenderChatSessionEditor,\n\trenderChatSessionEntry,\n\trenderChatSessionFooter,\n\trenderChatSessionPendingMessages,\n\trenderChatSessionUsage,\n\trenderChatSessionWorkingStatus,\n\ttranscriptCacheKey,\n} from \"./chat-session-host-rendering.ts\";\nimport {\n\tclearChatSessionBusyForTerminalWorkflowStage,\n\tdisposeChatSession,\n\tisChatSessionBashRunning,\n\tisChatSessionStreaming,\n\treassertChatSessionExternalPromptLifecycle,\n\tsettleChatSessionPromptLifecycle,\n\tstartChatSessionExternalPromptLifecycle,\n\tsyncChatSessionAnimationTick,\n} from \"./chat-session-host-runtime.ts\";\nimport { ChatSessionHostState } from \"./chat-session-host-state.ts\";\nimport type {\n\tAgentSnapshotMessage,\n\tChatSessionHostEntry,\n\tChatSessionHostOpts,\n\tChatSessionSubmitMode,\n} from \"./chat-session-host-types.ts\";\nimport type { ChatTranscriptEntryLike } from \"./chat-transcript.js\";\nimport { TaskInspector } from \"./task-inspector.js\";\nimport { renderTaskFooter } from \"./task-list.js\";\nimport type { TaskTranscriptEnvironment } from \"./task-transcript-page.ts\";\n\nexport type {\n\tChatSessionHostBashRequest,\n\tChatSessionHostCommands,\n\tChatSessionHostEntry,\n\tChatSessionHostOpts,\n\tChatSessionHostStyle,\n\tChatSessionSubmitMode,\n\tChatSessionViewportSettings,\n} from \"./chat-session-host-types.ts\";\n\nexport class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never> implements Component, Focusable {\n\tfocused = true;\n\n\tprivate readonly state: ChatSessionHostState<TExtraEntry>;\n\tprivate taskStore?: OwnerTaskStore;\n\t/** What `/tasks` and the task footer show: the session's task store, or the host's own task source. */\n\tprivate taskSource?: TaskViewSource;\n\tprivate readonly taskRowsInChat: boolean;\n\tprivate unsubscribeTasks?: () => void;\n\tprivate taskSession?: object;\n\tprivate unsubscribeTaskBinding?: () => void;\n\tprivate taskInspector?: TaskInspector;\n\tprivate historyHydrated = false;\n\tprivate readonly taskTranscriptEnvironment: () => TaskTranscriptEnvironment;\n\n\tconstructor(opts: ChatSessionHostOpts<TExtraEntry>) {\n\t\t// `/tasks` stays a local action owned by the host's `commands.handleSlashCommand`\n\t\t// (see submitChatSession). Hosts that mount the inspector call `openTasks` from\n\t\t// that callback; the host must not intercept it ahead of the owner.\n\t\tthis.taskRowsInChat = opts.taskRowsInChat ?? true;\n\t\t// A task transcript opened from this chat is a chat of its own on the same terminal and settings.\n\t\tthis.taskTranscriptEnvironment = () => ({\n\t\t\tcreateChat: (transcriptOpts) => new ChatSessionHost(transcriptOpts),\n\t\t\ttui: opts.tui,\n\t\t\tkeybindings: opts.keybindings,\n\t\t\teditorTheme: opts.editorTheme,\n\t\t\teditorFactory: opts.editorFactory,\n\t\t\tstyle: opts.style,\n\t\t\tgetChatRenderSettings: opts.getChatRenderSettings,\n\t\t\tnotify: (message) => this.showWarning(message),\n\t\t});\n\t\tthis.state = new ChatSessionHostState(opts, {\n\t\t\trenderEntry: (state, entry) => renderChatSessionEntry(state, entry),\n\t\t\ttranscriptCacheKey: (state, entry, index) => transcriptCacheKey(state, entry, index),\n\t\t});\n\t\tthis.state.editor = createChatSessionEditor(\n\t\t\tthis.state,\n\t\t\topts.tui,\n\t\t\topts.keybindings,\n\t\t\topts.editorTheme,\n\t\t\topts.editorFactory,\n\t\t\tthis.editorCallbacks(),\n\t\t);\n\t\tif (opts.autocompleteProvider) this.state.editor?.setAutocompleteProvider?.(opts.autocompleteProvider);\n\t\tthis.syncAnimationTick();\n\t\tthis.refreshTaskStore();\n\t}\n\n\topenTasks(id?: string): boolean {\n\t\tconst session = this.state.getAgentSession?.();\n\t\tif (session && !getOwnerTaskStore(session)) session.getAgentTaskHost?.();\n\t\tthis.refreshTaskStore();\n\t\tif (!this.taskSource) {\n\t\t\tthis.showWarning(\"Launched agents and shells will appear here.\");\n\t\t\treturn true;\n\t\t}\n\t\tthis.taskInspector?.dispose();\n\t\tthis.taskInspector = new TaskInspector(\n\t\t\tthis.taskSource,\n\t\t\t() => this.state.requestRender?.(),\n\t\t\t() => this.closeTasks(),\n\t\t\tundefined,\n\t\t\t() => this.taskTranscriptEnvironment(),\n\t\t);\n\t\tthis.taskInspector.open(id as TaskId | undefined);\n\t\tthis.state.requestRender?.();\n\t\treturn true;\n\t}\n\tget hasTaskInspector(): boolean {\n\t\treturn this.taskInspector !== undefined;\n\t}\n\tget taskInspectorFullscreen(): boolean {\n\t\treturn this.taskInspector?.fullscreen === true;\n\t}\n\tcloseTasks(): void {\n\t\tthis.taskInspector?.dispose();\n\t\tthis.taskInspector = undefined;\n\t\tthis.state.requestRender?.();\n\t}\n\t/** Offers input to the open task inspector; false when none is open or it declined the input. */\n\thandleTaskInput(data: string): boolean {\n\t\treturn this.taskInspector?.handleInput(data) === true;\n\t}\n\tappendMessages(messages: readonly AgentSnapshotMessage[]): void {\n\t\tthis.state.liveChat.appendMessages(messages);\n\t}\n\n\t/** Earlier history, shown above every entry while a reader scrolled away from the end keeps their place. */\n\tprependMessages(messages: readonly AgentSnapshotMessage[]): void {\n\t\tthis.state.liveChat.prependMessages(messages);\n\t\tthis.state.requestRender?.();\n\t}\n\n\t/** Replaces the conversation with `messages`, keeping the host's own extra entries. */\n\treplaceMessages(messages: readonly AgentSnapshotMessage[]): void {\n\t\tthis.state.liveChat.replaceMessages(messages, this.state.extraEntries);\n\t\tthis.state.requestRender?.();\n\t}\n\t/**\n\t * Adopt the assistant message a live session is part-way through streaming.\n\t *\n\t * A host mounted mid-turn missed the `message_start` and every delta that\n\t * came before it, and delta-only updates never restate them, so the session's\n\t * in-flight message is the only place that text still exists. Ignored once\n\t * this host is already following a stream of its own.\n\t */\n\thydrateStreamingAssistantMessage(message: AgentSnapshotMessage | undefined): void {\n\t\tif (message === undefined) return;\n\t\tif (this.state.liveChat.hydrateStreamingAssistantMessage(message)) this.state.requestRender?.();\n\t}\n\n\tasync loadSession(store: SessionStore, sessionId: string | undefined): Promise<boolean> {\n\t\tif (\n\t\t\tthis.historyHydrated ||\n\t\t\tthis.state.transcript.length > this.state.extraEntries.length ||\n\t\t\tsessionId === undefined\n\t\t)\n\t\t\treturn true;\n\t\tlet messages: readonly AgentSnapshotMessage[];\n\t\ttry {\n\t\t\tconst manager = await SessionManager.open(store, sessionId);\n\t\t\tmessages = repairOrphanToolResults(manager.buildSessionContext().messages, {\n\t\t\t\trepairTrailing: true,\n\t\t\t}) as readonly AgentSnapshotMessage[];\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.state.disposed) return false;\n\t\tif (this.historyHydrated || this.state.transcript.length > this.state.extraEntries.length) return true;\n\t\tthis.historyHydrated = true;\n\t\tconst extras = this.state.transcript.splice(0);\n\t\tthis.state.liveChat.appendMessages(messages);\n\t\tthis.state.transcript.push(...extras);\n\t\tthis.state.requestRender?.();\n\t\treturn true;\n\t}\n\n\tappendExtraEntry(entry: TExtraEntry): void {\n\t\tthis.state.extraEntries.push(entry);\n\t\tthis.state.transcript.push(entry);\n\t}\n\n\tentries(): readonly ChatSessionHostEntry<TExtraEntry>[] {\n\t\treturn this.state.transcript;\n\t}\n\n\t/** Tasks outlive tools and turns; only host/session binding grants this read projection. */\n\trefreshTaskStore(): void {\n\t\tconst session = this.state.getAgentSession?.();\n\t\tconst sessionChanged = session !== this.taskSession;\n\t\tif (sessionChanged) {\n\t\t\tthis.unsubscribeTaskBinding?.();\n\t\t\tthis.taskSession = session;\n\t\t\tthis.unsubscribeTaskBinding = session\n\t\t\t\t? watchOwnerTaskStoreBinding(session, () => this.refreshTaskStore())\n\t\t\t\t: undefined;\n\t\t}\n\t\tconst store = session ? getOwnerTaskStore(session) : undefined;\n\t\t// A session in another process (a workflow stage on a local worker) has no store here; the host\n\t\t// supplies a source that reads its tasks there.\n\t\tconst source = store ? ownerTaskViewSource(store) : this.state.getTaskSource?.();\n\t\tif (store === this.taskStore && source === this.taskSource) return;\n\t\tthis.closeTasks();\n\t\tthis.unsubscribeTasks?.();\n\t\tthis.taskStore = store;\n\t\tthis.taskSource = source;\n\t\tthis.unsubscribeTasks = undefined;\n\t\tthis.state.liveChat.clearTasks();\n\t\tthis.state.transcriptComponent.invalidate();\n\t\tthis.state.requestRender?.();\n\t\tif (!source) return;\n\t\tconst update = () => {\n\t\t\tif (this.taskRowsInChat) this.state.liveChat.upsertTasks(source.tasks, store);\n\t\t\tthis.state.transcriptComponent.invalidate();\n\t\t\tthis.state.requestRender?.();\n\t\t};\n\t\tthis.unsubscribeTasks = source.subscribe(update);\n\t\tupdate();\n\t}\n\tapplyAgentEvent(event: AgentSessionEvent): boolean {\n\t\tthis.refreshTaskStore();\n\t\treturn applyChatSessionAgentEvent(this.state, event);\n\t}\n\n\t/**\n\t * Restore the factual compaction indicator on a host mounted after the\n\t * `compaction_start` it never saw. The label resolves through the same\n\t * mapping the live event path uses, so the two cannot drift.\n\t *\n\t * Branch summaries deliberately do not paint here: their label belongs to\n\t * a retry lifecycle this re-attached host is not inside, and no event exists\n\t * to clear it after the summary finishes. An absent paintable reason is a\n\t * no-op unless this host is actively showing a compaction label, so unrelated\n\t * workflow delivery busy state is preserved.\n\t */\n\thydrateCompactionStatus(reason: CompactionReason | undefined): void {\n\t\tconst compactionReason = reason === \"branchSummary\" ? undefined : reason;\n\t\tif (compactionReason === undefined) {\n\t\t\tif (!this.state.compacting) return;\n\t\t\tthis.state.compacting = false;\n\t\t\tthis.state.statusMessage = \"\";\n\t\t} else {\n\t\t\tthis.state.compacting = true;\n\t\t\tthis.state.sdkBusy = true;\n\t\t\tthis.state.statusMessage = compactionStatusMessage(compactionReason);\n\t\t}\n\t\tthis.syncAnimationTick();\n\t\tthis.state.requestRender?.();\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.renderBody(width, 1);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.taskInspector?.invalidate();\n\t\tthis.state.transcriptComponent.invalidate();\n\t\tthis.state.bodyViewport.invalidate();\n\t\tthis.state.editor?.invalidate();\n\t}\n\n\trenderBody(width: number, budget: number): string[] {\n\t\tif (this.taskInspector) {\n\t\t\tif (this.taskInspector.fullscreen) return this.taskInspector.renderViewport(width, budget);\n\t\t\tconst picker = this.taskInspector.renderPicker(width, budget);\n\t\t\tconst remaining = Math.max(0, budget - picker.length);\n\t\t\tconst body = remaining ? renderChatSessionBody(this.state, width, remaining) : [];\n\t\t\treturn [...body, ...Array.from({ length: Math.max(0, remaining - body.length) }, () => \"\"), ...picker];\n\t\t}\n\t\treturn renderChatSessionBody(this.state, width, budget);\n\t}\n\n\t/**\n\t * Rows the body occupies at `width`, whether or not they are on screen.\n\t *\n\t * Pair with `renderBodyRows` to read the whole transcript, not only the\n\t * window the reader is parked on. Both measure the component stack the last\n\t * `renderBody` installed, so call them after at least one body render.\n\t */\n\tbodyRowCount(width: number): number {\n\t\treturn this.state.bodyViewport.rowCount(width);\n\t}\n\n\t/** Body rows `startRow` (inclusive) to `endRow` (exclusive), unscrolled. */\n\trenderBodyRows(width: number, startRow: number, endRow: number): string[] {\n\t\treturn this.state.bodyViewport.renderRows(width, startRow, endRow);\n\t}\n\n\t/**\n\t * Render a live assistant entry whole, or only its tail (the default).\n\t *\n\t * The tail window keeps a fast-streaming turn cheap for a reader following\n\t * the bottom of the body; it also drops everything above the last 240 lines\n\t * from what `bodyRowCount` and `renderBodyRows` report. Returns whether the\n\t * setting changed, so the caller can invalidate the rows that were rendered\n\t * under the old rule.\n\t */\n\tsetStreamingTailWindowEnabled(enabled: boolean): boolean {\n\t\tif (this.state.streamingTailWindowEnabled === enabled) return false;\n\t\tthis.state.streamingTailWindowEnabled = enabled;\n\t\tthis.invalidate();\n\t\treturn true;\n\t}\n\n\trenderPendingMessages(width: number): string[] {\n\t\treturn renderChatSessionPendingMessages(this.state, width);\n\t}\n\n\trenderWorkingStatus(width: number): string[] {\n\t\treturn renderChatSessionWorkingStatus(this.state, width);\n\t}\n\n\trenderUsage(width: number): string[] {\n\t\treturn renderChatSessionUsage(this.state, width);\n\t}\n\n\trenderEditor(width: number): string[] {\n\t\treturn renderChatSessionEditor(this.state, width, this.focused);\n\t}\n\n\trenderTaskFooter(width: number): string[] {\n\t\treturn renderTaskFooter(this.taskSource?.backgroundTasks ?? [], width);\n\t}\n\trenderFooter(width: number): string[] {\n\t\tconst footer = renderChatSessionFooter(this.state, width, this.hasTaskInspector && !this.taskInspectorFullscreen);\n\t\treturn footer.length ? footer : renderTaskFooter(this.taskSource?.backgroundTasks ?? [], width);\n\t}\n\n\thandleScrollInput(data: string): boolean {\n\t\treturn this.state.bodyViewport.handleInput(data);\n\t}\n\n\thandleInput(data: string): boolean {\n\t\treturn handleChatSessionInput(this.state, data, this.editorCallbacks());\n\t}\n\n\tinterrupt(options?: { restoreQueuedMessages?: boolean }): Promise<void> {\n\t\t// Keep the observed settlement: an async wrapper would orphan rejections from Escape callers.\n\t\treturn interruptChatSession(this.state, options);\n\t}\n\n\tasync submit(mode: ChatSessionSubmitMode = \"auto\", submittedText?: string): Promise<void> {\n\t\tawait submitChatSession(this.state, mode, submittedText);\n\t}\n\n\tisStreaming(): boolean {\n\t\treturn isChatSessionStreaming(this.state);\n\t}\n\n\tisBashRunning(): boolean {\n\t\treturn isChatSessionBashRunning(this.state);\n\t}\n\n\tisEditingBashCommand(): boolean {\n\t\treturn this.state.isBashMode;\n\t}\n\n\tisCompacting(): boolean {\n\t\treturn this.state.compacting;\n\t}\n\n\thasInputText(): boolean {\n\t\treturn this.state.inputBuffer.length > 0;\n\t}\n\n\thasAnimationTick(): boolean {\n\t\treturn this.state.animationTimer !== undefined;\n\t}\n\n\tbodyScrollFromBottom(): number {\n\t\treturn this.state.bodyViewport.getScrollFromBottom();\n\t}\n\n\tbodyMaxScroll(): number {\n\t\treturn this.state.bodyViewport.getMaxScroll();\n\t}\n\n\tinputText(): string {\n\t\treturn this.state.inputBuffer;\n\t}\n\tsetInputText(text: string): void {\n\t\tsetChatSessionEditorText(this.state, text);\n\t}\n\n\tstatusText(): string {\n\t\treturn this.state.statusMessage;\n\t}\n\n\tshowWarning(message: string): void {\n\t\tthis.state.statusMessage = message;\n\t\tthis.state.lastWarningMessage = message;\n\t\tthis.state.requestRender?.();\n\t}\n\n\tscrollToBottom(): void {\n\t\tthis.state.bodyViewport.scrollToBottom();\n\t}\n\n\t/**\n\t * Park the body with absolute row `row` at the top of its window, clamped\n\t * to the last rendered layout. Used to reveal a search match the reader\n\t * cannot currently see.\n\t */\n\tscrollBodyTo(row: number): void {\n\t\tthis.state.bodyViewport.scrollTo(row);\n\t}\n\n\tsyncAnimationTick(): void {\n\t\tsyncChatSessionAnimationTick(this.state);\n\t}\n\n\tclearBusyForTerminalWorkflowStage(): void {\n\t\tclearChatSessionBusyForTerminalWorkflowStage(this.state);\n\t}\n\n\t/**\n\t * Start Working for an accepted prompt delivered outside this host — a\n\t * workflow definition auto-sending to its own retained stage. Returns the\n\t * lifecycle token to hand back to `settleExternalPromptLifecycle`.\n\t */\n\tbeginExternalPromptLifecycle(): number | undefined {\n\t\treturn startChatSessionExternalPromptLifecycle(this.state);\n\t}\n\n\t/**\n\t * Reopen Working for a delivery still active after a temporary overlay — a\n\t * pre-turn compaction — cleared it. Preserves factual status text.\n\t */\n\treassertExternalPromptLifecycle(): number | undefined {\n\t\treturn reassertChatSessionExternalPromptLifecycle(this.state);\n\t}\n\n\t/** Settle a lifecycle from `beginExternalPromptLifecycle`. Stale tokens no-op. */\n\tsettleExternalPromptLifecycle(generation: number | undefined): void {\n\t\tsettleChatSessionPromptLifecycle(this.state, generation);\n\t\tsyncChatSessionAnimationTick(this.state);\n\t\tthis.state.requestRender?.();\n\t}\n\n\tdispose(): void {\n\t\tthis.taskInspector?.dispose();\n\t\tthis.unsubscribeTasks?.();\n\t\tthis.unsubscribeTaskBinding?.();\n\t\tdisposeChatSession(this.state);\n\t}\n\n\trestoreQueuedMessagesToEditor(): boolean {\n\t\treturn restoreQueuedMessagesToEditor(this.state);\n\t}\n\n\tprivate editorCallbacks(): {\n\t\tsubmit: (mode: \"auto\" | \"followUp\", submittedText?: string) => void | Promise<void>;\n\t\trestoreQueuedMessagesToEditor: () => boolean;\n\t\tabortCompaction: () => void | Promise<void>;\n\t\tinterrupt: (options?: { restoreQueuedMessages?: boolean }) => void | Promise<void>;\n\t\tabortBash: () => void | Promise<void>;\n\t} {\n\t\treturn {\n\t\t\tsubmit: (mode, submittedText) => this.submit(mode, submittedText),\n\t\t\trestoreQueuedMessagesToEditor: () => this.restoreQueuedMessagesToEditor(),\n\t\t\tabortCompaction: () => abortChatSessionCompaction(this.state),\n\t\t\tinterrupt: (options) => this.interrupt(options),\n\t\t\tabortBash: () => abortChatSessionBash(this.state),\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"chat-session-host.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,EAAE,iBAAiB,EAAuB,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACxH,OAAO,EAAE,mBAAmB,EAAuB,MAAM,yCAAyC,CAAC;AACnG,OAAO,EACN,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,6BAA6B,EAC7B,iBAAiB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,GACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACpG,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACtB,8BAA8B,EAC9B,kBAAkB,GAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,4CAA4C,EAC5C,kBAAkB,EAClB,wBAAwB,EACxB,sBAAsB,EACtB,0CAA0C,EAC1C,gCAAgC,EAChC,uCAAuC,EACvC,4BAA4B,GAC5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAQpE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAalD,MAAM,OAAO,eAAe;IAC3B,OAAO,GAAG,IAAI,CAAC;IAEE,KAAK,CAAoC;IAClD,SAAS,CAAkB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AAI,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACH,+BAA+B;QAC9B,OAAO,0CAA0C,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;IAED,kFAAkF;IAClF,6BAA6B,CAAC,UAA8B;QAC3D,gCAAgC,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACzD,4BAA4B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO;QACN,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC;QAC1B,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC;QAChC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,6BAA6B;QAC5B,OAAO,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAEO,eAAe;QAOtB,OAAO;YACN,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC;YACjE,6BAA6B,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,6BAA6B,EAAE;YACzE,eAAe,EAAE,GAAG,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC;YAC7D,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC/C,SAAS,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;SACjD,CAAC;IACH,CAAC;CACD","sourcesContent":["import type { Component, Focusable } from \"@earendil-works/pi-tui\";\nimport type { AgentSessionEvent, CompactionReason } from \"../../../core/agent-session.js\";\nimport { repairOrphanToolResults } from \"../../../core/messages.ts\";\nimport { SessionManager } from \"../../../core/session-manager.ts\";\nimport type { SessionStore } from \"../../../core/storage/session/types.js\";\nimport type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { getOwnerTaskStore, type OwnerTaskStore, watchOwnerTaskStoreBinding } from \"../../../core/tasks/owner-store.js\";\nimport { ownerTaskViewSource, type TaskViewSource } from \"../../../core/tasks/task-view-source.js\";\nimport {\n\tabortChatSessionBash,\n\tabortChatSessionCompaction,\n\tinterruptChatSession,\n\trestoreQueuedMessagesToEditor,\n\tsubmitChatSession,\n} from \"./chat-session-host-actions.ts\";\nimport {\n\tcreateChatSessionEditor,\n\thandleChatSessionInput,\n\tsetChatSessionEditorText,\n} from \"./chat-session-host-editor.ts\";\nimport { applyChatSessionAgentEvent, compactionStatusMessage } from \"./chat-session-host-events.ts\";\nimport {\n\trenderChatSessionBody,\n\trenderChatSessionEditor,\n\trenderChatSessionEntry,\n\trenderChatSessionFooter,\n\trenderChatSessionPendingMessages,\n\trenderChatSessionUsage,\n\trenderChatSessionWorkingStatus,\n\ttranscriptCacheKey,\n} from \"./chat-session-host-rendering.ts\";\nimport {\n\tclearChatSessionBusyForTerminalWorkflowStage,\n\tdisposeChatSession,\n\tisChatSessionBashRunning,\n\tisChatSessionStreaming,\n\treassertChatSessionExternalPromptLifecycle,\n\tsettleChatSessionPromptLifecycle,\n\tstartChatSessionExternalPromptLifecycle,\n\tsyncChatSessionAnimationTick,\n} from \"./chat-session-host-runtime.ts\";\nimport { ChatSessionHostState } from \"./chat-session-host-state.ts\";\nimport type {\n\tAgentSnapshotMessage,\n\tChatSessionHostEntry,\n\tChatSessionHostOpts,\n\tChatSessionSubmitMode,\n} from \"./chat-session-host-types.ts\";\nimport type { ChatTranscriptEntryLike } from \"./chat-transcript.js\";\nimport { TaskInspector } from \"./task-inspector.js\";\nimport { renderTaskFooter } from \"./task-list.js\";\nimport type { TaskTranscriptEnvironment } from \"./task-transcript-page.ts\";\n\nexport type {\n\tChatSessionHostBashRequest,\n\tChatSessionHostCommands,\n\tChatSessionHostEntry,\n\tChatSessionHostOpts,\n\tChatSessionHostStyle,\n\tChatSessionSubmitMode,\n\tChatSessionViewportSettings,\n} from \"./chat-session-host-types.ts\";\n\nexport class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never> implements Component, Focusable {\n\tfocused = true;\n\n\tprivate readonly state: ChatSessionHostState<TExtraEntry>;\n\tprivate taskStore?: OwnerTaskStore;\n\t/** What `/tasks` and the task footer show: the session's task store, or the host's own task source. */\n\tprivate taskSource?: TaskViewSource;\n\tprivate readonly taskRowsInChat: boolean;\n\tprivate unsubscribeTasks?: () => void;\n\tprivate taskSession?: object;\n\tprivate unsubscribeTaskBinding?: () => void;\n\tprivate taskInspector?: TaskInspector;\n\tprivate historyHydrated = false;\n\tprivate readonly taskTranscriptEnvironment: () => TaskTranscriptEnvironment;\n\n\tconstructor(opts: ChatSessionHostOpts<TExtraEntry>) {\n\t\t// `/tasks` stays a local action owned by the host's `commands.handleSlashCommand`\n\t\t// (see submitChatSession). Hosts that mount the inspector call `openTasks` from\n\t\t// that callback; the host must not intercept it ahead of the owner.\n\t\tthis.taskRowsInChat = opts.taskRowsInChat ?? true;\n\t\t// A task transcript opened from this chat is a chat of its own on the same terminal and settings.\n\t\tthis.taskTranscriptEnvironment = () => ({\n\t\t\tcreateChat: (transcriptOpts) => new ChatSessionHost(transcriptOpts),\n\t\t\ttui: opts.tui,\n\t\t\tkeybindings: opts.keybindings,\n\t\t\teditorTheme: opts.editorTheme,\n\t\t\teditorFactory: opts.editorFactory,\n\t\t\tstyle: opts.style,\n\t\t\tgetChatRenderSettings: opts.getChatRenderSettings,\n\t\t\tnotify: (message) => this.showWarning(message),\n\t\t});\n\t\tthis.state = new ChatSessionHostState(opts, {\n\t\t\trenderEntry: (state, entry) => renderChatSessionEntry(state, entry),\n\t\t\ttranscriptCacheKey: (state, entry, index) => transcriptCacheKey(state, entry, index),\n\t\t});\n\t\tthis.state.editor = createChatSessionEditor(\n\t\t\tthis.state,\n\t\t\topts.tui,\n\t\t\topts.keybindings,\n\t\t\topts.editorTheme,\n\t\t\topts.editorFactory,\n\t\t\tthis.editorCallbacks(),\n\t\t);\n\t\tif (opts.autocompleteProvider) this.state.editor?.setAutocompleteProvider?.(opts.autocompleteProvider);\n\t\tthis.syncAnimationTick();\n\t\tthis.refreshTaskStore();\n\t}\n\n\topenTasks(id?: string): boolean {\n\t\tconst session = this.state.getAgentSession?.();\n\t\tif (session && !getOwnerTaskStore(session)) session.getAgentTaskHost?.();\n\t\tthis.refreshTaskStore();\n\t\tif (!this.taskSource) {\n\t\t\tthis.showWarning(\"Launched agents and shells will appear here.\");\n\t\t\treturn true;\n\t\t}\n\t\tthis.taskInspector?.dispose();\n\t\tthis.taskInspector = new TaskInspector(\n\t\t\tthis.taskSource,\n\t\t\t() => this.state.requestRender?.(),\n\t\t\t() => this.closeTasks(),\n\t\t\tundefined,\n\t\t\t() => this.taskTranscriptEnvironment(),\n\t\t);\n\t\tthis.taskInspector.open(id as TaskId | undefined);\n\t\tthis.state.requestRender?.();\n\t\treturn true;\n\t}\n\tget hasTaskInspector(): boolean {\n\t\treturn this.taskInspector !== undefined;\n\t}\n\tget taskInspectorFullscreen(): boolean {\n\t\treturn this.taskInspector?.fullscreen === true;\n\t}\n\tcloseTasks(): void {\n\t\tthis.taskInspector?.dispose();\n\t\tthis.taskInspector = undefined;\n\t\tthis.state.requestRender?.();\n\t}\n\t/** Offers input to the open task inspector; false when none is open or it declined the input. */\n\thandleTaskInput(data: string): boolean {\n\t\treturn this.taskInspector?.handleInput(data) === true;\n\t}\n\tappendMessages(messages: readonly AgentSnapshotMessage[]): void {\n\t\tthis.state.liveChat.appendMessages(messages);\n\t}\n\n\t/** Earlier history, shown above every entry while a reader scrolled away from the end keeps their place. */\n\tprependMessages(messages: readonly AgentSnapshotMessage[]): void {\n\t\tthis.state.liveChat.prependMessages(messages);\n\t\tthis.state.requestRender?.();\n\t}\n\n\t/** Replaces the conversation with `messages`, keeping the host's own extra entries. */\n\treplaceMessages(messages: readonly AgentSnapshotMessage[]): void {\n\t\tthis.state.liveChat.replaceMessages(messages, this.state.extraEntries);\n\t\tthis.state.requestRender?.();\n\t}\n\t/**\n\t * Adopt the assistant message a live session is part-way through streaming.\n\t *\n\t * A host mounted mid-turn missed the `message_start` and every delta that\n\t * came before it, and delta-only updates never restate them, so the session's\n\t * in-flight message is the only place that text still exists. Ignored once\n\t * this host is already following a stream of its own.\n\t */\n\thydrateStreamingAssistantMessage(message: AgentSnapshotMessage | undefined): void {\n\t\tif (message === undefined) return;\n\t\tif (this.state.liveChat.hydrateStreamingAssistantMessage(message)) this.state.requestRender?.();\n\t}\n\n\t/**\n\t * Shows a saved conversation. A call in `inFlightToolCallIds` has no result yet because its stage waits for one,\n\t * so it shows as pending, not as interrupted, and the call's own end replaces it with the result.\n\t */\n\tasync loadSession(\n\t\tstore: SessionStore,\n\t\tsessionId: string | undefined,\n\t\tinFlightToolCallIds?: ReadonlySet<string>,\n\t): Promise<boolean> {\n\t\tif (\n\t\t\tthis.historyHydrated ||\n\t\t\tthis.state.transcript.length > this.state.extraEntries.length ||\n\t\t\tsessionId === undefined\n\t\t)\n\t\t\treturn true;\n\t\tlet messages: readonly AgentSnapshotMessage[];\n\t\ttry {\n\t\t\tconst manager = await SessionManager.open(store, sessionId);\n\t\t\tmessages = repairOrphanToolResults(manager.buildSessionContext().messages, {\n\t\t\t\trepairTrailing: true,\n\t\t\t\t...(inFlightToolCallIds === undefined ? {} : { inFlightToolCallIds }),\n\t\t\t}) as readonly AgentSnapshotMessage[];\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.state.disposed) return false;\n\t\tif (this.historyHydrated || this.state.transcript.length > this.state.extraEntries.length) return true;\n\t\tthis.historyHydrated = true;\n\t\tconst extras = this.state.transcript.splice(0);\n\t\tthis.state.liveChat.appendMessages(messages);\n\t\tthis.state.transcript.push(...extras);\n\t\tthis.state.requestRender?.();\n\t\treturn true;\n\t}\n\n\tappendExtraEntry(entry: TExtraEntry): void {\n\t\tthis.state.extraEntries.push(entry);\n\t\tthis.state.transcript.push(entry);\n\t}\n\n\tentries(): readonly ChatSessionHostEntry<TExtraEntry>[] {\n\t\treturn this.state.transcript;\n\t}\n\n\t/** Tasks outlive tools and turns; only host/session binding grants this read projection. */\n\trefreshTaskStore(): void {\n\t\tconst session = this.state.getAgentSession?.();\n\t\tconst sessionChanged = session !== this.taskSession;\n\t\tif (sessionChanged) {\n\t\t\tthis.unsubscribeTaskBinding?.();\n\t\t\tthis.taskSession = session;\n\t\t\tthis.unsubscribeTaskBinding = session\n\t\t\t\t? watchOwnerTaskStoreBinding(session, () => this.refreshTaskStore())\n\t\t\t\t: undefined;\n\t\t}\n\t\tconst store = session ? getOwnerTaskStore(session) : undefined;\n\t\t// A session in another process (a workflow stage on a local worker) has no store here; the host\n\t\t// supplies a source that reads its tasks there.\n\t\tconst source = store ? ownerTaskViewSource(store) : this.state.getTaskSource?.();\n\t\tif (store === this.taskStore && source === this.taskSource) return;\n\t\tthis.closeTasks();\n\t\tthis.unsubscribeTasks?.();\n\t\tthis.taskStore = store;\n\t\tthis.taskSource = source;\n\t\tthis.unsubscribeTasks = undefined;\n\t\tthis.state.liveChat.clearTasks();\n\t\tthis.state.transcriptComponent.invalidate();\n\t\tthis.state.requestRender?.();\n\t\tif (!source) return;\n\t\tconst update = () => {\n\t\t\tif (this.taskRowsInChat) this.state.liveChat.upsertTasks(source.tasks, store);\n\t\t\tthis.state.transcriptComponent.invalidate();\n\t\t\tthis.state.requestRender?.();\n\t\t};\n\t\tthis.unsubscribeTasks = source.subscribe(update);\n\t\tupdate();\n\t}\n\tapplyAgentEvent(event: AgentSessionEvent): boolean {\n\t\tthis.refreshTaskStore();\n\t\treturn applyChatSessionAgentEvent(this.state, event);\n\t}\n\n\t/**\n\t * Restore the factual compaction indicator on a host mounted after the\n\t * `compaction_start` it never saw. The label resolves through the same\n\t * mapping the live event path uses, so the two cannot drift.\n\t *\n\t * Branch summaries deliberately do not paint here: their label belongs to\n\t * a retry lifecycle this re-attached host is not inside, and no event exists\n\t * to clear it after the summary finishes. An absent paintable reason is a\n\t * no-op unless this host is actively showing a compaction label, so unrelated\n\t * workflow delivery busy state is preserved.\n\t */\n\thydrateCompactionStatus(reason: CompactionReason | undefined): void {\n\t\tconst compactionReason = reason === \"branchSummary\" ? undefined : reason;\n\t\tif (compactionReason === undefined) {\n\t\t\tif (!this.state.compacting) return;\n\t\t\tthis.state.compacting = false;\n\t\t\tthis.state.statusMessage = \"\";\n\t\t} else {\n\t\t\tthis.state.compacting = true;\n\t\t\tthis.state.sdkBusy = true;\n\t\t\tthis.state.statusMessage = compactionStatusMessage(compactionReason);\n\t\t}\n\t\tthis.syncAnimationTick();\n\t\tthis.state.requestRender?.();\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.renderBody(width, 1);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.taskInspector?.invalidate();\n\t\tthis.state.transcriptComponent.invalidate();\n\t\tthis.state.bodyViewport.invalidate();\n\t\tthis.state.editor?.invalidate();\n\t}\n\n\trenderBody(width: number, budget: number): string[] {\n\t\tif (this.taskInspector) {\n\t\t\tif (this.taskInspector.fullscreen) return this.taskInspector.renderViewport(width, budget);\n\t\t\tconst picker = this.taskInspector.renderPicker(width, budget);\n\t\t\tconst remaining = Math.max(0, budget - picker.length);\n\t\t\tconst body = remaining ? renderChatSessionBody(this.state, width, remaining) : [];\n\t\t\treturn [...body, ...Array.from({ length: Math.max(0, remaining - body.length) }, () => \"\"), ...picker];\n\t\t}\n\t\treturn renderChatSessionBody(this.state, width, budget);\n\t}\n\n\t/**\n\t * Rows the body occupies at `width`, whether or not they are on screen.\n\t *\n\t * Pair with `renderBodyRows` to read the whole transcript, not only the\n\t * window the reader is parked on. Both measure the component stack the last\n\t * `renderBody` installed, so call them after at least one body render.\n\t */\n\tbodyRowCount(width: number): number {\n\t\treturn this.state.bodyViewport.rowCount(width);\n\t}\n\n\t/** Body rows `startRow` (inclusive) to `endRow` (exclusive), unscrolled. */\n\trenderBodyRows(width: number, startRow: number, endRow: number): string[] {\n\t\treturn this.state.bodyViewport.renderRows(width, startRow, endRow);\n\t}\n\n\t/**\n\t * Render a live assistant entry whole, or only its tail (the default).\n\t *\n\t * The tail window keeps a fast-streaming turn cheap for a reader following\n\t * the bottom of the body; it also drops everything above the last 240 lines\n\t * from what `bodyRowCount` and `renderBodyRows` report. Returns whether the\n\t * setting changed, so the caller can invalidate the rows that were rendered\n\t * under the old rule.\n\t */\n\tsetStreamingTailWindowEnabled(enabled: boolean): boolean {\n\t\tif (this.state.streamingTailWindowEnabled === enabled) return false;\n\t\tthis.state.streamingTailWindowEnabled = enabled;\n\t\tthis.invalidate();\n\t\treturn true;\n\t}\n\n\trenderPendingMessages(width: number): string[] {\n\t\treturn renderChatSessionPendingMessages(this.state, width);\n\t}\n\n\trenderWorkingStatus(width: number): string[] {\n\t\treturn renderChatSessionWorkingStatus(this.state, width);\n\t}\n\n\trenderUsage(width: number): string[] {\n\t\treturn renderChatSessionUsage(this.state, width);\n\t}\n\n\trenderEditor(width: number): string[] {\n\t\treturn renderChatSessionEditor(this.state, width, this.focused);\n\t}\n\n\trenderTaskFooter(width: number): string[] {\n\t\treturn renderTaskFooter(this.taskSource?.backgroundTasks ?? [], width);\n\t}\n\trenderFooter(width: number): string[] {\n\t\tconst footer = renderChatSessionFooter(this.state, width, this.hasTaskInspector && !this.taskInspectorFullscreen);\n\t\treturn footer.length ? footer : renderTaskFooter(this.taskSource?.backgroundTasks ?? [], width);\n\t}\n\n\thandleScrollInput(data: string): boolean {\n\t\treturn this.state.bodyViewport.handleInput(data);\n\t}\n\n\thandleInput(data: string): boolean {\n\t\treturn handleChatSessionInput(this.state, data, this.editorCallbacks());\n\t}\n\n\tinterrupt(options?: { restoreQueuedMessages?: boolean }): Promise<void> {\n\t\t// Keep the observed settlement: an async wrapper would orphan rejections from Escape callers.\n\t\treturn interruptChatSession(this.state, options);\n\t}\n\n\tasync submit(mode: ChatSessionSubmitMode = \"auto\", submittedText?: string): Promise<void> {\n\t\tawait submitChatSession(this.state, mode, submittedText);\n\t}\n\n\tisStreaming(): boolean {\n\t\treturn isChatSessionStreaming(this.state);\n\t}\n\n\tisBashRunning(): boolean {\n\t\treturn isChatSessionBashRunning(this.state);\n\t}\n\n\tisEditingBashCommand(): boolean {\n\t\treturn this.state.isBashMode;\n\t}\n\n\tisCompacting(): boolean {\n\t\treturn this.state.compacting;\n\t}\n\n\thasInputText(): boolean {\n\t\treturn this.state.inputBuffer.length > 0;\n\t}\n\n\thasAnimationTick(): boolean {\n\t\treturn this.state.animationTimer !== undefined;\n\t}\n\n\tbodyScrollFromBottom(): number {\n\t\treturn this.state.bodyViewport.getScrollFromBottom();\n\t}\n\n\tbodyMaxScroll(): number {\n\t\treturn this.state.bodyViewport.getMaxScroll();\n\t}\n\n\tinputText(): string {\n\t\treturn this.state.inputBuffer;\n\t}\n\tsetInputText(text: string): void {\n\t\tsetChatSessionEditorText(this.state, text);\n\t}\n\n\tstatusText(): string {\n\t\treturn this.state.statusMessage;\n\t}\n\n\tshowWarning(message: string): void {\n\t\tthis.state.statusMessage = message;\n\t\tthis.state.lastWarningMessage = message;\n\t\tthis.state.requestRender?.();\n\t}\n\n\tscrollToBottom(): void {\n\t\tthis.state.bodyViewport.scrollToBottom();\n\t}\n\n\t/**\n\t * Park the body with absolute row `row` at the top of its window, clamped\n\t * to the last rendered layout. Used to reveal a search match the reader\n\t * cannot currently see.\n\t */\n\tscrollBodyTo(row: number): void {\n\t\tthis.state.bodyViewport.scrollTo(row);\n\t}\n\n\tsyncAnimationTick(): void {\n\t\tsyncChatSessionAnimationTick(this.state);\n\t}\n\n\tclearBusyForTerminalWorkflowStage(): void {\n\t\tclearChatSessionBusyForTerminalWorkflowStage(this.state);\n\t}\n\n\t/**\n\t * Start Working for an accepted prompt delivered outside this host — a\n\t * workflow definition auto-sending to its own retained stage. Returns the\n\t * lifecycle token to hand back to `settleExternalPromptLifecycle`.\n\t */\n\tbeginExternalPromptLifecycle(): number | undefined {\n\t\treturn startChatSessionExternalPromptLifecycle(this.state);\n\t}\n\n\t/**\n\t * Reopen Working for a delivery still active after a temporary overlay — a\n\t * pre-turn compaction — cleared it. Preserves factual status text.\n\t */\n\treassertExternalPromptLifecycle(): number | undefined {\n\t\treturn reassertChatSessionExternalPromptLifecycle(this.state);\n\t}\n\n\t/** Settle a lifecycle from `beginExternalPromptLifecycle`. Stale tokens no-op. */\n\tsettleExternalPromptLifecycle(generation: number | undefined): void {\n\t\tsettleChatSessionPromptLifecycle(this.state, generation);\n\t\tsyncChatSessionAnimationTick(this.state);\n\t\tthis.state.requestRender?.();\n\t}\n\n\tdispose(): void {\n\t\tthis.taskInspector?.dispose();\n\t\tthis.unsubscribeTasks?.();\n\t\tthis.unsubscribeTaskBinding?.();\n\t\tdisposeChatSession(this.state);\n\t}\n\n\trestoreQueuedMessagesToEditor(): boolean {\n\t\treturn restoreQueuedMessagesToEditor(this.state);\n\t}\n\n\tprivate editorCallbacks(): {\n\t\tsubmit: (mode: \"auto\" | \"followUp\", submittedText?: string) => void | Promise<void>;\n\t\trestoreQueuedMessagesToEditor: () => boolean;\n\t\tabortCompaction: () => void | Promise<void>;\n\t\tinterrupt: (options?: { restoreQueuedMessages?: boolean }) => void | Promise<void>;\n\t\tabortBash: () => void | Promise<void>;\n\t} {\n\t\treturn {\n\t\t\tsubmit: (mode, submittedText) => this.submit(mode, submittedText),\n\t\t\trestoreQueuedMessagesToEditor: () => this.restoreQueuedMessagesToEditor(),\n\t\t\tabortCompaction: () => abortChatSessionCompaction(this.state),\n\t\t\tinterrupt: (options) => this.interrupt(options),\n\t\t\tabortBash: () => abortChatSessionBash(this.state),\n\t\t};\n\t}\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Container, type Focusable } from "@earendil-works/pi-tui";
1
+ import { Container, type Focusable, type TUI } from "@earendil-works/pi-tui";
2
2
  import type { ModelRuntime } from "../../../core/model-runtime.js";
3
3
  import type { AuthStatus } from "../../../core/provider-composer.ts";
4
4
  export type AuthSelectorProvider = {
@@ -9,7 +9,8 @@ export type AuthSelectorProvider = {
9
9
  };
10
10
  export declare function formatAuthSelectorProviderType(authType: AuthSelectorProvider["authType"], subscription?: boolean): string;
11
11
  /**
12
- * Component that renders an auth provider selector
12
+ * Component that renders an auth provider selector. With `tui`, the selected row of a preferred partner provider
13
+ * shows its animated brand style.
13
14
  */
14
15
  export declare class OAuthSelectorComponent extends Container implements Focusable {
15
16
  readonly capturesViewportInput: boolean;
@@ -26,7 +27,13 @@ export declare class OAuthSelectorComponent extends Container implements Focusab
26
27
  private getAuthStatus;
27
28
  private onSelectCallback;
28
29
  private onCancelCallback;
29
- constructor(mode: "login" | "logout", modelRuntime: ModelRuntime, providers: AuthSelectorProvider[], onSelect: (providerId: string, authType: AuthSelectorProvider["authType"]) => void, onCancel: () => void, getAuthStatus?: (providerId: string) => AuthStatus, initialSearchInput?: string);
30
+ private readonly animationStart;
31
+ private stopAnimation;
32
+ constructor(mode: "login" | "logout", modelRuntime: ModelRuntime, providers: AuthSelectorProvider[], onSelect: (providerId: string, authType: AuthSelectorProvider["authType"]) => void, onCancel: () => void, getAuthStatus?: (providerId: string) => AuthStatus, initialSearchInput?: string, tui?: TUI);
33
+ render(width: number): string[];
34
+ /** Stops the brand animation. */
35
+ dispose(): void;
36
+ private getSelectedBrandStyle;
30
37
  private filterProviders;
31
38
  private updateList;
32
39
  private formatStatusIndicator;
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/oauth-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EACT,KAAK,SAAS,EAOd,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAIrE,MAAM,MAAM,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IACpD,OAAO,CAAC,aAAa,CAA2B;IAEhD,YACC,IAAI,EAAE,OAAO,GAAG,QAAQ,EACxB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,oBAAoB,EAAE,EACjC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,CAAC,UAAU,CAAC,KAAK,IAAI,EAClF,QAAQ,EAAE,MAAM,IAAI,EACpB,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,UAAU,EAClD,kBAAkB,SAAK,EACvB,GAAG,CAAC,EAAE,GAAG,EA6CT;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAIvC;IAED,iCAAiC;IACjC,OAAO,IAAI,IAAI,CAGd;IAED,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,UAAU;IAmDlB,OAAO,CAAC,qBAAqB;IA0B7B,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsCpC;CACD"}
@@ -1,6 +1,8 @@
1
1
  import { Container, fuzzyFilter, getKeybindings, getSelectPageIndex, Input, Spacer, TruncatedText, } from "@earendil-works/pi-tui";
2
+ import { isPreferredProvider } from "../../../core/preferred-providers.js";
2
3
  import { theme } from "../theme/theme.js";
3
4
  import { DynamicBorder } from "./dynamic-border.js";
5
+ import { getProviderBrandStyle, startBrandAnimation } from "./provider-brand.js";
4
6
  export function formatAuthSelectorProviderType(authType, subscription) {
5
7
  if (authType === "api_key")
6
8
  return "API key";
@@ -8,7 +10,8 @@ export function formatAuthSelectorProviderType(authType, subscription) {
8
10
  }
9
11
  const MAX_VISIBLE = 8;
10
12
  /**
11
- * Component that renders an auth provider selector
13
+ * Component that renders an auth provider selector. With `tui`, the selected row of a preferred partner provider
14
+ * shows its animated brand style.
12
15
  */
13
16
  export class OAuthSelectorComponent extends Container {
14
17
  capturesViewportInput = true;
@@ -31,7 +34,9 @@ export class OAuthSelectorComponent extends Container {
31
34
  getAuthStatus;
32
35
  onSelectCallback;
33
36
  onCancelCallback;
34
- constructor(mode, modelRuntime, providers, onSelect, onCancel, getAuthStatus, initialSearchInput = "") {
37
+ animationStart = performance.now();
38
+ stopAnimation;
39
+ constructor(mode, modelRuntime, providers, onSelect, onCancel, getAuthStatus, initialSearchInput = "", tui) {
35
40
  super();
36
41
  this.mode = mode;
37
42
  this.modelRuntime = modelRuntime;
@@ -65,6 +70,23 @@ export class OAuthSelectorComponent extends Container {
65
70
  this.addChild(new DynamicBorder());
66
71
  // Initial render
67
72
  this.filterProviders(initialSearchInput);
73
+ if (tui)
74
+ this.stopAnimation = startBrandAnimation(tui, () => this.getSelectedBrandStyle() !== undefined);
75
+ }
76
+ render(width) {
77
+ // The list is built from styled text, so an animated row needs a rebuild for each frame.
78
+ if (this.stopAnimation && this.getSelectedBrandStyle())
79
+ this.updateList();
80
+ return super.render(width);
81
+ }
82
+ /** Stops the brand animation. */
83
+ dispose() {
84
+ this.stopAnimation?.();
85
+ this.stopAnimation = undefined;
86
+ }
87
+ getSelectedBrandStyle() {
88
+ const selectedProvider = this.filteredProviders[this.selectedIndex];
89
+ return selectedProvider && getProviderBrandStyle(selectedProvider.id);
68
90
  }
69
91
  filterProviders(query) {
70
92
  this.filteredProviders = query
@@ -85,17 +107,16 @@ export class OAuthSelectorComponent extends Container {
85
107
  const statusIndicator = this.formatStatusIndicator(provider);
86
108
  const hasMultipleMethods = this.allProviders.some((other) => other.id === provider.id && other.authType !== provider.authType);
87
109
  const methodLabel = formatAuthSelectorProviderType(provider.authType, provider.subscription);
88
- const providerLabel = hasMultipleMethods ? `${provider.name} · ${methodLabel}` : provider.name;
89
- let line = "";
90
- if (isSelected) {
91
- const prefix = theme.fg("accent", "→ ");
92
- const text = theme.fg("accent", providerLabel);
93
- line = prefix + text + statusIndicator;
94
- }
95
- else {
96
- const text = ` ${theme.fg("text", providerLabel)}`;
97
- line = text + statusIndicator;
98
- }
110
+ const methodSuffix = hasMultipleMethods ? ` · ${methodLabel}` : "";
111
+ // U+2726 is single-width in every terminal, unlike star emoji or ambiguous-width symbols such as U+2605.
112
+ const partnerMarker = isPreferredProvider(provider.id) ? theme.fg("muted", " ✦") : "";
113
+ const color = isSelected ? "accent" : "text";
114
+ const brandStyle = isSelected && this.stopAnimation ? getProviderBrandStyle(provider.id) : undefined;
115
+ const name = brandStyle
116
+ ? brandStyle(provider.name, performance.now() - this.animationStart)
117
+ : theme.fg(color, provider.name);
118
+ const text = name + partnerMarker + (methodSuffix && theme.fg(color, methodSuffix));
119
+ const line = isSelected ? theme.fg("accent", "→ ") + text + statusIndicator : ` ${text}${statusIndicator}`;
99
120
  this.listContainer.addChild(new TruncatedText(line, 1, 0));
100
121
  }
101
122
  if (startIndex > 0 || endIndex < this.filteredProviders.length) {
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-selector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/oauth-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EAET,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,aAAa,GACb,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASpD,MAAM,UAAU,8BAA8B,CAC7C,QAA0C,EAC1C,YAAsB;IAEtB,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7C,OAAO,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC;AAC5D,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAC3C,qBAAqB,GAAY,IAAI,CAAC;IACvC,WAAW,CAAQ;IAE3B,kFAAkF;IAC1E,QAAQ,GAAG,KAAK,CAAC;I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C,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;YACzF,IAAI,CAAC,UAAU,EAAE,CAAC;QACnB,CAAC;QACD,eAAe;aACV,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAClC,IAAI,IAAI,CAAC,iBAAiB,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YACrD,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;YAC/B,IAAI,CAAC,UAAU,EAAE,CAAC;QACnB,CAAC;QACD,QAAQ;aACH,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,EAAE,CAAC;YACpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACpE,IAAI,gBAAgB,EAAE,CAAC;gBACtB,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YACvE,CAAC;QACF,CAAC;QACD,mBAAmB;aACd,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAAE,CAAC;YACnD,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACzB,CAAC;QACD,uCAAuC;aAClC,CAAC;YACL,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import {\n\tContainer,\n\ttype Focusable,\n\tfuzzyFilter,\n\tgetKeybindings,\n\tgetSelectPageIndex,\n\tInput,\n\tSpacer,\n\tTruncatedText,\n} from \"@earendil-works/pi-tui\";\nimport type { ModelRuntime } from \"../../../core/model-runtime.js\";\nimport type { AuthStatus } from \"../../../core/provider-composer.ts\";\nimport { theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\n\nexport type AuthSelectorProvider = {\n\tid: string;\n\tname: string;\n\tauthType: \"oauth\" | \"api_key\";\n\tsubscription?: boolean;\n};\n\nexport function formatAuthSelectorProviderType(\n\tauthType: AuthSelectorProvider[\"authType\"],\n\tsubscription?: boolean,\n): string {\n\tif (authType === \"api_key\") return \"API key\";\n\treturn subscription === false ? \"account\" : \"subscription\";\n}\n\nconst MAX_VISIBLE = 8;\n\n/**\n * Component that renders an auth provider selector\n */\nexport class OAuthSelectorComponent extends Container implements Focusable {\n\treadonly capturesViewportInput: boolean = true;\n\tprivate searchInput: Input;\n\n\t// Focusable implementation - propagate to search input for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.searchInput.focused = value;\n\t}\n\n\tprivate listContainer: Container;\n\tprivate allProviders: AuthSelectorProvider[];\n\tprivate filteredProviders: AuthSelectorProvider[];\n\tprivate selectedIndex: number = 0;\n\tprivate mode: \"login\" | \"logout\";\n\tprivate modelRuntime: ModelRuntime;\n\tprivate getAuthStatus: (providerId: string) => AuthStatus;\n\tprivate onSelectCallback: (providerId: string, authType: AuthSelectorProvider[\"authType\"]) => void;\n\tprivate onCancelCallback: () => void;\n\n\tconstructor(\n\t\tmode: \"login\" | \"logout\",\n\t\tmodelRuntime: ModelRuntime,\n\t\tproviders: AuthSelectorProvider[],\n\t\tonSelect: (providerId: string, authType: AuthSelectorProvider[\"authType\"]) => void,\n\t\tonCancel: () => void,\n\t\tgetAuthStatus?: (providerId: string) => AuthStatus,\n\t\tinitialSearchInput = \"\",\n\t) {\n\t\tsuper();\n\n\t\tthis.mode = mode;\n\t\tthis.modelRuntime = modelRuntime;\n\t\tthis.getAuthStatus = getAuthStatus ?? ((providerId) => this.modelRuntime.getProviderAuthStatus(providerId));\n\t\tthis.allProviders = providers;\n\t\tthis.filteredProviders = providers;\n\t\tthis.onSelectCallback = onSelect;\n\t\tthis.onCancelCallback = onCancel;\n\n\t\t// Add top border\n\t\tthis.addChild(new DynamicBorder());\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Add title\n\t\tconst title = mode === \"login\" ? \"Select provider to configure:\" : \"Select provider to logout:\";\n\t\tthis.addChild(new TruncatedText(theme.fg(\"accent\", theme.bold(title)), 1, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tthis.searchInput = new Input();\n\t\tthis.searchInput.setValue(initialSearchInput);\n\t\tthis.searchInput.onSubmit = () => {\n\t\t\tconst selectedProvider = this.filteredProviders[this.selectedIndex];\n\t\t\tif (selectedProvider) {\n\t\t\t\tthis.onSelectCallback(selectedProvider.id, selectedProvider.authType);\n\t\t\t}\n\t\t};\n\t\tthis.addChild(this.searchInput);\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Create list container\n\t\tthis.listContainer = new Container();\n\t\tthis.addChild(this.listContainer);\n\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Add bottom border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Initial render\n\t\tthis.filterProviders(initialSearchInput);\n\t}\n\n\tprivate filterProviders(query: string): void {\n\t\tthis.filteredProviders = query\n\t\t\t? fuzzyFilter(this.allProviders, query, (provider) => `${provider.name} ${provider.id} ${provider.authType}`)\n\t\t\t: this.allProviders;\n\t\tthis.selectedIndex = Math.max(0, Math.min(this.selectedIndex, Math.max(0, this.filteredProviders.length - 1)));\n\t\tthis.updateList();\n\t}\n\n\tprivate updateList(): void {\n\t\tthis.listContainer.clear();\n\n\t\tconst startIndex = Math.max(\n\t\t\t0,\n\t\t\tMath.min(this.selectedIndex - Math.floor(MAX_VISIBLE / 2), this.filteredProviders.length - MAX_VISIBLE),\n\t\t);\n\t\tconst endIndex = Math.min(startIndex + MAX_VISIBLE, this.filteredProviders.length);\n\n\t\tfor (let i = startIndex; i < endIndex; i++) {\n\t\t\tconst provider = this.filteredProviders[i];\n\t\t\tif (!provider) continue;\n\n\t\t\tconst isSelected = i === this.selectedIndex;\n\n\t\t\tconst statusIndicator = this.formatStatusIndicator(provider);\n\t\t\tconst hasMultipleMethods = this.allProviders.some(\n\t\t\t\t(other) => other.id === provider.id && other.authType !== provider.authType,\n\t\t\t);\n\t\t\tconst methodLabel = formatAuthSelectorProviderType(provider.authType, provider.subscription);\n\t\t\tconst providerLabel = hasMultipleMethods ? `${provider.name} · ${methodLabel}` : provider.name;\n\t\t\tlet line = \"\";\n\t\t\tif (isSelected) {\n\t\t\t\tconst prefix = theme.fg(\"accent\", \"→ \");\n\t\t\t\tconst text = theme.fg(\"accent\", providerLabel);\n\t\t\t\tline = prefix + text + statusIndicator;\n\t\t\t} else {\n\t\t\t\tconst text = ` ${theme.fg(\"text\", providerLabel)}`;\n\t\t\t\tline = text + statusIndicator;\n\t\t\t}\n\n\t\t\tthis.listContainer.addChild(new TruncatedText(line, 1, 0));\n\t\t}\n\n\t\tif (startIndex > 0 || endIndex < this.filteredProviders.length) {\n\t\t\tconst scrollInfo = theme.fg(\"muted\", ` (${this.selectedIndex + 1}/${this.filteredProviders.length})`);\n\t\t\tthis.listContainer.addChild(new TruncatedText(scrollInfo, 1, 0));\n\t\t}\n\n\t\t// Show \"no providers\" if empty\n\t\tif (this.filteredProviders.length === 0) {\n\t\t\tconst message =\n\t\t\t\tthis.allProviders.length === 0\n\t\t\t\t\t? this.mode === \"login\"\n\t\t\t\t\t\t? \"No providers available\"\n\t\t\t\t\t\t: \"No providers logged in. Use /login first.\"\n\t\t\t\t\t: \"No matching providers\";\n\t\t\tthis.listContainer.addChild(new TruncatedText(theme.fg(\"muted\", ` ${message}`), 1, 0));\n\t\t}\n\t}\n\n\tprivate formatStatusIndicator(provider: AuthSelectorProvider): string {\n\t\tconst status = this.getAuthStatus(provider.id);\n\t\tif (!status.configured) return theme.fg(\"muted\", \" • not configured\");\n\t\tswitch (status.source) {\n\t\t\tcase \"environment\":\n\t\t\t\treturn theme.fg(\"success\", ` ✓ env: ${status.label ?? \"API key\"}`);\n\t\t\tcase \"runtime\":\n\t\t\t\treturn theme.fg(\"success\", \" ✓ runtime API key\");\n\t\t\tcase \"stored\": {\n\t\t\t\tconst storedType = this.modelRuntime.getStoredCredentialType(provider.id);\n\t\t\t\treturn theme.fg(\n\t\t\t\t\t\"success\",\n\t\t\t\t\t` ✓ ${formatAuthSelectorProviderType(storedType ?? \"api_key\", provider.subscription)} configured`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase \"fallback\":\n\t\t\t\treturn theme.fg(\"success\", \" ✓ configured\");\n\t\t\tcase \"models_json_key\":\n\t\t\t\treturn theme.fg(\"success\", \" ✓ key in models.json\");\n\t\t\tcase \"models_json_command\":\n\t\t\t\treturn theme.fg(\"success\", \" ✓ command in models.json\");\n\t\t\tdefault:\n\t\t\t\treturn theme.fg(\"muted\", \" • not configured\");\n\t\t}\n\t}\n\n\thandleInput(keyData: string): boolean {\n\t\tconst kb = getKeybindings();\n\t\tconst pageIndex = getSelectPageIndex(kb, keyData, this.selectedIndex, this.filteredProviders.length, MAX_VISIBLE);\n\t\t// Up arrow\n\t\tif (kb.matches(keyData, \"tui.select.up\")) {\n\t\t\tif (this.filteredProviders.length === 0) return true;\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - 1);\n\t\t\tthis.updateList();\n\t\t}\n\t\t// Down arrow\n\t\telse if (kb.matches(keyData, \"tui.select.down\")) {\n\t\t\tif (this.filteredProviders.length === 0) return true;\n\t\t\tthis.selectedIndex = Math.min(this.filteredProviders.length - 1, this.selectedIndex + 1);\n\t\t\tthis.updateList();\n\t\t}\n\t\t// Page up/down\n\t\telse if (pageIndex !== undefined) {\n\t\t\tif (this.filteredProviders.length === 0) return true;\n\t\t\tthis.selectedIndex = pageIndex;\n\t\t\tthis.updateList();\n\t\t}\n\t\t// Enter\n\t\telse if (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\tconst selectedProvider = this.filteredProviders[this.selectedIndex];\n\t\t\tif (selectedProvider) {\n\t\t\t\tthis.onSelectCallback(selectedProvider.id, selectedProvider.authType);\n\t\t\t}\n\t\t}\n\t\t// Escape or Ctrl+C\n\t\telse if (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\tthis.onCancelCallback();\n\t\t}\n\t\t// Pass everything else to search input\n\t\telse {\n\t\t\tthis.searchInput.handleInput(keyData);\n\t\t\tthis.filterProviders(this.searchInput.getValue());\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"oauth-selector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/oauth-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EAET,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,aAAa,GAEb,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAA2B,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAS1G,MAAM,UAAU,8BAA8B,CAC7C,QAA0C,EAC1C,YAAsB;IAEtB,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7C,OAAO,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC;AAC5D,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAC3C,qBAAqB,GAAY,IAAI,CAAC;IACvC,WAAW,CAAQ;IAE3B,kFAAkF;IAC1E,QAAQ,GAAG,KAAK,CAAC;IACzB,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IACD,IAAI,OAAO,CAAC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S,KAAK,SAAS,EAAE,CAAC;YAClC,IAAI,IAAI,CAAC,iBAAiB,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YACrD,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;YAC/B,IAAI,CAAC,UAAU,EAAE,CAAC;QACnB,CAAC;QACD,QAAQ;aACH,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,EAAE,CAAC;YACpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACpE,IAAI,gBAAgB,EAAE,CAAC;gBACtB,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YACvE,CAAC;QACF,CAAC;QACD,mBAAmB;aACd,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAAE,CAAC;YACnD,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACzB,CAAC;QACD,uCAAuC;aAClC,CAAC;YACL,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import {\n\tContainer,\n\ttype Focusable,\n\tfuzzyFilter,\n\tgetKeybindings,\n\tgetSelectPageIndex,\n\tInput,\n\tSpacer,\n\tTruncatedText,\n\ttype TUI,\n} from \"@earendil-works/pi-tui\";\nimport type { ModelRuntime } from \"../../../core/model-runtime.js\";\nimport { isPreferredProvider } from \"../../../core/preferred-providers.ts\";\nimport type { AuthStatus } from \"../../../core/provider-composer.ts\";\nimport { theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { getProviderBrandStyle, type ProviderBrandStyle, startBrandAnimation } from \"./provider-brand.ts\";\n\nexport type AuthSelectorProvider = {\n\tid: string;\n\tname: string;\n\tauthType: \"oauth\" | \"api_key\";\n\tsubscription?: boolean;\n};\n\nexport function formatAuthSelectorProviderType(\n\tauthType: AuthSelectorProvider[\"authType\"],\n\tsubscription?: boolean,\n): string {\n\tif (authType === \"api_key\") return \"API key\";\n\treturn subscription === false ? \"account\" : \"subscription\";\n}\n\nconst MAX_VISIBLE = 8;\n\n/**\n * Component that renders an auth provider selector. With `tui`, the selected row of a preferred partner provider\n * shows its animated brand style.\n */\nexport class OAuthSelectorComponent extends Container implements Focusable {\n\treadonly capturesViewportInput: boolean = true;\n\tprivate searchInput: Input;\n\n\t// Focusable implementation - propagate to search input for IME cursor positioning\n\tprivate _focused = false;\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.searchInput.focused = value;\n\t}\n\n\tprivate listContainer: Container;\n\tprivate allProviders: AuthSelectorProvider[];\n\tprivate filteredProviders: AuthSelectorProvider[];\n\tprivate selectedIndex: number = 0;\n\tprivate mode: \"login\" | \"logout\";\n\tprivate modelRuntime: ModelRuntime;\n\tprivate getAuthStatus: (providerId: string) => AuthStatus;\n\tprivate onSelectCallback: (providerId: string, authType: AuthSelectorProvider[\"authType\"]) => void;\n\tprivate onCancelCallback: () => void;\n\tprivate readonly animationStart = performance.now();\n\tprivate stopAnimation: (() => void) | undefined;\n\n\tconstructor(\n\t\tmode: \"login\" | \"logout\",\n\t\tmodelRuntime: ModelRuntime,\n\t\tproviders: AuthSelectorProvider[],\n\t\tonSelect: (providerId: string, authType: AuthSelectorProvider[\"authType\"]) => void,\n\t\tonCancel: () => void,\n\t\tgetAuthStatus?: (providerId: string) => AuthStatus,\n\t\tinitialSearchInput = \"\",\n\t\ttui?: TUI,\n\t) {\n\t\tsuper();\n\n\t\tthis.mode = mode;\n\t\tthis.modelRuntime = modelRuntime;\n\t\tthis.getAuthStatus = getAuthStatus ?? ((providerId) => this.modelRuntime.getProviderAuthStatus(providerId));\n\t\tthis.allProviders = providers;\n\t\tthis.filteredProviders = providers;\n\t\tthis.onSelectCallback = onSelect;\n\t\tthis.onCancelCallback = onCancel;\n\n\t\t// Add top border\n\t\tthis.addChild(new DynamicBorder());\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Add title\n\t\tconst title = mode === \"login\" ? \"Select provider to configure:\" : \"Select provider to logout:\";\n\t\tthis.addChild(new TruncatedText(theme.fg(\"accent\", theme.bold(title)), 1, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tthis.searchInput = new Input();\n\t\tthis.searchInput.setValue(initialSearchInput);\n\t\tthis.searchInput.onSubmit = () => {\n\t\t\tconst selectedProvider = this.filteredProviders[this.selectedIndex];\n\t\t\tif (selectedProvider) {\n\t\t\t\tthis.onSelectCallback(selectedProvider.id, selectedProvider.authType);\n\t\t\t}\n\t\t};\n\t\tthis.addChild(this.searchInput);\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Create list container\n\t\tthis.listContainer = new Container();\n\t\tthis.addChild(this.listContainer);\n\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Add bottom border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Initial render\n\t\tthis.filterProviders(initialSearchInput);\n\n\t\tif (tui) this.stopAnimation = startBrandAnimation(tui, () => this.getSelectedBrandStyle() !== undefined);\n\t}\n\n\toverride render(width: number): string[] {\n\t\t// The list is built from styled text, so an animated row needs a rebuild for each frame.\n\t\tif (this.stopAnimation && this.getSelectedBrandStyle()) this.updateList();\n\t\treturn super.render(width);\n\t}\n\n\t/** Stops the brand animation. */\n\tdispose(): void {\n\t\tthis.stopAnimation?.();\n\t\tthis.stopAnimation = undefined;\n\t}\n\n\tprivate getSelectedBrandStyle(): ProviderBrandStyle | undefined {\n\t\tconst selectedProvider = this.filteredProviders[this.selectedIndex];\n\t\treturn selectedProvider && getProviderBrandStyle(selectedProvider.id);\n\t}\n\n\tprivate filterProviders(query: string): void {\n\t\tthis.filteredProviders = query\n\t\t\t? fuzzyFilter(this.allProviders, query, (provider) => `${provider.name} ${provider.id} ${provider.authType}`)\n\t\t\t: this.allProviders;\n\t\tthis.selectedIndex = Math.max(0, Math.min(this.selectedIndex, Math.max(0, this.filteredProviders.length - 1)));\n\t\tthis.updateList();\n\t}\n\n\tprivate updateList(): void {\n\t\tthis.listContainer.clear();\n\n\t\tconst startIndex = Math.max(\n\t\t\t0,\n\t\t\tMath.min(this.selectedIndex - Math.floor(MAX_VISIBLE / 2), this.filteredProviders.length - MAX_VISIBLE),\n\t\t);\n\t\tconst endIndex = Math.min(startIndex + MAX_VISIBLE, this.filteredProviders.length);\n\n\t\tfor (let i = startIndex; i < endIndex; i++) {\n\t\t\tconst provider = this.filteredProviders[i];\n\t\t\tif (!provider) continue;\n\n\t\t\tconst isSelected = i === this.selectedIndex;\n\n\t\t\tconst statusIndicator = this.formatStatusIndicator(provider);\n\t\t\tconst hasMultipleMethods = this.allProviders.some(\n\t\t\t\t(other) => other.id === provider.id && other.authType !== provider.authType,\n\t\t\t);\n\t\t\tconst methodLabel = formatAuthSelectorProviderType(provider.authType, provider.subscription);\n\t\t\tconst methodSuffix = hasMultipleMethods ? ` · ${methodLabel}` : \"\";\n\t\t\t// U+2726 is single-width in every terminal, unlike star emoji or ambiguous-width symbols such as U+2605.\n\t\t\tconst partnerMarker = isPreferredProvider(provider.id) ? theme.fg(\"muted\", \" ✦\") : \"\";\n\t\t\tconst color = isSelected ? \"accent\" : \"text\";\n\t\t\tconst brandStyle = isSelected && this.stopAnimation ? getProviderBrandStyle(provider.id) : undefined;\n\t\t\tconst name = brandStyle\n\t\t\t\t? brandStyle(provider.name, performance.now() - this.animationStart)\n\t\t\t\t: theme.fg(color, provider.name);\n\t\t\tconst text = name + partnerMarker + (methodSuffix && theme.fg(color, methodSuffix));\n\t\t\tconst line = isSelected ? theme.fg(\"accent\", \"→ \") + text + statusIndicator : ` ${text}${statusIndicator}`;\n\n\t\t\tthis.listContainer.addChild(new TruncatedText(line, 1, 0));\n\t\t}\n\n\t\tif (startIndex > 0 || endIndex < this.filteredProviders.length) {\n\t\t\tconst scrollInfo = theme.fg(\"muted\", ` (${this.selectedIndex + 1}/${this.filteredProviders.length})`);\n\t\t\tthis.listContainer.addChild(new TruncatedText(scrollInfo, 1, 0));\n\t\t}\n\n\t\t// Show \"no providers\" if empty\n\t\tif (this.filteredProviders.length === 0) {\n\t\t\tconst message =\n\t\t\t\tthis.allProviders.length === 0\n\t\t\t\t\t? this.mode === \"login\"\n\t\t\t\t\t\t? \"No providers available\"\n\t\t\t\t\t\t: \"No providers logged in. Use /login first.\"\n\t\t\t\t\t: \"No matching providers\";\n\t\t\tthis.listContainer.addChild(new TruncatedText(theme.fg(\"muted\", ` ${message}`), 1, 0));\n\t\t}\n\t}\n\n\tprivate formatStatusIndicator(provider: AuthSelectorProvider): string {\n\t\tconst status = this.getAuthStatus(provider.id);\n\t\tif (!status.configured) return theme.fg(\"muted\", \" • not configured\");\n\t\tswitch (status.source) {\n\t\t\tcase \"environment\":\n\t\t\t\treturn theme.fg(\"success\", ` ✓ env: ${status.label ?? \"API key\"}`);\n\t\t\tcase \"runtime\":\n\t\t\t\treturn theme.fg(\"success\", \" ✓ runtime API key\");\n\t\t\tcase \"stored\": {\n\t\t\t\tconst storedType = this.modelRuntime.getStoredCredentialType(provider.id);\n\t\t\t\treturn theme.fg(\n\t\t\t\t\t\"success\",\n\t\t\t\t\t` ✓ ${formatAuthSelectorProviderType(storedType ?? \"api_key\", provider.subscription)} configured`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase \"fallback\":\n\t\t\t\treturn theme.fg(\"success\", \" ✓ configured\");\n\t\t\tcase \"models_json_key\":\n\t\t\t\treturn theme.fg(\"success\", \" ✓ key in models.json\");\n\t\t\tcase \"models_json_command\":\n\t\t\t\treturn theme.fg(\"success\", \" ✓ command in models.json\");\n\t\t\tdefault:\n\t\t\t\treturn theme.fg(\"muted\", \" • not configured\");\n\t\t}\n\t}\n\n\thandleInput(keyData: string): boolean {\n\t\tconst kb = getKeybindings();\n\t\tconst pageIndex = getSelectPageIndex(kb, keyData, this.selectedIndex, this.filteredProviders.length, MAX_VISIBLE);\n\t\t// Up arrow\n\t\tif (kb.matches(keyData, \"tui.select.up\")) {\n\t\t\tif (this.filteredProviders.length === 0) return true;\n\t\t\tthis.selectedIndex = Math.max(0, this.selectedIndex - 1);\n\t\t\tthis.updateList();\n\t\t}\n\t\t// Down arrow\n\t\telse if (kb.matches(keyData, \"tui.select.down\")) {\n\t\t\tif (this.filteredProviders.length === 0) return true;\n\t\t\tthis.selectedIndex = Math.min(this.filteredProviders.length - 1, this.selectedIndex + 1);\n\t\t\tthis.updateList();\n\t\t}\n\t\t// Page up/down\n\t\telse if (pageIndex !== undefined) {\n\t\t\tif (this.filteredProviders.length === 0) return true;\n\t\t\tthis.selectedIndex = pageIndex;\n\t\t\tthis.updateList();\n\t\t}\n\t\t// Enter\n\t\telse if (kb.matches(keyData, \"tui.select.confirm\")) {\n\t\t\tconst selectedProvider = this.filteredProviders[this.selectedIndex];\n\t\t\tif (selectedProvider) {\n\t\t\t\tthis.onSelectCallback(selectedProvider.id, selectedProvider.authType);\n\t\t\t}\n\t\t}\n\t\t// Escape or Ctrl+C\n\t\telse if (kb.matches(keyData, \"tui.select.cancel\")) {\n\t\t\tthis.onCancelCallback();\n\t\t}\n\t\t// Pass everything else to search input\n\t\telse {\n\t\t\tthis.searchInput.handleInput(keyData);\n\t\t\tthis.filterProviders(this.searchInput.getValue());\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Animated brand styles for the names of preferred partner providers in selectors: Radius shimmers in its logo
3
+ * colors and OpenRouter glows in its brand color. Selectors apply them to the selected row only.
4
+ */
5
+ import { type TUI } from "@earendil-works/pi-tui";
6
+ /** Colors `text` for animation time `elapsedMs`. */
7
+ export type ProviderBrandStyle = (text: string, elapsedMs: number) => string;
8
+ /** The animated style of a provider's name, or `undefined` when the provider has none. */
9
+ export declare function getProviderBrandStyle(providerId: string): ProviderBrandStyle | undefined;
10
+ /** Colors `text` with the Radius logo colors flowing left to right. */
11
+ export declare function radiusShimmer(text: string, elapsedMs: number): string;
12
+ /** Colors `text` in OpenRouter's brand color, slowly brightening and dimming. */
13
+ export declare function openRouterGlow(text: string, elapsedMs: number): string;
14
+ /** Re-renders `tui` every animation frame while `isAnimating()` holds; returns the function that stops it. */
15
+ export declare function startBrandAnimation(tui: TUI, isAnimating: () => boolean): () => void;
16
+ //# sourceMappingURL=provider-brand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-brand.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/provider-brand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAqD,KAAK,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAKrG,oDAAoD;AACpD,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;AAE7E,0FAA0F;AAC1F,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAIxF;AAQD,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAkBrE;AAYD,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAItE;AAID,8GAA8G;AAC9G,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,OAAO,GAAG,MAAM,IAAI,CAMpF"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Animated brand styles for the names of preferred partner providers in selectors: Radius shimmers in its logo
3
+ * colors and OpenRouter glows in its brand color. Selectors apply them to the selected row only.
4
+ */
5
+ import { foregroundAnsi, mixColors, parseColor } from "@earendil-works/pi-tui";
6
+ import { RADIUS_PROVIDER_ID } from "../../../core/preferred-providers.js";
7
+ import { getCurrentThemeName } from "../theme/global-theme.js";
8
+ import { isLightTheme, theme } from "../theme/theme.js";
9
+ /** The animated style of a provider's name, or `undefined` when the provider has none. */
10
+ export function getProviderBrandStyle(providerId) {
11
+ if (providerId === RADIUS_PROVIDER_ID)
12
+ return radiusShimmer;
13
+ if (providerId === "openrouter")
14
+ return openRouterGlow;
15
+ return undefined;
16
+ }
17
+ /** The four colors of the Radius logo, in the order they stream across the text. */
18
+ const RADIUS_COLORS = ["#4d9abf", "#83ccd2", "#f1be57", "#f09082"].map((hex) => parseColor(hex));
19
+ /** Width of each color band, in characters. */
20
+ const CHARS_PER_COLOR = 4;
21
+ const CHARS_PER_SECOND = 10;
22
+ /** Colors `text` with the Radius logo colors flowing left to right. */
23
+ export function radiusShimmer(text, elapsedMs) {
24
+ const mode = theme.getColorMode();
25
+ const cycle = RADIUS_COLORS.length * CHARS_PER_COLOR;
26
+ const offset = (elapsedMs / 1000) * CHARS_PER_SECOND;
27
+ let result = "";
28
+ let index = 0;
29
+ for (const char of text) {
30
+ const position = (((index - offset) % cycle) + cycle) % cycle;
31
+ const band = Math.floor(position / CHARS_PER_COLOR);
32
+ const t = position / CHARS_PER_COLOR - band;
33
+ // Smoothstep keeps each band recognizable while still blending into the next one.
34
+ const amount = t * t * (3 - 2 * t);
35
+ const from = RADIUS_COLORS[band];
36
+ const to = RADIUS_COLORS[(band + 1) % RADIUS_COLORS.length];
37
+ result += foregroundAnsi(mixColors(from, to, amount, "srgb"), mode) + char;
38
+ index++;
39
+ }
40
+ return `${result}\x1b[39m`;
41
+ }
42
+ /**
43
+ * OpenRouter's brand colors per theme appearance: lime on dark backgrounds, violet on light ones, where lime would
44
+ * be unreadable. The glow breathes between `base` and the brighter `peak`.
45
+ */
46
+ const OPENROUTER_GLOW = {
47
+ dark: { base: parseColor("#c6f243"), peak: parseColor("#efffb0") },
48
+ light: { base: parseColor("#5d32e1"), peak: parseColor("#8f6bff") },
49
+ };
50
+ const GLOW_PERIOD_MS = 2400;
51
+ /** Colors `text` in OpenRouter's brand color, slowly brightening and dimming. */
52
+ export function openRouterGlow(text, elapsedMs) {
53
+ const { base, peak } = OPENROUTER_GLOW[isLightTheme(getCurrentThemeName()) ? "light" : "dark"];
54
+ const amount = (1 - Math.cos((2 * Math.PI * elapsedMs) / GLOW_PERIOD_MS)) / 2;
55
+ return `${foregroundAnsi(mixColors(base, peak, amount, "oklch"), theme.getColorMode())}${text}\x1b[39m`;
56
+ }
57
+ const ANIMATION_FRAME_MS = 50;
58
+ /** Re-renders `tui` every animation frame while `isAnimating()` holds; returns the function that stops it. */
59
+ export function startBrandAnimation(tui, isAnimating) {
60
+ const timer = setInterval(() => {
61
+ if (isAnimating())
62
+ tui.requestRender();
63
+ }, ANIMATION_FRAME_MS);
64
+ timer.unref?.();
65
+ return () => clearInterval(timer);
66
+ }
67
+ //# sourceMappingURL=provider-brand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-brand.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/provider-brand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAc,cAAc,EAAE,SAAS,EAAE,UAAU,EAAY,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAKxD,0FAA0F;AAC1F,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACvD,IAAI,UAAU,KAAK,kBAAkB;QAAE,OAAO,aAAa,CAAC;IAC5D,IAAI,UAAU,KAAK,YAAY;QAAE,OAAO,cAAc,CAAC;IACvD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,oFAAoF;AACpF,MAA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;IACvB,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;IAChB,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC","sourcesContent":["/**\n * Animated brand styles for the names of preferred partner providers in selectors: Radius shimmers in its logo\n * colors and OpenRouter glows in its brand color. Selectors apply them to the selected row only.\n */\n\nimport { type Color, foregroundAnsi, mixColors, parseColor, type TUI } from \"@earendil-works/pi-tui\";\nimport { RADIUS_PROVIDER_ID } from \"../../../core/preferred-providers.ts\";\nimport { getCurrentThemeName } from \"../theme/global-theme.ts\";\nimport { isLightTheme, theme } from \"../theme/theme.js\";\n\n/** Colors `text` for animation time `elapsedMs`. */\nexport type ProviderBrandStyle = (text: string, elapsedMs: number) => string;\n\n/** The animated style of a provider's name, or `undefined` when the provider has none. */\nexport function getProviderBrandStyle(providerId: string): ProviderBrandStyle | undefined {\n\tif (providerId === RADIUS_PROVIDER_ID) return radiusShimmer;\n\tif (providerId === \"openrouter\") return openRouterGlow;\n\treturn undefined;\n}\n\n/** The four colors of the Radius logo, in the order they stream across the text. */\nconst RADIUS_COLORS: readonly Color[] = [\"#4d9abf\", \"#83ccd2\", \"#f1be57\", \"#f09082\"].map((hex) => parseColor(hex));\n/** Width of each color band, in characters. */\nconst CHARS_PER_COLOR = 4;\nconst CHARS_PER_SECOND = 10;\n\n/** Colors `text` with the Radius logo colors flowing left to right. */\nexport function radiusShimmer(text: string, elapsedMs: number): string {\n\tconst mode = theme.getColorMode();\n\tconst cycle = RADIUS_COLORS.length * CHARS_PER_COLOR;\n\tconst offset = (elapsedMs / 1000) * CHARS_PER_SECOND;\n\tlet result = \"\";\n\tlet index = 0;\n\tfor (const char of text) {\n\t\tconst position = (((index - offset) % cycle) + cycle) % cycle;\n\t\tconst band = Math.floor(position / CHARS_PER_COLOR);\n\t\tconst t = position / CHARS_PER_COLOR - band;\n\t\t// Smoothstep keeps each band recognizable while still blending into the next one.\n\t\tconst amount = t * t * (3 - 2 * t);\n\t\tconst from = RADIUS_COLORS[band] as Color;\n\t\tconst to = RADIUS_COLORS[(band + 1) % RADIUS_COLORS.length] as Color;\n\t\tresult += foregroundAnsi(mixColors(from, to, amount, \"srgb\"), mode) + char;\n\t\tindex++;\n\t}\n\treturn `${result}\\x1b[39m`;\n}\n\n/**\n * OpenRouter's brand colors per theme appearance: lime on dark backgrounds, violet on light ones, where lime would\n * be unreadable. The glow breathes between `base` and the brighter `peak`.\n */\nconst OPENROUTER_GLOW = {\n\tdark: { base: parseColor(\"#c6f243\"), peak: parseColor(\"#efffb0\") },\n\tlight: { base: parseColor(\"#5d32e1\"), peak: parseColor(\"#8f6bff\") },\n} as const;\nconst GLOW_PERIOD_MS = 2400;\n\n/** Colors `text` in OpenRouter's brand color, slowly brightening and dimming. */\nexport function openRouterGlow(text: string, elapsedMs: number): string {\n\tconst { base, peak } = OPENROUTER_GLOW[isLightTheme(getCurrentThemeName()) ? \"light\" : \"dark\"];\n\tconst amount = (1 - Math.cos((2 * Math.PI * elapsedMs) / GLOW_PERIOD_MS)) / 2;\n\treturn `${foregroundAnsi(mixColors(base, peak, amount, \"oklch\"), theme.getColorMode())}${text}\\x1b[39m`;\n}\n\nconst ANIMATION_FRAME_MS = 50;\n\n/** Re-renders `tui` every animation frame while `isAnimating()` holds; returns the function that stops it. */\nexport function startBrandAnimation(tui: TUI, isAnimating: () => boolean): () => void {\n\tconst timer = setInterval(() => {\n\t\tif (isAnimating()) tui.requestRender();\n\t}, ANIMATION_FRAME_MS);\n\ttimer.unref?.();\n\treturn () => clearInterval(timer);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-auth-routing.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-routing.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EACN,KAAK,oBAAoB,EAGzB,MAAM,4BAA4B,CAAC;AAIpC,wBAAgB,kBAAkB,CACjC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,UAAU,EAAE,UAAU,GACpB,MAAM,CAKR;AAED,wBAAgB,4BAA4B,CAAC,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,oBAAoB,EAAE,CAQnH"}
1
+ {"version":3,"file":"interactive-auth-routing.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-routing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EACN,KAAK,oBAAoB,EAGzB,MAAM,4BAA4B,CAAC;AAIpC,wBAAgB,kBAAkB,CACjC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,UAAU,EAAE,UAAU,GACpB,MAAM,CAKR;AAED,wBAAgB,4BAA4B,CAAC,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,oBAAoB,EAAE,CAQnH"}
@@ -1,5 +1,6 @@
1
1
  import { builtinProviders } from "@bastani/pi-ai/providers/all";
2
2
  import { CredentialSynchronizationError } from "../../core/model-runtime.js";
3
+ import { compareProviders } from "../../core/preferred-providers.js";
3
4
  import { InteractiveModeBase } from "./interactive-mode-base.js";
4
5
  import { ExtensionSelectorComponent, OAuthSelectorComponent, } from "./interactive-mode-deps.js";
5
6
  import { BEDROCK_PROVIDER_ID } from "./interactive-mode-helpers.js";
@@ -39,7 +40,8 @@ InteractiveModeBase.prototype.getLoginProviderOptions = function (authType) {
39
40
  ...subscriptionFlag(subscriptions.get(provider.id)),
40
41
  });
41
42
  }
42
- return (authType ? options.filter((option) => option.authType === authType) : options).sort((a, b) => a.name.localeCompare(b.name));
43
+ // The sort is stable, so a provider's account option stays above its API key option.
44
+ return (authType ? options.filter((option) => option.authType === authType) : options).sort(compareProviders);
43
45
  };
44
46
  InteractiveModeBase.prototype.getLogoutProviderOptions = function () {
45
47
  const runtime = this.session.modelRuntime;
@@ -61,7 +63,7 @@ InteractiveModeBase.prototype.getLogoutProviderOptions = function () {
61
63
  if (authType)
62
64
  options.push({ id: providerId, name, authType, ...subscriptionFlag(subscriptions.get(providerId)) });
63
65
  }
64
- return options.sort((a, b) => a.name.localeCompare(b.name));
66
+ return options.sort(compareProviders);
65
67
  };
66
68
  InteractiveModeBase.prototype.startProviderLogin = async function (providerOption, onBack) {
67
69
  if (providerOption.authType === "oauth") {
@@ -140,8 +142,8 @@ InteractiveModeBase.prototype.showLoginProviderSelector = function (authType, in
140
142
  this.showLoginAuthTypeSelector();
141
143
  else
142
144
  this.ui.requestRender();
143
- }, (providerId) => this.session.modelRuntime.getProviderAuthStatus(providerId), initialSearchInput);
144
- return { component: selector, focus: selector };
145
+ }, (providerId) => this.session.modelRuntime.getProviderAuthStatus(providerId), initialSearchInput, this.ui);
146
+ return { component: selector, focus: selector, dispose: () => selector.dispose() };
145
147
  });
146
148
  };
147
149
  InteractiveModeBase.prototype.showOAuthSelector = async function (mode, initialSearchInput) {
@@ -175,8 +177,8 @@ InteractiveModeBase.prototype.showOAuthSelector = async function (mode, initialS
175
177
  }, () => {
176
178
  done();
177
179
  this.ui.requestRender();
178
- }, undefined, initialSearchInput);
179
- return { component: selector, focus: selector };
180
+ }, undefined, initialSearchInput, this.ui);
181
+ return { component: selector, focus: selector, dispose: () => selector.dispose() };
180
182
  });
181
183
  };
182
184
  //# sourceMappingURL=interactive-auth-routing.js.map