@caplets/core 0.24.1 → 0.25.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 (50) hide show
  1. package/dist/attach/options.d.ts +1 -0
  2. package/dist/attach/server.d.ts +3 -0
  3. package/dist/cli/commands.d.ts +10 -2
  4. package/dist/cli/doctor.d.ts +4 -1
  5. package/dist/cli.d.ts +3 -2
  6. package/dist/{completion-BeVXdm9q.js → completion-DrPr2vYw.js} +27 -5
  7. package/dist/daemon/config.d.ts +8 -0
  8. package/dist/daemon/env.d.ts +2 -0
  9. package/dist/daemon/index.d.ts +18 -0
  10. package/dist/daemon/logs.d.ts +15 -0
  11. package/dist/daemon/manager.d.ts +2 -0
  12. package/dist/daemon/paths.d.ts +2 -0
  13. package/dist/daemon/platform-darwin.d.ts +3 -0
  14. package/dist/daemon/platform-linux.d.ts +3 -0
  15. package/dist/daemon/platform-windows.d.ts +3 -0
  16. package/dist/daemon/process.d.ts +11 -0
  17. package/dist/daemon/shell.d.ts +20 -0
  18. package/dist/daemon/types.d.ts +178 -0
  19. package/dist/daemon/validation.d.ts +13 -0
  20. package/dist/daemon/xml.d.ts +1 -0
  21. package/dist/index.js +5857 -3604
  22. package/dist/native/options.d.ts +5 -2
  23. package/dist/native/remote.d.ts +6 -1
  24. package/dist/native.js +1 -1
  25. package/dist/project-binding/attach.d.ts +1 -3
  26. package/dist/project-binding/session.d.ts +1 -0
  27. package/dist/remote/credential-store.d.ts +12 -0
  28. package/dist/remote/options.d.ts +2 -7
  29. package/dist/remote/pairing.d.ts +13 -0
  30. package/dist/remote/profile-store.d.ts +94 -0
  31. package/dist/remote/profiles.d.ts +47 -0
  32. package/dist/remote/selection.d.ts +4 -4
  33. package/dist/remote/server-credential-store.d.ts +84 -0
  34. package/dist/remote/server-credentials.d.ts +21 -0
  35. package/dist/remote-control/client.d.ts +4 -1
  36. package/dist/serve/http.d.ts +5 -0
  37. package/dist/serve/index.d.ts +1 -3
  38. package/dist/serve/options.d.ts +7 -12
  39. package/dist/server/options.d.ts +2 -9
  40. package/dist/{service-Cvnuu9wr.js → service-DjwB8aiW.js} +1084 -254
  41. package/package.json +1 -1
  42. package/dist/serve/daemon/config.d.ts +0 -8
  43. package/dist/serve/daemon/index.d.ts +0 -16
  44. package/dist/serve/daemon/paths.d.ts +0 -3
  45. package/dist/serve/daemon/platform-darwin.d.ts +0 -2
  46. package/dist/serve/daemon/platform-linux.d.ts +0 -2
  47. package/dist/serve/daemon/platform-windows.d.ts +0 -2
  48. package/dist/serve/daemon/platform.d.ts +0 -9
  49. package/dist/serve/daemon/process.d.ts +0 -5
  50. package/dist/serve/daemon/types.d.ts +0 -86
@@ -7,6 +7,7 @@ export type AttachServeOptions = ServeOptions & {
7
7
  configPath: string;
8
8
  projectRoot: string;
9
9
  projectConfigPath: string;
10
+ authDir?: string | undefined;
10
11
  selection: ResolvedRemoteSelection;
11
12
  };
12
13
  export declare function resolveAttachServeOptions(raw?: RawAttachServeOptions, env?: Record<string, string | undefined>): Promise<AttachServeOptions>;
@@ -3,3 +3,6 @@ export type AttachServeIo = {
3
3
  writeErr?: (value: string) => void;
4
4
  };
5
5
  export declare function attachResolvedCaplets(options: AttachServeOptions, io?: AttachServeIo): Promise<void>;
