@codingfrees/uap-device-control 0.2.9 → 0.2.10
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 +16 -0
- package/dist/uap-device-control.mjs +31 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,3 +125,19 @@ The script requires clean package inputs, refuses an already-published version,
|
|
|
125
125
|
## UAP Downloads release candidates
|
|
126
126
|
|
|
127
127
|
The `UAP downloadable product candidates` workflow also builds the Node 26 portable `uap-device-control-remote-<version>.mjs`, its SHA-256 and sanitized provenance from the exact candidate source SHA. This executable JavaScript file **requires Node.js 26**; it is not a signed Windows/macOS native installer and is separate from the existing npm release channel. The private CI artifact is not a public UAP Downloads release. Each approved public release must embed Windows/Linux/macOS download, checksum, login, scoped-root, browser pairing and update/removal instructions in its description; live OS/browser certification and separate publication approval are required.
|
|
128
|
+
|
|
129
|
+
## ChatGPT MCP tool profiles
|
|
130
|
+
|
|
131
|
+
The connected MCP URL controls which tools are advertised and callable. A device-reported capability alone does not make its corresponding ChatGPT tool available.
|
|
132
|
+
|
|
133
|
+
| Connection URL | Profile | Relevant tools |
|
|
134
|
+
| --- | --- | --- |
|
|
135
|
+
| `https://device-control.aemdpc.ro/mcp` | `core` (default) | Device discovery, health, processes, terminal and approvals |
|
|
136
|
+
| `https://device-control.aemdpc.ro/mcp?profile=browser` | `browser` | `list_browser_tabs` and paired-browser operations |
|
|
137
|
+
| `https://device-control.aemdpc.ro/mcp?profile=screen` | `screen` | `list_monitors`, `screenshot`, streams and desktop controls |
|
|
138
|
+
| `https://device-control.aemdpc.ro/mcp?profile=filesystem` | `filesystem` | Root discovery and filesystem operations |
|
|
139
|
+
| `https://device-control.aemdpc.ro/mcp?profile=marketplace` | `marketplace` | All Device Control MCP tools |
|
|
140
|
+
|
|
141
|
+
To enable the advanced tools in ChatGPT, connect an explicit `browser` or `screen` profile, or the `marketplace` profile for the complete surface. The plugin packager supports `--profile browser`, `--profile screen`, and `--profile marketplace`, and embeds the matching URL in `mcp.json`. An existing `core` connection does not gain advanced tools just because the remote device reports those capabilities.
|
|
142
|
+
|
|
143
|
+
Profiles restrict both `tools/list` and `tools/call`; OAuth scopes and device/workspace authorization still apply. Browser reads require a paired browser extension and elevated-access approval; screenshots require a separate approval. Never grant approval automatically during diagnostic checks.
|
|
@@ -60,7 +60,7 @@ import os from "node:os";
|
|
|
60
60
|
import { execFile } from "node:child_process";
|
|
61
61
|
import { promisify } from "node:util";
|
|
62
62
|
import path from "node:path";
|
|
63
|
-
import { link, mkdir, readFile, rm, rename, writeFile } from "node:fs/promises";
|
|
63
|
+
import { link, mkdir, readFile, realpath, rm, rename, writeFile } from "node:fs/promises";
|
|
64
64
|
import { randomUUID } from "node:crypto";
|
|
65
65
|
function defaultDeviceControlStateDirectory(home = os.homedir(), platform = process.platform) {
|
|
66
66
|
if (platform === "win32") return path.join(process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"), "UAP", "DeviceControl");
|
|
@@ -142,7 +142,12 @@ async function verifiedRemoteOwner(pid) {
|
|
|
142
142
|
if (process.platform !== "win32") {
|
|
143
143
|
try {
|
|
144
144
|
const args = (await readFile(`/proc/${pid}/cmdline`)).toString("utf8").split("\0").filter(Boolean);
|
|
145
|
-
|
|
145
|
+
if (!args.includes("remote") || args.includes("--service")) return false;
|
|
146
|
+
for (const arg of args) {
|
|
147
|
+
if (/(?:^|[\\/])uap-device-control\.mjs$/.test(arg)) return true;
|
|
148
|
+
if (/(?:^|[\\/])uap-device-control$/.test(arg) && /(?:^|[\\/])uap-device-control\.mjs$/.test(await realpath(arg))) return true;
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
146
151
|
} catch {
|
|
147
152
|
return false;
|
|
148
153
|
}
|
|
@@ -797,7 +802,7 @@ import WebSocket from "ws";
|
|
|
797
802
|
// package.json
|
|
798
803
|
var package_default = {
|
|
799
804
|
name: "@codingfrees/uap-device-control",
|
|
800
|
-
version: "0.2.
|
|
805
|
+
version: "0.2.10",
|
|
801
806
|
description: "Cross-platform outbound UAP Device Control client",
|
|
802
807
|
type: "module",
|
|
803
808
|
bin: {
|
|
@@ -825,7 +830,7 @@ var package_default = {
|
|
|
825
830
|
// ../device-agent/src/engine.ts
|
|
826
831
|
import { execFile as execFile2, spawn } from "node:child_process";
|
|
827
832
|
import { promisify as promisify2 } from "node:util";
|
|
828
|
-
import { cp, mkdir as mkdir3, open, readdir, realpath, rename as rename2, rm as rm2, stat, writeFile as writeFile3 } from "node:fs/promises";
|
|
833
|
+
import { cp, mkdir as mkdir3, open, readdir, realpath as realpath2, rename as rename2, rm as rm2, stat, writeFile as writeFile3 } from "node:fs/promises";
|
|
829
834
|
import { realpathSync } from "node:fs";
|
|
830
835
|
import os2 from "node:os";
|
|
831
836
|
import path3 from "node:path";
|
|
@@ -1467,7 +1472,7 @@ async function safeExisting(root2, relative) {
|
|
|
1467
1472
|
if (!inside(root2, lexical)) throw new TypeError("path escapes configured root");
|
|
1468
1473
|
let target;
|
|
1469
1474
|
try {
|
|
1470
|
-
target = await
|
|
1475
|
+
target = await realpath2(lexical);
|
|
1471
1476
|
} catch {
|
|
1472
1477
|
throw new TypeError("device path is unavailable");
|
|
1473
1478
|
}
|
|
@@ -1486,20 +1491,20 @@ async function safeWritable(root2, relative) {
|
|
|
1486
1491
|
for (const part of parts) {
|
|
1487
1492
|
const next = path3.join(parent, part);
|
|
1488
1493
|
try {
|
|
1489
|
-
const resolved = await
|
|
1494
|
+
const resolved = await realpath2(next);
|
|
1490
1495
|
if (!inside(root2, resolved)) throw new TypeError("path escapes configured root");
|
|
1491
1496
|
parent = resolved;
|
|
1492
1497
|
} catch (error) {
|
|
1493
1498
|
if (error instanceof TypeError || !isMissing(error)) throw error;
|
|
1494
1499
|
await mkdir3(next);
|
|
1495
|
-
const resolved = await
|
|
1500
|
+
const resolved = await realpath2(next);
|
|
1496
1501
|
if (!inside(root2, resolved)) throw new TypeError("path escapes configured root");
|
|
1497
1502
|
parent = resolved;
|
|
1498
1503
|
}
|
|
1499
1504
|
}
|
|
1500
1505
|
const target = path3.join(parent, leaf);
|
|
1501
1506
|
try {
|
|
1502
|
-
const resolved = await
|
|
1507
|
+
const resolved = await realpath2(target);
|
|
1503
1508
|
if (!inside(root2, resolved)) throw new TypeError("path escapes configured root");
|
|
1504
1509
|
return resolved;
|
|
1505
1510
|
} catch (error) {
|
|
@@ -1852,7 +1857,7 @@ var WINDOWS_CLIPBOARD_WRITE = "param($text) Add-Type -AssemblyName System.Window
|
|
|
1852
1857
|
|
|
1853
1858
|
// ../device-agent/src/native-services.ts
|
|
1854
1859
|
import { execFile as execFile4 } from "node:child_process";
|
|
1855
|
-
import { realpath as
|
|
1860
|
+
import { realpath as realpath3, stat as stat2 } from "node:fs/promises";
|
|
1856
1861
|
import { win32 } from "node:path";
|
|
1857
1862
|
import { promisify as promisify4 } from "node:util";
|
|
1858
1863
|
var execute2 = promisify4(execFile4);
|
|
@@ -1922,7 +1927,7 @@ function parseSystemdService(name, output) {
|
|
|
1922
1927
|
async function firstExecutable(candidates, label) {
|
|
1923
1928
|
for (const candidate of candidates) {
|
|
1924
1929
|
try {
|
|
1925
|
-
const value = await
|
|
1930
|
+
const value = await realpath3(candidate);
|
|
1926
1931
|
if ((await stat2(value)).isFile()) return value;
|
|
1927
1932
|
} catch (error) {
|
|
1928
1933
|
if (!isMissing2(error)) throw error;
|
|
@@ -2101,6 +2106,15 @@ async function remoteSession(origin, stateDirectory, engine, fetcher = fetch, si
|
|
|
2101
2106
|
return;
|
|
2102
2107
|
}
|
|
2103
2108
|
if (!connected) throw new TypeError("remote socket sent data before connection acknowledgement");
|
|
2109
|
+
if (value.type === "presence-probe") {
|
|
2110
|
+
const probeId = bounded2(value.id, "presence probe id");
|
|
2111
|
+
socket.send(JSON.stringify({ type: "presence-ack", id: probeId }), (error) => {
|
|
2112
|
+
if (!error) return;
|
|
2113
|
+
closeCause = "socket-error";
|
|
2114
|
+
fail(new RemoteUnavailableError(void 0, "/device-control/remote/socket", "transport"));
|
|
2115
|
+
});
|
|
2116
|
+
return;
|
|
2117
|
+
}
|
|
2104
2118
|
if (value.type === "result-ack") {
|
|
2105
2119
|
const requestId = bounded2(value.requestId, "request id");
|
|
2106
2120
|
const pending = acknowledgements.get(requestId);
|
|
@@ -2144,7 +2158,7 @@ async function remoteSession(origin, stateDirectory, engine, fetcher = fetch, si
|
|
|
2144
2158
|
};
|
|
2145
2159
|
socket.on("message", onMessage).on("close", onClose).on("error", onError);
|
|
2146
2160
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
2147
|
-
socket.send(JSON.stringify({ type: "hello", device: engine.info() }));
|
|
2161
|
+
socket.send(JSON.stringify({ type: "hello", device: engine.info(), features: ["presence-probe-v1"] }));
|
|
2148
2162
|
});
|
|
2149
2163
|
} finally {
|
|
2150
2164
|
for (const pending of acknowledgements.values()) pending.reject(new RemoteUnavailableError(void 0, "/device-control/remote/socket", "transport"));
|
|
@@ -2642,8 +2656,7 @@ async function runDeviceControlCli(args = process.argv.slice(2)) {
|
|
|
2642
2656
|
signal: controller.signal,
|
|
2643
2657
|
log: (event) => {
|
|
2644
2658
|
output(event);
|
|
2645
|
-
if (event.event === "remote.session" && event.status === "connected")
|
|
2646
|
-
void displayVerifiedIdentity(resolvedOrigin, config.stateDirectory, output);
|
|
2659
|
+
if (event.event === "remote.session" && event.status === "connected") void displayVerifiedIdentity(resolvedOrigin, config.stateDirectory, output);
|
|
2647
2660
|
}
|
|
2648
2661
|
});
|
|
2649
2662
|
} finally {
|
|
@@ -2705,10 +2718,11 @@ function formatCliEvent(event, json2 = false) {
|
|
|
2705
2718
|
}
|
|
2706
2719
|
if (event.event === "remote.session") {
|
|
2707
2720
|
if (status === "replaced") return "\u267B\uFE0F Previous UAP Remote instance stopped; starting the new session";
|
|
2708
|
-
if (status === "connected")
|
|
2721
|
+
if (status === "connected")
|
|
2722
|
+
return "\u2705 Device connected \xB7 " + String(event.deviceId) + (event.agentVersion ? " \xB7 v" + String(event.agentVersion) : "") + (event.subject ? "\n Server subject: " + String(event.subject) : "") + (event.workspaceId ? "\n Workspace: " + String(event.workspaceId) : "");
|
|
2709
2723
|
if (status === "disconnected") {
|
|
2710
2724
|
const code = Number(event.closeCode);
|
|
2711
|
-
const cause = ["socket-closed", "socket-error", "client-abort", "protocol-error", "result-delivery"].includes(String(event.closeCause)) ? String(event.closeCause) : "";
|
|
2725
|
+
const cause = ["socket-closed", "socket-error", "client-abort", "protocol-error", "result-delivery", "presence-timeout"].includes(String(event.closeCause)) ? String(event.closeCause) : "";
|
|
2712
2726
|
const uptime = Number(event.uptimeMs);
|
|
2713
2727
|
return "\u{1F50C} Device disconnected \xB7 " + String(event.deviceId) + (Number.isInteger(code) && code >= 1e3 && code <= 4999 ? " \xB7 WS " + code : "") + (cause ? " \xB7 " + cause : "") + (Number.isInteger(uptime) && uptime >= 0 && uptime <= 864e5 ? " \xB7 uptime " + uptime + " ms" : "");
|
|
2714
2728
|
}
|
|
@@ -2720,7 +2734,8 @@ function formatCliEvent(event, json2 = false) {
|
|
|
2720
2734
|
return "Open this URL in a browser and explicitly approve this computer:\n" + String(event.url) + "\nIf using WSL2, open the link in Windows and keep this terminal running for the localhost callback.\nAlternatively, run login --pairing-code <code>.";
|
|
2721
2735
|
if (status === "connecting") return "\u{1F310} Connecting to " + String(event.origin) + " \xB7 " + String(event.platform);
|
|
2722
2736
|
if (status === "authenticated") return "\u2705 Authenticated \xB7 " + String(event.origin);
|
|
2723
|
-
if (status === "account-switched")
|
|
2737
|
+
if (status === "account-switched")
|
|
2738
|
+
return "\u2705 Account authorization replaced \xB7 " + String(event.origin) + (event.oldAuthorizationRevoked === false ? "\n\u26A0\uFE0F Prior authorization revocation could not be confirmed; revoke the old session in the account console" : " \xB7 previous authorization revoked");
|
|
2724
2739
|
if (status === "logged-out") return "\u2705 Logged out";
|
|
2725
2740
|
if (status === "browser-pairing-reset") return "\u2705 Browser pairing reset \xB7 run remote again to get a new pairing code";
|
|
2726
2741
|
if (status === "not-logged-in") return "\u26A0\uFE0F Not logged in";
|