gsd-pi 2.77.0-dev.538325aea → 2.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (709) hide show
  1. package/README.md +35 -17
  2. package/dist/cli.js +21 -13
  3. package/dist/extension-registry.js +1 -1
  4. package/dist/headless-ui.d.ts +1 -1
  5. package/dist/headless.js +4 -2
  6. package/dist/loader.js +1 -0
  7. package/dist/onboarding.js +5 -5
  8. package/dist/provider-migrations.d.ts +2 -2
  9. package/dist/provider-migrations.js +1 -2
  10. package/dist/remote-questions-config.js +1 -1
  11. package/dist/resources/extensions/async-jobs/async-bash-tool.js +1 -1
  12. package/dist/resources/extensions/aws-auth/index.js +1 -2
  13. package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.js +9 -6
  14. package/dist/resources/extensions/bg-shell/process-manager.js +1 -2
  15. package/dist/resources/extensions/browser-tools/index.js +1 -0
  16. package/dist/resources/extensions/claude-code-cli/index.js +1 -1
  17. package/dist/resources/extensions/claude-code-cli/partial-builder.js +17 -106
  18. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +10 -17
  19. package/dist/resources/extensions/gsd/auto-dispatch.js +14 -40
  20. package/dist/resources/extensions/gsd/auto-post-unit.js +0 -34
  21. package/dist/resources/extensions/gsd/auto-recovery.js +1 -38
  22. package/dist/resources/extensions/gsd/auto-start.js +2 -16
  23. package/dist/resources/extensions/gsd/dispatch-guard.js +3 -44
  24. package/dist/resources/extensions/gsd/guided-flow.js +1 -1
  25. package/dist/resources/extensions/gsd/prompts/system.md +0 -1
  26. package/dist/resources/extensions/mcp-client/index.js +1 -1
  27. package/dist/resources/extensions/ollama/index.js +2 -1
  28. package/dist/resources/extensions/ollama/ollama-chat-provider.js +15 -5
  29. package/dist/resources/extensions/remote-questions/config.js +1 -12
  30. package/dist/resources/extensions/universal-config/index.js +1 -1
  31. package/dist/security-overrides.d.ts +1 -4
  32. package/dist/security-overrides.js +3 -16
  33. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  34. package/dist/web/standalone/.next/BUILD_ID +1 -1
  35. package/dist/web/standalone/.next/app-path-routes-manifest.json +10 -10
  36. package/dist/web/standalone/.next/build-manifest.json +4 -4
  37. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  38. package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
  39. package/dist/web/standalone/.next/required-server-files.json +3 -3
  40. package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
  41. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  42. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  43. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  44. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  45. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  46. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  47. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  48. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  49. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  50. package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
  51. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  52. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  53. package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
  54. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  55. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  56. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  57. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  58. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  59. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  60. package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
  61. package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
  62. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
  63. package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
  64. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
  65. package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
  66. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
  67. package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
  68. package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
  69. package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
  70. package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
  71. package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
  72. package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
  73. package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
  74. package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
  75. package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
  76. package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
  77. package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
  78. package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
  79. package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
  80. package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
  81. package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
  82. package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
  83. package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  84. package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
  85. package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
  86. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  87. package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  88. package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
  89. package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
  90. package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
  91. package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
  92. package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
  93. package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
  94. package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
  95. package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
  96. package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
  97. package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
  98. package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
  99. package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
  100. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  101. package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
  102. package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
  103. package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
  104. package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
  105. package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  106. package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
  107. package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
  108. package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
  109. package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
  110. package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
  111. package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
  112. package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
  113. package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
  114. package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
  115. package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
  116. package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
  117. package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
  118. package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
  119. package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
  120. package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
  121. package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
  122. package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
  123. package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
  124. package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
  125. package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
  126. package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
  127. package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
  128. package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
  129. package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
  130. package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
  131. package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
  132. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
  133. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
  134. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
  135. package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
  136. package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
  137. package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
  138. package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
  139. package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
  140. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  141. package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  142. package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
  143. package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
  144. package/dist/web/standalone/.next/server/app/index.html +1 -1
  145. package/dist/web/standalone/.next/server/app/index.rsc +4 -4
  146. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  147. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
  148. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  149. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +3 -3
  150. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  151. package/dist/web/standalone/.next/server/app/page.js +2 -2
  152. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  153. package/dist/web/standalone/.next/server/app-paths-manifest.json +10 -10
  154. package/dist/web/standalone/.next/server/chunks/63.js +3 -3
  155. package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
  156. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  157. package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
  158. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  159. package/dist/web/standalone/.next/server/middleware.js +2 -2
  160. package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
  161. package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
  162. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  163. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  164. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  165. package/dist/web/standalone/.next/static/chunks/2826.e59e8578e2e28639.js +9 -0
  166. package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-f2a7482d42a5614b.js → page-2f24283c162b6ab3.js} +1 -1
  167. package/dist/web/standalone/.next/static/chunks/app/{layout-a16c7a7ecdf0c2cf.js → layout-9ecfd95f343793f0.js} +1 -1
  168. package/dist/web/standalone/.next/static/chunks/app/page-151349214571e2b6.js +1 -0
  169. package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +1 -0
  170. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +1 -0
  171. package/dist/web/standalone/.next/static/chunks/{webpack-1832629448831fdc.js → webpack-5fc74f13a25fa1bb.js} +1 -1
  172. package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
  173. package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
  174. package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
  175. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
  176. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
  177. package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
  178. package/dist/web/standalone/server.js +1 -1
  179. package/dist/web-mode.js +1 -1
  180. package/dist/welcome-screen.js +20 -19
  181. package/dist/wizard.js +5 -2
  182. package/package.json +7 -25
  183. package/packages/mcp-server/dist/server.d.ts.map +1 -1
  184. package/packages/mcp-server/dist/server.js +11 -15
  185. package/packages/mcp-server/dist/server.js.map +1 -1
  186. package/packages/mcp-server/src/server.ts +16 -17
  187. package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
  188. package/packages/native/tsconfig.json +1 -2
  189. package/packages/native/tsconfig.tsbuildinfo +1 -0
  190. package/pkg/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  191. package/pkg/dist/core/export-html/ansi-to-html.js +0 -1
  192. package/pkg/dist/core/export-html/ansi-to-html.js.map +1 -1
  193. package/pkg/dist/core/export-html/index.d.ts +1 -1
  194. package/pkg/dist/core/export-html/index.d.ts.map +1 -1
  195. package/pkg/dist/core/export-html/index.js +5 -39
  196. package/pkg/dist/core/export-html/index.js.map +1 -1
  197. package/pkg/dist/core/export-html/tool-renderer.d.ts +2 -2
  198. package/pkg/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  199. package/pkg/dist/core/export-html/tool-renderer.js.map +1 -1
  200. package/scripts/ensure-workspace-builds.cjs +0 -2
  201. package/scripts/link-workspace-packages.cjs +0 -2
  202. package/scripts/postinstall.js +178 -9
  203. package/src/resources/extensions/async-jobs/async-bash-tool.ts +1 -1
  204. package/src/resources/extensions/aws-auth/index.ts +1 -2
  205. package/src/resources/extensions/bg-shell/bg-shell-lifecycle.ts +7 -4
  206. package/src/resources/extensions/bg-shell/index.ts +1 -2
  207. package/src/resources/extensions/bg-shell/process-manager.ts +1 -2
  208. package/src/resources/extensions/browser-tools/index.ts +1 -2
  209. package/src/resources/extensions/claude-code-cli/index.ts +1 -1
  210. package/src/resources/extensions/claude-code-cli/partial-builder.ts +23 -115
  211. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +9 -19
  212. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +3 -27
  213. package/src/resources/extensions/gsd/auto-dispatch.ts +13 -43
  214. package/src/resources/extensions/gsd/auto-post-unit.ts +0 -33
  215. package/src/resources/extensions/gsd/auto-recovery.ts +1 -37
  216. package/src/resources/extensions/gsd/auto-start.ts +6 -20
  217. package/src/resources/extensions/gsd/dispatch-guard.ts +2 -44
  218. package/src/resources/extensions/gsd/guided-flow.ts +1 -1
  219. package/src/resources/extensions/gsd/prompts/system.md +0 -1
  220. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +0 -73
  221. package/src/resources/extensions/gsd/tests/complete-milestone-false-merge.test.ts +0 -15
  222. package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +9 -9
  223. package/src/resources/extensions/gsd/tests/integration/worktree-e2e.test.ts +0 -11
  224. package/src/resources/extensions/gsd/tests/milestone-status-authoritative.test.ts +3 -3
  225. package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +5 -127
  226. package/src/resources/extensions/mcp-client/index.ts +1 -1
  227. package/src/resources/extensions/ollama/index.ts +3 -3
  228. package/src/resources/extensions/ollama/ollama-chat-provider.ts +18 -6
  229. package/src/resources/extensions/remote-questions/config.ts +4 -15
  230. package/src/resources/extensions/search-the-web/index.ts +1 -2
  231. package/src/resources/extensions/shared/tests/format-utils.test.ts +3 -5
  232. package/src/resources/extensions/universal-config/index.ts +1 -1
  233. package/dist/web/standalone/.next/static/chunks/2826.d445fb428ef41fa1.js +0 -9
  234. package/dist/web/standalone/.next/static/chunks/app/page-5b113fd32bc2a1c3.js +0 -1
  235. package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +0 -1
  236. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +0 -1
  237. package/packages/gsd-agent-core/dist/agent-session.d.ts +0 -716
  238. package/packages/gsd-agent-core/dist/agent-session.d.ts.map +0 -1
  239. package/packages/gsd-agent-core/dist/agent-session.js +0 -2595
  240. package/packages/gsd-agent-core/dist/agent-session.js.map +0 -1
  241. package/packages/gsd-agent-core/dist/artifact-manager.d.ts +0 -52
  242. package/packages/gsd-agent-core/dist/artifact-manager.d.ts.map +0 -1
  243. package/packages/gsd-agent-core/dist/artifact-manager.js +0 -118
  244. package/packages/gsd-agent-core/dist/artifact-manager.js.map +0 -1
  245. package/packages/gsd-agent-core/dist/bash-executor.d.ts +0 -57
  246. package/packages/gsd-agent-core/dist/bash-executor.d.ts.map +0 -1
  247. package/packages/gsd-agent-core/dist/bash-executor.js +0 -282
  248. package/packages/gsd-agent-core/dist/bash-executor.js.map +0 -1
  249. package/packages/gsd-agent-core/dist/blob-store.d.ts +0 -39
  250. package/packages/gsd-agent-core/dist/blob-store.d.ts.map +0 -1
  251. package/packages/gsd-agent-core/dist/blob-store.js +0 -151
  252. package/packages/gsd-agent-core/dist/blob-store.js.map +0 -1
  253. package/packages/gsd-agent-core/dist/compaction/branch-summarization.d.ts +0 -90
  254. package/packages/gsd-agent-core/dist/compaction/branch-summarization.d.ts.map +0 -1
  255. package/packages/gsd-agent-core/dist/compaction/branch-summarization.js +0 -207
  256. package/packages/gsd-agent-core/dist/compaction/branch-summarization.js.map +0 -1
  257. package/packages/gsd-agent-core/dist/compaction/compaction.d.ts +0 -137
  258. package/packages/gsd-agent-core/dist/compaction/compaction.d.ts.map +0 -1
  259. package/packages/gsd-agent-core/dist/compaction/compaction.js +0 -621
  260. package/packages/gsd-agent-core/dist/compaction/compaction.js.map +0 -1
  261. package/packages/gsd-agent-core/dist/compaction/index.d.ts +0 -7
  262. package/packages/gsd-agent-core/dist/compaction/index.d.ts.map +0 -1
  263. package/packages/gsd-agent-core/dist/compaction/index.js +0 -7
  264. package/packages/gsd-agent-core/dist/compaction/index.js.map +0 -1
  265. package/packages/gsd-agent-core/dist/compaction/utils.d.ts +0 -78
  266. package/packages/gsd-agent-core/dist/compaction/utils.d.ts.map +0 -1
  267. package/packages/gsd-agent-core/dist/compaction/utils.js +0 -263
  268. package/packages/gsd-agent-core/dist/compaction/utils.js.map +0 -1
  269. package/packages/gsd-agent-core/dist/compaction-orchestrator.d.ts +0 -90
  270. package/packages/gsd-agent-core/dist/compaction-orchestrator.d.ts.map +0 -1
  271. package/packages/gsd-agent-core/dist/compaction-orchestrator.js +0 -338
  272. package/packages/gsd-agent-core/dist/compaction-orchestrator.js.map +0 -1
  273. package/packages/gsd-agent-core/dist/contextual-tips.d.ts +0 -43
  274. package/packages/gsd-agent-core/dist/contextual-tips.d.ts.map +0 -1
  275. package/packages/gsd-agent-core/dist/contextual-tips.js +0 -208
  276. package/packages/gsd-agent-core/dist/contextual-tips.js.map +0 -1
  277. package/packages/gsd-agent-core/dist/export-html/ansi-to-html.d.ts +0 -18
  278. package/packages/gsd-agent-core/dist/export-html/ansi-to-html.d.ts.map +0 -1
  279. package/packages/gsd-agent-core/dist/export-html/ansi-to-html.js +0 -250
  280. package/packages/gsd-agent-core/dist/export-html/ansi-to-html.js.map +0 -1
  281. package/packages/gsd-agent-core/dist/export-html/index.d.ts +0 -37
  282. package/packages/gsd-agent-core/dist/export-html/index.d.ts.map +0 -1
  283. package/packages/gsd-agent-core/dist/export-html/index.js +0 -257
  284. package/packages/gsd-agent-core/dist/export-html/index.js.map +0 -1
  285. package/packages/gsd-agent-core/dist/export-html/template.css +0 -971
  286. package/packages/gsd-agent-core/dist/export-html/template.html +0 -54
  287. package/packages/gsd-agent-core/dist/export-html/template.js +0 -1583
  288. package/packages/gsd-agent-core/dist/export-html/tool-renderer.d.ts +0 -38
  289. package/packages/gsd-agent-core/dist/export-html/tool-renderer.d.ts.map +0 -1
  290. package/packages/gsd-agent-core/dist/export-html/tool-renderer.js +0 -70
  291. package/packages/gsd-agent-core/dist/export-html/tool-renderer.js.map +0 -1
  292. package/packages/gsd-agent-core/dist/export-html/vendor/highlight.min.js +0 -1213
  293. package/packages/gsd-agent-core/dist/export-html/vendor/marked.min.js +0 -6
  294. package/packages/gsd-agent-core/dist/fallback-resolver.d.ts +0 -75
  295. package/packages/gsd-agent-core/dist/fallback-resolver.d.ts.map +0 -1
  296. package/packages/gsd-agent-core/dist/fallback-resolver.js +0 -118
  297. package/packages/gsd-agent-core/dist/fallback-resolver.js.map +0 -1
  298. package/packages/gsd-agent-core/dist/image-overflow-recovery.d.ts +0 -44
  299. package/packages/gsd-agent-core/dist/image-overflow-recovery.d.ts.map +0 -1
  300. package/packages/gsd-agent-core/dist/image-overflow-recovery.js +0 -99
  301. package/packages/gsd-agent-core/dist/image-overflow-recovery.js.map +0 -1
  302. package/packages/gsd-agent-core/dist/index.d.ts +0 -14
  303. package/packages/gsd-agent-core/dist/index.d.ts.map +0 -1
  304. package/packages/gsd-agent-core/dist/index.js +0 -19
  305. package/packages/gsd-agent-core/dist/index.js.map +0 -1
  306. package/packages/gsd-agent-core/dist/keybindings.d.ts +0 -47
  307. package/packages/gsd-agent-core/dist/keybindings.d.ts.map +0 -1
  308. package/packages/gsd-agent-core/dist/keybindings.js +0 -156
  309. package/packages/gsd-agent-core/dist/keybindings.js.map +0 -1
  310. package/packages/gsd-agent-core/dist/lifecycle-hooks.d.ts +0 -42
  311. package/packages/gsd-agent-core/dist/lifecycle-hooks.d.ts.map +0 -1
  312. package/packages/gsd-agent-core/dist/lifecycle-hooks.js +0 -204
  313. package/packages/gsd-agent-core/dist/lifecycle-hooks.js.map +0 -1
  314. package/packages/gsd-agent-core/dist/retry-handler.d.ts +0 -128
  315. package/packages/gsd-agent-core/dist/retry-handler.d.ts.map +0 -1
  316. package/packages/gsd-agent-core/dist/retry-handler.js +0 -518
  317. package/packages/gsd-agent-core/dist/retry-handler.js.map +0 -1
  318. package/packages/gsd-agent-core/dist/sdk.d.ts +0 -159
  319. package/packages/gsd-agent-core/dist/sdk.d.ts.map +0 -1
  320. package/packages/gsd-agent-core/dist/sdk.js +0 -375
  321. package/packages/gsd-agent-core/dist/sdk.js.map +0 -1
  322. package/packages/gsd-agent-core/dist/system-prompt.d.ts +0 -28
  323. package/packages/gsd-agent-core/dist/system-prompt.d.ts.map +0 -1
  324. package/packages/gsd-agent-core/dist/system-prompt.js +0 -201
  325. package/packages/gsd-agent-core/dist/system-prompt.js.map +0 -1
  326. package/packages/gsd-agent-core/package.json +0 -25
  327. package/packages/gsd-agent-core/scripts/copy-assets.cjs +0 -43
  328. package/packages/gsd-agent-core/src/agent-session.test.ts +0 -169
  329. package/packages/gsd-agent-core/src/agent-session.ts +0 -3358
  330. package/packages/gsd-agent-core/src/artifact-manager.ts +0 -126
  331. package/packages/gsd-agent-core/src/bash-executor.ts +0 -352
  332. package/packages/gsd-agent-core/src/blob-store.ts +0 -154
  333. package/packages/gsd-agent-core/src/compaction/branch-summarization.ts +0 -317
  334. package/packages/gsd-agent-core/src/compaction/compaction.ts +0 -855
  335. package/packages/gsd-agent-core/src/compaction/index.ts +0 -7
  336. package/packages/gsd-agent-core/src/compaction/utils.ts +0 -312
  337. package/packages/gsd-agent-core/src/compaction-orchestrator.ts +0 -449
  338. package/packages/gsd-agent-core/src/contextual-tips.ts +0 -232
  339. package/packages/gsd-agent-core/src/export-html/ansi-to-html.ts +0 -259
  340. package/packages/gsd-agent-core/src/export-html/index.ts +0 -345
  341. package/packages/gsd-agent-core/src/export-html/template.css +0 -971
  342. package/packages/gsd-agent-core/src/export-html/template.html +0 -54
  343. package/packages/gsd-agent-core/src/export-html/template.js +0 -1583
  344. package/packages/gsd-agent-core/src/export-html/tool-renderer.ts +0 -114
  345. package/packages/gsd-agent-core/src/export-html/vendor/highlight.min.js +0 -1213
  346. package/packages/gsd-agent-core/src/export-html/vendor/marked.min.js +0 -6
  347. package/packages/gsd-agent-core/src/fallback-resolver.ts +0 -193
  348. package/packages/gsd-agent-core/src/image-overflow-recovery.ts +0 -120
  349. package/packages/gsd-agent-core/src/index.ts +0 -68
  350. package/packages/gsd-agent-core/src/keybindings.ts +0 -220
  351. package/packages/gsd-agent-core/src/lifecycle-hooks.ts +0 -284
  352. package/packages/gsd-agent-core/src/retry-handler.ts +0 -620
  353. package/packages/gsd-agent-core/src/sdk.ts +0 -550
  354. package/packages/gsd-agent-core/src/system-prompt.ts +0 -270
  355. package/packages/gsd-agent-core/tsconfig.json +0 -28
  356. package/packages/gsd-agent-core/tsconfig.tsbuildinfo +0 -1
  357. package/packages/gsd-agent-modes/dist/cli/args.d.ts +0 -58
  358. package/packages/gsd-agent-modes/dist/cli/args.d.ts.map +0 -1
  359. package/packages/gsd-agent-modes/dist/cli/args.js +0 -324
  360. package/packages/gsd-agent-modes/dist/cli/args.js.map +0 -1
  361. package/packages/gsd-agent-modes/dist/cli/config-selector.d.ts +0 -13
  362. package/packages/gsd-agent-modes/dist/cli/config-selector.d.ts.map +0 -1
  363. package/packages/gsd-agent-modes/dist/cli/config-selector.js +0 -32
  364. package/packages/gsd-agent-modes/dist/cli/config-selector.js.map +0 -1
  365. package/packages/gsd-agent-modes/dist/cli/file-processor.d.ts +0 -15
  366. package/packages/gsd-agent-modes/dist/cli/file-processor.d.ts.map +0 -1
  367. package/packages/gsd-agent-modes/dist/cli/file-processor.js +0 -86
  368. package/packages/gsd-agent-modes/dist/cli/file-processor.js.map +0 -1
  369. package/packages/gsd-agent-modes/dist/cli/list-models.d.ts +0 -21
  370. package/packages/gsd-agent-modes/dist/cli/list-models.d.ts.map +0 -1
  371. package/packages/gsd-agent-modes/dist/cli/list-models.js +0 -114
  372. package/packages/gsd-agent-modes/dist/cli/list-models.js.map +0 -1
  373. package/packages/gsd-agent-modes/dist/cli/session-picker.d.ts +0 -10
  374. package/packages/gsd-agent-modes/dist/cli/session-picker.d.ts.map +0 -1
  375. package/packages/gsd-agent-modes/dist/cli/session-picker.js +0 -37
  376. package/packages/gsd-agent-modes/dist/cli/session-picker.js.map +0 -1
  377. package/packages/gsd-agent-modes/dist/index.d.ts +0 -7
  378. package/packages/gsd-agent-modes/dist/index.d.ts.map +0 -1
  379. package/packages/gsd-agent-modes/dist/index.js +0 -7
  380. package/packages/gsd-agent-modes/dist/index.js.map +0 -1
  381. package/packages/gsd-agent-modes/dist/main.d.ts +0 -8
  382. package/packages/gsd-agent-modes/dist/main.d.ts.map +0 -1
  383. package/packages/gsd-agent-modes/dist/main.js +0 -491
  384. package/packages/gsd-agent-modes/dist/main.js.map +0 -1
  385. package/packages/gsd-agent-modes/dist/modes/interactive/components/armin.d.ts +0 -34
  386. package/packages/gsd-agent-modes/dist/modes/interactive/components/armin.d.ts.map +0 -1
  387. package/packages/gsd-agent-modes/dist/modes/interactive/components/armin.js +0 -330
  388. package/packages/gsd-agent-modes/dist/modes/interactive/components/armin.js.map +0 -1
  389. package/packages/gsd-agent-modes/dist/modes/interactive/components/assistant-message.d.ts +0 -29
  390. package/packages/gsd-agent-modes/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  391. package/packages/gsd-agent-modes/dist/modes/interactive/components/assistant-message.js +0 -141
  392. package/packages/gsd-agent-modes/dist/modes/interactive/components/assistant-message.js.map +0 -1
  393. package/packages/gsd-agent-modes/dist/modes/interactive/components/bash-execution.d.ts +0 -36
  394. package/packages/gsd-agent-modes/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  395. package/packages/gsd-agent-modes/dist/modes/interactive/components/bash-execution.js +0 -157
  396. package/packages/gsd-agent-modes/dist/modes/interactive/components/bash-execution.js.map +0 -1
  397. package/packages/gsd-agent-modes/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  398. package/packages/gsd-agent-modes/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  399. package/packages/gsd-agent-modes/dist/modes/interactive/components/bordered-loader.js +0 -48
  400. package/packages/gsd-agent-modes/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  401. package/packages/gsd-agent-modes/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
  402. package/packages/gsd-agent-modes/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  403. package/packages/gsd-agent-modes/dist/modes/interactive/components/branch-summary-message.js +0 -43
  404. package/packages/gsd-agent-modes/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  405. package/packages/gsd-agent-modes/dist/modes/interactive/components/chat-frame.d.ts +0 -11
  406. package/packages/gsd-agent-modes/dist/modes/interactive/components/chat-frame.d.ts.map +0 -1
  407. package/packages/gsd-agent-modes/dist/modes/interactive/components/chat-frame.js +0 -47
  408. package/packages/gsd-agent-modes/dist/modes/interactive/components/chat-frame.js.map +0 -1
  409. package/packages/gsd-agent-modes/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
  410. package/packages/gsd-agent-modes/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  411. package/packages/gsd-agent-modes/dist/modes/interactive/components/compaction-summary-message.js +0 -44
  412. package/packages/gsd-agent-modes/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  413. package/packages/gsd-agent-modes/dist/modes/interactive/components/config-selector.d.ts +0 -71
  414. package/packages/gsd-agent-modes/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  415. package/packages/gsd-agent-modes/dist/modes/interactive/components/config-selector.js +0 -474
  416. package/packages/gsd-agent-modes/dist/modes/interactive/components/config-selector.js.map +0 -1
  417. package/packages/gsd-agent-modes/dist/modes/interactive/components/countdown-timer.d.ts +0 -15
  418. package/packages/gsd-agent-modes/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  419. package/packages/gsd-agent-modes/dist/modes/interactive/components/countdown-timer.js +0 -32
  420. package/packages/gsd-agent-modes/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  421. package/packages/gsd-agent-modes/dist/modes/interactive/components/custom-editor.d.ts +0 -22
  422. package/packages/gsd-agent-modes/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  423. package/packages/gsd-agent-modes/dist/modes/interactive/components/custom-editor.js +0 -70
  424. package/packages/gsd-agent-modes/dist/modes/interactive/components/custom-editor.js.map +0 -1
  425. package/packages/gsd-agent-modes/dist/modes/interactive/components/custom-message.d.ts +0 -20
  426. package/packages/gsd-agent-modes/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  427. package/packages/gsd-agent-modes/dist/modes/interactive/components/custom-message.js +0 -75
  428. package/packages/gsd-agent-modes/dist/modes/interactive/components/custom-message.js.map +0 -1
  429. package/packages/gsd-agent-modes/dist/modes/interactive/components/daxnuts.d.ts +0 -23
  430. package/packages/gsd-agent-modes/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  431. package/packages/gsd-agent-modes/dist/modes/interactive/components/daxnuts.js +0 -140
  432. package/packages/gsd-agent-modes/dist/modes/interactive/components/daxnuts.js.map +0 -1
  433. package/packages/gsd-agent-modes/dist/modes/interactive/components/diff.d.ts +0 -12
  434. package/packages/gsd-agent-modes/dist/modes/interactive/components/diff.d.ts.map +0 -1
  435. package/packages/gsd-agent-modes/dist/modes/interactive/components/diff.js +0 -133
  436. package/packages/gsd-agent-modes/dist/modes/interactive/components/diff.js.map +0 -1
  437. package/packages/gsd-agent-modes/dist/modes/interactive/components/dynamic-border.d.ts +0 -33
  438. package/packages/gsd-agent-modes/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  439. package/packages/gsd-agent-modes/dist/modes/interactive/components/dynamic-border.js +0 -82
  440. package/packages/gsd-agent-modes/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  441. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-editor.d.ts +0 -20
  442. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  443. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-editor.js +0 -111
  444. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-editor.js.map +0 -1
  445. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-input.d.ts +0 -24
  446. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  447. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-input.js +0 -63
  448. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-input.js.map +0 -1
  449. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-selector.d.ts +0 -33
  450. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  451. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-selector.js +0 -118
  452. package/packages/gsd-agent-modes/dist/modes/interactive/components/extension-selector.js.map +0 -1
  453. package/packages/gsd-agent-modes/dist/modes/interactive/components/footer.d.ts +0 -32
  454. package/packages/gsd-agent-modes/dist/modes/interactive/components/footer.d.ts.map +0 -1
  455. package/packages/gsd-agent-modes/dist/modes/interactive/components/footer.js +0 -230
  456. package/packages/gsd-agent-modes/dist/modes/interactive/components/footer.js.map +0 -1
  457. package/packages/gsd-agent-modes/dist/modes/interactive/components/index.d.ts +0 -34
  458. package/packages/gsd-agent-modes/dist/modes/interactive/components/index.d.ts.map +0 -1
  459. package/packages/gsd-agent-modes/dist/modes/interactive/components/index.js +0 -36
  460. package/packages/gsd-agent-modes/dist/modes/interactive/components/index.js.map +0 -1
  461. package/packages/gsd-agent-modes/dist/modes/interactive/components/keybinding-hints.d.ts +0 -48
  462. package/packages/gsd-agent-modes/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  463. package/packages/gsd-agent-modes/dist/modes/interactive/components/keybinding-hints.js +0 -72
  464. package/packages/gsd-agent-modes/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  465. package/packages/gsd-agent-modes/dist/modes/interactive/components/login-dialog.d.ts +0 -63
  466. package/packages/gsd-agent-modes/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  467. package/packages/gsd-agent-modes/dist/modes/interactive/components/login-dialog.js +0 -213
  468. package/packages/gsd-agent-modes/dist/modes/interactive/components/login-dialog.js.map +0 -1
  469. package/packages/gsd-agent-modes/dist/modes/interactive/components/model-selector.d.ts +0 -86
  470. package/packages/gsd-agent-modes/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  471. package/packages/gsd-agent-modes/dist/modes/interactive/components/model-selector.js +0 -536
  472. package/packages/gsd-agent-modes/dist/modes/interactive/components/model-selector.js.map +0 -1
  473. package/packages/gsd-agent-modes/dist/modes/interactive/components/oauth-selector.d.ts +0 -19
  474. package/packages/gsd-agent-modes/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  475. package/packages/gsd-agent-modes/dist/modes/interactive/components/oauth-selector.js +0 -93
  476. package/packages/gsd-agent-modes/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  477. package/packages/gsd-agent-modes/dist/modes/interactive/components/provider-manager.d.ts +0 -30
  478. package/packages/gsd-agent-modes/dist/modes/interactive/components/provider-manager.d.ts.map +0 -1
  479. package/packages/gsd-agent-modes/dist/modes/interactive/components/provider-manager.js +0 -169
  480. package/packages/gsd-agent-modes/dist/modes/interactive/components/provider-manager.js.map +0 -1
  481. package/packages/gsd-agent-modes/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -49
  482. package/packages/gsd-agent-modes/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  483. package/packages/gsd-agent-modes/dist/modes/interactive/components/scoped-models-selector.js +0 -267
  484. package/packages/gsd-agent-modes/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  485. package/packages/gsd-agent-modes/dist/modes/interactive/components/session-selector-search.d.ts +0 -21
  486. package/packages/gsd-agent-modes/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  487. package/packages/gsd-agent-modes/dist/modes/interactive/components/session-selector-search.js +0 -155
  488. package/packages/gsd-agent-modes/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  489. package/packages/gsd-agent-modes/dist/modes/interactive/components/session-selector.d.ts +0 -97
  490. package/packages/gsd-agent-modes/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  491. package/packages/gsd-agent-modes/dist/modes/interactive/components/session-selector.js +0 -810
  492. package/packages/gsd-agent-modes/dist/modes/interactive/components/session-selector.js.map +0 -1
  493. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.d.ts +0 -71
  494. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  495. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.js +0 -320
  496. package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.js.map +0 -1
  497. package/packages/gsd-agent-modes/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  498. package/packages/gsd-agent-modes/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  499. package/packages/gsd-agent-modes/dist/modes/interactive/components/show-images-selector.js +0 -34
  500. package/packages/gsd-agent-modes/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  501. package/packages/gsd-agent-modes/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
  502. package/packages/gsd-agent-modes/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  503. package/packages/gsd-agent-modes/dist/modes/interactive/components/skill-invocation-message.js +0 -46
  504. package/packages/gsd-agent-modes/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  505. package/packages/gsd-agent-modes/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  506. package/packages/gsd-agent-modes/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  507. package/packages/gsd-agent-modes/dist/modes/interactive/components/theme-selector.js +0 -45
  508. package/packages/gsd-agent-modes/dist/modes/interactive/components/theme-selector.js.map +0 -1
  509. package/packages/gsd-agent-modes/dist/modes/interactive/components/thinking-selector.d.ts +0 -11
  510. package/packages/gsd-agent-modes/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  511. package/packages/gsd-agent-modes/dist/modes/interactive/components/thinking-selector.js +0 -46
  512. package/packages/gsd-agent-modes/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  513. package/packages/gsd-agent-modes/dist/modes/interactive/components/timestamp.d.ts +0 -15
  514. package/packages/gsd-agent-modes/dist/modes/interactive/components/timestamp.d.ts.map +0 -1
  515. package/packages/gsd-agent-modes/dist/modes/interactive/components/timestamp.js +0 -40
  516. package/packages/gsd-agent-modes/dist/modes/interactive/components/timestamp.js.map +0 -1
  517. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts +0 -111
  518. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  519. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js +0 -984
  520. package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js.map +0 -1
  521. package/packages/gsd-agent-modes/dist/modes/interactive/components/tree-render-utils.d.ts +0 -44
  522. package/packages/gsd-agent-modes/dist/modes/interactive/components/tree-render-utils.d.ts.map +0 -1
  523. package/packages/gsd-agent-modes/dist/modes/interactive/components/tree-render-utils.js +0 -61
  524. package/packages/gsd-agent-modes/dist/modes/interactive/components/tree-render-utils.js.map +0 -1
  525. package/packages/gsd-agent-modes/dist/modes/interactive/components/tree-selector.d.ts +0 -109
  526. package/packages/gsd-agent-modes/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  527. package/packages/gsd-agent-modes/dist/modes/interactive/components/tree-selector.js +0 -1035
  528. package/packages/gsd-agent-modes/dist/modes/interactive/components/tree-selector.js.map +0 -1
  529. package/packages/gsd-agent-modes/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  530. package/packages/gsd-agent-modes/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  531. package/packages/gsd-agent-modes/dist/modes/interactive/components/user-message-selector.js +0 -112
  532. package/packages/gsd-agent-modes/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  533. package/packages/gsd-agent-modes/dist/modes/interactive/components/user-message.d.ts +0 -12
  534. package/packages/gsd-agent-modes/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  535. package/packages/gsd-agent-modes/dist/modes/interactive/components/user-message.js +0 -38
  536. package/packages/gsd-agent-modes/dist/modes/interactive/components/user-message.js.map +0 -1
  537. package/packages/gsd-agent-modes/dist/modes/interactive/components/visual-truncate.d.ts +0 -24
  538. package/packages/gsd-agent-modes/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  539. package/packages/gsd-agent-modes/dist/modes/interactive/components/visual-truncate.js +0 -33
  540. package/packages/gsd-agent-modes/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  541. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts +0 -27
  542. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts.map +0 -1
  543. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js +0 -793
  544. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +0 -1
  545. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/extension-ui-controller.d.ts +0 -4
  546. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/extension-ui-controller.d.ts.map +0 -1
  547. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/extension-ui-controller.js +0 -62
  548. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/extension-ui-controller.js.map +0 -1
  549. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.d.ts +0 -22
  550. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.d.ts.map +0 -1
  551. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js +0 -118
  552. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js.map +0 -1
  553. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/model-controller.d.ts +0 -7
  554. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/model-controller.d.ts.map +0 -1
  555. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/model-controller.js +0 -68
  556. package/packages/gsd-agent-modes/dist/modes/interactive/controllers/model-controller.js.map +0 -1
  557. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.d.ts +0 -50
  558. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.d.ts.map +0 -1
  559. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.js +0 -2
  560. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.js.map +0 -1
  561. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts +0 -358
  562. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  563. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js +0 -3409
  564. package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js.map +0 -1
  565. package/packages/gsd-agent-modes/dist/modes/interactive/slash-command-handlers.d.ts +0 -77
  566. package/packages/gsd-agent-modes/dist/modes/interactive/slash-command-handlers.d.ts.map +0 -1
  567. package/packages/gsd-agent-modes/dist/modes/interactive/slash-command-handlers.js +0 -529
  568. package/packages/gsd-agent-modes/dist/modes/interactive/slash-command-handlers.js.map +0 -1
  569. package/packages/gsd-agent-modes/dist/modes/interactive/utils/shorten-path.d.ts +0 -6
  570. package/packages/gsd-agent-modes/dist/modes/interactive/utils/shorten-path.d.ts.map +0 -1
  571. package/packages/gsd-agent-modes/dist/modes/interactive/utils/shorten-path.js +0 -15
  572. package/packages/gsd-agent-modes/dist/modes/interactive/utils/shorten-path.js.map +0 -1
  573. package/packages/gsd-agent-modes/dist/modes/print-mode.d.ts +0 -28
  574. package/packages/gsd-agent-modes/dist/modes/print-mode.d.ts.map +0 -1
  575. package/packages/gsd-agent-modes/dist/modes/print-mode.js +0 -84
  576. package/packages/gsd-agent-modes/dist/modes/print-mode.js.map +0 -1
  577. package/packages/gsd-agent-modes/dist/modes/rpc/jsonl.d.ts +0 -17
  578. package/packages/gsd-agent-modes/dist/modes/rpc/jsonl.d.ts.map +0 -1
  579. package/packages/gsd-agent-modes/dist/modes/rpc/jsonl.js +0 -49
  580. package/packages/gsd-agent-modes/dist/modes/rpc/jsonl.js.map +0 -1
  581. package/packages/gsd-agent-modes/dist/modes/rpc/remote-terminal.d.ts +0 -37
  582. package/packages/gsd-agent-modes/dist/modes/rpc/remote-terminal.d.ts.map +0 -1
  583. package/packages/gsd-agent-modes/dist/modes/rpc/remote-terminal.js +0 -84
  584. package/packages/gsd-agent-modes/dist/modes/rpc/remote-terminal.js.map +0 -1
  585. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.d.ts +0 -243
  586. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  587. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.js +0 -464
  588. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.js.map +0 -1
  589. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.d.ts +0 -25
  590. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  591. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.js +0 -750
  592. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.js.map +0 -1
  593. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-types.d.ts +0 -511
  594. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  595. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-types.js +0 -8
  596. package/packages/gsd-agent-modes/dist/modes/rpc/rpc-types.js.map +0 -1
  597. package/packages/gsd-agent-modes/dist/modes/shared/command-context-actions.d.ts +0 -19
  598. package/packages/gsd-agent-modes/dist/modes/shared/command-context-actions.d.ts.map +0 -1
  599. package/packages/gsd-agent-modes/dist/modes/shared/command-context-actions.js +0 -45
  600. package/packages/gsd-agent-modes/dist/modes/shared/command-context-actions.js.map +0 -1
  601. package/packages/gsd-agent-modes/dist/pi-coding-agent-compat.d.ts +0 -22
  602. package/packages/gsd-agent-modes/dist/pi-coding-agent-compat.d.ts.map +0 -1
  603. package/packages/gsd-agent-modes/dist/pi-coding-agent-compat.js +0 -21
  604. package/packages/gsd-agent-modes/dist/pi-coding-agent-compat.js.map +0 -1
  605. package/packages/gsd-agent-modes/dist/pi-tui-compat.d.ts +0 -4
  606. package/packages/gsd-agent-modes/dist/pi-tui-compat.d.ts.map +0 -1
  607. package/packages/gsd-agent-modes/dist/pi-tui-compat.js +0 -3
  608. package/packages/gsd-agent-modes/dist/pi-tui-compat.js.map +0 -1
  609. package/packages/gsd-agent-modes/dist/theme.d.ts +0 -15
  610. package/packages/gsd-agent-modes/dist/theme.d.ts.map +0 -1
  611. package/packages/gsd-agent-modes/dist/theme.js +0 -23
  612. package/packages/gsd-agent-modes/dist/theme.js.map +0 -1
  613. package/packages/gsd-agent-modes/dist/utils/theme.d.ts +0 -16
  614. package/packages/gsd-agent-modes/dist/utils/theme.d.ts.map +0 -1
  615. package/packages/gsd-agent-modes/dist/utils/theme.js +0 -11
  616. package/packages/gsd-agent-modes/dist/utils/theme.js.map +0 -1
  617. package/packages/gsd-agent-modes/package.json +0 -23
  618. package/packages/gsd-agent-modes/src/cli/args.ts +0 -350
  619. package/packages/gsd-agent-modes/src/cli/config-selector.ts +0 -54
  620. package/packages/gsd-agent-modes/src/cli/file-processor.ts +0 -107
  621. package/packages/gsd-agent-modes/src/cli/list-models.ts +0 -141
  622. package/packages/gsd-agent-modes/src/cli/session-picker.ts +0 -59
  623. package/packages/gsd-agent-modes/src/index.ts +0 -6
  624. package/packages/gsd-agent-modes/src/main.ts +0 -614
  625. package/packages/gsd-agent-modes/src/modes/interactive/components/__tests__/login-dialog.test.ts +0 -24
  626. package/packages/gsd-agent-modes/src/modes/interactive/components/__tests__/provider-display-name.test.ts +0 -18
  627. package/packages/gsd-agent-modes/src/modes/interactive/components/__tests__/timestamp.test.ts +0 -38
  628. package/packages/gsd-agent-modes/src/modes/interactive/components/__tests__/tool-execution.test.ts +0 -171
  629. package/packages/gsd-agent-modes/src/modes/interactive/components/armin.ts +0 -382
  630. package/packages/gsd-agent-modes/src/modes/interactive/components/assistant-message.ts +0 -178
  631. package/packages/gsd-agent-modes/src/modes/interactive/components/bash-execution.ts +0 -212
  632. package/packages/gsd-agent-modes/src/modes/interactive/components/bordered-loader.ts +0 -66
  633. package/packages/gsd-agent-modes/src/modes/interactive/components/branch-summary-message.ts +0 -59
  634. package/packages/gsd-agent-modes/src/modes/interactive/components/chat-frame.ts +0 -67
  635. package/packages/gsd-agent-modes/src/modes/interactive/components/compaction-summary-message.ts +0 -60
  636. package/packages/gsd-agent-modes/src/modes/interactive/components/config-selector.ts +0 -597
  637. package/packages/gsd-agent-modes/src/modes/interactive/components/countdown-timer.ts +0 -41
  638. package/packages/gsd-agent-modes/src/modes/interactive/components/custom-editor.ts +0 -88
  639. package/packages/gsd-agent-modes/src/modes/interactive/components/custom-message.ts +0 -100
  640. package/packages/gsd-agent-modes/src/modes/interactive/components/daxnuts.ts +0 -165
  641. package/packages/gsd-agent-modes/src/modes/interactive/components/diff.ts +0 -147
  642. package/packages/gsd-agent-modes/src/modes/interactive/components/dynamic-border.test.ts +0 -73
  643. package/packages/gsd-agent-modes/src/modes/interactive/components/dynamic-border.ts +0 -89
  644. package/packages/gsd-agent-modes/src/modes/interactive/components/extension-editor.ts +0 -151
  645. package/packages/gsd-agent-modes/src/modes/interactive/components/extension-input.ts +0 -100
  646. package/packages/gsd-agent-modes/src/modes/interactive/components/extension-selector.ts +0 -156
  647. package/packages/gsd-agent-modes/src/modes/interactive/components/footer.ts +0 -257
  648. package/packages/gsd-agent-modes/src/modes/interactive/components/index.ts +0 -35
  649. package/packages/gsd-agent-modes/src/modes/interactive/components/keybinding-hints.ts +0 -84
  650. package/packages/gsd-agent-modes/src/modes/interactive/components/login-dialog.ts +0 -257
  651. package/packages/gsd-agent-modes/src/modes/interactive/components/model-selector.ts +0 -656
  652. package/packages/gsd-agent-modes/src/modes/interactive/components/oauth-selector.ts +0 -122
  653. package/packages/gsd-agent-modes/src/modes/interactive/components/provider-manager.ts +0 -210
  654. package/packages/gsd-agent-modes/src/modes/interactive/components/scoped-models-selector.ts +0 -342
  655. package/packages/gsd-agent-modes/src/modes/interactive/components/session-selector-search.ts +0 -194
  656. package/packages/gsd-agent-modes/src/modes/interactive/components/session-selector.ts +0 -1011
  657. package/packages/gsd-agent-modes/src/modes/interactive/components/settings-selector.ts +0 -452
  658. package/packages/gsd-agent-modes/src/modes/interactive/components/show-images-selector.ts +0 -45
  659. package/packages/gsd-agent-modes/src/modes/interactive/components/skill-invocation-message.ts +0 -56
  660. package/packages/gsd-agent-modes/src/modes/interactive/components/theme-selector.ts +0 -63
  661. package/packages/gsd-agent-modes/src/modes/interactive/components/thinking-selector.ts +0 -64
  662. package/packages/gsd-agent-modes/src/modes/interactive/components/timestamp.ts +0 -48
  663. package/packages/gsd-agent-modes/src/modes/interactive/components/tool-execution.ts +0 -1157
  664. package/packages/gsd-agent-modes/src/modes/interactive/components/tree-render-utils.ts +0 -81
  665. package/packages/gsd-agent-modes/src/modes/interactive/components/tree-selector.ts +0 -1208
  666. package/packages/gsd-agent-modes/src/modes/interactive/components/user-message-selector.ts +0 -145
  667. package/packages/gsd-agent-modes/src/modes/interactive/components/user-message.ts +0 -44
  668. package/packages/gsd-agent-modes/src/modes/interactive/components/visual-truncate.ts +0 -50
  669. package/packages/gsd-agent-modes/src/modes/interactive/controllers/chat-controller-ordering.test.ts +0 -1430
  670. package/packages/gsd-agent-modes/src/modes/interactive/controllers/chat-controller.test.ts +0 -71
  671. package/packages/gsd-agent-modes/src/modes/interactive/controllers/chat-controller.ts +0 -957
  672. package/packages/gsd-agent-modes/src/modes/interactive/controllers/extension-ui-controller.ts +0 -63
  673. package/packages/gsd-agent-modes/src/modes/interactive/controllers/input-controller.test.ts +0 -183
  674. package/packages/gsd-agent-modes/src/modes/interactive/controllers/input-controller.ts +0 -140
  675. package/packages/gsd-agent-modes/src/modes/interactive/controllers/model-controller.ts +0 -77
  676. package/packages/gsd-agent-modes/src/modes/interactive/interactive-mode-ordering.test.ts +0 -44
  677. package/packages/gsd-agent-modes/src/modes/interactive/interactive-mode-state.ts +0 -49
  678. package/packages/gsd-agent-modes/src/modes/interactive/interactive-mode.ts +0 -4195
  679. package/packages/gsd-agent-modes/src/modes/interactive/slash-command-handlers.ts +0 -670
  680. package/packages/gsd-agent-modes/src/modes/interactive/utils/shorten-path.ts +0 -14
  681. package/packages/gsd-agent-modes/src/modes/print-mode.ts +0 -106
  682. package/packages/gsd-agent-modes/src/modes/rpc/jsonl.ts +0 -58
  683. package/packages/gsd-agent-modes/src/modes/rpc/remote-terminal.ts +0 -109
  684. package/packages/gsd-agent-modes/src/modes/rpc/rpc-client.ts +0 -572
  685. package/packages/gsd-agent-modes/src/modes/rpc/rpc-mode.ts +0 -902
  686. package/packages/gsd-agent-modes/src/modes/rpc/rpc-protocol-v2.test.ts +0 -971
  687. package/packages/gsd-agent-modes/src/modes/rpc/rpc-types.ts +0 -335
  688. package/packages/gsd-agent-modes/src/modes/shared/command-context-actions.ts +0 -53
  689. package/packages/gsd-agent-modes/src/pi-coding-agent-compat.ts +0 -42
  690. package/packages/gsd-agent-modes/src/pi-tui-compat.ts +0 -4
  691. package/packages/gsd-agent-modes/src/theme.ts +0 -25
  692. package/packages/gsd-agent-modes/src/utils/theme.ts +0 -24
  693. package/packages/gsd-agent-modes/tsconfig.json +0 -28
  694. package/packages/gsd-agent-modes/tsconfig.tsbuildinfo +0 -1
  695. package/packages/gsd-agent-types/dist/index.d.ts +0 -176
  696. package/packages/gsd-agent-types/dist/index.d.ts.map +0 -1
  697. package/packages/gsd-agent-types/dist/index.js +0 -24
  698. package/packages/gsd-agent-types/dist/index.js.map +0 -1
  699. package/packages/gsd-agent-types/package.json +0 -24
  700. package/packages/gsd-agent-types/src/index.ts +0 -206
  701. package/packages/gsd-agent-types/tsconfig.json +0 -25
  702. package/packages/gsd-agent-types/tsconfig.tsbuildinfo +0 -1
  703. package/packages/native/dist/tsconfig.tsbuildinfo +0 -1
  704. package/scripts/install.js +0 -512
  705. package/src/resources/extensions/claude-code-cli/tests/provider-registration.test.ts +0 -27
  706. package/src/resources/extensions/gsd/tests/auto-start-clean-runtime-db-gated.test.ts +0 -63
  707. package/src/resources/extensions/gsd/tests/dispatch-guard-summary-db-mismatch.test.ts +0 -77
  708. /package/dist/web/standalone/.next/static/{gy6_foLMsEzdGBT19c3hr → pV-mPo7rYGb5JBC09C8GG}/_buildManifest.js +0 -0
  709. /package/dist/web/standalone/.next/static/{gy6_foLMsEzdGBT19c3hr → pV-mPo7rYGb5JBC09C8GG}/_ssgManifest.js +0 -0
