@edgible-team/cli 1.0.1 → 1.2.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 (232) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +114 -1
  3. package/dist/client/api-client.d.ts +575 -0
  4. package/dist/client/api-client.d.ts.map +1 -0
  5. package/dist/client/api-client.js +196 -2
  6. package/dist/client/index.d.ts +10 -0
  7. package/dist/client/index.d.ts.map +1 -0
  8. package/dist/commands/agent.d.ts +3 -0
  9. package/dist/commands/agent.d.ts.map +1 -0
  10. package/dist/commands/agent.js +18 -34
  11. package/dist/commands/ai.d.ts +3 -0
  12. package/dist/commands/ai.d.ts.map +1 -0
  13. package/dist/commands/ai.js +1661 -275
  14. package/dist/commands/application.d.ts +6 -0
  15. package/dist/commands/application.d.ts.map +1 -0
  16. package/dist/commands/application.js +377 -0
  17. package/dist/commands/auth.d.ts +3 -0
  18. package/dist/commands/auth.d.ts.map +1 -0
  19. package/dist/commands/base/BaseCommand.d.ts +53 -0
  20. package/dist/commands/base/BaseCommand.d.ts.map +1 -0
  21. package/dist/commands/base/CommandHandler.d.ts +28 -0
  22. package/dist/commands/base/CommandHandler.d.ts.map +1 -0
  23. package/dist/commands/base/command-wrapper.d.ts +21 -0
  24. package/dist/commands/base/command-wrapper.d.ts.map +1 -0
  25. package/dist/commands/base/middleware.d.ts +34 -0
  26. package/dist/commands/base/middleware.d.ts.map +1 -0
  27. package/dist/commands/config.d.ts +3 -0
  28. package/dist/commands/config.d.ts.map +1 -0
  29. package/dist/commands/connectivity.d.ts +3 -0
  30. package/dist/commands/connectivity.d.ts.map +1 -0
  31. package/dist/commands/debug.d.ts +3 -0
  32. package/dist/commands/debug.d.ts.map +1 -0
  33. package/dist/commands/debug.js +336 -0
  34. package/dist/commands/discover.d.ts +3 -0
  35. package/dist/commands/discover.d.ts.map +1 -0
  36. package/dist/commands/examples/migrated-command-example.d.ts +31 -0
  37. package/dist/commands/examples/migrated-command-example.d.ts.map +1 -0
  38. package/dist/commands/gateway.d.ts +6 -0
  39. package/dist/commands/gateway.d.ts.map +1 -0
  40. package/dist/commands/managedGateway.d.ts +6 -0
  41. package/dist/commands/managedGateway.d.ts.map +1 -0
  42. package/dist/commands/managedGateway.js +132 -0
  43. package/dist/commands/utils/config-validator.d.ts +29 -0
  44. package/dist/commands/utils/config-validator.d.ts.map +1 -0
  45. package/dist/commands/utils/gateway-prompt.d.ts +23 -0
  46. package/dist/commands/utils/gateway-prompt.d.ts.map +1 -0
  47. package/dist/commands/utils/input-parser.d.ts +34 -0
  48. package/dist/commands/utils/input-parser.d.ts.map +1 -0
  49. package/dist/commands/utils/output-formatter.d.ts +62 -0
  50. package/dist/commands/utils/output-formatter.d.ts.map +1 -0
  51. package/dist/config/app-config.d.ts +44 -0
  52. package/dist/config/app-config.d.ts.map +1 -0
  53. package/dist/detection/SystemCapabilityDetector.d.ts +139 -0
  54. package/dist/detection/SystemCapabilityDetector.d.ts.map +1 -0
  55. package/dist/detection/ToolDetector.d.ts +16 -0
  56. package/dist/detection/ToolDetector.d.ts.map +1 -0
  57. package/dist/detection/WorkloadDetector.d.ts +62 -0
  58. package/dist/detection/WorkloadDetector.d.ts.map +1 -0
  59. package/dist/detection/tools.d.ts +16 -0
  60. package/dist/detection/tools.d.ts.map +1 -0
  61. package/dist/detection/tools.js +305 -0
  62. package/dist/di/bindings.d.ts +15 -0
  63. package/dist/di/bindings.d.ts.map +1 -0
  64. package/dist/di/container.d.ts +44 -0
  65. package/dist/di/container.d.ts.map +1 -0
  66. package/dist/di/types.d.ts +23 -0
  67. package/dist/di/types.d.ts.map +1 -0
  68. package/dist/index.d.ts +3 -0
  69. package/dist/index.d.ts.map +1 -0
  70. package/dist/index.js +8 -1
  71. package/dist/interfaces/IDaemonManager.d.ts +67 -0
  72. package/dist/interfaces/IDaemonManager.d.ts.map +1 -0
  73. package/dist/repositories/config-repository.d.ts +46 -0
  74. package/dist/repositories/config-repository.d.ts.map +1 -0
  75. package/dist/repositories/gateway-repository.d.ts +37 -0
  76. package/dist/repositories/gateway-repository.d.ts.map +1 -0
  77. package/dist/services/AgentStatusManager.d.ts +30 -0
  78. package/dist/services/AgentStatusManager.d.ts.map +1 -0
  79. package/dist/services/ConnectivityTester.d.ts +30 -0
  80. package/dist/services/ConnectivityTester.d.ts.map +1 -0
  81. package/dist/services/DependencyInstaller.d.ts +32 -0
  82. package/dist/services/DependencyInstaller.d.ts.map +1 -0
  83. package/dist/services/LocalAgentManager.d.ts +220 -0
  84. package/dist/services/LocalAgentManager.d.ts.map +1 -0
  85. package/dist/services/LocalAgentManager.js +3 -5
  86. package/dist/services/application/ApplicationService.d.ts +54 -0
  87. package/dist/services/application/ApplicationService.d.ts.map +1 -0
  88. package/dist/services/application/ApplicationService.js +10 -3
  89. package/dist/services/auth/AuthService.d.ts +42 -0
  90. package/dist/services/auth/AuthService.d.ts.map +1 -0
  91. package/dist/services/aws.d.ts +136 -0
  92. package/dist/services/aws.d.ts.map +1 -0
  93. package/dist/services/aws.js +2 -2
  94. package/dist/services/daemon/DaemonManagerFactory.d.ts +17 -0
  95. package/dist/services/daemon/DaemonManagerFactory.d.ts.map +1 -0
  96. package/dist/services/daemon/DockerDaemonManager.d.ts +26 -0
  97. package/dist/services/daemon/DockerDaemonManager.d.ts.map +1 -0
  98. package/dist/services/daemon/LaunchdDaemonManager.d.ts +20 -0
  99. package/dist/services/daemon/LaunchdDaemonManager.d.ts.map +1 -0
  100. package/dist/services/daemon/LaunchdDaemonManager.js +54 -6
  101. package/dist/services/daemon/PodmanDaemonManager.d.ts +24 -0
  102. package/dist/services/daemon/PodmanDaemonManager.d.ts.map +1 -0
  103. package/dist/services/daemon/SystemdDaemonManager.d.ts +20 -0
  104. package/dist/services/daemon/SystemdDaemonManager.d.ts.map +1 -0
  105. package/dist/services/daemon/WindowsServiceDaemonManager.d.ts +19 -0
  106. package/dist/services/daemon/WindowsServiceDaemonManager.d.ts.map +1 -0
  107. package/dist/services/daemon/index.d.ts +7 -0
  108. package/dist/services/daemon/index.d.ts.map +1 -0
  109. package/dist/services/edgible.d.ts +304 -0
  110. package/dist/services/edgible.d.ts.map +1 -0
  111. package/dist/services/edgible.js +53 -4
  112. package/dist/services/gateway/GatewayService.d.ts +88 -0
  113. package/dist/services/gateway/GatewayService.d.ts.map +1 -0
  114. package/dist/state/config.d.ts +96 -0
  115. package/dist/state/config.d.ts.map +1 -0
  116. package/dist/types/AgentConfig.d.ts +126 -0
  117. package/dist/types/AgentConfig.d.ts.map +1 -0
  118. package/dist/types/AgentStatus.d.ts +30 -0
  119. package/dist/types/AgentStatus.d.ts.map +1 -0
  120. package/dist/types/ApiClient.d.ts +36 -0
  121. package/dist/types/ApiClient.d.ts.map +1 -0
  122. package/dist/types/ApiRequests.d.ts +269 -0
  123. package/dist/types/ApiRequests.d.ts.map +1 -0
  124. package/dist/types/ApiResponses.d.ts +348 -0
  125. package/dist/types/ApiResponses.d.ts.map +1 -0
  126. package/dist/types/Application.d.ts +13 -0
  127. package/dist/types/Application.d.ts.map +1 -0
  128. package/dist/types/CaddyJson.d.ts +231 -0
  129. package/dist/types/CaddyJson.d.ts.map +1 -0
  130. package/dist/types/DeviceMetrics.d.ts +95 -0
  131. package/dist/types/DeviceMetrics.d.ts.map +1 -0
  132. package/dist/types/DeviceMetrics.js +5 -0
  133. package/dist/types/LogAggregation.d.ts +106 -0
  134. package/dist/types/LogAggregation.d.ts.map +1 -0
  135. package/dist/types/LogAggregation.js +5 -0
  136. package/dist/types/LogEntry.d.ts +60 -0
  137. package/dist/types/LogEntry.d.ts.map +1 -0
  138. package/dist/types/LogEntry.js +5 -0
  139. package/dist/types/UnifiedAgentStatus.d.ts +28 -0
  140. package/dist/types/UnifiedAgentStatus.d.ts.map +1 -0
  141. package/dist/types/WireGuard.d.ts +36 -0
  142. package/dist/types/WireGuard.d.ts.map +1 -0
  143. package/dist/types/Workload.d.ts +9 -0
  144. package/dist/types/Workload.d.ts.map +1 -0
  145. package/dist/types/agent.d.ts +120 -0
  146. package/dist/types/agent.d.ts.map +1 -0
  147. package/dist/types/command-options.d.ts +115 -0
  148. package/dist/types/command-options.d.ts.map +1 -0
  149. package/dist/types/connectivity.d.ts +80 -0
  150. package/dist/types/connectivity.d.ts.map +1 -0
  151. package/dist/types/errors.d.ts +97 -0
  152. package/dist/types/errors.d.ts.map +1 -0
  153. package/dist/types/gateway-types.d.ts +46 -0
  154. package/dist/types/gateway-types.d.ts.map +1 -0
  155. package/dist/types/index.d.ts +28 -0
  156. package/dist/types/index.d.ts.map +1 -0
  157. package/dist/types/models/ApplicationData.d.ts +78 -0
  158. package/dist/types/models/ApplicationData.d.ts.map +1 -0
  159. package/dist/types/models/CertificateData.d.ts +44 -0
  160. package/dist/types/models/CertificateData.d.ts.map +1 -0
  161. package/dist/types/models/DeviceData.d.ts +29 -0
  162. package/dist/types/models/DeviceData.d.ts.map +1 -0
  163. package/dist/types/models/DevicePoolData.d.ts +47 -0
  164. package/dist/types/models/DevicePoolData.d.ts.map +1 -0
  165. package/dist/types/models/LifecycleEvent.d.ts +27 -0
  166. package/dist/types/models/LifecycleEvent.d.ts.map +1 -0
  167. package/dist/types/models/LifecycleEvent.js +5 -0
  168. package/dist/types/models/OrganizationData.d.ts +53 -0
  169. package/dist/types/models/OrganizationData.d.ts.map +1 -0
  170. package/dist/types/models/OrganizationInviteData.d.ts +39 -0
  171. package/dist/types/models/OrganizationInviteData.d.ts.map +1 -0
  172. package/dist/types/models/ProviderConfiguration.d.ts +37 -0
  173. package/dist/types/models/ProviderConfiguration.d.ts.map +1 -0
  174. package/dist/types/models/ResourceData.d.ts +18 -0
  175. package/dist/types/models/ResourceData.d.ts.map +1 -0
  176. package/dist/types/models/ServiceResourceData.d.ts +5 -0
  177. package/dist/types/models/ServiceResourceData.d.ts.map +1 -0
  178. package/dist/types/models/UserData.d.ts +12 -0
  179. package/dist/types/models/UserData.d.ts.map +1 -0
  180. package/dist/types/route.d.ts +67 -0
  181. package/dist/types/route.d.ts.map +1 -0
  182. package/dist/types/validation/schemas.d.ts +606 -0
  183. package/dist/types/validation/schemas.d.ts.map +1 -0
  184. package/dist/types/validation/schemas.js +46 -4
  185. package/dist/types/validation.d.ts +68 -0
  186. package/dist/types/validation.d.ts.map +1 -0
  187. package/dist/utils/FileIntegrityManager.d.ts +37 -0
  188. package/dist/utils/FileIntegrityManager.d.ts.map +1 -0
  189. package/dist/utils/PathMigration.d.ts +45 -0
  190. package/dist/utils/PathMigration.d.ts.map +1 -0
  191. package/dist/utils/PathResolver.d.ts +76 -0
  192. package/dist/utils/PathResolver.d.ts.map +1 -0
  193. package/dist/utils/PlatformDetector.d.ts +60 -0
  194. package/dist/utils/PlatformDetector.d.ts.map +1 -0
  195. package/dist/utils/console-logger.d.ts +37 -0
  196. package/dist/utils/console-logger.d.ts.map +1 -0
  197. package/dist/utils/docker-compose-parser.d.ts +28 -0
  198. package/dist/utils/docker-compose-parser.d.ts.map +1 -0
  199. package/dist/utils/errors.d.ts +63 -0
  200. package/dist/utils/errors.d.ts.map +1 -0
  201. package/dist/utils/health-checker.d.ts +34 -0
  202. package/dist/utils/health-checker.d.ts.map +1 -0
  203. package/dist/utils/json-logger.d.ts +23 -0
  204. package/dist/utils/json-logger.d.ts.map +1 -0
  205. package/dist/utils/log-formatter.d.ts +85 -0
  206. package/dist/utils/log-formatter.d.ts.map +1 -0
  207. package/dist/utils/log-formatter.js +39 -11
  208. package/dist/utils/logger.d.ts +34 -0
  209. package/dist/utils/logger.d.ts.map +1 -0
  210. package/dist/utils/network-utils.d.ts +56 -0
  211. package/dist/utils/network-utils.d.ts.map +1 -0
  212. package/dist/utils/output.d.ts +73 -0
  213. package/dist/utils/output.d.ts.map +1 -0
  214. package/dist/utils/passwordValidation.d.ts +32 -0
  215. package/dist/utils/passwordValidation.d.ts.map +1 -0
  216. package/dist/utils/progress.d.ts +74 -0
  217. package/dist/utils/progress.d.ts.map +1 -0
  218. package/dist/utils/sudo-checker.d.ts +9 -0
  219. package/dist/utils/sudo-checker.d.ts.map +1 -0
  220. package/dist/utils/urls.d.ts +19 -0
  221. package/dist/utils/urls.d.ts.map +1 -0
  222. package/dist/utils/urls.js +3 -3
  223. package/dist/utils/validation.d.ts +19 -0
  224. package/dist/utils/validation.d.ts.map +1 -0
  225. package/dist/validation/schemas.d.ts +197 -0
  226. package/dist/validation/schemas.d.ts.map +1 -0
  227. package/dist/validation/schemas.js +1 -1
  228. package/dist/validation/validator.d.ts +22 -0
  229. package/dist/validation/validator.d.ts.map +1 -0
  230. package/package.json +9 -4
  231. package/recipes/compose/open-webui/.env +1 -0
  232. package/recipes/compose/open-webui/docker-compose.yml +17 -0
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Application service
3
+ * Handles application management operations
4
+ */
5
+ import { Application, Workload } from '../../detection/WorkloadDetector';
6
+ import { ConfigRepository } from '../../repositories/config-repository';
7
+ import { AuthService } from '../auth/AuthService';
8
+ import { Logger } from '../../utils/logger';
9
+ export interface ApplicationService {
10
+ setupApplication(workload: Workload, port: number, protocol: 'http' | 'https' | 'tcp' | 'udp', description?: string, gatewayId?: string): Promise<Application>;
11
+ getApplications(): Promise<Application[]>;
12
+ getApplication(id: string): Promise<Application>;
13
+ deleteApplication(id: string): Promise<boolean>;
14
+ createApplicationProgrammatically(params: {
15
+ name: string;
16
+ description: string;
17
+ port: number;
18
+ protocol: 'http' | 'https' | 'tcp' | 'udp';
19
+ hostnames?: string[];
20
+ deviceIds: string[];
21
+ gatewayIds?: string[];
22
+ useManagedGateway?: boolean;
23
+ subtype: 'local-preexisting' | 'managed-docker' | 'systemd' | 'docker-compose' | 'managed-process';
24
+ configuration?: Record<string, unknown>;
25
+ }): Promise<unknown>;
26
+ }
27
+ export declare class ApplicationServiceImpl implements ApplicationService {
28
+ private apiClient;
29
+ private configRepository;
30
+ private authService;
31
+ private logger;
32
+ private baseUrl;
33
+ private applications;
34
+ constructor(baseUrl: string, configRepository: ConfigRepository, authService: AuthService, logger: Logger);
35
+ private restoreTokensFromApiClient;
36
+ private generateServingIp;
37
+ setupApplication(workload: Workload, port: number, protocol?: 'http' | 'https' | 'tcp' | 'udp', description?: string, gatewayId?: string): Promise<Application>;
38
+ getApplications(): Promise<Application[]>;
39
+ getApplication(id: string): Promise<Application>;
40
+ deleteApplication(id: string): Promise<boolean>;
41
+ createApplicationProgrammatically(params: {
42
+ name: string;
43
+ description: string;
44
+ port: number;
45
+ protocol: 'http' | 'https' | 'tcp' | 'udp';
46
+ hostnames?: string[];
47
+ deviceIds: string[];
48
+ gatewayIds?: string[];
49
+ useManagedGateway?: boolean;
50
+ subtype: 'local-preexisting' | 'managed-docker' | 'systemd' | 'docker-compose' | 'managed-process';
51
+ configuration?: Record<string, unknown>;
52
+ }): Promise<unknown>;
53
+ }
54
+ //# sourceMappingURL=ApplicationService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplicationService.d.ts","sourceRoot":"","sources":["../../../src/services/application/ApplicationService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,CACd,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,EAC1C,WAAW,CAAC,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,CAAC,CAAC;IACxB,eAAe,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACjD,iBAAi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I,OAAO,CAAC,WAAW,EAAE,CAAC;IA8HzC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAsChD,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkB/C,iCAAiC,CAAC,MAAM,EAAE;QAC9C,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;QAC3C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,OAAO,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,SAAS,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;QACnG,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACzC,GAAG,OAAO,CAAC,OAAO,CAAC;CA0CrB"}
@@ -199,7 +199,7 @@ class ApplicationServiceImpl {
199
199
  servingIp,
200
200
  port,
201
201
  protocol,
202
- status: app.status === 'running' ? 'active' : 'inactive',
202
+ status: app.status === 'deployed' ? 'active' : 'inactive',
203
203
  createdAt: app.createdAt,
204
204
  description: app.description,
205
205
  };
