@mrclrchtr/supi-code-runtime 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 (3) hide show
  1. package/package.json +1 -1
  2. package/src/api.ts +1 -0
  3. package/src/types.ts +51 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-code-runtime",
3
- "version": "11.4.0",
3
+ "version": "12.0.0",
4
4
  "description": "Shared workspace context and capability contracts for code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/api.ts CHANGED
@@ -60,6 +60,7 @@ export type {
60
60
  ImportData,
61
61
  NodeAtData,
62
62
  OutlineData,
63
+ RefactorActionIdentity,
63
64
  RefactorOperation,
64
65
  RefactorRequest,
65
66
  RefactorResult,
package/src/types.ts CHANGED
@@ -193,31 +193,53 @@ export interface WorkspaceEdit {
193
193
  }
194
194
 
195
195
  /**
196
- * Supported refactor operation names for the current semantic planning path.
197
- */
198
- export type RefactorOperation =
199
- | "rename_symbol"
200
- | "extract_function"
201
- | "extract_variable"
202
- | "rename_file"
203
- | "move_file"
204
- | "update_imports"
205
- | "delete_dead_code";
206
-
207
- /**
208
- * Operation-aware refactor planning request.
196
+ * Operation-aware refactor planning request. Each operation carries only the
197
+ * scope it needs:
209
198
  *
210
- * Consumers provide a target file/position plus operation-specific options.
211
- * File/resource operations remain requestable so providers can reject them
212
- * explicitly and honestly until shared workspace-edit resource ops exist.
199
+ * - `rename_symbol`: one symbol position and the new name.
200
+ * - `code_action`: one file range and a CodeActionKind prefix under `refactor`.
201
+ * - `source_action`: one whole file and a CodeActionKind prefix under `source`.
202
+ *
203
+ * `kind` matches the requested kind and its dotted sub-kinds. `title`, when
204
+ * present, selects one action by its exact title.
213
205
  */
214
- export interface RefactorRequest {
215
- operation: RefactorOperation;
216
- file: string;
217
- position: CodePosition;
218
- range?: SourceRange;
219
- newName?: string;
220
- destination?: string;
206
+ export type RefactorRequest =
207
+ | {
208
+ operation: "rename_symbol";
209
+ file: string;
210
+ position: CodePosition;
211
+ newName: string;
212
+ }
213
+ | {
214
+ operation: "code_action";
215
+ file: string;
216
+ range: SourceRange;
217
+ kind: string;
218
+ title?: string;
219
+ }
220
+ | {
221
+ operation: "source_action";
222
+ file: string;
223
+ kind: string;
224
+ title?: string;
225
+ };
226
+
227
+ /** Supported refactor operation names. */
228
+ export type RefactorOperation = RefactorRequest["operation"];
229
+
230
+ /** The code action selected for a precise code- or source-action plan. */
231
+ export interface RefactorActionIdentity {
232
+ /** Server-reported CodeActionKind. */
233
+ kind: string;
234
+ /** Server-reported action title. */
235
+ title: string;
236
+ /**
237
+ * How the edits were obtained: `edit` from the action itself (after
238
+ * `codeAction/resolve` when needed), or `captured-command` from the single
239
+ * `workspace/applyEdit` the server pushed while running the action's command.
240
+ * Captured edits were refused, never applied.
241
+ */
242
+ provenance?: "edit" | "captured-command";
221
243
  }
222
244
 
223
245
  /**
@@ -228,6 +250,10 @@ export interface DisambiguationCandidate {
228
250
  file?: string;
229
251
  line?: number;
230
252
  character?: number;
253
+ /** Server-reported CodeActionKind, for code-action candidates. */
254
+ kind?: string;
255
+ /** Exact action title to pass back as `title`, for code-action candidates. */
256
+ title?: string;
231
257
  }
232
258
 
233
259
  /**
@@ -241,6 +267,8 @@ export type RefactorResult =
241
267
  | {
242
268
  kind: "precise";
243
269
  edits: WorkspaceEdit;
270
+ /** The selected code action, for code- and source-action plans. */
271
+ action?: RefactorActionIdentity;
244
272
  /** Provider roots authorized by the semantic route. Consumers canonicalize before storage. */
245
273
  authorizedMutationRoots: string[];
246
274
  }