@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,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { exec } from 'child_process';
|
|
7
|
+
import { promisify } from 'util';
|
|
8
|
+
import os from 'os';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { debugLogger } from '@vybestack/llxprt-code-telemetry/utils/debugLogger.js';
|
|
11
|
+
const execAsync = promisify(exec);
|
|
12
|
+
const MAX_TRAVERSAL_DEPTH = 32;
|
|
13
|
+
/**
|
|
14
|
+
* Fetches the entire process table on Windows.
|
|
15
|
+
*/
|
|
16
|
+
async function getProcessTableWindows() {
|
|
17
|
+
const processMap = new Map();
|
|
18
|
+
try {
|
|
19
|
+
// Fetch ProcessId, ParentProcessId, Name, and CommandLine for all processes.
|
|
20
|
+
const powershellCommand = 'Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,Name,CommandLine | ConvertTo-Json -Compress';
|
|
21
|
+
// Increase maxBuffer to handle large process lists (default is 1MB)
|
|
22
|
+
const { stdout } = await execAsync(`powershell "${powershellCommand}"`, {
|
|
23
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
24
|
+
});
|
|
25
|
+
if (!stdout.trim()) {
|
|
26
|
+
return processMap;
|
|
27
|
+
}
|
|
28
|
+
let processes;
|
|
29
|
+
try {
|
|
30
|
+
processes = JSON.parse(stdout);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// JSON parse failed; return empty map.
|
|
34
|
+
return processMap;
|
|
35
|
+
}
|
|
36
|
+
if (!Array.isArray(processes)) {
|
|
37
|
+
processes = [processes];
|
|
38
|
+
}
|
|
39
|
+
for (const p of processes) {
|
|
40
|
+
if (typeof p.ProcessId === 'number') {
|
|
41
|
+
processMap.set(p.ProcessId, {
|
|
42
|
+
pid: p.ProcessId,
|
|
43
|
+
parentPid: p.ParentProcessId !== undefined &&
|
|
44
|
+
p.ParentProcessId !== 0 &&
|
|
45
|
+
!Number.isNaN(p.ParentProcessId)
|
|
46
|
+
? p.ParentProcessId
|
|
47
|
+
: 0,
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- intentional falsy coalescing: string fallback for optional property
|
|
49
|
+
name: p.Name || '',
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- intentional falsy coalescing: string fallback for optional property
|
|
51
|
+
command: p.CommandLine || '',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// PowerShell failed; return empty map.
|
|
58
|
+
}
|
|
59
|
+
return processMap;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Fetches the parent process ID, name, and command for a given process ID on Unix.
|
|
63
|
+
*
|
|
64
|
+
* @param pid The process ID to inspect.
|
|
65
|
+
* @returns A promise that resolves to the parent's PID, name, and command.
|
|
66
|
+
*/
|
|
67
|
+
async function getProcessInfo(pid) {
|
|
68
|
+
try {
|
|
69
|
+
const command = `ps -o ppid=,command= -p ${pid}`;
|
|
70
|
+
const { stdout } = await execAsync(command);
|
|
71
|
+
const trimmedStdout = stdout.trim();
|
|
72
|
+
if (!trimmedStdout) {
|
|
73
|
+
return { parentPid: 0, name: '', command: '' };
|
|
74
|
+
}
|
|
75
|
+
const parts = trimmedStdout.split(/\s+/);
|
|
76
|
+
const ppidString = parts[0];
|
|
77
|
+
const parentPid = parseInt(ppidString, 10);
|
|
78
|
+
const fullCommand = trimmedStdout.substring(ppidString.length).trim();
|
|
79
|
+
const processName = path.basename(fullCommand.split(' ')[0]);
|
|
80
|
+
return {
|
|
81
|
+
parentPid: isNaN(parentPid) ? 1 : parentPid,
|
|
82
|
+
name: processName,
|
|
83
|
+
command: fullCommand,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
// Process info unavailable; return defaults.
|
|
88
|
+
return { parentPid: 0, name: '', command: '' };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Finds the IDE process info on Unix-like systems.
|
|
93
|
+
*
|
|
94
|
+
* The strategy is to find the shell process that spawned the CLI, and then
|
|
95
|
+
* find that shell's parent process (the IDE). To get the true IDE process,
|
|
96
|
+
* we traverse one level higher to get the grandparent.
|
|
97
|
+
*
|
|
98
|
+
* @returns A promise that resolves to the PID and command of the IDE process.
|
|
99
|
+
*/
|
|
100
|
+
async function getIdeProcessInfoForUnix() {
|
|
101
|
+
const shells = ['zsh', 'bash', 'sh', 'tcsh', 'csh', 'ksh', 'fish', 'dash'];
|
|
102
|
+
let currentPid = process.pid;
|
|
103
|
+
// eslint-disable-next-line sonarjs/too-many-break-or-continue-in-loop -- Existing structure is intentionally preserved; refactoring this boundary is outside the lint slice.
|
|
104
|
+
for (let i = 0; i < MAX_TRAVERSAL_DEPTH; i++) {
|
|
105
|
+
try {
|
|
106
|
+
const { parentPid, name, command } = await getProcessInfo(currentPid);
|
|
107
|
+
// Debug logging
|
|
108
|
+
if (process.env.DEBUG_PROCESS_TREE) {
|
|
109
|
+
debugLogger.error(`[Process Tree] PID: ${currentPid}, Parent: ${parentPid}, Name: "${name}", Command: "${command}"`);
|
|
110
|
+
}
|
|
111
|
+
// Check if it's a shell (handle both 'zsh' and '/bin/zsh' formats)
|
|
112
|
+
const baseName = path.basename(name);
|
|
113
|
+
const isShell = shells.some((shell) => baseName === shell || name === shell);
|
|
114
|
+
if (isShell) {
|
|
115
|
+
// The direct parent of the shell is often a utility process (e.g. VS
|
|
116
|
+
// Code's `ptyhost` process). To get the true IDE process, we need to
|
|
117
|
+
// traverse one level higher to get the grandparent.
|
|
118
|
+
let idePid = parentPid;
|
|
119
|
+
// eslint-disable-next-line sonarjs/nested-control-flow -- Existing structure is intentionally preserved; refactoring this boundary is outside the lint slice.
|
|
120
|
+
try {
|
|
121
|
+
const { parentPid: grandParentPid } = await getProcessInfo(parentPid);
|
|
122
|
+
if (grandParentPid > 1) {
|
|
123
|
+
idePid = grandParentPid;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// Ignore if getting grandparent fails, we'll just use the parent pid.
|
|
128
|
+
}
|
|
129
|
+
const { command } = await getProcessInfo(idePid);
|
|
130
|
+
return { pid: idePid, command };
|
|
131
|
+
}
|
|
132
|
+
if (parentPid <= 1) {
|
|
133
|
+
break; // Reached the root
|
|
134
|
+
}
|
|
135
|
+
currentPid = parentPid;
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// Process in chain died
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const { command } = await getProcessInfo(currentPid);
|
|
143
|
+
return { pid: currentPid, command };
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Finds the IDE process info on Windows using a snapshot approach.
|
|
147
|
+
*/
|
|
148
|
+
async function getIdeProcessInfoForWindows() {
|
|
149
|
+
// Fetch the entire process table in one go.
|
|
150
|
+
const processMap = await getProcessTableWindows();
|
|
151
|
+
const myPid = process.pid;
|
|
152
|
+
const myProc = processMap.get(myPid);
|
|
153
|
+
if (!myProc) {
|
|
154
|
+
// Fallback: try to get info for current process directly if snapshot fails
|
|
155
|
+
const { command } = await getProcessInfo(myPid);
|
|
156
|
+
return { pid: myPid, command };
|
|
157
|
+
}
|
|
158
|
+
// Perform tree traversal in memory.
|
|
159
|
+
// Strategy: Find the great-grandchild of the root process (pid 0 or non-existent parent).
|
|
160
|
+
const ancestors = [];
|
|
161
|
+
let curr = myProc;
|
|
162
|
+
for (let i = 0; i < MAX_TRAVERSAL_DEPTH && curr; i++) {
|
|
163
|
+
ancestors.push(curr);
|
|
164
|
+
if (curr.parentPid === 0 || !processMap.has(curr.parentPid)) {
|
|
165
|
+
break; // Reached root
|
|
166
|
+
}
|
|
167
|
+
curr = processMap.get(curr.parentPid);
|
|
168
|
+
}
|
|
169
|
+
if (ancestors.length >= 3) {
|
|
170
|
+
const target = ancestors[ancestors.length - 3];
|
|
171
|
+
return { pid: target.pid, command: target.command };
|
|
172
|
+
}
|
|
173
|
+
else if (ancestors.length > 0) {
|
|
174
|
+
const target = ancestors[ancestors.length - 1];
|
|
175
|
+
return { pid: target.pid, command: target.command };
|
|
176
|
+
}
|
|
177
|
+
return { pid: myPid, command: myProc.command };
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Traverses up the process tree to find the process ID and command of the IDE.
|
|
181
|
+
*
|
|
182
|
+
* This function uses different strategies depending on the operating system
|
|
183
|
+
* to identify the main application process (e.g., the main VS Code window
|
|
184
|
+
* process).
|
|
185
|
+
*
|
|
186
|
+
* If the IDE process cannot be reliably identified, it will return the
|
|
187
|
+
* top-level ancestor process ID and command as a fallback.
|
|
188
|
+
*
|
|
189
|
+
* @returns A promise that resolves to the PID and command of the IDE process.
|
|
190
|
+
*/
|
|
191
|
+
export async function getIdeProcessInfo() {
|
|
192
|
+
const platform = os.platform();
|
|
193
|
+
if (platform === 'win32') {
|
|
194
|
+
return getIdeProcessInfoForWindows();
|
|
195
|
+
}
|
|
196
|
+
return getIdeProcessInfoForUnix();
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=process-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-utils.js","sourceRoot":"","sources":["../../../src/ide/process-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,uDAAuD,CAAC;AAEpF,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC,MAAM,mBAAm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,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Vybestack LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export type { LspServerId, LspServerConfig, LspRequestEnvelope, LspResponseEnvelope, LspConfig, Diagnostic, ServerStatus, } from './types.js';
|
|
7
|
+
export { LspServiceClient, normalizeServerStatus, } from './lsp-service-client.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lsp/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'node:stream';
|
|
2
|
+
import type { Diagnostic, LspConfig, ServerStatus } from './types.js';
|
|
3
|
+
export declare function normalizeServerStatus(raw: unknown): ServerStatus;
|
|
4
|
+
export declare class LspServiceClient {
|
|
5
|
+
private readonly config;
|
|
6
|
+
private readonly workspaceRoot;
|
|
7
|
+
private alive;
|
|
8
|
+
private disabledPermanently;
|
|
9
|
+
private unavailableReason;
|
|
10
|
+
private process;
|
|
11
|
+
private connection;
|
|
12
|
+
constructor(config: LspConfig, workspaceRoot: string);
|
|
13
|
+
start(): Promise<void>;
|
|
14
|
+
checkFile(filePath: string, signal?: AbortSignal): Promise<Diagnostic[]>;
|
|
15
|
+
getAllDiagnostics(): Promise<Record<string, Diagnostic[]>>;
|
|
16
|
+
status(): Promise<ServerStatus[]>;
|
|
17
|
+
isAlive(): boolean;
|
|
18
|
+
getUnavailableReason(): string | undefined;
|
|
19
|
+
shutdown(): Promise<void>;
|
|
20
|
+
getMcpTransportStreams(): {
|
|
21
|
+
readable: Readable;
|
|
22
|
+
writable: Writable;
|
|
23
|
+
} | null;
|
|
24
|
+
private validateFirstServerCommand;
|
|
25
|
+
private resolveLspEntry;
|
|
26
|
+
private resolveLspEntryViaCreateRequire;
|
|
27
|
+
private resolveLspEntryMonorepoFallback;
|
|
28
|
+
private launchLspProcess;
|
|
29
|
+
private resolveBunPath;
|
|
30
|
+
private pathIsExecutable;
|
|
31
|
+
private pathIsReadable;
|
|
32
|
+
private waitForReady;
|
|
33
|
+
private withAbortGuard;
|
|
34
|
+
private withTimeout;
|
|
35
|
+
private disable;
|
|
36
|
+
private cleanupProcessState;
|
|
37
|
+
}
|