@opengsd/gsd-pi 1.2.0-dev.955e4da0 → 1.2.0-dev.fb12b103

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 (378) hide show
  1. package/dist/cli-style.d.ts +17 -0
  2. package/dist/cli-style.js +28 -0
  3. package/dist/cli.js +1 -1
  4. package/dist/headless-events.d.ts +4 -2
  5. package/dist/headless-events.js +7 -29
  6. package/dist/models-resolver.d.ts +3 -13
  7. package/dist/models-resolver.js +3 -22
  8. package/dist/resource-loader.js +2 -14
  9. package/dist/resources/.managed-resources-content-hash +1 -1
  10. package/dist/resources/extensions/async-jobs/async-bash-tool.js +30 -64
  11. package/dist/resources/extensions/async-jobs/await-tool.js +80 -12
  12. package/dist/resources/extensions/async-jobs/index.js +65 -0
  13. package/dist/resources/extensions/async-jobs/job-manager.js +12 -1
  14. package/dist/resources/extensions/bg-shell/bg-shell-command.js +6 -6
  15. package/dist/resources/extensions/bg-shell/bg-shell-tool.js +10 -7
  16. package/dist/resources/extensions/bg-shell/overlay.js +9 -6
  17. package/dist/resources/extensions/bg-shell/process-manager.js +54 -25
  18. package/dist/resources/extensions/bg-shell/readiness-detector.js +11 -0
  19. package/dist/resources/extensions/bg-shell/utilities.js +3 -0
  20. package/dist/resources/extensions/browser-tools/engine/managed-gsd-browser.js +209 -88
  21. package/dist/resources/extensions/browser-tools/engine/selection.js +73 -5
  22. package/dist/resources/extensions/browser-tools/index.js +69 -12
  23. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +30 -4
  24. package/dist/resources/extensions/gsd/auto/orchestrator.js +7 -5
  25. package/dist/resources/extensions/gsd/auto-dispatch.js +12 -1
  26. package/dist/resources/extensions/gsd/auto-model-selection.js +25 -6
  27. package/dist/resources/extensions/gsd/auto-post-unit.js +11 -2
  28. package/dist/resources/extensions/gsd/auto-prompts.js +15 -10
  29. package/dist/resources/extensions/gsd/auto-start.js +15 -10
  30. package/dist/resources/extensions/gsd/auto-tool-tracking.js +18 -0
  31. package/dist/resources/extensions/gsd/auto-unit-tool-scope.js +7 -16
  32. package/dist/resources/extensions/gsd/auto-worktree.js +30 -90
  33. package/dist/resources/extensions/gsd/auto.js +4 -13
  34. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +3 -2
  35. package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +23 -6
  36. package/dist/resources/extensions/gsd/bootstrap/register-extension.js +19 -0
  37. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +122 -20
  38. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +6 -2
  39. package/dist/resources/extensions/gsd/branch-patterns.js +2 -0
  40. package/dist/resources/extensions/gsd/browser-daemon-auto-prep.js +83 -0
  41. package/dist/resources/extensions/gsd/browser-evidence.js +8 -2
  42. package/dist/resources/extensions/gsd/captures.js +4 -6
  43. package/dist/resources/extensions/gsd/constants.js +0 -2
  44. package/dist/resources/extensions/gsd/crash-recovery.js +4 -12
  45. package/dist/resources/extensions/gsd/doctor-environment.js +2 -6
  46. package/dist/resources/extensions/gsd/doctor-format.js +9 -6
  47. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +13 -15
  48. package/dist/resources/extensions/gsd/error-classifier.js +9 -0
  49. package/dist/resources/extensions/gsd/exec-sandbox.js +30 -10
  50. package/dist/resources/extensions/gsd/guidance.js +98 -0
  51. package/dist/resources/extensions/gsd/guided-flow.js +17 -2
  52. package/dist/resources/extensions/gsd/mcp-filter.js +2 -19
  53. package/dist/resources/extensions/gsd/mcp-tool-name.js +5 -13
  54. package/dist/resources/extensions/gsd/memory-consolidation-scanner.js +1 -1
  55. package/dist/resources/extensions/gsd/migrate/safety.js +4 -1
  56. package/dist/resources/extensions/gsd/notification-store.js +11 -4
  57. package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +6 -4
  58. package/dist/resources/extensions/gsd/paths.js +27 -0
  59. package/dist/resources/extensions/gsd/pre-execution-checks.js +91 -3
  60. package/dist/resources/extensions/gsd/preferences-models.js +14 -48
  61. package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
  62. package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  63. package/dist/resources/extensions/gsd/prompts/refine-slice.md +1 -1
  64. package/dist/resources/extensions/gsd/prompts/replan-slice.md +1 -1
  65. package/dist/resources/extensions/gsd/prompts/run-uat.md +1 -1
  66. package/dist/resources/extensions/gsd/prompts/system.md +5 -2
  67. package/dist/resources/extensions/gsd/provider-error-guidance.js +1 -5
  68. package/dist/resources/extensions/gsd/provider-switch-observer.js +1 -1
  69. package/dist/resources/extensions/gsd/publication.js +87 -0
  70. package/dist/resources/extensions/gsd/recovery-classification.js +37 -94
  71. package/dist/resources/extensions/gsd/safety/destructive-confirmation.js +108 -0
  72. package/dist/resources/extensions/gsd/state.js +1 -20
  73. package/dist/resources/extensions/gsd/stop-notice.js +57 -0
  74. package/dist/resources/extensions/gsd/tool-surface-readiness.js +56 -0
  75. package/dist/resources/extensions/gsd/tools/exec-tool.js +9 -7
  76. package/dist/resources/extensions/gsd/tools/plan-slice.js +12 -6
  77. package/dist/resources/extensions/gsd/uat-policy.js +2 -1
  78. package/dist/resources/extensions/gsd/unit-closeout.js +138 -0
  79. package/dist/resources/extensions/gsd/unit-context-composer.js +74 -1
  80. package/dist/resources/extensions/gsd/unit-context-manifest.js +4 -27
  81. package/dist/resources/extensions/gsd/unit-registry.js +337 -0
  82. package/dist/resources/extensions/gsd/unit-tool-contracts.js +9 -182
  83. package/dist/resources/extensions/gsd/web-app-uat.js +45 -8
  84. package/dist/resources/extensions/gsd/workflow-tool-surface.js +1 -1
  85. package/dist/resources/extensions/gsd/worktree-git-recovery.js +15 -9
  86. package/dist/resources/extensions/gsd/worktree-root.js +11 -0
  87. package/dist/resources/extensions/gsd/worktree-session-state.js +4 -5
  88. package/dist/resources/extensions/search-the-web/native-search.js +5 -3
  89. package/dist/resources/extensions/shared/browser-contract.js +59 -0
  90. package/dist/resources/extensions/shared/gsd-browser-cli.js +96 -5
  91. package/dist/resources/shared/package.json +3 -0
  92. package/dist/resources/skills/create-skill/references/executable-code.md +1 -1
  93. package/dist/resources/skills/create-skill/workflows/add-reference.md +8 -3
  94. package/dist/resources/skills/create-skill/workflows/add-script.md +4 -2
  95. package/dist/resources/skills/create-skill/workflows/add-template.md +3 -1
  96. package/dist/resources/skills/create-skill/workflows/add-workflow.md +8 -3
  97. package/dist/resources/skills/create-skill/workflows/upgrade-to-router.md +10 -5
  98. package/dist/resources/skills/create-skill/workflows/verify-skill.md +9 -4
  99. package/dist/resources/skills/spike-wrap-up/SKILL.md +9 -9
  100. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  101. package/dist/web/standalone/.next/BUILD_ID +1 -1
  102. package/dist/web/standalone/.next/app-path-routes-manifest.json +13 -13
  103. package/dist/web/standalone/.next/build-manifest.json +3 -3
  104. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  105. package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
  106. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  107. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  108. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  109. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  110. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  111. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  112. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  113. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  114. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  115. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  116. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  117. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  118. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  119. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  120. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  121. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  122. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  123. package/dist/web/standalone/.next/server/app/api/update/route.js.nft.json +1 -1
  124. package/dist/web/standalone/.next/server/app/index.html +1 -1
  125. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  126. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  127. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  128. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  129. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  130. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  131. package/dist/web/standalone/.next/server/app-paths-manifest.json +13 -13
  132. package/dist/web/standalone/.next/server/chunks/5124.js +1 -1
  133. package/dist/web/standalone/.next/server/chunks/8357.js +1 -1
  134. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  135. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  136. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  137. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  138. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  139. package/dist/web/standalone/.next/static/chunks/{796.cf859a427a2cb2ac.js → 796.e0bdc932325d7e03.js} +1 -1
  140. package/dist/web/standalone/.next/static/chunks/{webpack-fbea77b5f9953368.js → webpack-f0285ce91d4ec9ef.js} +1 -1
  141. package/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
  142. package/dist/web/standalone/node_modules/postcss/lib/container.js +18 -26
  143. package/dist/web/standalone/node_modules/postcss/lib/css-syntax-error.js +14 -47
  144. package/dist/web/standalone/node_modules/postcss/lib/declaration.js +4 -4
  145. package/dist/web/standalone/node_modules/postcss/lib/fromJSON.js +3 -3
  146. package/dist/web/standalone/node_modules/postcss/lib/input.js +29 -54
  147. package/dist/web/standalone/node_modules/postcss/lib/lazy-result.js +37 -47
  148. package/dist/web/standalone/node_modules/postcss/lib/map-generator.js +9 -26
  149. package/dist/web/standalone/node_modules/postcss/lib/no-work-result.js +55 -57
  150. package/dist/web/standalone/node_modules/postcss/lib/node.js +31 -99
  151. package/dist/web/standalone/node_modules/postcss/lib/parse.js +1 -1
  152. package/dist/web/standalone/node_modules/postcss/lib/parser.js +9 -10
  153. package/dist/web/standalone/node_modules/postcss/lib/postcss.js +12 -12
  154. package/dist/web/standalone/node_modules/postcss/lib/previous-map.js +11 -30
  155. package/dist/web/standalone/node_modules/postcss/lib/processor.js +7 -7
  156. package/dist/web/standalone/node_modules/postcss/lib/result.js +5 -5
  157. package/dist/web/standalone/node_modules/postcss/lib/rule.js +6 -6
  158. package/dist/web/standalone/node_modules/postcss/lib/stringifier.js +28 -69
  159. package/dist/web/standalone/node_modules/postcss/lib/tokenize.js +2 -6
  160. package/dist/web/standalone/node_modules/postcss/package.json +48 -48
  161. package/dist/web/standalone/package.json +1 -1
  162. package/dist/worktree-cli.js +3 -6
  163. package/dist/worktree-status-banner.js +7 -15
  164. package/package.json +1 -1
  165. package/packages/cloud-mcp-gateway/package.json +2 -2
  166. package/packages/contracts/dist/rpc.d.ts +1 -0
  167. package/packages/contracts/dist/rpc.d.ts.map +1 -1
  168. package/packages/contracts/dist/rpc.js.map +1 -1
  169. package/packages/contracts/dist/workflow.d.ts +4 -0
  170. package/packages/contracts/dist/workflow.d.ts.map +1 -1
  171. package/packages/contracts/dist/workflow.js.map +1 -1
  172. package/packages/contracts/package.json +1 -1
  173. package/packages/daemon/package.json +4 -4
  174. package/packages/gsd-agent-core/package.json +5 -5
  175. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts +5 -0
  176. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  177. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js +5 -0
  178. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js.map +1 -1
  179. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  180. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js +7 -0
  181. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  182. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -1
  183. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js +8 -1
  184. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js.map +1 -1
  185. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-chat-render.d.ts.map +1 -1
  186. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-chat-render.js +11 -1
  187. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-chat-render.js.map +1 -1
  188. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.d.ts.map +1 -1
  189. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.js +4 -4
  190. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.js.map +1 -1
  191. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  192. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.js +3 -1
  193. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.js.map +1 -1
  194. package/packages/gsd-agent-modes/package.json +7 -7
  195. package/packages/mcp-server/dist/cli.js +6 -3
  196. package/packages/mcp-server/dist/cli.js.map +1 -1
  197. package/packages/mcp-server/dist/workflow-tools.d.ts +8 -0
  198. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  199. package/packages/mcp-server/dist/workflow-tools.js +17 -1
  200. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  201. package/packages/mcp-server/package.json +3 -3
  202. package/packages/native/package.json +1 -1
  203. package/packages/pi-agent-core/dist/harness/env/nodejs.d.ts +1 -0
  204. package/packages/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
  205. package/packages/pi-agent-core/dist/harness/env/nodejs.js +34 -3
  206. package/packages/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
  207. package/packages/pi-agent-core/dist/index.d.ts +1 -0
  208. package/packages/pi-agent-core/dist/index.d.ts.map +1 -1
  209. package/packages/pi-agent-core/dist/index.js +3 -0
  210. package/packages/pi-agent-core/dist/index.js.map +1 -1
  211. package/packages/pi-agent-core/package.json +1 -1
  212. package/packages/pi-ai/dist/models.generated.d.ts +94 -382
  213. package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
  214. package/packages/pi-ai/dist/models.generated.js +149 -422
  215. package/packages/pi-ai/dist/models.generated.js.map +1 -1
  216. package/packages/pi-ai/package.json +1 -1
  217. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +2 -2
  218. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  219. package/packages/pi-coding-agent/dist/core/auth-storage.js +19 -13
  220. package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  221. package/packages/pi-coding-agent/dist/core/provider-readiness.d.ts.map +1 -1
  222. package/packages/pi-coding-agent/dist/core/provider-readiness.js +13 -6
  223. package/packages/pi-coding-agent/dist/core/provider-readiness.js.map +1 -1
  224. package/packages/pi-coding-agent/dist/core/tools/bash.d.ts +11 -0
  225. package/packages/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
  226. package/packages/pi-coding-agent/dist/core/tools/bash.js +53 -11
  227. package/packages/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
  228. package/packages/pi-coding-agent/dist/index.d.ts +1 -1
  229. package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
  230. package/packages/pi-coding-agent/dist/index.js +1 -1
  231. package/packages/pi-coding-agent/dist/index.js.map +1 -1
  232. package/packages/pi-coding-agent/dist/utils/shell.d.ts +28 -2
  233. package/packages/pi-coding-agent/dist/utils/shell.d.ts.map +1 -1
  234. package/packages/pi-coding-agent/dist/utils/shell.js +56 -10
  235. package/packages/pi-coding-agent/dist/utils/shell.js.map +1 -1
  236. package/packages/pi-coding-agent/package.json +7 -7
  237. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  238. package/packages/pi-tui/dist/tui.js +9 -0
  239. package/packages/pi-tui/dist/tui.js.map +1 -1
  240. package/packages/pi-tui/package.json +2 -2
  241. package/packages/rpc-client/package.json +2 -2
  242. package/pkg/package.json +1 -1
  243. package/src/resources/extensions/async-jobs/async-bash-cancel.test.ts +360 -0
  244. package/src/resources/extensions/async-jobs/async-bash-tool.ts +33 -56
  245. package/src/resources/extensions/async-jobs/await-tool.test.ts +139 -0
  246. package/src/resources/extensions/async-jobs/await-tool.ts +82 -12
  247. package/src/resources/extensions/async-jobs/index.ts +79 -0
  248. package/src/resources/extensions/async-jobs/job-manager.ts +21 -1
  249. package/src/resources/extensions/bg-shell/bg-shell-command.ts +6 -6
  250. package/src/resources/extensions/bg-shell/bg-shell-tool.ts +10 -6
  251. package/src/resources/extensions/bg-shell/overlay.ts +9 -5
  252. package/src/resources/extensions/bg-shell/process-manager.ts +50 -25
  253. package/src/resources/extensions/bg-shell/readiness-detector.ts +12 -0
  254. package/src/resources/extensions/bg-shell/tests/lifecycle-and-utilities.test.ts +48 -1
  255. package/src/resources/extensions/bg-shell/utilities.ts +3 -0
  256. package/src/resources/extensions/browser-tools/engine/managed-gsd-browser.ts +265 -98
  257. package/src/resources/extensions/browser-tools/engine/selection.ts +90 -4
  258. package/src/resources/extensions/browser-tools/index.ts +71 -13
  259. package/src/resources/extensions/browser-tools/tests/browser-engine-selection.test.mjs +83 -13
  260. package/src/resources/extensions/browser-tools/tests/gsd-browser-launch-config.test.mjs +29 -1
  261. package/src/resources/extensions/browser-tools/tests/managed-gsd-browser-tools.test.mjs +136 -0
  262. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +34 -4
  263. package/src/resources/extensions/gsd/auto/orchestrator.ts +7 -5
  264. package/src/resources/extensions/gsd/auto-dispatch.ts +12 -0
  265. package/src/resources/extensions/gsd/auto-model-selection.ts +25 -5
  266. package/src/resources/extensions/gsd/auto-post-unit.ts +13 -2
  267. package/src/resources/extensions/gsd/auto-prompts.ts +40 -26
  268. package/src/resources/extensions/gsd/auto-start.ts +15 -10
  269. package/src/resources/extensions/gsd/auto-tool-tracking.ts +19 -0
  270. package/src/resources/extensions/gsd/auto-unit-tool-scope.ts +10 -17
  271. package/src/resources/extensions/gsd/auto-worktree.ts +30 -93
  272. package/src/resources/extensions/gsd/auto.ts +8 -15
  273. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +3 -5
  274. package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +23 -6
  275. package/src/resources/extensions/gsd/bootstrap/register-extension.ts +24 -0
  276. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +151 -15
  277. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +6 -2
  278. package/src/resources/extensions/gsd/branch-patterns.ts +3 -0
  279. package/src/resources/extensions/gsd/browser-daemon-auto-prep.ts +108 -0
  280. package/src/resources/extensions/gsd/browser-evidence.ts +18 -2
  281. package/src/resources/extensions/gsd/captures.ts +4 -6
  282. package/src/resources/extensions/gsd/constants.ts +0 -3
  283. package/src/resources/extensions/gsd/crash-recovery.ts +3 -9
  284. package/src/resources/extensions/gsd/doctor-environment.ts +2 -7
  285. package/src/resources/extensions/gsd/doctor-format.ts +12 -7
  286. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +13 -15
  287. package/src/resources/extensions/gsd/error-classifier.ts +11 -0
  288. package/src/resources/extensions/gsd/exec-sandbox.ts +49 -9
  289. package/src/resources/extensions/gsd/guidance.ts +139 -0
  290. package/src/resources/extensions/gsd/guided-flow.ts +16 -2
  291. package/src/resources/extensions/gsd/mcp-filter.ts +2 -23
  292. package/src/resources/extensions/gsd/mcp-tool-name.ts +6 -11
  293. package/src/resources/extensions/gsd/memory-consolidation-scanner.ts +1 -1
  294. package/src/resources/extensions/gsd/migrate/safety.ts +4 -1
  295. package/src/resources/extensions/gsd/notification-store.ts +26 -3
  296. package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +6 -4
  297. package/src/resources/extensions/gsd/paths.ts +33 -0
  298. package/src/resources/extensions/gsd/pre-execution-checks.ts +109 -3
  299. package/src/resources/extensions/gsd/preferences-models.ts +12 -47
  300. package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
  301. package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  302. package/src/resources/extensions/gsd/prompts/refine-slice.md +1 -1
  303. package/src/resources/extensions/gsd/prompts/replan-slice.md +1 -1
  304. package/src/resources/extensions/gsd/prompts/run-uat.md +1 -1
  305. package/src/resources/extensions/gsd/prompts/system.md +5 -2
  306. package/src/resources/extensions/gsd/provider-error-guidance.ts +4 -9
  307. package/src/resources/extensions/gsd/provider-switch-observer.ts +1 -1
  308. package/src/resources/extensions/gsd/publication.ts +122 -0
  309. package/src/resources/extensions/gsd/recovery-classification.ts +42 -96
  310. package/src/resources/extensions/gsd/safety/destructive-confirmation.ts +134 -0
  311. package/src/resources/extensions/gsd/state.ts +4 -21
  312. package/src/resources/extensions/gsd/stop-notice.ts +75 -0
  313. package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +22 -0
  314. package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +16 -19
  315. package/src/resources/extensions/gsd/tests/browser-automation-contract-fixture.ts +39 -0
  316. package/src/resources/extensions/gsd/tests/browser-contract.test.ts +44 -0
  317. package/src/resources/extensions/gsd/tests/browser-daemon-auto-prep.test.ts +144 -0
  318. package/src/resources/extensions/gsd/tests/checkout-branch-stash-guard.test.ts +66 -1
  319. package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +22 -0
  320. package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +8 -7
  321. package/src/resources/extensions/gsd/tests/destructive-confirmation.test.ts +303 -0
  322. package/src/resources/extensions/gsd/tests/dispatch-run-uat-browser-tools.test.ts +2 -1
  323. package/src/resources/extensions/gsd/tests/dynamic-bash-no-cap.test.ts +132 -0
  324. package/src/resources/extensions/gsd/tests/exec-graceful-kill.test.ts +193 -0
  325. package/src/resources/extensions/gsd/tests/exec-tool.test.ts +29 -1
  326. package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +35 -1
  327. package/src/resources/extensions/gsd/tests/guidance.test.ts +125 -0
  328. package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +53 -11
  329. package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +73 -58
  330. package/src/resources/extensions/gsd/tests/integration/gsd-integration-fixture.ts +80 -0
  331. package/src/resources/extensions/gsd/tests/mcp-project-config.test.ts +3 -1
  332. package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +32 -1
  333. package/src/resources/extensions/gsd/tests/notification-store.test.ts +32 -0
  334. package/src/resources/extensions/gsd/tests/oauth-api-model-routing.test.ts +167 -0
  335. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +193 -1
  336. package/src/resources/extensions/gsd/tests/provider-error-guidance.test.ts +3 -3
  337. package/src/resources/extensions/gsd/tests/publication.test.ts +120 -0
  338. package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +157 -0
  339. package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +1 -0
  340. package/src/resources/extensions/gsd/tests/stop-notice.test.ts +70 -0
  341. package/src/resources/extensions/gsd/tests/token-tool-gating.test.ts +76 -0
  342. package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +8 -0
  343. package/src/resources/extensions/gsd/tests/tool-surface-readiness.test.ts +155 -0
  344. package/src/resources/extensions/gsd/tests/uat-policy.test.ts +24 -29
  345. package/src/resources/extensions/gsd/tests/unit-closeout.test.ts +209 -0
  346. package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +67 -2
  347. package/src/resources/extensions/gsd/tests/unit-registry.test.ts +163 -0
  348. package/src/resources/extensions/gsd/tests/web-app-uat.test.ts +44 -1
  349. package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +2 -2
  350. package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +2 -2
  351. package/src/resources/extensions/gsd/tool-surface-readiness.ts +76 -0
  352. package/src/resources/extensions/gsd/tools/exec-tool.ts +8 -7
  353. package/src/resources/extensions/gsd/tools/plan-slice.ts +12 -6
  354. package/src/resources/extensions/gsd/uat-policy.ts +2 -1
  355. package/src/resources/extensions/gsd/unit-closeout.ts +201 -0
  356. package/src/resources/extensions/gsd/unit-context-composer.ts +111 -1
  357. package/src/resources/extensions/gsd/unit-context-manifest.ts +4 -28
  358. package/src/resources/extensions/gsd/unit-registry.ts +412 -0
  359. package/src/resources/extensions/gsd/unit-tool-contracts.ts +27 -192
  360. package/src/resources/extensions/gsd/web-app-uat.ts +51 -8
  361. package/src/resources/extensions/gsd/workflow-tool-surface.ts +4 -1
  362. package/src/resources/extensions/gsd/worktree-git-recovery.ts +15 -9
  363. package/src/resources/extensions/gsd/worktree-root.ts +12 -0
  364. package/src/resources/extensions/gsd/worktree-session-state.ts +3 -5
  365. package/src/resources/extensions/search-the-web/native-search.ts +5 -3
  366. package/src/resources/extensions/shared/browser-contract.ts +66 -0
  367. package/src/resources/extensions/shared/gsd-browser-cli.ts +119 -5
  368. package/src/resources/shared/package.json +3 -0
  369. package/src/resources/skills/create-skill/references/executable-code.md +1 -1
  370. package/src/resources/skills/create-skill/workflows/add-reference.md +8 -3
  371. package/src/resources/skills/create-skill/workflows/add-script.md +4 -2
  372. package/src/resources/skills/create-skill/workflows/add-template.md +3 -1
  373. package/src/resources/skills/create-skill/workflows/add-workflow.md +8 -3
  374. package/src/resources/skills/create-skill/workflows/upgrade-to-router.md +10 -5
  375. package/src/resources/skills/create-skill/workflows/verify-skill.md +9 -4
  376. package/src/resources/skills/spike-wrap-up/SKILL.md +9 -9
  377. /package/dist/web/standalone/.next/static/{C24pqUd-aru-l0Dp0gLZP → mU4QIDlpVHDdjDpeEKh5W}/_buildManifest.js +0 -0
  378. /package/dist/web/standalone/.next/static/{C24pqUd-aru-l0Dp0gLZP → mU4QIDlpVHDdjDpeEKh5W}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"input-controller.js","sourceRoot":"","sources":["../../../../src/modes/interactive/controllers/input-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAIpE;;;GAGG;AACH,SAAS,oBAAoB,CAAC,IAA8B;IAC3D,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACtD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IACvC,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9B,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,uBAAuB,CAAC,IAA8B,EAAE,MAAkC;IAClG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;IAC7E,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,IAexC;IACA,IAAI,CAAC,aAAa,CAAC,QAAQ,GAAG,KAAK,EAAE,IAAY,EAAE,EAAE;QACpD,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,IAAI;YAAE,OAAO;QAElB,IAAI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ACzB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;gBACvF,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAC9B,CAAC;YACD,OAAO;QACR,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC;QACjC,kFAAkF;QAClF,6BAA6B;QAC7B,IAAI,CAAC;YACJ,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACtC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACzB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;YACvF,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC9B,CAAC;IACF,CAAC,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,iBAAiB,CAAC,IAAY;IACtC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,mEAAmE;IACnE,wFAAwF;IACxF,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import type { ImageContent } from \"@gsd/pi-ai\";\nimport { dispatchSlashCommand } from \"../slash-command-handlers.js\";\nimport type { InteractiveModeStateHost } from \"../interactive-mode-state.js\";\nimport type { ContextualTips } from \"@gsd/agent-core\";\n\n/**\n * Consume and clear any pending pasted images from the host.\n * Returns undefined if there are no pending images.\n */\nfunction consumePendingImages(host: InteractiveModeStateHost): ImageContent[] | undefined {\n\tif (host.pendingImages.length === 0) return undefined;\n\tconst images = [...host.pendingImages];\n\thost.pendingImages.length = 0;\n\treturn images;\n}\n\nfunction markEditorSubmitLatency(host: InteractiveModeStateHost, images: ImageContent[] | undefined): void {\n\thost.session.beginTurnLatency?.({ source: \"tui\", trigger: \"editor_submit\" });\n\thost.session.markTurnLatency?.(\"tui.editor_submit\", { images: images?.length ?? 0 });\n}\n\nexport function setupEditorSubmitHandler(host: InteractiveModeStateHost & {\n\tgetSlashCommandContext: () => any;\n\thandleBashCommand: (command: string, excludeFromContext?: boolean) => Promise<void>;\n\tshowWarning: (message: string) => void;\n\tshowError: (message: string) => void;\n\tshowTip: (message: string) => void;\n\tupdateEditorBorderColor: () => void;\n\tisExtensionCommand: (text: string) => boolean;\n\tisKnownSlashCommand: (text: string) => boolean;\n\tqueueCompactionMessage: (text: string, mode: \"steer\" | \"followUp\") => void;\n\tupdatePendingMessagesDisplay: () => void;\n\tflushPendingBashComponents: () => void;\n\tcontextualTips: ContextualTips;\n\tgetContextPercent: () => number | undefined;\n\toptions?: { submitPromptsDirectly?: boolean };\n}): void {\n\thost.defaultEditor.onSubmit = async (text: string) => {\n\t\ttext = text.trim();\n\t\tif (!text) return;\n\n\t\tif (text.startsWith(\"/\") && !looksLikeFilePath(text)) {\n\t\t\tconst handled = await dispatchSlashCommand(text, host.getSlashCommandContext());\n\t\t\tif (handled) {\n\t\t\t\thost.editor.setText(\"\");\n\t\t\t\tconsumePendingImages(host); // discard images on slash command\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!host.isKnownSlashCommand(text)) {\n\t\t\t\tconst command = text.split(/\\s/)[0];\n\t\t\t\thost.showError(`Unknown command: ${command}. Use slash autocomplete to see available commands.`);\n\t\t\t\thost.editor.setText(\"\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (text.startsWith(\"!\")) {\n\t\t\tconst isExcluded = text.startsWith(\"!!\");\n\t\t\tconst command = isExcluded ? text.slice(2).trim() : text.slice(1).trim();\n\t\t\tif (command) {\n\t\t\t\tif (host.session.isBashRunning) {\n\t\t\t\t\thost.showWarning(\"A bash command is already running. Press Esc to cancel it first.\");\n\t\t\t\t\thost.editor.setText(text);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Track included bash commands for double-bang tip\n\t\t\t\tif (!isExcluded) {\n\t\t\t\t\thost.contextualTips.recordBashIncluded();\n\t\t\t\t}\n\t\t\t\thost.editor.addToHistory?.(text);\n\t\t\t\tawait host.handleBashCommand(command, isExcluded);\n\t\t\t\thost.isBashMode = false;\n\t\t\t\thost.updateEditorBorderColor();\n\t\t\t\tconsumePendingImages(host); // discard images on bash command\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Evaluate contextual tips before sending to agent\n\t\tconst tip = host.contextualTips.evaluate({\n\t\t\tinput: text,\n\t\t\tisStreaming: host.session.isStreaming,\n\t\t\tthinkingLevel: host.session.thinkingLevel,\n\t\t\tcontextPercent: host.getContextPercent(),\n\t\t});\n\t\tif (tip) {\n\t\t\thost.showTip(tip);\n\t\t}\n\n\t\tif (host.onInputCallback) {\n\t\t\thost.onInputCallback(text);\n\t\t\thost.editor.addToHistory?.(text);\n\t\t\treturn;\n\t\t}\n\n\t\t// Consume pending images for prompt submissions\n\t\tconst images = consumePendingImages(host);\n\n\t\tif (host.session.isCompacting) {\n\t\t\tif (host.isExtensionCommand(text)) {\n\t\t\t\thost.editor.addToHistory?.(text);\n\t\t\t\thost.editor.setText(\"\");\n\t\t\t\ttry {\n\t\t\t\t\tawait host.session.prompt(text, { images });\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\t\t\thost.showError(errorMessage);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thost.queueCompactionMessage(text, \"steer\");\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (host.session.isStreaming) {\n\t\t\thost.editor.addToHistory?.(text);\n\t\t\thost.editor.setText(\"\");\n\t\t\tawait host.session.prompt(text, { streamingBehavior: \"steer\", images });\n\t\t\thost.updatePendingMessagesDisplay();\n\t\t\thost.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\n\t\thost.flushPendingBashComponents();\n\n\t\tif (host.options?.submitPromptsDirectly) {\n\t\t\thost.editor.addToHistory?.(text);\n\t\t\ttry {\n\t\t\t\tmarkEditorSubmitLatency(host, images);\n\t\t\t\tawait host.session.prompt(text, { images });\n\t\t\t} catch (error: unknown) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\t\thost.showError(errorMessage);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\thost.editor.addToHistory?.(text);\n\t\t// submitPromptsDirectly is false; still dispatch via session.prompt so user input\n\t\t// is not silently discarded.\n\t\ttry {\n\t\t\tmarkEditorSubmitLatency(host, images);\n\t\t\tawait host.session.prompt(text, { images });\n\t\t} catch (error: unknown) {\n\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\thost.showError(errorMessage);\n\t\t}\n\t};\n}\n\n/**\n * Distinguish absolute file paths from slash commands (#3478).\n * Drag-and-drop inserts paths like \"/Users/name/Desktop/file.png\" which\n * should be treated as plain text input, not a /Users command.\n *\n * Heuristic: a slash command is a single token like \"/help\" or \"/gsd auto\".\n * File paths have a second \"/\" within the first token (e.g., \"/Users/...\").\n */\nfunction looksLikeFilePath(text: string): boolean {\n\tconst firstToken = text.split(/\\s/)[0];\n\t// Slash commands: /help, /gsd, /commit — single \"/\" at start only.\n\t// File paths: /Users/name/file, /home/user/file, /tmp/x — contain \"/\" after position 0.\n\treturn firstToken.indexOf(\"/\", 1) !== -1;\n}\n"]}