@@ -228,7 +228,7 @@ class ApplicationServiceImpl {
228
228
  servingIp: this.generateServingIp(),
229
229
  port: typeof port === 'number' ? port : 3000,
230
230
  protocol: protocol,
231
- status: appData.status === 'running' ? 'active' : 'inactive',
231
+ status: appData.status === 'deployed' ? 'active' : 'inactive',
232
232
  workloadId: workloadId || undefined,
233
233
  createdAt: appData.createdAt || new Date().toISOString(),
234
234
  url: appData.url,
@@ -272,11 +272,17 @@ class ApplicationServiceImpl {
272
272
  if (!config.organizationId) {
273
273
  throw new Error('Not logged in. Please run "edgible login" first.');
274
274
  }
275
+ // Build configuration object, merging provided configuration with port and protocol
276
+ const configuration = {
277
+ port: params.port,
278
+ protocol: params.protocol,
279
+ ...(params.configuration || {}),
280
+ };
275
281
  const createRequest = {
276
282
  name: params.name,
277
283
  description: params.description,
278
284
  organizationId: config.organizationId,
279
- configuration: { port: params.port, protocol: params.protocol },
285
+ configuration,
280
286
  hostnames: params.hostnames,
281
287
  deviceIds: params.deviceIds,
282
288
  gatewayIds: params.gatewayIds,
@@ -286,6 +292,7 @@ class ApplicationServiceImpl {
286
292
  if (params.useManagedGateway !== undefined) {
287
293
  createRequest.useManagedGateway = params.useManagedGateway;
288
294
  }
295
+ console.log(`application: ${params}`);
289
296
  const response = await this.apiClient.createApplication(createRequest);
290
297
  return response.application;
291
298
  }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Authentication service
3
+ * Handles user and device authentication operations
4
+ */
5
+ import { LoginResponse } from '../../client';
6
+ import { CreateDeviceWithOrphanedOrganizationResponse, GetUserOrganizationsResponse } from '../../types/ApiResponses';
7
+ import { ConfigRepository } from '../../repositories/config-repository';
8
+ import { Logger } from '../../utils/logger';
9
+ export interface AuthService {
10
+ loginUser(email: string, password: string): Promise<LoginResponse>;
11
+ loginDevice(deviceId: string, password: string): Promise<LoginResponse>;
12
+ verifyDeviceCredentials(deviceId: string, password: string): Promise<boolean>;
13
+ checkAccount(email: string): Promise<boolean>;
14
+ createDeviceWithOrganization(deviceName: string, password: string, userEmail?: string): Promise<CreateDeviceWithOrphanedOrganizationResponse>;
15
+ refreshToken(refreshToken: string): Promise<unknown>;
16
+ getUserOrganizations(email: string): Promise<GetUserOrganizationsResponse>;
17
+ getAccessToken(): string | undefined;
18
+ getIdToken(): string | undefined;
19
+ getRefreshToken(): string | undefined;
20
+ attemptAutoRelogin(): Promise<boolean>;
21
+ }
22
+ export declare class AuthServiceImpl implements AuthService {
23
+ private apiClient;
24
+ private configRepository;
25
+ private logger;
26
+ private baseUrl;
27
+ constructor(baseUrl: string, configRepository: ConfigRepository, logger: Logger);
28
+ private restoreTokensFromConfig;
29
+ attemptAutoRelogin(): Promise<boolean>;
30
+ private saveTokensToConfig;
31
+ loginUser(email: string, password: string): Promise<LoginResponse>;
32
+ createDeviceWithOrganization(deviceName: string, password: string, userEmail?: string): Promise<CreateDeviceWithOrphanedOrganizationResponse>;
33
+ checkAccount(email: string): Promise<boolean>;
34
+ loginDevice(deviceId: string, password: string): Promise<LoginResponse>;
35
+ verifyDeviceCredentials(deviceId: string, password: string): Promise<boolean>;
36
+ refreshToken(refreshToken: string): Promise<unknown>;
37
+ getAccessToken(): string | undefined;
38
+ getIdToken(): string | undefined;
39
+ getRefreshToken(): string | undefined;
40
+ getUserOrganizations(email: string): Promise<GetUserOrganizationsResponse>;
41
+ }
42
+ //# sourceMappingURL=AuthService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthService.d.ts","sourceRoot":"","sources":["../../../src/services/auth/AuthService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA4C,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvF,OAAO,EAAE,4CAA4C,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAEtH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACnE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACxE,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9E,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAA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,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA8C7E,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAW1D,cAAc,IAAI,MAAM,GAAG,SAAS;IAIpC,UAAU,IAAI,MAAM,GAAG,SAAS;IAIhC,eAAe,IAAI,MAAM,GAAG,SAAS;IAI/B,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,4BAA4B,CAAC;CAQjF"}
@@ -0,0 +1,136 @@
1
+ export interface AWSProfile {
2
+ name: string;
3
+ region: string;
4
+ accessKeyId?: string;
5
+ secretAccessKey?: string;
6
+ }
7
+ export interface EC2Instance {
8
+ instanceId: string;
9
+ publicIp: string;
10
+ privateIp: string;
11
+ state: string;
12
+ keyPairName: string;
13
+ region: string;
14
+ launchTime: Date;
15
+ }
16
+ export interface KeyPair {
17
+ keyName: string;
18
+ keyFingerprint: string;
19
+ privateKey: string;
20
+ publicKey: string;
21
+ }
22
+ export interface SSHConnection {
23
+ host: string;
24
+ port: number;
25
+ username: string;
26
+ privateKey: string;
27
+ }
28
+ export declare class AWSService {
29
+ private ec2Client;
30
+ private s3Client;
31
+ private ssmClient;
32
+ private profile;
33
+ private region;
34
+ constructor(profile?: string, region?: string);
35
+ /**
36
+ * Check if AWS CLI is available and get available profiles
37
+ */
38
+ checkAWSCLI(): Promise<{
39
+ available: boolean;
40
+ profiles: string[];
41
+ }>;
42
+ /**
43
+ * Validate AWS credentials for a profile
44
+ */
45
+ validateCredentials(profile?: string): Promise<boolean>;
46
+ /**
47
+ * Create a key pair for EC2 instance
48
+ */
49
+ createKeyPair(keyName: string): Promise<KeyPair>;
50
+ /**
51
+ * Check if key pair exists
52
+ */
53
+ keyPairExists(keyName: string): Promise<boolean>;
54
+ /**
55
+ * Create EC2 instance for gateway
56
+ */
57
+ createEC2Instance(config: {
58
+ name: string;
59
+ instanceType?: string;
60
+ keyPairName: string;
61
+ securityGroupIds?: string[];
62
+ subnetId?: string;
63
+ userData?: string;
64
+ }): Promise<EC2Instance>;
65
+ /**
66
+ * Get instance details
67
+ */
68
+ getInstanceDetails(instanceId: string): Promise<{
69
+ publicIp: string;
70
+ privateIp: string;
71
+ state: string;
72
+ }>;
73
+ /**
74
+ * Wait for instance to be running
75
+ */
76
+ private waitForInstanceRunning;
77
+ /**
78
+ * Terminate EC2 instance
79
+ */
80
+ terminateInstance(instanceId: string): Promise<void>;
81
+ /**
82
+ * Check if instance is ready for SSH connections
83
+ */
84
+ waitForSSHReady(instanceId: string, maxWaitTime?: number): Promise<boolean>;
85
+ /**
86
+ * Create or get security group with SSH access
87
+ */
88
+ getOrCreateSSHSecurityGroup(): Promise<string>;
89
+ /**
90
+ * Delete key pair
91
+ */
92
+ deleteKeyPair(keyName: string): Promise<void>;
93
+ /**
94
+ * Execute SSH command on instance
95
+ */
96
+ executeSSHCommand(connection: SSHConnection, command: string, timeout?: number): Promise<{
97
+ stdout: string;
98
+ stderr: string;
99
+ exitCode: number;
100
+ }>;
101
+ /**
102
+ * Upload file via SSH
103
+ */
104
+ uploadFile(connection: SSHConnection, localPath: string, remotePath: string): Promise<void>;
105
+ /**
106
+ * Generate user data script for EC2 instance
107
+ */
108
+ private generateUserData;
109
+ /**
110
+ * Save SSH key to file
111
+ */
112
+ saveSSHKey(keyPair: KeyPair, keyName: string): string;
113
+ /**
114
+ * Load SSH key from file
115
+ */
116
+ loadSSHKey(keyPath: string): string;
117
+ /**
118
+ * Download agent from S3 bucket
119
+ * @param bucketName S3 bucket name
120
+ * @param keyPath S3 object key (path within bucket)
121
+ * @param destinationPath Local file path to save the downloaded file
122
+ * @param useCloudFront Whether to use CloudFront URL instead of direct S3
123
+ * @param cloudFrontUrl CloudFront distribution URL (e.g., https://distribution.edgible.com)
124
+ */
125
+ downloadAgentFromS3(bucketName: string, keyPath: string, destinationPath: string, useCloudFront?: boolean, cloudFrontUrl?: string): Promise<void>;
126
+ /**
127
+ * Get S3 download URL (for use in SSH commands on remote server)
128
+ * @param bucketName S3 bucket name
129
+ * @param keyPath S3 object key
130
+ * @param useCloudFront Whether to use CloudFront URL
131
+ * @param cloudFrontUrl CloudFront distribution URL
132
+ * @returns URL string for downloading
133
+ */
134
+ getS3DownloadUrl(bucketName: string, keyPath: string, useCloudFront?: boolean, cloudFrontUrl?: string): string;
135
+ }
136
+ //# sourceMappingURL=aws.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws.d.ts","sourceRoot":"","sources":["../../src/services/aws.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,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,GAAG,OAAO,CAAC,IAAI,CAAC;IAanD;;OAEG;IACG,iBAAiB,CAAC,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAe,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IA2D5J;;OAEG;IACG,UAAU,CAAC,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoFjG;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA4DxB;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAerD;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAQnC;;;;;;;OAOG;IACG,mBAAmB,CACvB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,aAAa,GAAE,OAAe,EAC9B,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC;IA2EhB;;;;;;;OAOG;IACH,gBAAgB,CACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,aAAa,GAAE,OAAe,EAC9B,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM;CAQV"}
@@ -569,7 +569,7 @@ echo "Edgible Agent setup complete"
569
569
  `To deploy the agent:\n` +
570
570
  ` 1. Navigate to agent-v2 directory\n` +
571
571
  ` 2. Run: npm run build\n` +
572
- ` 3. Run: ./scripts/deploy-to-s3.sh --env production\n\n` +
572
+ ` 3. Run: ./scripts/deploy-to-s3.sh --env prod\n\n` +
573
573
  `Expected S3 path: s3://${bucketName}/${keyPath}\n` +
574
574
  `Current environment: ${keyPath.split('/')[0] || 'unknown'}`;
575
575
  }
@@ -577,7 +577,7 @@ echo "Edgible Agent setup complete"
577
577
  errorMessage = `Access denied to ${url}\n\n` +
578
578
  `This usually means one of:\n` +
579
579
  ` 1. Agent not deployed: The file doesn't exist at s3://${bucketName}/${keyPath}\n` +
580
- ` → Deploy agent: cd agent-v2 && ./scripts/deploy-to-s3.sh --env production\n\n` +
580
+ ` → Deploy agent: cd agent-v2 && ./scripts/deploy-to-s3.sh --env prod\n\n` +
581
581
  ` 2. CloudFront misconfiguration: OAC or bucket policy issue\n` +
582
582
  ` → Check backend Pulumi outputs for distribution status\n\n` +
583
583
  ` 3. Wrong bucket: Using bucket "${bucketName}" but file may be in different bucket\n` +
@@ -0,0 +1,17 @@
1
+ import { IDaemonManager } from '../../interfaces/IDaemonManager';
2
+ export type DaemonType = 'systemd' | 'launchd' | 'windows-service' | 'docker' | 'podman';
3
+ export declare class DaemonManagerFactory {
4
+ /**
5
+ * Create a daemon manager instance based on the type
6
+ */
7
+ static create(type: DaemonType): IDaemonManager;
8
+ /**
9
+ * Get daemon manager from stored config type
10
+ */
11
+ static fromConfig(installationType?: string): IDaemonManager | null;
12
+ /**
13
+ * Get the recommended daemon manager for the current platform
14
+ */
15
+ static getRecommended(): Promise<IDaemonManager | null>;
16
+ }
17
+ //# sourceMappingURL=DaemonManagerFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DaemonManagerFactory.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/DaemonManagerFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAQjE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzF,qBAAa,oBAAoB;IAC/B;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc;IAiC/C;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAanE;;OAEG;WACU,cAAc,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;CAS9D"}
@@ -0,0 +1,26 @@
1
+ import { IDaemonManager, DaemonStatus, DaemonConfig } from '../../interfaces/IDaemonManager';
2
+ export declare class DockerDaemonManager implements IDaemonManager {
3
+ private containerName;
4
+ private imageName;
5
+ private platform;
6
+ constructor();
7
+ install(config: DaemonConfig): Promise<void>;
8
+ start(): Promise<void>;
9
+ stop(): Promise<void>;
10
+ restart(): Promise<void>;
11
+ status(): Promise<DaemonStatus>;
12
+ logs(follow: boolean, lines?: number): Promise<string>;
13
+ enable(): Promise<void>;
14
+ disable(): Promise<void>;
15
+ uninstall(): Promise<void>;
16
+ getPlatform(): string;
17
+ getType(): 'systemd' | 'launchd' | 'windows-service' | 'docker' | 'podman';
18
+ private checkImageExists;
19
+ private buildImage;
20
+ private generateDockerRunCommand;
21
+ private createServiceWrapper;
22
+ private createSystemdWrapper;
23
+ private createLaunchdWrapper;
24
+ private removeServiceWrapper;
25
+ }
26
+ //# sourceMappingURL=DockerDaemonManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DockerDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/DockerDaemonManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,mBAAoB,YAAW,cAAc;IACxD,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,QAAQ,CAA+B;;IAMzC,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IA0C/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IA0B3D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ;YAI5D,gBAAgB;YAShB,UAAU;IAqBxB,OAAO,CAAC,wBAAwB;YA+DlB,oBAAoB;YASpB,oBAAoB;YAwBpB,oBAAoB;YA+BpB,oBAAoB;CAkBnC"}
@@ -0,0 +1,20 @@
1
+ import { IDaemonManager, DaemonStatus, DaemonConfig } from '../../interfaces/IDaemonManager';
2
+ export declare class LaunchdDaemonManager implements IDaemonManager {
3
+ private serviceName;
4
+ private plistPath;
5
+ private logPath;
6
+ constructor();
7
+ install(config: DaemonConfig): Promise<void>;
8
+ start(): Promise<void>;
9
+ stop(): Promise<void>;
10
+ restart(): Promise<void>;
11
+ status(): Promise<DaemonStatus>;
12
+ logs(follow: boolean, lines?: number): Promise<string>;
13
+ enable(): Promise<void>;
14
+ disable(): Promise<void>;
15
+ uninstall(): Promise<void>;
16
+ getPlatform(): string;
17
+ getType(): 'systemd' | 'launchd' | 'windows-service' | 'docker' | 'podman';
18
+ private generatePlistFile;
19
+ }
20
+ //# sourceMappingURL=LaunchdDaemonManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LaunchdDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/LaunchdDaemonManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;;IAYlB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAStB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IASrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAiC/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAuG3D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAUvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ;IAI1E,OAAO,CAAC,iBAAiB;CA8C1B"}
@@ -39,6 +39,7 @@ const util_1 = require("util");
39
39
  const fs = __importStar(require("fs/promises"));
40
40
  const path = __importStar(require("path"));
41
41
  const PlatformDetector_1 = require("../../utils/PlatformDetector");
42
+ const PathResolver_1 = require("../../utils/PathResolver");
42
43
  const execAsync = (0, util_1.promisify)(child_process_1.exec);
43
44
  class LaunchdDaemonManager {
44
45
  constructor() {
@@ -149,24 +150,66 @@ class LaunchdDaemonManager {
149
150
  }
150
151
  else {
151
152
  try {
152
- let combinedLogs = '';
153
+ // Read both log files
154
+ let stdoutLines = [];
155
+ let stderrLines = [];
153
156
  try {
154
157
  const { stdout: stdoutContent } = await execAsync(`tail -n ${lines} ${stdoutLog}`);
155
- combinedLogs += '==> stdout.log <==\n' + stdoutContent;
158
+ stdoutLines = stdoutContent.split('\n').filter(line => line.trim());
156
159
  }
157
160
  catch (error) {
158
161
  // File might not exist yet
159
- combinedLogs += '==> stdout.log <==\n(no logs yet)\n';
160
162
  }
161
163
  try {
162
164
  const { stdout: stderrContent } = await execAsync(`tail -n ${lines} ${stderrLog}`);
163
- combinedLogs += '\n==> stderr.log <==\n' + stderrContent;
165
+ stderrLines = stderrContent.split('\n').filter(line => line.trim());
164
166
  }
165
167
  catch (error) {
166
168
  // File might not exist yet
167
- combinedLogs += '\n==> stderr.log <==\n(no logs yet)\n';
168
169
  }
169
- return combinedLogs;
170
+ const parsedLogs = [];
171
+ // Parse stdout logs
172
+ for (const line of stdoutLines) {
173
+ try {
174
+ const parsed = JSON.parse(line);
175
+ if (parsed.timestamp) {
176
+ parsedLogs.push({ timestamp: parsed.timestamp, line });
177
+ }
178
+ else {
179
+ // Non-JSON or no timestamp, add as-is
180
+ parsedLogs.push({ timestamp: new Date().toISOString(), line });
181
+ }
182
+ }
183
+ catch {
184
+ // Not JSON, add as-is with current timestamp
185
+ parsedLogs.push({ timestamp: new Date().toISOString(), line });
186
+ }
187
+ }
188
+ // Parse stderr logs
189
+ for (const line of stderrLines) {
190
+ try {
191
+ const parsed = JSON.parse(line);
192
+ if (parsed.timestamp) {
193
+ parsedLogs.push({ timestamp: parsed.timestamp, line });
194
+ }
195
+ else {
196
+ // Non-JSON or no timestamp, add as-is
197
+ parsedLogs.push({ timestamp: new Date().toISOString(), line });
198
+ }
199
+ }
200
+ catch {
201
+ // Not JSON, add as-is with current timestamp
202
+ parsedLogs.push({ timestamp: new Date().toISOString(), line });
203
+ }
204
+ }
205
+ // Sort by timestamp
206
+ parsedLogs.sort((a, b) => {
207
+ return new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime();
208
+ });
209
+ // Take only the last N entries after sorting
210
+ const limitedLogs = parsedLogs.slice(-lines);
211
+ // Return combined sorted logs
212
+ return limitedLogs.map(entry => entry.line).join('\n');
170
213
  }
171
214
  catch (error) {
172
215
  throw new Error(`Failed to read logs: ${error instanceof Error ? error.message : String(error)}`);
@@ -215,6 +258,9 @@ class LaunchdDaemonManager {
215
258
  }
216
259
  generatePlistFile(config) {
217
260
  const nodePath = process.execPath; // Path to current Node.js executable
261
+ // Get the real user's home directory (even when running as root via sudo)
262
+ // This ensures applications like ollama can find their config/data directories
263
+ const userHome = PathResolver_1.PathResolver.getRealUserHome();
218
264
  return `<?xml version="1.0" encoding="UTF-8"?>
219
265
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
220
266
  <plist version="1.0">
@@ -245,6 +291,8 @@ class LaunchdDaemonManager {
245
291
  <string>production</string>
246
292
  <key>EDGIBLE_CONFIG_PATH</key>
247
293
  <string>${config.configPath}</string>
294
+ <key>HOME</key>
295
+ <string>${userHome}</string>
248
296
  </dict>
249
297
  <key>WorkingDirectory</key>
250
298
  <string>${config.agentPath}</string>
@@ -0,0 +1,24 @@
1
+ import { IDaemonManager, DaemonStatus, DaemonConfig } from '../../interfaces/IDaemonManager';
2
+ export declare class PodmanDaemonManager implements IDaemonManager {
3
+ private containerName;
4
+ private imageName;
5
+ private platform;
6
+ private systemdUserPath;
7
+ constructor();
8
+ install(config: DaemonConfig): Promise<void>;
9
+ start(): Promise<void>;
10
+ stop(): Promise<void>;
11
+ restart(): Promise<void>;
12
+ status(): Promise<DaemonStatus>;
13
+ logs(follow: boolean, lines?: number): Promise<string>;
14
+ enable(): Promise<void>;
15
+ disable(): Promise<void>;
16
+ uninstall(): Promise<void>;
17
+ getPlatform(): string;
18
+ getType(): 'systemd' | 'launchd' | 'windows-service' | 'docker' | 'podman';
19
+ private checkImageExists;
20
+ private buildImage;
21
+ private generatePodmanRunCommand;
22
+ private createUserService;
23
+ }
24
+ //# sourceMappingURL=PodmanDaemonManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PodmanDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/PodmanDaemonManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,mBAAoB,YAAW,cAAc;IACxD,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,eAAe,CAAS;;IAO1B,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IActB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAarB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAkD/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAwB3D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAavB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ;YAI5D,gBAAgB;YAShB,UAAU;IAqBxB,OAAO,CAAC,wBAAwB;YAyElB,iBAAiB;CAoChC"}
@@ -0,0 +1,20 @@
1
+ import { IDaemonManager, DaemonStatus, DaemonConfig } from '../../interfaces/IDaemonManager';
2
+ export declare class SystemdDaemonManager implements IDaemonManager {
3
+ private serviceName;
4
+ private serviceFilePath;
5
+ constructor();
6
+ install(config: DaemonConfig): Promise<void>;
7
+ start(): Promise<void>;
8
+ stop(): Promise<void>;
9
+ restart(): Promise<void>;
10
+ status(): Promise<DaemonStatus>;
11
+ logs(follow: boolean, lines?: number): Promise<string>;
12
+ enable(): Promise<void>;
13
+ disable(): Promise<void>;
14
+ uninstall(): Promise<void>;
15
+ getPlatform(): string;
16
+ getType(): 'systemd' | 'launchd' | 'windows-service' | 'docker' | 'podman';
17
+ private isEnabled;
18
+ private generateServiceFile;
19
+ }
20
+ //# sourceMappingURL=SystemdDaemonManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SystemdDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/SystemdDaemonManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAM7F,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,eAAe,CAA6D;;IAQ9E,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IA0B/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IA6B3D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAQvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ;YAI5D,SAAS;IASvB,OAAO,CAAC,mBAAmB;CAuB5B"}
@@ -0,0 +1,19 @@
1
+ import { IDaemonManager, DaemonStatus, DaemonConfig } from '../../interfaces/IDaemonManager';
2
+ export declare class WindowsServiceDaemonManager implements IDaemonManager {
3
+ private serviceName;
4
+ private displayName;
5
+ private description;
6
+ constructor();
7
+ install(config: DaemonConfig): Promise<void>;
8
+ start(): Promise<void>;
9
+ stop(): Promise<void>;
10
+ restart(): Promise<void>;
11
+ status(): Promise<DaemonStatus>;
12
+ logs(follow: boolean, lines?: number): Promise<string>;
13
+ enable(): Promise<void>;
14
+ disable(): Promise<void>;
15
+ uninstall(): Promise<void>;
16
+ getPlatform(): string;
17
+ getType(): 'systemd' | 'launchd' | 'windows-service' | 'docker' | 'podman';
18
+ }
19
+ //# sourceMappingURL=WindowsServiceDaemonManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WindowsServiceDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/WindowsServiceDaemonManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAK7F,qBAAa,2BAA4B,YAAW,cAAc;IAChE,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,WAAW,CAAwE;;IAQrF,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAoC5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAUtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAKxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IA2B/B,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IA4C3D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAQvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,SAAS,GAAG,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ;CAG3E"}
@@ -0,0 +1,7 @@
1
+ export { SystemdDaemonManager } from './SystemdDaemonManager';
2
+ export { LaunchdDaemonManager } from './LaunchdDaemonManager';
3
+ export { WindowsServiceDaemonManager } from './WindowsServiceDaemonManager';
4
+ export { DockerDaemonManager } from './DockerDaemonManager';
5
+ export { PodmanDaemonManager } from './PodmanDaemonManager';
6
+ export { DaemonManagerFactory, DaemonType } from './DaemonManagerFactory';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC"}