@codingfrees/uap-device-control 0.1.6 → 0.1.7
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/dist/uap-device-control.mjs +29 -1
- package/package.json +1 -1
|
@@ -400,6 +400,31 @@ function integer(value, label) {
|
|
|
400
400
|
import os3 from "node:os";
|
|
401
401
|
import path4 from "node:path";
|
|
402
402
|
|
|
403
|
+
// package.json
|
|
404
|
+
var package_default = {
|
|
405
|
+
name: "@codingfrees/uap-device-control",
|
|
406
|
+
version: "0.1.7",
|
|
407
|
+
description: "Cross-platform outbound UAP Device Control client",
|
|
408
|
+
type: "module",
|
|
409
|
+
bin: {
|
|
410
|
+
"uap-device-control": "dist/uap-device-control.mjs"
|
|
411
|
+
},
|
|
412
|
+
files: [
|
|
413
|
+
"dist/"
|
|
414
|
+
],
|
|
415
|
+
engines: {
|
|
416
|
+
node: ">=26.8.1 <27"
|
|
417
|
+
},
|
|
418
|
+
publishConfig: {
|
|
419
|
+
access: "public"
|
|
420
|
+
},
|
|
421
|
+
scripts: {
|
|
422
|
+
build: 'pnpm exec esbuild src/bin.ts --bundle --platform=node --format=esm --target=node26 --outfile=dist/uap-device-control.mjs --banner:js="#!/usr/bin/env node"',
|
|
423
|
+
prepack: "pnpm run build",
|
|
424
|
+
"publish:public": "node scripts/publish.mjs"
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
403
428
|
// ../device-agent/src/engine.ts
|
|
404
429
|
import { spawn } from "node:child_process";
|
|
405
430
|
import { cp, mkdir as mkdir2, readdir, readFile as readFile2, realpath, rename as rename2, rm as rm2, stat, writeFile as writeFile2 } from "node:fs/promises";
|
|
@@ -411,6 +436,7 @@ var DeviceAgentEngine = class {
|
|
|
411
436
|
constructor(options) {
|
|
412
437
|
this.options = options;
|
|
413
438
|
if (!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(options.deviceId)) throw new TypeError("device id is invalid");
|
|
439
|
+
if (options.agentVersion !== void 0 && !/^[0-9A-Za-z][0-9A-Za-z._+-]{0,119}$/.test(options.agentVersion)) throw new TypeError("device agent version is invalid");
|
|
414
440
|
this.#maxTransfer = bounded(options.maxTransferBytes ?? 8 * 1024 * 1024, 1024, 64 * 1024 * 1024, "transfer limit");
|
|
415
441
|
this.#maxOutput = bounded(options.maxOutputBytes ?? 1024 * 1024, 1024, 8 * 1024 * 1024, "output limit");
|
|
416
442
|
this.#maxProcesses = bounded(options.maxProcesses ?? 8, 1, 64, "process limit");
|
|
@@ -488,7 +514,7 @@ var DeviceAgentEngine = class {
|
|
|
488
514
|
status: "online",
|
|
489
515
|
os: os2.platform(),
|
|
490
516
|
architecture: os2.arch(),
|
|
491
|
-
agentVersion: "0.1.0",
|
|
517
|
+
agentVersion: this.options.agentVersion ?? "0.1.0",
|
|
492
518
|
lastSeen: Date.now(),
|
|
493
519
|
capabilities: [...this.capabilities],
|
|
494
520
|
activeSessions: this.#sessions.size
|
|
@@ -1674,6 +1700,7 @@ function secureEqual(left, right) {
|
|
|
1674
1700
|
}
|
|
1675
1701
|
|
|
1676
1702
|
// src/remote.ts
|
|
1703
|
+
var UAP_DEVICE_CONTROL_AGENT_VERSION = package_default.version;
|
|
1677
1704
|
async function runRemote(options) {
|
|
1678
1705
|
const fetcher = options.fetcher ?? fetch;
|
|
1679
1706
|
const deviceId = await loadRemoteDeviceId(options.stateDirectory);
|
|
@@ -1694,6 +1721,7 @@ async function runRemote(options) {
|
|
|
1694
1721
|
const engine = new DeviceAgentEngine({
|
|
1695
1722
|
deviceId,
|
|
1696
1723
|
name: os3.hostname(),
|
|
1724
|
+
agentVersion: UAP_DEVICE_CONTROL_AGENT_VERSION,
|
|
1697
1725
|
roots: options.roots,
|
|
1698
1726
|
...options.allowedExecutables.length ? { allowedExecutables: options.allowedExecutables } : {},
|
|
1699
1727
|
...services ? { services, allowedServices: options.allowedServices } : {},
|