gsd-pi 2.80.0-dev.96f4d89d5 → 2.80.0-dev.b2a374d5b

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 (239) hide show
  1. package/dist/resources/.managed-resources-content-hash +1 -1
  2. package/dist/resources/GSD-WORKFLOW.md +2 -2
  3. package/dist/resources/extensions/gsd/auto/loop.js +32 -1
  4. package/dist/resources/extensions/gsd/auto/phases.js +37 -30
  5. package/dist/resources/extensions/gsd/auto-dispatch.js +10 -0
  6. package/dist/resources/extensions/gsd/auto-post-unit.js +10 -10
  7. package/dist/resources/extensions/gsd/auto-prompts.js +111 -1
  8. package/dist/resources/extensions/gsd/auto-recovery.js +154 -8
  9. package/dist/resources/extensions/gsd/auto-start.js +2 -3
  10. package/dist/resources/extensions/gsd/auto.js +16 -3
  11. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +32 -1
  12. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +129 -1
  13. package/dist/resources/extensions/gsd/clean-root-preflight.js +42 -4
  14. package/dist/resources/extensions/gsd/commands/dispatcher.js +5 -0
  15. package/dist/resources/extensions/gsd/commands-extract-learnings.js +17 -12
  16. package/dist/resources/extensions/gsd/crash-recovery.js +56 -10
  17. package/dist/resources/extensions/gsd/db-base-schema.js +14 -0
  18. package/dist/resources/extensions/gsd/db-migration-steps.js +16 -0
  19. package/dist/resources/extensions/gsd/detection.js +106 -0
  20. package/dist/resources/extensions/gsd/gsd-db.js +102 -2
  21. package/dist/resources/extensions/gsd/guided-flow.js +63 -12
  22. package/dist/resources/extensions/gsd/migrate/command.js +40 -1
  23. package/dist/resources/extensions/gsd/migration-auto-check.js +87 -0
  24. package/dist/resources/extensions/gsd/planning-path-scope.js +26 -0
  25. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +7 -8
  26. package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +1 -1
  27. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +3 -1
  28. package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  29. package/dist/resources/extensions/gsd/prompts/quick-task.md +1 -5
  30. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
  31. package/dist/resources/extensions/gsd/quick.js +34 -2
  32. package/dist/resources/extensions/gsd/safety/evidence-collector.js +10 -2
  33. package/dist/resources/extensions/gsd/tools/plan-slice.js +9 -0
  34. package/dist/resources/extensions/gsd/tools/plan-task.js +9 -0
  35. package/dist/resources/extensions/gsd/unit-runtime.js +11 -0
  36. package/dist/resources/extensions/gsd/worktree-manager.js +16 -14
  37. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  38. package/dist/web/standalone/.next/BUILD_ID +1 -1
  39. package/dist/web/standalone/.next/app-path-routes-manifest.json +13 -13
  40. package/dist/web/standalone/.next/build-manifest.json +2 -2
  41. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  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.html +1 -1
  51. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  52. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  53. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  54. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  55. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  56. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  57. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  58. package/dist/web/standalone/.next/server/app/index.html +1 -1
  59. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  60. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  61. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  62. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  63. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  64. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  65. package/dist/web/standalone/.next/server/app-paths-manifest.json +13 -13
  66. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  67. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  68. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  69. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  70. package/package.json +4 -2
  71. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  72. package/packages/pi-coding-agent/dist/core/agent-session.js +3 -0
  73. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  74. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +76 -0
  75. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  76. package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +11 -0
  77. package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
  78. package/packages/pi-coding-agent/dist/core/compaction/compaction.js +9 -0
  79. package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
  80. package/packages/pi-coding-agent/dist/core/compaction-threshold.test.d.ts +2 -0
  81. package/packages/pi-coding-agent/dist/core/compaction-threshold.test.d.ts.map +1 -0
  82. package/packages/pi-coding-agent/dist/core/compaction-threshold.test.js +103 -0
  83. package/packages/pi-coding-agent/dist/core/compaction-threshold.test.js.map +1 -0
  84. package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts +15 -0
  85. package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts.map +1 -0
  86. package/packages/pi-coding-agent/dist/core/db-snapshot.js +66 -0
  87. package/packages/pi-coding-agent/dist/core/db-snapshot.js.map +1 -0
  88. package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts +2 -0
  89. package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts.map +1 -0
  90. package/packages/pi-coding-agent/dist/core/db-snapshot.test.js +24 -0
  91. package/packages/pi-coding-agent/dist/core/db-snapshot.test.js.map +1 -0
  92. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +3 -0
  93. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  94. package/packages/pi-coding-agent/dist/core/extensions/runner.js +17 -1
  95. package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  96. package/packages/pi-coding-agent/dist/core/extensions/runner.test.js +99 -0
  97. package/packages/pi-coding-agent/dist/core/extensions/runner.test.js.map +1 -1
  98. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +7 -0
  99. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  100. package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  101. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +20 -0
  102. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  103. package/packages/pi-coding-agent/dist/core/settings-manager.js +25 -0
  104. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  105. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js +6 -4
  106. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js.map +1 -1
  107. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +50 -19
  108. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
  109. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js +2 -2
  110. package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js.map +1 -1
  111. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  112. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
  113. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
  114. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +2 -1
  115. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
  116. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +7 -6
  117. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js.map +1 -1
  118. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +13 -0
  119. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  120. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +77 -13
  121. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  122. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  123. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +68 -2
  124. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  125. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js +53 -0
  126. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js.map +1 -1
  127. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  128. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +3 -0
  129. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  130. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  131. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +36 -27
  132. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
  133. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js +21 -0
  134. package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js.map +1 -1
  135. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts +2 -0
  136. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts.map +1 -0
  137. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js +10 -0
  138. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js.map +1 -0
  139. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.d.ts.map +1 -1
  140. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js +3 -2
  141. package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js.map +1 -1
  142. package/packages/pi-coding-agent/src/core/agent-session.ts +3 -0
  143. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +89 -0
  144. package/packages/pi-coding-agent/src/core/compaction/compaction.ts +18 -0
  145. package/packages/pi-coding-agent/src/core/compaction-threshold.test.ts +121 -0
  146. package/packages/pi-coding-agent/src/core/db-snapshot.test.ts +32 -0
  147. package/packages/pi-coding-agent/src/core/db-snapshot.ts +66 -0
  148. package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +110 -0
  149. package/packages/pi-coding-agent/src/core/extensions/runner.ts +19 -1
  150. package/packages/pi-coding-agent/src/core/extensions/types.ts +7 -0
  151. package/packages/pi-coding-agent/src/core/settings-manager.ts +39 -1
  152. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.ts +7 -5
  153. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +68 -19
  154. package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.ts +2 -2
  155. package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +1 -0
  156. package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +2 -1
  157. package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +10 -9
  158. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +88 -13
  159. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +56 -0
  160. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +91 -3
  161. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +3 -0
  162. package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +36 -27
  163. package/packages/pi-coding-agent/src/modes/interactive/tui-mode.test.ts +25 -0
  164. package/packages/pi-coding-agent/src/resources/extensions/memory/storage-safety-guard.test.ts +14 -0
  165. package/packages/pi-coding-agent/src/resources/extensions/memory/storage.ts +3 -2
  166. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  167. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  168. package/packages/pi-tui/dist/tui.js +17 -7
  169. package/packages/pi-tui/dist/tui.js.map +1 -1
  170. package/packages/pi-tui/src/tui.ts +19 -7
  171. package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
  172. package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  173. package/pkg/dist/modes/interactive/theme/themes.js +36 -27
  174. package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
  175. package/src/resources/GSD-WORKFLOW.md +2 -2
  176. package/src/resources/extensions/gsd/auto/loop-deps.ts +1 -0
  177. package/src/resources/extensions/gsd/auto/loop.ts +50 -8
  178. package/src/resources/extensions/gsd/auto/phases.ts +42 -28
  179. package/src/resources/extensions/gsd/auto-dispatch.ts +17 -0
  180. package/src/resources/extensions/gsd/auto-post-unit.ts +10 -10
  181. package/src/resources/extensions/gsd/auto-prompts.ts +116 -1
  182. package/src/resources/extensions/gsd/auto-recovery.ts +153 -7
  183. package/src/resources/extensions/gsd/auto-start.ts +7 -6
  184. package/src/resources/extensions/gsd/auto.ts +23 -3
  185. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +39 -1
  186. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +135 -1
  187. package/src/resources/extensions/gsd/clean-root-preflight.ts +41 -3
  188. package/src/resources/extensions/gsd/commands/dispatcher.ts +6 -0
  189. package/src/resources/extensions/gsd/commands-extract-learnings.ts +17 -12
  190. package/src/resources/extensions/gsd/crash-recovery.ts +67 -10
  191. package/src/resources/extensions/gsd/db-base-schema.ts +15 -0
  192. package/src/resources/extensions/gsd/db-migration-steps.ts +17 -0
  193. package/src/resources/extensions/gsd/detection.ts +128 -0
  194. package/src/resources/extensions/gsd/gsd-db.ts +119 -1
  195. package/src/resources/extensions/gsd/guided-flow.ts +66 -12
  196. package/src/resources/extensions/gsd/migrate/command.ts +47 -1
  197. package/src/resources/extensions/gsd/migration-auto-check.ts +129 -0
  198. package/src/resources/extensions/gsd/planning-path-scope.ts +35 -0
  199. package/src/resources/extensions/gsd/prompts/complete-milestone.md +7 -8
  200. package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +1 -1
  201. package/src/resources/extensions/gsd/prompts/plan-milestone.md +3 -1
  202. package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
  203. package/src/resources/extensions/gsd/prompts/quick-task.md +1 -5
  204. package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
  205. package/src/resources/extensions/gsd/quick.ts +37 -2
  206. package/src/resources/extensions/gsd/safety/evidence-collector.ts +11 -2
  207. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +1 -1
  208. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +170 -1
  209. package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +88 -2
  210. package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +9 -0
  211. package/src/resources/extensions/gsd/tests/crash-handler-secondary.test.ts +55 -0
  212. package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +22 -0
  213. package/src/resources/extensions/gsd/tests/db-schema-metadata.test.ts +2 -2
  214. package/src/resources/extensions/gsd/tests/detection.test.ts +140 -0
  215. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +44 -0
  216. package/src/resources/extensions/gsd/tests/has-pending-deep-stage.test.ts +33 -1
  217. package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +48 -0
  218. package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +127 -0
  219. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +50 -0
  220. package/src/resources/extensions/gsd/tests/plan-task.test.ts +21 -0
  221. package/src/resources/extensions/gsd/tests/prompt-path-audit.test.ts +40 -0
  222. package/src/resources/extensions/gsd/tests/quick-external-gsd.test.ts +40 -0
  223. package/src/resources/extensions/gsd/tests/right-sized-workflow-prompts.test.ts +192 -0
  224. package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +29 -0
  225. package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +38 -0
  226. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +63 -2
  227. package/src/resources/extensions/gsd/tests/status-db-open.test.ts +9 -0
  228. package/src/resources/extensions/gsd/tests/unit-runtime.test.ts +7 -0
  229. package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +1 -1
  230. package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +37 -6
  231. package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +7 -0
  232. package/src/resources/extensions/gsd/tests/worktree-nested-git-safety.test.ts +9 -2
  233. package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +179 -0
  234. package/src/resources/extensions/gsd/tools/plan-slice.ts +13 -0
  235. package/src/resources/extensions/gsd/tools/plan-task.ts +10 -0
  236. package/src/resources/extensions/gsd/unit-runtime.ts +14 -0
  237. package/src/resources/extensions/gsd/worktree-manager.ts +15 -4
  238. /package/dist/web/standalone/.next/static/{y7d--cnc6Cibuva-Lzzw_ → FU0iL9dhdc2IBzEYBDOlY}/_buildManifest.js +0 -0
  239. /package/dist/web/standalone/.next/static/{y7d--cnc6Cibuva-Lzzw_ → FU0iL9dhdc2IBzEYBDOlY}/_ssgManifest.js +0 -0
@@ -1,7 +1,8 @@
1
+ // GSD-2 Interactive Tool Execution Rendering Tests
1
2
  import { describe, test } from "node:test";
2
3
  import assert from "node:assert/strict";
3
4
  import stripAnsi from "strip-ansi";
4
- import { ToolExecutionComponent } from "../tool-execution.js";
5
+ import { ToolExecutionComponent, ToolPhaseSummaryComponent } from "../tool-execution.js";
5
6
  import { initTheme } from "../../theme/theme.js";
6
7
  initTheme("dark", false);
