phantomx-tool-client 1.0.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.
Files changed (34) hide show
  1. package/bin/tool-server.js +16 -0
  2. package/dist/Services/EditTool.d.ts +86 -0
  3. package/dist/Services/EditTool.d.ts.map +1 -0
  4. package/dist/Services/EditTool.js +516 -0
  5. package/dist/Services/EditTool.js.map +1 -0
  6. package/dist/Services/Logger.d.ts +32 -0
  7. package/dist/Services/Logger.d.ts.map +1 -0
  8. package/dist/Services/Logger.js +185 -0
  9. package/dist/Services/Logger.js.map +1 -0
  10. package/dist/Services/ReadFileTool.d.ts +49 -0
  11. package/dist/Services/ReadFileTool.d.ts.map +1 -0
  12. package/dist/Services/ReadFileTool.js +239 -0
  13. package/dist/Services/ReadFileTool.js.map +1 -0
  14. package/dist/__tests__/__mocks__/tool-server.mock.d.ts +4 -0
  15. package/dist/__tests__/__mocks__/tool-server.mock.d.ts.map +1 -0
  16. package/dist/__tests__/__mocks__/tool-server.mock.js +8 -0
  17. package/dist/__tests__/__mocks__/tool-server.mock.js.map +1 -0
  18. package/dist/__tests__/toolExecutionService_tempAI.test.d.ts +13 -0
  19. package/dist/__tests__/toolExecutionService_tempAI.test.d.ts.map +1 -0
  20. package/dist/__tests__/toolExecutionService_tempAI.test.js +491 -0
  21. package/dist/__tests__/toolExecutionService_tempAI.test.js.map +1 -0
  22. package/dist/githubOperationsHanlder.d.ts +274 -0
  23. package/dist/githubOperationsHanlder.d.ts.map +1 -0
  24. package/dist/githubOperationsHanlder.js +1487 -0
  25. package/dist/githubOperationsHanlder.js.map +1 -0
  26. package/dist/tool-server.d.ts +4 -0
  27. package/dist/tool-server.d.ts.map +1 -0
  28. package/dist/tool-server.js +190 -0
  29. package/dist/tool-server.js.map +1 -0
  30. package/dist/toolExecutionService.d.ts +28 -0
  31. package/dist/toolExecutionService.d.ts.map +1 -0
  32. package/dist/toolExecutionService.js +464 -0
  33. package/dist/toolExecutionService.js.map +1 -0
  34. package/package.json +58 -0
