@theia/plugin 1.55.0-next.37 → 1.55.0-next.67

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/plugin",
3
- "version": "1.55.0-next.37+4e7843ca5",
3
+ "version": "1.55.0-next.67+8664face6",
4
4
  "description": "Theia - Plugin API",
5
5
  "types": "./src/theia.d.ts",
6
6
  "publishConfig": {
@@ -27,10 +27,10 @@
27
27
  "watch": "theiaext watch"
28
28
  },
29
29
  "devDependencies": {
30
- "@theia/ext-scripts": "1.54.0"
30
+ "@theia/ext-scripts": "1.55.0"
31
31
  },
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "4e7843ca5ce4625e3b4823b9a87debd805906fba"
35
+ "gitHead": "8664face680c050b8d544a381645259b6821a634"
36
36
  }
@@ -27,8 +27,24 @@ export module '@theia/plugin' {
27
27
  readonly ranges: Range[];
28
28
  }
29
29
 
30
+ export interface ConversationRequest {
31
+ readonly type: 'request';
32
+ readonly message: string;
33
+ }
34
+
35
+ export interface ConversationResponse {
36
+ readonly type: 'response';
37
+ readonly message: string;
38
+ readonly references?: DocumentContextItem[];
39
+ }
40
+
30
41
  export interface MappedEditsContext {
31
- documents: DocumentContextItem[][];
42
+ readonly documents: DocumentContextItem[][];
43
+ /**
44
+ * The conversation that led to the current code block(s).
45
+ * The last conversation part contains the code block(s) for which the code mapper should provide edits.
46
+ */
47
+ readonly conversation?: (ConversationRequest | ConversationResponse)[];
32
48
  }
33
49
 
34
50
  /**
@@ -38,9 +54,8 @@ export module '@theia/plugin' {
38
54
  /**
39
55
  * Provide mapped edits for a given document.
40
56
  * @param document The document to provide mapped edits for.
41
- * @param codeBlocks Code blocks that come from an LLM's reply.
42
- * "Insert at cursor" in the panel chat only sends one edit that the user clicks on, but inline chat can send multiple blocks
43
- * and let the lang server decide what to do with them.
57
+ * @param codeBlocks Code blocks that come from an LLM's reply. "Apply in Editor" in the panel chat only sends one edit that the user clicks on, but inline chat can send
58
+ * multiple blocks and let the lang server decide what to do with them.
44
59
  * @param context The context for providing mapped edits.
45
60
  * @param token A cancellation token.
46
61
  * @returns A provider result of text edits.
@@ -53,7 +68,33 @@ export module '@theia/plugin' {
53
68
  ): ProviderResult<WorkspaceEdit | null>;
54
69
  }
55
70
 
71
+ export interface MappedEditsRequest {
72
+ readonly codeBlocks: { code: string; resource: Uri }[];
73
+ // for every prior response that contains codeblocks, make sure we pass the code as well as the resources based on the reported codemapper URIs
74
+ readonly conversation: (ConversationRequest | ConversationResponse)[];
75
+ }
76
+
77
+ export interface MappedEditsResponseStream {
78
+ textEdit(target: Uri, edits: TextEdit | TextEdit[]): void;
79
+ }
80
+
81
+ export interface MappedEditsResult {
82
+ readonly errorMessage?: string;
83
+ }
84
+
85
+ /**
86
+ * Interface for providing mapped edits for a given document.
87
+ */
88
+ export interface MappedEditsProvider2 {
89
+ provideMappedEdits(
90
+ request: MappedEditsRequest,
91
+ result: MappedEditsResponseStream,
92
+ token: CancellationToken
93
+ ): ProviderResult<MappedEditsResult>;
94
+ }
95
+
56
96
  export namespace chat {
57
97
  export function registerMappedEditsProvider(documentSelector: DocumentSelector, provider: MappedEditsProvider): Disposable;
98
+ export function registerMappedEditsProvider2(provider: MappedEditsProvider2): Disposable;
58
99
  }
59
100
  }