@bastani/atomic 0.9.2 → 0.9.3-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 (606) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +2 -2
  3. package/dist/builtin/cursor/CHANGELOG.md +15 -0
  4. package/dist/builtin/cursor/README.md +2 -1
  5. package/dist/builtin/cursor/package.json +2 -2
  6. package/dist/builtin/cursor/src/cursor-models-raw.json +2 -9
  7. package/dist/builtin/cursor/src/model-mapper.ts +14 -3
  8. package/dist/builtin/cursor/src/proto/protobuf-codec-base64.ts +22 -0
  9. package/dist/builtin/cursor/src/proto/protobuf-codec-request.ts +53 -13
  10. package/dist/builtin/cursor/src/proto/protobuf-codec-wire.ts +24 -7
  11. package/dist/builtin/cursor/src/proto/protobuf-codec.ts +3 -2
  12. package/dist/builtin/cursor/src/stream.ts +5 -11
  13. package/dist/builtin/cursor/src/transport-types.ts +3 -0
  14. package/dist/builtin/cursor/src/transport.ts +1 -0
  15. package/dist/builtin/intercom/package.json +1 -1
  16. package/dist/builtin/mcp/CHANGELOG.md +6 -0
  17. package/dist/builtin/mcp/direct-tools.ts +4 -2
  18. package/dist/builtin/mcp/package.json +1 -1
  19. package/dist/builtin/mcp/proxy-call.ts +3 -1
  20. package/dist/builtin/mcp/utils.ts +18 -7
  21. package/dist/builtin/subagents/CHANGELOG.md +20 -0
  22. package/dist/builtin/subagents/README.md +6 -6
  23. package/dist/builtin/subagents/agents/code-simplifier.md +7 -6
  24. package/dist/builtin/subagents/agents/codebase-analyzer.md +5 -4
  25. package/dist/builtin/subagents/agents/codebase-locator.md +3 -3
  26. package/dist/builtin/subagents/agents/codebase-online-researcher.md +10 -10
  27. package/dist/builtin/subagents/agents/codebase-pattern-finder.md +4 -4
  28. package/dist/builtin/subagents/agents/codebase-research-analyzer.md +3 -3
  29. package/dist/builtin/subagents/agents/codebase-research-locator.md +4 -4
  30. package/dist/builtin/subagents/agents/debugger.md +5 -5
  31. package/dist/builtin/subagents/agents/worker.md +56 -0
  32. package/dist/builtin/subagents/package.json +1 -1
  33. package/dist/builtin/subagents/skills/subagent/SKILL.md +11 -11
  34. package/dist/builtin/subagents/src/agents/agent-loaders.ts +3 -5
  35. package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +3 -3
  36. package/dist/builtin/subagents/src/extension/fanout-child.ts +1 -0
  37. package/dist/builtin/subagents/src/extension/index.ts +6 -3
  38. package/dist/builtin/subagents/src/extension/schemas.ts +2 -7
  39. package/dist/builtin/subagents/src/intercom/result-intercom.ts +4 -3
  40. package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +1 -4
  41. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +15 -1
  42. package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +35 -1
  43. package/dist/builtin/subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +1 -1
  44. package/dist/builtin/subagents/src/runs/shared/nested-render.ts +2 -2
  45. package/dist/builtin/subagents/src/runs/shared/pi-args.ts +2 -1
  46. package/dist/builtin/subagents/src/runs/shared/subagent-prompt-runtime.ts +4 -2
  47. package/dist/builtin/subagents/src/shared/types-async.ts +1 -0
  48. package/dist/builtin/subagents/src/shared/types-depth.ts +5 -5
  49. package/dist/builtin/subagents/src/shared/types-runtime.ts +2 -1
  50. package/dist/builtin/subagents/src/slash/prompt-template-bridge.ts +27 -5
  51. package/dist/builtin/subagents/src/tui/render-event-formatting.ts +2 -2
  52. package/dist/builtin/subagents/src/tui/render-layout.ts +27 -4
  53. package/dist/builtin/subagents/src/tui/render-result-animation.ts +22 -31
  54. package/dist/builtin/subagents/src/tui/render-result-compact.ts +6 -6
  55. package/dist/builtin/subagents/src/tui/render-result.ts +20 -19
  56. package/dist/builtin/subagents/src/tui/render-status-progress.ts +3 -3
  57. package/dist/builtin/subagents/src/tui/render-widget.ts +46 -7
  58. package/dist/builtin/subagents/src/tui/render.ts +2 -2
  59. package/dist/builtin/web-access/package.json +1 -1
  60. package/dist/builtin/workflows/CHANGELOG.md +56 -0
  61. package/dist/builtin/workflows/README.md +3 -3
  62. package/dist/builtin/workflows/builtin/goal-artifacts.ts +11 -6
  63. package/dist/builtin/workflows/builtin/goal-ledger.ts +33 -1
  64. package/dist/builtin/workflows/builtin/goal-prompts.ts +23 -28
  65. package/dist/builtin/workflows/builtin/goal-reducer.ts +2 -2
  66. package/dist/builtin/workflows/builtin/goal-reports.ts +2 -5
  67. package/dist/builtin/workflows/builtin/goal-review.ts +1 -1
  68. package/dist/builtin/workflows/builtin/goal-runner.ts +10 -17
  69. package/dist/builtin/workflows/builtin/open-claude-design-feedback.ts +3 -3
  70. package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +1 -3
  71. package/dist/builtin/workflows/builtin/open-claude-design-setup.ts +1 -1
  72. package/dist/builtin/workflows/builtin/ralph-core.ts +7 -17
  73. package/dist/builtin/workflows/builtin/ralph-runner.ts +11 -18
  74. package/dist/builtin/workflows/builtin/shared-prompts.ts +1 -1
  75. package/dist/builtin/workflows/package.json +1 -1
  76. package/dist/builtin/workflows/src/authoring.d.ts +1 -1
  77. package/dist/builtin/workflows/src/durable/backend.ts +343 -0
  78. package/dist/builtin/workflows/src/durable/child-primitive.ts +79 -0
  79. package/dist/builtin/workflows/src/durable/dbos-backend.ts +421 -0
  80. package/dist/builtin/workflows/src/durable/dbos-envelope.ts +171 -0
  81. package/dist/builtin/workflows/src/durable/factory.ts +96 -0
  82. package/dist/builtin/workflows/src/durable/file-backend.ts +433 -0
  83. package/dist/builtin/workflows/src/durable/index.ts +73 -0
  84. package/dist/builtin/workflows/src/durable/resume-catalog.ts +217 -0
  85. package/dist/builtin/workflows/src/durable/resume-runtime.ts +299 -0
  86. package/dist/builtin/workflows/src/durable/scoped-backend.ts +171 -0
  87. package/dist/builtin/workflows/src/durable/stage-primitive.ts +284 -0
  88. package/dist/builtin/workflows/src/durable/tool-primitive.ts +180 -0
  89. package/dist/builtin/workflows/src/durable/types.ts +168 -0
  90. package/dist/builtin/workflows/src/durable/ui-primitive.ts +96 -0
  91. package/dist/builtin/workflows/src/engine/options.ts +3 -0
  92. package/dist/builtin/workflows/src/engine/primitives/parallel.ts +2 -2
  93. package/dist/builtin/workflows/src/engine/primitives/task.ts +4 -4
  94. package/dist/builtin/workflows/src/engine/primitives/ui.ts +22 -8
  95. package/dist/builtin/workflows/src/engine/primitives/workflow.ts +8 -0
  96. package/dist/builtin/workflows/src/engine/run-durable-finalize.ts +69 -0
  97. package/dist/builtin/workflows/src/engine/run-durable-stage-session.ts +31 -0
  98. package/dist/builtin/workflows/src/engine/run.ts +148 -6
  99. package/dist/builtin/workflows/src/engine/runtime.ts +8 -2
  100. package/dist/builtin/workflows/src/extension/config-loader.ts +35 -15
  101. package/dist/builtin/workflows/src/extension/discovery.ts +20 -8
  102. package/dist/builtin/workflows/src/extension/extension-factory.ts +6 -12
  103. package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +5 -1
  104. package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +4 -2
  105. package/dist/builtin/workflows/src/extension/runtime.ts +48 -9
  106. package/dist/builtin/workflows/src/extension/wiring.ts +1 -1
  107. package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +143 -4
  108. package/dist/builtin/workflows/src/runs/background/quit.ts +61 -0
  109. package/dist/builtin/workflows/src/runs/background/status.ts +1 -0
  110. package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +5 -5
  111. package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +74 -33
  112. package/dist/builtin/workflows/src/runs/foreground/executor-stage-context.ts +20 -1
  113. package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +8 -7
  114. package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +1 -0
  115. package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +1 -1
  116. package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +19 -2
  117. package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +4 -0
  118. package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +10 -10
  119. package/dist/builtin/workflows/src/runs/foreground/stage-runner-options.ts +5 -1
  120. package/dist/builtin/workflows/src/runs/foreground/stage-runner-send-user-message.ts +25 -0
  121. package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +3 -0
  122. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +16 -0
  123. package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +20 -0
  124. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +23 -1
  125. package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +30 -1
  126. package/dist/builtin/workflows/src/shared/store-public-types.ts +6 -2
  127. package/dist/builtin/workflows/src/shared/store-run-methods.ts +12 -6
  128. package/dist/builtin/workflows/src/shared/types.ts +55 -0
  129. package/dist/builtin/workflows/src/tui/dispatch-confirm.ts +11 -10
  130. package/dist/builtin/workflows/src/tui/graph-view-constants.ts +1 -1
  131. package/dist/builtin/workflows/src/tui/graph-view-graph-render.ts +41 -0
  132. package/dist/builtin/workflows/src/tui/graph-view-input.ts +82 -24
  133. package/dist/builtin/workflows/src/tui/graph-view-render.ts +7 -0
  134. package/dist/builtin/workflows/src/tui/graph-view-state.ts +22 -2
  135. package/dist/builtin/workflows/src/tui/graph-view-types.ts +4 -5
  136. package/dist/builtin/workflows/src/tui/overlay-adapter.ts +9 -11
  137. package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +9 -3
  138. package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +11 -2
  139. package/dist/builtin/workflows/src/tui/stage-chat-view-live-events.ts +35 -0
  140. package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +51 -17
  141. package/dist/builtin/workflows/src/tui/stage-chat-view-status.ts +36 -0
  142. package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +5 -1
  143. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +3 -1
  144. package/dist/builtin/workflows/src/tui/status-list.ts +14 -2
  145. package/dist/builtin/workflows/src/tui/widget.ts +23 -8
  146. package/dist/builtin/workflows/src/tui/workflow-attach-pane-types.ts +5 -4
  147. package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +8 -8
  148. package/dist/builtin/workflows/src/tui/workflow-resume-selector.ts +151 -0
  149. package/dist/cli/args.d.ts.map +1 -1
  150. package/dist/cli/args.js +9 -9
  151. package/dist/cli/args.js.map +1 -1
  152. package/dist/config-self-update.d.ts.map +1 -1
  153. package/dist/config-self-update.js +3 -4
  154. package/dist/config-self-update.js.map +1 -1
  155. package/dist/config.d.ts.map +1 -1
  156. package/dist/config.js +4 -5
  157. package/dist/config.js.map +1 -1
  158. package/dist/core/agent-session-bash.d.ts +1 -0
  159. package/dist/core/agent-session-bash.d.ts.map +1 -1
  160. package/dist/core/agent-session-bash.js +1 -0
  161. package/dist/core/agent-session-bash.js.map +1 -1
  162. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  163. package/dist/core/agent-session-tool-registry.js +23 -0
  164. package/dist/core/agent-session-tool-registry.js.map +1 -1
  165. package/dist/core/bash-executor.d.ts +2 -0
  166. package/dist/core/bash-executor.d.ts.map +1 -1
  167. package/dist/core/bash-executor.js +1 -0
  168. package/dist/core/bash-executor.js.map +1 -1
  169. package/dist/core/compaction/compaction.d.ts +29 -0
  170. package/dist/core/compaction/compaction.d.ts.map +1 -1
  171. package/dist/core/compaction/compaction.js +36 -1
  172. package/dist/core/compaction/compaction.js.map +1 -1
  173. package/dist/core/compaction/context-compaction-metrics.d.ts +14 -2
  174. package/dist/core/compaction/context-compaction-metrics.d.ts.map +1 -1
  175. package/dist/core/compaction/context-compaction-metrics.js +50 -1
  176. package/dist/core/compaction/context-compaction-metrics.js.map +1 -1
  177. package/dist/core/compaction/context-compaction-prompt.d.ts.map +1 -1
  178. package/dist/core/compaction/context-compaction-prompt.js +2 -0
  179. package/dist/core/compaction/context-compaction-prompt.js.map +1 -1
  180. package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -1
  181. package/dist/core/compaction/context-compaction-runner.js +1 -1
  182. package/dist/core/compaction/context-compaction-runner.js.map +1 -1
  183. package/dist/core/compaction/context-deletion-application.d.ts.map +1 -1
  184. package/dist/core/compaction/context-deletion-application.js +5 -5
  185. package/dist/core/compaction/context-deletion-application.js.map +1 -1
  186. package/dist/core/compaction/context-deletion-targets.d.ts +2 -0
  187. package/dist/core/compaction/context-deletion-targets.d.ts.map +1 -1
  188. package/dist/core/compaction/context-deletion-targets.js +23 -3
  189. package/dist/core/compaction/context-deletion-targets.js.map +1 -1
  190. package/dist/core/compaction/context-deletion-tool-definitions.d.ts +6 -0
  191. package/dist/core/compaction/context-deletion-tool-definitions.d.ts.map +1 -1
  192. package/dist/core/compaction/context-deletion-tool-definitions.js.map +1 -1
  193. package/dist/core/compaction/context-deletion-tools.d.ts.map +1 -1
  194. package/dist/core/compaction/context-deletion-tools.js +18 -10
  195. package/dist/core/compaction/context-deletion-tools.js.map +1 -1
  196. package/dist/core/compaction/context-transcript-analysis.d.ts.map +1 -1
  197. package/dist/core/compaction/context-transcript-analysis.js +2 -4
  198. package/dist/core/compaction/context-transcript-analysis.js.map +1 -1
  199. package/dist/core/copilot-gemini-tool-arguments.d.ts.map +1 -1
  200. package/dist/core/copilot-gemini-tool-arguments.js +2 -60
  201. package/dist/core/copilot-gemini-tool-arguments.js.map +1 -1
  202. package/dist/core/extensions/context-types.d.ts +2 -0
  203. package/dist/core/extensions/context-types.d.ts.map +1 -1
  204. package/dist/core/extensions/context-types.js.map +1 -1
  205. package/dist/core/extensions/index.d.ts +2 -2
  206. package/dist/core/extensions/index.d.ts.map +1 -1
  207. package/dist/core/extensions/index.js +1 -1
  208. package/dist/core/extensions/index.js.map +1 -1
  209. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  210. package/dist/core/extensions/loader-virtual-modules.js +57 -32
  211. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  212. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  213. package/dist/core/extensions/runner-context.js +11 -0
  214. package/dist/core/extensions/runner-context.js.map +1 -1
  215. package/dist/core/extensions/tool-events.d.ts +13 -13
  216. package/dist/core/extensions/tool-events.d.ts.map +1 -1
  217. package/dist/core/extensions/tool-events.js +3 -3
  218. package/dist/core/extensions/tool-events.js.map +1 -1
  219. package/dist/core/extensions/types.d.ts +1 -1
  220. package/dist/core/extensions/types.d.ts.map +1 -1
  221. package/dist/core/extensions/types.js +1 -1
  222. package/dist/core/extensions/types.js.map +1 -1
  223. package/dist/core/flattened-tool-arguments.d.ts +18 -0
  224. package/dist/core/flattened-tool-arguments.d.ts.map +1 -1
  225. package/dist/core/flattened-tool-arguments.js +104 -0
  226. package/dist/core/flattened-tool-arguments.js.map +1 -1
  227. package/dist/core/messages.d.ts +1 -0
  228. package/dist/core/messages.d.ts.map +1 -1
  229. package/dist/core/messages.js +46 -1
  230. package/dist/core/messages.js.map +1 -1
  231. package/dist/core/sdk-exports.d.ts +1 -1
  232. package/dist/core/sdk-exports.d.ts.map +1 -1
  233. package/dist/core/sdk-exports.js +1 -1
  234. package/dist/core/sdk-exports.js.map +1 -1
  235. package/dist/core/sdk-types.d.ts +2 -2
  236. package/dist/core/sdk-types.d.ts.map +1 -1
  237. package/dist/core/sdk-types.js.map +1 -1
  238. package/dist/core/sdk.d.ts.map +1 -1
  239. package/dist/core/sdk.js +12 -0
  240. package/dist/core/sdk.js.map +1 -1
  241. package/dist/core/session-manager-core.d.ts +15 -7
  242. package/dist/core/session-manager-core.d.ts.map +1 -1
  243. package/dist/core/session-manager-core.js +20 -9
  244. package/dist/core/session-manager-core.js.map +1 -1
  245. package/dist/core/session-manager-entries.d.ts +2 -2
  246. package/dist/core/session-manager-entries.d.ts.map +1 -1
  247. package/dist/core/session-manager-entries.js +9 -3
  248. package/dist/core/session-manager-entries.js.map +1 -1
  249. package/dist/core/session-manager-history.d.ts.map +1 -1
  250. package/dist/core/session-manager-history.js +2 -1
  251. package/dist/core/session-manager-history.js.map +1 -1
  252. package/dist/core/session-manager-list.d.ts +3 -3
  253. package/dist/core/session-manager-list.d.ts.map +1 -1
  254. package/dist/core/session-manager-list.js +27 -8
  255. package/dist/core/session-manager-list.js.map +1 -1
  256. package/dist/core/session-manager-storage.d.ts +3 -1
  257. package/dist/core/session-manager-storage.d.ts.map +1 -1
  258. package/dist/core/session-manager-storage.js +55 -12
  259. package/dist/core/session-manager-storage.js.map +1 -1
  260. package/dist/core/session-manager-tool-dependencies.d.ts +10 -0
  261. package/dist/core/session-manager-tool-dependencies.d.ts.map +1 -0
  262. package/dist/core/session-manager-tool-dependencies.js +133 -0
  263. package/dist/core/session-manager-tool-dependencies.js.map +1 -0
  264. package/dist/core/session-manager-types.d.ts +22 -0
  265. package/dist/core/session-manager-types.d.ts.map +1 -1
  266. package/dist/core/session-manager-types.js.map +1 -1
  267. package/dist/core/session-manager.d.ts +2 -2
  268. package/dist/core/session-manager.d.ts.map +1 -1
  269. package/dist/core/session-manager.js +1 -1
  270. package/dist/core/session-manager.js.map +1 -1
  271. package/dist/core/settings-manager-basic-accessors.d.ts +4 -0
  272. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  273. package/dist/core/settings-manager-basic-accessors.js +18 -0
  274. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  275. package/dist/core/settings-manager-resource-accessors.d.ts +4 -0
  276. package/dist/core/settings-manager-resource-accessors.d.ts.map +1 -1
  277. package/dist/core/settings-manager-resource-accessors.js +15 -0
  278. package/dist/core/settings-manager-resource-accessors.js.map +1 -1
  279. package/dist/core/settings-types.d.ts +11 -0
  280. package/dist/core/settings-types.d.ts.map +1 -1
  281. package/dist/core/settings-types.js.map +1 -1
  282. package/dist/core/system-prompt.d.ts +1 -1
  283. package/dist/core/system-prompt.d.ts.map +1 -1
  284. package/dist/core/system-prompt.js +3 -2
  285. package/dist/core/system-prompt.js.map +1 -1
  286. package/dist/core/tools/artifact-protocol.d.ts +11 -0
  287. package/dist/core/tools/artifact-protocol.d.ts.map +1 -0
  288. package/dist/core/tools/artifact-protocol.js +76 -0
  289. package/dist/core/tools/artifact-protocol.js.map +1 -0
  290. package/dist/core/tools/artifacts.d.ts +18 -0
  291. package/dist/core/tools/artifacts.d.ts.map +1 -0
  292. package/dist/core/tools/artifacts.js +90 -0
  293. package/dist/core/tools/artifacts.js.map +1 -0
  294. package/dist/core/tools/bash-async-jobs.d.ts +20 -0
  295. package/dist/core/tools/bash-async-jobs.d.ts.map +1 -0
  296. package/dist/core/tools/bash-async-jobs.js +59 -0
  297. package/dist/core/tools/bash-async-jobs.js.map +1 -0
  298. package/dist/core/tools/bash-async-output.d.ts +10 -0
  299. package/dist/core/tools/bash-async-output.d.ts.map +1 -0
  300. package/dist/core/tools/bash-async-output.js +80 -0
  301. package/dist/core/tools/bash-async-output.js.map +1 -0
  302. package/dist/core/tools/bash-interceptor.d.ts +10 -0
  303. package/dist/core/tools/bash-interceptor.d.ts.map +1 -0
  304. package/dist/core/tools/bash-interceptor.js +39 -0
  305. package/dist/core/tools/bash-interceptor.js.map +1 -0
  306. package/dist/core/tools/bash-leading-cd.d.ts +7 -0
  307. package/dist/core/tools/bash-leading-cd.d.ts.map +1 -0
  308. package/dist/core/tools/bash-leading-cd.js +59 -0
  309. package/dist/core/tools/bash-leading-cd.js.map +1 -0
  310. package/dist/core/tools/bash-pty-native.d.ts +14 -0
  311. package/dist/core/tools/bash-pty-native.d.ts.map +1 -0
  312. package/dist/core/tools/bash-pty-native.js +71 -0
  313. package/dist/core/tools/bash-pty-native.js.map +1 -0
  314. package/dist/core/tools/bash.d.ts +28 -17
  315. package/dist/core/tools/bash.d.ts.map +1 -1
  316. package/dist/core/tools/bash.js +152 -35
  317. package/dist/core/tools/bash.js.map +1 -1
  318. package/dist/core/tools/block-resolver.d.ts +16 -0
  319. package/dist/core/tools/block-resolver.d.ts.map +1 -0
  320. package/dist/core/tools/block-resolver.js +74 -0
  321. package/dist/core/tools/block-resolver.js.map +1 -0
  322. package/dist/core/tools/conflict-registry.d.ts +16 -0
  323. package/dist/core/tools/conflict-registry.d.ts.map +1 -0
  324. package/dist/core/tools/conflict-registry.js +44 -0
  325. package/dist/core/tools/conflict-registry.js.map +1 -0
  326. package/dist/core/tools/directory-tree.d.ts +13 -0
  327. package/dist/core/tools/directory-tree.d.ts.map +1 -0
  328. package/dist/core/tools/directory-tree.js +81 -0
  329. package/dist/core/tools/directory-tree.js.map +1 -0
  330. package/dist/core/tools/edit.d.ts +4 -29
  331. package/dist/core/tools/edit.d.ts.map +1 -1
  332. package/dist/core/tools/edit.js +136 -228
  333. package/dist/core/tools/edit.js.map +1 -1
  334. package/dist/core/tools/fetch-url.d.ts +74 -0
  335. package/dist/core/tools/fetch-url.d.ts.map +1 -0
  336. package/dist/core/tools/fetch-url.js +518 -0
  337. package/dist/core/tools/fetch-url.js.map +1 -0
  338. package/dist/core/tools/find.d.ts +27 -9
  339. package/dist/core/tools/find.d.ts.map +1 -1
  340. package/dist/core/tools/find.js +400 -176
  341. package/dist/core/tools/find.js.map +1 -1
  342. package/dist/core/tools/glob-path-utils.d.ts +8 -0
  343. package/dist/core/tools/glob-path-utils.d.ts.map +1 -0
  344. package/dist/core/tools/glob-path-utils.js +26 -0
  345. package/dist/core/tools/glob-path-utils.js.map +1 -0
  346. package/dist/core/tools/grep.d.ts +12 -0
  347. package/dist/core/tools/grep.d.ts.map +1 -1
  348. package/dist/core/tools/grep.js +141 -17
  349. package/dist/core/tools/grep.js.map +1 -1
  350. package/dist/core/tools/hashline-engine/apply.d.ts +11 -0
  351. package/dist/core/tools/hashline-engine/apply.d.ts.map +1 -0
  352. package/dist/core/tools/hashline-engine/apply.js +752 -0
  353. package/dist/core/tools/hashline-engine/apply.js.map +1 -0
  354. package/dist/core/tools/hashline-engine/block.d.ts +40 -0
  355. package/dist/core/tools/hashline-engine/block.d.ts.map +1 -0
  356. package/dist/core/tools/hashline-engine/block.js +117 -0
  357. package/dist/core/tools/hashline-engine/block.js.map +1 -0
  358. package/dist/core/tools/hashline-engine/diff-preview.d.ts +15 -0
  359. package/dist/core/tools/hashline-engine/diff-preview.d.ts.map +1 -0
  360. package/dist/core/tools/hashline-engine/diff-preview.js +98 -0
  361. package/dist/core/tools/hashline-engine/diff-preview.js.map +1 -0
  362. package/dist/core/tools/hashline-engine/format.d.ts +71 -0
  363. package/dist/core/tools/hashline-engine/format.d.ts.map +1 -0
  364. package/dist/core/tools/hashline-engine/format.js +178 -0
  365. package/dist/core/tools/hashline-engine/format.js.map +1 -0
  366. package/dist/core/tools/hashline-engine/fs.d.ts +81 -0
  367. package/dist/core/tools/hashline-engine/fs.d.ts.map +1 -0
  368. package/dist/core/tools/hashline-engine/fs.js +143 -0
  369. package/dist/core/tools/hashline-engine/fs.js.map +1 -0
  370. package/dist/core/tools/hashline-engine/index.d.ts +18 -0
  371. package/dist/core/tools/hashline-engine/index.d.ts.map +1 -0
  372. package/dist/core/tools/hashline-engine/index.js +20 -0
  373. package/dist/core/tools/hashline-engine/index.js.map +1 -0
  374. package/dist/core/tools/hashline-engine/input.d.ts +101 -0
  375. package/dist/core/tools/hashline-engine/input.d.ts.map +1 -0
  376. package/dist/core/tools/hashline-engine/input.js +398 -0
  377. package/dist/core/tools/hashline-engine/input.js.map +1 -0
  378. package/dist/core/tools/hashline-engine/messages.d.ts +99 -0
  379. package/dist/core/tools/hashline-engine/messages.d.ts.map +1 -0
  380. package/dist/core/tools/hashline-engine/messages.js +144 -0
  381. package/dist/core/tools/hashline-engine/messages.js.map +1 -0
  382. package/dist/core/tools/hashline-engine/mismatch.d.ts +45 -0
  383. package/dist/core/tools/hashline-engine/mismatch.d.ts.map +1 -0
  384. package/dist/core/tools/hashline-engine/mismatch.js +90 -0
  385. package/dist/core/tools/hashline-engine/mismatch.js.map +1 -0
  386. package/dist/core/tools/hashline-engine/normalize.d.ts +21 -0
  387. package/dist/core/tools/hashline-engine/normalize.d.ts.map +1 -0
  388. package/dist/core/tools/hashline-engine/normalize.js +33 -0
  389. package/dist/core/tools/hashline-engine/normalize.js.map +1 -0
  390. package/dist/core/tools/hashline-engine/parser.d.ts +24 -0
  391. package/dist/core/tools/hashline-engine/parser.d.ts.map +1 -0
  392. package/dist/core/tools/hashline-engine/parser.js +381 -0
  393. package/dist/core/tools/hashline-engine/parser.js.map +1 -0
  394. package/dist/core/tools/hashline-engine/patcher.d.ts +118 -0
  395. package/dist/core/tools/hashline-engine/patcher.d.ts.map +1 -0
  396. package/dist/core/tools/hashline-engine/patcher.js +341 -0
  397. package/dist/core/tools/hashline-engine/patcher.js.map +1 -0
  398. package/dist/core/tools/hashline-engine/prefixes.d.ts +43 -0
  399. package/dist/core/tools/hashline-engine/prefixes.d.ts.map +1 -0
  400. package/dist/core/tools/hashline-engine/prefixes.js +135 -0
  401. package/dist/core/tools/hashline-engine/prefixes.js.map +1 -0
  402. package/dist/core/tools/hashline-engine/recovery.d.ts +41 -0
  403. package/dist/core/tools/hashline-engine/recovery.d.ts.map +1 -0
  404. package/dist/core/tools/hashline-engine/recovery.js +168 -0
  405. package/dist/core/tools/hashline-engine/recovery.js.map +1 -0
  406. package/dist/core/tools/hashline-engine/snapshots.d.ts +65 -0
  407. package/dist/core/tools/hashline-engine/snapshots.d.ts.map +1 -0
  408. package/dist/core/tools/hashline-engine/snapshots.js +108 -0
  409. package/dist/core/tools/hashline-engine/snapshots.js.map +1 -0
  410. package/dist/core/tools/hashline-engine/stream.d.ts +3 -0
  411. package/dist/core/tools/hashline-engine/stream.d.ts.map +1 -0
  412. package/dist/core/tools/hashline-engine/stream.js +111 -0
  413. package/dist/core/tools/hashline-engine/stream.js.map +1 -0
  414. package/dist/core/tools/hashline-engine/tokenizer.d.ts +69 -0
  415. package/dist/core/tools/hashline-engine/tokenizer.d.ts.map +1 -0
  416. package/dist/core/tools/hashline-engine/tokenizer.js +430 -0
  417. package/dist/core/tools/hashline-engine/tokenizer.js.map +1 -0
  418. package/dist/core/tools/hashline-engine/types.d.ts +166 -0
  419. package/dist/core/tools/hashline-engine/types.d.ts.map +1 -0
  420. package/dist/core/tools/hashline-engine/types.js +9 -0
  421. package/dist/core/tools/hashline-engine/types.js.map +1 -0
  422. package/dist/core/tools/hashline.d.ts +29 -0
  423. package/dist/core/tools/hashline.d.ts.map +1 -0
  424. package/dist/core/tools/hashline.js +110 -0
  425. package/dist/core/tools/hashline.js.map +1 -0
  426. package/dist/core/tools/index.d.ts +6 -4
  427. package/dist/core/tools/index.d.ts.map +1 -1
  428. package/dist/core/tools/index.js +52 -35
  429. package/dist/core/tools/index.js.map +1 -1
  430. package/dist/core/tools/notebook.d.ts +38 -0
  431. package/dist/core/tools/notebook.d.ts.map +1 -0
  432. package/dist/core/tools/notebook.js +125 -0
  433. package/dist/core/tools/notebook.js.map +1 -0
  434. package/dist/core/tools/read-document-extract.d.ts +9 -0
  435. package/dist/core/tools/read-document-extract.d.ts.map +1 -0
  436. package/dist/core/tools/read-document-extract.js +212 -0
  437. package/dist/core/tools/read-document-extract.js.map +1 -0
  438. package/dist/core/tools/read-selectors.d.ts +24 -0
  439. package/dist/core/tools/read-selectors.d.ts.map +1 -0
  440. package/dist/core/tools/read-selectors.js +277 -0
  441. package/dist/core/tools/read-selectors.js.map +1 -0
  442. package/dist/core/tools/read-url.d.ts +37 -0
  443. package/dist/core/tools/read-url.d.ts.map +1 -0
  444. package/dist/core/tools/read-url.js +39 -0
  445. package/dist/core/tools/read-url.js.map +1 -0
  446. package/dist/core/tools/read.d.ts +11 -11
  447. package/dist/core/tools/read.d.ts.map +1 -1
  448. package/dist/core/tools/read.js +224 -94
  449. package/dist/core/tools/read.js.map +1 -1
  450. package/dist/core/tools/resource-selectors.d.ts +44 -0
  451. package/dist/core/tools/resource-selectors.d.ts.map +1 -0
  452. package/dist/core/tools/resource-selectors.js +808 -0
  453. package/dist/core/tools/resource-selectors.js.map +1 -0
  454. package/dist/core/tools/search-details.d.ts +26 -0
  455. package/dist/core/tools/search-details.d.ts.map +1 -0
  456. package/dist/core/tools/search-details.js +24 -0
  457. package/dist/core/tools/search-details.js.map +1 -0
  458. package/dist/core/tools/search-line-ranges.d.ts +11 -0
  459. package/dist/core/tools/search-line-ranges.d.ts.map +1 -0
  460. package/dist/core/tools/search-line-ranges.js +65 -0
  461. package/dist/core/tools/search-line-ranges.js.map +1 -0
  462. package/dist/core/tools/search-native.d.ts +97 -0
  463. package/dist/core/tools/search-native.d.ts.map +1 -0
  464. package/dist/core/tools/search-native.js +27 -0
  465. package/dist/core/tools/search-native.js.map +1 -0
  466. package/dist/core/tools/search.d.ts +24 -0
  467. package/dist/core/tools/search.d.ts.map +1 -0
  468. package/dist/core/tools/search.js +573 -0
  469. package/dist/core/tools/search.js.map +1 -0
  470. package/dist/core/tools/truncate.d.ts +4 -4
  471. package/dist/core/tools/truncate.d.ts.map +1 -1
  472. package/dist/core/tools/truncate.js +3 -3
  473. package/dist/core/tools/truncate.js.map +1 -1
  474. package/dist/core/tools/url-ip-guards.d.ts +4 -0
  475. package/dist/core/tools/url-ip-guards.d.ts.map +1 -0
  476. package/dist/core/tools/url-ip-guards.js +126 -0
  477. package/dist/core/tools/url-ip-guards.js.map +1 -0
  478. package/dist/core/tools/write.d.ts +12 -2
  479. package/dist/core/tools/write.d.ts.map +1 -1
  480. package/dist/core/tools/write.js +166 -14
  481. package/dist/core/tools/write.js.map +1 -1
  482. package/dist/core/trust-manager.d.ts.map +1 -1
  483. package/dist/core/trust-manager.js +2 -3
  484. package/dist/core/trust-manager.js.map +1 -1
  485. package/dist/index-extensions.d.ts +2 -2
  486. package/dist/index-extensions.d.ts.map +1 -1
  487. package/dist/index-extensions.js +1 -1
  488. package/dist/index-extensions.js.map +1 -1
  489. package/dist/index.d.ts +3 -3
  490. package/dist/index.d.ts.map +1 -1
  491. package/dist/index.js +3 -3
  492. package/dist/index.js.map +1 -1
  493. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +1 -0
  494. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
  495. package/dist/modes/interactive/components/chat-session-host-runtime.js +12 -0
  496. package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
  497. package/dist/modes/interactive/components/chat-session-host-terminal-cleanup.d.ts +4 -0
  498. package/dist/modes/interactive/components/chat-session-host-terminal-cleanup.d.ts.map +1 -0
  499. package/dist/modes/interactive/components/chat-session-host-terminal-cleanup.js +131 -0
  500. package/dist/modes/interactive/components/chat-session-host-terminal-cleanup.js.map +1 -0
  501. package/dist/modes/interactive/components/chat-session-host.d.ts +2 -0
  502. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  503. package/dist/modes/interactive/components/chat-session-host.js +7 -1
  504. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  505. package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
  506. package/dist/modes/interactive/components/chat-transcript.js +15 -4
  507. package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
  508. package/dist/modes/interactive/components/custom-editor.d.ts +1 -0
  509. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  510. package/dist/modes/interactive/components/custom-editor.js +9 -2
  511. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  512. package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
  513. package/dist/modes/interactive/components/settings-selector-handlers.js +3 -0
  514. package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
  515. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
  516. package/dist/modes/interactive/components/settings-selector-items.js +7 -0
  517. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
  518. package/dist/modes/interactive/components/settings-selector-types.d.ts +2 -0
  519. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  520. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  521. package/dist/modes/interactive/components/tool-execution.d.ts +3 -0
  522. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  523. package/dist/modes/interactive/components/tool-execution.js +26 -0
  524. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  525. package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
  526. package/dist/modes/interactive/components/tree-selector-content.js +0 -5
  527. package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
  528. package/dist/modes/interactive/interactive-auth-login.d.ts.map +1 -1
  529. package/dist/modes/interactive/interactive-auth-login.js +1 -0
  530. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  531. package/dist/modes/interactive/interactive-autocomplete.d.ts.map +1 -1
  532. package/dist/modes/interactive/interactive-autocomplete.js +80 -2
  533. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  534. package/dist/modes/interactive/interactive-hotkeys-debug.d.ts.map +1 -1
  535. package/dist/modes/interactive/interactive-hotkeys-debug.js +3 -0
  536. package/dist/modes/interactive/interactive-hotkeys-debug.js.map +1 -1
  537. package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
  538. package/dist/modes/interactive/interactive-input-handling.js +51 -0
  539. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  540. package/dist/modes/interactive/interactive-mode-base.d.ts +5 -0
  541. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  542. package/dist/modes/interactive/interactive-mode-base.js +5 -0
  543. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  544. package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
  545. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  546. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
  547. package/dist/modes/interactive/interactive-mode-surface.d.ts +12 -0
  548. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  549. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  550. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  551. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  552. package/dist/modes/interactive/interactive-mode.js +1 -0
  553. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  554. package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
  555. package/dist/modes/interactive/interactive-model-routing.js +4 -1
  556. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  557. package/dist/modes/interactive/interactive-onboarding.d.ts +11 -0
  558. package/dist/modes/interactive/interactive-onboarding.d.ts.map +1 -0
  559. package/dist/modes/interactive/interactive-onboarding.js +220 -0
  560. package/dist/modes/interactive/interactive-onboarding.js.map +1 -0
  561. package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
  562. package/dist/modes/interactive/interactive-selectors.js +4 -0
  563. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  564. package/dist/modes/interactive/interactive-session-routing.d.ts.map +1 -1
  565. package/dist/modes/interactive/interactive-session-routing.js +6 -0
  566. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  567. package/dist/modes/interactive/interactive-slash-commands.d.ts.map +1 -1
  568. package/dist/modes/interactive/interactive-slash-commands.js +9 -4
  569. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  570. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  571. package/dist/modes/interactive/interactive-startup.js +28 -0
  572. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  573. package/dist/utils/child-process.d.ts.map +1 -1
  574. package/dist/utils/child-process.js +21 -1
  575. package/dist/utils/child-process.js.map +1 -1
  576. package/dist/utils/markit.d.ts +8 -0
  577. package/dist/utils/markit.d.ts.map +1 -0
  578. package/dist/utils/markit.js +53 -0
  579. package/dist/utils/markit.js.map +1 -0
  580. package/dist/utils/paths.d.ts +2 -1
  581. package/dist/utils/paths.d.ts.map +1 -1
  582. package/dist/utils/paths.js +14 -1
  583. package/dist/utils/paths.js.map +1 -1
  584. package/docs/compaction.md +18 -1
  585. package/docs/containerization.md +1 -1
  586. package/docs/docs.json +1 -0
  587. package/docs/extensions.md +25 -36
  588. package/docs/models.md +1 -1
  589. package/docs/providers.md +2 -1
  590. package/docs/quickstart.md +11 -6
  591. package/docs/sdk.md +5 -5
  592. package/docs/session-format.md +6 -0
  593. package/docs/sessions.md +6 -0
  594. package/docs/settings.md +7 -0
  595. package/docs/subagents.md +3 -2
  596. package/docs/tools.md +49 -0
  597. package/docs/usage.md +3 -3
  598. package/docs/workflows.md +112 -8
  599. package/examples/extensions/subagent/README.md +5 -5
  600. package/examples/extensions/subagent/agents/planner.md +1 -1
  601. package/examples/extensions/subagent/agents/reviewer.md +1 -1
  602. package/examples/extensions/subagent/agents/scout.md +2 -2
  603. package/examples/extensions/subagent/display.ts +3 -3
  604. package/examples/sdk/05-tools.ts +3 -3
  605. package/examples/sdk/README.md +1 -1
  606. package/package.json +5 -3
