@bastani/atomic 0.9.13 → 0.9.14-alpha.2

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 (762) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +3 -3
  3. package/dist/builtin/intercom/package.json +2 -2
  4. package/dist/builtin/mcp/package.json +3 -3
  5. package/dist/builtin/subagents/CHANGELOG.md +14 -0
  6. package/dist/builtin/subagents/README.md +6 -4
  7. package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
  8. package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
  9. package/dist/builtin/subagents/agents/codebase-locator.md +1 -1
  10. package/dist/builtin/subagents/agents/codebase-online-researcher.md +1 -1
  11. package/dist/builtin/subagents/agents/codebase-pattern-finder.md +1 -1
  12. package/dist/builtin/subagents/agents/codebase-research-analyzer.md +1 -1
  13. package/dist/builtin/subagents/agents/codebase-research-locator.md +1 -1
  14. package/dist/builtin/subagents/agents/debugger.md +1 -1
  15. package/dist/builtin/subagents/agents/worker.md +1 -1
  16. package/dist/builtin/subagents/package.json +6 -5
  17. package/dist/builtin/subagents/src/agents/agent-discovery.ts +17 -11
  18. package/dist/builtin/subagents/src/agents/agent-loaders.ts +115 -43
  19. package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +10 -8
  20. package/dist/builtin/subagents/src/agents/agent-management.ts +8 -7
  21. package/dist/builtin/subagents/src/agents/agent-overrides.ts +2 -2
  22. package/dist/builtin/subagents/src/agents/agent-scope.ts +1 -1
  23. package/dist/builtin/subagents/src/agents/agent-selection.ts +1 -1
  24. package/dist/builtin/subagents/src/agents/agent-serializer.ts +24 -3
  25. package/dist/builtin/subagents/src/agents/agent-types.ts +3 -1
  26. package/dist/builtin/subagents/src/agents/agents.ts +7 -5
  27. package/dist/builtin/subagents/src/agents/frontmatter.ts +67 -22
  28. package/dist/builtin/subagents/src/agents/identity.ts +1 -1
  29. package/dist/builtin/subagents/src/agents/skills-paths.ts +1 -1
  30. package/dist/builtin/subagents/src/agents/skills.ts +64 -6
  31. package/dist/builtin/subagents/src/extension/config.ts +1 -1
  32. package/dist/builtin/subagents/src/extension/control-notices.ts +2 -2
  33. package/dist/builtin/subagents/src/extension/doctor.ts +15 -5
  34. package/dist/builtin/subagents/src/extension/fanout-child.ts +12 -12
  35. package/dist/builtin/subagents/src/extension/index.ts +23 -23
  36. package/dist/builtin/subagents/src/extension/notification-content.ts +1 -1
  37. package/dist/builtin/subagents/src/extension/schemas.ts +1 -1
  38. package/dist/builtin/subagents/src/extension/startup-maintenance.ts +3 -3
  39. package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +3 -3
  40. package/dist/builtin/subagents/src/intercom/result-intercom.ts +1 -1
  41. package/dist/builtin/subagents/src/intercom/supervisor-authorization.ts +1 -1
  42. package/dist/builtin/subagents/src/runs/foreground/completion-notification.ts +2 -2
  43. package/dist/builtin/subagents/src/runs/foreground/execution-detach-reservations.ts +1 -1
  44. package/dist/builtin/subagents/src/runs/foreground/execution-intercom-detach.ts +3 -3
  45. package/dist/builtin/subagents/src/runs/foreground/execution-run-sync.ts +1 -1
  46. package/dist/builtin/subagents/src/runs/foreground/execution-updates.ts +2 -2
  47. package/dist/builtin/subagents/src/runs/foreground/execution-utils.ts +1 -1
  48. package/dist/builtin/subagents/src/runs/foreground/execution.ts +2 -2
  49. package/dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts +27 -11
  50. package/dist/builtin/subagents/src/runs/foreground/notify.ts +3 -3
  51. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +11 -11
  52. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-input.ts +3 -3
  53. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +15 -14
  54. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +19 -19
  55. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-runtime.ts +2 -2
  56. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +14 -13
  57. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +9 -9
  58. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +7 -7
  59. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-worktree.ts +6 -6
  60. package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +24 -23
  61. package/dist/builtin/subagents/src/runs/inprocess/control-registry.ts +1 -1
  62. package/dist/builtin/subagents/src/runs/inprocess/control-status.ts +3 -3
  63. package/dist/builtin/subagents/src/runs/inprocess/index.ts +3 -3
  64. package/dist/builtin/subagents/src/runs/inprocess/prompt-behavior.ts +17 -8
  65. package/dist/builtin/subagents/src/runs/inprocess/runner.ts +60 -12
  66. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-api.ts +8 -8
  67. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-control.ts +3 -3
  68. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-core.ts +4 -4
  69. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-projection.ts +4 -4
  70. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-registry.ts +5 -5
  71. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-rendering.ts +3 -3
  72. package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-sanitize.ts +3 -3
  73. package/dist/builtin/subagents/src/runs/inprocess.ts +1 -1
  74. package/dist/builtin/subagents/src/runs/shared/long-running-guard.ts +1 -1
  75. package/dist/builtin/subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +1 -1
  76. package/dist/builtin/subagents/src/runs/shared/model-candidate-filter.ts +3 -3
  77. package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +2 -2
  78. package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +1 -1
  79. package/dist/builtin/subagents/src/runs/shared/single-output.ts +1 -1
  80. package/dist/builtin/subagents/src/runs/shared/subagent-control.ts +1 -1
  81. package/dist/builtin/subagents/src/shared/artifacts.ts +2 -2
  82. package/dist/builtin/subagents/src/shared/event-jsonl-writer.ts +1 -1
  83. package/dist/builtin/subagents/src/shared/fast-mode.ts +1 -1
  84. package/dist/builtin/subagents/src/shared/formatters.ts +2 -2
  85. package/dist/builtin/subagents/src/shared/jsonl-writer.ts +1 -1
  86. package/dist/builtin/subagents/src/shared/model-resolution.ts +1 -1
  87. package/dist/builtin/subagents/src/shared/session-tokens.ts +1 -1
  88. package/dist/builtin/subagents/src/shared/settings.ts +4 -4
  89. package/dist/builtin/subagents/src/shared/status-format.ts +1 -1
  90. package/dist/builtin/subagents/src/shared/types-config.ts +16 -4
  91. package/dist/builtin/subagents/src/shared/types-depth.ts +1 -1
  92. package/dist/builtin/subagents/src/shared/types-nested.ts +1 -1
  93. package/dist/builtin/subagents/src/shared/types-output.ts +1 -1
  94. package/dist/builtin/subagents/src/shared/types-results.ts +1 -1
  95. package/dist/builtin/subagents/src/shared/types-runtime.ts +1 -1
  96. package/dist/builtin/subagents/src/shared/types.ts +6 -6
  97. package/dist/builtin/subagents/src/shared/utils.ts +3 -3
  98. package/dist/builtin/subagents/src/slash/prompt-template-bridge.ts +1 -1
  99. package/dist/builtin/subagents/src/slash/slash-bridge.ts +3 -3
  100. package/dist/builtin/subagents/src/slash/slash-commands.ts +6 -6
  101. package/dist/builtin/subagents/src/slash/slash-live-state.ts +3 -3
  102. package/dist/builtin/subagents/src/tui/render-event-formatting.ts +2 -2
  103. package/dist/builtin/subagents/src/tui/render-layout.ts +1 -1
  104. package/dist/builtin/subagents/src/tui/render-progress.ts +2 -2
  105. package/dist/builtin/subagents/src/tui/render-result-compact.ts +7 -7
  106. package/dist/builtin/subagents/src/tui/render-result.ts +10 -10
  107. package/dist/builtin/subagents/src/tui/render-stable-output.ts +1 -1
  108. package/dist/builtin/subagents/src/tui/render-status-progress.ts +5 -5
  109. package/dist/builtin/subagents/src/tui/render.ts +4 -4
  110. package/dist/builtin/web-access/package.json +2 -2
  111. package/dist/builtin/workflows/CHANGELOG.md +57 -0
  112. package/dist/builtin/workflows/README.md +39 -8
  113. package/dist/builtin/workflows/builtin/adversarial-verification-runner.ts +16 -5
  114. package/dist/builtin/workflows/builtin/adversarial-verification.ts +4 -0
  115. package/dist/builtin/workflows/builtin/classify-and-act.ts +4 -0
  116. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.ts +4 -0
  117. package/dist/builtin/workflows/builtin/generate-and-filter-runner.ts +12 -4
  118. package/dist/builtin/workflows/builtin/generate-and-filter.ts +4 -0
  119. package/dist/builtin/workflows/builtin/goal-models.ts +8 -10
  120. package/dist/builtin/workflows/builtin/goal.ts +4 -0
  121. package/dist/builtin/workflows/builtin/index.d.ts +0 -4
  122. package/dist/builtin/workflows/builtin/loop-until-done-runner.ts +4 -2
  123. package/dist/builtin/workflows/builtin/loop-until-done.ts +4 -0
  124. package/dist/builtin/workflows/builtin/open-claude-design-live-protocol.ts +305 -0
  125. package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +115 -171
  126. package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +9 -25
  127. package/dist/builtin/workflows/builtin/open-claude-design-setup.ts +19 -86
  128. package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +0 -6
  129. package/dist/builtin/workflows/builtin/open-claude-design.d.ts +0 -5
  130. package/dist/builtin/workflows/builtin/open-claude-design.ts +11 -15
  131. package/dist/builtin/workflows/builtin/ralph-models.ts +24 -29
  132. package/dist/builtin/workflows/builtin/ralph.ts +4 -0
  133. package/dist/builtin/workflows/builtin/tournament-runner.ts +6 -3
  134. package/dist/builtin/workflows/builtin/tournament.ts +4 -0
  135. package/dist/builtin/workflows/package.json +2 -2
  136. package/dist/builtin/workflows/skills/impeccable/SKILL.md +3 -3
  137. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +25 -31
  138. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +1 -0
  139. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +16 -10
  140. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_manual_edit_applier.toml +2 -2
  141. package/dist/builtin/workflows/skills/impeccable/reference/android.md +6 -0
  142. package/dist/builtin/workflows/skills/impeccable/reference/animate.md +3 -0
  143. package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +3 -1
  144. package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +6 -1
  145. package/dist/builtin/workflows/skills/impeccable/reference/critique.md +18 -2
  146. package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +24 -30
  147. package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +1 -0
  148. package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +16 -10
  149. package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +2 -2
  150. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +1 -1
  151. package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +1 -0
  152. package/dist/builtin/workflows/skills/impeccable/reference/document.md +1 -1
  153. package/dist/builtin/workflows/skills/impeccable/reference/extract.md +1 -1
  154. package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +12 -6
  155. package/dist/builtin/workflows/skills/impeccable/reference/init.md +12 -3
  156. package/dist/builtin/workflows/skills/impeccable/reference/ios.md +6 -0
  157. package/dist/builtin/workflows/skills/impeccable/reference/live-setup.md +102 -0
  158. package/dist/builtin/workflows/skills/impeccable/reference/live.md +113 -521
  159. package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +39 -26
  160. package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -1
  161. package/dist/builtin/workflows/skills/impeccable/reference/polish.md +3 -3
  162. package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +1 -1
  163. package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +25 -11
  164. package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +332 -221
  165. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +10 -19
  166. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +91 -38
  167. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +19 -10
  168. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +56 -6
  169. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +10 -16
  170. package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +140 -2
  171. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +1174 -694
  172. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns.mjs +1 -0
  173. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +5 -1
  174. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +431 -45
  175. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +10 -1
  176. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +47 -6
  177. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +23 -22
  178. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +0 -10
  179. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +384 -384
  180. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/color.mjs +466 -2
  181. package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +2 -0
  182. package/dist/builtin/workflows/skills/impeccable/scripts/embed-prompt.mjs +270 -0
  183. package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +51 -6
  184. package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +70 -10
  185. package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +336 -90
  186. package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +38 -3
  187. package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +77 -11
  188. package/dist/builtin/workflows/skills/impeccable/scripts/lib/design-parser.mjs +102 -19
  189. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +44 -59
  190. package/dist/builtin/workflows/skills/impeccable/scripts/lib/is-generated.mjs +3 -0
  191. package/dist/builtin/workflows/skills/impeccable/scripts/lib/open-system-browser.mjs +57 -0
  192. package/dist/builtin/workflows/skills/impeccable/scripts/lib/roll-selection.mjs +369 -0
  193. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +31 -3
  194. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +73 -2
  195. package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-css.mjs +617 -0
  196. package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-verify.mjs +71 -0
  197. package/dist/builtin/workflows/skills/impeccable/scripts/live/browser-script-parts.mjs +29 -2
  198. package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +54 -7
  199. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/astro.mjs +47 -0
  200. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/detect-utils.mjs +157 -0
  201. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/index.mjs +143 -0
  202. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/journal.mjs +205 -0
  203. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nextjs.mjs +49 -0
  204. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nuxt.mjs +170 -0
  205. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/script-src.mjs +26 -0
  206. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/static-html.mjs +26 -0
  207. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/sveltekit.mjs +71 -0
  208. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tag-strategy.mjs +247 -0
  209. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tanstack-start.mjs +70 -0
  210. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/vite-generic.mjs +42 -0
  211. package/dist/builtin/workflows/skills/impeccable/scripts/live/instructions.mjs +169 -0
  212. package/dist/builtin/workflows/skills/impeccable/scripts/live/roots.mjs +670 -0
  213. package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +232 -35
  214. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-ast.mjs +969 -0
  215. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-component.mjs +621 -74
  216. package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +66 -28
  217. package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +12 -12
  218. package/dist/builtin/workflows/skills/impeccable/scripts/live/ui-surfaces.mjs +75 -0
  219. package/dist/builtin/workflows/skills/impeccable/scripts/live/vocabulary.mjs +135 -0
  220. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +23 -37
  221. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +945 -115
  222. package/dist/builtin/workflows/skills/impeccable/scripts/live-complete.mjs +33 -1
  223. package/dist/builtin/workflows/skills/impeccable/scripts/live-copy-edit-agent.mjs +132 -15
  224. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +173 -425
  225. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +2 -0
  226. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +16 -3
  227. package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +39 -10
  228. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +194 -27
  229. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +10 -4
  230. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +50 -31
  231. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +91 -28
  232. package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +8 -5
  233. package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +759 -109
  234. package/dist/builtin/workflows/src/authoring/workflow.ts +9 -0
  235. package/dist/builtin/workflows/src/authoring.d.ts +3 -0
  236. package/dist/builtin/workflows/src/durable/completed-catalog.ts +23 -2
  237. package/dist/builtin/workflows/src/durable/dbos-backend.ts +30 -17
  238. package/dist/builtin/workflows/src/durable/dbos-envelope.ts +14 -0
  239. package/dist/builtin/workflows/src/durable/dbos-lifecycle.ts +60 -57
  240. package/dist/builtin/workflows/src/durable/dbos-process-owner.ts +87 -0
  241. package/dist/builtin/workflows/src/durable/dbos-registration-diagnostics.ts +113 -0
  242. package/dist/builtin/workflows/src/durable/factory.ts +11 -8
  243. package/dist/builtin/workflows/src/durable/tool-failure-checkpoint.ts +5 -0
  244. package/dist/builtin/workflows/src/durable/tool-primitive.ts +186 -20
  245. package/dist/builtin/workflows/src/durable/types.ts +4 -0
  246. package/dist/builtin/workflows/src/durable/workflow-heartbeat-anchor.ts +153 -0
  247. package/dist/builtin/workflows/src/engine/run-durable-stage-session.ts +28 -0
  248. package/dist/builtin/workflows/src/engine/run-tool-control-registry.ts +9 -1
  249. package/dist/builtin/workflows/src/engine/run.ts +1 -0
  250. package/dist/builtin/workflows/src/extension/adopt-session-run-state.ts +20 -0
  251. package/dist/builtin/workflows/src/extension/background-ui-adapter.ts +9 -30
  252. package/dist/builtin/workflows/src/extension/extension-factory.ts +3 -0
  253. package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +28 -10
  254. package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +138 -0
  255. package/dist/builtin/workflows/src/extension/index.bundle.mjs +3365 -1341
  256. package/dist/builtin/workflows/src/extension/workflow-heartbeat-delivery.ts +197 -0
  257. package/dist/builtin/workflows/src/extension/workflow-heartbeat-notice.ts +115 -0
  258. package/dist/builtin/workflows/src/extension/workflow-heartbeat-scheduler.ts +962 -0
  259. package/dist/builtin/workflows/src/extension/workflow-prompts.ts +4 -1
  260. package/dist/builtin/workflows/src/extension/workflow-schema.ts +29 -5
  261. package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +32 -1
  262. package/dist/builtin/workflows/src/runs/background/cancellation-registry.ts +10 -1
  263. package/dist/builtin/workflows/src/runs/background/job-tracker.ts +10 -1
  264. package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +16 -11
  265. package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +31 -1
  266. package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +41 -10
  267. package/dist/builtin/workflows/src/runs/foreground/stage-runner-messages.ts +48 -0
  268. package/dist/builtin/workflows/src/runs/foreground/stage-runner-output.ts +4 -1
  269. package/dist/builtin/workflows/src/runs/foreground/stage-runner-structured-output.ts +45 -12
  270. package/dist/builtin/workflows/src/sdk-surface.ts +9 -0
  271. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +10 -0
  272. package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +10 -0
  273. package/dist/builtin/workflows/src/shared/graph-store-snapshot.ts +14 -2
  274. package/dist/builtin/workflows/src/shared/persistence-restore.ts +12 -0
  275. package/dist/builtin/workflows/src/shared/prompt-answer.ts +130 -0
  276. package/dist/builtin/workflows/src/shared/session-scoped-singleton.ts +98 -0
  277. package/dist/builtin/workflows/src/shared/stage-ui-broker.ts +9 -1
  278. package/dist/builtin/workflows/src/shared/store-factory.ts +9 -1
  279. package/dist/builtin/workflows/src/shared/store-public-types.ts +2 -1
  280. package/dist/builtin/workflows/src/shared/store-tool-node-methods.ts +7 -0
  281. package/dist/builtin/workflows/src/shared/store-types.ts +18 -1
  282. package/dist/builtin/workflows/src/shared/tool-payload-bounds.ts +576 -0
  283. package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +1 -0
  284. package/dist/builtin/workflows/src/shared/workflow-authoring-types.ts +1 -0
  285. package/dist/builtin/workflows/src/shared/workflow-heartbeat-contract.d.ts +21 -0
  286. package/dist/builtin/workflows/src/shared/workflow-heartbeat-contract.ts +25 -0
  287. package/dist/builtin/workflows/src/tui/graph-theme.ts +8 -1
  288. package/dist/builtin/workflows/src/tui/graph-view-constants.ts +11 -0
  289. package/dist/builtin/workflows/src/tui/graph-view-input.ts +100 -5
  290. package/dist/builtin/workflows/src/tui/graph-view-layout.ts +42 -11
  291. package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +55 -6
  292. package/dist/builtin/workflows/src/tui/graph-view-render.ts +71 -6
  293. package/dist/builtin/workflows/src/tui/graph-view-state.ts +43 -0
  294. package/dist/builtin/workflows/src/tui/keybindings-adapter.ts +2 -0
  295. package/dist/builtin/workflows/src/tui/node-card.ts +5 -1
  296. package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +11 -2
  297. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +36 -10
  298. package/dist/builtin/workflows/src/tui/switcher.ts +11 -4
  299. package/dist/builtin/workflows/src/tui/tool-detail.ts +348 -0
  300. package/dist/builtin/workflows/src/tui/workflow-status.ts +5 -2
  301. package/dist/cli/args.d.ts +1 -0
  302. package/dist/cli/args.d.ts.map +1 -1
  303. package/dist/cli/args.js +11 -0
  304. package/dist/cli/args.js.map +1 -1
  305. package/dist/cli/auth-check.d.ts +1 -1
  306. package/dist/cli/auth-check.js.map +1 -1
  307. package/dist/cli/credential-print.d.ts +1 -1
  308. package/dist/cli/credential-print.js.map +1 -1
  309. package/dist/cli/list-models.d.ts +1 -1
  310. package/dist/cli/list-models.js.map +1 -1
  311. package/dist/cli/startup-ui.d.ts +9 -0
  312. package/dist/cli/startup-ui.d.ts.map +1 -1
  313. package/dist/cli/startup-ui.js +7 -1
  314. package/dist/cli/startup-ui.js.map +1 -1
  315. package/dist/core/agent-session-custom-message-commit.js +2 -2
  316. package/dist/core/agent-session-custom-message-commit.js.map +1 -1
  317. package/dist/core/agent-session-export.d.ts +6 -1
  318. package/dist/core/agent-session-export.d.ts.map +1 -1
  319. package/dist/core/agent-session-export.js +6 -3
  320. package/dist/core/agent-session-export.js.map +1 -1
  321. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  322. package/dist/core/agent-session-extension-bindings.js +6 -4
  323. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  324. package/dist/core/agent-session-methods.d.ts +5 -2
  325. package/dist/core/agent-session-methods.d.ts.map +1 -1
  326. package/dist/core/agent-session-methods.js.map +1 -1
  327. package/dist/core/agent-session-prompt.d.ts +12 -1
  328. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  329. package/dist/core/agent-session-prompt.js +31 -10
  330. package/dist/core/agent-session-prompt.js.map +1 -1
  331. package/dist/core/agent-session-runtime-auth.js.map +1 -1
  332. package/dist/core/agent-session-services.d.ts +1 -1
  333. package/dist/core/agent-session-services.js.map +1 -1
  334. package/dist/core/agent-session-skill-block.d.ts +1 -0
  335. package/dist/core/agent-session-skill-block.d.ts.map +1 -1
  336. package/dist/core/agent-session-skill-block.js +18 -2
  337. package/dist/core/agent-session-skill-block.js.map +1 -1
  338. package/dist/core/agent-session-state.d.ts.map +1 -1
  339. package/dist/core/agent-session-state.js +2 -1
  340. package/dist/core/agent-session-state.js.map +1 -1
  341. package/dist/core/agent-session-types.d.ts +2 -1
  342. package/dist/core/agent-session-types.d.ts.map +1 -1
  343. package/dist/core/agent-session-types.js.map +1 -1
  344. package/dist/core/agent-session.d.ts +1 -1
  345. package/dist/core/agent-session.js.map +1 -1
  346. package/dist/core/atomic-guide-command.js +2 -2
  347. package/dist/core/atomic-guide-command.js.map +1 -1
  348. package/dist/core/builtin-packages.d.ts.map +1 -1
  349. package/dist/core/builtin-packages.js +0 -6
  350. package/dist/core/builtin-packages.js.map +1 -1
  351. package/dist/core/cloudflare-gateway-binding.d.ts +11 -0
  352. package/dist/core/cloudflare-gateway-binding.d.ts.map +1 -0
  353. package/dist/core/cloudflare-gateway-binding.js +11 -0
  354. package/dist/core/cloudflare-gateway-binding.js.map +1 -0
  355. package/dist/core/codex-fast-mode-transport.d.ts +12 -0
  356. package/dist/core/codex-fast-mode-transport.d.ts.map +1 -0
  357. package/dist/core/codex-fast-mode-transport.js +130 -0
  358. package/dist/core/codex-fast-mode-transport.js.map +1 -0
  359. package/dist/core/codex-fast-mode.d.ts +20 -6
  360. package/dist/core/codex-fast-mode.d.ts.map +1 -1
  361. package/dist/core/codex-fast-mode.js +111 -3
  362. package/dist/core/codex-fast-mode.js.map +1 -1
  363. package/dist/core/diagnostics.d.ts +4 -0
  364. package/dist/core/diagnostics.d.ts.map +1 -1
  365. package/dist/core/diagnostics.js.map +1 -1
  366. package/dist/core/event-bus.d.ts +12 -0
  367. package/dist/core/event-bus.d.ts.map +1 -1
  368. package/dist/core/event-bus.js +22 -0
  369. package/dist/core/event-bus.js.map +1 -1
  370. package/dist/core/experimental.d.ts +25 -0
  371. package/dist/core/experimental.d.ts.map +1 -1
  372. package/dist/core/experimental.js +24 -0
  373. package/dist/core/experimental.js.map +1 -1
  374. package/dist/core/export-html/template-js/tree-filter-render.js +4 -3
  375. package/dist/core/export-html/template.js +4 -3
  376. package/dist/core/extension-session-state.d.ts +28 -0
  377. package/dist/core/extension-session-state.d.ts.map +1 -0
  378. package/dist/core/extension-session-state.js +55 -0
  379. package/dist/core/extension-session-state.js.map +1 -0
  380. package/dist/core/extensions/api-types.d.ts +6 -0
  381. package/dist/core/extensions/api-types.d.ts.map +1 -1
  382. package/dist/core/extensions/api-types.js.map +1 -1
  383. package/dist/core/extensions/context-types.d.ts +4 -0
  384. package/dist/core/extensions/context-types.d.ts.map +1 -1
  385. package/dist/core/extensions/context-types.js.map +1 -1
  386. package/dist/core/extensions/index.d.ts +1 -0
  387. package/dist/core/extensions/index.d.ts.map +1 -1
  388. package/dist/core/extensions/index.js +1 -0
  389. package/dist/core/extensions/index.js.map +1 -1
  390. package/dist/core/extensions/loader-api.d.ts +1 -1
  391. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  392. package/dist/core/extensions/loader-api.js +16 -10
  393. package/dist/core/extensions/loader-api.js.map +1 -1
  394. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  395. package/dist/core/extensions/loader-virtual-modules.js +12 -1
  396. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  397. package/dist/core/extensions/runner-context.d.ts +2 -0
  398. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  399. package/dist/core/extensions/runner-context.js +8 -0
  400. package/dist/core/extensions/runner-context.js.map +1 -1
  401. package/dist/core/extensions/runner.d.ts +1 -0
  402. package/dist/core/extensions/runner.d.ts.map +1 -1
  403. package/dist/core/extensions/runner.js +3 -0
  404. package/dist/core/extensions/runner.js.map +1 -1
  405. package/dist/core/extensions/runtime-types.d.ts +3 -0
  406. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  407. package/dist/core/extensions/runtime-types.js.map +1 -1
  408. package/dist/core/extensions/ui-types.d.ts +26 -0
  409. package/dist/core/extensions/ui-types.d.ts.map +1 -1
  410. package/dist/core/extensions/ui-types.js +17 -1
  411. package/dist/core/extensions/ui-types.js.map +1 -1
  412. package/dist/core/http-dispatcher.d.ts.map +1 -1
  413. package/dist/core/http-dispatcher.js +5 -0
  414. package/dist/core/http-dispatcher.js.map +1 -1
  415. package/dist/core/keybindings.d.ts +24 -0
  416. package/dist/core/keybindings.d.ts.map +1 -1
  417. package/dist/core/keybindings.js +6 -0
  418. package/dist/core/keybindings.js.map +1 -1
  419. package/dist/core/model-config.d.ts +5 -0
  420. package/dist/core/model-config.d.ts.map +1 -1
  421. package/dist/core/model-config.js +1 -0
  422. package/dist/core/model-config.js.map +1 -1
  423. package/dist/core/model-registry.d.ts +1 -1
  424. package/dist/core/model-registry.js.map +1 -1
  425. package/dist/core/model-resolver-cli.d.ts +1 -1
  426. package/dist/core/model-resolver-cli.js.map +1 -1
  427. package/dist/core/model-resolver-defaults.js +3 -3
  428. package/dist/core/model-resolver-defaults.js.map +1 -1
  429. package/dist/core/model-resolver-initial.d.ts +1 -1
  430. package/dist/core/model-resolver-initial.js.map +1 -1
  431. package/dist/core/model-resolver-scope.d.ts +1 -1
  432. package/dist/core/model-resolver-scope.js.map +1 -1
  433. package/dist/core/model-runtime.d.ts +54 -0
  434. package/dist/core/model-runtime.d.ts.map +1 -1
  435. package/dist/core/model-runtime.js +96 -13
  436. package/dist/core/model-runtime.js.map +1 -1
  437. package/dist/core/oauth-login.js.map +1 -1
  438. package/dist/core/project-trust.d.ts +10 -0
  439. package/dist/core/project-trust.d.ts.map +1 -1
  440. package/dist/core/project-trust.js +12 -0
  441. package/dist/core/project-trust.js.map +1 -1
  442. package/dist/core/resource-loader-assets.d.ts.map +1 -1
  443. package/dist/core/resource-loader-assets.js +14 -5
  444. package/dist/core/resource-loader-assets.js.map +1 -1
  445. package/dist/core/resource-loader-core.d.ts +3 -0
  446. package/dist/core/resource-loader-core.d.ts.map +1 -1
  447. package/dist/core/resource-loader-core.js +5 -0
  448. package/dist/core/resource-loader-core.js.map +1 -1
  449. package/dist/core/resource-loader-internals.d.ts +2 -0
  450. package/dist/core/resource-loader-internals.d.ts.map +1 -1
  451. package/dist/core/resource-loader-internals.js.map +1 -1
  452. package/dist/core/resource-loader-reload.d.ts.map +1 -1
  453. package/dist/core/resource-loader-reload.js +2 -0
  454. package/dist/core/resource-loader-reload.js.map +1 -1
  455. package/dist/core/resource-loader-types.d.ts +2 -0
  456. package/dist/core/resource-loader-types.d.ts.map +1 -1
  457. package/dist/core/resource-loader-types.js.map +1 -1
  458. package/dist/core/resource-loader.d.ts +2 -0
  459. package/dist/core/resource-loader.d.ts.map +1 -1
  460. package/dist/core/resource-loader.js +1 -0
  461. package/dist/core/resource-loader.js.map +1 -1
  462. package/dist/core/sdk-types.d.ts +7 -6
  463. package/dist/core/sdk-types.d.ts.map +1 -1
  464. package/dist/core/sdk-types.js.map +1 -1
  465. package/dist/core/sdk.d.ts.map +1 -1
  466. package/dist/core/sdk.js +17 -6
  467. package/dist/core/sdk.js.map +1 -1
  468. package/dist/core/session-manager-core.d.ts +7 -1
  469. package/dist/core/session-manager-core.d.ts.map +1 -1
  470. package/dist/core/session-manager-core.js +11 -2
  471. package/dist/core/session-manager-core.js.map +1 -1
  472. package/dist/core/session-manager-entries.d.ts +2 -2
  473. package/dist/core/session-manager-entries.d.ts.map +1 -1
  474. package/dist/core/session-manager-entries.js +6 -4
  475. package/dist/core/session-manager-entries.js.map +1 -1
  476. package/dist/core/session-manager-list.d.ts.map +1 -1
  477. package/dist/core/session-manager-list.js +5 -1
  478. package/dist/core/session-manager-list.js.map +1 -1
  479. package/dist/core/session-manager-types.d.ts +25 -2
  480. package/dist/core/session-manager-types.d.ts.map +1 -1
  481. package/dist/core/session-manager-types.js.map +1 -1
  482. package/dist/core/session-manager.d.ts +1 -1
  483. package/dist/core/session-manager.d.ts.map +1 -1
  484. package/dist/core/session-manager.js.map +1 -1
  485. package/dist/core/settings-manager-basic-accessors.d.ts +1 -0
  486. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  487. package/dist/core/settings-manager-basic-accessors.js +8 -0
  488. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  489. package/dist/core/settings-manager-ui-accessors.d.ts +3 -1
  490. package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -1
  491. package/dist/core/settings-manager-ui-accessors.js +9 -0
  492. package/dist/core/settings-manager-ui-accessors.js.map +1 -1
  493. package/dist/core/settings-manager.d.ts +1 -1
  494. package/dist/core/settings-manager.d.ts.map +1 -1
  495. package/dist/core/settings-manager.js.map +1 -1
  496. package/dist/core/settings-types.d.ts +4 -0
  497. package/dist/core/settings-types.d.ts.map +1 -1
  498. package/dist/core/settings-types.js.map +1 -1
  499. package/dist/core/skill-catalog.d.ts +35 -0
  500. package/dist/core/skill-catalog.d.ts.map +1 -0
  501. package/dist/core/skill-catalog.js +264 -0
  502. package/dist/core/skill-catalog.js.map +1 -0
  503. package/dist/core/skills-async.d.ts.map +1 -1
  504. package/dist/core/skills-async.js +12 -6
  505. package/dist/core/skills-async.js.map +1 -1
  506. package/dist/core/skills.d.ts +2 -0
  507. package/dist/core/skills.d.ts.map +1 -1
  508. package/dist/core/skills.js +8 -5
  509. package/dist/core/skills.js.map +1 -1
  510. package/dist/core/slash-commands.d.ts.map +1 -1
  511. package/dist/core/slash-commands.js +1 -5
  512. package/dist/core/slash-commands.js.map +1 -1
  513. package/dist/core/system-prompt.js +2 -2
  514. package/dist/core/system-prompt.js.map +1 -1
  515. package/dist/core/tools/ask-user-question/ask-user-question.d.ts +25 -2
  516. package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
  517. package/dist/core/tools/ask-user-question/ask-user-question.js +47 -18
  518. package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -1
  519. package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts.map +1 -1
  520. package/dist/core/tools/ask-user-question/view/components/multi-select-view.js +5 -2
  521. package/dist/core/tools/ask-user-question/view/components/multi-select-view.js.map +1 -1
  522. package/dist/core/tools/ask-user-question/view/components/submit-picker.d.ts.map +1 -1
  523. package/dist/core/tools/ask-user-question/view/components/submit-picker.js +3 -1
  524. package/dist/core/tools/ask-user-question/view/components/submit-picker.js.map +1 -1
  525. package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts.map +1 -1
  526. package/dist/core/tools/ask-user-question/view/components/wrapping-select.js +8 -1
  527. package/dist/core/tools/ask-user-question/view/components/wrapping-select.js.map +1 -1
  528. package/dist/core/tools/bash.d.ts.map +1 -1
  529. package/dist/core/tools/bash.js +2 -0
  530. package/dist/core/tools/bash.js.map +1 -1
  531. package/dist/core/tools/edit.d.ts.map +1 -1
  532. package/dist/core/tools/edit.js +2 -0
  533. package/dist/core/tools/edit.js.map +1 -1
  534. package/dist/core/tools/find.d.ts.map +1 -1
  535. package/dist/core/tools/find.js +3 -1
  536. package/dist/core/tools/find.js.map +1 -1
  537. package/dist/core/tools/grep.js +1 -1
  538. package/dist/core/tools/grep.js.map +1 -1
  539. package/dist/core/tools/hashline-engine/format.d.ts +2 -0
  540. package/dist/core/tools/hashline-engine/format.d.ts.map +1 -1
  541. package/dist/core/tools/hashline-engine/format.js +4 -2
  542. package/dist/core/tools/hashline-engine/format.js.map +1 -1
  543. package/dist/core/tools/hashline-engine/messages.d.ts +2 -0
  544. package/dist/core/tools/hashline-engine/messages.d.ts.map +1 -1
  545. package/dist/core/tools/hashline-engine/messages.js +4 -2
  546. package/dist/core/tools/hashline-engine/messages.js.map +1 -1
  547. package/dist/core/tools/hashline-engine/parser.d.ts.map +1 -1
  548. package/dist/core/tools/hashline-engine/parser.js +16 -4
  549. package/dist/core/tools/hashline-engine/parser.js.map +1 -1
  550. package/dist/core/tools/hashline-engine/tokenizer.d.ts.map +1 -1
  551. package/dist/core/tools/hashline-engine/tokenizer.js +37 -27
  552. package/dist/core/tools/hashline-engine/tokenizer.js.map +1 -1
  553. package/dist/core/tools/hashline.d.ts.map +1 -1
  554. package/dist/core/tools/hashline.js +8 -2
  555. package/dist/core/tools/hashline.js.map +1 -1
  556. package/dist/core/tools/ls.d.ts.map +1 -1
  557. package/dist/core/tools/ls.js +2 -0
  558. package/dist/core/tools/ls.js.map +1 -1
  559. package/dist/core/tools/read.d.ts.map +1 -1
  560. package/dist/core/tools/read.js +8 -1
  561. package/dist/core/tools/read.js.map +1 -1
  562. package/dist/core/tools/search.d.ts.map +1 -1
  563. package/dist/core/tools/search.js +2 -0
  564. package/dist/core/tools/search.js.map +1 -1
  565. package/dist/core/tools/todos.d.ts +3 -12
  566. package/dist/core/tools/todos.d.ts.map +1 -1
  567. package/dist/core/tools/todos.js +19 -4
  568. package/dist/core/tools/todos.js.map +1 -1
  569. package/dist/core/tools/write.d.ts.map +1 -1
  570. package/dist/core/tools/write.js +2 -0
  571. package/dist/core/tools/write.js.map +1 -1
  572. package/dist/index-extensions.d.ts +1 -1
  573. package/dist/index-extensions.d.ts.map +1 -1
  574. package/dist/index-extensions.js +1 -1
  575. package/dist/index-extensions.js.map +1 -1
  576. package/dist/index.d.ts +8 -5
  577. package/dist/index.d.ts.map +1 -1
  578. package/dist/index.js +6 -2
  579. package/dist/index.js.map +1 -1
  580. package/dist/main-runtime-api-key.d.ts +1 -1
  581. package/dist/main-runtime-api-key.js.map +1 -1
  582. package/dist/main-session-options.d.ts +1 -1
  583. package/dist/main-session-options.js.map +1 -1
  584. package/dist/main.d.ts.map +1 -1
  585. package/dist/main.js +10 -2
  586. package/dist/main.js.map +1 -1
  587. package/dist/modes/interactive/components/chat-session-host-rendering.js +1 -1
  588. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
  589. package/dist/modes/interactive/components/chat-session-host-state.d.ts +8 -0
  590. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  591. package/dist/modes/interactive/components/chat-session-host-state.js +8 -0
  592. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
  593. package/dist/modes/interactive/components/chat-session-host.d.ts +26 -0
  594. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  595. package/dist/modes/interactive/components/chat-session-host.js +38 -0
  596. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  597. package/dist/modes/interactive/components/chat-transcript.d.ts +37 -0
  598. package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
  599. package/dist/modes/interactive/components/chat-transcript.js +54 -1
  600. package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
  601. package/dist/modes/interactive/components/fast-mode-selector.js +1 -1
  602. package/dist/modes/interactive/components/fast-mode-selector.js.map +1 -1
  603. package/dist/modes/interactive/components/model-selector.d.ts +1 -1
  604. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  605. package/dist/modes/interactive/components/model-selector.js +2 -1
  606. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  607. package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
  608. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  609. package/dist/modes/interactive/components/reserved-bottom-overlay.d.ts +95 -0
  610. package/dist/modes/interactive/components/reserved-bottom-overlay.d.ts.map +1 -0
  611. package/dist/modes/interactive/components/reserved-bottom-overlay.js +234 -0
  612. package/dist/modes/interactive/components/reserved-bottom-overlay.js.map +1 -0
  613. package/dist/modes/interactive/components/session-selector-search.d.ts +4 -0
  614. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  615. package/dist/modes/interactive/components/session-selector-search.js +4 -0
  616. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  617. package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
  618. package/dist/modes/interactive/components/settings-selector-handlers.js +3 -0
  619. package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
  620. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
  621. package/dist/modes/interactive/components/settings-selector-items.js +7 -0
  622. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
  623. package/dist/modes/interactive/components/settings-selector-types.d.ts +3 -1
  624. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  625. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  626. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  627. package/dist/modes/interactive/components/tool-execution.js +12 -1
  628. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  629. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  630. package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
  631. package/dist/modes/interactive/interactive-autocomplete.js +5 -4
  632. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  633. package/dist/modes/interactive/interactive-bash-compact.d.ts.map +1 -1
  634. package/dist/modes/interactive/interactive-bash-compact.js +2 -2
  635. package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
  636. package/dist/modes/interactive/interactive-extension-custom-ui.js +94 -6
  637. package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
  638. package/dist/modes/interactive/interactive-mode-base.d.ts +41 -3
  639. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  640. package/dist/modes/interactive/interactive-mode-base.js +80 -11
  641. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  642. package/dist/modes/interactive/interactive-mode-surface.d.ts +9 -1
  643. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  644. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  645. package/dist/modes/interactive/interactive-mode-types.d.ts +2 -0
  646. package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
  647. package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
  648. package/dist/modes/interactive/interactive-model-catalog-startup.d.ts +8 -1
  649. package/dist/modes/interactive/interactive-model-catalog-startup.d.ts.map +1 -1
  650. package/dist/modes/interactive/interactive-model-catalog-startup.js +13 -3
  651. package/dist/modes/interactive/interactive-model-catalog-startup.js.map +1 -1
  652. package/dist/modes/interactive/interactive-model-routing.js +3 -4
  653. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  654. package/dist/modes/interactive/interactive-render-chat.js +6 -0
  655. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  656. package/dist/modes/interactive/interactive-resource-disclosure.js +2 -2
  657. package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -1
  658. package/dist/modes/interactive/interactive-selectors.js +7 -3
  659. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  660. package/dist/modes/interactive/interactive-session-runtime.js +7 -1
  661. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
  662. package/dist/modes/interactive/interactive-slash-commands.js +2 -2
  663. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  664. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  665. package/dist/modes/interactive/interactive-startup.js +34 -9
  666. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  667. package/dist/modes/interactive/interactive-tui.d.ts +21 -1
  668. package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
  669. package/dist/modes/interactive/interactive-tui.js +140 -38
  670. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  671. package/dist/modes/interactive/model-catalog-refresh.d.ts +17 -0
  672. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
  673. package/dist/modes/interactive/model-catalog-refresh.js +84 -0
  674. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
  675. package/dist/modes/interactive/theme/dark.json +2 -0
  676. package/dist/modes/interactive/theme/light.json +2 -0
  677. package/dist/modes/interactive/theme/theme-class.d.ts +12 -3
  678. package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
  679. package/dist/modes/interactive/theme/theme-class.js +6 -1
  680. package/dist/modes/interactive/theme/theme-class.js.map +1 -1
  681. package/dist/modes/interactive/theme/theme-controller.d.ts +10 -2
  682. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  683. package/dist/modes/interactive/theme/theme-controller.js +23 -10
  684. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  685. package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -1
  686. package/dist/modes/interactive/theme/theme-loading.js +1 -0
  687. package/dist/modes/interactive/theme/theme-loading.js.map +1 -1
  688. package/dist/modes/interactive/theme/theme-schema.d.ts +8 -0
  689. package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
  690. package/dist/modes/interactive/theme/theme-schema.js +3 -1
  691. package/dist/modes/interactive/theme/theme-schema.js.map +1 -1
  692. package/dist/modes/interactive/theme/theme-schema.json +9 -1
  693. package/dist/modes/interactive-engine/engine-custom-ui.d.ts +2 -0
  694. package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
  695. package/dist/modes/interactive-engine/engine-custom-ui.js +1 -0
  696. package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
  697. package/dist/modes/interactive-engine/protocol.d.ts +1 -0
  698. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  699. package/dist/modes/interactive-engine/protocol.js +1 -0
  700. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  701. package/dist/modes/interactive-engine/remote-component.d.ts +3 -1
  702. package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
  703. package/dist/modes/interactive-engine/remote-component.js +3 -2
  704. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  705. package/dist/modes/json-event.d.ts +6 -1
  706. package/dist/modes/json-event.d.ts.map +1 -1
  707. package/dist/modes/json-event.js +17 -2
  708. package/dist/modes/json-event.js.map +1 -1
  709. package/dist/modes/rpc/rpc-client.js.map +1 -1
  710. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  711. package/dist/modes/rpc/rpc-command-handler.js +5 -4
  712. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  713. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  714. package/dist/modes/rpc/rpc-responses.js.map +1 -1
  715. package/dist/modes/rpc/rpc-types.d.ts +1 -1
  716. package/dist/modes/rpc/rpc-types.js.map +1 -1
  717. package/dist/package-manager-cli.js.map +1 -1
  718. package/dist/server/create-harness.d.ts.map +1 -1
  719. package/dist/server/create-harness.js +11 -0
  720. package/dist/server/create-harness.js.map +1 -1
  721. package/dist/utils/abort.d.ts +9 -0
  722. package/dist/utils/abort.d.ts.map +1 -0
  723. package/dist/utils/abort.js +19 -0
  724. package/dist/utils/abort.js.map +1 -0
  725. package/dist/utils/tools-manager.d.ts +16 -1
  726. package/dist/utils/tools-manager.d.ts.map +1 -1
  727. package/dist/utils/tools-manager.js +19 -19
  728. package/dist/utils/tools-manager.js.map +1 -1
  729. package/docs/custom-provider.md +9 -8
  730. package/docs/development.md +0 -1
  731. package/docs/docs.json +0 -1
  732. package/docs/environment-variables.md +3 -0
  733. package/docs/extensions.md +100 -2
  734. package/docs/json.md +3 -1
  735. package/docs/keybindings.md +8 -3
  736. package/docs/models/artificial-analysis-index.md +2 -2
  737. package/docs/models/model-selection.md +32 -23
  738. package/docs/models/pareto-efficiency.md +25 -24
  739. package/docs/providers.md +95 -2
  740. package/docs/quickstart.md +4 -2
  741. package/docs/rpc.md +21 -7
  742. package/docs/sdk.md +26 -1
  743. package/docs/session-format.md +5 -2
  744. package/docs/settings.md +34 -3
  745. package/docs/skills.md +16 -1
  746. package/docs/terminal-setup.md +15 -2
  747. package/docs/themes.md +22 -4
  748. package/docs/tools.md +3 -1
  749. package/docs/tui.md +2 -0
  750. package/docs/usage.md +5 -4
  751. package/docs/workflows.md +96 -19
  752. package/npm-shrinkwrap.json +211 -232
  753. package/package.json +8 -8
  754. package/dist/builtin/i-have-adhd/CHANGELOG.md +0 -30
  755. package/dist/builtin/i-have-adhd/LICENSE +0 -21
  756. package/dist/builtin/i-have-adhd/README.md +0 -18
  757. package/dist/builtin/i-have-adhd/index.ts +0 -238
  758. package/dist/builtin/i-have-adhd/package.json +0 -56
  759. package/dist/builtin/i-have-adhd/skills/i-have-adhd/SKILL.md +0 -140
  760. package/dist/builtin/workflows/builtin/open-claude-design-feedback.ts +0 -359
  761. package/dist/builtin/workflows/skills/impeccable/scripts/live/ui-core.mjs +0 -180
  762. package/docs/i-have-adhd.md +0 -36
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-auth-login.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,oBAAoB,EAGpB,IAAI,EACJ,KAAK,GACL,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAExF,mBAAmB,CAAC,SAAS,CAAC,8BAA8B,GAAG,KAAK,WAEnE,UAAkB,EAClB,YAAoB,EACpB,QAA6B,EAC7B,aAAqC,EACrC,OAAO,GAAkC,EAAE;IAE3C,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE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B,MAAM,IAAI,CAAC,8BAA8B,CAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;IAC1G,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACzB,aAAa,EAAE,CAAC;QAChB,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,KAAK,YAAY,8BAA8B,EAAE,CAAC;YACrD,IAAI,CAAC,SAAS,CAAC,gBAAgB,YAAY,sDAAsD,QAAQ,EAAE,CAAC,CAAC;QAC9G,CAAC;aAAM,IAAI,cAAc,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;IACF,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { CredentialSynchronizationError } from \"../../core/model-runtime.ts\";\nimport { isOAuthLoginCancelled } from \"../../core/oauth-login.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Api,\n\tdefaultModelPerProvider,\n\tExtensionSelectorComponent,\n\tgetAuthPath,\n\tgetDocsPath,\n\tLoginDialogComponent,\n\ttype Model,\n\ttype OAuthSelectPrompt,\n\tpath,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport { hasDefaultModelProvider, isUnknownModel } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.completeProviderAuthentication = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tauthType: \"oauth\" | \"api_key\",\n\tpreviousModel: Model<Api> | undefined,\n\toptions: { modelsRefreshed?: boolean } = {},\n): Promise<void> {\n\tif (!options.modelsRefreshed) {\n\t\t// Match pi: after authentication persists the credential, a thrown catalog\n\t\t// refresh failure remains visible to the caller without rolling it back.\n\t\tawait this.session.modelRuntime.refresh();\n\t}\n\n\tconst actionLabel = authType === \"oauth\" ? `Logged in to ${providerName}` : `Saved API key for ${providerName}`;\n\n\tlet selectedModel: Model<Api> | undefined;\n\tlet selectionError: string | undefined;\n\tif (isUnknownModel(previousModel)) {\n\t\tconst availableModels = this.session.modelRuntime.getAvailableSnapshot();\n\t\tconst providerModels = availableModels.filter((model) => model.provider === providerId);\n\t\tif (!hasDefaultModelProvider(providerId)) {\n\t\t\tselectionError = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n\t\t} else if (providerModels.length === 0) {\n\t\t\tselectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\n\t\t} else {\n\t\t\tconst defaultModelId = defaultModelPerProvider[providerId];\n\t\t\tselectedModel = providerModels.find((model) => model.id === defaultModelId);\n\t\t\tif (!selectedModel) {\n\t\t\t\tselectionError = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.session.setModel(selectedModel);\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tselectedModel = undefined;\n\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tselectionError = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tawait this.updateAvailableProviderCount();\n\tthis.setupAutocompleteProvider();\n\tthis.footer.invalidate();\n\tthis.updateEditorBorderColor();\n\tif (selectedModel) {\n\t\tthis.showStatus(`${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`);\n\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n\t\tthis.checkDaxnutsEasterEgg(selectedModel);\n\t} else {\n\t\tthis.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);\n\t\tif (selectionError) {\n\t\t\tthis.showError(selectionError);\n\t\t} else {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth();\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showBedrockSetupDialog = function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): void {\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t() => restoreEditor(),\n\t\tproviderName,\n\t\t\"Amazon Bedrock setup\",\n\t);\n\tdialog.showDetails([\n\t\ttheme.fg(\"text\", \"Amazon Bedrock uses AWS credentials instead of a single API key.\"),\n\t\ttheme.fg(\"text\", \"Configure an AWS profile, IAM keys, bearer token, or role-based credentials.\"),\n\t\ttheme.fg(\"muted\", \"See:\"),\n\t\ttheme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n\t]);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.showApiKeyLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait this.session.modelRuntime.login(providerId, \"api_key\", {\n\t\t\tsignal: dialog.signal,\n\t\t\tprompt: (prompt) =>\n\t\t\t\tdialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined),\n\t\t\tnotify: (event) => {\n\t\t\t\tif (event.type === \"info\") dialog.showInfo(event.message, event.links);\n\t\t\t\telse if (event.type === \"progress\") dialog.showProgress(event.message);\n\t\t\t},\n\t\t});\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"api_key\", previousModel, {\n\t\t\tmodelsRefreshed: true,\n\t\t});\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(\n\t\t\t\t`Saved API key for ${providerName}, but local model state could not be synchronized: ${errorMsg}`,\n\t\t\t);\n\t\t} else if (!isOAuthLoginCancelled(error)) {\n\t\t\tthis.showError(`Failed to save API key for ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showOAuthLoginSelect = function (\n\tthis: InteractiveModeBase,\n\tdialog: LoginDialogComponent,\n\tprompt: OAuthSelectPrompt,\n): Promise<string | undefined> {\n\treturn new Promise((resolve) => {\n\t\tconst restoreDialog = () => {\n\t\t\tthis.editorContainer.clear();\n\t\t\tthis.editorContainer.addChild(dialog);\n\t\t\tthis.ui.setFocus(dialog);\n\t\t\tthis.ui.requestRender();\n\t\t};\n\t\tconst labels = prompt.options.map((option) => option.label);\n\t\tconst selector = new ExtensionSelectorComponent(\n\t\t\tprompt.message,\n\t\t\tlabels,\n\t\t\t(optionLabel) => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(prompt.options.find((option) => option.label === optionLabel)?.id);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(undefined);\n\t\t\t},\n\t\t);\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(selector);\n\t\tthis.ui.setFocus(selector);\n\t\tthis.ui.requestRender();\n\t});\n};\n\nInteractiveModeBase.prototype.showLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\tconst metadata = this.session.modelRuntime?.getOAuthProviderMetadata().find(({ id }) => id === providerId);\n\tconst usesCallbackServer = metadata?.usesCallbackServer === true;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t\tmetadata?.loginLabel,\n\t);\n\n\t// Show dialog in editor container\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\t// Promise for manual code input (racing with callback server)\n\tlet manualCodeResolve: ((code: string) => void) | undefined;\n\tlet manualCodeReject: ((err: Error) => void) | undefined;\n\tconst manualCodePromise = new Promise<string>((resolve, reject) => {\n\t\tmanualCodeResolve = resolve;\n\t\tmanualCodeReject = reject;\n\t});\n\n\t// Restore editor helper\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tlet loginSucceeded = false;\n\ttry {\n\t\tconst loginResult = await this.runtimeHost.loginOAuthProvider(providerId, {\n\t\t\tonAuth: (info: { url: string; instructions?: string }) => {\n\t\t\t\tdialog.showAuth(info.url, info.instructions, {\n\t\t\t\t\tshowCancelHint: !usesCallbackServer,\n\t\t\t\t});\n\n\t\t\t\tif (usesCallbackServer) {\n\t\t\t\t\t// Show input for manual paste, racing with callback\n\t\t\t\t\tdialog\n\t\t\t\t\t\t.showManualInput(\"Paste redirect URL below, or complete login in browser:\")\n\t\t\t\t\t\t.then((value) => {\n\t\t\t\t\t\t\tif (value && manualCodeResolve) {\n\t\t\t\t\t\t\t\tmanualCodeResolve(value);\n\t\t\t\t\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(() => {\n\t\t\t\t\t\t\tif (manualCodeReject) {\n\t\t\t\t\t\t\t\tmanualCodeReject(new Error(\"Login cancelled\"));\n\t\t\t\t\t\t\t\tmanualCodeReject = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// For Anthropic: onPrompt is called immediately after\n\t\t\t},\n\n\t\t\tonDeviceCode: (info) => {\n\t\t\t\tdialog.showDeviceCode(info);\n\t\t\t\tdialog.showWaiting(\"Waiting for authentication...\");\n\t\t\t},\n\n\t\t\tonPrompt: async (prompt: { message: string; placeholder?: string }) => {\n\t\t\t\treturn dialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined);\n\t\t\t},\n\n\t\t\tonProgress: (message: string) => {\n\t\t\t\tdialog.showProgress(message);\n\t\t\t},\n\n\t\t\tonInfo: (message, links) => {\n\t\t\t\tdialog.showInfo(message, links);\n\t\t\t},\n\n\t\t\tonSelect: (prompt: OAuthSelectPrompt) => this.showOAuthLoginSelect(dialog, prompt),\n\n\t\t\tonManualCodeInput: () => manualCodePromise,\n\n\t\t\tonManualCodeCancel: () => {\n\t\t\t\tdialog.dismissPendingInput();\n\t\t\t\tmanualCodeResolve?.(\"\");\n\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\tmanualCodeReject = undefined;\n\t\t\t},\n\n\t\t\tsignal: dialog.signal,\n\t\t});\n\t\tloginSucceeded = true;\n\n\t\t// Success\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"oauth\", previousModel, loginResult);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(`Logged in to ${providerName}, but local model state could not be synchronized: ${errorMsg}`);\n\t\t} else if (loginSucceeded || !isOAuthLoginCancelled(error)) {\n\t\t\tthis.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n};\n"]}
1
+ {"version":3,"file":"interactive-auth-login.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,oBAAoB,EAGpB,IAAI,EACJ,KAAK,GACL,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAExF,mBAAmB,CAAC,SAAS,CAAC,8BAA8B,GAAG,KAAK,WAEnE,UAAkB,EAClB,YAAoB,EACpB,QAA6B,EAC7B,aAAqC,EACrC,OAAO,GAAkC,EAAE;IAE3C,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;QAC9B,2EAA2E;QAC3E,yEAAyE;QACzE,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,WAAW,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,gBAAgB,YAAY,EAAE,CAAC,CAAC,CAAC,qBAAqB,YAAY,EAAE,CAAC;IAEhH,IAAI,aAAqC,CAAC;IAC1C,IAAI,cAAkC,CAAC;IACvC,IAAI,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC;QACnC,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,oBAAoB,EAAE,CAAC;QACzE,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC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AAK,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;IACF,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { CredentialSynchronizationError } from \"../../core/model-runtime.js\";\nimport { isOAuthLoginCancelled } from \"../../core/oauth-login.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Api,\n\tdefaultModelPerProvider,\n\tExtensionSelectorComponent,\n\tgetAuthPath,\n\tgetDocsPath,\n\tLoginDialogComponent,\n\ttype Model,\n\ttype OAuthSelectPrompt,\n\tpath,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport { hasDefaultModelProvider, isUnknownModel } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.completeProviderAuthentication = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n\tauthType: \"oauth\" | \"api_key\",\n\tpreviousModel: Model<Api> | undefined,\n\toptions: { modelsRefreshed?: boolean } = {},\n): Promise<void> {\n\tif (!options.modelsRefreshed) {\n\t\t// Match pi: after authentication persists the credential, a thrown catalog\n\t\t// refresh failure remains visible to the caller without rolling it back.\n\t\tawait this.session.modelRuntime.refresh();\n\t}\n\n\tconst actionLabel = authType === \"oauth\" ? `Logged in to ${providerName}` : `Saved API key for ${providerName}`;\n\n\tlet selectedModel: Model<Api> | undefined;\n\tlet selectionError: string | undefined;\n\tif (isUnknownModel(previousModel)) {\n\t\tconst availableModels = this.session.modelRuntime.getAvailableSnapshot();\n\t\tconst providerModels = availableModels.filter((model) => model.provider === providerId);\n\t\tif (!hasDefaultModelProvider(providerId)) {\n\t\t\tselectionError = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n\t\t} else if (providerModels.length === 0) {\n\t\t\tselectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\n\t\t} else {\n\t\t\tconst defaultModelId = defaultModelPerProvider[providerId];\n\t\t\tselectedModel = providerModels.find((model) => model.id === defaultModelId);\n\t\t\tif (!selectedModel) {\n\t\t\t\tselectionError = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.session.setModel(selectedModel);\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tselectedModel = undefined;\n\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tselectionError = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tawait this.updateAvailableProviderCount();\n\tthis.setupAutocompleteProvider();\n\tthis.footer.invalidate();\n\tthis.updateEditorBorderColor();\n\tif (selectedModel) {\n\t\tthis.showStatus(`${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`);\n\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n\t\tthis.checkDaxnutsEasterEgg(selectedModel);\n\t} else {\n\t\tthis.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);\n\t\tif (selectionError) {\n\t\t\tthis.showError(selectionError);\n\t\t} else {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth();\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showBedrockSetupDialog = function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): void {\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t() => restoreEditor(),\n\t\tproviderName,\n\t\t\"Amazon Bedrock setup\",\n\t);\n\tdialog.showDetails([\n\t\ttheme.fg(\"text\", \"Amazon Bedrock uses AWS credentials instead of a single API key.\"),\n\t\ttheme.fg(\"text\", \"Configure an AWS profile, IAM keys, bearer token, or role-based credentials.\"),\n\t\ttheme.fg(\"muted\", \"See:\"),\n\t\ttheme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n\t]);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.showApiKeyLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t);\n\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait this.session.modelRuntime.login(providerId, \"api_key\", {\n\t\t\tsignal: dialog.signal,\n\t\t\tprompt: (prompt) =>\n\t\t\t\tdialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined),\n\t\t\tnotify: (event) => {\n\t\t\t\tif (event.type === \"info\") dialog.showInfo(event.message, event.links);\n\t\t\t\telse if (event.type === \"progress\") dialog.showProgress(event.message);\n\t\t\t},\n\t\t});\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"api_key\", previousModel, {\n\t\t\tmodelsRefreshed: true,\n\t\t});\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(\n\t\t\t\t`Saved API key for ${providerName}, but local model state could not be synchronized: ${errorMsg}`,\n\t\t\t);\n\t\t} else if (!isOAuthLoginCancelled(error)) {\n\t\t\tthis.showError(`Failed to save API key for ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.showOAuthLoginSelect = function (\n\tthis: InteractiveModeBase,\n\tdialog: LoginDialogComponent,\n\tprompt: OAuthSelectPrompt,\n): Promise<string | undefined> {\n\treturn new Promise((resolve) => {\n\t\tconst restoreDialog = () => {\n\t\t\tthis.editorContainer.clear();\n\t\t\tthis.editorContainer.addChild(dialog);\n\t\t\tthis.ui.setFocus(dialog);\n\t\t\tthis.ui.requestRender();\n\t\t};\n\t\tconst labels = prompt.options.map((option) => option.label);\n\t\tconst selector = new ExtensionSelectorComponent(\n\t\t\tprompt.message,\n\t\t\tlabels,\n\t\t\t(optionLabel) => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(prompt.options.find((option) => option.label === optionLabel)?.id);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\trestoreDialog();\n\t\t\t\tresolve(undefined);\n\t\t\t},\n\t\t);\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(selector);\n\t\tthis.ui.setFocus(selector);\n\t\tthis.ui.requestRender();\n\t});\n};\n\nInteractiveModeBase.prototype.showLoginDialog = async function (\n\tthis: InteractiveModeBase,\n\tproviderId: string,\n\tproviderName: string,\n): Promise<void> {\n\tconst previousModel = this.session.model;\n\tconst metadata = this.session.modelRuntime?.getOAuthProviderMetadata().find(({ id }) => id === providerId);\n\tconst usesCallbackServer = metadata?.usesCallbackServer === true;\n\n\tconst dialog = new LoginDialogComponent(\n\t\tthis.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t\tmetadata?.loginLabel,\n\t);\n\n\t// Show dialog in editor container\n\tthis.editorContainer.clear();\n\tthis.editorContainer.addChild(dialog);\n\tthis.ui.setFocus(dialog);\n\tthis.ui.requestRender();\n\n\t// Promise for manual code input (racing with callback server)\n\tlet manualCodeResolve: ((code: string) => void) | undefined;\n\tlet manualCodeReject: ((err: Error) => void) | undefined;\n\tconst manualCodePromise = new Promise<string>((resolve, reject) => {\n\t\tmanualCodeResolve = resolve;\n\t\tmanualCodeReject = reject;\n\t});\n\n\t// Restore editor helper\n\tconst restoreEditor = () => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\tlet loginSucceeded = false;\n\ttry {\n\t\tconst loginResult = await this.runtimeHost.loginOAuthProvider(providerId, {\n\t\t\tonAuth: (info: { url: string; instructions?: string }) => {\n\t\t\t\tdialog.showAuth(info.url, info.instructions, {\n\t\t\t\t\tshowCancelHint: !usesCallbackServer,\n\t\t\t\t});\n\n\t\t\t\tif (usesCallbackServer) {\n\t\t\t\t\t// Show input for manual paste, racing with callback\n\t\t\t\t\tdialog\n\t\t\t\t\t\t.showManualInput(\"Paste redirect URL below, or complete login in browser:\")\n\t\t\t\t\t\t.then((value) => {\n\t\t\t\t\t\t\tif (value && manualCodeResolve) {\n\t\t\t\t\t\t\t\tmanualCodeResolve(value);\n\t\t\t\t\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(() => {\n\t\t\t\t\t\t\tif (manualCodeReject) {\n\t\t\t\t\t\t\t\tmanualCodeReject(new Error(\"Login cancelled\"));\n\t\t\t\t\t\t\t\tmanualCodeReject = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// For Anthropic: onPrompt is called immediately after\n\t\t\t},\n\n\t\t\tonDeviceCode: (info) => {\n\t\t\t\tdialog.showDeviceCode(info);\n\t\t\t\tdialog.showWaiting(\"Waiting for authentication...\");\n\t\t\t},\n\n\t\t\tonPrompt: async (prompt: { message: string; placeholder?: string }) => {\n\t\t\t\treturn dialog.showPrompt(prompt.message, \"placeholder\" in prompt ? prompt.placeholder : undefined);\n\t\t\t},\n\n\t\t\tonProgress: (message: string) => {\n\t\t\t\tdialog.showProgress(message);\n\t\t\t},\n\n\t\t\tonInfo: (message, links) => {\n\t\t\t\tdialog.showInfo(message, links);\n\t\t\t},\n\n\t\t\tonSelect: (prompt: OAuthSelectPrompt) => this.showOAuthLoginSelect(dialog, prompt),\n\n\t\t\tonManualCodeInput: () => manualCodePromise,\n\n\t\t\tonManualCodeCancel: () => {\n\t\t\t\tdialog.dismissPendingInput();\n\t\t\t\tmanualCodeResolve?.(\"\");\n\t\t\t\tmanualCodeResolve = undefined;\n\t\t\t\tmanualCodeReject = undefined;\n\t\t\t},\n\n\t\t\tsignal: dialog.signal,\n\t\t});\n\t\tloginSucceeded = true;\n\n\t\t// Success\n\t\trestoreEditor();\n\t\tawait this.completeProviderAuthentication(providerId, providerName, \"oauth\", previousModel, loginResult);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\tthis.showError(`Logged in to ${providerName}, but local model state could not be synchronized: ${errorMsg}`);\n\t\t} else if (loginSucceeded || !isOAuthLoginCancelled(error)) {\n\t\t\tthis.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-auth-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,0BAA0B,EAC1B,sBAAsB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAA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c,CAAC,EAAE,CAAC,CAAC;gBACxE,MAAM,IAAI,CAAC,4BAA4B,EAAE,CAAC;gBAC1C,IAAI,CAAC,yBAAyB,EAAE,CAAC;gBACjC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;YACtG,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACzB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvE,IAAI,CAAC,SAAS,CACb,KAAK,YAAY,8BAA8B;oBAC9C,CAAC,CAAC,2BAA2B,cAAc,CAAC,IAAI,sDAAsD,OAAO,EAAE;oBAC/G,CAAC,CAAC,kBAAkB,OAAO,EAAE,CAC9B,CAAC;YACH,CAAC;QACF,CAAC,EACD,GAAG,EAAE;YACJ,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC,CACD,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { builtinProviders } from \"@earendil-works/pi-ai/providers/all\";\nimport { CredentialSynchronizationError } from \"../../core/model-runtime.ts\";\nimport type { AuthStatus } from \"../../core/provider-composer.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AuthSelectorProvider,\n\tExtensionSelectorComponent,\n\tOAuthSelectorComponent,\n} from \"./interactive-mode-deps.ts\";\nimport { BEDROCK_PROVIDER_ID } from \"./interactive-mode-helpers.ts\";\nimport { resolveLoginProviderReference } from \"./login-provider-options.ts\";\n\nexport function formatLogoutStatus(\n\tproviderName: string,\n\tauthType: \"oauth\" | \"api_key\",\n\tauthStatus: AuthStatus,\n): string {\n\tconst action = authType === \"oauth\" ? `Logged out of ${providerName}` : `Removed stored API key for ${providerName}`;\n\treturn authStatus.source\n\t\t? `${action}. Authentication remains active through ${authStatus.label ?? authStatus.source}.`\n\t\t: action;\n}\n\nexport function getBuiltinApiKeyLoginOptions(getDisplayName: (providerId: string) => string): AuthSelectorProvider[] {\n\treturn builtinProviders()\n\t\t.filter((provider) => provider.auth.apiKey !== undefined)\n\t\t.map((provider) => ({\n\t\t\tid: provider.id,\n\t\t\tname: getDisplayName(provider.id),\n\t\t\tauthType: \"api_key\" as const,\n\t\t}));\n}\n\nInteractiveModeBase.prototype.getLoginProviderOptions = function (\n\tthis: InteractiveModeBase,\n\tauthType?: \"oauth\" | \"api_key\",\n): AuthSelectorProvider[] {\n\tconst options: AuthSelectorProvider[] = this.session.modelRuntime\n\t\t.getOAuthProviderMetadata()\n\t\t.map((provider) => ({ id: provider.id, name: provider.name, authType: \"oauth\" as const }));\n\tfor (const provider of this.session.modelRuntime.getProviders()) {\n\t\tif (provider.auth.apiKey)\n\t\t\toptions.push({ id: provider.id, name: provider.name ?? provider.id, authType: \"api_key\" });\n\t}\n\treturn (authType ? options.filter((option) => option.authType === authType) : options).sort((a, b) =>\n\t\ta.name.localeCompare(b.name),\n\t);\n};\nInteractiveModeBase.prototype.getLogoutProviderOptions = function (this: InteractiveModeBase): AuthSelectorProvider[] {\n\tconst runtime = this.session.modelRuntime;\n\tconst providers = runtime.getProviders();\n\tconst providerNames = new Map(providers.map((provider) => [provider.id, provider.name ?? provider.id]));\n\tfor (const provider of runtime.getOAuthProviderMetadata()) providerNames.set(provider.id, provider.name);\n\tconst options: AuthSelectorProvider[] = [];\n\tfor (const [providerId, name] of providerNames) {\n\t\tif (runtime.getProviderAuthStatus(providerId).source !== \"stored\") continue;\n\t\tconst authType = runtime.getStoredCredentialType(providerId);\n\t\tif (authType) options.push({ id: providerId, name, authType });\n\t}\n\treturn options.sort((a, b) => a.name.localeCompare(b.name));\n};\n\nInteractiveModeBase.prototype.startProviderLogin = async function (\n\tthis: InteractiveModeBase,\n\tproviderOption: AuthSelectorProvider,\n): Promise<void> {\n\tif (providerOption.authType === \"oauth\") {\n\t\tawait this.showLoginDialog(providerOption.id, providerOption.name);\n\t} else if (providerOption.id === BEDROCK_PROVIDER_ID) {\n\t\tthis.showBedrockSetupDialog(providerOption.id, providerOption.name);\n\t} else {\n\t\tawait this.showApiKeyLoginDialog(providerOption.id, providerOption.name);\n\t}\n};\n\nInteractiveModeBase.prototype.handleLoginCommand = async function (\n\tthis: InteractiveModeBase,\n\tproviderRef?: string,\n): Promise<void> {\n\tif (!providerRef?.trim()) {\n\t\tthis.showLoginAuthTypeSelector();\n\t\treturn;\n\t}\n\tconst resolution = resolveLoginProviderReference(this.getLoginProviderOptions(), providerRef);\n\tif (resolution.kind === \"direct\") {\n\t\tawait this.startProviderLogin(resolution.option);\n\t} else if (resolution.kind === \"choose_method\") {\n\t\tthis.showLoginAuthTypeSelector(resolution.options);\n\t} else {\n\t\tthis.showLoginProviderSelector(undefined, resolution.initialSearch);\n\t}\n};\n\nInteractiveModeBase.prototype.showLoginAuthTypeSelector = function (\n\tthis: InteractiveModeBase,\n\tproviderOptions?: AuthSelectorProvider[],\n): void {\n\tconst subscriptionLabel = \"Use a subscription\";\n\tconst apiKeyLabel = \"Use an API key\";\n\tconst choices = providerOptions\n\t\t? providerOptions.map((provider) => (provider.authType === \"oauth\" ? subscriptionLabel : apiKeyLabel))\n\t\t: [subscriptionLabel, apiKeyLabel];\n\tthis.showSelector((done) => {\n\t\tconst selector = new ExtensionSelectorComponent(\n\t\t\t\"Select authentication method:\",\n\t\t\tchoices,\n\t\t\t(option) => {\n\t\t\t\tdone();\n\t\t\t\tconst authType = option === subscriptionLabel ? \"oauth\" : \"api_key\";\n\t\t\t\tconst directOption = providerOptions?.find((provider) => provider.authType === authType);\n\t\t\t\tif (directOption) void this.startProviderLogin(directOption);\n\t\t\t\telse this.showLoginProviderSelector(authType);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n};\n\nInteractiveModeBase.prototype.showLoginProviderSelector = function (\n\tthis: InteractiveModeBase,\n\tauthType?: \"oauth\" | \"api_key\",\n\tinitialSearchInput?: string,\n): void {\n\tconst providerOptions = this.getLoginProviderOptions(authType);\n\tif (providerOptions.length === 0) {\n\t\tconst message =\n\t\t\tauthType === \"oauth\"\n\t\t\t\t? \"No subscription providers available.\"\n\t\t\t\t: authType === \"api_key\"\n\t\t\t\t\t? \"No API key providers available.\"\n\t\t\t\t\t: \"No login providers available.\";\n\t\tthis.showStatus(message);\n\t\treturn;\n\t}\n\n\tthis.showSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\t\"login\",\n\t\t\tthis.session.modelRuntime,\n\t\t\tproviderOptions,\n\t\t\tasync (providerId, selectedAuthType) => {\n\t\t\t\tdone();\n\t\t\t\tconst providerOption = providerOptions.find(\n\t\t\t\t\t(provider) => provider.id === providerId && provider.authType === selectedAuthType,\n\t\t\t\t);\n\t\t\t\tif (providerOption) await this.startProviderLogin(providerOption);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tif (authType) this.showLoginAuthTypeSelector();\n\t\t\t\telse this.ui.requestRender();\n\t\t\t},\n\t\t\t(providerId) => this.session.modelRuntime.getProviderAuthStatus(providerId),\n\t\t\tinitialSearchInput,\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n};\n\nInteractiveModeBase.prototype.showOAuthSelector = async function (\n\tthis: InteractiveModeBase,\n\tmode: \"login\" | \"logout\",\n): Promise<void> {\n\tif (mode === \"login\") {\n\t\tthis.showLoginAuthTypeSelector();\n\t\treturn;\n\t}\n\tconst providerOptions = this.getLogoutProviderOptions();\n\tif (providerOptions.length === 0) {\n\t\tthis.showStatus(\n\t\t\t\"No stored credentials to remove. /logout only removes credentials saved by /login; environment variables and models.json config are unchanged.\",\n\t\t);\n\t\treturn;\n\t}\n\tthis.showSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\tmode,\n\t\t\tthis.session.modelRuntime,\n\t\t\tproviderOptions,\n\t\t\tasync (providerId, selectedAuthType) => {\n\t\t\t\tdone();\n\t\t\t\tconst providerOption = providerOptions.find(\n\t\t\t\t\t(provider) => provider.id === providerId && provider.authType === selectedAuthType,\n\t\t\t\t);\n\t\t\t\tif (!providerOption) return;\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await this.runtimeHost.logoutProvider(providerOption.id);\n\t\t\t\t\tawait this.updateAvailableProviderCount();\n\t\t\t\t\tthis.setupAutocompleteProvider();\n\t\t\t\t\tthis.showStatus(formatLogoutStatus(providerOption.name, providerOption.authType, result.authStatus));\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tthis.showError(\n\t\t\t\t\t\terror instanceof CredentialSynchronizationError\n\t\t\t\t\t\t\t? `Credentials removed for ${providerOption.name}, but local model state could not be synchronized: ${message}`\n\t\t\t\t\t\t\t: `Logout failed: ${message}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n};\n"]}
1
+ {"version":3,"file":"interactive-auth-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,0BAA0B,EAC1B,sBAAsB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,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EAAE,CAAC,CAAC;gBACxE,MAAM,IAAI,CAAC,4BAA4B,EAAE,CAAC;gBAC1C,IAAI,CAAC,yBAAyB,EAAE,CAAC;gBACjC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;YACtG,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACzB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvE,IAAI,CAAC,SAAS,CACb,KAAK,YAAY,8BAA8B;oBAC9C,CAAC,CAAC,2BAA2B,cAAc,CAAC,IAAI,sDAAsD,OAAO,EAAE;oBAC/G,CAAC,CAAC,kBAAkB,OAAO,EAAE,CAC9B,CAAC;YACH,CAAC;QACF,CAAC,EACD,GAAG,EAAE;YACJ,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC,CACD,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { builtinProviders } from \"@earendil-works/pi-ai/providers/all\";\nimport { CredentialSynchronizationError } from \"../../core/model-runtime.js\";\nimport type { AuthStatus } from \"../../core/provider-composer.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AuthSelectorProvider,\n\tExtensionSelectorComponent,\n\tOAuthSelectorComponent,\n} from \"./interactive-mode-deps.ts\";\nimport { BEDROCK_PROVIDER_ID } from \"./interactive-mode-helpers.ts\";\nimport { resolveLoginProviderReference } from \"./login-provider-options.ts\";\n\nexport function formatLogoutStatus(\n\tproviderName: string,\n\tauthType: \"oauth\" | \"api_key\",\n\tauthStatus: AuthStatus,\n): string {\n\tconst action = authType === \"oauth\" ? `Logged out of ${providerName}` : `Removed stored API key for ${providerName}`;\n\treturn authStatus.source\n\t\t? `${action}. Authentication remains active through ${authStatus.label ?? authStatus.source}.`\n\t\t: action;\n}\n\nexport function getBuiltinApiKeyLoginOptions(getDisplayName: (providerId: string) => string): AuthSelectorProvider[] {\n\treturn builtinProviders()\n\t\t.filter((provider) => provider.auth.apiKey !== undefined)\n\t\t.map((provider) => ({\n\t\t\tid: provider.id,\n\t\t\tname: getDisplayName(provider.id),\n\t\t\tauthType: \"api_key\" as const,\n\t\t}));\n}\n\nInteractiveModeBase.prototype.getLoginProviderOptions = function (\n\tthis: InteractiveModeBase,\n\tauthType?: \"oauth\" | \"api_key\",\n): AuthSelectorProvider[] {\n\tconst options: AuthSelectorProvider[] = this.session.modelRuntime\n\t\t.getOAuthProviderMetadata()\n\t\t.map((provider) => ({ id: provider.id, name: provider.name, authType: \"oauth\" as const }));\n\tfor (const provider of this.session.modelRuntime.getProviders()) {\n\t\tif (provider.auth.apiKey)\n\t\t\toptions.push({ id: provider.id, name: provider.name ?? provider.id, authType: \"api_key\" });\n\t}\n\treturn (authType ? options.filter((option) => option.authType === authType) : options).sort((a, b) =>\n\t\ta.name.localeCompare(b.name),\n\t);\n};\nInteractiveModeBase.prototype.getLogoutProviderOptions = function (this: InteractiveModeBase): AuthSelectorProvider[] {\n\tconst runtime = this.session.modelRuntime;\n\tconst providers = runtime.getProviders();\n\tconst providerNames = new Map(providers.map((provider) => [provider.id, provider.name ?? provider.id]));\n\tfor (const provider of runtime.getOAuthProviderMetadata()) providerNames.set(provider.id, provider.name);\n\tconst options: AuthSelectorProvider[] = [];\n\tfor (const [providerId, name] of providerNames) {\n\t\tif (runtime.getProviderAuthStatus(providerId).source !== \"stored\") continue;\n\t\tconst authType = runtime.getStoredCredentialType(providerId);\n\t\tif (authType) options.push({ id: providerId, name, authType });\n\t}\n\treturn options.sort((a, b) => a.name.localeCompare(b.name));\n};\n\nInteractiveModeBase.prototype.startProviderLogin = async function (\n\tthis: InteractiveModeBase,\n\tproviderOption: AuthSelectorProvider,\n): Promise<void> {\n\tif (providerOption.authType === \"oauth\") {\n\t\tawait this.showLoginDialog(providerOption.id, providerOption.name);\n\t} else if (providerOption.id === BEDROCK_PROVIDER_ID) {\n\t\tthis.showBedrockSetupDialog(providerOption.id, providerOption.name);\n\t} else {\n\t\tawait this.showApiKeyLoginDialog(providerOption.id, providerOption.name);\n\t}\n};\n\nInteractiveModeBase.prototype.handleLoginCommand = async function (\n\tthis: InteractiveModeBase,\n\tproviderRef?: string,\n): Promise<void> {\n\tif (!providerRef?.trim()) {\n\t\tthis.showLoginAuthTypeSelector();\n\t\treturn;\n\t}\n\tconst resolution = resolveLoginProviderReference(this.getLoginProviderOptions(), providerRef);\n\tif (resolution.kind === \"direct\") {\n\t\tawait this.startProviderLogin(resolution.option);\n\t} else if (resolution.kind === \"choose_method\") {\n\t\tthis.showLoginAuthTypeSelector(resolution.options);\n\t} else {\n\t\tthis.showLoginProviderSelector(undefined, resolution.initialSearch);\n\t}\n};\n\nInteractiveModeBase.prototype.showLoginAuthTypeSelector = function (\n\tthis: InteractiveModeBase,\n\tproviderOptions?: AuthSelectorProvider[],\n): void {\n\tconst subscriptionLabel = \"Use a subscription\";\n\tconst apiKeyLabel = \"Use an API key\";\n\tconst choices = providerOptions\n\t\t? providerOptions.map((provider) => (provider.authType === \"oauth\" ? subscriptionLabel : apiKeyLabel))\n\t\t: [subscriptionLabel, apiKeyLabel];\n\tthis.showSelector((done) => {\n\t\tconst selector = new ExtensionSelectorComponent(\n\t\t\t\"Select authentication method:\",\n\t\t\tchoices,\n\t\t\t(option) => {\n\t\t\t\tdone();\n\t\t\t\tconst authType = option === subscriptionLabel ? \"oauth\" : \"api_key\";\n\t\t\t\tconst directOption = providerOptions?.find((provider) => provider.authType === authType);\n\t\t\t\tif (directOption) void this.startProviderLogin(directOption);\n\t\t\t\telse this.showLoginProviderSelector(authType);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n};\n\nInteractiveModeBase.prototype.showLoginProviderSelector = function (\n\tthis: InteractiveModeBase,\n\tauthType?: \"oauth\" | \"api_key\",\n\tinitialSearchInput?: string,\n): void {\n\tconst providerOptions = this.getLoginProviderOptions(authType);\n\tif (providerOptions.length === 0) {\n\t\tconst message =\n\t\t\tauthType === \"oauth\"\n\t\t\t\t? \"No subscription providers available.\"\n\t\t\t\t: authType === \"api_key\"\n\t\t\t\t\t? \"No API key providers available.\"\n\t\t\t\t\t: \"No login providers available.\";\n\t\tthis.showStatus(message);\n\t\treturn;\n\t}\n\n\tthis.showSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\t\"login\",\n\t\t\tthis.session.modelRuntime,\n\t\t\tproviderOptions,\n\t\t\tasync (providerId, selectedAuthType) => {\n\t\t\t\tdone();\n\t\t\t\tconst providerOption = providerOptions.find(\n\t\t\t\t\t(provider) => provider.id === providerId && provider.authType === selectedAuthType,\n\t\t\t\t);\n\t\t\t\tif (providerOption) await this.startProviderLogin(providerOption);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tif (authType) this.showLoginAuthTypeSelector();\n\t\t\t\telse this.ui.requestRender();\n\t\t\t},\n\t\t\t(providerId) => this.session.modelRuntime.getProviderAuthStatus(providerId),\n\t\t\tinitialSearchInput,\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n};\n\nInteractiveModeBase.prototype.showOAuthSelector = async function (\n\tthis: InteractiveModeBase,\n\tmode: \"login\" | \"logout\",\n): Promise<void> {\n\tif (mode === \"login\") {\n\t\tthis.showLoginAuthTypeSelector();\n\t\treturn;\n\t}\n\tconst providerOptions = this.getLogoutProviderOptions();\n\tif (providerOptions.length === 0) {\n\t\tthis.showStatus(\n\t\t\t\"No stored credentials to remove. /logout only removes credentials saved by /login; environment variables and models.json config are unchanged.\",\n\t\t);\n\t\treturn;\n\t}\n\tthis.showSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\tmode,\n\t\t\tthis.session.modelRuntime,\n\t\t\tproviderOptions,\n\t\t\tasync (providerId, selectedAuthType) => {\n\t\t\t\tdone();\n\t\t\t\tconst providerOption = providerOptions.find(\n\t\t\t\t\t(provider) => provider.id === providerId && provider.authType === selectedAuthType,\n\t\t\t\t);\n\t\t\t\tif (!providerOption) return;\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await this.runtimeHost.logoutProvider(providerOption.id);\n\t\t\t\t\tawait this.updateAvailableProviderCount();\n\t\t\t\t\tthis.setupAutocompleteProvider();\n\t\t\t\t\tthis.showStatus(formatLogoutStatus(providerOption.name, providerOption.authType, result.authStatus));\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tthis.showError(\n\t\t\t\t\t\terror instanceof CredentialSynchronizationError\n\t\t\t\t\t\t\t? `Credentials removed for ${providerOption.name}, but local model state could not be synchronized: ${message}`\n\t\t\t\t\t\t\t: `Logout failed: ${message}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n};\n"]}
@@ -1,3 +1,4 @@
1
+ import { getSkillCatalog } from "../../core/skill-catalog.js";
1
2
  import { getInteractiveEngineRemoteCommandCompletions, getInteractiveEngineRemoteCommands, } from "../interactive-engine/extension-ui-bridge.js";
