@mrclrchtr/supi-review 6.1.0 → 6.2.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 (134) hide show
  1. package/README.md +4 -2
  2. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  3. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
  4. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
  5. package/node_modules/@mrclrchtr/supi-agent-runtime/package.json +2 -2
  6. package/node_modules/@mrclrchtr/supi-code-intelligence/README.md +1 -1
  7. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  8. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  9. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
  10. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
  11. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/README.md +21 -3
  12. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  13. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  14. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
  15. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
  16. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +4 -5
  17. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/api.ts +12 -7
  18. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +1 -1
  19. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +0 -5
  20. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-publication.ts +6 -3
  21. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +2 -1
  22. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +5 -2
  23. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +2 -1
  24. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +17 -5
  25. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +40 -18
  26. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +164 -30
  27. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +9 -87
  28. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +0 -1
  29. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +4 -5
  30. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/types.ts +0 -29
  31. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +7 -21
  32. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-severity.ts +6 -0
  33. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-summary.ts +11 -14
  34. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +0 -5
  35. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/stale-diagnostics.ts +0 -1
  36. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sentinels.ts +29 -49
  37. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +1 -1
  38. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +4 -8
  39. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-helpers.ts +1 -9
  40. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +6 -3
  41. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +9 -1
  42. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +26 -41
  43. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +275 -99
  44. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +4 -1
  45. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +59 -28
  46. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +27 -19
  47. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +26 -0
  48. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +0 -17
  49. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +83 -19
  50. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +5 -2
  51. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/scanner.ts +24 -21
  52. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +29 -3
  53. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +19 -40
  54. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/utils.ts +13 -19
  55. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/workspace-path-policy.ts +287 -0
  56. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/README.md +6 -18
  57. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  58. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  59. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
  60. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
  61. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -5
  62. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +1 -11
  63. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/coordinates.ts +19 -0
  64. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -23
  65. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/operation-support.ts +3 -21
  66. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +5 -9
  67. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +10 -20
  68. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +7 -1
  69. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +9 -5
  70. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-protocol.ts +134 -9
  71. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-name.ts +96 -0
  72. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +11 -12
  73. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +39 -56
  74. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +9 -7
  75. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/js-binding-pattern.ts +26 -0
  76. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/node-at.ts +2 -21
  77. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-html-sql.ts +144 -12
  78. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline.ts +50 -37
  79. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/scope.ts +138 -0
  80. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +0 -7
  81. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/parsed-file-store.ts +1 -14
  82. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +0 -10
  83. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/service.ts +6 -8
  84. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/worker-main.ts +34 -10
  85. package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +5 -5
  86. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/capability/capability-warnings.ts +4 -22
  87. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/ast-scan-timing.ts +4 -2
  88. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/ast-scan.ts +1 -1
  89. package/node_modules/@mrclrchtr/supi-code-intelligence/src/api.ts +1 -0
  90. package/node_modules/@mrclrchtr/supi-code-intelligence/src/extension.ts +4 -2
  91. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-refresh.ts +24 -2
  92. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-types.ts +19 -0
  93. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/input/health-refactor.ts +16 -14
  94. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-types.ts +14 -1
  95. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-workflow.ts +21 -16
  96. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/lifecycle.ts +0 -3
  97. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/maintenance.ts +4 -5
  98. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/settings.ts +6 -9
  99. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/state.ts +0 -2
  100. package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/workspace-provider-host.ts +2 -2
  101. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/file-scope-markdown.ts +43 -0
  102. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/markdown.ts +66 -66
  103. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/refresh-outcome.ts +46 -0
  104. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/refresh-status.ts +166 -23
  105. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/result.ts +1 -0
  106. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/tui.ts +18 -5
  107. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/guidance.ts +3 -2
  108. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/guidance.ts +1 -1
  109. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/register.ts +5 -2
  110. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/schemas.ts +21 -11
  111. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  112. package/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
  113. package/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
  114. package/package.json +4 -4
  115. package/src/audit/review-audit.ts +6 -1
  116. package/src/config.ts +36 -0
  117. package/src/thinking.ts +62 -0
  118. package/src/tool/review_run/execute.ts +11 -4
  119. package/src/tool/review_run/execution.ts +12 -0
  120. package/src/tool/review_run/planner.ts +4 -2
  121. package/src/tool/review_run/runner.ts +14 -4
  122. package/src/tool/review_run/workflow.ts +6 -0
  123. package/src/tui/common.ts +7 -0
  124. package/src/tui/review-command.ts +29 -1
  125. package/src/types.ts +12 -1
  126. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +0 -59
  127. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/pattern-matcher.ts +0 -24
  128. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/scripts/generate-kotlin-wasm.mjs +0 -132
  129. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/scripts/generate-sql-wasm.mjs +0 -158
  130. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/scripts/vendor-wasm.mjs +0 -167
  131. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +0 -42
  132. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-registration.ts +0 -37
  133. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/service-registry.ts +0 -30
  134. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +0 -8
