gsd-pi 2.74.0-dev.b741afb → 2.74.0-dev.b7c5f96

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 (430) hide show
  1. package/dist/resources/extensions/gsd/activity-log.js +16 -0
  2. package/dist/resources/extensions/gsd/auto/loop.js +147 -10
  3. package/dist/resources/extensions/gsd/auto/phases.js +164 -9
  4. package/dist/resources/extensions/gsd/auto/session.js +10 -0
  5. package/dist/resources/extensions/gsd/auto-dispatch.js +11 -1
  6. package/dist/resources/extensions/gsd/auto-model-selection.js +54 -8
  7. package/dist/resources/extensions/gsd/auto-post-unit.js +215 -8
  8. package/dist/resources/extensions/gsd/auto-recovery.js +24 -10
  9. package/dist/resources/extensions/gsd/auto-unit-closeout.js +18 -0
  10. package/dist/resources/extensions/gsd/auto-verification.js +100 -2
  11. package/dist/resources/extensions/gsd/auto-worktree.js +2 -0
  12. package/dist/resources/extensions/gsd/auto.js +28 -2
  13. package/dist/resources/extensions/gsd/bootstrap/provider-error-resume.js +5 -3
  14. package/dist/resources/extensions/gsd/bootstrap/register-extension.js +10 -1
  15. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +61 -9
  16. package/dist/resources/extensions/gsd/cache.js +16 -5
  17. package/dist/resources/extensions/gsd/commands/catalog.js +6 -1
  18. package/dist/resources/extensions/gsd/commands/handlers/core.js +5 -1
  19. package/dist/resources/extensions/gsd/commands/handlers/ops.js +5 -0
  20. package/dist/resources/extensions/gsd/commands-extract-learnings.js +225 -0
  21. package/dist/resources/extensions/gsd/commands-prefs-wizard.js +51 -4
  22. package/dist/resources/extensions/gsd/docs/preferences-reference.md +16 -1
  23. package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +144 -0
  24. package/dist/resources/extensions/gsd/ecosystem/loader.js +145 -0
  25. package/dist/resources/extensions/gsd/git-service.js +49 -1
  26. package/dist/resources/extensions/gsd/graph-context.js +98 -7
  27. package/dist/resources/extensions/gsd/gsd-db.js +260 -2
  28. package/dist/resources/extensions/gsd/guided-flow.js +31 -6
  29. package/dist/resources/extensions/gsd/init-wizard.js +1 -0
  30. package/dist/resources/extensions/gsd/journal.js +27 -0
  31. package/dist/resources/extensions/gsd/metrics.js +19 -0
  32. package/dist/resources/extensions/gsd/parallel-orchestrator.js +33 -1
  33. package/dist/resources/extensions/gsd/preferences-models.js +20 -3
  34. package/dist/resources/extensions/gsd/preferences-types.js +2 -0
  35. package/dist/resources/extensions/gsd/preferences-validation.js +118 -2
  36. package/dist/resources/extensions/gsd/preferences.js +31 -0
  37. package/dist/resources/extensions/gsd/safety/evidence-collector.js +15 -30
  38. package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +12 -2
  39. package/dist/resources/extensions/gsd/templates/PREFERENCES.md +19 -0
  40. package/dist/resources/extensions/gsd/tools/complete-slice.js +5 -0
  41. package/dist/resources/extensions/gsd/tools/validate-milestone.js +39 -4
  42. package/dist/resources/extensions/gsd/unit-ownership.js +1 -1
  43. package/dist/resources/extensions/gsd/uok/audit-toggle.js +7 -0
  44. package/dist/resources/extensions/gsd/uok/audit.js +40 -0
  45. package/dist/resources/extensions/gsd/uok/contracts.js +1 -0
  46. package/dist/resources/extensions/gsd/uok/execution-graph.js +179 -0
  47. package/dist/resources/extensions/gsd/uok/flags.js +29 -0
  48. package/dist/resources/extensions/gsd/uok/gate-runner.js +109 -0
  49. package/dist/resources/extensions/gsd/uok/gitops.js +53 -0
  50. package/dist/resources/extensions/gsd/uok/kernel.js +80 -0
  51. package/dist/resources/extensions/gsd/uok/loop-adapter.js +133 -0
  52. package/dist/resources/extensions/gsd/uok/model-policy.js +66 -0
  53. package/dist/resources/extensions/gsd/uok/plan-v2.js +132 -0
  54. package/dist/resources/extensions/gsd/workflow-logger.js +22 -0
  55. package/dist/resources/extensions/ttsr/ttsr-manager.js +3 -1
  56. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  57. package/dist/web/standalone/.next/BUILD_ID +1 -1
  58. package/dist/web/standalone/.next/app-path-routes-manifest.json +8 -8
  59. package/dist/web/standalone/.next/build-manifest.json +2 -2
  60. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  61. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  62. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  63. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  64. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  65. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  66. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  67. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  68. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  69. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  70. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  71. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  72. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  73. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  74. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  75. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  76. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  77. package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
  78. package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +1 -1
  79. package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +1 -1
  80. package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
  81. package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +1 -1
  82. package/dist/web/standalone/.next/server/app/index.html +1 -1
  83. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  84. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  85. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  86. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  87. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  88. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  89. package/dist/web/standalone/.next/server/app-paths-manifest.json +8 -8
  90. package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
  91. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  92. package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
  93. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  94. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  95. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  96. package/package.json +1 -1
  97. package/packages/mcp-server/dist/readers/graph.d.ts +1 -1
  98. package/packages/mcp-server/dist/readers/graph.d.ts.map +1 -1
  99. package/packages/mcp-server/dist/readers/graph.js +107 -0
  100. package/packages/mcp-server/dist/readers/graph.js.map +1 -1
  101. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  102. package/packages/mcp-server/dist/workflow-tools.js +88 -6
  103. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  104. package/packages/mcp-server/src/readers/graph.test.ts +178 -0
  105. package/packages/mcp-server/src/readers/graph.ts +148 -1
  106. package/packages/mcp-server/src/workflow-tools.ts +95 -10
  107. package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
  108. package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
  109. package/packages/pi-ai/dist/index.d.ts +1 -9
  110. package/packages/pi-ai/dist/index.d.ts.map +1 -1
  111. package/packages/pi-ai/dist/index.js +1 -9
  112. package/packages/pi-ai/dist/index.js.map +1 -1
  113. package/packages/pi-ai/dist/models/capability-patches.d.ts +19 -0
  114. package/packages/pi-ai/dist/models/capability-patches.d.ts.map +1 -0
  115. package/packages/pi-ai/dist/models/capability-patches.js +36 -0
  116. package/packages/pi-ai/dist/models/capability-patches.js.map +1 -0
  117. package/packages/pi-ai/dist/{models.custom.d.ts → models/custom.d.ts} +1 -1
  118. package/packages/pi-ai/dist/models/custom.d.ts.map +1 -0
  119. package/packages/pi-ai/dist/{models.custom.js → models/custom.js} +4 -4
  120. package/packages/pi-ai/dist/models/custom.js.map +1 -0
  121. package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts +1482 -0
  122. package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts.map +1 -0
  123. package/packages/pi-ai/dist/models/generated/amazon-bedrock.js +1484 -0
  124. package/packages/pi-ai/dist/models/generated/amazon-bedrock.js.map +1 -0
  125. package/packages/pi-ai/dist/models/generated/anthropic.d.ts +377 -0
  126. package/packages/pi-ai/dist/models/generated/anthropic.d.ts.map +1 -0
  127. package/packages/pi-ai/dist/models/generated/anthropic.js +379 -0
  128. package/packages/pi-ai/dist/models/generated/anthropic.js.map +1 -0
  129. package/packages/pi-ai/dist/models/generated/azure-openai-responses.d.ts +700 -0
  130. package/packages/pi-ai/dist/models/generated/azure-openai-responses.d.ts.map +1 -0
  131. package/packages/pi-ai/dist/models/generated/azure-openai-responses.js +702 -0
  132. package/packages/pi-ai/dist/models/generated/azure-openai-responses.js.map +1 -0
  133. package/packages/pi-ai/dist/models/generated/cerebras.d.ts +71 -0
  134. package/packages/pi-ai/dist/models/generated/cerebras.d.ts.map +1 -0
  135. package/packages/pi-ai/dist/models/generated/cerebras.js +73 -0
  136. package/packages/pi-ai/dist/models/generated/cerebras.js.map +1 -0
  137. package/packages/pi-ai/dist/models/generated/github-copilot.d.ts +590 -0
  138. package/packages/pi-ai/dist/models/generated/github-copilot.d.ts.map +1 -0
  139. package/packages/pi-ai/dist/models/generated/github-copilot.js +444 -0
  140. package/packages/pi-ai/dist/models/generated/github-copilot.js.map +1 -0
  141. package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts +156 -0
  142. package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts.map +1 -0
  143. package/packages/pi-ai/dist/models/generated/google-antigravity.js +158 -0
  144. package/packages/pi-ai/dist/models/generated/google-antigravity.js.map +1 -0
  145. package/packages/pi-ai/dist/models/generated/google-gemini-cli.d.ts +105 -0
  146. package/packages/pi-ai/dist/models/generated/google-gemini-cli.d.ts.map +1 -0
  147. package/packages/pi-ai/dist/models/generated/google-gemini-cli.js +107 -0
  148. package/packages/pi-ai/dist/models/generated/google-gemini-cli.js.map +1 -0
  149. package/packages/pi-ai/dist/models/generated/google-vertex.d.ts +207 -0
  150. package/packages/pi-ai/dist/models/generated/google-vertex.d.ts.map +1 -0
  151. package/packages/pi-ai/dist/models/generated/google-vertex.js +209 -0
  152. package/packages/pi-ai/dist/models/generated/google-vertex.js.map +1 -0
  153. package/packages/pi-ai/dist/models/generated/google.d.ts +462 -0
  154. package/packages/pi-ai/dist/models/generated/google.d.ts.map +1 -0
  155. package/packages/pi-ai/dist/models/generated/google.js +464 -0
  156. package/packages/pi-ai/dist/models/generated/google.js.map +1 -0
  157. package/packages/pi-ai/dist/models/generated/groq.d.ts +309 -0
  158. package/packages/pi-ai/dist/models/generated/groq.d.ts.map +1 -0
  159. package/packages/pi-ai/dist/models/generated/groq.js +311 -0
  160. package/packages/pi-ai/dist/models/generated/groq.js.map +1 -0
  161. package/packages/pi-ai/dist/models/generated/huggingface.d.ts +383 -0
  162. package/packages/pi-ai/dist/models/generated/huggingface.d.ts.map +1 -0
  163. package/packages/pi-ai/dist/models/generated/huggingface.js +347 -0
  164. package/packages/pi-ai/dist/models/generated/huggingface.js.map +1 -0
  165. package/packages/pi-ai/dist/{models.generated.d.ts → models/generated/index.d.ts} +1 -1
  166. package/packages/pi-ai/dist/{models.generated.d.ts.map → models/generated/index.d.ts.map} +1 -1
  167. package/packages/pi-ai/dist/models/generated/index.js +51 -0
  168. package/packages/pi-ai/dist/models/generated/index.js.map +1 -0
  169. package/packages/pi-ai/dist/models/generated/kimi-coding.d.ts +37 -0
  170. package/packages/pi-ai/dist/models/generated/kimi-coding.d.ts.map +1 -0
  171. package/packages/pi-ai/dist/models/generated/kimi-coding.js +39 -0
  172. package/packages/pi-ai/dist/models/generated/kimi-coding.js.map +1 -0
  173. package/packages/pi-ai/dist/models/generated/minimax-cn.d.ts +105 -0
  174. package/packages/pi-ai/dist/models/generated/minimax-cn.d.ts.map +1 -0
  175. package/packages/pi-ai/dist/models/generated/minimax-cn.js +107 -0
  176. package/packages/pi-ai/dist/models/generated/minimax-cn.js.map +1 -0
  177. package/packages/pi-ai/dist/models/generated/minimax.d.ts +105 -0
  178. package/packages/pi-ai/dist/models/generated/minimax.d.ts.map +1 -0
  179. package/packages/pi-ai/dist/models/generated/minimax.js +107 -0
  180. package/packages/pi-ai/dist/models/generated/minimax.js.map +1 -0
  181. package/packages/pi-ai/dist/models/generated/mistral.d.ts +445 -0
  182. package/packages/pi-ai/dist/models/generated/mistral.d.ts.map +1 -0
  183. package/packages/pi-ai/dist/models/generated/mistral.js +447 -0
  184. package/packages/pi-ai/dist/models/generated/mistral.js.map +1 -0
  185. package/packages/pi-ai/dist/models/generated/openai-codex.d.ts +139 -0
  186. package/packages/pi-ai/dist/models/generated/openai-codex.d.ts.map +1 -0
  187. package/packages/pi-ai/dist/models/generated/openai-codex.js +141 -0
  188. package/packages/pi-ai/dist/models/generated/openai-codex.js.map +1 -0
  189. package/packages/pi-ai/dist/models/generated/openai.d.ts +700 -0
  190. package/packages/pi-ai/dist/models/generated/openai.d.ts.map +1 -0
  191. package/packages/pi-ai/dist/models/generated/openai.js +702 -0
  192. package/packages/pi-ai/dist/models/generated/openai.js.map +1 -0
  193. package/packages/pi-ai/dist/models/generated/opencode-go.d.ts +122 -0
  194. package/packages/pi-ai/dist/models/generated/opencode-go.d.ts.map +1 -0
  195. package/packages/pi-ai/dist/models/generated/opencode-go.js +124 -0
  196. package/packages/pi-ai/dist/models/generated/opencode-go.js.map +1 -0
  197. package/packages/pi-ai/dist/models/generated/opencode.d.ts +530 -0
  198. package/packages/pi-ai/dist/models/generated/opencode.d.ts.map +1 -0
  199. package/packages/pi-ai/dist/models/generated/opencode.js +532 -0
  200. package/packages/pi-ai/dist/models/generated/opencode.js.map +1 -0
  201. package/packages/pi-ai/dist/models/generated/openrouter.d.ts +4270 -0
  202. package/packages/pi-ai/dist/models/generated/openrouter.d.ts.map +1 -0
  203. package/packages/pi-ai/dist/models/generated/openrouter.js +4272 -0
  204. package/packages/pi-ai/dist/models/generated/openrouter.js.map +1 -0
  205. package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.d.ts +2604 -0
  206. package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.d.ts.map +1 -0
  207. package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.js +2606 -0
  208. package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.js.map +1 -0
  209. package/packages/pi-ai/dist/models/generated/xai.d.ts +411 -0
  210. package/packages/pi-ai/dist/models/generated/xai.d.ts.map +1 -0
  211. package/packages/pi-ai/dist/models/generated/xai.js +413 -0
  212. package/packages/pi-ai/dist/models/generated/xai.js.map +1 -0
  213. package/packages/pi-ai/dist/models/generated/zai.d.ts +276 -0
  214. package/packages/pi-ai/dist/models/generated/zai.d.ts.map +1 -0
  215. package/packages/pi-ai/dist/models/generated/zai.js +239 -0
  216. package/packages/pi-ai/dist/models/generated/zai.js.map +1 -0
  217. package/packages/pi-ai/dist/models/index.d.ts +27 -0
  218. package/packages/pi-ai/dist/models/index.d.ts.map +1 -0
  219. package/packages/pi-ai/dist/models/index.js +80 -0
  220. package/packages/pi-ai/dist/models/index.js.map +1 -0
  221. package/packages/pi-ai/dist/models.d.ts +1 -36
  222. package/packages/pi-ai/dist/models.d.ts.map +1 -1
  223. package/packages/pi-ai/dist/models.generated.test.js +1 -2
  224. package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
  225. package/packages/pi-ai/dist/models.js +3 -112
  226. package/packages/pi-ai/dist/models.js.map +1 -1
  227. package/packages/pi-ai/dist/models.test.js +6 -5
  228. package/packages/pi-ai/dist/models.test.js.map +1 -1
  229. package/packages/pi-ai/scripts/generate-models.ts +74 -40
  230. package/packages/pi-ai/src/index.ts +1 -9
  231. package/packages/pi-ai/src/models/capability-patches.ts +40 -0
  232. package/packages/pi-ai/src/{models.custom.ts → models/custom.ts} +4 -4
  233. package/packages/pi-ai/src/models/generated/amazon-bedrock.ts +1486 -0
  234. package/packages/pi-ai/src/models/generated/anthropic.ts +381 -0
  235. package/packages/pi-ai/src/models/generated/azure-openai-responses.ts +704 -0
  236. package/packages/pi-ai/src/models/generated/cerebras.ts +75 -0
  237. package/packages/pi-ai/src/models/generated/github-copilot.ts +446 -0
  238. package/packages/pi-ai/src/models/generated/google-antigravity.ts +160 -0
  239. package/packages/pi-ai/src/models/generated/google-gemini-cli.ts +109 -0
  240. package/packages/pi-ai/src/models/generated/google-vertex.ts +211 -0
  241. package/packages/pi-ai/src/models/generated/google.ts +466 -0
  242. package/packages/pi-ai/src/models/generated/groq.ts +313 -0
  243. package/packages/pi-ai/src/models/generated/huggingface.ts +349 -0
  244. package/packages/pi-ai/src/models/generated/index.ts +52 -0
  245. package/packages/pi-ai/src/models/generated/kimi-coding.ts +41 -0
  246. package/packages/pi-ai/src/models/generated/minimax-cn.ts +109 -0
  247. package/packages/pi-ai/src/models/generated/minimax.ts +109 -0
  248. package/packages/pi-ai/src/models/generated/mistral.ts +449 -0
  249. package/packages/pi-ai/src/models/generated/openai-codex.ts +143 -0
  250. package/packages/pi-ai/src/models/generated/openai.ts +704 -0
  251. package/packages/pi-ai/src/models/generated/opencode-go.ts +126 -0
  252. package/packages/pi-ai/src/models/generated/opencode.ts +534 -0
  253. package/packages/pi-ai/src/models/generated/openrouter.ts +4274 -0
  254. package/packages/pi-ai/src/models/generated/vercel-ai-gateway.ts +2608 -0
  255. package/packages/pi-ai/src/models/generated/xai.ts +415 -0
  256. package/packages/pi-ai/src/models/generated/zai.ts +241 -0
  257. package/packages/pi-ai/src/models/index.ts +106 -0
  258. package/packages/pi-ai/src/models.generated.test.ts +1 -2
  259. package/packages/pi-ai/src/models.test.ts +6 -5
  260. package/packages/pi-ai/src/models.ts +3 -153
  261. package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
  262. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  263. package/packages/pi-coding-agent/dist/core/agent-session.js +8 -2
  264. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  265. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +472 -0
  266. package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
  267. package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.d.ts +2 -0
  268. package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.d.ts.map +1 -0
  269. package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.js +52 -0
  270. package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.js.map +1 -0
  271. package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  272. package/packages/pi-coding-agent/dist/core/model-registry.js +2 -2
  273. package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  274. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.d.ts +2 -0
  275. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.d.ts.map +1 -0
  276. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js +61 -0
  277. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js.map +1 -0
  278. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +11 -0
  279. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
  280. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts +1 -0
  281. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  282. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +23 -9
  283. package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
  284. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts +11 -0
  285. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -0
  286. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +53 -0
  287. package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -0
  288. package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +8 -5
  289. package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  290. package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +27 -13
  291. package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  292. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +8 -0
  293. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  294. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +68 -8
  295. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  296. package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  297. package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js +22 -22
  298. package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js.map +1 -1
  299. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  300. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +232 -18
  301. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  302. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.d.ts +2 -0
  303. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.d.ts.map +1 -0
  304. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js +38 -0
  305. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js.map +1 -0
  306. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +14 -0
  307. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  308. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +70 -6
  309. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  310. package/packages/pi-coding-agent/src/core/agent-session.ts +12 -6
  311. package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +612 -0
  312. package/packages/pi-coding-agent/src/core/model-registry-env-fallback.test.ts +59 -0
  313. package/packages/pi-coding-agent/src/core/model-registry.ts +2 -1
  314. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.ts +92 -0
  315. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +19 -0
  316. package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +25 -10
  317. package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +75 -0
  318. package/packages/pi-coding-agent/src/modes/interactive/components/compaction-summary-message.ts +36 -15
  319. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +83 -7
  320. package/packages/pi-coding-agent/src/modes/interactive/components/user-message.ts +23 -26
  321. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +298 -41
  322. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-ordering.test.ts +44 -0
  323. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +92 -6
  324. package/packages/pi-coding-agent/src/types/ambient-modules.d.ts +69 -0
  325. package/packages/pi-coding-agent/tsconfig.json +2 -2
  326. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  327. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  328. package/packages/pi-tui/dist/tui.js +9 -2
  329. package/packages/pi-tui/dist/tui.js.map +1 -1
  330. package/packages/pi-tui/src/tui.ts +9 -1
  331. package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
  332. package/src/resources/extensions/gsd/activity-log.ts +21 -0
  333. package/src/resources/extensions/gsd/auto/loop-deps.ts +4 -0
  334. package/src/resources/extensions/gsd/auto/loop.ts +159 -10
  335. package/src/resources/extensions/gsd/auto/phases.ts +193 -9
  336. package/src/resources/extensions/gsd/auto/session.ts +10 -0
  337. package/src/resources/extensions/gsd/auto-dispatch.ts +16 -6
  338. package/src/resources/extensions/gsd/auto-model-selection.ts +69 -8
  339. package/src/resources/extensions/gsd/auto-post-unit.ts +226 -9
  340. package/src/resources/extensions/gsd/auto-recovery.ts +29 -9
  341. package/src/resources/extensions/gsd/auto-unit-closeout.ts +25 -1
  342. package/src/resources/extensions/gsd/auto-verification.ts +129 -2
  343. package/src/resources/extensions/gsd/auto-worktree.ts +1 -0
  344. package/src/resources/extensions/gsd/auto.ts +34 -2
  345. package/src/resources/extensions/gsd/bootstrap/provider-error-resume.ts +5 -3
  346. package/src/resources/extensions/gsd/bootstrap/register-extension.ts +15 -1
  347. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +72 -8
  348. package/src/resources/extensions/gsd/cache.ts +16 -5
  349. package/src/resources/extensions/gsd/commands/catalog.ts +6 -1
  350. package/src/resources/extensions/gsd/commands/handlers/core.ts +5 -1
  351. package/src/resources/extensions/gsd/commands/handlers/ops.ts +5 -0
  352. package/src/resources/extensions/gsd/commands-extract-learnings.ts +304 -0
  353. package/src/resources/extensions/gsd/commands-prefs-wizard.ts +58 -4
  354. package/src/resources/extensions/gsd/docs/preferences-reference.md +16 -1
  355. package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +228 -0
  356. package/src/resources/extensions/gsd/ecosystem/loader.ts +201 -0
  357. package/src/resources/extensions/gsd/git-service.ts +68 -0
  358. package/src/resources/extensions/gsd/graph-context.ts +139 -12
  359. package/src/resources/extensions/gsd/gsd-db.ts +321 -3
  360. package/src/resources/extensions/gsd/guided-flow.ts +36 -2
  361. package/src/resources/extensions/gsd/init-wizard.ts +3 -2
  362. package/src/resources/extensions/gsd/journal.ts +30 -0
  363. package/src/resources/extensions/gsd/metrics.ts +26 -0
  364. package/src/resources/extensions/gsd/parallel-orchestrator.ts +40 -1
  365. package/src/resources/extensions/gsd/preferences-models.ts +20 -3
  366. package/src/resources/extensions/gsd/preferences-types.ts +38 -0
  367. package/src/resources/extensions/gsd/preferences-validation.ts +117 -2
  368. package/src/resources/extensions/gsd/preferences.ts +34 -0
  369. package/src/resources/extensions/gsd/safety/evidence-collector.ts +15 -31
  370. package/src/resources/extensions/gsd/session-lock.ts +14 -2
  371. package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +20 -1
  372. package/src/resources/extensions/gsd/templates/PREFERENCES.md +19 -0
  373. package/src/resources/extensions/gsd/tests/artifacts-table-preserved-on-cache-invalidate.test.ts +177 -0
  374. package/src/resources/extensions/gsd/tests/auto-loop.test.ts +7 -3
  375. package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +20 -0
  376. package/src/resources/extensions/gsd/tests/auto-project-root-env.test.ts +7 -3
  377. package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +272 -0
  378. package/src/resources/extensions/gsd/tests/auto-warning-noise-regression.test.ts +117 -0
  379. package/src/resources/extensions/gsd/tests/cold-resume-db-reopen.test.ts +6 -2
  380. package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +340 -0
  381. package/src/resources/extensions/gsd/tests/complete-slice.test.ts +2 -2
  382. package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
  383. package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +10 -7
  384. package/src/resources/extensions/gsd/tests/gsd-db.test.ts +1 -1
  385. package/src/resources/extensions/gsd/tests/health-widget.test.ts +1 -1
  386. package/src/resources/extensions/gsd/tests/journal-integration.test.ts +3 -3
  387. package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -2
  388. package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -3
  389. package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
  390. package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +2 -1
  391. package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +40 -1
  392. package/src/resources/extensions/gsd/tests/preferences.test.ts +145 -0
  393. package/src/resources/extensions/gsd/tests/provider-errors.test.ts +57 -2
  394. package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +1 -1
  395. package/src/resources/extensions/gsd/tests/token-profile.test.ts +8 -5
  396. package/src/resources/extensions/gsd/tests/uok-audit-unified.test.ts +101 -0
  397. package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +85 -0
  398. package/src/resources/extensions/gsd/tests/uok-execution-graph.test.ts +69 -0
  399. package/src/resources/extensions/gsd/tests/uok-flags.test.ts +39 -0
  400. package/src/resources/extensions/gsd/tests/uok-gate-runner.test.ts +70 -0
  401. package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +85 -0
  402. package/src/resources/extensions/gsd/tests/uok-gitops-wiring.test.ts +35 -0
  403. package/src/resources/extensions/gsd/tests/uok-model-policy.test.ts +89 -0
  404. package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +167 -0
  405. package/src/resources/extensions/gsd/tests/uok-preferences.test.ts +42 -0
  406. package/src/resources/extensions/gsd/tests/validate-milestone-write-order.test.ts +39 -0
  407. package/src/resources/extensions/gsd/tools/complete-slice.ts +9 -2
  408. package/src/resources/extensions/gsd/tools/validate-milestone.ts +48 -3
  409. package/src/resources/extensions/gsd/types.ts +14 -1
  410. package/src/resources/extensions/gsd/unit-ownership.ts +2 -2
  411. package/src/resources/extensions/gsd/uok/audit-toggle.ts +9 -0
  412. package/src/resources/extensions/gsd/uok/audit.ts +51 -0
  413. package/src/resources/extensions/gsd/uok/contracts.ts +135 -0
  414. package/src/resources/extensions/gsd/uok/execution-graph.ts +241 -0
  415. package/src/resources/extensions/gsd/uok/flags.ts +45 -0
  416. package/src/resources/extensions/gsd/uok/gate-runner.ts +146 -0
  417. package/src/resources/extensions/gsd/uok/gitops.ts +75 -0
  418. package/src/resources/extensions/gsd/uok/kernel.ts +105 -0
  419. package/src/resources/extensions/gsd/uok/loop-adapter.ts +162 -0
  420. package/src/resources/extensions/gsd/uok/model-policy.ts +112 -0
  421. package/src/resources/extensions/gsd/uok/plan-v2.ts +156 -0
  422. package/src/resources/extensions/gsd/workflow-logger.ts +27 -1
  423. package/src/resources/extensions/ttsr/ttsr-manager.ts +10 -5
  424. package/packages/pi-ai/dist/models.custom.d.ts.map +0 -1
  425. package/packages/pi-ai/dist/models.custom.js.map +0 -1
  426. package/packages/pi-ai/dist/models.generated.js +0 -14343
  427. package/packages/pi-ai/dist/models.generated.js.map +0 -1
  428. package/packages/pi-ai/src/models.generated.ts +0 -14345
  429. /package/dist/web/standalone/.next/static/{XnHY5eXUsTCFmNodWHetD → k1VZ0h-SB6uWSZgPhgNwi}/_buildManifest.js +0 -0
  430. /package/dist/web/standalone/.next/static/{XnHY5eXUsTCFmNodWHetD → k1VZ0h-SB6uWSZgPhgNwi}/_ssgManifest.js +0 -0