6
+ declare function createAttachNativeService(options: AttachServeOptions, io: AttachServeIo): import("../native").NativeCapletsService;
7
+ export declare const createAttachNativeServiceForTests: typeof createAttachNativeService;
8
+ export {};
@@ -4,8 +4,10 @@ export declare const cliCommands: {
4
4
  readonly completion: "completion";
5
5
  readonly completeHidden: "__complete";
6
6
  readonly codeMode: "code-mode";
7
+ readonly daemon: "daemon";
7
8
  readonly serve: "serve";
8
9
  readonly attach: "attach";
10
+ readonly remote: "remote";
9
11
  readonly cloud: "cloud";
10
12
  readonly init: "init";
11
13
  readonly setup: "setup";
@@ -30,17 +32,23 @@ export declare const cliCommands: {
30
32
  readonly config: "config";
31
33
  readonly auth: "auth";
32
34
  };
33
- export declare const topLevelCommandNames: readonly ["serve", "code-mode", "attach", "cloud", "init", "setup", "doctor", "list", "install", "add", "inspect", "check-backend", "list-tools", "search-tools", "get-tool", "call-tool", "list-resources", "search-resources", "list-resource-templates", "read-resource", "list-prompts", "search-prompts", "get-prompt", "complete", "config", "auth", "completion"];
35
+ export declare const topLevelCommandNames: readonly ["serve", "daemon", "code-mode", "attach", "remote", "cloud", "init", "setup", "doctor", "list", "install", "add", "inspect", "check-backend", "list-tools", "search-tools", "get-tool", "call-tool", "list-resources", "search-resources", "list-resource-templates", "read-resource", "list-prompts", "search-prompts", "get-prompt", "complete", "config", "auth", "completion"];
34
36
  export declare const cliSubcommands: {
35
37
  readonly add: readonly ["cli", "mcp", "openapi", "google-discovery", "graphql", "http"];
36
38
  readonly auth: readonly ["login", "logout", "list", "refresh"];
37
39
  readonly cloud: readonly ["auth"];
40
+ readonly remote: readonly ["login", "status", "logout", "host"];
38
41
  readonly "code-mode": readonly ["types"];
39
42
  readonly completion: readonly ["bash", "zsh", "fish", "powershell", "cmd"];
40
43
  readonly config: readonly ["path", "paths"];
41
- readonly serve: readonly ["start", "stop", "status", "restart", "enable", "disable"];
44
+ readonly daemon: readonly ["install", "uninstall", "start", "restart", "stop", "status", "logs"];
42
45
  readonly setup: readonly ["codex", "claude-code", "opencode", "pi", "mcp-client"];
43
46
  };
47
+ export declare const cliNestedSubcommands: {
48
+ readonly remote: {
49
+ readonly host: readonly ["pair", "clients", "revoke"];
50
+ };
51
+ };
44
52
  export declare const capletIdCommands: Set<string>;
45
53
  export declare const qualifiedToolCommands: Set<string>;
46
54
  export declare const qualifiedPromptCommands: Set<string>;
@@ -1,11 +1,14 @@
1
1
  import { CloudAuthStore } from "../cloud-auth/store";
2
2
  import type { MutagenProjectSyncDoctorData } from "../project-binding/mutagen";
3
+ import { type DaemonOperationOptions } from "../daemon";
3
4
  export type DoctorOptions = {
4
5
  env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
5
6
  cwd?: string;
6
7
  syncStatus?: MutagenProjectSyncDoctorData;
7
8
  cloudAuthStore?: CloudAuthStore;
9
+ authDir?: string;
8
10
  observedOutputShapeCacheDir?: string;
11
+ daemon?: DaemonOperationOptions;
9
12
  };
10
13
  export type DoctorJsonReport = {
11
14
  server: Record<string, unknown>;
@@ -13,7 +16,7 @@ export type DoctorJsonReport = {
13
16
  projectBinding: Record<string, unknown>;
14
17
  sync: Record<string, unknown>;
15
18
  daemon: Record<string, unknown>;
16
- cloudAuth: Record<string, unknown>;
19
+ remoteLogin: Record<string, unknown>;
17
20
  exposure: Record<string, unknown>;
18
21
  codeMode: Record<string, unknown>;
19
22
  };
package/dist/cli.d.ts CHANGED
@@ -2,7 +2,8 @@ import { Command } from "commander";
2
2
  import { type SetupCommandRunner } from "./cli/setup";
3
3
  import { type AttachServeOptions } from "./attach/options";
4
4
  import type { ProjectBindingWebSocketFactory } from "./project-binding/transport";
5
- import { type ServeDaemonOperationOptions, type ServeOptions } from "./serve";
5
+ import { type DaemonOperationOptions } from "./daemon";
6
+ import { type ServeOptions } from "./serve";
6
7
  export { initConfig, starterConfig } from "./cli/init";
7
8
  export { installCaplets, normalizeGitRepo } from "./cli/install";
8
9
  export { addCliCaplet, addGoogleDiscoveryCaplet, addGraphqlCaplet, addHttpCaplet, addMcpCaplet, addOpenApiCaplet, } from "./cli/add";
@@ -18,7 +19,7 @@ type CliIO = {
18
19
  setExitCode?: (code: number) => void;
19
20
  serve?: (options: ServeOptions) => Promise<void>;
20
21
  attachServe?: (options: AttachServeOptions) => Promise<void>;
21
- daemon?: ServeDaemonOperationOptions;
22
+ daemon?: DaemonOperationOptions;
22
23
  runSetupCommand?: SetupCommandRunner;
23
24
  readStdin?: () => Promise<string>;
24
25
  };
@@ -1,4 +1,4 @@
1
- import { Dt as resolveConfigPath, Et as resolveCapletsRoot, Tn as __exportAll, bt as DEFAULT_AUTH_DIR, kt as resolveProjectConfigPath, tt as loadConfigWithSources, xt as DEFAULT_COMPLETION_CACHE_DIR } from "./service-Cvnuu9wr.js";
1
+ import { Dt as DEFAULT_AUTH_DIR, Ft as resolveConfigPath, Lt as resolveProjectConfigPath, Nn as __exportAll, Ot as DEFAULT_COMPLETION_CACHE_DIR, Pt as resolveCapletsRoot, ct as loadConfigWithSources } from "./service-DjwB8aiW.js";
2
2
  import { u as CapletsError } from "./validation-DgxCzt-A.js";
3
3
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
4
4
  import { dirname, join } from "node:path";
@@ -15,8 +15,10 @@ const cliCommands = {
15
15
  completion: "completion",
16
16
  completeHidden: "__complete",
17
17
  codeMode: "code-mode",
18
+ daemon: "daemon",
18
19
  serve: "serve",
19
20
  attach: "attach",
21
+ remote: "remote",
20
22
  cloud: "cloud",
21
23
  init: "init",
22
24
  setup: "setup",
@@ -43,8 +45,10 @@ const cliCommands = {
43
45
  };
44
46
  const topLevelCommandNames = [
45
47
  cliCommands.serve,
48
+ cliCommands.daemon,
46
49
  cliCommands.codeMode,
47
50
  cliCommands.attach,
51
+ cliCommands.remote,
48
52
  cliCommands.cloud,
49
53
  cliCommands.init,
50
54
  cliCommands.setup,
@@ -86,16 +90,23 @@ const cliSubcommands = {
86
90
  "refresh"
87
91
  ],
88
92
  [cliCommands.cloud]: ["auth"],
93
+ [cliCommands.remote]: [
94
+ "login",
95
+ "status",
96
+ "logout",
97
+ "host"
98
+ ],
89
99
  [cliCommands.codeMode]: ["types"],
90
100
  [cliCommands.completion]: [...completionShells],
91
101
  [cliCommands.config]: ["path", "paths"],
92
- [cliCommands.serve]: [
102
+ [cliCommands.daemon]: [
103
+ "install",
104
+ "uninstall",
93
105
  "start",
106
+ "restart",
94
107
  "stop",
95
108
  "status",
96
- "restart",
97
- "enable",
98
- "disable"
109
+ "logs"
99
110
  ],
100
111
  [cliCommands.setup]: [
101
112
  "codex",
@@ -105,6 +116,11 @@ const cliSubcommands = {
105
116
  "mcp-client"
106
117
  ]
107
118
  };
119
+ const cliNestedSubcommands = { [cliCommands.remote]: { host: [
120
+ "pair",
121
+ "clients",
122
+ "revoke"
123
+ ] } };
108
124
  const capletIdCommands = new Set([
109
125
  cliCommands.inspect,
110
126
  cliCommands.checkBackend,
@@ -511,6 +527,8 @@ async function completeCliWords(words, options = {}) {
511
527
  if (optionValues) return prefixFilter(optionValues, current);
512
528
  if (normalized.length === 1) return prefixFilter([...topLevelCommandNames], current);
513
529
  if (normalized.length === 2 && command in cliSubcommands) return prefixFilter(cliSubcommands[command], current);
530
+ const nestedStaticSubcommands = nestedSubcommandsFor(command, subcommand);
531
+ if (normalized.length === 3 && nestedStaticSubcommands) return prefixFilter(nestedStaticSubcommands, current);
514
532
  if (normalized.length === 2 && capletIdCommands.has(command)) return prefixFilter(promptResourceCommands.has(command) ? configuredCapletIds(options, { backend: "mcp" }) : configuredCapletIds(options), current);
515
533
  if (qualifiedToolCommands.has(command) || qualifiedPromptCommands.has(command)) {
516
534
  const kind = qualifiedToolCommands.has(command) ? "tools" : "prompts";
@@ -535,6 +553,10 @@ function suggestionsForOptionValue(command, subcommand, previous) {
535
553
  if (!previous) return void 0;
536
554
  return optionValueSuggestions[`${command}:${subcommand}`]?.[previous] ?? optionValueSuggestions[command]?.[previous] ?? optionValueSuggestions["*"]?.[previous];
537
555
  }
556
+ function nestedSubcommandsFor(command, subcommand) {
557
+ if (command !== cliCommands.remote || subcommand !== "host") return void 0;
558
+ return cliNestedSubcommands.remote.host;
559
+ }
538
560
  const promptResourceCommands = new Set([
539
561
  cliCommands.getPrompt,
540
562
  cliCommands.readResource,
@@ -0,0 +1,8 @@
1
+ import type { DaemonConfig, DaemonEnvConfig, DaemonInstallOptions, DaemonPaths, DaemonState } from "./types";
2
+ export declare function readDaemonConfig(paths: DaemonPaths): DaemonConfig | undefined;
3
+ export declare function writeDaemonConfig(paths: DaemonPaths, config: DaemonConfig): DaemonConfig;
4
+ export declare function readDaemonState(paths: DaemonPaths): DaemonState | undefined;
5
+ export declare function writeDaemonState(paths: DaemonPaths, state: DaemonState): DaemonState;
6
+ export declare function removeDaemonConfig(paths: DaemonPaths): void;
7
+ export declare function removeDaemonState(paths: DaemonPaths): void;
8
+ export declare function mergeDaemonEnv(existing: DaemonEnvConfig | undefined, install: Pick<DaemonInstallOptions, "env" | "unsetEnv" | "inheritEnv">): DaemonEnvConfig;
@@ -0,0 +1,2 @@
1
+ import type { DaemonOperationOptions, DaemonShellPlan } from "./types";
2
+ export declare function resolveDaemonShell(options: Pick<DaemonOperationOptions, "env" | "platform" | "accountShell">): DaemonShellPlan;
@@ -0,0 +1,18 @@
1
+ import type { DaemonInstallOptions, DaemonInstallResult, DaemonLifecycleResult, DaemonLogStream, DaemonLogsResult, DaemonOperationOptions, DaemonStatus, DaemonUninstallOptions, DaemonUninstallResult } from "./types";
2
+ export declare function installDaemon(install?: DaemonInstallOptions, options?: DaemonOperationOptions): Promise<DaemonInstallResult>;
3
+ export declare function uninstallDaemon(uninstall?: DaemonUninstallOptions, options?: DaemonOperationOptions): Promise<DaemonUninstallResult>;
4
+ export declare function startDaemon(options?: DaemonOperationOptions): Promise<DaemonLifecycleResult>;
5
+ export declare function restartDaemon(options?: DaemonOperationOptions): Promise<DaemonLifecycleResult>;
6
+ export declare function stopDaemon(options?: DaemonOperationOptions): Promise<DaemonLifecycleResult>;
7
+ export declare function daemonStatus(options?: DaemonOperationOptions): Promise<DaemonStatus>;
8
+ export declare function redactDaemonInstallResult(result: DaemonInstallResult): DaemonInstallResult;
9
+ export declare function daemonLogs(options?: DaemonOperationOptions & {
10
+ stream?: DaemonLogStream;
11
+ tail?: number;
12
+ }): DaemonLogsResult;
13
+ export { resolveDaemonPaths } from "./paths";
14
+ export { resolveDaemonHttpServeOptions, daemonServeArgs } from "./process";
15
+ export { readDaemonConfig, readDaemonState } from "./config";
16
+ export { createNativeDaemonManager } from "./manager";
17
+ export { followDaemonLogs } from "./logs";
18
+ export type { DaemonCommandPlan, DaemonCommandRunner, DaemonConfig, DaemonDescriptor, DaemonInstallOptions, DaemonLogEntry, DaemonLogStream, DaemonLogsResult, DaemonManager, DaemonOperationOptions, DaemonPaths, DaemonStatus, NativeDaemonStatus, RawDaemonServeOptions, } from "./types";
@@ -0,0 +1,15 @@
1
+ import type { DaemonLogEntry, DaemonLogStream, DaemonLogsResult, DaemonPaths } from "./types";
2
+ export declare function readDaemonLogs(paths: DaemonPaths, options?: {
3
+ stream?: DaemonLogStream;
4
+ tail?: number;
5
+ }): DaemonLogsResult;
6
+ export declare function followDaemonLogs(paths: DaemonPaths, options: {
7
+ stream?: DaemonLogStream;
8
+ tail?: number;
9
+ write: (entry: DaemonLogEntry | {
10
+ type: "metadata";
11
+ paths: Pick<DaemonPaths, "stdoutLog" | "stderrLog">;
12
+ }) => void;
13
+ signal?: AbortSignal;
14
+ }): Promise<void>;
15
+ export declare function ensureDaemonLogFiles(paths: DaemonPaths): void;
@@ -0,0 +1,2 @@
1
+ import type { DaemonManager, DaemonOperationOptions } from "./types";
2
+ export declare function createNativeDaemonManager(options?: DaemonOperationOptions): DaemonManager;
@@ -0,0 +1,2 @@
1
+ import type { DaemonOperationOptions, DaemonPaths } from "./types";
2
+ export declare function resolveDaemonPaths(options?: Pick<DaemonOperationOptions, "env" | "home" | "platform">): DaemonPaths;
@@ -0,0 +1,3 @@
1
+ import type { DaemonConfig, DaemonDescriptor } from "./types";
2
+ export declare const LAUNCHD_LABEL = "dev.caplets.daemon.default";
3
+ export declare function buildLaunchdDescriptor(config: DaemonConfig): DaemonDescriptor;
@@ -0,0 +1,3 @@
1
+ import type { DaemonConfig, DaemonDescriptor } from "./types";
2
+ export declare const SYSTEMD_UNIT = "caplets-daemon-default.service";
3
+ export declare function buildSystemdDescriptor(config: DaemonConfig): DaemonDescriptor;
@@ -0,0 +1,3 @@
1
+ import type { DaemonConfig, DaemonDescriptor } from "./types";
2
+ export declare const WINDOWS_TASK_NAME = "\\Caplets\\daemon-default";
3
+ export declare function buildWindowsTaskDescriptor(config: DaemonConfig): DaemonDescriptor;
@@ -0,0 +1,11 @@
1
+ import { type HttpServeOptions } from "../serve/options";
2
+ import type { DaemonCommandPlan, DaemonOperationOptions, DaemonPaths, RawDaemonServeOptions } from "./types";
3
+ export declare function resolveDaemonHttpServeOptions(raw: RawDaemonServeOptions, env?: NodeJS.ProcessEnv | Record<string, string | undefined>): HttpServeOptions;
4
+ export declare function daemonServeArgs(options: HttpServeOptions): string[];
5
+ export declare function buildDaemonCommandPlan(options: {
6
+ serve: HttpServeOptions;
7
+ paths: DaemonPaths;
8
+ operation: Pick<DaemonOperationOptions, "env" | "home" | "platform" | "accountShell">;
9
+ explicitEnv?: Record<string, string>;
10
+ inheritEnv?: boolean;
11
+ }): DaemonCommandPlan;
@@ -0,0 +1,20 @@
1
+ export declare function shellQuote(value: string): string;
2
+ export declare function serviceCommand(config: {
3
+ command: {
4
+ executable: string;
5
+ args: string[];
6
+ env?: Record<string, string>;
7
+ shell?: {
8
+ executable: string;
9
+ args: string[];
10
+ };
11
+ };
12
+ }): {
13
+ executable: string;
14
+ args: string[];
15
+ display: string;
16
+ };
17
+ export declare function shellCommandLine(shell: {
18
+ executable: string;
19
+ args: string[];
20
+ }, argv: string[], env?: Record<string, string>): string;
@@ -0,0 +1,178 @@
1
+ import type { HttpServeOptions, RawServeOptions } from "../serve/options";
2
+ export type DaemonInstance = "default";
3
+ export type RawDaemonServeOptions = Omit<RawServeOptions, "transport"> & {
4
+ preserveUnauthenticatedAuth?: boolean;
5
+ };
6
+ export type DaemonPaths = {
7
+ instance: DaemonInstance;
8
+ stateDir: string;
9
+ logDir: string;
10
+ stateFile: string;
11
+ stdoutLog: string;
12
+ stderrLog: string;
13
+ configFile: string;
14
+ descriptorFile: string;
15
+ wrapperFile: string;
16
+ };
17
+ export type DaemonEnvConfig = {
18
+ inherit: boolean;
19
+ values: Record<string, string>;
20
+ };
21
+ export type DaemonShellPlan = {
22
+ executable: string;
23
+ args: string[];
24
+ source: "SHELL" | "account" | "fallback";
25
+ };
26
+ export type DaemonCommandPlan = {
27
+ executable: string;
28
+ args: string[];
29
+ workingDirectory: string;
30
+ env: Record<string, string>;
31
+ inheritEnv: boolean;
32
+ stdoutLog: string;
33
+ stderrLog: string;
34
+ shell?: DaemonShellPlan;
35
+ };
36
+ export type DaemonConfig = {
37
+ instance: DaemonInstance;
38
+ serve: HttpServeOptions;
39
+ command: DaemonCommandPlan;
40
+ env: DaemonEnvConfig;
41
+ paths: DaemonPaths;
42
+ updatedAt: string;
43
+ };
44
+ export type DaemonState = {
45
+ instance: DaemonInstance;
46
+ installed: boolean;
47
+ running: boolean;
48
+ nativeState: NativeDaemonStateName;
49
+ updatedAt: string;
50
+ startedAt?: string;
51
+ pid?: number;
52
+ };
53
+ export type NativeDaemonStateName = "not_installed" | "installed_stopped" | "running" | "failed" | "unavailable" | "unknown";
54
+ export type NativeDaemonStatus = {
55
+ state: NativeDaemonStateName;
56
+ installed: boolean;
57
+ running: boolean;
58
+ pid?: number;
59
+ raw?: Record<string, unknown>;
60
+ message?: string;
61
+ };
62
+ export type DaemonStatus = {
63
+ instance: DaemonInstance;
64
+ installed: boolean;
65
+ running: boolean;
66
+ nativeState: NativeDaemonStateName;
67
+ paths: DaemonPaths;
68
+ config?: DaemonConfig;
69
+ native: NativeDaemonStatus;
70
+ health?: DaemonHealthResult;
71
+ };
72
+ export type DaemonHealthResult = {
73
+ ok: boolean;
74
+ url: string;
75
+ status?: number;
76
+ error?: string;
77
+ };
78
+ export type DaemonDescriptor = {
79
+ kind: "launchd-user-agent";
80
+ label: string;
81
+ path: string;
82
+ contents: string;
83
+ } | {
84
+ kind: "systemd-user";
85
+ unitName: string;
86
+ path: string;
87
+ contents: string;
88
+ } | {
89
+ kind: "windows-scheduled-task";
90
+ taskName: string;
91
+ path: string;
92
+ command: string;
93
+ xml: string;
94
+ wrapper: {
95
+ path: string;
96
+ contents: string;
97
+ };
98
+ };
99
+ export type DaemonManager = {
100
+ descriptor(config: DaemonConfig): DaemonDescriptor;
101
+ status(config: DaemonConfig | undefined, paths: DaemonPaths): Promise<NativeDaemonStatus>;
102
+ install(config: DaemonConfig): Promise<DaemonManagerAction>;
103
+ uninstall(config: DaemonConfig | undefined, paths: DaemonPaths): Promise<DaemonManagerAction>;
104
+ start(config: DaemonConfig): Promise<DaemonManagerAction>;
105
+ restart(config: DaemonConfig): Promise<DaemonManagerAction>;
106
+ stop(config?: DaemonConfig): Promise<DaemonManagerAction>;
107
+ };
108
+ export type DaemonManagerAction = {
109
+ action: string;
110
+ native: NativeDaemonStatus;
111
+ commands?: string[][];
112
+ descriptor?: DaemonDescriptor;
113
+ };
114
+ export type DaemonCommandRunner = {
115
+ exec(command: string, args: string[]): Promise<{
116
+ stdout: string;
117
+ stderr: string;
118
+ code: number;
119
+ }>;
120
+ };
121
+ export type DaemonOperationOptions = {
122
+ env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
123
+ home?: string;
124
+ platform?: NodeJS.Platform;
125
+ manager?: DaemonManager;
126
+ commandRunner?: DaemonCommandRunner;
127
+ fetch?: typeof fetch;
128
+ validateCommand?: (config: DaemonConfig) => Promise<DaemonHealthResult>;
129
+ accountShell?: string;
130
+ serviceAvailable?: boolean;
131
+ uid?: number;
132
+ now?: Date;
133
+ readPrompt?: (prompt: string) => Promise<string>;
134
+ isInteractive?: boolean;
135
+ healthTimeoutMs?: number;
136
+ healthIntervalMs?: number;
137
+ };
138
+ export type DaemonInstallOptions = RawDaemonServeOptions & {
139
+ reset?: boolean;
140
+ env?: string[];
141
+ unsetEnv?: string[];
142
+ inheritEnv?: boolean;
143
+ dryRun?: boolean;
144
+ validate?: boolean;
145
+ start?: boolean;
146
+ restart?: boolean;
147
+ noRestart?: boolean;
148
+ };
149
+ export type DaemonUninstallOptions = {
150
+ purge?: boolean;
151
+ dryRun?: boolean;
152
+ };
153
+ export type DaemonLifecycleResult = {
154
+ action: string;
155
+ status: DaemonStatus;
156
+ native?: DaemonManagerAction;
157
+ };
158
+ export type DaemonInstallResult = DaemonLifecycleResult & {
159
+ config: DaemonConfig;
160
+ descriptor: DaemonDescriptor;
161
+ validation?: DaemonHealthResult;
162
+ dryRun: boolean;
163
+ plannedActions: string[];
164
+ };
165
+ export type DaemonUninstallResult = DaemonLifecycleResult & {
166
+ purge: boolean;
167
+ dryRun: boolean;
168
+ removed: string[];
169
+ };
170
+ export type DaemonLogStream = "stdout" | "stderr" | "all";
171
+ export type DaemonLogEntry = {
172
+ stream: "stdout" | "stderr";
173
+ line: string;
174
+ };
175
+ export type DaemonLogsResult = {
176
+ paths: Pick<DaemonPaths, "stdoutLog" | "stderrLog">;
177
+ entries: DaemonLogEntry[];
178
+ };
@@ -0,0 +1,13 @@
1
+ import type { DaemonConfig, DaemonHealthResult } from "./types";
2
+ export declare function validateDaemonCommand(config: DaemonConfig, options?: {
3
+ fetch?: typeof fetch;
4
+ successSettleMs?: number;
5
+ timeoutMs?: number;
6
+ }): Promise<DaemonHealthResult>;
7
+ export declare function probeDaemonHealth(config: DaemonConfig, options?: {
8
+ fetch?: typeof fetch;
9
+ port?: number;
10
+ timeoutMs?: number;
11
+ }): Promise<DaemonHealthResult>;
12
+ export declare function assertDaemonHealth(result: DaemonHealthResult, label: string): void;
13
+ export declare function allocateLoopbackPort(): Promise<number>;
@@ -0,0 +1 @@
1
+ export declare function escapeXml(value: string): string;