@@ -1 +1 @@
1
- {"version":3,"file":"tree-selector-content.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tree-selector-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACtD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,SAAS,EAAE,CAAC;YAChB,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACrB,IAAI,SAAS,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;gBACrC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;YACzC,CAAC;YACD,IAAI,GAAG,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;gBAClC,MAAM,OAAO,GAAG,GAA2B,CAAC;gBAC5C,I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AAO,IAAI,GAAG,CAAC;QACxC,CAAC;QACD,KAAK,IAAI,EAAE,CAAC;YACX,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;YACnD,OAAO,QAAQ,IAAI,GAAG,CAAC;QACxB,CAAC;QACD,SAAS,CAAC;YACT,kDAAkD;YAClD,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5C,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5C,OAAO,IAAI,IAAI,KAAK,OAAO,GAAG,cAAc,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;QAC1E,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import type { SessionTreeNode } from \"../../../core/session-manager.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport type { ToolCallInfo } from \"./tree-selector-types.ts\";\n\nexport function getSearchableText(node: SessionTreeNode): string {\n\tconst entry = node.entry;\n\tconst parts: string[] = [];\n\n\tif (node.label) {\n\t\tparts.push(node.label);\n\t}\n\n\tswitch (entry.type) {\n\t\tcase \"message\": {\n\t\t\tconst msg = entry.message;\n\t\t\tparts.push(msg.role);\n\t\t\tif (\"content\" in msg && msg.content) {\n\t\t\t\tparts.push(extractContent(msg.content));\n\t\t\t}\n\t\t\tif (msg.role === \"bashExecution\") {\n\t\t\t\tconst bashMsg = msg as { command?: string };\n\t\t\t\tif (bashMsg.command) parts.push(bashMsg.command);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom_message\": {\n\t\t\tparts.push(entry.customType);\n\t\t\tif (typeof entry.content === \"string\") {\n\t\t\t\tparts.push(entry.content);\n\t\t\t} else {\n\t\t\t\tparts.push(extractContent(entry.content));\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"compaction\":\n\t\t\tparts.push(\"compaction\");\n\t\t\tbreak;\n\t\tcase \"branch_summary\":\n\t\t\tparts.push(\"branch summary\", entry.summary);\n\t\t\tbreak;\n\t\tcase \"session_info\":\n\t\t\tparts.push(\"title\");\n\t\t\tif (entry.name) parts.push(entry.name);\n\t\t\tbreak;\n\t\tcase \"model_change\":\n\t\t\tparts.push(\"model\", entry.modelId);\n\t\t\tbreak;\n\t\tcase \"thinking_level_change\":\n\t\t\tparts.push(\"thinking\", entry.thinkingLevel);\n\t\t\tbreak;\n\t\tcase \"context_window_change\":\n\t\t\tparts.push(\"context window\", String(entry.contextWindow));\n\t\t\tbreak;\n\t\tcase \"custom\":\n\t\t\tparts.push(\"custom\", entry.customType);\n\t\t\tbreak;\n\t\tcase \"label\":\n\t\t\tparts.push(\"label\", entry.label ?? \"\");\n\t\t\tbreak;\n\t}\n\n\treturn parts.join(\" \");\n}\n\nexport function getEntryDisplayText(\n\tnode: SessionTreeNode,\n\tisSelected: boolean,\n\ttoolCallMap: Map<string, ToolCallInfo>,\n): string {\n\tconst entry = node.entry;\n\tlet result: string;\n\n\tswitch (entry.type) {\n\t\tcase \"message\": {\n\t\t\tconst msg = entry.message;\n\t\t\tconst role = msg.role;\n\t\t\tif (role === \"user\") {\n\t\t\t\tconst msgWithContent = msg as { content?: unknown };\n\t\t\t\tconst content = normalizeText(extractContent(msgWithContent.content));\n\t\t\t\tresult = theme.fg(\"accent\", \"user: \") + content;\n\t\t\t} else if (role === \"assistant\") {\n\t\t\t\tconst msgWithContent = msg as { content?: unknown; stopReason?: string; errorMessage?: string };\n\t\t\t\tconst textContent = normalizeText(extractContent(msgWithContent.content));\n\t\t\t\tif (textContent) {\n\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + textContent;\n\t\t\t\t} else if (msgWithContent.stopReason === \"aborted\") {\n\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + theme.fg(\"muted\", \"(aborted)\");\n\t\t\t\t} else if (msgWithContent.errorMessage) {\n\t\t\t\t\tconst errMsg = normalizeText(msgWithContent.errorMessage).slice(0, 80);\n\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + theme.fg(\"error\", errMsg);\n\t\t\t\t} else {\n\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + theme.fg(\"muted\", \"(no content)\");\n\t\t\t\t}\n\t\t\t} else if (role === \"toolResult\") {\n\t\t\t\tconst toolMsg = msg as { toolCallId?: string; toolName?: string };\n\t\t\t\tconst toolCall = toolMsg.toolCallId ? toolCallMap.get(toolMsg.toolCallId) : undefined;\n\t\t\t\tif (toolCall) {\n\t\t\t\t\tresult = theme.fg(\"muted\", formatToolCall(toolCall.name, toolCall.arguments));\n\t\t\t\t} else {\n\t\t\t\t\tresult = theme.fg(\"muted\", `[${toolMsg.toolName ?? \"tool\"}]`);\n\t\t\t\t}\n\t\t\t} else if (role === \"bashExecution\") {\n\t\t\t\tconst bashMsg = msg as { command?: string };\n\t\t\t\tresult = theme.fg(\"dim\", `[bash]: ${normalizeText(bashMsg.command ?? \"\")}`);\n\t\t\t} else {\n\t\t\t\tresult = theme.fg(\"dim\", `[${role}]`);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom_message\": {\n\t\t\tconst content =\n\t\t\t\ttypeof entry.content === \"string\"\n\t\t\t\t\t? entry.content\n\t\t\t\t\t: entry.content\n\t\t\t\t\t\t\t.filter((c): c is { type: \"text\"; text: string } => c.type === \"text\")\n\t\t\t\t\t\t\t.map((c) => c.text)\n\t\t\t\t\t\t\t.join(\"\");\n\t\t\tresult = theme.fg(\"customMessageLabel\", `[${entry.customType}]: `) + normalizeText(content);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"compaction\": {\n\t\t\tconst tokens = Math.round(entry.tokensBefore / 1000);\n\t\t\tresult = theme.fg(\"borderAccent\", `[compaction: ${tokens}k tokens]`);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"branch_summary\":\n\t\t\tresult = theme.fg(\"warning\", `[branch summary]: `) + normalizeText(entry.summary);\n\t\t\tbreak;\n\t\tcase \"model_change\":\n\t\t\tresult = theme.fg(\"dim\", `[model: ${entry.modelId}]`);\n\t\t\tbreak;\n\t\tcase \"thinking_level_change\":\n\t\t\tresult = theme.fg(\"dim\", `[thinking: ${entry.thinkingLevel}]`);\n\t\t\tbreak;\n\t\tcase \"context_window_change\":\n\t\t\tresult = theme.fg(\"dim\", `[context window: ${entry.contextWindow}]`);\n\t\t\tbreak;\n\t\tcase \"custom\":\n\t\t\tresult = theme.fg(\"dim\", `[custom: ${entry.customType}]`);\n\t\t\tbreak;\n\t\tcase \"label\":\n\t\t\tresult = theme.fg(\"dim\", `[label: ${entry.label ?? \"(cleared)\"}]`);\n\t\t\tbreak;\n\t\tcase \"session_info\":\n\t\t\tresult = entry.name\n\t\t\t\t? [theme.fg(\"dim\", \"[title: \"), theme.fg(\"dim\", entry.name), theme.fg(\"dim\", \"]\")].join(\"\")\n\t\t\t\t: [theme.fg(\"dim\", \"[title: \"), theme.italic(theme.fg(\"dim\", \"empty\")), theme.fg(\"dim\", \"]\")].join(\"\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tresult = \"\";\n\t}\n\n\treturn isSelected ? theme.bold(result) : result;\n}\n\nexport function formatLabelTimestamp(timestamp: string): string {\n\tconst date = new Date(timestamp);\n\tconst now = new Date();\n\tconst hours = date.getHours().toString().padStart(2, \"0\");\n\tconst minutes = date.getMinutes().toString().padStart(2, \"0\");\n\tconst time = `${hours}:${minutes}`;\n\n\tif (\n\t\tdate.getFullYear() === now.getFullYear() &&\n\t\tdate.getMonth() === now.getMonth() &&\n\t\tdate.getDate() === now.getDate()\n\t) {\n\t\treturn time;\n\t}\n\n\tconst month = date.getMonth() + 1;\n\tconst day = date.getDate();\n\tif (date.getFullYear() === now.getFullYear()) {\n\t\treturn `${month}/${day} ${time}`;\n\t}\n\n\tconst year = date.getFullYear().toString().slice(-2);\n\treturn `${year}/${month}/${day} ${time}`;\n}\n\nexport function extractContent(content: unknown): string {\n\tconst maxLen = 200;\n\tif (typeof content === \"string\") return content.slice(0, maxLen);\n\tif (Array.isArray(content)) {\n\t\tlet result = \"\";\n\t\tfor (const c of content) {\n\t\t\tif (typeof c === \"object\" && c !== null && \"type\" in c && c.type === \"text\") {\n\t\t\t\tresult += (c as { text: string }).text;\n\t\t\t\tif (result.length >= maxLen) return result.slice(0, maxLen);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\treturn \"\";\n}\n\nexport function hasTextContent(content: unknown): boolean {\n\tif (typeof content === \"string\") return content.trim().length > 0;\n\tif (Array.isArray(content)) {\n\t\tfor (const c of content) {\n\t\t\tif (typeof c === \"object\" && c !== null && \"type\" in c && c.type === \"text\") {\n\t\t\t\tconst text = (c as { text?: string }).text;\n\t\t\t\tif (text && text.trim().length > 0) return true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction normalizeText(s: string): string {\n\treturn s.replace(/[\\n\\t]/g, \" \").trim();\n}\n\nfunction formatToolCall(name: string, args: Record<string, unknown>): string {\n\tconst shortenPath = (p: string): string => {\n\t\tconst home = process.env.HOME || process.env.USERPROFILE || \"\";\n\t\tif (home && p.startsWith(home)) return `~${p.slice(home.length)}`;\n\t\treturn p;\n\t};\n\n\tswitch (name) {\n\t\tcase \"read\": {\n\t\t\tconst path = shortenPath(String(args.path || args.file_path || \"\"));\n\t\t\tconst offset = args.offset as number | undefined;\n\t\t\tconst limit = args.limit as number | undefined;\n\t\t\tlet display = path;\n\t\t\tif (offset !== undefined || limit !== undefined) {\n\t\t\t\tconst start = offset ?? 1;\n\t\t\t\tconst end = limit !== undefined ? start + limit - 1 : \"\";\n\t\t\t\tdisplay += `:${start}${end ? `-${end}` : \"\"}`;\n\t\t\t}\n\t\t\treturn `[read: ${display}]`;\n\t\t}\n\t\tcase \"write\": {\n\t\t\tconst path = shortenPath(String(args.path || args.file_path || \"\"));\n\t\t\treturn `[write: ${path}]`;\n\t\t}\n\t\tcase \"edit\": {\n\t\t\tconst path = shortenPath(String(args.path || args.file_path || \"\"));\n\t\t\treturn `[edit: ${path}]`;\n\t\t}\n\t\tcase \"bash\": {\n\t\t\tconst rawCmd = String(args.command || \"\");\n\t\t\tconst cmd = rawCmd\n\t\t\t\t.replace(/[\\n\\t]/g, \" \")\n\t\t\t\t.trim()\n\t\t\t\t.slice(0, 50);\n\t\t\treturn `[bash: ${cmd}${rawCmd.length > 50 ? \"...\" : \"\"}]`;\n\t\t}\n\t\tcase \"grep\": {\n\t\t\tconst pattern = String(args.pattern || \"\");\n\t\t\tconst path = shortenPath(String(args.path || \".\"));\n\t\t\treturn `[grep: /${pattern}/ in ${path}]`;\n\t\t}\n\t\tcase \"find\": {\n\t\t\tconst pattern = String(args.pattern || \"\");\n\t\t\tconst path = shortenPath(String(args.path || \".\"));\n\t\t\treturn `[find: ${pattern} in ${path}]`;\n\t\t}\n\t\tcase \"ls\": {\n\t\t\tconst path = shortenPath(String(args.path || \".\"));\n\t\t\treturn `[ls: ${path}]`;\n\t\t}\n\t\tdefault: {\n\t\t\t// Custom tool - show name and truncated JSON args\n\t\t\tconst serializedArgs = JSON.stringify(args);\n\t\t\tconst argsStr = serializedArgs.slice(0, 40);\n\t\t\treturn `[${name}: ${argsStr}${serializedArgs.length > 40 ? \"...\" : \"\"}]`;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"tree-selector-content.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tree-selector-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACtD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED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CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YAC3C,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;YACnD,OAAO,UAAU,OAAO,OAAO,IAAI,GAAG,CAAC;QACxC,CAAC;QACD,KAAK,IAAI,EAAE,CAAC;YACX,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;YACnD,OAAO,QAAQ,IAAI,GAAG,CAAC;QACxB,CAAC;QACD,SAAS,CAAC;YACT,kDAAkD;YAClD,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5C,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5C,OAAO,IAAI,IAAI,KAAK,OAAO,GAAG,cAAc,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;QAC1E,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import type { SessionTreeNode } from \"../../../core/session-manager.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport type { ToolCallInfo } from \"./tree-selector-types.ts\";\n\nexport function getSearchableText(node: SessionTreeNode): string {\n\tconst entry = node.entry;\n\tconst parts: string[] = [];\n\n\tif (node.label) {\n\t\tparts.push(node.label);\n\t}\n\n\tswitch (entry.type) {\n\t\tcase \"message\": {\n\t\t\tconst msg = entry.message;\n\t\t\tparts.push(msg.role);\n\t\t\tif (\"content\" in msg && msg.content) {\n\t\t\t\tparts.push(extractContent(msg.content));\n\t\t\t}\n\t\t\tif (msg.role === \"bashExecution\") {\n\t\t\t\tconst bashMsg = msg as { command?: string };\n\t\t\t\tif (bashMsg.command) parts.push(bashMsg.command);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom_message\": {\n\t\t\tparts.push(entry.customType);\n\t\t\tif (typeof entry.content === \"string\") {\n\t\t\t\tparts.push(entry.content);\n\t\t\t} else {\n\t\t\t\tparts.push(extractContent(entry.content));\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"compaction\":\n\t\t\tparts.push(\"compaction\");\n\t\t\tbreak;\n\t\tcase \"branch_summary\":\n\t\t\tparts.push(\"branch summary\", entry.summary);\n\t\t\tbreak;\n\t\tcase \"session_info\":\n\t\t\tparts.push(\"title\");\n\t\t\tif (entry.name) parts.push(entry.name);\n\t\t\tbreak;\n\t\tcase \"model_change\":\n\t\t\tparts.push(\"model\", entry.modelId);\n\t\t\tbreak;\n\t\tcase \"thinking_level_change\":\n\t\t\tparts.push(\"thinking\", entry.thinkingLevel);\n\t\t\tbreak;\n\t\tcase \"context_window_change\":\n\t\t\tparts.push(\"context window\", String(entry.contextWindow));\n\t\t\tbreak;\n\t\tcase \"custom\":\n\t\t\tparts.push(\"custom\", entry.customType);\n\t\t\tbreak;\n\t\tcase \"label\":\n\t\t\tparts.push(\"label\", entry.label ?? \"\");\n\t\t\tbreak;\n\t}\n\n\treturn parts.join(\" \");\n}\n\nexport function getEntryDisplayText(\n\tnode: SessionTreeNode,\n\tisSelected: boolean,\n\ttoolCallMap: Map<string, ToolCallInfo>,\n): string {\n\tconst entry = node.entry;\n\tlet result: string;\n\n\tswitch (entry.type) {\n\t\tcase \"message\": {\n\t\t\tconst msg = entry.message;\n\t\t\tconst role = msg.role;\n\t\t\tif (role === \"user\") {\n\t\t\t\tconst msgWithContent = msg as { content?: unknown };\n\t\t\t\tconst content = normalizeText(extractContent(msgWithContent.content));\n\t\t\t\tresult = theme.fg(\"accent\", \"user: \") + content;\n\t\t\t} else if (role === \"assistant\") {\n\t\t\t\tconst msgWithContent = msg as { content?: unknown; stopReason?: string; errorMessage?: string };\n\t\t\t\tconst textContent = normalizeText(extractContent(msgWithContent.content));\n\t\t\t\tif (textContent) {\n\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + textContent;\n\t\t\t\t} else if (msgWithContent.stopReason === \"aborted\") {\n\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + theme.fg(\"muted\", \"(aborted)\");\n\t\t\t\t} else if (msgWithContent.errorMessage) {\n\t\t\t\t\tconst errMsg = normalizeText(msgWithContent.errorMessage).slice(0, 80);\n\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + theme.fg(\"error\", errMsg);\n\t\t\t\t} else {\n\t\t\t\t\tresult = theme.fg(\"success\", \"assistant: \") + theme.fg(\"muted\", \"(no content)\");\n\t\t\t\t}\n\t\t\t} else if (role === \"toolResult\") {\n\t\t\t\tconst toolMsg = msg as { toolCallId?: string; toolName?: string };\n\t\t\t\tconst toolCall = toolMsg.toolCallId ? toolCallMap.get(toolMsg.toolCallId) : undefined;\n\t\t\t\tif (toolCall) {\n\t\t\t\t\tresult = theme.fg(\"muted\", formatToolCall(toolCall.name, toolCall.arguments));\n\t\t\t\t} else {\n\t\t\t\t\tresult = theme.fg(\"muted\", `[${toolMsg.toolName ?? \"tool\"}]`);\n\t\t\t\t}\n\t\t\t} else if (role === \"bashExecution\") {\n\t\t\t\tconst bashMsg = msg as { command?: string };\n\t\t\t\tresult = theme.fg(\"dim\", `[bash]: ${normalizeText(bashMsg.command ?? \"\")}`);\n\t\t\t} else {\n\t\t\t\tresult = theme.fg(\"dim\", `[${role}]`);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom_message\": {\n\t\t\tconst content =\n\t\t\t\ttypeof entry.content === \"string\"\n\t\t\t\t\t? entry.content\n\t\t\t\t\t: entry.content\n\t\t\t\t\t\t\t.filter((c): c is { type: \"text\"; text: string } => c.type === \"text\")\n\t\t\t\t\t\t\t.map((c) => c.text)\n\t\t\t\t\t\t\t.join(\"\");\n\t\t\tresult = theme.fg(\"customMessageLabel\", `[${entry.customType}]: `) + normalizeText(content);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"compaction\": {\n\t\t\tconst tokens = Math.round(entry.tokensBefore / 1000);\n\t\t\tresult = theme.fg(\"borderAccent\", `[compaction: ${tokens}k tokens]`);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"branch_summary\":\n\t\t\tresult = theme.fg(\"warning\", `[branch summary]: `) + normalizeText(entry.summary);\n\t\t\tbreak;\n\t\tcase \"model_change\":\n\t\t\tresult = theme.fg(\"dim\", `[model: ${entry.modelId}]`);\n\t\t\tbreak;\n\t\tcase \"thinking_level_change\":\n\t\t\tresult = theme.fg(\"dim\", `[thinking: ${entry.thinkingLevel}]`);\n\t\t\tbreak;\n\t\tcase \"context_window_change\":\n\t\t\tresult = theme.fg(\"dim\", `[context window: ${entry.contextWindow}]`);\n\t\t\tbreak;\n\t\tcase \"custom\":\n\t\t\tresult = theme.fg(\"dim\", `[custom: ${entry.customType}]`);\n\t\t\tbreak;\n\t\tcase \"label\":\n\t\t\tresult = theme.fg(\"dim\", `[label: ${entry.label ?? \"(cleared)\"}]`);\n\t\t\tbreak;\n\t\tcase \"session_info\":\n\t\t\tresult = entry.name\n\t\t\t\t? [theme.fg(\"dim\", \"[title: \"), theme.fg(\"dim\", entry.name), theme.fg(\"dim\", \"]\")].join(\"\")\n\t\t\t\t: [theme.fg(\"dim\", \"[title: \"), theme.italic(theme.fg(\"dim\", \"empty\")), theme.fg(\"dim\", \"]\")].join(\"\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tresult = \"\";\n\t}\n\n\treturn isSelected ? theme.bold(result) : result;\n}\n\nexport function formatLabelTimestamp(timestamp: string): string {\n\tconst date = new Date(timestamp);\n\tconst now = new Date();\n\tconst hours = date.getHours().toString().padStart(2, \"0\");\n\tconst minutes = date.getMinutes().toString().padStart(2, \"0\");\n\tconst time = `${hours}:${minutes}`;\n\n\tif (\n\t\tdate.getFullYear() === now.getFullYear() &&\n\t\tdate.getMonth() === now.getMonth() &&\n\t\tdate.getDate() === now.getDate()\n\t) {\n\t\treturn time;\n\t}\n\n\tconst month = date.getMonth() + 1;\n\tconst day = date.getDate();\n\tif (date.getFullYear() === now.getFullYear()) {\n\t\treturn `${month}/${day} ${time}`;\n\t}\n\n\tconst year = date.getFullYear().toString().slice(-2);\n\treturn `${year}/${month}/${day} ${time}`;\n}\n\nexport function extractContent(content: unknown): string {\n\tconst maxLen = 200;\n\tif (typeof content === \"string\") return content.slice(0, maxLen);\n\tif (Array.isArray(content)) {\n\t\tlet result = \"\";\n\t\tfor (const c of content) {\n\t\t\tif (typeof c === \"object\" && c !== null && \"type\" in c && c.type === \"text\") {\n\t\t\t\tresult += (c as { text: string }).text;\n\t\t\t\tif (result.length >= maxLen) return result.slice(0, maxLen);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\treturn \"\";\n}\n\nexport function hasTextContent(content: unknown): boolean {\n\tif (typeof content === \"string\") return content.trim().length > 0;\n\tif (Array.isArray(content)) {\n\t\tfor (const c of content) {\n\t\t\tif (typeof c === \"object\" && c !== null && \"type\" in c && c.type === \"text\") {\n\t\t\t\tconst text = (c as { text?: string }).text;\n\t\t\t\tif (text && text.trim().length > 0) return true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction normalizeText(s: string): string {\n\treturn s.replace(/[\\n\\t]/g, \" \").trim();\n}\n\nfunction formatToolCall(name: string, args: Record<string, unknown>): string {\n\tconst shortenPath = (p: string): string => {\n\t\tconst home = process.env.HOME || process.env.USERPROFILE || \"\";\n\t\tif (home && p.startsWith(home)) return `~${p.slice(home.length)}`;\n\t\treturn p;\n\t};\n\n\tswitch (name) {\n\t\tcase \"read\": {\n\t\t\tconst path = shortenPath(String(args.path || args.file_path || \"\"));\n\t\t\tconst offset = args.offset as number | undefined;\n\t\t\tconst limit = args.limit as number | undefined;\n\t\t\tlet display = path;\n\t\t\tif (offset !== undefined || limit !== undefined) {\n\t\t\t\tconst start = offset ?? 1;\n\t\t\t\tconst end = limit !== undefined ? start + limit - 1 : \"\";\n\t\t\t\tdisplay += `:${start}${end ? `-${end}` : \"\"}`;\n\t\t\t}\n\t\t\treturn `[read: ${display}]`;\n\t\t}\n\t\tcase \"write\": {\n\t\t\tconst path = shortenPath(String(args.path || args.file_path || \"\"));\n\t\t\treturn `[write: ${path}]`;\n\t\t}\n\t\tcase \"edit\": {\n\t\t\tconst path = shortenPath(String(args.path || args.file_path || \"\"));\n\t\t\treturn `[edit: ${path}]`;\n\t\t}\n\t\tcase \"bash\": {\n\t\t\tconst rawCmd = String(args.command || \"\");\n\t\t\tconst cmd = rawCmd\n\t\t\t\t.replace(/[\\n\\t]/g, \" \")\n\t\t\t\t.trim()\n\t\t\t\t.slice(0, 50);\n\t\t\treturn `[bash: ${cmd}${rawCmd.length > 50 ? \"...\" : \"\"}]`;\n\t\t}\n\t\tcase \"find\": {\n\t\t\tconst pattern = String(args.pattern || \"\");\n\t\t\tconst path = shortenPath(String(args.path || \".\"));\n\t\t\treturn `[find: ${pattern} in ${path}]`;\n\t\t}\n\t\tcase \"ls\": {\n\t\t\tconst path = shortenPath(String(args.path || \".\"));\n\t\t\treturn `[ls: ${path}]`;\n\t\t}\n\t\tdefault: {\n\t\t\t// Custom tool - show name and truncated JSON args\n\t\t\tconst serializedArgs = JSON.stringify(args);\n\t\t\tconst argsStr = serializedArgs.slice(0, 40);\n\t\t\treturn `[${name}: ${argsStr}${serializedArgs.length > 40 ? \"...\" : \"\"}]`;\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-auth-login.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-login.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, type OAuthProviderId, type OAuthSelectPrompt, path, getAuthPath, getDocsPath, defaultModelPerProvider, ExtensionSelectorComponent, LoginDialogComponent, theme } from \"./interactive-mode-deps.ts\";\nimport { hasDefaultModelProvider, isUnknownModel } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.completeProviderAuthentication = async function(this: InteractiveModeBase, providerId: string, providerName: string, authType: \"oauth\" | \"api_key\", previousModel: Model<Api> | undefined): Promise<void> {\n this.session.modelRegistry.refresh();\n\n const actionLabel =\n authType === \"oauth\"\n ? `Logged in to ${providerName}`\n : `Saved API key for ${providerName}`;\n\n let selectedModel: Model<Api> | undefined;\n let selectionError: string | undefined;\n if (isUnknownModel(previousModel)) {\n const availableModels = this.session.modelRegistry.getAvailable();\n const providerModels = availableModels.filter(\n (model) => model.provider === providerId,\n );\n if (!hasDefaultModelProvider(providerId)) {\n selectionError = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n } else if (providerModels.length === 0) {\n selectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\n } else {\n const defaultModelId = defaultModelPerProvider[providerId];\n selectedModel = providerModels.find(\n (model) => model.id === defaultModelId,\n );\n if (!selectedModel) {\n selectionError = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\n } else {\n try {\n await this.session.setModel(selectedModel);\n } catch (error: unknown) {\n selectedModel = undefined;\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n selectionError = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\n }\n }\n }\n }\n\n await this.updateAvailableProviderCount();\n this.setupAutocompleteProvider();\n this.footer.invalidate();\n this.updateEditorBorderColor();\n if (selectedModel) {\n this.showStatus(\n `${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`,\n );\n void this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n this.checkDaxnutsEasterEgg(selectedModel);\n } else {\n this.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);\n if (selectionError) {\n this.showError(selectionError);\n } else {\n void this.maybeWarnAboutAnthropicSubscriptionAuth();\n }\n }\n };\n\nInteractiveModeBase.prototype.showBedrockSetupDialog = function(this: InteractiveModeBase, providerId: string, providerName: string): void {\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n () => restoreEditor(),\n providerName,\n \"Amazon Bedrock setup\",\n );\n dialog.showInfo([\n theme.fg(\n \"text\",\n \"Amazon Bedrock uses AWS credentials instead of a single API key.\",\n ),\n theme.fg(\n \"text\",\n \"Configure an AWS profile, IAM keys, bearer token, or role-based credentials.\",\n ),\n theme.fg(\"muted\", \"See:\"),\n theme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n ]);\n\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showApiKeyLoginDialog = async function(this: InteractiveModeBase, providerId: string, providerName: string): Promise<void> {\n const previousModel = this.session.model;\n\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n (_success, _message) => {\n // Completion handled below\n },\n providerName,\n );\n\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n try {\n const apiKey = (await dialog.showPrompt(\"Enter API key:\")).trim();\n if (!apiKey) {\n throw new Error(\"API key cannot be empty.\");\n }\n\n this.session.modelRegistry.authStorage.set(providerId, {\n type: \"api_key\",\n key: apiKey,\n });\n\n restoreEditor();\n await this.completeProviderAuthentication(\n providerId,\n providerName,\n \"api_key\",\n previousModel,\n );\n } catch (error: unknown) {\n restoreEditor();\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg !== \"Login cancelled\") {\n this.showError(\n `Failed to save API key for ${providerName}: ${errorMsg}`,\n );\n }\n }\n };\n\nInteractiveModeBase.prototype.showOAuthLoginSelect = function(this: InteractiveModeBase, dialog: LoginDialogComponent, prompt: OAuthSelectPrompt): Promise<string | undefined> {\n return new Promise((resolve) => {\n const restoreDialog = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n };\n const labels = prompt.options.map((option) => option.label);\n const selector = new ExtensionSelectorComponent(\n prompt.message,\n labels,\n (optionLabel) => {\n restoreDialog();\n resolve(\n prompt.options.find((option) => option.label === optionLabel)?.id,\n );\n },\n () => {\n restoreDialog();\n resolve(undefined);\n },\n );\n this.editorContainer.clear();\n this.editorContainer.addChild(selector);\n this.ui.setFocus(selector);\n this.ui.requestRender();\n });\n };\n\nInteractiveModeBase.prototype.showLoginDialog = async function(this: InteractiveModeBase, providerId: string, providerName: string): Promise<void> {\n const providerInfo = this.session.modelRegistry.authStorage\n .getOAuthProviders()\n .find((provider) => provider.id === providerId);\n const previousModel = this.session.model;\n\n // Providers that use callback servers (can paste redirect URL)\n const usesCallbackServer = providerInfo?.usesCallbackServer ?? false;\n\n // Create login dialog component\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n (_success, _message) => {\n // Completion handled below\n },\n providerName,\n );\n\n // Show dialog in editor container\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n\n // Promise for manual code input (racing with callback server)\n let manualCodeResolve: ((code: string) => void) | undefined;\n let manualCodeReject: ((err: Error) => void) | undefined;\n const manualCodePromise = new Promise<string>((resolve, reject) => {\n manualCodeResolve = resolve;\n manualCodeReject = reject;\n });\n\n // Restore editor helper\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n try {\n await this.session.modelRegistry.authStorage.login(\n providerId as OAuthProviderId,\n {\n onAuth: (info: { url: string; instructions?: string }) => {\n dialog.showAuth(info.url, info.instructions, {\n showCancelHint: !usesCallbackServer,\n });\n\n if (usesCallbackServer) {\n // Show input for manual paste, racing with callback\n dialog\n .showManualInput(\n \"Paste redirect URL below, or complete login in browser:\",\n )\n .then((value) => {\n if (value && manualCodeResolve) {\n manualCodeResolve(value);\n manualCodeResolve = undefined;\n }\n })\n .catch(() => {\n if (manualCodeReject) {\n manualCodeReject(new Error(\"Login cancelled\"));\n manualCodeReject = undefined;\n }\n });\n }\n // For Anthropic: onPrompt is called immediately after\n },\n\n onDeviceCode: (info) => {\n dialog.showDeviceCode(info);\n dialog.showWaiting(\"Waiting for authentication...\");\n },\n\n onPrompt: async (prompt: {\n message: string;\n placeholder?: string;\n }) => {\n return dialog.showPrompt(prompt.message, prompt.placeholder);\n },\n\n onProgress: (message: string) => {\n dialog.showProgress(message);\n },\n\n onSelect: (prompt: OAuthSelectPrompt) =>\n this.showOAuthLoginSelect(dialog, prompt),\n\n onManualCodeInput: () => manualCodePromise,\n\n signal: dialog.signal,\n },\n );\n\n // Success\n restoreEditor();\n await this.completeProviderAuthentication(\n providerId,\n providerName,\n \"oauth\",\n previousModel,\n );\n } catch (error: unknown) {\n restoreEditor();\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg !== \"Login cancelled\") {\n this.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n }\n }\n };\n"]}
1
+ {"version":3,"file":"interactive-auth-login.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-login.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, type OAuthProviderId, type OAuthSelectPrompt, path, getAuthPath, getDocsPath, defaultModelPerProvider, ExtensionSelectorComponent, LoginDialogComponent, theme } from \"./interactive-mode-deps.ts\";\nimport { hasDefaultModelProvider, isUnknownModel } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.completeProviderAuthentication = async function(this: InteractiveModeBase, providerId: string, providerName: string, authType: \"oauth\" | \"api_key\", previousModel: Model<Api> | undefined): Promise<void> {\n this.session.modelRegistry.refresh();\n\n const actionLabel =\n authType === \"oauth\"\n ? `Logged in to ${providerName}`\n : `Saved API key for ${providerName}`;\n\n let selectedModel: Model<Api> | undefined;\n let selectionError: string | undefined;\n if (isUnknownModel(previousModel)) {\n const availableModels = this.session.modelRegistry.getAvailable();\n const providerModels = availableModels.filter(\n (model) => model.provider === providerId,\n );\n if (!hasDefaultModelProvider(providerId)) {\n selectionError = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n } else if (providerModels.length === 0) {\n selectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\n } else {\n const defaultModelId = defaultModelPerProvider[providerId];\n selectedModel = providerModels.find(\n (model) => model.id === defaultModelId,\n );\n if (!selectedModel) {\n selectionError = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\n } else {\n try {\n await this.session.setModel(selectedModel);\n } catch (error: unknown) {\n selectedModel = undefined;\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n selectionError = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\n }\n }\n }\n }\n\n await this.updateAvailableProviderCount();\n this.setupAutocompleteProvider();\n this.footer.invalidate();\n this.updateEditorBorderColor();\n if (selectedModel) {\n this.showStatus(\n `${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`,\n );\n void this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n this.checkDaxnutsEasterEgg(selectedModel);\n } else {\n this.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);\n if (selectionError) {\n this.showError(selectionError);\n } else {\n void this.maybeWarnAboutAnthropicSubscriptionAuth();\n }\n }\n\n await this.resumePendingFirstRunOnboardingSeed();\n };\n\nInteractiveModeBase.prototype.showBedrockSetupDialog = function(this: InteractiveModeBase, providerId: string, providerName: string): void {\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n () => restoreEditor(),\n providerName,\n \"Amazon Bedrock setup\",\n );\n dialog.showInfo([\n theme.fg(\n \"text\",\n \"Amazon Bedrock uses AWS credentials instead of a single API key.\",\n ),\n theme.fg(\n \"text\",\n \"Configure an AWS profile, IAM keys, bearer token, or role-based credentials.\",\n ),\n theme.fg(\"muted\", \"See:\"),\n theme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n ]);\n\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showApiKeyLoginDialog = async function(this: InteractiveModeBase, providerId: string, providerName: string): Promise<void> {\n const previousModel = this.session.model;\n\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n (_success, _message) => {\n // Completion handled below\n },\n providerName,\n );\n\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n try {\n const apiKey = (await dialog.showPrompt(\"Enter API key:\")).trim();\n if (!apiKey) {\n throw new Error(\"API key cannot be empty.\");\n }\n\n this.session.modelRegistry.authStorage.set(providerId, {\n type: \"api_key\",\n key: apiKey,\n });\n\n restoreEditor();\n await this.completeProviderAuthentication(\n providerId,\n providerName,\n \"api_key\",\n previousModel,\n );\n } catch (error: unknown) {\n restoreEditor();\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg !== \"Login cancelled\") {\n this.showError(\n `Failed to save API key for ${providerName}: ${errorMsg}`,\n );\n }\n }\n };\n\nInteractiveModeBase.prototype.showOAuthLoginSelect = function(this: InteractiveModeBase, dialog: LoginDialogComponent, prompt: OAuthSelectPrompt): Promise<string | undefined> {\n return new Promise((resolve) => {\n const restoreDialog = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n };\n const labels = prompt.options.map((option) => option.label);\n const selector = new ExtensionSelectorComponent(\n prompt.message,\n labels,\n (optionLabel) => {\n restoreDialog();\n resolve(\n prompt.options.find((option) => option.label === optionLabel)?.id,\n );\n },\n () => {\n restoreDialog();\n resolve(undefined);\n },\n );\n this.editorContainer.clear();\n this.editorContainer.addChild(selector);\n this.ui.setFocus(selector);\n this.ui.requestRender();\n });\n };\n\nInteractiveModeBase.prototype.showLoginDialog = async function(this: InteractiveModeBase, providerId: string, providerName: string): Promise<void> {\n const providerInfo = this.session.modelRegistry.authStorage\n .getOAuthProviders()\n .find((provider) => provider.id === providerId);\n const previousModel = this.session.model;\n\n // Providers that use callback servers (can paste redirect URL)\n const usesCallbackServer = providerInfo?.usesCallbackServer ?? false;\n\n // Create login dialog component\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n (_success, _message) => {\n // Completion handled below\n },\n providerName,\n );\n\n // Show dialog in editor container\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n\n // Promise for manual code input (racing with callback server)\n let manualCodeResolve: ((code: string) => void) | undefined;\n let manualCodeReject: ((err: Error) => void) | undefined;\n const manualCodePromise = new Promise<string>((resolve, reject) => {\n manualCodeResolve = resolve;\n manualCodeReject = reject;\n });\n\n // Restore editor helper\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n try {\n await this.session.modelRegistry.authStorage.login(\n providerId as OAuthProviderId,\n {\n onAuth: (info: { url: string; instructions?: string }) => {\n dialog.showAuth(info.url, info.instructions, {\n showCancelHint: !usesCallbackServer,\n });\n\n if (usesCallbackServer) {\n // Show input for manual paste, racing with callback\n dialog\n .showManualInput(\n \"Paste redirect URL below, or complete login in browser:\",\n )\n .then((value) => {\n if (value && manualCodeResolve) {\n manualCodeResolve(value);\n manualCodeResolve = undefined;\n }\n })\n .catch(() => {\n if (manualCodeReject) {\n manualCodeReject(new Error(\"Login cancelled\"));\n manualCodeReject = undefined;\n }\n });\n }\n // For Anthropic: onPrompt is called immediately after\n },\n\n onDeviceCode: (info) => {\n dialog.showDeviceCode(info);\n dialog.showWaiting(\"Waiting for authentication...\");\n },\n\n onPrompt: async (prompt: {\n message: string;\n placeholder?: string;\n }) => {\n return dialog.showPrompt(prompt.message, prompt.placeholder);\n },\n\n onProgress: (message: string) => {\n dialog.showProgress(message);\n },\n\n onSelect: (prompt: OAuthSelectPrompt) =>\n this.showOAuthLoginSelect(dialog, prompt),\n\n onManualCodeInput: () => manualCodePromise,\n\n signal: dialog.signal,\n },\n );\n\n // Success\n restoreEditor();\n await this.completeProviderAuthentication(\n providerId,\n providerName,\n \"oauth\",\n previousModel,\n );\n } catch (error: unknown) {\n restoreEditor();\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg !== \"Login cancelled\") {\n this.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n }\n }\n };\n"]}
@@ -53,6 +53,7 @@ InteractiveModeBase.prototype.completeProviderAuthentication = async function (p
53
53
  void this.maybeWarnAboutAnthropicSubscriptionAuth();
54
54
  }
