gsd-pi 2.34.0 → 2.35.0-dev.30eec3f

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 (500) hide show
  1. package/dist/cli.js +7 -2
  2. package/dist/resource-loader.d.ts +1 -1
  3. package/dist/resource-loader.js +13 -1
  4. package/dist/resources/extensions/async-jobs/await-tool.js +0 -2
  5. package/dist/resources/extensions/async-jobs/job-manager.js +0 -6
  6. package/dist/resources/extensions/bg-shell/output-formatter.js +1 -19
  7. package/dist/resources/extensions/bg-shell/process-manager.js +0 -4
  8. package/dist/resources/extensions/bg-shell/types.js +0 -2
  9. package/dist/resources/extensions/context7/index.js +5 -0
  10. package/dist/resources/extensions/get-secrets-from-user.js +2 -30
  11. package/dist/resources/extensions/google-search/index.js +5 -0
  12. package/dist/resources/extensions/gsd/auto-dispatch.js +43 -1
  13. package/dist/resources/extensions/gsd/auto-loop.js +10 -1
  14. package/dist/resources/extensions/gsd/auto-recovery.js +35 -0
  15. package/dist/resources/extensions/gsd/auto-start.js +35 -2
  16. package/dist/resources/extensions/gsd/auto.js +59 -4
  17. package/dist/resources/extensions/gsd/changelog.js +162 -0
  18. package/dist/resources/extensions/gsd/commands-bootstrap.js +1 -0
  19. package/dist/resources/extensions/gsd/commands-handlers.js +2 -2
  20. package/dist/resources/extensions/gsd/commands-inspect.js +10 -3
  21. package/dist/resources/extensions/gsd/commands-prefs-wizard.js +5 -1
  22. package/dist/resources/extensions/gsd/commands.js +8 -1
  23. package/dist/resources/extensions/gsd/docs/preferences-reference.md +10 -0
  24. package/dist/resources/extensions/gsd/doctor-checks.js +113 -5
  25. package/dist/resources/extensions/gsd/doctor-environment.js +26 -17
  26. package/dist/resources/extensions/gsd/doctor-proactive.js +22 -0
  27. package/dist/resources/extensions/gsd/doctor.js +36 -0
  28. package/dist/resources/extensions/gsd/files.js +11 -2
  29. package/dist/resources/extensions/gsd/gitignore.js +54 -7
  30. package/dist/resources/extensions/gsd/guided-flow.js +5 -3
  31. package/dist/resources/extensions/gsd/health-widget-core.js +96 -0
  32. package/dist/resources/extensions/gsd/health-widget.js +97 -46
  33. package/dist/resources/extensions/gsd/index.js +10 -1
  34. package/dist/resources/extensions/gsd/migrate-external.js +55 -2
  35. package/dist/resources/extensions/gsd/paths.js +74 -7
  36. package/dist/resources/extensions/gsd/post-unit-hooks.js +4 -1
  37. package/dist/resources/extensions/gsd/preferences-validation.js +54 -1
  38. package/dist/resources/extensions/gsd/preferences.js +2 -0
  39. package/dist/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
  40. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
  41. package/dist/resources/extensions/gsd/roadmap-mutations.js +55 -0
  42. package/dist/resources/extensions/gsd/session-lock.js +26 -2
  43. package/dist/resources/extensions/gsd/templates/plan.md +8 -0
  44. package/dist/resources/extensions/gsd/worktree-resolver.js +12 -0
  45. package/dist/resources/extensions/mcp-client/index.js +2 -1
  46. package/dist/resources/extensions/remote-questions/remote-command.js +2 -22
  47. package/dist/resources/extensions/shared/mod.js +1 -1
  48. package/dist/resources/extensions/shared/sanitize.js +30 -0
  49. package/dist/resources/extensions/subagent/index.js +6 -14
  50. package/dist/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
  51. package/package.json +2 -1
  52. package/packages/native/dist/native.d.ts +0 -2
  53. package/packages/native/dist/native.js +0 -2
  54. package/packages/native/src/native.ts +0 -3
  55. package/packages/pi-agent-core/dist/agent-loop.d.ts +14 -0
  56. package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  57. package/packages/pi-agent-core/dist/agent-loop.js +24 -27
  58. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  59. package/packages/pi-agent-core/dist/agent.d.ts +1 -0
  60. package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
  61. package/packages/pi-agent-core/dist/agent.js +11 -22
  62. package/packages/pi-agent-core/dist/agent.js.map +1 -1
  63. package/packages/pi-agent-core/dist/proxy.d.ts +1 -25
  64. package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -1
  65. package/packages/pi-agent-core/dist/proxy.js +3 -9
  66. package/packages/pi-agent-core/dist/proxy.js.map +1 -1
  67. package/packages/pi-agent-core/src/agent-loop.ts +30 -27
  68. package/packages/pi-agent-core/src/agent.ts +12 -23
  69. package/packages/pi-agent-core/src/proxy.ts +3 -9
  70. package/packages/pi-ai/dist/api-registry.d.ts +0 -2
  71. package/packages/pi-ai/dist/api-registry.d.ts.map +1 -1
  72. package/packages/pi-ai/dist/api-registry.js +0 -10
  73. package/packages/pi-ai/dist/api-registry.js.map +1 -1
  74. package/packages/pi-ai/dist/providers/anthropic.d.ts +0 -8
  75. package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  76. package/packages/pi-ai/dist/providers/anthropic.js +1 -1
  77. package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
  78. package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
  79. package/packages/pi-ai/dist/providers/azure-openai-responses.js +5 -41
  80. package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
  81. package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts +0 -1
  82. package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -1
  83. package/packages/pi-ai/dist/providers/github-copilot-headers.js +1 -1
  84. package/packages/pi-ai/dist/providers/github-copilot-headers.js.map +1 -1
  85. package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts +1 -43
  86. package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
  87. package/packages/pi-ai/dist/providers/google-gemini-cli.js +2 -2
  88. package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
  89. package/packages/pi-ai/dist/providers/google-shared.d.ts +0 -4
  90. package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
  91. package/packages/pi-ai/dist/providers/google-shared.js +1 -1
  92. package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
  93. package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
  94. package/packages/pi-ai/dist/providers/openai-completions.js +10 -73
  95. package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
  96. package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
  97. package/packages/pi-ai/dist/providers/openai-responses.js +9 -80
  98. package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
  99. package/packages/pi-ai/dist/providers/openai-shared.d.ts +65 -0
  100. package/packages/pi-ai/dist/providers/openai-shared.d.ts.map +1 -0
  101. package/packages/pi-ai/dist/providers/openai-shared.js +146 -0
  102. package/packages/pi-ai/dist/providers/openai-shared.js.map +1 -0
  103. package/packages/pi-ai/dist/providers/register-builtins.d.ts +0 -1
  104. package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
  105. package/packages/pi-ai/dist/providers/register-builtins.js +1 -1
  106. package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
  107. package/packages/pi-ai/dist/utils/event-stream.d.ts +0 -2
  108. package/packages/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
  109. package/packages/pi-ai/dist/utils/event-stream.js +0 -4
  110. package/packages/pi-ai/dist/utils/event-stream.js.map +1 -1
  111. package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
  112. package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +7 -135
  113. package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -1
  114. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
  115. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +7 -135
  116. package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -1
  117. package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts +46 -0
  118. package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts.map +1 -0
  119. package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js +160 -0
  120. package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js.map +1 -0
  121. package/packages/pi-ai/dist/utils/overflow.d.ts +0 -4
  122. package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -1
  123. package/packages/pi-ai/dist/utils/overflow.js +0 -6
  124. package/packages/pi-ai/dist/utils/overflow.js.map +1 -1
  125. package/packages/pi-ai/dist/utils/validation.d.ts +0 -8
  126. package/packages/pi-ai/dist/utils/validation.d.ts.map +1 -1
  127. package/packages/pi-ai/dist/utils/validation.js +0 -14
  128. package/packages/pi-ai/dist/utils/validation.js.map +1 -1
  129. package/packages/pi-ai/src/api-registry.ts +0 -12
  130. package/packages/pi-ai/src/providers/anthropic.ts +1 -1
  131. package/packages/pi-ai/src/providers/azure-openai-responses.ts +11 -45
  132. package/packages/pi-ai/src/providers/github-copilot-headers.ts +1 -1
  133. package/packages/pi-ai/src/providers/google-gemini-cli.ts +2 -2
  134. package/packages/pi-ai/src/providers/google-shared.ts +1 -1
  135. package/packages/pi-ai/src/providers/openai-completions.ts +16 -86
  136. package/packages/pi-ai/src/providers/openai-responses.ts +16 -96
  137. package/packages/pi-ai/src/providers/openai-shared.ts +193 -0
  138. package/packages/pi-ai/src/providers/register-builtins.ts +1 -1
  139. package/packages/pi-ai/src/utils/event-stream.ts +0 -5
  140. package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +14 -162
  141. package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +13 -161
  142. package/packages/pi-ai/src/utils/oauth/google-oauth-utils.ts +201 -0
  143. package/packages/pi-ai/src/utils/overflow.ts +1 -8
  144. package/packages/pi-ai/src/utils/validation.ts +0 -15
  145. package/packages/pi-coding-agent/dist/config.d.ts +0 -9
  146. package/packages/pi-coding-agent/dist/config.d.ts.map +1 -1
  147. package/packages/pi-coding-agent/dist/config.js +4 -8
  148. package/packages/pi-coding-agent/dist/config.js.map +1 -1
  149. package/packages/pi-coding-agent/dist/core/agent-session.d.ts +16 -63
  150. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  151. package/packages/pi-coding-agent/dist/core/agent-session.js +104 -641
  152. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  153. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +0 -1
  154. package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  155. package/packages/pi-coding-agent/dist/core/auth-storage.js +4 -35
  156. package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  157. package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  158. package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js +5 -43
  159. package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js.map +1 -1
  160. package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
  161. package/packages/pi-coding-agent/dist/core/compaction/compaction.js +11 -69
  162. package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
  163. package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts +40 -0
  164. package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
  165. package/packages/pi-coding-agent/dist/core/compaction/utils.js +78 -0
  166. package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
  167. package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts +77 -0
  168. package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts.map +1 -0
  169. package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js +331 -0
  170. package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js.map +1 -0
  171. package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts +0 -4
  172. package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  173. package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js +1 -1
  174. package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -1
  175. package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +2 -2
  176. package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
  177. package/packages/pi-coding-agent/dist/core/extensions/index.js +1 -1
  178. package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
  179. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +15 -5
  180. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  181. package/packages/pi-coding-agent/dist/core/extensions/runner.js +129 -256
  182. package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  183. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +49 -42
  184. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  185. package/packages/pi-coding-agent/dist/core/extensions/types.js +2 -21
  186. package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  187. package/packages/pi-coding-agent/dist/core/keybindings.d.ts +0 -8
  188. package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
  189. package/packages/pi-coding-agent/dist/core/keybindings.js +2 -2
  190. package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -1
  191. package/packages/pi-coding-agent/dist/core/lock-utils.d.ts +39 -0
  192. package/packages/pi-coding-agent/dist/core/lock-utils.d.ts.map +1 -0
  193. package/packages/pi-coding-agent/dist/core/lock-utils.js +89 -0
  194. package/packages/pi-coding-agent/dist/core/lock-utils.js.map +1 -0
  195. package/packages/pi-coding-agent/dist/core/lsp/client.d.ts +0 -17
  196. package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
  197. package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -62
  198. package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
  199. package/packages/pi-coding-agent/dist/core/lsp/config.d.ts +1 -1
  200. package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
  201. package/packages/pi-coding-agent/dist/core/lsp/config.js +2 -6
  202. package/packages/pi-coding-agent/dist/core/lsp/config.js.map +1 -1
  203. package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts +0 -5
  204. package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts.map +1 -1
  205. package/packages/pi-coding-agent/dist/core/lsp/edits.js +1 -1
  206. package/packages/pi-coding-agent/dist/core/lsp/edits.js.map +1 -1
  207. package/packages/pi-coding-agent/dist/core/lsp/index.d.ts.map +1 -1
  208. package/packages/pi-coding-agent/dist/core/lsp/index.js +52 -107
  209. package/packages/pi-coding-agent/dist/core/lsp/index.js.map +1 -1
  210. package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts +0 -1
  211. package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts.map +1 -1
  212. package/packages/pi-coding-agent/dist/core/lsp/lspmux.js +3 -22
  213. package/packages/pi-coding-agent/dist/core/lsp/lspmux.js.map +1 -1
  214. package/packages/pi-coding-agent/dist/core/lsp/types.d.ts +0 -1
  215. package/packages/pi-coding-agent/dist/core/lsp/types.d.ts.map +1 -1
  216. package/packages/pi-coding-agent/dist/core/lsp/types.js +0 -28
  217. package/packages/pi-coding-agent/dist/core/lsp/types.js.map +1 -1
  218. package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts +1 -6
  219. package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts.map +1 -1
  220. package/packages/pi-coding-agent/dist/core/lsp/utils.js +1 -28
  221. package/packages/pi-coding-agent/dist/core/lsp/utils.js.map +1 -1
  222. package/packages/pi-coding-agent/dist/core/messages.d.ts +0 -8
  223. package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
  224. package/packages/pi-coding-agent/dist/core/messages.js +5 -5
  225. package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
  226. package/packages/pi-coding-agent/dist/core/model-registry.d.ts +0 -3
  227. package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  228. package/packages/pi-coding-agent/dist/core/model-registry.js +1 -3
  229. package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  230. package/packages/pi-coding-agent/dist/core/model-resolver.d.ts +1 -26
  231. package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  232. package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -59
  233. package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  234. package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  235. package/packages/pi-coding-agent/dist/core/package-manager.js +2 -4
  236. package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  237. package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts +0 -17
  238. package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
  239. package/packages/pi-coding-agent/dist/core/prompt-templates.js +2 -2
  240. package/packages/pi-coding-agent/dist/core/prompt-templates.js.map +1 -1
  241. package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +2 -4
  242. package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  243. package/packages/pi-coding-agent/dist/core/resource-loader.js +46 -60
  244. package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  245. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +87 -0
  246. package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -0
  247. package/packages/pi-coding-agent/dist/core/retry-handler.js +295 -0
  248. package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -0
  249. package/packages/pi-coding-agent/dist/core/session-manager.d.ts +0 -5
  250. package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
  251. package/packages/pi-coding-agent/dist/core/session-manager.js +5 -32
  252. package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
  253. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +8 -12
  254. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  255. package/packages/pi-coding-agent/dist/core/settings-manager.js +78 -168
  256. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  257. package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
  258. package/packages/pi-coding-agent/dist/core/skills.js +1 -3
  259. package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
  260. package/packages/pi-coding-agent/dist/index.d.ts +1 -1
  261. package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
  262. package/packages/pi-coding-agent/dist/index.js +1 -1
  263. package/packages/pi-coding-agent/dist/index.js.map +1 -1
  264. package/packages/pi-coding-agent/dist/migrations.d.ts +0 -16
  265. package/packages/pi-coding-agent/dist/migrations.d.ts.map +1 -1
  266. package/packages/pi-coding-agent/dist/migrations.js +2 -2
  267. package/packages/pi-coding-agent/dist/migrations.js.map +1 -1
  268. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +0 -2
  269. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  270. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +2 -2
  271. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  272. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts +1 -1
  273. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  274. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js +9 -26
  275. package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -1
  276. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  277. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -13
  278. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  279. package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts +44 -0
  280. package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts.map +1 -0
  281. package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js +61 -0
  282. package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js.map +1 -0
  283. package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  284. package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +6 -9
  285. package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -1
  286. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -24
  287. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  288. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +50 -512
  289. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  290. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts +71 -0
  291. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -0
  292. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +514 -0
  293. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -0
  294. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +65 -4
  295. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  296. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +6 -23
  297. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  298. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts +12 -0
  299. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -0
  300. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +175 -0
  301. package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -0
  302. package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts +6 -0
  303. package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts.map +1 -0
  304. package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js +15 -0
  305. package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js.map +1 -0
  306. package/packages/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
  307. package/packages/pi-coding-agent/dist/modes/print-mode.js +2 -30
  308. package/packages/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
  309. package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  310. package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js +2 -28
  311. package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
  312. package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts +19 -0
  313. package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts.map +1 -0
  314. package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js +45 -0
  315. package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js.map +1 -0
  316. package/packages/pi-coding-agent/dist/utils/changelog.d.ts +0 -4
  317. package/packages/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
  318. package/packages/pi-coding-agent/dist/utils/changelog.js +1 -1
  319. package/packages/pi-coding-agent/dist/utils/changelog.js.map +1 -1
  320. package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts +0 -1
  321. package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
  322. package/packages/pi-coding-agent/dist/utils/clipboard-image.js +1 -1
  323. package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
  324. package/packages/pi-coding-agent/dist/utils/error.d.ts +5 -0
  325. package/packages/pi-coding-agent/dist/utils/error.d.ts.map +1 -0
  326. package/packages/pi-coding-agent/dist/utils/error.js +7 -0
  327. package/packages/pi-coding-agent/dist/utils/error.js.map +1 -0
  328. package/packages/pi-coding-agent/dist/utils/photon.d.ts +0 -19
  329. package/packages/pi-coding-agent/dist/utils/photon.d.ts.map +1 -1
  330. package/packages/pi-coding-agent/dist/utils/photon.js +1 -120
  331. package/packages/pi-coding-agent/dist/utils/photon.js.map +1 -1
  332. package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts +0 -1
  333. package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -1
  334. package/packages/pi-coding-agent/dist/utils/tools-manager.js +1 -1
  335. package/packages/pi-coding-agent/dist/utils/tools-manager.js.map +1 -1
  336. package/packages/pi-coding-agent/package.json +1 -1
  337. package/packages/pi-coding-agent/src/config.ts +5 -10
  338. package/packages/pi-coding-agent/src/core/agent-session.ts +117 -745
  339. package/packages/pi-coding-agent/src/core/auth-storage.ts +4 -38
  340. package/packages/pi-coding-agent/src/core/compaction/branch-summarization.ts +7 -53
  341. package/packages/pi-coding-agent/src/core/compaction/compaction.ts +14 -74
  342. package/packages/pi-coding-agent/src/core/compaction/utils.ts +100 -0
  343. package/packages/pi-coding-agent/src/core/compaction-orchestrator.ts +424 -0
  344. package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +1 -1
  345. package/packages/pi-coding-agent/src/core/extensions/index.ts +1 -21
  346. package/packages/pi-coding-agent/src/core/extensions/runner.ts +119 -256
  347. package/packages/pi-coding-agent/src/core/extensions/types.ts +50 -69
  348. package/packages/pi-coding-agent/src/core/keybindings.ts +2 -2
  349. package/packages/pi-coding-agent/src/core/lock-utils.ts +113 -0
  350. package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -73
  351. package/packages/pi-coding-agent/src/core/lsp/config.ts +2 -10
  352. package/packages/pi-coding-agent/src/core/lsp/edits.ts +1 -1
  353. package/packages/pi-coding-agent/src/core/lsp/index.ts +83 -152
  354. package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +3 -23
  355. package/packages/pi-coding-agent/src/core/lsp/types.ts +0 -29
  356. package/packages/pi-coding-agent/src/core/lsp/utils.ts +1 -33
  357. package/packages/pi-coding-agent/src/core/messages.ts +5 -5
  358. package/packages/pi-coding-agent/src/core/model-registry.ts +0 -2
  359. package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -77
  360. package/packages/pi-coding-agent/src/core/package-manager.ts +1 -4
  361. package/packages/pi-coding-agent/src/core/prompt-templates.ts +2 -2
  362. package/packages/pi-coding-agent/src/core/resource-loader.ts +56 -69
  363. package/packages/pi-coding-agent/src/core/retry-handler.ts +359 -0
  364. package/packages/pi-coding-agent/src/core/session-manager.ts +5 -34
  365. package/packages/pi-coding-agent/src/core/settings-manager.ts +87 -166
  366. package/packages/pi-coding-agent/src/core/skills.ts +1 -4
  367. package/packages/pi-coding-agent/src/index.ts +1 -7
  368. package/packages/pi-coding-agent/src/migrations.ts +2 -2
  369. package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +2 -2
  370. package/packages/pi-coding-agent/src/modes/interactive/components/session-selector.ts +17 -29
  371. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +1 -13
  372. package/packages/pi-coding-agent/src/modes/interactive/components/tree-render-utils.ts +81 -0
  373. package/packages/pi-coding-agent/src/modes/interactive/components/tree-selector.ts +14 -19
  374. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +50 -561
  375. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +653 -0
  376. package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +7 -26
  377. package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +196 -0
  378. package/packages/pi-coding-agent/src/modes/interactive/utils/shorten-path.ts +14 -0
  379. package/packages/pi-coding-agent/src/modes/print-mode.ts +2 -30
  380. package/packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts +2 -28
  381. package/packages/pi-coding-agent/src/modes/shared/command-context-actions.ts +53 -0
  382. package/packages/pi-coding-agent/src/utils/changelog.ts +1 -1
  383. package/packages/pi-coding-agent/src/utils/clipboard-image.ts +1 -1
  384. package/packages/pi-coding-agent/src/utils/error.ts +6 -0
  385. package/packages/pi-coding-agent/src/utils/photon.ts +0 -137
  386. package/packages/pi-coding-agent/src/utils/tools-manager.ts +1 -1
  387. package/packages/pi-tui/dist/components/editor.d.ts +0 -10
  388. package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
  389. package/packages/pi-tui/dist/components/editor.js +1 -1
  390. package/packages/pi-tui/dist/components/editor.js.map +1 -1
  391. package/packages/pi-tui/dist/components/markdown.d.ts +5 -0
  392. package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -1
  393. package/packages/pi-tui/dist/components/markdown.js +25 -31
  394. package/packages/pi-tui/dist/components/markdown.js.map +1 -1
  395. package/packages/pi-tui/dist/keys.d.ts +0 -4
  396. package/packages/pi-tui/dist/keys.d.ts.map +1 -1
  397. package/packages/pi-tui/dist/keys.js +94 -162
  398. package/packages/pi-tui/dist/keys.js.map +1 -1
  399. package/packages/pi-tui/dist/overlay-layout.d.ts +55 -0
  400. package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -0
  401. package/packages/pi-tui/dist/overlay-layout.js +288 -0
  402. package/packages/pi-tui/dist/overlay-layout.js.map +1 -0
  403. package/packages/pi-tui/dist/tui.d.ts +0 -22
  404. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  405. package/packages/pi-tui/dist/tui.js +6 -272
  406. package/packages/pi-tui/dist/tui.js.map +1 -1
  407. package/packages/pi-tui/dist/utils.d.ts +0 -7
  408. package/packages/pi-tui/dist/utils.d.ts.map +1 -1
  409. package/packages/pi-tui/dist/utils.js +0 -44
  410. package/packages/pi-tui/dist/utils.js.map +1 -1
  411. package/packages/pi-tui/src/components/editor.ts +1 -1
  412. package/packages/pi-tui/src/components/markdown.ts +25 -29
  413. package/packages/pi-tui/src/keys.ts +94 -173
  414. package/packages/pi-tui/src/overlay-layout.ts +372 -0
  415. package/packages/pi-tui/src/tui.ts +11 -312
  416. package/packages/pi-tui/src/utils.ts +0 -43
  417. package/pkg/dist/core/export-html/ansi-to-html.d.ts +0 -4
  418. package/pkg/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  419. package/pkg/dist/core/export-html/ansi-to-html.js +1 -1
  420. package/pkg/dist/core/export-html/ansi-to-html.js.map +1 -1
  421. package/pkg/dist/modes/interactive/theme/theme.d.ts +65 -4
  422. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  423. package/pkg/dist/modes/interactive/theme/theme.js +6 -23
  424. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
  425. package/pkg/dist/modes/interactive/theme/themes.d.ts +12 -0
  426. package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -0
  427. package/pkg/dist/modes/interactive/theme/themes.js +175 -0
  428. package/pkg/dist/modes/interactive/theme/themes.js.map +1 -0
  429. package/pkg/package.json +1 -1
  430. package/src/resources/extensions/async-jobs/await-tool.ts +0 -2
  431. package/src/resources/extensions/async-jobs/job-manager.ts +0 -7
  432. package/src/resources/extensions/bg-shell/output-formatter.ts +0 -17
  433. package/src/resources/extensions/bg-shell/process-manager.ts +0 -4
  434. package/src/resources/extensions/bg-shell/types.ts +0 -12
  435. package/src/resources/extensions/context7/index.ts +7 -0
  436. package/src/resources/extensions/get-secrets-from-user.ts +2 -35
  437. package/src/resources/extensions/google-search/index.ts +7 -0
  438. package/src/resources/extensions/gsd/auto-dispatch.ts +49 -1
  439. package/src/resources/extensions/gsd/auto-loop.ts +11 -1
  440. package/src/resources/extensions/gsd/auto-recovery.ts +39 -0
  441. package/src/resources/extensions/gsd/auto-start.ts +42 -2
  442. package/src/resources/extensions/gsd/auto.ts +61 -3
  443. package/src/resources/extensions/gsd/changelog.ts +213 -0
  444. package/src/resources/extensions/gsd/commands-bootstrap.ts +1 -0
  445. package/src/resources/extensions/gsd/commands-handlers.ts +2 -2
  446. package/src/resources/extensions/gsd/commands-inspect.ts +10 -3
  447. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +5 -1
  448. package/src/resources/extensions/gsd/commands.ts +9 -1
  449. package/src/resources/extensions/gsd/docs/preferences-reference.md +10 -0
  450. package/src/resources/extensions/gsd/doctor-checks.ts +107 -5
  451. package/src/resources/extensions/gsd/doctor-environment.ts +26 -16
  452. package/src/resources/extensions/gsd/doctor-proactive.ts +24 -0
  453. package/src/resources/extensions/gsd/doctor-types.ts +9 -1
  454. package/src/resources/extensions/gsd/doctor.ts +35 -0
  455. package/src/resources/extensions/gsd/files.ts +12 -2
  456. package/src/resources/extensions/gsd/gitignore.ts +54 -7
  457. package/src/resources/extensions/gsd/guided-flow.ts +5 -3
  458. package/src/resources/extensions/gsd/health-widget-core.ts +129 -0
  459. package/src/resources/extensions/gsd/health-widget.ts +103 -59
  460. package/src/resources/extensions/gsd/index.ts +10 -1
  461. package/src/resources/extensions/gsd/migrate-external.ts +47 -2
  462. package/src/resources/extensions/gsd/paths.ts +73 -7
  463. package/src/resources/extensions/gsd/post-unit-hooks.ts +5 -1
  464. package/src/resources/extensions/gsd/preferences-validation.ts +54 -1
  465. package/src/resources/extensions/gsd/preferences.ts +2 -0
  466. package/src/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
  467. package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
  468. package/src/resources/extensions/gsd/roadmap-mutations.ts +66 -0
  469. package/src/resources/extensions/gsd/session-lock.ts +29 -2
  470. package/src/resources/extensions/gsd/templates/plan.md +8 -0
  471. package/src/resources/extensions/gsd/tests/commands-inspect-open-db.test.ts +46 -0
  472. package/src/resources/extensions/gsd/tests/doctor-git.test.ts +98 -2
  473. package/src/resources/extensions/gsd/tests/doctor-runtime.test.ts +59 -3
  474. package/src/resources/extensions/gsd/tests/files-loadfile-eisdir.test.ts +20 -0
  475. package/src/resources/extensions/gsd/tests/gitignore-tracked-gsd.test.ts +214 -0
  476. package/src/resources/extensions/gsd/tests/health-widget.test.ts +158 -0
  477. package/src/resources/extensions/gsd/tests/paths.test.ts +113 -0
  478. package/src/resources/extensions/gsd/tests/preferences.test.ts +40 -2
  479. package/src/resources/extensions/gsd/tests/test-utils.ts +165 -0
  480. package/src/resources/extensions/gsd/tests/validate-directory.test.ts +15 -0
  481. package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +2 -0
  482. package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +32 -0
  483. package/src/resources/extensions/gsd/worktree-resolver.ts +11 -0
  484. package/src/resources/extensions/mcp-client/index.ts +2 -1
  485. package/src/resources/extensions/remote-questions/remote-command.ts +2 -23
  486. package/src/resources/extensions/shared/mod.ts +1 -1
  487. package/src/resources/extensions/shared/sanitize.ts +36 -0
  488. package/src/resources/extensions/subagent/index.ts +6 -12
  489. package/src/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
  490. package/dist/resources/extensions/shared/wizard-ui.js +0 -478
  491. package/packages/pi-coding-agent/dist/modes/interactive/theme/dark.json +0 -85
  492. package/packages/pi-coding-agent/dist/modes/interactive/theme/light.json +0 -84
  493. package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -335
  494. package/packages/pi-coding-agent/src/modes/interactive/theme/dark.json +0 -85
  495. package/packages/pi-coding-agent/src/modes/interactive/theme/light.json +0 -84
  496. package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.json +0 -335
  497. package/pkg/dist/modes/interactive/theme/dark.json +0 -85
  498. package/pkg/dist/modes/interactive/theme/light.json +0 -84
  499. package/pkg/dist/modes/interactive/theme/theme-schema.json +0 -335
  500. package/src/resources/extensions/shared/wizard-ui.ts +0 -551
