@mrclrchtr/supi-review 11.4.0 → 12.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 (101) hide show
  1. package/CHANGELOG.md +5 -0
  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/package.json +2 -2
  4. package/node_modules/@mrclrchtr/supi-code-intelligence/CHANGELOG.md +22 -0
  5. package/node_modules/@mrclrchtr/supi-code-intelligence/README.md +13 -7
  6. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  7. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
  8. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
  9. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  10. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/README.md +21 -16
  11. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  12. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
  13. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
  14. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  15. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  16. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/api.ts +2 -2
  17. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +13 -3
  18. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +25 -9
  19. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +7 -5
  20. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-edit-capture.ts +258 -0
  21. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +64 -11
  22. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +8 -0
  23. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +48 -79
  24. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +3 -1
  25. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +21 -35
  26. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-command-capture.ts +139 -0
  27. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +202 -47
  28. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/route-boundary.ts +26 -0
  29. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +57 -12
  30. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +3 -0
  31. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +22 -1
  32. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  33. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -0
  34. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +51 -23
  35. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  36. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  37. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/coordinates.ts +16 -2
  38. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +3 -2
  39. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-errors.ts +2 -0
  40. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-range.ts +94 -0
  41. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +26 -6
  42. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +6 -3
  43. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +13 -4
  44. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +1 -9
  45. package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +5 -5
  46. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/server-status.ts +41 -12
  47. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/anchored-structural.ts +4 -1
  48. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/symbol.ts +1 -1
  49. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-types.ts +8 -4
  50. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-workflow.ts +11 -16
  51. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/input/health-refactor.ts +48 -34
  52. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/input/workflows.ts +45 -46
  53. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/inspect/file-point.ts +2 -2
  54. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/inspect-types.ts +1 -1
  55. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/inspect-workflow.ts +3 -3
  56. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-file-actions.ts +122 -0
  57. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-plan-pipeline.ts +152 -0
  58. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-plans.ts +18 -15
  59. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-types.ts +24 -12
  60. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-workflow.ts +68 -243
  61. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/execute.ts +6 -7
  62. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/spec.ts +9 -16
  63. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/tui.ts +12 -6
  64. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/spec.ts +6 -0
  65. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/spec.ts +6 -0
  66. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/structured-schema.ts +4 -4
  67. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/structured.ts +15 -17
  68. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/execute.ts +1 -1
  69. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/markdown.ts +33 -6
  70. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/result.ts +1 -1
  71. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/spec.ts +14 -6
  72. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/structured.ts +2 -2
  73. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/tui.ts +2 -2
  74. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/spec.ts +8 -0
  75. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/result.ts +2 -1
  76. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/spec.ts +7 -0
  77. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/execute.ts +0 -2
  78. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/result.ts +23 -13
  79. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/spec.ts +8 -2
  80. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/structured.ts +59 -12
  81. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/tui.ts +14 -17
  82. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/markdown.ts +1 -1
  83. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/spec.ts +6 -0
  84. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/namespace.ts +14 -0
  85. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/refactor-markdown.ts +55 -15
  86. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/register.ts +3 -0
  87. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/refactor-preview.ts +118 -0
  88. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/refactor-unavailable.ts +16 -0
  89. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/refactor.ts +8 -2
  90. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/schemas.ts +63 -20
  91. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/specs.ts +3 -0
  92. package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/status-overlay.ts +1 -1
  93. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  94. package/package.json +4 -4
  95. package/src/tool/namespace.ts +11 -0
  96. package/src/tool/review_audit/register.ts +2 -0
  97. package/src/tool/review_audit/spec.ts +7 -0
  98. package/src/tool/review_output/register.ts +2 -0
  99. package/src/tool/review_output/spec.ts +6 -0
  100. package/src/tool/review_run/child-tools.ts +15 -0
  101. package/src/tool/review_run/spec.ts +8 -0
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Readable preview entries for refactor plans.
3
+ *
4
+ * Some servers (kotlin-lsp) return minimal character-level edits, so renaming
5
+ * `total` to `sumDoubled` arrives as `sumD`, `ub`, `ed`. The preview combines
6
+ * consecutive single-line edits on one line into one before/after entry. The
7
+ * stored plan and its edits stay exactly as the server returned them.
8
+ */
9
+
10
+ import { readFileSync } from "node:fs";
11
+ import type { FileEdit } from "@mrclrchtr/supi-code-runtime/api";
12
+
13
+ /** One preview entry: a server edit as is, or several edits on one line combined. */
14
+ export type RefactorPreviewEntry =
15
+ | { readonly kind: "edit"; readonly edit: FileEdit }
16
+ | {
17
+ readonly kind: "line";
18
+ readonly file: string;
19
+ /** Zero-based line and UTF-16 span covering every combined edit. */
20
+ readonly line: number;
21
+ readonly startCharacter: number;
22
+ readonly endCharacter: number;
23
+ readonly before: string;
24
+ readonly after: string;
25
+ readonly editCount: number;
26
+ };
27
+
28
+ /**
29
+ * Number of leading edits to show so that at least `maxResults` are shown and
30
+ * the last shown edit does not split a group of edits on the same line.
31
+ */
32
+ export function previewEditCount(edits: readonly FileEdit[], maxResults: number): number {
33
+ let count = Math.min(Math.max(0, maxResults), edits.length);
34
+ while (count > 0 && count < edits.length) {
35
+ const last = edits[count - 1] as FileEdit;
36
+ const next = edits[count] as FileEdit;
37
+ if (!isInlineEdit(last) || !isInlineEdit(next) || !sameLine(last, next)) break;
38
+ count++;
39
+ }
40
+ return count;
41
+ }
42
+
43
+ /** Combine consecutive edits on one line when the current file text allows it. */
44
+ export function buildRefactorPreview(edits: readonly FileEdit[]): RefactorPreviewEntry[] {
45
+ const lines = new Map<string, readonly string[] | null>();
46
+ const entries: RefactorPreviewEntry[] = [];
47
+ for (let index = 0; index < edits.length; ) {
48
+ let end = index + 1;
49
+ const first = edits[index] as FileEdit;
50
+ while (
51
+ end < edits.length &&
52
+ isInlineEdit(first) &&
53
+ isInlineEdit(edits[end] as FileEdit) &&
54
+ sameLine(first, edits[end] as FileEdit)
55
+ ) {
56
+ end++;
57
+ }
58
+ const group = edits.slice(index, end);
59
+ const combined = group.length > 1 ? combineLine(group, fileLines(first.file, lines)) : null;
60
+ if (combined) entries.push(combined);
61
+ else entries.push(...group.map((edit) => ({ kind: "edit" as const, edit })));
62
+ index = end;
63
+ }
64
+ return entries;
65
+ }
66
+
67
+ function isInlineEdit(edit: FileEdit): boolean {
68
+ return edit.range.start.line === edit.range.end.line && !/[\r\n]/u.test(edit.newText);
69
+ }
70
+
71
+ function sameLine(a: FileEdit, b: FileEdit): boolean {
72
+ return a.file === b.file && a.range.start.line === b.range.start.line;
73
+ }
74
+
75
+ function fileLines(
76
+ file: string,
77
+ cache: Map<string, readonly string[] | null>,
78
+ ): readonly string[] | null {
79
+ if (!cache.has(file)) {
80
+ try {
81
+ cache.set(file, readFileSync(file, "utf8").split(/\r\n|\r|\n/u));
82
+ } catch {
83
+ cache.set(file, null);
84
+ }
85
+ }
86
+ return cache.get(file) ?? null;
87
+ }
88
+
89
+ /** Apply sorted, non-overlapping edits to their line; null when that is not possible. */
90
+ function combineLine(
91
+ group: readonly FileEdit[],
92
+ lines: readonly string[] | null,
93
+ ): RefactorPreviewEntry | null {
94
+ const first = group[0] as FileEdit;
95
+ const text = lines?.[first.range.start.line];
96
+ if (text === undefined) return null;
97
+ const sorted = [...group].sort((a, b) => a.range.start.character - b.range.start.character);
98
+ let after = "";
99
+ let cursor = (sorted[0] as FileEdit).range.start.character;
100
+ const startCharacter = cursor;
101
+ for (const edit of sorted) {
102
+ const { start, end } = edit.range;
103
+ if (start.character < cursor || end.character < start.character) return null;
104
+ if (end.character > text.length) return null;
105
+ after += text.slice(cursor, start.character) + edit.newText;
106
+ cursor = end.character;
107
+ }
108
+ return {
109
+ kind: "line",
110
+ file: first.file,
111
+ line: first.range.start.line,
112
+ startCharacter,
113
+ endCharacter: cursor,
114
+ before: text.slice(startCharacter, cursor),
115
+ after,
116
+ editCount: group.length,
117
+ };
118
+ }
@@ -0,0 +1,16 @@
1
+ /** Unavailable reasons shared by code_refactor_plan and code_refactor_apply. */
2
+
3
+ /** supi-lsp text for a request superseded by a file change while it ran. */
4
+ const SEMANTIC_INPUT_CHANGED = "Semantic input changed";
5
+ const CONCURRENT_EDIT_HINT = "Retry after concurrent edits finish.";
6
+
7
+ /**
8
+ * Add a recovery hint to a reason caused by a concurrent edit, for example a
9
+ * plan running in parallel with an apply. Other reasons are returned unchanged.
10
+ */
11
+ export function refactorUnavailableReason(reason: string): string {
12
+ if (!reason.includes(SEMANTIC_INPUT_CHANGED) || reason.includes(CONCURRENT_EDIT_HINT)) {
13
+ return reason;
14
+ }
15
+ return `${reason} ${CONCURRENT_EDIT_HINT}`;
16
+ }
@@ -5,6 +5,7 @@ import { toDisplayPath } from "../../analysis/search/paths.ts";
5
5
  import type { RefactorPlan } from "../../session/refactor-plans.ts";