55
55
  }
56
+ await this.resumePendingFirstRunOnboardingSeed();
56
57
  };
57
58
  InteractiveModeBase.prototype.showBedrockSetupDialog = function (providerId, providerName) {
58
59
  const restoreEditor = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-auth-login.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAsE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAClO,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEx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CAAC,CAAC;YAC/D,CAAC;YAED,UAAU,EAAE,CAAC,OAAe,EAAE,EAAE;gBAC9B,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YAC/B,CAAC;YAED,QAAQ,EAAE,CAAC,MAAyB,EAAE,EAAE,CACtC,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;YAE3C,iBAAiB,EAAE,GAAG,EAAE,CAAC,iBAAiB;YAE1C,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CACF,CAAC;QAEF,UAAU;QACV,aAAa,EAAE,CAAC;QAChB,MAAM,IAAI,CAAC,8BAA8B,CACvC,UAAU,EACV,YAAY,EACZ,OAAO,EACP,aAAa,CACd,CAAC;IACJ,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,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,QAAQ,KAAK,iBAAiB,EAAE,CAAC;YACnC,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, type OAuthProviderId, type OAuthSelectPrompt, path, getAuthPath, getDocsPath, defaultModelPerProvider, ExtensionSelectorComponent, LoginDialogComponent, theme } from \"./interactive-mode-deps.ts\";\nimport { hasDefaultModelProvider, isUnknownModel } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.completeProviderAuthentication = async function(this: InteractiveModeBase, providerId: string, providerName: string, authType: \"oauth\" | \"api_key\", previousModel: Model<Api> | undefined): Promise<void> {\n this.session.modelRegistry.refresh();\n\n const actionLabel =\n authType === \"oauth\"\n ? `Logged in to ${providerName}`\n : `Saved API key for ${providerName}`;\n\n let selectedModel: Model<Api> | undefined;\n let selectionError: string | undefined;\n if (isUnknownModel(previousModel)) {\n const availableModels = this.session.modelRegistry.getAvailable();\n const providerModels = availableModels.filter(\n (model) => model.provider === providerId,\n );\n if (!hasDefaultModelProvider(providerId)) {\n selectionError = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n } else if (providerModels.length === 0) {\n selectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\n } else {\n const defaultModelId = defaultModelPerProvider[providerId];\n selectedModel = providerModels.find(\n (model) => model.id === defaultModelId,\n );\n if (!selectedModel) {\n selectionError = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\n } else {\n try {\n await this.session.setModel(selectedModel);\n } catch (error: unknown) {\n selectedModel = undefined;\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n selectionError = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\n }\n }\n }\n }\n\n await this.updateAvailableProviderCount();\n this.setupAutocompleteProvider();\n this.footer.invalidate();\n this.updateEditorBorderColor();\n if (selectedModel) {\n this.showStatus(\n `${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`,\n );\n void this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n this.checkDaxnutsEasterEgg(selectedModel);\n } else {\n this.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);\n if (selectionError) {\n this.showError(selectionError);\n } else {\n void this.maybeWarnAboutAnthropicSubscriptionAuth();\n }\n }\n };\n\nInteractiveModeBase.prototype.showBedrockSetupDialog = function(this: InteractiveModeBase, providerId: string, providerName: string): void {\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n () => restoreEditor(),\n providerName,\n \"Amazon Bedrock setup\",\n );\n dialog.showInfo([\n theme.fg(\n \"text\",\n \"Amazon Bedrock uses AWS credentials instead of a single API key.\",\n ),\n theme.fg(\n \"text\",\n \"Configure an AWS profile, IAM keys, bearer token, or role-based credentials.\",\n ),\n theme.fg(\"muted\", \"See:\"),\n theme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n ]);\n\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showApiKeyLoginDialog = async function(this: InteractiveModeBase, providerId: string, providerName: string): Promise<void> {\n const previousModel = this.session.model;\n\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n (_success, _message) => {\n // Completion handled below\n },\n providerName,\n );\n\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n try {\n const apiKey = (await dialog.showPrompt(\"Enter API key:\")).trim();\n if (!apiKey) {\n throw new Error(\"API key cannot be empty.\");\n }\n\n this.session.modelRegistry.authStorage.set(providerId, {\n type: \"api_key\",\n key: apiKey,\n });\n\n restoreEditor();\n await this.completeProviderAuthentication(\n providerId,\n providerName,\n \"api_key\",\n previousModel,\n );\n } catch (error: unknown) {\n restoreEditor();\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg !== \"Login cancelled\") {\n this.showError(\n `Failed to save API key for ${providerName}: ${errorMsg}`,\n );\n }\n }\n };\n\nInteractiveModeBase.prototype.showOAuthLoginSelect = function(this: InteractiveModeBase, dialog: LoginDialogComponent, prompt: OAuthSelectPrompt): Promise<string | undefined> {\n return new Promise((resolve) => {\n const restoreDialog = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n };\n const labels = prompt.options.map((option) => option.label);\n const selector = new ExtensionSelectorComponent(\n prompt.message,\n labels,\n (optionLabel) => {\n restoreDialog();\n resolve(\n prompt.options.find((option) => option.label === optionLabel)?.id,\n );\n },\n () => {\n restoreDialog();\n resolve(undefined);\n },\n );\n this.editorContainer.clear();\n this.editorContainer.addChild(selector);\n this.ui.setFocus(selector);\n this.ui.requestRender();\n });\n };\n\nInteractiveModeBase.prototype.showLoginDialog = async function(this: InteractiveModeBase, providerId: string, providerName: string): Promise<void> {\n const providerInfo = this.session.modelRegistry.authStorage\n .getOAuthProviders()\n .find((provider) => provider.id === providerId);\n const previousModel = this.session.model;\n\n // Providers that use callback servers (can paste redirect URL)\n const usesCallbackServer = providerInfo?.usesCallbackServer ?? false;\n\n // Create login dialog component\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n (_success, _message) => {\n // Completion handled below\n },\n providerName,\n );\n\n // Show dialog in editor container\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n\n // Promise for manual code input (racing with callback server)\n let manualCodeResolve: ((code: string) => void) | undefined;\n let manualCodeReject: ((err: Error) => void) | undefined;\n const manualCodePromise = new Promise<string>((resolve, reject) => {\n manualCodeResolve = resolve;\n manualCodeReject = reject;\n });\n\n // Restore editor helper\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n try {\n await this.session.modelRegistry.authStorage.login(\n providerId as OAuthProviderId,\n {\n onAuth: (info: { url: string; instructions?: string }) => {\n dialog.showAuth(info.url, info.instructions, {\n showCancelHint: !usesCallbackServer,\n });\n\n if (usesCallbackServer) {\n // Show input for manual paste, racing with callback\n dialog\n .showManualInput(\n \"Paste redirect URL below, or complete login in browser:\",\n )\n .then((value) => {\n if (value && manualCodeResolve) {\n manualCodeResolve(value);\n manualCodeResolve = undefined;\n }\n })\n .catch(() => {\n if (manualCodeReject) {\n manualCodeReject(new Error(\"Login cancelled\"));\n manualCodeReject = undefined;\n }\n });\n }\n // For Anthropic: onPrompt is called immediately after\n },\n\n onDeviceCode: (info) => {\n dialog.showDeviceCode(info);\n dialog.showWaiting(\"Waiting for authentication...\");\n },\n\n onPrompt: async (prompt: {\n message: string;\n placeholder?: string;\n }) => {\n return dialog.showPrompt(prompt.message, prompt.placeholder);\n },\n\n onProgress: (message: string) => {\n dialog.showProgress(message);\n },\n\n onSelect: (prompt: OAuthSelectPrompt) =>\n this.showOAuthLoginSelect(dialog, prompt),\n\n onManualCodeInput: () => manualCodePromise,\n\n signal: dialog.signal,\n },\n );\n\n // Success\n restoreEditor();\n await this.completeProviderAuthentication(\n providerId,\n providerName,\n \"oauth\",\n previousModel,\n );\n } catch (error: unknown) {\n restoreEditor();\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg !== \"Login cancelled\") {\n this.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n }\n }\n };\n"]}
