oh-my-opencode 5.0.0-beta.30 → 5.0.0-beta.32

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 (278) hide show
  1. package/dist/cli/index.js +178 -37
  2. package/dist/cli-node/index.js +178 -37
  3. package/dist/config/schema/background-task.d.ts +1 -0
  4. package/dist/config/schema/oh-my-opencode-config.d.ts +1 -0
  5. package/dist/features/background-agent/constants.d.ts +0 -7
  6. package/dist/features/background-agent/manager.d.ts +2 -1
  7. package/dist/features/background-agent/parent-wake-dispatched-tracker.d.ts +0 -1
  8. package/dist/features/background-agent/parent-wake-notifier-types.d.ts +1 -1
  9. package/dist/features/background-agent/parent-wake-prompt-dispatch.d.ts +1 -1
  10. package/dist/features/background-agent/parent-wake-session-inspector.d.ts +1 -1
  11. package/dist/features/background-agent/subagent-spawn-limits.d.ts +8 -0
  12. package/dist/features/monitor/manager-internals.d.ts +1 -1
  13. package/dist/features/monitor/output-injector-types.d.ts +1 -1
  14. package/dist/features/task-toast-manager/manager.d.ts +0 -24
  15. package/dist/features/team-mode/tools/messaging-live-delivery-recipient.d.ts +1 -0
  16. package/dist/features/team-mode/tools/messaging-runtime.d.ts +1 -0
  17. package/dist/hooks/anthropic-context-window-limit-recovery/message-storage-directory.d.ts +0 -3
  18. package/dist/hooks/anthropic-context-window-limit-recovery/state.d.ts +1 -0
  19. package/dist/hooks/anthropic-context-window-limit-recovery/storage/empty-messages.d.ts +0 -1
  20. package/dist/hooks/anthropic-context-window-limit-recovery/tool-result-storage.d.ts +11 -0
  21. package/dist/hooks/claude-code-hooks/session-hook-state.d.ts +1 -0
  22. package/dist/hooks/claude-code-hooks/stop.d.ts +2 -0
  23. package/dist/hooks/claude-code-hooks/todo.d.ts +0 -1
  24. package/dist/hooks/claude-code-hooks/transcript.d.ts +2 -0
  25. package/dist/hooks/fsync-skip-warning/index.d.ts +4 -0
  26. package/dist/hooks/hashline-edit-diff-enhancer/hook.d.ts +1 -0
  27. package/dist/hooks/hashline-edit-diff-enhancer/pending-captures.d.ts +13 -0
  28. package/dist/hooks/keyword-detector/hook.d.ts +7 -0
  29. package/dist/hooks/keyword-detector/ultrawork/source-detector.d.ts +0 -1
  30. package/dist/hooks/model-fallback/hook.d.ts +1 -1
  31. package/dist/index.js +681 -273
  32. package/dist/oh-my-opencode.schema.json +5 -0
  33. package/dist/plugin-dispose.d.ts +3 -0
  34. package/dist/shared/agent-tool-restrictions.d.ts +0 -1
  35. package/dist/skills/ultimate-browsing/references/insane-search/README.md +9 -2
  36. package/dist/tools/delegate-task/sync-session-cleanup.d.ts +3 -0
  37. package/dist/tools/delegate-task/sync-session-poller.d.ts +1 -0
  38. package/dist/tools/delegate-task/types.d.ts +1 -0
  39. package/dist/tools/session-manager/directory-filter.d.ts +2 -0
  40. package/dist/tui.js +148 -9
  41. package/package.json +16 -15
  42. package/packages/git-bash-mcp/dist/cli.js +1 -0
  43. package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +47 -19
  44. package/packages/lsp-core/src/lsp/client-diagnostics-pull-timeout.test.ts +64 -0
  45. package/packages/lsp-core/src/lsp/client-wrapper.test.ts +97 -0
  46. package/packages/lsp-core/src/lsp/client-wrapper.ts +21 -6
  47. package/packages/lsp-core/src/lsp/client.ts +6 -3
  48. package/packages/lsp-core/src/lsp/constants.ts +5 -0
  49. package/packages/lsp-core/src/lsp/controlled-clock-test-support.ts +61 -0
  50. package/packages/lsp-core/src/lsp/errors.ts +15 -0
  51. package/packages/lsp-core/src/lsp/fixtures/workspace-edit-server.mjs +10 -3
  52. package/packages/lsp-core/src/lsp/manager-lifecycle.test.ts +262 -0
  53. package/packages/lsp-core/src/lsp/manager.ts +106 -13
  54. package/packages/lsp-core/src/lsp/timer-provider.ts +13 -0
  55. package/packages/lsp-core/src/lsp/transport-request-timeout.test.ts +73 -0
  56. package/packages/lsp-core/src/lsp/transport.ts +7 -2
  57. package/packages/lsp-core/src/lsp/workspace-document-state.test.ts +84 -1
  58. package/packages/lsp-core/src/lsp/workspace-document-state.ts +30 -11
  59. package/packages/lsp-core/src/lsp/workspace-markers.ts +18 -1
  60. package/packages/lsp-core/src/mcp.ts +3 -0
  61. package/packages/lsp-core/src/tools/parameters.test.ts +51 -0
  62. package/packages/lsp-daemon/dist/cli.js +155 -34
  63. package/packages/lsp-daemon/dist/client.js +155 -34
  64. package/packages/lsp-daemon/dist/index.js +155 -34
  65. package/packages/lsp-daemon/dist/proxy.js +3 -0
  66. package/packages/lsp-tools-mcp/dist/cli.js +155 -34
  67. package/packages/lsp-tools-mcp/dist/lsp/manager.js +134 -28
  68. package/packages/lsp-tools-mcp/dist/mcp.js +155 -34
  69. package/packages/lsp-tools-mcp/dist/tools.js +154 -34
  70. package/packages/lsp-tools-mcp/package.json +1 -1
  71. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  72. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  73. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  74. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +17 -2
  75. package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +17 -2
  76. package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
  77. package/packages/omo-codex/plugin/components/codegraph/src/mcp-unavailable.ts +12 -0
  78. package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable-idle.test.ts +47 -0
  79. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  80. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  81. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  82. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  83. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  84. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  85. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
  86. package/packages/omo-codex/plugin/components/lsp/dist/cli.js +152 -34
  87. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  88. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  89. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  90. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  91. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  92. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  93. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  94. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  95. package/packages/omo-codex/plugin/components/ultrawork/AGENTS.md +5 -4
  96. package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +489 -4
  97. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  98. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -2
  99. package/packages/omo-codex/plugin/components/ultrawork/scripts/sync-directive.mjs +30 -14
  100. package/packages/omo-codex/plugin/components/ultrawork/src/directive-content.ts +4 -0
  101. package/packages/omo-codex/plugin/components/ultrawork/src/directive.ts +5 -2
  102. package/packages/omo-codex/plugin/components/ultrawork/test/directive-source.test.ts +14 -8
  103. package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +12 -1
  104. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +2 -2
  105. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  106. package/packages/omo-codex/plugin/components/ulw-loop/AGENTS.md +5 -2
  107. package/packages/omo-codex/plugin/components/ulw-loop/README.md +1 -0
  108. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-continuation.js +9 -0
  109. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.d.ts +14 -0
  110. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.js +10 -1
  111. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-template.d.ts +8 -0
  112. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-template.js +113 -0
  113. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +9 -5
  114. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +2 -1
  115. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.d.ts +1 -1
  116. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.js +1 -0
  117. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.js +2 -0
  118. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +856 -347
  119. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.d.ts +2 -0
  120. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +27 -6
  121. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.d.ts +13 -0
  122. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.js +14 -0
  123. package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +17 -9
  124. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.js +17 -2
  125. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-missing-recovery.d.ts +13 -0
  126. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-missing-recovery.js +19 -0
  127. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.d.ts +2 -0
  128. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.js +53 -0
  129. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-artifacts.d.ts +9 -0
  130. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-artifacts.js +85 -0
  131. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.js +1 -1
  132. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +4 -2
  133. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +41 -102
  134. package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.js +4 -2
  135. package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.js +185 -14
  136. package/packages/omo-codex/plugin/components/ulw-loop/dist/status-next-actions.d.ts +6 -0
  137. package/packages/omo-codex/plugin/components/ulw-loop/dist/status-next-actions.js +33 -0
  138. package/packages/omo-codex/plugin/components/ulw-loop/dist/surface.d.ts +18 -0
  139. package/packages/omo-codex/plugin/components/ulw-loop/dist/surface.js +65 -0
  140. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
  141. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  142. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +17 -0
  143. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-continuation.ts +7 -0
  144. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-reconciliation.ts +25 -1
  145. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-template.ts +127 -0
  146. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +10 -12
  147. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +2 -1
  148. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-output.ts +1 -0
  149. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-subcommands.ts +2 -0
  150. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +34 -5
  151. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-snapshot.ts +23 -0
  152. package/packages/omo-codex/plugin/components/ulw-loop/src/domain-types.ts +19 -9
  153. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-io.ts +18 -3
  154. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-missing-recovery.ts +27 -0
  155. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-aggregate.ts +57 -0
  156. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-artifacts.ts +103 -0
  157. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-fields.ts +1 -1
  158. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +54 -123
  159. package/packages/omo-codex/plugin/components/ulw-loop/src/review-blockers.ts +4 -2
  160. package/packages/omo-codex/plugin/components/ulw-loop/src/spawn-guard.ts +187 -12
  161. package/packages/omo-codex/plugin/components/ulw-loop/src/status-next-actions.ts +36 -0
  162. package/packages/omo-codex/plugin/components/ulw-loop/src/surface.ts +95 -0
  163. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-final.test.ts +107 -1
  164. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-template.test.ts +92 -0
  165. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-status-next-actions.test.ts +183 -0
  166. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +35 -0
  167. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/quality-gate-builder.ts +7 -3
  168. package/packages/omo-codex/plugin/components/ulw-loop/test/guided-recovery.test.ts +105 -0
  169. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-aggregate.test.ts +101 -0
  170. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-roles.test.ts +46 -2
  171. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-senpi-surface.test.ts +131 -0
  172. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +5 -0
  173. package/packages/omo-codex/plugin/components/ulw-loop/test/spawn-guard.test.ts +318 -1
  174. package/packages/omo-codex/plugin/components/ulw-loop/test/surface.test.ts +74 -0
  175. package/packages/omo-codex/plugin/components/ulw-loop/test/ultrawork-directive.test.ts +9 -3
  176. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  177. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  178. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  179. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +1 -1
  180. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  181. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  182. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  183. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  184. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  185. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  186. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  187. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  188. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  189. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
  190. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  191. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  192. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  193. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  194. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-ulw-execute-continuation.json +1 -1
  195. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  196. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  197. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  198. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  199. package/packages/omo-codex/plugin/package-lock.json +13 -13
  200. package/packages/omo-codex/plugin/package.json +1 -1
  201. package/packages/omo-codex/plugin/scripts/sync-skills.mjs +31 -2
  202. package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/README.md +9 -2
  203. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +17 -0
  204. package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +11 -1
  205. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +13 -0
  206. package/packages/omo-codex/plugin/test/ultrawork-skill-pointer.test.mjs +5 -2
  207. package/packages/omo-codex/scripts/install-dist/install-local.mjs +2 -2
  208. package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/README.md +9 -2
  209. package/dist/features/builtin-skills/index.d.ts +0 -1
  210. package/dist/features/builtin-skills/skill-file-loader.d.ts +0 -1
  211. package/dist/features/builtin-skills/skills/agent-browser-skill.d.ts +0 -1
  212. package/dist/features/builtin-skills/skills/agent-browser-template.d.ts +0 -1
  213. package/dist/features/builtin-skills/skills/debugging.d.ts +0 -1
  214. package/dist/features/builtin-skills/skills/dev-browser.d.ts +0 -1
  215. package/dist/features/builtin-skills/skills/frontend.d.ts +0 -1
  216. package/dist/features/builtin-skills/skills/git-master-sections/commit-atomic-planning.d.ts +0 -1
  217. package/dist/features/builtin-skills/skills/git-master-sections/commit-context-analysis.d.ts +0 -1
  218. package/dist/features/builtin-skills/skills/git-master-sections/commit-execution-verification.d.ts +0 -1
  219. package/dist/features/builtin-skills/skills/git-master-sections/commit-workflow.d.ts +0 -1
  220. package/dist/features/builtin-skills/skills/git-master-sections/history-search-workflow.d.ts +0 -1
  221. package/dist/features/builtin-skills/skills/git-master-sections/overview.d.ts +0 -1
  222. package/dist/features/builtin-skills/skills/git-master-sections/quick-reference.d.ts +0 -1
  223. package/dist/features/builtin-skills/skills/git-master-sections/rebase-workflow.d.ts +0 -1
  224. package/dist/features/builtin-skills/skills/git-master-skill-metadata.d.ts +0 -1
  225. package/dist/features/builtin-skills/skills/git-master.d.ts +0 -1
  226. package/dist/features/builtin-skills/skills/index.d.ts +0 -1
  227. package/dist/features/builtin-skills/skills/init-deep.d.ts +0 -1
  228. package/dist/features/builtin-skills/skills/playwright-cli.d.ts +0 -1
  229. package/dist/features/builtin-skills/skills/playwright-mcp-skill.d.ts +0 -1
  230. package/dist/features/builtin-skills/skills/playwright.d.ts +0 -1
  231. package/dist/features/builtin-skills/skills/remove-ai-slops.d.ts +0 -1
  232. package/dist/features/builtin-skills/skills/review-work.d.ts +0 -1
  233. package/dist/features/builtin-skills/skills/security-research.d.ts +0 -1
  234. package/dist/features/builtin-skills/skills/security-review.d.ts +0 -1
  235. package/dist/features/builtin-skills/skills/team-mode.d.ts +0 -1
  236. package/dist/features/builtin-skills/skills/visual-qa.d.ts +0 -1
  237. package/dist/features/builtin-skills/skills.d.ts +0 -1
  238. package/dist/features/builtin-skills/types.d.ts +0 -1
  239. package/dist/features/claude-code-plugin-loader/agent-loader.d.ts +0 -1
  240. package/dist/features/claude-code-plugin-loader/command-loader.d.ts +0 -1
  241. package/dist/features/claude-code-plugin-loader/discovery-core.d.ts +0 -1
  242. package/dist/features/claude-code-plugin-loader/discovery-paths.d.ts +0 -1
  243. package/dist/features/claude-code-plugin-loader/discovery.d.ts +0 -1
  244. package/dist/features/claude-code-plugin-loader/hook-loader.d.ts +0 -1
  245. package/dist/features/claude-code-plugin-loader/index.d.ts +0 -1
  246. package/dist/features/claude-code-plugin-loader/install-path-resolver.d.ts +0 -1
  247. package/dist/features/claude-code-plugin-loader/installed-plugin-database.d.ts +0 -1
  248. package/dist/features/claude-code-plugin-loader/loaded-plugin.d.ts +0 -1
  249. package/dist/features/claude-code-plugin-loader/loader.d.ts +0 -1
  250. package/dist/features/claude-code-plugin-loader/mcp-server-loader.d.ts +0 -1
  251. package/dist/features/claude-code-plugin-loader/plugin-key.d.ts +0 -1
  252. package/dist/features/claude-code-plugin-loader/plugin-manifest.d.ts +0 -1
  253. package/dist/features/claude-code-plugin-loader/plugin-path-resolver.d.ts +0 -1
  254. package/dist/features/claude-code-plugin-loader/plugin-settings.d.ts +0 -1
  255. package/dist/features/claude-code-plugin-loader/scope-filter.d.ts +0 -1
  256. package/dist/features/claude-code-plugin-loader/skill-loader.d.ts +0 -1
  257. package/dist/features/claude-code-plugin-loader/types.d.ts +0 -1
  258. package/dist/hooks/ralph-loop/completion-promise-detector-test-input.d.ts +0 -11
  259. package/dist/hooks/ralph-loop/loop-session-recovery.d.ts +0 -7
  260. package/dist/shared/prompt-async-gate/message-inspection-error.d.ts +0 -1
  261. package/dist/shared/prompt-async-gate/pending-tool-turn.d.ts +0 -1
  262. package/dist/shared/prompt-async-gate/prompt-message-state.d.ts +0 -1
  263. package/dist/shared/prompt-async-gate/queue.d.ts +0 -1
  264. package/dist/shared/prompt-async-gate/recent-dispatches.d.ts +0 -1
  265. package/dist/shared/prompt-async-gate/reservations.d.ts +0 -1
  266. package/dist/shared/prompt-async-gate/semantic-dedupe.d.ts +0 -1
  267. package/dist/shared/prompt-async-gate/session-idle-dispatch.d.ts +0 -1
  268. package/dist/shared/prompt-async-gate/timing.d.ts +0 -1
  269. package/dist/shared/prompt-async-gate/types.d.ts +0 -1
  270. package/dist/tools/call-omo-agent/message-storage-directory.d.ts +0 -1
  271. package/dist/tools/delegate-task/model-string-parser.d.ts +0 -1
  272. package/packages/lsp-tools-mcp/dist/lsp/cleanup-errors.d.ts +0 -1
  273. package/packages/lsp-tools-mcp/dist/lsp/constants.d.ts +0 -1
  274. package/packages/lsp-tools-mcp/dist/lsp/language-mappings.d.ts +0 -1
  275. package/packages/lsp-tools-mcp/dist/lsp/process-signal-cleanup.d.ts +0 -1
  276. package/packages/lsp-tools-mcp/dist/missing-dependency-result.d.ts +0 -1
  277. package/packages/omo-codex/plugin/components/ultrawork/directive.md +0 -483
  278. package/packages/omo-codex/plugin/components/ultrawork/skills/ultrawork/SKILL.md +0 -490