7
8
  function renderTool(toolName, args, result, toolDefinition) {
@@ -18,25 +19,53 @@ function renderToolCollapsed(toolName, args, result, toolDefinition) {
18
19
  return stripAnsi(component.render(120).join("\n"));
19
20
  }
20
21
  describe("ToolExecutionComponent", () => {
21
- test("renders framed header with Running status while tool is partial", () => {
22
+ test("renders framed header with running status while tool is partial", () => {
22
23
  const rendered = renderToolCollapsed("mcp__demo__do_thing", { ok: true });
23
- assert.match(rendered, /Tool demo\u00b7do_thing/);
24
- assert.match(rendered, /Running/);
25
- assert.match(rendered, /Running · \d+(ms|s)/);
24
+ assert.match(rendered, /demo\u00b7do_thing/);
25
+ assert.doesNotMatch(rendered, /Tool demo\u00b7do_thing/);
26
+ assert.match(rendered, /running/);
27
+ assert.match(rendered, /running · \d+(ms|s)/);
26
28
  });
27
- test("renders framed header with Error status for failed tool result", () => {
29
+ test("renders framed header with failed status for failed tool result", () => {
28
30
  const rendered = renderTool("mcp__demo__do_thing", { ok: true }, { content: [{ type: "text", text: "boom" }], isError: true });
29
- assert.match(rendered, /Tool demo\u00b7do_thing/);
30
- assert.match(rendered, /Error/);
31
- assert.match(rendered, /Error · \d+(ms|s)/);
31
+ assert.match(rendered, /demo\u00b7do_thing/);
32
+ assert.doesNotMatch(rendered, /Tool demo\u00b7do_thing/);
33
+ assert.match(rendered, /failed/);
34
+ assert.match(rendered, /failed · \d+(ms|s)/);
32
35
  assert.match(rendered, /boom/);
33
36
  });
34
37
  test("collapses successful low-signal tool cards by default", () => {
35
38
  const rendered = renderToolCollapsed("mcp__demo__noop", { ok: true }, { content: [], isError: false });
36
- assert.match(rendered, /Done · \d+(ms|s)/);
37
- assert.match(rendered, /Completed/);
39
+ assert.match(rendered, /success · \d+(ms|s)/);
40
+ assert.match(rendered, /demo\u00b7noop/);
41
+ assert.doesNotMatch(rendered, /Completed/);
38
42
  assert.doesNotMatch(rendered, /ok=true/);
39
43
  });
44
+ test("exposes phase metadata for successful low-signal tool rows", () => {
45
+ const component = new ToolExecutionComponent("gsd_requirement_update", { id: "R001" }, {}, { label: "Update Requirement" }, { requestRender() { } });
46
+ component.updateResult({ content: [], isError: false });
47
+ assert.deepEqual(component.getRollupPhase()?.label, "Requirement writes");
48
+ });
49
+ test("exposes phase metadata for collapsed output-bearing generic tools", () => {
50
+ const component = new ToolExecutionComponent("mcp__demo__do_thing", { ok: true }, {}, undefined, { requestRender() { } });
51
+ component.updateResult({ content: [{ type: "text", text: "important output" }], isError: false });
52
+ assert.deepEqual(component.getRollupPhase()?.label, "Other tool actions");
53
+ });
54
+ test("renders phase-based summaries for rolled-up tool executions", () => {
55
+ const phases = [
56
+ { label: "Setup / shell", count: 6, durationMs: 12 },
57
+ { label: "Context reads", count: 4, durationMs: 6 },
58
+ { label: "Requirement writes", count: 4, durationMs: 4 },
59
+ { label: "Memory lookups", count: 4, durationMs: 4 },
60
+ { label: "Finalization", count: 1, durationMs: 1 },
61
+ ];
62
+ const rendered = stripAnsi(new ToolPhaseSummaryComponent(phases).render(120).join("\n"));
63
+ assert.match(rendered, /Setup \/ shell 6 actions\s+success · 12ms/);
64
+ assert.match(rendered, /Context reads 4 actions\s+success · 6ms/);
65
+ assert.match(rendered, /Requirement writes 4 actions\s+success · 4ms/);
66
+ assert.match(rendered, /Memory lookups 4 actions\s+success · 4ms/);
67
+ assert.match(rendered, /Finalization 1 action\s+success · 1ms/);
68
+ });
40
69
  test("passes failed result status to custom result renderers", () => {
41
70
  const rendered = renderTool("gsd_requirement_save", { id: "R001" }, { content: [{ type: "text", text: "saved" }], isError: true }, {
42
71
  label: "Save Requirement",
@@ -47,7 +76,7 @@ describe("ToolExecutionComponent", () => {
47
76
  };
48
77
  },
49
78
  });
50
- assert.match(rendered, /Error/);
79
+ assert.match(rendered, /failed/);
51
80
  assert.match(rendered, /custom saw error/);
52
81
  assert.doesNotMatch(rendered, /custom saw success/);
53
82
  });
@@ -80,12 +109,14 @@ describe("ToolExecutionComponent", () => {
80
109
  });
81
110
  test("frame header prefers toolDefinition.label over raw tool name", () => {
82
111
  const rendered = renderToolCollapsed("gsd_slice_complete", { sliceId: "S03" }, undefined, { label: "Complete Slice" });
83
- assert.match(rendered, /Tool Complete Slice/);
112
+ assert.match(rendered, /Complete Slice/);
113
+ assert.doesNotMatch(rendered, /Tool Complete Slice/);
84
114
  assert.doesNotMatch(rendered, /gsd_slice_complete/);
85
115
  });
86
116
  test("frame header strips gsd_ prefix and title-cases when no label is registered", () => {
87
117
  const rendered = renderToolCollapsed("gsd_requirement_update", { id: "R005" });
88
- assert.match(rendered, /Tool Requirement Update/);
118
+ assert.match(rendered, /Requirement Update/);
119
+ assert.doesNotMatch(rendered, /Tool Requirement Update/);
89
120
  assert.doesNotMatch(rendered, /gsd_requirement_update/);
90
121
  });
91
122
  test("formatCompactArgs truncates long string values inline instead of dumping JSON", () => {
@@ -109,13 +140,13 @@ describe("ToolExecutionComponent", () => {
109
140
  assert.match(rendered, new RegExp(longPath.replace(/\//g, "\\/")));
110
141
  assert.doesNotMatch(rendered, /…/);
111
142
  });
112
- test("generic fallback truncates long output when collapsed", () => {
143
+ test("generic fallback collapses successful output rows until expanded", () => {
113
144
  const longOutput = Array.from({ length: 25 }, (_, i) => `line ${i + 1}`).join("\n");
114
145
  const rendered = renderToolCollapsed("mcp__demo__do_thing", { ok: true }, { content: [{ type: "text", text: longOutput }], isError: false });
115
- assert.match(rendered, /line 1\b/);
116
- assert.match(rendered, /line 10\b/);
117
- assert.doesNotMatch(rendered, /line 20\b/);
118
- assert.match(rendered, /\(15 more lines/);
146
+ assert.match(rendered, /demo\u00b7do_thing/);
147
+ assert.match(rendered, /success · \d+(ms|s)/);
148
+ assert.doesNotMatch(rendered, /line 1\b/);
149
+ assert.doesNotMatch(rendered, /\(15 more lines/);
119
150
  });
120
151
  test("generic fallback falls back to truncated JSON for complex args", () => {
121
152
  const rendered = renderTool("mcp__demo__nested", { payload: { nested: { deeply: ["a", "b", "c"] } }, name: "x" });
@@ -1 +1 @@
1
- {"version":3,"file":"tool-execution.test.js","sourceRoot":"","sources":["../../../../../src/modes/interactive/components/__tests__/tool-execution.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEzB,SAAS,UAAU,CAClB,QAAgB,EAChB,IAA6B,EAC7B,MAIC,EACD,cAAiH;IAEjH,MAAM,SAAS,GAAG,IAAI,sBAAsB,CAC3C,QAAQ,EACR,IAAI,EACJ,EAAE,EACF,cAAqB,EACrB,EAAE,aAAa,KAAI,CAAC,EAAS,CAC7B,CAAC;IACF,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,MAAM;QAAE,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,SAAS,CAAC,SAAS,CAAC,MA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";\nimport stripAnsi from \"strip-ansi\";\nimport { ToolExecutionComponent } from \"../tool-execution.js\";\nimport { initTheme } from \"../../theme/theme.js\";\n\ninitTheme(\"dark\", false);\n\nfunction renderTool(\n\ttoolName: string,\n\targs: Record<string, unknown>,\n\tresult?: {\n\t\tcontent: Array<{ type: string; text?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: Record<string, unknown>;\n\t},\n\ttoolDefinition?: { label?: string; renderCall?: (...args: any[]) => any; renderResult?: (...args: any[]) => any },\n): string {\n\tconst component = new ToolExecutionComponent(\n\t\ttoolName,\n\t\targs,\n\t\t{},\n\t\ttoolDefinition as any,\n\t\t{ requestRender() {} } as any,\n\t);\n\tcomponent.setExpanded(true);\n\tif (result) component.updateResult(result);\n\treturn stripAnsi(component.render(120).join(\"\\n\"));\n}\n\nfunction renderToolCollapsed(\n\ttoolName: string,\n\targs: Record<string, unknown>,\n\tresult?: {\n\t\tcontent: Array<{ type: string; text?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: Record<string, unknown>;\n\t},\n\ttoolDefinition?: { label?: string; renderCall?: (...args: any[]) => any; renderResult?: (...args: any[]) => any },\n): string {\n\tconst component = new ToolExecutionComponent(\n\t\ttoolName,\n\t\targs,\n\t\t{},\n\t\ttoolDefinition as any,\n\t\t{ requestRender() {} } as any,\n\t);\n\tif (result) component.updateResult(result);\n\treturn stripAnsi(component.render(120).join(\"\\n\"));\n}\n\ndescribe(\"ToolExecutionComponent\", () => {\n\ttest(\"renders framed header with Running status while tool is partial\", () => {\n\t\tconst rendered = renderToolCollapsed(\"mcp__demo__do_thing\", { ok: true });\n\n\t\tassert.match(rendered, /Tool demo\\u00b7do_thing/);\n\t\tassert.match(rendered, /Running/);\n\t\tassert.match(rendered, /Running · \\d+(ms|s)/);\n\t});\n\n\ttest(\"renders framed header with Error status for failed tool result\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__demo__do_thing\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [{ type: \"text\", text: \"boom\" }], isError: true },\n\t\t);\n\n\t\tassert.match(rendered, /Tool demo\\u00b7do_thing/);\n\t\tassert.match(rendered, /Error/);\n\t\tassert.match(rendered, /Error · \\d+(ms|s)/);\n\t\tassert.match(rendered, /boom/);\n\t});\n\n\ttest(\"collapses successful low-signal tool cards by default\", () => {\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"mcp__demo__noop\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /Done · \\d+(ms|s)/);\n\t\tassert.match(rendered, /Completed/);\n\t\tassert.doesNotMatch(rendered, /ok=true/);\n\t});\n\n\ttest(\"passes failed result status to custom result renderers\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"gsd_requirement_save\",\n\t\t\t{ id: \"R001\" },\n\t\t\t{ content: [{ type: \"text\", text: \"saved\" }], isError: true },\n\t\t\t{\n\t\t\t\tlabel: \"Save Requirement\",\n\t\t\t\trenderResult(result: { isError?: boolean }) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trender: () => [result.isError ? \"custom saw error\" : \"custom saw success\"],\n\t\t\t\t\t\tinvalidate() {},\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\tassert.match(rendered, /Error/);\n\t\tassert.match(rendered, /custom saw error/);\n\t\tassert.doesNotMatch(rendered, /custom saw success/);\n\t});\n\n\ttest(\"renders capitalized Claude Code Bash tool names with bash output instead of generic args JSON\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"Bash\",\n\t\t\t{ command: \"pwd\" },\n\t\t\t{ content: [{ type: \"text\", text: \"/tmp/gsd-pr-fix\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /\\$ pwd/);\n\t\tassert.match(rendered, /\\/tmp\\/gsd-pr-fix/);\n\t\tassert.doesNotMatch(rendered, /^\\{\\s*\\}$/m);\n\t});\n\n\ttest(\"renders capitalized Claude Code Read tool names with read output\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"Read\",\n\t\t\t{ path: \"/tmp/demo.txt\" },\n\t\t\t{ content: [{ type: \"text\", text: \"hello\\nworld\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /read .*demo\\.txt/);\n\t\tassert.match(rendered, /hello/);\n\t\tassert.match(rendered, /world/);\n\t});\n\n\ttest(\"generic fallback strips mcp__<server>__ prefix and shows server·tool title\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__context7__resolve_library_id\",\n\t\t\t{ name: \"react\" },\n\t\t\t{ content: [{ type: \"text\", text: \"react@18.3.1\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /context7\\u00b7resolve_library_id/);\n\t\tassert.doesNotMatch(rendered, /mcp__/);\n\t\tassert.match(rendered, /name=\"react\"/);\n\t\tassert.match(rendered, /react@18\\.3\\.1/);\n\t});\n\n\ttest(\"generic fallback renders compact key=value args for primitive args\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"some_unknown_tool\",\n\t\t\t{ count: 3, enabled: true, label: \"hello\" },\n\t\t);\n\n\t\tassert.match(rendered, /Some Unknown Tool/);\n\t\tassert.match(rendered, /count=3/);\n\t\tassert.match(rendered, /enabled=true/);\n\t\tassert.match(rendered, /label=\"hello\"/);\n\t\tassert.doesNotMatch(rendered, /^\\{$/m);\n\t});\n\n\ttest(\"frame header prefers toolDefinition.label over raw tool name\", () => {\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"gsd_slice_complete\",\n\t\t\t{ sliceId: \"S03\" },\n\t\t\tundefined,\n\t\t\t{ label: \"Complete Slice\" },\n\t\t);\n\n\t\tassert.match(rendered, /Tool Complete Slice/);\n\t\tassert.doesNotMatch(rendered, /gsd_slice_complete/);\n\t});\n\n\ttest(\"frame header strips gsd_ prefix and title-cases when no label is registered\", () => {\n\t\tconst rendered = renderToolCollapsed(\"gsd_requirement_update\", { id: \"R005\" });\n\n\t\tassert.match(rendered, /Tool Requirement Update/);\n\t\tassert.doesNotMatch(rendered, /gsd_requirement_update/);\n\t});\n\n\ttest(\"formatCompactArgs truncates long string values inline instead of dumping JSON\", () => {\n\t\tconst longPath = \"/Users/alice/.gsd/projects/4dce7b775013/worktrees/slice-S03-some-long-path-that-exceeds-limit\";\n\t\tconst rendered = renderToolCollapsed(\"gsd_slice_complete\", {\n\t\t\tsliceId: \"S03\",\n\t\t\tmilestoneId: \"M001\",\n\t\t\tworktree: longPath,\n\t\t});\n\n\t\tassert.match(rendered, /sliceId=\"S03\"/);\n\t\tassert.match(rendered, /milestoneId=\"M001\"/);\n\t\tassert.match(rendered, /worktree=\".*…\"/);\n\t\tassert.doesNotMatch(rendered, /\"sliceId\":\\s*\"S03\"/);\n\t});\n\n\ttest(\"formatCompactArgs shows full string values when expanded\", () => {\n\t\tconst longPath = \"/Users/alice/.gsd/projects/4dce7b775013/worktrees/slice-S03-some-long-path-that-exceeds-limit\";\n\t\tconst rendered = renderTool(\"gsd_slice_complete\", {\n\t\t\tsliceId: \"S03\",\n\t\t\tworktree: longPath,\n\t\t});\n\n\t\tassert.match(rendered, new RegExp(longPath.replace(/\\//g, \"\\\\/\")));\n\t\tassert.doesNotMatch(rendered, /…/);\n\t});\n\n\ttest(\"generic fallback truncates long output when collapsed\", () => {\n\t\tconst longOutput = Array.from({ length: 25 }, (_, i) => `line ${i + 1}`).join(\"\\n\");\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"mcp__demo__do_thing\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [{ type: \"text\", text: longOutput }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /line 1\\b/);\n\t\tassert.match(rendered, /line 10\\b/);\n\t\tassert.doesNotMatch(rendered, /line 20\\b/);\n\t\tassert.match(rendered, /\\(15 more lines/);\n\t});\n\n\ttest(\"generic fallback falls back to truncated JSON for complex args\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__demo__nested\",\n\t\t\t{ payload: { nested: { deeply: [\"a\", \"b\", \"c\"] } }, name: \"x\" },\n\t\t);\n\n\t\tassert.match(rendered, /demo\\u00b7nested/);\n\t\t// Multi-line JSON dump for the complex payload\n\t\tassert.match(rendered, /\"payload\"/);\n\t\tassert.match(rendered, /\"nested\"/);\n\t});\n});\n"]}
1
+ {"version":3,"file":"tool-execution.test.js","sourceRoot":"","sources":["../../../../../src/modes/interactive/components/__tests__/tool-execution.test.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAA2B,MAAM,sBAAsB,CAAC;AAClH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEzB,SAAS,UAAU,CAClB,QAAgB,EAChB,IAA6B,EAC7B,MAIC,EACD,cAAiH;IAEjH,MAAM,SAAS,GAAG,IAAI,sBAAsB,CAC3C,QAAQ,EACR,IAAI,EACJ,EAAE,EACF,cAAqB,EACrB,EAAE,aAAa,KAAI,CAAC,EAAS,CAC7B,CAAC;IACF,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,MAAM;QAAE,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,mBAAmB,CAC3B,QAAgB,EAChB,IAA6B,EAC7B,MAIC,EACD,cAAiH;IAEjH,MAAM,SAAS,GAAG,IAAI,sBAAsB,CAC3C,QAAQ,EACR,IAAI,EACJ,EAAE,EACF,cAAqB,EACrB,EAAE,aAAa,KAAI,CAAC,EAAS,CAC7B,CAAC;IACF,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,EAAE,qBAAqB,CAAC,CAAC;QAC9C,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC1C,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,gEAAgE,EAAE,GAAG,EAAE;QAC3E,MAAM,QAAQ,GAAG,UAAU,CAC1B,mBAAmB,EACnB,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAC/D,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QAC3C,+CAA+C;QAC/C,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// GSD-2 Interactive Tool Execution Rendering Tests\nimport { describe, test } from \"node:test\";\nimport assert from \"node:assert/strict\";\nimport stripAnsi from \"strip-ansi\";\nimport { ToolExecutionComponent, ToolPhaseSummaryComponent, type ToolExecutionPhase } from \"../tool-execution.js\";\nimport { initTheme } from \"../../theme/theme.js\";\n\ninitTheme(\"dark\", false);\n\nfunction renderTool(\n\ttoolName: string,\n\targs: Record<string, unknown>,\n\tresult?: {\n\t\tcontent: Array<{ type: string; text?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: Record<string, unknown>;\n\t},\n\ttoolDefinition?: { label?: string; renderCall?: (...args: any[]) => any; renderResult?: (...args: any[]) => any },\n): string {\n\tconst component = new ToolExecutionComponent(\n\t\ttoolName,\n\t\targs,\n\t\t{},\n\t\ttoolDefinition as any,\n\t\t{ requestRender() {} } as any,\n\t);\n\tcomponent.setExpanded(true);\n\tif (result) component.updateResult(result);\n\treturn stripAnsi(component.render(120).join(\"\\n\"));\n}\n\nfunction renderToolCollapsed(\n\ttoolName: string,\n\targs: Record<string, unknown>,\n\tresult?: {\n\t\tcontent: Array<{ type: string; text?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: Record<string, unknown>;\n\t},\n\ttoolDefinition?: { label?: string; renderCall?: (...args: any[]) => any; renderResult?: (...args: any[]) => any },\n): string {\n\tconst component = new ToolExecutionComponent(\n\t\ttoolName,\n\t\targs,\n\t\t{},\n\t\ttoolDefinition as any,\n\t\t{ requestRender() {} } as any,\n\t);\n\tif (result) component.updateResult(result);\n\treturn stripAnsi(component.render(120).join(\"\\n\"));\n}\n\ndescribe(\"ToolExecutionComponent\", () => {\n\ttest(\"renders framed header with running status while tool is partial\", () => {\n\t\tconst rendered = renderToolCollapsed(\"mcp__demo__do_thing\", { ok: true });\n\n\t\tassert.match(rendered, /demo\\u00b7do_thing/);\n\t\tassert.doesNotMatch(rendered, /Tool demo\\u00b7do_thing/);\n\t\tassert.match(rendered, /running/);\n\t\tassert.match(rendered, /running · \\d+(ms|s)/);\n\t});\n\n\ttest(\"renders framed header with failed status for failed tool result\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__demo__do_thing\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [{ type: \"text\", text: \"boom\" }], isError: true },\n\t\t);\n\n\t\tassert.match(rendered, /demo\\u00b7do_thing/);\n\t\tassert.doesNotMatch(rendered, /Tool demo\\u00b7do_thing/);\n\t\tassert.match(rendered, /failed/);\n\t\tassert.match(rendered, /failed · \\d+(ms|s)/);\n\t\tassert.match(rendered, /boom/);\n\t});\n\n\ttest(\"collapses successful low-signal tool cards by default\", () => {\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"mcp__demo__noop\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /success · \\d+(ms|s)/);\n\t\tassert.match(rendered, /demo\\u00b7noop/);\n\t\tassert.doesNotMatch(rendered, /Completed/);\n\t\tassert.doesNotMatch(rendered, /ok=true/);\n\t});\n\n\ttest(\"exposes phase metadata for successful low-signal tool rows\", () => {\n\t\tconst component = new ToolExecutionComponent(\n\t\t\t\"gsd_requirement_update\",\n\t\t\t{ id: \"R001\" },\n\t\t\t{},\n\t\t\t{ label: \"Update Requirement\" } as any,\n\t\t\t{ requestRender() {} } as any,\n\t\t);\n\t\tcomponent.updateResult({ content: [], isError: false });\n\n\t\tassert.deepEqual(component.getRollupPhase()?.label, \"Requirement writes\");\n\t});\n\n\ttest(\"exposes phase metadata for collapsed output-bearing generic tools\", () => {\n\t\tconst component = new ToolExecutionComponent(\n\t\t\t\"mcp__demo__do_thing\",\n\t\t\t{ ok: true },\n\t\t\t{},\n\t\t\tundefined,\n\t\t\t{ requestRender() {} } as any,\n\t\t);\n\t\tcomponent.updateResult({ content: [{ type: \"text\", text: \"important output\" }], isError: false });\n\n\t\tassert.deepEqual(component.getRollupPhase()?.label, \"Other tool actions\");\n\t});\n\n\ttest(\"renders phase-based summaries for rolled-up tool executions\", () => {\n\t\tconst phases: ToolExecutionPhase[] = [\n\t\t\t{ label: \"Setup / shell\", count: 6, durationMs: 12 },\n\t\t\t{ label: \"Context reads\", count: 4, durationMs: 6 },\n\t\t\t{ label: \"Requirement writes\", count: 4, durationMs: 4 },\n\t\t\t{ label: \"Memory lookups\", count: 4, durationMs: 4 },\n\t\t\t{ label: \"Finalization\", count: 1, durationMs: 1 },\n\t\t];\n\t\tconst rendered = stripAnsi(new ToolPhaseSummaryComponent(phases).render(120).join(\"\\n\"));\n\n\t\tassert.match(rendered, /Setup \\/ shell 6 actions\\s+success · 12ms/);\n\t\tassert.match(rendered, /Context reads 4 actions\\s+success · 6ms/);\n\t\tassert.match(rendered, /Requirement writes 4 actions\\s+success · 4ms/);\n\t\tassert.match(rendered, /Memory lookups 4 actions\\s+success · 4ms/);\n\t\tassert.match(rendered, /Finalization 1 action\\s+success · 1ms/);\n\t});\n\n\ttest(\"passes failed result status to custom result renderers\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"gsd_requirement_save\",\n\t\t\t{ id: \"R001\" },\n\t\t\t{ content: [{ type: \"text\", text: \"saved\" }], isError: true },\n\t\t\t{\n\t\t\t\tlabel: \"Save Requirement\",\n\t\t\t\trenderResult(result: { isError?: boolean }) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trender: () => [result.isError ? \"custom saw error\" : \"custom saw success\"],\n\t\t\t\t\t\tinvalidate() {},\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\tassert.match(rendered, /failed/);\n\t\tassert.match(rendered, /custom saw error/);\n\t\tassert.doesNotMatch(rendered, /custom saw success/);\n\t});\n\n\ttest(\"renders capitalized Claude Code Bash tool names with bash output instead of generic args JSON\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"Bash\",\n\t\t\t{ command: \"pwd\" },\n\t\t\t{ content: [{ type: \"text\", text: \"/tmp/gsd-pr-fix\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /\\$ pwd/);\n\t\tassert.match(rendered, /\\/tmp\\/gsd-pr-fix/);\n\t\tassert.doesNotMatch(rendered, /^\\{\\s*\\}$/m);\n\t});\n\n\ttest(\"renders capitalized Claude Code Read tool names with read output\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"Read\",\n\t\t\t{ path: \"/tmp/demo.txt\" },\n\t\t\t{ content: [{ type: \"text\", text: \"hello\\nworld\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /read .*demo\\.txt/);\n\t\tassert.match(rendered, /hello/);\n\t\tassert.match(rendered, /world/);\n\t});\n\n\ttest(\"generic fallback strips mcp__<server>__ prefix and shows server·tool title\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__context7__resolve_library_id\",\n\t\t\t{ name: \"react\" },\n\t\t\t{ content: [{ type: \"text\", text: \"react@18.3.1\" }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /context7\\u00b7resolve_library_id/);\n\t\tassert.doesNotMatch(rendered, /mcp__/);\n\t\tassert.match(rendered, /name=\"react\"/);\n\t\tassert.match(rendered, /react@18\\.3\\.1/);\n\t});\n\n\ttest(\"generic fallback renders compact key=value args for primitive args\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"some_unknown_tool\",\n\t\t\t{ count: 3, enabled: true, label: \"hello\" },\n\t\t);\n\n\t\tassert.match(rendered, /Some Unknown Tool/);\n\t\tassert.match(rendered, /count=3/);\n\t\tassert.match(rendered, /enabled=true/);\n\t\tassert.match(rendered, /label=\"hello\"/);\n\t\tassert.doesNotMatch(rendered, /^\\{$/m);\n\t});\n\n\ttest(\"frame header prefers toolDefinition.label over raw tool name\", () => {\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"gsd_slice_complete\",\n\t\t\t{ sliceId: \"S03\" },\n\t\t\tundefined,\n\t\t\t{ label: \"Complete Slice\" },\n\t\t);\n\n\t\tassert.match(rendered, /Complete Slice/);\n\t\tassert.doesNotMatch(rendered, /Tool Complete Slice/);\n\t\tassert.doesNotMatch(rendered, /gsd_slice_complete/);\n\t});\n\n\ttest(\"frame header strips gsd_ prefix and title-cases when no label is registered\", () => {\n\t\tconst rendered = renderToolCollapsed(\"gsd_requirement_update\", { id: \"R005\" });\n\n\t\tassert.match(rendered, /Requirement Update/);\n\t\tassert.doesNotMatch(rendered, /Tool Requirement Update/);\n\t\tassert.doesNotMatch(rendered, /gsd_requirement_update/);\n\t});\n\n\ttest(\"formatCompactArgs truncates long string values inline instead of dumping JSON\", () => {\n\t\tconst longPath = \"/Users/alice/.gsd/projects/4dce7b775013/worktrees/slice-S03-some-long-path-that-exceeds-limit\";\n\t\tconst rendered = renderToolCollapsed(\"gsd_slice_complete\", {\n\t\t\tsliceId: \"S03\",\n\t\t\tmilestoneId: \"M001\",\n\t\t\tworktree: longPath,\n\t\t});\n\n\t\tassert.match(rendered, /sliceId=\"S03\"/);\n\t\tassert.match(rendered, /milestoneId=\"M001\"/);\n\t\tassert.match(rendered, /worktree=\".*…\"/);\n\t\tassert.doesNotMatch(rendered, /\"sliceId\":\\s*\"S03\"/);\n\t});\n\n\ttest(\"formatCompactArgs shows full string values when expanded\", () => {\n\t\tconst longPath = \"/Users/alice/.gsd/projects/4dce7b775013/worktrees/slice-S03-some-long-path-that-exceeds-limit\";\n\t\tconst rendered = renderTool(\"gsd_slice_complete\", {\n\t\t\tsliceId: \"S03\",\n\t\t\tworktree: longPath,\n\t\t});\n\n\t\tassert.match(rendered, new RegExp(longPath.replace(/\\//g, \"\\\\/\")));\n\t\tassert.doesNotMatch(rendered, /…/);\n\t});\n\n\ttest(\"generic fallback collapses successful output rows until expanded\", () => {\n\t\tconst longOutput = Array.from({ length: 25 }, (_, i) => `line ${i + 1}`).join(\"\\n\");\n\t\tconst rendered = renderToolCollapsed(\n\t\t\t\"mcp__demo__do_thing\",\n\t\t\t{ ok: true },\n\t\t\t{ content: [{ type: \"text\", text: longOutput }], isError: false },\n\t\t);\n\n\t\tassert.match(rendered, /demo\\u00b7do_thing/);\n\t\tassert.match(rendered, /success · \\d+(ms|s)/);\n\t\tassert.doesNotMatch(rendered, /line 1\\b/);\n\t\tassert.doesNotMatch(rendered, /\\(15 more lines/);\n\t});\n\n\ttest(\"generic fallback falls back to truncated JSON for complex args\", () => {\n\t\tconst rendered = renderTool(\n\t\t\t\"mcp__demo__nested\",\n\t\t\t{ payload: { nested: { deeply: [\"a\", \"b\", \"c\"] } }, name: \"x\" },\n\t\t);\n\n\t\tassert.match(rendered, /demo\\u00b7nested/);\n\t\t// Multi-line JSON dump for the complex payload\n\t\tassert.match(rendered, /\"payload\"/);\n\t\tassert.match(rendered, /\"nested\"/);\n\t});\n});\n"]}
@@ -80,8 +80,8 @@ export class AdaptiveLayoutComponent {
80
80
  }
81
81
  frame(lines, width, title, rightTitle, accent) {
82
82
  return style()
83
- .border("rounded")
84
- .density("comfortable")
83
+ .border("rule")
84
+ .density("compact")
85
85
  .toneColor((text) => theme.fg("surfaceMuted", text))
86
86
  .borderColor((text) => theme.fg("surfaceBorder", text))
87
87
  .title(theme.fg("surfaceTitle", title))
@@ -1 +1 @@
1
- {"version":3,"file":"adaptive-layout.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/adaptive-layout.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAEnF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAmB,MAAM,mBAAmB,CAAC;AAW3D,MAAM,OAAO,uBAAuB;IACnC,YAA6B,QAAmC;QAAnC,aAAQ,GAAR,QAAQ,CAA2B;IAAG,CAAC;IAEpE,UAAU,KAAU,CAAC;IAErB,MAAM,CAAC,KAAa;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,cAAc,CAAC;YAC3B,aAAa,EAAE,KAAK;YACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS;SACnC,CAAC,CAAC;QAEH,IAAI,KAAK,CAAC,QAAQ,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,eAAe,KAAK,CAAC,EAAE,CAAC;YACxH,OAAO,EAAE,CAAC;QACX,CAAC;QAED,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,GAAG,EAAE;YAAE,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACpF,IAAI,IAAI,KAAK,OAAO;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gsd/pi-tui\";\nimport type { TuiAdaptiveMode, TuiMode } from \"../tui-mode.js\";\nimport { resolveTuiMode } from \"../tui-mode.js\";\nimport { theme, type ThemeColor } from \"../theme/theme.js\";\n\nexport interface AdaptiveLayoutState {\n\toverride: TuiAdaptiveMode;\n\tactiveToolCount: number;\n\tgsdPhase?: string;\n\tlastError?: string;\n\tsessionName?: string;\n\tcwd: string;\n}\n\nexport class AdaptiveLayoutComponent implements Component {\n\tconstructor(private readonly getState: () => AdaptiveLayoutState) {}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst state = this.getState();\n\t\tconst mode = resolveTuiMode({\n\t\t\tterminalWidth: width,\n\t\t\toverride: state.override,\n\t\t\tactiveToolCount: state.activeToolCount,\n\t\t\tgsdPhase: state.gsdPhase,\n\t\t\thasBlockingError: !!state.lastError,\n\t\t});\n\n\t\tif (state.override === \"auto\" && mode === \"chat\" && !state.gsdPhase && !state.lastError && state.activeToolCount === 0) {\n\t\t\treturn [];\n\t\t}\n\n\t\tif (mode === \"compact\" || width < 72) return this.renderCompact(width, mode, state);\n\t\tif (mode === \"debug\") return this.renderDebug(width, state);\n\t\tif (mode === \"validation\") return this.renderValidation(width, state);\n\t\tif (mode === \"workflow\") return this.renderWorkflow(width, state);\n\t\treturn this.renderChat(width, state);\n\t}\n\n\tprivate renderWorkflow(width: number, state: AdaptiveLayoutState): string[] {\n\t\tif (width < 112) return this.renderCompact(width, \"workflow\", state);\n\n\t\tconst leftWidth = Math.max(44, Math.floor(width * 0.56));\n\t\tconst rightWidth = Math.max(32, width - leftWidth - 2);\n\t\tconst phase = state.gsdPhase ?? \"Ready\";\n\t\tconst left = this.frame(\n\t\t\t[\n\t\t\t\tthis.metric(\"Active\", phase, \"modeWorkflow\"),\n\t\t\t\tthis.metric(\"Tools\", state.activeToolCount > 0 ? `${state.activeToolCount} running` : \"idle\", \"toolRunning\"),\n\t\t\t\tthis.metric(\"Mode\", state.override === \"auto\" ? \"auto workflow\" : state.override, \"modeWorkflow\"),\n\t\t\t],\n\t\t\tleftWidth,\n\t\t\t\"GSD Command Center\",\n\t\t\t\"workflow\",\n\t\t\t\"modeWorkflow\",\n\t\t);\n\t\tconst right = this.frame(\n\t\t\t[\n\t\t\t\t`Session ${state.sessionName ?? \"current\"}`,\n\t\t\t\t`Path ${this.basename(state.cwd)}`,\n\t\t\t\t`Next ${state.activeToolCount > 0 ? \"watch tool output\" : \"continue from prompt\"}`,\n\t\t\t],\n\t\t\trightWidth,\n\t\t\t\"signals\",\n\t\t\t\"inspector\",\n\t\t\t\"surfaceAccent\",\n\t\t);\n\t\treturn this.columns(left, right, leftWidth);\n\t}\n\n\tprivate renderValidation(width: number, state: AdaptiveLayoutState): string[] {\n\t\tconst phase = state.gsdPhase ?? \"Validation pending\";\n\t\treturn this.frame(\n\t\t\t[\n\t\t\t\tthis.metric(\"Focus\", phase, \"modeValidation\"),\n\t\t\t\tthis.metric(\"Checks\", state.activeToolCount > 0 ? `${state.activeToolCount} active` : \"waiting\", \"toolRunning\"),\n\t\t\t\tthis.metric(\"Timeline\", state.lastError ? \"blocked\" : \"ready for completion evidence\", state.lastError ? \"toolError\" : \"toolSuccess\"),\n\t\t\t],\n\t\t\twidth,\n\t\t\t\"validation\",\n\t\t\tstate.override === \"auto\" ? \"auto\" : state.override,\n\t\t\t\"modeValidation\",\n\t\t);\n\t}\n\n\tprivate renderDebug(width: number, state: AdaptiveLayoutState): string[] {\n\t\tconst error = state.lastError ?? \"Blocking error detected\";\n\t\treturn this.frame(\n\t\t\t[\n\t\t\t\tthis.metric(\"Failure\", truncateToWidth(error, Math.max(20, width - 20), \"\"), \"toolError\"),\n\t\t\t\tthis.metric(\"Tools\", state.activeToolCount > 0 ? `${state.activeToolCount} still running` : \"none running\", \"toolRunning\"),\n\t\t\t\tthis.metric(\"Next\", \"inspect the failed output, then retry the smallest step\", \"modeDebug\"),\n\t\t\t],\n\t\t\twidth,\n\t\t\t\"blocking failure\",\n\t\t\t\"debug\",\n\t\t\t\"modeDebug\",\n\t\t);\n\t}\n\n\tprivate renderChat(width: number, state: AdaptiveLayoutState): string[] {\n\t\treturn this.frame(\n\t\t\t[\n\t\t\t\tthis.metric(\"Mode\", state.override === \"auto\" ? \"auto chat\" : state.override, \"surfaceAccent\"),\n\t\t\t\tthis.metric(\"Tools\", state.activeToolCount > 0 ? `${state.activeToolCount} active` : \"compact rows\", \"toolMuted\"),\n\t\t\t],\n\t\t\twidth,\n\t\t\t\"chat\",\n\t\t\tstate.sessionName ?? \"conversation\",\n\t\t\t\"surfaceAccent\",\n\t\t);\n\t}\n\n\tprivate renderCompact(width: number, mode: TuiMode, state: AdaptiveLayoutState): string[] {\n\t\tconst phase = state.lastError ?? state.gsdPhase ?? (state.activeToolCount > 0 ? `${state.activeToolCount} tools` : \"ready\");\n\t\tconst line = `${theme.fg(\"modeCompact\", \"GSD compact\")} ${theme.fg(\"surfaceMuted\", `${mode} · ${phase}`)}`;\n\t\treturn style()\n\t\t\t.border(\"minimal\")\n\t\t\t.borderColor((text) => theme.fg(\"surfaceBorder\", text))\n\t\t\t.bodyGutter(\" \")\n\t\t\t.render([line], width);\n\t}\n\n\tprivate frame(lines: string[], width: number, title: string, rightTitle: string, accent: ThemeColor): string[] {\n\t\treturn style()\n\t\t\t.border(\"rounded\")\n\t\t\t.density(\"comfortable\")\n\t\t\t.toneColor((text) => theme.fg(\"surfaceMuted\", text))\n\t\t\t.borderColor((text) => theme.fg(\"surfaceBorder\", text))\n\t\t\t.title(theme.fg(\"surfaceTitle\", title))\n\t\t\t.rightTitle(theme.fg(accent, rightTitle))\n\t\t\t.bodyGutter(theme.fg(accent, \"│ \"))\n\t\t\t.render(lines, width);\n\t}\n\n\tprivate metric(label: string, value: string, color: ThemeColor): string {\n\t\treturn `${theme.fg(\"surfaceMuted\", `${label.padEnd(8)} `)}${theme.fg(color, value)}`;\n\t}\n\n\tprivate columns(left: string[], right: string[], leftWidth: number): string[] {\n\t\tconst rows = Math.max(left.length, right.length);\n\t\tconst output: string[] = [];\n\t\tfor (let i = 0; i < rows; i++) {\n\t\t\tconst leftLine = left[i] ?? \"\";\n\t\t\tconst rightLine = right[i] ?? \"\";\n\t\t\tconst gap = \" \".repeat(Math.max(2, leftWidth - visibleWidth(leftLine) + 2));\n\t\t\toutput.push(`${leftLine}${gap}${rightLine}`);\n\t\t}\n\t\treturn output;\n\t}\n\n\tprivate basename(cwd: string): string {\n\t\tconst trimmed = cwd.replace(/\\/+$/, \"\");\n\t\tconst slash = trimmed.lastIndexOf(\"/\");\n\t\treturn slash === -1 ? trimmed : trimmed.slice(slash + 1);\n\t}\n}\n"]}
1
+ {"version":3,"file":"adaptive-layout.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/adaptive-layout.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAEnF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAmB,MAAM,mBAAmB,CAAC;AAW3D,MAAM,OAAO,uBAAuB;IACnC,YAA6B,QAAmC;QAAnC,aAAQ,GAAR,QAAQ,CAA2B;IAAG,CAAC;IAEpE,UAAU,KAAU,CAAC;IAErB,MAAM,CAAC,KAAa;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,cAAc,CAAC;YAC3B,aAAa,EAAE,KAAK;YACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS;SACnC,CAAC,CAAC;QAEH,IAAI,KAAK,CAAC,QAAQ,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,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AC,GAAG,CAAC,CAAC;QACvC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC1D,CAAC;CACD","sourcesContent":["// GSD2 - Adaptive terminal mode dashboard for the interactive TUI\n\nimport { style, truncateToWidth, visibleWidth, type Component } from \"@gsd/pi-tui\";\nimport type { TuiAdaptiveMode, TuiMode } from \"../tui-mode.js\";\nimport { resolveTuiMode } from \"../tui-mode.js\";\nimport { theme, type ThemeColor } from \"../theme/theme.js\";\n\nexport interface AdaptiveLayoutState {\n\toverride: TuiAdaptiveMode;\n\tactiveToolCount: number;\n\tgsdPhase?: string;\n\tlastError?: string;\n\tsessionName?: string;\n\tcwd: string;\n}\n\nexport class AdaptiveLayoutComponent implements Component {\n\tconstructor(private readonly getState: () => AdaptiveLayoutState) {}\n\n\tinvalidate(): void {}\n\n\trender(width: number): string[] {\n\t\tconst state = this.getState();\n\t\tconst mode = resolveTuiMode({\n\t\t\tterminalWidth: width,\n\t\t\toverride: state.override,\n\t\t\tactiveToolCount: state.activeToolCount,\n\t\t\tgsdPhase: state.gsdPhase,\n\t\t\thasBlockingError: !!state.lastError,\n\t\t});\n\n\t\tif (state.override === \"auto\" && mode === \"chat\" && !state.gsdPhase && !state.lastError && state.activeToolCount === 0) {\n\t\t\treturn [];\n\t\t}\n\n\t\tif (mode === \"compact\" || width < 72) return this.renderCompact(width, mode, state);\n\t\tif (mode === \"debug\") return this.renderDebug(width, state);\n\t\tif (mode === \"validation\") return this.renderValidation(width, state);\n\t\tif (mode === \"workflow\") return this.renderWorkflow(width, state);\n\t\treturn this.renderChat(width, state);\n\t}\n\n\tprivate renderWorkflow(width: number, state: AdaptiveLayoutState): string[] {\n\t\tif (width < 112) return this.renderCompact(width, \"workflow\", state);\n\n\t\tconst leftWidth = Math.max(44, Math.floor(width * 0.56));\n\t\tconst rightWidth = Math.max(32, width - leftWidth - 2);\n\t\tconst phase = state.gsdPhase ?? \"Ready\";\n\t\tconst left = this.frame(\n\t\t\t[\n\t\t\t\tthis.metric(\"Active\", phase, \"modeWorkflow\"),\n\t\t\t\tthis.metric(\"Tools\", state.activeToolCount > 0 ? `${state.activeToolCount} running` : \"idle\", \"toolRunning\"),\n\t\t\t\tthis.metric(\"Mode\", state.override === \"auto\" ? \"auto workflow\" : state.override, \"modeWorkflow\"),\n\t\t\t],\n\t\t\tleftWidth,\n\t\t\t\"GSD Command Center\",\n\t\t\t\"workflow\",\n\t\t\t\"modeWorkflow\",\n\t\t);\n\t\tconst right = this.frame(\n\t\t\t[\n\t\t\t\t`Session ${state.sessionName ?? \"current\"}`,\n\t\t\t\t`Path ${this.basename(state.cwd)}`,\n\t\t\t\t`Next ${state.activeToolCount > 0 ? \"watch tool output\" : \"continue from prompt\"}`,\n\t\t\t],\n\t\t\trightWidth,\n\t\t\t\"signals\",\n\t\t\t\"inspector\",\n\t\t\t\"surfaceAccent\",\n\t\t);\n\t\treturn this.columns(left, right, leftWidth);\n\t}\n\n\tprivate renderValidation(width: number, state: AdaptiveLayoutState): string[] {\n\t\tconst phase = state.gsdPhase ?? \"Validation pending\";\n\t\treturn this.frame(\n\t\t\t[\n\t\t\t\tthis.metric(\"Focus\", phase, \"modeValidation\"),\n\t\t\t\tthis.metric(\"Checks\", state.activeToolCount > 0 ? `${state.activeToolCount} active` : \"waiting\", \"toolRunning\"),\n\t\t\t\tthis.metric(\"Timeline\", state.lastError ? \"blocked\" : \"ready for completion evidence\", state.lastError ? \"toolError\" : \"toolSuccess\"),\n\t\t\t],\n\t\t\twidth,\n\t\t\t\"validation\",\n\t\t\tstate.override === \"auto\" ? \"auto\" : state.override,\n\t\t\t\"modeValidation\",\n\t\t);\n\t}\n\n\tprivate renderDebug(width: number, state: AdaptiveLayoutState): string[] {\n\t\tconst error = state.lastError ?? \"Blocking error detected\";\n\t\treturn this.frame(\n\t\t\t[\n\t\t\t\tthis.metric(\"Failure\", truncateToWidth(error, Math.max(20, width - 20), \"\"), \"toolError\"),\n\t\t\t\tthis.metric(\"Tools\", state.activeToolCount > 0 ? `${state.activeToolCount} still running` : \"none running\", \"toolRunning\"),\n\t\t\t\tthis.metric(\"Next\", \"inspect the failed output, then retry the smallest step\", \"modeDebug\"),\n\t\t\t],\n\t\t\twidth,\n\t\t\t\"blocking failure\",\n\t\t\t\"debug\",\n\t\t\t\"modeDebug\",\n\t\t);\n\t}\n\n\tprivate renderChat(width: number, state: AdaptiveLayoutState): string[] {\n\t\treturn this.frame(\n\t\t\t[\n\t\t\t\tthis.metric(\"Mode\", state.override === \"auto\" ? \"auto chat\" : state.override, \"surfaceAccent\"),\n\t\t\t\tthis.metric(\"Tools\", state.activeToolCount > 0 ? `${state.activeToolCount} active` : \"compact rows\", \"toolMuted\"),\n\t\t\t],\n\t\t\twidth,\n\t\t\t\"chat\",\n\t\t\tstate.sessionName ?? \"conversation\",\n\t\t\t\"surfaceAccent\",\n\t\t);\n\t}\n\n\tprivate renderCompact(width: number, mode: TuiMode, state: AdaptiveLayoutState): string[] {\n\t\tconst phase = state.lastError ?? state.gsdPhase ?? (state.activeToolCount > 0 ? `${state.activeToolCount} tools` : \"ready\");\n\t\tconst line = `${theme.fg(\"modeCompact\", \"GSD compact\")} ${theme.fg(\"surfaceMuted\", `${mode} · ${phase}`)}`;\n\t\treturn style()\n\t\t\t.border(\"minimal\")\n\t\t\t.borderColor((text) => theme.fg(\"surfaceBorder\", text))\n\t\t\t.bodyGutter(\" \")\n\t\t\t.render([line], width);\n\t}\n\n\tprivate frame(lines: string[], width: number, title: string, rightTitle: string, accent: ThemeColor): string[] {\n\t\treturn style()\n\t\t\t.border(\"rule\")\n\t\t\t.density(\"compact\")\n\t\t\t.toneColor((text) => theme.fg(\"surfaceMuted\", text))\n\t\t\t.borderColor((text) => theme.fg(\"surfaceBorder\", text))\n\t\t\t.title(theme.fg(\"surfaceTitle\", title))\n\t\t\t.rightTitle(theme.fg(accent, rightTitle))\n\t\t\t.bodyGutter(theme.fg(accent, \"│ \"))\n\t\t\t.render(lines, width);\n\t}\n\n\tprivate metric(label: string, value: string, color: ThemeColor): string {\n\t\treturn `${theme.fg(\"surfaceMuted\", `${label.padEnd(8)} `)}${theme.fg(color, value)}`;\n\t}\n\n\tprivate columns(left: string[], right: string[], leftWidth: number): string[] {\n\t\tconst rows = Math.max(left.length, right.length);\n\t\tconst output: string[] = [];\n\t\tfor (let i = 0; i < rows; i++) {\n\t\t\tconst leftLine = left[i] ?? \"\";\n\t\t\tconst rightLine = right[i] ?? \"\";\n\t\t\tconst gap = \" \".repeat(Math.max(2, leftWidth - visibleWidth(leftLine) + 2));\n\t\t\toutput.push(`${leftLine}${gap}${rightLine}`);\n\t\t}\n\t\treturn output;\n\t}\n\n\tprivate basename(cwd: string): string {\n\t\tconst trimmed = cwd.replace(/\\/+$/, \"\");\n\t\tconst slash = trimmed.lastIndexOf(\"/\");\n\t\treturn slash === -1 ? trimmed : trimmed.slice(slash + 1);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"assistant-message.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,SAAS,EAAY,KAAK,aAAa,EAAgB,MAAM,aAAa,CAAC;AAEpF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,WAAW,YAAY;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACvD,OAAO,CAAC,gBAAgB,CAAY;IACpC,OAAO,CAAC,iBAAiB,CAAU;IACnC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,WAAW,CAAC,CAAmB;IACvC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,KAAK,CAAC,CAAe;IAC7B,OAAO,CAAC,YAAY,CAAU;gBAG7B,OAAO,CAAC,EAAE,gBAAgB,EAC1B,iBAAiB,UAAQ,EACzB,aAAa,GAAE,aAAkC,EACjD,eAAe,GAAE,eAAiC,EAClD,KAAK,CAAC,EAAE,YAAY;IAsBrB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI;IAO/C,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAO3B,UAAU,IAAI,IAAI;IAO3B,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAIzC,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAqFrC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAiBxC"}
1
+ {"version":3,"file":"assistant-message.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,SAAS,EAAY,KAAK,aAAa,EAAgB,MAAM,aAAa,CAAC;AAEpF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,WAAW,YAAY;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACvD,OAAO,CAAC,gBAAgB,CAAY;IACpC,OAAO,CAAC,iBAAiB,CAAU;IACnC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,WAAW,CAAC,CAAmB;IACvC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,KAAK,CAAC,CAAe;IAC7B,OAAO,CAAC,YAAY,CAAU;gBAG7B,OAAO,CAAC,EAAE,gBAAgB,EAC1B,iBAAiB,UAAQ,EACzB,aAAa,GAAE,aAAkC,EACjD,eAAe,GAAE,eAAiC,EAClD,KAAK,CAAC,EAAE,YAAY;IAsBrB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI;IAO/C,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAO3B,UAAU,IAAI,IAAI;IAO3B,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAIzC,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAqFrC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAiBxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"assistant-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAsB,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAOlD;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IASvD,YACC,OAA0B,EAC1B,iBAAiB,GAAG,KAAK,EACzB,gBAA+B,gBAAgB,EAAE,EACjD,kBAAmC,eAAe,EAClD,KAAoB;QAEpB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,sEAAsE;QACtE,6EAA6E;QAC7E,kEAAkE;QAClE,IAAI,CAAC,YAAY,GAAG,CAAC,KAAK,CAAC;QAE3B,sCAAsC;QACtC,IAAI,CAAC,gBAAgB,GAAG,IAAI,SAAS,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC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,CAAC,CAAC,CAAC,CAAC;oBAC9C,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBACzF,CAAC;YACF,CAAC;QAEF,CAAC;IACF,CAAC;IAEQ,MAAM,CAAC,KAAa;QAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC;QACjD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QACxF,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE;YACjD,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS;YACtC,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,aAAa,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,MAAM,CAAC;QACf,CAAC;QACD,OAAO,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;IACxB,CAAC;CACD","sourcesContent":["import type { AssistantMessage } from \"@gsd/pi-ai\";\nimport { Container, Markdown, type MarkdownTheme, Spacer, Text } from \"@gsd/pi-tui\";\nimport { getMarkdownTheme, theme } from \"../theme/theme.js\";\nimport { type TimestampFormat } from \"./timestamp.js\";\nimport { renderChatFrame } from \"./chat-frame.js\";\n\nexport interface ContentRange {\n\tstartIndex: number;\n\tendIndex: number;\n}\n\n/**\n * Component that renders a complete assistant message, or a sub-range of its content[].\n * When `range` is provided, only content[startIndex..endIndex] (inclusive) is rendered.\n * Non-text/thinking blocks within the range are silently skipped.\n */\nexport class AssistantMessageComponent extends Container {\n\tprivate contentContainer: Container;\n\tprivate hideThinkingBlock: boolean;\n\tprivate markdownTheme: MarkdownTheme;\n\tprivate lastMessage?: AssistantMessage;\n\tprivate timestampFormat: TimestampFormat;\n\tprivate range?: ContentRange;\n\tprivate showMetadata: boolean;\n\n\tconstructor(\n\t\tmessage?: AssistantMessage,\n\t\thideThinkingBlock = false,\n\t\tmarkdownTheme: MarkdownTheme = getMarkdownTheme(),\n\t\ttimestampFormat: TimestampFormat = \"date-time-iso\",\n\t\trange?: ContentRange,\n\t) {\n\t\tsuper();\n\n\t\tthis.hideThinkingBlock = hideThinkingBlock;\n\t\tthis.markdownTheme = markdownTheme;\n\t\tthis.timestampFormat = timestampFormat;\n\t\tthis.range = range;\n\t\t// No range = legacy full-message rendering; show metadata by default.\n\t\t// Ranged (interleaved) instances start with metadata hidden; chat-controller\n\t\t// calls setShowMetadata(true) on the last segment at message_end.\n\t\tthis.showMetadata = !range;\n\n\t\t// Container for text/thinking content\n\t\tthis.contentContainer = new Container();\n\t\tthis.addChild(this.contentContainer);\n\n\t\tif (message) {\n\t\t\tthis.updateContent(message);\n\t\t}\n\t}\n\n\tsetRange(range: ContentRange | undefined): void {\n\t\tthis.range = range;\n\t\tif (this.lastMessage) {\n\t\t\tthis.updateContent(this.lastMessage);\n\t\t}\n\t}\n\n\tsetShowMetadata(show: boolean): void {\n\t\tthis.showMetadata = show;\n\t\tif (this.lastMessage) {\n\t\t\tthis.updateContent(this.lastMessage);\n\t\t}\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tif (this.lastMessage) {\n\t\t\tthis.updateContent(this.lastMessage);\n\t\t}\n\t}\n\n\tsetHideThinkingBlock(hide: boolean): void {\n\t\tthis.hideThinkingBlock = hide;\n\t}\n\n\tupdateContent(message: AssistantMessage): void {\n\t\tthis.lastMessage = message;\n\n\t\t// Clear content container\n\t\tthis.contentContainer.clear();\n\n\t\tconst start = this.range?.startIndex ?? 0;\n\t\tconst end = this.range?.endIndex ?? message.content.length - 1;\n\t\tconst slice = message.content.slice(start, end + 1);\n\n\t\tconst hasVisibleContent = slice.some(\n\t\t\t(c) => (c.type === \"text\" && c.text.trim()) || (c.type === \"thinking\" && c.thinking.trim()),\n\t\t);\n\t\tconst hasTextContent = message.content.some((c) => c.type === \"text\" && c.text.trim().length > 0);\n\t\tconst hasToolContent = message.content.some((c) => c.type === \"toolCall\" || c.type === \"serverToolUse\");\n\t\t// Claude Code often emits long reasoning blocks ahead of user-visible text/tool\n\t\t// output in the same lifecycle. Keep chat output visible without requiring a\n\t\t// manual thinking toggle every turn.\n\t\tconst shouldCapThinking = hasTextContent || hasToolContent || message.provider === \"claude-code\";\n\n\t\t// Render content in order; non-text/thinking blocks are silently skipped\n\t\tfor (let i = 0; i < slice.length; i++) {\n\t\t\tconst content = slice[i];\n\t\t\tif (content.type === \"text\" && content.text.trim()) {\n\t\t\t\t// Assistant text messages with no background - trim the text\n\t\t\t\t// Set paddingY=0 to avoid extra spacing before tool executions\n\t\t\t\tthis.contentContainer.addChild(new Markdown(content.text.trim(), 1, 0, this.markdownTheme));\n\t\t\t} else if (content.type === \"thinking\" && content.thinking.trim()) {\n\t\t\t\t// Add spacing only when another visible assistant content block follows.\n\t\t\t\t// This avoids a superfluous blank line before separately-rendered tool execution blocks.\n\t\t\t\tconst hasVisibleContentAfter = slice\n\t\t\t\t\t.slice(i + 1)\n\t\t\t\t\t.some((c) => (c.type === \"text\" && c.text.trim()) || (c.type === \"thinking\" && c.thinking.trim()));\n\n\t\t\t\tif (this.hideThinkingBlock) {\n\t\t\t\t\t// Show static \"Thinking...\" label when hidden\n\t\t\t\t\tthis.contentContainer.addChild(new Text(theme.italic(theme.fg(\"thinkingText\", \"Thinking...\")), 1, 0));\n\t\t\t\t\tif (hasVisibleContentAfter) {\n\t\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Thinking traces in thinkingText color, italic\n\t\t\t\t\tconst thinkingMarkdown = new Markdown(content.thinking.trim(), 1, 0, this.markdownTheme, {\n\t\t\t\t\t\tcolor: (text: string) => theme.fg(\"thinkingText\", text),\n\t\t\t\t\t\titalic: true,\n\t\t\t\t\t});\n\t\t\t\t\t// Keep visible chat output readable when thinking traces are long.\n\t\t\t\t\t// Tool-bearing turns can stream text in a later assistant message.\n\t\t\t\t\tif (shouldCapThinking) {\n\t\t\t\t\t\tthinkingMarkdown.maxLines = 8;\n\t\t\t\t\t}\n\t\t\t\t\tthis.contentContainer.addChild(thinkingMarkdown);\n\t\t\t\t\tif (hasVisibleContentAfter) {\n\t\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Metadata (errors, timestamp): gated on showMetadata so ranged instances stay clean\n\t\t// until chat-controller explicitly enables it on the last segment at message_end.\n\t\tif (this.showMetadata) {\n\t\t\t// Check if aborted - show after partial content\n\t\t\t// But only if there are no tool calls (tool execution components will show the error)\n\t\t\tconst hasToolCalls = message.content.some((c) => c.type === \"toolCall\");\n\t\t\tif (!hasToolCalls) {\n\t\t\t\tif (message.stopReason === \"aborted\") {\n\t\t\t\t\tconst abortMessage =\n\t\t\t\t\t\tmessage.errorMessage && message.errorMessage !== \"Request was aborted\"\n\t\t\t\t\t\t\t? message.errorMessage\n\t\t\t\t\t\t\t: \"Operation aborted\";\n\t\t\t\t\tif (hasVisibleContent) {\n\t\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t\t}\n\t\t\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"error\", abortMessage), 1, 0));\n\t\t\t\t} else if (message.stopReason === \"error\") {\n\t\t\t\t\tconst errorMsg = message.errorMessage || \"Unknown error\";\n\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"error\", `Error: ${errorMsg}`), 1, 0));\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\toverride render(width: number): string[] {\n\t\tconst frameWidth = Math.max(20, width);\n\t\tconst contentWidth = Math.max(1, frameWidth - 4);\n\t\tconst lines = super.render(contentWidth);\n\t\tconst headerLabel = this.lastMessage?.model ? `GSD - ${this.lastMessage.model}` : \"GSD\";\n\t\tconst framed = renderChatFrame(lines, frameWidth, {\n\t\t\tlabel: headerLabel,\n\t\t\ttone: \"assistant\",\n\t\t\ttimestamp: this.lastMessage?.timestamp,\n\t\t\ttimestampFormat: this.timestampFormat,\n\t\t\tshowTimestamp: this.showMetadata,\n\t\t});\n\t\tif (framed.length === 0) {\n\t\t\treturn framed;\n\t\t}\n\t\treturn [\"\", ...framed];\n\t}\n}\n"]}
1
+ {"version":3,"file":"assistant-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/assistant-message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAsB,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAOlD;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IASvD,YACC,OAA0B,EAC1B,iBAAiB,GAAG,KAAK,EACzB,gBAA+B,gBAAgB,EAAE,EACjD,kBAAmC,eAAe,EAClD,KAAoB;QAEpB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IA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AM,CAAC;QACf,CAAC;QACD,OAAO,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;IACxB,CAAC;CACD","sourcesContent":["// GSD2 TUI - Assistant message card renderer for interactive terminal sessions.\nimport type { AssistantMessage } from \"@gsd/pi-ai\";\nimport { Container, Markdown, type MarkdownTheme, Spacer, Text } from \"@gsd/pi-tui\";\nimport { getMarkdownTheme, theme } from \"../theme/theme.js\";\nimport { type TimestampFormat } from \"./timestamp.js\";\nimport { renderChatFrame } from \"./chat-frame.js\";\n\nexport interface ContentRange {\n\tstartIndex: number;\n\tendIndex: number;\n}\n\n/**\n * Component that renders a complete assistant message, or a sub-range of its content[].\n * When `range` is provided, only content[startIndex..endIndex] (inclusive) is rendered.\n * Non-text/thinking blocks within the range are silently skipped.\n */\nexport class AssistantMessageComponent extends Container {\n\tprivate contentContainer: Container;\n\tprivate hideThinkingBlock: boolean;\n\tprivate markdownTheme: MarkdownTheme;\n\tprivate lastMessage?: AssistantMessage;\n\tprivate timestampFormat: TimestampFormat;\n\tprivate range?: ContentRange;\n\tprivate showMetadata: boolean;\n\n\tconstructor(\n\t\tmessage?: AssistantMessage,\n\t\thideThinkingBlock = false,\n\t\tmarkdownTheme: MarkdownTheme = getMarkdownTheme(),\n\t\ttimestampFormat: TimestampFormat = \"date-time-iso\",\n\t\trange?: ContentRange,\n\t) {\n\t\tsuper();\n\n\t\tthis.hideThinkingBlock = hideThinkingBlock;\n\t\tthis.markdownTheme = markdownTheme;\n\t\tthis.timestampFormat = timestampFormat;\n\t\tthis.range = range;\n\t\t// No range = legacy full-message rendering; show metadata by default.\n\t\t// Ranged (interleaved) instances start with metadata hidden; chat-controller\n\t\t// calls setShowMetadata(true) on the last segment at message_end.\n\t\tthis.showMetadata = !range;\n\n\t\t// Container for text/thinking content\n\t\tthis.contentContainer = new Container();\n\t\tthis.addChild(this.contentContainer);\n\n\t\tif (message) {\n\t\t\tthis.updateContent(message);\n\t\t}\n\t}\n\n\tsetRange(range: ContentRange | undefined): void {\n\t\tthis.range = range;\n\t\tif (this.lastMessage) {\n\t\t\tthis.updateContent(this.lastMessage);\n\t\t}\n\t}\n\n\tsetShowMetadata(show: boolean): void {\n\t\tthis.showMetadata = show;\n\t\tif (this.lastMessage) {\n\t\t\tthis.updateContent(this.lastMessage);\n\t\t}\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tif (this.lastMessage) {\n\t\t\tthis.updateContent(this.lastMessage);\n\t\t}\n\t}\n\n\tsetHideThinkingBlock(hide: boolean): void {\n\t\tthis.hideThinkingBlock = hide;\n\t}\n\n\tupdateContent(message: AssistantMessage): void {\n\t\tthis.lastMessage = message;\n\n\t\t// Clear content container\n\t\tthis.contentContainer.clear();\n\n\t\tconst start = this.range?.startIndex ?? 0;\n\t\tconst end = this.range?.endIndex ?? message.content.length - 1;\n\t\tconst slice = message.content.slice(start, end + 1);\n\n\t\tconst hasVisibleContent = slice.some(\n\t\t\t(c) => (c.type === \"text\" && c.text.trim()) || (c.type === \"thinking\" && c.thinking.trim()),\n\t\t);\n\t\tconst hasTextContent = message.content.some((c) => c.type === \"text\" && c.text.trim().length > 0);\n\t\tconst hasToolContent = message.content.some((c) => c.type === \"toolCall\" || c.type === \"serverToolUse\");\n\t\t// Claude Code often emits long reasoning blocks ahead of user-visible text/tool\n\t\t// output in the same lifecycle. Keep chat output visible without requiring a\n\t\t// manual thinking toggle every turn.\n\t\tconst shouldCapThinking = hasTextContent || hasToolContent || message.provider === \"claude-code\";\n\n\t\t// Render content in order; non-text/thinking blocks are silently skipped\n\t\tfor (let i = 0; i < slice.length; i++) {\n\t\t\tconst content = slice[i];\n\t\t\tif (content.type === \"text\" && content.text.trim()) {\n\t\t\t\t// Assistant text messages with no background - trim the text\n\t\t\t\t// Set paddingY=0 to avoid extra spacing before tool executions\n\t\t\t\tthis.contentContainer.addChild(new Markdown(content.text.trim(), 1, 0, this.markdownTheme));\n\t\t\t} else if (content.type === \"thinking\" && content.thinking.trim()) {\n\t\t\t\t// Add spacing only when another visible assistant content block follows.\n\t\t\t\t// This avoids a superfluous blank line before separately-rendered tool execution blocks.\n\t\t\t\tconst hasVisibleContentAfter = slice\n\t\t\t\t\t.slice(i + 1)\n\t\t\t\t\t.some((c) => (c.type === \"text\" && c.text.trim()) || (c.type === \"thinking\" && c.thinking.trim()));\n\n\t\t\t\tif (this.hideThinkingBlock) {\n\t\t\t\t\t// Show static \"Thinking...\" label when hidden\n\t\t\t\t\tthis.contentContainer.addChild(new Text(theme.italic(theme.fg(\"thinkingText\", \"Thinking...\")), 1, 0));\n\t\t\t\t\tif (hasVisibleContentAfter) {\n\t\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Thinking traces in thinkingText color, italic\n\t\t\t\t\tconst thinkingMarkdown = new Markdown(content.thinking.trim(), 1, 0, this.markdownTheme, {\n\t\t\t\t\t\tcolor: (text: string) => theme.fg(\"thinkingText\", text),\n\t\t\t\t\t\titalic: true,\n\t\t\t\t\t});\n\t\t\t\t\t// Keep visible chat output readable when thinking traces are long.\n\t\t\t\t\t// Tool-bearing turns can stream text in a later assistant message.\n\t\t\t\t\tif (shouldCapThinking) {\n\t\t\t\t\t\tthinkingMarkdown.maxLines = 8;\n\t\t\t\t\t}\n\t\t\t\t\tthis.contentContainer.addChild(thinkingMarkdown);\n\t\t\t\t\tif (hasVisibleContentAfter) {\n\t\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Metadata (errors, timestamp): gated on showMetadata so ranged instances stay clean\n\t\t// until chat-controller explicitly enables it on the last segment at message_end.\n\t\tif (this.showMetadata) {\n\t\t\t// Check if aborted - show after partial content\n\t\t\t// But only if there are no tool calls (tool execution components will show the error)\n\t\t\tconst hasToolCalls = message.content.some((c) => c.type === \"toolCall\");\n\t\t\tif (!hasToolCalls) {\n\t\t\t\tif (message.stopReason === \"aborted\") {\n\t\t\t\t\tconst abortMessage =\n\t\t\t\t\t\tmessage.errorMessage && message.errorMessage !== \"Request was aborted\"\n\t\t\t\t\t\t\t? message.errorMessage\n\t\t\t\t\t\t\t: \"Operation aborted\";\n\t\t\t\t\tif (hasVisibleContent) {\n\t\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t\t}\n\t\t\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"error\", abortMessage), 1, 0));\n\t\t\t\t} else if (message.stopReason === \"error\") {\n\t\t\t\t\tconst errorMsg = message.errorMessage || \"Unknown error\";\n\t\t\t\t\tthis.contentContainer.addChild(new Spacer(1));\n\t\t\t\t\tthis.contentContainer.addChild(new Text(theme.fg(\"error\", `Error: ${errorMsg}`), 1, 0));\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\toverride render(width: number): string[] {\n\t\tconst frameWidth = Math.max(20, width);\n\t\tconst contentWidth = Math.max(1, frameWidth - 4);\n\t\tconst lines = super.render(contentWidth);\n\t\tconst headerLabel = this.lastMessage?.model ? `GSD - ${this.lastMessage.model}` : \"GSD\";\n\t\tconst framed = renderChatFrame(lines, frameWidth, {\n\t\t\tlabel: headerLabel,\n\t\t\ttone: \"assistant\",\n\t\t\ttimestamp: this.lastMessage?.timestamp,\n\t\t\ttimestampFormat: this.timestampFormat,\n\t\t\tshowTimestamp: this.showMetadata,\n\t\t});\n\t\tif (framed.length === 0) {\n\t\t\treturn framed;\n\t\t}\n\t\treturn [\"\", ...framed];\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"chat-frame.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-frame.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEvE,KAAK,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,YAAY,GAAG,OAAO,CAAC;AAU/D,wBAAgB,eAAe,CAC9B,YAAY,EAAE,MAAM,EAAE,EACtB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;IACL,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB,GACC,MAAM,EAAE,CA8DV"}
1
+ {"version":3,"file":"chat-frame.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-frame.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEvE,KAAK,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,YAAY,GAAG,OAAO,CAAC;AAU/D,wBAAgB,eAAe,CAC9B,YAAY,EAAE,MAAM,EAAE,EACtB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;IACL,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB,GACC,MAAM,EAAE,CA8DV"}
@@ -1,3 +1,4 @@
1
+ // GSD2 TUI - Shared chat frame renderer for assistant, user, and system cards.
1
2
  import { style, truncateToWidth, visibleWidth } from "@gsd/pi-tui";
2
3
  import { theme } from "../theme/theme.js";
3
4
  import { formatTimestamp } from "./timestamp.js";
@@ -21,7 +22,7 @@ export function renderChatFrame(contentLines, width, opts) {
21
22
  : "borderAccent";
22
23
  const borderMuted = isPurple ? "customMessageLabel" : "borderMuted";
23
24
  const border = (s) => theme.fg(borderColor, s);
24
- const leftRaw = `• ${opts.label}`;
25
+ const leftRaw = opts.label;
25
26
  const rightRaw = opts.showTimestamp === false || !opts.timestamp
26
27
  ? ""
27
28
  : formatTimestamp(opts.timestamp, opts.timestampFormat);
@@ -1 +1 @@
1
- {"version":3,"file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E;SACZ,MAAM,CAAC,MAAM,CAAC;SACd,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;SAC1F,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SACxC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import { style, truncateToWidth, visibleWidth } from \"@gsd/pi-tui\";\nimport { theme } from \"../theme/theme.js\";\nimport { formatTimestamp, type TimestampFormat } from \"./timestamp.js\";\n\ntype FrameTone = \"assistant\" | \"user\" | \"compaction\" | \"skill\";\n\nfunction trimOuterBlankLines(lines: string[]): string[] {\n\tlet start = 0;\n\tlet end = lines.length;\n\twhile (start < end && lines[start].trim().length === 0) start++;\n\twhile (end > start && lines[end - 1].trim().length === 0) end--;\n\treturn lines.slice(start, end);\n}\n\nexport function renderChatFrame(\n\tcontentLines: string[],\n\twidth: number,\n\topts: {\n\t\tlabel: string;\n\t\ttone: FrameTone;\n\t\ttimestamp?: number;\n\t\ttimestampFormat: TimestampFormat;\n\t\tshowTimestamp?: boolean;\n\t},\n): string[] {\n\tconst outerWidth = Math.max(20, width);\n\tconst contentWidth = Math.max(1, outerWidth - 2); // \"│ \" + content\n\tconst isPurple = opts.tone === \"compaction\" || opts.tone === \"skill\";\n\tconst borderColor =\n\t\topts.tone === \"user\"\n\t\t\t? \"border\"\n\t\t\t: isPurple\n\t\t\t\t? \"customMessageLabel\"\n\t\t\t\t: \"borderAccent\";\n\tconst borderMuted = isPurple ? \"customMessageLabel\" : \"borderMuted\";\n\tconst border = (s: string) => theme.fg(borderColor, s);\n\tconst leftRaw = `• ${opts.label}`;\n\tconst rightRaw =\n\t\topts.showTimestamp === false || !opts.timestamp\n\t\t\t? \"\"\n\t\t\t: formatTimestamp(opts.timestamp, opts.timestampFormat);\n\n\tconst leftBudget = rightRaw\n\t\t? Math.max(1, outerWidth - visibleWidth(rightRaw) - 1)\n\t\t: outerWidth;\n\tconst left = truncateToWidth(leftRaw, leftBudget, \"\");\n\tconst labelColor =\n\t\topts.tone === \"user\"\n\t\t\t? \"border\"\n\t\t\t: isPurple\n\t\t\t\t? \"customMessageLabel\"\n\t\t\t\t: \"borderAccent\";\n\tconst dashIdx = left.indexOf(\" - \");\n\tconst leftStyled =\n\t\tdashIdx >= 0\n\t\t\t? theme.fg(labelColor, theme.bold(left.slice(0, dashIdx))) +\n\t\t\t\ttheme.fg(\"dim\", left.slice(dashIdx))\n\t\t\t: theme.fg(labelColor, theme.bold(left));\n\tconst rightStyled = rightRaw ? theme.fg(\"dim\", rightRaw) : \"\";\n\tconst gap =\n\t\trightRaw.length > 0\n\t\t\t? Math.max(\n\t\t\t\t\t1,\n\t\t\t\t\touterWidth - visibleWidth(leftStyled) - visibleWidth(rightStyled),\n\t\t\t\t)\n\t\t\t: Math.max(0, outerWidth - visibleWidth(leftStyled));\n\tconst headerRow = `${leftStyled}${\" \".repeat(gap)}${rightStyled}`;\n\tconst headerPad = Math.max(0, outerWidth - visibleWidth(headerRow));\n\n\tconst bodyColor =\n\t\topts.tone === \"user\"\n\t\t\t? \"userMessageText\"\n\t\t\t: isPurple\n\t\t\t\t? \"customMessageText\"\n\t\t\t\t: \"assistantMessageText\";\n\tconst sourceLines = trimOuterBlankLines(contentLines);\n\tconst bodyLines = (sourceLines.length > 0 ? sourceLines : [\"\"]).map((line) => {\n\t\tconst clipped = truncateToWidth(line, contentWidth, \"\");\n\t\treturn theme.fg(bodyColor, clipped);\n\t});\n\n\treturn style()\n\t\t.border(\"rule\")\n\t\t.borderColor((line) => (line.startsWith(\"─\") ? theme.fg(borderMuted, line) : border(line)))\n\t\t.title(headerRow + \" \".repeat(headerPad))\n\t\t.render(bodyLines,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AC,CAAC,CAAC;IAEH,OAAO,KAAK,EAAE;SACZ,MAAM,CAAC,MAAM,CAAC;SACd,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;SAC1F,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SACxC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// GSD2 TUI - Shared chat frame renderer for assistant, user, and system cards.\nimport { style, truncateToWidth, visibleWidth } from \"@gsd/pi-tui\";\nimport { theme } from \"../theme/theme.js\";\nimport { formatTimestamp, type TimestampFormat } from \"./timestamp.js\";\n\ntype FrameTone = \"assistant\" | \"user\" | \"compaction\" | \"skill\";\n\nfunction trimOuterBlankLines(lines: string[]): string[] {\n\tlet start = 0;\n\tlet end = lines.length;\n\twhile (start < end && lines[start].trim().length === 0) start++;\n\twhile (end > start && lines[end - 1].trim().length === 0) end--;\n\treturn lines.slice(start, end);\n}\n\nexport function renderChatFrame(\n\tcontentLines: string[],\n\twidth: number,\n\topts: {\n\t\tlabel: string;\n\t\ttone: FrameTone;\n\t\ttimestamp?: number;\n\t\ttimestampFormat: TimestampFormat;\n\t\tshowTimestamp?: boolean;\n\t},\n): string[] {\n\tconst outerWidth = Math.max(20, width);\n\tconst contentWidth = Math.max(1, outerWidth - 2); // \"│ \" + content\n\tconst isPurple = opts.tone === \"compaction\" || opts.tone === \"skill\";\n\tconst borderColor =\n\t\topts.tone === \"user\"\n\t\t\t? \"border\"\n\t\t\t: isPurple\n\t\t\t\t? \"customMessageLabel\"\n\t\t\t\t: \"borderAccent\";\n\tconst borderMuted = isPurple ? \"customMessageLabel\" : \"borderMuted\";\n\tconst border = (s: string) => theme.fg(borderColor, s);\n\tconst leftRaw = opts.label;\n\tconst rightRaw =\n\t\topts.showTimestamp === false || !opts.timestamp\n\t\t\t? \"\"\n\t\t\t: formatTimestamp(opts.timestamp, opts.timestampFormat);\n\n\tconst leftBudget = rightRaw\n\t\t? Math.max(1, outerWidth - visibleWidth(rightRaw) - 1)\n\t\t: outerWidth;\n\tconst left = truncateToWidth(leftRaw, leftBudget, \"\");\n\tconst labelColor =\n\t\topts.tone === \"user\"\n\t\t\t? \"border\"\n\t\t\t: isPurple\n\t\t\t\t? \"customMessageLabel\"\n\t\t\t\t: \"borderAccent\";\n\tconst dashIdx = left.indexOf(\" - \");\n\tconst leftStyled =\n\t\tdashIdx >= 0\n\t\t\t? theme.fg(labelColor, theme.bold(left.slice(0, dashIdx))) +\n\t\t\t\ttheme.fg(\"dim\", left.slice(dashIdx))\n\t\t\t: theme.fg(labelColor, theme.bold(left));\n\tconst rightStyled = rightRaw ? theme.fg(\"dim\", rightRaw) : \"\";\n\tconst gap =\n\t\trightRaw.length > 0\n\t\t\t? Math.max(\n\t\t\t\t\t1,\n\t\t\t\t\touterWidth - visibleWidth(leftStyled) - visibleWidth(rightStyled),\n\t\t\t\t)\n\t\t\t: Math.max(0, outerWidth - visibleWidth(leftStyled));\n\tconst headerRow = `${leftStyled}${\" \".repeat(gap)}${rightStyled}`;\n\tconst headerPad = Math.max(0, outerWidth - visibleWidth(headerRow));\n\n\tconst bodyColor =\n\t\topts.tone === \"user\"\n\t\t\t? \"userMessageText\"\n\t\t\t: isPurple\n\t\t\t\t? \"customMessageText\"\n\t\t\t\t: \"assistantMessageText\";\n\tconst sourceLines = trimOuterBlankLines(contentLines);\n\tconst bodyLines = (sourceLines.length > 0 ? sourceLines : [\"\"]).map((line) => {\n\t\tconst clipped = truncateToWidth(line, contentWidth, \"\");\n\t\treturn theme.fg(bodyColor, clipped);\n\t});\n\n\treturn style()\n\t\t.border(\"rule\")\n\t\t.borderColor((line) => (line.startsWith(\"─\") ? theme.fg(borderMuted, line) : border(line)))\n\t\t.title(headerRow + \" \".repeat(headerPad))\n\t\t.render(bodyLines, outerWidth);\n}\n"]}
@@ -1,3 +1,4 @@
1
+ // GSD2 TUI Tests - Runtime coverage for tool-card cleanup and success notification rendering.
1
2
  // Runtime regression tests for the post-compaction tool-card cleanup and the
2
3
  // green-bordered success-notification rendering. Replaces the source-grep
3
4
  // `src/tests/tui-running-and-success-box.test.ts` that was deleted in #4875
@@ -51,16 +52,16 @@ function makeMockTUI() {
51
52
  }
52
53
  // ─── Bug 1: tool cards stuck in "Running" after compaction ──────────────
53
54
  describe("ToolExecutionComponent post-compaction cleanup", () => {
54
- it("renders 'Running' status while the tool call has no result", () => {
55
+ it("renders 'running' status while the tool call has no result", () => {
55
56
  // Baseline: a freshly-constructed component (mid-stream) must show
56
57
  // the running badge — this is the state we need to flip OUT of when
57
58
  // compaction removes the result message.
58
59
  const ui = makeMockTUI();
59
60
  const c = new ToolExecutionComponent("read_file", { path: "/tmp/x.txt" }, {}, undefined, ui);
60
61
  const rendered = c.render(60).map(stripAnsi).join("\n");
61
- assert.ok(rendered.includes("Running"), "freshly constructed component should render 'Running' badge");
62
+ assert.ok(rendered.includes("running"), "freshly constructed component should render 'running' badge");
62
63
  });
63
- it("markHistoricalNoResult flips a stuck tool card OUT of 'Running'", () => {
64
+ it("markHistoricalNoResult flips a stuck tool card OUT of 'running'", () => {
64
65
  // Real bug: after session-history replay (post-compaction or session
65
66
  // switch), tool calls without matching tool_result messages stay in
66
67
  // isPartial = true forever. markHistoricalNoResult must produce a
@@ -69,9 +70,9 @@ describe("ToolExecutionComponent post-compaction cleanup", () => {
69
70
  const c = new ToolExecutionComponent("read_file", { path: "/tmp/x.txt" }, {}, undefined, ui);
70
71
  c.markHistoricalNoResult();
71
72
  const rendered = c.render(60).map(stripAnsi).join("\n");
72
- assert.ok(!rendered.includes("Running"), "after markHistoricalNoResult, the tool card must NOT render 'Running' got:\n" +
73
+ assert.ok(!rendered.includes("running"), "after markHistoricalNoResult, the tool card must NOT render 'running' -- got:\n" +
73
74
  rendered);
74
- assert.ok(rendered.includes("Done"), "flipped card should render 'Done' status (no-result success)");
75
+ assert.ok(rendered.includes("success"), "flipped card should render 'success' status (no-result success)");
75
76
  });
76
77
  it("markHistoricalNoResult is idempotent when a real result already exists", () => {
77
78
  // Late-arriving stream events must not clobber legitimate results.
@@ -86,7 +87,7 @@ describe("ToolExecutionComponent post-compaction cleanup", () => {
86
87
  isError: false,
87
88
  }, false);
88
89
  const before = c.render(60).map(stripAnsi).join("\n");
89
- assert.ok(before.includes("Done"), "after complete(), card shows 'Done'");
90
+ assert.ok(before.includes("success"), "after complete(), card shows 'success'");
90
91
  c.markHistoricalNoResult(); // must early-return
91
92
  const after = c.render(60).map(stripAnsi).join("\n");
92
93
  assert.equal(after, before, "markHistoricalNoResult must NOT mutate state when a real result is already present");
@@ -1 +1 @@
1
- {"version":3,"file":"tool-card-cleanup-and-success-runtime.test.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,sBAAsB;AACtB,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,wEAAwE;AACxE,0EAA0E;AAC1E,4EAA4E;AAC5E,sBAAsB;AAEtB,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AACxG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACp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AC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,MAAM,CAAC,EAAE,CACR,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,EACtB,iEAAiE;YAChE,gEAAgE,CACjE,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;QAClF,qEAAqE;QACrE,qEAAqE;QACrE,kEAAkE;QAClE,0BAA0B;QAC1B,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvE,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,CAAC,EAAE,CACR,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EACrB,iEAAiE,CACjE,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// Runtime regression tests for the post-compaction tool-card cleanup and the\n// green-bordered success-notification rendering. Replaces the source-grep\n// `src/tests/tui-running-and-success-box.test.ts` that was deleted in #4875\n// (tracked as #4872).\n//\n// The previous tests asserted on identifier presence and method signature\n// shape via regex. A regression that routed `success` notifications through\n// `showStatus` (dim text) by accident would not have failed because the\n// `showSuccess` method would still exist and still match the regex. These\n// tests instead drive the components through the actual scenario and assert\n// on rendered output.\n\nimport assert from \"node:assert/strict\";\nimport { describe, it, before } from \"node:test\";\n\nimport { Container, Text } from \"@gsd/pi-tui\";\nimport stripAnsi from \"strip-ansi\";\n\nimport { initTheme, theme } from \"../theme/theme.js\";\nimport { renderExtensionNotifyInChat, shouldRenderExtensionNotifyInChat } from \"../interactive-mode.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\nimport { ToolExecutionComponent } from \"./tool-execution.js\";\n\n// Theme is a globalThis-shared singleton that throws if not initialized.\n// Initialize once before any test that exercises themed rendering.\nbefore(() => {\n\tinitTheme(\"dark\");\n});\n\ndescribe(\"Extension warning notifications\", () => {\n\tit(\"do not render into chat output\", () => {\n\t\tassert.equal(shouldRenderExtensionNotifyInChat(\"warning\"), false);\n\t\tassert.equal(shouldRenderExtensionNotifyInChat(\"error\"), true);\n\t\tassert.equal(shouldRenderExtensionNotifyInChat(\"success\"), true);\n\t\tassert.equal(shouldRenderExtensionNotifyInChat(\"info\"), true);\n\t\tassert.equal(shouldRenderExtensionNotifyInChat(undefined), true);\n\n\t\tconst warningChat = new Container();\n\t\tconst warningResult = renderExtensionNotifyInChat(warningChat, \"extension warning\", \"warning\");\n\t\tassert.equal(warningResult.rendered, false);\n\t\tassert.equal(\n\t\t\twarningChat.render(80).map(stripAnsi).join(\"\\n\"),\n\t\t\t\"\",\n\t\t\t\"warning notifications must not add chat output\",\n\t\t);\n\n\t\tfor (const type of [\"error\", \"success\", \"info\"] as const) {\n\t\t\tconst chat = new Container();\n\t\t\tconst result = renderExtensionNotifyInChat(chat, `${type} notification`, type);\n\t\t\tassert.equal(result.rendered, true, `${type} notification should render`);\n\t\t\tassert.match(\n\t\t\t\tchat.render(80).map(stripAnsi).join(\"\\n\"),\n\t\t\t\tnew RegExp(`${type} notification`),\n\t\t\t\t`${type} notification text should appear in chat output`,\n\t\t\t);\n\t\t}\n\t});\n});\n\ninterface MockTui {\n\trenderCount: number;\n\trequestRender(): void;\n}\n\nfunction makeMockTUI(): MockTui {\n\treturn {\n\t\trenderCount: 0,\n\t\trequestRender() {\n\t\t\tthis.renderCount++;\n\t\t},\n\t};\n}\n\n// ─── Bug 1: tool cards stuck in \"Running\" after compaction ──────────────\n\ndescribe(\"ToolExecutionComponent post-compaction cleanup\", () => {\n\tit(\"renders 'Running' status while the tool call has no result\", () => {\n\t\t// Baseline: a freshly-constructed component (mid-stream) must show\n\t\t// the running badge — this is the state we need to flip OUT of when\n\t\t// compaction removes the result message.\n\t\tconst ui = makeMockTUI();\n\t\tconst c = new ToolExecutionComponent(\n\t\t\t\"read_file\",\n\t\t\t{ path: \"/tmp/x.txt\" },\n\t\t\t{},\n\t\t\tundefined,\n\t\t\tui as never,\n\t\t);\n\t\tconst rendered = c.render(60).map(stripAnsi).join(\"\\n\");\n\t\tassert.ok(\n\t\t\trendered.includes(\"Running\"),\n\t\t\t\"freshly constructed component should render 'Running' badge\",\n\t\t);\n\t});\n\n\tit(\"markHistoricalNoResult flips a stuck tool card OUT of 'Running'\", () => {\n\t\t// Real bug: after session-history replay (post-compaction or session\n\t\t// switch), tool calls without matching tool_result messages stay in\n\t\t// isPartial = true forever. markHistoricalNoResult must produce a\n\t\t// rendered output that no longer reads \"Running\".\n\t\tconst ui = makeMockTUI();\n\t\tconst c = new ToolExecutionComponent(\n\t\t\t\"read_file\",\n\t\t\t{ path: \"/tmp/x.txt\" },\n\t\t\t{},\n\t\t\tundefined,\n\t\t\tui as never,\n\t\t);\n\n\t\tc.markHistoricalNoResult();\n\n\t\tconst rendered = c.render(60).map(stripAnsi).join(\"\\n\");\n\t\tassert.ok(\n\t\t\t!rendered.includes(\"Running\"),\n\t\t\t\"after markHistoricalNoResult, the tool card must NOT render 'Running' — got:\\n\" +\n\t\t\t\trendered,\n\t\t);\n\t\tassert.ok(\n\t\t\trendered.includes(\"Done\"),\n\t\t\t\"flipped card should render 'Done' status (no-result success)\",\n\t\t);\n\t});\n\n\tit(\"markHistoricalNoResult is idempotent when a real result already exists\", () => {\n\t\t// Late-arriving stream events must not clobber legitimate results.\n\t\t// We observe the no-clobber via behaviour: a card that completed\n\t\t// with a real result keeps its \"Done\" badge and content even if\n\t\t// markHistoricalNoResult fires again afterwards.\n\t\tconst ui = makeMockTUI();\n\t\tconst c = new ToolExecutionComponent(\n\t\t\t\"read_file\",\n\t\t\t{ path: \"/tmp/x.txt\" },\n\t\t\t{},\n\t\t\tundefined,\n\t\t\tui as never,\n\t\t);\n\n\t\t// Use the public completion path the runtime calls.\n\t\tc.updateResult(\n\t\t\t{\n\t\t\t\tcontent: [{ type: \"text\", text: \"real-result-payload\" }],\n\t\t\t\tisError: false,\n\t\t\t},\n\t\t\tfalse, // isPartial = false → \"Done\"\n\t\t);\n\n\t\tconst before = c.render(60).map(stripAnsi).join(\"\\n\");\n\t\tassert.ok(before.includes(\"Done\"), \"after complete(), card shows 'Done'\");\n\n\t\tc.markHistoricalNoResult(); // must early-return\n\t\tconst after = c.render(60).map(stripAnsi).join(\"\\n\");\n\t\tassert.equal(\n\t\t\tafter,\n\t\t\tbefore,\n\t\t\t\"markHistoricalNoResult must NOT mutate state when a real result is already present\",\n\t\t);\n\t});\n});\n\n// ─── Bug 2: success notifications render as a green bordered box ────────\n\ndescribe(\"Success-notification rendering — DynamicBorder + success theme\", () => {\n\t// We drive the same component composition that interactive-mode.showSuccess\n\t// builds (DynamicBorder + Text + DynamicBorder, all themed with\n\t// theme.fg(\"success\", …)) and assert on the rendered output, rather than\n\t// trying to instantiate the full InteractiveMode (which requires a real\n\t// session, bridge, and TUI runtime).\n\tfunction buildSuccessNotification(message: string): Container {\n\t\tconst c = new Container();\n\t\tconst successColor = (text: string) => theme.fg(\"success\", text);\n\t\tc.addChild(new DynamicBorder(successColor));\n\t\tc.addChild(new Text(theme.fg(\"success\", message), 1, 0));\n\t\tc.addChild(new DynamicBorder(successColor));\n\t\treturn c;\n\t}\n\n\tit(\"renders a top and bottom horizontal border framing the message\", () => {\n\t\tconst c = buildSuccessNotification(\"Milestone M042 ready.\");\n\t\tconst lines = c.render(40);\n\n\t\t// First and last lines should be horizontal-rule borders\n\t\t// (DynamicBorder renders a row of \"─\" characters).\n\t\tconst firstStripped = stripAnsi(lines[0]);\n\t\tconst lastStripped = stripAnsi(lines[lines.length - 1]);\n\n\t\tassert.ok(\n\t\t\tfirstStripped.includes(\"─\"),\n\t\t\t`first line should be a border (got: ${JSON.stringify(firstStripped)})`,\n\t\t);\n\t\tassert.ok(\n\t\t\tlastStripped.includes(\"─\"),\n\t\t\t`last line should be a border (got: ${JSON.stringify(lastStripped)})`,\n\t\t);\n\t\tassert.ok(\n\t\t\tlines.length >= 3,\n\t\t\t`success notification must have at least 3 lines (top border, message, bottom border) — got ${lines.length}`,\n\t\t);\n\t});\n\n\tit(\"the message text appears between the two borders\", () => {\n\t\tconst c = buildSuccessNotification(\"Milestone M042 ready.\");\n\t\tconst lines = c.render(40);\n\n\t\tconst messageRow = lines.findIndex((l) => stripAnsi(l).includes(\"Milestone M042 ready.\"));\n\t\tassert.ok(messageRow > 0, \"message must appear after the top border\");\n\t\tassert.ok(\n\t\t\tmessageRow < lines.length - 1,\n\t\t\t\"message must appear before the bottom border\",\n\t\t);\n\t});\n\n\tit(\"borders carry ANSI styling (not plain dim text like showStatus)\", () => {\n\t\t// Goodhart-resistant: if a regression routed success through\n\t\t// showStatus, the borders would be missing AND the rendered text\n\t\t// would be plain (or only dim-styled, not success-colored). We\n\t\t// observe the border lines carry ANSI escape codes — the literal\n\t\t// foreground color depends on the theme (which is system-dependent\n\t\t// in CI), so we don't pin a specific code but DO require styling\n\t\t// to be present.\n\t\tconst c = buildSuccessNotification(\"ok\");\n\t\tconst lines = c.render(40);\n\t\tconst top = lines[0];\n\t\tassert.ok(\n\t\t\ttop !== stripAnsi(top),\n\t\t\t\"top border must contain ANSI styling — a plain unstyled border \" +\n\t\t\t\t\"would indicate the rendering bypassed theme.fg('success', ...)\",\n\t\t);\n\t});\n\n\tit(\"plain Text status (the showStatus path) does NOT produce a bordered box\", () => {\n\t\t// Counter-test: this is what the bug looked like — a single dim Text\n\t\t// with no surrounding border. If anyone ever \"fixes\" the showSuccess\n\t\t// regression by also adding borders to showStatus, this test will\n\t\t// surface the conflation.\n\t\tconst plain = new Text(theme.fg(\"dim\", \"Milestone M042 ready.\"), 1, 0);\n\t\tconst lines = plain.render(40);\n\t\tconst joined = lines.map(stripAnsi).join(\"\\n\");\n\t\tassert.ok(\n\t\t\t!joined.includes(\"─\"),\n\t\t\t\"plain Text (showStatus path) must NOT contain border characters\",\n\t\t);\n\t});\n});\n"]}
1
+ {"version":3,"file":"tool-card-cleanup-and-success-runtime.test.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,sBAAsB;AACtB,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,wEAAwE;AACxE,0EAA0E;AAC1E,4EAA4E;AAC5E,sBAAsB;AAEtB,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AACxG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,yEAAyE;AACzE,mEAAmE;AACnE,MAAM,CAAC,GAAG,EAAE;IACX,SAAS,CAAC,MAAM,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAChD,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACzC,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC;QAClE,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,OAAO,CAAC,EAAE,IAAI,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AAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvE,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,CAAC,EAAE,CACR,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EACrB,iEAAiE,CACjE,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// GSD2 TUI Tests - Runtime coverage for tool-card cleanup and success notification rendering.\n// Runtime regression tests for the post-compaction tool-card cleanup and the\n// green-bordered success-notification rendering. Replaces the source-grep\n// `src/tests/tui-running-and-success-box.test.ts` that was deleted in #4875\n// (tracked as #4872).\n//\n// The previous tests asserted on identifier presence and method signature\n// shape via regex. A regression that routed `success` notifications through\n// `showStatus` (dim text) by accident would not have failed because the\n// `showSuccess` method would still exist and still match the regex. These\n// tests instead drive the components through the actual scenario and assert\n// on rendered output.\n\nimport assert from \"node:assert/strict\";\nimport { describe, it, before } from \"node:test\";\n\nimport { Container, Text } from \"@gsd/pi-tui\";\nimport stripAnsi from \"strip-ansi\";\n\nimport { initTheme, theme } from \"../theme/theme.js\";\nimport { renderExtensionNotifyInChat, shouldRenderExtensionNotifyInChat } from \"../interactive-mode.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\nimport { ToolExecutionComponent } from \"./tool-execution.js\";\n\n// Theme is a globalThis-shared singleton that throws if not initialized.\n// Initialize once before any test that exercises themed rendering.\nbefore(() => {\n\tinitTheme(\"dark\");\n});\n\ndescribe(\"Extension warning notifications\", () => {\n\tit(\"do not render into chat output\", () => {\n\t\tassert.equal(shouldRenderExtensionNotifyInChat(\"warning\"), false);\n\t\tassert.equal(shouldRenderExtensionNotifyInChat(\"error\"), true);\n\t\tassert.equal(shouldRenderExtensionNotifyInChat(\"success\"), true);\n\t\tassert.equal(shouldRenderExtensionNotifyInChat(\"info\"), true);\n\t\tassert.equal(shouldRenderExtensionNotifyInChat(undefined), true);\n\n\t\tconst warningChat = new Container();\n\t\tconst warningResult = renderExtensionNotifyInChat(warningChat, \"extension warning\", \"warning\");\n\t\tassert.equal(warningResult.rendered, false);\n\t\tassert.equal(\n\t\t\twarningChat.render(80).map(stripAnsi).join(\"\\n\"),\n\t\t\t\"\",\n\t\t\t\"warning notifications must not add chat output\",\n\t\t);\n\n\t\tfor (const type of [\"error\", \"success\", \"info\"] as const) {\n\t\t\tconst chat = new Container();\n\t\t\tconst result = renderExtensionNotifyInChat(chat, `${type} notification`, type);\n\t\t\tassert.equal(result.rendered, true, `${type} notification should render`);\n\t\t\tassert.match(\n\t\t\t\tchat.render(80).map(stripAnsi).join(\"\\n\"),\n\t\t\t\tnew RegExp(`${type} notification`),\n\t\t\t\t`${type} notification text should appear in chat output`,\n\t\t\t);\n\t\t}\n\t});\n});\n\ninterface MockTui {\n\trenderCount: number;\n\trequestRender(): void;\n}\n\nfunction makeMockTUI(): MockTui {\n\treturn {\n\t\trenderCount: 0,\n\t\trequestRender() {\n\t\t\tthis.renderCount++;\n\t\t},\n\t};\n}\n\n// ─── Bug 1: tool cards stuck in \"Running\" after compaction ──────────────\n\ndescribe(\"ToolExecutionComponent post-compaction cleanup\", () => {\n\tit(\"renders 'running' status while the tool call has no result\", () => {\n\t\t// Baseline: a freshly-constructed component (mid-stream) must show\n\t\t// the running badge — this is the state we need to flip OUT of when\n\t\t// compaction removes the result message.\n\t\tconst ui = makeMockTUI();\n\t\tconst c = new ToolExecutionComponent(\n\t\t\t\"read_file\",\n\t\t\t{ path: \"/tmp/x.txt\" },\n\t\t\t{},\n\t\t\tundefined,\n\t\t\tui as never,\n\t\t);\n\t\tconst rendered = c.render(60).map(stripAnsi).join(\"\\n\");\n\t\tassert.ok(\n\t\t\trendered.includes(\"running\"),\n\t\t\t\"freshly constructed component should render 'running' badge\",\n\t\t);\n\t});\n\n\tit(\"markHistoricalNoResult flips a stuck tool card OUT of 'running'\", () => {\n\t\t// Real bug: after session-history replay (post-compaction or session\n\t\t// switch), tool calls without matching tool_result messages stay in\n\t\t// isPartial = true forever. markHistoricalNoResult must produce a\n\t\t// rendered output that no longer reads \"Running\".\n\t\tconst ui = makeMockTUI();\n\t\tconst c = new ToolExecutionComponent(\n\t\t\t\"read_file\",\n\t\t\t{ path: \"/tmp/x.txt\" },\n\t\t\t{},\n\t\t\tundefined,\n\t\t\tui as never,\n\t\t);\n\n\t\tc.markHistoricalNoResult();\n\n\t\tconst rendered = c.render(60).map(stripAnsi).join(\"\\n\");\n\t\tassert.ok(\n\t\t\t!rendered.includes(\"running\"),\n\t\t\t\"after markHistoricalNoResult, the tool card must NOT render 'running' -- got:\\n\" +\n\t\t\t\trendered,\n\t\t);\n\t\tassert.ok(\n\t\t\trendered.includes(\"success\"),\n\t\t\t\"flipped card should render 'success' status (no-result success)\",\n\t\t);\n\t});\n\n\tit(\"markHistoricalNoResult is idempotent when a real result already exists\", () => {\n\t\t// Late-arriving stream events must not clobber legitimate results.\n\t\t// We observe the no-clobber via behaviour: a card that completed\n\t\t// with a real result keeps its \"Done\" badge and content even if\n\t\t// markHistoricalNoResult fires again afterwards.\n\t\tconst ui = makeMockTUI();\n\t\tconst c = new ToolExecutionComponent(\n\t\t\t\"read_file\",\n\t\t\t{ path: \"/tmp/x.txt\" },\n\t\t\t{},\n\t\t\tundefined,\n\t\t\tui as never,\n\t\t);\n\n\t\t// Use the public completion path the runtime calls.\n\t\tc.updateResult(\n\t\t\t{\n\t\t\t\tcontent: [{ type: \"text\", text: \"real-result-payload\" }],\n\t\t\t\tisError: false,\n\t\t\t},\n\t\t\tfalse, // isPartial = false → \"Done\"\n\t\t);\n\n\t\tconst before = c.render(60).map(stripAnsi).join(\"\\n\");\n\t\tassert.ok(before.includes(\"success\"), \"after complete(), card shows 'success'\");\n\n\t\tc.markHistoricalNoResult(); // must early-return\n\t\tconst after = c.render(60).map(stripAnsi).join(\"\\n\");\n\t\tassert.equal(\n\t\t\tafter,\n\t\t\tbefore,\n\t\t\t\"markHistoricalNoResult must NOT mutate state when a real result is already present\",\n\t\t);\n\t});\n});\n\n// ─── Bug 2: success notifications render as a green bordered box ────────\n\ndescribe(\"Success-notification rendering — DynamicBorder + success theme\", () => {\n\t// We drive the same component composition that interactive-mode.showSuccess\n\t// builds (DynamicBorder + Text + DynamicBorder, all themed with\n\t// theme.fg(\"success\", …)) and assert on the rendered output, rather than\n\t// trying to instantiate the full InteractiveMode (which requires a real\n\t// session, bridge, and TUI runtime).\n\tfunction buildSuccessNotification(message: string): Container {\n\t\tconst c = new Container();\n\t\tconst successColor = (text: string) => theme.fg(\"success\", text);\n\t\tc.addChild(new DynamicBorder(successColor));\n\t\tc.addChild(new Text(theme.fg(\"success\", message), 1, 0));\n\t\tc.addChild(new DynamicBorder(successColor));\n\t\treturn c;\n\t}\n\n\tit(\"renders a top and bottom horizontal border framing the message\", () => {\n\t\tconst c = buildSuccessNotification(\"Milestone M042 ready.\");\n\t\tconst lines = c.render(40);\n\n\t\t// First and last lines should be horizontal-rule borders\n\t\t// (DynamicBorder renders a row of \"─\" characters).\n\t\tconst firstStripped = stripAnsi(lines[0]);\n\t\tconst lastStripped = stripAnsi(lines[lines.length - 1]);\n\n\t\tassert.ok(\n\t\t\tfirstStripped.includes(\"─\"),\n\t\t\t`first line should be a border (got: ${JSON.stringify(firstStripped)})`,\n\t\t);\n\t\tassert.ok(\n\t\t\tlastStripped.includes(\"─\"),\n\t\t\t`last line should be a border (got: ${JSON.stringify(lastStripped)})`,\n\t\t);\n\t\tassert.ok(\n\t\t\tlines.length >= 3,\n\t\t\t`success notification must have at least 3 lines (top border, message, bottom border) — got ${lines.length}`,\n\t\t);\n\t});\n\n\tit(\"the message text appears between the two borders\", () => {\n\t\tconst c = buildSuccessNotification(\"Milestone M042 ready.\");\n\t\tconst lines = c.render(40);\n\n\t\tconst messageRow = lines.findIndex((l) => stripAnsi(l).includes(\"Milestone M042 ready.\"));\n\t\tassert.ok(messageRow > 0, \"message must appear after the top border\");\n\t\tassert.ok(\n\t\t\tmessageRow < lines.length - 1,\n\t\t\t\"message must appear before the bottom border\",\n\t\t);\n\t});\n\n\tit(\"borders carry ANSI styling (not plain dim text like showStatus)\", () => {\n\t\t// Goodhart-resistant: if a regression routed success through\n\t\t// showStatus, the borders would be missing AND the rendered text\n\t\t// would be plain (or only dim-styled, not success-colored). We\n\t\t// observe the border lines carry ANSI escape codes — the literal\n\t\t// foreground color depends on the theme (which is system-dependent\n\t\t// in CI), so we don't pin a specific code but DO require styling\n\t\t// to be present.\n\t\tconst c = buildSuccessNotification(\"ok\");\n\t\tconst lines = c.render(40);\n\t\tconst top = lines[0];\n\t\tassert.ok(\n\t\t\ttop !== stripAnsi(top),\n\t\t\t\"top border must contain ANSI styling — a plain unstyled border \" +\n\t\t\t\t\"would indicate the rendering bypassed theme.fg('success', ...)\",\n\t\t);\n\t});\n\n\tit(\"plain Text status (the showStatus path) does NOT produce a bordered box\", () => {\n\t\t// Counter-test: this is what the bug looked like — a single dim Text\n\t\t// with no surrounding border. If anyone ever \"fixes\" the showSuccess\n\t\t// regression by also adding borders to showStatus, this test will\n\t\t// surface the conflation.\n\t\tconst plain = new Text(theme.fg(\"dim\", \"Milestone M042 ready.\"), 1, 0);\n\t\tconst lines = plain.render(40);\n\t\tconst joined = lines.map(stripAnsi).join(\"\\n\");\n\t\tassert.ok(\n\t\t\t!joined.includes(\"─\"),\n\t\t\t\"plain Text (showStatus path) must NOT contain border characters\",\n\t\t);\n\t});\n});\n"]}
@@ -1,5 +1,10 @@
1
1
  import { Container, type TUI } from "@gsd/pi-tui";
2
2
  import type { ToolDefinition } from "../../../core/extensions/types.js";
3
+ export type ToolExecutionPhase = {
4
+ label: string;
5
+ count: number;
6
+ durationMs: number;
7
+ };
3
8
  export interface ToolExecutionOptions {
4
9
  showImages?: boolean;
5
10
  }
@@ -84,6 +89,8 @@ export declare class ToolExecutionComponent extends Container {
84
89
  invalidate(): void;
85
90
  render(width: number): string[];
86
91
  private shouldRenderCompactSuccess;
92
+ getRollupPhase(): ToolExecutionPhase | null;
93
+ private getPhaseLabel;
87
94
  private getCompactSummary;
88
95
  private updateDisplay;
89
96
  /**
@@ -93,4 +100,10 @@ export declare class ToolExecutionComponent extends Container {
93
100
  private getTextOutput;
94
101
  private formatToolExecution;
95
102
  }
103
+ export declare class ToolPhaseSummaryComponent extends Container {
104
+ private readonly phases;
105
+ constructor(phases: ToolExecutionPhase[]);
106
+ getPhases(): ToolExecutionPhase[];
107
+ render(width: number): string[];
108
+ }
96
109
  //# sourceMappingURL=tool-execution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,SAAS,EAQT,KAAK,GAAG,EAGR,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAmKxE,MAAM,WAAW,oBAAoB;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAUD;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;IACpD,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,WAAW,CAAO;IAC1B,OAAO,CAAC,eAAe,CAAe;IACtC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,cAAc,CAAC,CAAiB;IACxC,OAAO,CAAC,EAAE,CAAM;IAChB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;IACxC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,MAAM,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AQ,EAAE,OAAO,GAAG,IAAI;IAKpC,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAKzB,UAAU,IAAI,IAAI;IAKlB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IA+BxC,OAAO,CAAC,0BAA0B;IAMlC,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,aAAa;IAoKrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA+EzB,OAAO,CAAC,aAAa;IA0BrB,OAAO,CAAC,mBAAmB;CAsX3B"}
1
+ {"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,SAAS,EAQT,KAAK,GAAG,EAGR,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AA2IxE,MAAM,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACnB,CAAC;AA+CF,MAAM,WAAW,oBAAoB;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAUD;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;IACpD,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,WAAW,CAAO;IAC1B,OAAO,CAAC,eAAe,CAAe;IACtC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,cAAc,CAAC,CAAiB;IACxC,OAAO,CAAC,EAAE,CAAM;IAChB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;IACx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