1
+ {"version":3,"file":"interactive-auth-login.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAsE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAClO,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAExF,mBAAmB,CAAC,SAAS,CAAC,8BAA8B,GAAG,KAAK,WAAqC,UAAkB,EAAE,YAAoB,EAAE,QAA6B,EAAE,aAAqC;IACnN,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;IAErC,MAAM,WAAW,GACf,QAAQ,KAAK,OAAO;QAClB,CAAC,CAAC,gBAAgB,YAAY,EAAE;QAChC,CAAC,CAAC,qBAAqB,YAAY,EAAE,CAAC;IAE1C,IAAI,aAAqC,CAAC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iBAAiB;YAE1C,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CACF,CAAC;QAEF,UAAU;QACV,aAAa,EAAE,CAAC;QAChB,MAAM,IAAI,CAAC,8BAA8B,CACvC,UAAU,EACV,YAAY,EACZ,OAAO,EACP,aAAa,CACd,CAAC;IACJ,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,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,QAAQ,KAAK,iBAAiB,EAAE,CAAC;YACnC,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, type OAuthProviderId, type OAuthSelectPrompt, path, getAuthPath, getDocsPath, defaultModelPerProvider, ExtensionSelectorComponent, LoginDialogComponent, theme } from \"./interactive-mode-deps.ts\";\nimport { hasDefaultModelProvider, isUnknownModel } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.completeProviderAuthentication = async function(this: InteractiveModeBase, providerId: string, providerName: string, authType: \"oauth\" | \"api_key\", previousModel: Model<Api> | undefined): Promise<void> {\n this.session.modelRegistry.refresh();\n\n const actionLabel =\n authType === \"oauth\"\n ? `Logged in to ${providerName}`\n : `Saved API key for ${providerName}`;\n\n let selectedModel: Model<Api> | undefined;\n let selectionError: string | undefined;\n if (isUnknownModel(previousModel)) {\n const availableModels = this.session.modelRegistry.getAvailable();\n const providerModels = availableModels.filter(\n (model) => model.provider === providerId,\n );\n if (!hasDefaultModelProvider(providerId)) {\n selectionError = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n } else if (providerModels.length === 0) {\n selectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\n } else {\n const defaultModelId = defaultModelPerProvider[providerId];\n selectedModel = providerModels.find(\n (model) => model.id === defaultModelId,\n );\n if (!selectedModel) {\n selectionError = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\n } else {\n try {\n await this.session.setModel(selectedModel);\n } catch (error: unknown) {\n selectedModel = undefined;\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n selectionError = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\n }\n }\n }\n }\n\n await this.updateAvailableProviderCount();\n this.setupAutocompleteProvider();\n this.footer.invalidate();\n this.updateEditorBorderColor();\n if (selectedModel) {\n this.showStatus(\n `${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`,\n );\n void this.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n this.checkDaxnutsEasterEgg(selectedModel);\n } else {\n this.showStatus(`${actionLabel}. Credentials saved to ${getAuthPath()}`);\n if (selectionError) {\n this.showError(selectionError);\n } else {\n void this.maybeWarnAboutAnthropicSubscriptionAuth();\n }\n }\n\n await this.resumePendingFirstRunOnboardingSeed();\n };\n\nInteractiveModeBase.prototype.showBedrockSetupDialog = function(this: InteractiveModeBase, providerId: string, providerName: string): void {\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n () => restoreEditor(),\n providerName,\n \"Amazon Bedrock setup\",\n );\n dialog.showInfo([\n theme.fg(\n \"text\",\n \"Amazon Bedrock uses AWS credentials instead of a single API key.\",\n ),\n theme.fg(\n \"text\",\n \"Configure an AWS profile, IAM keys, bearer token, or role-based credentials.\",\n ),\n theme.fg(\"muted\", \"See:\"),\n theme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n ]);\n\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.showApiKeyLoginDialog = async function(this: InteractiveModeBase, providerId: string, providerName: string): Promise<void> {\n const previousModel = this.session.model;\n\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n (_success, _message) => {\n // Completion handled below\n },\n providerName,\n );\n\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n try {\n const apiKey = (await dialog.showPrompt(\"Enter API key:\")).trim();\n if (!apiKey) {\n throw new Error(\"API key cannot be empty.\");\n }\n\n this.session.modelRegistry.authStorage.set(providerId, {\n type: \"api_key\",\n key: apiKey,\n });\n\n restoreEditor();\n await this.completeProviderAuthentication(\n providerId,\n providerName,\n \"api_key\",\n previousModel,\n );\n } catch (error: unknown) {\n restoreEditor();\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg !== \"Login cancelled\") {\n this.showError(\n `Failed to save API key for ${providerName}: ${errorMsg}`,\n );\n }\n }\n };\n\nInteractiveModeBase.prototype.showOAuthLoginSelect = function(this: InteractiveModeBase, dialog: LoginDialogComponent, prompt: OAuthSelectPrompt): Promise<string | undefined> {\n return new Promise((resolve) => {\n const restoreDialog = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n };\n const labels = prompt.options.map((option) => option.label);\n const selector = new ExtensionSelectorComponent(\n prompt.message,\n labels,\n (optionLabel) => {\n restoreDialog();\n resolve(\n prompt.options.find((option) => option.label === optionLabel)?.id,\n );\n },\n () => {\n restoreDialog();\n resolve(undefined);\n },\n );\n this.editorContainer.clear();\n this.editorContainer.addChild(selector);\n this.ui.setFocus(selector);\n this.ui.requestRender();\n });\n };\n\nInteractiveModeBase.prototype.showLoginDialog = async function(this: InteractiveModeBase, providerId: string, providerName: string): Promise<void> {\n const providerInfo = this.session.modelRegistry.authStorage\n .getOAuthProviders()\n .find((provider) => provider.id === providerId);\n const previousModel = this.session.model;\n\n // Providers that use callback servers (can paste redirect URL)\n const usesCallbackServer = providerInfo?.usesCallbackServer ?? false;\n\n // Create login dialog component\n const dialog = new LoginDialogComponent(\n this.ui,\n providerId,\n (_success, _message) => {\n // Completion handled below\n },\n providerName,\n );\n\n // Show dialog in editor container\n this.editorContainer.clear();\n this.editorContainer.addChild(dialog);\n this.ui.setFocus(dialog);\n this.ui.requestRender();\n\n // Promise for manual code input (racing with callback server)\n let manualCodeResolve: ((code: string) => void) | undefined;\n let manualCodeReject: ((err: Error) => void) | undefined;\n const manualCodePromise = new Promise<string>((resolve, reject) => {\n manualCodeResolve = resolve;\n manualCodeReject = reject;\n });\n\n // Restore editor helper\n const restoreEditor = () => {\n this.editorContainer.clear();\n this.editorContainer.addChild(this.editor);\n this.ui.setFocus(this.editor);\n this.ui.requestRender();\n };\n\n try {\n await this.session.modelRegistry.authStorage.login(\n providerId as OAuthProviderId,\n {\n onAuth: (info: { url: string; instructions?: string }) => {\n dialog.showAuth(info.url, info.instructions, {\n showCancelHint: !usesCallbackServer,\n });\n\n if (usesCallbackServer) {\n // Show input for manual paste, racing with callback\n dialog\n .showManualInput(\n \"Paste redirect URL below, or complete login in browser:\",\n )\n .then((value) => {\n if (value && manualCodeResolve) {\n manualCodeResolve(value);\n manualCodeResolve = undefined;\n }\n })\n .catch(() => {\n if (manualCodeReject) {\n manualCodeReject(new Error(\"Login cancelled\"));\n manualCodeReject = undefined;\n }\n });\n }\n // For Anthropic: onPrompt is called immediately after\n },\n\n onDeviceCode: (info) => {\n dialog.showDeviceCode(info);\n dialog.showWaiting(\"Waiting for authentication...\");\n },\n\n onPrompt: async (prompt: {\n message: string;\n placeholder?: string;\n }) => {\n return dialog.showPrompt(prompt.message, prompt.placeholder);\n },\n\n onProgress: (message: string) => {\n dialog.showProgress(message);\n },\n\n onSelect: (prompt: OAuthSelectPrompt) =>\n this.showOAuthLoginSelect(dialog, prompt),\n\n onManualCodeInput: () => manualCodePromise,\n\n signal: dialog.signal,\n },\n );\n\n // Success\n restoreEditor();\n await this.completeProviderAuthentication(\n providerId,\n providerName,\n \"oauth\",\n previousModel,\n );\n } catch (error: unknown) {\n restoreEditor();\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg !== \"Login cancelled\") {\n this.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n }\n }\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-autocomplete.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-autocomplete.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, type AutocompleteItem, type AutocompleteProvider, type SlashCommand, type ExtensionRunner, type ResourceDiagnostic, type SourceInfo, CombinedAutocompleteProvider, fuzzyFilter, hasSupportedCodexFastModeModel, BUILTIN_SLASH_COMMANDS, parseGitUrl, getModelSearchText } from \"./interactive-mode-deps.ts\";\nimport { BUILTIN_SLASH_COMMAND_NAMES } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.getAutocompleteSourceTag = function(this: InteractiveModeBase, sourceInfo?: SourceInfo): string | undefined {\n if (!sourceInfo) {\n return undefined;\n }\n\n const scopePrefix =\n sourceInfo.scope === \"user\"\n ? \"u\"\n : sourceInfo.scope === \"project\"\n ? \"p\"\n : \"t\";\n const source = sourceInfo.source.trim();\n\n if (source === \"auto\" || source === \"local\" || source === \"cli\") {\n return scopePrefix;\n }\n\n if (source.startsWith(\"npm:\")) {\n return `${scopePrefix}:${source}`;\n }\n\n const gitSource = parseGitUrl(source);\n if (gitSource) {\n const ref = gitSource.ref ? `@${gitSource.ref}` : \"\";\n return `${scopePrefix}:git:${gitSource.host}/${gitSource.path}${ref}`;\n }\n\n return scopePrefix;\n };\n\nInteractiveModeBase.prototype.prefixAutocompleteDescription = function(this: InteractiveModeBase, description: string | undefined, sourceInfo?: SourceInfo): string | undefined {\n const sourceTag = this.getAutocompleteSourceTag(sourceInfo);\n if (!sourceTag) {\n return description;\n }\n return description ? `[${sourceTag}] ${description}` : `[${sourceTag}]`;\n };\n\nInteractiveModeBase.prototype.getBuiltInCommandConflictDiagnostics = function(this: InteractiveModeBase, extensionRunner: ExtensionRunner): ResourceDiagnostic[] {\n return extensionRunner\n .getRegisteredCommands()\n .filter((command) => BUILTIN_SLASH_COMMAND_NAMES.has(command.name))\n .map((command) => ({\n type: \"warning\" as const,\n message:\n command.invocationName === command.name\n ? `Extension command '/${command.name}' conflicts with built-in interactive command. Skipping in autocomplete.`\n : `Extension command '/${command.name}' conflicts with built-in interactive command. Available as '/${command.invocationName}'.`,\n path: command.sourceInfo.path,\n }));\n };\n\nInteractiveModeBase.prototype.getCodexFastModeCandidateModels = function(this: InteractiveModeBase): Model<Api>[] {\n if (this.session.scopedModels.length > 0) {\n return this.session.scopedModels\n .map((scoped) => scoped.model)\n .filter((model) => this.session.modelRegistry.hasConfiguredAuth(model));\n }\n\n return this.session.modelRegistry.getAvailable();\n };\n\nInteractiveModeBase.prototype.hasCodexFastModeSupportedModels = function(this: InteractiveModeBase): boolean {\n return hasSupportedCodexFastModeModel(\n this.getCodexFastModeCandidateModels(),\n );\n };\n\nInteractiveModeBase.prototype.createBaseAutocompleteProvider = function(this: InteractiveModeBase): AutocompleteProvider {\n // Define commands for autocomplete\n const slashCommands: SlashCommand[] = BUILTIN_SLASH_COMMANDS.filter(\n (command) => command.name !== \"fast\" || this.hasCodexFastModeSupportedModels(),\n ).map((command) => ({\n name: command.name,\n description: command.description,\n getArgumentCompletions: command.getArgumentCompletions,\n }));\n\n const modelCommand = slashCommands.find(\n (command) => command.name === \"model\",\n );\n if (modelCommand) {\n modelCommand.getArgumentCompletions = (\n prefix: string,\n ): AutocompleteItem[] | null => {\n // Get available models (scoped or from registry)\n const models =\n this.session.scopedModels.length > 0\n ? this.session.scopedModels.map((s) => s.model)\n : this.session.modelRegistry.getAvailable();\n\n if (models.length === 0) return null;\n\n // Create items with provider/id format\n const items = models.map((m) => ({\n id: m.id,\n provider: m.provider,\n name: m.name,\n label: `${m.provider}/${m.id}`,\n }));\n\n // Fuzzy filter by model ID + provider in either order.\n const filtered = fuzzyFilter(items, prefix, getModelSearchText);\n\n if (filtered.length === 0) return null;\n\n return filtered.map((item) => ({\n value: item.label,\n label: item.id,\n description: item.provider,\n }));\n };\n }\n\n // Convert prompt templates to SlashCommand format for autocomplete\n const templateCommands: SlashCommand[] = this.session.promptTemplates.map(\n (cmd) => ({\n name: cmd.name,\n description: this.prefixAutocompleteDescription(\n cmd.description,\n cmd.sourceInfo,\n ),\n ...(cmd.argumentHint && { argumentHint: cmd.argumentHint }),\n }),\n );\n\n // Convert extension commands to SlashCommand format. Built-in command names\n // stay reserved even when a built-in is contextually hidden (for example,\n // /fast without a supported OpenAI model) so extension visibility cannot\n // change as auth/model state changes.\n const extensionCommands: SlashCommand[] = this.session.extensionRunner\n .getRegisteredCommands()\n .filter((cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name))\n .map((cmd) => ({\n name: cmd.invocationName,\n description: this.prefixAutocompleteDescription(\n cmd.description,\n cmd.sourceInfo,\n ),\n getArgumentCompletions: cmd.getArgumentCompletions,\n }));\n\n // Build skill commands from session.skills (if enabled)\n this.skillCommands.clear();\n const skillCommandList: SlashCommand[] = [];\n if (this.settingsManager.getEnableSkillCommands()) {\n for (const skill of this.session.resourceLoader.getSkills().skills) {\n const commandName = `skill:${skill.name}`;\n this.skillCommands.set(commandName, skill.filePath);\n skillCommandList.push({\n name: commandName,\n description: this.prefixAutocompleteDescription(\n skill.description,\n skill.sourceInfo,\n ),\n });\n }\n }\n\n return new CombinedAutocompleteProvider(\n [\n ...slashCommands,\n ...templateCommands,\n ...extensionCommands,\n ...skillCommandList,\n ],\n this.sessionManager.getCwd(),\n this.fdPath,\n );\n };\n\nInteractiveModeBase.prototype.setupAutocompleteProvider = function(this: InteractiveModeBase): void {\n let provider = this.createBaseAutocompleteProvider();\n for (const wrapProvider of this.autocompleteProviderWrappers) {\n provider = wrapProvider(provider);\n }\n\n this.autocompleteProvider = provider;\n this.defaultEditor.setAutocompleteProvider(provider);\n if (this.editor !== this.defaultEditor) {\n this.editor.setAutocompleteProvider?.(provider);\n }\n };\n"]}
1
+ {"version":3,"file":"interactive-autocomplete.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-autocomplete.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, type AutocompleteItem, type AutocompleteProvider, type AutocompleteSuggestions, type SlashCommand, type ExtensionRunner, type ResourceDiagnostic, type SourceInfo, CombinedAutocompleteProvider, fuzzyFilter, hasSupportedCodexFastModeModel, BUILTIN_SLASH_COMMANDS, parseGitUrl, getModelSearchText } from \"./interactive-mode-deps.ts\";\nimport { BUILTIN_SLASH_COMMAND_NAMES } from \"./interactive-mode-helpers.ts\";\n\nconst AT_MENTION_PATH_DELIMITERS = new Set([\" \", \"\\t\", '\"', \"'\", \"=\"]);\n\nfunction findLastAtMentionDelimiter(text: string): number {\n for (let index = text.length - 1; index >= 0; index -= 1) {\n if (AT_MENTION_PATH_DELIMITERS.has(text[index] ?? \"\")) return index;\n }\n return -1;\n}\n\nfunction isAtMentionTokenStart(text: string, index: number): boolean {\n return index === 0 || AT_MENTION_PATH_DELIMITERS.has(text[index - 1] ?? \"\");\n}\n\nfunction findUnclosedAtMentionQuoteStart(text: string): number | null {\n let quoteStart = -1;\n let inQuotes = false;\n for (let index = 0; index < text.length; index += 1) {\n if (text[index] === '\"') {\n inQuotes = !inQuotes;\n if (inQuotes) quoteStart = index;\n }\n }\n return inQuotes ? quoteStart : null;\n}\n\nfunction extractAtMentionPrefix(textBeforeCursor: string): string | null {\n const quoteStart = findUnclosedAtMentionQuoteStart(textBeforeCursor);\n if (quoteStart !== null && quoteStart > 0 && textBeforeCursor[quoteStart - 1] === \"@\") {\n return isAtMentionTokenStart(textBeforeCursor, quoteStart - 1)\n ? textBeforeCursor.slice(quoteStart - 1)\n : null;\n }\n const lastDelimiterIndex = findLastAtMentionDelimiter(textBeforeCursor);\n const tokenStart = lastDelimiterIndex === -1 ? 0 : lastDelimiterIndex + 1;\n return textBeforeCursor[tokenStart] === \"@\" ? textBeforeCursor.slice(tokenStart) : null;\n}\n\nfunction atMentionPrefixToPathPrefix(atPrefix: string): string {\n return atPrefix.startsWith('@\"') ? `\"${atPrefix.slice(2)}` : atPrefix.slice(1);\n}\n\nfunction toAtMentionCompletion(item: AutocompleteItem): AutocompleteItem {\n return {\n ...item,\n value: item.value.startsWith(\"@\") ? item.value : `@${item.value}`,\n };\n}\n\nclass AtMentionFallbackAutocompleteProvider implements AutocompleteProvider {\n private readonly primary: AutocompleteProvider;\n private readonly pathFallback: AutocompleteProvider;\n\n constructor(primary: AutocompleteProvider, pathFallback: AutocompleteProvider) {\n this.primary = primary;\n this.pathFallback = pathFallback;\n }\n\n async getSuggestions(\n lines: string[],\n cursorLine: number,\n cursorCol: number,\n options: { signal: AbortSignal; force?: boolean },\n ): Promise<AutocompleteSuggestions | null> {\n const primarySuggestions = await this.primary.getSuggestions(lines, cursorLine, cursorCol, options);\n if (primarySuggestions || options.signal.aborted) return primarySuggestions;\n\n const currentLine = lines[cursorLine] ?? \"\";\n const textBeforeCursor = currentLine.slice(0, cursorCol);\n const atPrefix = extractAtMentionPrefix(textBeforeCursor);\n if (!atPrefix) return null;\n\n const pathPrefix = atMentionPrefixToPathPrefix(atPrefix);\n const prefixStart = cursorCol - atPrefix.length;\n const fallbackLines = [...lines];\n fallbackLines[cursorLine] = `${currentLine.slice(0, prefixStart)}${pathPrefix}${currentLine.slice(cursorCol)}`;\n const fallbackSuggestions = await this.pathFallback.getSuggestions(\n fallbackLines,\n cursorLine,\n prefixStart + pathPrefix.length,\n { ...options, force: true },\n );\n if (!fallbackSuggestions) return null;\n\n return {\n prefix: atPrefix,\n items: fallbackSuggestions.items.map(toAtMentionCompletion),\n };\n }\n\n applyCompletion(\n lines: string[],\n cursorLine: number,\n cursorCol: number,\n item: AutocompleteItem,\n prefix: string,\n ): { lines: string[]; cursorLine: number; cursorCol: number } {\n return this.primary.applyCompletion(lines, cursorLine, cursorCol, item, prefix);\n }\n\n shouldTriggerFileCompletion(lines: string[], cursorLine: number, cursorCol: number): boolean {\n return this.primary.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;\n }\n}\n\nInteractiveModeBase.prototype.getAutocompleteSourceTag = function(this: InteractiveModeBase, sourceInfo?: SourceInfo): string | undefined {\n if (!sourceInfo) {\n return undefined;\n }\n\n const scopePrefix =\n sourceInfo.scope === \"user\"\n ? \"u\"\n : sourceInfo.scope === \"project\"\n ? \"p\"\n : \"t\";\n const source = sourceInfo.source.trim();\n\n if (source === \"auto\" || source === \"local\" || source === \"cli\") {\n return scopePrefix;\n }\n\n if (source.startsWith(\"npm:\")) {\n return `${scopePrefix}:${source}`;\n }\n\n const gitSource = parseGitUrl(source);\n if (gitSource) {\n const ref = gitSource.ref ? `@${gitSource.ref}` : \"\";\n return `${scopePrefix}:git:${gitSource.host}/${gitSource.path}${ref}`;\n }\n\n return scopePrefix;\n };\n\nInteractiveModeBase.prototype.prefixAutocompleteDescription = function(this: InteractiveModeBase, description: string | undefined, sourceInfo?: SourceInfo): string | undefined {\n const sourceTag = this.getAutocompleteSourceTag(sourceInfo);\n if (!sourceTag) {\n return description;\n }\n return description ? `[${sourceTag}] ${description}` : `[${sourceTag}]`;\n };\n\nInteractiveModeBase.prototype.getBuiltInCommandConflictDiagnostics = function(this: InteractiveModeBase, extensionRunner: ExtensionRunner): ResourceDiagnostic[] {\n return extensionRunner\n .getRegisteredCommands()\n .filter((command) => BUILTIN_SLASH_COMMAND_NAMES.has(command.name))\n .map((command) => ({\n type: \"warning\" as const,\n message:\n command.invocationName === command.name\n ? `Extension command '/${command.name}' conflicts with built-in interactive command. Skipping in autocomplete.`\n : `Extension command '/${command.name}' conflicts with built-in interactive command. Available as '/${command.invocationName}'.`,\n path: command.sourceInfo.path,\n }));\n };\n\nInteractiveModeBase.prototype.getCodexFastModeCandidateModels = function(this: InteractiveModeBase): Model<Api>[] {\n if (this.session.scopedModels.length > 0) {\n return this.session.scopedModels\n .map((scoped) => scoped.model)\n .filter((model) => this.session.modelRegistry.hasConfiguredAuth(model));\n }\n\n return this.session.modelRegistry.getAvailable();\n };\n\nInteractiveModeBase.prototype.hasCodexFastModeSupportedModels = function(this: InteractiveModeBase): boolean {\n return hasSupportedCodexFastModeModel(\n this.getCodexFastModeCandidateModels(),\n );\n };\n\nInteractiveModeBase.prototype.createBaseAutocompleteProvider = function(this: InteractiveModeBase): AutocompleteProvider {\n // Define commands for autocomplete\n const slashCommands: SlashCommand[] = BUILTIN_SLASH_COMMANDS.filter(\n (command) => command.name !== \"fast\" || this.hasCodexFastModeSupportedModels(),\n ).map((command) => ({\n name: command.name,\n description: command.description,\n getArgumentCompletions: command.getArgumentCompletions,\n }));\n\n const modelCommand = slashCommands.find(\n (command) => command.name === \"model\",\n );\n if (modelCommand) {\n modelCommand.getArgumentCompletions = (\n prefix: string,\n ): AutocompleteItem[] | null => {\n // Get available models (scoped or from registry)\n const models =\n this.session.scopedModels.length > 0\n ? this.session.scopedModels.map((s) => s.model)\n : this.session.modelRegistry.getAvailable();\n\n if (models.length === 0) return null;\n\n // Create items with provider/id format\n const items = models.map((m) => ({\n id: m.id,\n provider: m.provider,\n name: m.name,\n label: `${m.provider}/${m.id}`,\n }));\n\n // Fuzzy filter by model ID + provider in either order.\n const filtered = fuzzyFilter(items, prefix, getModelSearchText);\n\n if (filtered.length === 0) return null;\n\n return filtered.map((item) => ({\n value: item.label,\n label: item.id,\n description: item.provider,\n }));\n };\n }\n\n // Convert prompt templates to SlashCommand format for autocomplete\n const templateCommands: SlashCommand[] = this.session.promptTemplates.map(\n (cmd) => ({\n name: cmd.name,\n description: this.prefixAutocompleteDescription(\n cmd.description,\n cmd.sourceInfo,\n ),\n ...(cmd.argumentHint && { argumentHint: cmd.argumentHint }),\n }),\n );\n\n // Convert extension commands to SlashCommand format. Built-in command names\n // stay reserved even when a built-in is contextually hidden (for example,\n // /fast without a supported OpenAI model) so extension visibility cannot\n // change as auth/model state changes.\n const extensionCommands: SlashCommand[] = this.session.extensionRunner\n .getRegisteredCommands()\n .filter((cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name))\n .map((cmd) => ({\n name: cmd.invocationName,\n description: this.prefixAutocompleteDescription(\n cmd.description,\n cmd.sourceInfo,\n ),\n getArgumentCompletions: cmd.getArgumentCompletions,\n }));\n\n // Build skill commands from session.skills (if enabled)\n this.skillCommands.clear();\n const skillCommandList: SlashCommand[] = [];\n if (this.settingsManager.getEnableSkillCommands()) {\n for (const skill of this.session.resourceLoader.getSkills().skills) {\n const commandName = `skill:${skill.name}`;\n this.skillCommands.set(commandName, skill.filePath);\n skillCommandList.push({\n name: commandName,\n description: this.prefixAutocompleteDescription(\n skill.description,\n skill.sourceInfo,\n ),\n });\n }\n }\n\n const commands = [\n ...slashCommands,\n ...templateCommands,\n ...extensionCommands,\n ...skillCommandList,\n ];\n const cwd = this.sessionManager.getCwd();\n return new AtMentionFallbackAutocompleteProvider(\n new CombinedAutocompleteProvider(commands, cwd, this.fdPath),\n new CombinedAutocompleteProvider(commands, cwd, null),\n );\n };\n\nInteractiveModeBase.prototype.setupAutocompleteProvider = function(this: InteractiveModeBase): void {\n let provider = this.createBaseAutocompleteProvider();\n for (const wrapProvider of this.autocompleteProviderWrappers) {\n provider = wrapProvider(provider);\n }\n\n this.autocompleteProvider = provider;\n this.defaultEditor.setAutocompleteProvider(provider);\n if (this.editor !== this.defaultEditor) {\n this.editor.setAutocompleteProvider?.(provider);\n }\n };\n"]}
@@ -1,6 +1,82 @@
1
1
  import { InteractiveModeBase } from "./interactive-mode-base.js";
