@mrclrchtr/supi-review 5.0.0 → 6.0.0

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 (201) hide show
  1. package/README.md +15 -15
  2. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -2
  3. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
  4. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
  5. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
  6. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
  7. package/node_modules/@mrclrchtr/supi-agent-runtime/package.json +2 -2
  8. package/node_modules/@mrclrchtr/supi-code-intelligence/README.md +2 -2
  9. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  10. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +2 -2
  11. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
  12. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
  13. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
  14. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
  15. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/README.md +34 -3
  16. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  17. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +2 -2
  18. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
  19. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
  20. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
  21. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
  22. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  23. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/api.ts +12 -1
  24. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +67 -28
  25. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +63 -6
  26. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-evidence.ts +46 -5
  27. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +1 -0
  28. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-publication.ts +214 -0
  29. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +278 -79
  30. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +29 -8
  31. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +101 -19
  32. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +19 -1
  33. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +49 -3
  34. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +73 -15
  35. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +1 -1
  36. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +2 -2
  37. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +5 -5
  38. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +3 -0
  39. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +68 -0
  40. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +8 -0
  41. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +176 -24
  42. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +4 -0
  43. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sentinels.ts +46 -10
  44. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +4 -3
  45. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +65 -17
  46. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +143 -21
  47. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +2 -0
  48. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +43 -1
  49. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +31 -0
  50. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  51. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +2 -2
  52. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
  53. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
  54. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
  55. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
  56. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  57. package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +5 -5
  58. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/diagnostics.ts +58 -126
  59. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/file-scope.ts +184 -0
  60. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/recovery.ts +8 -1
  61. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/readiness.ts +4 -0
  62. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/ast-scan.ts +4 -1
  63. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/pattern-analysis.ts +10 -3
  64. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/pattern.ts +6 -1
  65. package/node_modules/@mrclrchtr/supi-code-intelligence/src/config.ts +35 -1
  66. package/node_modules/@mrclrchtr/supi-code-intelligence/src/extension.ts +57 -14
  67. package/node_modules/@mrclrchtr/supi-code-intelligence/src/overview/overview-data.ts +9 -2
  68. package/node_modules/@mrclrchtr/supi-code-intelligence/src/overview/overview.ts +49 -30
  69. package/node_modules/@mrclrchtr/supi-code-intelligence/src/overview/types.ts +2 -0
  70. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-types.ts +2 -2
  71. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-workflow.ts +3 -2
  72. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-refresh.ts +76 -49
  73. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-types.ts +7 -1
  74. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-workflow.ts +35 -18
  75. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/input/workflows.ts +2 -2
  76. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/inspect-workflow.ts +2 -1
  77. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation/collect.ts +2 -2
  78. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation-types.ts +2 -0
  79. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation-workflow.ts +8 -2
  80. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-workflow.ts +2 -1
  81. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/session.ts +25 -1
  82. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/maintenance.ts +105 -23
  83. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/recovery.ts +11 -5
  84. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/execute.ts +23 -0
  85. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/guidance.ts +8 -0
  86. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{find → code_find}/render.ts +1 -1
  87. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/find.ts → code_find/result.ts} +36 -11
  88. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/spec.ts +37 -0
  89. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/execute.ts +24 -0
  90. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/guidance.ts +6 -0
  91. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{graph → code_graph}/markdown.ts +1 -1
  92. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/graph.ts → code_graph/result.ts} +69 -4
  93. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/spec.ts +39 -0
  94. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{health → code_health}/execute.ts +2 -18
  95. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/guidance.ts +8 -0
  96. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{health → code_health}/markdown.ts +68 -18
  97. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/health.ts → code_health/result.ts} +29 -4
  98. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/spec.ts +41 -0
  99. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/execute.ts +20 -0
  100. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/guidance.ts +6 -0
  101. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{inspect → code_inspect}/markdown.ts +1 -1
  102. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/inspect.ts → code_inspect/result.ts} +32 -3
  103. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/spec.ts +25 -0
  104. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/execute.ts +25 -0
  105. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/guidance.ts +9 -0
  106. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{orientation → code_orientation}/markdown.ts +1 -1
  107. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/orientation.ts → code_orientation/result.ts} +67 -3
  108. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/spec.ts +25 -0
  109. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/execute.ts +17 -0
  110. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/guidance.ts +5 -0
  111. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{refactor-apply/execute.ts → code_refactor_apply/result.ts} +5 -11
  112. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/spec.ts +26 -0
  113. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/execute.ts +27 -0
  114. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/guidance.ts +8 -0
  115. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{refactor-plan/execute.ts → code_refactor_plan/result.ts} +9 -22
  116. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/spec.ts +25 -0
  117. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/execute.ts +19 -0
  118. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/guidance.ts +8 -0
  119. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{resolve → code_resolve}/markdown.ts +1 -1
  120. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/resolve.ts → code_resolve/result.ts} +37 -24
  121. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/spec.ts +25 -0
  122. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/guidance.ts +71 -52
  123. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/infra/truncate.ts +40 -0
  124. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{refactor-plan/markdown.ts → refactor-markdown.ts} +4 -7
  125. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/register.ts +9 -97
  126. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/refactor.ts +1 -4
  127. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/schemas.ts +26 -157
  128. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/specs.ts +40 -126
  129. package/node_modules/@mrclrchtr/supi-core/package.json +2 -2
  130. package/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
  131. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
  132. package/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
  133. package/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
  134. package/package.json +4 -4
  135. package/src/config.ts +2 -2
  136. package/src/review.ts +5 -5
  137. package/src/target/input.ts +90 -0
  138. package/src/target/resolve.ts +9 -39
  139. package/src/tool/output-page.ts +45 -8
  140. package/src/tool/page-render.ts +37 -0
  141. package/src/tool/page-schemas.ts +29 -0
  142. package/src/tool/review_audit/execute.ts +56 -0
  143. package/src/tool/review_audit/guidance.ts +10 -0
  144. package/src/tool/review_audit/register.ts +19 -0
  145. package/src/{tui/paged-output.ts → tool/review_audit/render.ts} +9 -72
  146. package/src/tool/review_audit/result.ts +144 -0
  147. package/src/tool/review_audit/spec.ts +44 -0
  148. package/src/tool/review_output/execute.ts +19 -0
  149. package/src/tool/review_output/guidance.ts +7 -0
  150. package/src/tool/review_output/register.ts +23 -0
  151. package/src/tool/review_output/render.ts +37 -0
  152. package/src/tool/review_output/result.ts +33 -0
  153. package/src/tool/review_output/spec.ts +29 -0
  154. package/src/tool/{child-failure-diagnostics.ts → review_run/child-failures.ts} +1 -1
  155. package/src/tool/{child-session-runner.ts → review_run/child-session.ts} +2 -2
  156. package/src/tool/{review-tools.ts → review_run/child-tools.ts} +43 -6
  157. package/src/tool/{review-debug-summary.ts → review_run/debug-summary.ts} +1 -1
  158. package/src/tool/{agent-review-tools.ts → review_run/execute.ts} +10 -59
  159. package/src/tool/{review-execution.ts → review_run/execution.ts} +6 -6
  160. package/src/tool/{review-format.ts → review_run/format.ts} +9 -11
  161. package/src/tool/review_run/guidance.ts +11 -0
  162. package/src/tool/{agent-review-schemas.ts → review_run/input-schema.ts} +61 -62
  163. package/src/tool/{planner-input.ts → review_run/planner-input.ts} +3 -3
  164. package/src/tool/{planner-runner.ts → review_run/planner.ts} +7 -7
  165. package/src/tool/{post-review-policy.ts → review_run/post-policy.ts} +4 -4
  166. package/src/tool/{review-recovery.ts → review_run/recovery.ts} +4 -4
  167. package/src/tool/review_run/register.ts +24 -0
  168. package/src/{tui/run.ts → tool/review_run/render.ts} +30 -23
  169. package/src/tool/review_run/result.ts +51 -0
  170. package/src/tool/{review-runner.ts → review_run/runner.ts} +7 -7
  171. package/src/tool/{schemas.ts → review_run/schemas.ts} +4 -4
  172. package/src/tool/review_run/spec.ts +11 -0
  173. package/src/{review-result.ts → tool/review_run/submission.ts} +7 -5
  174. package/src/tool/{review-system-prompt.ts → review_run/system-prompt.ts} +3 -3
  175. package/src/tool/{review-workflow.ts → review_run/workflow.ts} +19 -15
  176. package/src/tui/common.ts +2 -2
  177. package/src/tui/review-command.ts +4 -4
  178. package/src/tui/review-target-picker.ts +11 -11
  179. package/src/types.ts +15 -5
  180. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/find/execute.ts +0 -43
  181. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/graph/execute.ts +0 -82
  182. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/inspect/execute.ts +0 -40
  183. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/orientation/execute.ts +0 -80
  184. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/resolve/execute.ts +0 -53
  185. package/src/tool/review-audit-tool.ts +0 -181
  186. package/src/tool/review-output-tool.ts +0 -74
  187. package/src/tool/tool-specs.ts +0 -137
  188. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{find → code_find}/ast-kinds.ts +0 -0
  189. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{find → code_find}/markdown.ts +0 -0
  190. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{find → code_find}/modes.ts +0 -0
  191. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{find → code_find}/tui.ts +0 -0
  192. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{graph → code_graph}/tui.ts +0 -0
  193. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{health → code_health}/refresh-status.ts +0 -0
  194. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{health → code_health}/semantic-state.ts +0 -0
  195. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{health → code_health}/tui.ts +0 -0
  196. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{inspect → code_inspect}/tui.ts +0 -0
  197. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{orientation → code_orientation}/tui.ts +0 -0
  198. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{refactor-apply → code_refactor_apply}/tui.ts +0 -0
  199. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{refactor-plan → code_refactor_plan}/tui.ts +0 -0
  200. /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{resolve → code_resolve}/tui.ts +0 -0
  201. /package/src/tool/{child-resource-loader.ts → review_run/child-resources.ts} +0 -0