@@ -1,3 +1,11 @@
1
+ import type { ProcessCrashRecoverySummary } from "@mrclrchtr/supi-lsp/api";
2
+ import {
3
+ formatProcessCrashRecovery,
4
+ formatStaleDiagnosticRestarts,
5
+ isFileReadinessPending,
6
+ } from "./refresh-outcome.ts";
7
+ import { readSemanticHealthState } from "./semantic-state.ts";
8
+
1
9
  /** Render current and retained health refresh status for the TUI. */
2
10
 
3
11
  export function readRefreshStatus(data: Record<string, unknown> | null): string | null {
@@ -5,25 +13,10 @@ export function readRefreshStatus(data: Record<string, unknown> | null): string
5
13
  if (!refresh) return null;
6
14
 
7
15
  switch (refresh.kind) {
8
- case "completed": {
9
- const attempted = readNumber(refresh.attemptedActiveClients);
10
- const restarted = readNumber(refresh.restartedClients);
11
- const stale = readRecord(refresh.staleAssessment);
12
- const noOp = attempted === 0 && restarted === 0;
13
- const label = refreshAttemptLabel(refresh);
14
- const base = noOp
15
- ? `${label} completed no-op`
16
- : `${label} completed: ${attempted} clients targeted, ${restarted} restarted`;
17
- const evidence = formatDiagnosticEvidence(readRecord(refresh.diagnosticEvidence));
18
- const withEvidence = evidence ? `${base}; ${evidence}` : base;
19
- return stale?.suspected === true
20
- ? `${withEvidence}; stale pattern suspected in ${readNumber(stale.matchedFileCount)} files`
21
- : withEvidence;
22
- }
23
- case "failed": {
24
- const evidence = formatDiagnosticEvidence(readRecord(refresh.diagnosticEvidence));
25
- return `${refreshAttemptLabel(refresh)} failed${typeof refresh.reason === "string" ? `: ${refresh.reason}` : ""}${evidence ? `; ${evidence}` : ""}`;
26
- }
16
+ case "completed":
17
+ return formatCompletedRefreshStatus(refresh, isPendingFileReadiness(data));
18
+ case "failed":
19
+ return formatFailedRefreshStatus(refresh);
27
20
  case "not-attempted":
28
21
  return `refresh attempt not started${formatLastRefreshSuffix(refresh)}`;
29
22
  case "not-requested":
@@ -33,6 +26,89 @@ export function readRefreshStatus(data: Record<string, unknown> | null): string
33
26
  }
34
27
  }
35
28
 
