@vybestack/llxprt-code-ide-integration 0.10.0-nightly.260613.1adad3b34
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/dist/.last_build +0 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/src/ide/constants.d.ts +6 -0
- package/dist/src/ide/constants.js +7 -0
- package/dist/src/ide/constants.js.map +1 -0
- package/dist/src/ide/detect-ide.d.ts +64 -0
- package/dist/src/ide/detect-ide.js +78 -0
- package/dist/src/ide/detect-ide.js.map +1 -0
- package/dist/src/ide/ide-client.d.ts +77 -0
- package/dist/src/ide/ide-client.js +440 -0
- package/dist/src/ide/ide-client.js.map +1 -0
- package/dist/src/ide/ide-installer.d.ts +14 -0
- package/dist/src/ide/ide-installer.js +116 -0
- package/dist/src/ide/ide-installer.js.map +1 -0
- package/dist/src/ide/ideContext.d.ts +415 -0
- package/dist/src/ide/ideContext.js +162 -0
- package/dist/src/ide/ideContext.js.map +1 -0
- package/dist/src/ide/index.d.ts +11 -0
- package/dist/src/ide/index.js +12 -0
- package/dist/src/ide/index.js.map +1 -0
- package/dist/src/ide/process-utils.d.ts +21 -0
- package/dist/src/ide/process-utils.js +198 -0
- package/dist/src/ide/process-utils.js.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lsp/index.d.ts +7 -0
- package/dist/src/lsp/index.js +7 -0
- package/dist/src/lsp/index.js.map +1 -0
- package/dist/src/lsp/lsp-service-client.d.ts +37 -0
- package/dist/src/lsp/lsp-service-client.js +415 -0
- package/dist/src/lsp/lsp-service-client.js.map +1 -0
- package/dist/src/lsp/types.d.ts +45 -0
- package/dist/src/lsp/types.js +3 -0
- package/dist/src/lsp/types.js.map +1 -0
- package/dist/src/utils/paths.d.ts +13 -0
- package/dist/src/utils/paths.js +24 -0
- package/dist/src/utils/paths.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
/**
|
|
8
|
+
* Zod schema for validating a file context from the IDE.
|
|
9
|
+
*/
|
|
10
|
+
export declare const FileSchema: z.ZodObject<{
|
|
11
|
+
path: z.ZodString;
|
|
12
|
+
timestamp: z.ZodNumber;
|
|
13
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
selectedText: z.ZodOptional<z.ZodString>;
|
|
15
|
+
cursor: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
line: z.ZodNumber;
|
|
17
|
+
character: z.ZodNumber;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
line: number;
|
|
20
|
+
character: number;
|
|
21
|
+
}, {
|
|
22
|
+
line: number;
|
|
23
|
+
character: number;
|
|
24
|
+
}>>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
path: string;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
cursor?: {
|
|
29
|
+
line: number;
|
|
30
|
+
character: number;
|
|
31
|
+
} | undefined;
|
|
32
|
+
isActive?: boolean | undefined;
|
|
33
|
+
selectedText?: string | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
path: string;
|
|
36
|
+
timestamp: number;
|
|
37
|
+
cursor?: {
|
|
38
|
+
line: number;
|
|
39
|
+
character: number;
|
|
40
|
+
} | undefined;
|
|
41
|
+
isActive?: boolean | undefined;
|
|
42
|
+
selectedText?: string | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
export type File = z.infer<typeof FileSchema>;
|
|
45
|
+
export declare const IdeContextSchema: z.ZodObject<{
|
|
46
|
+
workspaceState: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
openFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
48
|
+
path: z.ZodString;
|
|
49
|
+
timestamp: z.ZodNumber;
|
|
50
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
+
selectedText: z.ZodOptional<z.ZodString>;
|
|
52
|
+
cursor: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
line: z.ZodNumber;
|
|
54
|
+
character: z.ZodNumber;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
line: number;
|
|
57
|
+
character: number;
|
|
58
|
+
}, {
|
|
59
|
+
line: number;
|
|
60
|
+
character: number;
|
|
61
|
+
}>>;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
path: string;
|
|
64
|
+
timestamp: number;
|
|
65
|
+
cursor?: {
|
|
66
|
+
line: number;
|
|
67
|
+
character: number;
|
|
68
|
+
} | undefined;
|
|
69
|
+
isActive?: boolean | undefined;
|
|
70
|
+
selectedText?: string | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
path: string;
|
|
73
|
+
timestamp: number;
|
|
74
|
+
cursor?: {
|
|
75
|
+
line: number;
|
|
76
|
+
character: number;
|
|
77
|
+
} | undefined;
|
|
78
|
+
isActive?: boolean | undefined;
|
|
79
|
+
selectedText?: string | undefined;
|
|
80
|
+
}>, "many">>;
|
|
81
|
+
isTrusted: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
openFiles?: {
|
|
84
|
+
path: string;
|
|
85
|
+
timestamp: number;
|
|
86
|
+
cursor?: {
|
|
87
|
+
line: number;
|
|
88
|
+
character: number;
|
|
89
|
+
} | undefined;
|
|
90
|
+
isActive?: boolean | undefined;
|
|
91
|
+
selectedText?: string | undefined;
|
|
92
|
+
}[] | undefined;
|
|
93
|
+
isTrusted?: boolean | undefined;
|
|
94
|
+
}, {
|
|
95
|
+
openFiles?: {
|
|
96
|
+
path: string;
|
|
97
|
+
timestamp: number;
|
|
98
|
+
cursor?: {
|
|
99
|
+
line: number;
|
|
100
|
+
character: number;
|
|
101
|
+
} | undefined;
|
|
102
|
+
isActive?: boolean | undefined;
|
|
103
|
+
selectedText?: string | undefined;
|
|
104
|
+
}[] | undefined;
|
|
105
|
+
isTrusted?: boolean | undefined;
|
|
106
|
+
}>>;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
workspaceState?: {
|
|
109
|
+
openFiles?: {
|
|
110
|
+
path: string;
|
|
111
|
+
timestamp: number;
|
|
112
|
+
cursor?: {
|
|
113
|
+
line: number;
|
|
114
|
+
character: number;
|
|
115
|
+
} | undefined;
|
|
116
|
+
isActive?: boolean | undefined;
|
|
117
|
+
selectedText?: string | undefined;
|
|
118
|
+
}[] | undefined;
|
|
119
|
+
isTrusted?: boolean | undefined;
|
|
120
|
+
} | undefined;
|
|
121
|
+
}, {
|
|
122
|
+
workspaceState?: {
|
|
123
|
+
openFiles?: {
|
|
124
|
+
path: string;
|
|
125
|
+
timestamp: number;
|
|
126
|
+
cursor?: {
|
|
127
|
+
line: number;
|
|
128
|
+
character: number;
|
|
129
|
+
} | undefined;
|
|
130
|
+
isActive?: boolean | undefined;
|
|
131
|
+
selectedText?: string | undefined;
|
|
132
|
+
}[] | undefined;
|
|
133
|
+
isTrusted?: boolean | undefined;
|
|
134
|
+
} | undefined;
|
|
135
|
+
}>;
|
|
136
|
+
export type IdeContext = z.infer<typeof IdeContextSchema>;
|
|
137
|
+
/**
|
|
138
|
+
* Zod schema for validating the 'ide/contextUpdate' notification from the IDE.
|
|
139
|
+
*/
|
|
140
|
+
export declare const IdeContextNotificationSchema: z.ZodObject<{
|
|
141
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
142
|
+
method: z.ZodLiteral<"ide/contextUpdate">;
|
|
143
|
+
params: z.ZodObject<{
|
|
144
|
+
workspaceState: z.ZodOptional<z.ZodObject<{
|
|
145
|
+
openFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
|
+
path: z.ZodString;
|
|
147
|
+
timestamp: z.ZodNumber;
|
|
148
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
+
selectedText: z.ZodOptional<z.ZodString>;
|
|
150
|
+
cursor: z.ZodOptional<z.ZodObject<{
|
|
151
|
+
line: z.ZodNumber;
|
|
152
|
+
character: z.ZodNumber;
|
|
153
|
+
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
line: number;
|
|
155
|
+
character: number;
|
|
156
|
+
}, {
|
|
157
|
+
line: number;
|
|
158
|
+
character: number;
|
|
159
|
+
}>>;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
path: string;
|
|
162
|
+
timestamp: number;
|
|
163
|
+
cursor?: {
|
|
164
|
+
line: number;
|
|
165
|
+
character: number;
|
|
166
|
+
} | undefined;
|
|
167
|
+
isActive?: boolean | undefined;
|
|
168
|
+
selectedText?: string | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
path: string;
|
|
171
|
+
timestamp: number;
|
|
172
|
+
cursor?: {
|
|
173
|
+
line: number;
|
|
174
|
+
character: number;
|
|
175
|
+
} | undefined;
|
|
176
|
+
isActive?: boolean | undefined;
|
|
177
|
+
selectedText?: string | undefined;
|
|
178
|
+
}>, "many">>;
|
|
179
|
+
isTrusted: z.ZodOptional<z.ZodBoolean>;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
openFiles?: {
|
|
182
|
+
path: string;
|
|
183
|
+
timestamp: number;
|
|
184
|
+
cursor?: {
|
|
185
|
+
line: number;
|
|
186
|
+
character: number;
|
|
187
|
+
} | undefined;
|
|
188
|
+
isActive?: boolean | undefined;
|
|
189
|
+
selectedText?: string | undefined;
|
|
190
|
+
}[] | undefined;
|
|
191
|
+
isTrusted?: boolean | undefined;
|
|
192
|
+
}, {
|
|
193
|
+
openFiles?: {
|
|
194
|
+
path: string;
|
|
195
|
+
timestamp: number;
|
|
196
|
+
cursor?: {
|
|
197
|
+
line: number;
|
|
198
|
+
character: number;
|
|
199
|
+
} | undefined;
|
|
200
|
+
isActive?: boolean | undefined;
|
|
201
|
+
selectedText?: string | undefined;
|
|
202
|
+
}[] | undefined;
|
|
203
|
+
isTrusted?: boolean | undefined;
|
|
204
|
+
}>>;
|
|
205
|
+
}, "strip", z.ZodTypeAny, {
|
|
206
|
+
workspaceState?: {
|
|
207
|
+
openFiles?: {
|
|
208
|
+
path: string;
|
|
209
|
+
timestamp: number;
|
|
210
|
+
cursor?: {
|
|
211
|
+
line: number;
|
|
212
|
+
character: number;
|
|
213
|
+
} | undefined;
|
|
214
|
+
isActive?: boolean | undefined;
|
|
215
|
+
selectedText?: string | undefined;
|
|
216
|
+
}[] | undefined;
|
|
217
|
+
isTrusted?: boolean | undefined;
|
|
218
|
+
} | undefined;
|
|
219
|
+
}, {
|
|
220
|
+
workspaceState?: {
|
|
221
|
+
openFiles?: {
|
|
222
|
+
path: string;
|
|
223
|
+
timestamp: number;
|
|
224
|
+
cursor?: {
|
|
225
|
+
line: number;
|
|
226
|
+
character: number;
|
|
227
|
+
} | undefined;
|
|
228
|
+
isActive?: boolean | undefined;
|
|
229
|
+
selectedText?: string | undefined;
|
|
230
|
+
}[] | undefined;
|
|
231
|
+
isTrusted?: boolean | undefined;
|
|
232
|
+
} | undefined;
|
|
233
|
+
}>;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
params: {
|
|
236
|
+
workspaceState?: {
|
|
237
|
+
openFiles?: {
|
|
238
|
+
path: string;
|
|
239
|
+
timestamp: number;
|
|
240
|
+
cursor?: {
|
|
241
|
+
line: number;
|
|
242
|
+
character: number;
|
|
243
|
+
} | undefined;
|
|
244
|
+
isActive?: boolean | undefined;
|
|
245
|
+
selectedText?: string | undefined;
|
|
246
|
+
}[] | undefined;
|
|
247
|
+
isTrusted?: boolean | undefined;
|
|
248
|
+
} | undefined;
|
|
249
|
+
};
|
|
250
|
+
jsonrpc: "2.0";
|
|
251
|
+
method: "ide/contextUpdate";
|
|
252
|
+
}, {
|
|
253
|
+
params: {
|
|
254
|
+
workspaceState?: {
|
|
255
|
+
openFiles?: {
|
|
256
|
+
path: string;
|
|
257
|
+
timestamp: number;
|
|
258
|
+
cursor?: {
|
|
259
|
+
line: number;
|
|
260
|
+
character: number;
|
|
261
|
+
} | undefined;
|
|
262
|
+
isActive?: boolean | undefined;
|
|
263
|
+
selectedText?: string | undefined;
|
|
264
|
+
}[] | undefined;
|
|
265
|
+
isTrusted?: boolean | undefined;
|
|
266
|
+
} | undefined;
|
|
267
|
+
};
|
|
268
|
+
jsonrpc: "2.0";
|
|
269
|
+
method: "ide/contextUpdate";
|
|
270
|
+
}>;
|
|
271
|
+
export declare const IdeDiffAcceptedNotificationSchema: z.ZodObject<{
|
|
272
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
273
|
+
method: z.ZodLiteral<"ide/diffAccepted">;
|
|
274
|
+
params: z.ZodObject<{
|
|
275
|
+
filePath: z.ZodString;
|
|
276
|
+
content: z.ZodString;
|
|
277
|
+
}, "strip", z.ZodTypeAny, {
|
|
278
|
+
filePath: string;
|
|
279
|
+
content: string;
|
|
280
|
+
}, {
|
|
281
|
+
filePath: string;
|
|
282
|
+
content: string;
|
|
283
|
+
}>;
|
|
284
|
+
}, "strip", z.ZodTypeAny, {
|
|
285
|
+
params: {
|
|
286
|
+
filePath: string;
|
|
287
|
+
content: string;
|
|
288
|
+
};
|
|
289
|
+
jsonrpc: "2.0";
|
|
290
|
+
method: "ide/diffAccepted";
|
|
291
|
+
}, {
|
|
292
|
+
params: {
|
|
293
|
+
filePath: string;
|
|
294
|
+
content: string;
|
|
295
|
+
};
|
|
296
|
+
jsonrpc: "2.0";
|
|
297
|
+
method: "ide/diffAccepted";
|
|
298
|
+
}>;
|
|
299
|
+
export declare const IdeDiffRejectedNotificationSchema: z.ZodObject<{
|
|
300
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
301
|
+
method: z.ZodLiteral<"ide/diffRejected">;
|
|
302
|
+
params: z.ZodObject<{
|
|
303
|
+
filePath: z.ZodString;
|
|
304
|
+
}, "strip", z.ZodTypeAny, {
|
|
305
|
+
filePath: string;
|
|
306
|
+
}, {
|
|
307
|
+
filePath: string;
|
|
308
|
+
}>;
|
|
309
|
+
}, "strip", z.ZodTypeAny, {
|
|
310
|
+
params: {
|
|
311
|
+
filePath: string;
|
|
312
|
+
};
|
|
313
|
+
jsonrpc: "2.0";
|
|
314
|
+
method: "ide/diffRejected";
|
|
315
|
+
}, {
|
|
316
|
+
params: {
|
|
317
|
+
filePath: string;
|
|
318
|
+
};
|
|
319
|
+
jsonrpc: "2.0";
|
|
320
|
+
method: "ide/diffRejected";
|
|
321
|
+
}>;
|
|
322
|
+
/**
|
|
323
|
+
* This is defined for backwards compatibility only. Newer extension versions
|
|
324
|
+
* will only send IdeDiffRejectedNotificationSchema.
|
|
325
|
+
*
|
|
326
|
+
* A notification that a diff has been closed in the IDE.
|
|
327
|
+
*/
|
|
328
|
+
export declare const IdeDiffClosedNotificationSchema: z.ZodObject<{
|
|
329
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
330
|
+
method: z.ZodLiteral<"ide/diffClosed">;
|
|
331
|
+
params: z.ZodObject<{
|
|
332
|
+
filePath: z.ZodString;
|
|
333
|
+
content: z.ZodOptional<z.ZodString>;
|
|
334
|
+
}, "strip", z.ZodTypeAny, {
|
|
335
|
+
filePath: string;
|
|
336
|
+
content?: string | undefined;
|
|
337
|
+
}, {
|
|
338
|
+
filePath: string;
|
|
339
|
+
content?: string | undefined;
|
|
340
|
+
}>;
|
|
341
|
+
}, "strip", z.ZodTypeAny, {
|
|
342
|
+
params: {
|
|
343
|
+
filePath: string;
|
|
344
|
+
content?: string | undefined;
|
|
345
|
+
};
|
|
346
|
+
jsonrpc: "2.0";
|
|
347
|
+
method: "ide/diffClosed";
|
|
348
|
+
}, {
|
|
349
|
+
params: {
|
|
350
|
+
filePath: string;
|
|
351
|
+
content?: string | undefined;
|
|
352
|
+
};
|
|
353
|
+
jsonrpc: "2.0";
|
|
354
|
+
method: "ide/diffClosed";
|
|
355
|
+
}>;
|
|
356
|
+
export declare const CloseDiffResponseSchema: z.ZodEffects<z.ZodObject<{
|
|
357
|
+
content: z.ZodArray<z.ZodObject<{
|
|
358
|
+
text: z.ZodString;
|
|
359
|
+
type: z.ZodLiteral<"text">;
|
|
360
|
+
}, "strip", z.ZodTypeAny, {
|
|
361
|
+
type: "text";
|
|
362
|
+
text: string;
|
|
363
|
+
}, {
|
|
364
|
+
type: "text";
|
|
365
|
+
text: string;
|
|
366
|
+
}>, "many">;
|
|
367
|
+
}, "strip", z.ZodTypeAny, {
|
|
368
|
+
content: {
|
|
369
|
+
type: "text";
|
|
370
|
+
text: string;
|
|
371
|
+
}[];
|
|
372
|
+
}, {
|
|
373
|
+
content: {
|
|
374
|
+
type: "text";
|
|
375
|
+
text: string;
|
|
376
|
+
}[];
|
|
377
|
+
}>, {
|
|
378
|
+
content?: string | undefined;
|
|
379
|
+
}, {
|
|
380
|
+
content: {
|
|
381
|
+
type: "text";
|
|
382
|
+
text: string;
|
|
383
|
+
}[];
|
|
384
|
+
}>;
|
|
385
|
+
export type DiffUpdateResult = {
|
|
386
|
+
status: 'accepted';
|
|
387
|
+
content?: string;
|
|
388
|
+
} | {
|
|
389
|
+
status: 'rejected';
|
|
390
|
+
content: undefined;
|
|
391
|
+
};
|
|
392
|
+
type IdeContextSubscriber = (ideContext: IdeContext | undefined) => void;
|
|
393
|
+
/**
|
|
394
|
+
* Creates a new store for managing the IDE's context.
|
|
395
|
+
* This factory function encapsulates the state and logic, allowing for the creation
|
|
396
|
+
* of isolated instances, which is particularly useful for testing.
|
|
397
|
+
*
|
|
398
|
+
* @returns An object with methods to interact with the IDE context.
|
|
399
|
+
*/
|
|
400
|
+
export declare function createIdeContextStore(): {
|
|
401
|
+
setIdeContext: (newIdeContext: IdeContext) => void;
|
|
402
|
+
getIdeContext: () => IdeContext | undefined;
|
|
403
|
+
subscribeToIdeContext: (subscriber: IdeContextSubscriber) => () => void;
|
|
404
|
+
clearIdeContext: () => void;
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* The default, shared instance of the IDE context store for the application.
|
|
408
|
+
*/
|
|
409
|
+
export declare const ideContext: {
|
|
410
|
+
setIdeContext: (newIdeContext: IdeContext) => void;
|
|
411
|
+
getIdeContext: () => IdeContext | undefined;
|
|
412
|
+
subscribeToIdeContext: (subscriber: IdeContextSubscriber) => () => void;
|
|
413
|
+
clearIdeContext: () => void;
|
|
414
|
+
};
|
|
415
|
+
export {};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
/**
|
|
8
|
+
* Zod schema for validating a file context from the IDE.
|
|
9
|
+
*/
|
|
10
|
+
export const FileSchema = z.object({
|
|
11
|
+
path: z.string(),
|
|
12
|
+
timestamp: z.number(),
|
|
13
|
+
isActive: z.boolean().optional(),
|
|
14
|
+
selectedText: z.string().optional(),
|
|
15
|
+
cursor: z
|
|
16
|
+
.object({
|
|
17
|
+
line: z.number(),
|
|
18
|
+
character: z.number(),
|
|
19
|
+
})
|
|
20
|
+
.optional(),
|
|
21
|
+
});
|
|
22
|
+
export const IdeContextSchema = z.object({
|
|
23
|
+
workspaceState: z
|
|
24
|
+
.object({
|
|
25
|
+
openFiles: z.array(FileSchema).optional(),
|
|
26
|
+
isTrusted: z.boolean().optional(),
|
|
27
|
+
})
|
|
28
|
+
.optional(),
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Zod schema for validating the 'ide/contextUpdate' notification from the IDE.
|
|
32
|
+
*/
|
|
33
|
+
export const IdeContextNotificationSchema = z.object({
|
|
34
|
+
jsonrpc: z.literal('2.0'),
|
|
35
|
+
method: z.literal('ide/contextUpdate'),
|
|
36
|
+
params: IdeContextSchema,
|
|
37
|
+
});
|
|
38
|
+
export const IdeDiffAcceptedNotificationSchema = z.object({
|
|
39
|
+
jsonrpc: z.literal('2.0'),
|
|
40
|
+
method: z.literal('ide/diffAccepted'),
|
|
41
|
+
params: z.object({
|
|
42
|
+
filePath: z.string(),
|
|
43
|
+
content: z.string(),
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
export const IdeDiffRejectedNotificationSchema = z.object({
|
|
47
|
+
jsonrpc: z.literal('2.0'),
|
|
48
|
+
method: z.literal('ide/diffRejected'),
|
|
49
|
+
params: z.object({
|
|
50
|
+
filePath: z.string(),
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* This is defined for backwards compatibility only. Newer extension versions
|
|
55
|
+
* will only send IdeDiffRejectedNotificationSchema.
|
|
56
|
+
*
|
|
57
|
+
* A notification that a diff has been closed in the IDE.
|
|
58
|
+
*/
|
|
59
|
+
export const IdeDiffClosedNotificationSchema = z.object({
|
|
60
|
+
jsonrpc: z.literal('2.0'),
|
|
61
|
+
method: z.literal('ide/diffClosed'),
|
|
62
|
+
params: z.object({
|
|
63
|
+
filePath: z.string(),
|
|
64
|
+
content: z.string().optional(),
|
|
65
|
+
}),
|
|
66
|
+
});
|
|
67
|
+
export const CloseDiffResponseSchema = z
|
|
68
|
+
.object({
|
|
69
|
+
content: z
|
|
70
|
+
.array(z.object({
|
|
71
|
+
text: z.string(),
|
|
72
|
+
type: z.literal('text'),
|
|
73
|
+
}))
|
|
74
|
+
.min(1),
|
|
75
|
+
})
|
|
76
|
+
.transform((val, ctx) => {
|
|
77
|
+
try {
|
|
78
|
+
const parsed = JSON.parse(val.content[0].text);
|
|
79
|
+
const innerSchema = z.object({ content: z.string().optional() });
|
|
80
|
+
const validationResult = innerSchema.safeParse(parsed);
|
|
81
|
+
if (!validationResult.success) {
|
|
82
|
+
validationResult.error.issues.forEach((issue) => ctx.addIssue(issue));
|
|
83
|
+
return z.NEVER;
|
|
84
|
+
}
|
|
85
|
+
return validationResult.data;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// JSON parsing failed - add validation error
|
|
89
|
+
ctx.addIssue({
|
|
90
|
+
code: z.ZodIssueCode.custom,
|
|
91
|
+
message: 'Invalid JSON in text content',
|
|
92
|
+
});
|
|
93
|
+
return z.NEVER;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* Creates a new store for managing the IDE's context.
|
|
98
|
+
* This factory function encapsulates the state and logic, allowing for the creation
|
|
99
|
+
* of isolated instances, which is particularly useful for testing.
|
|
100
|
+
*
|
|
101
|
+
* @returns An object with methods to interact with the IDE context.
|
|
102
|
+
*/
|
|
103
|
+
export function createIdeContextStore() {
|
|
104
|
+
let ideContextState = undefined;
|
|
105
|
+
const subscribers = new Set();
|
|
106
|
+
/**
|
|
107
|
+
* Notifies all registered subscribers about the current IDE context.
|
|
108
|
+
*/
|
|
109
|
+
function notifySubscribers() {
|
|
110
|
+
for (const subscriber of subscribers) {
|
|
111
|
+
subscriber(ideContextState);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Sets the IDE context and notifies all registered subscribers of the change.
|
|
116
|
+
* @param newIdeContext The new IDE context from the IDE.
|
|
117
|
+
*/
|
|
118
|
+
function setIdeContext(newIdeContext) {
|
|
119
|
+
ideContextState = newIdeContext;
|
|
120
|
+
notifySubscribers();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Clears the IDE context and notifies all registered subscribers of the change.
|
|
124
|
+
*/
|
|
125
|
+
function clearIdeContext() {
|
|
126
|
+
ideContextState = undefined;
|
|
127
|
+
notifySubscribers();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Retrieves the current IDE context.
|
|
131
|
+
* @returns The `IdeContext` object if a file is active; otherwise, `undefined`.
|
|
132
|
+
*/
|
|
133
|
+
function getIdeContext() {
|
|
134
|
+
return ideContextState;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Subscribes to changes in the IDE context.
|
|
138
|
+
*
|
|
139
|
+
* When the IDE context changes, the provided `subscriber` function will be called.
|
|
140
|
+
* Note: The subscriber is not called with the current value upon subscription.
|
|
141
|
+
*
|
|
142
|
+
* @param subscriber The function to be called when the IDE context changes.
|
|
143
|
+
* @returns A function that, when called, will unsubscribe the provided subscriber.
|
|
144
|
+
*/
|
|
145
|
+
function subscribeToIdeContext(subscriber) {
|
|
146
|
+
subscribers.add(subscriber);
|
|
147
|
+
return () => {
|
|
148
|
+
subscribers.delete(subscriber);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
setIdeContext,
|
|
153
|
+
getIdeContext,
|
|
154
|
+
subscribeToIdeContext,
|
|
155
|
+
clearIdeContext,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The default, shared instance of the IDE context store for the application.
|
|
160
|
+
*/
|
|
161
|
+
export const ideContext = createIdeContextStore();
|
|
162
|
+
//# sourceMappingURL=ideContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ideContext.js","sourceRoot":"","sources":["../../../src/ide/ideContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,SAAS,EAAE,CAAC,CAAC,MAAM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2025 Vybestack LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export { IDE_DEFINITIONS, detectIdeFromEnv, detectIde, isCloudShell, type IdeInfo, } from './detect-ide.js';
|
|
7
|
+
export { LLXPRT_CODE_COMPANION_EXTENSION_NAME } from './constants.js';
|
|
8
|
+
export { getIdeProcessInfo } from './process-utils.js';
|
|
9
|
+
export { FileSchema, IdeContextSchema, IdeContextNotificationSchema, IdeDiffAcceptedNotificationSchema, IdeDiffRejectedNotificationSchema, IdeDiffClosedNotificationSchema, CloseDiffResponseSchema, createIdeContextStore, ideContext, type IdeContext, type File, type DiffUpdateResult, } from './ideContext.js';
|
|
10
|
+
export { IdeClient, IDEConnectionStatus, type IDEConnectionState, } from './ide-client.js';
|
|
11
|
+
export { getIdeInstaller, type IdeInstaller, type InstallResult, } from './ide-installer.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Vybestack LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export { IDE_DEFINITIONS, detectIdeFromEnv, detectIde, isCloudShell, } from './detect-ide.js';
|
|
7
|
+
export { LLXPRT_CODE_COMPANION_EXTENSION_NAME } from './constants.js';
|
|
8
|
+
export { getIdeProcessInfo } from './process-utils.js';
|
|
9
|
+
export { FileSchema, IdeContextSchema, IdeContextNotificationSchema, IdeDiffAcceptedNotificationSchema, IdeDiffRejectedNotificationSchema, IdeDiffClosedNotificationSchema, CloseDiffResponseSchema, createIdeContextStore, ideContext, } from './ideContext.js';
|
|
10
|
+
export { IdeClient, IDEConnectionStatus, } from './ide-client.js';
|
|
11
|
+
export { getIdeInstaller, } from './ide-installer.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ide/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,YAAY,GAEb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,4BAA4B,EAC5B,iCAAiC,EACjC,iCAAiC,EACjC,+BAA+B,EAC/B,uBAAuB,EACvB,qBAAqB,EACrB,UAAU,GAIX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,SAAS,EACT,mBAAmB,GAEpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,eAAe,GAGhB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Traverses up the process tree to find the process ID and command of the IDE.
|
|
8
|
+
*
|
|
9
|
+
* This function uses different strategies depending on the operating system
|
|
10
|
+
* to identify the main application process (e.g., the main VS Code window
|
|
11
|
+
* process).
|
|
12
|
+
*
|
|
13
|
+
* If the IDE process cannot be reliably identified, it will return the
|
|
14
|
+
* top-level ancestor process ID and command as a fallback.
|
|
15
|
+
*
|
|
16
|
+
* @returns A promise that resolves to the PID and command of the IDE process.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getIdeProcessInfo(): Promise<{
|
|
19
|
+
pid: number;
|
|
20
|
+
command: string;
|
|
21
|
+
}>;
|