6
6
  import { assembledNextQueries, assembleToolResult, type ToolResultAssembly } from "./assembly.ts";
7
7
  import { createToolDisplaySection } from "./display.ts";
8
+ import { previewEditCount } from "./refactor-preview.ts";
8
9
  import type { SearchDetails, ToolDisplaySection } from "./types.ts";
9
10
 
10
11
  export interface RefactorPlanAssemblyData {
@@ -45,7 +46,7 @@ export function assembleRefactorPlanDetails(
45
46
  const edits = createEvidenceList({
46
47
  key: "refactor.edits",
47
48
  items: [...plan.edits.edits],
48
- maxResults,
49
+ maxResults: previewEditCount(plan.edits.edits, maxResults),
49
50
  });
50
51
  const evidenceSource = plan.evidenceSource ?? "semantic";
51
52
  const provenance = [
@@ -67,7 +68,12 @@ export function assembleRefactorPlanDetails(
67
68
  },
68
69
  ],
69
70
  evidenceLists: [edits.metadata],
70
- nextQueries: [`Use code_refactor_apply with planId: "${plan.id}" to apply this refactor`],
71
+ nextQueries: [
72
+ `Use code_refactor_apply with planId: "${plan.id}" to apply this refactor`,
73
+ ...(plan.operation === "code_action"
74
+ ? ["After applying, use rename_symbol to rename any server-generated names"]
75
+ : []),
76
+ ],
71
77
  candidateCount: edits.metadata.totalCount ?? edits.metadata.shownCount,
72
78
  confidence: evidenceSource,
73
79
  provenance,
@@ -4,11 +4,12 @@ import {
4
4
  type PublicRefactorOperationName,
5
5
  } from "../session/refactor-types.ts";
6
6
  import { TARGET_SYMBOL_KINDS } from "../session/target-input.ts";
7
+ import { CODE_FIND_AST_KINDS } from "./code_find/ast-kinds.ts";
7
8
 
8
9
  export const ScopeParam = Type.String({
9
10
  description: "Workspace-relative file or directory scope.",
10
11
  });
11
- export const FindScopeParam = Type.Array(
12
+ export const FindScopesParam = Type.Array(
12
13
  Type.String({ description: "Workspace-relative search scope." }),
13
14
  {
14
15
  description: "One or more workspace-relative search scopes.",
@@ -20,11 +21,6 @@ export const QueryParam = Type.String({
20
21
  description: "Human or code reference to resolve or search for.",
21
22
  minLength: 1,
22
23
  });
23
- export const FindQueryParam = Type.String({
24
- description:
25
- "AST mode: name or import module-specifier substring. Semantic mode: workspace-symbol query.",
26
- minLength: 1,
27
- });
28
24
  const LineParam = Type.Integer({ description: "1-based line.", minimum: 1 });
29
25
  const CharacterParam = Type.Integer({
30
26
  description: "1-based UTF-16 column.",
@@ -74,6 +70,29 @@ function exactOneSelector(properties: Record<string, TSchema>, description: stri
74
70
  });
75
71
  }
76
72
 
73
+ export const FindSearchParam = exactOneSelector(
74
+ {
75
+ ast: Type.Object(
76
+ {
77
+ kind: Type.Enum(CODE_FIND_AST_KINDS, {
78
+ type: "string",
79
+ description: "AST structure kind.",
80
+ }),
81
+ query: Type.String({
82
+ description: "Name or import module-specifier substring.",
83
+ minLength: 1,
84
+ }),
85
+ },
86
+ { additionalProperties: false, description: "Structural search over syntax trees." },
87
+ ),
88
+ semantic: Type.Object(
89
+ { query: Type.String({ description: "Workspace-symbol query.", minLength: 1 }) },
90
+ { additionalProperties: false, description: "Language-server workspace-symbol search." },
91
+ ),
92
+ },
93
+ "Exactly one search mode.",
94
+ );
95
+
77
96
  export const ResolveTargetParam = exactOneSelector(
78
97
  {
79
98
  anchor: SourcePointParam,
@@ -112,7 +131,7 @@ export const OrientationFocusParam = exactOneSelector(
112
131
  "Exactly one Orientation focus.",
113
132
  );
114
133
 
115
- export const RefactorTargetParam = exactOneSelector(
134
+ const RefactorTargetParam = exactOneSelector(
116
135
  {
117
136
  handle: Type.String({ description: "Target handle from a previous code tool result." }),
118
137
  anchor: SourcePointParam,
@@ -131,28 +150,52 @@ const RangeParam = Type.Object(
131
150
  { additionalProperties: false },
132
151
  ),
133
152
  },
134
- { additionalProperties: false },
153
+ {
154
+ additionalProperties: false,
155
+ description: "Source range; end is exclusive. Equal start and end mark a cursor position.",
156
+ },
135
157
  );
136
158
 
137
159
  const NewNameParam = Type.String({ description: "New symbol name.", minLength: 1 });
160
+ const ActionTitleParam = Type.String({
161
+ description:
162
+ "Exact action title from a previous ambiguous result; selects one of several matching actions.",
163
+ minLength: 1,
164
+ });
138
165
 
139
166
  const RefactorOperationProperties = {
140
- rename_symbol: Type.Object({ newName: NewNameParam }, { additionalProperties: false }),
141
- extract_function: Type.Object(
142
- { newName: NewNameParam, range: RangeParam },
143
- { additionalProperties: false },
144
- ),
145
- extract_variable: Type.Object(
146
- { newName: NewNameParam, range: RangeParam },
147
- { additionalProperties: false },
167
+ rename_symbol: Type.Object(
168
+ { target: RefactorTargetParam, newName: NewNameParam },
169
+ { additionalProperties: false, description: "Rename one symbol across the workspace." },
148
170
  ),
149
- update_imports: Type.Object({}, { additionalProperties: false }),
150
- delete_dead_code: Type.Object(
151
- {},
171
+ code_action: Type.Object(
172
+ {
173
+ file: FileParam,
174
+ range: RangeParam,
175
+ kind: Type.String({
176
+ description:
177
+ 'CodeActionKind prefix under "refactor", such as "refactor.extract" or "refactor.inline". Sub-kinds match.',
178
+ pattern: "^refactor(\\..+)?$",
179
+ }),
180
+ title: Type.Optional(ActionTitleParam),
181
+ },
152
182
  {
153
183
  additionalProperties: false,
154
- description: "Remove server-supported unused code; support may be limited to unused imports.",
184
+ description:
185
+ "Server refactor action for one range. Generated names (e.g. extracted variables) appear in the preview; rename them afterwards with rename_symbol.",
186
+ },
187
+ ),
188
+ source_action: Type.Object(
189
+ {
190
+ file: FileParam,
191
+ kind: Type.String({
192
+ description:
193
+ 'CodeActionKind prefix under "source", such as "source.organizeImports" or "source.fixAll". Sub-kinds match.',
194
+ pattern: "^source(\\..+)?$",
195
+ }),
196
+ title: Type.Optional(ActionTitleParam),
155
197
  },
198
+ { additionalProperties: false, description: "Server source action for one whole file." },
156
199
  ),
157
200
  } satisfies Record<PublicRefactorOperationName, TSchema>;
158
201
 
@@ -1,3 +1,4 @@
1
+ import type { ToolAnnotations } from "@earendil-works/pi-coding-agent";
1
2
  import type { Component } from "@earendil-works/pi-tui";
2
3
  import type { TSchema } from "typebox";
3
4
  import type {
@@ -27,6 +28,8 @@ export type CodeToolRendererFn = (...args: any[]) => Component;
27
28
  export interface CodeIntelligenceToolDefinitionSpec {
28
29
  name: CodeIntelligenceToolName;
29
30
  label: string;
31
+ /** Audited behavior hints for permission extensions (MCP tool-annotation semantics). */
32
+ annotations: ToolAnnotations;
30
33
  parameters: TSchema;
31
34
  /** Machine-readable success and recoverable-input outcomes for programmatic callers. */
32
35
  outputSchema?: TSchema;
@@ -618,7 +618,7 @@ export class CiStatusDialog {
618
618
  text(
619
619
  t.fg(
620
620
  "dim",
621
- ` ${operation}: server ${support.server}; SuPi ${support.supi}${support.reason ? ` — ${support.reason}` : ""}`,
621
+ ` ${operation}: server ${support.server}; SuPi ${support.supi}${support.kinds?.length ? `; kinds ${support.kinds.join(", ")}` : ""}${support.anyKind ? "; may return any kind" : ""}${support.reason ? ` — ${support.reason}` : ""}`,
622
622
  ),
623
623
  );
624
624
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "11.4.0",
3
+ "version": "12.0.0",
4
4
  "description": "Shared settings, configuration, reporting, and session infrastructure",
5
5
  "license": "MIT",
6
6
  "repository": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-review",
3
- "version": "11.4.0",
3
+ "version": "12.0.0",
4
4
  "description": "Parallel inspection-only reviews of exact Git targets",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,9 +32,9 @@
32
32
  "README.md"
33
33
  ],
34
34
  "dependencies": {
35
- "@mrclrchtr/supi-agent-runtime": "11.4.0",
36
- "@mrclrchtr/supi-core": "11.4.0",
37
- "@mrclrchtr/supi-code-intelligence": "11.4.0"
35
+ "@mrclrchtr/supi-agent-runtime": "12.0.0",
36
+ "@mrclrchtr/supi-code-intelligence": "12.0.0",
37
+ "@mrclrchtr/supi-core": "12.0.0"
38
38
  },
39
39
  "bundledDependencies": [
40
40
  "@mrclrchtr/supi-agent-runtime",
@@ -0,0 +1,11 @@
1
+ import type { ToolNamespace } from "@earendil-works/pi-coding-agent";
2
+
3
+ /** Codemode namespace shared by the script-callable Review tools. */
4
+ export const REVIEW_TOOL_NAMESPACE: ToolNamespace = {
5
+ name: "review",
6
+ description: "Read Review reports and reviewer replays produced by review_run or /supi-review.",
7
+ instructions: [
8
+ "review_output reads a report artifact by the artifactId that review_run or /supi-review returned.",
9
+ "review_audit lists local reviewer replays; start with the Replay Outline before message or raw views.",
10
+ ].join("\n"),
11
+ };
@@ -1,5 +1,6 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import type { LocalReviewAuditStore } from "../../audit/local-review-audit-store.ts";
3
+ import { REVIEW_TOOL_NAMESPACE } from "../namespace.ts";
3
4
  import { executeReviewAudit } from "./execute.ts";
4
5
  import { promptGuidelines, promptSnippet, toolDescription } from "./guidance.ts";
5
6
  import { renderAuditCall, renderAuditResult } from "./render.ts";
@@ -9,6 +10,7 @@ import { reviewAuditSpec } from "./spec.ts";
9
10
  export function registerReviewAuditTool(pi: ExtensionAPI, store: LocalReviewAuditStore): void {
10
11
  pi.registerTool({
11
12
  ...reviewAuditSpec,
13
+ namespace: REVIEW_TOOL_NAMESPACE,
12
14
  description: toolDescription,
13
15
  promptSnippet,
14
16
  promptGuidelines: [...promptGuidelines],
@@ -41,6 +41,13 @@ const reviewAuditParameters = Type.Object(
41
41
  export const reviewAuditSpec = {
42
42
  name: REVIEW_AUDIT_TOOL_NAME,
43
43
  label: REVIEW_AUDIT_TOOL_LABEL,
44
+ // Reading prunes only expired SuPi-owned replay files that no call can return.
45
+ annotations: {
46
+ readOnlyHint: true,
47
+ destructiveHint: false,
48
+ idempotentHint: true,
49
+ openWorldHint: false,
50
+ },
44
51
  parameters: reviewAuditParameters,
45
52
  outputSchema: reviewAuditOutputSchema,
46
53
  } as const;
@@ -1,5 +1,6 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import type { ReviewArtifactStore } from "../../session/review-artifact-store.ts";
3
+ import { REVIEW_TOOL_NAMESPACE } from "../namespace.ts";
3
4
  import { executeReviewOutput } from "./execute.ts";
4
5
  import { promptGuidelines, promptSnippet, toolDescription } from "./guidance.ts";
5
6
  import { renderOutputCall, renderOutputResult } from "./render.ts";
@@ -9,6 +10,7 @@ import { reviewOutputSpec } from "./spec.ts";
9
10
  export function registerReviewOutputTool(pi: ExtensionAPI, store: ReviewArtifactStore): void {
10
11
  pi.registerTool({
11
12
  ...reviewOutputSpec,
13
+ namespace: REVIEW_TOOL_NAMESPACE,
12
14
  description: toolDescription,
13
15
  promptSnippet,
14
16
  promptGuidelines: [...promptGuidelines],
@@ -25,6 +25,12 @@ const reviewOutputParameters = Type.Object(
25
25
  export const reviewOutputSpec = {
26
26
  name: REVIEW_OUTPUT_TOOL_NAME,
27
27
  label: REVIEW_OUTPUT_TOOL_LABEL,
28
+ annotations: {
29
+ readOnlyHint: true,
30
+ destructiveHint: false,
31
+ idempotentHint: true,
32
+ openWorldHint: false,
33
+ },
28
34
  parameters: reviewOutputParameters,
29
35
  outputSchema: Type.Object(
30
36
  {
@@ -17,6 +17,18 @@ const declineReviewRecoverySchema = Type.Object(
17
17
  { additionalProperties: false },
18
18
  );
19
19
 
20
+ /**
21
+ * Hints shared by the child-only tools: each records one in-memory result and ends its child
22
+ * session without touching files or the network. A repeated call overwrites or conflicts with
23
+ * the first, so none is idempotent.
24
+ */
25
+ const CHILD_TOOL_ANNOTATIONS = {
26
+ readOnlyHint: false,
27
+ destructiveHint: false,
28
+ idempotentHint: false,
29
+ openWorldHint: false,
30
+ } as const;
31
+
20
32
  /** Canonical metadata for the child-session tools owned by the review_run workflow. */
21
33
  export const REVIEW_CHILD_TOOL_SPECS = {
22
34
  submitReview: {
@@ -25,6 +37,7 @@ export const REVIEW_CHILD_TOOL_SPECS = {
25
37
  description:
26
38
  "Submit the one final structured result for this review task. A successful call ends the Reviewer Session.",
27
39
  exposure: "model-only",
40
+ annotations: CHILD_TOOL_ANNOTATIONS,
28
41
  parameters: reviewSubmissionSchema,
29
42
  },
30
43
  declineReviewRecovery: {
@@ -33,6 +46,7 @@ export const REVIEW_CHILD_TOOL_SPECS = {
33
46
  description:
34
47
  "End Submission Recovery without a Task Verdict when retained history cannot support a valid review submission.",
35
48
  exposure: "model-only",
49
+ annotations: CHILD_TOOL_ANNOTATIONS,
36
50
  parameters: declineReviewRecoverySchema,
37
51
  },
38
52
  submitPlannerDraft: {
@@ -40,6 +54,7 @@ export const REVIEW_CHILD_TOOL_SPECS = {
40
54
  label: "Submit Planner Draft",
41
55
  description:
42
56
  "Submit the one advisory Planner Draft. A successful call ends the Planner Session.",
57
+ annotations: CHILD_TOOL_ANNOTATIONS,
43
58
  parameters: plannerDraftSchema,
44
59
  },
45
60
  } as const;
@@ -7,6 +7,14 @@ export const REVIEW_RUN_TOOL_LABEL = "Run Review";
7
7
  export const reviewRunSpec = {
8
8
  name: REVIEW_RUN_TOOL_NAME,
9
9
  label: REVIEW_RUN_TOOL_LABEL,
10
+ // Starts model-backed Reviewer Sessions (optionally with Web tools) and may store replays.
11
+ // Reviewers get bash; inspection-only is a protocol, not access control.
12
+ annotations: {
13
+ readOnlyHint: false,
14
+ destructiveHint: true,
15
+ idempotentHint: false,
16
+ openWorldHint: true,
17
+ },
10
18
  parameters: runReviewSchema,
11
19
  // Start Reviews only through direct model calls.
12
20
  exposure: "model-only",