@@ -15,6 +15,8 @@
15
15
  import { appendFileSync, mkdirSync, readdirSync, readFileSync } from "node:fs";
16
16
  import { join } from "node:path";
17
17
  import { gsdRoot } from "./paths.js";
18
+ import { buildAuditEnvelope, emitUokAuditEvent } from "./uok/audit.js";
19
+ import { isUnifiedAuditEnabled } from "./uok/audit-toggle.js";
18
20
 
19
21
  // ─── Types ────────────────────────────────────────────────────────────────────
20
22
 
@@ -90,6 +92,34 @@ export function emitJournalEvent(basePath: string, entry: JournalEntry): void {
90
92
  } catch {
91
93
  // Silent failure — journal must never break auto-mode
92
94
  }
95
+
96
+ if (!isUnifiedAuditEnabled()) return;
97
+ try {
98
+ const causedBy = entry.causedBy
99
+ ? `${entry.causedBy.flowId}:${entry.causedBy.seq}`
100
+ : undefined;
101
+ const turnId =
102
+ typeof entry.data?.turnId === "string"
103
+ ? entry.data.turnId
104
+ : undefined;
105
+ emitUokAuditEvent(
106
+ basePath,
107
+ buildAuditEnvelope({
108
+ traceId: entry.flowId,
109
+ turnId,
110
+ causedBy,
111
+ category: "orchestration",
112
+ type: `journal-${entry.eventType}`,
113
+ payload: {
114
+ seq: entry.seq,
115
+ rule: entry.rule,
116
+ data: entry.data ?? {},
117
+ },
118
+ }),
119
+ );
120
+ } catch {
121
+ // Best-effort: audit projection must never block journal writes.
122
+ }
93
123
  }
