@intentic/local-agent 1.176.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Artur Kurowski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @intentic/local-agent
2
+
3
+ The plumbing every intentic CLI that lives on a **user's own computer** needs, and none of what any of them does.
4
+
5
+ ```
6
+ ~/.intentic/<name>/ agentHome(name) — state dir + config.json
7
+ config.json writeSecretFile() — 0700 dir, 0600 file
8
+ <agent>.log spawnDetached() — the loop's output has nowhere else to go
9
+ <agent>.pid livePid() — find the loop again from another process
10
+
11
+ HKCU\…\Run registerAutostart() — Windows, per-user, no elevation
12
+ ~/Library/LaunchAgents/ registerAutostart() — macOS, opt-in per agent
13
+ ~/.config/autostart/ registerAutostart() — Linux desktop session
14
+ ```
15
+
16
+ ## Why it exists
17
+
18
+ Three agents ship to a user's machine and have nothing in common except how they are **installed** and how they
19
+ **stay alive**:
20
+
21
+ | | what it does | uses |
22
+ | --- | --- | --- |
23
+ | [`@intentic/host`](../../_computers/host) | lets the sandbox's agent work on this computer | home, launcher, autostart, detached |
24
+ | [`@intentic/sync`](../../_sandbox/sync) | mirrors files and ports between machine and sandbox | home, launcher, autostart, detached |
25
+ | [`@intentic/acp-bridge`](../../_sandbox/acp-bridge) | lets an editor talk to the sandbox | home |
26
+
27
+ They were written months apart, and each copy of that plumbing was made from the last one — a shape with a known
28
+ ending. The second copy is a snapshot of the first on the day it was taken, and every fix after that lands in
29
+ only one of them. It already had:
30
+
31
+ - **sync wrote its token file world-readable.** Its config module was copied from host's *before* the 0600 floor
32
+ was added there, and nothing afterwards compared the two.
33
+ - **host has no macOS autostart.** It was copied from a sync that did not have one yet, and on macOS it wrote an
34
+ XDG entry that nothing reads.
35
+ - **The Windows console rule, the compiled-binary argv rule and "report what the tool actually said"** were each
36
+ written out at length in two files, in prose, cross-referencing the other agent by name — including in
37
+ ARCHITECTURE.md, which said host's spawns behave "for the reason `@intentic/sync` documents".
38
+
39
+ This package is those lessons as code, so the fourth agent inherits them by importing rather than by reading.
40
+
41
+ ## The four pieces
42
+
43
+ **`home.ts`** — `agentHome(name)` gives `{ dir, configPath }` under `~/.intentic/<name>`; `writeSecretFile`
44
+ writes through a 0700 directory to a 0600 file. Both modes are re-applied on every write, because `mkdir` does
45
+ not tighten a directory that already exists — an agent installed before this floor existed would otherwise keep
46
+ its old permissions forever.
47
+
48
+ **`launcher.ts`** — `cliLauncher(cliName)` answers how to re-invoke this CLI. The subtlety is the compiled
49
+ binary: `bun build --compile` reports an `argv[1]` inside its own virtual filesystem and re-injects it on every
50
+ launch, so passing it again shifts the command to `argv[2]` where the parser never looks.
51
+
52
+ **`autostart.ts`** — `registerAutostart(spec, launcher, log)` against an `AutostartSpec` the agent declares.
53
+ Windows gets the **detached** command (Explorer starts a Run entry in the interactive session, where the
54
+ foreground loop would park a black console window on the desktop from login until shutdown); launchd and the
55
+ desktop session, which supervise what they start, get the **foreground** one. `launchAgent` is optional — an
56
+ agent that has not been exercised on macOS says so and gets a note, rather than a file macOS never reads.
57
+
58
+ **`detached.ts`** — `spawnDetached`, `livePid`, `isProcessAlive`. The loop is spawned `detached` on **every**
59
+ platform: on POSIX for its own session, on Windows because without it the loop is torn down the moment its
60
+ parent exits — measured on the compiled binary, and the reason "connected in the background (pid N)" was a lie
61
+ there for every release that passed `windowsHide` instead. The two cannot be combined to get both properties
62
+ (`CREATE_NO_WINDOW` is ignored alongside `DETACHED_PROCESS`), so a detached loop on Windows has no console at
63
+ all, and Windows hands a console child of a console-less process a new console *with a window*. That is why
64
+ every spawn inside a loop — git and ssh in sync's bridge, docker and PowerShell in host's tools — passes
65
+ `windowsHide` itself; the flag applies whether or not the parent has a console, where inheritance did not.
66
+
67
+ `spawnDetached` also answers only once the loop has **survived** a short settle window, and throws naming its log
68
+ otherwise. A pid proves the OS created a process; every caller turns it straight into a sentence promising the
69
+ user their machine is now doing something.
70
+
71
+ ## What this package is not
72
+
73
+ It knows nothing about sandboxes, tunnels, enrollment or MCP. It takes a name, a launcher and a spec, and makes a
74
+ CLI survive a reboot with its credentials readable only by its owner. *What* the agent then does is the agent's
75
+ business — which is why host's scopes and sync's Mutagen sessions are nowhere near here.
76
+
77
+ ## Key files
78
+
79
+ - [src/index.ts](src/index.ts) — the public surface.
80
+ - [src/home.ts](src/home.ts) — the `~/.intentic/<agent>` directory and its 0600 floor.
81
+ - [src/autostart.ts](src/autostart.ts) — login autostart, per platform.
82
+ - [src/detached.ts](src/detached.ts) — the background loop, and surviving a closed terminal.
83
+ - [src/launcher.ts](src/launcher.ts) — `cliLauncher()`, including the compiled-binary argv case.
@@ -0,0 +1,25 @@
1
+ import { type CliLauncher } from "./launcher.js";
2
+ import type { Log } from "./home.js";
3
+ export interface LaunchAgentSpec {
4
+ readonly label: string;
5
+ readonly logPath: string;
6
+ }
7
+ export interface AutostartSpec {
8
+ readonly id: string;
9
+ readonly windowsRunValue: string;
10
+ readonly desktopName: string;
11
+ readonly desktopComment: string;
12
+ readonly launchAgent?: LaunchAgentSpec;
13
+ readonly detachedArgs: readonly string[];
14
+ readonly foregroundArgs: readonly string[];
15
+ readonly failureNote: (reason: string) => string;
16
+ }
17
+ export declare const windowsRunAddArgs: (spec: AutostartSpec, launcher: CliLauncher) => string[];
18
+ export declare const windowsRunDeleteArgs: (spec: AutostartSpec) => string[];
19
+ export declare const systemdUserAvailable: () => boolean;
20
+ export declare const systemdUserUnit: (spec: AutostartSpec, launcher: CliLauncher) => string;
21
+ export declare const linuxDesktopEntry: (spec: AutostartSpec, launcher: CliLauncher) => string;
22
+ export declare const macLaunchAgentXml: (spec: AutostartSpec, agent: LaunchAgentSpec, launcher: CliLauncher) => string;
23
+ export declare const registerAutostart: (spec: AutostartSpec, launcher: CliLauncher, log: Log) => Promise<boolean>;
24
+ export declare const unregisterAutostart: (spec: AutostartSpec, log: Log) => Promise<void>;
25
+ //# sourceMappingURL=autostart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autostart.d.ts","sourceRoot":"","sources":["../src/autostart.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,eAAe,CAAC;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AA6BrC,MAAM,WAAW,eAAe;IAE5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAGvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAG1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAGpB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAEhC,QAAQ,CAAC,WAAW,CAAC,EAAE,eAAe,CAAC;IAUvC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAE3C,QAAQ,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACpD;AAiCD,eAAO,MAAM,iBAAiB,SAAU,aAAa,YAAY,WAAW,KAAG,MAAM,EAUpF,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,aAAa,KAAG,MAAM,EAAmE,CAAC;AAWrI,eAAO,MAAM,oBAAoB,QAAO,OAOvC,CAAC;AASF,eAAO,MAAM,eAAe,SAAU,aAAa,YAAY,WAAW,KAAG,MAc5E,CAAC;AAsBF,eAAO,MAAM,iBAAiB,SAAU,aAAa,YAAY,WAAW,KAAG,MAO9E,CAAC;AAIF,eAAO,MAAM,iBAAiB,SAAU,aAAa,SAAS,eAAe,YAAY,WAAW,KAAG,MAetG,CAAC;AA2CF,eAAO,MAAM,iBAAiB,SAAgB,aAAa,YAAY,WAAW,OAAO,GAAG,KAAG,OAAO,CAAC,OAAO,CAuB7G,CAAC;AAGF,eAAO,MAAM,mBAAmB,SAAgB,aAAa,OAAO,GAAG,KAAG,OAAO,CAAC,IAAI,CA8BrF,CAAC"}
@@ -0,0 +1,163 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { mkdir, rm, writeFile } from "node:fs/promises";
3
+ import { homedir } from "node:os";
4
+ import { basename, dirname, join } from "node:path";
5
+ import { quotedCommandLine } from "./launcher.js";
6
+ const WINDOWS_RUN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
7
+ const linuxDesktopPath = (spec) => join(homedir(), ".config", "autostart", `${spec.id}.desktop`);
8
+ const macPlistPath = (agent) => join(homedir(), "Library", "LaunchAgents", `${agent.label}.plist`);
9
+ const systemdUnitName = (spec) => `${spec.id}.service`;
10
+ const systemdUnitPath = (spec) => join(homedir(), ".config", "systemd", "user", systemdUnitName(spec));
11
+ const regExe = () => join(process.env["SystemRoot"] ?? "C:\\Windows", "System32", "reg.exe");
12
+ const reason = (error) => (error instanceof Error ? error.message : String(error));
13
+ const register = (command, args) => {
14
+ const result = spawnSync(command, args, { encoding: "utf8" });
15
+ if (result.error !== undefined) {
16
+ throw result.error;
17
+ }
18
+ if (result.status !== 0) {
19
+ const said = `${result.stdout}${result.stderr}`.trim();
20
+ throw new Error(said === "" ? `${basename(command)} exited ${result.status}` : said);
21
+ }
22
+ };
23
+ export const windowsRunAddArgs = (spec, launcher) => [
24
+ "add",
25
+ WINDOWS_RUN_KEY,
26
+ "/v",
27
+ spec.windowsRunValue,
28
+ "/t",
29
+ "REG_SZ",
30
+ "/d",
31
+ quotedCommandLine([...launcher, ...spec.detachedArgs]),
32
+ "/f",
33
+ ];
34
+ export const windowsRunDeleteArgs = (spec) => ["delete", WINDOWS_RUN_KEY, "/v", spec.windowsRunValue, "/f"];
35
+ const SYSTEMD_LIVE_STATES = new Set(["running", "degraded", "starting", "maintenance", "stopping", "initializing"]);
36
+ export const systemdUserAvailable = () => {
37
+ const result = spawnSync("systemctl", ["--user", "is-system-running"], { encoding: "utf8" });
38
+ if (result.error !== undefined) {
39
+ return false;
40
+ }
41
+ return SYSTEMD_LIVE_STATES.has(result.stdout.trim());
42
+ };
43
+ export const systemdUserUnit = (spec, launcher) => `[Unit]
44
+ Description=${spec.desktopName} — ${spec.desktopComment}
45
+ After=network-online.target
46
+
47
+ [Service]
48
+ Type=simple
49
+ ExecStart=${quotedCommandLine([...launcher, ...spec.foregroundArgs])}
50
+ Restart=on-failure
51
+ RestartSec=5
52
+ Environment=PATH=${join(homedir(), ".local", "bin")}:/usr/local/bin:/usr/bin:/bin
53
+
54
+ [Install]
55
+ WantedBy=default.target
56
+ `;
57
+ const registerSystemdUser = async (spec, launcher, log) => {
58
+ const unit = systemdUnitPath(spec);
59
+ await mkdir(dirname(unit), { recursive: true });
60
+ await writeFile(unit, systemdUserUnit(spec, launcher), { mode: 0o644 });
61
+ spawnSync("loginctl", ["enable-linger"], { stdio: "ignore" });
62
+ spawnSync("systemctl", ["--user", "daemon-reload"], { stdio: "ignore" });
63
+ register("systemctl", ["--user", "enable", "--now", systemdUnitName(spec)]);
64
+ log(`registered ${systemdUnitName(spec)} to run now and at boot. Follow it with: journalctl --user -u ${spec.id} -f`);
65
+ return true;
66
+ };
67
+ export const linuxDesktopEntry = (spec, launcher) => `[Desktop Entry]
68
+ Type=Application
69
+ Name=${spec.desktopName}
70
+ Comment=${spec.desktopComment}
71
+ Exec=${quotedCommandLine([...launcher, ...spec.foregroundArgs])}
72
+ X-GNOME-Autostart-enabled=true
73
+ `;
74
+ export const macLaunchAgentXml = (spec, agent, launcher) => `<?xml version="1.0" encoding="UTF-8"?>
75
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
76
+ <plist version="1.0">
77
+ <dict>
78
+ <key>Label</key><string>${agent.label}</string>
79
+ <key>ProgramArguments</key>
80
+ <array>
81
+ ${[...launcher, ...spec.foregroundArgs].map((arg) => ` <string>${arg}</string>`).join("\n")}
82
+ </array>
83
+ <key>RunAtLoad</key><true/>
84
+ <key>StandardOutPath</key><string>${agent.logPath}</string>
85
+ <key>StandardErrorPath</key><string>${agent.logPath}</string>
86
+ </dict>
87
+ </plist>
88
+ `;
89
+ const registerMac = async (spec, agent, launcher) => {
90
+ const plist = macPlistPath(agent);
91
+ await mkdir(dirname(plist), { recursive: true });
92
+ await writeFile(plist, macLaunchAgentXml(spec, agent, launcher), { mode: 0o644 });
93
+ const uid = process.getuid?.() ?? 0;
94
+ spawnSync("launchctl", ["bootout", `gui/${uid}/${agent.label}`], { stdio: "ignore" });
95
+ if (spawnSync("launchctl", ["bootstrap", `gui/${uid}`, plist], { stdio: "ignore" }).status === 0) {
96
+ return true;
97
+ }
98
+ register("launchctl", ["load", "-w", plist]);
99
+ return true;
100
+ };
101
+ const registerLinux = async (spec, launcher, log) => {
102
+ if (systemdUserAvailable()) {
103
+ await rm(linuxDesktopPath(spec), { force: true });
104
+ return await registerSystemdUser(spec, launcher, log);
105
+ }
106
+ const file = linuxDesktopPath(spec);
107
+ await mkdir(dirname(file), { recursive: true });
108
+ await writeFile(file, linuxDesktopEntry(spec, launcher), { mode: 0o644 });
109
+ if (process.env["XDG_CURRENT_DESKTOP"] === undefined) {
110
+ log(`note: this machine has neither a systemd user manager nor a desktop session, so nothing will start ${spec.id} at boot. It runs until this machine restarts.`);
111
+ }
112
+ return false;
113
+ };
114
+ export const registerAutostart = async (spec, launcher, log) => {
115
+ try {
116
+ if (process.platform === "darwin") {
117
+ if (spec.launchAgent === undefined) {
118
+ log(`note: ${spec.id} has no macOS login autostart yet; it runs until this machine restarts.`);
119
+ return false;
120
+ }
121
+ return await registerMac(spec, spec.launchAgent, launcher);
122
+ }
123
+ if (process.platform === "win32") {
124
+ register(regExe(), windowsRunAddArgs(spec, launcher));
125
+ return false;
126
+ }
127
+ if (process.platform === "linux") {
128
+ return await registerLinux(spec, launcher, log);
129
+ }
130
+ log(`note: ${spec.id} has no login autostart on ${process.platform}; it runs until this machine restarts.`);
131
+ }
132
+ catch (error) {
133
+ log(spec.failureNote(reason(error)));
134
+ }
135
+ return false;
136
+ };
137
+ export const unregisterAutostart = async (spec, log) => {
138
+ try {
139
+ if (process.platform === "darwin") {
140
+ if (spec.launchAgent === undefined) {
141
+ return;
142
+ }
143
+ const plist = macPlistPath(spec.launchAgent);
144
+ const uid = process.getuid?.() ?? 0;
145
+ spawnSync("launchctl", ["bootout", `gui/${uid}/${spec.launchAgent.label}`], { stdio: "ignore" });
146
+ spawnSync("launchctl", ["unload", plist], { stdio: "ignore" });
147
+ await rm(plist, { force: true });
148
+ return;
149
+ }
150
+ if (process.platform === "win32") {
151
+ spawnSync(regExe(), windowsRunDeleteArgs(spec), { stdio: "ignore" });
152
+ return;
153
+ }
154
+ spawnSync("systemctl", ["--user", "disable", "--now", systemdUnitName(spec)], { stdio: "ignore" });
155
+ await rm(systemdUnitPath(spec), { force: true });
156
+ spawnSync("systemctl", ["--user", "daemon-reload"], { stdio: "ignore" });
157
+ await rm(linuxDesktopPath(spec), { force: true });
158
+ }
159
+ catch (error) {
160
+ log(`note: couldn't remove the login-autostart entry for ${spec.id} (${reason(error)}).`);
161
+ }
162
+ };
163
+ //# sourceMappingURL=autostart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autostart.js","sourceRoot":"","sources":["../src/autostart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAoB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAiEpE,MAAM,eAAe,GAAG,yDAAyD,CAAC;AAElF,MAAM,gBAAgB,GAAG,CAAC,IAAmB,EAAU,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;AACxH,MAAM,YAAY,GAAG,CAAC,KAAsB,EAAU,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC,KAAK,QAAQ,CAAC,CAAC;AAE5H,MAAM,eAAe,GAAG,CAAC,IAAmB,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,UAAU,CAAC;AAC9E,MAAM,eAAe,GAAG,CAAC,IAAmB,EAAU,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,CAA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E,QAAQ,EAAE,CAAC,CAAC;QACnG,MAAM,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,SAAS,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QACzE,MAAM,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,GAAG,CAAC,uDAAuD,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9F,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { CliLauncher } from "./launcher.js";
2
+ export declare const isProcessAlive: (pid: number) => boolean;
3
+ export declare const livePid: (pidPath: string) => Promise<number | undefined>;
4
+ export declare const spawnDetached: (logPath: string, launcher: CliLauncher, args: readonly string[]) => Promise<number>;
5
+ //# sourceMappingURL=detached.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detached.d.ts","sourceRoot":"","sources":["../src/detached.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAYjD,eAAO,MAAM,cAAc,QAAS,MAAM,KAAG,OAO5C,CAAC;AAIF,eAAO,MAAM,OAAO,YAAmB,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAMzE,CAAC;AAwCF,eAAO,MAAM,aAAa,YAAmB,MAAM,YAAY,WAAW,QAAQ,SAAS,MAAM,EAAE,KAAG,OAAO,CAAC,MAAM,CAgBnH,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { spawn } from "node:child_process";
2
+ import { openSync } from "node:fs";
3
+ import { readFile } from "node:fs/promises";
4
+ import { setTimeout } from "node:timers/promises";
5
+ export const isProcessAlive = (pid) => {
6
+ try {
7
+ process.kill(pid, 0);
8
+ return true;
9
+ }
10
+ catch (error) {
11
+ return error.code === "EPERM";
12
+ }
13
+ };
14
+ export const livePid = async (pidPath) => {
15
+ const pid = Number((await readFile(pidPath, "utf8").catch(() => "")).trim());
16
+ if (!Number.isInteger(pid) || pid <= 0) {
17
+ return undefined;
18
+ }
19
+ return isProcessAlive(pid) ? pid : undefined;
20
+ };
21
+ const SETTLE_MS = 2_000;
22
+ const SETTLE_POLL_MS = 100;
23
+ export const spawnDetached = async (logPath, launcher, args) => {
24
+ const logFd = openSync(logPath, "a");
25
+ const [command, ...leading] = launcher;
26
+ const child = spawn(command, [...leading, ...args], { detached: true, stdio: ["ignore", logFd, logFd] });
27
+ child.unref();
28
+ const pid = child.pid;
29
+ if (pid === undefined) {
30
+ throw new Error(`could not start ${command} in the background. Details: ${logPath}`);
31
+ }
32
+ for (let waited = 0; waited < SETTLE_MS; waited += SETTLE_POLL_MS) {
33
+ await setTimeout(SETTLE_POLL_MS);
34
+ if (!isProcessAlive(pid)) {
35
+ throw new Error(`the background loop started and stopped immediately (pid ${pid}). Details: ${logPath}`);
36
+ }
37
+ }
38
+ return pid;
39
+ };
40
+ //# sourceMappingURL=detached.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detached.js","sourceRoot":"","sources":["../src/detached.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAalD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAW,EAAE;IACnD,IAAI,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IAChB,CA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,KAAK,CAAC,mBAAmB,OAAO,gCAAgC,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IACD,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,IAAI,cAAc,EAAE,CAAC;QAChE,MAAM,UAAU,CAAC,cAAc,CAAC,CAAC;QACjC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,4DAA4D,GAAG,eAAe,OAAO,EAAE,CAAC,CAAC;QAC7G,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC,CAAC"}
package/dist/home.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export type Log = (message: string) => void;
2
+ export interface AgentHome {
3
+ readonly dir: string;
4
+ readonly configPath: string;
5
+ }
6
+ export declare const agentHome: (name: string) => AgentHome;
7
+ export declare const writeSecretFile: (path: string, dir: string, contents: string) => Promise<void>;
8
+ //# sourceMappingURL=home.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../src/home.ts"],"names":[],"mappings":"AAoBA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAE5C,MAAM,WAAW,SAAS;IAEtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,SAGxC,CAAC;AAQF,eAAO,MAAM,eAAe,SAAgB,MAAM,OAAO,MAAM,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CAG/F,CAAC"}
package/dist/home.js ADDED
@@ -0,0 +1,12 @@
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+ export const agentHome = (name) => {
5
+ const dir = join(homedir(), ".intentic", name);
6
+ return { dir, configPath: join(dir, "config.json") };
7
+ };
8
+ export const writeSecretFile = async (path, dir, contents) => {
9
+ await mkdir(dir, { recursive: true, mode: 0o700 });
10
+ await writeFile(path, contents, { encoding: "utf8", mode: 0o600 });
11
+ };
12
+ //# sourceMappingURL=home.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"home.js","sourceRoot":"","sources":["../src/home.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA2BjC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAa,EAAE;IACjD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;IAC/C,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC;AACzD,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,IAAY,EAAE,GAAW,EAAE,QAAgB,EAAiB,EAAE;IAChG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,MAAM,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACvE,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { agentHome, writeSecretFile, type AgentHome, type Log } from "./home.js";
2
+ export { cliLauncher, quotedCommandLine, type CliLauncher } from "./launcher.js";
3
+ export { linuxDesktopEntry, macLaunchAgentXml, registerAutostart, unregisterAutostart, windowsRunAddArgs, windowsRunDeleteArgs, type AutostartSpec, type LaunchAgentSpec, } from "./autostart.js";
4
+ export { isProcessAlive, livePid, spawnDetached } from "./detached.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EACH,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { agentHome, writeSecretFile } from "./home.js";
2
+ export { cliLauncher, quotedCommandLine } from "./launcher.js";
3
+ export { linuxDesktopEntry, macLaunchAgentXml, registerAutostart, unregisterAutostart, windowsRunAddArgs, windowsRunDeleteArgs, } from "./autostart.js";
4
+ export { isProcessAlive, livePid, spawnDetached } from "./detached.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,eAAe,EAA4B,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAoB,MAAM,eAAe,CAAC;AACjF,OAAO,EACH,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,GAGvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type CliLauncher = readonly [string, ...string[]];
2
+ export declare const cliLauncher: (cliName: string) => CliLauncher;
3
+ export declare const quotedCommandLine: (argv: readonly string[]) => string;
4
+ //# sourceMappingURL=launcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAKzD,eAAO,MAAM,WAAW,YAAa,MAAM,KAAG,WAM7C,CAAC;AAKF,eAAO,MAAM,iBAAiB,SAAU,SAAS,MAAM,EAAE,KAAG,MAAiD,CAAC"}
@@ -0,0 +1,10 @@
1
+ const isBunVirtualEntry = (entry) => entry.includes("$bunfs") || entry.includes("~BUN");
2
+ export const cliLauncher = (cliName) => {
3
+ const entry = process.argv[1];
4
+ if (entry === undefined) {
5
+ throw new Error(`cannot locate the ${cliName} entry to re-launch it`);
6
+ }
7
+ return isBunVirtualEntry(entry) ? [process.execPath] : [process.execPath, entry];
8
+ };
9
+ export const quotedCommandLine = (argv) => argv.map((arg) => `"${arg}"`).join(" ");
10
+ //# sourceMappingURL=launcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAkBA,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAGzG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAe,EAAe,EAAE;IACxD,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,qBAAqB,OAAO,wBAAwB,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACrF,CAAC,CAAC;AAKF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAuB,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@intentic/local-agent",
3
+ "version": "1.176.3",
4
+ "description": "The plumbing every intentic CLI that lives on a user's own computer needs — state home, login autostart, self-relaunch, detached background loop",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/intentic/intentic.git",
10
+ "directory": "_computers/local-agent"
11
+ },
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public",
17
+ "registry": "https://registry.npmjs.org/"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": {
23
+ "@intentic/src": "./src/index.ts",
24
+ "default": "./dist/index.js"
25
+ },
26
+ "require": {
27
+ "@intentic/src": "./src/index.ts",
28
+ "default": "./dist/index.js"
29
+ }
30
+ }
31
+ },
32
+ "dependencies": {
33
+ "tslib": "2.8.1"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "24.13.2",
37
+ "@typescript/native-preview": "7.0.0-dev.20260707.2",
38
+ "vitest": "4.1.10",
39
+ "@intentic/tsconfig": "0.0.0"
40
+ },
41
+ "scripts": {
42
+ "build": "tsgo",
43
+ "typecheck": "tsgo --noEmit -p tsconfig.test.json",
44
+ "watch": "tsgo --build --watch",
45
+ "test": "vitest run",
46
+ "test:watch": "vitest"
47
+ }
48
+ }