@@ -0,0 +1,464 @@
1
+ "use strict";
2
+ // this will have implementation for the n number of tools that we have created in the form of client
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.executeSelfHostedTool = executeSelfHostedTool;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ const child_process_1 = require("child_process");
41
+ const githubOperationsHanlder_1 = require("./githubOperationsHanlder");
42
+ const Logger_1 = require("./Services/Logger");
43
+ const logger = (0, Logger_1.createLogger)('ToolExecutionService');
44
+ const githubService = new githubOperationsHanlder_1.GithubOperationsService();
45
+ const normalizeError = (error) => {
46
+ if (error instanceof Error) {
47
+ return error.message;
48
+ }
49
+ return String(error);
50
+ };
51
+ const persistentContextStore = new Map();
52
+ const resolveContextKey = (payload) => {
53
+ const candidateKeys = [
54
+ payload.id
55
+ ];
56
+ for (const key of candidateKeys) {
57
+ if (typeof key === 'string' && key.trim().length > 0) {
58
+ return key.trim();
59
+ }
60
+ }
61
+ return 'default';
62
+ };
63
+ const buildDefaultContext = (basePath, contextKey) => {
64
+ const backgroundProcesses = new Map();
65
+ const processHandles = new Map();
66
+ let nextProcessId = 1;
67
+ const resolvePath = (targetPath) => {
68
+ if (!targetPath || targetPath.trim().length === 0) {
69
+ return basePath;
70
+ }
71
+ return path.isAbsolute(targetPath)
72
+ ? targetPath
73
+ : path.join(basePath, targetPath);
74
+ };
75
+ const executeCommand = async (command) => {
76
+ logger.debug(`[${contextKey}] executeCommand: ${command}`);
77
+ return await new Promise((resolve) => {
78
+ const child = (0, child_process_1.spawn)('bash', ['-lc', command], {
79
+ cwd: basePath,
80
+ stdio: ['ignore', 'pipe', 'pipe'],
81
+ });
82
+ let stdout = '';
83
+ let stderr = '';
84
+ child.stdout.on('data', (chunk) => {
85
+ stdout += chunk.toString();
86
+ });
87
+ child.stderr.on('data', (chunk) => {
88
+ stderr += chunk.toString();
89
+ });
90
+ child.on('close', (code) => {
91
+ if (code === 0) {
92
+ logger.success(`[${contextKey}] executeCommand succeeded: ${command}`);
93
+ }
94
+ else {
95
+ logger.warn(`[${contextKey}] executeCommand failed with exit code ${code}: ${command}`);
96
+ }
97
+ resolve({
98
+ success: code === 0,
99
+ output: stdout,
100
+ error: code === 0 ? '' : (stderr || `Command failed with exit code ${code}`),
101
+ command,
102
+ code,
103
+ });
104
+ });
105
+ child.on('error', (error) => {
106
+ logger.error(`[${contextKey}] executeCommand spawn error for command: ${command}`, error);
107
+ resolve({
108
+ success: false,
109
+ output: stdout,
110
+ error: error.message,
111
+ command,
112
+ code: -1,
113
+ });
114
+ });
115
+ });
116
+ };
117
+ const executeHostCommand = async (command) => {
118
+ // In self-hosted worker mode, this process itself is on host context.
119
+ return await executeCommand(command);
120
+ };
121
+ const startBackgroundProcess = async (command, processName = '', workingDirectory = '') => {
122
+ var _a, _b, _c;
123
+ const processId = nextProcessId++;
124
+ const cwd = workingDirectory && workingDirectory.trim().length > 0
125
+ ? resolvePath(workingDirectory)
126
+ : basePath;
127
+ const child = (0, child_process_1.spawn)('bash', ['-lc', command], {
128
+ cwd,
129
+ detached: true,
130
+ stdio: ['ignore', 'pipe', 'pipe'],
131
+ });
132
+ const processInfo = {
133
+ id: processId,
134
+ name: processName || `process-${processId}`,
135
+ command,
136
+ startTime: new Date().toISOString(),
137
+ status: 'running',
138
+ output: '',
139
+ errorOutput: '',
140
+ exitCode: null,
141
+ pid: (_a = child.pid) !== null && _a !== void 0 ? _a : null,
142
+ };
143
+ (_b = child.stdout) === null || _b === void 0 ? void 0 : _b.on('data', (chunk) => {
144
+ processInfo.output += chunk.toString();
145
+ });
146
+ (_c = child.stderr) === null || _c === void 0 ? void 0 : _c.on('data', (chunk) => {
147
+ processInfo.errorOutput += chunk.toString();
148
+ });
149
+ child.on('close', (code) => {
150
+ processInfo.status = code === 0 ? 'exited' : 'failed';
151
+ processInfo.exitCode = code;
152
+ processHandles.delete(processId);
153
+ });
154
+ child.on('error', (error) => {
155
+ processInfo.status = 'failed';
156
+ processInfo.exitCode = -1;
157
+ processInfo.errorOutput += `${error.message}\n`;
158
+ processHandles.delete(processId);
159
+ });
160
+ child.unref();
161
+ backgroundProcesses.set(processId, processInfo);
162
+ processHandles.set(processId, child);
163
+ logger.info(`[${contextKey}] Background process started — id: ${processId}, name: "${processInfo.name}", pid: ${processInfo.pid}, command: ${command}`);
164
+ child.on('close', (code) => {
165
+ if (code === 0) {
166
+ logger.success(`[${contextKey}] Background process exited cleanly — id: ${processId}, name: "${processInfo.name}"`);
167
+ }
168
+ else {
169
+ logger.warn(`[${contextKey}] Background process exited with code ${code} — id: ${processId}, name: "${processInfo.name}"`);
170
+ }
171
+ });
172
+ return {
173
+ success: true,
174
+ processId,
175
+ status: processInfo.status,
176
+ pid: processInfo.pid,
177
+ processName: processInfo.name,
178
+ command: processInfo.command,
179
+ };
180
+ };
181
+ const listBackgroundProcesses = () => {
182
+ return Array.from(backgroundProcesses.values()).map((record) => ({ ...record }));
183
+ };
184
+ const getBackgroundProcessLogs = async (processId, maxLines = 0, tailMode = true) => {
185
+ logger.debug(`[${contextKey}] getBackgroundProcessLogs called — processId: ${processId}, maxLines: ${maxLines}, tailMode: ${tailMode}`);
186
+ const record = backgroundProcesses.get(processId);
187
+ if (!record) {
188
+ logger.warn(`[${contextKey}] getBackgroundProcessLogs — process ${processId} not found`);
189
+ return {
190
+ success: false,
191
+ error: `Background process ${processId} not found`,
192
+ };
193
+ }
194
+ const combined = `${record.output}${record.errorOutput}`;
195
+ const lines = combined.split('\n');
196
+ let selectedLines = lines;
197
+ if (maxLines > 0) {
198
+ selectedLines = tailMode
199
+ ? lines.slice(Math.max(0, lines.length - maxLines))
200
+ : lines.slice(0, maxLines);
201
+ }
202
+ return {
203
+ success: true,
204
+ processId,
205
+ status: record.status,
206
+ output: selectedLines.join('\n'),
207
+ };
208
+ };
209
+ const terminateBackgroundProcess = async (processId) => {
210
+ logger.info(`[${contextKey}] terminateBackgroundProcess — processId: ${processId}`);
211
+ const record = backgroundProcesses.get(processId);
212
+ if (!record) {
213
+ logger.warn(`[${contextKey}] terminateBackgroundProcess — process ${processId} not found`);
214
+ return {
215
+ success: false,
216
+ error: `Background process ${processId} not found`,
217
+ };
218
+ }
219
+ const child = processHandles.get(processId);
220
+ if (child && child.pid) {
221
+ try {
222
+ process.kill(child.pid, 'SIGTERM');
223
+ record.status = 'failed';
224
+ record.exitCode = -1;
225
+ processHandles.delete(processId);
226
+ logger.success(`[${contextKey}] terminateBackgroundProcess — process ${processId} (pid: ${child.pid}) terminated successfully`);
227
+ return {
228
+ success: true,
229
+ processId,
230
+ status: 'terminated',
231
+ };
232
+ }
233
+ catch (error) {
234
+ logger.error(`[${contextKey}] terminateBackgroundProcess — failed to kill process ${processId} (pid: ${child.pid})`, error);
235
+ return {
236
+ success: false,
237
+ processId,
238
+ error: normalizeError(error),
239
+ };
240
+ }
241
+ }
242
+ logger.warn(`[${contextKey}] terminateBackgroundProcess — no active handle for process ${processId}, current status: ${record.status}`);
243
+ return {
244
+ success: true,
245
+ processId,
246
+ status: record.status,
247
+ };
248
+ };
249
+ const startDockerContainer = async (input) => {
250
+ logger.info(`[${contextKey}] startDockerContainer — input: ${JSON.stringify(input)}`);
251
+ const composeFilePath = resolvePath(String((input === null || input === void 0 ? void 0 : input.composeFilePath) || ''));
252
+ if (!composeFilePath || !fs.existsSync(composeFilePath)) {
253
+ logger.error(`[${contextKey}] startDockerContainer — Docker Compose file not found at path: ${composeFilePath}`);
254
+ return {
255
+ success: false,
256
+ output: '',
257
+ error: `Docker Compose file not found at path: ${composeFilePath}`,
258
+ command: '',
259
+ };
260
+ }
261
+ const detached = (input === null || input === void 0 ? void 0 : input.detached) !== false;
262
+ const buildImages = (input === null || input === void 0 ? void 0 : input.buildImages) === true;
263
+ const forceRecreate = (input === null || input === void 0 ? void 0 : input.forceRecreate) === true;
264
+ const additionalFlags = String((input === null || input === void 0 ? void 0 : input.additionalFlags) || '').trim();
265
+ const services = Array.isArray(input === null || input === void 0 ? void 0 : input.serviceNames) ? input.serviceNames : [];
266
+ const envVars = Object.entries((input === null || input === void 0 ? void 0 : input.environment) || {})
267
+ .map(([k, v]) => `${k}="${String(v)}"`)
268
+ .join(' ');
269
+ let command = `docker compose -f "${composeFilePath}" up`;
270
+ if (detached) {
271
+ command += ' -d';
272
+ }
273
+ if (buildImages) {
274
+ command += ' --build';
275
+ }
276
+ if (forceRecreate) {
277
+ command += ' --force-recreate';
278
+ }
279
+ if (additionalFlags) {
280
+ command += ` ${additionalFlags}`;
281
+ }
282
+ if (services.length > 0) {
283
+ command += ` ${services.join(' ')}`;
284
+ }
285
+ if (envVars) {
286
+ command = `${envVars} ${command}`;
287
+ }
288
+ logger.info(`[${contextKey}] startDockerContainer — running command: ${command}`);
289
+ const execResult = await executeCommand(command);
290
+ if (execResult === null || execResult === void 0 ? void 0 : execResult.success) {
291
+ logger.success(`[${contextKey}] startDockerContainer — container started successfully`);
292
+ }
293
+ else {
294
+ logger.warn(`[${contextKey}] startDockerContainer — container start failed: ${(execResult === null || execResult === void 0 ? void 0 : execResult.error) || 'unknown error'}`);
295
+ }
296
+ return {
297
+ success: !!(execResult === null || execResult === void 0 ? void 0 : execResult.success),
298
+ output: (execResult === null || execResult === void 0 ? void 0 : execResult.output) || '',
299
+ error: (execResult === null || execResult === void 0 ? void 0 : execResult.error) || '',
300
+ command,
301
+ };
302
+ };
303
+ const getDockerContainerStatus = async (input) => {
304
+ const format = (input === null || input === void 0 ? void 0 : input.format) === 'json' ? 'json' : 'table';
305
+ let command = format === 'json'
306
+ ? 'docker ps --format json'
307
+ : 'docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Ports}}"';
308
+ if (Array.isArray(input === null || input === void 0 ? void 0 : input.containerIds) && input.containerIds.length > 0) {
309
+ const ids = input.containerIds.filter((id) => typeof id === 'string' && id.trim().length > 0);
310
+ if (ids.length > 0) {
311
+ const filters = ids.map((id) => `--filter "id=${id}"`).join(' ');
312
+ command = format === 'json'
313
+ ? `docker ps ${filters} --format json`
314
+ : `docker ps ${filters} --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Ports}}"`;
315
+ }
316
+ }
317
+ const execResult = await executeCommand(command);
318
+ return (execResult === null || execResult === void 0 ? void 0 : execResult.output) || execResult;
319
+ };
320
+ return {
321
+ basePath,
322
+ contextKey,
323
+ executeCommand,
324
+ executeHostCommand,
325
+ startBackgroundProcess,
326
+ listBackgroundProcesses,
327
+ getBackgroundProcessLogs,
328
+ terminateBackgroundProcess,
329
+ startDockerContainer,
330
+ getDockerContainerStatus,
331
+ };
332
+ };
333
+ async function executeSelfHostedTool(payload, context) {
334
+ var _a, _b, _c, _d;
335
+ try {
336
+ const basePath = process.env.FILE_WORKER_BASE_PATH || process.cwd();
337
+ const contextKey = resolveContextKey(payload);
338
+ logger.info(`executeSelfHostedTool — invoked | agentId: ${payload.id} | tool: ${(_a = payload === null || payload === void 0 ? void 0 : payload.toolCall) === null || _a === void 0 ? void 0 : _a.name} | contextKey: ${contextKey}`);
339
+ let runtime;
340
+ if (context) {
341
+ logger.debug(`[${contextKey}] Using injected context (override mode)`);
342
+ const defaultContext = buildDefaultContext(basePath, contextKey);
343
+ runtime = {
344
+ ...defaultContext,
345
+ ...(context || {}),
346
+ contextKey,
347
+ };
348
+ }
349
+ else {
350
+ const existingContext = persistentContextStore.get(contextKey);
351
+ if (existingContext) {
352
+ logger.debug(`[${contextKey}] Reusing existing persistent context`);
353
+ runtime = existingContext;
354
+ }
355
+ else {
356
+ logger.info(`[${contextKey}] No existing context found — building new default context | basePath: ${basePath}`);
357
+ runtime = buildDefaultContext(basePath, contextKey);
358
+ persistentContextStore.set(contextKey, runtime);
359
+ }
360
+ }
361
+ const toolName = (_b = payload === null || payload === void 0 ? void 0 : payload.toolCall) === null || _b === void 0 ? void 0 : _b.name;
362
+ const input = ((_c = payload === null || payload === void 0 ? void 0 : payload.toolCall) === null || _c === void 0 ? void 0 : _c.input) || {};
363
+ if (!toolName || typeof toolName !== 'string') {
364
+ logger.error(`[${contextKey}] Invalid tool call payload — missing or non-string tool name | payload: ${JSON.stringify(payload === null || payload === void 0 ? void 0 : payload.toolCall)}`);
365
+ return {
366
+ success: false,
367
+ error: 'Invalid tool call payload: missing tool name',
368
+ };
369
+ }
370
+ let result;
371
+ logger.info(`[${contextKey}] Dispatching tool: "${toolName}"`);
372
+ if (toolName === 'Execute_commmand' && (input === null || input === void 0 ? void 0 : input.command)) {
373
+ result = await runtime.executeCommand(input.command);
374
+ }
375
+ else if (toolName === 'Execute_commmand_host_machine' && (input === null || input === void 0 ? void 0 : input.command)) {
376
+ result = await runtime.executeHostCommand(input.command);
377
+ }
378
+ else if (toolName === 'StartBackgroundProcess') {
379
+ result = await runtime.startBackgroundProcess(input === null || input === void 0 ? void 0 : input.command, input === null || input === void 0 ? void 0 : input.processName, input === null || input === void 0 ? void 0 : input.workingDirectory);
380
+ }
381
+ else if (toolName === 'ListBackgroundProcesses') {
382
+ result = runtime.listBackgroundProcesses();
383
+ }
384
+ else if (toolName === 'GetBackgroundProcessLogs') {
385
+ result = await runtime.getBackgroundProcessLogs(input === null || input === void 0 ? void 0 : input.processId, input === null || input === void 0 ? void 0 : input.maxLines, input === null || input === void 0 ? void 0 : input.tailMode);
386
+ }
387
+ else if (toolName === 'TerminateBackgroundProcess') {
388
+ result = await runtime.terminateBackgroundProcess(input === null || input === void 0 ? void 0 : input.processId);
389
+ }
390
+ else if (toolName === 'StartDockerContainer') {
391
+ result = await runtime.startDockerContainer(input);
392
+ }
393
+ else if (toolName === 'GetDockerContainerStatus') {
394
+ result = await runtime.getDockerContainerStatus(input);
395
+ // ── GitHub tools ────────────────────────────────────────────────────
396
+ }
397
+ else if (toolName === 'Github_GetRepositoryList') {
398
+ result = await githubService.getRepositoryList();
399
+ }
400
+ else if (toolName === 'Github_PullRepository') {
401
+ result = await githubService.pullRepository(input.repoName, undefined);
402
+ }
403
+ else if (toolName === 'Github_PushRepository') {
404
+ result = await githubService.pushRepository(input.repoName, undefined);
405
+ }
406
+ else if (toolName === 'Github_CheckRepositoryStatus') {
407
+ result = await githubService.checkRepositoryStatus(input.repoName, undefined);
408
+ }
409
+ else if (toolName === 'Github_GetRepositoryHistory') {
410
+ result = await githubService.getRepositoryHistory(input.repoName, input.branch || 'main', input.maxCommits || 10);
411
+ }
412
+ else if (toolName === 'Github_CommitLocalChanges') {
413
+ result = await githubService.commitLocalChanges(input.repoName, input.remoteBranchName || 'main', input.commitMessage, {}, undefined);
414
+ }
415
+ else if (toolName === 'Github_CreatePullRequest') {
416
+ result = await githubService.createPullRequest(input.repoName, input.targetBranch, input.title, input.body, undefined);
417
+ }
418
+ else if (toolName === 'Github_CheckPullRequestExists') {
419
+ result = await githubService.checkPullRequestExists(input.repoName, input.targetBranch);
420
+ }
421
+ else if (toolName === 'Github_GetCommitDetails') {
422
+ result = await githubService.getCommitDetails(input.repoName, input.commitHash);
423
+ }
424
+ else if (toolName === 'Github_GetCommitList') {
425
+ result = await githubService.getCommitList(input.repoName, input.branch, input.maxCommits || 100);
426
+ }
427
+ else if (toolName === 'Github_GetLatestCommitDiff') {
428
+ result = await githubService.getLatestCommitDiff(input.repoName, input.branch);
429
+ }
430
+ else if (toolName === 'Github_GetCommitDiffByHash') {
431
+ result = await githubService.getCommitDiffByHash(input.repoName, input.commitHash);
432
+ }
433
+ else if (toolName === 'Github_MergeBranchIntoBranch') {
434
+ result = await githubService.mergeBranchIntoBranch(input.repoName, input.sourceBranch, input.targetBranch, !!input.pushToRemote, undefined);
435
+ }
436
+ else if (toolName.includes('tavily')) {
437
+ logger.warn(`[${contextKey}] Tool "${toolName}" is a server-side only tool (tavily) — rejecting`);
438
+ return {
439
+ success: false,
440
+ error: `Tool ${toolName} must be handled on server-side and is not supported on self-hosted file worker`,
441
+ };
442
+ }
443
+ else {
444
+ logger.warn(`[${contextKey}] Unsupported tool requested: "${toolName}"`);
445
+ return {
446
+ success: false,
447
+ error: `Unsupported tool for self-hosted worker: ${toolName}`,
448
+ };
449
+ }
450
+ logger.success(`[${contextKey}] Tool "${toolName}" executed successfully`);
451
+ return {
452
+ success: true,
453
+ result,
454
+ };
455
+ }
456
+ catch (error) {
457
+ logger.error(`executeSelfHostedTool — unhandled exception | agentId: ${payload === null || payload === void 0 ? void 0 : payload.id} | tool: ${(_d = payload === null || payload === void 0 ? void 0 : payload.toolCall) === null || _d === void 0 ? void 0 : _d.name}`, error);
458
+ return {
459
+ success: false,
460
+ error: normalizeError(error),
461
+ };
462
+ }
463
+ }
464
+ //# sourceMappingURL=toolExecutionService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolExecutionService.js","sourceRoot":"","sources":["../src/toolExecutionService.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W,QAAQ,mDAAmD,CAAC,CAAC;YAClG,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,QAAQ,QAAQ,iFAAiF;aAC3G,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,IAAI,UAAU,kCAAkC,QAAQ,GAAG,CAAC,CAAC;YACzE,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,4CAA4C,QAAQ,EAAE;aAChE,CAAC;QACN,CAAC;QAED,MAAM,CAAC,OAAO,CAAC,IAAI,UAAU,WAAW,QAAQ,yBAAyB,CAAC,CAAC;QAC3E,OAAO;YAEH,OAAO,EAAE,IAAI;YACb,MAAM;SACT,CAAC;IACN,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAC,0DAA0D,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,EAAE,YAAY,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,0CAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;QAChI,OAAO;YAEH,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC;SAC/B,CAAC;IACN,CAAC;AACL,CAAC"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "phantomx-tool-client",
3
+ "version": "1.0.0",
4
+ "description": "Self-hosted tool-server client that connects to a remote orchestration server and executes tools locally",
5
+ "main": "dist/tool-server.js",
6
+ "bin": {
7
+ "tool-server": "bin/tool-server.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "bin",
12
+ "package.json",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "test": "jest --runInBand --forceExit",
17
+ "test:watch": "jest --watch --runInBand",
18
+ "test:coverage": "jest --coverage --runInBand --forceExit",
19
+ "build": "tsc",
20
+ "prepare": "tsc",
21
+ "dev": "ts-node src/tool-server.ts"
22
+ },
23
+ "keywords": [
24
+ "tool-server",
25
+ "socket.io",
26
+ "self-hosted",
27
+ "agent"
28
+ ],
29
+ "author": "",
30
+ "license": "ISC",
31
+ "engines": {
32
+ "node": ">=16.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/cors": "^2.8.19",
36
+ "@types/express": "^5.0.3",
37
+ "@types/jest": "^30.0.0",
38
+ "@types/node": "^24.5.2",
39
+ "jest": "^30.4.2",
40
+ "ts-jest": "^29.4.11",
41
+ "ts-node": "^10.9.2",
42
+ "typescript": "^5.9.2"
43
+ },
44
+ "dependencies": {
45
+ "chalk": "^4.1.2",
46
+ "cors": "^2.8.5",
47
+ "dotenv": "^17.2.2",
48
+ "express": "^5.1.0",
49
+ "fs": "^0.0.1-security",
50
+ "http": "^0.0.1-security",
51
+ "octokit": "^5.0.5",
52
+ "path": "^0.12.7",
53
+ "simple-git": "^3.36.0",
54
+ "socket.io": "^4.8.1",
55
+ "socket.io-client": "^4.8.3",
56
+ "ssh2": "^1.17.0"
57
+ }
58
+ }