94
124
 
95
125
  // ─── Query ────────────────────────────────────────────────────────────────────
@@ -19,6 +19,8 @@ import { gsdRoot } from "./paths.js";
19
19
  import { getAndClearSkills } from "./skill-telemetry.js";
20
20
  import { loadJsonFile, loadJsonFileOrNull, saveJsonFile } from "./json-persistence.js";
21
21
  import { parseUnitId } from "./unit-id.js";
22
+ import { buildAuditEnvelope, emitUokAuditEvent } from "./uok/audit.js";
23
+ import { isUnifiedAuditEnabled } from "./uok/audit-toggle.js";
22
24
 
23
25
  // Re-export from shared — import directly from format-utils to avoid pulling
24
26
  // in the full barrel (mod.js → ui.js → @gsd/pi-tui) which breaks when loaded
@@ -143,6 +145,9 @@ export function snapshotUnitMetrics(
143
145
  promptCharCount?: number;
144
146
  baselineCharCount?: number;
145
147
  autoSessionKey?: string;
148
+ traceId?: string;
149
+ turnId?: string;
150
+ causedBy?: string;
146
151
  },
147
152
  ): UnitMetrics | null {
148
153
  if (!ledger) return null;
@@ -235,6 +240,27 @@ export function snapshotUnitMetrics(
235
240
  }
236
241
  saveLedger(basePath, ledger);
237
242
 
243
+ if (isUnifiedAuditEnabled()) {
244
+ emitUokAuditEvent(
245
+ basePath,
246
+ buildAuditEnvelope({
247
+ traceId: opts?.traceId ?? `metrics:${unitType}:${unitId}`,
248
+ turnId: opts?.turnId,
249
+ causedBy: opts?.causedBy,
250
+ category: "metrics",
251
+ type: "unit-metrics-snapshot",
252
+ payload: {
253
+ unitType,
254
+ unitId,
255
+ model,
256
+ tokens: unit.tokens,
257
+ cost: unit.cost,
258
+ toolCalls: unit.toolCalls,
259
+ },
260
+ }),
261
+ );
262
+ }
263
+
238
264
  return unit;
239
265
  }