1
+ {"version":3,"file":"input-controller.js","sourceRoot":"","sources":["../../../../src/modes/interactive/controllers/input-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAIpE;;;GAGG;AACH,SAAS,oBAAoB,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,CAAC,CAAC;QACjC,kFAAkF;QAClF,6BAA6B;QAC7B,IAAI,CAAC;YACJ,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACtC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACzB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;YACvF,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC9B,CAAC;IACF,CAAC,CAAC;IAEF,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,iBAAiB,CAAC,IAAY;IACtC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,mEAAmE;IACnE,wFAAwF;IACxF,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import type { ImageContent } from \"@gsd/pi-ai\";\nimport { dispatchSlashCommand } from \"../slash-command-handlers.js\";\nimport type { InteractiveModeStateHost } from \"../interactive-mode-state.js\";\nimport type { ContextualTips } from \"@gsd/agent-core\";\n\n/**\n * Consume and clear any pending pasted images from the host.\n * Returns undefined if there are no pending images.\n */\nfunction consumePendingImages(host: InteractiveModeStateHost): ImageContent[] | undefined {\n\tif (host.pendingImages.length === 0) return undefined;\n\tconst images = [...host.pendingImages];\n\thost.pendingImages.length = 0;\n\treturn images;\n}\n\nfunction markEditorSubmitLatency(host: InteractiveModeStateHost, images: ImageContent[] | undefined): void {\n\thost.session.beginTurnLatency?.({ source: \"tui\", trigger: \"editor_submit\" });\n\thost.session.markTurnLatency?.(\"tui.editor_submit\", { images: images?.length ?? 0 });\n}\n\nfunction wireEditorSubmitHandler(\n\thost: InteractiveModeStateHost & { editor: { onSubmit?: (text: string) => void | Promise<void> } },\n\thandler: (text: string) => Promise<void>,\n): void {\n\thost.defaultEditor.onSubmit = handler;\n\tif (host.editor !== host.defaultEditor) {\n\t\thost.editor.onSubmit = handler;\n\t}\n}\n\nexport function setupEditorSubmitHandler(host: InteractiveModeStateHost & {\n\tgetSlashCommandContext: () => any;\n\thandleBashCommand: (command: string, excludeFromContext?: boolean) => Promise<void>;\n\tshowWarning: (message: string) => void;\n\tshowError: (message: string) => void;\n\tshowTip: (message: string) => void;\n\tupdateEditorBorderColor: () => void;\n\tisExtensionCommand: (text: string) => boolean;\n\tisKnownSlashCommand: (text: string) => boolean;\n\tqueueCompactionMessage: (text: string, mode: \"steer\" | \"followUp\") => void;\n\tupdatePendingMessagesDisplay: () => void;\n\tflushPendingBashComponents: () => void;\n\tcontextualTips: ContextualTips;\n\tgetContextPercent: () => number | undefined;\n\toptions?: { submitPromptsDirectly?: boolean };\n}): void {\n\tconst onSubmit = async (text: string) => {\n\t\ttext = text.trim();\n\t\tif (!text) return;\n\n\t\tif (text.startsWith(\"/\") && !looksLikeFilePath(text)) {\n\t\t\tconst handled = await dispatchSlashCommand(text, host.getSlashCommandContext());\n\t\t\tif (handled) {\n\t\t\t\thost.editor.setText(\"\");\n\t\t\t\tconsumePendingImages(host); // discard images on slash command\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!host.isKnownSlashCommand(text)) {\n\t\t\t\tconst command = text.split(/\\s/)[0];\n\t\t\t\thost.showError(`Unknown command: ${command}. Use slash autocomplete to see available commands.`);\n\t\t\t\thost.editor.setText(\"\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (text.startsWith(\"!\")) {\n\t\t\tconst isExcluded = text.startsWith(\"!!\");\n\t\t\tconst command = isExcluded ? text.slice(2).trim() : text.slice(1).trim();\n\t\t\tif (command) {\n\t\t\t\tif (host.session.isBashRunning) {\n\t\t\t\t\thost.showWarning(\"A bash command is already running. Press Esc to cancel it first.\");\n\t\t\t\t\thost.editor.setText(text);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Track included bash commands for double-bang tip\n\t\t\t\tif (!isExcluded) {\n\t\t\t\t\thost.contextualTips.recordBashIncluded();\n\t\t\t\t}\n\t\t\t\thost.editor.addToHistory?.(text);\n\t\t\t\tawait host.handleBashCommand(command, isExcluded);\n\t\t\t\thost.isBashMode = false;\n\t\t\t\thost.updateEditorBorderColor();\n\t\t\t\tconsumePendingImages(host); // discard images on bash command\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Evaluate contextual tips before sending to agent\n\t\tconst tip = host.contextualTips.evaluate({\n\t\t\tinput: text,\n\t\t\tisStreaming: host.session.isStreaming,\n\t\t\tthinkingLevel: host.session.thinkingLevel,\n\t\t\tcontextPercent: host.getContextPercent(),\n\t\t});\n\t\tif (tip) {\n\t\t\thost.showTip(tip);\n\t\t}\n\n\t\tif (host.onInputCallback) {\n\t\t\thost.onInputCallback(text);\n\t\t\thost.editor.addToHistory?.(text);\n\t\t\treturn;\n\t\t}\n\n\t\t// Consume pending images for prompt submissions\n\t\tconst images = consumePendingImages(host);\n\n\t\tif (host.session.isCompacting) {\n\t\t\tif (host.isExtensionCommand(text)) {\n\t\t\t\thost.editor.addToHistory?.(text);\n\t\t\t\thost.editor.setText(\"\");\n\t\t\t\ttry {\n\t\t\t\t\tawait host.session.prompt(text, { images });\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\t\t\thost.showError(errorMessage);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thost.queueCompactionMessage(text, \"steer\");\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (host.session.isStreaming) {\n\t\t\thost.editor.addToHistory?.(text);\n\t\t\thost.editor.setText(\"\");\n\t\t\tawait host.session.prompt(text, { streamingBehavior: \"steer\", images });\n\t\t\thost.updatePendingMessagesDisplay();\n\t\t\thost.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\n\t\thost.flushPendingBashComponents();\n\n\t\tif (host.options?.submitPromptsDirectly) {\n\t\t\thost.editor.addToHistory?.(text);\n\t\t\ttry {\n\t\t\t\tmarkEditorSubmitLatency(host, images);\n\t\t\t\tawait host.session.prompt(text, { images });\n\t\t\t} catch (error: unknown) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\t\thost.showError(errorMessage);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\thost.editor.addToHistory?.(text);\n\t\t// submitPromptsDirectly is false; still dispatch via session.prompt so user input\n\t\t// is not silently discarded.\n\t\ttry {\n\t\t\tmarkEditorSubmitLatency(host, images);\n\t\t\tawait host.session.prompt(text, { images });\n\t\t} catch (error: unknown) {\n\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\thost.showError(errorMessage);\n\t\t}\n\t};\n\n\twireEditorSubmitHandler(host, onSubmit);\n}\n\n/**\n * Distinguish absolute file paths from slash commands (#3478).\n * Drag-and-drop inserts paths like \"/Users/name/Desktop/file.png\" which\n * should be treated as plain text input, not a /Users command.\n *\n * Heuristic: a slash command is a single token like \"/help\" or \"/gsd auto\".\n * File paths have a second \"/\" within the first token (e.g., \"/Users/...\").\n */\nfunction looksLikeFilePath(text: string): boolean {\n\tconst firstToken = text.split(/\\s/)[0];\n\t// Slash commands: /help, /gsd, /commit — single \"/\" at start only.\n\t// File paths: /Users/name/file, /home/user/file, /tmp/x — contain \"/\" after position 0.\n\treturn firstToken.indexOf(\"/\", 1) !== -1;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-chat-render.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-chat-render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAA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EF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,2BAA2B,GAAG,IAAI,CAS9E;AAED;;;GAGG;AACJ,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,2BAA2B,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAyC3G"}
@@ -195,7 +195,17 @@ export function renderSessionContext(host, sessionContext, options = {}) {
195
195
  const component = new ToolExecutionComponent(content.name, content.arguments, { showImages: host.settingsManager.getShowImages() }, host.getRegisteredToolDefinition(content.name), host.ui);
196
196
  component.setExpanded(host.toolOutputExpanded);
197
197
  host.chatContainer.addChild(component);
198
- if (message.stopReason === "aborted" || message.stopReason === "error") {
198
+ // On an aborted/errored turn, only the tool calls that never
199
+ // produced a result should render as interrupted. A tool that
200
+ // actually completed has its result in a later `toolResult`
201
+ // message (keyed by toolCallId) — register it as pending so the
202
+ // normal toolResult handler below renders the TRUE result with
203
+ // its real isError flag. Otherwise the successful result would be
204
+ // silently discarded and the row shown red.
205
+ const turnAbortedOrErrored = message.stopReason === "aborted" || message.stopReason === "error";
206
+ const hasRealResult = turnAbortedOrErrored &&
207
+ sessionContext.messages.some((m) => m.role === "toolResult" && m.toolCallId === content.id);
208
+ if (turnAbortedOrErrored && !hasRealResult) {
199
209
  let errorMessage;
200
210
  if (message.stopReason === "aborted") {
201
211
  const retryAttempt = host.session.retryAttempt;
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-chat-render.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-chat-render.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,gFAAgF;AAIhF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAa,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,mBAAm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ode.ts (Phase E2 seam remediation).\n\nimport type { AgentMessage } from \"@gsd/pi-agent-core\";\nimport type { AssistantMessage, Message } from \"@gsd/pi-ai\";\nimport { parseSkillBlock } from \"@gsd/agent-core\";\nimport type { SessionContext } from \"@gsd/pi-coding-agent/core/session-manager.js\";\nimport type { TruncationResult } from \"@gsd/pi-coding-agent/core/tools/truncate.js\";\nimport { Container, Markdown, Spacer, Text } from \"@gsd/pi-tui\";\nimport { theme } from \"@gsd/pi-coding-agent/theme/theme.js\";\nimport { AssistantMessageComponent } from \"./components/assistant-message.js\";\nimport { chatTurnFollowsUser, reconcileChatTurnConnections } from \"./components/chat-turn-connect.js\";\nimport { BashExecutionComponent } from \"./components/bash-execution.js\";\nimport { BranchSummaryMessageComponent } from \"./components/branch-summary-message.js\";\nimport { CompactionSummaryMessageComponent } from \"./components/compaction-summary-message.js\";\nimport { CustomMessageComponent } from \"./components/custom-message.js\";\nimport { DynamicBorder } from \"./components/dynamic-border.js\";\nimport { SkillInvocationMessageComponent } from \"./components/skill-invocation-message.js\";\nimport { ToolExecutionComponent } from \"./components/tool-execution.js\";\nimport { UserMessageComponent } from \"./components/user-message.js\";\nimport { asServerToolUse, asWebSearchResult, isToolContentBlock } from \"./gsd-content-blocks.js\";\nimport { buildAssistantReplaySegments } from \"./interactive-notify-render.js\";\nimport { MAX_CHAT_COMPONENTS } from \"./interactive-mode-class-constants.js\";\nimport type { InteractiveModeDelegateHost } from \"./interactive-mode-delegate-host.js\";\n\n\t/** Extract text content from a user message */\nexport function getUserMessageText(host: InteractiveModeDelegateHost, message: Message): string {\n\t\tif (message.role !== \"user\") return \"\";\n\t\tconst textBlocks =\n\t\t\ttypeof message.content === \"string\"\n\t\t\t\t? [{ type: \"text\", text: message.content }]\n\t\t\t\t: message.content.filter((c: { type: string }) => c.type === \"text\");\n\t\treturn textBlocks.map((c) => (c as { text: string }).text).join(\"\");\n\t}\n\n\t/**\n\t * Show a status message in the chat.\n\t *\n\t * If multiple status messages are emitted back-to-back (without anything else being added to the chat),\n\t * we update the previous status line instead of appending new ones to avoid log spam.\n\t */\nexport function showStatus(host: InteractiveModeDelegateHost, message: string, options?: { append?: boolean }): void {\n\t\tconst append = options?.append ?? false;\n\t\tconst children = host.chatContainer.children;\n\t\tconst last = children.length > 0 ? children[children.length - 1] : undefined;\n\t\tconst secondLast = children.length > 1 ? children[children.length - 2] : undefined;\n\n\t\tif (!append && last && secondLast && last === host.lastStatusText && secondLast === host.lastStatusSpacer) {\n\t\t\thost.lastStatusText.setText(theme.fg(\"dim\", message));\n\t\t\thost.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\n\t\tconst spacer = new Spacer(1);\n\t\tconst text = new Text(theme.fg(\"dim\", message), 1, 0);\n\t\thost.chatContainer.addChild(spacer);\n\t\thost.chatContainer.addChild(text);\n\t\thost.lastStatusSpacer = spacer;\n\t\thost.lastStatusText = text;\n\t\thost.ui.requestRender();\n\t}\n\nfunction addUserMessageComponent(host: InteractiveModeDelegateHost, userComponent: UserMessageComponent): void {\n\thost.chatContainer.addChild(userComponent);\n}\n\nfunction hasAssistantVisibleContent(content: Array<any>, hideThinkingBlock: boolean): boolean {\n\treturn content.some((c: any) => {\n\t\tif (c?.type === \"text\" && typeof c.text === \"string\" && c.text.trim().length > 0) return true;\n\t\tif (!hideThinkingBlock && c?.type === \"thinking\" && typeof c.thinking === \"string\" && c.thinking.trim().length > 0) return true;\n\t\treturn false;\n\t});\n}\n\nfunction finalizeChatMutation(host: InteractiveModeDelegateHost): void {\n\ttrimChatHistory(host);\n\treconcileChatTurnConnections(host.chatContainer.children);\n}\n\nexport function addMessageToChat(host: InteractiveModeDelegateHost, message: AgentMessage, options?: { populateHistory?: boolean }): void {\n\t\tconst timestampFormat = host.settingsManager.getTimestampFormat();\n\t\tswitch (message.role) {\n\t\t\tcase \"bashExecution\": {\n\t\t\t\tconst component = new BashExecutionComponent(message.command, host.ui, message.excludeFromContext);\n\t\t\t\tif (message.output) {\n\t\t\t\t\tcomponent.appendOutput(message.output);\n\t\t\t\t}\n\t\t\t\tcomponent.setComplete(\n\t\t\t\t\tmessage.exitCode,\n\t\t\t\t\tmessage.cancelled,\n\t\t\t\t\tmessage.truncated ? ({ truncated: true } as TruncationResult) : undefined,\n\t\t\t\t\tmessage.fullOutputPath,\n\t\t\t\t);\n\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"custom\": {\n\t\t\t\tif (message.display) {\n\t\t\t\t\tconst renderer = host.session.extensionRunner?.getMessageRenderer(message.customType);\n\t\t\t\t\tconst component = new CustomMessageComponent(message, renderer, host.getMarkdownThemeWithSettings());\n\t\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"compactionSummary\": {\n\t\t\t\thost.chatContainer.addChild(new Spacer(1));\n\t\t\t\tconst component = new CompactionSummaryMessageComponent(message, host.getMarkdownThemeWithSettings());\n\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branchSummary\": {\n\t\t\t\thost.chatContainer.addChild(new Spacer(1));\n\t\t\t\tconst component = new BranchSummaryMessageComponent(message, host.getMarkdownThemeWithSettings());\n\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"user\": {\n\t\t\t\tconst textContent = getUserMessageText(host, message);\n\t\t\t\tif (textContent) {\n\t\t\t\t\tconst skillBlock = parseSkillBlock(textContent);\n\t\t\t\t\tif (skillBlock) {\n\t\t\t\t\t\t// Render skill block (collapsible)\n\t\t\t\t\t\thost.chatContainer.addChild(new Spacer(1));\n\t\t\t\t\t\tconst component = new SkillInvocationMessageComponent(\n\t\t\t\t\t\t\tskillBlock,\n\t\t\t\t\t\t\thost.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\t\t\t// Render user message separately if present\n\t\t\t\t\t\tif (skillBlock.userMessage) {\n\t\t\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\t\t\tskillBlock.userMessage,\n\t\t\t\t\t\t\t\thost.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\t\tmessage.timestamp,\n\t\t\t\t\t\t\t\ttimestampFormat,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\taddUserMessageComponent(host, userComponent);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst userComponent = new UserMessageComponent(textContent, host.getMarkdownThemeWithSettings(), message.timestamp, timestampFormat);\n\t\t\t\t\t\taddUserMessageComponent(host, userComponent);\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.populateHistory) {\n\t\t\t\t\t\thost.editor.addToHistory?.(textContent);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"assistant\": {\n\t\t\t\tconst hasToolBlocks = message.content.some((c: any) => isToolContentBlock(c));\n\t\t\t\tconst isAbortOrError = message.stopReason === \"aborted\" || message.stopReason === \"error\";\n\t\t\t\tif (!hasAssistantVisibleContent(message.content, host.hideThinkingBlock) && !(isAbortOrError && !hasToolBlocks)) break;\n\t\t\t\tconst connectedToUser = chatTurnFollowsUser(host.chatContainer.children);\n\t\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\t\tmessage,\n\t\t\t\t\thost.hideThinkingBlock,\n\t\t\t\t\thost.getMarkdownThemeWithSettings(),\n\t\t\t\t\ttimestampFormat,\n\t\t\t\t\tundefined,\n\t\t\t\t\tconnectedToUser,\n\t\t\t\t);\n\t\t\t\thost.chatContainer.addChild(assistantComponent);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"toolResult\": {\n\t\t\t\t// Tool results are rendered inline with tool calls, handled separately\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst _exhaustive: never = message;\n\t\t\t}\n\t\t}\n\t\tfinalizeChatMutation(host);\n\t}\n\n\t/**\n\t * Remove oldest components when chat exceeds MAX_CHAT_COMPONENTS.\n\t * Only render-components are removed — session data stays in SessionManager.\n\t */\nexport function trimChatHistory(host: InteractiveModeDelegateHost): void {\n\t\twhile (host.chatContainer.children.length > MAX_CHAT_COMPONENTS) {\n\t\t\tconst oldest = host.chatContainer.children[0];\n\t\t\thost.chatContainer.removeChild(oldest);\n\t\t}\n\t}\n\n\t/**\n\t * Render session context to chat. Used for initial load and rebuild after compaction.\n\t * @param sessionContext Session context to render\n\t * @param options.updateFooter Update footer state\n\t * @param options.populateHistory Add user messages to editor history\n\t */\nexport function renderSessionContext(host: InteractiveModeDelegateHost, \n\t\tsessionContext: SessionContext,\n\t\toptions: { updateFooter?: boolean; populateHistory?: boolean } = {},\n\t): void {\n\t\thost.pendingTools.clear();\n\t\tconst timestampFormat = host.settingsManager.getTimestampFormat();\n\n\t\tif (options.updateFooter) {\n\t\t\thost.footer.invalidate();\n\t\t\thost.updateEditorBorderColor();\n\t\t}\n\n\t\tfor (const message of sessionContext.messages) {\n\t\t\t// Assistant messages need special handling for tool calls\n\t\t\tif (message.role === \"assistant\") {\n\t\t\t\tconst hasToolBlocks = message.content.some((c) => isToolContentBlock(c));\n\t\t\t\tif (!hasToolBlocks) {\n\t\t\t\t\taddMessageToChat(host, message);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst assistantSegments: AssistantMessageComponent[] = [];\n\t\t\t\tconst replaySegments = buildAssistantReplaySegments(message.content);\n\n\t\t\t\tfor (const segment of replaySegments) {\n\t\t\t\t\tif (segment.kind === \"assistant\") {\n\t\t\t\t\t\tconst segContent = message.content.slice(segment.startIndex, segment.endIndex + 1);\n\t\t\t\t\t\tif (!hasAssistantVisibleContent(segContent, host.hideThinkingBlock)) continue;\n\t\t\t\t\t\tconst connectedToUser = chatTurnFollowsUser(host.chatContainer.children);\n\t\t\t\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\thost.hideThinkingBlock,\n\t\t\t\t\t\t\thost.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\ttimestampFormat,\n\t\t\t\t\t\t\t{ startIndex: segment.startIndex, endIndex: segment.endIndex },\n\t\t\t\t\t\t\tconnectedToUser,\n\t\t\t\t\t\t);\n\t\t\t\t\t\thost.chatContainer.addChild(assistantComponent);\n\t\t\t\t\t\tassistantSegments.push(assistantComponent);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst content = message.content[segment.contentIndex];\n\t\t\t\t\tif (content.type === \"toolCall\") {\n\t\t\t\t\t\tconst component = new ToolExecutionComponent(\n\t\t\t\t\t\t\tcontent.name,\n\t\t\t\t\t\t\tcontent.arguments,\n\t\t\t\t\t\t\t{ showImages: host.settingsManager.getShowImages() },\n\t\t\t\t\t\t\thost.getRegisteredToolDefinition(content.name),\n\t\t\t\t\t\t\thost.ui,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\t\t\thost.chatContainer.addChild(component);\n\n\t\t\t\t\t\tif (message.stopReason === \"aborted\" || message.stopReason === \"error\") {\n\t\t\t\t\t\t\tlet errorMessage: string;\n\t\t\t\t\t\t\tif (message.stopReason === \"aborted\") {\n\t\t\t\t\t\t\t\tconst retryAttempt = host.session.retryAttempt;\n\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\tretryAttempt > 0\n\t\t\t\t\t\t\t\t\t\t? `Aborted after ${retryAttempt} retry attempt${retryAttempt > 1 ? \"s\" : \"\"}`\n\t\t\t\t\t\t\t\t\t\t: \"Operation aborted\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\terrorMessage = message.errorMessage || \"Error\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcomponent.updateResult({ content: [{ type: \"text\", text: errorMessage }], isError: true });\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thost.pendingTools.set(content.id, component);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst serverTool = asServerToolUse(content);\n\t\t\t\t\t\tif (serverTool) {\n\t\t\t\t\t\t// Server-side tool (e.g., native web search)\n\t\t\t\t\t\tconst component = new ToolExecutionComponent(\n\t\t\t\t\t\t\tserverTool.name,\n\t\t\t\t\t\t\tserverTool.input ?? {},\n\t\t\t\t\t\t\t{ showImages: host.settingsManager.getShowImages() },\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\thost.ui,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\t\t\t// Find matching webSearchResult in host message's content\n\t\t\t\t\t\tconst resultBlock = message.content\n\t\t\t\t\t\t\t.map(asWebSearchResult)\n\t\t\t\t\t\t\t.find((block) => block && block.toolUseId === serverTool.id);\n\t\t\t\t\t\tif (resultBlock) {\n\t\t\t\t\t\t\tconst searchContent = resultBlock.content;\n\t\t\t\t\t\t\tconst isError = searchContent && typeof searchContent === \"object\" && \"type\" in (searchContent as any) && (searchContent as any).type === \"web_search_tool_result_error\";\n\t\t\t\t\t\t\tconst resultText = host.formatWebSearchResult(searchContent);\n\t\t\t\t\t\t\tcomponent.updateResult({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: resultText }],\n\t\t\t\t\t\t\t\tisError: !!isError,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No result yet (aborted stream?) — show as pending\n\t\t\t\t\t\t\thost.pendingTools.set(serverTool.id, component);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Match streaming-mode behavior: show metadata once on the final\n\t\t\t\t// assistant prose segment for host message.\n\t\t\t\tconst lastAssistantSegment = assistantSegments[assistantSegments.length - 1];\n\t\t\t\tlastAssistantSegment?.setShowMetadata(true);\n\t\t\t} else if (message.role === \"toolResult\") {\n\t\t\t\t// Match tool results to pending tool components\n\t\t\t\tconst component = host.pendingTools.get(message.toolCallId);\n\t\t\t\tif (component) {\n\t\t\t\t\tcomponent.updateResult(message);\n\t\t\t\t\thost.pendingTools.delete(message.toolCallId);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// All other messages use standard rendering\n\t\t\t\taddMessageToChat(host, message, options);\n\t\t\t}\n\t\t}\n\n\t\t// Any pendingTools entries left over after replay are historical tool\n\t\t// calls whose results were squashed out of session context (commonly by\n\t\t// compaction). Mark them finished so the frame stops showing \"Running\".\n\t\tfor (const component of host.pendingTools.values()) {\n\t\t\tcomponent.markHistoricalNoResult();\n\t\t}\n\t\thost.pendingTools.clear();\n\t\ttrimChatHistory(host);\n\t\treconcileChatTurnConnections(host.chatContainer.children);\n\t\thost.ui.requestRender();\n\t}\n\nexport function renderInitialMessages(host: InteractiveModeDelegateHost): void {\n\t\tconst context = host.sessionManager.buildSessionContext();\n\t\trenderSessionContext(host, context, {\n\t\t\tupdateFooter: true,\n\t\t\tpopulateHistory: true,\n\t\t});\n\t\tpopulatePinnedFromMessages(host, context.messages);\n\n\t\tconst allEntries = host.sessionManager.getEntries();\n\t\tconst compactionCount = allEntries.filter((e: { type: string }) => e.type === \"compaction\").length;\n\t\tif (compactionCount > 0) {\n\t\t\tconst times = compactionCount === 1 ? \"1 time\" : `${compactionCount} times`;\n\t\t\tshowStatus(host, `Session compacted ${times}`);\n\t\t}\n\t}\n\nexport async function getUserInput(host: InteractiveModeDelegateHost): Promise<string> {\n\t\treturn new Promise((resolve) => {\n\t\t\thost.onInputCallback = (text: string) => {\n\t\t\t\thost.onInputCallback = undefined;\n\t\t\t\tresolve(text);\n\t\t\t};\n\t\t});\n\t}\n\nexport function rebuildChatFromMessages(host: InteractiveModeDelegateHost): void {\n\t\thost.chatContainer.clear();\n\t\thost.pinnedMessageContainer.clear();\n\t\tconst context = host.sessionManager.buildSessionContext();\n\t\trenderSessionContext(host, context);\n\t\t// Pinned content NOT re-populated here — the streaming lifecycle in\n\t\t// chat-controller.ts manages the pinned zone during active work.\n\t\t// populatePinnedFromMessages() remains in renderInitialMessages()\n\t\t// for the session-resume case at startup.\n\t}\n\n\t/**\n\t * After rebuilding chat from messages, pin the last assistant text above the\n\t * editor if tool results would otherwise push it out of the viewport.\n\t */\nexport function populatePinnedFromMessages(host: InteractiveModeDelegateHost, messages: AgentMessage[]): void {\n\t\thost.pinnedMessageContainer.clear();\n\n\t\t// Walk backwards to find the last assistant message\n\t\tlet lastAssistant: AssistantMessage | undefined;\n\t\tfor (let i = messages.length - 1; i >= 0; i--) {\n\t\t\tconst msg = messages[i];\n\t\t\tif (msg && \"role\" in msg && msg.role === \"assistant\") {\n\t\t\t\tlastAssistant = msg as AssistantMessage;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!lastAssistant) return;\n\n\t\t// Check if any tool calls follow the last text block\n\t\tconst content = lastAssistant.content;\n\t\tlet lastTextIndex = -1;\n\t\tlet hasToolAfterText = false;\n\t\tfor (let i = 0; i < content.length; i++) {\n\t\t\tif (content[i].type === \"text\") lastTextIndex = i;\n\t\t}\n\t\tif (lastTextIndex >= 0) {\n\t\t\tfor (let i = lastTextIndex + 1; i < content.length; i++) {\n\t\t\t\tif (isToolContentBlock(content[i])) {\n\t\t\t\t\thasToolAfterText = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!hasToolAfterText || lastTextIndex < 0) return;\n\n\t\tconst textBlock = content[lastTextIndex] as { type: \"text\"; text: string };\n\t\tconst text = textBlock.text?.trim();\n\t\tif (!text) return;\n\n\t\thost.pinnedMessageContainer.addChild(\n\t\t\tnew DynamicBorder((str: string) => theme.fg(\"dim\", str), \"Latest Output\"),\n\t\t);\n\t\thost.pinnedMessageContainer.addChild(\n\t\t\tnew Markdown(text, 1, 0, host.getMarkdownThemeWithSettings()),\n\t\t);\n\t}\n"]}
1
+ {"version":3,"file":"interactive-chat-render.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-chat-render.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,gFAAgF;AAIhF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAa,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;A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KAAK,MAAM;YAAE,aAAa,GAAG,CAAC,CAAC;IACnD,CAAC;IACD,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,aAAa,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACzD,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpC,gBAAgB,GAAG,IAAI,CAAC;gBACxB,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;IACD,IAAI,CAAC,gBAAgB,IAAI,aAAa,GAAG,CAAC;QAAE,OAAO;IAEnD,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAmC,CAAC;IAC3E,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;IACpC,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CACnC,IAAI,aAAa,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,eAAe,CAAC,CACzE,CAAC;IACF,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CACnC,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAC7D,CAAC;AACH,CAAC","sourcesContent":["// Project/App: gsd-pi\n// File Purpose: Extracted from interactive-mode.ts (Phase E2 seam remediation).\n\nimport type { AgentMessage } from \"@gsd/pi-agent-core\";\nimport type { AssistantMessage, Message } from \"@gsd/pi-ai\";\nimport { parseSkillBlock } from \"@gsd/agent-core\";\nimport type { SessionContext } from \"@gsd/pi-coding-agent/core/session-manager.js\";\nimport type { TruncationResult } from \"@gsd/pi-coding-agent/core/tools/truncate.js\";\nimport { Container, Markdown, Spacer, Text } from \"@gsd/pi-tui\";\nimport { theme } from \"@gsd/pi-coding-agent/theme/theme.js\";\nimport { AssistantMessageComponent } from \"./components/assistant-message.js\";\nimport { chatTurnFollowsUser, reconcileChatTurnConnections } from \"./components/chat-turn-connect.js\";\nimport { BashExecutionComponent } from \"./components/bash-execution.js\";\nimport { BranchSummaryMessageComponent } from \"./components/branch-summary-message.js\";\nimport { CompactionSummaryMessageComponent } from \"./components/compaction-summary-message.js\";\nimport { CustomMessageComponent } from \"./components/custom-message.js\";\nimport { DynamicBorder } from \"./components/dynamic-border.js\";\nimport { SkillInvocationMessageComponent } from \"./components/skill-invocation-message.js\";\nimport { ToolExecutionComponent } from \"./components/tool-execution.js\";\nimport { UserMessageComponent } from \"./components/user-message.js\";\nimport { asServerToolUse, asWebSearchResult, isToolContentBlock } from \"./gsd-content-blocks.js\";\nimport { buildAssistantReplaySegments } from \"./interactive-notify-render.js\";\nimport { MAX_CHAT_COMPONENTS } from \"./interactive-mode-class-constants.js\";\nimport type { InteractiveModeDelegateHost } from \"./interactive-mode-delegate-host.js\";\n\n\t/** Extract text content from a user message */\nexport function getUserMessageText(host: InteractiveModeDelegateHost, message: Message): string {\n\t\tif (message.role !== \"user\") return \"\";\n\t\tconst textBlocks =\n\t\t\ttypeof message.content === \"string\"\n\t\t\t\t? [{ type: \"text\", text: message.content }]\n\t\t\t\t: message.content.filter((c: { type: string }) => c.type === \"text\");\n\t\treturn textBlocks.map((c) => (c as { text: string }).text).join(\"\");\n\t}\n\n\t/**\n\t * Show a status message in the chat.\n\t *\n\t * If multiple status messages are emitted back-to-back (without anything else being added to the chat),\n\t * we update the previous status line instead of appending new ones to avoid log spam.\n\t */\nexport function showStatus(host: InteractiveModeDelegateHost, message: string, options?: { append?: boolean }): void {\n\t\tconst append = options?.append ?? false;\n\t\tconst children = host.chatContainer.children;\n\t\tconst last = children.length > 0 ? children[children.length - 1] : undefined;\n\t\tconst secondLast = children.length > 1 ? children[children.length - 2] : undefined;\n\n\t\tif (!append && last && secondLast && last === host.lastStatusText && secondLast === host.lastStatusSpacer) {\n\t\t\thost.lastStatusText.setText(theme.fg(\"dim\", message));\n\t\t\thost.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\n\t\tconst spacer = new Spacer(1);\n\t\tconst text = new Text(theme.fg(\"dim\", message), 1, 0);\n\t\thost.chatContainer.addChild(spacer);\n\t\thost.chatContainer.addChild(text);\n\t\thost.lastStatusSpacer = spacer;\n\t\thost.lastStatusText = text;\n\t\thost.ui.requestRender();\n\t}\n\nfunction addUserMessageComponent(host: InteractiveModeDelegateHost, userComponent: UserMessageComponent): void {\n\thost.chatContainer.addChild(userComponent);\n}\n\nfunction hasAssistantVisibleContent(content: Array<any>, hideThinkingBlock: boolean): boolean {\n\treturn content.some((c: any) => {\n\t\tif (c?.type === \"text\" && typeof c.text === \"string\" && c.text.trim().length > 0) return true;\n\t\tif (!hideThinkingBlock && c?.type === \"thinking\" && typeof c.thinking === \"string\" && c.thinking.trim().length > 0) return true;\n\t\treturn false;\n\t});\n}\n\nfunction finalizeChatMutation(host: InteractiveModeDelegateHost): void {\n\ttrimChatHistory(host);\n\treconcileChatTurnConnections(host.chatContainer.children);\n}\n\nexport function addMessageToChat(host: InteractiveModeDelegateHost, message: AgentMessage, options?: { populateHistory?: boolean }): void {\n\t\tconst timestampFormat = host.settingsManager.getTimestampFormat();\n\t\tswitch (message.role) {\n\t\t\tcase \"bashExecution\": {\n\t\t\t\tconst component = new BashExecutionComponent(message.command, host.ui, message.excludeFromContext);\n\t\t\t\tif (message.output) {\n\t\t\t\t\tcomponent.appendOutput(message.output);\n\t\t\t\t}\n\t\t\t\tcomponent.setComplete(\n\t\t\t\t\tmessage.exitCode,\n\t\t\t\t\tmessage.cancelled,\n\t\t\t\t\tmessage.truncated ? ({ truncated: true } as TruncationResult) : undefined,\n\t\t\t\t\tmessage.fullOutputPath,\n\t\t\t\t);\n\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"custom\": {\n\t\t\t\tif (message.display) {\n\t\t\t\t\tconst renderer = host.session.extensionRunner?.getMessageRenderer(message.customType);\n\t\t\t\t\tconst component = new CustomMessageComponent(message, renderer, host.getMarkdownThemeWithSettings());\n\t\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"compactionSummary\": {\n\t\t\t\thost.chatContainer.addChild(new Spacer(1));\n\t\t\t\tconst component = new CompactionSummaryMessageComponent(message, host.getMarkdownThemeWithSettings());\n\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branchSummary\": {\n\t\t\t\thost.chatContainer.addChild(new Spacer(1));\n\t\t\t\tconst component = new BranchSummaryMessageComponent(message, host.getMarkdownThemeWithSettings());\n\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"user\": {\n\t\t\t\tconst textContent = getUserMessageText(host, message);\n\t\t\t\tif (textContent) {\n\t\t\t\t\tconst skillBlock = parseSkillBlock(textContent);\n\t\t\t\t\tif (skillBlock) {\n\t\t\t\t\t\t// Render skill block (collapsible)\n\t\t\t\t\t\thost.chatContainer.addChild(new Spacer(1));\n\t\t\t\t\t\tconst component = new SkillInvocationMessageComponent(\n\t\t\t\t\t\t\tskillBlock,\n\t\t\t\t\t\t\thost.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\t\t\t// Render user message separately if present\n\t\t\t\t\t\tif (skillBlock.userMessage) {\n\t\t\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\t\t\tskillBlock.userMessage,\n\t\t\t\t\t\t\t\thost.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\t\tmessage.timestamp,\n\t\t\t\t\t\t\t\ttimestampFormat,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\taddUserMessageComponent(host, userComponent);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst userComponent = new UserMessageComponent(textContent, host.getMarkdownThemeWithSettings(), message.timestamp, timestampFormat);\n\t\t\t\t\t\taddUserMessageComponent(host, userComponent);\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.populateHistory) {\n\t\t\t\t\t\thost.editor.addToHistory?.(textContent);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"assistant\": {\n\t\t\t\tconst hasToolBlocks = message.content.some((c: any) => isToolContentBlock(c));\n\t\t\t\tconst isAbortOrError = message.stopReason === \"aborted\" || message.stopReason === \"error\";\n\t\t\t\tif (!hasAssistantVisibleContent(message.content, host.hideThinkingBlock) && !(isAbortOrError && !hasToolBlocks)) break;\n\t\t\t\tconst connectedToUser = chatTurnFollowsUser(host.chatContainer.children);\n\t\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\t\tmessage,\n\t\t\t\t\thost.hideThinkingBlock,\n\t\t\t\t\thost.getMarkdownThemeWithSettings(),\n\t\t\t\t\ttimestampFormat,\n\t\t\t\t\tundefined,\n\t\t\t\t\tconnectedToUser,\n\t\t\t\t);\n\t\t\t\thost.chatContainer.addChild(assistantComponent);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"toolResult\": {\n\t\t\t\t// Tool results are rendered inline with tool calls, handled separately\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst _exhaustive: never = message;\n\t\t\t}\n\t\t}\n\t\tfinalizeChatMutation(host);\n\t}\n\n\t/**\n\t * Remove oldest components when chat exceeds MAX_CHAT_COMPONENTS.\n\t * Only render-components are removed — session data stays in SessionManager.\n\t */\nexport function trimChatHistory(host: InteractiveModeDelegateHost): void {\n\t\twhile (host.chatContainer.children.length > MAX_CHAT_COMPONENTS) {\n\t\t\tconst oldest = host.chatContainer.children[0];\n\t\t\thost.chatContainer.removeChild(oldest);\n\t\t}\n\t}\n\n\t/**\n\t * Render session context to chat. Used for initial load and rebuild after compaction.\n\t * @param sessionContext Session context to render\n\t * @param options.updateFooter Update footer state\n\t * @param options.populateHistory Add user messages to editor history\n\t */\nexport function renderSessionContext(host: InteractiveModeDelegateHost, \n\t\tsessionContext: SessionContext,\n\t\toptions: { updateFooter?: boolean; populateHistory?: boolean } = {},\n\t): void {\n\t\thost.pendingTools.clear();\n\t\tconst timestampFormat = host.settingsManager.getTimestampFormat();\n\n\t\tif (options.updateFooter) {\n\t\t\thost.footer.invalidate();\n\t\t\thost.updateEditorBorderColor();\n\t\t}\n\n\t\tfor (const message of sessionContext.messages) {\n\t\t\t// Assistant messages need special handling for tool calls\n\t\t\tif (message.role === \"assistant\") {\n\t\t\t\tconst hasToolBlocks = message.content.some((c) => isToolContentBlock(c));\n\t\t\t\tif (!hasToolBlocks) {\n\t\t\t\t\taddMessageToChat(host, message);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst assistantSegments: AssistantMessageComponent[] = [];\n\t\t\t\tconst replaySegments = buildAssistantReplaySegments(message.content);\n\n\t\t\t\tfor (const segment of replaySegments) {\n\t\t\t\t\tif (segment.kind === \"assistant\") {\n\t\t\t\t\t\tconst segContent = message.content.slice(segment.startIndex, segment.endIndex + 1);\n\t\t\t\t\t\tif (!hasAssistantVisibleContent(segContent, host.hideThinkingBlock)) continue;\n\t\t\t\t\t\tconst connectedToUser = chatTurnFollowsUser(host.chatContainer.children);\n\t\t\t\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\thost.hideThinkingBlock,\n\t\t\t\t\t\t\thost.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\ttimestampFormat,\n\t\t\t\t\t\t\t{ startIndex: segment.startIndex, endIndex: segment.endIndex },\n\t\t\t\t\t\t\tconnectedToUser,\n\t\t\t\t\t\t);\n\t\t\t\t\t\thost.chatContainer.addChild(assistantComponent);\n\t\t\t\t\t\tassistantSegments.push(assistantComponent);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst content = message.content[segment.contentIndex];\n\t\t\t\t\tif (content.type === \"toolCall\") {\n\t\t\t\t\t\tconst component = new ToolExecutionComponent(\n\t\t\t\t\t\t\tcontent.name,\n\t\t\t\t\t\t\tcontent.arguments,\n\t\t\t\t\t\t\t{ showImages: host.settingsManager.getShowImages() },\n\t\t\t\t\t\t\thost.getRegisteredToolDefinition(content.name),\n\t\t\t\t\t\t\thost.ui,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\t\t\thost.chatContainer.addChild(component);\n\n\t\t\t\t\t\t// On an aborted/errored turn, only the tool calls that never\n\t\t\t\t\t\t// produced a result should render as interrupted. A tool that\n\t\t\t\t\t\t// actually completed has its result in a later `toolResult`\n\t\t\t\t\t\t// message (keyed by toolCallId) — register it as pending so the\n\t\t\t\t\t\t// normal toolResult handler below renders the TRUE result with\n\t\t\t\t\t\t// its real isError flag. Otherwise the successful result would be\n\t\t\t\t\t\t// silently discarded and the row shown red.\n\t\t\t\t\t\tconst turnAbortedOrErrored =\n\t\t\t\t\t\t\tmessage.stopReason === \"aborted\" || message.stopReason === \"error\";\n\t\t\t\t\t\tconst hasRealResult =\n\t\t\t\t\t\t\tturnAbortedOrErrored &&\n\t\t\t\t\t\t\tsessionContext.messages.some(\n\t\t\t\t\t\t\t\t(m) => m.role === \"toolResult\" && m.toolCallId === content.id,\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (turnAbortedOrErrored && !hasRealResult) {\n\t\t\t\t\t\t\tlet errorMessage: string;\n\t\t\t\t\t\t\tif (message.stopReason === \"aborted\") {\n\t\t\t\t\t\t\t\tconst retryAttempt = host.session.retryAttempt;\n\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\tretryAttempt > 0\n\t\t\t\t\t\t\t\t\t\t? `Aborted after ${retryAttempt} retry attempt${retryAttempt > 1 ? \"s\" : \"\"}`\n\t\t\t\t\t\t\t\t\t\t: \"Operation aborted\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\terrorMessage = message.errorMessage || \"Error\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcomponent.updateResult({ content: [{ type: \"text\", text: errorMessage }], isError: true });\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thost.pendingTools.set(content.id, component);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst serverTool = asServerToolUse(content);\n\t\t\t\t\t\tif (serverTool) {\n\t\t\t\t\t\t// Server-side tool (e.g., native web search)\n\t\t\t\t\t\tconst component = new ToolExecutionComponent(\n\t\t\t\t\t\t\tserverTool.name,\n\t\t\t\t\t\t\tserverTool.input ?? {},\n\t\t\t\t\t\t\t{ showImages: host.settingsManager.getShowImages() },\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\thost.ui,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcomponent.setExpanded(host.toolOutputExpanded);\n\t\t\t\t\t\thost.chatContainer.addChild(component);\n\t\t\t\t\t\t// Find matching webSearchResult in host message's content\n\t\t\t\t\t\tconst resultBlock = message.content\n\t\t\t\t\t\t\t.map(asWebSearchResult)\n\t\t\t\t\t\t\t.find((block) => block && block.toolUseId === serverTool.id);\n\t\t\t\t\t\tif (resultBlock) {\n\t\t\t\t\t\t\tconst searchContent = resultBlock.content;\n\t\t\t\t\t\t\tconst isError = searchContent && typeof searchContent === \"object\" && \"type\" in (searchContent as any) && (searchContent as any).type === \"web_search_tool_result_error\";\n\t\t\t\t\t\t\tconst resultText = host.formatWebSearchResult(searchContent);\n\t\t\t\t\t\t\tcomponent.updateResult({\n\t\t\t\t\t\t\t\tcontent: [{ type: \"text\", text: resultText }],\n\t\t\t\t\t\t\t\tisError: !!isError,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No result yet (aborted stream?) — show as pending\n\t\t\t\t\t\t\thost.pendingTools.set(serverTool.id, component);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Match streaming-mode behavior: show metadata once on the final\n\t\t\t\t// assistant prose segment for host message.\n\t\t\t\tconst lastAssistantSegment = assistantSegments[assistantSegments.length - 1];\n\t\t\t\tlastAssistantSegment?.setShowMetadata(true);\n\t\t\t} else if (message.role === \"toolResult\") {\n\t\t\t\t// Match tool results to pending tool components\n\t\t\t\tconst component = host.pendingTools.get(message.toolCallId);\n\t\t\t\tif (component) {\n\t\t\t\t\tcomponent.updateResult(message);\n\t\t\t\t\thost.pendingTools.delete(message.toolCallId);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// All other messages use standard rendering\n\t\t\t\taddMessageToChat(host, message, options);\n\t\t\t}\n\t\t}\n\n\t\t// Any pendingTools entries left over after replay are historical tool\n\t\t// calls whose results were squashed out of session context (commonly by\n\t\t// compaction). Mark them finished so the frame stops showing \"Running\".\n\t\tfor (const component of host.pendingTools.values()) {\n\t\t\tcomponent.markHistoricalNoResult();\n\t\t}\n\t\thost.pendingTools.clear();\n\t\ttrimChatHistory(host);\n\t\treconcileChatTurnConnections(host.chatContainer.children);\n\t\thost.ui.requestRender();\n\t}\n\nexport function renderInitialMessages(host: InteractiveModeDelegateHost): void {\n\t\tconst context = host.sessionManager.buildSessionContext();\n\t\trenderSessionContext(host, context, {\n\t\t\tupdateFooter: true,\n\t\t\tpopulateHistory: true,\n\t\t});\n\t\tpopulatePinnedFromMessages(host, context.messages);\n\n\t\tconst allEntries = host.sessionManager.getEntries();\n\t\tconst compactionCount = allEntries.filter((e: { type: string }) => e.type === \"compaction\").length;\n\t\tif (compactionCount > 0) {\n\t\t\tconst times = compactionCount === 1 ? \"1 time\" : `${compactionCount} times`;\n\t\t\tshowStatus(host, `Session compacted ${times}`);\n\t\t}\n\t}\n\nexport async function getUserInput(host: InteractiveModeDelegateHost): Promise<string> {\n\t\treturn new Promise((resolve) => {\n\t\t\thost.onInputCallback = (text: string) => {\n\t\t\t\thost.onInputCallback = undefined;\n\t\t\t\tresolve(text);\n\t\t\t};\n\t\t});\n\t}\n\nexport function rebuildChatFromMessages(host: InteractiveModeDelegateHost): void {\n\t\thost.chatContainer.clear();\n\t\thost.pinnedMessageContainer.clear();\n\t\tconst context = host.sessionManager.buildSessionContext();\n\t\trenderSessionContext(host, context);\n\t\t// Pinned content NOT re-populated here — the streaming lifecycle in\n\t\t// chat-controller.ts manages the pinned zone during active work.\n\t\t// populatePinnedFromMessages() remains in renderInitialMessages()\n\t\t// for the session-resume case at startup.\n\t}\n\n\t/**\n\t * After rebuilding chat from messages, pin the last assistant text above the\n\t * editor if tool results would otherwise push it out of the viewport.\n\t */\nexport function populatePinnedFromMessages(host: InteractiveModeDelegateHost, messages: AgentMessage[]): void {\n\t\thost.pinnedMessageContainer.clear();\n\n\t\t// Walk backwards to find the last assistant message\n\t\tlet lastAssistant: AssistantMessage | undefined;\n\t\tfor (let i = messages.length - 1; i >= 0; i--) {\n\t\t\tconst msg = messages[i];\n\t\t\tif (msg && \"role\" in msg && msg.role === \"assistant\") {\n\t\t\t\tlastAssistant = msg as AssistantMessage;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!lastAssistant) return;\n\n\t\t// Check if any tool calls follow the last text block\n\t\tconst content = lastAssistant.content;\n\t\tlet lastTextIndex = -1;\n\t\tlet hasToolAfterText = false;\n\t\tfor (let i = 0; i < content.length; i++) {\n\t\t\tif (content[i].type === \"text\") lastTextIndex = i;\n\t\t}\n\t\tif (lastTextIndex >= 0) {\n\t\t\tfor (let i = lastTextIndex + 1; i < content.length; i++) {\n\t\t\t\tif (isToolContentBlock(content[i])) {\n\t\t\t\t\thasToolAfterText = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!hasToolAfterText || lastTextIndex < 0) return;\n\n\t\tconst textBlock = content[lastTextIndex] as { type: \"text\"; text: string };\n\t\tconst text = textBlock.text?.trim();\n\t\tif (!text) return;\n\n\t\thost.pinnedMessageContainer.addChild(\n\t\t\tnew DynamicBorder((str: string) => theme.fg(\"dim\", str), \"Latest Output\"),\n\t\t);\n\t\thost.pinnedMessageContainer.addChild(\n\t\t\tnew Markdown(text, 1, 0, host.getMarkdownThemeWithSettings()),\n\t\t);\n\t}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-selectors-auth.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-selectors-auth.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,oBAAoB,EAA0B,MAAM,gCAAgC,CAAC;AACnG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AA6CvF,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG;IACjF,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAOA;AAMD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,2BAA2B,GAAG,oBAAoB,EAAE,CAsCnG;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,2BAA2B,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAkElH;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBvH;AAoED,wBAAsB,eAAe,CAAC,IAAI,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsF1G"}
1
+ {"version":3,"file":"interactive-selectors-auth.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-selectors-auth.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,oBAAoB,EAA0B,MAAM,gCAAgC,CAAC;AACnG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AA6CvF,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG;IACjF,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAOA;AAMD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,2BAA2B,GAAG,oBAAoB,EAAE,CA2CnG;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,2BAA2B,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAkElH;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBvH;AAoED,wBAAsB,eAAe,CAAC,IAAI,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsF1G"}
@@ -66,10 +66,10 @@ function getApiKeyProviderDisplayName(host, providerId) {
66
66
  }
67
67
  export function buildLoginProviderOptions(host) {
68
68
  const modelRegistry = host.session.modelRegistry;
69
- const oauthProviders = modelRegistry.authStorage
70
- .getOAuthProviders()
71
- .filter((provider) => isBrowserOAuthProviderAllowed(provider.id));
69
+ const allOAuthProviders = modelRegistry.authStorage.getOAuthProviders();
70
+ const oauthProviders = allOAuthProviders.filter((provider) => isBrowserOAuthProviderAllowed(provider.id));
72
71
  const oauthProviderIds = new Set(oauthProviders.map((provider) => provider.id));
72
+ const apiKeyOnlyOAuthProviderIds = new Set(allOAuthProviders.filter((provider) => !isBrowserOAuthProviderAllowed(provider.id)).map((provider) => provider.id));
73
73
  const modelProviderIds = Array.from(new Set(modelRegistry.getAll().map((model) => model.provider))).sort();
74
74
  const externalCliProviders = modelProviderIds
75
75
  .filter((providerId) => modelRegistry.getProviderAuthMode(providerId) === "externalCli")
@@ -80,7 +80,7 @@ export function buildLoginProviderOptions(host) {
80
80
  statusLabel: modelRegistry.isProviderRequestReady(providerId) ? "✓ ready" : undefined,
81
81
  }));
82
82
  const apiKeyProviders = modelProviderIds
83
- .filter((providerId) => modelRegistry.getProviderAuthMode(providerId) === "apiKey")
83
+ .filter((providerId) => modelRegistry.getProviderAuthMode(providerId) === "apiKey" || apiKeyOnlyOAuthProviderIds.has(providerId))
84
84
  .filter((providerId) => !oauthProviderIds.has(providerId))
85
85
  .map((providerId) => ({
86
86
  id: providerId,
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-selectors-auth.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-selectors-auth.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,6FAA6F;AAC7F,cAAc;AAGd,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAA6B,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAGnG,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAE/D,SAAS,6BAA6B,CAAC,UAAkB;IACxD,OAAO,CAAC,+BAA+B,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,eAAe,CAAC,SAAiC;IACzD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,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AAM,CAAC;YACR,4DAA4D;QAC7D,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,gBAAgB,YAAY,0BAA0B,WAAW,EAAE,EAAE,CAAC,CAAC;IACxF,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACzB,aAAa,EAAE,CAAC;QAChB,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,QAAQ,KAAK,iBAAiB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1G,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["// Project/App: gsd-pi\n// File Purpose: Extracted from interactive-selectors-session.ts (Phase E2 seam remediation).\n// @ts-nocheck\n\nimport type { OAuthProviderId } from \"@gsd/pi-ai\";\nimport { getApiKeyEnvVars } from \"@gsd/pi-ai\";\nimport { getAuthPath } from \"@gsd/pi-coding-agent/config.js\";\nimport { BUILT_IN_PROVIDER_DISPLAY_NAMES } from \"@gsd/pi-coding-agent/core/provider-display-names.js\";\nimport { LoginDialogComponent } from \"./components/login-dialog.js\";\nimport { type AuthSelectorProvider, OAuthSelectorComponent } from \"./components/oauth-selector.js\";\nimport type { InteractiveModeDelegateHost } from \"./interactive-mode-delegate-host.js\";\n\nconst BLOCKED_BROWSER_OAUTH_PROVIDERS = new Set([\"anthropic\"]);\n\nfunction isBrowserOAuthProviderAllowed(providerId: string): boolean {\n\treturn !BLOCKED_BROWSER_OAUTH_PROVIDERS.has(providerId);\n}\n\nfunction uniqueProviders(providers: AuthSelectorProvider[]): AuthSelectorProvider[] {\n\tconst seen = new Set<string>();\n\tconst unique: AuthSelectorProvider[] = [];\n\tfor (const provider of providers) {\n\t\tif (seen.has(provider.id)) continue;\n\t\tseen.add(provider.id);\n\t\tunique.push(provider);\n\t}\n\treturn unique;\n}\n\nfunction formatAuthStatus(status: { source?: string; label?: string } | undefined): string | undefined {\n\tif (!status?.source) return undefined;\n\tif (status.source === \"stored\") return \"✓ configured\";\n\tif (status.source === \"environment\" && status.label) return `✓ env: ${status.label}`;\n\tif (status.source === \"runtime\" && status.label) return `✓ ${status.label}`;\n\tif (status.source === \"models_json_command\") return \"✓ command in models.json\";\n\tif (status.source === \"models_json_key\") return \"✓ key in models.json\";\n\tif (status.source === \"fallback\") return \"✓ configured\";\n\treturn undefined;\n}\n\nfunction formatEnvHint(envVars: readonly string[] | undefined): string {\n\tif (!envVars || envVars.length === 0) return \"\";\n\treturn ` (or set ${envVars.join(\" / \")})`;\n}\n\nfunction apiKeyCredentialLabel(providerId: string): string {\n\tif (providerId === \"huggingface\") return \"user access token\";\n\treturn \"API key\";\n}\n\nfunction apiKeyPlaceholder(providerId: string): string | undefined {\n\tif (providerId === \"huggingface\") return \"hf_...\";\n\treturn undefined;\n}\n\nexport function buildApiKeyLoginPrompt(providerId: string, providerName: string): {\n\tmessage: string;\n\tplaceholder?: string;\n} {\n\tconst credentialLabel = apiKeyCredentialLabel(providerId);\n\tconst envHint = formatEnvHint(getApiKeyEnvVars(providerId));\n\treturn {\n\t\tmessage: `Paste your ${providerName} ${credentialLabel}${envHint}:`,\n\t\tplaceholder: apiKeyPlaceholder(providerId),\n\t};\n}\n\nfunction getApiKeyProviderDisplayName(host: InteractiveModeDelegateHost, providerId: string): string {\n\treturn BUILT_IN_PROVIDER_DISPLAY_NAMES[providerId] ?? host.session.modelRegistry.getProviderDisplayName(providerId);\n}\n\nexport function buildLoginProviderOptions(host: InteractiveModeDelegateHost): AuthSelectorProvider[] {\n\tconst modelRegistry = host.session.modelRegistry;\n\tconst oauthProviders = modelRegistry.authStorage\n\t\t.getOAuthProviders()\n\t\t.filter((provider) => isBrowserOAuthProviderAllowed(provider.id));\n\tconst oauthProviderIds = new Set(oauthProviders.map((provider) => provider.id));\n\tconst modelProviderIds = Array.from(new Set(modelRegistry.getAll().map((model) => model.provider))).sort();\n\n\tconst externalCliProviders = modelProviderIds\n\t\t.filter((providerId) => modelRegistry.getProviderAuthMode(providerId) === \"externalCli\")\n\t\t.map((providerId) => ({\n\t\t\tid: providerId,\n\t\t\tname: modelRegistry.getProviderDisplayName(providerId),\n\t\t\tauthType: \"external_cli\" as const,\n\t\t\tstatusLabel: modelRegistry.isProviderRequestReady(providerId) ? \"✓ ready\" : undefined,\n\t\t}));\n\n\tconst apiKeyProviders = modelProviderIds\n\t\t.filter((providerId) => modelRegistry.getProviderAuthMode(providerId) === \"apiKey\")\n\t\t.filter((providerId) => !oauthProviderIds.has(providerId))\n\t\t.map((providerId) => ({\n\t\t\tid: providerId,\n\t\t\tname: getApiKeyProviderDisplayName(host, providerId),\n\t\t\tauthType: \"api_key\" as const,\n\t\t\tstatusLabel: formatAuthStatus(modelRegistry.getProviderAuthStatus(providerId)),\n\t\t}));\n\n\tconst browserOAuthProviders = oauthProviders.map((provider) => ({\n\t\t...provider,\n\t\tauthType: \"oauth\" as const,\n\t\tstatusLabel: formatAuthStatus(modelRegistry.getProviderAuthStatus(provider.id)),\n\t}));\n\n\treturn uniqueProviders([\n\t\t...externalCliProviders,\n\t\t...apiKeyProviders,\n\t\t...browserOAuthProviders,\n\t]);\n}\n\nexport async function showOAuthSelector(host: InteractiveModeDelegateHost, mode: \"login\" | \"logout\"): Promise<void> {\n\tconst loginProviders = mode === \"login\" ? buildLoginProviderOptions(host) : undefined;\n\n\tif (mode === \"logout\") {\n\t\tconst providers = host.session.modelRegistry.authStorage.list();\n\t\tconst loggedInProviders = providers.filter(\n\t\t\t(p) => host.session.modelRegistry.authStorage.get(p)?.type === \"oauth\",\n\t\t);\n\t\tif (loggedInProviders.length === 0) {\n\t\t\thost.showStatus(\"No OAuth providers logged in. Use /login first.\");\n\t\t\treturn;\n\t\t}\n\t}\n\n\thost.showSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\tmode,\n\t\t\thost.session.modelRegistry.authStorage,\n\t\t\t(providerId: string) => {\n\t\t\t\tdone();\n\n\t\t\t\tconst handleAsync = async () => {\n\t\t\t\t\tif (mode === \"login\") {\n\t\t\t\t\t\tawait handleLoginProviderSelection(host, providerId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst providerInfo = host.session.modelRegistry.authStorage\n\t\t\t\t\t\t\t.getOAuthProviders()\n\t\t\t\t\t\t\t.find((p) => p.id === providerId);\n\t\t\t\t\t\tconst providerName = providerInfo?.name || providerId;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\thost.session.modelRegistry.authStorage.logout(providerId);\n\t\t\t\t\t\t\thost.session.modelRegistry.refresh();\n\t\t\t\t\t\t\tawait host.updateAvailableProviderCount();\n\n\t\t\t\t\t\t\tconst currentModel = host.session.model;\n\t\t\t\t\t\t\tif (currentModel?.provider === providerId) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst available = host.session.modelRegistry.getAvailable();\n\t\t\t\t\t\t\t\t\tconst fallback = available.find((m) => m.provider !== providerId);\n\t\t\t\t\t\t\t\t\tif (fallback) {\n\t\t\t\t\t\t\t\t\t\tawait host.session.setModel(fallback);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t// Model switch failed — user can manually switch via /model\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\thost.showStatus(`Logged out of ${providerName}`);\n\t\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\t\thost.showError(`Logout failed: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\thandleAsync().catch(() => {\n\t\t\t\t\t// Swallow — showLoginDialog already handles its own errors.\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\thost.ui.requestRender();\n\t\t\t},\n\t\t\tloginProviders,\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nexport async function handleLoginProviderSelection(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tconst modelRegistry = host.session.modelRegistry;\n\tconst authMode = modelRegistry.getProviderAuthMode(providerId);\n\n\tif (authMode === \"externalCli\") {\n\t\tawait activateExternalCliProvider(host, providerId);\n\t\treturn;\n\t}\n\n\tconst oauthProvider = modelRegistry.authStorage.getOAuthProviders().find((provider) => provider.id === providerId);\n\tif (oauthProvider && isBrowserOAuthProviderAllowed(providerId)) {\n\t\tawait host.showLoginDialog(providerId);\n\t\treturn;\n\t}\n\n\tawait showApiKeyLoginDialog(host, providerId);\n}\n\nasync function activateExternalCliProvider(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tconst modelRegistry = host.session.modelRegistry;\n\tconst providerName = modelRegistry.getProviderDisplayName(providerId);\n\n\tif (!modelRegistry.isProviderRequestReady(providerId)) {\n\t\thost.showError(`${providerName} is not ready. Run the provider's own login command, then try /login again.`);\n\t\treturn;\n\t}\n\n\tmodelRegistry.authStorage.set(providerId, { type: \"api_key\", key: \"cli\" });\n\tmodelRegistry.refresh();\n\tawait host.updateAvailableProviderCount();\n\n\tconst targetModel = modelRegistry.getAvailable().find((model) => model.provider === providerId);\n\tif (targetModel) {\n\t\tawait host.session.setModel(targetModel);\n\t\thost.showStatus(`Using ${providerName}: ${providerId}/${targetModel.id}`);\n\t} else {\n\t\thost.showStatus(`${providerName} is ready. Use /model to choose a model.`);\n\t}\n}\n\nasync function showApiKeyLoginDialog(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tconst providerName = host.session.modelRegistry.getProviderDisplayName(providerId);\n\tconst dialog = new LoginDialogComponent(host.ui, providerId, (_success, _message) => {}, providerName);\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tdialog.dispose();\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tconst prompt = buildApiKeyLoginPrompt(providerId, providerName);\n\t\tconst apiKey = (await dialog.showPrompt(prompt.message, prompt.placeholder)).trim();\n\t\tif (!apiKey) {\n\t\t\tthrow new Error(\"API key is required\");\n\t\t}\n\n\t\thost.session.modelRegistry.authStorage.set(providerId, { type: \"api_key\", key: apiKey });\n\t\trestoreEditor();\n\t\thost.session.modelRegistry.refresh();\n\t\tawait host.updateAvailableProviderCount();\n\n\t\tconst targetModel = host.session.modelRegistry.getAvailable().find((model) => model.provider === providerId);\n\t\tif (targetModel) {\n\t\t\tawait host.session.setModel(targetModel);\n\t\t}\n\n\t\thost.showStatus(`Saved ${providerName} API key to ${getAuthPath()}`);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (errorMsg !== \"Login cancelled\" && !errorMsg.includes(\"Superseded\") && !errorMsg.includes(\"disposed\")) {\n\t\t\thost.showError(`Failed to save ${providerName} API key: ${errorMsg}`);\n\t\t}\n\t}\n}\n\nexport async function showLoginDialog(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tif (!isBrowserOAuthProviderAllowed(providerId)) {\n\t\tawait showApiKeyLoginDialog(host, providerId);\n\t\treturn;\n\t}\n\n\tconst providerInfo = host.session.modelRegistry.authStorage.getOAuthProviders().find((p) => p.id === providerId);\n\tconst providerName = providerInfo?.name || providerId;\n\tconst usesCallbackServer = providerInfo?.usesCallbackServer ?? false;\n\n\tconst dialog = new LoginDialogComponent(host.ui, providerId, (_success, _message) => {});\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tdialog.dispose();\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait host.session.modelRegistry.authStorage.login(providerId as OAuthProviderId, {\n\t\t\tonAuth: (info: { url: string; instructions?: string }) => {\n\t\t\t\tdialog.showAuth(info.url, info.instructions);\n\n\t\t\t\tif (!usesCallbackServer && providerId === \"github-copilot\") {\n\t\t\t\t\tdialog.showWaiting(\"Waiting for browser authentication...\");\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonPrompt: async (prompt: { message: string; placeholder?: string; allowEmpty?: boolean }) => {\n\t\t\t\treturn dialog.showPrompt(prompt.message, prompt.placeholder, { allowEmpty: prompt.allowEmpty });\n\t\t\t},\n\n\t\t\tonProgress: (message: string) => {\n\t\t\t\tdialog.showProgress(message);\n\t\t\t},\n\n\t\t\tonManualCodeInput: usesCallbackServer\n\t\t\t\t? () => dialog.showManualInput(\"Paste redirect URL below, or complete login in browser:\")\n\t\t\t\t: undefined,\n\n\t\t\tonDeviceCode: (info) => {\n\t\t\t\tdialog.showDeviceCode(info);\n\t\t\t\tdialog.showWaiting(\"Waiting for browser authentication...\");\n\t\t\t},\n\t\t\tonSelect: async (prompt) => prompt.options[0]?.id,\n\n\t\t\tsignal: dialog.signal,\n\t\t});\n\n\t\trestoreEditor();\n\t\thost.session.modelRegistry.refresh();\n\t\tawait host.updateAvailableProviderCount();\n\n\t\ttry {\n\t\t\tconst currentModel = host.session.model;\n\t\t\tif (currentModel) {\n\t\t\t\tconst currentKey = await host.session.modelRegistry.getApiKey(currentModel);\n\t\t\t\tif (!currentKey) {\n\t\t\t\t\tconst available = host.session.modelRegistry.getAvailable();\n\t\t\t\t\tconst newProviderModel = available.find((m) => m.provider === providerId);\n\t\t\t\t\tif (newProviderModel) {\n\t\t\t\t\t\tawait host.session.setModel(newProviderModel);\n\t\t\t\t\t} else if (available.length > 0) {\n\t\t\t\t\t\tawait host.session.setModel(available[0]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Model switch failed — user can manually switch via /model\n\t\t}\n\n\t\thost.showStatus(`Logged in to ${providerName}. Credentials saved to ${getAuthPath()}`);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (errorMsg !== \"Login cancelled\" && !errorMsg.includes(\"Superseded\") && !errorMsg.includes(\"disposed\")) {\n\t\t\thost.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"interactive-selectors-auth.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-selectors-auth.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,6FAA6F;AAC7F,cAAc;AAGd,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAA6B,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAGnG,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAE/D,SAAS,6BAA6B,CAAC,UAAkB;IACxD,OAAO,CAAC,+BAA+B,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,eAAe,CAAC,SAAiC;IACzD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;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AAC;oBAC/C,CAAC;yBAAM,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACjC,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC3C,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QAAC,MAAM,CAAC;YACR,4DAA4D;QAC7D,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,gBAAgB,YAAY,0BAA0B,WAAW,EAAE,EAAE,CAAC,CAAC;IACxF,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACzB,aAAa,EAAE,CAAC;QAChB,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,QAAQ,KAAK,iBAAiB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1G,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["// Project/App: gsd-pi\n// File Purpose: Extracted from interactive-selectors-session.ts (Phase E2 seam remediation).\n// @ts-nocheck\n\nimport type { OAuthProviderId } from \"@gsd/pi-ai\";\nimport { getApiKeyEnvVars } from \"@gsd/pi-ai\";\nimport { getAuthPath } from \"@gsd/pi-coding-agent/config.js\";\nimport { BUILT_IN_PROVIDER_DISPLAY_NAMES } from \"@gsd/pi-coding-agent/core/provider-display-names.js\";\nimport { LoginDialogComponent } from \"./components/login-dialog.js\";\nimport { type AuthSelectorProvider, OAuthSelectorComponent } from \"./components/oauth-selector.js\";\nimport type { InteractiveModeDelegateHost } from \"./interactive-mode-delegate-host.js\";\n\nconst BLOCKED_BROWSER_OAUTH_PROVIDERS = new Set([\"anthropic\"]);\n\nfunction isBrowserOAuthProviderAllowed(providerId: string): boolean {\n\treturn !BLOCKED_BROWSER_OAUTH_PROVIDERS.has(providerId);\n}\n\nfunction uniqueProviders(providers: AuthSelectorProvider[]): AuthSelectorProvider[] {\n\tconst seen = new Set<string>();\n\tconst unique: AuthSelectorProvider[] = [];\n\tfor (const provider of providers) {\n\t\tif (seen.has(provider.id)) continue;\n\t\tseen.add(provider.id);\n\t\tunique.push(provider);\n\t}\n\treturn unique;\n}\n\nfunction formatAuthStatus(status: { source?: string; label?: string } | undefined): string | undefined {\n\tif (!status?.source) return undefined;\n\tif (status.source === \"stored\") return \"✓ configured\";\n\tif (status.source === \"environment\" && status.label) return `✓ env: ${status.label}`;\n\tif (status.source === \"runtime\" && status.label) return `✓ ${status.label}`;\n\tif (status.source === \"models_json_command\") return \"✓ command in models.json\";\n\tif (status.source === \"models_json_key\") return \"✓ key in models.json\";\n\tif (status.source === \"fallback\") return \"✓ configured\";\n\treturn undefined;\n}\n\nfunction formatEnvHint(envVars: readonly string[] | undefined): string {\n\tif (!envVars || envVars.length === 0) return \"\";\n\treturn ` (or set ${envVars.join(\" / \")})`;\n}\n\nfunction apiKeyCredentialLabel(providerId: string): string {\n\tif (providerId === \"huggingface\") return \"user access token\";\n\treturn \"API key\";\n}\n\nfunction apiKeyPlaceholder(providerId: string): string | undefined {\n\tif (providerId === \"huggingface\") return \"hf_...\";\n\treturn undefined;\n}\n\nexport function buildApiKeyLoginPrompt(providerId: string, providerName: string): {\n\tmessage: string;\n\tplaceholder?: string;\n} {\n\tconst credentialLabel = apiKeyCredentialLabel(providerId);\n\tconst envHint = formatEnvHint(getApiKeyEnvVars(providerId));\n\treturn {\n\t\tmessage: `Paste your ${providerName} ${credentialLabel}${envHint}:`,\n\t\tplaceholder: apiKeyPlaceholder(providerId),\n\t};\n}\n\nfunction getApiKeyProviderDisplayName(host: InteractiveModeDelegateHost, providerId: string): string {\n\treturn BUILT_IN_PROVIDER_DISPLAY_NAMES[providerId] ?? host.session.modelRegistry.getProviderDisplayName(providerId);\n}\n\nexport function buildLoginProviderOptions(host: InteractiveModeDelegateHost): AuthSelectorProvider[] {\n\tconst modelRegistry = host.session.modelRegistry;\n\tconst allOAuthProviders = modelRegistry.authStorage.getOAuthProviders();\n\tconst oauthProviders = allOAuthProviders.filter((provider) => isBrowserOAuthProviderAllowed(provider.id));\n\tconst oauthProviderIds = new Set(oauthProviders.map((provider) => provider.id));\n\tconst apiKeyOnlyOAuthProviderIds = new Set(\n\t\tallOAuthProviders.filter((provider) => !isBrowserOAuthProviderAllowed(provider.id)).map((provider) => provider.id),\n\t);\n\tconst modelProviderIds = Array.from(new Set(modelRegistry.getAll().map((model) => model.provider))).sort();\n\n\tconst externalCliProviders = modelProviderIds\n\t\t.filter((providerId) => modelRegistry.getProviderAuthMode(providerId) === \"externalCli\")\n\t\t.map((providerId) => ({\n\t\t\tid: providerId,\n\t\t\tname: modelRegistry.getProviderDisplayName(providerId),\n\t\t\tauthType: \"external_cli\" as const,\n\t\t\tstatusLabel: modelRegistry.isProviderRequestReady(providerId) ? \"✓ ready\" : undefined,\n\t\t}));\n\n\tconst apiKeyProviders = modelProviderIds\n\t\t.filter(\n\t\t\t(providerId) =>\n\t\t\t\tmodelRegistry.getProviderAuthMode(providerId) === \"apiKey\" || apiKeyOnlyOAuthProviderIds.has(providerId),\n\t\t)\n\t\t.filter((providerId) => !oauthProviderIds.has(providerId))\n\t\t.map((providerId) => ({\n\t\t\tid: providerId,\n\t\t\tname: getApiKeyProviderDisplayName(host, providerId),\n\t\t\tauthType: \"api_key\" as const,\n\t\t\tstatusLabel: formatAuthStatus(modelRegistry.getProviderAuthStatus(providerId)),\n\t\t}));\n\n\tconst browserOAuthProviders = oauthProviders.map((provider) => ({\n\t\t...provider,\n\t\tauthType: \"oauth\" as const,\n\t\tstatusLabel: formatAuthStatus(modelRegistry.getProviderAuthStatus(provider.id)),\n\t}));\n\n\treturn uniqueProviders([\n\t\t...externalCliProviders,\n\t\t...apiKeyProviders,\n\t\t...browserOAuthProviders,\n\t]);\n}\n\nexport async function showOAuthSelector(host: InteractiveModeDelegateHost, mode: \"login\" | \"logout\"): Promise<void> {\n\tconst loginProviders = mode === \"login\" ? buildLoginProviderOptions(host) : undefined;\n\n\tif (mode === \"logout\") {\n\t\tconst providers = host.session.modelRegistry.authStorage.list();\n\t\tconst loggedInProviders = providers.filter(\n\t\t\t(p) => host.session.modelRegistry.authStorage.get(p)?.type === \"oauth\",\n\t\t);\n\t\tif (loggedInProviders.length === 0) {\n\t\t\thost.showStatus(\"No OAuth providers logged in. Use /login first.\");\n\t\t\treturn;\n\t\t}\n\t}\n\n\thost.showSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\tmode,\n\t\t\thost.session.modelRegistry.authStorage,\n\t\t\t(providerId: string) => {\n\t\t\t\tdone();\n\n\t\t\t\tconst handleAsync = async () => {\n\t\t\t\t\tif (mode === \"login\") {\n\t\t\t\t\t\tawait handleLoginProviderSelection(host, providerId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst providerInfo = host.session.modelRegistry.authStorage\n\t\t\t\t\t\t\t.getOAuthProviders()\n\t\t\t\t\t\t\t.find((p) => p.id === providerId);\n\t\t\t\t\t\tconst providerName = providerInfo?.name || providerId;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\thost.session.modelRegistry.authStorage.logout(providerId);\n\t\t\t\t\t\t\thost.session.modelRegistry.refresh();\n\t\t\t\t\t\t\tawait host.updateAvailableProviderCount();\n\n\t\t\t\t\t\t\tconst currentModel = host.session.model;\n\t\t\t\t\t\t\tif (currentModel?.provider === providerId) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst available = host.session.modelRegistry.getAvailable();\n\t\t\t\t\t\t\t\t\tconst fallback = available.find((m) => m.provider !== providerId);\n\t\t\t\t\t\t\t\t\tif (fallback) {\n\t\t\t\t\t\t\t\t\t\tawait host.session.setModel(fallback);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t// Model switch failed — user can manually switch via /model\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\thost.showStatus(`Logged out of ${providerName}`);\n\t\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\t\thost.showError(`Logout failed: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\thandleAsync().catch(() => {\n\t\t\t\t\t// Swallow — showLoginDialog already handles its own errors.\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\thost.ui.requestRender();\n\t\t\t},\n\t\t\tloginProviders,\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nexport async function handleLoginProviderSelection(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tconst modelRegistry = host.session.modelRegistry;\n\tconst authMode = modelRegistry.getProviderAuthMode(providerId);\n\n\tif (authMode === \"externalCli\") {\n\t\tawait activateExternalCliProvider(host, providerId);\n\t\treturn;\n\t}\n\n\tconst oauthProvider = modelRegistry.authStorage.getOAuthProviders().find((provider) => provider.id === providerId);\n\tif (oauthProvider && isBrowserOAuthProviderAllowed(providerId)) {\n\t\tawait host.showLoginDialog(providerId);\n\t\treturn;\n\t}\n\n\tawait showApiKeyLoginDialog(host, providerId);\n}\n\nasync function activateExternalCliProvider(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tconst modelRegistry = host.session.modelRegistry;\n\tconst providerName = modelRegistry.getProviderDisplayName(providerId);\n\n\tif (!modelRegistry.isProviderRequestReady(providerId)) {\n\t\thost.showError(`${providerName} is not ready. Run the provider's own login command, then try /login again.`);\n\t\treturn;\n\t}\n\n\tmodelRegistry.authStorage.set(providerId, { type: \"api_key\", key: \"cli\" });\n\tmodelRegistry.refresh();\n\tawait host.updateAvailableProviderCount();\n\n\tconst targetModel = modelRegistry.getAvailable().find((model) => model.provider === providerId);\n\tif (targetModel) {\n\t\tawait host.session.setModel(targetModel);\n\t\thost.showStatus(`Using ${providerName}: ${providerId}/${targetModel.id}`);\n\t} else {\n\t\thost.showStatus(`${providerName} is ready. Use /model to choose a model.`);\n\t}\n}\n\nasync function showApiKeyLoginDialog(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tconst providerName = host.session.modelRegistry.getProviderDisplayName(providerId);\n\tconst dialog = new LoginDialogComponent(host.ui, providerId, (_success, _message) => {}, providerName);\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tdialog.dispose();\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tconst prompt = buildApiKeyLoginPrompt(providerId, providerName);\n\t\tconst apiKey = (await dialog.showPrompt(prompt.message, prompt.placeholder)).trim();\n\t\tif (!apiKey) {\n\t\t\tthrow new Error(\"API key is required\");\n\t\t}\n\n\t\thost.session.modelRegistry.authStorage.set(providerId, { type: \"api_key\", key: apiKey });\n\t\trestoreEditor();\n\t\thost.session.modelRegistry.refresh();\n\t\tawait host.updateAvailableProviderCount();\n\n\t\tconst targetModel = host.session.modelRegistry.getAvailable().find((model) => model.provider === providerId);\n\t\tif (targetModel) {\n\t\t\tawait host.session.setModel(targetModel);\n\t\t}\n\n\t\thost.showStatus(`Saved ${providerName} API key to ${getAuthPath()}`);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (errorMsg !== \"Login cancelled\" && !errorMsg.includes(\"Superseded\") && !errorMsg.includes(\"disposed\")) {\n\t\t\thost.showError(`Failed to save ${providerName} API key: ${errorMsg}`);\n\t\t}\n\t}\n}\n\nexport async function showLoginDialog(host: InteractiveModeDelegateHost, providerId: string): Promise<void> {\n\tif (!isBrowserOAuthProviderAllowed(providerId)) {\n\t\tawait showApiKeyLoginDialog(host, providerId);\n\t\treturn;\n\t}\n\n\tconst providerInfo = host.session.modelRegistry.authStorage.getOAuthProviders().find((p) => p.id === providerId);\n\tconst providerName = providerInfo?.name || providerId;\n\tconst usesCallbackServer = providerInfo?.usesCallbackServer ?? false;\n\n\tconst dialog = new LoginDialogComponent(host.ui, providerId, (_success, _message) => {});\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tdialog.dispose();\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait host.session.modelRegistry.authStorage.login(providerId as OAuthProviderId, {\n\t\t\tonAuth: (info: { url: string; instructions?: string }) => {\n\t\t\t\tdialog.showAuth(info.url, info.instructions);\n\n\t\t\t\tif (!usesCallbackServer && providerId === \"github-copilot\") {\n\t\t\t\t\tdialog.showWaiting(\"Waiting for browser authentication...\");\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonPrompt: async (prompt: { message: string; placeholder?: string; allowEmpty?: boolean }) => {\n\t\t\t\treturn dialog.showPrompt(prompt.message, prompt.placeholder, { allowEmpty: prompt.allowEmpty });\n\t\t\t},\n\n\t\t\tonProgress: (message: string) => {\n\t\t\t\tdialog.showProgress(message);\n\t\t\t},\n\n\t\t\tonManualCodeInput: usesCallbackServer\n\t\t\t\t? () => dialog.showManualInput(\"Paste redirect URL below, or complete login in browser:\")\n\t\t\t\t: undefined,\n\n\t\t\tonDeviceCode: (info) => {\n\t\t\t\tdialog.showDeviceCode(info);\n\t\t\t\tdialog.showWaiting(\"Waiting for browser authentication...\");\n\t\t\t},\n\t\t\tonSelect: async (prompt) => prompt.options[0]?.id,\n\n\t\t\tsignal: dialog.signal,\n\t\t});\n\n\t\trestoreEditor();\n\t\thost.session.modelRegistry.refresh();\n\t\tawait host.updateAvailableProviderCount();\n\n\t\ttry {\n\t\t\tconst currentModel = host.session.model;\n\t\t\tif (currentModel) {\n\t\t\t\tconst currentKey = await host.session.modelRegistry.getApiKey(currentModel);\n\t\t\t\tif (!currentKey) {\n\t\t\t\t\tconst available = host.session.modelRegistry.getAvailable();\n\t\t\t\t\tconst newProviderModel = available.find((m) => m.provider === providerId);\n\t\t\t\t\tif (newProviderModel) {\n\t\t\t\t\t\tawait host.session.setModel(newProviderModel);\n\t\t\t\t\t} else if (available.length > 0) {\n\t\t\t\t\t\tawait host.session.setModel(available[0]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Model switch failed — user can manually switch via /model\n\t\t}\n\n\t\thost.showStatus(`Logged in to ${providerName}. Credentials saved to ${getAuthPath()}`);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (errorMsg !== \"Login cancelled\" && !errorMsg.includes(\"Superseded\") && !errorMsg.includes(\"disposed\")) {\n\t\t\thost.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-mode.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAsBpD,YAAY,EACX,UAAU,EACV,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,UAAU,GACV,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CA+0BtE"}
1
+ {"version":3,"file":"rpc-mode.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAsBpD,YAAY,EACX,UAAU,EACV,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,UAAU,GACV,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAi1BtE"}
@@ -551,7 +551,9 @@ export async function runRpcMode(session) {
551
551
  // Bash
552
552
  // =================================================================
553
553
  case "bash": {
554
- const result = await session.executeBash(command.command);
554
+ const result = await session.executeBash(command.command, undefined, {
555
+ excludeFromContext: command.excludeFromContext,
556
+ });
555
557
  return success(id, "bash", result);
556
558
  }
557
559
  case "abort_bash": {