29
+ function formatCompletedRefreshStatus(
30
+ refresh: Record<string, unknown>,
31
+ fileReadinessPending: boolean,
32
+ ): string {
33
+ const attempted = readNumber(refresh.attemptedActiveClients);
34
+ const restarted = readNumber(refresh.restartedClients);
35
+ const processCrashRecovery = formatProcessCrashRecovery(
36
+ readProcessCrashRecovery(refresh.processCrashRecovery),
37
+ );
38
+ const noOp =
39
+ !fileReadinessPending && attempted === 0 && restarted === 0 && processCrashRecovery === null;
40
+ const label = refreshAttemptLabel(refresh);
41
+ const base = fileReadinessPending
42
+ ? `${label} waiting — LSP may still be warming; retry shortly`
43
+ : noOp
44
+ ? `${label} completed no-op`
45
+ : `${label} completed: ${attempted} clients targeted`;
46
+ const outcomes = formatRefreshOutcomes(refresh, restarted, processCrashRecovery, noOp);
47
+ const withOutcome = outcomes.length > 0 ? `${base}; ${outcomes.join("; ")}` : base;
48
+ const evidence = formatDiagnosticEvidence(readRecord(refresh.diagnosticEvidence));
49
+ const withEvidence = evidence ? `${withOutcome}; ${evidence}` : withOutcome;
50
+ const stale = readRecord(refresh.staleAssessment);
51
+ return stale?.suspected === true
52
+ ? `${withEvidence}; stale pattern suspected in ${readNumber(stale.matchedFileCount)} files`
53
+ : withEvidence;
54
+ }
55
+
56
+ function formatFailedRefreshStatus(refresh: Record<string, unknown>): string {
57
+ const processCrashRecovery = formatProcessCrashRecovery(
58
+ readProcessCrashRecovery(refresh.processCrashRecovery),
59
+ );
60
+ const staleRestart = formatStaleDiagnosticRestartsForRecord(refresh);
61
+ const evidence = formatDiagnosticEvidence(readRecord(refresh.diagnosticEvidence));
62
+ const reason = typeof refresh.reason === "string" ? `: ${refresh.reason}` : "";
63
+ return `${refreshAttemptLabel(refresh)} failed${reason}${staleRestart ? `; ${staleRestart}` : ""}${processCrashRecovery ? `; ${processCrashRecovery}` : ""}${evidence ? `; ${evidence}` : ""}`;
64
+ }
65
+
66
+ function formatRefreshOutcomes(
67
+ refresh: Record<string, unknown>,
68
+ restarted: number,
69
+ processCrashRecovery: string | null,
70
+ noOp: boolean,
71
+ ): string[] {
72
+ const outcomes: string[] = [];
73
+ if (refresh.operationScope === "workspace-runtime" && !noOp) {
74
+ outcomes.push(formatStaleDiagnosticRestarts(restarted));
75
+ }
76
+ if (processCrashRecovery) outcomes.push(processCrashRecovery);
77
+ return outcomes;
78
+ }
79
+
80
+ /** Render only the material current recovery outcome for compact TUI chrome. */
81
+ export function readCompactRefreshStatus(data: Record<string, unknown> | null): string | null {
82
+ const refresh = readRecord(data?.refresh);
83
+ if (!refresh || (refresh.kind !== "completed" && refresh.kind !== "failed")) return null;
84
+
85
+ const processCrashRecovery = formatProcessCrashRecovery(
86
+ readProcessCrashRecovery(refresh.processCrashRecovery),
87
+ );
88
+ if (refresh.kind === "failed") {
89
+ const staleRestart = formatStaleDiagnosticRestartsForRecord(refresh);
90
+ return (
91
+ [staleRestart, processCrashRecovery]
92
+ .filter((value): value is string => value !== null)
93
+ .join("; ") || null
94
+ );
95
+ }
96
+ const fileReadinessPending = isPendingFileReadiness(data);
97
+ if (
98
+ !processCrashRecovery &&
99
+ readNumber(refresh.restartedClients) === 0 &&
100
+ !fileReadinessPending
101
+ ) {
102
+ return null;
103
+ }
104
+
105
+ const staleRestart = formatStaleDiagnosticRestartsForRecord(refresh);
106
+ const readiness = fileReadinessPending ? "LSP may still be warming; retry shortly" : null;
107
+ return [staleRestart, processCrashRecovery, readiness]
108
+ .filter((value): value is string => value !== null)
109
+ .join("; ");
110
+ }
111
+
36
112
  export function readPreviousRefreshStatus(data: Record<string, unknown> | null): string | null {
37
113
  const refresh = readRecord(data?.refresh);
38
114
  if (!refresh || (refresh.kind !== "not-requested" && refresh.kind !== "not-attempted")) {
@@ -41,11 +117,23 @@ export function readPreviousRefreshStatus(data: Record<string, unknown> | null):
41
117
  const attempt = readRecord(refresh.lastAttempt);
42
118
  if (!attempt) return null;
43
119
  const evidence = formatCompactDiagnosticEvidence(readRecord(attempt.diagnosticEvidence));
120
+ const processCrashRecovery = formatProcessCrashRecovery(
121
+ readProcessCrashRecovery(attempt.processCrashRecovery),
122
+ );
123
+ const staleRestart = formatStaleDiagnosticRestartsForRecord(attempt);
124
+ const fileReadinessPending =
125
+ attempt.kind === "completed" &&
126
+ isFileReadinessPending(attempt, readSemanticHealthState(data?.semanticState));
127
+ const readiness = fileReadinessPending ? "LSP may still be warming; retry shortly" : null;
128
+ const outcome = [readiness, staleRestart, processCrashRecovery, evidence]
129
+ .filter((value): value is string => value !== null)
130
+ .join("; ");
44
131
  if (attempt.kind === "failed") {
45
- return `last ${refreshAttemptLabel(attempt)} failed${evidence ? ` (${evidence})` : ""}`;
132
+ return `last ${refreshAttemptLabel(attempt)} failed${outcome ? ` (${outcome})` : ""}`;
46
133
  }
47
134
  if (attempt.kind === "completed") {
48
- return `last ${refreshAttemptLabel(attempt)} completed${evidence ? ` (${evidence})` : ""}`;
135
+ const status = fileReadinessPending ? "waiting" : "completed";
136
+ return `last ${refreshAttemptLabel(attempt)} ${status}${outcome ? ` (${outcome})` : ""}`;
49
137
  }
50
138
  return null;
51
139
  }
@@ -54,16 +142,45 @@ function refreshAttemptLabel(attempt: Record<string, unknown>): string {
54
142
  return attempt.operationScope === "file-runtime" ? "file maintenance attempt" : "refresh attempt";
55
143
  }
56
144
 
145
+ function formatStaleDiagnosticRestartsForRecord(attempt: Record<string, unknown>): string | null {
146
+ if (
147
+ attempt.operationScope !== "workspace-runtime" ||
148
+ typeof attempt.restartedClients !== "number"
149
+ ) {
150
+ return null;
151
+ }
152
+ const processCrashRecovery = formatProcessCrashRecovery(
153
+ readProcessCrashRecovery(attempt.processCrashRecovery),
154
+ );
155
+ const noOp =
156
+ attempt.kind === "completed" &&
157
+ readNumber(attempt.attemptedActiveClients) === 0 &&
158
+ attempt.restartedClients === 0 &&
159
+ processCrashRecovery === null;
160
+ return noOp ? null : formatStaleDiagnosticRestarts(attempt.restartedClients);
161
+ }
162
+
57
163
  function formatLastRefreshSuffix(refresh: Record<string, unknown>): string {
58
164
  const attempt = readRecord(refresh.lastAttempt);
59
165
  if (!attempt) return "";
60
166
  const evidence = formatDiagnosticEvidence(readRecord(attempt.diagnosticEvidence));
167
+ const staleRestart = formatStaleDiagnosticRestartsForRecord(attempt);
168
+ const processCrashRecovery = formatProcessCrashRecovery(
169
+ readProcessCrashRecovery(attempt.processCrashRecovery),
170
+ );
171
+ const fileReadinessPending =
172
+ attempt.kind === "completed" && isFileReadinessPending(attempt, null);
173
+ const readiness = fileReadinessPending ? "LSP may still be warming; retry shortly" : null;
174
+ const outcome = [readiness, staleRestart, processCrashRecovery, evidence]
175
+ .filter((value): value is string => value !== null)
176
+ .join("; ");
61
177
  if (attempt.kind === "failed") {
62
178
  const reason = typeof attempt.reason === "string" ? `: ${attempt.reason}` : "";
63
- return `; last ${refreshAttemptLabel(attempt)} failed${reason}${evidence ? `; ${evidence}` : ""}`;
179
+ return `; last ${refreshAttemptLabel(attempt)} failed${reason}${outcome ? `; ${outcome}` : ""}`;
64
180
  }
65
181
  if (attempt.kind === "completed") {
66
- return `; last ${refreshAttemptLabel(attempt)} completed${evidence ? `; ${evidence}` : ""}`;
182
+ const status = fileReadinessPending ? "waiting" : "completed";
183
+ return `; last ${refreshAttemptLabel(attempt)} ${status}${outcome ? `; ${outcome}` : ""}`;
67
184
  }
68
185
  return "";
69
186
  }
@@ -80,6 +197,32 @@ function formatDiagnosticEvidence(evidence: Record<string, unknown> | null): str
80
197
  return `${counts[0]} requested, ${counts[1]} confirmed, ${counts[2]} unconfirmed, ${counts[3]} failed, ${counts[4]} removed`;
81
198
  }