@@ -60,7 +60,6 @@ export function createAwaitTool(getManager: () => AsyncJobManager): ToolDefiniti
60
60
  const running = watched.filter((j) => j.status === "running");
61
61
  if (running.length === 0) {
62
62
  const result = formatResults(watched);
63
- manager.acknowledgeDeliveries(watched.map((j) => j.id));
64
63
  return { content: [{ type: "text", text: result }], details: undefined };
65
64
  }
66
65
 
@@ -69,7 +68,6 @@ export function createAwaitTool(getManager: () => AsyncJobManager): ToolDefiniti
69
68
 
70
69
  // Collect all completed results (more may have finished while waiting)
71
70
  const completed = watched.filter((j) => j.status !== "running");
72
- manager.acknowledgeDeliveries(completed.map((j) => j.id));
73
71
 
74
72
  const stillRunning = watched.filter((j) => j.status === "running");
75
73
  let result = formatResults(completed);
@@ -148,13 +148,6 @@ export class AsyncJobManager {
148
148
  return [...this.jobs.values()];
149
149
  }
150
150
 
151
- /**
152
- * No-op. Retained for API compatibility with await_job tool.
153
- */
154
- acknowledgeDeliveries(_jobIds: string[]): void {
155
- // Delivery is fire-once; no retries to cancel.
156
- }
157
-
158
151
  /**
159
152
  * Cleanup all timers and resources.
160
153
  */