@@ -3,15 +3,11 @@ import { existsSync, statSync } from "node:fs";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { resolve } from "node:path";
5
5
  import {
6
- buildTaskScopedAggregateReconciliationHint,
7
6
  canReconcileActiveFinalTaskScopedAggregateSnapshot,
8
7
  canReconcileCompletedTaskScopedAggregateSnapshot,
8
+ codexSnapshotMismatchError,
9
9
  } from "./checkpoint-reconciliation.js";
10
- import {
11
- formatCodexGoalReconciliation,
12
- readCodexGoalSnapshotInput,
13
- reconcileCodexGoalSnapshot,
14
- } from "./codex-goal-snapshot.js";
10
+ import { readCodexGoalSnapshotInput, reconcileCodexGoalSnapshot } from "./codex-goal-snapshot.js";
15
11
  import { requireAllCriteriaPass, requireAllPlanCriteriaPass, requireEssentialCriteriaPass } from "./evidence.js";
16
12
  import {
17
13
  codexGoalMode,
@@ -28,6 +24,7 @@ import {
28
24
  sameBlockerOccurrences,
29
25
  validateQualityGate,
30
26
  } from "./quality-gate.js";
27
+ import { resolveToolkitSurface } from "./surface.js";
31
28
  import type {
32
29
  UlwLoopAggregateCompletion,
33
30
  UlwLoopItem,
@@ -139,13 +136,16 @@ function buildLedger(
139
136
  codexGoal: unknown,
140
137
  aggregateCompletion: UlwLoopAggregateCompletion | undefined,
141
138
  ): UlwLoopLedgerEntry {
142
- const watch = qualityGate?.codeReview.codeQualityStatus === "WATCH";
139
+ const watch = qualityGate?.surface === "lazycodex" && qualityGate.codeReview.codeQualityStatus === "WATCH";
143
140
  const entry: UlwLoopLedgerEntry = {
144
141
  at: now,
145
142
  kind: ledgerKind(args.status, goal, aggregateCompletion),
146
143
  goalId: goal.id,
147
144
  status: goal.status,
148
- evidence: watch ? `${args.evidence} | codeQuality=WATCH: ${qualityGate.codeReview.evidence}` : args.evidence,
145
+ evidence:
146
+ watch && qualityGate.surface === "lazycodex"
147
+ ? `${args.evidence} | codeQuality=WATCH: ${qualityGate.codeReview.evidence}`
148
+ : args.evidence,
149
149
  };
150
150
  if (codexGoal !== undefined) entry.codexGoal = codexGoal;
151
151
  if (qualityGate !== undefined) entry.qualityGate = qualityGate;
@@ -217,10 +217,7 @@ export async function checkpointUlwLoop(
217
217
  ));
218
218
  const taskScoped = completedTaskScoped || activeFinalTaskScoped;
219
219
  if (!taskScoped)
220
- throw new UlwLoopError(
221
- `${formatCodexGoalReconciliation(reconciliation)}${aggregate && snapshot?.status === "complete" && objective !== undefined ? buildTaskScopedAggregateReconciliationHint(goal, final) : ""}`,
222
- "ulw_loop_codex_snapshot_mismatch",
223
- );
220
+ throw codexSnapshotMismatchError({ reconciliation, snapshot, expectedObjective: expectedCodexObjective(plan, goal), taskScopedHint: { goal, aggregate, final } });
224
221
  }
225
222
  if (closesBatch) requireBatchFinalReady(plan, goal);
226
223
  if (closesBatch && args.qualityGateJson === undefined)
@@ -230,6 +227,7 @@ export async function checkpointUlwLoop(
230
227
  qualityGate = validateQualityGate(await readJsonInput(args.qualityGateJson, repoRoot), {
231
228
  repoRoot,
232
229
  fs: QUALITY_GATE_FS,
230
+ reviewerSurface: resolveToolkitSurface(),
233
231
  ...(plan.evidenceLayoutVersion === 2
234
232
  ? { currentAttemptDir: ulwLoopAttemptEvidenceDir(goal.id, goal.attempt, scope) }
235
233
  : {}),
@@ -12,6 +12,7 @@ import {
12
12
  steer,
13
13
  } from "./cli-subcommands.js";
14
14
  import { resolveUlwLoopSessionIdFromEnv, type UlwLoopScope } from "./paths.js";
15
+ import { sessionIdRequiredMessage } from "./plan-missing-recovery.js";
15
16
  import { UlwLoopError } from "./types.js";
16
17
 
17
18
  export const ULW_LOOP_SUBCOMMANDS = [
@@ -108,7 +109,7 @@ function commandScope(argv: readonly string[]): UlwLoopScope | undefined {
108
109
  if (sessionIdFlagPresent(argv)) {
109
110
  const sessionId = readValue(argv, SESSION_ID_FLAG)?.trim();
110
111
  if (!sessionId) {
111
- throw new UlwLoopError(`${SESSION_ID_FLAG} requires a non-empty value.`, "ULW_LOOP_SESSION_ID_REQUIRED", {
112
+ throw new UlwLoopError(sessionIdRequiredMessage(SESSION_ID_FLAG), "ULW_LOOP_SESSION_ID_REQUIRED", {
112
113
  details: { flag: SESSION_ID_FLAG },
113
114
  });
114
115
  }
@@ -10,6 +10,7 @@ export const ULW_LOOP_HELP = `Usage:
10
10
  omo-agent-toolkit ulw-loop complete-goals [--retry-failed] [--json]
11
11
  omo-agent-toolkit ulw-loop criteria --goal-id <id> [--json]
12
12
  omo-agent-toolkit ulw-loop record-evidence --goal-id <id> --criterion-id <id> --status pass|fail|blocked --evidence "..." [--notes "..."] [--json]
13
+ omo-agent-toolkit ulw-loop checkpoint --print-template [--goal-id <id>] [--json]
13
14
  omo-agent-toolkit ulw-loop checkpoint --goal-id <id> --status complete|failed|blocked --evidence "..." --codex-goal-json <...> [--quality-gate-json <...>] [--no-advance] [--json]
14
15
  omo-agent-toolkit ulw-loop steer --kind <kind> ... --evidence "..." --rationale "..." [--proposals-json <json-or-path>] [--json]
15
16
  omo-agent-toolkit ulw-loop add-goal --title "..." --objective "..." [--json]
@@ -17,6 +17,7 @@ import { type UlwLoopScope, ulwLoopAttemptEvidenceDir } from "./paths.js";
17
17
  import { addUlwLoopGoal, createUlwLoopPlan, startNextUlwLoop, summarizeUlwLoopPlan } from "./plan-crud.js";
18
18
  import { readUlwLoopPlan } from "./plan-io.js";
19
19
  import { recordFinalReviewBlockers } from "./review-blockers.js";
20
+ import { statusNextActions } from "./status-next-actions.js";
20
21
  import { steerUlwLoop } from "./steering.js";
21
22
  import { steerUlwLoopBatch } from "./steering-batch.js";
22
23
  import type { UlwLoopItem } from "./types.js";
@@ -73,6 +74,7 @@ export async function status(repoRoot: string, json: boolean, scope?: UlwLoopSco
73
74
  plan,
74
75
  summary: summarizeUlwLoopPlan(plan),
75
76
  ...(currentAttemptDir === undefined ? {} : { currentAttemptDir }),
77
+ nextActions: statusNextActions(plan),
76
78
  });
77
79
  } else printStatus(plan);
78
80
  return 0;
@@ -5,6 +5,7 @@ import {
5
5
  isEssentialCriterion,
6
6
  isFinalRunCompletionCandidate,
7
7
  } from "./goal-status.js";
8
+ import { resolveToolkitSurface, reviewerRolesFor, type UlwLoopToolkitSurface } from "./surface.js";
8
9
  import type { UlwLoopCodexGoalMode, UlwLoopItem, UlwLoopPlan, UlwLoopSuccessCriterion } from "./types.js";
9
10
 
10
11
  export interface CodexCreateGoalPayload {
@@ -20,11 +21,13 @@ export function buildCodexGoalInstruction(args: {
20
21
  readonly plan: UlwLoopPlan;
21
22
  readonly goal: UlwLoopItem;
22
23
  readonly isFinal?: boolean;
24
+ readonly surface?: UlwLoopToolkitSurface;
23
25
  }): UlwLoopGoalInstruction {
24
26
  const mode = codexGoalMode(args.plan);
25
27
  const createGoal = buildCreateGoalPayload(args.plan, args.goal);
26
28
  const isFinal = args.isFinal ?? isFinalRunCompletionCandidate(args.plan, args.goal);
27
- return { text: buildText(mode, args.plan, args.goal, createGoal, isFinal), json: createGoal };
29
+ const surface = args.surface ?? resolveToolkitSurface();
30
+ return { text: buildText(mode, args.plan, args.goal, createGoal, isFinal, surface), json: createGoal };
28
31
  }
29
32
 
30
33
  function buildCreateGoalPayload(plan: UlwLoopPlan, goal: UlwLoopItem): CodexCreateGoalPayload {
@@ -37,6 +40,7 @@ function buildText(
37
40
  goal: UlwLoopItem,
38
41
  createGoal: CodexCreateGoalPayload,
39
42
  isFinal: boolean,
43
+ surface: UlwLoopToolkitSurface,
40
44
  ): string {
41
45
  return joinLines([
42
46
  mode === "aggregate" ? "UlwLoop aggregate-goal handoff" : "UlwLoop active-goal handoff",
@@ -54,7 +58,7 @@ function buildText(
54
58
  "- Goals are unlimited. Do not add numeric limits.",
55
59
  ...modeConstraintLines(mode, isFinal),
56
60
  ...evidenceLayoutLines(plan),
57
- finalSection(plan, goal, isFinal, mode === "aggregate"),
61
+ finalSection(plan, goal, isFinal, mode === "aggregate", surface),
58
62
  ...checkpointLines(plan, mode),
59
63
  "",
60
64
  "create_goal payload:",
@@ -112,18 +116,26 @@ function evidenceLayoutLines(plan: UlwLoopPlan): string[] {
112
116
  ];
113
117
  }
114
118
 
115
- function finalSection(plan: UlwLoopPlan, goal: UlwLoopItem, isFinal: boolean, aggregate: boolean): string {
119
+ function finalSection(
120
+ plan: UlwLoopPlan,
121
+ goal: UlwLoopItem,
122
+ isFinal: boolean,
123
+ aggregate: boolean,
124
+ surface: UlwLoopToolkitSurface,
125
+ ): string {
126
+ const roles = reviewerRolesFor(surface);
116
127
  if (!isFinal)
117
128
  return "- This is not the final ulw-loop story; do not run the final reviewer/manual-QA/gate-review quality gate yet.";
118
129
  const option = sessionOption(plan);
130
+ if (surface === "omo-senpi") return senpiFinalSection(plan, goal, aggregate);
119
131
  const blockerCommand = `omo-agent-toolkit ulw-loop record-review-blockers${option} --goal-id ${goal.id} --title "Resolve final code-review blockers" --objective "<blocker-resolution objective>" --evidence "<review findings>" --codex-goal-json "<active get_goal JSON or path>"`;
120
132
  const checkpointCommand = `omo-agent-toolkit ulw-loop checkpoint${option} --goal-id ${goal.id} --status complete --evidence "<targeted verification/manualQa/gateReview evidence>" --codex-goal-json "<fresh complete get_goal JSON or path>" --quality-gate-json "<quality gate JSON or path>"`;
121
133
  return joinLines([
122
134
  "Final story — run mandatory quality gate before update_goal:",
123
135
  "- Run targeted verification for changed behavior.",
124
136
  "- Confirm every manualQa artifact path exists and has non-zero size.",
125
- "- First spawn lazycodex-code-reviewer and lazycodex-qa-executor in parallel (fork_context: false on the v1 surface; fork_turns: \"none\" on v2). Include the original brief, goal objectives, desired user-visible outcome, diff, and evidence; wait for BOTH to return and confirm their report artifacts exist on disk (code-review report + manualQa matrix).",
126
- "- Only then spawn lazycodex-gate-reviewer (same fork settings), passing those artifact paths.",
137
+ `- First spawn ${roles.codeReview} and ${roles.manualQa} in parallel (fork_context: false on the v1 surface; fork_turns: "none" on v2). Include the original brief, goal objectives, desired user-visible outcome, diff, and evidence; wait for BOTH to return and confirm their report artifacts exist on disk (code-review report + manualQa matrix).`,
138
+ `- Only then spawn ${roles.gateReview} (same fork settings), passing those artifact paths.`,
127
139
  "- Require clean codeReview, manualQa, gateReview, iteration, and criteriaCoverage. criteriaCoverage must summarize originalIntent, desiredOutcome, and userOutcomeReview; counts alone are not approval.",
128
140
  "- On a reviewer REJECT, fix only the cited blockers, rerun the affected verification/Manual-QA, and re-review the delta at most TWICE; if blockers remain, record them and surface to the user.",
129
141
  "- If codeQualityStatus is WATCH, include the WATCH notes verbatim in your final user-facing message.",
@@ -136,6 +148,23 @@ function finalSection(plan: UlwLoopPlan, goal: UlwLoopItem, isFinal: boolean, ag
136
148
  ]);
137
149
  }
138
150
 
151
+ function senpiFinalSection(plan: UlwLoopPlan, goal: UlwLoopItem, aggregate: boolean): string {
152
+ const option = sessionOption(plan);
153
+ const checkpointCommand = `omo-agent-toolkit ulw-loop checkpoint${option} --goal-id ${goal.id} --status complete --evidence "<manualQa/gateReview evidence>" --codex-goal-json "<fresh complete get_goal JSON or path>" --quality-gate-json "$(omo-agent-toolkit ulw-loop checkpoint${option} --print-template)"`;
154
+ return joinLines([
155
+ "Final story — run the single-reviewer quality gate before update_goal:",
156
+ "- Run manual QA yourself and write the non-empty artifact under currentAttemptDir; set manualQa.by to \"main-session\".",
157
+ '- Spawn exactly one gate reviewer with task(category: "deep").',
158
+ "- If that task fails with any model_unavailable failure, retry with category:unspecified-high, then category:unspecified-low.",
159
+ '- Set gateReview.by to the exact category:<name> literal used for the successful task.',
160
+ '- Build the gate JSON with omo-agent-toolkit ulw-loop checkpoint --print-template, then fill manualQa, gateReview, iteration, and criteriaCoverage.',
161
+ '- Require passed manualQa, approved gateReview, passed iteration, and complete criteriaCoverage before update_goal({status: "complete"}).',
162
+ aggregate
163
+ ? `- If the gate is clean, call update_goal({status: "complete"}), call get_goal again, then checkpoint the aggregate story: ${checkpointCommand}`
164
+ : `- If the gate is clean, call update_goal({status: "complete"}), call get_goal again, then checkpoint: ${checkpointCommand}`,
165
+ ]);
166
+ }
167
+
139
168
  function sessionOption(plan: UlwLoopPlan): string {
140
169
  const prefix = ".omo/ulw-loop/";
141
170
  const suffix = "/goals.json";
@@ -139,3 +139,26 @@ export function formatCodexGoalReconciliation(reconciliation: CodexGoalReconcili
139
139
  const parts = [...reconciliation.errors, ...reconciliation.warnings];
140
140
  return parts.join(" ");
141
141
  }
142
+
143
+ export interface CodexGoalMismatchRecovery {
144
+ readonly message: string;
145
+ readonly details: { readonly expectedObjective: string; readonly receivedObjective: string };
146
+ }
147
+
148
+ /**
149
+ * The reconciliation errors normalize whitespace for comparison, which makes the
150
+ * quoted objective unusable as a copy source. Recovery therefore carries the
151
+ * plan's `codexObjective` verbatim so the agent can paste it into `update_goal`.
152
+ */
153
+ export function codexGoalMismatchRecovery(
154
+ expectedObjective: string,
155
+ snapshot: CodexGoalSnapshot | null | undefined,
156
+ ): CodexGoalMismatchRecovery {
157
+ const receivedObjective = snapshot?.objective ?? "";
158
+ const message = [
159
+ "Recovery: the Codex goal objective must equal the plan's codexObjective exactly — copy the expected value below into update_goal and re-run get_goal.",
160
+ `expected codexObjective: ${expectedObjective}`,
161
+ `received objective: ${receivedObjective || "(none)"}`,
162
+ ].join("\n");
163
+ return { message, details: { expectedObjective, receivedObjective } };
164
+ }
@@ -107,15 +107,7 @@ export interface UlwLoopManualQaAdversarialCase {
107
107
  readonly artifactRefs: readonly string[];
108
108
  }
109
109
 
110
- export interface UlwLoopQualityGate {
111
- readonly codeReview: {
112
- readonly by: string;
113
- readonly recommendation: "APPROVE";
114
- readonly codeQualityStatus: "CLEAR" | "WATCH";
115
- readonly reportPath: string;
116
- readonly evidence: string;
117
- readonly blockers: readonly [];
118
- };
110
+ interface UlwLoopQualityGateCommon {
119
111
  readonly manualQa: {
120
112
  readonly by: string;
121
113
  readonly status: "passed";
@@ -147,6 +139,24 @@ export interface UlwLoopQualityGate {
147
139
  };
148
140
  }
149
141
 
142
+ export interface UlwLoopQualityGateLazycodex extends UlwLoopQualityGateCommon {
143
+ readonly surface: "lazycodex";
144
+ readonly codeReview: {
145
+ readonly by: string;
146
+ readonly recommendation: "APPROVE";
147
+ readonly codeQualityStatus: "CLEAR" | "WATCH";
148
+ readonly reportPath: string;
149
+ readonly evidence: string;
150
+ readonly blockers: readonly [];
151
+ };
152
+ }
153
+
154
+ export interface UlwLoopQualityGateSenpi extends UlwLoopQualityGateCommon {
155
+ readonly surface: "omo-senpi";
156
+ }
157
+
158
+ export type UlwLoopQualityGate = UlwLoopQualityGateLazycodex | UlwLoopQualityGateSenpi;
159
+
150
160
  export interface UlwLoopLedgerEntry {
151
161
  at: string;
152
162
  kind: UlwLoopLedgerEventKind;
@@ -1,4 +1,4 @@
1
- import { createReadStream } from "node:fs";
1
+ import { createReadStream, readdirSync } from "node:fs";
2
2
  import { appendFile, mkdir, readFile, rename, writeFile } from "node:fs/promises";
3
3
  import { createInterface } from "node:readline";
4
4
 
@@ -11,6 +11,7 @@ import {
11
11
  ulwLoopLedgerPath,
12
12
  ulwLoopRelativeDir,
13
13
  } from "./paths.js";
14
+ import { planMissingRecovery } from "./plan-missing-recovery.js";
14
15
  import type { UlwLoopLedgerEntry, UlwLoopPlan } from "./types.js";
15
16
  import { iso, ULW_LOOP_DIR, ULW_LOOP_GOALS, ULW_LOOP_LEDGER, UlwLoopError } from "./types.js";
16
17
 
@@ -73,10 +74,11 @@ export async function readUlwLoopPlan(repoRoot: string, scope?: UlwLoopScope): P
73
74
  raw = await readFile(path, "utf8");
74
75
  } catch (error) {
75
76
  if (!hasCode(error, "ENOENT")) throw error;
77
+ const recovery = planMissingRecovery(readSessionDirs(repoRoot));
76
78
  throw new UlwLoopError(
77
- `No ulw-loop plan found at ${repoRelative(path, repoRoot)}. Run \`omo-agent-toolkit ulw-loop create-goals ...\` first.`,
79
+ `No ulw-loop plan found at ${repoRelative(path, repoRoot)}.\n${recovery.message}`,
78
80
  "ULW_LOOP_PLAN_MISSING",
79
- { cause: error },
81
+ { cause: error, ...(recovery.details === undefined ? {} : { details: recovery.details }) },
80
82
  );
81
83
  }
82
84
  const parsed: UlwLoopPlan = JSON.parse(raw);
@@ -108,6 +110,19 @@ export async function readUlwLoopPlan(repoRoot: string, scope?: UlwLoopScope): P
108
110
  return parsed;
109
111
  }
110
112
 
113
+ // Session dirs are the only recovery hint that matters when a plan is missing: the
114
+ // caller is almost always scoped to a session whose sibling actually holds the plan.
115
+ function readSessionDirs(repoRoot: string): readonly string[] {
116
+ try {
117
+ return readdirSync(ulwLoopDir(repoRoot), { withFileTypes: true })
118
+ .filter((entry) => entry.isDirectory())
119
+ .map((entry) => entry.name)
120
+ .sort();
121
+ } catch {
122
+ return [];
123
+ }
124
+ }
125
+
111
126
  export async function writePlan(repoRoot: string, plan: UlwLoopPlan, scope?: UlwLoopScope): Promise<void> {
112
127
  await mkdir(ulwLoopDir(repoRoot, scope), { recursive: true });
113
128
  const path = ulwLoopGoalsPath(repoRoot, scope);
@@ -0,0 +1,27 @@
1
+ export const ULW_LOOP_CREATE_GOALS_COMMAND = 'omo-agent-toolkit ulw-loop create-goals --brief "<brief>" --json';
2
+
3
+ export interface PlanMissingRecovery {
4
+ readonly message: string;
5
+ readonly details?: { readonly existingSessionIds: readonly string[] };
6
+ }
7
+
8
+ /**
9
+ * A missing plan is either "never bootstrapped" or "bootstrapped under a different
10
+ * session id"; the recovery text has to answer both without the caller guessing.
11
+ */
12
+ export function planMissingRecovery(existingSessionIds: readonly string[]): PlanMissingRecovery {
13
+ const lines = [`Recovery: bootstrap the plan with \`${ULW_LOOP_CREATE_GOALS_COMMAND}\`.`];
14
+ if (existingSessionIds.length === 0) return { message: lines.join("\n") };
15
+ lines.push(
16
+ `Existing ulw-loop session ids under .omo/ulw-loop/: ${existingSessionIds.join(", ")}. Re-run with \`--session-id <id>\` to target one of them.`,
17
+ );
18
+ return { message: lines.join("\n"), details: { existingSessionIds } };
19
+ }
20
+
21
+ export function sessionIdRequiredMessage(flag: string): string {
22
+ return [
23
+ `${flag} requires a non-empty value.`,
24
+ "Recovery: subprocess, eval, and hook contexts do not inherit the ulw-loop session env (OMO_ULW_LOOP_SESSION_ID / CODEX_SESSION_ID / CODEX_THREAD_ID / PI_SESSION_ID),",
25
+ `so pass the scope explicitly: \`${flag} <id>\` (for example \`${flag} 01a05b8a-6763-7780-834f-319423b071ce\`).`,
26
+ ].join("\n");
27
+ }
@@ -0,0 +1,57 @@
1
+ import { resolve } from "node:path";
2
+ import type { ValidateQualityGateOptions } from "./quality-gate.js";
3
+ import { isRecord } from "./quality-gate-fields.js";
4
+ import { UlwLoopError } from "./types.js";
5
+
6
+ type Defect = { readonly field: string; readonly message: string };
7
+ const PLACEHOLDER = /^(?:<replace:[^>]+>|placeholder|todo|tbd|n\/a|stub)$/i;
8
+
9
+ function add(defects: Defect[], field: string, message: string): void {
10
+ defects.push({ field, message });
11
+ }
12
+ function text(value: unknown, field: string, defects: Defect[]): void {
13
+ if (typeof value !== "string" || value.trim() === "")
14
+ add(defects, field, `Final quality gate requires non-empty ${field}.`);
15
+ else if (PLACEHOLDER.test(value.trim())) add(defects, field, `Final quality gate rejects placeholder ${field}.`);
16
+ }
17
+ function section(value: unknown, field: string, defects: Defect[]): Record<string, unknown> {
18
+ if (!isRecord(value)) {
19
+ add(defects, field, `Final quality gate is missing ${field} evidence.`);
20
+ return {};
21
+ }
22
+ return value;
23
+ }
24
+
25
+ export function aggregateQualityGateDefects(input: unknown, opts: ValidateQualityGateOptions | undefined): void {
26
+ if (!isRecord(input)) return;
27
+ const defects: Defect[] = [];
28
+ const gate = input;
29
+ const manual = section(gate["manualQa"], "manualQa", defects);
30
+ const review = section(gate["gateReview"], "gateReview", defects);
31
+ text(manual["evidence"], "manualQa.evidence", defects);
32
+ text(review["evidence"], "gateReview.evidence", defects);
33
+ if (review["recommendation"] !== "APPROVE")
34
+ add(defects, "gateReview.recommendation", "gateReview.recommendation must be APPROVE.");
35
+ const artifacts = Array.isArray(manual["artifactRefs"]) ? manual["artifactRefs"] : [];
36
+ for (const [index, item] of artifacts.entries()) {
37
+ if (!isRecord(item)) continue;
38
+ const path = item["path"];
39
+ if (typeof path !== "string" || path.trim() === "") continue;
40
+ if (opts?.repoRoot !== undefined && opts.fs !== undefined && !opts.fs.existsSync(resolve(opts.repoRoot, path)))
41
+ add(
42
+ defects,
43
+ `manualQa.artifactRefs[${index}].path`,
44
+ `manualQa.artifactRefs[${index}].path must point to an existing artifact.`,
45
+ );
46
+ }
47
+ if (defects.length === 0) return;
48
+ const truncated = defects.length > 25;
49
+ const fields = defects.slice(0, 25).map(({ field, message }) => ({ field, message }));
50
+ const message = [
51
+ `Final quality gate has ${fields.length}${truncated ? "+" : ""} validation defects:`,
52
+ ...fields.map((item) => `- ${item.field}: ${item.message}`),
53
+ ].join("\n");
54
+ throw new UlwLoopError(message, "ULW_LOOP_QUALITY_GATE_INVALID", {
55
+ details: { field: fields[0]?.field, fields, ...(truncated ? { truncated: true } : {}) },
56
+ });
57
+ }
@@ -0,0 +1,103 @@
1
+ import { resolve } from "node:path";
2
+ import { isWithinAttemptDir } from "./paths.js";
3
+ import type { ValidateQualityGateOptions } from "./quality-gate.js";
4
+ import { invalid, section, stringArray, textField } from "./quality-gate-fields.js";
5
+ import type { UlwLoopManualQaArtifactKind, UlwLoopManualQaArtifactRef, UlwLoopManualQaSurface } from "./types.js";
6
+
7
+ export function surfaceField(value: unknown, field: string): UlwLoopManualQaSurface {
8
+ if (
9
+ value === "cli" ||
10
+ value === "http" ||
11
+ value === "tmux" ||
12
+ value === "browser" ||
13
+ value === "gui" ||
14
+ value === "data"
15
+ )
16
+ return value;
17
+ invalid(`${field} must be a supported manual QA surface.`, field);
18
+ }
19
+
20
+ export function kindField(value: unknown, field: string): UlwLoopManualQaArtifactKind {
21
+ if (
22
+ value === "cli-transcript" ||
23
+ value === "log" ||
24
+ value === "screenshot" ||
25
+ value === "image" ||
26
+ value === "http-dump" ||
27
+ value === "data-diff"
28
+ )
29
+ return value;
30
+ invalid(`${field} must be a supported artifact kind.`, field);
31
+ }
32
+
33
+ export function artifactCompatible(surface: UlwLoopManualQaSurface, kind: UlwLoopManualQaArtifactKind): boolean {
34
+ switch (surface) {
35
+ case "cli":
36
+ case "tmux":
37
+ return kind === "cli-transcript" || kind === "log";
38
+ case "http":
39
+ return kind === "http-dump";
40
+ case "browser":
41
+ case "gui":
42
+ return kind === "screenshot" || kind === "image";
43
+ case "data":
44
+ return kind === "data-diff";
45
+ default:
46
+ invalid("manualQa.surfaceEvidence has an unsupported surface.", "manualQa.surfaceEvidence.surface");
47
+ }
48
+ }
49
+
50
+ export function checkFile(path: string, field: string, opts?: ValidateQualityGateOptions): void {
51
+ if (opts?.repoRoot === undefined || opts.fs === undefined) return;
52
+ const absolute = resolve(opts.repoRoot, path);
53
+ if (!opts.fs.existsSync(absolute)) invalid(`${field} must point to an existing artifact.`, field);
54
+ if (opts.fs.statSync(absolute).size <= 0) invalid(`${field} must point to a non-empty artifact.`, field);
55
+ if (opts.currentAttemptDir !== undefined && opts.repoRoot !== undefined) {
56
+ const attemptRoot = resolve(opts.repoRoot, opts.currentAttemptDir);
57
+ if (!isWithinAttemptDir(absolute, attemptRoot))
58
+ invalid(
59
+ `${field} (${path}) must point to an artifact from the current attempt (${opts.currentAttemptDir}).`,
60
+ field,
61
+ );
62
+ }
63
+ }
64
+
65
+ export function artifactMap(refs: readonly UlwLoopManualQaArtifactRef[]): Map<string, UlwLoopManualQaArtifactRef> {
66
+ const byId = new Map<string, UlwLoopManualQaArtifactRef>();
67
+ for (const ref of refs) {
68
+ if (byId.has(ref.id)) invalid(`manualQa.artifactRefs contains duplicate ${ref.id}.`, "manualQa.artifactRefs");
69
+ byId.set(ref.id, ref);
70
+ }
71
+ return byId;
72
+ }
73
+
74
+ export function parseArtifactRefs(
75
+ value: unknown,
76
+ opts?: ValidateQualityGateOptions,
77
+ ): readonly UlwLoopManualQaArtifactRef[] {
78
+ if (!Array.isArray(value) || value.length === 0)
79
+ invalid("manualQa.artifactRefs must not be empty.", "manualQa.artifactRefs");
80
+ return value.map((item, index) => {
81
+ const ref = section(item, `manualQa.artifactRefs[${index}]`);
82
+ const path = textField(ref["path"], `manualQa.artifactRefs[${index}].path`);
83
+ checkFile(path, `manualQa.artifactRefs[${index}].path`, opts);
84
+ return {
85
+ id: textField(ref["id"], `manualQa.artifactRefs[${index}].id`),
86
+ kind: kindField(ref["kind"], `manualQa.artifactRefs[${index}].kind`),
87
+ description: textField(ref["description"], `manualQa.artifactRefs[${index}].description`),
88
+ path,
89
+ };
90
+ });
91
+ }
92
+
93
+ export function referencedArtifacts(
94
+ value: unknown,
95
+ field: string,
96
+ byId: ReadonlyMap<string, UlwLoopManualQaArtifactRef>,
97
+ ): readonly UlwLoopManualQaArtifactRef[] {
98
+ return stringArray(value, field).map((id) => {
99
+ const artifact = byId.get(id);
100
+ if (artifact === undefined) invalid(`${field} references unknown artifact ${id}.`, field);
101
+ return artifact;
102
+ });
103
+ }
@@ -1,6 +1,6 @@
1
1
  import { UlwLoopError } from "./types.js";
2
2
 
3
- const PLACEHOLDER_PATTERN = /^(?:placeholder|todo|tbd|n\/a|stub)$/i;
3
+ const PLACEHOLDER_PATTERN = /^(?:<replace:[^>]+>|placeholder|todo|tbd|n\/a|stub)$/i;
4
4
 
5
5
  export function invalid(message: string, field: string): never {
6
6
  throw new UlwLoopError(message, "ULW_LOOP_QUALITY_GATE_INVALID", { details: { field } });