autodev-cli 1.4.0 → 1.4.4

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.
Files changed (237) hide show
  1. package/bin/autodev.js +0 -0
  2. package/out/agentBackup/archive.d.ts +44 -0
  3. package/out/agentBackup/archive.js +131 -0
  4. package/out/agentBackup/archive.js.map +1 -0
  5. package/out/agentBackup/export.d.ts +18 -0
  6. package/out/agentBackup/export.js +92 -0
  7. package/out/agentBackup/export.js.map +1 -0
  8. package/out/agentBackup/import.d.ts +21 -0
  9. package/out/agentBackup/import.js +40 -0
  10. package/out/agentBackup/import.js.map +1 -0
  11. package/out/agentBackup/index.d.ts +6 -0
  12. package/out/agentBackup/index.js +11 -0
  13. package/out/agentBackup/index.js.map +1 -0
  14. package/out/agentBackup/layout.d.ts +30 -0
  15. package/out/agentBackup/layout.js +126 -0
  16. package/out/agentBackup/layout.js.map +1 -0
  17. package/out/agentBackup/manifest.d.ts +24 -0
  18. package/out/agentBackup/manifest.js +70 -0
  19. package/out/agentBackup/manifest.js.map +1 -0
  20. package/out/agentBackup/opencodeDb.d.ts +20 -0
  21. package/out/agentBackup/opencodeDb.js +213 -0
  22. package/out/agentBackup/opencodeDb.js.map +1 -0
  23. package/out/agentBackup/sessionProviders.d.ts +35 -0
  24. package/out/agentBackup/sessionProviders.js +263 -0
  25. package/out/agentBackup/sessionProviders.js.map +1 -0
  26. package/out/agentBackup/upload.d.ts +9 -0
  27. package/out/agentBackup/upload.js +121 -0
  28. package/out/agentBackup/upload.js.map +1 -0
  29. package/out/cli.d.ts +1 -0
  30. package/out/cli.js +8 -0
  31. package/out/cli.js.map +1 -1
  32. package/out/cliExit.d.ts +34 -0
  33. package/out/cliExit.js +159 -0
  34. package/out/cliExit.js.map +1 -0
  35. package/out/commands/config.d.ts +2 -0
  36. package/out/commands/config.js +7 -7
  37. package/out/commands/config.js.map +1 -1
  38. package/out/commands/connect.d.ts +2 -0
  39. package/out/commands/connect.js +11 -0
  40. package/out/commands/connect.js.map +1 -1
  41. package/out/commands/export.d.ts +2 -0
  42. package/out/commands/export.js +79 -0
  43. package/out/commands/export.js.map +1 -0
  44. package/out/commands/import.d.ts +2 -0
  45. package/out/commands/import.js +92 -0
  46. package/out/commands/import.js.map +1 -0
  47. package/out/commands/init.d.ts +16 -0
  48. package/out/commands/init.js +9 -5
  49. package/out/commands/init.js.map +1 -1
  50. package/out/commands/resume.d.ts +2 -0
  51. package/out/commands/resume.js +65 -0
  52. package/out/commands/resume.js.map +1 -0
  53. package/out/commands/sessions.d.ts +2 -0
  54. package/out/commands/sessions.js +64 -0
  55. package/out/commands/sessions.js.map +1 -0
  56. package/out/commands/start.d.ts +2 -0
  57. package/out/commands/start.js +40 -7
  58. package/out/commands/start.js.map +1 -1
  59. package/out/commands/status.d.ts +2 -0
  60. package/out/commands/status.js +3 -3
  61. package/out/commands/status.js.map +1 -1
  62. package/out/commands/tailOutput.d.ts +12 -0
  63. package/out/commands/up.d.ts +3 -0
  64. package/out/configManager.d.ts +42 -0
  65. package/out/configManager.js +447 -0
  66. package/out/configManager.js.map +1 -0
  67. package/out/connect.d.ts +4 -0
  68. package/out/connect.js +7 -7
  69. package/out/connect.js.map +1 -1
  70. package/out/core/adapters.d.ts +34 -0
  71. package/out/core/adapters.js +84 -0
  72. package/out/core/adapters.js.map +1 -0
  73. package/out/core/commandHelpers.d.ts +12 -0
  74. package/out/core/commandHelpers.js +96 -0
  75. package/out/core/commandHelpers.js.map +1 -0
  76. package/out/core/projectMcp.d.ts +34 -0
  77. package/out/core/projectMcp.js +160 -0
  78. package/out/core/projectMcp.js.map +1 -0
  79. package/out/core/provider/BaseProvider.d.ts +14 -0
  80. package/out/core/provider/BaseProvider.js +25 -0
  81. package/out/core/provider/BaseProvider.js.map +1 -0
  82. package/out/core/provider/ProviderRegistry.d.ts +12 -0
  83. package/out/core/provider/ProviderRegistry.js +40 -0
  84. package/out/core/provider/ProviderRegistry.js.map +1 -0
  85. package/out/core/provider/contract.d.ts +62 -0
  86. package/out/core/provider/contract.js +9 -0
  87. package/out/core/provider/contract.js.map +1 -0
  88. package/out/core/provider/implementations.d.ts +54 -0
  89. package/out/core/provider/implementations.js +147 -0
  90. package/out/core/provider/implementations.js.map +1 -0
  91. package/out/core/settingsLoader.d.ts +221 -0
  92. package/out/core/settingsLoader.js +176 -0
  93. package/out/core/settingsLoader.js.map +1 -0
  94. package/out/discordGateway.d.ts +26 -0
  95. package/out/discordGateway.js +230 -0
  96. package/out/discordGateway.js.map +1 -0
  97. package/out/discordPoller.d.ts +28 -0
  98. package/out/discordPoller.js +247 -0
  99. package/out/discordPoller.js.map +1 -0
  100. package/out/dispatcher.d.ts +12 -0
  101. package/out/dispatcher.js +214 -0
  102. package/out/dispatcher.js.map +1 -0
  103. package/out/emailPoller.d.ts +42 -0
  104. package/out/emailPoller.js +221 -0
  105. package/out/emailPoller.js.map +1 -0
  106. package/out/git/gitService.d.ts +36 -0
  107. package/out/git/gitService.js +165 -0
  108. package/out/git/gitService.js.map +1 -0
  109. package/out/hookEventNormalizer.d.ts +39 -0
  110. package/out/hookEventNormalizer.js +397 -0
  111. package/out/hookEventNormalizer.js.map +1 -0
  112. package/out/hooksManager.d.ts +25 -0
  113. package/out/hooksManager.js +471 -0
  114. package/out/hooksManager.js.map +1 -0
  115. package/out/launchIde.d.ts +14 -0
  116. package/out/logger.d.ts +12 -0
  117. package/out/mcpEmailTest.d.ts +29 -0
  118. package/out/mcpEmailTest.js +245 -0
  119. package/out/mcpEmailTest.js.map +1 -0
  120. package/out/mcpInstallCheck.d.ts +23 -0
  121. package/out/mcpInstallCheck.js +219 -0
  122. package/out/mcpInstallCheck.js.map +1 -0
  123. package/out/mcpManager.d.ts +35 -0
  124. package/out/mcpManager.js +371 -0
  125. package/out/mcpManager.js.map +1 -0
  126. package/out/messageBuilder.d.ts +54 -0
  127. package/out/messageBuilder.js +373 -0
  128. package/out/messageBuilder.js.map +1 -0
  129. package/out/openCodeHooksManager.d.ts +23 -0
  130. package/out/openCodeHooksManager.js +511 -0
  131. package/out/openCodeHooksManager.js.map +1 -0
  132. package/out/periodicActions.d.ts +63 -0
  133. package/out/periodicActions.js +237 -0
  134. package/out/periodicActions.js.map +1 -0
  135. package/out/profileBuilder.d.ts +29 -0
  136. package/out/profileBuilder.js +366 -0
  137. package/out/profileBuilder.js.map +1 -0
  138. package/out/prompt.d.ts +12 -0
  139. package/out/prompt.js +18 -0
  140. package/out/prompt.js.map +1 -0
  141. package/out/protocolSections.d.ts +26 -0
  142. package/out/protocolSections.js +209 -0
  143. package/out/protocolSections.js.map +1 -0
  144. package/out/providers/claudeCliProvider.d.ts +71 -0
  145. package/out/providers/claudeCliProvider.js +425 -0
  146. package/out/providers/claudeCliProvider.js.map +1 -0
  147. package/out/providers/claudeTuiProvider.d.ts +23 -0
  148. package/out/providers/claudeTuiProvider.js +296 -0
  149. package/out/providers/claudeTuiProvider.js.map +1 -0
  150. package/out/providers/copilotCliProvider.d.ts +16 -0
  151. package/out/providers/copilotCliProvider.js +44 -0
  152. package/out/providers/copilotCliProvider.js.map +1 -0
  153. package/out/providers/copilotSdkProvider.d.ts +12 -0
  154. package/out/providers/copilotSdkProvider.js +445 -0
  155. package/out/providers/copilotSdkProvider.js.map +1 -0
  156. package/out/providers/grokTuiProvider.d.ts +14 -0
  157. package/out/providers/grokTuiProvider.js +271 -0
  158. package/out/providers/grokTuiProvider.js.map +1 -0
  159. package/out/providers/opencodeCliProvider.d.ts +29 -0
  160. package/out/providers/opencodeCliProvider.js +199 -0
  161. package/out/providers/opencodeCliProvider.js.map +1 -0
  162. package/out/providers/opencodeSdkProvider.d.ts +22 -0
  163. package/out/providers/opencodeSdkProvider.js +557 -0
  164. package/out/providers/opencodeSdkProvider.js.map +1 -0
  165. package/out/providers.d.ts +9 -0
  166. package/out/providers.js +44 -0
  167. package/out/providers.js.map +1 -0
  168. package/out/rateLimit.d.ts +18 -0
  169. package/out/rateLimit.js +90 -0
  170. package/out/rateLimit.js.map +1 -0
  171. package/out/rdp/auth.d.ts +55 -0
  172. package/out/rdp/auth.js +197 -0
  173. package/out/rdp/auth.js.map +1 -0
  174. package/out/rdp/bridge.d.ts +86 -0
  175. package/out/rdp/bridge.js +1398 -0
  176. package/out/rdp/bridge.js.map +1 -0
  177. package/out/rdp/constants.d.ts +86 -0
  178. package/out/rdp/constants.js +182 -0
  179. package/out/rdp/constants.js.map +1 -0
  180. package/out/rdp/index.d.ts +7 -0
  181. package/out/rdp/index.js +14 -0
  182. package/out/rdp/index.js.map +1 -0
  183. package/out/rdp/session.d.ts +30 -0
  184. package/out/rdp/session.js +196 -0
  185. package/out/rdp/session.js.map +1 -0
  186. package/out/rdp/types.d.ts +27 -0
  187. package/out/rdp/types.js +6 -0
  188. package/out/rdp/types.js.map +1 -0
  189. package/out/sdk/index.d.ts +22 -0
  190. package/out/sdk/index.js +81 -0
  191. package/out/sdk/index.js.map +1 -0
  192. package/out/sessionState.d.ts +54 -0
  193. package/out/sessionState.js +284 -0
  194. package/out/sessionState.js.map +1 -0
  195. package/out/sessions.d.ts +11 -0
  196. package/out/sessions.js +32 -0
  197. package/out/sessions.js.map +1 -0
  198. package/out/taskLoop.d.ts +152 -0
  199. package/out/taskLoop.js +2505 -0
  200. package/out/taskLoop.js.map +1 -0
  201. package/out/todo.d.ts +42 -0
  202. package/out/todo.js +311 -0
  203. package/out/todo.js.map +1 -0
  204. package/out/todoWriteManager.d.ts +26 -0
  205. package/out/todoWriteManager.js +44 -0
  206. package/out/todoWriteManager.js.map +1 -0
  207. package/out/vnc/auth.d.ts +52 -0
  208. package/out/vnc/auth.js +181 -0
  209. package/out/vnc/auth.js.map +1 -0
  210. package/out/vnc/bridge.d.ts +40 -0
  211. package/out/vnc/bridge.js +540 -0
  212. package/out/vnc/bridge.js.map +1 -0
  213. package/out/vnc/constants.d.ts +8 -0
  214. package/out/vnc/constants.js +34 -0
  215. package/out/vnc/constants.js.map +1 -0
  216. package/out/vnc/des.d.ts +6 -0
  217. package/out/vnc/des.js +93 -0
  218. package/out/vnc/des.js.map +1 -0
  219. package/out/vnc/index.d.ts +7 -0
  220. package/out/vnc/index.js +13 -0
  221. package/out/vnc/index.js.map +1 -0
  222. package/out/vnc/session.d.ts +18 -0
  223. package/out/vnc/session.js +193 -0
  224. package/out/vnc/session.js.map +1 -0
  225. package/out/vnc/types.d.ts +16 -0
  226. package/out/vnc/types.js +6 -0
  227. package/out/vnc/types.js.map +1 -0
  228. package/out/webSocketPoller.d.ts +95 -0
  229. package/out/webSocketPoller.js +986 -0
  230. package/out/webSocketPoller.js.map +1 -0
  231. package/out/webhook.d.ts +37 -0
  232. package/out/webhook.js +265 -0
  233. package/out/webhook.js.map +1 -0
  234. package/out/webhookPoller.d.ts +40 -0
  235. package/out/webhookPoller.js +378 -0
  236. package/out/webhookPoller.js.map +1 -0
  237. package/package.json +54 -41
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ // ---------------------------------------------------------------------------
3
+ // Rate-limit detection — central registry of phrases Claude uses to signal
4
+ // throttling, plus the reset-time parser. Add new wording in ONE place
5
+ // (RateLimitDetector.PHRASES) and every call site picks it up.
6
+ // ---------------------------------------------------------------------------
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.RateLimitDetector = exports.RateLimitError = void 0;
9
+ class RateLimitError extends Error {
10
+ rawMessage;
11
+ resetAt;
12
+ constructor(rawMessage, resetAt) {
13
+ super(rawMessage);
14
+ this.rawMessage = rawMessage;
15
+ this.resetAt = resetAt;
16
+ this.name = 'RateLimitError';
17
+ }
18
+ }
19
+ exports.RateLimitError = RateLimitError;
20
+ /**
21
+ * Phrases / regexes that mean "Claude is throttled, pause the loop". Each
22
+ * entry is matched case-insensitively against the candidate text. Add new
23
+ * wording here whenever Anthropic ships a new error string — no other site
24
+ * in the codebase needs to change.
25
+ */
26
+ const PHRASES = [
27
+ /hit your limit/i, // "You've hit your limit · resets 9pm (Europe/Sofia)"
28
+ /rate limit/i, // "API Error: ... · Rate limited"
29
+ /out of extra usage/i, // "You're out of extra usage · resets 8:20pm (Europe/Sofia)"
30
+ /\bout of\b.*\busage\b/i, // future variants of "out of … usage"
31
+ /usage limit reached/i,
32
+ ];
33
+ class RateLimitDetector {
34
+ /** True when text contains any known rate-limit phrase. */
35
+ static matches(text) {
36
+ if (!text) {
37
+ return false;
38
+ }
39
+ return PHRASES.some(p => p.test(text));
40
+ }
41
+ /** Build a RateLimitError from text, parsing the reset time if present. */
42
+ static toError(text) {
43
+ const trimmed = (text ?? '').trim();
44
+ return new RateLimitError(trimmed || 'Rate limited', RateLimitDetector.parseResetTime(trimmed));
45
+ }
46
+ /** Match + build in one step. Returns null when text is not a rate limit. */
47
+ static detect(text) {
48
+ return RateLimitDetector.matches(text) ? RateLimitDetector.toError(text) : null;
49
+ }
50
+ /**
51
+ * Parse "resets 9pm (Europe/Sofia)" / "resets 8:20pm (Europe/Sofia)" into a
52
+ * UTC Date. Returns undefined when no reset clause is present or parseable.
53
+ */
54
+ static parseResetTime(text) {
55
+ const m = text.match(/resets\s+(\d{1,2})(?::(\d{2}))?\s*(am|pm)\s*\(([^)]+)\)/i);
56
+ if (!m) {
57
+ return undefined;
58
+ }
59
+ try {
60
+ let hour = parseInt(m[1]);
61
+ const min = parseInt(m[2] ?? '0');
62
+ const isPm = m[3].toLowerCase() === 'pm';
63
+ const tz = m[4];
64
+ if (isPm && hour !== 12) {
65
+ hour += 12;
66
+ }
67
+ if (!isPm && hour === 12) {
68
+ hour = 0;
69
+ }
70
+ const now = new Date();
71
+ const dateStr = new Intl.DateTimeFormat('sv', { timeZone: tz }).format(now);
72
+ for (let d = 0; d <= 1; d++) {
73
+ const base = Date.parse(dateStr) + d * 86_400_000 + hour * 3_600_000 + min * 60_000;
74
+ const naiveDate = new Date(base);
75
+ const inTz = new Date(naiveDate.toLocaleString('en-US', { timeZone: tz }));
76
+ const offset = naiveDate.getTime() - inTz.getTime();
77
+ const resetUtc = new Date(base + offset);
78
+ if (resetUtc > now) {
79
+ return resetUtc;
80
+ }
81
+ }
82
+ return undefined;
83
+ }
84
+ catch {
85
+ return undefined;
86
+ }
87
+ }
88
+ }
89
+ exports.RateLimitDetector = RateLimitDetector;
90
+ //# sourceMappingURL=rateLimit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rateLimit.js","sourceRoot":"","sources":["../src/rateLimit.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,2EAA2E;AAC3E,uEAAuE;AACvE,+DAA+D;AAC/D,8EAA8E;;;AAE9E,MAAa,cAAe,SAAQ,KAAK;IAClB;IAA6B;IAAlD,YAAqB,UAAkB,EAAW,OAAyB;QACzE,KAAK,CAAC,UAAU,CAAC,CAAC;QADC,eAAU,GAAV,UAAU,CAAQ;QAAW,YAAO,GAAP,OAAO,CAAkB;QAEzE,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC;AAED;;;;;GAKG;AACH,MAAM,OAAO,GAA0B;IACrC,iBAAiB,EAAiB,sDAAsD;IACxF,aAAa,EAAqB,kCAAkC;IACpE,qBAAqB,EAAa,6DAA6D;IAC/F,wBAAwB,EAAU,sCAAsC;IACxE,sBAAsB;CACvB,CAAC;AAEF,MAAa,iBAAiB;IAC5B,2DAA2D;IAC3D,MAAM,CAAC,OAAO,CAAC,IAAY;QACzB,IAAI,CAAC,IAAI,EAAE,CAAC;YAAC,OAAO,KAAK,CAAC;QAAC,CAAC;QAC5B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,2EAA2E;IAC3E,MAAM,CAAC,OAAO,CAAC,IAAY;QACzB,MAAM,OAAO,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACpC,OAAO,IAAI,cAAc,CAAC,OAAO,IAAI,cAAc,EAAE,iBAAiB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC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AAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,GAAG,GAAG,MAAM,CAAC;gBACpF,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;gBACjC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;gBAC3E,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;gBACpD,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;gBACzC,IAAI,QAAQ,GAAG,GAAG,EAAE,CAAC;oBAAC,OAAO,QAAQ,CAAC;gBAAC,CAAC;YAC1C,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,SAAS,CAAC;QAAC,CAAC;IAC/B,CAAC;CACF;AA7CD,8CA6CC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * RdpAuth — handles the security negotiation layer for RDP connections.
3
+ *
4
+ * Supported protocols (negotiated via X.224 Negotiation Request):
5
+ * PROTOCOL_RDP (0) — Classic RDP Security (RC4); rarely used today
6
+ * PROTOCOL_SSL (1) — TLS wrapping (most XRDP servers)
7
+ * PROTOCOL_HYBRID (2) — CredSSP / NLA (Windows default; Phase 2)
8
+ *
9
+ * For Phase 1 (XRDP / local targets) we negotiate TLS-only (PROTOCOL_SSL).
10
+ * This avoids the full CredSSP/NTLM stack and works against:
11
+ * - xrdp with TLS enabled (default on modern Linux)
12
+ * - Windows 2008+ with "Allow connections from … any version" security level
13
+ *
14
+ * NLA (CredSSP) is prepared as a future phase — see negotiateNla().
15
+ */
16
+ import * as net from 'net';
17
+ import * as tls from 'tls';
18
+ /**
19
+ * Build an X.224 Connection Request TPDU with an RDP Negotiation Request
20
+ * appended as a type-length-value (TLV) trailer.
21
+ *
22
+ * The cookie (mstshash=<username>) is optional but recommended for xrdp
23
+ * load-balancing.
24
+ */
25
+ export declare function buildX224ConnectRequest(requestedProtocols: number, username?: string): Buffer;
26
+ /**
27
+ * Parse the X.224 Connection Confirm TPDU (and optional Negotiation Response).
28
+ * Returns the selected protocol or throws on failure.
29
+ */
30
+ export declare function parseX224ConnectConfirm(data: Buffer): number;
31
+ /**
32
+ * Upgrade a plain TCP socket to TLS.
33
+ * Returns the TLS socket once the handshake is complete.
34
+ * Certificate validation is disabled (self-signed is the norm for RDP).
35
+ */
36
+ export declare function upgradeTls(sock: net.Socket, host: string): Promise<tls.TLSSocket>;
37
+ /**
38
+ * Generate a 32-byte random client random for Classic RDP Security.
39
+ * Not used in TLS mode but exposed for completeness / future use.
40
+ */
41
+ export declare function generateClientRandom(): Buffer;
42
+ /**
43
+ * Placeholder for CredSSP / NLA negotiation.
44
+ * Full NTLM + CredSSP is complex; this throws with a clear message so callers
45
+ * can detect that NLA is required and surface a useful error to the user.
46
+ *
47
+ * @throws Always — NLA is not yet implemented.
48
+ */
49
+ export declare function negotiateNla(_sock: tls.TLSSocket, _username: string, _password: string, _domain: string): Promise<void>;
50
+ /**
51
+ * Choose the best protocol to request during X.224 negotiation.
52
+ * We always try TLS first; fall back to classic RDP only if the server
53
+ * explicitly rejects and the caller retries.
54
+ */
55
+ export declare function selectRequestProtocol(): number;
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ /**
3
+ * RdpAuth — handles the security negotiation layer for RDP connections.
4
+ *
5
+ * Supported protocols (negotiated via X.224 Negotiation Request):
6
+ * PROTOCOL_RDP (0) — Classic RDP Security (RC4); rarely used today
7
+ * PROTOCOL_SSL (1) — TLS wrapping (most XRDP servers)
8
+ * PROTOCOL_HYBRID (2) — CredSSP / NLA (Windows default; Phase 2)
9
+ *
10
+ * For Phase 1 (XRDP / local targets) we negotiate TLS-only (PROTOCOL_SSL).
11
+ * This avoids the full CredSSP/NTLM stack and works against:
12
+ * - xrdp with TLS enabled (default on modern Linux)
13
+ * - Windows 2008+ with "Allow connections from … any version" security level
14
+ *
15
+ * NLA (CredSSP) is prepared as a future phase — see negotiateNla().
16
+ */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || (function () {
34
+ var ownKeys = function(o) {
35
+ ownKeys = Object.getOwnPropertyNames || function (o) {
36
+ var ar = [];
37
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
38
+ return ar;
39
+ };
40
+ return ownKeys(o);
41
+ };
42
+ return function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ })();
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.buildX224ConnectRequest = buildX224ConnectRequest;
52
+ exports.parseX224ConnectConfirm = parseX224ConnectConfirm;
53
+ exports.upgradeTls = upgradeTls;
54
+ exports.generateClientRandom = generateClientRandom;
55
+ exports.negotiateNla = negotiateNla;
56
+ exports.selectRequestProtocol = selectRequestProtocol;
57
+ const tls = __importStar(require("tls"));
58
+ const constants_1 = require("./constants");
59
+ // ── X.224 helpers ──────────────────────────────────────────────────────────
60
+ /**
61
+ * Build an X.224 Connection Request TPDU with an RDP Negotiation Request
62
+ * appended as a type-length-value (TLV) trailer.
63
+ *
64
+ * The cookie (mstshash=<username>) is optional but recommended for xrdp
65
+ * load-balancing.
66
+ */
67
+ function buildX224ConnectRequest(requestedProtocols, username) {
68
+ const cookie = username
69
+ ? `Cookie: mstshash=${username}\r\n`
70
+ : '';
71
+ // RDP Negotiation Request TLV: type(1) + flags(1) + length(2) + protocols(4)
72
+ const negReq = Buffer.alloc(8);
73
+ negReq[0] = 0x01; // TYPE_RDP_NEG_REQ
74
+ negReq[1] = 0x00; // flags
75
+ negReq.writeUInt16LE(0x0008, 2); // length = 8
76
+ negReq.writeUInt32LE(requestedProtocols, 4);
77
+ // TPDU variable part: cookie + negotiation request
78
+ const varPart = Buffer.concat([
79
+ Buffer.from(cookie, 'ascii'),
80
+ negReq,
81
+ ]);
82
+ // X.224 CR TPDU header: LI(1) + code(1) + dstRef(2) + srcRef(2) + class(1)
83
+ const li = 6 + varPart.length; // header length indicator (bytes after LI itself)
84
+ const tpdu = Buffer.alloc(7 + varPart.length);
85
+ tpdu[0] = li;
86
+ tpdu[1] = constants_1.X224_TPDU_CONNECTION_REQUEST;
87
+ tpdu.writeUInt16BE(0x0000, 2); // dst ref
88
+ tpdu.writeUInt16BE(0x0000, 4); // src ref
89
+ tpdu[6] = 0x00; // class 0
90
+ varPart.copy(tpdu, 7);
91
+ // TPKT header: version(1) + reserved(1) + length(2)
92
+ const totalLen = 4 + tpdu.length;
93
+ const tpkt = Buffer.alloc(4 + tpdu.length);
94
+ tpkt[0] = 0x03; // TPKT version
95
+ tpkt[1] = 0x00; // reserved
96
+ tpkt.writeUInt16BE(totalLen, 2);
97
+ tpdu.copy(tpkt, 4);
98
+ return tpkt;
99
+ }
100
+ /**
101
+ * Parse the X.224 Connection Confirm TPDU (and optional Negotiation Response).
102
+ * Returns the selected protocol or throws on failure.
103
+ */
104
+ function parseX224ConnectConfirm(data) {
105
+ if (data.length < 7)
106
+ throw new Error('X.224 CC too short');
107
+ if (data[0] !== 0x03)
108
+ throw new Error('Not a TPKT packet');
109
+ const tpduStart = 4;
110
+ const code = data[tpduStart + 1];
111
+ if (code !== constants_1.X224_TPDU_CONNECTION_CONFIRM) {
112
+ throw new Error(`Expected X.224 CC (0xD0), got 0x${code.toString(16)}`);
113
+ }
114
+ // Check for optional RDP Negotiation TLV appended after the fixed 7-byte header
115
+ const varOffset = tpduStart + 7;
116
+ if (data.length >= varOffset + 8) {
117
+ const tlvType = data[varOffset];
118
+ if (tlvType === 0x02) {
119
+ // TYPE_RDP_NEG_RSP — server accepted our requested protocol.
120
+ // The flags field here contains capability bits (e.g. EXTENDED_CLIENT_DATA_SUPPORTED=0x01)
121
+ // which are NOT error indicators — do not treat them as failures.
122
+ return data.readUInt32LE(varOffset + 4);
123
+ }
124
+ if (tlvType === 0x03) {
125
+ // TYPE_RDP_NEG_FAILURE — server rejected our protocol request.
126
+ const failureCode = data.readUInt32LE(varOffset + 4);
127
+ const reasons = {
128
+ 1: 'SSL_REQUIRED_BY_SERVER',
129
+ 2: 'SSL_NOT_ALLOWED_BY_SERVER',
130
+ 3: 'SSL_CERT_NOT_ON_SERVER',
131
+ 4: 'INCONSISTENT_FLAGS',
132
+ 5: 'HYBRID_REQUIRED_BY_SERVER (NLA required)',
133
+ 6: 'SSL_WITH_USER_AUTH_REQUIRED_BY_SERVER',
134
+ };
135
+ throw new Error(`RDP Negotiation Failure: ${reasons[failureCode] ?? `code ${failureCode}`}`);
136
+ }
137
+ }
138
+ // No negotiation TLV — server accepted default (classic RDP security)
139
+ return constants_1.PROTOCOL_RDP;
140
+ }
141
+ // ── TLS upgrade ───────────────────────────────────────────────────────────
142
+ /**
143
+ * Upgrade a plain TCP socket to TLS.
144
+ * Returns the TLS socket once the handshake is complete.
145
+ * Certificate validation is disabled (self-signed is the norm for RDP).
146
+ */
147
+ function upgradeTls(sock, host) {
148
+ return new Promise((resolve, reject) => {
149
+ const tlsSock = tls.connect({
150
+ socket: sock,
151
+ host,
152
+ rejectUnauthorized: false, // RDP servers use self-signed certs
153
+ });
154
+ tlsSock.once('secureConnect', () => resolve(tlsSock));
155
+ tlsSock.once('error', reject);
156
+ });
157
+ }
158
+ // ── RDP Security (Classic — no longer recommended but kept for completeness) ─
159
+ /**
160
+ * Generate a 32-byte random client random for Classic RDP Security.
161
+ * Not used in TLS mode but exposed for completeness / future use.
162
+ */
163
+ function generateClientRandom() {
164
+ const crypto = require('crypto');
165
+ return crypto.randomBytes(32);
166
+ }
167
+ // ── NLA / CredSSP stub (Phase 2) ──────────────────────────────────────────
168
+ /**
169
+ * Placeholder for CredSSP / NLA negotiation.
170
+ * Full NTLM + CredSSP is complex; this throws with a clear message so callers
171
+ * can detect that NLA is required and surface a useful error to the user.
172
+ *
173
+ * @throws Always — NLA is not yet implemented.
174
+ */
175
+ function negotiateNla(
176
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
177
+ _sock,
178
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
179
+ _username,
180
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
181
+ _password,
182
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
183
+ _domain) {
184
+ return Promise.reject(new Error('NLA / CredSSP authentication is not yet supported. ' +
185
+ 'Connect to an RDP server configured for SSL/TLS security level, ' +
186
+ 'or use xrdp with TLS enabled.'));
187
+ }
188
+ // ── Protocol selection helper ─────────────────────────────────────────────
189
+ /**
190
+ * Choose the best protocol to request during X.224 negotiation.
191
+ * We always try TLS first; fall back to classic RDP only if the server
192
+ * explicitly rejects and the caller retries.
193
+ */
194
+ function selectRequestProtocol() {
195
+ return constants_1.PROTOCOL_SSL;
196
+ }
197
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/rdp/auth.ts"],"names":[],"mappings":";AAAA;;;;;;;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EhF;;;GAGG;AACH,SAAgB,oBAAoB;IAClC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAA4B,CAAC;IAC5D,OAAO,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,6EAA6E;AAE7E;;;;;;GAMG;AACH,SAAgB,YAAY;AAC1B,6DAA6D;AAC7D,KAAoB;AACpB,6DAA6D;AAC7D,SAAiB;AACjB,6DAA6D;AAC7D,SAAiB;AACjB,6DAA6D;AAC7D,OAAe;IAEf,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CACP,qDAAqD;QACrD,kEAAkE;QAClE,+BAA+B,CAChC,CACF,CAAC;AACJ,CAAC;AAED,6EAA6E;AAE7E;;;;GAIG;AACH,SAAgB,qBAAqB;IACnC,OAAO,wBAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * RdpBridge — TCP/TLS connection to an RDP server.
3
+ *
4
+ * Implements the minimal RDP protocol phases needed for screen + input:
5
+ *
6
+ * Phase 1 X.224 Connection Request / Confirm (TPKT/X.224)
7
+ * Phase 2 TLS upgrade (PROTOCOL_SSL negotiated in Phase 1)
8
+ * Phase 3 MCS Connect (T.125 / GCC Conference Create)
9
+ * Phase 4 MCS Erect Domain + Attach User
10
+ * Phase 5 MCS Channel Joins (Global + optional cliprdr)
11
+ * Phase 6 RDP Security Exchange + Client Info (Classic RDP Security disabled; TLS carries everything)
12
+ * Phase 7 Demand-Active / Confirm-Active capability exchange
13
+ * Phase 8 Running — bitmap updates, input events, clipboard
14
+ *
15
+ * Emits:
16
+ * 'fbu' (rects: RdpRect[]) — one or more bitmap rectangles
17
+ * 'cursor' ({ hotX, hotY, width, height, rgba: string }) — cursor shape update
18
+ * 'clipboard' (text: string) — remote clipboard changed
19
+ * 'error' (err: Error) — unrecoverable error
20
+ * 'close' () — TCP/TLS connection closed
21
+ */
22
+ import { EventEmitter } from 'events';
23
+ import type { RdpInfo, RdpConnectOptions } from './types';
24
+ export declare class RdpBridge extends EventEmitter {
25
+ private _sock;
26
+ private _closed;
27
+ private _recvBuf;
28
+ private _handshakeBuf;
29
+ private _width;
30
+ private _height;
31
+ private _colorDepth;
32
+ private _userId;
33
+ private _shareId;
34
+ private _connected;
35
+ private _opts;
36
+ private _reconnectCount;
37
+ private static readonly _MAX_RECONNECTS;
38
+ /** Optional external logger — set before calling connect(). */
39
+ log: (msg: string) => void;
40
+ get width(): number;
41
+ get height(): number;
42
+ /**
43
+ * Connect to an RDP server. Resolves once the desktop is ready.
44
+ */
45
+ connect(opts: RdpConnectOptions): Promise<RdpInfo>;
46
+ /** Send a mouse event. buttonMask: bit0=left, bit1=right, bit2=middle */
47
+ sendMouse(x: number, y: number, buttonMask: number): void;
48
+ /** Send a key event. jsKeyCode is the browser keyCode value. */
49
+ sendKey(jsKeyCode: number, down: boolean): void;
50
+ /** Push local clipboard text to the remote. */
51
+ sendClipboardText(text: string): void;
52
+ close(): void;
53
+ /**
54
+ * Reconnect using saved opts — called after xrdp's clean TCP close that
55
+ * follows the initial session-creation handshake.
56
+ */
57
+ private _doReconnect;
58
+ private _handshake;
59
+ /**
60
+ * Handle RDP license exchange after Client Info PDU.
61
+ * Responds to SERVER_LICENSE_REQUEST and PLATFORM_CHALLENGE until the
62
+ * server completes licensing (or sends a non-license PDU).
63
+ */
64
+ private _doLicenseExchange;
65
+ private _runLoop;
66
+ private _dispatchPdu;
67
+ private _handleDataPdu;
68
+ private _handleUpdatePdu;
69
+ private _parseBitmapUpdate;
70
+ private _sendInput;
71
+ private _sendX224Data;
72
+ private _sendMcsData;
73
+ /** Read a complete TPKT from the given socket (used during handshake only). */
74
+ private _readTpkt;
75
+ /** Read a TPKT and return only the payload (after TPKT+X.224 headers). */
76
+ private _readTpktPayload;
77
+ /**
78
+ * Wait for an RDP PDU with a specific pduType in the Share Control Header.
79
+ * Times out after `timeoutMs` ms.
80
+ */
81
+ private _waitForPduType;
82
+ /** Try to parse one complete TPKT from _recvBuf without blocking.
83
+ * Fast-path PDUs (first byte != 0x03) are skipped with a warning since we
84
+ * advertise no fast-path support; they should not appear, but guard anyway. */
85
+ private _tryParseTpkt;
86
+ }