agent-afk 5.35.3 → 5.36.1

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.
@@ -0,0 +1,4 @@
1
+ import type { ServiceManager } from './types.js';
2
+ export * from './types.js';
3
+ export declare function serviceManagerFor(platform?: NodeJS.Platform): ServiceManager | null;
4
+ export declare const SUPPORTED_SERVICE_PLATFORMS = "macOS (launchd) and Linux (systemd --user)";
@@ -0,0 +1,2 @@
1
+ import type { ServiceManager } from '../types.js';
2
+ export declare const launchdManager: ServiceManager;
@@ -0,0 +1,7 @@
1
+ import type { ServiceInstallOptions, ServiceInstallOutcome, ServiceName, ServiceUninstallOutcome } from '../types.js';
2
+ export interface SystemdInstallOptions extends ServiceInstallOptions {
3
+ _entrypointExistsCheck?: (p: string) => boolean;
4
+ }
5
+ export declare function installSystemdService(name: ServiceName, opts?: SystemdInstallOptions): ServiceInstallOutcome;
6
+ export declare function uninstallSystemdService(name: ServiceName): ServiceUninstallOutcome;
7
+ export declare function readUnitFile(name: ServiceName): string | undefined;
@@ -0,0 +1,2 @@
1
+ import type { ServiceManager } from '../types.js';
2
+ export declare const systemdManager: ServiceManager;
@@ -0,0 +1,11 @@
1
+ import type { ServiceName } from '../types.js';
2
+ export declare function systemdUserDir(home?: string): string;
3
+ export declare function unitFileName(name: ServiceName): string;
4
+ export declare function pathUnitFileName(name: ServiceName): string;
5
+ export declare function restartUnitFileName(name: ServiceName): string;
6
+ export declare function unitPath(name: ServiceName, home?: string): string;
7
+ export declare function pathUnitPath(name: ServiceName, home?: string): string;
8
+ export declare function restartUnitPath(name: ServiceName, home?: string): string;
9
+ export declare function systemdLabel(name: ServiceName): string;
10
+ export declare function serviceLogPath(name: ServiceName): string;
11
+ export declare const SYSTEMCTL_TIMEOUT_MS = 8000;
@@ -0,0 +1,9 @@
1
+ import type { ServiceName, ServiceStatus } from '../types.js';
2
+ export interface SystemctlShowResult {
3
+ pid?: number;
4
+ lastExitStatus?: number;
5
+ activeState?: string;
6
+ loadState?: string;
7
+ }
8
+ export declare function parseSystemctlShow(output: string): SystemctlShowResult;
9
+ export declare function systemdStatus(name: ServiceName): ServiceStatus;
@@ -0,0 +1,20 @@
1
+ export interface ServiceUnitOptions {
2
+ description: string;
3
+ execStart: string[];
4
+ workingDirectory: string;
5
+ logFile: string;
6
+ environmentVariables?: Record<string, string>;
7
+ }
8
+ export interface PathUnitOptions {
9
+ description: string;
10
+ pathModified: string[];
11
+ unit: string;
12
+ }
13
+ export interface RestartUnitOptions {
14
+ description: string;
15
+ systemctlPath: string;
16
+ targetUnit: string;
17
+ }
18
+ export declare function renderServiceUnit(opts: ServiceUnitOptions): string;
19
+ export declare function renderPathUnit(opts: PathUnitOptions): string;
20
+ export declare function renderRestartUnit(opts: RestartUnitOptions): string;
@@ -0,0 +1,63 @@
1
+ export type ServiceName = 'telegram' | 'daemon';
2
+ export declare const SERVICE_NAMES: readonly ServiceName[];
3
+ export interface ServiceInstallOptions {
4
+ noWatch?: boolean;
5
+ dryRun?: boolean;
6
+ environment?: Record<string, string>;
7
+ }
8
+ export type ServiceInstallOutcome = {
9
+ kind: 'installed';
10
+ configPath: string;
11
+ label: string;
12
+ autoRestartOnRebuild: boolean;
13
+ notes?: string[];
14
+ } | {
15
+ kind: 'already-installed';
16
+ configPath: string;
17
+ label: string;
18
+ } | {
19
+ kind: 'failed';
20
+ reason: string;
21
+ };
22
+ export type ServiceUninstallOutcome = {
23
+ kind: 'uninstalled';
24
+ configPath: string;
25
+ } | {
26
+ kind: 'not-installed';
27
+ configPath: string;
28
+ } | {
29
+ kind: 'failed';
30
+ reason: string;
31
+ };
32
+ export type ServiceRestartOutcome = {
33
+ kind: 'restarted';
34
+ label: string;
35
+ } | {
36
+ kind: 'not-installed';
37
+ configPath: string;
38
+ } | {
39
+ kind: 'failed';
40
+ reason: string;
41
+ };
42
+ export interface ServiceStatus {
43
+ name: ServiceName;
44
+ label: string;
45
+ installed: boolean;
46
+ configPath: string;
47
+ pid?: number;
48
+ lastExitStatus?: number;
49
+ logFile: string;
50
+ }
51
+ export interface ServiceManager {
52
+ readonly backend: 'launchd' | 'systemd';
53
+ readonly configKind: string;
54
+ install(name: ServiceName, opts?: ServiceInstallOptions): ServiceInstallOutcome;
55
+ uninstall(name: ServiceName): ServiceUninstallOutcome;
56
+ status(name: ServiceName): ServiceStatus;
57
+ restart(name: ServiceName): ServiceRestartOutcome;
58
+ isInstalled(name: ServiceName): boolean;
59
+ configPath(name: ServiceName): string;
60
+ logPath(name: ServiceName): string;
61
+ label(name: ServiceName): string;
62
+ readConfigFile(name: ServiceName): string | undefined;
63
+ }