@edgible-team/cli 1.2.20 → 1.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/agent/install.d.ts.map +1 -1
- package/dist/commands/agent/install.js +38 -15
- package/dist/commands/debug.d.ts.map +1 -1
- package/dist/commands/debug.js +6 -1
- package/dist/interfaces/IDaemonManager.d.ts +2 -1
- package/dist/interfaces/IDaemonManager.d.ts.map +1 -1
- package/dist/services/AgentStatusManager.d.ts.map +1 -1
- package/dist/services/AgentStatusManager.js +1 -0
- package/dist/services/LocalAgentManager.d.ts.map +1 -1
- package/dist/services/LocalAgentManager.js +7 -0
- package/dist/services/daemon/DaemonManagerFactory.d.ts +1 -1
- package/dist/services/daemon/DaemonManagerFactory.d.ts.map +1 -1
- package/dist/services/daemon/DaemonManagerFactory.js +23 -3
- package/dist/services/daemon/DockerDaemonManager.d.ts +2 -2
- package/dist/services/daemon/DockerDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/ForegroundDaemonManager.d.ts +22 -0
- package/dist/services/daemon/ForegroundDaemonManager.d.ts.map +1 -0
- package/dist/services/daemon/ForegroundDaemonManager.js +200 -0
- package/dist/services/daemon/LaunchdDaemonManager.d.ts +2 -2
- package/dist/services/daemon/LaunchdDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/OpenRCDaemonManager.d.ts +25 -0
- package/dist/services/daemon/OpenRCDaemonManager.d.ts.map +1 -0
- package/dist/services/daemon/OpenRCDaemonManager.js +202 -0
- package/dist/services/daemon/PodmanDaemonManager.d.ts +2 -2
- package/dist/services/daemon/PodmanDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/SystemdDaemonManager.d.ts +2 -2
- package/dist/services/daemon/SystemdDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/WindowsServiceDaemonManager.d.ts +2 -2
- package/dist/services/daemon/WindowsServiceDaemonManager.d.ts.map +1 -1
- package/dist/services/daemon/index.d.ts +2 -0
- package/dist/services/daemon/index.d.ts.map +1 -1
- package/dist/services/daemon/index.js +5 -1
- package/dist/state/config.d.ts +1 -1
- package/dist/state/config.d.ts.map +1 -1
- package/dist/types/agent.d.ts +1 -1
- package/dist/types/agent.d.ts.map +1 -1
- package/dist/types/validation/schemas.d.ts +4 -4
- package/dist/utils/PathResolver.d.ts.map +1 -1
- package/dist/utils/PathResolver.js +3 -0
- package/dist/utils/PlatformDetector.d.ts +6 -3
- package/dist/utils/PlatformDetector.d.ts.map +1 -1
- package/dist/utils/PlatformDetector.js +61 -20
- package/dist/validation/stack-schemas.d.ts +26 -26
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/install.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAU9D,wBAAsB,kBAAkB,CACtC,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,EAChL,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,iBAAiB,GAC9B,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/install.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAU9D,wBAAsB,kBAAkB,CACtC,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,EAChL,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,iBAAiB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAqff"}
|
|
@@ -268,24 +268,41 @@ async function handleAgentInstall(options, logger, configManager, edgibleService
|
|
|
268
268
|
const availableOptions = await PlatformDetector_1.PlatformDetector.getAvailableOptions();
|
|
269
269
|
if (availableOptions.length === 0) {
|
|
270
270
|
console.error(chalk_1.default.red('✗ No installation methods available on this system'));
|
|
271
|
-
console.error(chalk_1.default.yellow('\
|
|
272
|
-
console.error(chalk_1.default.yellow(' - Linux: systemd (
|
|
273
|
-
console.error(chalk_1.default.yellow(' - macOS: launchd
|
|
274
|
-
console.error(chalk_1.default.yellow(' - Windows: Windows Service
|
|
275
|
-
console.error(chalk_1.default.yellow('\nPlease ensure you have the appropriate privileges and daemon support.'));
|
|
271
|
+
console.error(chalk_1.default.yellow('\nExpected at least one install method for your platform.'));
|
|
272
|
+
console.error(chalk_1.default.yellow(' - Linux: systemd, OpenRC, or foreground (user process)'));
|
|
273
|
+
console.error(chalk_1.default.yellow(' - macOS: launchd'));
|
|
274
|
+
console.error(chalk_1.default.yellow(' - Windows: Windows Service'));
|
|
276
275
|
return;
|
|
277
276
|
}
|
|
278
277
|
let selectedType;
|
|
279
278
|
if (options.type || noInteractive) {
|
|
280
|
-
|
|
279
|
+
let typeToUse = options.type;
|
|
280
|
+
if (!typeToUse && noInteractive) {
|
|
281
|
+
if (platform === 'darwin') {
|
|
282
|
+
typeToUse = 'launchd';
|
|
283
|
+
}
|
|
284
|
+
else if (platform === 'win32') {
|
|
285
|
+
typeToUse = 'windows-service';
|
|
286
|
+
}
|
|
287
|
+
else if (platform === 'linux') {
|
|
288
|
+
const rec = await PlatformDetector_1.PlatformDetector.getRecommendedType();
|
|
289
|
+
typeToUse = rec ?? 'foreground';
|
|
290
|
+
}
|
|
291
|
+
}
|
|
281
292
|
if (!typeToUse) {
|
|
282
293
|
throw new Error('Installation type is required in non-interactive mode (e.g. --type launchd).');
|
|
283
294
|
}
|
|
284
295
|
// Type specified via flag - validate it's a supported daemon type
|
|
285
|
-
const supportedTypes = [
|
|
296
|
+
const supportedTypes = [
|
|
297
|
+
'systemd',
|
|
298
|
+
'openrc',
|
|
299
|
+
'foreground',
|
|
300
|
+
'launchd',
|
|
301
|
+
'windows-service',
|
|
302
|
+
];
|
|
286
303
|
if (!supportedTypes.includes(typeToUse)) {
|
|
287
304
|
console.error(chalk_1.default.red(`✗ Installation type '${typeToUse}' is not supported`));
|
|
288
|
-
console.error(chalk_1.default.yellow(`
|
|
305
|
+
console.error(chalk_1.default.yellow(` Supported types: ${supportedTypes.join(', ')}`));
|
|
289
306
|
console.error(chalk_1.default.yellow(` Docker and Podman installations are no longer available`));
|
|
290
307
|
return;
|
|
291
308
|
}
|
|
@@ -323,14 +340,18 @@ async function handleAgentInstall(options, logger, configManager, edgibleService
|
|
|
323
340
|
selectedType = installType;
|
|
324
341
|
}
|
|
325
342
|
console.log(chalk_1.default.green(`\n✓ Selected: ${selectedType}\n`));
|
|
326
|
-
// Validate --local flag
|
|
327
|
-
if (options.local &&
|
|
328
|
-
|
|
329
|
-
|
|
343
|
+
// Validate --local flag
|
|
344
|
+
if (options.local &&
|
|
345
|
+
selectedType !== 'systemd' &&
|
|
346
|
+
selectedType !== 'openrc' &&
|
|
347
|
+
selectedType !== 'foreground' &&
|
|
348
|
+
selectedType !== 'launchd' &&
|
|
349
|
+
selectedType !== 'windows-service') {
|
|
350
|
+
console.error(chalk_1.default.red('✗ --local flag is not supported for this installation type'));
|
|
351
|
+
console.error(chalk_1.default.yellow(' Supported with: systemd, openrc, foreground, launchd, windows-service'));
|
|
330
352
|
return;
|
|
331
353
|
}
|
|
332
354
|
// Step 4: Check and Install Dependencies
|
|
333
|
-
// All supported installation types are native daemons, so always check dependencies
|
|
334
355
|
{
|
|
335
356
|
console.log(chalk_1.default.blue('🔍 Checking System Dependencies'));
|
|
336
357
|
console.log(chalk_1.default.gray('Verifying required tools are installed...\n'));
|
|
@@ -369,8 +390,7 @@ async function handleAgentInstall(options, logger, configManager, edgibleService
|
|
|
369
390
|
}
|
|
370
391
|
// Step 5: Install Agent Files
|
|
371
392
|
let agentPath;
|
|
372
|
-
|
|
373
|
-
const useSystemPath = true;
|
|
393
|
+
const useSystemPath = selectedType !== 'foreground';
|
|
374
394
|
const configPath = PathResolver_1.PathResolver.getAgentConfigPath(useSystemPath);
|
|
375
395
|
// For native daemon installations, download/install agent files
|
|
376
396
|
console.log(chalk_1.default.blue('📦 Installing Agent Files'));
|
|
@@ -453,6 +473,9 @@ async function handleAgentInstall(options, logger, configManager, edgibleService
|
|
|
453
473
|
console.log(chalk_1.default.green.bold(' ✓ Installation Complete!'));
|
|
454
474
|
console.log(chalk_1.default.blue.bold('═══════════════════════════════════════════\n'));
|
|
455
475
|
console.log(chalk_1.default.gray('Next steps:'));
|
|
476
|
+
if (selectedType === 'foreground') {
|
|
477
|
+
console.log(chalk_1.default.gray(` • Foreground install: start again after reboot with ${chalk_1.default.white('edgible agent start')}`));
|
|
478
|
+
}
|
|
456
479
|
console.log(chalk_1.default.gray(` • View status: ${chalk_1.default.white('edgible agent status')}`));
|
|
457
480
|
console.log(chalk_1.default.gray(` • View logs: ${chalk_1.default.white('edgible agent logs --follow')}`));
|
|
458
481
|
console.log(chalk_1.default.gray(` • Stop agent: ${chalk_1.default.white('edgible agent stop')}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2mBzD"}
|
package/dist/commands/debug.js
CHANGED
|
@@ -119,7 +119,12 @@ function setupDebugCommands(program) {
|
|
|
119
119
|
// Step 3: Install agent
|
|
120
120
|
console.log(chalk_1.default.blue.bold('\n[Step 3/9] Installing Agent\n'));
|
|
121
121
|
const platform = PlatformDetector_1.PlatformDetector.getPlatform();
|
|
122
|
-
const installationType = platform === 'darwin'
|
|
122
|
+
const installationType = platform === 'darwin'
|
|
123
|
+
? 'launchd'
|
|
124
|
+
: platform === 'win32'
|
|
125
|
+
? 'windows-service'
|
|
126
|
+
: (await PlatformDetector_1.PlatformDetector.getRecommendedType()) ??
|
|
127
|
+
'foreground';
|
|
123
128
|
if (options.local) {
|
|
124
129
|
console.log(chalk_1.default.cyan('Using local agent build from agent-v2/dist/\n'));
|
|
125
130
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type DaemonManagerInstallationType = 'systemd' | 'launchd' | 'windows-service' | 'docker' | 'podman' | 'openrc' | 'foreground';
|
|
1
2
|
export interface DaemonStatus {
|
|
2
3
|
running: boolean;
|
|
3
4
|
enabled: boolean;
|
|
@@ -72,6 +73,6 @@ export interface IDaemonManager {
|
|
|
72
73
|
/**
|
|
73
74
|
* Get the installation type
|
|
74
75
|
*/
|
|
75
|
-
getType():
|
|
76
|
+
getType(): DaemonManagerInstallationType;
|
|
76
77
|
}
|
|
77
78
|
//# sourceMappingURL=IDaemonManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDaemonManager.d.ts","sourceRoot":"","sources":["../../src/interfaces/IDaemonManager.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,SAAS,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B;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AAM,CAAC;IAEtB;;OAEG;IACH,OAAO,IAAI,6BAA6B,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentStatusManager.d.ts","sourceRoot":"","sources":["../../src/services/AgentStatusManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAA4C,MAAM,6BAA6B,CAAC;AAKrI,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAC,CAAiB;IACvC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAmC;IACrD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAQ;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAK;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAO;;
|
|
1
|
+
{"version":3,"file":"AgentStatusManager.d.ts","sourceRoot":"","sources":["../../src/services/AgentStatusManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAA4C,MAAM,6BAA6B,CAAC;AAKrI,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAC,CAAiB;IACvC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAmC;IACrD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAQ;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAK;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAO;;IAqB5B,SAAS,IAAI,OAAO,CAAC,wBAAwB,CAAC;IAgE9C,YAAY,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB9C,aAAa,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,IAAI,GAAG,IAAI;IAqBzE,YAAY,IAAI,IAAI;YAUN,UAAU;YASV,uBAAuB;YAoBvB,kBAAkB;IA4ChC,OAAO,CAAC,iBAAiB;IAMzB,iBAAiB,IAAI,MAAM;IAK3B,iBAAiB,IAAI,MAAM;IAKrB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAUlC,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAUrC,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAUjC,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAUzC,cAAc,IAAI,OAAO,CAAC,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;IAU3E,gBAAgB,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;CAQ7D"}
|
|
@@ -55,6 +55,7 @@ class AgentStatusManager extends events_1.EventEmitter {
|
|
|
55
55
|
const userConfig = configManager.getConfig();
|
|
56
56
|
// Resolve agent config paths based on installation type
|
|
57
57
|
const useSystemPath = userConfig.agentInstallationType === 'systemd' ||
|
|
58
|
+
userConfig.agentInstallationType === 'openrc' ||
|
|
58
59
|
userConfig.agentInstallationType === 'launchd' ||
|
|
59
60
|
userConfig.agentInstallationType === 'windows-service' ||
|
|
60
61
|
userConfig.agentInstallationType === 'docker' ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalAgentManager.d.ts","sourceRoot":"","sources":["../../src/services/LocalAgentManager.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,kBAAkB,EAGnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,EAEtB,wBAAwB,EACxB,kBAAkB,EAGnB,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D;;OAEG;IACG,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBxE;;OAEG;IACG,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BxD;;OAEG;IACG,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBxC,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAyBxC;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;YACW,oBAAoB;IASlC;;OAEG;YACW,sBAAsB;IAYpC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuBzB;;OAEG;YACW,kBAAkB;IA+ChC;;OAEG;YACW,gBAAgB;IA+C9B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAI9B;;OAEG;YACW,gBAAgB;IAgG9B;;OAEG;YACW,eAAe;IAgD7B;;OAEG;YACW,sBAAsB;IAkBpC;;OAEG;YACW,kBAAkB;CAkBjC"}
|
|
@@ -428,6 +428,13 @@ class LocalAgentManager {
|
|
|
428
428
|
console.log(chalk_1.default.gray(' 2. Check service logs: sudo journalctl -u edgible-agent -n 50'));
|
|
429
429
|
console.log(chalk_1.default.gray(' 3. Verify service file: cat /etc/systemd/system/edgible-agent.service'));
|
|
430
430
|
}
|
|
431
|
+
else if (userConfig.agentInstallationType === 'openrc') {
|
|
432
|
+
console.error(chalk_1.default.red(`\n✗ Failed to start OpenRC service: ${errorMessage}`));
|
|
433
|
+
console.log(chalk_1.default.yellow('\nTroubleshooting:'));
|
|
434
|
+
console.log(chalk_1.default.gray(' 1. Check service status: sudo rc-service edgible-agent status'));
|
|
435
|
+
console.log(chalk_1.default.gray(' 2. Check agent log file under /var/lib/edgible/agent/logs/agent.log'));
|
|
436
|
+
console.log(chalk_1.default.gray(' 3. Verify init script: cat /etc/init.d/edgible-agent'));
|
|
437
|
+
}
|
|
431
438
|
throw new Error(`Failed to start agent via daemon: ${errorMessage}`);
|
|
432
439
|
}
|
|
433
440
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDaemonManager } from '../../interfaces/IDaemonManager';
|
|
2
|
-
export type DaemonType = 'systemd' | 'launchd' | 'windows-service' | 'docker' | 'podman';
|
|
2
|
+
export type DaemonType = 'systemd' | 'launchd' | 'windows-service' | 'docker' | 'podman' | 'openrc' | 'foreground';
|
|
3
3
|
export declare class DaemonManagerFactory {
|
|
4
4
|
/**
|
|
5
5
|
* Create a daemon manager instance based on the type
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"DaemonManagerFactory.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/DaemonManagerFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAUjE,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,SAAS,GACT,iBAAiB,GACjB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,YAAY,CAAC;AAEjB,qBAAa,oBAAoB;IAC/B;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc;IA+C/C;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAgCnE;;OAEG;WACU,cAAc,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;CAS9D"}
|
|
@@ -4,6 +4,8 @@ exports.DaemonManagerFactory = void 0;
|
|
|
4
4
|
const SystemdDaemonManager_1 = require("./SystemdDaemonManager");
|
|
5
5
|
const LaunchdDaemonManager_1 = require("./LaunchdDaemonManager");
|
|
6
6
|
const WindowsServiceDaemonManager_1 = require("./WindowsServiceDaemonManager");
|
|
7
|
+
const OpenRCDaemonManager_1 = require("./OpenRCDaemonManager");
|
|
8
|
+
const ForegroundDaemonManager_1 = require("./ForegroundDaemonManager");
|
|
7
9
|
const PlatformDetector_1 = require("../../utils/PlatformDetector");
|
|
8
10
|
class DaemonManagerFactory {
|
|
9
11
|
/**
|
|
@@ -14,7 +16,7 @@ class DaemonManagerFactory {
|
|
|
14
16
|
const platform = PlatformDetector_1.PlatformDetector.getPlatform();
|
|
15
17
|
// Block Docker and Podman installations
|
|
16
18
|
if (type === 'docker' || type === 'podman') {
|
|
17
|
-
throw new Error(`${type} installations are no longer supported. Please use native daemon installations (systemd,
|
|
19
|
+
throw new Error(`${type} installations are no longer supported. Please use native daemon installations (systemd, openrc, foreground on Linux; launchd on macOS; windows-service on Windows).`);
|
|
18
20
|
}
|
|
19
21
|
switch (type) {
|
|
20
22
|
case 'systemd':
|
|
@@ -22,6 +24,16 @@ class DaemonManagerFactory {
|
|
|
22
24
|
throw new Error('systemd is only available on Linux');
|
|
23
25
|
}
|
|
24
26
|
return new SystemdDaemonManager_1.SystemdDaemonManager();
|
|
27
|
+
case 'openrc':
|
|
28
|
+
if (platform !== 'linux') {
|
|
29
|
+
throw new Error('OpenRC is only available on Linux');
|
|
30
|
+
}
|
|
31
|
+
return new OpenRCDaemonManager_1.OpenRCDaemonManager();
|
|
32
|
+
case 'foreground':
|
|
33
|
+
if (platform !== 'linux') {
|
|
34
|
+
throw new Error('Foreground installs are only available on Linux');
|
|
35
|
+
}
|
|
36
|
+
return new ForegroundDaemonManager_1.ForegroundDaemonManager();
|
|
25
37
|
case 'launchd':
|
|
26
38
|
if (platform !== 'darwin') {
|
|
27
39
|
throw new Error('launchd is only available on macOS');
|
|
@@ -44,7 +56,15 @@ class DaemonManagerFactory {
|
|
|
44
56
|
if (!installationType) {
|
|
45
57
|
return null;
|
|
46
58
|
}
|
|
47
|
-
const validTypes = [
|
|
59
|
+
const validTypes = [
|
|
60
|
+
'systemd',
|
|
61
|
+
'openrc',
|
|
62
|
+
'foreground',
|
|
63
|
+
'launchd',
|
|
64
|
+
'windows-service',
|
|
65
|
+
'docker',
|
|
66
|
+
'podman',
|
|
67
|
+
];
|
|
48
68
|
if (!validTypes.includes(installationType)) {
|
|
49
69
|
throw new Error(`Invalid installation type in config: ${installationType}`);
|
|
50
70
|
}
|
|
@@ -52,7 +72,7 @@ class DaemonManagerFactory {
|
|
|
52
72
|
if (installationType === 'docker' || installationType === 'podman') {
|
|
53
73
|
throw new Error(`${installationType} installations are no longer supported.\n` +
|
|
54
74
|
`Please uninstall the current agent and reinstall using a native daemon:\n` +
|
|
55
|
-
` - Linux: systemd\n` +
|
|
75
|
+
` - Linux: systemd, openrc, or foreground\n` +
|
|
56
76
|
` - macOS: launchd\n` +
|
|
57
77
|
` - Windows: windows-service`);
|
|
58
78
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDaemonManager, DaemonStatus, DaemonConfig } from '../../interfaces/IDaemonManager';
|
|
1
|
+
import { IDaemonManager, DaemonStatus, DaemonConfig, DaemonManagerInstallationType } from '../../interfaces/IDaemonManager';
|
|
2
2
|
export declare class DockerDaemonManager implements IDaemonManager {
|
|
3
3
|
private containerName;
|
|
4
4
|
private imageName;
|
|
@@ -17,7 +17,7 @@ export declare class DockerDaemonManager implements IDaemonManager {
|
|
|
17
17
|
disable(): Promise<void>;
|
|
18
18
|
uninstall(): Promise<void>;
|
|
19
19
|
getPlatform(): string;
|
|
20
|
-
getType():
|
|
20
|
+
getType(): DaemonManagerInstallationType;
|
|
21
21
|
private checkImageExists;
|
|
22
22
|
private buildImage;
|
|
23
23
|
private generateDockerRunCommand;
|
|
@@ -1 +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;
|
|
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,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAM5H,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,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IA0B7G,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,6BAA6B;YAI1B,gBAAgB;YAShB,UAAU;IAqBxB,OAAO,CAAC,wBAAwB;YA+DlB,oBAAoB;YASpB,oBAAoB;YAwBpB,oBAAoB;YA+BpB,oBAAoB;CAkBnC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IDaemonManager, DaemonStatus, DaemonConfig, DaemonManagerInstallationType } from '../../interfaces/IDaemonManager';
|
|
2
|
+
export declare class ForegroundDaemonManager implements IDaemonManager {
|
|
3
|
+
private paths;
|
|
4
|
+
constructor();
|
|
5
|
+
install(_config: DaemonConfig): Promise<void>;
|
|
6
|
+
start(): Promise<void>;
|
|
7
|
+
stop(): Promise<void>;
|
|
8
|
+
restart(): Promise<void>;
|
|
9
|
+
status(): Promise<DaemonStatus>;
|
|
10
|
+
logs(follow: boolean, lines?: number, _options?: {
|
|
11
|
+
stdout?: boolean;
|
|
12
|
+
stderr?: boolean;
|
|
13
|
+
}): Promise<string>;
|
|
14
|
+
enable(): Promise<void>;
|
|
15
|
+
disable(): Promise<void>;
|
|
16
|
+
uninstall(): Promise<void>;
|
|
17
|
+
getPlatform(): string;
|
|
18
|
+
getType(): DaemonManagerInstallationType;
|
|
19
|
+
private readPid;
|
|
20
|
+
private isPidAlive;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ForegroundDaemonManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForegroundDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/ForegroundDaemonManager.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AAQzC,qBAAa,uBAAwB,YAAW,cAAc;IAC5D,OAAO,CAAC,KAAK;;IAuBP,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoDtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAKxB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAY/B,IAAI,CACR,MAAM,EAAE,OAAO,EACf,KAAK,GAAE,MAAY,EACnB,QAAQ,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAChD,OAAO,CAAC,MAAM,CAAC;IAkBZ,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAKhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,6BAA6B;YAI1B,OAAO;IAUrB,OAAO,CAAC,UAAU;CAQnB"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ForegroundDaemonManager = void 0;
|
|
37
|
+
const child_process_1 = require("child_process");
|
|
38
|
+
const util_1 = require("util");
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const fsPromises = __importStar(require("fs/promises"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const PlatformDetector_1 = require("../../utils/PlatformDetector");
|
|
43
|
+
const PathResolver_1 = require("../../utils/PathResolver");
|
|
44
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
45
|
+
const INSTALL_TYPE = 'foreground';
|
|
46
|
+
class ForegroundDaemonManager {
|
|
47
|
+
paths() {
|
|
48
|
+
const configDir = PathResolver_1.PathResolver.resolveAgentConfigPath(INSTALL_TYPE);
|
|
49
|
+
return {
|
|
50
|
+
configDir,
|
|
51
|
+
indexJs: path.join(configDir, 'index.js'),
|
|
52
|
+
agentConfigJson: path.join(configDir, 'agent.config.json'),
|
|
53
|
+
pidFile: path.join(configDir, 'edgible-agent.pid'),
|
|
54
|
+
logFile: PathResolver_1.PathResolver.resolveAgentLogPath(INSTALL_TYPE),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
constructor() {
|
|
58
|
+
if (PlatformDetector_1.PlatformDetector.getPlatform() !== 'linux') {
|
|
59
|
+
throw new Error('ForegroundDaemonManager is only supported on Linux');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async install(_config) {
|
|
63
|
+
const logPath = PathResolver_1.PathResolver.resolveAgentLogPath(INSTALL_TYPE);
|
|
64
|
+
await fsPromises.mkdir(path.dirname(logPath), { recursive: true });
|
|
65
|
+
}
|
|
66
|
+
async start() {
|
|
67
|
+
const { indexJs, agentConfigJson, pidFile, logFile } = this.paths();
|
|
68
|
+
if (!fs.existsSync(indexJs)) {
|
|
69
|
+
throw new Error('Agent not installed. Run "edgible agent install" first.');
|
|
70
|
+
}
|
|
71
|
+
if (!fs.existsSync(agentConfigJson)) {
|
|
72
|
+
throw new Error(`Agent config missing: ${agentConfigJson}`);
|
|
73
|
+
}
|
|
74
|
+
const existingPid = await this.readPid(pidFile);
|
|
75
|
+
if (existingPid !== undefined && this.isPidAlive(existingPid)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (existingPid !== undefined) {
|
|
79
|
+
await fsPromises.unlink(pidFile).catch(() => undefined);
|
|
80
|
+
}
|
|
81
|
+
await fsPromises.mkdir(path.dirname(logFile), { recursive: true });
|
|
82
|
+
const logFd = fs.openSync(logFile, 'a');
|
|
83
|
+
const nodePath = process.execPath;
|
|
84
|
+
const args = [indexJs, 'start', '-c', agentConfigJson];
|
|
85
|
+
const child = (0, child_process_1.spawn)(nodePath, args, {
|
|
86
|
+
detached: true,
|
|
87
|
+
stdio: ['ignore', logFd, logFd],
|
|
88
|
+
windowsHide: true,
|
|
89
|
+
});
|
|
90
|
+
fs.closeSync(logFd);
|
|
91
|
+
child.on('error', (err) => {
|
|
92
|
+
console.error('Agent process error:', err);
|
|
93
|
+
});
|
|
94
|
+
child.unref();
|
|
95
|
+
if (!child.pid) {
|
|
96
|
+
throw new Error('Failed to spawn agent process');
|
|
97
|
+
}
|
|
98
|
+
await fsPromises.writeFile(pidFile, `${child.pid}\n`, 'utf8');
|
|
99
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
100
|
+
if (!this.isPidAlive(child.pid)) {
|
|
101
|
+
throw new Error('Agent process exited immediately. Check logs at ' + logFile);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async stop() {
|
|
105
|
+
const { pidFile } = this.paths();
|
|
106
|
+
const pid = await this.readPid(pidFile);
|
|
107
|
+
if (pid === undefined) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
process.kill(pid, 'SIGTERM');
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
// ignore
|
|
115
|
+
}
|
|
116
|
+
const deadline = Date.now() + 10000;
|
|
117
|
+
while (Date.now() < deadline && this.isPidAlive(pid)) {
|
|
118
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
119
|
+
}
|
|
120
|
+
if (this.isPidAlive(pid)) {
|
|
121
|
+
try {
|
|
122
|
+
process.kill(pid, 'SIGKILL');
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// ignore
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
await fsPromises.unlink(pidFile).catch(() => undefined);
|
|
129
|
+
}
|
|
130
|
+
async restart() {
|
|
131
|
+
await this.stop();
|
|
132
|
+
await this.start();
|
|
133
|
+
}
|
|
134
|
+
async status() {
|
|
135
|
+
const { pidFile } = this.paths();
|
|
136
|
+
const pid = await this.readPid(pidFile);
|
|
137
|
+
const running = pid !== undefined && this.isPidAlive(pid);
|
|
138
|
+
return {
|
|
139
|
+
running,
|
|
140
|
+
enabled: false,
|
|
141
|
+
pid,
|
|
142
|
+
message: running ? `Agent running (PID ${pid})` : 'Agent not running',
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async logs(follow, lines = 100, _options) {
|
|
146
|
+
const { logFile } = this.paths();
|
|
147
|
+
if (follow) {
|
|
148
|
+
const proc = (0, child_process_1.spawn)('tail', ['-n', String(lines), '-f', logFile], { stdio: 'inherit' });
|
|
149
|
+
process.on('SIGINT', () => {
|
|
150
|
+
proc.kill('SIGTERM');
|
|
151
|
+
process.exit(0);
|
|
152
|
+
});
|
|
153
|
+
return '';
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
const { stdout } = await execAsync(`tail -n ${lines} "${logFile}"`);
|
|
157
|
+
return stdout;
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
throw new Error(`Failed to read logs: ${error instanceof Error ? error.message : String(error)}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async enable() {
|
|
164
|
+
// No boot integration for foreground installs
|
|
165
|
+
}
|
|
166
|
+
async disable() {
|
|
167
|
+
// No boot integration for foreground installs
|
|
168
|
+
}
|
|
169
|
+
async uninstall() {
|
|
170
|
+
await this.stop();
|
|
171
|
+
await fsPromises.unlink(this.paths().pidFile).catch(() => undefined);
|
|
172
|
+
}
|
|
173
|
+
getPlatform() {
|
|
174
|
+
return 'linux';
|
|
175
|
+
}
|
|
176
|
+
getType() {
|
|
177
|
+
return 'foreground';
|
|
178
|
+
}
|
|
179
|
+
async readPid(pidFile) {
|
|
180
|
+
try {
|
|
181
|
+
const raw = await fsPromises.readFile(pidFile, 'utf8');
|
|
182
|
+
const n = parseInt(raw.trim(), 10);
|
|
183
|
+
return Number.isFinite(n) ? n : undefined;
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
isPidAlive(pid) {
|
|
190
|
+
try {
|
|
191
|
+
process.kill(pid, 0);
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
exports.ForegroundDaemonManager = ForegroundDaemonManager;
|
|
200
|
+
//# sourceMappingURL=ForegroundDaemonManager.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDaemonManager, DaemonStatus, DaemonConfig } from '../../interfaces/IDaemonManager';
|
|
1
|
+
import { IDaemonManager, DaemonStatus, DaemonConfig, DaemonManagerInstallationType } from '../../interfaces/IDaemonManager';
|
|
2
2
|
export declare class LaunchdDaemonManager implements IDaemonManager {
|
|
3
3
|
private serviceName;
|
|
4
4
|
private plistPath;
|
|
@@ -17,7 +17,7 @@ export declare class LaunchdDaemonManager implements IDaemonManager {
|
|
|
17
17
|
disable(): Promise<void>;
|
|
18
18
|
uninstall(): Promise<void>;
|
|
19
19
|
getPlatform(): string;
|
|
20
|
-
getType():
|
|
20
|
+
getType(): DaemonManagerInstallationType;
|
|
21
21
|
private generatePlistFile;
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=LaunchdDaemonManager.d.ts.map
|
|
@@ -1 +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;
|
|
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,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAM5H,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,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAsJ7G,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,6BAA6B;IAIxC,OAAO,CAAC,iBAAiB;CA8C1B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IDaemonManager, DaemonStatus, DaemonConfig, DaemonManagerInstallationType } from '../../interfaces/IDaemonManager';
|
|
2
|
+
export declare class OpenRCDaemonManager implements IDaemonManager {
|
|
3
|
+
private readonly serviceName;
|
|
4
|
+
private readonly initScriptPath;
|
|
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, _options?: {
|
|
12
|
+
stdout?: boolean;
|
|
13
|
+
stderr?: boolean;
|
|
14
|
+
}): Promise<string>;
|
|
15
|
+
enable(): Promise<void>;
|
|
16
|
+
disable(): Promise<void>;
|
|
17
|
+
uninstall(): Promise<void>;
|
|
18
|
+
getPlatform(): string;
|
|
19
|
+
getType(): DaemonManagerInstallationType;
|
|
20
|
+
private isEnabled;
|
|
21
|
+
private generateInitScript;
|
|
22
|
+
/** Single-quoted string safe for OpenRC /bin/sh */
|
|
23
|
+
private shSingleQuote;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=OpenRCDaemonManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenRCDaemonManager.d.ts","sourceRoot":"","sources":["../../../src/services/daemon/OpenRCDaemonManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAM5H,qBAAa,mBAAoB,YAAW,cAAc;IACxD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAC/C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqC;;IAQ9D,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAY5C,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;IAmB/B,IAAI,CACR,MAAM,EAAE,OAAO,EACf,KAAK,GAAE,MAAY,EACnB,QAAQ,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAChD,OAAO,CAAC,MAAM,CAAC;IAmBZ,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAQvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBhC,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,6BAA6B;YAI1B,SAAS;IASvB,OAAO,CAAC,kBAAkB;IAuB1B,mDAAmD;IACnD,OAAO,CAAC,aAAa;CAGtB"}
|