82
199
 
200
+ export function isPendingFileReadiness(data: Record<string, unknown> | null): boolean {
201
+ const observation = readRecord(data?.diagnosticObservation);
202
+ const scope = readRecord(observation?.scope);
203
+ if (scope?.kind !== "file") return false;
204
+
205
+ const refresh = readRecord(data?.refresh);
206
+ const attempt = refresh && typeof refresh.operationScope === "string" ? refresh : null;
207
+ return isFileReadinessPending(attempt, readSemanticHealthState(data?.semanticState));
208
+ }
209
+
210
+ function readProcessCrashRecovery(value: unknown): ProcessCrashRecoverySummary | null {
211
+ const summary = readRecord(value);
212
+ if (!summary) return null;
213
+ const attemptedRoutes = summary.attemptedRoutes;
214
+ const recoveredRoutes = summary.recoveredRoutes;
215
+ const failedRoutes = summary.failedRoutes;
216
+ if (
217
+ !isEvidenceCount(attemptedRoutes) ||
218
+ !isEvidenceCount(recoveredRoutes) ||
219
+ !isEvidenceCount(failedRoutes)
220
+ ) {
221
+ return null;
222
+ }
223
+ return { attemptedRoutes, recoveredRoutes, failedRoutes };
224
+ }
225
+
83
226
  function readEvidenceCounts(evidence: Record<string, unknown> | null): number[] | null {
84
227
  if (!evidence) return null;
85
228
  const counts = [
@@ -19,6 +19,7 @@ export type {
19
19
  HealthDiagnosticEntry,
20
20
  HealthDiagnosticObservation,
21
21
  HealthDiagnosticScope,
22
+ HealthFileReadiness,
22
23
  HealthRefreshAttempt,
23
24
  HealthRefreshState,
24
25
  HealthSection,
@@ -24,7 +24,12 @@ import {
24
24
  type ToolResult,
25
25
  } from "../../ui/tui/common.ts";
26
26
  import type { CodeHealthToolParams } from "./execute.ts";
27
- import { readPreviousRefreshStatus, readRefreshStatus } from "./refresh-status.ts";
27
+ import {
28
+ isPendingFileReadiness,
29
+ readCompactRefreshStatus,
30
+ readPreviousRefreshStatus,
31
+ readRefreshStatus,
32
+ } from "./refresh-status.ts";
28
33
  import { formatSemanticHealthState, readSemanticHealthState } from "./semantic-state.ts";
29
34
 
30
35
  /** ── renderCall ────────────────────────────────────────────────── */
@@ -125,6 +130,7 @@ function buildCompactSummary(data: Record<string, unknown> | null, theme: Theme)
125
130
  const semanticRequested = sections.some(
126
131
  (section) => section.key === "diagnostics" || section.key === "servers",
127
132
  );
133
+ const fileReadinessPending = isPendingFileReadiness(data);
128
134
  const segments = sections.map((section) =>
129
135
  formatSectionSummary(
130
136
  section,
@@ -132,6 +138,7 @@ function buildCompactSummary(data: Record<string, unknown> | null, theme: Theme)
132
138
  ? formatCompactDiagnosticEvidence(readDiagnosticEvidence(data))
133
139
  : null,
134
140
  theme,
141
+ fileReadinessPending,
135
142
  ),
136
143
  );
137
144
  if (semanticRequested) {
@@ -142,8 +149,8 @@ function buildCompactSummary(data: Record<string, unknown> | null, theme: Theme)
142
149
  `${theme.fg("dim", "lsp")} ${theme.fg(statusColor, semanticStatus)}${routeSummary ? ` ${theme.fg("warning", routeSummary)}` : ""}`,
143
150
  );
144
151
  }
145
- const previousRefresh = readPreviousRefreshStatus(data);
146
- if (previousRefresh) segments.push(theme.fg("dim", previousRefresh));
152
+ const refreshStatus = readCompactRefreshStatus(data) ?? readPreviousRefreshStatus(data);
153
+ if (refreshStatus) segments.push(theme.fg("dim", refreshStatus));
147
154
  const capabilityWarningCount = readCapabilityWarnings(data).length;
148
155
  if (capabilityWarningCount > 0) {
149
156
  const label = capabilityWarningCount === 1 ? "capability warning" : "capability warnings";
@@ -158,11 +165,14 @@ function formatSectionSummary(
158
165
  section: HealthSectionSummary,
159
166
  coverage: string | null,
160
167
  theme: Theme,
168
+ fileReadinessPending: boolean,
161
169
  ): string {
162
170
  const label = sectionLabel(section.key);
163
171
  const coverageSuffix = coverage ? ` (${coverage})` : "";
164
172
  if (section.status === "unavailable" || !section.available) {
165
- return `${theme.fg("dim", label)} ${theme.fg("warning", "unavailable")}${coverageSuffix}`;
173
+ const status =
174
+ section.key === "diagnostics" && fileReadinessPending ? "pending" : "unavailable";
175
+ return `${theme.fg("dim", label)} ${theme.fg("warning", status)}${coverageSuffix}`;
166
176
  }
167
177
  if (section.status === "partial") {
168
178
  return `${theme.fg("dim", label)} ${theme.fg("warning", "partial")}${coverageSuffix}`;
@@ -307,7 +317,10 @@ function buildDiagnosticSummary(data: Record<string, unknown> | null, theme: The
307
317
  const section = readHealthSections(data).find((entry) => entry.key === "diagnostics");
308
318
  if (!section) return new Text("", 0, 0);
309
319
  if (section.status === "unavailable" || !section.available) {
310
- return new Text(theme.fg("warning", "Diagnostics unavailable"), 0, 0);
320
+ const label = isPendingFileReadiness(data)
321
+ ? "Diagnostics pending — LSP may still be warming; retry shortly"
322
+ : "Diagnostics unavailable";
323
+ return new Text(theme.fg("warning", label), 0, 0);
311
324
  }
312
325
  const trackedFiles = diagnosticScopeKind(data) === "tracked-files";
313
326
  if (section.status === "partial") {
@@ -1,5 +1,6 @@
1
- export const toolDescription = "Apply one stored refactor plan by planId.";
1
+ export const toolDescription =
2
+ "Apply one fresh stored refactor plan by planId after safety checks; mutates its files.";
2
3
 
3
- export const promptSnippet = "apply a fresh stored refactor plan";
4
+ export const promptSnippet = "apply a stored refactor plan";
4
5
 
5
6
  export const promptGuidelines: string[] = [];
@@ -1,5 +1,5 @@
1
1
  export const toolDescription =
2
- "Preview one semantic rename or extraction and return a planId without mutating files.";
2
+ "Preview one semantic rename, extraction, import cleanup, or dead-code deletion and return a planId without mutating files.";
3
3
 
4
4
  export const promptSnippet = "preview a precise semantic refactor";
5
5
 
@@ -1,7 +1,10 @@
1
1
  import { createHmac, randomBytes } from "node:crypto";
2
2
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
3
- import { recordDebugEvent, startDebugTimer } from "@mrclrchtr/supi-core/debug";
4
- import { truncateIdentity } from "@mrclrchtr/supi-lsp/debug-telemetry";
3
+ import {
4
+ recordDebugEvent,
5
+ startDebugTimer,
6
+ truncateDebugIdentity as truncateIdentity,
7
+ } from "@mrclrchtr/supi-core/debug";
5
8
  import type { WorkspaceCodeIntelligenceSession } from "../session/session.ts";
6
9
  import {
7
10
  CODE_INTELLIGENCE_TOOL_PROMPT_SURFACES,
@@ -1,5 +1,9 @@
1
1
  import { StringEnum } from "@earendil-works/pi-ai";
2
2
  import { type TSchema, Type } from "typebox";
3
+ import {
4
+ PUBLIC_REFACTOR_OPERATION_NAMES,
5
+ type PublicRefactorOperationName,
6
+ } from "../session/refactor-types.ts";
3
7
  import { TARGET_SYMBOL_KINDS } from "../session/target-input.ts";
4
8
 
5
9
  export const ScopeParam = Type.String({
@@ -127,18 +131,24 @@ const RangeParam = Type.Object(
127
131
 
128
132
  const NewNameParam = Type.String({ description: "New symbol name.", minLength: 1 });
129
133
 
134
+ const RefactorOperationProperties = {
135
+ rename_symbol: Type.Object({ newName: NewNameParam }, { additionalProperties: false }),
136
+ extract_function: Type.Object(
137
+ { newName: NewNameParam, range: RangeParam },
138
+ { additionalProperties: false },
139
+ ),
140
+ extract_variable: Type.Object(
141
+ { newName: NewNameParam, range: RangeParam },
142
+ { additionalProperties: false },
143
+ ),
144
+ update_imports: Type.Object({}, { additionalProperties: false }),
145
+ delete_dead_code: Type.Object({}, { additionalProperties: false }),
146
+ } satisfies Record<PublicRefactorOperationName, TSchema>;
147
+
130
148
  export const RefactorOperationParam = exactOneSelector(
131
- {
132
- rename_symbol: Type.Object({ newName: NewNameParam }, { additionalProperties: false }),
133
- extract_function: Type.Object(
134
- { newName: NewNameParam, range: RangeParam },
135
- { additionalProperties: false },
136
- ),
137
- extract_variable: Type.Object(
138
- { newName: NewNameParam, range: RangeParam },
139
- { additionalProperties: false },
140
- ),
141
- },
149
+ Object.fromEntries(
150
+ PUBLIC_REFACTOR_OPERATION_NAMES.map((name) => [name, RefactorOperationProperties[name]]),
151
+ ),
142
152
  "Exactly one refactor operation.",
143
153
  );
144
154
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "description": "Shared settings, configuration, reporting, and session infrastructure",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -0,0 +1,11 @@
1
+ /** Maximum UTF-16 code-unit length of one debug identity string. */
2
+ export const MAX_DEBUG_IDENTITY_STRING = 512;
3
+
4
+ /** Marker appended to a truncated debug identity string. */
5
+ export const DEBUG_IDENTITY_TRUNCATION_MARKER = "…";
6
+
7
+ /** Bound one debug identity string, including its truncation marker. */
8
+ export function truncateDebugIdentity(value: string): string {
9
+ if (value.length <= MAX_DEBUG_IDENTITY_STRING) return value;
10
+ return `${value.slice(0, MAX_DEBUG_IDENTITY_STRING - 1)}${DEBUG_IDENTITY_TRUNCATION_MARKER}`;
11
+ }
@@ -3,6 +3,11 @@
3
3
  // Kept separate from debug-registry.ts so debug-timing.ts can import the
4
4
  // registry without creating an import cycle through the barrel re-export.
5
5
 
6
+ export {
7
+ DEBUG_IDENTITY_TRUNCATION_MARKER,
8
+ MAX_DEBUG_IDENTITY_STRING,
9
+ truncateDebugIdentity,
10
+ } from "./debug-identity.ts";
6
11
  // biome-ignore lint/performance/noReExportAll: preserve the stable debug domain entry point
7
12
  export * from "./debug-registry.ts";
8
13
  // biome-ignore lint/performance/noReExportAll: preserve the stable debug domain entry point
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-review",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "description": "Parallel inspection-only reviews of exact Git targets",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,9 +31,9 @@
31
31
  "README.md"
32
32
  ],
33
33
  "dependencies": {
34
- "@mrclrchtr/supi-agent-runtime": "6.1.0",
35
- "@mrclrchtr/supi-core": "6.1.0",
36
- "@mrclrchtr/supi-code-intelligence": "6.1.0"
34
+ "@mrclrchtr/supi-core": "6.2.0",
35
+ "@mrclrchtr/supi-code-intelligence": "6.2.0",
36
+ "@mrclrchtr/supi-agent-runtime": "6.2.0"
37
37
  },
38
38
  "bundledDependencies": [
39
39
  "@mrclrchtr/supi-agent-runtime",
@@ -50,7 +50,10 @@ export interface ReviewAuditTrace {
50
50
  export interface ReviewAuditRecordInput {
51
51
  task: ReviewTask;
52
52
  modelId: string;
53
+ /** Effective level passed to PI. */
53
54
  thinkingLevel: string;
55
+ /** Requested level, absent only in older v1 records. */
56
+ requestedThinkingLevel: string;
54
57
  protocolPrompt: string;
55
58
  packet: string;
56
59
  packetHash: string;
@@ -62,8 +65,10 @@ export interface ReviewAuditRecordInput {
62
65
  }
63
66
 
64
67
  /** Complete on-disk representation of an opt-in reviewer replay. */
65
- export interface ReviewAuditRecord extends ReviewAuditRecordInput {
68
+ export interface ReviewAuditRecord extends Omit<ReviewAuditRecordInput, "requestedThinkingLevel"> {
66
69
  format: "supi-review-audit/v1";
70
+ /** Missing for v1 records created before requested levels were recorded. */
71
+ requestedThinkingLevel?: string;
67
72
  artifactId: string;
68
73
  createdAt: string;
69
74
  expiresAt: string;
package/src/config.ts CHANGED
@@ -2,6 +2,12 @@ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import { loadSupiConfig } from "@mrclrchtr/supi-core/config";
3
3
  import { defineConfigSettings, registerSettings } from "@mrclrchtr/supi-core/settings";
4
4
  import { CURRENT_SESSION_REVIEW_MODEL } from "./model.ts";
5
+ import {
6
+ PLANNER_DEFAULT_THINKING_LEVEL,
7
+ REVIEW_THINKING_LEVELS,
8
+ REVIEWER_DEFAULT_THINKING_LEVEL,
9
+ type ReviewThinkingLevel,
10
+ } from "./thinking.ts";
5
11
  import { REVIEW_AUDIT_TOOL_NAME } from "./tool/review_audit/spec.ts";
6
12
  import { REVIEW_RUN_TOOL_NAME } from "./tool/review_run/spec.ts";
7
13
 
@@ -18,6 +24,10 @@ export interface ReviewConfig extends Record<string, unknown> {
18
24
  agentModel: string;
19
25
  /** Canonical Planner model id, or `current` for the active session model. */
20
26
  plannerModel: string;
27
+ /** Configured Reviewer thinking level; validated when Reviewer Sessions start. */
28
+ reviewerThinkingLevel: string;
29
+ /** Configured Planner thinking level; validated when Planner Drafts start. */
30
+ plannerThinkingLevel: string;
21
31
  /** Explicit canonical Submission Recovery model id, or `disabled`. */
22
32
  recoveryModel: string;
23
33
  /** Record every reviewer's local replay and enable replay retrieval. */
@@ -35,6 +45,8 @@ export const REVIEW_DEFAULTS: ReviewConfig = {
35
45
  agentToolEnabled: true,
36
46
  agentModel: CURRENT_SESSION_REVIEW_MODEL,
37
47
  plannerModel: CURRENT_SESSION_REVIEW_MODEL,
48
+ reviewerThinkingLevel: REVIEWER_DEFAULT_THINKING_LEVEL,
49
+ plannerThinkingLevel: PLANNER_DEFAULT_THINKING_LEVEL,
38
50
  recoveryModel: "disabled",
39
51
  auditEnabled: false,
40
52
  bootstrapCommand: "",
@@ -46,6 +58,8 @@ export function loadReviewConfig(cwd: string, homeDir?: string): ReviewConfig {
46
58
  const raw = loadSupiConfig(REVIEW_CONFIG_SECTION, cwd, REVIEW_DEFAULTS, { homeDir });
47
59
  const readModel = (value: unknown, fallback: string) =>
48
60
  typeof value === "string" && value.trim() ? value.trim() : fallback;
61
+ const readThinkingLevel = (value: unknown, fallback: ReviewThinkingLevel) =>
62
+ value === undefined ? fallback : typeof value === "string" ? value.trim() : String(value);
49
63
  const readBoolean = (value: unknown, fallback: boolean) => {
50
64
  if (typeof value === "boolean") return value;
51
65
  if (typeof value === "string") return value.trim().toLowerCase() === "true";
@@ -58,6 +72,14 @@ export function loadReviewConfig(cwd: string, homeDir?: string): ReviewConfig {
58
72
  agentToolEnabled: readBoolean(raw.agentToolEnabled, REVIEW_DEFAULTS.agentToolEnabled),
59
73
  agentModel: readModel(raw.agentModel, REVIEW_DEFAULTS.agentModel),
60
74
  plannerModel: readModel(raw.plannerModel, REVIEW_DEFAULTS.plannerModel),
75
+ reviewerThinkingLevel: readThinkingLevel(
76
+ raw.reviewerThinkingLevel,
77
+ REVIEW_DEFAULTS.reviewerThinkingLevel as ReviewThinkingLevel,
78
+ ),
79
+ plannerThinkingLevel: readThinkingLevel(
80
+ raw.plannerThinkingLevel,
81
+ REVIEW_DEFAULTS.plannerThinkingLevel as ReviewThinkingLevel,
82
+ ),
61
83
  recoveryModel: readModel(raw.recoveryModel, REVIEW_DEFAULTS.recoveryModel),
62
84
  auditEnabled: readBoolean(raw.auditEnabled, REVIEW_DEFAULTS.auditEnabled),
63
85
  bootstrapCommand: readCommand(raw.bootstrapCommand),
@@ -110,6 +132,13 @@ export function registerReviewSettings(pi: ExtensionAPI, homeDir?: string): void
110
132
  includeDisabled: false,
111
133
  staticOptions: [currentOption],
112
134
  },
135
+ {
136
+ kind: "enum",
137
+ key: "reviewerThinkingLevel",
138
+ label: "Reviewer thinking level",
139
+ description: "PI reasoning level for Reviewer Sessions.",
140
+ values: [...REVIEW_THINKING_LEVELS],
141
+ },
113
142
  {
114
143
  kind: "modelPicker",
115
144
  key: "plannerModel",
@@ -118,6 +147,13 @@ export function registerReviewSettings(pi: ExtensionAPI, homeDir?: string): void
118
147
  includeDisabled: false,
119
148
  staticOptions: [currentOption],
120
149
  },
150
+ {
151
+ kind: "enum",
152
+ key: "plannerThinkingLevel",
153
+ label: "Planner thinking level",
154
+ description: "PI reasoning level for Planner Drafts.",
155
+ values: [...REVIEW_THINKING_LEVELS],
156
+ },
121
157
  {
122
158
  kind: "modelPicker",
123
159
  key: "recoveryModel",
@@ -0,0 +1,62 @@
1
+ import { clampThinkingLevel, type Model, type ModelThinkingLevel } from "@earendil-works/pi-ai";
2
+
3
+ /** PI thinking levels available in Review settings. */
4
+ export const REVIEW_THINKING_LEVELS = [
5
+ "off",
6
+ "minimal",
7
+ "low",
8
+ "medium",
9
+ "high",
10
+ "xhigh",
11
+ "max",
12
+ ] as const satisfies readonly ModelThinkingLevel[];
13
+
14
+ /** A validated PI thinking level used by a Review child role. */
15
+ export type ReviewThinkingLevel = (typeof REVIEW_THINKING_LEVELS)[number];
16
+
17
+ /** Default reasoning budget for Reviewer Sessions. */
18
+ export const REVIEWER_DEFAULT_THINKING_LEVEL: ReviewThinkingLevel = "max";
19
+ /** Default reasoning budget for Planner Drafts. */
20
+ export const PLANNER_DEFAULT_THINKING_LEVEL: ReviewThinkingLevel = "low";
21
+
22
+ /** Review child role that can have a configured thinking level. */
23
+ export type ReviewThinkingRole = "Reviewer" | "Planner";
24
+
25
+ /**
26
+ * Validate one configured role value at the point where that role is needed.
27
+ * Missing values use the role's package default; invalid values fail closed.
28
+ */
29
+ export function resolveReviewThinkingLevel(
30
+ value: unknown,
31
+ role: ReviewThinkingRole,
32
+ ): ReviewThinkingLevel {
33
+ if (value === undefined) {
34
+ return role === "Reviewer" ? REVIEWER_DEFAULT_THINKING_LEVEL : PLANNER_DEFAULT_THINKING_LEVEL;
35
+ }
36
+ const normalized = typeof value === "string" ? value.trim() : undefined;
37
+ if (normalized && REVIEW_THINKING_LEVELS.includes(normalized as ReviewThinkingLevel)) {
38
+ return normalized as ReviewThinkingLevel;
39
+ }
40
+ throw new Error(
41
+ `Invalid ${role} thinking level ${describeValue(value)}. Supported values: ${REVIEW_THINKING_LEVELS.join(", ")}.`,
42
+ );
43
+ }
44
+
45
+ /** Clamp a requested Review level to the selected model's capabilities. */
46
+ export function clampReviewThinkingLevel(
47
+ // biome-ignore lint/suspicious/noExplicitAny: Model<any> is PI's canonical type
48
+ model: Model<any>,
49
+ requested: ReviewThinkingLevel,
50
+ ): ModelThinkingLevel {
51
+ return clampThinkingLevel(model, requested);
52
+ }
53
+
54
+ function describeValue(value: unknown): string {
55
+ if (typeof value === "string") return JSON.stringify(value.slice(0, 120));
56
+ try {
57
+ const encoded = JSON.stringify(value);
58
+ return (encoded ?? String(value)).slice(0, 120);
59
+ } catch {
60
+ return String(value).slice(0, 120);
61
+ }
62
+ }
@@ -9,17 +9,18 @@ import {
9
9
  resolveRecoveryReviewModel,
10
10
  } from "../../model.ts";
11
11
  import type { ReviewArtifactStore } from "../../session/review-artifact-store.ts";
12
+ import { resolveReviewThinkingLevel } from "../../thinking.ts";
12
13
  import { parseRunReviewToolInput } from "./input-schema.ts";
13
14
  import { buildRunResult } from "./result.ts";
14
15
  import { runReview } from "./workflow.ts";
15
16
 
16
17
  function resolveReviewerModel(
17
18
  ctx: Parameters<Parameters<ExtensionAPI["registerTool"]>[0]["execute"]>[4],
19
+ configuredModelId: string,
18
20
  ) {
19
- const config = loadReviewConfig(ctx.cwd);
20
- const reviewer = resolveAgentReviewModel(ctx, config.agentModel);
21
+ const reviewer = resolveAgentReviewModel(ctx, configuredModelId);
21
22
  if (!reviewer)
22
- throw new Error(`Configured reviewer model "${config.agentModel}" is unavailable.`);
23
+ throw new Error(`Configured reviewer model "${configuredModelId}" is unavailable.`);
23
24
  return reviewer;
24
25
  }
25
26
 
@@ -82,6 +83,11 @@ export function makeRunReviewExecute(
82
83
  return async (_id, params, signal, onUpdate, ctx) => {
83
84
  const input = parseRunReviewToolInput(params);
84
85
  const config = loadReviewConfig(ctx.cwd);
86
+ const reviewerThinkingLevel = resolveReviewThinkingLevel(
87
+ config.reviewerThinkingLevel,
88
+ "Reviewer",
89
+ );
90
+ const reviewerModel = resolveReviewerModel(ctx, config.agentModel);
85
91
  const auditStore = config.auditEnabled ? localAuditStore : undefined;
86
92
  const { statusSpinner, wrappedUpdate } = wireSpinnerToProgress(ctx, onUpdate);
87
93
 
@@ -98,7 +104,8 @@ export function makeRunReviewExecute(
98
104
  target: input.target,
99
105
  review: input.review,
100
106
  scope: input.scope,
101
- reviewerModel: resolveReviewerModel(ctx),
107
+ reviewerModel,
108
+ reviewerThinkingLevel,
102
109
  ...(recoveryModel ? { recoveryModel } : {}),
103
110
  ...(config.recoveryModel !== "disabled" &&
104
111
  config.recoveryModel !== CURRENT_SESSION_REVIEW_MODEL &&