@@ -1,8 +1,9 @@
1
1
  import { Type } from "typebox";
2
2
  import { Value } from "typebox/value";
3
- import { REVIEW_LIMITS } from "../review-limits.ts";
4
- import { normalizeReviewScope } from "../review-scope.ts";
5
- import type { ReviewInput, ReviewScope, ReviewTargetSpec } from "../types.ts";
3
+ import { REVIEW_LIMITS } from "../../review-limits.ts";
4
+ import { normalizeReviewScope } from "../../review-scope.ts";
5
+ import { normalizeReviewTarget, reviewTargetEndpoints } from "../../target/input.ts";
6
+ import type { ReviewInput, ReviewScope, ReviewTargetSpec } from "../../types.ts";
6
7
  import { reviewInputSchema } from "./schemas.ts";
7
8
 
8
9
  function endpointSchema(role: "before" | "after") {
@@ -26,26 +27,43 @@ const scopePathsSchema = Type.Array(
26
27
  minItems: 1,
27
28
  maxItems: REVIEW_LIMITS.reviewScopePathsPerTarget,
28
29
  description:
29
- "Optional advisory path focus for this batch. It does not limit repository inspection, changed-path evidence, or findings.",
30
+ "Optional advisory path focus for this batch. This argument sits at the top level of the tool call, alongside target; do not place it inside target. It does not limit repository inspection, changed-path evidence, or findings.",
30
31
  },
31
32
  );
32
33
 