2
2
  import { CombinedAutocompleteProvider, fuzzyFilter, hasSupportedCodexFastModeModel, BUILTIN_SLASH_COMMANDS, parseGitUrl, getModelSearchText } from "./interactive-mode-deps.js";
3
3
  import { BUILTIN_SLASH_COMMAND_NAMES } from "./interactive-mode-helpers.js";
4
+ const AT_MENTION_PATH_DELIMITERS = new Set([" ", "\t", '"', "'", "="]);
5
+ function findLastAtMentionDelimiter(text) {
6
+ for (let index = text.length - 1; index >= 0; index -= 1) {
7
+ if (AT_MENTION_PATH_DELIMITERS.has(text[index] ?? ""))
8
+ return index;
9
+ }
10
+ return -1;
11
+ }
12
+ function isAtMentionTokenStart(text, index) {
13
+ return index === 0 || AT_MENTION_PATH_DELIMITERS.has(text[index - 1] ?? "");
14
+ }
15
+ function findUnclosedAtMentionQuoteStart(text) {
16
+ let quoteStart = -1;
17
+ let inQuotes = false;
18
+ for (let index = 0; index < text.length; index += 1) {
19
+ if (text[index] === '"') {
20
+ inQuotes = !inQuotes;
21
+ if (inQuotes)
22
+ quoteStart = index;
23
+ }
24
+ }
25
+ return inQuotes ? quoteStart : null;
26
+ }
27
+ function extractAtMentionPrefix(textBeforeCursor) {
28
+ const quoteStart = findUnclosedAtMentionQuoteStart(textBeforeCursor);
29
+ if (quoteStart !== null && quoteStart > 0 && textBeforeCursor[quoteStart - 1] === "@") {
30
+ return isAtMentionTokenStart(textBeforeCursor, quoteStart - 1)
31
+ ? textBeforeCursor.slice(quoteStart - 1)
32
+ : null;
33
+ }
34
+ const lastDelimiterIndex = findLastAtMentionDelimiter(textBeforeCursor);
35
+ const tokenStart = lastDelimiterIndex === -1 ? 0 : lastDelimiterIndex + 1;
36
+ return textBeforeCursor[tokenStart] === "@" ? textBeforeCursor.slice(tokenStart) : null;
37
+ }
38
+ function atMentionPrefixToPathPrefix(atPrefix) {
39
+ return atPrefix.startsWith('@"') ? `"${atPrefix.slice(2)}` : atPrefix.slice(1);
40
+ }
41
+ function toAtMentionCompletion(item) {
42
+ return {
43
+ ...item,
44
+ value: item.value.startsWith("@") ? item.value : `@${item.value}`,
45
+ };
46
+ }
47
+ class AtMentionFallbackAutocompleteProvider {
48
+ constructor(primary, pathFallback) {
49
+ this.primary = primary;
50
+ this.pathFallback = pathFallback;
51
+ }
52
+ async getSuggestions(lines, cursorLine, cursorCol, options) {
53
+ const primarySuggestions = await this.primary.getSuggestions(lines, cursorLine, cursorCol, options);
54
+ if (primarySuggestions || options.signal.aborted)
55
+ return primarySuggestions;
56
+ const currentLine = lines[cursorLine] ?? "";
57
+ const textBeforeCursor = currentLine.slice(0, cursorCol);
58
+ const atPrefix = extractAtMentionPrefix(textBeforeCursor);
59
+ if (!atPrefix)
60
+ return null;
61
+ const pathPrefix = atMentionPrefixToPathPrefix(atPrefix);
62
+ const prefixStart = cursorCol - atPrefix.length;
63
+ const fallbackLines = [...lines];
64
+ fallbackLines[cursorLine] = `${currentLine.slice(0, prefixStart)}${pathPrefix}${currentLine.slice(cursorCol)}`;
65
+ const fallbackSuggestions = await this.pathFallback.getSuggestions(fallbackLines, cursorLine, prefixStart + pathPrefix.length, { ...options, force: true });
66
+ if (!fallbackSuggestions)
67
+ return null;
68
+ return {
69
+ prefix: atPrefix,
70
+ items: fallbackSuggestions.items.map(toAtMentionCompletion),
71
+ };
72
+ }
73
+ applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
74
+ return this.primary.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
75
+ }
76
+ shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
77
+ return this.primary.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;
78
+ }
79
+ }
4
80
  InteractiveModeBase.prototype.getAutocompleteSourceTag = function (sourceInfo) {
5
81
  if (!sourceInfo) {
6
82
  return undefined;
@@ -119,12 +195,14 @@ InteractiveModeBase.prototype.createBaseAutocompleteProvider = function () {
119
195
  });
120
196
  }
