centaurus-cli 2.4.0 → 2.5.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.
- package/README.md +151 -1
- package/dist/cli-adapter.d.ts +41 -2
- package/dist/cli-adapter.d.ts.map +1 -1
- package/dist/cli-adapter.js +407 -79
- package/dist/cli-adapter.js.map +1 -1
- package/dist/config/types.d.ts +23 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +20 -0
- package/dist/config/types.js.map +1 -1
- package/dist/context/__tests__/command-detector.test.d.ts +14 -0
- package/dist/context/__tests__/command-detector.test.d.ts.map +1 -0
- package/dist/context/__tests__/command-detector.test.js +318 -0
- package/dist/context/__tests__/command-detector.test.js.map +1 -0
- package/dist/context/__tests__/context-manager.test.d.ts +16 -0
- package/dist/context/__tests__/context-manager.test.d.ts.map +1 -0
- package/dist/context/__tests__/context-manager.test.js +375 -0
- package/dist/context/__tests__/context-manager.test.js.map +1 -0
- package/dist/context/__tests__/error-handling.test.d.ts +15 -0
- package/dist/context/__tests__/error-handling.test.d.ts.map +1 -0
- package/dist/context/__tests__/error-handling.test.js +447 -0
- package/dist/context/__tests__/error-handling.test.js.map +1 -0
- package/dist/context/command-detector.d.ts +50 -0
- package/dist/context/command-detector.d.ts.map +1 -0
- package/dist/context/command-detector.js +72 -0
- package/dist/context/command-detector.js.map +1 -0
- package/dist/context/context-manager.d.ts +144 -0
- package/dist/context/context-manager.d.ts.map +1 -0
- package/dist/context/context-manager.js +487 -0
- package/dist/context/context-manager.js.map +1 -0
- package/dist/context/handlers/__tests__/docker-handler.test.d.ts +13 -0
- package/dist/context/handlers/__tests__/docker-handler.test.d.ts.map +1 -0
- package/dist/context/handlers/__tests__/docker-handler.test.js +285 -0
- package/dist/context/handlers/__tests__/docker-handler.test.js.map +1 -0
- package/dist/context/handlers/__tests__/ssh-handler.test.d.ts +13 -0
- package/dist/context/handlers/__tests__/ssh-handler.test.d.ts.map +1 -0
- package/dist/context/handlers/__tests__/ssh-handler.test.js +251 -0
- package/dist/context/handlers/__tests__/ssh-handler.test.js.map +1 -0
- package/dist/context/handlers/__tests__/wsl-handler.test.d.ts +7 -0
- package/dist/context/handlers/__tests__/wsl-handler.test.d.ts.map +1 -0
- package/dist/context/handlers/__tests__/wsl-handler.test.js +331 -0
- package/dist/context/handlers/__tests__/wsl-handler.test.js.map +1 -0
- package/dist/context/handlers/docker-handler.d.ts +111 -0
- package/dist/context/handlers/docker-handler.d.ts.map +1 -0
- package/dist/context/handlers/docker-handler.js +439 -0
- package/dist/context/handlers/docker-handler.js.map +1 -0
- package/dist/context/handlers/ssh-handler.d.ts +120 -0
- package/dist/context/handlers/ssh-handler.d.ts.map +1 -0
- package/dist/context/handlers/ssh-handler.js +523 -0
- package/dist/context/handlers/ssh-handler.js.map +1 -0
- package/dist/context/handlers/wsl-handler.d.ts +128 -0
- package/dist/context/handlers/wsl-handler.d.ts.map +1 -0
- package/dist/context/handlers/wsl-handler.js +590 -0
- package/dist/context/handlers/wsl-handler.js.map +1 -0
- package/dist/context/index.d.ts +8 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +7 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/subshell-handler.d.ts +130 -0
- package/dist/context/subshell-handler.d.ts.map +1 -0
- package/dist/context/subshell-handler.js +5 -0
- package/dist/context/subshell-handler.js.map +1 -0
- package/dist/context/types.d.ts +70 -0
- package/dist/context/types.d.ts.map +1 -0
- package/dist/context/types.js +34 -0
- package/dist/context/types.js.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/services/__tests__/ai-context-injector.test.d.ts +15 -0
- package/dist/services/__tests__/ai-context-injector.test.d.ts.map +1 -0
- package/dist/services/__tests__/ai-context-injector.test.js +326 -0
- package/dist/services/__tests__/ai-context-injector.test.js.map +1 -0
- package/dist/services/ai-context-injector.d.ts +41 -0
- package/dist/services/ai-context-injector.d.ts.map +1 -0
- package/dist/services/ai-context-injector.js +97 -0
- package/dist/services/ai-context-injector.js.map +1 -0
- package/dist/services/ai-service-client.d.ts +4 -1
- package/dist/services/ai-service-client.d.ts.map +1 -1
- package/dist/services/ai-service-client.js +5 -1
- package/dist/services/ai-service-client.js.map +1 -1
- package/dist/src/context/types.js +27 -0
- package/dist/src/services/ai-context-injector.js +96 -0
- package/dist/src/services/ai-service-client.js +270 -0
- package/dist/src/services/api-client.js +349 -0
- package/dist/src/tools/types.js +1 -0
- package/dist/src/types/index.js +1 -0
- package/dist/test/context/types.js +27 -0
- package/dist/test/services/__tests__/ai-context-injector.test.js +325 -0
- package/dist/test/services/ai-context-injector.js +96 -0
- package/dist/test/services/ai-service-client.js +270 -0
- package/dist/test/services/api-client.js +349 -0
- package/dist/test/tools/types.js +1 -0
- package/dist/test/types/index.js +1 -0
- package/dist/test-ai-context-injector.js +97 -0
- package/dist/test-ssh-handler.d.ts +8 -0
- package/dist/test-ssh-handler.d.ts.map +1 -0
- package/dist/test-ssh-handler.js +198 -0
- package/dist/test-ssh-handler.js.map +1 -0
- package/dist/tools/command.d.ts.map +1 -1
- package/dist/tools/command.js +123 -46
- package/dist/tools/command.js.map +1 -1
- package/dist/tools/file-ops.d.ts.map +1 -1
- package/dist/tools/file-ops.js +115 -48
- package/dist/tools/file-ops.js.map +1 -1
- package/dist/tools/types.d.ts +1 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +41 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/ui/components/App.d.ts +3 -0
- package/dist/ui/components/App.d.ts.map +1 -1
- package/dist/ui/components/App.js +213 -46
- package/dist/ui/components/App.js.map +1 -1
- package/dist/ui/components/Breadcrumbs.d.ts +12 -0
- package/dist/ui/components/Breadcrumbs.d.ts.map +1 -0
- package/dist/ui/components/Breadcrumbs.js +62 -0
- package/dist/ui/components/Breadcrumbs.js.map +1 -0
- package/dist/ui/components/CodeBlock.js +1 -1
- package/dist/ui/components/CodeBlock.js.map +1 -1
- package/dist/ui/components/DiffViewer.js +1 -1
- package/dist/ui/components/DiffViewer.js.map +1 -1
- package/dist/ui/components/FileViewerScreen.d.ts +14 -0
- package/dist/ui/components/FileViewerScreen.d.ts.map +1 -0
- package/dist/ui/components/FileViewerScreen.js +74 -0
- package/dist/ui/components/FileViewerScreen.js.map +1 -0
- package/dist/ui/components/InputBox.d.ts +2 -0
- package/dist/ui/components/InputBox.d.ts.map +1 -1
- package/dist/ui/components/InputBox.js +85 -41
- package/dist/ui/components/InputBox.js.map +1 -1
- package/dist/ui/components/MessageDisplay.d.ts.map +1 -1
- package/dist/ui/components/MessageDisplay.js +3 -28
- package/dist/ui/components/MessageDisplay.js.map +1 -1
- package/dist/ui/components/PasswordPrompt.d.ts +9 -0
- package/dist/ui/components/PasswordPrompt.d.ts.map +1 -0
- package/dist/ui/components/PasswordPrompt.js +20 -0
- package/dist/ui/components/PasswordPrompt.js.map +1 -0
- package/dist/ui/components/StatusBar.d.ts +2 -0
- package/dist/ui/components/StatusBar.d.ts.map +1 -1
- package/dist/ui/components/StatusBar.js +36 -1
- package/dist/ui/components/StatusBar.js.map +1 -1
- package/dist/ui/components/ToolExecutionMessage.d.ts.map +1 -1
- package/dist/ui/components/ToolExecutionMessage.js +13 -24
- package/dist/ui/components/ToolExecutionMessage.js.map +1 -1
- package/dist/ui/components/VersionUpdatePrompt.d.ts +10 -0
- package/dist/ui/components/VersionUpdatePrompt.d.ts.map +1 -0
- package/dist/ui/components/VersionUpdatePrompt.js +41 -0
- package/dist/ui/components/VersionUpdatePrompt.js.map +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +38 -10
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/version-checker.d.ts +14 -0
- package/dist/utils/version-checker.d.ts.map +1 -0
- package/dist/utils/version-checker.js +63 -0
- package/dist/utils/version-checker.js.map +1 -0
- package/package.json +71 -69
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSH Handler for remote shell connections
|
|
3
|
+
*/
|
|
4
|
+
import { Client } from 'ssh2';
|
|
5
|
+
import { SubshellConnectionError, SubshellExecutionError } from '../types.js';
|
|
6
|
+
import { randomBytes } from 'crypto';
|
|
7
|
+
/**
|
|
8
|
+
* SSH Handler implementation
|
|
9
|
+
*/
|
|
10
|
+
export class SSHHandler {
|
|
11
|
+
type = 'ssh';
|
|
12
|
+
detectionPatterns = [
|
|
13
|
+
/^ssh\s+/,
|
|
14
|
+
/^ssh\s+-[^\s]+\s+/,
|
|
15
|
+
];
|
|
16
|
+
client = null;
|
|
17
|
+
sftpClient = null;
|
|
18
|
+
config = null;
|
|
19
|
+
currentWorkingDirectory = '~';
|
|
20
|
+
shellType = 'bash';
|
|
21
|
+
osType = 'linux';
|
|
22
|
+
sessionId = '';
|
|
23
|
+
onPasswordRequest;
|
|
24
|
+
/**
|
|
25
|
+
* Set password request callback
|
|
26
|
+
*/
|
|
27
|
+
setPasswordRequestCallback(callback) {
|
|
28
|
+
this.onPasswordRequest = callback;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Detect if a command should trigger this handler
|
|
32
|
+
*/
|
|
33
|
+
detect(command) {
|
|
34
|
+
return this.detectionPatterns.some(pattern => pattern.test(command));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Connect to the SSH server
|
|
38
|
+
*/
|
|
39
|
+
async connect(command, cwd) {
|
|
40
|
+
this.sessionId = randomBytes(16).toString('hex');
|
|
41
|
+
try {
|
|
42
|
+
// Parse SSH command
|
|
43
|
+
this.config = this.parseSSHCommand(command);
|
|
44
|
+
// Prompt for password if no other auth method is available
|
|
45
|
+
if (!this.config.password && !this.config.privateKey && this.onPasswordRequest) {
|
|
46
|
+
try {
|
|
47
|
+
const password = await this.onPasswordRequest(`Password for ${this.config.username}@${this.config.host}:`);
|
|
48
|
+
this.config.password = password;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
throw new Error('Password input cancelled');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Establish SSH connection
|
|
55
|
+
await this.establishConnection(this.config);
|
|
56
|
+
// Initialize SFTP (non-fatal)
|
|
57
|
+
try {
|
|
58
|
+
await this.initializeSFTP();
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
// Continue without SFTP; file ops will fallback to command-based methods
|
|
62
|
+
this.sftpClient = null;
|
|
63
|
+
}
|
|
64
|
+
// Detect shell type and OS
|
|
65
|
+
this.shellType = await this.detectShellType();
|
|
66
|
+
this.osType = await this.detectOSType();
|
|
67
|
+
// Get initial working directory
|
|
68
|
+
this.currentWorkingDirectory = await this.getCurrentWorkingDirectory();
|
|
69
|
+
// Inject shell integration script
|
|
70
|
+
await this.injectShellIntegration();
|
|
71
|
+
return {
|
|
72
|
+
type: 'ssh',
|
|
73
|
+
handler: this,
|
|
74
|
+
metadata: {
|
|
75
|
+
hostname: this.config.host,
|
|
76
|
+
username: this.config.username,
|
|
77
|
+
workingDirectory: this.currentWorkingDirectory,
|
|
78
|
+
shell: this.shellType,
|
|
79
|
+
os: this.osType,
|
|
80
|
+
port: this.config.port,
|
|
81
|
+
},
|
|
82
|
+
connectionState: 'connected',
|
|
83
|
+
sessionId: this.sessionId,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
throw new SubshellConnectionError('ssh', error instanceof Error ? error.message : 'Unknown error', true);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Disconnect from the SSH server
|
|
92
|
+
*/
|
|
93
|
+
async disconnect() {
|
|
94
|
+
if (this.sftpClient) {
|
|
95
|
+
this.sftpClient.end();
|
|
96
|
+
this.sftpClient = null;
|
|
97
|
+
}
|
|
98
|
+
if (this.client) {
|
|
99
|
+
this.client.end();
|
|
100
|
+
this.client = null;
|
|
101
|
+
}
|
|
102
|
+
this.config = null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Execute a command in the SSH session
|
|
106
|
+
*/
|
|
107
|
+
async executeCommand(command) {
|
|
108
|
+
if (!this.client) {
|
|
109
|
+
throw new SubshellExecutionError(command, 'Not connected to SSH server');
|
|
110
|
+
}
|
|
111
|
+
return new Promise((resolve, reject) => {
|
|
112
|
+
const timeout = setTimeout(() => {
|
|
113
|
+
reject(new SubshellExecutionError(command, 'Command timed out after 30 seconds'));
|
|
114
|
+
}, 30000);
|
|
115
|
+
this.client.exec(`cd "${this.currentWorkingDirectory}" && ${command}; echo "__CENTAURUS_PWD__:$(pwd)"`, (err, stream) => {
|
|
116
|
+
if (err) {
|
|
117
|
+
clearTimeout(timeout);
|
|
118
|
+
reject(new SubshellExecutionError(command, err.message));
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
let stdout = '';
|
|
122
|
+
let stderr = '';
|
|
123
|
+
stream.on('close', (code) => {
|
|
124
|
+
clearTimeout(timeout);
|
|
125
|
+
// Extract working directory from output
|
|
126
|
+
const pwdMatch = stdout.match(/__CENTAURUS_PWD__:(.+)$/m);
|
|
127
|
+
if (pwdMatch) {
|
|
128
|
+
this.currentWorkingDirectory = pwdMatch[1].trim();
|
|
129
|
+
stdout = stdout.replace(/__CENTAURUS_PWD__:.+$/m, '').trim();
|
|
130
|
+
}
|
|
131
|
+
resolve({
|
|
132
|
+
stdout,
|
|
133
|
+
stderr,
|
|
134
|
+
exitCode: code || 0,
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
stream.on('data', (data) => {
|
|
138
|
+
stdout += data.toString();
|
|
139
|
+
});
|
|
140
|
+
stream.stderr.on('data', (data) => {
|
|
141
|
+
stderr += data.toString();
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Read a file from the remote filesystem
|
|
148
|
+
*/
|
|
149
|
+
async readFile(path) {
|
|
150
|
+
const absolutePath = this.resolveAbsolutePath(path);
|
|
151
|
+
// Prefer SFTP when available
|
|
152
|
+
if (this.sftpClient) {
|
|
153
|
+
return new Promise((resolve, reject) => {
|
|
154
|
+
this.sftpClient.readFile(absolutePath, 'utf8', (err, data) => {
|
|
155
|
+
if (err) {
|
|
156
|
+
reject(new Error(`Failed to read file ${path}: ${err.message}`));
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
resolve(data);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
// Fallback: use base64 over exec
|
|
165
|
+
const result = await this.executeCommand(`base64 "${absolutePath}" || cat "${absolutePath}" | base64`);
|
|
166
|
+
const base64Out = result.stdout.replace(/\s+/g, '');
|
|
167
|
+
try {
|
|
168
|
+
return Buffer.from(base64Out, 'base64').toString('utf8');
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
throw new Error(`Failed to decode file ${path}: ${e.message}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Write a file to the remote filesystem
|
|
176
|
+
*/
|
|
177
|
+
async writeFile(path, content) {
|
|
178
|
+
const absolutePath = this.resolveAbsolutePath(path);
|
|
179
|
+
// Prefer SFTP when available
|
|
180
|
+
if (this.sftpClient) {
|
|
181
|
+
return new Promise((resolve, reject) => {
|
|
182
|
+
this.sftpClient.writeFile(absolutePath, content, 'utf8', (err) => {
|
|
183
|
+
if (err) {
|
|
184
|
+
reject(new Error(`Failed to write file ${path}: ${err.message}`));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
resolve();
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
// Fallback: base64 via exec (robust against special chars), chunked
|
|
193
|
+
const base64Content = Buffer.from(content, 'utf8').toString('base64');
|
|
194
|
+
const CHUNK_SIZE = 32000;
|
|
195
|
+
// Truncate file first
|
|
196
|
+
let result = await this.executeCommand(`: > "${absolutePath}"`);
|
|
197
|
+
if (result.exitCode !== 0) {
|
|
198
|
+
throw new Error(`Failed to initialize file ${path}: ${result.stderr || 'unknown error'}`);
|
|
199
|
+
}
|
|
200
|
+
for (let i = 0; i < base64Content.length; i += CHUNK_SIZE) {
|
|
201
|
+
const chunk = base64Content.slice(i, i + CHUNK_SIZE);
|
|
202
|
+
result = await this.executeCommand(`echo "${chunk}" | base64 -d >> "${absolutePath}"`);
|
|
203
|
+
if (result.exitCode !== 0) {
|
|
204
|
+
throw new Error(`Failed to write file chunk for ${path}: ${result.stderr || 'unknown error'}`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* List directory contents
|
|
210
|
+
*/
|
|
211
|
+
async listDirectory(path) {
|
|
212
|
+
const absolutePath = this.resolveAbsolutePath(path);
|
|
213
|
+
// Prefer SFTP when available
|
|
214
|
+
if (this.sftpClient) {
|
|
215
|
+
return new Promise((resolve, reject) => {
|
|
216
|
+
this.sftpClient.readdir(absolutePath, (err, list) => {
|
|
217
|
+
if (err) {
|
|
218
|
+
reject(new Error(`Failed to list directory ${path}: ${err.message}`));
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
const entries = list.map(item => ({
|
|
222
|
+
name: item.filename,
|
|
223
|
+
type: item.attrs.isDirectory() ? 'directory' : 'file',
|
|
224
|
+
size: item.attrs.size,
|
|
225
|
+
permissions: item.attrs.mode?.toString(8),
|
|
226
|
+
}));
|
|
227
|
+
resolve(entries);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
// Fallback: parse ls -la output
|
|
233
|
+
const result = await this.executeCommand(`ls -la "${absolutePath}"`);
|
|
234
|
+
if (result.exitCode !== 0) {
|
|
235
|
+
throw new Error(`Failed to list directory ${path}: ${result.stderr || 'unknown error'}`);
|
|
236
|
+
}
|
|
237
|
+
return this.parseDirectoryListing(result.stdout);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Search for files matching a pattern
|
|
241
|
+
*/
|
|
242
|
+
async searchFiles(pattern, directory) {
|
|
243
|
+
const absolutePath = this.resolveAbsolutePath(directory);
|
|
244
|
+
const escapedPattern = pattern.replace(/'/g, "'\\''");
|
|
245
|
+
const command = `grep -rn '${escapedPattern}' "${absolutePath}" 2>/dev/null || true`;
|
|
246
|
+
const result = await this.executeCommand(command);
|
|
247
|
+
const results = [];
|
|
248
|
+
const lines = result.stdout.split('\n').filter(line => line.trim());
|
|
249
|
+
for (const line of lines) {
|
|
250
|
+
const match = line.match(/^(.+?):(\d+):(.+)$/);
|
|
251
|
+
if (match) {
|
|
252
|
+
results.push({
|
|
253
|
+
file: match[1],
|
|
254
|
+
line: parseInt(match[2], 10),
|
|
255
|
+
content: match[3],
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return results;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Get the current working directory
|
|
263
|
+
*/
|
|
264
|
+
async getCurrentWorkingDirectory() {
|
|
265
|
+
const result = await this.executeCommand('pwd');
|
|
266
|
+
return result.stdout.trim();
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Get the shell type
|
|
270
|
+
*/
|
|
271
|
+
async getShellType() {
|
|
272
|
+
return this.shellType;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Get the operating system type
|
|
276
|
+
*/
|
|
277
|
+
async getOSType() {
|
|
278
|
+
return this.osType;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Get breadcrumb information for the UI
|
|
282
|
+
*/
|
|
283
|
+
getBreadcrumbs() {
|
|
284
|
+
if (!this.config) {
|
|
285
|
+
return [];
|
|
286
|
+
}
|
|
287
|
+
return [
|
|
288
|
+
{
|
|
289
|
+
label: 'ssh',
|
|
290
|
+
color: 'cyan',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
label: `${this.config.username}@${this.config.host}`,
|
|
294
|
+
color: 'cyan',
|
|
295
|
+
},
|
|
296
|
+
];
|
|
297
|
+
}
|
|
298
|
+
// Private helper methods
|
|
299
|
+
/**
|
|
300
|
+
* Parse SSH command to extract connection details
|
|
301
|
+
*/
|
|
302
|
+
parseSSHCommand(command) {
|
|
303
|
+
const parts = command.trim().split(/\s+/);
|
|
304
|
+
let host = '';
|
|
305
|
+
let port = 22;
|
|
306
|
+
let username = '';
|
|
307
|
+
// Parse command line arguments
|
|
308
|
+
for (let i = 1; i < parts.length; i++) {
|
|
309
|
+
const part = parts[i];
|
|
310
|
+
if (part === '-p' && i + 1 < parts.length) {
|
|
311
|
+
port = parseInt(parts[i + 1], 10);
|
|
312
|
+
i++;
|
|
313
|
+
}
|
|
314
|
+
else if (part.startsWith('-') && part !== '-p') {
|
|
315
|
+
// Skip other flags
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
else if (!host) {
|
|
319
|
+
// This should be the host (possibly with username)
|
|
320
|
+
if (part.includes('@')) {
|
|
321
|
+
const [user, hostname] = part.split('@');
|
|
322
|
+
username = user;
|
|
323
|
+
host = hostname;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
host = part;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// Default username to current user if not specified
|
|
331
|
+
if (!username) {
|
|
332
|
+
username = process.env.USER || process.env.USERNAME || 'user';
|
|
333
|
+
}
|
|
334
|
+
if (!host) {
|
|
335
|
+
throw new Error('Could not parse SSH host from command');
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
host,
|
|
339
|
+
port,
|
|
340
|
+
username,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Establish SSH connection
|
|
345
|
+
*/
|
|
346
|
+
async establishConnection(config) {
|
|
347
|
+
return new Promise((resolve, reject) => {
|
|
348
|
+
this.client = new Client();
|
|
349
|
+
const connectConfig = {
|
|
350
|
+
host: config.host,
|
|
351
|
+
port: config.port,
|
|
352
|
+
username: config.username,
|
|
353
|
+
};
|
|
354
|
+
// Add authentication method
|
|
355
|
+
if (config.password) {
|
|
356
|
+
connectConfig.password = config.password;
|
|
357
|
+
}
|
|
358
|
+
else if (config.privateKey) {
|
|
359
|
+
connectConfig.privateKey = config.privateKey;
|
|
360
|
+
if (config.passphrase) {
|
|
361
|
+
connectConfig.passphrase = config.passphrase;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
// Try SSH agent or default keys
|
|
366
|
+
connectConfig.tryKeyboard = true;
|
|
367
|
+
}
|
|
368
|
+
this.client.on('ready', () => {
|
|
369
|
+
resolve();
|
|
370
|
+
});
|
|
371
|
+
this.client.on('error', (err) => {
|
|
372
|
+
reject(new Error(`ssh connection failed: ${err.message}`));
|
|
373
|
+
});
|
|
374
|
+
this.client.connect(connectConfig);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Initialize SFTP session
|
|
379
|
+
*/
|
|
380
|
+
async initializeSFTP() {
|
|
381
|
+
if (!this.client) {
|
|
382
|
+
throw new Error('SSH client not connected');
|
|
383
|
+
}
|
|
384
|
+
return new Promise((resolve, reject) => {
|
|
385
|
+
this.client.sftp((err, sftp) => {
|
|
386
|
+
if (err) {
|
|
387
|
+
reject(err);
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
this.sftpClient = sftp;
|
|
391
|
+
resolve();
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Detect the shell type on the remote system
|
|
398
|
+
*/
|
|
399
|
+
async detectShellType() {
|
|
400
|
+
try {
|
|
401
|
+
const result = await this.executeCommand('echo $SHELL');
|
|
402
|
+
const shellPath = result.stdout.trim();
|
|
403
|
+
if (shellPath.includes('bash'))
|
|
404
|
+
return 'bash';
|
|
405
|
+
if (shellPath.includes('zsh'))
|
|
406
|
+
return 'zsh';
|
|
407
|
+
if (shellPath.includes('fish'))
|
|
408
|
+
return 'fish';
|
|
409
|
+
return 'bash'; // Default to bash
|
|
410
|
+
}
|
|
411
|
+
catch {
|
|
412
|
+
return 'bash';
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Detect the operating system type
|
|
417
|
+
*/
|
|
418
|
+
async detectOSType() {
|
|
419
|
+
try {
|
|
420
|
+
const result = await this.executeCommand('uname -s');
|
|
421
|
+
const osName = result.stdout.trim().toLowerCase();
|
|
422
|
+
if (osName.includes('darwin'))
|
|
423
|
+
return 'macos';
|
|
424
|
+
if (osName.includes('linux'))
|
|
425
|
+
return 'linux';
|
|
426
|
+
return 'linux'; // Default to linux
|
|
427
|
+
}
|
|
428
|
+
catch {
|
|
429
|
+
return 'linux';
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Inject shell integration script
|
|
434
|
+
*/
|
|
435
|
+
async injectShellIntegration() {
|
|
436
|
+
try {
|
|
437
|
+
const script = this.getShellIntegrationScript();
|
|
438
|
+
await this.executeCommand(script);
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
// Shell integration is optional, don't fail if it doesn't work
|
|
442
|
+
console.warn('Failed to inject shell integration:', error);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Get shell integration script based on shell type
|
|
447
|
+
*/
|
|
448
|
+
getShellIntegrationScript() {
|
|
449
|
+
const sessionId = this.sessionId;
|
|
450
|
+
if (this.shellType === 'bash') {
|
|
451
|
+
return `
|
|
452
|
+
export CENTAURUS_SUBSHELL=1
|
|
453
|
+
export CENTAURUS_SESSION_ID="${sessionId}"
|
|
454
|
+
_centaurus_pwd_hook() {
|
|
455
|
+
echo "__CENTAURUS_PWD__:$(pwd)"
|
|
456
|
+
}
|
|
457
|
+
export PROMPT_COMMAND="_centaurus_pwd_hook; \${PROMPT_COMMAND}"
|
|
458
|
+
`.trim();
|
|
459
|
+
}
|
|
460
|
+
else if (this.shellType === 'zsh') {
|
|
461
|
+
return `
|
|
462
|
+
export CENTAURUS_SUBSHELL=1
|
|
463
|
+
export CENTAURUS_SESSION_ID="${sessionId}"
|
|
464
|
+
_centaurus_pwd_hook() {
|
|
465
|
+
echo "__CENTAURUS_PWD__:$(pwd)"
|
|
466
|
+
}
|
|
467
|
+
precmd_functions+=(_centaurus_pwd_hook)
|
|
468
|
+
`.trim();
|
|
469
|
+
}
|
|
470
|
+
else if (this.shellType === 'fish') {
|
|
471
|
+
return `
|
|
472
|
+
set -x CENTAURUS_SUBSHELL 1
|
|
473
|
+
set -x CENTAURUS_SESSION_ID "${sessionId}"
|
|
474
|
+
function _centaurus_pwd_hook --on-event fish_prompt
|
|
475
|
+
echo "__CENTAURUS_PWD__:"(pwd)
|
|
476
|
+
end
|
|
477
|
+
`.trim();
|
|
478
|
+
}
|
|
479
|
+
// Default POSIX-compatible script
|
|
480
|
+
return `
|
|
481
|
+
export CENTAURUS_SUBSHELL=1
|
|
482
|
+
export CENTAURUS_SESSION_ID="${sessionId}"
|
|
483
|
+
`.trim();
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Resolve a path to an absolute path
|
|
487
|
+
*/
|
|
488
|
+
resolveAbsolutePath(path) {
|
|
489
|
+
if (path.startsWith('/')) {
|
|
490
|
+
return path;
|
|
491
|
+
}
|
|
492
|
+
if (path.startsWith('~')) {
|
|
493
|
+
return path;
|
|
494
|
+
}
|
|
495
|
+
return `${this.currentWorkingDirectory}/${path}`;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Parse directory listing output (ls -la)
|
|
499
|
+
*/
|
|
500
|
+
parseDirectoryListing(output) {
|
|
501
|
+
const entries = [];
|
|
502
|
+
const lines = output.split('\n').filter(line => line.trim());
|
|
503
|
+
for (const line of lines) {
|
|
504
|
+
// Skip total line and . .. entries
|
|
505
|
+
if (line.startsWith('total') || line.endsWith(' .') || line.endsWith(' ..'))
|
|
506
|
+
continue;
|
|
507
|
+
const match = line.match(/^([drwx-]+)\s+\d+\s+\S+\s+\S+\s+(\d+)\s+\S+\s+\S+\s+\S+\s+(.+)$/);
|
|
508
|
+
if (match) {
|
|
509
|
+
const permissions = match[1];
|
|
510
|
+
const size = parseInt(match[2], 10);
|
|
511
|
+
const name = match[3];
|
|
512
|
+
entries.push({
|
|
513
|
+
name,
|
|
514
|
+
type: permissions.startsWith('d') ? 'directory' : 'file',
|
|
515
|
+
size,
|
|
516
|
+
permissions,
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return entries;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
//# sourceMappingURL=ssh-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-handler.js","sourceRoot":"","sources":["../../../src/context/handlers/ssh-handler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAgC,MAAM,MAAM,CAAC;AAE5D,OAAO,EAAmB,uBAAuB,EAAE,sBAAsB,EAAU,MAAM,aAAa,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAcrC;;GAEG;AACH,MAAM,OAAO,UAAU;IACZ,IAAI,GAAG,KAAK,CAAC;IACb,iBAAiB,GAAG;QAC3B,SAAS;QACT,mBAAmB;KACpB,CAAC;IAEM,MAAM,GAAkB,IAAI,CAAC;IAC7B,UAAU,GAAQ,IAAI,CAAC;IACvB,MAAM,GAAqB,IAAI,CAAC;IAChC,uBAAuB,GAAW,GAAG,CAAC;IACtC,SAAS,GAAW,MAAM,CAAC;IAC3B,MAAM,GAAW,OAAO,CAAC;IACzB,SAAS,GAAW,EAAE,CAAC;IACvB,iBAAiB,CAAwC;IAEjE;;OAEG;IACH,0BAA0B,CAAC,QAA8C;QACvE,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAe;QACpB,OAAO,IA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|
2
|
+
* WSL Handler for Windows Subsystem for Linux
|
|
3
|
+
*/
|
|
4
|
+
import { SubshellHandler, BreadcrumbInfo, CommandResult, DirectoryEntry, SearchResult } from '../subshell-handler.js';
|
|
5
|
+
import { SubshellContext, OSType } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* WSL-specific configuration
|
|
8
|
+
*/
|
|
9
|
+
export interface WSLConfig {
|
|
10
|
+
/** WSL distribution name (e.g., "Ubuntu", "Debian") */
|
|
11
|
+
distribution: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* WSL Handler implementation
|
|
15
|
+
*/
|
|
16
|
+
export declare class WSLHandler implements SubshellHandler {
|
|
17
|
+
readonly type = "wsl";
|
|
18
|
+
readonly detectionPatterns: RegExp[];
|
|
19
|
+
private config;
|
|
20
|
+
private currentWorkingDirectory;
|
|
21
|
+
private shellType;
|
|
22
|
+
private sessionId;
|
|
23
|
+
private shellProcess;
|
|
24
|
+
private commandQueue;
|
|
25
|
+
private currentOutput;
|
|
26
|
+
private currentError;
|
|
27
|
+
/**
|
|
28
|
+
* Detect if a command should trigger this handler
|
|
29
|
+
*/
|
|
30
|
+
detect(command: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Connect to the WSL environment
|
|
33
|
+
*/
|
|
34
|
+
connect(command: string, cwd: string): Promise<SubshellContext>;
|
|
35
|
+
/**
|
|
36
|
+
* Spawn an interactive shell process
|
|
37
|
+
*/
|
|
38
|
+
private spawnInteractiveShell;
|
|
39
|
+
/**
|
|
40
|
+
* Disconnect from the WSL environment
|
|
41
|
+
*/
|
|
42
|
+
disconnect(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Execute a command in the WSL environment
|
|
45
|
+
*/
|
|
46
|
+
executeCommand(command: string): Promise<CommandResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Wait for command completion by monitoring output
|
|
49
|
+
*/
|
|
50
|
+
private waitForCommandCompletion;
|
|
51
|
+
/**
|
|
52
|
+
* Read a file from the WSL filesystem
|
|
53
|
+
*/
|
|
54
|
+
readFile(path: string): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Write a file to the WSL filesystem
|
|
57
|
+
*/
|
|
58
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* List directory contents in WSL
|
|
61
|
+
*/
|
|
62
|
+
listDirectory(path: string): Promise<DirectoryEntry[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Search for files matching a pattern in WSL
|
|
65
|
+
*/
|
|
66
|
+
searchFiles(pattern: string, directory: string): Promise<SearchResult[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Get the current working directory in WSL
|
|
69
|
+
*/
|
|
70
|
+
getCurrentWorkingDirectory(): Promise<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Get the shell type
|
|
73
|
+
*/
|
|
74
|
+
getShellType(): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Get the operating system type (always linux for WSL)
|
|
77
|
+
*/
|
|
78
|
+
getOSType(): Promise<OSType>;
|
|
79
|
+
/**
|
|
80
|
+
* Get breadcrumb information for the UI
|
|
81
|
+
*/
|
|
82
|
+
getBreadcrumbs(): BreadcrumbInfo[];
|
|
83
|
+
/**
|
|
84
|
+
* Verify that WSL is available on the system
|
|
85
|
+
*/
|
|
86
|
+
private verifyWSLAvailable;
|
|
87
|
+
/**
|
|
88
|
+
* Parse WSL command to extract distribution name
|
|
89
|
+
*/
|
|
90
|
+
private parseWSLCommand;
|
|
91
|
+
/**
|
|
92
|
+
* Get the default WSL distribution
|
|
93
|
+
*/
|
|
94
|
+
private getDefaultDistribution;
|
|
95
|
+
/**
|
|
96
|
+
* Detect the shell type in WSL
|
|
97
|
+
*/
|
|
98
|
+
private detectShellType;
|
|
99
|
+
/**
|
|
100
|
+
* Build a WSL command with working directory context
|
|
101
|
+
*/
|
|
102
|
+
private buildWSLCommand;
|
|
103
|
+
/**
|
|
104
|
+
* Convert Windows path to WSL path
|
|
105
|
+
*/
|
|
106
|
+
static windowsToWSLPath(windowsPath: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* Convert WSL path to Windows path
|
|
109
|
+
*/
|
|
110
|
+
static wslToWindowsPath(wslPath: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* Resolve a path to a WSL path
|
|
113
|
+
*/
|
|
114
|
+
private resolveWSLPath;
|
|
115
|
+
/**
|
|
116
|
+
* Parse directory listing output
|
|
117
|
+
*/
|
|
118
|
+
private parseDirectoryListing;
|
|
119
|
+
/**
|
|
120
|
+
* Parse search results from grep output
|
|
121
|
+
*/
|
|
122
|
+
private parseSearchResults;
|
|
123
|
+
/**
|
|
124
|
+
* Execute a promise with a timeout
|
|
125
|
+
*/
|
|
126
|
+
private executeWithTimeout;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=wsl-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wsl-handler.d.ts","sourceRoot":"","sources":["../../../src/context/handlers/wsl-handler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtH,OAAO,EAAE,eAAe,EAAmD,MAAM,EAAE,MAAM,aAAa,CAAC;AAMvG;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,UAAW,YAAW,eAAe;IAChD,QAAQ,CAAC,IAAI,SAAS;IACtB,QAAQ,CAAC,iBAAiB,WAIxB;IAEF,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,uBAAuB,CAAe;IAC9C,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,YAAY,CAIZ;IACR,OAAO,CAAC,aAAa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