2
3
  import { InteractiveModeBase } from "./interactive-mode-base.js";
3
4
  import { BUILTIN_SLASH_COMMANDS, BUNDLED_EXTENSION_SLASH_COMMANDS, CombinedAutocompleteProvider, fuzzyFilter, getModelSearchText, hasSupportedCodexFastModeModel, parseGitUrl, } from "./interactive-mode-deps.js";
@@ -241,12 +242,12 @@ InteractiveModeBase.prototype.createBaseAutocompleteProvider = function () {
241
242
  this.skillCommands.clear();
242
243
  const skillCommandList = [];
243
244
  if (this.settingsManager.getEnableSkillCommands()) {
244
- for (const skill of this.session.resourceLoader.getSkills().skills) {
245
- const commandName = `skill:${skill.name}`;
246
- this.skillCommands.set(commandName, skill.filePath);
245
+ for (const command of getSkillCatalog(this.session.resourceLoader).commands) {
246
+ const commandName = `skill:${command.name}`;
247
+ this.skillCommands.set(commandName, command.skill.filePath);
247
248
  skillCommandList.push({
248
249
  name: commandName,
249
- description: this.prefixAutocompleteDescription(skill.description, skill.sourceInfo),
250
+ description: this.prefixAutocompleteDescription(command.description, command.sourceInfo),
250
251
  });
251
252
  }
252
253
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-autocomplete.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,4CAA4C,EAC5C,kCAAkC,GAClC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAKN,sBAAsB,EACtB,gCAAgC,EAChC,4BAA4B,EAE5B,WAAW,EACX,kBAAkB,EAClB,8BAA8B,EAE9B,WAAW,GAIX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEvE,SAAS,0BAA0B,CAAC,IAAY;IAC/C,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1D,IAAI,0BAA0B,CAAC,GAAG,CAAC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A6E;IAC7E,0EAA0E;IAC1E,4EAA4E;IAC5E,yEAAyE;IACzE,yEAAyE;IACzE,qBAAqB;IACrB,MAAM,iBAAiB,GAAG,IAAI,CAAC,wBAAwB,CAAC;QACvD,GAAG,aAAa;QAChB,GAAG,gBAAgB;QACnB,GAAG,iBAAiB;QACpB,GAAG,gBAAgB;KACnB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG;QAChB,GAAG,aAAa;QAChB,GAAG,gBAAgB;QACnB,GAAG,iBAAiB;QACpB,GAAG,gBAAgB;QACnB,GAAG,iBAAiB;KACpB,CAAC;IACF,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;IACzC,OAAO,IAAI,qCAAqC,CAC/C,IAAI,4BAA4B,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,EAC5D,IAAI,4BAA4B,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,CACrD,CAAC;AACH,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,yBAAyB,GAAG;IACzD,IAAI,QAAQ,GAAG,IAAI,CAAC,8BAA8B,EAAE,CAAC;IACrD,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAC9D,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,oBAAoB,GAAG,QAAQ,CAAC;IACrC,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;AACF,CAAC,CAAC","sourcesContent":["import {\n\tgetInteractiveEngineRemoteCommandCompletions,\n\tgetInteractiveEngineRemoteCommands,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Api,\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tBUILTIN_SLASH_COMMANDS,\n\tBUNDLED_EXTENSION_SLASH_COMMANDS,\n\tCombinedAutocompleteProvider,\n\ttype ExtensionRunner,\n\tfuzzyFilter,\n\tgetModelSearchText,\n\thasSupportedCodexFastModeModel,\n\ttype Model,\n\tparseGitUrl,\n\ttype ResourceDiagnostic,\n\ttype SlashCommand,\n\ttype SourceInfo,\n} from \"./interactive-mode-deps.ts\";\nimport { BUILTIN_SLASH_COMMAND_NAMES } from \"./interactive-mode-helpers.ts\";\nimport { getLoginProviderCompletions } from \"./login-provider-options.ts\";\n\nconst AT_MENTION_PATH_DELIMITERS = new Set([\" \", \"\\t\", '\"', \"'\", \"=\"]);\n\nfunction findLastAtMentionDelimiter(text: string): number {\n\tfor (let index = text.length - 1; index >= 0; index -= 1) {\n\t\tif (AT_MENTION_PATH_DELIMITERS.has(text[index] ?? \"\")) return index;\n\t}\n\treturn -1;\n}\n\nfunction isAtMentionTokenStart(text: string, index: number): boolean {\n\treturn index === 0 || AT_MENTION_PATH_DELIMITERS.has(text[index - 1] ?? \"\");\n}\n\nfunction findUnclosedAtMentionQuoteStart(text: string): number | null {\n\tlet quoteStart = -1;\n\tlet inQuotes = false;\n\tfor (let index = 0; index < text.length; index += 1) {\n\t\tif (text[index] === '\"') {\n\t\t\tinQuotes = !inQuotes;\n\t\t\tif (inQuotes) quoteStart = index;\n\t\t}\n\t}\n\treturn inQuotes ? quoteStart : null;\n}\n\nfunction extractAtMentionPrefix(textBeforeCursor: string): string | null {\n\tconst quoteStart = findUnclosedAtMentionQuoteStart(textBeforeCursor);\n\tif (quoteStart !== null && quoteStart > 0 && textBeforeCursor[quoteStart - 1] === \"@\") {\n\t\treturn isAtMentionTokenStart(textBeforeCursor, quoteStart - 1) ? textBeforeCursor.slice(quoteStart - 1) : null;\n\t}\n\tconst lastDelimiterIndex = findLastAtMentionDelimiter(textBeforeCursor);\n\tconst tokenStart = lastDelimiterIndex === -1 ? 0 : lastDelimiterIndex + 1;\n\treturn textBeforeCursor[tokenStart] === \"@\" ? textBeforeCursor.slice(tokenStart) : null;\n}\n\nfunction atMentionPrefixToPathPrefix(atPrefix: string): string {\n\treturn atPrefix.startsWith('@\"') ? `\"${atPrefix.slice(2)}` : atPrefix.slice(1);\n}\n\nfunction toAtMentionCompletion(item: AutocompleteItem): AutocompleteItem {\n\treturn {\n\t\t...item,\n\t\tvalue: item.value.startsWith(\"@\") ? item.value : `@${item.value}`,\n\t};\n}\n\nclass AtMentionFallbackAutocompleteProvider implements AutocompleteProvider {\n\tprivate readonly primary: AutocompleteProvider;\n\tprivate readonly pathFallback: AutocompleteProvider;\n\n\tconstructor(primary: AutocompleteProvider, pathFallback: AutocompleteProvider) {\n\t\tthis.primary = primary;\n\t\tthis.pathFallback = pathFallback;\n\t}\n\n\tasync getSuggestions(\n\t\tlines: string[],\n\t\tcursorLine: number,\n\t\tcursorCol: number,\n\t\toptions: { signal: AbortSignal; force?: boolean },\n\t): Promise<AutocompleteSuggestions | null> {\n\t\tconst primarySuggestions = await this.primary.getSuggestions(lines, cursorLine, cursorCol, options);\n\t\tif (primarySuggestions || options.signal.aborted) return primarySuggestions;\n\n\t\tconst currentLine = lines[cursorLine] ?? \"\";\n\t\tconst textBeforeCursor = currentLine.slice(0, cursorCol);\n\t\tconst atPrefix = extractAtMentionPrefix(textBeforeCursor);\n\t\tif (!atPrefix) return null;\n\n\t\tconst pathPrefix = atMentionPrefixToPathPrefix(atPrefix);\n\t\tconst prefixStart = cursorCol - atPrefix.length;\n\t\tconst fallbackLines = [...lines];\n\t\tfallbackLines[cursorLine] = `${currentLine.slice(0, prefixStart)}${pathPrefix}${currentLine.slice(cursorCol)}`;\n\t\tconst fallbackSuggestions = await this.pathFallback.getSuggestions(\n\t\t\tfallbackLines,\n\t\t\tcursorLine,\n\t\t\tprefixStart + pathPrefix.length,\n\t\t\t{ ...options, force: true },\n\t\t);\n\t\tif (!fallbackSuggestions) return null;\n\n\t\treturn {\n\t\t\tprefix: atPrefix,\n\t\t\titems: fallbackSuggestions.items.map(toAtMentionCompletion),\n\t\t};\n\t}\n\n\tapplyCompletion(\n\t\tlines: string[],\n\t\tcursorLine: number,\n\t\tcursorCol: number,\n\t\titem: AutocompleteItem,\n\t\tprefix: string,\n\t): { lines: string[]; cursorLine: number; cursorCol: number } {\n\t\treturn this.primary.applyCompletion(lines, cursorLine, cursorCol, item, prefix);\n\t}\n\n\tshouldTriggerFileCompletion(lines: string[], cursorLine: number, cursorCol: number): boolean {\n\t\treturn this.primary.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;\n\t}\n}\n\nInteractiveModeBase.prototype.getAutocompleteSourceTag = function (\n\tthis: InteractiveModeBase,\n\tsourceInfo?: SourceInfo,\n): string | undefined {\n\tif (!sourceInfo) {\n\t\treturn undefined;\n\t}\n\n\tconst scopePrefix = sourceInfo.scope === \"user\" ? \"u\" : sourceInfo.scope === \"project\" ? \"p\" : \"t\";\n\tconst source = sourceInfo.source.trim();\n\n\tif (source === \"auto\" || source === \"local\" || source === \"cli\") {\n\t\treturn scopePrefix;\n\t}\n\n\tif (source.startsWith(\"npm:\")) {\n\t\treturn `${scopePrefix}:${source}`;\n\t}\n\n\tconst gitSource = parseGitUrl(source);\n\tif (gitSource) {\n\t\tconst ref = gitSource.ref ? `@${gitSource.ref}` : \"\";\n\t\treturn `${scopePrefix}:git:${gitSource.host}/${gitSource.path}${ref}`;\n\t}\n\n\treturn scopePrefix;\n};\n\nInteractiveModeBase.prototype.prefixAutocompleteDescription = function (\n\tthis: InteractiveModeBase,\n\tdescription: string | undefined,\n\tsourceInfo?: SourceInfo,\n): string | undefined {\n\tconst sourceTag = this.getAutocompleteSourceTag(sourceInfo);\n\tif (!sourceTag) {\n\t\treturn description;\n\t}\n\treturn description ? `[${sourceTag}] ${description}` : `[${sourceTag}]`;\n};\n\nInteractiveModeBase.prototype.getBuiltInCommandConflictDiagnostics = function (\n\tthis: InteractiveModeBase,\n\textensionRunner: ExtensionRunner,\n): ResourceDiagnostic[] {\n\treturn extensionRunner\n\t\t.getRegisteredCommands()\n\t\t.filter((command) => BUILTIN_SLASH_COMMAND_NAMES.has(command.name))\n\t\t.map((command) => ({\n\t\t\ttype: \"warning\" as const,\n\t\t\tmessage:\n\t\t\t\tcommand.invocationName === command.name\n\t\t\t\t\t? `Extension command '/${command.name}' conflicts with built-in interactive command. Skipping in autocomplete.`\n\t\t\t\t\t: `Extension command '/${command.name}' conflicts with built-in interactive command. Available as '/${command.invocationName}'.`,\n\t\t\tpath: command.sourceInfo.path,\n\t\t}));\n};\n\nInteractiveModeBase.prototype.getCodexFastModeCandidateModels = function (this: InteractiveModeBase): Model<Api>[] {\n\tif (this.session.scopedModels.length > 0) {\n\t\treturn this.session.scopedModels\n\t\t\t.map((scoped) => scoped.model)\n\t\t\t.filter((model) => this.session.modelRuntime.hasConfiguredAuth(model.provider));\n\t}\n\n\treturn [...this.session.modelRuntime.getAvailableSnapshot()];\n};\n\nInteractiveModeBase.prototype.hasCodexFastModeSupportedModels = function (this: InteractiveModeBase): boolean {\n\treturn hasSupportedCodexFastModeModel(this.getCodexFastModeCandidateModels());\n};\n\nInteractiveModeBase.prototype.buildRemoteSlashCommands = function (\n\tthis: InteractiveModeBase,\n\tlocalCommands: SlashCommand[],\n): SlashCommand[] {\n\tconst remote = getInteractiveEngineRemoteCommands(this.runtimeHost);\n\tif (remote.length === 0) return [];\n\n\t// Names already present locally (built-ins, prompt templates, skills) win, so\n\t// the child catalog only contributes commands the host is genuinely missing.\n\tconst takenNames = new Set<string>(localCommands.map((command) => command.name));\n\tconst skillCommandsEnabled = this.settingsManager.getEnableSkillCommands();\n\t// Reuse bundled argument-completion providers (e.g. /workflow subcommands and\n\t// input schemas) for their matching child commands; RPC cannot serialize the\n\t// completion callbacks themselves.\n\tconst bundledArgumentCompletions = new Map(\n\t\tBUNDLED_EXTENSION_SLASH_COMMANDS.map((command) => [command.name, command.getArgumentCompletions] as const),\n\t);\n\n\tconst remoteCommands: SlashCommand[] = [];\n\tfor (const command of remote) {\n\t\t// Built-in interactive command names stay reserved regardless of source.\n\t\tif (BUILTIN_SLASH_COMMAND_NAMES.has(command.name)) continue;\n\t\t// Honor the skill-commands setting for child-provided skills too.\n\t\tif (command.source === \"skill\" && !skillCommandsEnabled) continue;\n\t\tif (takenNames.has(command.name)) continue;\n\t\ttakenNames.add(command.name);\n\t\tconst bundledCompletions = bundledArgumentCompletions.get(command.name);\n\t\tconst getArgumentCompletions = command.hasArgumentCompletions\n\t\t\t? async (prefix: string): Promise<AutocompleteItem[] | null> => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn await getInteractiveEngineRemoteCommandCompletions(this.runtimeHost, command.name, prefix);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn (await bundledCompletions?.(prefix)) ?? null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: bundledCompletions;\n\t\tremoteCommands.push({\n\t\t\tname: command.name,\n\t\t\tdescription: this.prefixAutocompleteDescription(command.description, command.sourceInfo),\n\t\t\t...(getArgumentCompletions ? { getArgumentCompletions } : {}),\n\t\t});\n\t}\n\treturn remoteCommands;\n};\n\nInteractiveModeBase.prototype.createBaseAutocompleteProvider = function (\n\tthis: InteractiveModeBase,\n): AutocompleteProvider {\n\t// Define commands for autocomplete\n\tconst slashCommands: SlashCommand[] = BUILTIN_SLASH_COMMANDS.filter(\n\t\t(command) => command.name !== \"fast\" || this.hasCodexFastModeSupportedModels(),\n\t).map((command) => ({\n\t\tname: command.name,\n\t\targumentHint: command.argumentHint,\n\t\tdescription: command.description,\n\t\tgetArgumentCompletions: command.getArgumentCompletions,\n\t}));\n\n\tconst modelCommand = slashCommands.find((command) => command.name === \"model\");\n\tif (modelCommand) {\n\t\tmodelCommand.getArgumentCompletions = (prefix: string): AutocompleteItem[] | null => {\n\t\t\t// Get available models (scoped or from registry)\n\t\t\tconst models =\n\t\t\t\tthis.session.scopedModels.length > 0\n\t\t\t\t\t? this.session.scopedModels.map((s) => s.model)\n\t\t\t\t\t: this.session.modelRuntime.getAvailableSnapshot();\n\n\t\t\tif (models.length === 0) return null;\n\n\t\t\t// Create items with provider/id format\n\t\t\tconst items = models.map((m) => ({\n\t\t\t\tid: m.id,\n\t\t\t\tprovider: m.provider,\n\t\t\t\tname: m.name,\n\t\t\t\tlabel: `${m.provider}/${m.id}`,\n\t\t\t}));\n\n\t\t\t// Fuzzy filter by model ID + provider in either order.\n\t\t\tconst filtered = fuzzyFilter(items, prefix, getModelSearchText);\n\n\t\t\tif (filtered.length === 0) return null;\n\n\t\t\treturn filtered.map((item) => ({\n\t\t\t\tvalue: item.label,\n\t\t\t\tlabel: item.id,\n\t\t\t\tdescription: item.provider,\n\t\t\t}));\n\t\t};\n\t}\n\n\tconst loginCommand = slashCommands.find((command) => command.name === \"login\");\n\tif (loginCommand) {\n\t\tloginCommand.getArgumentCompletions = (prefix: string) =>\n\t\t\tgetLoginProviderCompletions(this.getLoginProviderOptions(), prefix);\n\t}\n\n\t// Convert prompt templates to SlashCommand format for autocomplete\n\tconst templateCommands: SlashCommand[] = this.session.promptTemplates.map((cmd) => ({\n\t\tname: cmd.name,\n\t\tdescription: this.prefixAutocompleteDescription(cmd.description, cmd.sourceInfo),\n\t\t...(cmd.argumentHint && { argumentHint: cmd.argumentHint }),\n\t}));\n\n\t// Convert extension commands to SlashCommand format. Built-in command names\n\t// stay reserved even when a built-in is contextually hidden (for example,\n\t// /fast without a supported OpenAI model) so extension visibility cannot\n\t// change as auth/model state changes. While extension loading is deferred,\n\t// expose lightweight bundled command metadata without importing heavy\n\t// implementations; the submit path loads the implementation on demand.\n\tconst registeredExtensionCommands = this.session.extensionRunner\n\t\t.getRegisteredCommands()\n\t\t.filter((cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name));\n\tconst registeredNames = new Set(registeredExtensionCommands.map((cmd) => cmd.invocationName));\n\tconst extensionCommands: SlashCommand[] = [\n\t\t...(this.deferredStartupPending\n\t\t\t? BUNDLED_EXTENSION_SLASH_COMMANDS.filter(\n\t\t\t\t\t(cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name) && !registeredNames.has(cmd.name),\n\t\t\t\t).map((cmd) => ({\n\t\t\t\t\tname: cmd.name,\n\t\t\t\t\tdescription: cmd.description,\n\t\t\t\t\tgetArgumentCompletions: cmd.getArgumentCompletions,\n\t\t\t\t}))\n\t\t\t: []),\n\t\t...registeredExtensionCommands.map((cmd) => ({\n\t\t\tname: cmd.invocationName,\n\t\t\tdescription: this.prefixAutocompleteDescription(cmd.description, cmd.sourceInfo),\n\t\t\tgetArgumentCompletions: cmd.getArgumentCompletions,\n\t\t})),\n\t];\n\n\t// Build skill commands from session.skills (if enabled)\n\tthis.skillCommands.clear();\n\tconst skillCommandList: SlashCommand[] = [];\n\tif (this.settingsManager.getEnableSkillCommands()) {\n\t\tfor (const skill of this.session.resourceLoader.getSkills().skills) {\n\t\t\tconst commandName = `skill:${skill.name}`;\n\t\t\tthis.skillCommands.set(commandName, skill.filePath);\n\t\t\tskillCommandList.push({\n\t\t\t\tname: commandName,\n\t\t\t\tdescription: this.prefixAutocompleteDescription(skill.description, skill.sourceInfo),\n\t\t\t});\n\t\t}\n\t}\n\n\t// In the isolated interactive host (isolateInteractiveHost) the host session\n\t// loads no extensions, so extension slash commands (/workflow, /workflows,\n\t// /run, /mcp, …) exist only in the engine child. Merge the child's command\n\t// catalog — fetched asynchronously after engine bind — so autocomplete lists\n\t// them. Built-in names stay reserved and anything already present locally\n\t// (built-ins, prompt templates, skills the host also loaded) is deduped, so\n\t// only genuinely engine-only commands are added. Execution keeps routing\n\t// through the child via the patched session.prompt(); nothing is handled\n\t// twice on the host.\n\tconst remoteCommandList = this.buildRemoteSlashCommands([\n\t\t...slashCommands,\n\t\t...templateCommands,\n\t\t...extensionCommands,\n\t\t...skillCommandList,\n\t]);\n\n\tconst commands = [\n\t\t...slashCommands,\n\t\t...templateCommands,\n\t\t...extensionCommands,\n\t\t...skillCommandList,\n\t\t...remoteCommandList,\n\t];\n\tconst cwd = this.sessionManager.getCwd();\n\treturn new AtMentionFallbackAutocompleteProvider(\n\t\tnew CombinedAutocompleteProvider(commands, cwd, this.fdPath),\n\t\tnew CombinedAutocompleteProvider(commands, cwd, null),\n\t);\n};\n\nInteractiveModeBase.prototype.setupAutocompleteProvider = function (this: InteractiveModeBase): void {\n\tlet provider = this.createBaseAutocompleteProvider();\n\tfor (const wrapProvider of this.autocompleteProviderWrappers) {\n\t\tprovider = wrapProvider(provider);\n\t}\n\n\tthis.autocompleteProvider = provider;\n\tthis.defaultEditor.setAutocompleteProvider(provider);\n\tif (this.editor !== this.defaultEditor) {\n\t\tthis.editor.setAutocompleteProvider?.(provider);\n\t}\n};\n"]}
1
+ {"version":3,"file":"interactive-autocomplete.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACN,4CAA4C,EAC5C,kCAAkC,GAClC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAKN,sBAAsB,EACtB,gCAAgC,EAChC,4BAA4B,EAE5B,WAAW,EACX,kBAAkB,EAClB,8BAA8B,EAE9B,WAAW,GAIX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEvE,SAAS,0BAA0B,CAAC,IAAY;IAC/C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AC,uBAAuB,EAAE,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { getSkillCatalog } from \"../../core/skill-catalog.ts\";\nimport {\n\tgetInteractiveEngineRemoteCommandCompletions,\n\tgetInteractiveEngineRemoteCommands,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Api,\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tBUILTIN_SLASH_COMMANDS,\n\tBUNDLED_EXTENSION_SLASH_COMMANDS,\n\tCombinedAutocompleteProvider,\n\ttype ExtensionRunner,\n\tfuzzyFilter,\n\tgetModelSearchText,\n\thasSupportedCodexFastModeModel,\n\ttype Model,\n\tparseGitUrl,\n\ttype ResourceDiagnostic,\n\ttype SlashCommand,\n\ttype SourceInfo,\n} from \"./interactive-mode-deps.ts\";\nimport { BUILTIN_SLASH_COMMAND_NAMES } from \"./interactive-mode-helpers.ts\";\nimport { getLoginProviderCompletions } from \"./login-provider-options.ts\";\n\nconst AT_MENTION_PATH_DELIMITERS = new Set([\" \", \"\\t\", '\"', \"'\", \"=\"]);\n\nfunction findLastAtMentionDelimiter(text: string): number {\n\tfor (let index = text.length - 1; index >= 0; index -= 1) {\n\t\tif (AT_MENTION_PATH_DELIMITERS.has(text[index] ?? \"\")) return index;\n\t}\n\treturn -1;\n}\n\nfunction isAtMentionTokenStart(text: string, index: number): boolean {\n\treturn index === 0 || AT_MENTION_PATH_DELIMITERS.has(text[index - 1] ?? \"\");\n}\n\nfunction findUnclosedAtMentionQuoteStart(text: string): number | null {\n\tlet quoteStart = -1;\n\tlet inQuotes = false;\n\tfor (let index = 0; index < text.length; index += 1) {\n\t\tif (text[index] === '\"') {\n\t\t\tinQuotes = !inQuotes;\n\t\t\tif (inQuotes) quoteStart = index;\n\t\t}\n\t}\n\treturn inQuotes ? quoteStart : null;\n}\n\nfunction extractAtMentionPrefix(textBeforeCursor: string): string | null {\n\tconst quoteStart = findUnclosedAtMentionQuoteStart(textBeforeCursor);\n\tif (quoteStart !== null && quoteStart > 0 && textBeforeCursor[quoteStart - 1] === \"@\") {\n\t\treturn isAtMentionTokenStart(textBeforeCursor, quoteStart - 1) ? textBeforeCursor.slice(quoteStart - 1) : null;\n\t}\n\tconst lastDelimiterIndex = findLastAtMentionDelimiter(textBeforeCursor);\n\tconst tokenStart = lastDelimiterIndex === -1 ? 0 : lastDelimiterIndex + 1;\n\treturn textBeforeCursor[tokenStart] === \"@\" ? textBeforeCursor.slice(tokenStart) : null;\n}\n\nfunction atMentionPrefixToPathPrefix(atPrefix: string): string {\n\treturn atPrefix.startsWith('@\"') ? `\"${atPrefix.slice(2)}` : atPrefix.slice(1);\n}\n\nfunction toAtMentionCompletion(item: AutocompleteItem): AutocompleteItem {\n\treturn {\n\t\t...item,\n\t\tvalue: item.value.startsWith(\"@\") ? item.value : `@${item.value}`,\n\t};\n}\n\nclass AtMentionFallbackAutocompleteProvider implements AutocompleteProvider {\n\tprivate readonly primary: AutocompleteProvider;\n\tprivate readonly pathFallback: AutocompleteProvider;\n\n\tconstructor(primary: AutocompleteProvider, pathFallback: AutocompleteProvider) {\n\t\tthis.primary = primary;\n\t\tthis.pathFallback = pathFallback;\n\t}\n\n\tasync getSuggestions(\n\t\tlines: string[],\n\t\tcursorLine: number,\n\t\tcursorCol: number,\n\t\toptions: { signal: AbortSignal; force?: boolean },\n\t): Promise<AutocompleteSuggestions | null> {\n\t\tconst primarySuggestions = await this.primary.getSuggestions(lines, cursorLine, cursorCol, options);\n\t\tif (primarySuggestions || options.signal.aborted) return primarySuggestions;\n\n\t\tconst currentLine = lines[cursorLine] ?? \"\";\n\t\tconst textBeforeCursor = currentLine.slice(0, cursorCol);\n\t\tconst atPrefix = extractAtMentionPrefix(textBeforeCursor);\n\t\tif (!atPrefix) return null;\n\n\t\tconst pathPrefix = atMentionPrefixToPathPrefix(atPrefix);\n\t\tconst prefixStart = cursorCol - atPrefix.length;\n\t\tconst fallbackLines = [...lines];\n\t\tfallbackLines[cursorLine] = `${currentLine.slice(0, prefixStart)}${pathPrefix}${currentLine.slice(cursorCol)}`;\n\t\tconst fallbackSuggestions = await this.pathFallback.getSuggestions(\n\t\t\tfallbackLines,\n\t\t\tcursorLine,\n\t\t\tprefixStart + pathPrefix.length,\n\t\t\t{ ...options, force: true },\n\t\t);\n\t\tif (!fallbackSuggestions) return null;\n\n\t\treturn {\n\t\t\tprefix: atPrefix,\n\t\t\titems: fallbackSuggestions.items.map(toAtMentionCompletion),\n\t\t};\n\t}\n\n\tapplyCompletion(\n\t\tlines: string[],\n\t\tcursorLine: number,\n\t\tcursorCol: number,\n\t\titem: AutocompleteItem,\n\t\tprefix: string,\n\t): { lines: string[]; cursorLine: number; cursorCol: number } {\n\t\treturn this.primary.applyCompletion(lines, cursorLine, cursorCol, item, prefix);\n\t}\n\n\tshouldTriggerFileCompletion(lines: string[], cursorLine: number, cursorCol: number): boolean {\n\t\treturn this.primary.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;\n\t}\n}\n\nInteractiveModeBase.prototype.getAutocompleteSourceTag = function (\n\tthis: InteractiveModeBase,\n\tsourceInfo?: SourceInfo,\n): string | undefined {\n\tif (!sourceInfo) {\n\t\treturn undefined;\n\t}\n\n\tconst scopePrefix = sourceInfo.scope === \"user\" ? \"u\" : sourceInfo.scope === \"project\" ? \"p\" : \"t\";\n\tconst source = sourceInfo.source.trim();\n\n\tif (source === \"auto\" || source === \"local\" || source === \"cli\") {\n\t\treturn scopePrefix;\n\t}\n\n\tif (source.startsWith(\"npm:\")) {\n\t\treturn `${scopePrefix}:${source}`;\n\t}\n\n\tconst gitSource = parseGitUrl(source);\n\tif (gitSource) {\n\t\tconst ref = gitSource.ref ? `@${gitSource.ref}` : \"\";\n\t\treturn `${scopePrefix}:git:${gitSource.host}/${gitSource.path}${ref}`;\n\t}\n\n\treturn scopePrefix;\n};\n\nInteractiveModeBase.prototype.prefixAutocompleteDescription = function (\n\tthis: InteractiveModeBase,\n\tdescription: string | undefined,\n\tsourceInfo?: SourceInfo,\n): string | undefined {\n\tconst sourceTag = this.getAutocompleteSourceTag(sourceInfo);\n\tif (!sourceTag) {\n\t\treturn description;\n\t}\n\treturn description ? `[${sourceTag}] ${description}` : `[${sourceTag}]`;\n};\n\nInteractiveModeBase.prototype.getBuiltInCommandConflictDiagnostics = function (\n\tthis: InteractiveModeBase,\n\textensionRunner: ExtensionRunner,\n): ResourceDiagnostic[] {\n\treturn extensionRunner\n\t\t.getRegisteredCommands()\n\t\t.filter((command) => BUILTIN_SLASH_COMMAND_NAMES.has(command.name))\n\t\t.map((command) => ({\n\t\t\ttype: \"warning\" as const,\n\t\t\tmessage:\n\t\t\t\tcommand.invocationName === command.name\n\t\t\t\t\t? `Extension command '/${command.name}' conflicts with built-in interactive command. Skipping in autocomplete.`\n\t\t\t\t\t: `Extension command '/${command.name}' conflicts with built-in interactive command. Available as '/${command.invocationName}'.`,\n\t\t\tpath: command.sourceInfo.path,\n\t\t}));\n};\n\nInteractiveModeBase.prototype.getCodexFastModeCandidateModels = function (this: InteractiveModeBase): Model<Api>[] {\n\tif (this.session.scopedModels.length > 0) {\n\t\treturn this.session.scopedModels\n\t\t\t.map((scoped) => scoped.model)\n\t\t\t.filter((model) => this.session.modelRuntime.hasConfiguredAuth(model.provider));\n\t}\n\n\treturn [...this.session.modelRuntime.getAvailableSnapshot()];\n};\n\nInteractiveModeBase.prototype.hasCodexFastModeSupportedModels = function (this: InteractiveModeBase): boolean {\n\treturn hasSupportedCodexFastModeModel(this.getCodexFastModeCandidateModels());\n};\n\nInteractiveModeBase.prototype.buildRemoteSlashCommands = function (\n\tthis: InteractiveModeBase,\n\tlocalCommands: SlashCommand[],\n): SlashCommand[] {\n\tconst remote = getInteractiveEngineRemoteCommands(this.runtimeHost);\n\tif (remote.length === 0) return [];\n\n\t// Names already present locally (built-ins, prompt templates, skills) win, so\n\t// the child catalog only contributes commands the host is genuinely missing.\n\tconst takenNames = new Set<string>(localCommands.map((command) => command.name));\n\tconst skillCommandsEnabled = this.settingsManager.getEnableSkillCommands();\n\t// Reuse bundled argument-completion providers (e.g. /workflow subcommands and\n\t// input schemas) for their matching child commands; RPC cannot serialize the\n\t// completion callbacks themselves.\n\tconst bundledArgumentCompletions = new Map(\n\t\tBUNDLED_EXTENSION_SLASH_COMMANDS.map((command) => [command.name, command.getArgumentCompletions] as const),\n\t);\n\n\tconst remoteCommands: SlashCommand[] = [];\n\tfor (const command of remote) {\n\t\t// Built-in interactive command names stay reserved regardless of source.\n\t\tif (BUILTIN_SLASH_COMMAND_NAMES.has(command.name)) continue;\n\t\t// Honor the skill-commands setting for child-provided skills too.\n\t\tif (command.source === \"skill\" && !skillCommandsEnabled) continue;\n\t\tif (takenNames.has(command.name)) continue;\n\t\ttakenNames.add(command.name);\n\t\tconst bundledCompletions = bundledArgumentCompletions.get(command.name);\n\t\tconst getArgumentCompletions = command.hasArgumentCompletions\n\t\t\t? async (prefix: string): Promise<AutocompleteItem[] | null> => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn await getInteractiveEngineRemoteCommandCompletions(this.runtimeHost, command.name, prefix);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn (await bundledCompletions?.(prefix)) ?? null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: bundledCompletions;\n\t\tremoteCommands.push({\n\t\t\tname: command.name,\n\t\t\tdescription: this.prefixAutocompleteDescription(command.description, command.sourceInfo),\n\t\t\t...(getArgumentCompletions ? { getArgumentCompletions } : {}),\n\t\t});\n\t}\n\treturn remoteCommands;\n};\n\nInteractiveModeBase.prototype.createBaseAutocompleteProvider = function (\n\tthis: InteractiveModeBase,\n): AutocompleteProvider {\n\t// Define commands for autocomplete\n\tconst slashCommands: SlashCommand[] = BUILTIN_SLASH_COMMANDS.filter(\n\t\t(command) => command.name !== \"fast\" || this.hasCodexFastModeSupportedModels(),\n\t).map((command) => ({\n\t\tname: command.name,\n\t\targumentHint: command.argumentHint,\n\t\tdescription: command.description,\n\t\tgetArgumentCompletions: command.getArgumentCompletions,\n\t}));\n\n\tconst modelCommand = slashCommands.find((command) => command.name === \"model\");\n\tif (modelCommand) {\n\t\tmodelCommand.getArgumentCompletions = (prefix: string): AutocompleteItem[] | null => {\n\t\t\t// Get available models (scoped or from registry)\n\t\t\tconst models =\n\t\t\t\tthis.session.scopedModels.length > 0\n\t\t\t\t\t? this.session.scopedModels.map((s) => s.model)\n\t\t\t\t\t: this.session.modelRuntime.getAvailableSnapshot();\n\n\t\t\tif (models.length === 0) return null;\n\n\t\t\t// Create items with provider/id format\n\t\t\tconst items = models.map((m) => ({\n\t\t\t\tid: m.id,\n\t\t\t\tprovider: m.provider,\n\t\t\t\tname: m.name,\n\t\t\t\tlabel: `${m.provider}/${m.id}`,\n\t\t\t}));\n\n\t\t\t// Fuzzy filter by model ID + provider in either order.\n\t\t\tconst filtered = fuzzyFilter(items, prefix, getModelSearchText);\n\n\t\t\tif (filtered.length === 0) return null;\n\n\t\t\treturn filtered.map((item) => ({\n\t\t\t\tvalue: item.label,\n\t\t\t\tlabel: item.id,\n\t\t\t\tdescription: item.provider,\n\t\t\t}));\n\t\t};\n\t}\n\n\tconst loginCommand = slashCommands.find((command) => command.name === \"login\");\n\tif (loginCommand) {\n\t\tloginCommand.getArgumentCompletions = (prefix: string) =>\n\t\t\tgetLoginProviderCompletions(this.getLoginProviderOptions(), prefix);\n\t}\n\n\t// Convert prompt templates to SlashCommand format for autocomplete\n\tconst templateCommands: SlashCommand[] = this.session.promptTemplates.map((cmd) => ({\n\t\tname: cmd.name,\n\t\tdescription: this.prefixAutocompleteDescription(cmd.description, cmd.sourceInfo),\n\t\t...(cmd.argumentHint && { argumentHint: cmd.argumentHint }),\n\t}));\n\n\t// Convert extension commands to SlashCommand format. Built-in command names\n\t// stay reserved even when a built-in is contextually hidden (for example,\n\t// /fast without a supported OpenAI model) so extension visibility cannot\n\t// change as auth/model state changes. While extension loading is deferred,\n\t// expose lightweight bundled command metadata without importing heavy\n\t// implementations; the submit path loads the implementation on demand.\n\tconst registeredExtensionCommands = this.session.extensionRunner\n\t\t.getRegisteredCommands()\n\t\t.filter((cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name));\n\tconst registeredNames = new Set(registeredExtensionCommands.map((cmd) => cmd.invocationName));\n\tconst extensionCommands: SlashCommand[] = [\n\t\t...(this.deferredStartupPending\n\t\t\t? BUNDLED_EXTENSION_SLASH_COMMANDS.filter(\n\t\t\t\t\t(cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name) && !registeredNames.has(cmd.name),\n\t\t\t\t).map((cmd) => ({\n\t\t\t\t\tname: cmd.name,\n\t\t\t\t\tdescription: cmd.description,\n\t\t\t\t\tgetArgumentCompletions: cmd.getArgumentCompletions,\n\t\t\t\t}))\n\t\t\t: []),\n\t\t...registeredExtensionCommands.map((cmd) => ({\n\t\t\tname: cmd.invocationName,\n\t\t\tdescription: this.prefixAutocompleteDescription(cmd.description, cmd.sourceInfo),\n\t\t\tgetArgumentCompletions: cmd.getArgumentCompletions,\n\t\t})),\n\t];\n\n\t// Build skill commands from session.skills (if enabled)\n\tthis.skillCommands.clear();\n\tconst skillCommandList: SlashCommand[] = [];\n\tif (this.settingsManager.getEnableSkillCommands()) {\n\t\tfor (const command of getSkillCatalog(this.session.resourceLoader).commands) {\n\t\t\tconst commandName = `skill:${command.name}`;\n\t\t\tthis.skillCommands.set(commandName, command.skill.filePath);\n\t\t\tskillCommandList.push({\n\t\t\t\tname: commandName,\n\t\t\t\tdescription: this.prefixAutocompleteDescription(command.description, command.sourceInfo),\n\t\t\t});\n\t\t}\n\t}\n\n\t// In the isolated interactive host (isolateInteractiveHost) the host session\n\t// loads no extensions, so extension slash commands (/workflow, /workflows,\n\t// /run, /mcp, …) exist only in the engine child. Merge the child's command\n\t// catalog — fetched asynchronously after engine bind — so autocomplete lists\n\t// them. Built-in names stay reserved and anything already present locally\n\t// (built-ins, prompt templates, skills the host also loaded) is deduped, so\n\t// only genuinely engine-only commands are added. Execution keeps routing\n\t// through the child via the patched session.prompt(); nothing is handled\n\t// twice on the host.\n\tconst remoteCommandList = this.buildRemoteSlashCommands([\n\t\t...slashCommands,\n\t\t...templateCommands,\n\t\t...extensionCommands,\n\t\t...skillCommandList,\n\t]);\n\n\tconst commands = [\n\t\t...slashCommands,\n\t\t...templateCommands,\n\t\t...extensionCommands,\n\t\t...skillCommandList,\n\t\t...remoteCommandList,\n\t];\n\tconst cwd = this.sessionManager.getCwd();\n\treturn new AtMentionFallbackAutocompleteProvider(\n\t\tnew CombinedAutocompleteProvider(commands, cwd, this.fdPath),\n\t\tnew CombinedAutocompleteProvider(commands, cwd, null),\n\t);\n};\n\nInteractiveModeBase.prototype.setupAutocompleteProvider = function (this: InteractiveModeBase): void {\n\tlet provider = this.createBaseAutocompleteProvider();\n\tfor (const wrapProvider of this.autocompleteProviderWrappers) {\n\t\tprovider = wrapProvider(provider);\n\t}\n\n\tthis.autocompleteProvider = provider;\n\tthis.defaultEditor.setAutocompleteProvider(provider);\n\tif (this.editor !== this.defaultEditor) {\n\t\tthis.editor.setAutocompleteProvider?.(provider);\n\t}\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-bash-compact.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-bash-compact.ts"],"names":[],"mappings":"AAIA,wFAAwF;AACxF,eAAO,MAAM,sCAAsC,4FACuC,CAAC"}
1
+ {"version":3,"file":"interactive-bash-compact.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-bash-compact.ts"],"names":[],"mappings":"AAKA,wFAAwF;AACxF,eAAO,MAAM,sCAAsC,4FACuC,CAAC"}
@@ -117,7 +117,7 @@ InteractiveModeBase.prototype.handleCompactCommand = async function () {
117
117
  }