121
197
  }
122
- return new CombinedAutocompleteProvider([
198
+ const commands = [
123
199
  ...slashCommands,
124
200
  ...templateCommands,
125
201
  ...extensionCommands,
126
202
  ...skillCommandList,
127
- ], this.sessionManager.getCwd(), this.fdPath);
203
+ ];
204
+ const cwd = this.sessionManager.getCwd();
205
+ return new AtMentionFallbackAutocompleteProvider(new CombinedAutocompleteProvider(commands, cwd, this.fdPath), new CombinedAutocompleteProvider(commands, cwd, null));
128
206
  };
129
207
  InteractiveModeBase.prototype.setupAutocompleteProvider = function () {
130
208
  let provider = this.createBaseAutocompleteProvider();
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-autocomplete.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAA6J,4BAA4B,EAAE,WAAW,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC3U,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG,UAAoC,UAAuB;IAChH,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,WAAW,GACf,UAAU,CAAC,KAAK,KAAK,MAAM;QACzB,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,UAAU,CAAC,KAAK,KAAK,SAAS;YAC9B,CAAC,CAAC,GAAG;YACL,CAAC,CAAC,GAAG,CAAC;IACZ,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAExC,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QAChE,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,OAAO,GAAG,WAAW,IAAI,MAAM,EAAE,CAAC;IACpC,CAAC;IAED,MAAM,SAAS,GAAG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B,KAAK,CAAC,UAAU,CACjB;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,IAAI,4BAA4B,CACrC;QACE,GAAG,aAAa;QAChB,GAAG,gBAAgB;QACnB,GAAG,iBAAiB;QACpB,GAAG,gBAAgB;KACpB,EACD,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,EAC5B,IAAI,CAAC,MAAM,CACZ,CAAC;AACJ,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,yBAAyB,GAAG;IACtD,IAAI,QAAQ,GAAG,IAAI,CAAC,8BAA8B,EAAE,CAAC;IACrD,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAC7D,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,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;QACvC,IAAI,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, type AutocompleteItem, type AutocompleteProvider, type SlashCommand, type ExtensionRunner, type ResourceDiagnostic, type SourceInfo, CombinedAutocompleteProvider, fuzzyFilter, hasSupportedCodexFastModeModel, BUILTIN_SLASH_COMMANDS, parseGitUrl, getModelSearchText } from \"./interactive-mode-deps.ts\";\nimport { BUILTIN_SLASH_COMMAND_NAMES } from \"./interactive-mode-helpers.ts\";\n\nInteractiveModeBase.prototype.getAutocompleteSourceTag = function(this: InteractiveModeBase, sourceInfo?: SourceInfo): string | undefined {\n if (!sourceInfo) {\n return undefined;\n }\n\n const scopePrefix =\n sourceInfo.scope === \"user\"\n ? \"u\"\n : sourceInfo.scope === \"project\"\n ? \"p\"\n : \"t\";\n const source = sourceInfo.source.trim();\n\n if (source === \"auto\" || source === \"local\" || source === \"cli\") {\n return scopePrefix;\n }\n\n if (source.startsWith(\"npm:\")) {\n return `${scopePrefix}:${source}`;\n }\n\n const gitSource = parseGitUrl(source);\n if (gitSource) {\n const ref = gitSource.ref ? `@${gitSource.ref}` : \"\";\n return `${scopePrefix}:git:${gitSource.host}/${gitSource.path}${ref}`;\n }\n\n return scopePrefix;\n };\n\nInteractiveModeBase.prototype.prefixAutocompleteDescription = function(this: InteractiveModeBase, description: string | undefined, sourceInfo?: SourceInfo): string | undefined {\n const sourceTag = this.getAutocompleteSourceTag(sourceInfo);\n if (!sourceTag) {\n return description;\n }\n return description ? `[${sourceTag}] ${description}` : `[${sourceTag}]`;\n };\n\nInteractiveModeBase.prototype.getBuiltInCommandConflictDiagnostics = function(this: InteractiveModeBase, extensionRunner: ExtensionRunner): ResourceDiagnostic[] {\n return extensionRunner\n .getRegisteredCommands()\n .filter((command) => BUILTIN_SLASH_COMMAND_NAMES.has(command.name))\n .map((command) => ({\n type: \"warning\" as const,\n message:\n command.invocationName === command.name\n ? `Extension command '/${command.name}' conflicts with built-in interactive command. Skipping in autocomplete.`\n : `Extension command '/${command.name}' conflicts with built-in interactive command. Available as '/${command.invocationName}'.`,\n path: command.sourceInfo.path,\n }));\n };\n\nInteractiveModeBase.prototype.getCodexFastModeCandidateModels = function(this: InteractiveModeBase): Model<Api>[] {\n if (this.session.scopedModels.length > 0) {\n return this.session.scopedModels\n .map((scoped) => scoped.model)\n .filter((model) => this.session.modelRegistry.hasConfiguredAuth(model));\n }\n\n return this.session.modelRegistry.getAvailable();\n };\n\nInteractiveModeBase.prototype.hasCodexFastModeSupportedModels = function(this: InteractiveModeBase): boolean {\n return hasSupportedCodexFastModeModel(\n this.getCodexFastModeCandidateModels(),\n );\n };\n\nInteractiveModeBase.prototype.createBaseAutocompleteProvider = function(this: InteractiveModeBase): AutocompleteProvider {\n // Define commands for autocomplete\n const slashCommands: SlashCommand[] = BUILTIN_SLASH_COMMANDS.filter(\n (command) => command.name !== \"fast\" || this.hasCodexFastModeSupportedModels(),\n ).map((command) => ({\n name: command.name,\n description: command.description,\n getArgumentCompletions: command.getArgumentCompletions,\n }));\n\n const modelCommand = slashCommands.find(\n (command) => command.name === \"model\",\n );\n if (modelCommand) {\n modelCommand.getArgumentCompletions = (\n prefix: string,\n ): AutocompleteItem[] | null => {\n // Get available models (scoped or from registry)\n const models =\n this.session.scopedModels.length > 0\n ? this.session.scopedModels.map((s) => s.model)\n : this.session.modelRegistry.getAvailable();\n\n if (models.length === 0) return null;\n\n // Create items with provider/id format\n const items = models.map((m) => ({\n id: m.id,\n provider: m.provider,\n name: m.name,\n label: `${m.provider}/${m.id}`,\n }));\n\n // Fuzzy filter by model ID + provider in either order.\n const filtered = fuzzyFilter(items, prefix, getModelSearchText);\n\n if (filtered.length === 0) return null;\n\n return filtered.map((item) => ({\n value: item.label,\n label: item.id,\n description: item.provider,\n }));\n };\n }\n\n // Convert prompt templates to SlashCommand format for autocomplete\n const templateCommands: SlashCommand[] = this.session.promptTemplates.map(\n (cmd) => ({\n name: cmd.name,\n description: this.prefixAutocompleteDescription(\n cmd.description,\n cmd.sourceInfo,\n ),\n ...(cmd.argumentHint && { argumentHint: cmd.argumentHint }),\n }),\n );\n\n // Convert extension commands to SlashCommand format. Built-in command names\n // stay reserved even when a built-in is contextually hidden (for example,\n // /fast without a supported OpenAI model) so extension visibility cannot\n // change as auth/model state changes.\n const extensionCommands: SlashCommand[] = this.session.extensionRunner\n .getRegisteredCommands()\n .filter((cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name))\n .map((cmd) => ({\n name: cmd.invocationName,\n description: this.prefixAutocompleteDescription(\n cmd.description,\n cmd.sourceInfo,\n ),\n getArgumentCompletions: cmd.getArgumentCompletions,\n }));\n\n // Build skill commands from session.skills (if enabled)\n this.skillCommands.clear();\n const skillCommandList: SlashCommand[] = [];\n if (this.settingsManager.getEnableSkillCommands()) {\n for (const skill of this.session.resourceLoader.getSkills().skills) {\n const commandName = `skill:${skill.name}`;\n this.skillCommands.set(commandName, skill.filePath);\n skillCommandList.push({\n name: commandName,\n description: this.prefixAutocompleteDescription(\n skill.description,\n skill.sourceInfo,\n ),\n });\n }\n }\n\n return new CombinedAutocompleteProvider(\n [\n ...slashCommands,\n ...templateCommands,\n ...extensionCommands,\n ...skillCommandList,\n ],\n this.sessionManager.getCwd(),\n this.fdPath,\n );\n };\n\nInteractiveModeBase.prototype.setupAutocompleteProvider = function(this: InteractiveModeBase): void {\n let provider = this.createBaseAutocompleteProvider();\n for (const wrapProvider of this.autocompleteProviderWrappers) {\n provider = wrapProvider(provider);\n }\n\n this.autocompleteProvider = provider;\n this.defaultEditor.setAutocompleteProvider(provider);\n if (this.editor !== this.defaultEditor) {\n this.editor.setAutocompleteProvider?.(provider);\n }\n };\n"]}
1
+ {"version":3,"file":"interactive-autocomplete.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAA2L,4BAA4B,EAAE,WAAW,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACzW,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEvE,SAAS,0BAA0B,CAAC,IAAY;IAC9C,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACzD,IAAI,0BAA0B,CAAC,GAAG,CAAC,IAAI,CAAC,K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,IAAI,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAC7D,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,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;QACvC,IAAI,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Api, type Model, type AutocompleteItem, type AutocompleteProvider, type AutocompleteSuggestions, type SlashCommand, type ExtensionRunner, type ResourceDiagnostic, type SourceInfo, CombinedAutocompleteProvider, fuzzyFilter, hasSupportedCodexFastModeModel, BUILTIN_SLASH_COMMANDS, parseGitUrl, getModelSearchText } from \"./interactive-mode-deps.ts\";\nimport { BUILTIN_SLASH_COMMAND_NAMES } from \"./interactive-mode-helpers.ts\";\n\nconst AT_MENTION_PATH_DELIMITERS = new Set([\" \", \"\\t\", '\"', \"'\", \"=\"]);\n\nfunction findLastAtMentionDelimiter(text: string): number {\n for (let index = text.length - 1; index >= 0; index -= 1) {\n if (AT_MENTION_PATH_DELIMITERS.has(text[index] ?? \"\")) return index;\n }\n return -1;\n}\n\nfunction isAtMentionTokenStart(text: string, index: number): boolean {\n return index === 0 || AT_MENTION_PATH_DELIMITERS.has(text[index - 1] ?? \"\");\n}\n\nfunction findUnclosedAtMentionQuoteStart(text: string): number | null {\n let quoteStart = -1;\n let inQuotes = false;\n for (let index = 0; index < text.length; index += 1) {\n if (text[index] === '\"') {\n inQuotes = !inQuotes;\n if (inQuotes) quoteStart = index;\n }\n }\n return inQuotes ? quoteStart : null;\n}\n\nfunction extractAtMentionPrefix(textBeforeCursor: string): string | null {\n const quoteStart = findUnclosedAtMentionQuoteStart(textBeforeCursor);\n if (quoteStart !== null && quoteStart > 0 && textBeforeCursor[quoteStart - 1] === \"@\") {\n return isAtMentionTokenStart(textBeforeCursor, quoteStart - 1)\n ? textBeforeCursor.slice(quoteStart - 1)\n : null;\n }\n const lastDelimiterIndex = findLastAtMentionDelimiter(textBeforeCursor);\n const tokenStart = lastDelimiterIndex === -1 ? 0 : lastDelimiterIndex + 1;\n return textBeforeCursor[tokenStart] === \"@\" ? textBeforeCursor.slice(tokenStart) : null;\n}\n\nfunction atMentionPrefixToPathPrefix(atPrefix: string): string {\n return atPrefix.startsWith('@\"') ? `\"${atPrefix.slice(2)}` : atPrefix.slice(1);\n}\n\nfunction toAtMentionCompletion(item: AutocompleteItem): AutocompleteItem {\n return {\n ...item,\n value: item.value.startsWith(\"@\") ? item.value : `@${item.value}`,\n };\n}\n\nclass AtMentionFallbackAutocompleteProvider implements AutocompleteProvider {\n private readonly primary: AutocompleteProvider;\n private readonly pathFallback: AutocompleteProvider;\n\n constructor(primary: AutocompleteProvider, pathFallback: AutocompleteProvider) {\n this.primary = primary;\n this.pathFallback = pathFallback;\n }\n\n async getSuggestions(\n lines: string[],\n cursorLine: number,\n cursorCol: number,\n options: { signal: AbortSignal; force?: boolean },\n ): Promise<AutocompleteSuggestions | null> {\n const primarySuggestions = await this.primary.getSuggestions(lines, cursorLine, cursorCol, options);\n if (primarySuggestions || options.signal.aborted) return primarySuggestions;\n\n const currentLine = lines[cursorLine] ?? \"\";\n const textBeforeCursor = currentLine.slice(0, cursorCol);\n const atPrefix = extractAtMentionPrefix(textBeforeCursor);\n if (!atPrefix) return null;\n\n const pathPrefix = atMentionPrefixToPathPrefix(atPrefix);\n const prefixStart = cursorCol - atPrefix.length;\n const fallbackLines = [...lines];\n fallbackLines[cursorLine] = `${currentLine.slice(0, prefixStart)}${pathPrefix}${currentLine.slice(cursorCol)}`;\n const fallbackSuggestions = await this.pathFallback.getSuggestions(\n fallbackLines,\n cursorLine,\n prefixStart + pathPrefix.length,\n { ...options, force: true },\n );\n if (!fallbackSuggestions) return null;\n\n return {\n prefix: atPrefix,\n items: fallbackSuggestions.items.map(toAtMentionCompletion),\n };\n }\n\n applyCompletion(\n lines: string[],\n cursorLine: number,\n cursorCol: number,\n item: AutocompleteItem,\n prefix: string,\n ): { lines: string[]; cursorLine: number; cursorCol: number } {\n return this.primary.applyCompletion(lines, cursorLine, cursorCol, item, prefix);\n }\n\n shouldTriggerFileCompletion(lines: string[], cursorLine: number, cursorCol: number): boolean {\n return this.primary.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;\n }\n}\n\nInteractiveModeBase.prototype.getAutocompleteSourceTag = function(this: InteractiveModeBase, sourceInfo?: SourceInfo): string | undefined {\n if (!sourceInfo) {\n return undefined;\n }\n\n const scopePrefix =\n sourceInfo.scope === \"user\"\n ? \"u\"\n : sourceInfo.scope === \"project\"\n ? \"p\"\n : \"t\";\n const source = sourceInfo.source.trim();\n\n if (source === \"auto\" || source === \"local\" || source === \"cli\") {\n return scopePrefix;\n }\n\n if (source.startsWith(\"npm:\")) {\n return `${scopePrefix}:${source}`;\n }\n\n const gitSource = parseGitUrl(source);\n if (gitSource) {\n const ref = gitSource.ref ? `@${gitSource.ref}` : \"\";\n return `${scopePrefix}:git:${gitSource.host}/${gitSource.path}${ref}`;\n }\n\n return scopePrefix;\n };\n\nInteractiveModeBase.prototype.prefixAutocompleteDescription = function(this: InteractiveModeBase, description: string | undefined, sourceInfo?: SourceInfo): string | undefined {\n const sourceTag = this.getAutocompleteSourceTag(sourceInfo);\n if (!sourceTag) {\n return description;\n }\n return description ? `[${sourceTag}] ${description}` : `[${sourceTag}]`;\n };\n\nInteractiveModeBase.prototype.getBuiltInCommandConflictDiagnostics = function(this: InteractiveModeBase, extensionRunner: ExtensionRunner): ResourceDiagnostic[] {\n return extensionRunner\n .getRegisteredCommands()\n .filter((command) => BUILTIN_SLASH_COMMAND_NAMES.has(command.name))\n .map((command) => ({\n type: \"warning\" as const,\n message:\n command.invocationName === command.name\n ? `Extension command '/${command.name}' conflicts with built-in interactive command. Skipping in autocomplete.`\n : `Extension command '/${command.name}' conflicts with built-in interactive command. Available as '/${command.invocationName}'.`,\n path: command.sourceInfo.path,\n }));\n };\n\nInteractiveModeBase.prototype.getCodexFastModeCandidateModels = function(this: InteractiveModeBase): Model<Api>[] {\n if (this.session.scopedModels.length > 0) {\n return this.session.scopedModels\n .map((scoped) => scoped.model)\n .filter((model) => this.session.modelRegistry.hasConfiguredAuth(model));\n }\n\n return this.session.modelRegistry.getAvailable();\n };\n\nInteractiveModeBase.prototype.hasCodexFastModeSupportedModels = function(this: InteractiveModeBase): boolean {\n return hasSupportedCodexFastModeModel(\n this.getCodexFastModeCandidateModels(),\n );\n };\n\nInteractiveModeBase.prototype.createBaseAutocompleteProvider = function(this: InteractiveModeBase): AutocompleteProvider {\n // Define commands for autocomplete\n const slashCommands: SlashCommand[] = BUILTIN_SLASH_COMMANDS.filter(\n (command) => command.name !== \"fast\" || this.hasCodexFastModeSupportedModels(),\n ).map((command) => ({\n name: command.name,\n description: command.description,\n getArgumentCompletions: command.getArgumentCompletions,\n }));\n\n const modelCommand = slashCommands.find(\n (command) => command.name === \"model\",\n );\n if (modelCommand) {\n modelCommand.getArgumentCompletions = (\n prefix: string,\n ): AutocompleteItem[] | null => {\n // Get available models (scoped or from registry)\n const models =\n this.session.scopedModels.length > 0\n ? this.session.scopedModels.map((s) => s.model)\n : this.session.modelRegistry.getAvailable();\n\n if (models.length === 0) return null;\n\n // Create items with provider/id format\n const items = models.map((m) => ({\n id: m.id,\n provider: m.provider,\n name: m.name,\n label: `${m.provider}/${m.id}`,\n }));\n\n // Fuzzy filter by model ID + provider in either order.\n const filtered = fuzzyFilter(items, prefix, getModelSearchText);\n\n if (filtered.length === 0) return null;\n\n return filtered.map((item) => ({\n value: item.label,\n label: item.id,\n description: item.provider,\n }));\n };\n }\n\n // Convert prompt templates to SlashCommand format for autocomplete\n const templateCommands: SlashCommand[] = this.session.promptTemplates.map(\n (cmd) => ({\n name: cmd.name,\n description: this.prefixAutocompleteDescription(\n cmd.description,\n cmd.sourceInfo,\n ),\n ...(cmd.argumentHint && { argumentHint: cmd.argumentHint }),\n }),\n );\n\n // Convert extension commands to SlashCommand format. Built-in command names\n // stay reserved even when a built-in is contextually hidden (for example,\n // /fast without a supported OpenAI model) so extension visibility cannot\n // change as auth/model state changes.\n const extensionCommands: SlashCommand[] = this.session.extensionRunner\n .getRegisteredCommands()\n .filter((cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name))\n .map((cmd) => ({\n name: cmd.invocationName,\n description: this.prefixAutocompleteDescription(\n cmd.description,\n cmd.sourceInfo,\n ),\n getArgumentCompletions: cmd.getArgumentCompletions,\n }));\n\n // Build skill commands from session.skills (if enabled)\n this.skillCommands.clear();\n const skillCommandList: SlashCommand[] = [];\n if (this.settingsManager.getEnableSkillCommands()) {\n for (const skill of this.session.resourceLoader.getSkills().skills) {\n const commandName = `skill:${skill.name}`;\n this.skillCommands.set(commandName, skill.filePath);\n skillCommandList.push({\n name: commandName,\n description: this.prefixAutocompleteDescription(\n skill.description,\n skill.sourceInfo,\n ),\n });\n }\n }\n\n const commands = [\n ...slashCommands,\n ...templateCommands,\n ...extensionCommands,\n ...skillCommandList,\n ];\n const cwd = this.sessionManager.getCwd();\n return new AtMentionFallbackAutocompleteProvider(\n new CombinedAutocompleteProvider(commands, cwd, this.fdPath),\n new CombinedAutocompleteProvider(commands, cwd, null),\n );\n };\n\nInteractiveModeBase.prototype.setupAutocompleteProvider = function(this: InteractiveModeBase): void {\n let provider = this.createBaseAutocompleteProvider();\n for (const wrapProvider of this.autocompleteProviderWrappers) {\n provider = wrapProvider(provider);\n }\n\n this.autocompleteProvider = provider;\n this.defaultEditor.setAutocompleteProvider(provider);\n if (this.editor !== this.defaultEditor) {\n this.editor.setAutocompleteProvider?.(provider);\n }\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-hotkeys-debug.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-hotkeys-debug.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Keybinding, type AppKeybinding, fs, path, Markdown, Spacer, Text, visibleWidth, getDebugLogPath, ArminComponent, DaxnutsComponent, DynamicBorder, EarendilAnnouncementComponent, formatKeyText, keyDisplayText, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.getAppKeyDisplay = function(this: InteractiveModeBase, action: AppKeybinding): string {\n return keyDisplayText(action);\n };\n\nInteractiveModeBase.prototype.getEditorKeyDisplay = function(this: InteractiveModeBase, action: Keybinding): string {\n return keyDisplayText(action);\n };\n\nInteractiveModeBase.prototype.handleHotkeysCommand = function(this: InteractiveModeBase): void {\n // Navigation keybindings\n const cursorUp = this.getEditorKeyDisplay(\"tui.editor.cursorUp\");\n const cursorDown = this.getEditorKeyDisplay(\"tui.editor.cursorDown\");\n const cursorLeft = this.getEditorKeyDisplay(\"tui.editor.cursorLeft\");\n const cursorRight = this.getEditorKeyDisplay(\"tui.editor.cursorRight\");\n const cursorWordLeft = this.getEditorKeyDisplay(\n \"tui.editor.cursorWordLeft\",\n );\n const cursorWordRight = this.getEditorKeyDisplay(\n \"tui.editor.cursorWordRight\",\n );\n const cursorLineStart = this.getEditorKeyDisplay(\n \"tui.editor.cursorLineStart\",\n );\n const cursorLineEnd = this.getEditorKeyDisplay(\"tui.editor.cursorLineEnd\");\n const jumpForward = this.getEditorKeyDisplay(\"tui.editor.jumpForward\");\n const jumpBackward = this.getEditorKeyDisplay(\"tui.editor.jumpBackward\");\n const pageUp = this.getEditorKeyDisplay(\"tui.editor.pageUp\");\n const pageDown = this.getEditorKeyDisplay(\"tui.editor.pageDown\");\n\n // Editing keybindings\n const submit = this.getEditorKeyDisplay(\"tui.input.submit\");\n const newLine = this.getEditorKeyDisplay(\"tui.input.newLine\");\n const deleteWordBackward = this.getEditorKeyDisplay(\n \"tui.editor.deleteWordBackward\",\n );\n const deleteWordForward = this.getEditorKeyDisplay(\n \"tui.editor.deleteWordForward\",\n );\n const deleteToLineStart = this.getEditorKeyDisplay(\n \"tui.editor.deleteToLineStart\",\n );\n const deleteToLineEnd = this.getEditorKeyDisplay(\n \"tui.editor.deleteToLineEnd\",\n );\n const yank = this.getEditorKeyDisplay(\"tui.editor.yank\");\n const yankPop = this.getEditorKeyDisplay(\"tui.editor.yankPop\");\n const undo = this.getEditorKeyDisplay(\"tui.editor.undo\");\n const tab = this.getEditorKeyDisplay(\"tui.input.tab\");\n\n // App keybindings\n const interrupt = this.getAppKeyDisplay(\"app.interrupt\");\n const clear = this.getAppKeyDisplay(\"app.clear\");\n const exit = this.getAppKeyDisplay(\"app.exit\");\n const suspend = this.getAppKeyDisplay(\"app.suspend\");\n const cycleThinkingLevel = this.getAppKeyDisplay(\"app.thinking.cycle\");\n const cycleModelForward = this.getAppKeyDisplay(\"app.model.cycleForward\");\n const selectModel = this.getAppKeyDisplay(\"app.model.select\");\n const expandTools = this.getAppKeyDisplay(\"app.tools.expand\");\n const toggleThinking = this.getAppKeyDisplay(\"app.thinking.toggle\");\n const externalEditor = this.getAppKeyDisplay(\"app.editor.external\");\n const cycleModelBackward = this.getAppKeyDisplay(\"app.model.cycleBackward\");\n const followUp = this.getAppKeyDisplay(\"app.message.followUp\");\n const dequeue = this.getAppKeyDisplay(\"app.message.dequeue\");\n const pasteImage = this.getAppKeyDisplay(\"app.clipboard.pasteImage\");\n\n let hotkeys = `\n**Navigation**\n| Key | Action |\n|-----|--------|\n| \\`${cursorUp}\\` / \\`${cursorDown}\\` / \\`${cursorLeft}\\` / \\`${cursorRight}\\` | Move cursor / browse history (Up when empty) |\n| \\`${cursorWordLeft}\\` / \\`${cursorWordRight}\\` | Move by word |\n| \\`${cursorLineStart}\\` | Start of line |\n| \\`${cursorLineEnd}\\` | End of line |\n| \\`${jumpForward}\\` | Jump forward to character |\n| \\`${jumpBackward}\\` | Jump backward to character |\n| \\`${pageUp}\\` / \\`${pageDown}\\` | Scroll by page |\n\n**Editing**\n| Key | Action |\n|-----|--------|\n| \\`${submit}\\` | Send message |\n| \\`${newLine}\\` | New line${process.platform === \"win32\" ? \" (ctrl+enter on Windows Terminal)\" : \"\"} |\n| \\`${deleteWordBackward}\\` | Delete word backwards |\n| \\`${deleteWordForward}\\` | Delete word forwards |\n| \\`${deleteToLineStart}\\` | Delete to start of line |\n| \\`${deleteToLineEnd}\\` | Delete to end of line |\n| \\`${yank}\\` | Paste the most-recently-deleted text |\n| \\`${yankPop}\\` | Cycle through the deleted text after pasting |\n| \\`${undo}\\` | Undo |\n\n**Other**\n| Key | Action |\n|-----|--------|\n| \\`${tab}\\` | Path completion / accept autocomplete |\n| \\`${interrupt}\\` | Cancel autocomplete / abort streaming |\n| \\`${clear}\\` | Clear editor (first) / exit (second) |\n| \\`${exit}\\` | Exit (when editor is empty) |\n| \\`${suspend}\\` | Suspend to background |\n| \\`${cycleThinkingLevel}\\` | Cycle thinking level |\n| \\`${cycleModelForward}\\` / \\`${cycleModelBackward}\\` | Cycle models |\n| \\`${selectModel}\\` | Open model selector |\n| \\`${expandTools}\\` | Toggle tool output expansion |\n| \\`${toggleThinking}\\` | Toggle thinking block visibility |\n| \\`${externalEditor}\\` | Edit message in external editor |\n| \\`${followUp}\\` | Queue follow-up message |\n| \\`${dequeue}\\` | Restore queued messages |\n| \\`${pasteImage}\\` | Paste image from clipboard |\n| \\`/\\` | Slash commands |\n| \\`!\\` | Run bash command |\n| \\`!!\\` | Run bash command (excluded from context) |\n`;\n\n // Add extension-registered shortcuts\n const extensionRunner = this.session.extensionRunner;\n const shortcuts = extensionRunner.getShortcuts(\n this.keybindings.getEffectiveConfig(),\n );\n if (shortcuts.size > 0) {\n hotkeys += `\n**Extensions**\n| Key | Action |\n|-----|--------|\n`;\n for (const [key, shortcut] of shortcuts) {\n const description = shortcut.description ?? shortcut.extensionPath;\n const keyDisplay = formatKeyText(key, { capitalize: true });\n hotkeys += `| \\`${keyDisplay}\\` | ${description} |\\n`;\n }\n }\n\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(new DynamicBorder());\n this.chatContainer.addChild(\n new Text(theme.bold(theme.fg(\"accent\", \"Keyboard Shortcuts\")), 1, 0),\n );\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Markdown(hotkeys.trim(), 1, 1, this.getMarkdownThemeWithSettings()),\n );\n this.chatContainer.addChild(new DynamicBorder());\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.handleClearCommand = async function(this: InteractiveModeBase): Promise<void> {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.newSession();\n if (result.cancelled) {\n return;\n }\n this.renderCurrentSessionState();\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(`${theme.fg(\"accent\", \"✓ New session started\")}`, 1, 1),\n );\n this.ui.requestRender();\n } catch (error: unknown) {\n await this.handleFatalRuntimeError(\"Failed to create session\", error);\n }\n };\n\nInteractiveModeBase.prototype.handleDebugCommand = function(this: InteractiveModeBase): void {\n const width = this.ui.terminal.columns;\n const height = this.ui.terminal.rows;\n const allLines = this.ui.render(width);\n\n const debugLogPath = getDebugLogPath();\n const debugData = [\n `Debug output at ${new Date().toISOString()}`,\n `Terminal: ${width}x${height}`,\n `Total lines: ${allLines.length}`,\n \"\",\n \"=== All rendered lines with visible widths ===\",\n ...allLines.map((line, idx) => {\n const vw = visibleWidth(line);\n const escaped = JSON.stringify(line);\n return `[${idx}] (w=${vw}) ${escaped}`;\n }),\n \"\",\n \"=== Agent messages (JSONL) ===\",\n ...this.session.messages.map((msg) => JSON.stringify(msg)),\n \"\",\n ].join(\"\\n\");\n\n fs.mkdirSync(path.dirname(debugLogPath), { recursive: true });\n fs.writeFileSync(debugLogPath, debugData);\n\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(\n `${theme.fg(\"accent\", \"✓ Debug log written\")}\\n${theme.fg(\"muted\", debugLogPath)}`,\n 1,\n 1,\n ),\n );\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.handleArminSaysHi = function(this: InteractiveModeBase): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(new ArminComponent(this.ui));\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.handleDementedDelves = function(this: InteractiveModeBase): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(new EarendilAnnouncementComponent());\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.handleDaxnuts = function(this: InteractiveModeBase): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(new DaxnutsComponent(this.ui));\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.checkDaxnutsEasterEgg = function(this: InteractiveModeBase, model: { provider: string; id: string }): void {\n if (\n model.provider === \"opencode\" &&\n model.id.toLowerCase().includes(\"kimi-k2.5\")\n ) {\n this.handleDaxnuts();\n }\n };\n"]}
1
+ {"version":3,"file":"interactive-hotkeys-debug.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-hotkeys-debug.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Keybinding, type AppKeybinding, fs, path, Markdown, Spacer, Text, visibleWidth, getDebugLogPath, ArminComponent, DaxnutsComponent, DynamicBorder, EarendilAnnouncementComponent, formatKeyText, keyDisplayText, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.getAppKeyDisplay = function(this: InteractiveModeBase, action: AppKeybinding): string {\n return keyDisplayText(action);\n };\n\nInteractiveModeBase.prototype.getEditorKeyDisplay = function(this: InteractiveModeBase, action: Keybinding): string {\n return keyDisplayText(action);\n };\n\nInteractiveModeBase.prototype.handleHotkeysCommand = function(this: InteractiveModeBase): void {\n // Navigation keybindings\n const cursorUp = this.getEditorKeyDisplay(\"tui.editor.cursorUp\");\n const cursorDown = this.getEditorKeyDisplay(\"tui.editor.cursorDown\");\n const cursorLeft = this.getEditorKeyDisplay(\"tui.editor.cursorLeft\");\n const cursorRight = this.getEditorKeyDisplay(\"tui.editor.cursorRight\");\n const cursorWordLeft = this.getEditorKeyDisplay(\n \"tui.editor.cursorWordLeft\",\n );\n const cursorWordRight = this.getEditorKeyDisplay(\n \"tui.editor.cursorWordRight\",\n );\n const cursorLineStart = this.getEditorKeyDisplay(\n \"tui.editor.cursorLineStart\",\n );\n const cursorLineEnd = this.getEditorKeyDisplay(\"tui.editor.cursorLineEnd\");\n const jumpForward = this.getEditorKeyDisplay(\"tui.editor.jumpForward\");\n const jumpBackward = this.getEditorKeyDisplay(\"tui.editor.jumpBackward\");\n const pageUp = this.getEditorKeyDisplay(\"tui.editor.pageUp\");\n const pageDown = this.getEditorKeyDisplay(\"tui.editor.pageDown\");\n\n // Editing keybindings\n const submit = this.getEditorKeyDisplay(\"tui.input.submit\");\n const newLine = this.getEditorKeyDisplay(\"tui.input.newLine\");\n const deleteWordBackward = this.getEditorKeyDisplay(\n \"tui.editor.deleteWordBackward\",\n );\n const deleteWordForward = this.getEditorKeyDisplay(\n \"tui.editor.deleteWordForward\",\n );\n const deleteToLineStart = this.getEditorKeyDisplay(\n \"tui.editor.deleteToLineStart\",\n );\n const deleteToLineEnd = this.getEditorKeyDisplay(\n \"tui.editor.deleteToLineEnd\",\n );\n const yank = this.getEditorKeyDisplay(\"tui.editor.yank\");\n const yankPop = this.getEditorKeyDisplay(\"tui.editor.yankPop\");\n const undo = this.getEditorKeyDisplay(\"tui.editor.undo\");\n const tab = this.getEditorKeyDisplay(\"tui.input.tab\");\n\n // App keybindings\n const interrupt = this.getAppKeyDisplay(\"app.interrupt\");\n const clear = this.getAppKeyDisplay(\"app.clear\");\n const exit = this.getAppKeyDisplay(\"app.exit\");\n const suspend = this.getAppKeyDisplay(\"app.suspend\");\n const cycleThinkingLevel = this.getAppKeyDisplay(\"app.thinking.cycle\");\n const cycleModelForward = this.getAppKeyDisplay(\"app.model.cycleForward\");\n const selectModel = this.getAppKeyDisplay(\"app.model.select\");\n const expandTools = this.getAppKeyDisplay(\"app.tools.expand\");\n const toggleThinking = this.getAppKeyDisplay(\"app.thinking.toggle\");\n const externalEditor = this.getAppKeyDisplay(\"app.editor.external\");\n const cycleModelBackward = this.getAppKeyDisplay(\"app.model.cycleBackward\");\n const followUp = this.getAppKeyDisplay(\"app.message.followUp\");\n const dequeue = this.getAppKeyDisplay(\"app.message.dequeue\");\n const pasteImage = this.getAppKeyDisplay(\"app.clipboard.pasteImage\");\n\n let hotkeys = `\n**Navigation**\n| Key | Action |\n|-----|--------|\n| \\`${cursorUp}\\` / \\`${cursorDown}\\` / \\`${cursorLeft}\\` / \\`${cursorRight}\\` | Move cursor / browse history (Up when empty) |\n| \\`${cursorWordLeft}\\` / \\`${cursorWordRight}\\` | Move by word |\n| \\`${cursorLineStart}\\` | Start of line |\n| \\`${cursorLineEnd}\\` | End of line |\n| \\`${jumpForward}\\` | Jump forward to character |\n| \\`${jumpBackward}\\` | Jump backward to character |\n| \\`${pageUp}\\` / \\`${pageDown}\\` | Scroll by page |\n\n**Editing**\n| Key | Action |\n|-----|--------|\n| \\`${submit}\\` | Send message |\n| \\`${newLine}\\` | New line${process.platform === \"win32\" ? \" (ctrl+enter on Windows Terminal)\" : \"\"} |\n| \\`${deleteWordBackward}\\` | Delete word backwards |\n| \\`${deleteWordForward}\\` | Delete word forwards |\n| \\`${deleteToLineStart}\\` | Delete to start of line |\n| \\`${deleteToLineEnd}\\` | Delete to end of line |\n| \\`${yank}\\` | Paste the most-recently-deleted text |\n| \\`${yankPop}\\` | Cycle through the deleted text after pasting |\n| \\`${undo}\\` | Undo |\n\n**Other**\n| Key | Action |\n|-----|--------|\n| \\`${tab}\\` | Path completion / accept autocomplete |\n| \\`${interrupt}\\` | Cancel autocomplete / abort streaming |\n| \\`${clear}\\` | Clear editor (first) / exit (second) |\n| \\`${exit}\\` | Exit (when editor is empty) |\n| \\`${suspend}\\` | Suspend to background |\n| \\`${cycleThinkingLevel}\\` | Cycle thinking level |\n| \\`${cycleModelForward}\\` / \\`${cycleModelBackward}\\` | Cycle models |\n| \\`${selectModel}\\` | Open model selector |\n| \\`${expandTools}\\` | Toggle tool output expansion |\n| \\`${toggleThinking}\\` | Toggle thinking block visibility |\n| \\`${externalEditor}\\` | Edit message in external editor |\n| \\`${followUp}\\` | Queue follow-up message |\n| \\`${dequeue}\\` | Restore queued messages |\n| \\`${pasteImage}\\` | Paste image from clipboard |\n| \\`/\\` | Slash commands |\n| \\`!\\` | Run bash command |\n| \\`!!\\` | Run bash command (excluded from context) |\n`;\n\n // Add extension-registered shortcuts\n const extensionRunner = this.session.extensionRunner;\n const shortcuts = extensionRunner.getShortcuts(\n this.keybindings.getEffectiveConfig(),\n );\n if (shortcuts.size > 0) {\n hotkeys += `\n**Extensions**\n| Key | Action |\n|-----|--------|\n`;\n for (const [key, shortcut] of shortcuts) {\n const description = shortcut.description ?? shortcut.extensionPath;\n const keyDisplay = formatKeyText(key, { capitalize: true });\n hotkeys += `| \\`${keyDisplay}\\` | ${description} |\\n`;\n }\n }\n\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(new DynamicBorder());\n this.chatContainer.addChild(\n new Text(theme.bold(theme.fg(\"accent\", \"Keyboard Shortcuts\")), 1, 0),\n );\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Markdown(hotkeys.trim(), 1, 1, this.getMarkdownThemeWithSettings()),\n );\n this.chatContainer.addChild(new DynamicBorder());\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.handleClearCommand = async function(this: InteractiveModeBase): Promise<void> {\n if (this.loadingAnimation) {\n this.loadingAnimation.stop();\n this.loadingAnimation = undefined;\n }\n this.statusContainer.clear();\n try {\n const result = await this.runtimeHost.newSession();\n if (result.cancelled) {\n return;\n }\n if (this.firstRunOnboardingActive) {\n this.clearPendingFirstRunOnboardingSeed();\n }\n this.renderCurrentSessionState();\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(`${theme.fg(\"accent\", \"✓ New session started\")}`, 1, 1),\n );\n this.ui.requestRender();\n } catch (error: unknown) {\n await this.handleFatalRuntimeError(\"Failed to create session\", error);\n }\n };\n\nInteractiveModeBase.prototype.handleDebugCommand = function(this: InteractiveModeBase): void {\n const width = this.ui.terminal.columns;\n const height = this.ui.terminal.rows;\n const allLines = this.ui.render(width);\n\n const debugLogPath = getDebugLogPath();\n const debugData = [\n `Debug output at ${new Date().toISOString()}`,\n `Terminal: ${width}x${height}`,\n `Total lines: ${allLines.length}`,\n \"\",\n \"=== All rendered lines with visible widths ===\",\n ...allLines.map((line, idx) => {\n const vw = visibleWidth(line);\n const escaped = JSON.stringify(line);\n return `[${idx}] (w=${vw}) ${escaped}`;\n }),\n \"\",\n \"=== Agent messages (JSONL) ===\",\n ...this.session.messages.map((msg) => JSON.stringify(msg)),\n \"\",\n ].join(\"\\n\");\n\n fs.mkdirSync(path.dirname(debugLogPath), { recursive: true });\n fs.writeFileSync(debugLogPath, debugData);\n\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(\n new Text(\n `${theme.fg(\"accent\", \"✓ Debug log written\")}\\n${theme.fg(\"muted\", debugLogPath)}`,\n 1,\n 1,\n ),\n );\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.handleArminSaysHi = function(this: InteractiveModeBase): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(new ArminComponent(this.ui));\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.handleDementedDelves = function(this: InteractiveModeBase): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(new EarendilAnnouncementComponent());\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.handleDaxnuts = function(this: InteractiveModeBase): void {\n this.chatContainer.addChild(new Spacer(1));\n this.chatContainer.addChild(new DaxnutsComponent(this.ui));\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.checkDaxnutsEasterEgg = function(this: InteractiveModeBase, model: { provider: string; id: string }): void {\n if (\n model.provider === \"opencode\" &&\n model.id.toLowerCase().includes(\"kimi-k2.5\")\n ) {\n this.handleDaxnuts();\n }\n };\n"]}
@@ -126,6 +126,9 @@ InteractiveModeBase.prototype.handleClearCommand = async function () {
126
126
  if (result.cancelled) {
127
127
  return;
128
128
  }
129
+ if (this.firstRunOnboardingActive) {
130
+ this.clearPendingFirstRunOnboardingSeed();
131
+ }
129
132
  this.renderCurrentSessionState();
130
133
  this.chatContainer.addChild(new Spacer(1));
131
134
  this.chatContainer.addChild(new Text(`${theme.fg("accent", "✓ New session started")}`, 1, 1));