synapse-mcp 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 (138) hide show
  1. package/README.md +607 -0
  2. package/dist/constants.d.ts +23 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/constants.js +58 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/formatters/index.d.ts +275 -0
  7. package/dist/formatters/index.d.ts.map +1 -0
  8. package/dist/formatters/index.js +461 -0
  9. package/dist/formatters/index.js.map +1 -0
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +178 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/schemas/common.d.ts +48 -0
  15. package/dist/schemas/common.d.ts.map +1 -0
  16. package/dist/schemas/common.js +69 -0
  17. package/dist/schemas/common.js.map +1 -0
  18. package/dist/schemas/discriminator.d.ts +20 -0
  19. package/dist/schemas/discriminator.d.ts.map +1 -0
  20. package/dist/schemas/discriminator.js +25 -0
  21. package/dist/schemas/discriminator.js.map +1 -0
  22. package/dist/schemas/flux/compose.d.ts +93 -0
  23. package/dist/schemas/flux/compose.d.ts.map +1 -0
  24. package/dist/schemas/flux/compose.js +112 -0
  25. package/dist/schemas/flux/compose.js.map +1 -0
  26. package/dist/schemas/flux/container.d.ts +144 -0
  27. package/dist/schemas/flux/container.d.ts.map +1 -0
  28. package/dist/schemas/flux/container.js +163 -0
  29. package/dist/schemas/flux/container.js.map +1 -0
  30. package/dist/schemas/flux/docker.d.ts +91 -0
  31. package/dist/schemas/flux/docker.d.ts.map +1 -0
  32. package/dist/schemas/flux/docker.js +101 -0
  33. package/dist/schemas/flux/docker.js.map +1 -0
  34. package/dist/schemas/flux/host.d.ts +61 -0
  35. package/dist/schemas/flux/host.d.ts.map +1 -0
  36. package/dist/schemas/flux/host.js +72 -0
  37. package/dist/schemas/flux/host.js.map +1 -0
  38. package/dist/schemas/flux/index.d.ts +20 -0
  39. package/dist/schemas/flux/index.d.ts.map +1 -0
  40. package/dist/schemas/flux/index.js +88 -0
  41. package/dist/schemas/flux/index.js.map +1 -0
  42. package/dist/schemas/index.d.ts +11 -0
  43. package/dist/schemas/index.d.ts.map +1 -0
  44. package/dist/schemas/index.js +11 -0
  45. package/dist/schemas/index.js.map +1 -0
  46. package/dist/schemas/scout/index.d.ts +151 -0
  47. package/dist/schemas/scout/index.d.ts.map +1 -0
  48. package/dist/schemas/scout/index.js +41 -0
  49. package/dist/schemas/scout/index.js.map +1 -0
  50. package/dist/schemas/scout/logs.d.ts +48 -0
  51. package/dist/schemas/scout/logs.d.ts.map +1 -0
  52. package/dist/schemas/scout/logs.js +47 -0
  53. package/dist/schemas/scout/logs.js.map +1 -0
  54. package/dist/schemas/scout/simple.d.ts +68 -0
  55. package/dist/schemas/scout/simple.d.ts.map +1 -0
  56. package/dist/schemas/scout/simple.js +75 -0
  57. package/dist/schemas/scout/simple.js.map +1 -0
  58. package/dist/schemas/scout/zfs.d.ts +37 -0
  59. package/dist/schemas/scout/zfs.d.ts.map +1 -0
  60. package/dist/schemas/scout/zfs.js +36 -0
  61. package/dist/schemas/scout/zfs.js.map +1 -0
  62. package/dist/schemas/unified.d.ts +674 -0
  63. package/dist/schemas/unified.d.ts.map +1 -0
  64. package/dist/schemas/unified.js +453 -0
  65. package/dist/schemas/unified.js.map +1 -0
  66. package/dist/services/compose.d.ts +107 -0
  67. package/dist/services/compose.d.ts.map +1 -0
  68. package/dist/services/compose.js +308 -0
  69. package/dist/services/compose.js.map +1 -0
  70. package/dist/services/container.d.ts +69 -0
  71. package/dist/services/container.d.ts.map +1 -0
  72. package/dist/services/container.js +111 -0
  73. package/dist/services/container.js.map +1 -0
  74. package/dist/services/docker.d.ts +243 -0
  75. package/dist/services/docker.d.ts.map +1 -0
  76. package/dist/services/docker.js +812 -0
  77. package/dist/services/docker.js.map +1 -0
  78. package/dist/services/file-service.d.ts +79 -0
  79. package/dist/services/file-service.d.ts.map +1 -0
  80. package/dist/services/file-service.js +226 -0
  81. package/dist/services/file-service.js.map +1 -0
  82. package/dist/services/interfaces.d.ts +537 -0
  83. package/dist/services/interfaces.d.ts.map +1 -0
  84. package/dist/services/interfaces.js +2 -0
  85. package/dist/services/interfaces.js.map +1 -0
  86. package/dist/services/ssh-pool-exec.d.ts +10 -0
  87. package/dist/services/ssh-pool-exec.d.ts.map +1 -0
  88. package/dist/services/ssh-pool-exec.js +10 -0
  89. package/dist/services/ssh-pool-exec.js.map +1 -0
  90. package/dist/services/ssh-pool.d.ts +66 -0
  91. package/dist/services/ssh-pool.d.ts.map +1 -0
  92. package/dist/services/ssh-pool.js +253 -0
  93. package/dist/services/ssh-pool.js.map +1 -0
  94. package/dist/services/ssh-service.d.ts +39 -0
  95. package/dist/services/ssh-service.d.ts.map +1 -0
  96. package/dist/services/ssh-service.js +143 -0
  97. package/dist/services/ssh-service.js.map +1 -0
  98. package/dist/services/ssh.d.ts +37 -0
  99. package/dist/services/ssh.d.ts.map +1 -0
  100. package/dist/services/ssh.js +50 -0
  101. package/dist/services/ssh.js.map +1 -0
  102. package/dist/tools/flux.d.ts +14 -0
  103. package/dist/tools/flux.d.ts.map +1 -0
  104. package/dist/tools/flux.js +86 -0
  105. package/dist/tools/flux.js.map +1 -0
  106. package/dist/tools/index.d.ts +7 -0
  107. package/dist/tools/index.d.ts.map +1 -0
  108. package/dist/tools/index.js +43 -0
  109. package/dist/tools/index.js.map +1 -0
  110. package/dist/tools/scout.d.ts +14 -0
  111. package/dist/tools/scout.d.ts.map +1 -0
  112. package/dist/tools/scout.js +96 -0
  113. package/dist/tools/scout.js.map +1 -0
  114. package/dist/tools/unified.d.ts +7 -0
  115. package/dist/tools/unified.d.ts.map +1 -0
  116. package/dist/tools/unified.js +827 -0
  117. package/dist/tools/unified.js.map +1 -0
  118. package/dist/types.d.ts +93 -0
  119. package/dist/types.d.ts.map +1 -0
  120. package/dist/types.js +7 -0
  121. package/dist/types.js.map +1 -0
  122. package/dist/utils/errors.d.ts +60 -0
  123. package/dist/utils/errors.d.ts.map +1 -0
  124. package/dist/utils/errors.js +131 -0
  125. package/dist/utils/errors.js.map +1 -0
  126. package/dist/utils/help.d.ts +69 -0
  127. package/dist/utils/help.d.ts.map +1 -0
  128. package/dist/utils/help.js +259 -0
  129. package/dist/utils/help.js.map +1 -0
  130. package/dist/utils/index.d.ts +4 -0
  131. package/dist/utils/index.d.ts.map +1 -0
  132. package/dist/utils/index.js +4 -0
  133. package/dist/utils/index.js.map +1 -0
  134. package/dist/utils/path-security.d.ts +64 -0
  135. package/dist/utils/path-security.d.ts.map +1 -0
  136. package/dist/utils/path-security.js +138 -0
  137. package/dist/utils/path-security.js.map +1 -0
  138. package/package.json +85 -0
