gsd-pi 2.75.0-dev.063e5a3 → 2.75.0-dev.fd2382b9f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (606) hide show
  1. package/README.md +186 -149
  2. package/dist/claude-cli-check.d.ts +10 -0
  3. package/dist/claude-cli-check.js +13 -3
  4. package/dist/headless-events.d.ts +1 -1
  5. package/dist/headless-events.js +5 -2
  6. package/dist/headless.js +5 -6
  7. package/dist/loader.js +0 -0
  8. package/dist/onboarding.js +39 -14
  9. package/dist/resources/extensions/ask-user-questions.js +17 -5
  10. package/dist/resources/extensions/claude-code-cli/models.js +9 -0
  11. package/dist/resources/extensions/claude-code-cli/readiness.js +12 -2
  12. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +76 -4
  13. package/dist/resources/extensions/gsd/auto/detect-stuck.js +9 -0
  14. package/dist/resources/extensions/gsd/auto/loop.js +67 -4
  15. package/dist/resources/extensions/gsd/auto/phases.js +70 -47
  16. package/dist/resources/extensions/gsd/auto/resolve.js +1 -1
  17. package/dist/resources/extensions/gsd/auto/run-unit.js +10 -1
  18. package/dist/resources/extensions/gsd/auto/session.js +5 -0
  19. package/dist/resources/extensions/gsd/auto-artifact-paths.js +20 -0
  20. package/dist/resources/extensions/gsd/auto-dashboard.js +15 -7
  21. package/dist/resources/extensions/gsd/auto-dispatch.js +112 -6
  22. package/dist/resources/extensions/gsd/auto-loop.js +1 -1
  23. package/dist/resources/extensions/gsd/auto-model-selection.js +10 -2
  24. package/dist/resources/extensions/gsd/auto-post-unit.js +9 -7
  25. package/dist/resources/extensions/gsd/auto-prompts.js +151 -37
  26. package/dist/resources/extensions/gsd/auto-recovery.js +57 -0
  27. package/dist/resources/extensions/gsd/auto-start.js +5 -3
  28. package/dist/resources/extensions/gsd/auto-verification.js +3 -3
  29. package/dist/resources/extensions/gsd/auto-worktree.js +55 -1
  30. package/dist/resources/extensions/gsd/auto.js +50 -25
  31. package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +8 -21
  32. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +22 -4
  33. package/dist/resources/extensions/gsd/bootstrap/query-tools.js +29 -0
  34. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +22 -0
  35. package/dist/resources/extensions/gsd/commands/catalog.js +67 -3
  36. package/dist/resources/extensions/gsd/commands/handlers/core.js +6 -0
  37. package/dist/resources/extensions/gsd/commands/handlers/escalate.js +171 -0
  38. package/dist/resources/extensions/gsd/commands/handlers/ops.js +16 -0
  39. package/dist/resources/extensions/gsd/commands/handlers/workflow.js +228 -29
  40. package/dist/resources/extensions/gsd/commands-cmux.js +5 -2
  41. package/dist/resources/extensions/gsd/commands-debug.js +388 -0
  42. package/dist/resources/extensions/gsd/commands-do.js +1 -0
  43. package/dist/resources/extensions/gsd/commands-handlers.js +21 -2
  44. package/dist/resources/extensions/gsd/commands-prefs-wizard.js +1 -1
  45. package/dist/resources/extensions/gsd/commands-scan.js +94 -0
  46. package/dist/resources/extensions/gsd/commands-workflow-templates.js +101 -2
  47. package/dist/resources/extensions/gsd/custom-workflow-engine.js +74 -54
  48. package/dist/resources/extensions/gsd/db-writer.js +1 -0
  49. package/dist/resources/extensions/gsd/debug-session-store.js +238 -0
  50. package/dist/resources/extensions/gsd/definition-loader.js +7 -0
  51. package/dist/resources/extensions/gsd/docs/preferences-reference.md +9 -9
  52. package/dist/resources/extensions/gsd/doctor-git-checks.js +5 -1
  53. package/dist/resources/extensions/gsd/doctor-proactive.js +4 -1
  54. package/dist/resources/extensions/gsd/doctor-providers.js +48 -20
  55. package/dist/resources/extensions/gsd/doctor-runtime-checks.js +22 -4
  56. package/dist/resources/extensions/gsd/doctor.js +7 -1
  57. package/dist/resources/extensions/gsd/error-classifier.js +6 -3
  58. package/dist/resources/extensions/gsd/escalation.js +321 -0
  59. package/dist/resources/extensions/gsd/forensics.js +26 -29
  60. package/dist/resources/extensions/gsd/git-service.js +0 -1
  61. package/dist/resources/extensions/gsd/graph.js +26 -2
  62. package/dist/resources/extensions/gsd/gsd-db.js +254 -29
  63. package/dist/resources/extensions/gsd/health-widget-core.js +42 -14
  64. package/dist/resources/extensions/gsd/health-widget.js +7 -4
  65. package/dist/resources/extensions/gsd/metrics.js +1 -0
  66. package/dist/resources/extensions/gsd/model-cost-table.js +3 -1
  67. package/dist/resources/extensions/gsd/model-router.js +7 -1
  68. package/dist/resources/extensions/gsd/native-git-bridge.js +137 -5
  69. package/dist/resources/extensions/gsd/notification-widget.js +24 -39
  70. package/dist/resources/extensions/gsd/notifications.js +4 -0
  71. package/dist/resources/extensions/gsd/post-execution-checks.js +27 -11
  72. package/dist/resources/extensions/gsd/pre-execution-checks.js +97 -4
  73. package/dist/resources/extensions/gsd/preferences-models.js +1 -0
  74. package/dist/resources/extensions/gsd/preferences-types.js +2 -1
  75. package/dist/resources/extensions/gsd/preferences-validation.js +42 -8
  76. package/dist/resources/extensions/gsd/preferences.js +10 -10
  77. package/dist/resources/extensions/gsd/prompts/debug-diagnose.md +25 -0
  78. package/dist/resources/extensions/gsd/prompts/debug-session-manager.md +80 -0
  79. package/dist/resources/extensions/gsd/prompts/execute-task.md +12 -0
  80. package/dist/resources/extensions/gsd/prompts/plan-milestone.md +12 -0
  81. package/dist/resources/extensions/gsd/prompts/refine-slice.md +69 -0
  82. package/dist/resources/extensions/gsd/prompts/scan.md +79 -0
  83. package/dist/resources/extensions/gsd/prompts/workflow-oneshot.md +26 -0
  84. package/dist/resources/extensions/gsd/run-manager.js +37 -17
  85. package/dist/resources/extensions/gsd/state.js +47 -3
  86. package/dist/resources/extensions/gsd/templates/PREFERENCES.md +7 -7
  87. package/dist/resources/extensions/gsd/tools/complete-task.js +80 -0
  88. package/dist/resources/extensions/gsd/tools/plan-milestone.js +37 -12
  89. package/dist/resources/extensions/gsd/tools/plan-slice.js +5 -2
  90. package/dist/resources/extensions/gsd/uok/flags.js +7 -7
  91. package/dist/resources/extensions/gsd/uok/kernel.js +8 -3
  92. package/dist/resources/extensions/gsd/workflow-dispatch.js +64 -0
  93. package/dist/resources/extensions/gsd/workflow-install.js +327 -0
  94. package/dist/resources/extensions/gsd/workflow-manifest.js +8 -0
  95. package/dist/resources/extensions/gsd/workflow-mcp.js +1 -6
  96. package/dist/resources/extensions/gsd/workflow-plugins.js +346 -0
  97. package/dist/resources/extensions/gsd/workflow-templates/accessibility-audit.md +88 -0
  98. package/dist/resources/extensions/gsd/workflow-templates/api-breaking-change.md +117 -0
  99. package/dist/resources/extensions/gsd/workflow-templates/bugfix.md +1 -0
  100. package/dist/resources/extensions/gsd/workflow-templates/changelog-gen.md +82 -0
  101. package/dist/resources/extensions/gsd/workflow-templates/ci-bootstrap.md +144 -0
  102. package/dist/resources/extensions/gsd/workflow-templates/dead-code.md +81 -0
  103. package/dist/resources/extensions/gsd/workflow-templates/dep-upgrade.md +1 -0
  104. package/dist/resources/extensions/gsd/workflow-templates/docs-sync.yaml +76 -0
  105. package/dist/resources/extensions/gsd/workflow-templates/env-audit.yaml +88 -0
  106. package/dist/resources/extensions/gsd/workflow-templates/full-project.md +1 -0
  107. package/dist/resources/extensions/gsd/workflow-templates/hotfix.md +1 -0
  108. package/dist/resources/extensions/gsd/workflow-templates/issue-triage.md +84 -0
  109. package/dist/resources/extensions/gsd/workflow-templates/observability-setup.md +133 -0
  110. package/dist/resources/extensions/gsd/workflow-templates/onboarding-check.md +74 -0
  111. package/dist/resources/extensions/gsd/workflow-templates/performance-audit.md +125 -0
  112. package/dist/resources/extensions/gsd/workflow-templates/pr-review.md +67 -0
  113. package/dist/resources/extensions/gsd/workflow-templates/pr-triage.md +83 -0
  114. package/dist/resources/extensions/gsd/workflow-templates/refactor.md +1 -0
  115. package/dist/resources/extensions/gsd/workflow-templates/registry.json +184 -0
  116. package/dist/resources/extensions/gsd/workflow-templates/release.md +118 -0
  117. package/dist/resources/extensions/gsd/workflow-templates/rename-symbol.yaml +99 -0
  118. package/dist/resources/extensions/gsd/workflow-templates/security-audit.md +1 -0
  119. package/dist/resources/extensions/gsd/workflow-templates/small-feature.md +1 -0
  120. package/dist/resources/extensions/gsd/workflow-templates/spike.md +1 -0
  121. package/dist/resources/extensions/gsd/workflow-templates/test-backfill.yaml +73 -0
  122. package/dist/resources/extensions/gsd/worktree-resolver.js +42 -1
  123. package/dist/resources/extensions/remote-questions/commands.js +380 -0
  124. package/dist/resources/extensions/remote-questions/manager.js +39 -5
  125. package/dist/resources/extensions/remote-questions/telegram-adapter.js +79 -4
  126. package/dist/resources/extensions/shared/interview-ui.js +189 -1
  127. package/dist/resources/extensions/shared/layout-utils.js +17 -0
  128. package/dist/resources/extensions/shared/rtk-shared.js +47 -0
  129. package/dist/resources/extensions/shared/rtk.js +3 -46
  130. package/dist/resources/skills/create-workflow/SKILL.md +33 -6
  131. package/dist/rtk-shared.d.ts +10 -0
  132. package/dist/rtk-shared.js +47 -0
  133. package/dist/rtk.d.ts +2 -6
  134. package/dist/rtk.js +3 -48
  135. package/dist/shared/workspace-types.d.ts +52 -0
  136. package/dist/shared/workspace-types.js +1 -0
  137. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  138. package/dist/update-check.d.ts +10 -0
  139. package/dist/update-check.js +24 -3
  140. package/dist/web/standalone/.next/BUILD_ID +1 -1
  141. package/dist/web/standalone/.next/app-path-routes-manifest.json +6 -6
  142. package/dist/web/standalone/.next/build-manifest.json +3 -3
  143. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  144. package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
  145. package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  146. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  147. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  148. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  149. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  150. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  151. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  152. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  153. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  154. package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  155. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  156. package/dist/web/standalone/.next/server/app/_not-found.rsc +2 -2
  157. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  158. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  159. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  160. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  161. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  162. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  163. package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
  164. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  165. package/dist/web/standalone/.next/server/app/index.html +1 -1
  166. package/dist/web/standalone/.next/server/app/index.rsc +2 -2
  167. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  168. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
  169. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  170. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  171. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  172. package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  173. package/dist/web/standalone/.next/server/app-paths-manifest.json +6 -6
  174. package/dist/web/standalone/.next/server/chunks/6897.js +2 -2
  175. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  176. package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
  177. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  178. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  179. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  180. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  181. package/dist/web/standalone/.next/static/chunks/2826.02df9631042cc18e.js +9 -0
  182. package/dist/web/standalone/.next/static/chunks/{webpack-b868033a5834586d.js → webpack-6c7cda3e318eedb6.js} +1 -1
  183. package/dist/web/standalone/.next/static/css/3e9cdadb4d23b8a4.css +1 -0
  184. package/dist/welcome-screen.js +48 -24
  185. package/dist/wizard.js +2 -2
  186. package/dist/worktree-cli.d.ts +6 -5
  187. package/dist/worktree-cli.js +23 -7
  188. package/package.json +3 -3
  189. package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
  190. package/packages/native/tsconfig.tsbuildinfo +1 -1
  191. package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
  192. package/packages/pi-ai/dist/models/capability-patches.d.ts.map +1 -1
  193. package/packages/pi-ai/dist/models/capability-patches.js +3 -2
  194. package/packages/pi-ai/dist/models/capability-patches.js.map +1 -1
  195. package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts +68 -0
  196. package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts.map +1 -1
  197. package/packages/pi-ai/dist/models/generated/amazon-bedrock.js +68 -0
  198. package/packages/pi-ai/dist/models/generated/amazon-bedrock.js.map +1 -1
  199. package/packages/pi-ai/dist/models/generated/anthropic.d.ts +17 -0
  200. package/packages/pi-ai/dist/models/generated/anthropic.d.ts.map +1 -1
  201. package/packages/pi-ai/dist/models/generated/anthropic.js +17 -0
  202. package/packages/pi-ai/dist/models/generated/anthropic.js.map +1 -1
  203. package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts +17 -0
  204. package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts.map +1 -1
  205. package/packages/pi-ai/dist/models/generated/google-antigravity.js +17 -0
  206. package/packages/pi-ai/dist/models/generated/google-antigravity.js.map +1 -1
  207. package/packages/pi-ai/dist/models/generated/groq.d.ts +0 -153
  208. package/packages/pi-ai/dist/models/generated/groq.d.ts.map +1 -1
  209. package/packages/pi-ai/dist/models/generated/groq.js +0 -153
  210. package/packages/pi-ai/dist/models/generated/groq.js.map +1 -1
  211. package/packages/pi-ai/dist/models/generated/index.d.ts +136 -153
  212. package/packages/pi-ai/dist/models/generated/index.d.ts.map +1 -1
  213. package/packages/pi-ai/dist/models/generated/openai-codex.d.ts +17 -0
  214. package/packages/pi-ai/dist/models/generated/openai-codex.d.ts.map +1 -1
  215. package/packages/pi-ai/dist/models/generated/openai-codex.js +17 -0
  216. package/packages/pi-ai/dist/models/generated/openai-codex.js.map +1 -1
  217. package/packages/pi-ai/dist/models/generated/openrouter.d.ts +17 -0
  218. package/packages/pi-ai/dist/models/generated/openrouter.d.ts.map +1 -1
  219. package/packages/pi-ai/dist/models/generated/openrouter.js +17 -0
  220. package/packages/pi-ai/dist/models/generated/openrouter.js.map +1 -1
  221. package/packages/pi-ai/dist/models.generated.test.js +17 -0
  222. package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
  223. package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts +22 -1
  224. package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
  225. package/packages/pi-ai/dist/providers/amazon-bedrock.js +40 -6
  226. package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  227. package/packages/pi-ai/dist/providers/amazon-bedrock.test.d.ts +2 -0
  228. package/packages/pi-ai/dist/providers/amazon-bedrock.test.d.ts.map +1 -0
  229. package/packages/pi-ai/dist/providers/amazon-bedrock.test.js +106 -0
  230. package/packages/pi-ai/dist/providers/amazon-bedrock.test.js.map +1 -0
  231. package/packages/pi-ai/dist/providers/anthropic-auth.test.js +42 -1
  232. package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
  233. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts +20 -1
  234. package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
  235. package/packages/pi-ai/dist/providers/anthropic-shared.js +32 -2
  236. package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
  237. package/packages/pi-ai/dist/providers/anthropic-shared.test.js +12 -1
  238. package/packages/pi-ai/dist/providers/anthropic-shared.test.js.map +1 -1
  239. package/packages/pi-ai/dist/providers/anthropic.d.ts +11 -0
  240. package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  241. package/packages/pi-ai/dist/providers/anthropic.js +18 -1
  242. package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
  243. package/packages/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
  244. package/packages/pi-ai/dist/utils/oauth/openai-codex.js +12 -0
  245. package/packages/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
  246. package/packages/pi-ai/package.json +1 -1
  247. package/packages/pi-ai/scripts/generate-models.ts +50 -0
  248. package/packages/pi-ai/src/models/capability-patches.ts +5 -2
  249. package/packages/pi-ai/src/models/generated/amazon-bedrock.ts +68 -0
  250. package/packages/pi-ai/src/models/generated/anthropic.ts +17 -0
  251. package/packages/pi-ai/src/models/generated/google-antigravity.ts +17 -0
  252. package/packages/pi-ai/src/models/generated/groq.ts +0 -153
  253. package/packages/pi-ai/src/models/generated/openai-codex.ts +17 -0
  254. package/packages/pi-ai/src/models/generated/openrouter.ts +17 -0
  255. package/packages/pi-ai/src/models.generated.test.ts +17 -0
  256. package/packages/pi-ai/src/providers/amazon-bedrock.test.ts +164 -0
  257. package/packages/pi-ai/src/providers/amazon-bedrock.ts +41 -7
  258. package/packages/pi-ai/src/providers/anthropic-auth.test.ts +47 -1
  259. package/packages/pi-ai/src/providers/anthropic-shared.test.ts +15 -1
  260. package/packages/pi-ai/src/providers/anthropic-shared.ts +36 -3
  261. package/packages/pi-ai/src/providers/anthropic.ts +19 -1
  262. package/packages/pi-ai/src/utils/oauth/openai-codex.ts +15 -0
  263. package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
  264. package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.d.ts +2 -0
  265. package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.d.ts.map +1 -0
  266. package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js +38 -0
  267. package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -0
  268. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +14 -0
  269. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  270. package/packages/pi-coding-agent/dist/core/auth-storage.js +34 -0
  271. package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  272. package/packages/pi-coding-agent/dist/core/auth-storage.test.js +74 -0
  273. package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
  274. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +4 -1
  275. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  276. package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +32 -0
  277. package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
  278. package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  279. package/packages/pi-coding-agent/dist/core/sdk.js +32 -0
  280. package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
  281. package/packages/pi-coding-agent/dist/core/skill-tool.test.js +2 -2
  282. package/packages/pi-coding-agent/dist/core/skill-tool.test.js.map +1 -1
  283. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
  284. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +17 -7
  285. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
  286. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  287. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +48 -34
  288. package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  289. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts +4 -0
  290. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  291. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +83 -33
  292. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  293. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +70 -0
  294. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  295. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +77 -0
  296. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  297. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +1 -66
  298. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  299. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +1 -75
  300. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  301. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts +1 -1
  302. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  303. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +192 -24
  304. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
  305. package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +56 -0
  306. package/packages/pi-coding-agent/src/core/auth-storage.test.ts +83 -0
  307. package/packages/pi-coding-agent/src/core/auth-storage.ts +35 -0
  308. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +4 -1
  309. package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +37 -1
  310. package/packages/pi-coding-agent/src/core/sdk.ts +41 -0
  311. package/packages/pi-coding-agent/src/core/skill-tool.test.ts +2 -2
  312. package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +19 -7
  313. package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +53 -31
  314. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +88 -36
  315. package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +83 -0
  316. package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +2 -83
  317. package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +208 -27
  318. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  319. package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
  320. package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
  321. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts +70 -0
  322. package/pkg/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  323. package/pkg/dist/modes/interactive/theme/theme-schema.js +77 -0
  324. package/pkg/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  325. package/pkg/dist/modes/interactive/theme/theme.d.ts +1 -66
  326. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  327. package/pkg/dist/modes/interactive/theme/theme.js +1 -75
  328. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
  329. package/pkg/dist/modes/interactive/theme/themes.d.ts +1 -1
  330. package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
  331. package/pkg/dist/modes/interactive/theme/themes.js +192 -24
  332. package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
  333. package/src/resources/extensions/ask-user-questions.ts +24 -6
  334. package/src/resources/extensions/claude-code-cli/models.ts +9 -0
  335. package/src/resources/extensions/claude-code-cli/readiness.ts +13 -2
  336. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +94 -4
  337. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +84 -0
  338. package/src/resources/extensions/gsd/auto/detect-stuck.ts +10 -0
  339. package/src/resources/extensions/gsd/auto/loop-deps.ts +1 -0
  340. package/src/resources/extensions/gsd/auto/loop.ts +109 -3
  341. package/src/resources/extensions/gsd/auto/phases.ts +94 -60
  342. package/src/resources/extensions/gsd/auto/resolve.ts +1 -1
  343. package/src/resources/extensions/gsd/auto/run-unit.ts +11 -1
  344. package/src/resources/extensions/gsd/auto/session.ts +7 -0
  345. package/src/resources/extensions/gsd/auto-artifact-paths.ts +20 -0
  346. package/src/resources/extensions/gsd/auto-dashboard.ts +21 -4
  347. package/src/resources/extensions/gsd/auto-dispatch.ts +123 -5
  348. package/src/resources/extensions/gsd/auto-loop.ts +1 -1
  349. package/src/resources/extensions/gsd/auto-model-selection.ts +13 -2
  350. package/src/resources/extensions/gsd/auto-post-unit.ts +9 -7
  351. package/src/resources/extensions/gsd/auto-prompts.ts +178 -38
  352. package/src/resources/extensions/gsd/auto-recovery.ts +63 -1
  353. package/src/resources/extensions/gsd/auto-start.ts +8 -6
  354. package/src/resources/extensions/gsd/auto-verification.ts +3 -3
  355. package/src/resources/extensions/gsd/auto-worktree.ts +65 -0
  356. package/src/resources/extensions/gsd/auto.ts +53 -28
  357. package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +8 -21
  358. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +22 -4
  359. package/src/resources/extensions/gsd/bootstrap/query-tools.ts +31 -0
  360. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +22 -0
  361. package/src/resources/extensions/gsd/commands/catalog.ts +60 -3
  362. package/src/resources/extensions/gsd/commands/handlers/core.ts +6 -0
  363. package/src/resources/extensions/gsd/commands/handlers/escalate.ts +216 -0
  364. package/src/resources/extensions/gsd/commands/handlers/ops.ts +16 -0
  365. package/src/resources/extensions/gsd/commands/handlers/workflow.ts +279 -29
  366. package/src/resources/extensions/gsd/commands-cmux.ts +6 -2
  367. package/src/resources/extensions/gsd/commands-debug.ts +484 -0
  368. package/src/resources/extensions/gsd/commands-do.ts +1 -0
  369. package/src/resources/extensions/gsd/commands-handlers.ts +19 -2
  370. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +1 -1
  371. package/src/resources/extensions/gsd/commands-scan.ts +125 -0
  372. package/src/resources/extensions/gsd/commands-workflow-templates.ts +129 -2
  373. package/src/resources/extensions/gsd/custom-workflow-engine.ts +85 -60
  374. package/src/resources/extensions/gsd/db-writer.ts +3 -0
  375. package/src/resources/extensions/gsd/debug-session-store.ts +377 -0
  376. package/src/resources/extensions/gsd/definition-loader.ts +7 -0
  377. package/src/resources/extensions/gsd/docs/preferences-reference.md +9 -9
  378. package/src/resources/extensions/gsd/doctor-git-checks.ts +5 -1
  379. package/src/resources/extensions/gsd/doctor-proactive.ts +4 -1
  380. package/src/resources/extensions/gsd/doctor-providers.ts +52 -22
  381. package/src/resources/extensions/gsd/doctor-runtime-checks.ts +23 -4
  382. package/src/resources/extensions/gsd/doctor-types.ts +1 -0
  383. package/src/resources/extensions/gsd/doctor.ts +7 -1
  384. package/src/resources/extensions/gsd/error-classifier.ts +6 -3
  385. package/src/resources/extensions/gsd/escalation.ts +367 -0
  386. package/src/resources/extensions/gsd/forensics.ts +25 -29
  387. package/src/resources/extensions/gsd/git-service.ts +0 -1
  388. package/src/resources/extensions/gsd/graph.ts +33 -3
  389. package/src/resources/extensions/gsd/gsd-db.ts +306 -29
  390. package/src/resources/extensions/gsd/health-widget-core.ts +43 -14
  391. package/src/resources/extensions/gsd/health-widget.ts +7 -3
  392. package/src/resources/extensions/gsd/metrics.ts +1 -0
  393. package/src/resources/extensions/gsd/model-cost-table.ts +3 -1
  394. package/src/resources/extensions/gsd/model-router.ts +15 -1
  395. package/src/resources/extensions/gsd/native-git-bridge.ts +134 -6
  396. package/src/resources/extensions/gsd/notification-widget.ts +25 -43
  397. package/src/resources/extensions/gsd/notifications.ts +6 -0
  398. package/src/resources/extensions/gsd/post-execution-checks.ts +37 -14
  399. package/src/resources/extensions/gsd/pre-execution-checks.ts +98 -8
  400. package/src/resources/extensions/gsd/preferences-models.ts +1 -0
  401. package/src/resources/extensions/gsd/preferences-types.ts +10 -2
  402. package/src/resources/extensions/gsd/preferences-validation.ts +33 -7
  403. package/src/resources/extensions/gsd/preferences.ts +10 -10
  404. package/src/resources/extensions/gsd/prompts/debug-diagnose.md +25 -0
  405. package/src/resources/extensions/gsd/prompts/debug-session-manager.md +80 -0
  406. package/src/resources/extensions/gsd/prompts/execute-task.md +12 -0
  407. package/src/resources/extensions/gsd/prompts/plan-milestone.md +12 -0
  408. package/src/resources/extensions/gsd/prompts/refine-slice.md +69 -0
  409. package/src/resources/extensions/gsd/prompts/scan.md +79 -0
  410. package/src/resources/extensions/gsd/prompts/workflow-oneshot.md +26 -0
  411. package/src/resources/extensions/gsd/run-manager.ts +53 -19
  412. package/src/resources/extensions/gsd/state.ts +50 -2
  413. package/src/resources/extensions/gsd/templates/PREFERENCES.md +7 -7
  414. package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +1 -34
  415. package/src/resources/extensions/gsd/tests/artifact-corruption-2630.test.ts +7 -0
  416. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +45 -31
  417. package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +123 -1
  418. package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +39 -0
  419. package/src/resources/extensions/gsd/tests/autocomplete-regressions-1675.test.ts +39 -0
  420. package/src/resources/extensions/gsd/tests/commands-do.test.ts +48 -0
  421. package/src/resources/extensions/gsd/tests/commands-scan.test.ts +351 -0
  422. package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +8 -6
  423. package/src/resources/extensions/gsd/tests/complete-slice.test.ts +2 -2
  424. package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
  425. package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +63 -0
  426. package/src/resources/extensions/gsd/tests/debug-command-handler.test.ts +905 -0
  427. package/src/resources/extensions/gsd/tests/debug-command-lifecycle.integration.test.ts +1229 -0
  428. package/src/resources/extensions/gsd/tests/debug-session-store.test.ts +565 -0
  429. package/src/resources/extensions/gsd/tests/discuss-milestone-structured-questions.test.ts +64 -0
  430. package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +67 -0
  431. package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +62 -18
  432. package/src/resources/extensions/gsd/tests/enhanced-verification-integration.test.ts +5 -0
  433. package/src/resources/extensions/gsd/tests/escalation.test.ts +818 -0
  434. package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +29 -12
  435. package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +106 -0
  436. package/src/resources/extensions/gsd/tests/forensics-hook-key-parse.test.ts +74 -0
  437. package/src/resources/extensions/gsd/tests/graph-operations.test.ts +0 -4
  438. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +44 -1
  439. package/src/resources/extensions/gsd/tests/health-widget.test.ts +8 -2
  440. package/src/resources/extensions/gsd/tests/integration/doctor-git.test.ts +39 -0
  441. package/src/resources/extensions/gsd/tests/integration/doctor-proactive.test.ts +44 -0
  442. package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +68 -1
  443. package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +109 -11
  444. package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +51 -0
  445. package/src/resources/extensions/gsd/tests/integration/test-isolation.ts +53 -0
  446. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +171 -1
  447. package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
  448. package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
  449. package/src/resources/extensions/gsd/tests/milestone-status-tool.test.ts +3 -2
  450. package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +2 -2
  451. package/src/resources/extensions/gsd/tests/model-router.test.ts +1 -1
  452. package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +59 -0
  453. package/src/resources/extensions/gsd/tests/notification-widget.test.ts +1 -1
  454. package/src/resources/extensions/gsd/tests/plan-slice.test.ts +17 -0
  455. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +105 -1
  456. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +275 -6
  457. package/src/resources/extensions/gsd/tests/preferences.test.ts +69 -1
  458. package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +539 -0
  459. package/src/resources/extensions/gsd/tests/projection-regression.test.ts +7 -0
  460. package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +27 -0
  461. package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +24 -0
  462. package/src/resources/extensions/gsd/tests/prompt-db.test.ts +1 -1
  463. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +33 -0
  464. package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +67 -0
  465. package/src/resources/extensions/gsd/tests/remote-notification-from-desktop.test.ts +107 -0
  466. package/src/resources/extensions/gsd/tests/requirements.test.ts +9 -0
  467. package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +153 -0
  468. package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +16 -4
  469. package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +3 -0
  470. package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +15 -0
  471. package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +5 -0
  472. package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +2 -1
  473. package/src/resources/extensions/gsd/tests/uok-flags.test.ts +31 -1
  474. package/src/resources/extensions/gsd/tests/uok-kernel-path.test.ts +166 -0
  475. package/src/resources/extensions/gsd/tests/workflow-install.test.ts +113 -0
  476. package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +15 -6
  477. package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +2 -2
  478. package/src/resources/extensions/gsd/tests/workflow-plugins.test.ts +310 -0
  479. package/src/resources/extensions/gsd/tests/workflow-projections.test.ts +7 -0
  480. package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +8 -2
  481. package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +2 -1
  482. package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +77 -2
  483. package/src/resources/extensions/gsd/tools/complete-task.ts +87 -0
  484. package/src/resources/extensions/gsd/tools/plan-milestone.ts +42 -8
  485. package/src/resources/extensions/gsd/tools/plan-slice.ts +6 -1
  486. package/src/resources/extensions/gsd/types.ts +62 -0
  487. package/src/resources/extensions/gsd/unit-runtime.ts +1 -0
  488. package/src/resources/extensions/gsd/uok/contracts.ts +2 -1
  489. package/src/resources/extensions/gsd/uok/flags.ts +7 -7
  490. package/src/resources/extensions/gsd/uok/kernel.ts +16 -4
  491. package/src/resources/extensions/gsd/workflow-dispatch.ts +106 -0
  492. package/src/resources/extensions/gsd/workflow-install.ts +423 -0
  493. package/src/resources/extensions/gsd/workflow-manifest.ts +8 -0
  494. package/src/resources/extensions/gsd/workflow-mcp.ts +1 -6
  495. package/src/resources/extensions/gsd/workflow-plugins.ts +403 -0
  496. package/src/resources/extensions/gsd/workflow-templates/accessibility-audit.md +88 -0
  497. package/src/resources/extensions/gsd/workflow-templates/api-breaking-change.md +117 -0
  498. package/src/resources/extensions/gsd/workflow-templates/bugfix.md +1 -0
  499. package/src/resources/extensions/gsd/workflow-templates/changelog-gen.md +82 -0
  500. package/src/resources/extensions/gsd/workflow-templates/ci-bootstrap.md +144 -0
  501. package/src/resources/extensions/gsd/workflow-templates/dead-code.md +81 -0
  502. package/src/resources/extensions/gsd/workflow-templates/dep-upgrade.md +1 -0
  503. package/src/resources/extensions/gsd/workflow-templates/docs-sync.yaml +76 -0
  504. package/src/resources/extensions/gsd/workflow-templates/env-audit.yaml +88 -0
  505. package/src/resources/extensions/gsd/workflow-templates/full-project.md +1 -0
  506. package/src/resources/extensions/gsd/workflow-templates/hotfix.md +1 -0
  507. package/src/resources/extensions/gsd/workflow-templates/issue-triage.md +84 -0
  508. package/src/resources/extensions/gsd/workflow-templates/observability-setup.md +133 -0
  509. package/src/resources/extensions/gsd/workflow-templates/onboarding-check.md +74 -0
  510. package/src/resources/extensions/gsd/workflow-templates/performance-audit.md +125 -0
  511. package/src/resources/extensions/gsd/workflow-templates/pr-review.md +67 -0
  512. package/src/resources/extensions/gsd/workflow-templates/pr-triage.md +83 -0
  513. package/src/resources/extensions/gsd/workflow-templates/refactor.md +1 -0
  514. package/src/resources/extensions/gsd/workflow-templates/registry.json +184 -0
  515. package/src/resources/extensions/gsd/workflow-templates/release.md +118 -0
  516. package/src/resources/extensions/gsd/workflow-templates/rename-symbol.yaml +99 -0
  517. package/src/resources/extensions/gsd/workflow-templates/security-audit.md +1 -0
  518. package/src/resources/extensions/gsd/workflow-templates/small-feature.md +1 -0
  519. package/src/resources/extensions/gsd/workflow-templates/spike.md +1 -0
  520. package/src/resources/extensions/gsd/workflow-templates/test-backfill.yaml +73 -0
  521. package/src/resources/extensions/gsd/workflow-templates.ts +7 -0
  522. package/src/resources/extensions/gsd/workspace-index.ts +9 -4
  523. package/src/resources/extensions/gsd/worktree-resolver.ts +47 -1
  524. package/src/resources/extensions/remote-questions/commands.ts +480 -0
  525. package/src/resources/extensions/remote-questions/manager.ts +49 -4
  526. package/src/resources/extensions/remote-questions/telegram-adapter.ts +86 -4
  527. package/src/resources/extensions/remote-questions/tests/command-polling.test.ts +246 -0
  528. package/src/resources/extensions/remote-questions/tests/remote-answer-normalization.test.ts +92 -0
  529. package/src/resources/extensions/remote-questions/tests/telegram-commands.test.ts +267 -0
  530. package/src/resources/extensions/shared/interview-ui.ts +195 -1
  531. package/src/resources/extensions/shared/layout-utils.ts +26 -0
  532. package/src/resources/extensions/shared/rtk-shared.ts +58 -0
  533. package/src/resources/extensions/shared/rtk.ts +12 -52
  534. package/src/resources/extensions/shared/tests/interview-preview.test.ts +177 -0
  535. package/src/resources/extensions/shared/tests/preview-layout.test.ts +120 -0
  536. package/src/resources/skills/create-workflow/SKILL.md +33 -6
  537. package/dist/web/standalone/.next/static/chunks/2826.dd3dc8bbd3025fa5.js +0 -9
  538. package/dist/web/standalone/.next/static/css/f6e8833d46e738d8.css +0 -1
  539. package/packages/native/dist/ps/types.d.ts +0 -5
  540. package/packages/native/dist/ps/types.js +0 -2
  541. package/packages/native/src/ps/types.ts +0 -5
  542. package/packages/pi-ai/node_modules/@smithy/node-http-handler/LICENSE +0 -201
  543. package/packages/pi-ai/node_modules/@smithy/node-http-handler/README.md +0 -9
  544. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js +0 -762
  545. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +0 -19
  546. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/constants.js +0 -1
  547. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +0 -9
  548. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/index.js +0 -3
  549. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +0 -230
  550. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +0 -87
  551. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +0 -32
  552. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +0 -169
  553. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +0 -21
  554. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +0 -88
  555. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +0 -36
  556. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +0 -21
  557. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +0 -22
  558. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +0 -23
  559. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +0 -8
  560. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +0 -41
  561. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +0 -21
  562. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/timing.js +0 -4
  563. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +0 -63
  564. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +0 -10
  565. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +0 -5
  566. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +0 -4
  567. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +0 -3
  568. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +0 -46
  569. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +0 -24
  570. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +0 -12
  571. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +0 -63
  572. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +0 -13
  573. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +0 -12
  574. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +0 -2
  575. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +0 -6
  576. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +0 -6
  577. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +0 -2
  578. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +0 -5
  579. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +0 -6
  580. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +0 -13
  581. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +0 -8
  582. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +0 -10
  583. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +0 -5
  584. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +0 -4
  585. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +0 -3
  586. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +0 -46
  587. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +0 -24
  588. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +0 -12
  589. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +0 -63
  590. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +0 -13
  591. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +0 -12
  592. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +0 -2
  593. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +0 -6
  594. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +0 -6
  595. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +0 -2
  596. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +0 -5
  597. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +0 -6
  598. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +0 -13
  599. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +0 -8
  600. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +0 -12
  601. package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +0 -12
  602. package/packages/pi-ai/node_modules/@smithy/node-http-handler/package.json +0 -68
  603. package/packages/pi-ai/oauth.d.ts +0 -1
  604. package/packages/pi-ai/oauth.js +0 -1
  605. /package/dist/web/standalone/.next/static/{j7IBD35UgrL2b298GLK3V → jaWw1Jh0TYayjbfOrFe8D}/_buildManifest.js +0 -0
  606. /package/dist/web/standalone/.next/static/{j7IBD35UgrL2b298GLK3V → jaWw1Jh0TYayjbfOrFe8D}/_ssgManifest.js +0 -0
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Tests for Telegram command handling.
3
+ *
4
+ * Framework: node:test + node:assert/strict (CONTRIBUTING.md rules)
5
+ *
6
+ * Run:
7
+ * npm run test:unit
8
+ *
9
+ * Or directly after compiling:
10
+ * node scripts/compile-tests.mjs && \
11
+ * node --import ./scripts/dist-test-resolve.mjs \
12
+ * --experimental-test-isolation=process \
13
+ * --test "dist-test/src/resources/extensions/remote-questions/tests/*.test.js"
14
+ *
15
+ * Covers:
16
+ * - Command detection: messages starting with / are commands
17
+ * - /help returns a list of all commands
18
+ * - /status returns current GSD state
19
+ * - /pause writes a stop directive
20
+ * - Unknown commands return a helpful error + /help hint
21
+ * - Non-commands are NOT treated as commands (regression guard)
22
+ */
23
+
24
+ import test from "node:test";
25
+ import assert from "node:assert/strict";
26
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync, existsSync } from "node:fs";
27
+ import { join } from "node:path";
28
+ import { tmpdir } from "node:os";
29
+
30
+ import { isCommand, handleCommand, type CommandSender } from "../commands.ts";
31
+
32
+ // ─── Helpers ─────────────────────────────────────────────────────────────────
33
+
34
+ function makeBasePath(): string {
35
+ const dir = mkdtempSync(join(tmpdir(), "gsd-cmd-test-"));
36
+ // Create minimal .gsd directory structure
37
+ mkdirSync(join(dir, ".gsd", "activity"), { recursive: true });
38
+ mkdirSync(join(dir, ".gsd", "runtime"), { recursive: true });
39
+ return dir;
40
+ }
41
+
42
+ function makeCapturingSender(): { sender: CommandSender; messages: string[] } {
43
+ const messages: string[] = [];
44
+ const sender: CommandSender = {
45
+ async send(text: string) {
46
+ messages.push(text);
47
+ },
48
+ };
49
+ return { sender, messages };
50
+ }
51
+
52
+ // ─── isCommand ────────────────────────────────────────────────────────────────
53
+
54
+ test("isCommand: messages starting with / are commands", () => {
55
+ assert.equal(isCommand("/help"), true);
56
+ assert.equal(isCommand("/status"), true);
57
+ assert.equal(isCommand("/pause"), true);
58
+ assert.equal(isCommand("/resume"), true);
59
+ assert.equal(isCommand("/log 5"), true);
60
+ assert.equal(isCommand("/unknown_cmd"), true);
61
+ });
62
+
63
+ test("isCommand: bare slash without word character is not a command", () => {
64
+ assert.equal(isCommand("/ "), false);
65
+ assert.equal(isCommand("/"), false);
66
+ });
67
+
68
+ test("isCommand (regression guard): regular messages are NOT commands", () => {
69
+ assert.equal(isCommand("hello"), false);
70
+ assert.equal(isCommand("yes"), false);
71
+ assert.equal(isCommand("1"), false);
72
+ assert.equal(isCommand("A"), false);
73
+ assert.equal(isCommand(""), false);
74
+ assert.equal(isCommand("http://example.com"), false);
75
+ });
76
+
77
+ // ─── /help ────────────────────────────────────────────────────────────────────
78
+
79
+ test("/help returns a reply listing all expected commands", async (t) => {
80
+ const dir = makeBasePath();
81
+ const { sender, messages } = makeCapturingSender();
82
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
83
+
84
+ await handleCommand("/help", sender, dir);
85
+
86
+ assert.equal(messages.length, 1);
87
+ const reply = messages[0];
88
+ // Project prefix must be present
89
+ assert.ok(reply.startsWith("📁"), `Expected project prefix, got: ${reply}`);
90
+ // All supported commands must be mentioned
91
+ for (const cmd of ["/status", "/progress", "/budget", "/pause", "/resume", "/log", "/help"]) {
92
+ assert.ok(reply.includes(cmd), `Expected /help to mention ${cmd}`);
93
+ }
94
+ });
95
+
96
+ // ─── /status ─────────────────────────────────────────────────────────────────
97
+
98
+ test("/status returns GSD state text (idle when no active session)", async (t) => {
99
+ const dir = makeBasePath();
100
+ const { sender, messages } = makeCapturingSender();
101
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
102
+
103
+ await handleCommand("/status", sender, dir);
104
+
105
+ assert.equal(messages.length, 1);
106
+ const reply = messages[0];
107
+ assert.ok(reply.length > 0, "Expected non-empty status reply");
108
+ // Project prefix must be present
109
+ assert.ok(reply.startsWith("📁"), `Expected project prefix, got: ${reply}`);
110
+ // Should contain some state indication
111
+ assert.ok(
112
+ reply.toLowerCase().includes("state") || reply.toLowerCase().includes("gsd"),
113
+ `Expected status reply to mention state or GSD, got: ${reply}`,
114
+ );
115
+ });
116
+
117
+ test("/status reads paused-session.json when present", async (t) => {
118
+ const dir = makeBasePath();
119
+ const { sender, messages } = makeCapturingSender();
120
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
121
+
122
+ // Write a fake paused-session.json
123
+ const pausedMeta = {
124
+ milestoneId: "M001",
125
+ unitType: "execute-task",
126
+ unitId: "M001/S01/T01",
127
+ pausedAt: "2026-01-01T12:00:00.000Z",
128
+ };
129
+ writeFileSync(
130
+ join(dir, ".gsd", "runtime", "paused-session.json"),
131
+ JSON.stringify(pausedMeta),
132
+ "utf-8",
133
+ );
134
+
135
+ await handleCommand("/status", sender, dir);
136
+
137
+ assert.equal(messages.length, 1);
138
+ const reply = messages[0];
139
+ // Project prefix must be present
140
+ assert.ok(reply.startsWith("📁"), `Expected project prefix, got: ${reply}`);
141
+ assert.ok(reply.includes("M001"), `Expected milestone ID in status, got: ${reply}`);
142
+ });
143
+
144
+ // ─── /pause ──────────────────────────────────────────────────────────────────
145
+
146
+ test("/pause writes a stop capture to CAPTURES.md", async (t) => {
147
+ const dir = makeBasePath();
148
+ const { sender, messages } = makeCapturingSender();
149
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
150
+
151
+ await handleCommand("/pause", sender, dir);
152
+
153
+ assert.equal(messages.length, 1);
154
+ const reply = messages[0];
155
+
156
+ // Project prefix must be present
157
+ assert.ok(reply.startsWith("📁"), `Expected project prefix, got: ${reply}`);
158
+ // Reply should indicate success
159
+ assert.ok(
160
+ reply.toLowerCase().includes("pause") || reply.toLowerCase().includes("directive"),
161
+ `Expected pause confirmation, got: ${reply}`,
162
+ );
163
+
164
+ // CAPTURES.md should exist
165
+ const capturesPath = join(dir, ".gsd", "CAPTURES.md");
166
+ assert.ok(existsSync(capturesPath), "Expected CAPTURES.md to be created by /pause");
167
+
168
+ // The file should contain a stop classification
169
+ const { readFileSync } = await import("node:fs");
170
+ const content = readFileSync(capturesPath, "utf-8");
171
+ assert.ok(
172
+ content.includes("**Classification:** stop"),
173
+ `Expected stop classification in CAPTURES.md, got:\n${content}`,
174
+ );
175
+ });
176
+
177
+ // ─── /resume ─────────────────────────────────────────────────────────────────
178
+
179
+ test("/resume reports no pending directives when CAPTURES.md is empty", async (t) => {
180
+ const dir = makeBasePath();
181
+ const { sender, messages } = makeCapturingSender();
182
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
183
+
184
+ await handleCommand("/resume", sender, dir);
185
+
186
+ assert.equal(messages.length, 1);
187
+ const reply = messages[0];
188
+ // Project prefix must be present
189
+ assert.ok(reply.startsWith("📁"), `Expected project prefix, got: ${reply}`);
190
+ // Should report that there are no directives to clear
191
+ assert.ok(
192
+ reply.toLowerCase().includes("no pending") || reply.toLowerCase().includes("not paused"),
193
+ `Expected "no pending directives" message, got: ${reply}`,
194
+ );
195
+ });
196
+
197
+ // ─── Unknown command ──────────────────────────────────────────────────────────
198
+
199
+ test("unknown command returns helpful error message with /help hint", async (t) => {
200
+ const dir = makeBasePath();
201
+ const { sender, messages } = makeCapturingSender();
202
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
203
+
204
+ await handleCommand("/invalid_command", sender, dir);
205
+
206
+ assert.equal(messages.length, 1);
207
+ const reply = messages[0];
208
+ // Project prefix must be present
209
+ assert.ok(reply.startsWith("📁"), `Expected project prefix, got: ${reply}`);
210
+ assert.ok(reply.includes("/invalid_command"), "Expected unknown command name in reply");
211
+ assert.ok(reply.includes("/help"), "Expected /help hint in unknown command reply");
212
+ });
213
+
214
+ test("unknown command reply differs from /help output", async (t) => {
215
+ const dir = makeBasePath();
216
+ const { sender: helpSender, messages: helpMessages } = makeCapturingSender();
217
+ const { sender: unknownSender, messages: unknownMessages } = makeCapturingSender();
218
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
219
+
220
+ await handleCommand("/help", helpSender, dir);
221
+ await handleCommand("/notacommand", unknownSender, dir);
222
+
223
+ assert.notEqual(
224
+ helpMessages[0],
225
+ unknownMessages[0],
226
+ "Unknown command reply should differ from /help output",
227
+ );
228
+ });
229
+
230
+ // ─── /log ─────────────────────────────────────────────────────────────────────
231
+
232
+ test("/log returns a message (empty or with entries)", async (t) => {
233
+ const dir = makeBasePath();
234
+ const { sender, messages } = makeCapturingSender();
235
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
236
+
237
+ await handleCommand("/log", sender, dir);
238
+
239
+ assert.equal(messages.length, 1);
240
+ assert.ok(messages[0].length > 0, "Expected non-empty /log reply");
241
+ });
242
+
243
+ test("/log 3 limits output to last 3 entries", async (t) => {
244
+ const dir = makeBasePath();
245
+ const { sender, messages } = makeCapturingSender();
246
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
247
+
248
+ // Write 5 fake activity log files
249
+ const activityDir = join(dir, ".gsd", "activity");
250
+ for (let i = 1; i <= 5; i++) {
251
+ writeFileSync(
252
+ join(activityDir, `00${i}-execute-task-M001-S01-T0${i}.jsonl`),
253
+ '{"type":"toolCall","name":"bash"}\n',
254
+ "utf-8",
255
+ );
256
+ }
257
+
258
+ await handleCommand("/log 3", sender, dir);
259
+
260
+ assert.equal(messages.length, 1);
261
+ const reply = messages[0];
262
+ // Should mention "3" entries (the requested count)
263
+ assert.ok(reply.includes("3"), `Expected 3 entries in /log 3 reply, got: ${reply}`);
264
+ // Should not list all 5
265
+ const entryMatches = (reply.match(/#\d+/g) ?? []).length;
266
+ assert.ok(entryMatches <= 3, `Expected at most 3 entries, found ${entryMatches}`);
267
+ });
@@ -26,14 +26,16 @@
26
26
  */
27
27
 
28
28
  import type { ExtensionCommandContext } from "@gsd/pi-coding-agent";
29
- import { type Theme } from "@gsd/pi-coding-agent";
29
+ import { getMarkdownTheme, type Theme } from "@gsd/pi-coding-agent";
30
30
  import {
31
31
  Editor,
32
32
  Key,
33
+ Markdown,
33
34
  matchesKey,
34
35
  truncateToWidth,
35
36
  type TUI,
36
37
  } from "@gsd/pi-tui";
38
+ import { mergeSideBySide } from "./layout-utils.js";
37
39
  import { makeUI, INDENT } from "./ui.js";
38
40
 
39
41
  // ─── Exported types ───────────────────────────────────────────────────────────
@@ -41,6 +43,8 @@ import { makeUI, INDENT } from "./ui.js";
41
43
  export interface QuestionOption {
42
44
  label: string;
43
45
  description: string;
46
+ /** Optional markdown content shown in a side-by-side preview panel when this option is highlighted. */
47
+ preview?: string;
44
48
  }
45
49
 
46
50
  export interface Question {
@@ -113,6 +117,14 @@ export interface WrapUpOptions {
113
117
  const OTHER_OPTION_LABEL = "None of the above";
114
118
  const OTHER_OPTION_DESCRIPTION = "Select to type your own answer.";
115
119
 
120
+ // Preview layout constants
121
+ const MIN_PREVIEW_WIDTH = 30;
122
+ const MIN_OPTIONS_WIDTH = 30;
123
+ const PREVIEW_RATIO = 0.60; // preview gets the majority of the width
124
+ const DIVIDER_CHARS = " │ ";
125
+ const DIVIDER_WIDTH = 3;
126
+ const PREVIEW_MAX_LINES = 20; // hard cap — keeps total ≤ 24 rows for single-question
127
+
116
128
  // ─── Wrap-up screen ───────────────────────────────────────────────────────────
117
129
 
118
130
  export async function showWrapUpScreen(
@@ -520,6 +532,99 @@ export async function showInterviewRound(
520
532
  return lines;
521
533
  }
522
534
 
535
+ // ── Preview helpers ──────────────────────────────────────────────
536
+
537
+ let mdThemeCache: ReturnType<typeof getMarkdownTheme> | null = null;
538
+ let previewCache: { markdown: string; width: number; lines: string[] } | null = null;
539
+
540
+ function questionHasAnyPreview(): boolean {
541
+ return questions[currentIdx].options.some(
542
+ (o) => o.preview != null && o.preview.trim().length > 0,
543
+ );
544
+ }
545
+
546
+ function getCurrentPreview(): string | null {
547
+ const q = questions[currentIdx];
548
+ const idx = states[currentIdx].cursorIndex;
549
+ if (idx < q.options.length) {
550
+ const preview = q.options[idx].preview;
551
+ return preview && preview.trim().length > 0 ? preview : null;
552
+ }
553
+ return null;
554
+ }
555
+
556
+ function renderOptionsColumn(optWidth: number): string[] {
557
+ const ui = makeUI(theme, optWidth);
558
+ const col: string[] = [];
559
+ const push = (...rows: string[][]) => { for (const r of rows) col.push(...r); };
560
+
561
+ const q = questions[currentIdx];
562
+ const st = states[currentIdx];
563
+ const multiSel = isMultiSelect(currentIdx);
564
+
565
+ push(ui.question(` ${q.question}`));
566
+ if (multiSel) push(ui.meta(" (Select all that apply)"));
567
+ push(ui.blank());
568
+
569
+ for (let i = 0; i < q.options.length; i++) {
570
+ const opt = q.options[i];
571
+ const isCursor = i === st.cursorIndex;
572
+ if (multiSel) {
573
+ const isChecked = st.checkedIndices.has(i);
574
+ if (isCursor && !focusNotes) push(ui.checkboxSelected(opt.label, opt.description, isChecked));
575
+ else push(ui.checkboxUnselected(opt.label, opt.description, isChecked, focusNotes));
576
+ } else {
577
+ const isCommitted = i === st.committedIndex;
578
+ if (isCursor && !focusNotes) {
579
+ push(ui.optionSelected(i + 1, opt.label, opt.description, isCommitted));
580
+ } else {
581
+ push(ui.optionUnselected(i + 1, opt.label, opt.description, { isCommitted, isFocusDimmed: focusNotes }));
582
+ }
583
+ }
584
+ }
585
+
586
+ const ndIdx = noneOrDoneIdx(currentIdx);
587
+ const ndCursor = ndIdx === st.cursorIndex;
588
+ if (multiSel) {
589
+ push(ui.blank());
590
+ if (ndCursor && !focusNotes) push(ui.doneSelected());
591
+ else push(ui.doneUnselected());
592
+ } else {
593
+ const ndCommitted = ndIdx === st.committedIndex;
594
+ if (ndCursor && !focusNotes) {
595
+ push(ui.slotSelected(OTHER_OPTION_LABEL, OTHER_OPTION_DESCRIPTION, ndCommitted));
596
+ } else {
597
+ push(ui.slotUnselected(OTHER_OPTION_LABEL, OTHER_OPTION_DESCRIPTION, { isCommitted: ndCommitted, isFocusDimmed: focusNotes }));
598
+ }
599
+ }
600
+
601
+ if (st.notesVisible || focusNotes) {
602
+ push(ui.blank(), ui.notesLabel(focusNotes));
603
+ if (focusNotes) {
604
+ for (const line of getEditor().render(optWidth - 2)) col.push(truncateToWidth(` ${line}`, optWidth));
605
+ } else if (st.notes) {
606
+ push(ui.notesText(st.notes));
607
+ }
608
+ }
609
+
610
+ return col;
611
+ }
612
+
613
+ function renderPreviewColumn(markdown: string, previewWidth: number): string[] {
614
+ if (previewCache && previewCache.markdown === markdown && previewCache.width === previewWidth) {
615
+ return previewCache.lines;
616
+ }
617
+ if (!mdThemeCache) mdThemeCache = getMarkdownTheme();
618
+ const header = [
619
+ truncateToWidth(theme.fg("accent", theme.bold(" Preview")), previewWidth),
620
+ truncateToWidth(theme.fg("dim", " " + "─".repeat(Math.max(0, previewWidth - 2))), previewWidth),
621
+ ];
622
+ const md = new Markdown(markdown, 1, 0, mdThemeCache);
623
+ const lines = [...header, ...md.render(previewWidth)];
624
+ previewCache = { markdown, width: previewWidth, lines };
625
+ return lines;
626
+ }
627
+
523
628
  // ── Main render ──────────────────────────────────────────────────
524
629
 
525
630
  function render(width: number): string[] {
@@ -528,6 +633,95 @@ export async function showInterviewRound(
528
633
  if (showingExitConfirm) { cachedLines = renderExitConfirm(width); return cachedLines; }
529
634
  if (showingReview) { cachedLines = renderReviewScreen(width); return cachedLines; }
530
635
 
636
+ const useSideBySide = questionHasAnyPreview()
637
+ && width >= (MIN_OPTIONS_WIDTH + MIN_PREVIEW_WIDTH + DIVIDER_WIDTH);
638
+
639
+ if (useSideBySide) {
640
+ // ── Preview path ──────────────────────────────────────
641
+ const ui = makeUI(theme, width);
642
+ const lines: string[] = [];
643
+ const push = (...rows: string[][]) => { for (const r of rows) lines.push(...r); };
644
+
645
+ push(ui.bar());
646
+
647
+ if (isMultiQuestion) {
648
+ const unanswered = questions.filter((_, i) => !isQuestionAnswered(i)).length;
649
+ const answeredSet = new Set(questions.map((_, i) => i).filter(i => isQuestionAnswered(i)));
650
+ push(ui.questionTabs(questions.map(q => q.header), currentIdx, answeredSet));
651
+ push(ui.blank());
652
+ const progressParts = [
653
+ opts.progress,
654
+ `Question ${currentIdx + 1}/${questions.length}`,
655
+ unanswered > 0 ? `${unanswered} unanswered` : null,
656
+ ].filter(Boolean).join(" • ");
657
+ if (progressParts) push(ui.meta(` ${progressParts}`));
658
+ push(ui.blank());
659
+ } else {
660
+ if (opts.progress) push(ui.meta(` ${opts.progress}`), ui.blank());
661
+ }
662
+
663
+ // Side-by-side body — fixed height per render, capped to terminal.
664
+ // tuiChrome accounts for elements rendered outside the interview
665
+ // component: spinner/loader (1-2), status line (1), tool header (1),
666
+ // plus a safety margin for future additions.
667
+ const termRows = (typeof process !== "undefined" && process.stdout?.rows) || 24;
668
+ const footerLines = 3; // blank + hints + bar
669
+ const tuiChrome = 5;
670
+ const maxBody = Math.min(PREVIEW_MAX_LINES, Math.max(6, termRows - lines.length - footerLines - tuiChrome));
671
+
672
+ const previewWidth = Math.max(MIN_PREVIEW_WIDTH, Math.floor(width * PREVIEW_RATIO));
673
+ const leftWidth = Math.max(MIN_OPTIONS_WIDTH, width - previewWidth - DIVIDER_WIDTH);
674
+
675
+ const fullLeft = renderOptionsColumn(leftWidth);
676
+ const leftLines = fullLeft.slice(0, maxBody);
677
+ if (fullLeft.length > maxBody) {
678
+ const n = fullLeft.length - maxBody + 1;
679
+ const lbl = `+${n} lines hidden`;
680
+ const d = "─".repeat(Math.max(0, Math.floor((leftWidth - lbl.length - 2) / 2)));
681
+ leftLines[maxBody - 1] = truncateToWidth(theme.fg("dim", ` ${d} ${lbl} ${d}`), leftWidth);
682
+ }
683
+
684
+ const preview = getCurrentPreview();
685
+ const fullRight = preview ? renderPreviewColumn(preview, previewWidth) : [];
686
+ const rightLines = fullRight.slice(0, maxBody);
687
+ if (fullRight.length > maxBody) {
688
+ const n = fullRight.length - maxBody + 1;
689
+ const lbl = `+${n} lines hidden`;
690
+ const d = "─".repeat(Math.max(0, Math.floor((previewWidth - lbl.length - 2) / 2)));
691
+ rightLines[maxBody - 1] = truncateToWidth(theme.fg("dim", ` ${d} ${lbl} ${d}`), previewWidth);
692
+ }
693
+
694
+ while (leftLines.length < maxBody) leftLines.push("");
695
+ while (rightLines.length < maxBody) rightLines.push("");
696
+ const divider = theme.fg("dim", DIVIDER_CHARS);
697
+ lines.push(...mergeSideBySide(leftLines, rightLines, leftWidth, divider, width));
698
+
699
+ // Footer
700
+ push(ui.blank());
701
+ const isLast = !isMultiQuestion || currentIdx === questions.length - 1;
702
+ const hints: string[] = [];
703
+ if (focusNotes) {
704
+ hints.push("enter to confirm");
705
+ hints.push("tab or esc to close notes");
706
+ } else if (isMultiSelect(currentIdx)) {
707
+ hints.push("space to toggle");
708
+ if (isMultiQuestion) hints.push("←/→ navigate questions");
709
+ hints.push("tab to add notes");
710
+ hints.push(isLast && allAnswered() ? "enter to review" : "enter to next");
711
+ } else {
712
+ hints.push("tab to add notes");
713
+ if (isMultiQuestion) hints.push("←/→ navigate");
714
+ hints.push(isLast && allAnswered() ? "enter to review" : "enter to next");
715
+ }
716
+ hints.push("esc to exit");
717
+ push(ui.hints(hints), ui.bar());
718
+
719
+ cachedLines = lines;
720
+ return lines;
721
+ }
722
+
723
+ // ── Original path — no preview, untouched ────────────────
724
+
531
725
  const ui = makeUI(theme, width);
532
726
  const lines: string[] = [];
533
727
  const push = (...rows: string[][]) => { for (const r of rows) lines.push(...r); };
@@ -47,3 +47,29 @@ export function fitColumns(parts: string[], width: number, separator = " "): st
47
47
  }
48
48
  return truncateToWidth(result, width);
49
49
  }
50
+
51
+ /**
52
+ * Merge two sets of lines into a side-by-side layout with a vertical divider.
53
+ *
54
+ * Each left line is padded to `leftWidth`, then joined with a styled divider
55
+ * and the corresponding right line. Output lines are truncated to `totalWidth`.
56
+ */
57
+ export function mergeSideBySide(
58
+ leftLines: string[],
59
+ rightLines: string[],
60
+ leftWidth: number,
61
+ divider: string,
62
+ totalWidth: number,
63
+ ): string[] {
64
+ const maxLen = Math.max(leftLines.length, rightLines.length);
65
+ const merged: string[] = [];
66
+
67
+ for (let i = 0; i < maxLen; i++) {
68
+ const left = i < leftLines.length ? leftLines[i] : "";
69
+ const right = i < rightLines.length ? rightLines[i] : "";
70
+ const paddedLeft = padRight(left, leftWidth);
71
+ merged.push(truncateToWidth(paddedLeft + divider + right, totalWidth));
72
+ }
73
+
74
+ return merged;
75
+ }
@@ -0,0 +1,58 @@
1
+ import { existsSync } from "node:fs";
2
+ import { homedir as osHomedir } from "node:os";
3
+ import { delimiter, join } from "node:path";
4
+
5
+ export const GSD_RTK_DISABLED_ENV = "GSD_RTK_DISABLED";
6
+ export const GSD_RTK_PATH_ENV = "GSD_RTK_PATH";
7
+ export const RTK_TELEMETRY_DISABLED_ENV = "RTK_TELEMETRY_DISABLED";
8
+
9
+ export function isTruthy(value: string | undefined): boolean {
10
+ if (!value) return false;
11
+ const normalized = value.trim().toLowerCase();
12
+ return normalized === "1" || normalized === "true" || normalized === "yes";
13
+ }
14
+
15
+ export function isRtkEnabled(env: NodeJS.ProcessEnv = process.env): boolean {
16
+ return !isTruthy(env[GSD_RTK_DISABLED_ENV]);
17
+ }
18
+
19
+ export function getManagedRtkDir(env: NodeJS.ProcessEnv = process.env): string {
20
+ return join(env.GSD_HOME || join(osHomedir(), ".gsd"), "agent", "bin");
21
+ }
22
+
23
+ export function getRtkBinaryName(platform: NodeJS.Platform = process.platform): string {
24
+ return platform === "win32" ? "rtk.exe" : "rtk";
25
+ }
26
+
27
+ export function getPathValue(env: NodeJS.ProcessEnv): string | undefined {
28
+ const pathKey = Object.keys(env).find((key) => key.toLowerCase() === "path");
29
+ return pathKey ? env[pathKey] : env.PATH;
30
+ }
31
+
32
+ export function resolvePathCandidates(pathValue: string | undefined): string[] {
33
+ if (!pathValue) return [];
34
+ return pathValue
35
+ .split(delimiter)
36
+ .map((part) => part.trim())
37
+ .filter(Boolean);
38
+ }
39
+
40
+ export function resolveSystemRtkPath(
41
+ pathValue: string | undefined,
42
+ platform: NodeJS.Platform = process.platform,
43
+ ): string | null {
44
+ const candidates = platform === "win32"
45
+ ? ["rtk.exe", "rtk.cmd", "rtk.bat", "rtk"]
46
+ : ["rtk"];
47
+
48
+ for (const dir of resolvePathCandidates(pathValue)) {
49
+ for (const candidate of candidates) {
50
+ const fullPath = join(dir, candidate);
51
+ if (existsSync(fullPath)) {
52
+ return fullPath;
53
+ }
54
+ }
55
+ }
56
+
57
+ return null;
58
+ }
@@ -1,19 +1,21 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import { existsSync } from "node:fs";
3
- import { homedir } from "node:os";
4
- import { delimiter, join } from "node:path";
3
+ import { join } from "node:path";
4
+ import {
5
+ GSD_RTK_DISABLED_ENV,
6
+ GSD_RTK_PATH_ENV,
7
+ RTK_TELEMETRY_DISABLED_ENV,
8
+ getManagedRtkDir,
9
+ getPathValue,
10
+ getRtkBinaryName,
11
+ isRtkEnabled,
12
+ resolveSystemRtkPath,
13
+ } from "./rtk-shared.js";
5
14
 
6
- const GSD_RTK_PATH_ENV = "GSD_RTK_PATH";
7
- const GSD_RTK_DISABLED_ENV = "GSD_RTK_DISABLED";
8
15
  const GSD_RTK_REWRITE_TIMEOUT_MS_ENV = "GSD_RTK_REWRITE_TIMEOUT_MS";
9
- const RTK_TELEMETRY_DISABLED_ENV = "RTK_TELEMETRY_DISABLED";
10
16
  const RTK_REWRITE_TIMEOUT_MS = 5_000;
11
17
 
12
- function isTruthy(value: string | undefined): boolean {
13
- if (!value) return false;
14
- const normalized = value.trim().toLowerCase();
15
- return normalized === "1" || normalized === "true" || normalized === "yes";
16
- }
18
+ export { isRtkEnabled };
17
19
 
18
20
  function getRewriteTimeoutMs(env: NodeJS.ProcessEnv = process.env): number {
19
21
  const configured = Number.parseInt(env[GSD_RTK_REWRITE_TIMEOUT_MS_ENV] ?? "", 10);
@@ -23,10 +25,6 @@ function getRewriteTimeoutMs(env: NodeJS.ProcessEnv = process.env): number {
23
25
  return RTK_REWRITE_TIMEOUT_MS;
24
26
  }
25
27
 
26
- export function isRtkEnabled(env: NodeJS.ProcessEnv = process.env): boolean {
27
- return !isTruthy(env[GSD_RTK_DISABLED_ENV]);
28
- }
29
-
30
28
  export function buildRtkEnv(env: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {
31
29
  return {
32
30
  ...env,
@@ -34,44 +32,6 @@ export function buildRtkEnv(env: NodeJS.ProcessEnv = process.env): NodeJS.Proces
34
32
  };
35
33
  }
36
34
 
37
- function getManagedRtkDir(env: NodeJS.ProcessEnv = process.env): string {
38
- return join(env.GSD_HOME || join(homedir(), ".gsd"), "agent", "bin");
39
- }
40
-
41
- function getRtkBinaryName(platform: NodeJS.Platform = process.platform): string {
42
- return platform === "win32" ? "rtk.exe" : "rtk";
43
- }
44
-
45
- function getPathValue(env: NodeJS.ProcessEnv): string | undefined {
46
- const pathKey = Object.keys(env).find((key) => key.toLowerCase() === "path");
47
- return pathKey ? env[pathKey] : env.PATH;
48
- }
49
-
50
- function resolvePathCandidates(pathValue: string | undefined): string[] {
51
- if (!pathValue) return [];
52
- return pathValue
53
- .split(delimiter)
54
- .map((part) => part.trim())
55
- .filter(Boolean);
56
- }
57
-
58
- function resolveSystemRtkPath(pathValue: string | undefined, platform: NodeJS.Platform = process.platform): string | null {
59
- const candidates = platform === "win32"
60
- ? ["rtk.exe", "rtk.cmd", "rtk.bat", "rtk"]
61
- : ["rtk"];
62
-
63
- for (const dir of resolvePathCandidates(pathValue)) {
64
- for (const candidate of candidates) {
65
- const fullPath = join(dir, candidate);
66
- if (existsSync(fullPath)) {
67
- return fullPath;
68
- }
69
- }
70
- }
71
-
72
- return null;
73
- }
74
-
75
35
  export interface ResolveRtkBinaryPathOptions {
76
36
  binaryPath?: string;
77
37
  env?: NodeJS.ProcessEnv;