@elizaos/daemon 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.
- package/README.md +117 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +181 -0
- package/dist/index.js.map +1 -0
- package/dist/launchd.d.ts +9 -0
- package/dist/launchd.d.ts.map +1 -0
- package/dist/launchd.js +272 -0
- package/dist/launchd.js.map +1 -0
- package/dist/schtasks.d.ts +9 -0
- package/dist/schtasks.d.ts.map +1 -0
- package/dist/schtasks.js +259 -0
- package/dist/schtasks.js.map +1 -0
- package/dist/systemd.d.ts +9 -0
- package/dist/systemd.d.ts.map +1 -0
- package/dist/systemd.js +325 -0
- package/dist/systemd.js.map +1 -0
- package/dist/types.d.ts +84 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# @elizaos/daemon
|
|
2
|
+
|
|
3
|
+
Cross-platform daemon/service management for Eliza agents.
|
|
4
|
+
|
|
5
|
+
Provides a unified API for managing background services across platforms:
|
|
6
|
+
- **macOS**: LaunchAgents (launchd)
|
|
7
|
+
- **Linux**: systemd user services
|
|
8
|
+
- **Windows**: Scheduled Tasks (schtasks)
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @elizaos/daemon
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { installAgentService, isServiceRunning, stopService } from "@elizaos/daemon";
|
|
20
|
+
|
|
21
|
+
// Install an Eliza agent as a background service
|
|
22
|
+
await installAgentService({
|
|
23
|
+
name: "my-eliza-agent",
|
|
24
|
+
description: "My Eliza Agent",
|
|
25
|
+
entryPoint: "/path/to/agent/index.js",
|
|
26
|
+
workingDirectory: "/path/to/agent",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Check if running
|
|
30
|
+
const running = await isServiceRunning("my-eliza-agent");
|
|
31
|
+
console.log(`Agent running: ${running}`);
|
|
32
|
+
|
|
33
|
+
// Stop the service
|
|
34
|
+
await stopService("my-eliza-agent");
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
### Service Management
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// Install a service
|
|
43
|
+
installService(config: ServiceConfig): Promise<ServiceResult>
|
|
44
|
+
|
|
45
|
+
// Uninstall a service
|
|
46
|
+
uninstallService(name: string): Promise<ServiceResult>
|
|
47
|
+
|
|
48
|
+
// Start/stop/restart
|
|
49
|
+
startService(name: string): Promise<ServiceResult>
|
|
50
|
+
stopService(name: string): Promise<ServiceResult>
|
|
51
|
+
restartService(name: string): Promise<ServiceResult>
|
|
52
|
+
|
|
53
|
+
// Check status
|
|
54
|
+
isServiceInstalled(name: string): Promise<boolean>
|
|
55
|
+
isServiceRunning(name: string): Promise<boolean>
|
|
56
|
+
getServiceRuntime(name: string): Promise<ServiceRuntime>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Service Configuration
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
interface ServiceConfig {
|
|
63
|
+
/** Unique service name/identifier */
|
|
64
|
+
name: string;
|
|
65
|
+
/** Human-readable description */
|
|
66
|
+
description?: string;
|
|
67
|
+
/** Command to execute (first element is the executable) */
|
|
68
|
+
command: string[];
|
|
69
|
+
/** Working directory for the service */
|
|
70
|
+
workingDirectory?: string;
|
|
71
|
+
/** Environment variables */
|
|
72
|
+
environment?: Record<string, string>;
|
|
73
|
+
/** Auto-restart on failure (default: true) */
|
|
74
|
+
restartOnFailure?: boolean;
|
|
75
|
+
/** Restart delay in seconds (default: 5) */
|
|
76
|
+
restartDelay?: number;
|
|
77
|
+
/** Keep alive - restart if process exits (default: true) */
|
|
78
|
+
keepAlive?: boolean;
|
|
79
|
+
/** Run at system load/boot (default: true) */
|
|
80
|
+
runAtLoad?: boolean;
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Platform-Specific Managers
|
|
85
|
+
|
|
86
|
+
For direct access to platform-specific functionality:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { launchdManager, systemdManager, schtasksManager } from "@elizaos/daemon";
|
|
90
|
+
|
|
91
|
+
// Use macOS-specific features
|
|
92
|
+
if (process.platform === "darwin") {
|
|
93
|
+
const runtime = await launchdManager.getRuntime("my-service");
|
|
94
|
+
console.log("Plist path:", runtime.platformInfo?.plistPath);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Platform Details
|
|
99
|
+
|
|
100
|
+
### macOS (launchd)
|
|
101
|
+
|
|
102
|
+
Services are installed as user LaunchAgents in `~/Library/LaunchAgents/`.
|
|
103
|
+
Logs are written to `~/Library/Logs/{service-name}/`.
|
|
104
|
+
|
|
105
|
+
### Linux (systemd)
|
|
106
|
+
|
|
107
|
+
Services are installed as user units in `~/.config/systemd/user/`.
|
|
108
|
+
User lingering is automatically enabled to allow services to run without login.
|
|
109
|
+
|
|
110
|
+
### Windows (Task Scheduler)
|
|
111
|
+
|
|
112
|
+
Services are registered as scheduled tasks that run at user logon.
|
|
113
|
+
Tasks are configured with auto-restart on failure.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @elizaos/daemon - Cross-platform daemon/service management for Eliza agents.
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified API for managing background services across platforms:
|
|
5
|
+
* - macOS: LaunchAgents (launchd)
|
|
6
|
+
* - Linux: systemd user services
|
|
7
|
+
* - Windows: Scheduled Tasks (schtasks)
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { installService, getServiceManager } from "@elizaos/daemon";
|
|
12
|
+
*
|
|
13
|
+
* // Install a service
|
|
14
|
+
* await installService({
|
|
15
|
+
* name: "my-eliza-agent",
|
|
16
|
+
* description: "My Eliza Agent",
|
|
17
|
+
* command: ["node", "/path/to/agent.js"],
|
|
18
|
+
* keepAlive: true,
|
|
19
|
+
* runAtLoad: true,
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Check status
|
|
23
|
+
* const manager = getServiceManager();
|
|
24
|
+
* const runtime = await manager.getRuntime("my-eliza-agent");
|
|
25
|
+
* console.log(`Running: ${runtime.running}, PID: ${runtime.pid}`);
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @module
|
|
29
|
+
*/
|
|
30
|
+
import type { Platform, ServiceCommand, ServiceConfig, ServiceManager, ServiceResult, ServiceRuntime } from "./types.js";
|
|
31
|
+
export type { Platform, ServiceCommand, ServiceConfig, ServiceManager, ServiceResult, ServiceRuntime, };
|
|
32
|
+
export { launchdManager } from "./launchd.js";
|
|
33
|
+
export { systemdManager } from "./systemd.js";
|
|
34
|
+
export { schtasksManager } from "./schtasks.js";
|
|
35
|
+
/**
|
|
36
|
+
* Get the current platform.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getPlatform(): Platform;
|
|
39
|
+
/**
|
|
40
|
+
* Check if the current platform is supported.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isPlatformSupported(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Get the service manager for the current platform.
|
|
45
|
+
*
|
|
46
|
+
* @throws Error if the platform is not supported
|
|
47
|
+
*/
|
|
48
|
+
export declare function getServiceManager(): ServiceManager;
|
|
49
|
+
/**
|
|
50
|
+
* Install a service on the current platform.
|
|
51
|
+
*
|
|
52
|
+
* @param config - Service configuration
|
|
53
|
+
* @returns Result of the installation
|
|
54
|
+
*/
|
|
55
|
+
export declare function installService(config: ServiceConfig): Promise<ServiceResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Uninstall a service on the current platform.
|
|
58
|
+
*
|
|
59
|
+
* @param name - Service name
|
|
60
|
+
* @returns Result of the uninstallation
|
|
61
|
+
*/
|
|
62
|
+
export declare function uninstallService(name: string): Promise<ServiceResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Start a service on the current platform.
|
|
65
|
+
*
|
|
66
|
+
* @param name - Service name
|
|
67
|
+
* @returns Result of the start operation
|
|
68
|
+
*/
|
|
69
|
+
export declare function startService(name: string): Promise<ServiceResult>;
|
|
70
|
+
/**
|
|
71
|
+
* Stop a service on the current platform.
|
|
72
|
+
*
|
|
73
|
+
* @param name - Service name
|
|
74
|
+
* @returns Result of the stop operation
|
|
75
|
+
*/
|
|
76
|
+
export declare function stopService(name: string): Promise<ServiceResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Restart a service on the current platform.
|
|
79
|
+
*
|
|
80
|
+
* @param name - Service name
|
|
81
|
+
* @returns Result of the restart operation
|
|
82
|
+
*/
|
|
83
|
+
export declare function restartService(name: string): Promise<ServiceResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Check if a service is installed on the current platform.
|
|
86
|
+
*
|
|
87
|
+
* @param name - Service name
|
|
88
|
+
* @returns True if the service is installed
|
|
89
|
+
*/
|
|
90
|
+
export declare function isServiceInstalled(name: string): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Check if a service is running on the current platform.
|
|
93
|
+
*
|
|
94
|
+
* @param name - Service name
|
|
95
|
+
* @returns True if the service is running
|
|
96
|
+
*/
|
|
97
|
+
export declare function isServiceRunning(name: string): Promise<boolean>;
|
|
98
|
+
/**
|
|
99
|
+
* Get service command details.
|
|
100
|
+
*
|
|
101
|
+
* @param name - Service name
|
|
102
|
+
* @returns Service command details or null if not found
|
|
103
|
+
*/
|
|
104
|
+
export declare function getServiceCommand(name: string): Promise<ServiceCommand | null>;
|
|
105
|
+
/**
|
|
106
|
+
* Get service runtime status.
|
|
107
|
+
*
|
|
108
|
+
* @param name - Service name
|
|
109
|
+
* @returns Service runtime status
|
|
110
|
+
*/
|
|
111
|
+
export declare function getServiceRuntime(name: string): Promise<ServiceRuntime>;
|
|
112
|
+
/**
|
|
113
|
+
* Install an Eliza agent as a service.
|
|
114
|
+
*
|
|
115
|
+
* This is a convenience function that sets up sensible defaults for Eliza agents.
|
|
116
|
+
*
|
|
117
|
+
* @param options - Agent service options
|
|
118
|
+
* @returns Result of the installation
|
|
119
|
+
*/
|
|
120
|
+
export declare function installAgentService(options: {
|
|
121
|
+
/** Agent name (used as service name) */
|
|
122
|
+
name: string;
|
|
123
|
+
/** Agent description */
|
|
124
|
+
description?: string;
|
|
125
|
+
/** Path to the agent entry point (e.g., index.js) */
|
|
126
|
+
entryPoint: string;
|
|
127
|
+
/** Working directory for the agent */
|
|
128
|
+
workingDirectory?: string;
|
|
129
|
+
/** Node.js executable path (defaults to current process) */
|
|
130
|
+
nodeExecutable?: string;
|
|
131
|
+
/** Additional environment variables */
|
|
132
|
+
environment?: Record<string, string>;
|
|
133
|
+
}): Promise<ServiceResult>;
|
|
134
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../typescript/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,QAAQ,EACR,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,GACf,CAAC;AAGF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;GAEG;AACH,wBAAgB,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;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,GAAG,OAAO,CAAC,aAAa,CAAC,CAezB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @elizaos/daemon - Cross-platform daemon/service management for Eliza agents.
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified API for managing background services across platforms:
|
|
5
|
+
* - macOS: LaunchAgents (launchd)
|
|
6
|
+
* - Linux: systemd user services
|
|
7
|
+
* - Windows: Scheduled Tasks (schtasks)
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { installService, getServiceManager } from "@elizaos/daemon";
|
|
12
|
+
*
|
|
13
|
+
* // Install a service
|
|
14
|
+
* await installService({
|
|
15
|
+
* name: "my-eliza-agent",
|
|
16
|
+
* description: "My Eliza Agent",
|
|
17
|
+
* command: ["node", "/path/to/agent.js"],
|
|
18
|
+
* keepAlive: true,
|
|
19
|
+
* runAtLoad: true,
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Check status
|
|
23
|
+
* const manager = getServiceManager();
|
|
24
|
+
* const runtime = await manager.getRuntime("my-eliza-agent");
|
|
25
|
+
* console.log(`Running: ${runtime.running}, PID: ${runtime.pid}`);
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @module
|
|
29
|
+
*/
|
|
30
|
+
import { launchdManager } from "./launchd.js";
|
|
31
|
+
import { schtasksManager } from "./schtasks.js";
|
|
32
|
+
import { systemdManager } from "./systemd.js";
|
|
33
|
+
// Re-export platform-specific managers for direct access
|
|
34
|
+
export { launchdManager } from "./launchd.js";
|
|
35
|
+
export { systemdManager } from "./systemd.js";
|
|
36
|
+
export { schtasksManager } from "./schtasks.js";
|
|
37
|
+
/**
|
|
38
|
+
* Get the current platform.
|
|
39
|
+
*/
|
|
40
|
+
export function getPlatform() {
|
|
41
|
+
return process.platform;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check if the current platform is supported.
|
|
45
|
+
*/
|
|
46
|
+
export function isPlatformSupported() {
|
|
47
|
+
const platform = getPlatform();
|
|
48
|
+
return platform === "darwin" || platform === "linux" || platform === "win32";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the service manager for the current platform.
|
|
52
|
+
*
|
|
53
|
+
* @throws Error if the platform is not supported
|
|
54
|
+
*/
|
|
55
|
+
export function getServiceManager() {
|
|
56
|
+
const platform = getPlatform();
|
|
57
|
+
switch (platform) {
|
|
58
|
+
case "darwin":
|
|
59
|
+
return launchdManager;
|
|
60
|
+
case "linux":
|
|
61
|
+
return systemdManager;
|
|
62
|
+
case "win32":
|
|
63
|
+
return schtasksManager;
|
|
64
|
+
default:
|
|
65
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Install a service on the current platform.
|
|
70
|
+
*
|
|
71
|
+
* @param config - Service configuration
|
|
72
|
+
* @returns Result of the installation
|
|
73
|
+
*/
|
|
74
|
+
export async function installService(config) {
|
|
75
|
+
const manager = getServiceManager();
|
|
76
|
+
return manager.install(config);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Uninstall a service on the current platform.
|
|
80
|
+
*
|
|
81
|
+
* @param name - Service name
|
|
82
|
+
* @returns Result of the uninstallation
|
|
83
|
+
*/
|
|
84
|
+
export async function uninstallService(name) {
|
|
85
|
+
const manager = getServiceManager();
|
|
86
|
+
return manager.uninstall(name);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Start a service on the current platform.
|
|
90
|
+
*
|
|
91
|
+
* @param name - Service name
|
|
92
|
+
* @returns Result of the start operation
|
|
93
|
+
*/
|
|
94
|
+
export async function startService(name) {
|
|
95
|
+
const manager = getServiceManager();
|
|
96
|
+
return manager.start(name);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Stop a service on the current platform.
|
|
100
|
+
*
|
|
101
|
+
* @param name - Service name
|
|
102
|
+
* @returns Result of the stop operation
|
|
103
|
+
*/
|
|
104
|
+
export async function stopService(name) {
|
|
105
|
+
const manager = getServiceManager();
|
|
106
|
+
return manager.stop(name);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Restart a service on the current platform.
|
|
110
|
+
*
|
|
111
|
+
* @param name - Service name
|
|
112
|
+
* @returns Result of the restart operation
|
|
113
|
+
*/
|
|
114
|
+
export async function restartService(name) {
|
|
115
|
+
const manager = getServiceManager();
|
|
116
|
+
return manager.restart(name);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Check if a service is installed on the current platform.
|
|
120
|
+
*
|
|
121
|
+
* @param name - Service name
|
|
122
|
+
* @returns True if the service is installed
|
|
123
|
+
*/
|
|
124
|
+
export async function isServiceInstalled(name) {
|
|
125
|
+
const manager = getServiceManager();
|
|
126
|
+
return manager.isInstalled(name);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Check if a service is running on the current platform.
|
|
130
|
+
*
|
|
131
|
+
* @param name - Service name
|
|
132
|
+
* @returns True if the service is running
|
|
133
|
+
*/
|
|
134
|
+
export async function isServiceRunning(name) {
|
|
135
|
+
const manager = getServiceManager();
|
|
136
|
+
return manager.isRunning(name);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Get service command details.
|
|
140
|
+
*
|
|
141
|
+
* @param name - Service name
|
|
142
|
+
* @returns Service command details or null if not found
|
|
143
|
+
*/
|
|
144
|
+
export async function getServiceCommand(name) {
|
|
145
|
+
const manager = getServiceManager();
|
|
146
|
+
return manager.getCommand(name);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Get service runtime status.
|
|
150
|
+
*
|
|
151
|
+
* @param name - Service name
|
|
152
|
+
* @returns Service runtime status
|
|
153
|
+
*/
|
|
154
|
+
export async function getServiceRuntime(name) {
|
|
155
|
+
const manager = getServiceManager();
|
|
156
|
+
return manager.getRuntime(name);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Install an Eliza agent as a service.
|
|
160
|
+
*
|
|
161
|
+
* This is a convenience function that sets up sensible defaults for Eliza agents.
|
|
162
|
+
*
|
|
163
|
+
* @param options - Agent service options
|
|
164
|
+
* @returns Result of the installation
|
|
165
|
+
*/
|
|
166
|
+
export async function installAgentService(options) {
|
|
167
|
+
const nodeExe = options.nodeExecutable || process.execPath;
|
|
168
|
+
const config = {
|
|
169
|
+
name: options.name,
|
|
170
|
+
description: options.description || `Eliza Agent: ${options.name}`,
|
|
171
|
+
command: [nodeExe, options.entryPoint],
|
|
172
|
+
workingDirectory: options.workingDirectory,
|
|
173
|
+
environment: options.environment,
|
|
174
|
+
keepAlive: true,
|
|
175
|
+
restartOnFailure: true,
|
|
176
|
+
restartDelay: 5,
|
|
177
|
+
runAtLoad: true,
|
|
178
|
+
};
|
|
179
|
+
return installService(config);
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../typescript/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAoB9C,yDAAyD;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;G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,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC;QACtC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,SAAS,EAAE,IAAI;QACf,gBAAgB,EAAE,IAAI;QACtB,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,IAAI;KAChB,CAAC;IAEF,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* macOS LaunchAgent service manager.
|
|
3
|
+
*
|
|
4
|
+
* Manages services via launchd LaunchAgents for the current user.
|
|
5
|
+
*/
|
|
6
|
+
import type { ServiceManager } from "./types.js";
|
|
7
|
+
/** macOS LaunchAgent service manager */
|
|
8
|
+
export declare const launchdManager: ServiceManager;
|
|
9
|
+
//# sourceMappingURL=launchd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launchd.d.ts","sourceRoot":"","sources":["../typescript/src/launchd.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAGV,cAAc,EAGf,MAAM,YAAY,CAAC;AAgLpB,wCAAwC;AACxC,eAAO,MAAM,cAAc,EAAE,cA2H5B,CAAC"}
|