@codingfrees/uap-device-control 0.2.11 → 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 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
- Publish a verified public release from this package with:
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, refuses an already-published version, builds and dry-runs the package, then calls npm publish and verifies the registry version plus the `latest` dist-tag. The root `pnpm deploy:npm` entrypoint invokes the publisher directly; a separate package-local node_modules directory is unnecessary when workspace dependencies are installed. npm account 2FA remains mandatory and is handled by npm during the publish step.
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.11",
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"
@@ -2024,6 +2033,42 @@ async function runRemote(options) {
2024
2033
  engine.close();
2025
2034
  }
2026
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
+ }
2027
2072
  function createRefreshScheduler(refresh, delayMs = 100) {
2028
2073
  let timer;
2029
2074
  return {
@@ -2055,6 +2100,7 @@ async function remoteSession(origin, stateDirectory, engine, fetcher = fetch, si
2055
2100
  const sessionStartedAt = Date.now();
2056
2101
  let closeCode;
2057
2102
  let closeCause;
2103
+ let heartbeat;
2058
2104
  const execute4 = (command, workspaceId) => {
2059
2105
  if (!command.capability.startsWith("browser.")) return engine.execute(command.capability, command.parameters, { workspaceId });
2060
2106
  const current = browserExecution.then(() => engine.execute(command.capability, command.parameters, { workspaceId }));
@@ -2111,6 +2157,11 @@ async function remoteSession(origin, stateDirectory, engine, fetcher = fetch, si
2111
2157
  const value = socketMessage(data);
2112
2158
  if (value.type === "connected") {
2113
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
+ });
2114
2165
  log?.({
2115
2166
  event: "remote.session",
2116
2167
  status: "connected",
@@ -2122,6 +2173,10 @@ async function remoteSession(origin, stateDirectory, engine, fetcher = fetch, si
2122
2173
  return;
2123
2174
  }
2124
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
+ }
2125
2180
  if (value.type === "presence-probe") {
2126
2181
  const probeId = bounded2(value.id, "presence probe id");
2127
2182
  socket.send(JSON.stringify({ type: "presence-ack", id: probeId }), (error) => {
@@ -2174,9 +2229,10 @@ async function remoteSession(origin, stateDirectory, engine, fetcher = fetch, si
2174
2229
  };
2175
2230
  socket.on("message", onMessage).on("close", onClose).on("error", onError);
2176
2231
  signal?.addEventListener("abort", onAbort, { once: true });
2177
- 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"] }));
2178
2233
  });
2179
2234
  } finally {
2235
+ heartbeat?.stop();
2180
2236
  for (const pending of acknowledgements.values()) pending.reject(new RemoteUnavailableError(void 0, "/device-control/remote/socket", "transport"));
2181
2237
  acknowledgements.clear();
2182
2238
  await drain();
package/package.json CHANGED
@@ -1,13 +1,22 @@
1
1
  {
2
2
  "name": "@codingfrees/uap-device-control",
3
- "version": "0.2.11",
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"