shellx-ai 1.1.1 → 1.1.2

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.
@@ -1,404 +0,0 @@
1
- /**
2
- * ShellCommandExecutor - A module for executing shell commands
3
- *
4
- * This module provides functionality for executing shell commands with
5
- * output monitoring, timeout handling, and result management.
6
- */
7
- import { createLogger } from "../logger.js";
8
- // Create logger for ShellCommandExecutor
9
- const logger = createLogger("ShellCommandExecutor");
10
- import { v4 as uuidv4 } from "uuid";
11
- import { OutputBuffer } from "./output-buffer.js";
12
- /** Session ID for PTY terminal output */
13
- const COMMAND_PTY_SID = 999;
14
- /**
15
- * ShellCommandExecutor class handles shell command execution
16
- *
17
- * This class provides methods to:
18
- * - Execute single or multiple shell commands
19
- * - Monitor command output in real-time
20
- * - Handle command timeouts
21
- * - Manage command execution state
22
- */
23
- export class ShellCommandExecutor {
24
- client;
25
- outputBuffer;
26
- /**
27
- * Creates a ShellCommandExecutor instance
28
- *
29
- * @param client - The ConnectionClient instance for command execution
30
- */
31
- constructor(client) {
32
- this.client = client;
33
- this.outputBuffer = new OutputBuffer();
34
- }
35
- /**
36
- * Handle shell output data from WebSocket messages
37
- *
38
- * This method should be called when receiving shell output chunks
39
- * from the WebSocket connection.
40
- *
41
- * @param chunks - Array of [sessionId, length, dataArray] tuples
42
- *
43
- * @example
44
- * ```typescript
45
- * // In WebSocket message handler
46
- * if (message.chunks) {
47
- * executor.handleShellOutput(message.chunks);
48
- * }
49
- * ```
50
- */
51
- handleShellOutput(chunks) {
52
- try {
53
- const [sessionId, , dataArrays] = chunks;
54
- // Validate chunks structure
55
- if (!Array.isArray(chunks) || chunks.length < 3) {
56
- logger.error(`❌ Invalid chunks structure:`, {
57
- length: chunks?.length,
58
- chunks: chunks
59
- });
60
- return;
61
- }
62
- // Validate dataArrays is an array
63
- if (!Array.isArray(dataArrays)) {
64
- logger.error(`❌ dataArrays is not an array:`, {
65
- type: typeof dataArrays,
66
- value: dataArrays
67
- });
68
- return;
69
- }
70
- // Only process COMMAND_PTY_SID sessions
71
- if (sessionId === COMMAND_PTY_SID) {
72
- // Filter and validate each data array
73
- const validDataArrays = dataArrays.filter((data, index) => {
74
- if (!data) {
75
- logger.warn(`⚠️ Skipping null/undefined chunk at index ${index}`);
76
- return false;
77
- }
78
- // Check if it's a Uint8Array
79
- if (!(data instanceof Uint8Array)) {
80
- // Try to convert if it's an array-like object
81
- if (Array.isArray(data) || data.buffer instanceof ArrayBuffer) {
82
- try {
83
- return true;
84
- }
85
- catch {
86
- logger.warn(`⚠️ Cannot convert chunk at index ${index}:`, {
87
- type: typeof data,
88
- constructor: data?.constructor?.name
89
- });
90
- return false;
91
- }
92
- }
93
- logger.warn(`⚠️ Skipping invalid chunk at index ${index}:`, {
94
- type: typeof data,
95
- isUint8Array: data instanceof Uint8Array,
96
- constructor: data?.constructor?.name
97
- });
98
- return false;
99
- }
100
- return true;
101
- });
102
- if (validDataArrays.length > 0) {
103
- this.outputBuffer.handleShellOutput(sessionId, validDataArrays);
104
- }
105
- }
106
- }
107
- catch (error) {
108
- logger.error(`❌ Error in handleShellOutput:`, error);
109
- }
110
- }
111
- /**
112
- * Execute a shell command with output monitoring
113
- *
114
- * @param command - The shell command to execute
115
- * @param options - Command execution options
116
- * @returns Promise resolving to ShellCommandResult
117
- *
118
- * @example
119
- * ```typescript
120
- * const result = await executor.executeShellCommand('ls -la', {
121
- * title: 'List files',
122
- * timeout: 5000,
123
- * onOutput: (output) => console.log(output)
124
- * });
125
- * ```
126
- */
127
- async executeShellCommand(command, options = {}) {
128
- // Validate client
129
- if (!this.client) {
130
- logger.error("❌ Client is not initialized");
131
- return {
132
- success: false,
133
- output: "",
134
- error: "Client not initialized",
135
- duration: 0,
136
- };
137
- }
138
- const startTime = Date.now();
139
- const title = options.title || `Execute command: ${command}`;
140
- const timeout = options.timeout || 3000;
141
- logger.info(`🔨 ${title}`);
142
- logger.debug(`⏱️ Timeout: ${timeout}ms`);
143
- return (async () => {
144
- const commandId = uuidv4();
145
- logger.debug(`🔑 Generated command ID: ${commandId}`);
146
- // Create promise that will be resolved by output buffer
147
- return new Promise((resolve, reject) => {
148
- // Register command promise
149
- this.outputBuffer.registerCommand(commandId, resolve, reject, startTime, options, command);
150
- logger.debug(`📋 [ShellCommandExecutor] Pending commands: ${this.outputBuffer.getPendingCount()}`);
151
- // Set timeout
152
- const timeoutId = setTimeout(() => {
153
- if (this.outputBuffer.hasCommand(commandId)) {
154
- const client = this.getClient();
155
- if (client) {
156
- client.appendExecutionLog(`✅ [Shell] Command ${command} execution completed`);
157
- }
158
- const commandPromise = this.outputBuffer.unregisterCommand(commandId);
159
- resolve({
160
- success: true,
161
- output: commandPromise ? commandPromise.output.trim() : "",
162
- duration: Date.now() - startTime,
163
- });
164
- }
165
- }, timeout);
166
- // Execute the shell command
167
- void (async () => {
168
- try {
169
- const shellAction = {
170
- title,
171
- actions: [
172
- {
173
- type: "command",
174
- command: command,
175
- title: options.title,
176
- },
177
- ],
178
- options: {
179
- timeoutMs: timeout,
180
- },
181
- };
182
- await this.client.sendMessageWithTaskId({ actions: shellAction }, "command", commandId, timeout);
183
- logger.debug(`📤 Command sent: ${commandId}`);
184
- }
185
- catch (error) {
186
- clearTimeout(timeoutId);
187
- this.outputBuffer.unregisterCommand(commandId);
188
- const errorMessage = error instanceof Error ? error.message : String(error);
189
- logger.error(`❌ Failed to send command: ${command}`, error);
190
- resolve({
191
- success: false,
192
- output: "",
193
- error: errorMessage,
194
- duration: Date.now() - startTime,
195
- });
196
- }
197
- })();
198
- });
199
- })();
200
- }
201
- /**
202
- * Execute shell command with simple output (for backward compatibility)
203
- *
204
- * @param command - The shell command to execute
205
- * @param options - Command execution options
206
- * @returns Promise resolving to ShellCommandResult
207
- *
208
- * @example
209
- * ```typescript
210
- * const result = await executor.executeSimpleShellCommand('pm list packages', {
211
- * title: 'List packages',
212
- * timeout: 10000,
213
- * waitAfterMs: 1000
214
- * });
215
- * ```
216
- */
217
- async executeSimpleShellCommand(command, options) {
218
- try {
219
- const result = await this.executeShellCommand(command, {
220
- title: options?.title,
221
- timeout: options?.timeout,
222
- });
223
- // Wait if specified
224
- if (options?.waitAfterMs) {
225
- await new Promise((resolve) => setTimeout(resolve, options.waitAfterMs));
226
- }
227
- const client = this.getClient();
228
- if (client) {
229
- client.appendExecutionLog(`✅ [Shell] Command completed: ${command}`);
230
- }
231
- return result;
232
- }
233
- catch (error) {
234
- logger.error(`❌ Command failed: ${command}`, error);
235
- throw error;
236
- }
237
- }
238
- /**
239
- * Execute multiple shell commands in sequence
240
- *
241
- * @param commands - Array of command configurations
242
- * @param options - Execution options
243
- * @returns Promise resolving to array of ShellCommandResult
244
- *
245
- * @example
246
- * ```typescript
247
- * const results = await executor.executeShellCommands(
248
- * [
249
- * { command: 'pm list packages', title: 'List packages' },
250
- * { command: 'dumpsys battery', title: 'Get battery info' }
251
- * ],
252
- * {
253
- * continueOnError: true,
254
- * timeout: 5000
255
- * }
256
- * );
257
- * ```
258
- */
259
- async executeShellCommands(commands, options) {
260
- const results = [];
261
- try {
262
- logger.info(`🔨 Starting execution of ${commands.length} commands`);
263
- for (const [index, cmd] of commands.entries()) {
264
- try {
265
- const title = cmd.title || `Command ${index + 1}/${commands.length}: ${cmd.command}`;
266
- logger.info(`🔨 ${title}`);
267
- const result = await this.executeShellCommand(cmd.command, {
268
- title,
269
- timeout: options?.timeout,
270
- waitAfterMs: cmd.waitAfterMs,
271
- });
272
- results.push(result);
273
- }
274
- catch (error) {
275
- logger.error(`❌ Command ${index + 1} failed:`, error);
276
- if (options?.continueOnError) {
277
- results.push({
278
- success: false,
279
- output: "",
280
- error: error instanceof Error ? error.message : String(error),
281
- duration: 0,
282
- });
283
- continue;
284
- }
285
- else {
286
- throw error;
287
- }
288
- }
289
- }
290
- logger.info(`✅ All commands completed`);
291
- return results;
292
- }
293
- catch (error) {
294
- logger.error(`❌ Batch command execution failed:`, error);
295
- throw error;
296
- }
297
- }
298
- /**
299
- * Execute an ADB command
300
- *
301
- * @param command - The ADB command to execute (without 'adb' prefix)
302
- * @param options - Command execution options
303
- * @returns Promise resolving to ShellCommandResult
304
- *
305
- * @example
306
- * ```typescript
307
- * const result = await executor.adbCommand('shell pm list packages', {
308
- * title: 'List packages via ADB',
309
- * timeout: 10000
310
- * });
311
- * ```
312
- */
313
- async adbCommand(command, options) {
314
- return this.executeShellCommand(command, {
315
- title: options?.title || `ADB command: ${command}`,
316
- timeout: options?.timeout,
317
- waitAfterMs: options?.waitAfterMs,
318
- onOutput: options?.onOutput,
319
- onError: options?.onError,
320
- expectedOutput: options?.expectedOutput,
321
- successPattern: options?.successPattern,
322
- });
323
- }
324
- /**
325
- * Execute a key action (press a hardware key)
326
- *
327
- * @param keyCode - The key code to press (e.g., 'KEYCODE_HOME', 'KEYCODE_BACK')
328
- * @param options - Execution options
329
- * @returns Promise resolving to boolean indicating success
330
- *
331
- * @example
332
- * ```typescript
333
- * const success = await executor.executeKeyAction('KEYCODE_HOME', {
334
- * longPress: false,
335
- * waitAfterMs: 500
336
- * });
337
- * ```
338
- */
339
- async executeKeyAction(keyCode, options = {}) {
340
- try {
341
- logger.info(`🔑 Executing key action: ${keyCode}${options.longPress ? " (long press)" : ""}`);
342
- const keyAction = {
343
- title: `Key press: ${keyCode}${options.longPress ? " (long press)" : ""}`,
344
- actions: [
345
- {
346
- type: "key",
347
- keyCode,
348
- options: {
349
- longPress: options.longPress,
350
- },
351
- },
352
- ],
353
- };
354
- await this.client.executeAction(keyAction);
355
- // Wait if specified
356
- if (options.waitAfterMs) {
357
- await new Promise((resolve) => setTimeout(resolve, options.waitAfterMs));
358
- }
359
- logger.info(`✅ Key action completed: ${keyCode}`);
360
- return true;
361
- }
362
- catch (error) {
363
- logger.error(`❌ Key action failed: ${keyCode}`, error);
364
- return false;
365
- }
366
- }
367
- /**
368
- * Get the underlying client instance
369
- *
370
- * @returns The ConnectionClient instance
371
- */
372
- getClient() {
373
- if (!this.client) {
374
- logger.error("❌ Attempted to access null client");
375
- return null;
376
- }
377
- return this.client;
378
- }
379
- /**
380
- * Get the output buffer instance
381
- *
382
- * @returns The OutputBuffer instance
383
- */
384
- getOutputBuffer() {
385
- return this.outputBuffer;
386
- }
387
- /**
388
- * Clear all pending command promises
389
- *
390
- * This method is useful for cleanup scenarios
391
- */
392
- clearPendingCommands() {
393
- this.outputBuffer.clear();
394
- }
395
- /**
396
- * Get the number of pending commands
397
- *
398
- * @returns The number of currently pending commands
399
- */
400
- getPendingCommandCount() {
401
- return this.outputBuffer.getPendingCount();
402
- }
403
- }
404
- //# sourceMappingURL=shell-command-executor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shell-command-executor.js","sourceRoot":"","sources":["../../src/shell/shell-command-executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,yCAAyC;AACzC,MAAM,MAAM,GAAG,YAAY,CAAC,sBAAsB,CAAC,CAAC;AACpD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAmBlD,yCAAyC;AACzC,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;;;;;;;GAQG;AACH,MAAM,OAAO,oBAAoB;IAQX;IAPZ,YAAY,CAAe;IAEnC;;;;OAIG;IACH,YAAoB,MAAyB;QAAzB,WAAM,GAAN,MAAM,CAAmB;QAC3C,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;IACzC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACI,iBAAiB,CAAC,MAAsC;QAC7D,IAAI,CAAC;YACH,MAAM,CAAC,SAAS,EAAE,AAAD,EAAG,UAAU,CAAC,GAAG,MAAM,CAAC;YAEzC,4BAA4B;YAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CA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