33
- const targetSchema = Type.Object(
34
+ const workingTreeTargetSchema = Type.Object(
35
+ {
36
+ from: Type.Optional(endpointSchema("before")),
37
+ },
38
+ {
39
+ additionalProperties: false,
40
+ description:
41
+ "Review the frozen current filesystem, including staged, unstaged, and non-ignored untracked files. Optional from sets the committed before state.",
42
+ },
43
+ );
44
+
45
+ const committedTargetSchema = Type.Object(
34
46
  {
35
47
  from: Type.Optional(endpointSchema("before")),
36
48
  to: Type.Optional(endpointSchema("after")),
37
- includeUncommittedChanges: Type.Optional(
38
- Type.Boolean({
39
- default: true,
40
- description:
41
- "Include the current filesystem and non-ignored untracked files. Defaults to true. When true, omit to.",
42
- }),
43
- ),
44
49
  },
45
50
  {
46
51
  additionalProperties: false,
47
52
  description:
48
- "Exact Review Target. Omit it, or use {}, for the current filesystem. Endpoints resolve once to full commits.",
53
+ "Review exact committed Git state. Optional from and to select the before and after commits; to defaults to HEAD.",
54
+ },
55
+ );
56
+
57
+ const targetSchema = Type.Object(
58
+ {
59
+ workingTree: Type.Optional(workingTreeTargetSchema),
60
+ committed: Type.Optional(committedTargetSchema),
61
+ },
62
+ {
63
+ maxProperties: 1,
64
+ additionalProperties: false,
65
+ description:
66
+ "Exact Review Target. Omit it, or use {}, for the current filesystem. Select workingTree or committed; endpoints resolve once to full commits.",
49
67
  },
50
68
  );
51
69
 
@@ -77,36 +95,37 @@ function isRecord(value: unknown): value is Record<string, unknown> {
77
95
  return typeof value === "object" && value !== null && !Array.isArray(value);
78
96
  }
79
97
 
80
- function blankEndpointError(target: unknown): Error | undefined {
81
- if (!isRecord(target)) return undefined;
82
- for (const name of ["from", "to"] as const) {
83
- const endpoint = target[name];
84
- if (typeof endpoint === "string" && !endpoint.trim()) {
85
- return new Error(`Review Target ${name} must not be blank.`);
86
- }
87
- }
88
- return undefined;
89
- }
90
-
91
98
  function oldTargetError(target: unknown): Error | undefined {
92
99
  if (!isRecord(target)) return undefined;
93
- const oldTarget = ["workingTree", "comparison", "commit", "currentState", "kind"].some(
94
- (key) => key in target,
95
- );
100
+ const oldTarget = [
101
+ "from",
102
+ "to",
103
+ "includeUncommittedChanges",
104
+ "comparison",
105
+ "commit",
106
+ "currentState",
107
+ "kind",
108
+ ].some((key) => key in target);
96
109
  return oldTarget
97
- ? new Error("Review Target must use only from, to, and includeUncommittedChanges.")
110
+ ? new Error("Review Target must select a workingTree or committed target object.")
98
111
  : undefined;
99
112
  }
100
113
 
101
- function endpointWhitespaceError(target: unknown): Error | undefined {
102
- if (!isRecord(target)) return undefined;
103
- for (const name of ["from", "to"] as const) {
104
- const endpoint = target[name];
105
- if (typeof endpoint === "string" && /\s/u.test(endpoint) && endpoint.trim()) {
106
- return new Error(`Review Target ${name} must not contain whitespace.`);
107
- }
114
+ function targetShapeError(target: unknown): Error | undefined {
115
+ if (target === undefined) return undefined;
116
+ try {
117
+ normalizeReviewTarget(target as ReviewTargetSpec);
118
+ return undefined;
119
+ } catch (error) {
120
+ return error instanceof Error ? error : new Error("Invalid Review Target.");
108
121
  }
109
- return undefined;
122
+ }
123
+
124
+ function pathsInsideTargetError(target: unknown): Error | undefined {
125
+ if (!isRecord(target)) return undefined;
126
+ return "paths" in target
127
+ ? new Error("Review paths must be a top-level argument, not part of the Review Target.")
128
+ : undefined;
110
129
  }
111
130
 
112
131
  function taskModeError(tasks: unknown): Error | undefined {
@@ -138,33 +157,16 @@ function invalidInputError(input: unknown): Error {
138
157
  return new Error("Review input must not use removed Finding Scope fields.");
139
158
  }
140
159
  return (
141
- blankEndpointError(input.target) ??
142
- endpointWhitespaceError(input.target) ??
143
160
  oldTargetError(input.target) ??
161
+ pathsInsideTargetError(input.target) ??
162
+ targetShapeError(input.target) ??
144
163
  taskModeError(input.tasks) ??
145
164
  new Error("Invalid review execution input.")
146
165
  );
147
166
  }
148
167
 
149
168
  function normalizeTarget(target: ReviewTargetSpec | undefined): ReviewTargetSpec {
150
- if (!target) return {};
151
- const from = target.from?.trim();
152
- const to = target.to?.trim();
153
- if (target.from !== undefined && !from) throw new Error("Review Target from must not be blank.");
154
- if (target.to !== undefined && !to) throw new Error("Review Target to must not be blank.");
155
- if (target.from !== undefined && /\s/u.test(target.from)) {
156
- throw new Error("Review Target from must not contain whitespace.");
157
- }
158
- if (target.to !== undefined && /\s/u.test(target.to)) {
159
- throw new Error("Review Target to must not contain whitespace.");
160
- }
161
- return {
162
- ...(from ? { from } : {}),
163
- ...(to ? { to } : {}),
164
- ...(target.includeUncommittedChanges !== undefined
165
- ? { includeUncommittedChanges: target.includeUncommittedChanges }
166
- : {}),
167
- };
169
+ return normalizeReviewTarget(target);
168
170
  }
169
171
 
170
172
  /** Validate and narrow a caller-defined Review request after provider-level JSON parsing. */
@@ -174,15 +176,12 @@ export function parseRunReviewToolInput(input: unknown): RunReviewToolInput {
174
176
  const { target, paths, ...review } = parsed;
175
177
  const normalizedTarget = normalizeTarget(target);
176
178
  const scope = normalizeReviewScope(paths ? { paths } : undefined);
177
- const includeUncommittedChanges = normalizedTarget.includeUncommittedChanges ?? true;
178
- if (includeUncommittedChanges && normalizedTarget.to !== undefined) {
179
- throw new Error("Review Target to is not valid when includeUncommittedChanges is true.");
180
- }
179
+ const endpoints = reviewTargetEndpoints(normalizedTarget);
181
180
  const change = review.tasks.some((task) => task.mode === "change");
182
- if (!change && normalizedTarget.from !== undefined) {
181
+ if (!change && endpoints.from !== undefined) {
183
182
  throw new Error("Review Targets for all-state tasks must not set from.");
184
183
  }
185
- if (!includeUncommittedChanges && change && normalizedTarget.from === undefined) {
184
+ if (endpoints.kind === "committed" && change && endpoints.from === undefined) {
186
185
  throw new Error("A committed change Review Target requires an explicit from endpoint.");
187
186
  }
188
187
  return { target: normalizedTarget, scope, review };
@@ -1,6 +1,6 @@
1
- import { formatReviewScopeForPlanner } from "../review-scope.ts";
2
- import { buildFileManifest } from "../target/file-manifest.ts";
3
- import type { ReviewScope, ReviewSnapshot } from "../types.ts";
1
+ import { formatReviewScopeForPlanner } from "../../review-scope.ts";
2
+ import { buildFileManifest } from "../../target/file-manifest.ts";
3
+ import type { ReviewScope, ReviewSnapshot } from "../../types.ts";
4
4
 
5
5
  /** Build bounded Planner input from exact target facts and an advisory Review Scope. */
6
6
  export function buildPlannerPrompt(
@@ -3,10 +3,10 @@ import { defineTool } from "@earendil-works/pi-coding-agent";
3
3
  import { createEarlyCancellationDiagnostics } from "@mrclrchtr/supi-agent-runtime/api";
4
4
  import { HEADLESS_INSPECTION_TOOL_NAMES } from "@mrclrchtr/supi-code-intelligence/headless";
5
5
  import { Value } from "typebox/value";
6
- import { normalizeReviewInput } from "../review-input.ts";
7
- import type { PlannerDraft, PlannerInvocation, PlannerRunResult } from "../types.ts";
8
- import { runIsolatedChild } from "./child-session-runner.ts";
9
- import { REVIEW_TOOL_SPECS } from "./tool-specs.ts";
6
+ import { normalizeReviewInput } from "../../review-input.ts";
7
+ import type { PlannerDraft, PlannerInvocation, PlannerRunResult } from "../../types.ts";
8
+ import { runIsolatedChild } from "./child-session.ts";
9
+ import { REVIEW_CHILD_TOOL_SPECS } from "./child-tools.ts";
10
10
 
11
11
  /** Protocol version for Planner prompt structures — keep in sync with review workflow. */
12
12
  export const PLANNER_PROMPT_VERSION = "6";
@@ -23,12 +23,12 @@ export function buildPlannerSystemPrompt(): string {
23
23
  "Set required mode to change when the task reviews the supplied non-empty change. Set required mode to state when the task reviews only the frozen after state.",
24
24
  "When target metadata says there is no canonical change, set required mode to state for every task.",
25
25
  "Do not define finding eligibility. The fixed Reviewer Protocol owns that policy.",
26
- `Reviewers receive read, bash, grep, ${HEADLESS_INSPECTION_TOOL_NAMES.join(", ")}, and ${REVIEW_TOOL_SPECS.submitReview.name}.`,
26
+ `Reviewers receive read, bash, grep, ${HEADLESS_INSPECTION_TOOL_NAMES.join(", ")}, and ${REVIEW_CHILD_TOOL_SPECS.submitReview.name}.`,
27
27
  "Reviewers may use Git and read-only Code Intelligence, but must not launch PI, invoke nested reviews, mutate source/Git history, or inspect live runtime/accounting state.",
28
28
  "Do not request tests, builds, linters, runtime experiments, or verification outside repository inspection.",
29
29
  "Require findings to be concrete and supported by inspected code.",
30
30
  "Do not claim to have inspected or verified code.",
31
- `Submit one valid draft with ${REVIEW_TOOL_SPECS.submitPlannerDraft.name}; if the tool rejects it, correct the draft and retry.`,
31
+ `Submit one valid draft with ${REVIEW_CHILD_TOOL_SPECS.submitPlannerDraft.name}; if the tool rejects it, correct the draft and retry.`,
32
32
  ].join("\n");
33
33
  }
34
34
 
@@ -38,7 +38,7 @@ export async function runPlanner(invocation: PlannerInvocation): Promise<Planner
38
38
  return { kind: "canceled", diagnostics: createEarlyCancellationDiagnostics() };
39
39
  }
40
40
  const holder: { value?: PlannerDraft } = {};
41
- const spec = REVIEW_TOOL_SPECS.submitPlannerDraft;
41
+ const spec = REVIEW_CHILD_TOOL_SPECS.submitPlannerDraft;
42
42
  const submit = defineTool({
43
43
  ...spec,
44
44
  execute: async (_id, args) => {
@@ -1,8 +1,8 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import { wrapExtensionContext } from "@mrclrchtr/supi-core/context";
3
- import type { PostReviewPolicy } from "../config.ts";
4
- import type { ReviewBatchDetails, ReviewOutputReference } from "../types.ts";
5
- import { REVIEW_TOOL_SPECS } from "./tool-specs.ts";
3
+ import type { PostReviewPolicy } from "../../config.ts";
4
+ import type { ReviewBatchDetails, ReviewOutputReference } from "../../types.ts";
5
+ import { REVIEW_OUTPUT_TOOL_NAME } from "../review_output/spec.ts";
6
6
 
7
7
  function findingCount(details: ReviewBatchDetails): number {
8
8
  return details.results.reduce(
@@ -55,7 +55,7 @@ export function buildPostReviewInstruction(
55
55
  ];
56
56
  if (output.nextOffset !== undefined) {
57
57
  lines.push(
58
- `Before responding, retrieve every remaining output page with ${REVIEW_TOOL_SPECS.output.name}, starting with ${JSON.stringify({ artifactId: output.artifactId, offset: output.nextOffset })}.`,
58
+ `Before responding, retrieve every remaining output page with ${REVIEW_OUTPUT_TOOL_NAME}, starting with ${JSON.stringify({ artifactId: output.artifactId, offset: output.nextOffset })}.`,
59
59
  );
60
60
  }
61
61
  if (details.results.some((result) => result.status !== "completed")) {
@@ -5,15 +5,15 @@ import type {
5
5
  AgentRunContinuationTurn,
6
6
  } from "@mrclrchtr/supi-agent-runtime/api";
7
7
  import { redactDebugData } from "@mrclrchtr/supi-core/debug";
8
- import type { ReviewAuditTraceCollector } from "../audit/review-audit.ts";
9
- import { REVIEW_LIMITS } from "../review-limits.ts";
8
+ import type { ReviewAuditTraceCollector } from "../../audit/review-audit.ts";
9
+ import { REVIEW_LIMITS } from "../../review-limits.ts";
10
10
  import type {
11
11
  ReviewModelSelection,
12
12
  ReviewSubmission,
13
13
  SubmissionRecovery,
14
14
  SubmissionRecoveryAttempt,
15
- } from "../types.ts";
16
- import type { ReviewRecoveryTerminalState } from "./review-tools.ts";
15
+ } from "../../types.ts";
16
+ import type { ReviewRecoveryTerminalState } from "./child-tools.ts";
17
17
 
18
18
  const RECOVERY_TOOLS = ["submit_review", "decline_review_recovery"] as const;
19
19
  const RECOVERY_PROMPT = [
@@ -0,0 +1,24 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import type { LocalReviewAuditStore } from "../../audit/local-review-audit-store.ts";
3
+ import type { ReviewArtifactStore } from "../../session/review-artifact-store.ts";
4
+ import { makeRunReviewExecute } from "./execute.ts";
5
+ import { promptGuidelines, promptSnippet, toolDescription } from "./guidance.ts";
6
+ import { renderRunCall, renderRunResult } from "./render.ts";
7
+ import { reviewRunSpec } from "./spec.ts";
8
+
9
+ /** Register caller-defined Review execution for agents. */
10
+ export function registerReviewRunTool(
11
+ pi: ExtensionAPI,
12
+ artifactStore: ReviewArtifactStore,
13
+ localAuditStore?: LocalReviewAuditStore,
14
+ ): void {
15
+ pi.registerTool({
16
+ ...reviewRunSpec,
17
+ description: toolDescription,
18
+ promptSnippet,
19
+ promptGuidelines: [...promptGuidelines],
20
+ renderCall: renderRunCall,
21
+ renderResult: renderRunResult,
22
+ execute: makeRunReviewExecute(artifactStore, localAuditStore),
23
+ });
24
+ }
@@ -1,19 +1,7 @@
1
- /** TUI renderer for supi_review_run. */
1
+ /** TUI renderer for review_run. */
2
2
 
3
3
  import type { Theme } from "@earendil-works/pi-coding-agent";
4
4
  import { Container, Spacer, Text } from "@earendil-works/pi-tui";
5
- import type {
6
- ReviewExecutionPartialTaskState,
7
- ReviewExecutionProgressDetails,
8
- } from "../tool/review-execution.ts";
9
- import { REVIEW_TOOL_SPECS } from "../tool/tool-specs.ts";
10
- import { formatReviewUsage } from "../tool/usage-format.ts";
11
- import type {
12
- ReviewBatchDetails,
13
- ReviewProgress,
14
- ReviewScope,
15
- ReviewTaskResult,
16
- } from "../types.ts";
17
5
  import {
18
6
  buildTaskSection,
19
7
  formatStatusLabel,
@@ -21,7 +9,19 @@ import {
21
9
  renderError,
22
10
  renderPartial,
23
11
  renderReviewToolCall,
24
- } from "./common.ts";
12
+ } from "../../tui/common.ts";
13
+ import type {
14
+ ReviewBatchDetails,
15
+ ReviewProgress,
16
+ ReviewScope,
17
+ ReviewTaskResult,
18
+ } from "../../types.ts";
19
+ import { formatReviewUsage } from "../usage-format.ts";
20
+ import type {
21
+ ReviewExecutionPartialTaskState,
22
+ ReviewExecutionProgressDetails,
23
+ } from "./execution.ts";
24
+ import { REVIEW_RUN_TOOL_NAME } from "./spec.ts";
25
25
 
26
26
  function formatTaskCollapsed(result: ReviewTaskResult, theme: Theme): string {
27
27
  const warnings = result.capabilityWarnings?.length ?? 0;
@@ -56,17 +56,24 @@ function quotedEndpoint(value: unknown): string | undefined {
56
56
 
57
57
  function formatRequestedTarget(target: unknown): string {
58
58
  if (!isRecord(target)) return "requested target: current filesystem";
59
- const from = quotedEndpoint(target.from);
60
- const to = quotedEndpoint(target.to);
61
- const includeUncommittedChanges = target.includeUncommittedChanges !== false;
62
- if (!from && !to && includeUncommittedChanges) return "requested target: current filesystem";
59
+ const workingTree = isRecord(target.workingTree) ? target.workingTree : undefined;
60
+ const committed = isRecord(target.committed) ? target.committed : undefined;
61
+ if (!workingTree && !committed) return "requested target: current filesystem";
62
+
63
+ if (workingTree) {
64
+ const from = quotedEndpoint(workingTree.from);
65
+ return from
66
+ ? `requested target: from ${from} · uncommitted changes included`
67
+ : "requested target: current filesystem";
68
+ }
63
69
 
70
+ const from = quotedEndpoint(committed?.from);
71
+ const to = quotedEndpoint(committed?.to);
64
72
  const endpoints = [
65
73
  ...(from ? [`from ${from}`] : []),
66
- ...(to ? [`to ${to}`] : []),
67
- ...(!to && !includeUncommittedChanges ? ['default to "HEAD"'] : []),
74
+ ...(to ? [`to ${to}`] : ['default to "HEAD"']),
68
75
  ];
69
- return `requested target: ${endpoints.join(" · ")} · ${includeUncommittedChanges ? "uncommitted changes included" : "uncommitted changes excluded"}`;
76
+ return `requested target: ${endpoints.join(" · ")} · uncommitted changes excluded`;
70
77
  }
71
78
 
72
79
  function formatTaskModes(tasks: unknown): string {
@@ -95,7 +102,7 @@ export function renderRunCall(args: unknown, theme: Theme): Text {
95
102
  formatTaskModes(params.tasks),
96
103
  formatScopeCount(scope),
97
104
  ].join(" · ");
98
- return renderReviewToolCall(REVIEW_TOOL_SPECS.run.name, "review", theme, detail);
105
+ return renderReviewToolCall(REVIEW_RUN_TOOL_NAME, "review", theme, detail);
99
106
  }
100
107
 
101
108
  type PartialReviewDetails = ReviewExecutionProgressDetails;
@@ -208,7 +215,7 @@ export function renderRunResult(
208
215
  }
209
216
  const details = result.details as ReviewBatchDetails | undefined;
210
217
  if (context.isError || !details) {
211
- return renderError(`${REVIEW_TOOL_SPECS.run.name} failed`, theme);
218
+ return renderError(`${REVIEW_RUN_TOOL_NAME} failed`, theme);
212
219
  }
213
220
  return options.expanded ? buildExpanded(details, theme) : buildCollapsed(details, theme);
214
221
  }
@@ -0,0 +1,51 @@
1
+ import type { AgentToolResult } from "@earendil-works/pi-coding-agent";
2
+ import type { PostReviewPolicy } from "../../config.ts";
3
+ import type { ReviewArtifactStore } from "../../session/review-artifact-store.ts";
4
+ import type { ReviewBatchDetails, ReviewOutputReference } from "../../types.ts";
5
+ import { createReviewOutput, MAX_PAGE_CHARACTERS, MAX_PAGE_LINES } from "../output-page.ts";
6
+ import { formatReviewBatch } from "./format.ts";
7
+ import { withPostReviewInstruction } from "./post-policy.ts";
8
+ import type { runReview } from "./workflow.ts";
9
+
10
+ /** Completed variant of the review_run workflow outcome. */
11
+ export type CompletedReviewOutcome = Extract<
12
+ Awaited<ReturnType<typeof runReview>>,
13
+ { kind: "completed" }
14
+ >;
15
+
16
+ export type ReviewRunResultDetails = ReviewBatchDetails & { output: ReviewOutputReference };
17
+
18
+ const POST_REVIEW_POLICY_CHARACTER_RESERVE = 4_000;
19
+ const POST_REVIEW_POLICY_LINE_RESERVE = 32;
20
+
21
+ /** Store the full batch report and assemble the model-facing review_run result. */
22
+ export function buildRunResult(
23
+ artifactStore: ReviewArtifactStore,
24
+ outcome: CompletedReviewOutcome,
25
+ postReviewPolicy: PostReviewPolicy,
26
+ ): AgentToolResult<ReviewRunResultDetails> {
27
+ const hasFindings = outcome.details.results.some(
28
+ (result) => result.status === "completed" && result.findings.length > 0,
29
+ );
30
+ const output = createReviewOutput(
31
+ artifactStore,
32
+ formatReviewBatch(outcome.details),
33
+ hasFindings
34
+ ? {
35
+ firstPageCharacters: MAX_PAGE_CHARACTERS - POST_REVIEW_POLICY_CHARACTER_RESERVE,
36
+ firstPageLines: MAX_PAGE_LINES - POST_REVIEW_POLICY_LINE_RESERVE,
37
+ }
38
+ : {},
39
+ );
40
+ const text = withPostReviewInstruction(
41
+ output.text,
42
+ postReviewPolicy,
43
+ outcome.details,
44
+ output.reference,
45
+ );
46
+ return {
47
+ content: [{ type: "text", text }],
48
+ details: { ...outcome.details, output: output.reference },
49
+ ...(outcome.usage ? { usage: outcome.usage } : {}),
50
+ };
51
+ }
@@ -4,19 +4,19 @@ import {
4
4
  createEarlyCancellationDiagnostics,
5
5
  } from "@mrclrchtr/supi-agent-runtime/api";
6
6
  import { HEADLESS_INSPECTION_TOOL_NAMES } from "@mrclrchtr/supi-code-intelligence/headless";
7
- import { ReviewAuditTraceCollector } from "../audit/review-audit.ts";
8
- import { summarizeReviewSnapshot } from "../git.ts";
7
+ import { ReviewAuditTraceCollector } from "../../audit/review-audit.ts";
8
+ import { summarizeReviewSnapshot } from "../../git.ts";
9
9
  import type {
10
10
  ReviewerCapabilityWarning,
11
11
  ReviewerExtensionSetStatus,
12
12
  ReviewerInvocation,
13
13
  ReviewerRunResult,
14
14
  ReviewSubmission,
15
- } from "../types.ts";
16
- import { runIsolatedChild } from "./child-session-runner.ts";
17
- import { ReviewRecoveryPolicy } from "./review-recovery.ts";
18
- import { buildReviewerSystemPrompt } from "./review-system-prompt.ts";
19
- import { createReviewRecoveryDeclineTool, createReviewSubmissionTool } from "./review-tools.ts";
15
+ } from "../../types.ts";
16
+ import { runIsolatedChild } from "./child-session.ts";
17
+ import { createReviewRecoveryDeclineTool, createReviewSubmissionTool } from "./child-tools.ts";
18
+ import { ReviewRecoveryPolicy } from "./recovery.ts";
19
+ import { buildReviewerSystemPrompt } from "./system-prompt.ts";
20
20
 
21
21
  function auditOutcome(result: ReviewerRunResult): {
22
22
  kind: string;
@@ -1,6 +1,6 @@
1
1
  import { StringEnum } from "@earendil-works/pi-ai";
2
2
  import { Type } from "typebox";
3
- import { REVIEW_LIMITS } from "../review-limits.ts";
3
+ import { REVIEW_LIMITS } from "../../review-limits.ts";
4
4
 
5
5
  /** TypeBox schema for one caller-defined review task (provider-visible). */
6
6
  export const reviewTaskSchema = Type.Object(
@@ -152,21 +152,21 @@ export const reviewSubmissionSchema = Type.Object(
152
152
  {
153
153
  status: StringEnum(["complete", "incomplete"] as const, {
154
154
  description:
155
- "complete when the supplied Review Criteria were sufficient; incomplete when unavailable source detail limited the audit.",
155
+ "complete when the supplied Review Criteria were sufficient (this includes a clean review); incomplete only when an identified Review Criteria source was actually unavailable.",
156
156
  }),
157
157
  reason: Type.Optional(
158
158
  Type.String({
159
159
  minLength: 1,
160
160
  maxLength: REVIEW_LIMITS.criteriaCoverageReasonCharacters,
161
161
  pattern: "\\S",
162
- description: "Required only when status is incomplete; names the unavailable detail.",
162
+ description: "Use only when status is incomplete; omit it when status is complete.",
163
163
  }),
164
164
  ),
165
165
  },
166
166
  {
167
167
  additionalProperties: false,
168
168
  description:
169
- "Required structured criteria coverage statement; incomplete coverage cannot support a definitive pass.",
169
+ "Required structured criteria coverage statement; a clean review with sufficient criteria must report complete, and incomplete coverage cannot support a definitive verdict on its own.",
170
170
  },
171
171
  ),
172
172
  },
@@ -0,0 +1,11 @@
1
+ import { runReviewSchema } from "./input-schema.ts";
2
+
3
+ export const REVIEW_RUN_TOOL_NAME = "review_run";
4
+ export const REVIEW_RUN_TOOL_LABEL = "Run Review";
5
+
6
+ /** Canonical provider-facing metadata for the review_run tool. */
7
+ export const reviewRunSpec = {
8
+ name: REVIEW_RUN_TOOL_NAME,
9
+ label: REVIEW_RUN_TOOL_LABEL,
10
+ parameters: runReviewSchema,
11
+ } as const;
@@ -1,5 +1,5 @@
1
- import { REVIEW_LIMITS } from "./review-limits.ts";
2
- import { normalizeRepositoryRelativePath, normalizeReviewPathArgument } from "./review-path.ts";
1
+ import { REVIEW_LIMITS } from "../../review-limits.ts";
2
+ import { normalizeRepositoryRelativePath, normalizeReviewPathArgument } from "../../review-path.ts";
3
3
  import type {
4
4
  CriteriaCoverage,
5
5
  FindingCounts,
@@ -7,7 +7,7 @@ import type {
7
7
  ReviewFinding,
8
8
  ReviewLocation,
9
9
  ReviewSubmission,
10
- } from "./types.ts";
10
+ } from "../../types.ts";
11
11
 
12
12
  type ReviewSubmissionInput = Omit<ReviewSubmission, "findings"> & {
13
13
  findings: Array<
@@ -49,7 +49,9 @@ function normalizeCriteriaCoverage(coverage: CriteriaCoverage): CriteriaCoverage
49
49
  if (!coverage) throw new Error("Review submissions must include criteria coverage.");
50
50
  const reason = ("reason" in coverage ? coverage.reason : undefined)?.trim();
51
51
  if (coverage.status === "complete") {
52
- if (reason) throw new Error("Complete criteria coverage must not include a reason.");
52
+ // Tolerate a stray reason: reviewer models may treat the reason field as
53
+ // required and include it even for complete coverage. The accepted
54
+ // submission is complete with no reason.
53
55
  return { status: "complete" };
54
56
  }
55
57
  if (!reason) throw new Error("Incomplete criteria coverage needs a criteria coverage reason.");
@@ -125,7 +127,7 @@ export function normalizeReviewSubmission(
125
127
  verdict:
126
128
  findingCounts.blocking > 0
127
129
  ? "issues"
128
- : criteriaCoverage?.status === "incomplete"
130
+ : criteriaCoverage?.status === "incomplete" && findingCounts.total > 0
129
131
  ? "incomplete"
130
132
  : findingCounts.total > 0
131
133
  ? "pass_with_findings"
@@ -1,4 +1,4 @@
1
- import { REVIEW_TOOL_SPECS } from "./tool-specs.ts";
1
+ import { REVIEW_CHILD_TOOL_SPECS } from "./child-tools.ts";
2
2
 
3
3
  /** Minimal non-overridable protocol shared by every caller-defined review task. */
4
4
  export function buildReviewerSystemPrompt(dependencyBootstrapConfigured = false): string {
@@ -15,7 +15,7 @@ export function buildReviewerSystemPrompt(dependencyBootstrapConfigured = false)
15
15
  "change permits findings attributable to the selected change, including regressions, omitted or partial required behavior, and acceptance-relevant scope creep. A pre-existing issue is permitted only in a changed file or a directly affected symbol. It stays advisory unless the selected change worsens or newly exposes it. Exclude unrelated pre-existing issues.",
16
16
  "state permits findings relevant to the Review Criteria anywhere in the frozen after state. A pre-existing finding may block acceptance when it is relevant to those criteria.",
17
17
  "Before alleging a documented-rule breach, check that rule's documented exceptions. Do not report candidates covered by an exception; a submitted breach finding must state why no documented exception applies.",
18
- "Always submit criteriaCoverage: complete when the supplied Review Criteria were sufficient, otherwise incomplete with the reason. Preserve any concrete findings when coverage is incomplete.",
18
+ "Always submit criteriaCoverage: complete when the supplied Review Criteria were sufficient, including for a clean review with no findings; omit the reason field for complete coverage. Submit incomplete only when an identified Review Criteria source was actually unavailable, and name that missing source as the reason. Never restate these instructions as a reason, and never mark a sufficient-review complete work as incomplete.",
19
19
  "Test verification means inspecting test source, coverage, and requirement mapping; runtime checks are delegated to the containing Agent.",
20
20
  "Report only concrete findings supported by inspected code.",
21
21
  "blocksAcceptance means the reviewed target should not be accepted as satisfying the Review Task without correcting that finding.",
@@ -23,6 +23,6 @@ export function buildReviewerSystemPrompt(dependencyBootstrapConfigured = false)
23
23
  "effort estimates correction size: small, medium, or large.",
24
24
  "confidence is a value from 0 to 1; the Review Engine applies no confidence threshold.",
25
25
  "Preserve your intended finding order.",
26
- `Submit one valid result with ${REVIEW_TOOL_SPECS.submitReview.name}. If it is rejected, correct the result and retry. Do not return review prose outside that tool.`,
26
+ `Submit one valid result with ${REVIEW_CHILD_TOOL_SPECS.submitReview.name}. If it is rejected, correct the result and retry. Do not return review prose outside that tool.`,
27
27
  ].join("\n");
28
28
  }
@@ -5,11 +5,12 @@ import {
5
5
  createEarlyCancellationDiagnostics,
6
6
  createUnobservedAgentRunDiagnostics,
7
7
  } from "@mrclrchtr/supi-agent-runtime/api";
8
- import type { LocalReviewAuditStore } from "../audit/local-review-audit-store.ts";
9
- import { isRootCommit, resolveReviewSnapshot, summarizeReviewSnapshot } from "../git.ts";
10
- import { normalizeReviewInput } from "../review-input.ts";
11
- import { normalizeReviewScope, validateReviewScope } from "../review-scope.ts";
12
- import { snapshotsMatch } from "../target/snapshot-match.ts";
8
+ import type { LocalReviewAuditStore } from "../../audit/local-review-audit-store.ts";
9
+ import { isRootCommit, resolveReviewSnapshot, summarizeReviewSnapshot } from "../../git.ts";
10
+ import { normalizeReviewInput } from "../../review-input.ts";
11
+ import { normalizeReviewScope, validateReviewScope } from "../../review-scope.ts";
12
+ import { reviewTargetEndpoints } from "../../target/input.ts";
13
+ import { snapshotsMatch } from "../../target/snapshot-match.ts";
13
14
  import type {
14
15
  PlannerRunResult,
15
16
  PlanningRecord,
@@ -21,12 +22,12 @@ import type {
21
22
  ReviewTargetSpec,
22
23
  ReviewTask,
23
24
  ReviewTaskResult,
24
- } from "../types.ts";
25
- import { runDependencyBootstrap } from "../workspace/dependency-bootstrap.ts";
26
- import { materializeReviewWorkspace } from "../workspace/review-workspace.ts";
25
+ } from "../../types.ts";
26
+ import { runDependencyBootstrap } from "../../workspace/dependency-bootstrap.ts";
27
+ import { materializeReviewWorkspace } from "../../workspace/review-workspace.ts";
28
+ import { executeReviewTasks, type ReviewExecutionUpdate } from "./execution.ts";
29
+ import { PLANNER_PROMPT_VERSION, runPlanner } from "./planner.ts";
27
30
  import { buildPlannerPrompt } from "./planner-input.ts";
28
- import { PLANNER_PROMPT_VERSION, runPlanner } from "./planner-runner.ts";
29
- import { executeReviewTasks, type ReviewExecutionUpdate } from "./review-execution.ts";
30
31
 
31
32
  /** Tool update callback signature shared across workflow adapters. */
32
33
  type OnUpdate = ReviewExecutionUpdate;
@@ -266,10 +267,11 @@ async function targetRuleError(
266
267
  signal?: AbortSignal,
267
268
  ): Promise<string | undefined> {
268
269
  const change = hasChangeTask(review.tasks);
269
- if (!change && snapshot.requestedTarget.from !== undefined) {
270
+ const requestedTarget = reviewTargetEndpoints(snapshot.requestedTarget);
271
+ if (!change && requestedTarget.from !== undefined) {
270
272
  return "Review Targets for all-state tasks must not set from.";
271
273
  }
272
- if (!snapshot.target.includeUncommittedChanges && change && !snapshot.requestedTarget.from) {
274
+ if (!snapshot.target.includeUncommittedChanges && change && requestedTarget.from === undefined) {
273
275
  return "A committed change Review Target requires an explicit from endpoint.";
274
276
  }
275
277
  if (!snapshot.target.includeUncommittedChanges && change) {
@@ -288,10 +290,12 @@ type ResolvedReviewInput =
288
290
  | { kind: "invalid"; reason: string };
289
291
 
290
292
  function reviewTargetsMatch(left: ReviewTargetSpec, right: ReviewTargetSpec): boolean {
293
+ const leftTarget = reviewTargetEndpoints(left);
294
+ const rightTarget = reviewTargetEndpoints(right);
291
295
  return (
292
- left.from === right.from &&
293
- left.to === right.to &&
294
- (left.includeUncommittedChanges ?? true) === (right.includeUncommittedChanges ?? true)
296
+ leftTarget.kind === rightTarget.kind &&
297
+ leftTarget.from === rightTarget.from &&
298
+ leftTarget.to === rightTarget.to
295
299
  );
296
300
  }
297
301