@@ -22,7 +22,6 @@ import {
22
22
  READINESS_PATTERNS,
23
23
  BUILD_COMPLETE_PATTERNS,
24
24
  TEST_RESULT_PATTERNS,
25
- LINE_DEDUP_MAX,
26
25
  } from "./types.js";
27
26
  import { addEvent, pushAlert } from "./process-manager.js";
28
27
  import { transitionToReady } from "./readiness-detector.js";
@@ -106,22 +105,6 @@ export function analyzeLine(bg: BgProcess, line: string, stream: "stdout" | "std
106
105
  }
107
106
  }
108
107
 
109
- // Dedup tracking — evict oldest entry when map exceeds LINE_DEDUP_MAX (LRU via Map insertion order)
110
- bg.totalRawLines++;
111
- const lineHash = line.trim().slice(0, 100);
112
- const existing = bg.lineDedup.get(lineHash);
113
- if (existing !== undefined) {
114
- // Re-insert to update insertion order (move to tail = most recent)
115
- bg.lineDedup.delete(lineHash);
116
- bg.lineDedup.set(lineHash, existing + 1);
117
- } else {
118
- if (bg.lineDedup.size >= LINE_DEDUP_MAX) {
119
- // Evict oldest entry (Map iteration order = insertion order = LRU at head)
120
- const oldest = bg.lineDedup.keys().next().value;
121
- if (oldest !== undefined) bg.lineDedup.delete(oldest);
122
- }
123
- bg.lineDedup.set(lineHash, 1);
124
- }
125
108
  }