@@ -1,1430 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { test } from "node:test";
3
-
4
- import { handleAgentEvent } from "./chat-controller.js";
5
-
6
- function makeUsage() {
7
- return {
8
- input: 0,
9
- output: 0,
10
- cacheRead: 0,
11
- cacheWrite: 0,
12
- totalTokens: 0,
13
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
14
- };
15
- }
16
-
17
- function makeAssistant(content: any[]) {
18
- return {
19
- role: "assistant",
20
- content,
21
- api: "anthropic-messages",
22
- provider: "claude-code",
23
- model: "claude-sonnet-4",
24
- usage: makeUsage(),
25
- stopReason: "stop",
26
- timestamp: Date.now(),
27
- };
28
- }
29
-
30
- function createHost() {
31
- const chatContainer = {
32
- children: [] as any[],
33
- addChild(component: any) {
34
- this.children.push(component);
35
- },
36
- removeChild(component: any) {
37
- const idx = this.children.indexOf(component);
38
- if (idx !== -1) this.children.splice(idx, 1);
39
- },
40
- clear() {
41
- this.children = [];
42
- },
43
- };
44
-
45
- const pinnedMessageContainer = {
46
- children: [] as any[],
47
- addChild(component: any) {
48
- this.children.push(component);
49
- },
50
- removeChild(component: any) {
51
- const idx = this.children.indexOf(component);
52
- if (idx !== -1) this.children.splice(idx, 1);
53
- },
54
- clear() {
55
- this.children = [];
56
- },
57
- };
58
-
59
- const host: any = {
60
- isInitialized: true,
61
- init: async () => {},
62
- defaultEditor: { onEscape: undefined },
63
- editor: {},
64
- session: { retryAttempt: 0, abortCompaction: () => {}, abortRetry: () => {} },
65
- // rows:1 keeps the pinned-zone off-screen-threshold at its floor (1) so
66
- // any rendered segment after a pinnable text block triggers the pin.
67
- // Real terminals are larger; see chat-controller rowsRenderedAfterContentIndex.
68
- ui: { requestRender: () => {}, terminal: { rows: 1, columns: 80 } },
69
- footer: { invalidate: () => {} },
70
- keybindings: {},
71
- statusContainer: { clear: () => {}, addChild: () => {} },
72
- chatContainer,
73
- settingsManager: { getTimestampFormat: () => "date-time-iso", getShowImages: () => false },
74
- pendingTools: new Map(),
75
- toolOutputExpanded: false,
76
- hideThinkingBlock: false,
77
- isBashMode: false,
78
- defaultWorkingMessage: "Working...",
79
- compactionQueuedMessages: [],
80
- editorContainer: {},
81
- pendingMessagesContainer: { clear: () => {} },
82
- pinnedMessageContainer,
83
- addMessageToChat: () => {},
84
- getMarkdownThemeWithSettings: () => ({}),
85
- formatWebSearchResult: () => "",
86
- getRegisteredToolDefinition: () => undefined,
87
- checkShutdownRequested: async () => {},
88
- rebuildChatFromMessages: () => {},
89
- flushCompactionQueue: async () => {},
90
- showStatus: () => {},
91
- showError: () => {},
92
- updatePendingMessagesDisplay: () => {},
93
- updateTerminalTitle: () => {},
94
- updateEditorBorderColor: () => {},
95
- };
96
-
97
- return host;
98
- }
99
-
100
- test("chat-controller renders content blocks in content[] index order (tool-first stream)", async () => {
101
- // ToolExecutionComponent uses the global theme singleton.
102
- // Install a minimal no-op theme implementation for this unit test.
103
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
104
- fg: (_key: string, text: string) => text,
105
- bg: (_key: string, text: string) => text,
106
- bold: (text: string) => text,
107
- italic: (text: string) => text,
108
- truncate: (text: string) => text,
109
- };
110
-
111
- const host = createHost();
112
- const toolId = "mcp-tool-1";
113
- const toolCall = {
114
- type: "toolCall",
115
- id: toolId,
116
- name: "exec_command",
117
- arguments: { cmd: "echo hi" },
118
- };
119
-
120
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
121
-
122
- assert.equal(host.chatContainer.children.length, 0, "nothing should render before content arrives");
123
-
124
- await handleAgentEvent(
125
- host,
126
- {
127
- type: "message_update",
128
- message: makeAssistant([toolCall]),
129
- assistantMessageEvent: {
130
- type: "toolcall_end",
131
- contentIndex: 0,
132
- toolCall: {
133
- ...toolCall,
134
- externalResult: {
135
- content: [{ type: "text", text: "tool output" }],
136
- details: {},
137
- isError: false,
138
- },
139
- },
140
- partial: makeAssistant([toolCall]),
141
- },
142
- } as any,
143
- );
144
-
145
- // content[0] = toolCall → ToolExecutionComponent renders first
146
- assert.equal(host.chatContainer.children.length, 1, "tool execution block should render immediately");
147
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "ToolExecutionComponent");
148
-
149
- host.getMarkdownThemeWithSettings = () => ({});
150
-
151
- await handleAgentEvent(
152
- host,
153
- {
154
- type: "message_update",
155
- message: makeAssistant([toolCall, { type: "text", text: "done" }]),
156
- assistantMessageEvent: {
157
- type: "text_delta",
158
- contentIndex: 1,
159
- delta: "done",
160
- partial: makeAssistant([toolCall, { type: "text", text: "done" }]),
161
- },
162
- } as any,
163
- );
164
-
165
- // content[0]=toolCall, content[1]=text → order: tool, then text
166
- assert.equal(host.chatContainer.children.length, 2, "text run should render after tool in content[] order");
167
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "ToolExecutionComponent");
168
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "AssistantMessageComponent");
169
- });
170
-
171
- test("chat-controller renders serverToolUse before trailing text matching content[] index order", async () => {
172
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
173
- fg: (_key: string, text: string) => text,
174
- bg: (_key: string, text: string) => text,
175
- bold: (text: string) => text,
176
- italic: (text: string) => text,
177
- truncate: (text: string) => text,
178
- };
179
-
180
- const host = createHost();
181
- const toolId = "mcp-secure-1";
182
- const serverToolUse = {
183
- type: "serverToolUse",
184
- id: toolId,
185
- name: "mcp__gsd-workflow__secure_env_collect",
186
- input: { projectDir: "/tmp/project", keys: [{ key: "SECURE_PASSWORD" }], destination: "dotenv" },
187
- };
188
-
189
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
190
-
191
- await handleAgentEvent(
192
- host,
193
- {
194
- type: "message_update",
195
- message: makeAssistant([serverToolUse]),
196
- assistantMessageEvent: {
197
- type: "server_tool_use",
198
- contentIndex: 0,
199
- partial: makeAssistant([serverToolUse]),
200
- },
201
- } as any,
202
- );
203
-
204
- // content[0] = serverToolUse → ToolExecutionComponent renders first
205
- assert.equal(host.chatContainer.children.length, 1, "server tool block should render immediately");
206
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "ToolExecutionComponent");
207
-
208
- host.getMarkdownThemeWithSettings = () => ({});
209
- const resultMessage = makeAssistant([
210
- {
211
- ...serverToolUse,
212
- externalResult: {
213
- content: [{ type: "text", text: "secure_env_collect was cancelled by user." }],
214
- details: {},
215
- isError: true,
216
- },
217
- },
218
- { type: "text", text: "The secure password collection was cancelled." },
219
- ]);
220
-
221
- await handleAgentEvent(
222
- host,
223
- {
224
- type: "message_update",
225
- message: resultMessage,
226
- assistantMessageEvent: {
227
- type: "server_tool_use",
228
- contentIndex: 0,
229
- partial: resultMessage,
230
- },
231
- } as any,
232
- );
233
-
234
- // content[0]=serverToolUse, content[1]=text → order: tool, then text
235
- assert.equal(host.chatContainer.children.length, 2, "text run should render after server tool in content[] order");
236
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "ToolExecutionComponent");
237
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "AssistantMessageComponent");
238
- });
239
-
240
- test("chat-controller replays final message_end content when result adds unstreamed trailing text", async () => {
241
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
242
- fg: (_key: string, text: string) => text,
243
- bg: (_key: string, text: string) => text,
244
- bold: (text: string) => text,
245
- italic: (text: string) => text,
246
- truncate: (text: string) => text,
247
- };
248
-
249
- const host = createHost();
250
- host.getMarkdownThemeWithSettings = () => ({});
251
-
252
- const tool = {
253
- type: "toolCall",
254
- id: "mcp-end-replay-1",
255
- name: "read",
256
- mcpServer: "filesystem",
257
- arguments: { filePath: "/tmp/demo.txt" },
258
- };
259
-
260
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
261
-
262
- const streamedContent = [
263
- tool,
264
- { type: "thinking", thinking: "I am analyzing tool output..." },
265
- ];
266
- await handleAgentEvent(
267
- host,
268
- {
269
- type: "message_update",
270
- message: makeAssistant(streamedContent),
271
- assistantMessageEvent: {
272
- type: "thinking_delta",
273
- contentIndex: 1,
274
- delta: "I am analyzing tool output...",
275
- partial: makeAssistant(streamedContent),
276
- },
277
- } as any,
278
- );
279
-
280
- assert.equal(host.chatContainer.children.length, 2, "streaming shows tool + thinking only");
281
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "ToolExecutionComponent");
282
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "AssistantMessageComponent");
283
-
284
- // Final payload includes trailing text that never arrived as message_update.
285
- const finalContent = [
286
- tool,
287
- { type: "thinking", thinking: "I am analyzing tool output..." },
288
- { type: "text", text: "Correct anything important I missed?" },
289
- ];
290
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant(finalContent) } as any);
291
-
292
- assert.equal(host.chatContainer.children.length, 3, "message_end should replay and include trailing text segment");
293
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "ToolExecutionComponent");
294
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "AssistantMessageComponent");
295
- assert.equal(host.chatContainer.children[2]?.constructor?.name, "AssistantMessageComponent");
296
- });
297
-
298
- test("chat-controller keeps pre-tool prose visible until post-tool prose arrives, then prunes it", async () => {
299
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
300
- fg: (_key: string, text: string) => text,
301
- bg: (_key: string, text: string) => text,
302
- bold: (text: string) => text,
303
- italic: (text: string) => text,
304
- truncate: (text: string) => text,
305
- };
306
-
307
- const host = createHost();
308
- host.getMarkdownThemeWithSettings = () => ({});
309
-
310
- const mcpTool = {
311
- type: "toolCall",
312
- id: "mcp-tool-1",
313
- name: "read",
314
- mcpServer: "filesystem",
315
- arguments: { filePath: "/tmp/demo.txt" },
316
- };
317
-
318
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
319
-
320
- // Provisional assistant text arrives first.
321
- await handleAgentEvent(
322
- host,
323
- {
324
- type: "message_update",
325
- message: makeAssistant([{ type: "text", text: "Let me inspect the workspace first." }]),
326
- assistantMessageEvent: {
327
- type: "text_delta",
328
- contentIndex: 0,
329
- delta: "Let me inspect the workspace first.",
330
- partial: makeAssistant([{ type: "text", text: "Let me inspect the workspace first." }]),
331
- },
332
- } as any,
333
- );
334
- assert.equal(host.chatContainer.children.length, 1);
335
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "AssistantMessageComponent");
336
-
337
- // MCP tool appears; provisional text should remain visible until post-tool prose exists.
338
- await handleAgentEvent(
339
- host,
340
- {
341
- type: "message_update",
342
- message: makeAssistant([{ type: "text", text: "Let me inspect the workspace first." }, mcpTool]),
343
- assistantMessageEvent: {
344
- type: "toolcall_end",
345
- contentIndex: 1,
346
- toolCall: {
347
- ...mcpTool,
348
- externalResult: {
349
- content: [{ type: "text", text: "file preview" }],
350
- details: {},
351
- isError: false,
352
- },
353
- },
354
- partial: makeAssistant([{ type: "text", text: "Let me inspect the workspace first." }, mcpTool]),
355
- },
356
- } as any,
357
- );
358
- assert.equal(host.chatContainer.children.length, 2, "pre-tool prose should remain during tool-only window");
359
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "AssistantMessageComponent");
360
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "ToolExecutionComponent");
361
-
362
- // Post-tool prose arrives: pre-tool prose should now be pruned.
363
- const finalContent = [
364
- { type: "text", text: "Let me inspect the workspace first." },
365
- mcpTool,
366
- { type: "text", text: "Which missing feature matters most to you?" },
367
- ];
368
- await handleAgentEvent(
369
- host,
370
- {
371
- type: "message_update",
372
- message: makeAssistant(finalContent),
373
- assistantMessageEvent: {
374
- type: "text_delta",
375
- contentIndex: 2,
376
- delta: "Which missing feature matters most to you?",
377
- partial: makeAssistant(finalContent),
378
- },
379
- } as any,
380
- );
381
- assert.equal(host.chatContainer.children.length, 2);
382
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "ToolExecutionComponent");
383
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "AssistantMessageComponent");
384
-
385
- // Finalize to tear down any pinned spinner state.
386
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant(finalContent) } as any);
387
- });
388
-
389
- test("chat-controller keeps pre-tool thinking visible for claude-code MCP turns without post-tool prose", async () => {
390
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
391
- fg: (_key: string, text: string) => text,
392
- bg: (_key: string, text: string) => text,
393
- bold: (text: string) => text,
394
- italic: (text: string) => text,
395
- truncate: (text: string) => text,
396
- };
397
-
398
- const host = createHost();
399
- host.getMarkdownThemeWithSettings = () => ({});
400
-
401
- const mcpTool = {
402
- type: "toolCall",
403
- id: "mcp-tool-thinking-1",
404
- name: "read",
405
- mcpServer: "filesystem",
406
- arguments: { filePath: "/tmp/demo.txt" },
407
- };
408
-
409
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
410
-
411
- const thinkingOnly = [{ type: "thinking", thinking: "I should inspect the workspace." }];
412
- await handleAgentEvent(
413
- host,
414
- {
415
- type: "message_update",
416
- message: makeAssistant(thinkingOnly),
417
- assistantMessageEvent: {
418
- type: "thinking_delta",
419
- contentIndex: 0,
420
- delta: "I should inspect the workspace.",
421
- partial: makeAssistant(thinkingOnly),
422
- },
423
- } as any,
424
- );
425
- assert.equal(host.chatContainer.children.length, 1);
426
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "AssistantMessageComponent");
427
-
428
- await handleAgentEvent(
429
- host,
430
- {
431
- type: "message_update",
432
- message: makeAssistant([thinkingOnly[0], mcpTool]),
433
- assistantMessageEvent: {
434
- type: "toolcall_end",
435
- contentIndex: 1,
436
- toolCall: {
437
- ...mcpTool,
438
- externalResult: {
439
- content: [{ type: "text", text: "file preview" }],
440
- details: {},
441
- isError: false,
442
- },
443
- },
444
- partial: makeAssistant([thinkingOnly[0], mcpTool]),
445
- },
446
- } as any,
447
- );
448
-
449
- assert.equal(host.chatContainer.children.length, 2, "thinking should remain visible while only tool output is present");
450
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "AssistantMessageComponent");
451
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "ToolExecutionComponent");
452
-
453
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant([thinkingOnly[0], mcpTool]) } as any);
454
- });
455
-
456
- test("chat-controller keeps pre-tool question text for claude-code MCP when post-tool prose exists", async () => {
457
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
458
- fg: (_key: string, text: string) => text,
459
- bg: (_key: string, text: string) => text,
460
- bold: (text: string) => text,
461
- italic: (text: string) => text,
462
- truncate: (text: string) => text,
463
- };
464
-
465
- const host = createHost();
466
- host.getMarkdownThemeWithSettings = () => ({});
467
-
468
- const mcpTool = {
469
- type: "toolCall",
470
- id: "mcp-tool-question-1",
471
- name: "glob",
472
- mcpServer: "filesystem",
473
- arguments: { pattern: "**/*" },
474
- };
475
-
476
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
477
-
478
- const questionText = { type: "text", text: "Which file should I inspect?" };
479
-
480
- await handleAgentEvent(
481
- host,
482
- {
483
- type: "message_update",
484
- message: makeAssistant([questionText]),
485
- assistantMessageEvent: {
486
- type: "text_delta",
487
- contentIndex: 0,
488
- delta: questionText.text,
489
- partial: makeAssistant([questionText]),
490
- },
491
- } as any,
492
- );
493
-
494
- await handleAgentEvent(
495
- host,
496
- {
497
- type: "message_update",
498
- message: makeAssistant([questionText, mcpTool]),
499
- assistantMessageEvent: {
500
- type: "toolcall_end",
501
- contentIndex: 1,
502
- toolCall: {
503
- ...mcpTool,
504
- externalResult: {
505
- content: [{ type: "text", text: "glob output" }],
506
- details: {},
507
- isError: false,
508
- },
509
- },
510
- partial: makeAssistant([questionText, mcpTool]),
511
- },
512
- } as any,
513
- );
514
-
515
- const postTool = { type: "text", text: "I'll review that next." };
516
- const finalContent = [questionText, mcpTool, postTool];
517
- await handleAgentEvent(
518
- host,
519
- {
520
- type: "message_update",
521
- message: makeAssistant(finalContent),
522
- assistantMessageEvent: {
523
- type: "text_delta",
524
- contentIndex: 2,
525
- delta: postTool.text,
526
- partial: makeAssistant(finalContent),
527
- },
528
- } as any,
529
- );
530
-
531
- assert.equal(host.chatContainer.children.length, 3, "question text should remain alongside MCP tool and post-tool prose");
532
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "AssistantMessageComponent", "pre-tool question stays visible");
533
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "ToolExecutionComponent", "tool renders in the middle");
534
- assert.equal(host.chatContainer.children[2]?.constructor?.name, "AssistantMessageComponent", "post-tool prose renders last");
535
-
536
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant(finalContent) } as any);
537
- });
538
-
539
- test("chat-controller prunes orphaned provisional text after claude-code sub-turn shrink when MCP tools appear", async () => {
540
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
541
- fg: (_key: string, text: string) => text,
542
- bg: (_key: string, text: string) => text,
543
- bold: (text: string) => text,
544
- italic: (text: string) => text,
545
- truncate: (text: string) => text,
546
- };
547
-
548
- const host = createHost();
549
- host.getMarkdownThemeWithSettings = () => ({});
550
-
551
- const mcpTool = {
552
- type: "toolCall",
553
- id: "mcp-tool-shrink-1",
554
- name: "glob",
555
- mcpServer: "filesystem",
556
- arguments: { pattern: "**/*" },
557
- };
558
-
559
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
560
-
561
- // Sub-turn 1: generate longer provisional text content.
562
- await handleAgentEvent(
563
- host,
564
- {
565
- type: "message_update",
566
- message: makeAssistant([{ type: "text", text: "Old provisional preface." }, { type: "text", text: "More old text." }]),
567
- assistantMessageEvent: {
568
- type: "text_delta",
569
- contentIndex: 1,
570
- delta: "More old text.",
571
- partial: makeAssistant([{ type: "text", text: "Old provisional preface." }, { type: "text", text: "More old text." }]),
572
- },
573
- } as any,
574
- );
575
- assert.equal(host.chatContainer.children.length, 1, "first sub-turn text run should render");
576
-
577
- // Sub-turn 2 starts (content shrink): old component is orphaned by design.
578
- await handleAgentEvent(
579
- host,
580
- {
581
- type: "message_update",
582
- message: makeAssistant([{ type: "text", text: "New provisional text before tool." }]),
583
- assistantMessageEvent: {
584
- type: "text_delta",
585
- contentIndex: 0,
586
- delta: "New provisional text before tool.",
587
- partial: makeAssistant([{ type: "text", text: "New provisional text before tool." }]),
588
- },
589
- } as any,
590
- );
591
- assert.equal(host.chatContainer.children.length, 2, "shrink keeps prior text until MCP tool context appears");
592
-
593
- // MCP tool appears in sub-turn 2: tool-only windows keep provisional prose visible.
594
- await handleAgentEvent(
595
- host,
596
- {
597
- type: "message_update",
598
- message: makeAssistant([{ type: "text", text: "New provisional text before tool." }, mcpTool]),
599
- assistantMessageEvent: {
600
- type: "toolcall_end",
601
- contentIndex: 1,
602
- toolCall: {
603
- ...mcpTool,
604
- externalResult: {
605
- content: [{ type: "text", text: "glob output" }],
606
- details: {},
607
- isError: false,
608
- },
609
- },
610
- partial: makeAssistant([{ type: "text", text: "New provisional text before tool." }, mcpTool]),
611
- },
612
- } as any,
613
- );
614
- assert.equal(host.chatContainer.children.length, 3, "stale text runs are deferred until post-tool prose arrives");
615
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "AssistantMessageComponent");
616
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "AssistantMessageComponent");
617
- assert.equal(host.chatContainer.children[2]?.constructor?.name, "ToolExecutionComponent");
618
-
619
- const finalContent = [mcpTool, { type: "text", text: "Final visible question?" }];
620
- await handleAgentEvent(
621
- host,
622
- {
623
- type: "message_update",
624
- message: makeAssistant(finalContent),
625
- assistantMessageEvent: {
626
- type: "text_delta",
627
- contentIndex: 1,
628
- delta: "Final visible question?",
629
- partial: makeAssistant(finalContent),
630
- },
631
- } as any,
632
- );
633
- assert.equal(host.chatContainer.children.length, 2);
634
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "ToolExecutionComponent");
635
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "AssistantMessageComponent");
636
-
637
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant(finalContent) } as any);
638
- });
639
-
640
- test("chat-controller prunes orphans from multiple sub-turn shrinks before MCP post-tool prose", async () => {
641
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
642
- fg: (_key: string, text: string) => text,
643
- bg: (_key: string, text: string) => text,
644
- bold: (text: string) => text,
645
- italic: (text: string) => text,
646
- truncate: (text: string) => text,
647
- };
648
-
649
- const host = createHost();
650
- host.getMarkdownThemeWithSettings = () => ({});
651
-
652
- const mcpTool = {
653
- type: "toolCall",
654
- id: "mcp-tool-multi-shrink-1",
655
- name: "glob",
656
- mcpServer: "filesystem",
657
- arguments: { pattern: "**/*" },
658
- };
659
-
660
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
661
-
662
- // Sub-turn 1: 3 text blocks (merged into one text-run).
663
- const subTurn1 = [
664
- { type: "text", text: "First provisional A." },
665
- { type: "text", text: "First provisional B." },
666
- { type: "text", text: "First provisional C." },
667
- ];
668
- await handleAgentEvent(
669
- host,
670
- {
671
- type: "message_update",
672
- message: makeAssistant(subTurn1),
673
- assistantMessageEvent: {
674
- type: "text_delta",
675
- contentIndex: 2,
676
- delta: "First provisional C.",
677
- partial: makeAssistant(subTurn1),
678
- },
679
- } as any,
680
- );
681
- assert.equal(host.chatContainer.children.length, 1, "first sub-turn renders 1 text-run");
682
-
683
- // Sub-turn 2 (first shrink 3 → 2 blocks).
684
- const subTurn2 = [
685
- { type: "text", text: "Second provisional A." },
686
- { type: "text", text: "Second provisional B." },
687
- ];
688
- await handleAgentEvent(
689
- host,
690
- {
691
- type: "message_update",
692
- message: makeAssistant(subTurn2),
693
- assistantMessageEvent: {
694
- type: "text_delta",
695
- contentIndex: 1,
696
- delta: "Second provisional B.",
697
- partial: makeAssistant(subTurn2),
698
- },
699
- } as any,
700
- );
701
- assert.equal(host.chatContainer.children.length, 2, "first shrink appends, keeps prior text as frozen history");
702
-
703
- // Sub-turn 3 (second shrink 2 → 1 block). This is the critical step —
704
- // without orphan accumulation, sub-turn 1's orphaned segment would be
705
- // dropped from tracking here and later strand in the container.
706
- const subTurn3 = [{ type: "text", text: "Third provisional." }];
707
- await handleAgentEvent(
708
- host,
709
- {
710
- type: "message_update",
711
- message: makeAssistant(subTurn3),
712
- assistantMessageEvent: {
713
- type: "text_delta",
714
- contentIndex: 0,
715
- delta: "Third provisional.",
716
- partial: makeAssistant(subTurn3),
717
- },
718
- } as any,
719
- );
720
- assert.equal(host.chatContainer.children.length, 3, "second shrink appends again, still no prune (no post-tool text)");
721
-
722
- // MCP tool appears — tool-only window still keeps provisional prose visible.
723
- await handleAgentEvent(
724
- host,
725
- {
726
- type: "message_update",
727
- message: makeAssistant([{ type: "text", text: "Third provisional." }, mcpTool]),
728
- assistantMessageEvent: {
729
- type: "toolcall_end",
730
- contentIndex: 1,
731
- toolCall: {
732
- ...mcpTool,
733
- externalResult: {
734
- content: [{ type: "text", text: "glob output" }],
735
- details: {},
736
- isError: false,
737
- },
738
- },
739
- partial: makeAssistant([{ type: "text", text: "Third provisional." }, mcpTool]),
740
- },
741
- } as any,
742
- );
743
- assert.equal(host.chatContainer.children.length, 4, "tool-only window keeps all three provisional text-runs");
744
-
745
- // Final post-tool text arrives — prune must drop ALL three pre-tool
746
- // provisional text-runs across both shrinks, leaving only tool + final text.
747
- const finalContent = [mcpTool, { type: "text", text: "Final answer." }];
748
- await handleAgentEvent(
749
- host,
750
- {
751
- type: "message_update",
752
- message: makeAssistant(finalContent),
753
- assistantMessageEvent: {
754
- type: "text_delta",
755
- contentIndex: 1,
756
- delta: "Final answer.",
757
- partial: makeAssistant(finalContent),
758
- },
759
- } as any,
760
- );
761
- assert.equal(
762
- host.chatContainer.children.length,
763
- 2,
764
- "all pre-tool provisional segments from every shrink must be pruned once post-tool prose arrives",
765
- );
766
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "ToolExecutionComponent");
767
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "AssistantMessageComponent");
768
-
769
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant(finalContent) } as any);
770
- });
771
-
772
- test("chat-controller pins latest assistant text above editor when tool calls are present", async () => {
773
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
774
- fg: (_key: string, text: string) => text,
775
- bg: (_key: string, text: string) => text,
776
- bold: (text: string) => text,
777
- italic: (text: string) => text,
778
- truncate: (text: string) => text,
779
- };
780
-
781
- const host = createHost();
782
- const toolId = "tool-pin-1";
783
- const toolCall = {
784
- type: "toolCall",
785
- id: toolId,
786
- name: "exec_command",
787
- arguments: { cmd: "echo hi" },
788
- };
789
-
790
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
791
-
792
- assert.equal(host.pinnedMessageContainer.children.length, 0, "pinned zone should be empty at message_start");
793
-
794
- // Send a message with text followed by a tool call
795
- host.getMarkdownThemeWithSettings = () => ({});
796
- await handleAgentEvent(
797
- host,
798
- {
799
- type: "message_update",
800
- message: makeAssistant([
801
- { type: "text", text: "Looking at the files now." },
802
- toolCall,
803
- ]),
804
- assistantMessageEvent: {
805
- type: "toolcall_end",
806
- contentIndex: 1,
807
- toolCall: {
808
- ...toolCall,
809
- externalResult: {
810
- content: [{ type: "text", text: "file contents" }],
811
- details: {},
812
- isError: false,
813
- },
814
- },
815
- partial: makeAssistant([{ type: "text", text: "Looking at the files now." }, toolCall]),
816
- },
817
- } as any,
818
- );
819
-
820
- // Pinned zone should now have a DynamicBorder and a Markdown component
821
- assert.equal(host.pinnedMessageContainer.children.length, 2, "pinned zone should have border + markdown");
822
- assert.equal(host.pinnedMessageContainer.children[0]?.constructor?.name, "DynamicBorder");
823
- assert.equal(host.pinnedMessageContainer.children[1]?.constructor?.name, "Markdown");
824
- });
825
-
826
- test("chat-controller clears pinned zone when a new assistant message starts", async () => {
827
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
828
- fg: (_key: string, text: string) => text,
829
- bg: (_key: string, text: string) => text,
830
- bold: (text: string) => text,
831
- italic: (text: string) => text,
832
- truncate: (text: string) => text,
833
- };
834
-
835
- const host = createHost();
836
- const toolCall = {
837
- type: "toolCall",
838
- id: "tool-clear-1",
839
- name: "exec_command",
840
- arguments: { cmd: "echo hi" },
841
- };
842
-
843
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
844
-
845
- // Populate the pinned zone
846
- host.getMarkdownThemeWithSettings = () => ({});
847
- await handleAgentEvent(
848
- host,
849
- {
850
- type: "message_update",
851
- message: makeAssistant([{ type: "text", text: "Working on it." }, toolCall]),
852
- assistantMessageEvent: {
853
- type: "toolcall_end",
854
- contentIndex: 1,
855
- toolCall: {
856
- ...toolCall,
857
- externalResult: {
858
- content: [{ type: "text", text: "ok" }],
859
- details: {},
860
- isError: false,
861
- },
862
- },
863
- partial: makeAssistant([{ type: "text", text: "Working on it." }, toolCall]),
864
- },
865
- } as any,
866
- );
867
-
868
- assert.ok(host.pinnedMessageContainer.children.length > 0, "pinned zone should be populated");
869
-
870
- // Start a new assistant message — pinned zone should clear
871
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
872
-
873
- assert.equal(host.pinnedMessageContainer.children.length, 0, "pinned zone should clear on new assistant message");
874
- });
875
-
876
- test("chat-controller clears pinned zone when the agent turn ends", async () => {
877
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
878
- fg: (_key: string, text: string) => text,
879
- bg: (_key: string, text: string) => text,
880
- bold: (text: string) => text,
881
- italic: (text: string) => text,
882
- truncate: (text: string) => text,
883
- };
884
-
885
- const host = createHost();
886
- const toolCall = {
887
- type: "toolCall",
888
- id: "tool-clear-on-end-1",
889
- name: "exec_command",
890
- arguments: { cmd: "echo hi" },
891
- };
892
-
893
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
894
-
895
- host.getMarkdownThemeWithSettings = () => ({});
896
- await handleAgentEvent(
897
- host,
898
- {
899
- type: "message_update",
900
- message: makeAssistant([{ type: "text", text: "Working on it." }, toolCall]),
901
- assistantMessageEvent: {
902
- type: "toolcall_end",
903
- contentIndex: 1,
904
- toolCall: {
905
- ...toolCall,
906
- externalResult: {
907
- content: [{ type: "text", text: "ok" }],
908
- details: {},
909
- isError: false,
910
- },
911
- },
912
- partial: makeAssistant([{ type: "text", text: "Working on it." }, toolCall]),
913
- },
914
- } as any,
915
- );
916
-
917
- assert.ok(host.pinnedMessageContainer.children.length > 0, "pinned zone should be populated before agent_end");
918
-
919
- await handleAgentEvent(host, { type: "agent_end" } as any);
920
-
921
- assert.equal(host.pinnedMessageContainer.children.length, 0, "pinned zone should clear on agent_end");
922
- });
923
-
924
- test("chat-controller clears pinned zone when assistant message ends", async () => {
925
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
926
- fg: (_key: string, text: string) => text,
927
- bg: (_key: string, text: string) => text,
928
- bold: (text: string) => text,
929
- italic: (text: string) => text,
930
- truncate: (text: string) => text,
931
- };
932
-
933
- const host = createHost();
934
- const toolCall = {
935
- type: "toolCall",
936
- id: "tool-msg-end-1",
937
- name: "exec_command",
938
- arguments: { cmd: "echo hi" },
939
- };
940
-
941
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
942
-
943
- host.getMarkdownThemeWithSettings = () => ({});
944
- const msgContent = [{ type: "text", text: "Summary after tools." }, toolCall];
945
- await handleAgentEvent(
946
- host,
947
- {
948
- type: "message_update",
949
- message: makeAssistant(msgContent),
950
- assistantMessageEvent: {
951
- type: "toolcall_end",
952
- contentIndex: 1,
953
- toolCall: {
954
- ...toolCall,
955
- externalResult: {
956
- content: [{ type: "text", text: "ok" }],
957
- details: {},
958
- isError: false,
959
- },
960
- },
961
- partial: makeAssistant(msgContent),
962
- },
963
- } as any,
964
- );
965
-
966
- assert.ok(host.pinnedMessageContainer.children.length > 0, "pinned zone should be populated during streaming");
967
-
968
- // End the assistant message (e.g. before form elicitation) — pinned zone should clear
969
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant(msgContent) } as any);
970
-
971
- assert.equal(host.pinnedMessageContainer.children.length, 0, "pinned zone should clear on message_end to prevent duplicate display");
972
- });
973
-
974
- test("chat-controller does not pin when there are no tool calls", async () => {
975
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
976
- fg: (_key: string, text: string) => text,
977
- bg: (_key: string, text: string) => text,
978
- bold: (text: string) => text,
979
- italic: (text: string) => text,
980
- truncate: (text: string) => text,
981
- };
982
-
983
- const host = createHost();
984
-
985
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
986
-
987
- host.getMarkdownThemeWithSettings = () => ({});
988
- await handleAgentEvent(
989
- host,
990
- {
991
- type: "message_update",
992
- message: makeAssistant([{ type: "text", text: "Just some text, no tools." }]),
993
- assistantMessageEvent: {
994
- type: "text_delta",
995
- contentIndex: 0,
996
- delta: "Just some text, no tools.",
997
- partial: makeAssistant([{ type: "text", text: "Just some text, no tools." }]),
998
- },
999
- } as any,
1000
- );
1001
-
1002
- assert.equal(host.pinnedMessageContainer.children.length, 0, "pinned zone should stay empty without tool calls");
1003
- });
1004
-
1005
- // Regression test for issue #4144: interleaved text/tool content must render in content[] index order.
1006
- // Stream: [text "A", toolCall T1, text "B", toolCall T2, text "C"]
1007
- // Expected chatContainer order: textRun(A), toolExec(T1), textRun(B), toolExec(T2), textRun(C)
1008
- // Each AssistantMessageComponent must render ONLY its own text — no duplication after message_end.
1009
- test("chat-controller renders interleaved text and tool blocks in content[] index order (#4144)", async () => {
1010
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
1011
- fg: (_key: string, text: string) => text,
1012
- bg: (_key: string, text: string) => text,
1013
- bold: (text: string) => text,
1014
- italic: (text: string) => text,
1015
- truncate: (text: string) => text,
1016
- };
1017
-
1018
- const host = createHost();
1019
- host.getMarkdownThemeWithSettings = () => ({});
1020
-
1021
- const t1 = { type: "toolCall", id: "t1", name: "tool_one", arguments: {} };
1022
- const t2 = { type: "toolCall", id: "t2", name: "tool_two", arguments: {} };
1023
-
1024
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
1025
-
1026
- // Stream text "A" at index 0
1027
- await handleAgentEvent(host, {
1028
- type: "message_update",
1029
- message: makeAssistant([{ type: "text", text: "A" }]),
1030
- assistantMessageEvent: {
1031
- type: "text_delta",
1032
- contentIndex: 0,
1033
- delta: "A",
1034
- partial: makeAssistant([{ type: "text", text: "A" }]),
1035
- },
1036
- } as any);
1037
-
1038
- // Stream toolCall T1 at index 1
1039
- await handleAgentEvent(host, {
1040
- type: "message_update",
1041
- message: makeAssistant([{ type: "text", text: "A" }, t1]),
1042
- assistantMessageEvent: {
1043
- type: "toolcall_end",
1044
- contentIndex: 1,
1045
- toolCall: {
1046
- ...t1,
1047
- externalResult: { content: [{ type: "text", text: "result1" }], details: {}, isError: false },
1048
- },
1049
- partial: makeAssistant([{ type: "text", text: "A" }, t1]),
1050
- },
1051
- } as any);
1052
-
1053
- // Stream text "B" at index 2
1054
- await handleAgentEvent(host, {
1055
- type: "message_update",
1056
- message: makeAssistant([{ type: "text", text: "A" }, t1, { type: "text", text: "B" }]),
1057
- assistantMessageEvent: {
1058
- type: "text_delta",
1059
- contentIndex: 2,
1060
- delta: "B",
1061
- partial: makeAssistant([{ type: "text", text: "A" }, t1, { type: "text", text: "B" }]),
1062
- },
1063
- } as any);
1064
-
1065
- // Stream toolCall T2 at index 3
1066
- await handleAgentEvent(host, {
1067
- type: "message_update",
1068
- message: makeAssistant([{ type: "text", text: "A" }, t1, { type: "text", text: "B" }, t2]),
1069
- assistantMessageEvent: {
1070
- type: "toolcall_end",
1071
- contentIndex: 3,
1072
- toolCall: {
1073
- ...t2,
1074
- externalResult: { content: [{ type: "text", text: "result2" }], details: {}, isError: false },
1075
- },
1076
- partial: makeAssistant([{ type: "text", text: "A" }, t1, { type: "text", text: "B" }, t2]),
1077
- },
1078
- } as any);
1079
-
1080
- // Stream text "C" at index 4
1081
- const finalContent = [
1082
- { type: "text", text: "A" }, t1, { type: "text", text: "B" }, t2, { type: "text", text: "C" },
1083
- ];
1084
- await handleAgentEvent(host, {
1085
- type: "message_update",
1086
- message: makeAssistant(finalContent),
1087
- assistantMessageEvent: {
1088
- type: "text_delta",
1089
- contentIndex: 4,
1090
- delta: "C",
1091
- partial: makeAssistant(finalContent),
1092
- },
1093
- } as any);
1094
-
1095
- // Finalize — exercises the message_end path where a buggy setRange(undefined) would cause duplication
1096
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant(finalContent) } as any);
1097
-
1098
- // Assert interleaved order: textRun(A), toolExec(T1), textRun(B), toolExec(T2), textRun(C)
1099
- assert.equal(host.chatContainer.children.length, 5, "should have 5 children in interleaved order");
1100
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "AssistantMessageComponent", "index 0: text run A");
1101
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "ToolExecutionComponent", "index 1: tool T1");
1102
- assert.equal(host.chatContainer.children[2]?.constructor?.name, "AssistantMessageComponent", "index 2: text run B");
1103
- assert.equal(host.chatContainer.children[3]?.constructor?.name, "ToolExecutionComponent", "index 3: tool T2");
1104
- assert.equal(host.chatContainer.children[4]?.constructor?.name, "AssistantMessageComponent", "index 4: text run C");
1105
-
1106
- // Helper: collect the text of all Markdown children inside an AssistantMessageComponent.
1107
- // Structure: AssistantMessageComponent (Container) -> contentContainer (children[0]) -> Markdown nodes.
1108
- function getRenderedTexts(comp: any): string[] {
1109
- const contentContainer = comp.children?.[0];
1110
- if (!contentContainer) return [];
1111
- return (contentContainer.children ?? [])
1112
- .filter((c: any) => c.constructor?.name === "Markdown")
1113
- .map((c: any) => (c as any).text as string);
1114
- }
1115
-
1116
- // Each text-run component must contain only its own text — no cross-contamination after message_end
1117
- assert.deepEqual(getRenderedTexts(host.chatContainer.children[0]), ["A"], "text run A must contain only 'A'");
1118
- assert.deepEqual(getRenderedTexts(host.chatContainer.children[2]), ["B"], "text run B must contain only 'B'");
1119
- assert.deepEqual(getRenderedTexts(host.chatContainer.children[4]), ["C"], "text run C must contain only 'C'");
1120
- });
1121
-
1122
- test("chat-controller does not duplicate text when content is [text, tool, text] (interleaved stream)", async () => {
1123
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
1124
- fg: (_key: string, text: string) => text,
1125
- bg: (_key: string, text: string) => text,
1126
- bold: (text: string) => text,
1127
- italic: (text: string) => text,
1128
- truncate: (text: string) => text,
1129
- };
1130
-
1131
- const host = createHost();
1132
- host.getMarkdownThemeWithSettings = () => ({});
1133
-
1134
- const t1 = { type: "toolCall", id: "t1", name: "tool_one", arguments: {} };
1135
-
1136
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
1137
-
1138
- // Step 1: text "A" at index 0
1139
- await handleAgentEvent(host, {
1140
- type: "message_update",
1141
- message: makeAssistant([{ type: "text", text: "A" }]),
1142
- assistantMessageEvent: {
1143
- type: "text_delta",
1144
- contentIndex: 0,
1145
- delta: "A",
1146
- partial: makeAssistant([{ type: "text", text: "A" }]),
1147
- },
1148
- } as any);
1149
-
1150
- // Step 2: toolCall at index 1
1151
- await handleAgentEvent(host, {
1152
- type: "message_update",
1153
- message: makeAssistant([{ type: "text", text: "A" }, t1]),
1154
- assistantMessageEvent: {
1155
- type: "toolcall_end",
1156
- contentIndex: 1,
1157
- toolCall: {
1158
- ...t1,
1159
- externalResult: { content: [{ type: "text", text: "result1" }], details: {}, isError: false },
1160
- },
1161
- partial: makeAssistant([{ type: "text", text: "A" }, t1]),
1162
- },
1163
- } as any);
1164
-
1165
- // Step 3: text "B" at index 2
1166
- const finalContent = [{ type: "text", text: "A" }, t1, { type: "text", text: "B" }];
1167
- await handleAgentEvent(host, {
1168
- type: "message_update",
1169
- message: makeAssistant(finalContent),
1170
- assistantMessageEvent: {
1171
- type: "text_delta",
1172
- contentIndex: 2,
1173
- delta: "B",
1174
- partial: makeAssistant(finalContent),
1175
- },
1176
- } as any);
1177
-
1178
- assert.equal(host.chatContainer.children.length, 3);
1179
- assert.equal(host.chatContainer.children[0]?.constructor?.name, "AssistantMessageComponent");
1180
- assert.equal(host.chatContainer.children[1]?.constructor?.name, "ToolExecutionComponent");
1181
- assert.equal(host.chatContainer.children[2]?.constructor?.name, "AssistantMessageComponent");
1182
-
1183
- const firstText = host.chatContainer.children[0];
1184
- const secondText = host.chatContainer.children[2];
1185
- assert.notEqual(firstText, secondText, "text-before-tool and text-after-tool must be separate component instances");
1186
- assert.deepEqual((firstText as any).range, { startIndex: 0, endIndex: 0 }, "first text-run covers only content[0]");
1187
- assert.deepEqual((secondText as any).range, { startIndex: 2, endIndex: 2 }, "second text-run covers only content[2]");
1188
-
1189
- // Finalize — regression guard: range must NOT be cleared on message_end (would cause duplication)
1190
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant(finalContent) } as any);
1191
-
1192
- assert.deepEqual((secondText as any).range, { startIndex: 2, endIndex: 2 }, "range must not be cleared on message_end (would cause duplication)");
1193
- });
1194
-
1195
- // Regression for the claude-code sub-turn bug that followed #4144:
1196
- // an adapter can reset content[] back to 0/1 mid-lifecycle when a new provider
1197
- // sub-turn begins. The segment walker must NOT update prior-sub-turn text-run
1198
- // components in place (which would destroy earlier history) and must NOT reuse
1199
- // stale tool registrations for a new tool at the same contentIndex. Prior
1200
- // sub-turn children must stay frozen; new sub-turn segments must append after
1201
- // them, and the pinned "Latest Output" mirror must re-evaluate for the new sub-turn.
1202
- test("chat-controller freezes prior sub-turn and appends new segments when content shrinks", async () => {
1203
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
1204
- fg: (_key: string, text: string) => text,
1205
- bg: (_key: string, text: string) => text,
1206
- bold: (text: string) => text,
1207
- italic: (text: string) => text,
1208
- truncate: (text: string) => text,
1209
- };
1210
-
1211
- const host = createHost();
1212
- host.getMarkdownThemeWithSettings = () => ({});
1213
-
1214
- const t1 = { type: "toolCall", id: "t1", name: "tool_one", arguments: {} };
1215
- const t2 = { type: "toolCall", id: "t2", name: "tool_two", arguments: {} };
1216
-
1217
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
1218
-
1219
- // Sub-turn 1: grow to [A, T1, B]
1220
- await handleAgentEvent(host, {
1221
- type: "message_update",
1222
- message: makeAssistant([{ type: "text", text: "A" }]),
1223
- assistantMessageEvent: {
1224
- type: "text_delta", contentIndex: 0, delta: "A",
1225
- partial: makeAssistant([{ type: "text", text: "A" }]),
1226
- },
1227
- } as any);
1228
- await handleAgentEvent(host, {
1229
- type: "message_update",
1230
- message: makeAssistant([{ type: "text", text: "A" }, t1]),
1231
- assistantMessageEvent: {
1232
- type: "toolcall_end", contentIndex: 1,
1233
- toolCall: { ...t1, externalResult: { content: [{ type: "text", text: "r1" }], details: {}, isError: false } },
1234
- partial: makeAssistant([{ type: "text", text: "A" }, t1]),
1235
- },
1236
- } as any);
1237
- await handleAgentEvent(host, {
1238
- type: "message_update",
1239
- message: makeAssistant([{ type: "text", text: "A" }, t1, { type: "text", text: "B" }]),
1240
- assistantMessageEvent: {
1241
- type: "text_delta", contentIndex: 2, delta: "B",
1242
- partial: makeAssistant([{ type: "text", text: "A" }, t1, { type: "text", text: "B" }]),
1243
- },
1244
- } as any);
1245
-
1246
- assert.equal(host.chatContainer.children.length, 3, "sub-turn 1 renders 3 children");
1247
- const priorA = host.chatContainer.children[0];
1248
- const priorT1 = host.chatContainer.children[1];
1249
- const priorB = host.chatContainer.children[2];
1250
-
1251
- // Sub-turn boundary: adapter resets content[] to [C]
1252
- await handleAgentEvent(host, {
1253
- type: "message_update",
1254
- message: makeAssistant([{ type: "text", text: "C" }]),
1255
- assistantMessageEvent: {
1256
- type: "text_delta", contentIndex: 0, delta: "C",
1257
- partial: makeAssistant([{ type: "text", text: "C" }]),
1258
- },
1259
- } as any);
1260
-
1261
- // Prior 3 children must still exist in DOM — and a NEW text-run for "C" appended after them.
1262
- assert.equal(host.chatContainer.children.length, 4, "shrink must append new segment, not replace prior history");
1263
- assert.equal(host.chatContainer.children[0], priorA, "prior A component stays at index 0");
1264
- assert.equal(host.chatContainer.children[1], priorT1, "prior T1 component stays at index 1");
1265
- assert.equal(host.chatContainer.children[2], priorB, "prior B component stays at index 2");
1266
- assert.notEqual(host.chatContainer.children[3], priorA, "new C text-run must be a different component from prior A");
1267
- assert.equal(host.chatContainer.children[3]?.constructor?.name, "AssistantMessageComponent");
1268
-
1269
- // Prior A component must still render "A", not be overwritten with "C".
1270
- function getRenderedTexts(comp: any): string[] {
1271
- const contentContainer = comp.children?.[0];
1272
- if (!contentContainer) return [];
1273
- return (contentContainer.children ?? [])
1274
- .filter((c: any) => c.constructor?.name === "Markdown")
1275
- .map((c: any) => (c as any).text as string);
1276
- }
1277
- assert.deepEqual(getRenderedTexts(priorA), ["A"], "prior A text-run must still contain 'A' after shrink");
1278
- assert.deepEqual(getRenderedTexts(priorB), ["B"], "prior B text-run must still contain 'B' after shrink");
1279
- assert.deepEqual(getRenderedTexts(host.chatContainer.children[3]), ["C"], "new text-run must contain only 'C'");
1280
-
1281
- // Sub-turn 2 grows with a new tool T2 at contentIndex=1.
1282
- await handleAgentEvent(host, {
1283
- type: "message_update",
1284
- message: makeAssistant([{ type: "text", text: "C" }, t2]),
1285
- assistantMessageEvent: {
1286
- type: "toolcall_end", contentIndex: 1,
1287
- toolCall: { ...t2, externalResult: { content: [{ type: "text", text: "r2" }], details: {}, isError: false } },
1288
- partial: makeAssistant([{ type: "text", text: "C" }, t2]),
1289
- },
1290
- } as any);
1291
-
1292
- // T2 must be appended after the new C text-run, not conflated with the stale T1 registration.
1293
- assert.equal(host.chatContainer.children.length, 5, "new tool appends after new text-run");
1294
- assert.equal(host.chatContainer.children[4]?.constructor?.name, "ToolExecutionComponent");
1295
- assert.notEqual(host.chatContainer.children[4], priorT1, "new T2 must be a different component from prior T1");
1296
-
1297
- // Finalize so the module-level pinned spinner (setInterval) is torn down and the test process can exit.
1298
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant([{ type: "text", text: "C" }, t2]) } as any);
1299
- });
1300
-
1301
- // Regression: after a sub-turn shrink, lastPinnedText must be cleared so the
1302
- // pinned "Latest Output" mirror can display text from the new sub-turn instead
1303
- // of staying frozen on a stale snapshot (the "bottom green stays" symptom).
1304
- test("chat-controller updates pinned zone after sub-turn shrink", async () => {
1305
- (globalThis as any)[Symbol.for("@gsd/pi-coding-agent:theme")] = {
1306
- fg: (_key: string, text: string) => text,
1307
- bg: (_key: string, text: string) => text,
1308
- bold: (text: string) => text,
1309
- italic: (text: string) => text,
1310
- truncate: (text: string) => text,
1311
- };
1312
-
1313
- const host = createHost();
1314
- host.getMarkdownThemeWithSettings = () => ({});
1315
-
1316
- const t1 = { type: "toolCall", id: "t1", name: "tool_one", arguments: {} };
1317
- const t2 = { type: "toolCall", id: "t2", name: "tool_two", arguments: {} };
1318
-
1319
- await handleAgentEvent(host, { type: "message_start", message: makeAssistant([]) } as any);
1320
-
1321
- // Sub-turn 1 with pinnable text before a tool → populates pinned zone with "first".
1322
- await handleAgentEvent(host, {
1323
- type: "message_update",
1324
- message: makeAssistant([{ type: "text", text: "first" }, t1]),
1325
- assistantMessageEvent: {
1326
- type: "toolcall_end", contentIndex: 1,
1327
- toolCall: { ...t1, externalResult: { content: [{ type: "text", text: "r1" }], details: {}, isError: false } },
1328
- partial: makeAssistant([{ type: "text", text: "first" }, t1]),
1329
- },
1330
- } as any);
1331
- const pinnedMarkdown = host.pinnedMessageContainer.children[1];
1332
- assert.equal((pinnedMarkdown as any)?.text, "first", "pinned zone seeded with sub-turn 1 text");
1333
-
1334
- // Sub-turn boundary: content resets to [second, t2].
1335
- await handleAgentEvent(host, {
1336
- type: "message_update",
1337
- message: makeAssistant([{ type: "text", text: "second" }, t2]),
1338
- assistantMessageEvent: {
1339
- type: "toolcall_end", contentIndex: 1,
1340
- toolCall: { ...t2, externalResult: { content: [{ type: "text", text: "r2" }], details: {}, isError: false } },
1341
- partial: makeAssistant([{ type: "text", text: "second" }, t2]),
1342
- },
1343
- } as any);
1344
-
1345
- // Pinned markdown must now reflect the new sub-turn's text, not stay frozen on "first".
1346
- assert.equal((pinnedMarkdown as any)?.text, "second", "pinned zone must update after sub-turn shrink (#4144 regression)");
1347
-
1348
- // Finalize so the module-level pinned spinner (setInterval) is torn down and the test process can exit.
1349
- await handleAgentEvent(host, { type: "message_end", message: makeAssistant([{ type: "text", text: "second" }, t2]) } as any);
1350
- });
1351
-
1352
- test("chat-controller: agent_end without message_end must not remove streaming component from DOM (regression #4197)", async () => {
1353
- const host = createHost();
1354
-
1355
- await handleAgentEvent(host, {
1356
- type: "message_start",
1357
- message: makeAssistant([]),
1358
- } as any);
1359
-
1360
- // Simulate partial streaming that creates an AssistantMessageComponent
1361
- await handleAgentEvent(host, {
1362
- type: "message_update",
1363
- message: makeAssistant([{ type: "text", text: "partial answer" }]),
1364
- assistantMessageEvent: {
1365
- type: "text_delta",
1366
- contentIndex: 0,
1367
- delta: "partial answer",
1368
- partial: makeAssistant([{ type: "text", text: "partial answer" }]),
1369
- },
1370
- } as any);
1371
-
1372
- // Precondition: component is in DOM
1373
- assert.equal(
1374
- host.chatContainer.children.length,
1375
- 1,
1376
- "streaming component must be in DOM after message_update",
1377
- );
1378
- const comp = host.chatContainer.children[0];
1379
-
1380
- // Simulate abort: agent_end fires WITHOUT message_end
1381
- await handleAgentEvent(host, { type: "agent_end" } as any);
1382
-
1383
- assert.equal(
1384
- host.chatContainer.children.length,
1385
- 1,
1386
- "agent_end must NOT remove the streaming component from the DOM (issue #4197)",
1387
- );
1388
- assert.equal(
1389
- host.chatContainer.children[0],
1390
- comp,
1391
- "the same component instance must remain in the DOM after agent_end",
1392
- );
1393
- });
1394
-
1395
- test("chat-controller: agent_end after message_end must not alter DOM", async () => {
1396
- const host = createHost();
1397
- const content = [{ type: "text", text: "complete answer" }];
1398
-
1399
- await handleAgentEvent(host, {
1400
- type: "message_start",
1401
- message: makeAssistant([]),
1402
- } as any);
1403
-
1404
- await handleAgentEvent(host, {
1405
- type: "message_update",
1406
- message: makeAssistant(content),
1407
- assistantMessageEvent: {
1408
- type: "text_delta",
1409
- contentIndex: 0,
1410
- delta: "complete answer",
1411
- partial: makeAssistant(content),
1412
- },
1413
- } as any);
1414
-
1415
- await handleAgentEvent(host, {
1416
- type: "message_end",
1417
- message: makeAssistant(content),
1418
- } as any);
1419
-
1420
- const countAfterMessageEnd = host.chatContainer.children.length;
1421
- assert.ok(countAfterMessageEnd > 0, "component must be present after message_end");
1422
-
1423
- await handleAgentEvent(host, { type: "agent_end" } as any);
1424
-
1425
- assert.equal(
1426
- host.chatContainer.children.length,
1427
- countAfterMessageEnd,
1428
- "agent_end after message_end must not add or remove DOM nodes",
1429
- );
1430
- });