@@ -0,0 +1,537 @@
1
+ import type { HostConfig, ContainerInfo, ContainerStats, HostStatus, LogEntry, ImageInfo } from "../types.js";
2
+ import type Docker from "dockerode";
3
+ import type { NodeSSH } from "node-ssh";
4
+ import type { HostResources } from "./ssh.js";
5
+ import type { DockerSystemInfo, DockerDiskUsage, PruneResult, ListImagesOptions } from "./docker.js";
6
+ import type { PoolStats } from "./ssh-pool.js";
7
+ import type { ComposeProject } from "./compose.js";
8
+ /**
9
+ * Docker service interface for managing Docker containers, images, and resources.
10
+ * Provides operations for container lifecycle management, image operations, system queries,
11
+ * and Docker daemon interactions across multiple hosts.
12
+ */
13
+ export interface IDockerService {
14
+ /**
15
+ * Get a Docker client instance for the specified host configuration.
16
+ * Clients are cached per host to reuse connections.
17
+ *
18
+ * @param config - Host configuration containing connection details
19
+ * @returns Docker client instance (dockerode)
20
+ */
21
+ getDockerClient(config: HostConfig): Docker;
22
+ /**
23
+ * List containers across multiple hosts with optional filtering.
24
+ *
25
+ * @param hosts - Array of host configurations to query
26
+ * @param options - Filtering options
27
+ * @param options.state - Filter by container state (all, running, stopped, paused)
28
+ * @param options.nameFilter - Filter by container name (partial match)
29
+ * @param options.imageFilter - Filter by image name (partial match)
30
+ * @param options.labelFilter - Filter by label (format: "key=value")
31
+ * @returns Array of containers with their details and host information
32
+ */
33
+ listContainers(hosts: HostConfig[], options?: {
34
+ state?: "all" | "running" | "stopped" | "paused";
35
+ nameFilter?: string;
36
+ imageFilter?: string;
37
+ labelFilter?: string;
38
+ }): Promise<ContainerInfo[]>;
39
+ /**
40
+ * Perform a lifecycle action on a container.
41
+ *
42
+ * @param containerId - Container ID or name
43
+ * @param action - Action to perform (start, stop, restart, pause, unpause)
44
+ * @param host - Host configuration where container is located
45
+ */
46
+ containerAction(containerId: string, action: "start" | "stop" | "restart" | "pause" | "unpause", host: HostConfig): Promise<void>;
47
+ /**
48
+ * Retrieve logs from a container.
49
+ *
50
+ * @param containerId - Container ID or name
51
+ * @param host - Host configuration where container is located
52
+ * @param options - Log retrieval options
53
+ * @param options.lines - Number of lines to retrieve (default: 100)
54
+ * @param options.since - Show logs since timestamp or duration (e.g., "2023-01-01T00:00:00Z" or "10m")
55
+ * @param options.until - Show logs until timestamp or duration
56
+ * @param options.stream - Stream to retrieve (all, stdout, stderr)
57
+ * @returns Array of log entries with timestamps and content
58
+ */
59
+ getContainerLogs(containerId: string, host: HostConfig, options?: {
60
+ lines?: number;
61
+ since?: string;
62
+ until?: string;
63
+ stream?: "all" | "stdout" | "stderr";
64
+ }): Promise<LogEntry[]>;
65
+ /**
66
+ * Get resource usage statistics for a container.
67
+ *
68
+ * @param containerId - Container ID or name
69
+ * @param host - Host configuration where container is located
70
+ * @returns Resource statistics including CPU, memory, network, and I/O
71
+ */
72
+ getContainerStats(containerId: string, host: HostConfig): Promise<ContainerStats>;
73
+ /**
74
+ * Find which host a container is running on.
75
+ * Searches across all provided hosts.
76
+ *
77
+ * @param containerId - Container ID or name to find
78
+ * @param hosts - Array of host configurations to search
79
+ * @returns Host config and container info if found, null otherwise
80
+ */
81
+ findContainerHost(containerId: string, hosts: HostConfig[]): Promise<{
82
+ host: HostConfig;
83
+ container: Docker.ContainerInfo;
84
+ } | null>;
85
+ /**
86
+ * Get Docker daemon status and version info for multiple hosts.
87
+ *
88
+ * @param hosts - Array of host configurations to check
89
+ * @returns Array of host statuses with daemon info and reachability
90
+ */
91
+ getHostStatus(hosts: HostConfig[]): Promise<HostStatus[]>;
92
+ /**
93
+ * List Docker images across multiple hosts with optional filtering.
94
+ *
95
+ * @param hosts - Array of host configurations to query
96
+ * @param options - Filtering options (dangling, reference, etc.)
97
+ * @returns Array of images with their details and host information
98
+ */
99
+ listImages(hosts: HostConfig[], options?: ListImagesOptions): Promise<ImageInfo[]>;
100
+ /**
101
+ * Get detailed information about a container.
102
+ *
103
+ * @param containerId - Container ID or name
104
+ * @param host - Host configuration where container is located
105
+ * @returns Full container inspection data from Docker API
106
+ */
107
+ inspectContainer(containerId: string, host: HostConfig): Promise<Docker.ContainerInspectInfo>;
108
+ /**
109
+ * Get Docker daemon system information.
110
+ *
111
+ * @param host - Host configuration to query
112
+ * @returns System info including version, OS, architecture, and resource limits
113
+ */
114
+ getDockerInfo(host: HostConfig): Promise<DockerSystemInfo>;
115
+ /**
116
+ * Get Docker disk usage information.
117
+ *
118
+ * @param host - Host configuration to query
119
+ * @returns Disk usage breakdown for images, containers, volumes, and build cache
120
+ */
121
+ getDockerDiskUsage(host: HostConfig): Promise<DockerDiskUsage>;
122
+ /**
123
+ * Remove unused Docker resources (prune operation).
124
+ *
125
+ * @param host - Host configuration where pruning should occur
126
+ * @param target - Resource type to prune (containers, images, volumes, networks, buildcache, all)
127
+ * @returns Array of prune results showing what was removed and space reclaimed
128
+ */
129
+ pruneDocker(host: HostConfig, target: "containers" | "images" | "volumes" | "networks" | "buildcache" | "all"): Promise<PruneResult[]>;
130
+ /**
131
+ * Pull a Docker image from a registry.
132
+ *
133
+ * @param imageName - Image name with optional tag (e.g., "nginx:latest")
134
+ * @param host - Host configuration where image should be pulled
135
+ * @returns Operation status
136
+ */
137
+ pullImage(imageName: string, host: HostConfig): Promise<{
138
+ status: string;
139
+ }>;
140
+ /**
141
+ * Recreate a container with the same configuration.
142
+ * Optionally pulls the latest image before recreating.
143
+ *
144
+ * @param containerId - Container ID or name to recreate
145
+ * @param host - Host configuration where container is located
146
+ * @param options - Recreate options
147
+ * @param options.pull - Whether to pull latest image before recreating
148
+ * @returns Operation status and new container ID
149
+ */
150
+ recreateContainer(containerId: string, host: HostConfig, options?: {
151
+ pull?: boolean;
152
+ }): Promise<{
153
+ status: string;
154
+ containerId: string;
155
+ }>;
156
+ /**
157
+ * Remove a Docker image.
158
+ *
159
+ * @param imageId - Image ID or name to remove
160
+ * @param host - Host configuration where image is located
161
+ * @param options - Removal options
162
+ * @param options.force - Force removal even if image is in use
163
+ * @returns Operation status
164
+ */
165
+ removeImage(imageId: string, host: HostConfig, options?: {
166
+ force?: boolean;
167
+ }): Promise<{
168
+ status: string;
169
+ }>;
170
+ /**
171
+ * Build a Docker image from a Dockerfile.
172
+ *
173
+ * @param host - Host configuration where build should occur
174
+ * @param options - Build options
175
+ * @param options.context - Path to build context directory
176
+ * @param options.tag - Tag for the built image
177
+ * @param options.dockerfile - Path to Dockerfile (relative to context, default: "Dockerfile")
178
+ * @param options.noCache - Disable build cache
179
+ * @returns Operation status
180
+ */
181
+ buildImage(host: HostConfig, options: {
182
+ context: string;
183
+ tag: string;
184
+ dockerfile?: string;
185
+ noCache?: boolean;
186
+ }): Promise<{
187
+ status: string;
188
+ }>;
189
+ /**
190
+ * Clear all cached Docker client connections.
191
+ * Useful for cleanup during shutdown or when connections need to be reset.
192
+ */
193
+ clearClients(): void;
194
+ }
195
+ /**
196
+ * SSH service interface for executing commands on remote hosts.
197
+ * Provides secure command execution and resource monitoring via SSH connections.
198
+ */
199
+ export interface ISSHService {
200
+ /**
201
+ * Execute a command on a remote host via SSH.
202
+ *
203
+ * @param host - Host configuration containing SSH connection details
204
+ * @param command - Command to execute (will be sanitized for security)
205
+ * @param args - Optional command arguments (sanitized separately)
206
+ * @param options - Execution options
207
+ * @param options.timeoutMs - Command timeout in milliseconds
208
+ * @returns Command output as string (stdout)
209
+ * @throws SSHCommandError if command fails or times out
210
+ */
211
+ executeSSHCommand(host: HostConfig, command: string, args?: string[], options?: {
212
+ timeoutMs?: number;
213
+ }): Promise<string>;
214
+ /**
215
+ * Get system resource information from a remote host.
216
+ * Retrieves CPU, memory, disk usage, and uptime.
217
+ *
218
+ * @param host - Host configuration to query
219
+ * @returns Resource information including CPU, memory, disk, and uptime
220
+ */
221
+ getHostResources(host: HostConfig): Promise<HostResources>;
222
+ }
223
+ /**
224
+ * Docker Compose service interface for managing multi-container applications.
225
+ * Provides operations for Compose project lifecycle management, service control,
226
+ * and log retrieval.
227
+ */
228
+ export interface IComposeService {
229
+ /**
230
+ * Execute a Docker Compose command on a remote host.
231
+ * Low-level method for running arbitrary Compose actions.
232
+ *
233
+ * @param host - Host configuration where project is located
234
+ * @param project - Compose project name
235
+ * @param action - Compose action/subcommand (e.g., "up", "down", "ps")
236
+ * @param extraArgs - Additional arguments to pass to the command
237
+ * @returns Command output as string
238
+ */
239
+ composeExec(host: HostConfig, project: string, action: string, extraArgs?: string[]): Promise<string>;
240
+ /**
241
+ * List all Docker Compose projects on a host.
242
+ *
243
+ * @param host - Host configuration to query
244
+ * @returns Array of Compose projects with their status and services
245
+ */
246
+ listComposeProjects(host: HostConfig): Promise<ComposeProject[]>;
247
+ /**
248
+ * Get detailed status of a specific Compose project.
249
+ *
250
+ * @param host - Host configuration where project is located
251
+ * @param project - Compose project name
252
+ * @returns Project details including service states and configuration
253
+ */
254
+ getComposeStatus(host: HostConfig, project: string): Promise<ComposeProject>;
255
+ /**
256
+ * Start a Docker Compose project (bring services up).
257
+ *
258
+ * @param host - Host configuration where project is located
259
+ * @param project - Compose project name
260
+ * @param detach - Run in detached mode (default: true)
261
+ * @returns Command output
262
+ */
263
+ composeUp(host: HostConfig, project: string, detach?: boolean): Promise<string>;
264
+ /**
265
+ * Stop and remove a Docker Compose project (bring services down).
266
+ *
267
+ * @param host - Host configuration where project is located
268
+ * @param project - Compose project name
269
+ * @param removeVolumes - Also remove named volumes (default: false)
270
+ * @returns Command output
271
+ */
272
+ composeDown(host: HostConfig, project: string, removeVolumes?: boolean): Promise<string>;
273
+ /**
274
+ * Restart all services in a Docker Compose project.
275
+ *
276
+ * @param host - Host configuration where project is located
277
+ * @param project - Compose project name
278
+ * @returns Command output
279
+ */
280
+ composeRestart(host: HostConfig, project: string): Promise<string>;
281
+ /**
282
+ * Retrieve logs from Docker Compose services.
283
+ *
284
+ * @param host - Host configuration where project is located
285
+ * @param project - Compose project name
286
+ * @param options - Log retrieval options
287
+ * @param options.tail - Number of lines to show from end of logs
288
+ * @param options.follow - Follow log output (stream mode)
289
+ * @param options.timestamps - Include timestamps in output
290
+ * @param options.since - Show logs since timestamp or duration
291
+ * @param options.until - Show logs until timestamp or duration
292
+ * @param options.services - Filter logs to specific services
293
+ * @returns Log output as string
294
+ */
295
+ composeLogs(host: HostConfig, project: string, options?: {
296
+ tail?: number;
297
+ follow?: boolean;
298
+ timestamps?: boolean;
299
+ since?: string;
300
+ until?: string;
301
+ services?: string[];
302
+ }): Promise<string>;
303
+ /**
304
+ * Build or rebuild Docker Compose services.
305
+ *
306
+ * @param host - Host configuration where project is located
307
+ * @param project - Compose project name
308
+ * @param options - Build options
309
+ * @param options.service - Build only specific service
310
+ * @param options.noCache - Do not use cache when building
311
+ * @param options.pull - Always pull newer versions of base images
312
+ * @returns Command output
313
+ */
314
+ composeBuild(host: HostConfig, project: string, options?: {
315
+ service?: string;
316
+ noCache?: boolean;
317
+ pull?: boolean;
318
+ }): Promise<string>;
319
+ /**
320
+ * Pull service images defined in Docker Compose file.
321
+ *
322
+ * @param host - Host configuration where project is located
323
+ * @param project - Compose project name
324
+ * @param options - Pull options
325
+ * @param options.service - Pull only specific service
326
+ * @param options.ignorePullFailures - Continue even if some pulls fail
327
+ * @param options.quiet - Suppress output
328
+ * @returns Command output
329
+ */
330
+ composePull(host: HostConfig, project: string, options?: {
331
+ service?: string;
332
+ ignorePullFailures?: boolean;
333
+ quiet?: boolean;
334
+ }): Promise<string>;
335
+ /**
336
+ * Recreate containers for Docker Compose services.
337
+ * Useful for applying configuration changes without rebuilding images.
338
+ *
339
+ * @param host - Host configuration where project is located
340
+ * @param project - Compose project name
341
+ * @param options - Recreate options
342
+ * @param options.service - Recreate only specific service
343
+ * @param options.forceRecreate - Force recreation even if config hasn't changed
344
+ * @param options.noDeps - Don't recreate dependent services
345
+ * @returns Command output
346
+ */
347
+ composeRecreate(host: HostConfig, project: string, options?: {
348
+ service?: string;
349
+ forceRecreate?: boolean;
350
+ noDeps?: boolean;
351
+ }): Promise<string>;
352
+ }
353
+ /**
354
+ * SSH connection pool interface for managing reusable SSH connections.
355
+ * Provides connection pooling to reduce overhead of establishing SSH connections
356
+ * and improve performance for repeated operations.
357
+ */
358
+ export interface ISSHConnectionPool {
359
+ /**
360
+ * Get an SSH connection from the pool for the specified host.
361
+ * Creates a new connection if none exists or all are in use.
362
+ *
363
+ * @param host - Host configuration for the connection
364
+ * @returns Active SSH connection ready for use
365
+ * @throws SSHConnectionError if connection cannot be established
366
+ */
367
+ getConnection(host: HostConfig): Promise<NodeSSH>;
368
+ /**
369
+ * Return an SSH connection to the pool for reuse.
370
+ * Connection remains open and available for future requests.
371
+ *
372
+ * @param host - Host configuration the connection belongs to
373
+ * @param connection - SSH connection to release back to pool
374
+ */
375
+ releaseConnection(host: HostConfig, connection: NodeSSH): Promise<void>;
376
+ /**
377
+ * Close a specific host's connection and remove from pool.
378
+ * Use when connection is no longer needed or has errors.
379
+ *
380
+ * @param host - Host configuration whose connection should be closed
381
+ */
382
+ closeConnection(host: HostConfig): Promise<void>;
383
+ /**
384
+ * Close all connections in the pool and clear pool state.
385
+ * Use during shutdown or cleanup.
386
+ */
387
+ closeAll(): Promise<void>;
388
+ /**
389
+ * Get connection pool statistics.
390
+ * Useful for monitoring pool health and performance.
391
+ *
392
+ * @returns Statistics including active connections, pool size, and usage metrics
393
+ */
394
+ getStats(): PoolStats;
395
+ }
396
+ /**
397
+ * Service factory interface for creating service instances with dependency injection.
398
+ * Provides centralized creation of all service instances with proper dependency wiring.
399
+ */
400
+ export interface IServiceFactory {
401
+ /**
402
+ * Create a Docker service instance.
403
+ * Docker service manages Docker API connections and operations.
404
+ *
405
+ * @returns Docker service instance
406
+ */
407
+ createDockerService(): IDockerService;
408
+ /**
409
+ * Create an SSH connection pool instance.
410
+ *
411
+ * @param config - Optional pool configuration
412
+ * @param config.maxConnections - Maximum number of connections per host (default: 5)
413
+ * @returns SSH connection pool instance
414
+ */
415
+ createSSHConnectionPool(config?: Partial<{
416
+ maxConnections: number;
417
+ }>): ISSHConnectionPool;
418
+ /**
419
+ * Create an SSH service instance.
420
+ * SSH service requires a connection pool for managing connections.
421
+ *
422
+ * @param pool - SSH connection pool to use for managing connections
423
+ * @returns SSH service instance
424
+ */
425
+ createSSHService(pool: ISSHConnectionPool): ISSHService;
426
+ /**
427
+ * Create a Docker Compose service instance.
428
+ * Compose service requires SSH service for executing remote commands.
429
+ *
430
+ * @param sshService - SSH service to use for remote command execution
431
+ * @returns Compose service instance
432
+ */
433
+ createComposeService(sshService: ISSHService): IComposeService;
434
+ /**
435
+ * Create a File service instance.
436
+ * File service requires SSH service for remote file operations.
437
+ *
438
+ * @param sshService - SSH service to use for remote command execution
439
+ * @returns File service instance
440
+ */
441
+ createFileService(sshService: ISSHService): IFileService;
442
+ }
443
+ /**
444
+ * File service interface for remote file operations via SSH.
445
+ * Provides secure file reading, directory listing, command execution,
446
+ * and file transfer capabilities across hosts.
447
+ */
448
+ export interface IFileService {
449
+ /**
450
+ * Read content from a file on a remote host.
451
+ *
452
+ * @param host - Host configuration where the file is located
453
+ * @param path - Absolute path to the file to read
454
+ * @param maxSize - Maximum bytes to read (content truncated if exceeded)
455
+ * @returns Object containing file content, size, and truncation status
456
+ */
457
+ readFile(host: HostConfig, path: string, maxSize: number): Promise<{
458
+ content: string;
459
+ size: number;
460
+ truncated: boolean;
461
+ }>;
462
+ /**
463
+ * List contents of a directory on a remote host.
464
+ *
465
+ * @param host - Host configuration where the directory is located
466
+ * @param path - Absolute path to the directory
467
+ * @param showHidden - Whether to show hidden files (prefixed with .)
468
+ * @returns Directory listing as string (ls output)
469
+ */
470
+ listDirectory(host: HostConfig, path: string, showHidden: boolean): Promise<string>;
471
+ /**
472
+ * Get tree representation of a directory structure.
473
+ *
474
+ * @param host - Host configuration where the directory is located
475
+ * @param path - Absolute path to the directory
476
+ * @param depth - Maximum depth to traverse
477
+ * @returns Tree output as string
478
+ */
479
+ treeDirectory(host: HostConfig, path: string, depth: number): Promise<string>;
480
+ /**
481
+ * Execute a command in a working directory on a remote host.
482
+ * SECURITY: Commands are validated against an allowlist by default.
483
+ *
484
+ * @param host - Host configuration where to execute
485
+ * @param path - Working directory for command execution
486
+ * @param command - Command to execute (must be in allowlist unless env override)
487
+ * @param timeout - Command timeout in milliseconds
488
+ * @returns Object containing stdout and exit code
489
+ */
490
+ executeCommand(host: HostConfig, path: string, command: string, timeout: number): Promise<{
491
+ stdout: string;
492
+ exitCode: number;
493
+ }>;
494
+ /**
495
+ * Find files matching a pattern on a remote host.
496
+ *
497
+ * @param host - Host configuration to search
498
+ * @param path - Base directory to search from
499
+ * @param pattern - Glob pattern to match (e.g., "*.log")
500
+ * @param options - Search options
501
+ * @param options.type - File type filter (f=file, d=directory, l=symlink)
502
+ * @param options.maxDepth - Maximum search depth
503
+ * @param options.limit - Maximum number of results
504
+ * @returns Newline-separated list of matching paths
505
+ */
506
+ findFiles(host: HostConfig, path: string, pattern: string, options: {
507
+ type?: "f" | "d" | "l";
508
+ maxDepth?: number;
509
+ limit?: number;
510
+ }): Promise<string>;
511
+ /**
512
+ * Transfer a file between hosts via SCP.
513
+ *
514
+ * @param sourceHost - Source host configuration
515
+ * @param sourcePath - Path to source file
516
+ * @param targetHost - Target host configuration
517
+ * @param targetPath - Destination path
518
+ * @returns Transfer result with bytes transferred and optional warning
519
+ */
520
+ transferFile(sourceHost: HostConfig, sourcePath: string, targetHost: HostConfig, targetPath: string): Promise<{
521
+ bytesTransferred: number;
522
+ warning?: string;
523
+ }>;
524
+ /**
525
+ * Compare two files and return diff output.
526
+ * Supports comparing files on the same host or across different hosts.
527
+ *
528
+ * @param host1 - First host configuration
529
+ * @param path1 - Path to first file
530
+ * @param host2 - Second host configuration
531
+ * @param path2 - Path to second file
532
+ * @param contextLines - Number of context lines in diff output
533
+ * @returns Unified diff output string
534
+ */
535
+ diffFiles(host1: HostConfig, path1: string, host2: HostConfig, path2: string, contextLines: number): Promise<string>;
536
+ }
537
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/services/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,UAAU,EACV,QAAQ,EACR,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC;IAE5C;;;;;;;;;;OAUG;IACH,cAAc,CACZ,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;QACjD,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WA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ces.js","sourceRoot":"","sources":["../../src/services/interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * DEPRECATED: This file is deprecated in favor of ssh-service.ts
3
+ *
4
+ * This module previously provided a global SSH pool singleton.
5
+ * Use SSHService class with dependency injection instead.
6
+ *
7
+ * @deprecated Use SSHService from ssh-service.ts
8
+ */
9
+ export type { SSHCommandOptions } from "./ssh-service.js";
10
+ //# sourceMappingURL=ssh-pool-exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssh-pool-exec.d.ts","sourceRoot":"","sources":["../../src/services/ssh-pool-exec.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * DEPRECATED: This file is deprecated in favor of ssh-service.ts
3
+ *
4
+ * This module previously provided a global SSH pool singleton.
5
+ * Use SSHService class with dependency injection instead.
6
+ *
7
+ * @deprecated Use SSHService from ssh-service.ts
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=ssh-pool-exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssh-pool-exec.js","sourceRoot":"","sources":["../../src/services/ssh-pool-exec.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,66 @@
1
+ import { HostConfig } from "../types.js";
2
+ import { NodeSSH } from "node-ssh";
3
+ /**
4
+ * SSH connection pool configuration
5
+ */
6
+ export interface SSHPoolConfig {
7
+ maxConnections: number;
8
+ idleTimeoutMs: number;
9
+ connectionTimeoutMs: number;
10
+ enableHealthChecks: boolean;
11
+ healthCheckIntervalMs: number;
12
+ }
13
+ /**
14
+ * Default pool configuration
15
+ */
16
+ export declare const DEFAULT_POOL_CONFIG: SSHPoolConfig;
17
+ /**
18
+ * Pool statistics for monitoring
19
+ */
20
+ export interface PoolStats {
21
+ poolHits: number;
22
+ poolMisses: number;
23
+ activeConnections: number;
24
+ idleConnections: number;
25
+ totalConnections: number;
26
+ healthChecksPassed: number;
27
+ healthCheckFailures: number;
28
+ }
29
+ /**
30
+ * SSH Connection Pool interface
31
+ */
32
+ export interface SSHConnectionPool {
33
+ getConnection(host: HostConfig): Promise<NodeSSH>;
34
+ releaseConnection(host: HostConfig, connection: NodeSSH): Promise<void>;
35
+ closeConnection(host: HostConfig): Promise<void>;
36
+ closeAll(): Promise<void>;
37
+ getStats(): PoolStats;
38
+ }
39
+ /**
40
+ * Generate unique pool key for host
41
+ * Format: ${host.name}:${port}
42
+ */
43
+ export declare function generatePoolKey(host: HostConfig): string;
44
+ /**
45
+ * SSH Connection Pool Implementation
46
+ */
47
+ export declare class SSHConnectionPoolImpl implements SSHConnectionPool {
48
+ private config;
49
+ private pool;
50
+ private stats;
51
+ private healthCheckTimer?;
52
+ constructor(config?: Partial<SSHPoolConfig>);
53
+ getStats(): PoolStats;
54
+ private startHealthChecks;
55
+ private performHealthChecks;
56
+ private checkConnectionHealth;
57
+ getConnection(host: HostConfig): Promise<NodeSSH>;
58
+ private createConnection;
59
+ private updateConnectionStats;
60
+ releaseConnection(host: HostConfig, connection: NodeSSH): Promise<void>;
61
+ private scheduleIdleCleanup;
62
+ private removeConnection;
63
+ closeConnection(host: HostConfig): Promise<void>;
64
+ closeAll(): Promise<void>;
65
+ }
66
+ //# sourceMappingURL=ssh-pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssh-pool.d.ts","sourceRoot":"","sources":["../../src/services/ssh-pool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBA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