126
109
 
127
110
  // ── Digest Generation ──────────────────────────────────────────────────────
@@ -162,12 +162,8 @@ export function startProcess(opts: StartOptions): BgProcess {
162
162
  group: opts.group || null,
163
163
  lastErrorCount: 0,
164
164
  lastWarningCount: 0,
165
- commandHistory: [],
166
- lineDedup: new Map(),
167
- totalRawLines: 0,
168
165
  stdoutLineCount: 0,
169
166
  stderrLineCount: 0,
170
- envKeys: Object.keys(opts.env || {}),
171
167
  restartCount: 0,
172
168
  startConfig: {
173
169
  command,
@@ -21,9 +21,7 @@ export interface ProcessEvent {
21
21
  | "recovered"
22
22
  | "exited"
23
23
  | "crashed"
24
- | "output"
25
24
  | "port_open"
26
- | "pattern_match"
27
25
  | "port_timeout";
28
26
  timestamp: number;
29
27
  detail: string;
@@ -92,18 +90,10 @@ export interface BgProcess {
92
90
  lastErrorCount: number;
93
91
  /** Last warning count snapshot for diff detection */
94
92
  lastWarningCount: number;
95
- /** Command history for shell-type sessions */
96
- commandHistory: string[];
97
- /** Dedup tracker: hash → count of repeated lines (capped at LINE_DEDUP_MAX entries) */
98
- lineDedup: Map<string, number>;
99
- /** Total raw lines (before dedup) for token savings calc */
100
- totalRawLines: number;
101
93
  /** Tracked stdout line count (incremented in addOutputLine, avoids O(n) filter) */
102
94
  stdoutLineCount: number;
103
95
  /** Tracked stderr line count (incremented in addOutputLine, avoids O(n) filter) */
104
96
  stderrLineCount: number;
105
- /** Env snapshot (keys only, no values for security) */
106
- envKeys: string[];
107
97
  /** Restart count */
108
98
  restartCount: number;
109
99
  /** Original start config for restart */
@@ -187,8 +177,6 @@ export interface ProcessManifest {
187
177
  export const MAX_BUFFER_LINES = 5000;
188
178
  export const MAX_EVENTS = 200;
189
179
  export const DEAD_PROCESS_TTL = 10 * 60 * 1000;
190
- /** Maximum unique entries in the per-process lineDedup Map before LRU eviction. */
191
- export const LINE_DEDUP_MAX = 500;
192
180
  export const PORT_PROBE_TIMEOUT = 500;
193
181
  export const READY_POLL_INTERVAL = 250;
194
182
  export const DEFAULT_READY_TIMEOUT = 30000;
@@ -414,6 +414,13 @@ export default function (pi: ExtensionAPI) {
414
414
  },
415
415
  });
416
416
 
417
+ // ── Session cleanup ─────────────────────────────────────────────────────
418
+
419
+ pi.on("session_shutdown", async () => {
420
+ searchCache.clear();
421
+ docCache.clear();
422
+ });
423
+
417
424
  // ── Startup notification ─────────────────────────────────────────────────
418
425
 
419
426
  pi.on("session_start", async (_event, ctx) => {
@@ -11,9 +11,9 @@ import { existsSync, statSync } from "node:fs";
11
11
  import { resolve } from "node:path";
12
12
 
13
13
  import type { ExtensionAPI, Theme } from "@gsd/pi-coding-agent";
14
- import { CURSOR_MARKER, Editor, type EditorTheme, Key, matchesKey, Text, truncateToWidth, wrapTextWithAnsi } from "@gsd/pi-tui";
14
+ import { Editor, type EditorTheme, Key, matchesKey, Text, truncateToWidth, wrapTextWithAnsi } from "@gsd/pi-tui";
15
15
  import { Type } from "@sinclair/typebox";
16
- import { makeUI, type ProgressStatus } from "./shared/mod.js";
16
+ import { makeUI, maskEditorLine, type ProgressStatus } from "./shared/mod.js";
17
17
  import { parseSecretsManifest, formatSecretsManifest } from "./gsd/files.js";
18
18
  import { resolveMilestoneFile } from "./gsd/paths.js";
19
19
  import type { SecretsManifestEntry } from "./gsd/types.js";
@@ -42,39 +42,6 @@ function maskPreview(value: string): string {
42
42
  return `${value.slice(0, 4)}${"*".repeat(Math.max(4, value.length - 8))}${value.slice(-4)}`;
43
43
  }
44
44
 
45
- /**
46
- * Replace editor visible text with masked characters while preserving ANSI cursor/sequencer codes.
47
- */
48
- function maskEditorLine(line: string): string {
49
- // Keep border / metadata lines readable.
50
- if (line.startsWith("─")) {
51
- return line;
52
- }
53
-
54
- let output = "";
55
- let i = 0;
56
- while (i < line.length) {
57
- if (line.startsWith(CURSOR_MARKER, i)) {
58
- output += CURSOR_MARKER;
59
- i += CURSOR_MARKER.length;
60
- continue;
61
- }
62
-
63
- const ansiMatch = /^\x1b\[[0-9;]*m/.exec(line.slice(i));
64
- if (ansiMatch) {
65
- output += ansiMatch[0];
66
- i += ansiMatch[0].length;
67
- continue;
68
- }
69
-
70
- const ch = line[i] as string;
71
- output += ch === " " ? " " : "*";
72
- i += 1;
73
- }
74
-
75
- return output;
76
- }
77
-
78
45
  function shellEscapeSingle(value: string): string {
79
46
  return `'${value.replace(/'/g, `'\\''`)}'`;
80
47
  }
@@ -411,6 +411,13 @@ export default function (pi: ExtensionAPI) {
411
411
  },
412
412
  });
413
413
 
414
+ // ── Session cleanup ─────────────────────────────────────────────────────
415
+
416
+ pi.on("session_shutdown", async () => {
417
+ resultCache.clear();
418
+ client = null;
419
+ });
420
+
414
421
  // ── Startup notification ─────────────────────────────────────────────────
415
422
 
416
423
  pi.on("session_start", async (_event, ctx) => {
@@ -12,14 +12,16 @@
12
12
  import type { GSDState } from "./types.js";
13
13
  import type { GSDPreferences } from "./preferences.js";
14
14
  import type { UatType } from "./files.js";
15
- import { loadFile, extractUatType, loadActiveOverrides } from "./files.js";
15
+ import { loadFile, extractUatType, loadActiveOverrides, parseRoadmap } from "./files.js";
16
16
  import {
17
17
  resolveMilestoneFile,
18
18
  resolveMilestonePath,
19
19
  resolveSliceFile,
20
+ resolveSlicePath,
20
21
  resolveTaskFile,
21
22
  relSliceFile,
22
23
  buildMilestoneFileName,
24
+ buildSliceFileName,
23
25
  } from "./paths.js";
24
26
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
25
27
  import { join } from "node:path";
@@ -369,6 +371,30 @@ const DISPATCH_RULES: DispatchRule[] = [
369
371
  name: "validating-milestone → validate-milestone",
370
372
  match: async ({ state, mid, midTitle, basePath, prefs }) => {
371
373
  if (state.phase !== "validating-milestone") return null;
374
+
375
+ // Safety guard (#1368): verify all roadmap slices have SUMMARY files before
376
+ // allowing milestone validation. If any slice lacks a summary, the milestone
377
+ // is not genuinely complete — something skipped earlier slices.
378
+ const roadmapFile = resolveMilestoneFile(basePath, mid, "ROADMAP");
379
+ const roadmapContent = roadmapFile ? await loadFile(roadmapFile) : null;
380
+ if (roadmapContent) {
381
+ const roadmap = parseRoadmap(roadmapContent);
382
+ const missingSlices: string[] = [];
383
+ for (const slice of roadmap.slices) {
384
+ const summaryPath = resolveSliceFile(basePath, mid, slice.id, "SUMMARY");
385
+ if (!summaryPath || !existsSync(summaryPath)) {
386
+ missingSlices.push(slice.id);
387
+ }
388
+ }
389
+ if (missingSlices.length > 0) {
390
+ return {
391
+ action: "stop",
392
+ reason: `Cannot validate milestone ${mid}: slices ${missingSlices.join(", ")} are missing SUMMARY files. These slices may have been skipped.`,
393
+ level: "error",
394
+ };
395
+ }
396
+ }
397
+
372
398
  // Skip preference: write a minimal pass-through VALIDATION file
373
399
  if (prefs?.phases?.skip_milestone_validation) {
374
400
  const mDir = resolveMilestonePath(basePath, mid);
@@ -404,6 +430,28 @@ const DISPATCH_RULES: DispatchRule[] = [
404
430
  name: "completing-milestone → complete-milestone",
405
431
  match: async ({ state, mid, midTitle, basePath }) => {
406
432
  if (state.phase !== "completing-milestone") return null;
433
+
434
+ // Safety guard (#1368): verify all roadmap slices have SUMMARY files.
435
+ const roadmapFile = resolveMilestoneFile(basePath, mid, "ROADMAP");
436
+ const roadmapContent = roadmapFile ? await loadFile(roadmapFile) : null;
437
+ if (roadmapContent) {
438
+ const roadmap = parseRoadmap(roadmapContent);
439
+ const missingSlices: string[] = [];
440
+ for (const slice of roadmap.slices) {
441
+ const summaryPath = resolveSliceFile(basePath, mid, slice.id, "SUMMARY");
442
+ if (!summaryPath || !existsSync(summaryPath)) {
443
+ missingSlices.push(slice.id);
444
+ }
445
+ }
446
+ if (missingSlices.length > 0) {
447
+ return {
448
+ action: "stop",
449
+ reason: `Cannot complete milestone ${mid}: slices ${missingSlices.join(", ")} are missing SUMMARY files. Run /gsd doctor to diagnose.`,
450
+ level: "error",
451
+ };
452
+ }
453
+ }
454
+
407
455
  return {
408
456
  action: "dispatch",
409
457
  unitType: "complete-milestone",
@@ -221,6 +221,15 @@ export async function runUnit(
221
221
  s.pendingResolve = resolve;
222
222
  });
223
223
 
224
+ // Ensure cwd matches basePath before dispatch (#1389).
225
+ // async_bash and background jobs can drift cwd away from the worktree.
226
+ // Realigning here prevents commits from landing on the wrong branch.
227
+ try {
228
+ if (process.cwd() !== s.basePath) {
229
+ process.chdir(s.basePath);
230
+ }
231
+ } catch { /* non-fatal — chdir may fail if dir was removed */ }
232
+
224
233
  // ── Send the prompt ──
225
234
  debugLog("runUnit", { phase: "send-message", unitType, unitId });
226
235
 
@@ -344,6 +353,7 @@ export interface LoopDeps {
344
353
  getManifestStatus: (
345
354
  basePath: string,
346
355
  mid: string | undefined,
356
+ projectRoot?: string,
347
357
  ) => Promise<{ pending: unknown[] } | null>;
348
358
  collectSecretsFromManifest: (
349
359
  basePath: string,
@@ -983,7 +993,7 @@ export async function autoLoop(
983
993
 
984
994
  // Secrets re-check gate
985
995
  try {
986
- const manifestStatus = await deps.getManifestStatus(s.basePath, mid);
996
+ const manifestStatus = await deps.getManifestStatus(s.basePath, mid, s.originalBasePath);
987
997
  if (manifestStatus && manifestStatus.pending.length > 0) {
988
998
  const result = await deps.collectSecretsFromManifest(
989
999
  s.basePath,
@@ -8,6 +8,8 @@
8
8
  */
9
9
 
10
10
  import type { ExtensionContext } from "@gsd/pi-coding-agent";
11
+ import { parseUnitId } from "./unit-id.js";
12
+ import { atomicWriteSync } from "./atomic-write.js";
11
13
  import { clearUnitRuntimeRecord } from "./unit-runtime.js";
12
14
  import { clearParseCache, parseRoadmap, parsePlan } from "./files.js";
13
15
  import { isValidationTerminal } from "./state.js";
@@ -35,6 +37,7 @@ import {
35
37
  clearPathCache,
36
38
  resolveGsdRootFile,
37
39
  } from "./paths.js";
40
+ import { markSliceDoneInRoadmap } from "./roadmap-mutations.js";
38
41
  import {
39
42
  existsSync,
40
43
  mkdirSync,
@@ -499,6 +502,42 @@ export async function selfHealRuntimeRecords(
499
502
  for (const record of records) {
500
503
  const { unitType, unitId } = record;
501
504
 
505
+ // Case 0: complete-slice with SUMMARY + UAT but unchecked roadmap (#1350).
506
+ // If a complete-slice was interrupted after writing artifacts but before
507
+ // flipping the roadmap checkbox, the verification fails and the dispatch
508
+ // loop relaunches the same unit forever. Auto-fix the checkbox.
509
+ if (unitType === "complete-slice") {
510
+ const { milestone: mid, slice: sid } = parseUnitId(unitId);
511
+ if (mid && sid) {
512
+ const dir = resolveSlicePath(base, mid, sid);
513
+ if (dir) {
514
+ const summaryPath = join(dir, buildSliceFileName(sid, "SUMMARY"));
515
+ const uatPath = join(dir, buildSliceFileName(sid, "UAT"));
516
+ if (existsSync(summaryPath) && existsSync(uatPath)) {
517
+ const roadmapFile = resolveMilestoneFile(base, mid, "ROADMAP");
518
+ if (roadmapFile && existsSync(roadmapFile)) {
519
+ try {
520
+ const roadmapContent = readFileSync(roadmapFile, "utf-8");
521
+ const roadmap = parseRoadmap(roadmapContent);
522
+ const slice = (roadmap.slices ?? []).find(s => s.id === sid);
523
+ if (slice && !slice.done) {
524
+ // Auto-fix: flip the checkbox using shared utility
525
+ if (markSliceDoneInRoadmap(base, mid, sid)) {
526
+ ctx.ui.notify(
527
+ `Self-heal: marked ${sid} done in roadmap (SUMMARY + UAT exist but checkbox was stale).`,
528
+ "info",
529
+ );
530
+ }
531
+ }
532
+ } catch {
533
+ // Roadmap parse failure — don't block self-heal
534
+ }
535
+ }
536
+ }
537
+ }
538
+ }
539
+ }
540
+
502
541
  // Clear stale dispatched records (dispatched > 1h ago, process crashed)
503
542
  const age = now - (record.startedAt ?? 0);
504
543
  if (record.phase === "dispatched" && age > STALE_THRESHOLD_MS) {
@@ -20,6 +20,8 @@ import {
20
20
  resolveSkillDiscoveryMode,
21
21
  getIsolationMode,
22
22
  } from "./preferences.js";
23
+ import { ensureGsdSymlink } from "./repo-identity.js";
24
+ import { migrateToExternalState, recoverFailedMigration } from "./migrate-external.js";
23
25
  import { collectSecretsFromManifest } from "../get-secrets-from-user.js";
24
26
  import { gsdRoot, resolveMilestoneFile, milestonesDir } from "./paths.js";
25
27
  import { invalidateAllCaches } from "./cache.js";
@@ -92,6 +94,13 @@ export interface BootstrapDeps {
92
94
  * Returns false if the bootstrap aborted (e.g., guided flow returned,
93
95
  * concurrent session detected). Returns true when ready to dispatch.
94
96
  */
97
+
98
+ /** Guard: tracks consecutive bootstrap attempts that found phase === "complete".
99
+ * Prevents the recursive dialog loop described in #1348 where
100
+ * bootstrapAutoSession → showSmartEntry → checkAutoStartAfterDiscuss → startAuto
101
+ * cycles indefinitely when the discuss workflow doesn't produce a milestone. */
102
+ let _consecutiveCompleteBootstraps = 0;
103
+ const MAX_CONSECUTIVE_COMPLETE_BOOTSTRAPS = 2;
95
104
  export async function bootstrapAutoSession(
96
105
  s: AutoSession,
97
106
  ctx: ExtensionCommandContext,
@@ -128,7 +137,20 @@ export async function bootstrapAutoSession(
128
137
  nativeInit(base, mainBranch);
129
138
  }
130
139
 
131
- // Ensure .gitignore has baseline patterns
140
+ // Migrate legacy in-project .gsd/ to external state directory.
141
+ // Migration MUST run before ensureGitignore to avoid adding ".gsd" to
142
+ // .gitignore when .gsd/ is git-tracked (data-loss bug #1364).
143
+ recoverFailedMigration(base);
144
+ const migration = migrateToExternalState(base);
145
+ if (migration.error) {
146
+ ctx.ui.notify(`External state migration warning: ${migration.error}`, "warning");
147
+ }
148
+ // Ensure symlink exists (handles fresh projects and post-migration)
149
+ ensureGsdSymlink(base);
150
+
151
+ // Ensure .gitignore has baseline patterns.
152
+ // ensureGitignore checks for git-tracked .gsd/ files and skips the
153
+ // ".gsd" pattern if the project intentionally tracks .gsd/ in git.
132
154
  const gitPrefs = loadEffectiveGSDPreferences()?.preferences?.git;
133
155
  const commitDocs = gitPrefs?.commit_docs;
134
156
  const manageGitignore = gitPrefs?.manage_gitignore;
@@ -286,6 +308,20 @@ export async function bootstrapAutoSession(
286
308
  if (!hasSurvivorBranch) {
287
309
  // No active work — start a new milestone via discuss flow
288
310
  if (!state.activeMilestone || state.phase === "complete") {
311
+ // Guard against recursive dialog loop (#1348):
312
+ // If we've entered this branch multiple times in quick succession,
313
+ // the discuss workflow isn't producing a milestone. Break the cycle.
314
+ _consecutiveCompleteBootstraps++;
315
+ if (_consecutiveCompleteBootstraps > MAX_CONSECUTIVE_COMPLETE_BOOTSTRAPS) {
316
+ _consecutiveCompleteBootstraps = 0;
317
+ ctx.ui.notify(
318
+ "All milestones are complete and the discussion didn't produce a new one. " +
319
+ "Run /gsd to start a new milestone manually.",
320
+ "warning",
321
+ );
322
+ return releaseLockAndReturn();
323
+ }
324
+
289
325
  const { showSmartEntry } = await import("./guided-flow.js");
290
326
  await showSmartEntry(ctx, pi, base, { step: requestedStepMode });
291
327
 
@@ -296,6 +332,7 @@ export async function bootstrapAutoSession(
296
332
  postState.phase !== "complete" &&
297
333
  postState.phase !== "pre-planning"
298
334
  ) {
335
+ _consecutiveCompleteBootstraps = 0; // Successfully advanced past "complete"
299
336
  state = postState;
300
337
  } else if (
301
338
  postState.activeMilestone &&
@@ -352,6 +389,9 @@ export async function bootstrapAutoSession(
352
389
  return releaseLockAndReturn();
353
390
  }
354
391
 
392
+ // Successfully resolved an active milestone — reset the re-entry guard
393
+ _consecutiveCompleteBootstraps = 0;
394
+
355
395
  // ── Initialize session state ──
356
396
  s.active = true;
357
397
  s.stepMode = requestedStepMode;
@@ -484,7 +524,7 @@ export async function bootstrapAutoSession(
484
524
  // Secrets collection gate
485
525
  const mid = state.activeMilestone!.id;
486
526
  try {
487
- const manifestStatus = await getManifestStatus(base, mid);
527
+ const manifestStatus = await getManifestStatus(base, mid, s.originalBasePath || base);
488
528
  if (manifestStatus && manifestStatus.pending.length > 0) {
489
529
  const result = await collectSecretsFromManifest(base, mid, ctx);
490
530
  if (
@@ -127,7 +127,7 @@ import {
127
127
  formatTokenCount,
128
128
  } from "./metrics.js";
129
129
  import { join } from "node:path";
130
- import { readFileSync, existsSync, mkdirSync } from "node:fs";
130
+ import { readFileSync, existsSync, mkdirSync, writeFileSync, unlinkSync } from "node:fs";
131
131
  import { atomicWriteSync } from "./atomic-write.js";
132
132
  import {
133
133
  autoCommitCurrentBranch,
@@ -554,6 +554,13 @@ export async function stopAuto(
554
554
  resetRoutingHistory();
555
555
  resetHookState();
556
556
  if (s.basePath) clearPersistedHookState(s.basePath);
557
+
558
+ // Remove paused-session metadata if present (#1383)
559
+ try {
560
+ const pausedPath = join(gsdRoot(s.originalBasePath || s.basePath), "runtime", "paused-session.json");
561
+ if (existsSync(pausedPath)) unlinkSync(pausedPath);
562
+ } catch { /* non-fatal */ }
563
+
557
564
  s.active = false;
558
565
  s.paused = false;
559
566
  s.stepMode = false;
@@ -607,8 +614,32 @@ export async function pauseAuto(
607
614
 
608
615
  s.pausedSessionFile = ctx?.sessionManager?.getSessionFile() ?? null;
609
616
 
610
- if (lockBase()) clearLock(lockBase());
611
- if (lockBase()) releaseSessionLock(lockBase());
617
+ // Persist paused-session metadata so resume survives /exit (#1383).
618
+ // The fresh-start bootstrap checks for this file and restores worktree context.
619
+ try {
620
+ const pausedMeta = {
621
+ milestoneId: s.currentMilestoneId,
622
+ worktreePath: isInAutoWorktree(s.basePath) ? s.basePath : null,
623
+ originalBasePath: s.originalBasePath,
624
+ stepMode: s.stepMode,
625
+ pausedAt: new Date().toISOString(),
626
+ sessionFile: s.pausedSessionFile,
627
+ };
628
+ const runtimeDir = join(gsdRoot(s.originalBasePath || s.basePath), "runtime");
629
+ mkdirSync(runtimeDir, { recursive: true });
630
+ writeFileSync(
631
+ join(runtimeDir, "paused-session.json"),
632
+ JSON.stringify(pausedMeta, null, 2),
633
+ "utf-8",
634
+ );
635
+ } catch {
636
+ // Non-fatal — resume will still work via full bootstrap, just without worktree context
637
+ }
638
+
639
+ if (lockBase()) {
640
+ releaseSessionLock(lockBase());
641
+ clearLock(lockBase());
642
+ }
612
643
 
613
644
  deregisterSigtermHandler();
614
645
 
@@ -792,6 +823,30 @@ export async function startAuto(
792
823
  base = escapeStaleWorktree(base);
793
824
 
794
825
  // If resuming from paused state, just re-activate and dispatch next unit.
826
+ // Check persisted paused-session first (#1383) — survives /exit.
827
+ if (!s.paused) {
828
+ try {
829
+ const pausedPath = join(gsdRoot(base), "runtime", "paused-session.json");
830
+ if (existsSync(pausedPath)) {
831
+ const meta = JSON.parse(readFileSync(pausedPath, "utf-8"));
832
+ if (meta.milestoneId) {
833
+ s.currentMilestoneId = meta.milestoneId;
834
+ s.originalBasePath = meta.originalBasePath || base;
835
+ s.stepMode = meta.stepMode ?? requestedStepMode;
836
+ s.paused = true;
837
+ // Clean up the persisted file — we're consuming it
838
+ try { unlinkSync(pausedPath); } catch { /* non-fatal */ }
839
+ ctx.ui.notify(
840
+ `Resuming paused session for ${meta.milestoneId}${meta.worktreePath ? ` (worktree)` : ""}.`,
841
+ "info",
842
+ );
843
+ }
844
+ }
845
+ } catch {
846
+ // Malformed or missing — proceed with fresh bootstrap
847
+ }
848
+ }
849
+
795
850
  if (s.paused) {
796
851
  const resumeLock = acquireSessionLock(base);
797
852
  if (!resumeLock.acquired) {
@@ -1145,6 +1200,9 @@ export async function dispatchHookUnit(
1145
1200
  ctx.ui.setStatus("gsd-auto", s.stepMode ? "next" : "auto");
1146
1201
  ctx.ui.notify(`Running post-unit hook: ${hookName}`, "info");
1147
1202
 
1203
+ // Ensure cwd matches basePath before hook dispatch (#1389)
1204
+ try { if (process.cwd() !== s.basePath) process.chdir(s.basePath); } catch {}
1205
+
1148
1206
  debugLog("dispatchHookUnit", {
1149
1207
  phase: "send-message",
1150
1208
  promptLength: hookPrompt.length,