118
118
  }
119
119
  };
120
- InteractiveModeBase.prototype.stop = function () {
120
+ InteractiveModeBase.prototype.stop = function (fullscreenExitOutput = this.settingsManager.getFullscreenExitOutput()) {
121
121
  this.disposeActiveSelector();
122
122
  this.disposeInteractiveEngineHost();
123
123
  this.disposeInteractiveEngineHost = () => { };
@@ -136,7 +136,7 @@ InteractiveModeBase.prototype.stop = function () {
136
136
  this.unsubscribe();
137
137
  }
138
138
  if (this.isInitialized) {
139
- this.stopInteractiveTui();
139
+ this.stopInteractiveTui(fullscreenExitOutput);
140
140
  this.isInitialized = false;
141
141
  }
142
142
  this.unregisterSignalHandlers();
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-bash-compact.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-bash-compact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAyB,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,wFAAwF;AACxF,MAAM,CAAC,MAAM,sCAAsC,GAClD,yFAAyF,CAAC;AAE3F,mBAAmB,CAAC,SAAS,CAAC,iBAAiB,GAAG,KAAK,WAEtD,OAAe,EACf,kBAAkB,GAAG,KAAK;IAE1B,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;IAErD,mDAAmD;IACnD,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,YAAY,CAAC;QACtD,IAAI,EAAE,WAAW;QACjB,OAAO;QACP,kBAAkB;QAClB,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;KACjC,CAAC,CAAC;IAEH,uDAAuD;IACvD,IAAI,WAAW,EAAE,MAAM,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;QAElC,kCAAkC;QAClC,IAAI,CAAC,aAAa,GAAG,IAAI,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,kBAAkB,CAAC,CAAC;QACtF,IAAI,IAAI,C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AkB,CAAC,OAAO,EAAE,CAAC;IAClC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,EAAE,CAAC;IACpB,CAAC;IACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACxB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC5B,CAAC;IACD,IAAI,CAAC,wBAAwB,EAAE,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { BashExecutionComponent, type TruncationResult } from \"./interactive-mode-deps.ts\";\nimport { isEngineSendFailure } from \"./interactive-prompt-restore.ts\";\n\n/** Warning shown when `/compact` is submitted while a compaction is already running. */\nexport const COMPACTION_ALREADY_IN_PROGRESS_WARNING =\n\t\"Compaction is already in progress. Wait for it to finish before running /compact again.\";\n\nInteractiveModeBase.prototype.handleBashCommand = async function (\n\tthis: InteractiveModeBase,\n\tcommand: string,\n\texcludeFromContext = false,\n): Promise<void> {\n\tconst extensionRunner = this.session.extensionRunner;\n\n\t// Emit user_bash event to let extensions intercept\n\tconst eventResult = await extensionRunner.emitUserBash({\n\t\ttype: \"user_bash\",\n\t\tcommand,\n\t\texcludeFromContext,\n\t\tcwd: this.sessionManager.getCwd(),\n\t});\n\n\t// If extension returned a full result, use it directly\n\tif (eventResult?.result) {\n\t\tconst result = eventResult.result;\n\n\t\t// Create UI component for display\n\t\tthis.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext);\n\t\tif (this.session.isStreaming) {\n\t\t\tthis.pendingMessagesContainer.addChild(this.bashComponent);\n\t\t\tthis.pendingBashComponents.push(this.bashComponent);\n\t\t} else {\n\t\t\tthis.chatContainer.addChild(this.bashComponent);\n\t\t}\n\n\t\t// Show output and complete\n\t\tif (result.output) {\n\t\t\tthis.bashComponent.appendOutput(result.output);\n\t\t}\n\t\tthis.bashComponent.setComplete(\n\t\t\tresult.exitCode,\n\t\t\tresult.cancelled,\n\t\t\tresult.truncated ? ({ truncated: true, content: result.output } as TruncationResult) : undefined,\n\t\t\tresult.fullOutputPath,\n\t\t);\n\n\t\t// Record the result in session\n\t\tthis.session.recordBashResult(command, result, { excludeFromContext });\n\t\tthis.bashComponent = undefined;\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\t// Normal execution path (possibly with custom operations)\n\tconst isDeferred = this.session.isStreaming;\n\tthis.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext);\n\n\tif (isDeferred) {\n\t\t// Show in pending area when agent is streaming\n\t\tthis.pendingMessagesContainer.addChild(this.bashComponent);\n\t\tthis.pendingBashComponents.push(this.bashComponent);\n\t} else {\n\t\t// Show in chat immediately when agent is idle\n\t\tthis.chatContainer.addChild(this.bashComponent);\n\t}\n\tthis.ui.requestRender();\n\n\ttry {\n\t\tconst result = await this.session.executeBash(\n\t\t\tcommand,\n\t\t\t(chunk) => {\n\t\t\t\tif (this.bashComponent) {\n\t\t\t\t\tthis.bashComponent.appendOutput(chunk);\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ excludeFromContext, operations: eventResult?.operations },\n\t\t);\n\n\t\tif (this.bashComponent) {\n\t\t\tthis.bashComponent.setComplete(\n\t\t\t\tresult.exitCode,\n\t\t\t\tresult.cancelled,\n\t\t\t\tresult.truncated ? ({ truncated: true, content: result.output } as TruncationResult) : undefined,\n\t\t\t\tresult.fullOutputPath,\n\t\t\t);\n\t\t}\n\t} catch (error) {\n\t\tif (this.bashComponent) {\n\t\t\tthis.bashComponent.setComplete(undefined, false);\n\t\t}\n\t\tthis.bashComponent = undefined;\n\t\tthis.ui.requestRender();\n\t\t// A send the engine never accepted belongs to the submit handler, which\n\t\t// restores the `!` draft. Ownership comes from the child's admission\n\t\t// frame, not from output: a command can create files and print nothing,\n\t\t// and offering that text back invites a second run.\n\t\tif (isEngineSendFailure(error)) throw error;\n\t\tthis.showError(`Bash command failed: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\treturn;\n\t}\n\n\tthis.bashComponent = undefined;\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleCompactCommand = async function (this: InteractiveModeBase): Promise<void> {\n\t// A manual /compact can take over automatic compaction, but must not start\n\t// another manual compaction or overlap branch summarization.\n\tconst automaticCompaction =\n\t\tthis.session.compactionReason === \"threshold\" || this.session.compactionReason === \"overflow\";\n\tif (this.manualCompactionTakeoverPending || (this.compactionActive && !automaticCompaction)) {\n\t\tthis.showWarning(COMPACTION_ALREADY_IN_PROGRESS_WARNING);\n\t\treturn;\n\t}\n\n\tconst entries = this.sessionManager.getEntries();\n\tconst messageCount = entries.filter((e) => e.type === \"message\").length;\n\n\tif (messageCount < 2) {\n\t\tthis.showWarning(\"Nothing to compact (no messages yet)\");\n\t\treturn;\n\t}\n\n\tif (this.loadingAnimation) {\n\t\tthis.loadingAnimation.stop();\n\t\tthis.loadingAnimation = undefined;\n\t}\n\tthis.statusContainer.clear();\n\n\tthis.manualCompactionTakeoverPending = true;\n\ttry {\n\t\tawait this.session.compact();\n\t} catch (error) {\n\t\t// Compaction failures arrive as events, so they stay ignored here — except\n\t\t// a send the engine never accepted, which the submit handler turns back\n\t\t// into an editor draft.\n\t\tif (isEngineSendFailure(error)) throw error;\n\t} finally {\n\t\t// An engine can reject before it sends a manual compaction-end event. Do\n\t\t// not leave the local handoff guard latched in that case.\n\t\tif (this.manualCompactionTakeoverPending) {\n\t\t\tthis.manualCompactionTakeoverPending = false;\n\t\t\tif (!this.session.isCompacting) void this.flushCompactionQueue({ willRetry: false });\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.stop = function (this: InteractiveModeBase): void {\n\tthis.disposeActiveSelector();\n\tthis.disposeInteractiveEngineHost();\n\tthis.disposeInteractiveEngineHost = () => {};\n\tif (this.settingsManager.getShowTerminalProgress()) {\n\t\tthis.ui.terminal.setProgress(false);\n\t}\n\tif (this.loadingAnimation) {\n\t\tthis.loadingAnimation.stop();\n\t\tthis.loadingAnimation = undefined;\n\t}\n\tthis.themeController.disableAutoSync();\n\tthis.clearExtensionTerminalInputListeners();\n\tthis.footer.dispose();\n\tthis.footerDataProvider.dispose();\n\tif (this.unsubscribe) {\n\t\tthis.unsubscribe();\n\t}\n\tif (this.isInitialized) {\n\t\tthis.stopInteractiveTui();\n\t\tthis.isInitialized = false;\n\t}\n\tthis.unregisterSignalHandlers();\n};\n"]}
1
+ {"version":3,"file":"interactive-bash-compact.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-bash-compact.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAyB,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,wFAAwF;AACxF,MAAM,CAAC,MAAM,sCAAsC,GAClD,yFAAyF,CAAC;AAE3F,mBAAmB,CAAC,SAAS,CAAC,iBAAiB,GAAG,KAAK,WAEtD,OAAe,EACf,kBAAkB,GAAG,KAAK;IAE1B,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;IAErD,mDAAmD;IACnD,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,YAAY,CAAC;QACtD,IAAI,EAAE,WAAW;QACjB,OAAO;QACP,kBAAkB;QAClB,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;KACjC,CAAC,CAAC;IAEH,uDAAuD;IACvD,IAAI,WAAW,EAAE,MAAM,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;QAElC,kCAAkC;QAClC,IAAI,CAAC,aAAa,GAAG,IAAI,sBAAsB,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,kBAAkB,CAAC,CAAC;QACtF,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAA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E,CAAC;IACtB,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;IAClC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,EAAE,CAAC;IACpB,CAAC;IACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACxB,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC5B,CAAC;IACD,IAAI,CAAC,wBAAwB,EAAE,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import type { FullscreenExitOutput } from \"../../core/settings-manager.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { BashExecutionComponent, type TruncationResult } from \"./interactive-mode-deps.ts\";\nimport { isEngineSendFailure } from \"./interactive-prompt-restore.ts\";\n\n/** Warning shown when `/compact` is submitted while a compaction is already running. */\nexport const COMPACTION_ALREADY_IN_PROGRESS_WARNING =\n\t\"Compaction is already in progress. Wait for it to finish before running /compact again.\";\n\nInteractiveModeBase.prototype.handleBashCommand = async function (\n\tthis: InteractiveModeBase,\n\tcommand: string,\n\texcludeFromContext = false,\n): Promise<void> {\n\tconst extensionRunner = this.session.extensionRunner;\n\n\t// Emit user_bash event to let extensions intercept\n\tconst eventResult = await extensionRunner.emitUserBash({\n\t\ttype: \"user_bash\",\n\t\tcommand,\n\t\texcludeFromContext,\n\t\tcwd: this.sessionManager.getCwd(),\n\t});\n\n\t// If extension returned a full result, use it directly\n\tif (eventResult?.result) {\n\t\tconst result = eventResult.result;\n\n\t\t// Create UI component for display\n\t\tthis.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext);\n\t\tif (this.session.isStreaming) {\n\t\t\tthis.pendingMessagesContainer.addChild(this.bashComponent);\n\t\t\tthis.pendingBashComponents.push(this.bashComponent);\n\t\t} else {\n\t\t\tthis.chatContainer.addChild(this.bashComponent);\n\t\t}\n\n\t\t// Show output and complete\n\t\tif (result.output) {\n\t\t\tthis.bashComponent.appendOutput(result.output);\n\t\t}\n\t\tthis.bashComponent.setComplete(\n\t\t\tresult.exitCode,\n\t\t\tresult.cancelled,\n\t\t\tresult.truncated ? ({ truncated: true, content: result.output } as TruncationResult) : undefined,\n\t\t\tresult.fullOutputPath,\n\t\t);\n\n\t\t// Record the result in session\n\t\tthis.session.recordBashResult(command, result, { excludeFromContext });\n\t\tthis.bashComponent = undefined;\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\t// Normal execution path (possibly with custom operations)\n\tconst isDeferred = this.session.isStreaming;\n\tthis.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext);\n\n\tif (isDeferred) {\n\t\t// Show in pending area when agent is streaming\n\t\tthis.pendingMessagesContainer.addChild(this.bashComponent);\n\t\tthis.pendingBashComponents.push(this.bashComponent);\n\t} else {\n\t\t// Show in chat immediately when agent is idle\n\t\tthis.chatContainer.addChild(this.bashComponent);\n\t}\n\tthis.ui.requestRender();\n\n\ttry {\n\t\tconst result = await this.session.executeBash(\n\t\t\tcommand,\n\t\t\t(chunk) => {\n\t\t\t\tif (this.bashComponent) {\n\t\t\t\t\tthis.bashComponent.appendOutput(chunk);\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ excludeFromContext, operations: eventResult?.operations },\n\t\t);\n\n\t\tif (this.bashComponent) {\n\t\t\tthis.bashComponent.setComplete(\n\t\t\t\tresult.exitCode,\n\t\t\t\tresult.cancelled,\n\t\t\t\tresult.truncated ? ({ truncated: true, content: result.output } as TruncationResult) : undefined,\n\t\t\t\tresult.fullOutputPath,\n\t\t\t);\n\t\t}\n\t} catch (error) {\n\t\tif (this.bashComponent) {\n\t\t\tthis.bashComponent.setComplete(undefined, false);\n\t\t}\n\t\tthis.bashComponent = undefined;\n\t\tthis.ui.requestRender();\n\t\t// A send the engine never accepted belongs to the submit handler, which\n\t\t// restores the `!` draft. Ownership comes from the child's admission\n\t\t// frame, not from output: a command can create files and print nothing,\n\t\t// and offering that text back invites a second run.\n\t\tif (isEngineSendFailure(error)) throw error;\n\t\tthis.showError(`Bash command failed: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\treturn;\n\t}\n\n\tthis.bashComponent = undefined;\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.handleCompactCommand = async function (this: InteractiveModeBase): Promise<void> {\n\t// A manual /compact can take over automatic compaction, but must not start\n\t// another manual compaction or overlap branch summarization.\n\tconst automaticCompaction =\n\t\tthis.session.compactionReason === \"threshold\" || this.session.compactionReason === \"overflow\";\n\tif (this.manualCompactionTakeoverPending || (this.compactionActive && !automaticCompaction)) {\n\t\tthis.showWarning(COMPACTION_ALREADY_IN_PROGRESS_WARNING);\n\t\treturn;\n\t}\n\n\tconst entries = this.sessionManager.getEntries();\n\tconst messageCount = entries.filter((e) => e.type === \"message\").length;\n\n\tif (messageCount < 2) {\n\t\tthis.showWarning(\"Nothing to compact (no messages yet)\");\n\t\treturn;\n\t}\n\n\tif (this.loadingAnimation) {\n\t\tthis.loadingAnimation.stop();\n\t\tthis.loadingAnimation = undefined;\n\t}\n\tthis.statusContainer.clear();\n\n\tthis.manualCompactionTakeoverPending = true;\n\ttry {\n\t\tawait this.session.compact();\n\t} catch (error) {\n\t\t// Compaction failures arrive as events, so they stay ignored here — except\n\t\t// a send the engine never accepted, which the submit handler turns back\n\t\t// into an editor draft.\n\t\tif (isEngineSendFailure(error)) throw error;\n\t} finally {\n\t\t// An engine can reject before it sends a manual compaction-end event. Do\n\t\t// not leave the local handoff guard latched in that case.\n\t\tif (this.manualCompactionTakeoverPending) {\n\t\t\tthis.manualCompactionTakeoverPending = false;\n\t\t\tif (!this.session.isCompacting) void this.flushCompactionQueue({ willRetry: false });\n\t\t}\n\t}\n};\n\nInteractiveModeBase.prototype.stop = function (\n\tthis: InteractiveModeBase,\n\tfullscreenExitOutput: FullscreenExitOutput = this.settingsManager.getFullscreenExitOutput(),\n): void {\n\tthis.disposeActiveSelector();\n\tthis.disposeInteractiveEngineHost();\n\tthis.disposeInteractiveEngineHost = () => {};\n\tif (this.settingsManager.getShowTerminalProgress()) {\n\t\tthis.ui.terminal.setProgress(false);\n\t}\n\tif (this.loadingAnimation) {\n\t\tthis.loadingAnimation.stop();\n\t\tthis.loadingAnimation = undefined;\n\t}\n\tthis.themeController.disableAutoSync();\n\tthis.clearExtensionTerminalInputListeners();\n\tthis.footer.dispose();\n\tthis.footerDataProvider.dispose();\n\tif (this.unsubscribe) {\n\t\tthis.unsubscribe();\n\t}\n\tif (this.isInitialized) {\n\t\tthis.stopInteractiveTui(fullscreenExitOutput);\n\t\tthis.isInitialized = false;\n\t}\n\tthis.unregisterSignalHandlers();\n};\n"]}
@@ -1,5 +1,19 @@
1
- import { InteractiveModeBase } from "./interactive-mode-base.js";
1
+ import { ReservedBottomOverlay, TranscriptOverlayReserve, transcriptOverlayIntersection, } from "./components/reserved-bottom-overlay.js";
2
+ import { InteractiveModeBase, isFullscreenTranscriptScrollAction } from "./interactive-mode-base.js";
2
3
  import { Text, theme, } from "./interactive-mode-deps.js";
