local-commander-agent 0.3.45 → 0.3.47
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/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/bin/localcommander.mjs +17 -0
- package/bin/posix.mjs +84 -66
- package/package.json +4 -4
- package/runtime/JobHost.exe +0 -0
- package/runtime/LocalCommanderAgent.exe +0 -0
- package/runtime/OwnerBridge.exe +0 -0
- package/runtime/agent.mjs +1717 -340
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Change history
|
|
2
2
|
|
|
3
|
+
## 0.3.47 - 2026-10-22
|
|
4
|
+
|
|
5
|
+
- New: screenshots on Linux. Where the screenshot tool is available to your account and the computer has Full Access, it now also works on a Linux desktop (Wayland through the desktop portal or grim, X11 through xwd, import or maim). When capture is not possible the client gets a clear reason, such as no desktop session or no capture tool.
|
|
6
|
+
- New: you can turn screenshots off for this computer. Run `localcommander screenshot off` on Windows, or `npx local-commander-agent screenshot off` on macOS and Linux; `screenshot on` turns them back on and `screenshot status` shows the current setting. No restart is needed.
|
|
7
|
+
- The cabinet now shows whether each computer has Full Access or selected folders only.
|
|
8
|
+
- Includes everything in 0.3.46.
|
|
9
|
+
|
|
10
|
+
## 0.3.46 - 2026-10-22
|
|
11
|
+
|
|
12
|
+
- Simpler setup on macOS and Linux: the approval page opens in your browser by itself, and on a Mac access is one click in a window (Full Access, or Choose Folder). Linux asks one question in the terminal: press Enter for Full Access or type a folder.
|
|
13
|
+
- Fixed: on macOS, updates keep access to the agent's key in the Keychain.
|
|
14
|
+
- Includes everything in 0.3.45.
|
|
15
|
+
|
|
3
16
|
## 0.3.45 - 2026-10-22
|
|
4
17
|
|
|
5
18
|
- New: macOS 14 or later on Apple Silicon, and Linux x64 or arm64 with a systemd user session. Run the same `npx local-commander-agent@latest` in Terminal; npm downloads only the runtime for your computer. Setup pairs the computer, asks what may be used in the terminal, and runs the agent as a background service that starts when you sign in.
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Use **Windows 11 x64**, **macOS 14 or later on Apple Silicon**, or **Linux with
|
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
2. The installer opens a browser. Sign in to [Local Commander](https://localcmd.app), check the displayed pairing code, and approve this computer. Approve only a pairing you just started yourself.
|
|
22
|
-
3. Choose access in the local
|
|
22
|
+
3. Choose access in the local window (on Windows and macOS; Linux asks one question in the terminal):
|
|
23
23
|
- **Full access - all connected drives (default):** approve the available drive letters, file reads/writes, installed commands and localhost services at once. There is no folder picker or separate approval for Node.
|
|
24
24
|
- **Selected folders:** choose one folder in the folder picker. It starts read/write; more folders and write permission can be added later.
|
|
25
25
|
|
package/bin/localcommander.mjs
CHANGED
|
@@ -316,6 +316,19 @@ async function auditCommand(runtimeDir, sub) {
|
|
|
316
316
|
}
|
|
317
317
|
fail("ARGUMENT_INVALID");
|
|
318
318
|
}
|
|
319
|
+
// Owner opt-out for take_screenshot under Full Access (#486), on by default. Only this owner-run command changes it (the agent
|
|
320
|
+
// state folder is protected from every file tool); the agent checks it on each capture, so no restart is needed.
|
|
321
|
+
const SCREENSHOT_OFF_FILE = "screenshot-disabled-by-owner";
|
|
322
|
+
async function screenshotCommand(args) {
|
|
323
|
+
const action = args[0] || "status";
|
|
324
|
+
if (args.length > 1 || !["status", "on", "off"].includes(action)) fail("ARGUMENT_INVALID");
|
|
325
|
+
if (!(await readCurrent())) fail("AGENT_NOT_INSTALLED");
|
|
326
|
+
const file = path.join(stateDirectory(), SCREENSHOT_OFF_FILE);
|
|
327
|
+
if (action === "off") await fs.writeFile(file, "", { flag: "wx" }).catch(error => { if (error?.code !== "EEXIST") throw error; });
|
|
328
|
+
if (action === "on") await fs.rm(file, { force: true });
|
|
329
|
+
const off = await fs.lstat(file).then(() => true, error => error?.code !== "ENOENT");
|
|
330
|
+
process.stdout.write(JSON.stringify({ screenshot: off ? "off" : "on" }) + "\n");
|
|
331
|
+
}
|
|
319
332
|
// Public AI-provider domains routed through the tunnel; everything else stays direct. Mirror of
|
|
320
333
|
// packages/connectivity/src/profiles.ts (stable public suffixes).
|
|
321
334
|
const PROXY_PROVIDERS = {
|
|
@@ -793,6 +806,10 @@ async function main() {
|
|
|
793
806
|
if (action === "setup") await restartIfRunning();
|
|
794
807
|
return;
|
|
795
808
|
}
|
|
809
|
+
if (command === "screenshot") {
|
|
810
|
+
await screenshotCommand(args);
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
796
813
|
if (command === "audit") {
|
|
797
814
|
const current = await readCurrent(); if (!current) fail("AGENT_NOT_INSTALLED");
|
|
798
815
|
await auditCommand(current.runtimeDir, args);
|
package/bin/posix.mjs
CHANGED
|
@@ -1,66 +1,84 @@
|
|
|
1
|
-
// macOS and Linux: the runtime ships in a per-platform package (an optional dependency, so npm installs only the
|
|
2
|
-
// matching one). Its lifecycle accepts only a private, owner-only artifact directory, so the files are copied from the
|
|
3
|
-
// npx cache into a fresh private directory and the lifecycle installs from there into its own versions directory.
|
|
4
|
-
import { constants } from "node:fs";
|
|
5
|
-
import fs from "node:fs/promises";
|
|
6
|
-
import os from "node:os";
|
|
7
|
-
import path from "node:path";
|
|
8
|
-
import { spawnSync } from "node:child_process";
|
|
9
|
-
import { createRequire } from "node:module";
|
|
10
|
-
|
|
11
|
-
const PACKAGES = { "darwin-arm64": "local-commander-agent-darwin-arm64", "linux-x64": "local-commander-agent-linux-x64", "linux-arm64": "local-commander-agent-linux-arm64" };
|
|
12
|
-
// npm command -> lifecycle command. The default (`npx local-commander-agent@latest`) is setup, as on Windows.
|
|
13
|
-
const COMMANDS = { bootstrap: "setup", install: "setup", setup: "setup", update: "update", pair: "pair", access: "access", "configure-access": "access",
|
|
14
|
-
start: "start", stop: "stop", status: "status", rollback: "rollback", uninstall: "uninstall" };
|
|
15
|
-
const EXECUTABLES = new Set(["node", "posix-host", "owner-store"]);
|
|
16
|
-
|
|
17
|
-
function fail(code) { const error = new Error(code); error.code = code; throw error; }
|
|
18
|
-
|
|
19
|
-
export function posixHelp() {
|
|
20
|
-
return [
|
|
21
|
-
"Local Commander",
|
|
22
|
-
"",
|
|
23
|
-
" npx local-commander-agent@latest set up this computer, pair it and choose access",
|
|
24
|
-
" npx local-commander-agent@latest update install this version, keeping pairing and access",
|
|
25
|
-
" npx local-commander-agent@latest status|start|stop|pair|access|rollback",
|
|
26
|
-
" npx local-commander-agent@latest uninstall [--purge-state]",
|
|
27
|
-
""
|
|
28
|
-
].join("\n");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
// macOS and Linux: the runtime ships in a per-platform package (an optional dependency, so npm installs only the
|
|
2
|
+
// matching one). Its lifecycle accepts only a private, owner-only artifact directory, so the files are copied from the
|
|
3
|
+
// npx cache into a fresh private directory and the lifecycle installs from there into its own versions directory.
|
|
4
|
+
import { constants } from "node:fs";
|
|
5
|
+
import fs from "node:fs/promises";
|
|
6
|
+
import os from "node:os";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { spawnSync } from "node:child_process";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
10
|
+
|
|
11
|
+
const PACKAGES = { "darwin-arm64": "local-commander-agent-darwin-arm64", "linux-x64": "local-commander-agent-linux-x64", "linux-arm64": "local-commander-agent-linux-arm64" };
|
|
12
|
+
// npm command -> lifecycle command. The default (`npx local-commander-agent@latest`) is setup, as on Windows.
|
|
13
|
+
const COMMANDS = { bootstrap: "setup", install: "setup", setup: "setup", update: "update", pair: "pair", access: "access", "configure-access": "access",
|
|
14
|
+
start: "start", stop: "stop", status: "status", rollback: "rollback", uninstall: "uninstall" };
|
|
15
|
+
const EXECUTABLES = new Set(["node", "posix-host", "owner-store"]);
|
|
16
|
+
|
|
17
|
+
function fail(code) { const error = new Error(code); error.code = code; throw error; }
|
|
18
|
+
|
|
19
|
+
export function posixHelp() {
|
|
20
|
+
return [
|
|
21
|
+
"Local Commander",
|
|
22
|
+
"",
|
|
23
|
+
" npx local-commander-agent@latest set up this computer, pair it and choose access",
|
|
24
|
+
" npx local-commander-agent@latest update install this version, keeping pairing and access",
|
|
25
|
+
" npx local-commander-agent@latest status|start|stop|pair|access|rollback",
|
|
26
|
+
" npx local-commander-agent@latest uninstall [--purge-state]",
|
|
27
|
+
""
|
|
28
|
+
].join("\n");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Owner opt-out for take_screenshot under Full Access (#486): a marker in the installed service agent's state folder
|
|
32
|
+
// (the service runs without XDG_DATA_HOME). No runtime staging is needed; the agent checks it on each capture.
|
|
33
|
+
async function screenshotCommand(args) {
|
|
34
|
+
const action = args[0] || "status";
|
|
35
|
+
if (args.length > 1 || !["status", "on", "off"].includes(action)) fail("ARGUMENT_INVALID");
|
|
36
|
+
if (typeof process.getuid === "function" && process.getuid() === 0) fail("POSIX_OWNER_REQUIRED");
|
|
37
|
+
const state = path.join(os.homedir(), process.platform === "darwin" ? "Library/Application Support" : ".local/share", "LocalCommander", "Agent");
|
|
38
|
+
const folder = await fs.lstat(state).catch(() => null);
|
|
39
|
+
if (!folder?.isDirectory() || folder.uid !== process.getuid()) fail("AGENT_NOT_INSTALLED");
|
|
40
|
+
const file = path.join(state, "screenshot-disabled-by-owner");
|
|
41
|
+
if (action === "off") await fs.open(file, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600)
|
|
42
|
+
.then(handle => handle.close(), error => { if (error?.code !== "EEXIST") throw error; });
|
|
43
|
+
if (action === "on") await fs.rm(file, { force: true });
|
|
44
|
+
const off = await fs.lstat(file).then(() => true, error => error?.code !== "ENOENT");
|
|
45
|
+
process.stdout.write(JSON.stringify({ screenshot: off ? "off" : "on" }) + "\n");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function runPosix(argv, version) {
|
|
49
|
+
const name = PACKAGES[process.platform + "-" + process.arch];
|
|
50
|
+
if (!name) fail(process.platform === "darwin" ? "MACOS_APPLE_SILICON_REQUIRED" : process.platform === "linux" ? "LINUX_X64_OR_ARM64_REQUIRED" : "PLATFORM_UNSUPPORTED");
|
|
51
|
+
const command = argv[0] || "bootstrap", args = argv.slice(1);
|
|
52
|
+
if (command === "-h" || command === "--help" || command === "help") { process.stdout.write(posixHelp()); return; }
|
|
53
|
+
if (command === "screenshot") { await screenshotCommand(args); return; }
|
|
54
|
+
const lifecycle = COMMANDS[command];
|
|
55
|
+
if (!lifecycle) fail("ARGUMENT_INVALID");
|
|
56
|
+
if (lifecycle === "uninstall" ? args.length > 1 || (args.length === 1 && args[0] !== "--purge-state") : args.length) fail("ARGUMENT_INVALID");
|
|
57
|
+
if (typeof process.getuid === "function" && process.getuid() === 0) fail("POSIX_OWNER_REQUIRED");
|
|
58
|
+
|
|
59
|
+
let packageJson;
|
|
60
|
+
try { packageJson = createRequire(import.meta.url).resolve(name + "/package.json"); } catch { fail("PLATFORM_PACKAGE_MISSING"); }
|
|
61
|
+
const meta = JSON.parse(await fs.readFile(packageJson, "utf8"));
|
|
62
|
+
if (meta.name !== name || meta.version !== version) fail("PLATFORM_PACKAGE_MISMATCH");
|
|
63
|
+
const source = path.join(path.dirname(packageJson), "runtime");
|
|
64
|
+
const manifest = JSON.parse(await fs.readFile(path.join(source, "manifest.json"), "utf8"));
|
|
65
|
+
const files = Object.keys(manifest?.files ?? {});
|
|
66
|
+
if (manifest?.platform !== process.platform || manifest?.arch !== process.arch || !files.length || files.some(file => !/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u.test(file))) fail("PLATFORM_PACKAGE_INVALID");
|
|
67
|
+
|
|
68
|
+
// Canonical parent: on macOS os.tmpdir() is under /var, a symlink to /private/var, and the lifecycle rejects aliases.
|
|
69
|
+
const stage = await fs.mkdtemp(path.join(await fs.realpath(os.tmpdir()), "local-commander-"));
|
|
70
|
+
try {
|
|
71
|
+
await fs.chmod(stage, 0o700);
|
|
72
|
+
for (const file of [...files, "manifest.json"]) {
|
|
73
|
+
const target = path.join(stage, file);
|
|
74
|
+
await fs.copyFile(path.join(source, file), target, constants.COPYFILE_EXCL);
|
|
75
|
+
await fs.chmod(target, EXECUTABLES.has(file) ? 0o700 : 0o600);
|
|
76
|
+
}
|
|
77
|
+
// The lifecycle verifies every file against the manifest, then copies them into its own versions directory.
|
|
78
|
+
const result = spawnSync(path.join(stage, "node"), [path.join(stage, "lifecycle.mjs"), lifecycle, ...args], { stdio: "inherit" });
|
|
79
|
+
if (result.error) throw result.error;
|
|
80
|
+
process.exitCode = result.status ?? 1;
|
|
81
|
+
} finally {
|
|
82
|
+
await fs.rm(stage, { recursive: true, force: true });
|
|
83
|
+
}
|
|
84
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "local-commander-agent",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.47",
|
|
4
4
|
"description": "Computer companion for Local Commander: connect AI clients to local files, approved commands and localhost. Requires https://localcmd.app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"arm64"
|
|
17
17
|
],
|
|
18
18
|
"optionalDependencies": {
|
|
19
|
-
"local-commander-agent-darwin-arm64": "0.3.
|
|
20
|
-
"local-commander-agent-linux-arm64": "0.3.
|
|
21
|
-
"local-commander-agent-linux-x64": "0.3.
|
|
19
|
+
"local-commander-agent-darwin-arm64": "0.3.47",
|
|
20
|
+
"local-commander-agent-linux-arm64": "0.3.47",
|
|
21
|
+
"local-commander-agent-linux-x64": "0.3.47"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=20.0.0"
|
package/runtime/JobHost.exe
CHANGED
|
Binary file
|
|
Binary file
|
package/runtime/OwnerBridge.exe
CHANGED
|
Binary file
|