@codingfrees/uap-device-control 0.2.10 → 0.2.12
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/DISCLOSURE +14 -0
- package/README.md +3 -3
- package/dist/uap-device-control.mjs +78 -4
- package/package.json +11 -2
package/DISCLOSURE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
UAP Device Control is an authorized remote device administration client.
|
|
2
|
+
It can perform terminal, filesystem, process, screen and optional browser
|
|
3
|
+
operations on an enrolled device, making its capabilities security-relevant
|
|
4
|
+
and dual-use.
|
|
5
|
+
|
|
6
|
+
Its intended use is administration of devices controlled by the owner or
|
|
7
|
+
a person who has explicitly authorized that access. The client requires
|
|
8
|
+
authenticated device enrollment, origin-bound credentials, capability
|
|
9
|
+
restrictions, and elevated approval for sensitive operations. It must not
|
|
10
|
+
be used to access systems without authorization.
|
|
11
|
+
|
|
12
|
+
Publication is submitted to npm staging. Public promotion requires a
|
|
13
|
+
maintainer to review the staged package and complete npm two-factor
|
|
14
|
+
authentication; automated OIDC staging does not bypass this requirement.
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ You can also provide the origin through `UAP_DEVICE_CONTROL_ORIGIN`.
|
|
|
28
28
|
npx @codingfrees/uap-device-control@latest remote
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
The interactive CLI uses concise human-readable status lines by default (`✅`, `❌`, `⚠️`, `🔐`, `🌐`, `🔌`, `🔧`). Use `--json` for stable JSONL output in scripts and log collectors. Only one `remote` process may use a state directory at a time; a new temporary Remote can replace a verified prior temporary instance, while unrelated or service-managed processes fail closed. OAuth refresh is serialized across processes, and access-token renewal is retried in the existing broker session rather than forcing a device reconnect.
|
|
31
|
+
The interactive CLI uses concise human-readable status lines by default (`✅`, `❌`, `⚠️`, `🔐`, `🌐`, `🔌`, `🔧`). Use `--json` for stable JSONL output in scripts and log collectors. Only one `remote` process may use a state directory at a time; a new temporary Remote can replace a verified prior temporary instance, while unrelated or service-managed processes fail closed. OAuth refresh is serialized across processes, and access-token renewal is retried in the existing broker session rather than forcing a device reconnect. On relays advertising `transport-ping-v1`, a bounded 30-second application heartbeat receives automatic responses while the Durable Object hibernates; a missing reply causes the CLI to replace the silent half-open transport. Older relays continue using on-demand presence probes until both sides are updated.
|
|
32
32
|
|
|
33
33
|
Interactive `remote` sessions display the UAP Device Control banner at startup; JSON and service modes remain banner-free. Use `--debug` to add local terminal-command diagnostics containing the executable, redacted argument vector, working directory and shortened request ID. Environment values are never logged, and common credential-bearing flags and headers are redacted.
|
|
34
34
|
|
|
@@ -110,7 +110,7 @@ The client opens only outbound HTTPS connections plus the optional browser bridg
|
|
|
110
110
|
|
|
111
111
|
## Publishing
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
Stage a verified dual-use release for npm maintainer approval with:
|
|
114
114
|
|
|
115
115
|
```bash
|
|
116
116
|
pnpm publish:public
|
|
@@ -120,7 +120,7 @@ Validate the exact release without publishing with `pnpm publish:public -- --dry
|
|
|
120
120
|
|
|
121
121
|
For `npm whoami` HTTP 401 in Linux/WSL, renew authentication locally using `npm login --registry=https://registry.npmjs.org/ --auth-type=web`, then confirm `npm whoami`. Do not paste credentials into issue reports or logs. npm versions are immutable: bump the package version and commit a clean tree before publishing.
|
|
122
122
|
|
|
123
|
-
The script requires clean package inputs,
|
|
123
|
+
The script requires clean package inputs, the persistent `contentPolicy` declaration and bundled `DISCLOSURE`, and an unused version. It builds and checks the package, then calls `npm stage publish`. The root `pnpm deploy:npm` entrypoint uses the same staging script. A maintainer must inspect and explicitly approve the stage on npmjs.com with 2FA before the version becomes publicly available; the script does not bypass npm identity checks or claim a staged version is published.
|
|
124
124
|
|
|
125
125
|
## UAP Downloads release candidates
|
|
126
126
|
|
|
@@ -802,14 +802,23 @@ import WebSocket from "ws";
|
|
|
802
802
|
// package.json
|
|
803
803
|
var package_default = {
|
|
804
804
|
name: "@codingfrees/uap-device-control",
|
|
805
|
-
version: "0.2.
|
|
805
|
+
version: "0.2.12",
|
|
806
806
|
description: "Cross-platform outbound UAP Device Control client",
|
|
807
|
+
contentPolicy: {
|
|
808
|
+
class: "dual-use"
|
|
809
|
+
},
|
|
810
|
+
repository: {
|
|
811
|
+
type: "git",
|
|
812
|
+
url: "git+https://github.com/CodingFrees/UAP-next.git",
|
|
813
|
+
directory: "apps/uap-device-control"
|
|
814
|
+
},
|
|
807
815
|
type: "module",
|
|
808
816
|
bin: {
|
|
809
817
|
"uap-device-control": "dist/uap-device-control.mjs"
|
|
810
818
|
},
|
|
811
819
|
files: [
|
|
812
|
-
"dist/"
|
|
820
|
+
"dist/",
|
|
821
|
+
"DISCLOSURE"
|
|
813
822
|
],
|
|
814
823
|
engines: {
|
|
815
824
|
node: ">=26.8.1 <27"
|
|
@@ -1957,9 +1966,10 @@ async function runRemote(options) {
|
|
|
1957
1966
|
if (options.allowedServices.length && !services) throw new TypeError("native service control is unavailable");
|
|
1958
1967
|
let refreshSession = () => {
|
|
1959
1968
|
};
|
|
1969
|
+
const browserRefresh = createRefreshScheduler(() => refreshSession());
|
|
1960
1970
|
const browserLog = (event) => {
|
|
1961
1971
|
options.log?.(event);
|
|
1962
|
-
if (event.event === "browser.bridge" && ["paired", "unpaired", "connected", "permissions-granted", "permissions-required"].includes(String(event.status)))
|
|
1972
|
+
if (event.event === "browser.bridge" && ["paired", "unpaired", "connected", "permissions-granted", "permissions-required"].includes(String(event.status))) browserRefresh.schedule();
|
|
1963
1973
|
};
|
|
1964
1974
|
const browserPort = options.browserPort ?? 18700;
|
|
1965
1975
|
const browser = options.browserControl === false ? void 0 : await createBrowserBridge(options.stateDirectory, browserPort, browserLog).catch((error) => {
|
|
@@ -2019,9 +2029,60 @@ async function runRemote(options) {
|
|
|
2019
2029
|
}
|
|
2020
2030
|
}
|
|
2021
2031
|
} finally {
|
|
2032
|
+
browserRefresh.close();
|
|
2022
2033
|
engine.close();
|
|
2023
2034
|
}
|
|
2024
2035
|
}
|
|
2036
|
+
function createRemoteHeartbeat(socket, onMissed, intervalMs = 3e4, timeoutMs = 1e4) {
|
|
2037
|
+
let pending;
|
|
2038
|
+
let stopped = false;
|
|
2039
|
+
const stop = () => {
|
|
2040
|
+
stopped = true;
|
|
2041
|
+
clearInterval(interval);
|
|
2042
|
+
if (pending) clearTimeout(pending);
|
|
2043
|
+
pending = void 0;
|
|
2044
|
+
};
|
|
2045
|
+
const fail = () => {
|
|
2046
|
+
if (stopped) return;
|
|
2047
|
+
stop();
|
|
2048
|
+
onMissed();
|
|
2049
|
+
};
|
|
2050
|
+
const interval = setInterval(() => {
|
|
2051
|
+
if (stopped || pending) return;
|
|
2052
|
+
pending = setTimeout(fail, timeoutMs);
|
|
2053
|
+
pending.unref();
|
|
2054
|
+
try {
|
|
2055
|
+
socket.send('{"type":"transport-ping"}', (error) => {
|
|
2056
|
+
if (error) fail();
|
|
2057
|
+
});
|
|
2058
|
+
} catch {
|
|
2059
|
+
fail();
|
|
2060
|
+
}
|
|
2061
|
+
}, intervalMs);
|
|
2062
|
+
interval.unref();
|
|
2063
|
+
return {
|
|
2064
|
+
acknowledge() {
|
|
2065
|
+
if (!pending || stopped) return;
|
|
2066
|
+
clearTimeout(pending);
|
|
2067
|
+
pending = void 0;
|
|
2068
|
+
},
|
|
2069
|
+
stop
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
function createRefreshScheduler(refresh, delayMs = 100) {
|
|
2073
|
+
let timer;
|
|
2074
|
+
return {
|
|
2075
|
+
schedule() {
|
|
2076
|
+
if (timer) clearTimeout(timer);
|
|
2077
|
+
timer = setTimeout(refresh, delayMs);
|
|
2078
|
+
timer.unref();
|
|
2079
|
+
},
|
|
2080
|
+
close() {
|
|
2081
|
+
if (timer) clearTimeout(timer);
|
|
2082
|
+
timer = void 0;
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2025
2086
|
function optionalBrowserBridgeFailure(error) {
|
|
2026
2087
|
if (!error || typeof error !== "object" || !("code" in error)) return false;
|
|
2027
2088
|
return ["EADDRINUSE", "EACCES", "EAFNOSUPPORT", "EPROTONOSUPPORT"].includes(String(error.code));
|
|
@@ -2039,6 +2100,7 @@ async function remoteSession(origin, stateDirectory, engine, fetcher = fetch, si
|
|
|
2039
2100
|
const sessionStartedAt = Date.now();
|
|
2040
2101
|
let closeCode;
|
|
2041
2102
|
let closeCause;
|
|
2103
|
+
let heartbeat;
|
|
2042
2104
|
const execute4 = (command, workspaceId) => {
|
|
2043
2105
|
if (!command.capability.startsWith("browser.")) return engine.execute(command.capability, command.parameters, { workspaceId });
|
|
2044
2106
|
const current = browserExecution.then(() => engine.execute(command.capability, command.parameters, { workspaceId }));
|
|
@@ -2095,6 +2157,11 @@ async function remoteSession(origin, stateDirectory, engine, fetcher = fetch, si
|
|
|
2095
2157
|
const value = socketMessage(data);
|
|
2096
2158
|
if (value.type === "connected") {
|
|
2097
2159
|
connected = true;
|
|
2160
|
+
if (Array.isArray(value.features) && value.features.includes("transport-ping-v1"))
|
|
2161
|
+
heartbeat = createRemoteHeartbeat(socket, () => {
|
|
2162
|
+
closeCause = "presence-timeout";
|
|
2163
|
+
socket.terminate();
|
|
2164
|
+
});
|
|
2098
2165
|
log?.({
|
|
2099
2166
|
event: "remote.session",
|
|
2100
2167
|
status: "connected",
|
|
@@ -2106,6 +2173,10 @@ async function remoteSession(origin, stateDirectory, engine, fetcher = fetch, si
|
|
|
2106
2173
|
return;
|
|
2107
2174
|
}
|
|
2108
2175
|
if (!connected) throw new TypeError("remote socket sent data before connection acknowledgement");
|
|
2176
|
+
if (value.type === "transport-pong" && heartbeat) {
|
|
2177
|
+
heartbeat.acknowledge();
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2109
2180
|
if (value.type === "presence-probe") {
|
|
2110
2181
|
const probeId = bounded2(value.id, "presence probe id");
|
|
2111
2182
|
socket.send(JSON.stringify({ type: "presence-ack", id: probeId }), (error) => {
|
|
@@ -2158,9 +2229,10 @@ async function remoteSession(origin, stateDirectory, engine, fetcher = fetch, si
|
|
|
2158
2229
|
};
|
|
2159
2230
|
socket.on("message", onMessage).on("close", onClose).on("error", onError);
|
|
2160
2231
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
2161
|
-
socket.send(JSON.stringify({ type: "hello", device: engine.info(), features: ["presence-probe-v1"] }));
|
|
2232
|
+
socket.send(JSON.stringify({ type: "hello", device: engine.info(), features: ["presence-probe-v1", "transport-ping-v1"] }));
|
|
2162
2233
|
});
|
|
2163
2234
|
} finally {
|
|
2235
|
+
heartbeat?.stop();
|
|
2164
2236
|
for (const pending of acknowledgements.values()) pending.reject(new RemoteUnavailableError(void 0, "/device-control/remote/socket", "transport"));
|
|
2165
2237
|
acknowledgements.clear();
|
|
2166
2238
|
await drain();
|
|
@@ -2714,6 +2786,8 @@ function formatCliEvent(event, json2 = false) {
|
|
|
2714
2786
|
}
|
|
2715
2787
|
if (status === "paired") return "\u2705 UAP Browser Extension paired";
|
|
2716
2788
|
if (status === "connected") return "\u{1F310} UAP Browser Extension connected";
|
|
2789
|
+
if (status === "permissions-granted") return "\u2705 UAP Browser Extension access granted";
|
|
2790
|
+
if (status === "permissions-required") return "\u26A0\uFE0F UAP Browser Extension connected \xB7 browser access required";
|
|
2717
2791
|
if (status === "unpaired") return "\u{1F50C} UAP Browser Extension unpaired";
|
|
2718
2792
|
}
|
|
2719
2793
|
if (event.event === "remote.session") {
|
package/package.json
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingfrees/uap-device-control",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Cross-platform outbound UAP Device Control client",
|
|
5
|
+
"contentPolicy": {
|
|
6
|
+
"class": "dual-use"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/CodingFrees/UAP-next.git",
|
|
11
|
+
"directory": "apps/uap-device-control"
|
|
12
|
+
},
|
|
5
13
|
"type": "module",
|
|
6
14
|
"bin": {
|
|
7
15
|
"uap-device-control": "dist/uap-device-control.mjs"
|
|
8
16
|
},
|
|
9
17
|
"files": [
|
|
10
|
-
"dist/"
|
|
18
|
+
"dist/",
|
|
19
|
+
"DISCLOSURE"
|
|
11
20
|
],
|
|
12
21
|
"engines": {
|
|
13
22
|
"node": ">=26.8.1 <27"
|