4
+ import { isMouseWheelInput, isOverlayMounted } from "./interactive-tui.js";
5
+ function validateReservedBottomOverlayOptions(options) {
6
+ const anchor = options?.anchor;
7
+ if (anchor !== "bottom-left" && anchor !== "bottom-center" && anchor !== "bottom-right") {
8
+ throw new Error("reserveTranscriptRows requires an explicit bottom anchor: bottom-left, bottom-center, or bottom-right");
9
+ }
10
+ if (options?.row !== undefined) {
11
+ throw new Error("reserveTranscriptRows does not support overlayOptions.row");
12
+ }
13
+ if (options?.offsetY !== undefined && options.offsetY !== 0) {
14
+ throw new Error("reserveTranscriptRows does not support a nonzero overlayOptions.offsetY");
15
+ }
16
+ }
3
17
  InteractiveModeBase.prototype.showExtensionNotify = function (message, type) {
4
18
  if (type === "error") {
5
19
  this.showError(message);
@@ -31,6 +45,8 @@ InteractiveModeBase.prototype.showExtensionCustom = async function (factory, opt
31
45
  let overlayHandle;
32
46
  let releaseHostInlineCustomUi;
33
47
  let releaseOverlayInlineCustomUiFocusDeferral;
48
+ let transcriptReserveCoordinator;
49
+ let releaseTranscriptReserveRegistration;
34
50
  const disposeComponent = () => {
35
51
  try {
36
52
  component?.dispose?.();
@@ -49,12 +65,27 @@ InteractiveModeBase.prototype.showExtensionCustom = async function (factory, opt
49
65
  const cleanupAbortListener = () => {
50
66
  options?.signal?.removeEventListener("abort", abortCustomUi);
51
67
  };
68
+ const releaseTranscriptReserve = () => {
69
+ const coordinator = transcriptReserveCoordinator;
70
+ releaseTranscriptReserveRegistration?.();
71
+ releaseTranscriptReserveRegistration = undefined;
72
+ transcriptReserveCoordinator = undefined;
73
+ if (!coordinator)
74
+ return;
75
+ if (coordinator.empty) {
76
+ this.documentContainer.removeChild(coordinator);
77
+ if (this.transcriptOverlayReserve === coordinator)
78
+ this.transcriptOverlayReserve = undefined;
79
+ }
80
+ this.ui.requestRender();
81
+ };
52
82
  const closeMountedUi = () => {
53
83
  if (!mounted)
54
84
  return;
55
85
  if (isOverlay) {
56
86
  releaseOverlayInlineCustomUiFocusDeferral?.();
57
87
  releaseOverlayInlineCustomUiFocusDeferral = undefined;
88
+ releaseTranscriptReserve();
58
89
  // Hide THIS overlay, not whatever is on top: during engine-death
59
90
  // teardown an unrelated native overlay can be above this one, and the
60
91
  // generic top-overlay call would close that instead.
@@ -136,15 +167,72 @@ InteractiveModeBase.prototype.showExtensionCustom = async function (factory, opt
136
167
  const w = component?.width;
137
168
  return w ? { width: w } : undefined;
138
169
  };
139
- const handle = this.ui.showOverlay(component, resolveOptions());
170
+ // A reserving overlay is bounded so a transcript strip always
171
+ // survives, and the rows it still covers are added to the end of
172
+ // the document so the scroll clamp can raise them into that strip.
173
+ const resolvedOverlayOptions = resolveOptions();
174
+ let mountedOverlayOptions = resolvedOverlayOptions;
175
+ let mountedComponent = component;
176
+ let pendingReserve;
177
+ if (options?.reserveTranscriptRows === true) {
178
+ validateReservedBottomOverlayOptions(resolvedOverlayOptions);
179
+ // `custom()` documents the richer `ExtensionCustomComponent`
180
+ // contract; this signature still names pi-tui's narrower one.
181
+ const bounded = new ReservedBottomOverlay(component, () => this.ui.terminal.rows, resolvedOverlayOptions?.margin, resolvedOverlayOptions?.maxHeight, (data) => isFullscreenTranscriptScrollAction(data, this.keybindings) || isMouseWheelInput(data), () => this.ui.requestRender());
182
+ mountedComponent = bounded;
183
+ if (resolvedOverlayOptions?.maxHeight !== undefined) {
184
+ mountedOverlayOptions = { ...resolvedOverlayOptions };
185
+ delete mountedOverlayOptions.maxHeight;
186
+ }
187
+ // A raw host reset can remove the exact overlay without touching its
188
+ // handle. Stop reserving in that frame, then remove the registration
189
+ // after the document render traversal finishes.
190
+ let removalObserved = false;
191
+ const overlayShowing = () => {
192
+ if (!isOverlayMounted(this.ui, mountedComponent)) {
193
+ if (!removalObserved) {
194
+ removalObserved = true;
195
+ queueMicrotask(releaseTranscriptReserve);
196
+ }
197
+ return false;
198
+ }
199
+ if (overlayHandle === undefined || overlayHandle.isHidden())
200
+ return false;
201
+ const visible = resolvedOverlayOptions?.visible;
202
+ return visible === undefined ? true : visible(this.ui.terminal.columns, this.ui.terminal.rows);
203
+ };
204
+ pendingReserve = () => overlayShowing()
205
+ ? transcriptOverlayIntersection(bounded.renderedHeight, this.ui.terminal.rows, this.transcriptScrollView?.viewportHeight ?? 0, resolvedOverlayOptions?.margin)
206
+ : undefined;
207
+ }
208
+ const handle = this.ui.showOverlay(mountedComponent, mountedOverlayOptions);
140
209
  overlayHandle = handle;
141
210
  mounted = true;
211
+ // Register only once the overlay is really up and `mounted` is
212
+ // set: a throw before this point must not leave a registry entry
213
+ // or blank-row component in the transcript document.
214
+ if (pendingReserve) {
215
+ let coordinator = this.transcriptOverlayReserve;
216
+ if (!coordinator) {
217
+ coordinator = new TranscriptOverlayReserve(() => this.transcriptScrollView?.viewportHeight ?? 0);
218
+ this.transcriptOverlayReserve = coordinator;
219
+ transcriptReserveCoordinator = coordinator;
220
+ this.documentContainer.addChild(coordinator);
221
+ }
222
+ else {
223
+ transcriptReserveCoordinator = coordinator;
224
+ }
225
+ releaseTranscriptReserveRegistration = coordinator.register(pendingReserve);
226
+ }
227
+ let releaseDeferral;
142
228
  if (options?.deferInlineCustomUiFocus) {
143
- let releaseDeferral = this.beginInlineCustomUiFocusDeferral();
229
+ releaseDeferral = this.beginInlineCustomUiFocusDeferral();
144
230
  releaseOverlayInlineCustomUiFocusDeferral = () => {
145
231
  releaseDeferral?.();
146
232
  releaseDeferral = undefined;
147
233
  };
234
+ }
235
+ if (options?.deferInlineCustomUiFocus || pendingReserve) {
148
236
  const release = () => {
149
237
  releaseOverlayInlineCustomUiFocusDeferral?.();
150
238
  releaseOverlayInlineCustomUiFocusDeferral = undefined;
@@ -152,13 +240,14 @@ InteractiveModeBase.prototype.showExtensionCustom = async function (factory, opt
152
240
  const wrappedHandle = {
153
241
  hide: () => {
154
242
  release();
243
+ releaseTranscriptReserve();
155
244
  handle.hide();
156
245
  },
157
246
  setHidden: (hidden) => {
158
247
  if (hidden)
159
248
  release();
160
249
  handle.setHidden(hidden);
161
- if (!hidden && releaseDeferral === undefined) {
250
+ if (!hidden && options?.deferInlineCustomUiFocus && releaseDeferral === undefined) {
162
251
  releaseDeferral = this.beginInlineCustomUiFocusDeferral();
163
252
  releaseOverlayInlineCustomUiFocusDeferral = () => {
164
253
  releaseDeferral?.();
@@ -171,11 +260,10 @@ InteractiveModeBase.prototype.showExtensionCustom = async function (factory, opt
171
260
  unfocus: (unfocusOptions) => handle.unfocus(unfocusOptions),
172
261
  isFocused: () => handle.isFocused(),
173
262
  };
174
- // Expose handle to caller for visibility control
263
+ overlayHandle = wrappedHandle;
175
264
  options?.onHandle?.(wrappedHandle);
176
265
  }
177
266
  else {
178
- // Expose handle to caller for visibility control
179
267
  options?.onHandle?.(handle);
180
268
  }
181
269
  }