240
266
 
@@ -42,6 +42,8 @@ import {
42
42
  } from "./parallel-eligibility.js";
43
43
  import { getErrorMessage } from "./error-utils.js";
44
44
  import { logWarning } from "./workflow-logger.js";
45
+ import { resolveUokFlags } from "./uok/flags.js";
46
+ import { selectConflictFreeBatch } from "./uok/execution-graph.js";
45
47
 
46
48
  // ─── Types ─────────────────────────────────────────────────────────────────
47
49
 
@@ -69,6 +71,10 @@ export interface OrchestratorState {
69
71
 
70
72
  let state: OrchestratorState | null = null;
71
73
 
74
+ function overlapKey(a: string, b: string): string {
75
+ return a < b ? `${a}::${b}` : `${b}::${a}`;
76
+ }
77
+
72
78
  // ─── Persistence ──────────────────────────────────────────────────────────
73
79
 
74
80
  const ORCHESTRATOR_STATE_FILE = "orchestrator.json";
@@ -365,6 +371,7 @@ export async function startParallel(
365
371
  }
366
372
 
367
373
  const config = resolveParallelConfig(prefs);
374
+ const uokFlags = resolveUokFlags(prefs);
368
375
 
369
376
  // Release any leftover state from a previous session before reassigning
370
377
  if (state) {
@@ -418,8 +425,40 @@ export async function startParallel(
418
425
  const started: string[] = [];
419
426
  const errors: Array<{ mid: string; error: string }> = [];
420
427
 
428
+ let filteredMilestoneIds = milestoneIds;
429
+ if (uokFlags.executionGraph && milestoneIds.length > 1) {
430
+ try {
431
+ const requestedIds = new Set(milestoneIds);
432
+ const candidates = await analyzeParallelEligibility(basePath);
433
+ const overlapPairs = new Set<string>();
434
+ for (const overlap of candidates.fileOverlaps) {
435
+ if (!requestedIds.has(overlap.mid1) || !requestedIds.has(overlap.mid2)) continue;
436
+ overlapPairs.add(overlapKey(overlap.mid1, overlap.mid2));
437
+ }
438
+ filteredMilestoneIds = selectConflictFreeBatch({
439
+ orderedIds: milestoneIds,
440
+ maxParallel: milestoneIds.length,
441
+ hasConflict: (candidate, existing) =>
442
+ overlapPairs.has(overlapKey(candidate, existing)),
443
+ });
444
+ if (filteredMilestoneIds.length < milestoneIds.length) {
445
+ const skipped = milestoneIds.filter((mid) => !filteredMilestoneIds.includes(mid));
446
+ logWarning(
447
+ "parallel",
448
+ `uok execution graph filtered ${skipped.length} conflicting milestone(s): ${skipped.join(", ")}`,
449
+ );
450
+ }
451
+ } catch (e) {
452
+ logWarning(
453
+ "parallel",
454
+ `uok execution graph overlap analysis failed; using legacy milestone selection: ${(e as Error).message}`,
455
+ );
456
+ filteredMilestoneIds = milestoneIds;
457
+ }
458
+ }
459
+
421
460
  // Cap to max_workers
422
- const toStart = milestoneIds.slice(0, config.max_workers);
461
+ const toStart = filteredMilestoneIds.slice(0, config.max_workers);
423
462
 
424
463
  for (const mid of toStart) {
425
464
  // Check budget ceiling before each spawn
@@ -355,7 +355,7 @@ export function resolveAutoSupervisorConfig(): AutoSupervisorConfig {
355
355
 
356
356
  // ─── Token Profile Resolution ─────────────────────────────────────────────
357
357
 
358
- const VALID_TOKEN_PROFILES = new Set<TokenProfile>(["budget", "balanced", "quality"]);
358
+ const VALID_TOKEN_PROFILES = new Set<TokenProfile>(["budget", "balanced", "quality", "burn-max"]);
359
359
 
360
360
  /**
361
361
  * Resolve profile defaults for a given token profile tier.
@@ -400,6 +400,22 @@ export function resolveProfileDefaults(profile: TokenProfile): Partial<GSDPrefer
400
400
  skip_reassess: true,
401
401
  },
402
402
  };
403
+ case "burn-max":
404
+ return {
405
+ // Quality-first profile: keep user-selected models, disable downgrade routing.
406
+ // Policy constraints still apply at dispatch time.
407
+ dynamic_routing: {
408
+ enabled: false,
409
+ },
410
+ context_selection: "full",
411
+ phases: {
412
+ skip_research: false,
413
+ skip_slice_research: false,
414
+ skip_reassess: false,
415
+ skip_milestone_validation: false,
416
+ reassess_after_slice: true,
417
+ },
418
+ };
403
419
  }
404
420
  }
405
421
 
@@ -416,7 +432,7 @@ export function resolveEffectiveProfile(): TokenProfile {
416
432
 
417
433
  /**
418
434
  * Resolve the inline level from the active token profile.
419
- * budget -> minimal, balanced -> standard, quality -> full.
435
+ * budget -> minimal, balanced -> standard, quality/burn-max -> full.
420
436
  */
421
437
  export function resolveInlineLevel(): InlineLevel {
422
438
  const profile = resolveEffectiveProfile();
@@ -424,12 +440,13 @@ export function resolveInlineLevel(): InlineLevel {
424
440
  case "budget": return "minimal";
425
441
  case "balanced": return "standard";
426
442
  case "quality": return "full";
443
+ case "burn-max": return "full";
427
444
  }
428
445
  }
429
446
 
430
447
  /**
431
448
  * Resolve the context selection mode from the active token profile.
432
- * budget -> "smart", balanced/quality -> "full".
449
+ * budget -> "smart", balanced/quality/burn-max -> "full".
433
450
  * Explicit preference always wins.
434
451
  */
435
452
  export function resolveContextSelection(): import("./types.js").ContextSelectionMode {
@@ -83,6 +83,7 @@ export const KNOWN_PREFERENCE_KEYS = new Set<string>([
83
83
  "post_unit_hooks",
84
84
  "pre_dispatch_hooks",
85
85
  "dynamic_routing",
86
+ "uok",
86
87
  "token_profile",
87
88
  "phases",
88
89
  "auto_visualize",
@@ -114,6 +115,7 @@ export const KNOWN_PREFERENCE_KEYS = new Set<string>([
114
115
  "discuss_web_research",
115
116
  "discuss_depth",
116
117
  "flat_rate_providers",
118
+ "language",
117
119
  ]);
118
120
 
119
121
  /** Canonical list of all dispatch unit types. */
@@ -208,6 +210,35 @@ export interface CmuxPreferences {
208
210
  browser?: boolean;
209
211
  }
210
212
 
213
+ export type UokTurnActionMode = "commit" | "snapshot" | "status-only";
214
+
215
+ export interface UokPreferences {
216
+ enabled?: boolean;
217
+ legacy_fallback?: {
218
+ enabled?: boolean;
219
+ };
220
+ gates?: {
221
+ enabled?: boolean;
222
+ };
223
+ model_policy?: {
224
+ enabled?: boolean;
225
+ };
226
+ execution_graph?: {
227
+ enabled?: boolean;
228
+ };
229
+ gitops?: {
230
+ enabled?: boolean;
231
+ turn_action?: UokTurnActionMode;
232
+ turn_push?: boolean;
233
+ };
234
+ audit_unified?: {
235
+ enabled?: boolean;
236
+ };
237
+ plan_v2?: {
238
+ enabled?: boolean;
239
+ };
240
+ }
241
+
211
242
  /**
212
243
  * Opt-in experimental features. All features in this block are disabled by
213
244
  * default and must be explicitly enabled. They may change or be removed without
@@ -256,6 +287,8 @@ export interface GSDPreferences {
256
287
  post_unit_hooks?: PostUnitHookConfig[];
257
288
  pre_dispatch_hooks?: PreDispatchHookConfig[];
258
289
  dynamic_routing?: DynamicRoutingConfig;
290
+ /** Unified Orchestration Kernel controls (all flags default off). */
291
+ uok?: UokPreferences;
259
292
  /** Per-model capability overrides. Deep-merged with built-in profiles for capability-aware routing (ADR-004). */
260
293
  modelOverrides?: Record<string, { capabilities?: Partial<ModelCapabilities> }>;
261
294
  context_management?: ContextManagementConfig;
@@ -371,6 +404,11 @@ export interface GSDPreferences {
371
404
  * same regardless of model. Case-insensitive.
372
405
  */
373
406
  flat_rate_providers?: string[];
407
+ /**
408
+ * Language preference for GSD responses. Accepts any language name or code
409
+ * (e.g. "Chinese", "zh", "German", "de", "日本語"). Persists across /clear.
410
+ */
411
+ language?: string;
374
412
  }
375
413
 
376
414
  export interface LoadedGSDPreferences {
@@ -22,7 +22,12 @@ import {
22
22
  type GSDSkillRule,
23
23
  } from "./preferences-types.js";
24
24
 
25
- const VALID_TOKEN_PROFILES = new Set<TokenProfile>(["budget", "balanced", "quality"]);
25
+ const VALID_TOKEN_PROFILES = new Set<TokenProfile>(["budget", "balanced", "quality", "burn-max"]);
26
+ const VALID_UOK_TURN_ACTIONS = new Set<"commit" | "snapshot" | "status-only">([
27
+ "commit",
28
+ "snapshot",
29
+ "status-only",
30
+ ]);
26
31
 
27
32
  export function validatePreferences(preferences: GSDPreferences): {
28
33
  preferences: GSDPreferences;
@@ -161,12 +166,112 @@ export function validatePreferences(preferences: GSDPreferences): {
161
166
  }
162
167
  }
163
168
 
169
+ // ─── UOK Flags ──────────────────────────────────────────────────────
170
+ if (preferences.uok !== undefined) {
171
+ if (typeof preferences.uok === "object" && preferences.uok !== null) {
172
+ const raw = preferences.uok as Record<string, unknown>;
173
+ const valid: NonNullable<GSDPreferences["uok"]> = {};
174
+
175
+ if (raw.enabled !== undefined) {
176
+ if (typeof raw.enabled === "boolean") valid.enabled = raw.enabled;
177
+ else errors.push("uok.enabled must be a boolean");
178
+ }
179
+
180
+ const parseEnabledBlock = (
181
+ key: "legacy_fallback" | "gates" | "model_policy" | "execution_graph" | "audit_unified" | "plan_v2",
182
+ ): void => {
183
+ const value = raw[key];
184
+ if (value === undefined) return;
185
+ if (typeof value !== "object" || value === null) {
186
+ errors.push(`uok.${key} must be an object`);
187
+ return;
188
+ }
189
+ const block = value as Record<string, unknown>;
190
+ const parsed: { enabled?: boolean } = {};
191
+ if (block.enabled !== undefined) {
192
+ if (typeof block.enabled === "boolean") parsed.enabled = block.enabled;
193
+ else errors.push(`uok.${key}.enabled must be a boolean`);
194
+ }
195
+ const unknown = Object.keys(block).filter((k) => k !== "enabled");
196
+ for (const unk of unknown) {
197
+ warnings.push(`unknown uok.${key} key "${unk}" — ignored`);
198
+ }
199
+ if (Object.keys(parsed).length > 0) {
200
+ valid[key] = parsed;
201
+ }
202
+ };
203
+
204
+ parseEnabledBlock("legacy_fallback");
205
+ parseEnabledBlock("gates");
206
+ parseEnabledBlock("model_policy");
207
+ parseEnabledBlock("execution_graph");
208
+ parseEnabledBlock("audit_unified");
209
+ parseEnabledBlock("plan_v2");
210
+
211
+ if (raw.gitops !== undefined) {
212
+ if (typeof raw.gitops !== "object" || raw.gitops === null) {
213
+ errors.push("uok.gitops must be an object");
214
+ } else {
215
+ const gitops = raw.gitops as Record<string, unknown>;
216
+ const parsed: NonNullable<NonNullable<GSDPreferences["uok"]>["gitops"]> = {};
217
+ if (gitops.enabled !== undefined) {
218
+ if (typeof gitops.enabled === "boolean") parsed.enabled = gitops.enabled;
219
+ else errors.push("uok.gitops.enabled must be a boolean");
220
+ }
221
+ if (gitops.turn_action !== undefined) {
222
+ if (
223
+ typeof gitops.turn_action === "string" &&
224
+ VALID_UOK_TURN_ACTIONS.has(gitops.turn_action as "commit" | "snapshot" | "status-only")
225
+ ) {
226
+ parsed.turn_action = gitops.turn_action as "commit" | "snapshot" | "status-only";
227
+ } else {
228
+ errors.push("uok.gitops.turn_action must be one of: commit, snapshot, status-only");
229
+ }
230
+ }
231
+ if (gitops.turn_push !== undefined) {
232
+ if (typeof gitops.turn_push === "boolean") parsed.turn_push = gitops.turn_push;
233
+ else errors.push("uok.gitops.turn_push must be a boolean");
234
+ }
235
+ const unknown = Object.keys(gitops).filter((k) => !["enabled", "turn_action", "turn_push"].includes(k));
236
+ for (const unk of unknown) {
237
+ warnings.push(`unknown uok.gitops key "${unk}" — ignored`);
238
+ }
239
+ if (Object.keys(parsed).length > 0) {
240
+ valid.gitops = parsed;
241
+ }
242
+ }
243
+ }
244
+
245
+ const knownUokKeys = new Set([
246
+ "enabled",
247
+ "legacy_fallback",
248
+ "gates",
249
+ "model_policy",
250
+ "execution_graph",
251
+ "gitops",
252
+ "audit_unified",
253
+ "plan_v2",
254
+ ]);
255
+ for (const key of Object.keys(raw)) {
256
+ if (!knownUokKeys.has(key)) {
257
+ warnings.push(`unknown uok key "${key}" — ignored`);
258
+ }
259
+ }
260
+
261
+ if (Object.keys(valid).length > 0) {
262
+ validated.uok = valid;
263
+ }
264
+ } else {
265
+ errors.push("uok must be an object");
266
+ }
267
+ }
268
+
164
269
  // ─── Token Profile ─────────────────────────────────────────────────
165
270
  if (preferences.token_profile !== undefined) {
166
271
  if (typeof preferences.token_profile === "string" && VALID_TOKEN_PROFILES.has(preferences.token_profile as TokenProfile)) {
167
272
  validated.token_profile = preferences.token_profile as TokenProfile;
168
273
  } else {
169
- errors.push(`token_profile must be one of: budget, balanced, quality`);
274
+ errors.push(`token_profile must be one of: budget, balanced, quality, burn-max`);
170
275
  }
171
276
  }
172
277
 
@@ -1002,5 +1107,15 @@ export function validatePreferences(preferences: GSDPreferences): {
1002
1107
  }
1003
1108
  }
1004
1109
 
1110
+ // ─── Language ────────────────────────────────────────────────────────
1111
+ if (preferences.language !== undefined) {
1112
+ const trimmed = typeof preferences.language === "string" ? preferences.language.trim() : undefined;
1113
+ if (trimmed && trimmed.length <= 50 && !/[\r\n]/.test(trimmed)) {
1114
+ validated.language = trimmed;
1115
+ } else {
1116
+ errors.push(`language must be a non-empty string up to 50 characters with no newlines (e.g. "Chinese", "de", "日本語")`);
1117
+ }
1118
+ }
1119
+
1005
1120
  return { preferences: validated, errors, warnings };
1006
1121
  }
@@ -50,6 +50,8 @@ export type {
50
50
  AutoSupervisorConfig,
51
51
  RemoteQuestionsConfig,
52
52
  CmuxPreferences,
53
+ UokTurnActionMode,
54
+ UokPreferences,
53
55
  CodebaseMapPreferences,
54
56
  GSDPreferences,
55
57
  LoadedGSDPreferences,
@@ -378,6 +380,32 @@ function mergePreferences(base: GSDPreferences, override: GSDPreferences): GSDPr
378
380
  dynamic_routing: (base.dynamic_routing || override.dynamic_routing)
379
381
  ? { ...(base.dynamic_routing ?? {}), ...(override.dynamic_routing ?? {}) } as DynamicRoutingConfig
380
382
  : undefined,
383
+ uok: (base.uok || override.uok)
384
+ ? {
385
+ enabled: override.uok?.enabled ?? base.uok?.enabled,
386
+ legacy_fallback: (base.uok?.legacy_fallback || override.uok?.legacy_fallback)
387
+ ? { ...(base.uok?.legacy_fallback ?? {}), ...(override.uok?.legacy_fallback ?? {}) }
388
+ : undefined,
389
+ gates: (base.uok?.gates || override.uok?.gates)
390
+ ? { ...(base.uok?.gates ?? {}), ...(override.uok?.gates ?? {}) }
391
+ : undefined,
392
+ model_policy: (base.uok?.model_policy || override.uok?.model_policy)
393
+ ? { ...(base.uok?.model_policy ?? {}), ...(override.uok?.model_policy ?? {}) }
394
+ : undefined,
395
+ execution_graph: (base.uok?.execution_graph || override.uok?.execution_graph)
396
+ ? { ...(base.uok?.execution_graph ?? {}), ...(override.uok?.execution_graph ?? {}) }
397
+ : undefined,
398
+ gitops: (base.uok?.gitops || override.uok?.gitops)
399
+ ? { ...(base.uok?.gitops ?? {}), ...(override.uok?.gitops ?? {}) }
400
+ : undefined,
401
+ audit_unified: (base.uok?.audit_unified || override.uok?.audit_unified)
402
+ ? { ...(base.uok?.audit_unified ?? {}), ...(override.uok?.audit_unified ?? {}) }
403
+ : undefined,
404
+ plan_v2: (base.uok?.plan_v2 || override.uok?.plan_v2)
405
+ ? { ...(base.uok?.plan_v2 ?? {}), ...(override.uok?.plan_v2 ?? {}) }
406
+ : undefined,
407
+ }
408
+ : undefined,
381
409
  token_profile: override.token_profile ?? base.token_profile,
382
410
  phases: (base.phases || override.phases)
383
411
  ? { ...(base.phases ?? {}), ...(override.phases ?? {}) }
@@ -419,6 +447,7 @@ function mergePreferences(base: GSDPreferences, override: GSDPreferences): GSDPr
419
447
  slice_parallel: (base.slice_parallel || override.slice_parallel)
420
448
  ? { ...(base.slice_parallel ?? {}), ...(override.slice_parallel ?? {}) }
421
449
  : undefined,
450
+ language: override.language ?? base.language,
422
451
  };
423
452
  }
424
453
 
@@ -534,6 +563,11 @@ export function renderPreferencesForSystemPrompt(preferences: GSDPreferences, re
534
563
  }
535
564
  }
536
565
 
566
+ if (preferences.language) {
567
+ const safeLang = preferences.language.replace(/[\r\n]/g, " ").slice(0, 50);
568
+ lines.push(`- Language: Always respond in ${safeLang}.`);
569
+ }
570
+
537
571
  return lines.join("\n");
538
572
  }
539
573
 
@@ -68,11 +68,11 @@ export function getFilePaths(): string[] {
68
68
  * Record a tool call at dispatch time (before execution).
69
69
  * Exit codes and output are filled in by recordToolResult after execution.
70
70
  */
71
- export function recordToolCall(toolName: string, input: Record<string, unknown>): void {
71
+ export function recordToolCall(toolCallId: string, toolName: string, input: Record<string, unknown>): void {
72
72
  if (toolName === "bash" || toolName === "Bash") {
73
73
  unitEvidence.push({
74
74
  kind: "bash",
75
- toolCallId: "",
75
+ toolCallId,
76
76
  command: String(input.command ?? ""),
77
77
  exitCode: -1,
78
78
  outputSnippet: "",
@@ -81,14 +81,14 @@ export function recordToolCall(toolName: string, input: Record<string, unknown>)
81
81
  } else if (toolName === "write" || toolName === "Write") {
82
82
  unitEvidence.push({
83
83
  kind: "write",
84
- toolCallId: "",
84
+ toolCallId,
85
85
  path: String(input.file_path ?? input.path ?? ""),
86
86
  timestamp: Date.now(),
87
87
  });
88
88
  } else if (toolName === "edit" || toolName === "Edit") {
89
89
  unitEvidence.push({
90
90
  kind: "edit",
91
- toolCallId: "",
91
+ toolCallId,
92
92
  path: String(input.file_path ?? input.path ?? ""),
93
93
  timestamp: Date.now(),
94
94
  });
@@ -96,8 +96,9 @@ export function recordToolCall(toolName: string, input: Record<string, unknown>)
96
96
  }
97
97
 
98
98
  /**
99
- * Record a tool execution result. Matches the most recent unresolved entry
100
- * of the same kind and fills in the toolCallId, exit code, and output.
99
+ * Record a tool execution result. Matches the entry by toolCallId (assigned
100
+ * at dispatch time) and fills in exit code + output. Prior versions matched
101
+ * by `kind + empty-string` which corrupted parallel tool calls.
101
102
  */
102
103
  export function recordToolResult(
103
104
  toolCallId: string,
@@ -105,36 +106,19 @@ export function recordToolResult(
105
106
  result: unknown,
106
107
  isError: boolean,
107
108
  ): void {
108
- const normalizedName = toolName.toLowerCase();
109
-
110
- if (normalizedName === "bash") {
111
- const entry = findLastUnresolved("bash") as BashEvidence | undefined;
112
- if (entry) {
113
- entry.toolCallId = toolCallId;
114
- const text = extractResultText(result);
115
- entry.outputSnippet = text.slice(0, 500);
116
- const exitMatch = text.match(/Command exited with code (\d+)/);
117
- entry.exitCode = exitMatch ? Number(exitMatch[1]) : (isError ? 1 : 0);
118
- }
119
- } else if (normalizedName === "write" || normalizedName === "edit") {
120
- const entry = findLastUnresolved(normalizedName as "write" | "edit");
121
- if (entry) {
122
- entry.toolCallId = toolCallId;
123
- }
109
+ const entry = unitEvidence.find(e => e.toolCallId === toolCallId);
110
+ if (!entry) return;
111
+
112
+ if (entry.kind === "bash") {
113
+ const text = extractResultText(result);
114
+ entry.outputSnippet = text.slice(0, 500);
115
+ const exitMatch = text.match(/Command exited with code (\d+)/);
116
+ entry.exitCode = exitMatch ? Number(exitMatch[1]) : (isError ? 1 : 0);
124
117
  }
125
118
  }
126
119
 
127
120
  // ─── Internals ──────────────────────────────────────────────────────────────
128
121
 
129
- function findLastUnresolved(kind: string): EvidenceEntry | undefined {
130
- for (let i = unitEvidence.length - 1; i >= 0; i--) {
131
- if (unitEvidence[i].kind === kind && unitEvidence[i].toolCallId === "") {
132
- return unitEvidence[i];
133
- }
134
- }
135
- return undefined;
136
- }
137
-
138
122
  function extractResultText(result: unknown): string {
139
123
  if (typeof result === "string") return result;
140
124
  if (result && typeof result === "object") {
@@ -52,6 +52,18 @@ export interface SessionLockStatus {
52
52
  recovered?: boolean;
53
53
  }
54
54
 
55
+ interface ProperLockfileApi {
56
+ lockSync(
57
+ path: string,
58
+ options?: {
59
+ realpath?: boolean;
60
+ stale?: number;
61
+ update?: number;
62
+ onCompromised?: () => void;
63
+ },
64
+ ): () => void;
65
+ }
66
+
55
67
  // ─── Module State ───────────────────────────────────────────────────────────
56
68
 
57
69
  /** Release function from proper-lockfile — calling it releases the OS lock. */
@@ -277,9 +289,9 @@ export function acquireSessionLock(basePath: string): SessionLockResult {
277
289
  unitStartedAt: new Date().toISOString(),
278
290
  };
279
291
 
280
- let lockfile: typeof import("proper-lockfile");
292
+ let lockfile: ProperLockfileApi;
281
293
  try {
282
- lockfile = _require("proper-lockfile") as typeof import("proper-lockfile");
294
+ lockfile = _require("proper-lockfile") as ProperLockfileApi;
283
295
  } catch {
284
296
  // proper-lockfile not available — fall back to PID-based check
285
297
  return acquireFallbackLock(basePath, lp, lockData);
@@ -32,6 +32,7 @@ import {
32
32
  } from "./session-status-io.js";
33
33
  import { hasFileConflict } from "./slice-parallel-conflict.js";
34
34
  import { getErrorMessage } from "./error-utils.js";
35
+ import { selectConflictFreeBatch } from "./uok/execution-graph.js";
35
36
 
36
37
  // ─── Types ─────────────────────────────────────────────────────────────────
37
38
 
@@ -61,6 +62,7 @@ export interface SliceOrchestratorState {
61
62
  export interface StartSliceParallelOpts {
62
63
  maxWorkers?: number;
63
64
  budgetCeiling?: number;
65
+ useExecutionGraph?: boolean;
64
66
  }
65
67
 
66
68
  // ─── Module State ──────────────────────────────────────────────────────────
@@ -118,7 +120,12 @@ export async function startSliceParallel(
118
120
  const errors: Array<{ sid: string; error: string }> = [];
119
121
 
120
122
  // Filter out conflicting slices (conservative: check all pairs)
121
- const safeSlices = filterConflictingSlices(basePath, milestoneId, eligibleSlices);
123
+ const safeSlices = filterConflictingSlices(
124
+ basePath,
125
+ milestoneId,
126
+ eligibleSlices,
127
+ opts.useExecutionGraph === true,
128
+ );
122
129
 
123
130
  // Limit to maxWorkers
124
131
  const toSpawn = safeSlices.slice(0, maxWorkers);
@@ -245,7 +252,19 @@ function filterConflictingSlices(
245
252
  basePath: string,
246
253
  milestoneId: string,
247
254
  slices: Array<{ id: string }>,
255
+ useExecutionGraph: boolean,
248
256
  ): Array<{ id: string }> {
257
+ if (useExecutionGraph) {
258
+ const selectedIds = selectConflictFreeBatch({
259
+ orderedIds: slices.map((slice) => slice.id),
260
+ maxParallel: slices.length,
261
+ hasConflict: (candidate, existing) =>
262
+ hasFileConflict(basePath, milestoneId, candidate, existing),
263
+ });
264
+ const selected = new Set(selectedIds);
265
+ return slices.filter((slice) => selected.has(slice.id));
266
+ }
267
+
249
268
  const safe: Array<{ id: string }> = [];
250
269
 
251
270
  for (const candidate of slices) {