@uvl000/claude-trace 3.0.13-workflowexp.1

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 (258) hide show
  1. package/README.md +477 -0
  2. package/README.zh-CN.md +477 -0
  3. package/dist/adapt/api-format.d.ts +41 -0
  4. package/dist/adapt/api-format.d.ts.map +1 -0
  5. package/dist/adapt/api-format.js +132 -0
  6. package/dist/adapt/api-format.js.map +1 -0
  7. package/dist/adapt/openai-adapter.d.ts +123 -0
  8. package/dist/adapt/openai-adapter.d.ts.map +1 -0
  9. package/dist/adapt/openai-adapter.js +628 -0
  10. package/dist/adapt/openai-adapter.js.map +1 -0
  11. package/dist/cli/cli-common.d.ts +73 -0
  12. package/dist/cli/cli-common.d.ts.map +1 -0
  13. package/dist/cli/cli-common.js +189 -0
  14. package/dist/cli/cli-common.js.map +1 -0
  15. package/dist/cli/cli.d.ts +23 -0
  16. package/dist/cli/cli.d.ts.map +1 -0
  17. package/dist/cli/cli.js +175 -0
  18. package/dist/cli/cli.js.map +1 -0
  19. package/dist/cli/codex-cli.d.ts +24 -0
  20. package/dist/cli/codex-cli.d.ts.map +1 -0
  21. package/dist/cli/codex-cli.js +146 -0
  22. package/dist/cli/codex-cli.js.map +1 -0
  23. package/dist/cli/opencode-cli.d.ts +23 -0
  24. package/dist/cli/opencode-cli.d.ts.map +1 -0
  25. package/dist/cli/opencode-cli.js +156 -0
  26. package/dist/cli/opencode-cli.js.map +1 -0
  27. package/dist/cli/trace-runner.d.ts +21 -0
  28. package/dist/cli/trace-runner.d.ts.map +1 -0
  29. package/dist/cli/trace-runner.js +282 -0
  30. package/dist/cli/trace-runner.js.map +1 -0
  31. package/dist/cli/validate-trace.d.ts +30 -0
  32. package/dist/cli/validate-trace.d.ts.map +1 -0
  33. package/dist/cli/validate-trace.js +230 -0
  34. package/dist/cli/validate-trace.js.map +1 -0
  35. package/dist/cli/verify-offline-bundle.d.ts +13 -0
  36. package/dist/cli/verify-offline-bundle.d.ts.map +1 -0
  37. package/dist/cli/verify-offline-bundle.js +89 -0
  38. package/dist/cli/verify-offline-bundle.js.map +1 -0
  39. package/dist/cli/vibe-coding-proxy-cli.d.ts +12 -0
  40. package/dist/cli/vibe-coding-proxy-cli.d.ts.map +1 -0
  41. package/dist/cli/vibe-coding-proxy-cli.js +218 -0
  42. package/dist/cli/vibe-coding-proxy-cli.js.map +1 -0
  43. package/dist/config/claude-config-overlay.d.ts +69 -0
  44. package/dist/config/claude-config-overlay.d.ts.map +1 -0
  45. package/dist/config/claude-config-overlay.js +229 -0
  46. package/dist/config/claude-config-overlay.js.map +1 -0
  47. package/dist/config/codex-config-overlay.d.ts +122 -0
  48. package/dist/config/codex-config-overlay.d.ts.map +1 -0
  49. package/dist/config/codex-config-overlay.js +352 -0
  50. package/dist/config/codex-config-overlay.js.map +1 -0
  51. package/dist/index.d.ts +15 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +37 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/intercept/forward-proxy.d.ts +77 -0
  56. package/dist/intercept/forward-proxy.d.ts.map +1 -0
  57. package/dist/intercept/forward-proxy.js +368 -0
  58. package/dist/intercept/forward-proxy.js.map +1 -0
  59. package/dist/intercept/header-redaction.d.ts +7 -0
  60. package/dist/intercept/header-redaction.d.ts.map +1 -0
  61. package/dist/intercept/header-redaction.js +28 -0
  62. package/dist/intercept/header-redaction.js.map +1 -0
  63. package/dist/intercept/interceptor-loader.js +26 -0
  64. package/dist/intercept/interceptor.d.ts +164 -0
  65. package/dist/intercept/interceptor.d.ts.map +1 -0
  66. package/dist/intercept/interceptor.js +496 -0
  67. package/dist/intercept/interceptor.js.map +1 -0
  68. package/dist/intercept/mitm-cert.d.ts +53 -0
  69. package/dist/intercept/mitm-cert.d.ts.map +1 -0
  70. package/dist/intercept/mitm-cert.js +259 -0
  71. package/dist/intercept/mitm-cert.js.map +1 -0
  72. package/dist/intercept/proxy-log-writer.d.ts +77 -0
  73. package/dist/intercept/proxy-log-writer.d.ts.map +1 -0
  74. package/dist/intercept/proxy-log-writer.js +323 -0
  75. package/dist/intercept/proxy-log-writer.js.map +1 -0
  76. package/dist/intercept/proxy-targets.d.ts +69 -0
  77. package/dist/intercept/proxy-targets.d.ts.map +1 -0
  78. package/dist/intercept/proxy-targets.js +129 -0
  79. package/dist/intercept/proxy-targets.js.map +1 -0
  80. package/dist/intercept/reverse-proxy.d.ts +191 -0
  81. package/dist/intercept/reverse-proxy.d.ts.map +1 -0
  82. package/dist/intercept/reverse-proxy.js +807 -0
  83. package/dist/intercept/reverse-proxy.js.map +1 -0
  84. package/dist/intercept/token-extractor.js +28 -0
  85. package/dist/report/html-generator.d.ts +96 -0
  86. package/dist/report/html-generator.d.ts.map +1 -0
  87. package/dist/report/html-generator.js +225 -0
  88. package/dist/report/html-generator.js.map +1 -0
  89. package/dist/report/index-generator.d.ts +89 -0
  90. package/dist/report/index-generator.d.ts.map +1 -0
  91. package/dist/report/index-generator.js +319 -0
  92. package/dist/report/index-generator.js.map +1 -0
  93. package/dist/report/shared-conversation-processor.d.ts +200 -0
  94. package/dist/report/shared-conversation-processor.d.ts.map +1 -0
  95. package/dist/report/shared-conversation-processor.js +720 -0
  96. package/dist/report/shared-conversation-processor.js.map +1 -0
  97. package/dist/routing/codex-routing.d.ts +40 -0
  98. package/dist/routing/codex-routing.d.ts.map +1 -0
  99. package/dist/routing/codex-routing.js +96 -0
  100. package/dist/routing/codex-routing.js.map +1 -0
  101. package/dist/routing/proxy-routing.d.ts +48 -0
  102. package/dist/routing/proxy-routing.d.ts.map +1 -0
  103. package/dist/routing/proxy-routing.js +113 -0
  104. package/dist/routing/proxy-routing.js.map +1 -0
  105. package/dist/tools/binary-utils.d.ts +29 -0
  106. package/dist/tools/binary-utils.d.ts.map +1 -0
  107. package/dist/tools/binary-utils.js +134 -0
  108. package/dist/tools/binary-utils.js.map +1 -0
  109. package/dist/tools/claude.d.ts +61 -0
  110. package/dist/tools/claude.d.ts.map +1 -0
  111. package/dist/tools/claude.js +449 -0
  112. package/dist/tools/claude.js.map +1 -0
  113. package/dist/tools/codex.d.ts +70 -0
  114. package/dist/tools/codex.d.ts.map +1 -0
  115. package/dist/tools/codex.js +492 -0
  116. package/dist/tools/codex.js.map +1 -0
  117. package/dist/tools/opencode.d.ts +85 -0
  118. package/dist/tools/opencode.d.ts.map +1 -0
  119. package/dist/tools/opencode.js +401 -0
  120. package/dist/tools/opencode.js.map +1 -0
  121. package/dist/tools/types.d.ts +91 -0
  122. package/dist/tools/types.d.ts.map +1 -0
  123. package/dist/tools/types.js +11 -0
  124. package/dist/tools/types.js.map +1 -0
  125. package/dist/types.d.ts +158 -0
  126. package/dist/types.d.ts.map +1 -0
  127. package/dist/types.js +12 -0
  128. package/dist/types.js.map +1 -0
  129. package/frontend/dist/index.global.js +1551 -0
  130. package/frontend/dist/styles.css +1027 -0
  131. package/frontend/template.html +19 -0
  132. package/node_modules/agent-base/LICENSE +22 -0
  133. package/node_modules/agent-base/README.md +69 -0
  134. package/node_modules/agent-base/dist/helpers.d.ts +15 -0
  135. package/node_modules/agent-base/dist/helpers.d.ts.map +1 -0
  136. package/node_modules/agent-base/dist/helpers.js +66 -0
  137. package/node_modules/agent-base/dist/helpers.js.map +1 -0
  138. package/node_modules/agent-base/dist/index.d.ts +41 -0
  139. package/node_modules/agent-base/dist/index.d.ts.map +1 -0
  140. package/node_modules/agent-base/dist/index.js +178 -0
  141. package/node_modules/agent-base/dist/index.js.map +1 -0
  142. package/node_modules/agent-base/package.json +46 -0
  143. package/node_modules/debug/LICENSE +20 -0
  144. package/node_modules/debug/README.md +481 -0
  145. package/node_modules/debug/package.json +64 -0
  146. package/node_modules/debug/src/browser.js +272 -0
  147. package/node_modules/debug/src/common.js +292 -0
  148. package/node_modules/debug/src/index.js +10 -0
  149. package/node_modules/debug/src/node.js +263 -0
  150. package/node_modules/http-proxy-agent/LICENSE +22 -0
  151. package/node_modules/http-proxy-agent/README.md +44 -0
  152. package/node_modules/http-proxy-agent/dist/index.d.ts +44 -0
  153. package/node_modules/http-proxy-agent/dist/index.d.ts.map +1 -0
  154. package/node_modules/http-proxy-agent/dist/index.js +148 -0
  155. package/node_modules/http-proxy-agent/dist/index.js.map +1 -0
  156. package/node_modules/http-proxy-agent/package.json +47 -0
  157. package/node_modules/https-proxy-agent/LICENSE +22 -0
  158. package/node_modules/https-proxy-agent/README.md +70 -0
  159. package/node_modules/https-proxy-agent/dist/index.d.ts +47 -0
  160. package/node_modules/https-proxy-agent/dist/index.d.ts.map +1 -0
  161. package/node_modules/https-proxy-agent/dist/index.js +180 -0
  162. package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  163. package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +15 -0
  164. package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map +1 -0
  165. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +101 -0
  166. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  167. package/node_modules/https-proxy-agent/package.json +50 -0
  168. package/node_modules/ms/index.js +162 -0
  169. package/node_modules/ms/license.md +21 -0
  170. package/node_modules/ms/package.json +38 -0
  171. package/node_modules/ms/readme.md +59 -0
  172. package/node_modules/node-forge/LICENSE +331 -0
  173. package/node_modules/node-forge/README.md +2071 -0
  174. package/node_modules/node-forge/dist/forge.all.min.js +2 -0
  175. package/node_modules/node-forge/dist/forge.all.min.js.map +1 -0
  176. package/node_modules/node-forge/dist/forge.min.js +2 -0
  177. package/node_modules/node-forge/dist/forge.min.js.map +1 -0
  178. package/node_modules/node-forge/dist/prime.worker.min.js +2 -0
  179. package/node_modules/node-forge/dist/prime.worker.min.js.map +1 -0
  180. package/node_modules/node-forge/flash/swf/SocketPool.swf +0 -0
  181. package/node_modules/node-forge/lib/aes.js +1091 -0
  182. package/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
  183. package/node_modules/node-forge/lib/asn1-validator.js +91 -0
  184. package/node_modules/node-forge/lib/asn1.js +1503 -0
  185. package/node_modules/node-forge/lib/baseN.js +186 -0
  186. package/node_modules/node-forge/lib/cipher.js +230 -0
  187. package/node_modules/node-forge/lib/cipherModes.js +999 -0
  188. package/node_modules/node-forge/lib/des.js +496 -0
  189. package/node_modules/node-forge/lib/ed25519.js +1091 -0
  190. package/node_modules/node-forge/lib/forge.js +13 -0
  191. package/node_modules/node-forge/lib/form.js +149 -0
  192. package/node_modules/node-forge/lib/hmac.js +146 -0
  193. package/node_modules/node-forge/lib/http.js +1346 -0
  194. package/node_modules/node-forge/lib/index.all.js +16 -0
  195. package/node_modules/node-forge/lib/index.js +33 -0
  196. package/node_modules/node-forge/lib/jsbn.js +1294 -0
  197. package/node_modules/node-forge/lib/kem.js +168 -0
  198. package/node_modules/node-forge/lib/log.js +319 -0
  199. package/node_modules/node-forge/lib/md.all.js +13 -0
  200. package/node_modules/node-forge/lib/md.js +11 -0
  201. package/node_modules/node-forge/lib/md5.js +289 -0
  202. package/node_modules/node-forge/lib/mgf.js +12 -0
  203. package/node_modules/node-forge/lib/mgf1.js +57 -0
  204. package/node_modules/node-forge/lib/oids.js +180 -0
  205. package/node_modules/node-forge/lib/pbe.js +1023 -0
  206. package/node_modules/node-forge/lib/pbkdf2.js +211 -0
  207. package/node_modules/node-forge/lib/pem.js +237 -0
  208. package/node_modules/node-forge/lib/pkcs1.js +276 -0
  209. package/node_modules/node-forge/lib/pkcs12.js +1078 -0
  210. package/node_modules/node-forge/lib/pkcs7.js +1260 -0
  211. package/node_modules/node-forge/lib/pkcs7asn1.js +410 -0
  212. package/node_modules/node-forge/lib/pki.js +102 -0
  213. package/node_modules/node-forge/lib/prime.js +297 -0
  214. package/node_modules/node-forge/lib/prime.worker.js +168 -0
  215. package/node_modules/node-forge/lib/prng.js +419 -0
  216. package/node_modules/node-forge/lib/pss.js +241 -0
  217. package/node_modules/node-forge/lib/random.js +191 -0
  218. package/node_modules/node-forge/lib/rc2.js +410 -0
  219. package/node_modules/node-forge/lib/rsa.js +1968 -0
  220. package/node_modules/node-forge/lib/sha1.js +319 -0
  221. package/node_modules/node-forge/lib/sha256.js +327 -0
  222. package/node_modules/node-forge/lib/sha512.js +561 -0
  223. package/node_modules/node-forge/lib/socket.js +287 -0
  224. package/node_modules/node-forge/lib/ssh.js +236 -0
  225. package/node_modules/node-forge/lib/tls.js +4282 -0
  226. package/node_modules/node-forge/lib/tlssocket.js +249 -0
  227. package/node_modules/node-forge/lib/util.js +2652 -0
  228. package/node_modules/node-forge/lib/x509.js +3251 -0
  229. package/node_modules/node-forge/lib/xhr.js +738 -0
  230. package/node_modules/node-forge/package.json +123 -0
  231. package/node_modules/smol-toml/LICENSE +24 -0
  232. package/node_modules/smol-toml/README.md +239 -0
  233. package/node_modules/smol-toml/dist/date.d.ts +41 -0
  234. package/node_modules/smol-toml/dist/date.js +127 -0
  235. package/node_modules/smol-toml/dist/error.d.ts +38 -0
  236. package/node_modules/smol-toml/dist/error.js +63 -0
  237. package/node_modules/smol-toml/dist/extract.d.ts +30 -0
  238. package/node_modules/smol-toml/dist/extract.js +100 -0
  239. package/node_modules/smol-toml/dist/index.cjs +897 -0
  240. package/node_modules/smol-toml/dist/index.d.ts +43 -0
  241. package/node_modules/smol-toml/dist/index.js +33 -0
  242. package/node_modules/smol-toml/dist/parse.d.ts +37 -0
  243. package/node_modules/smol-toml/dist/parse.js +148 -0
  244. package/node_modules/smol-toml/dist/primitive.d.ts +31 -0
  245. package/node_modules/smol-toml/dist/primitive.js +179 -0
  246. package/node_modules/smol-toml/dist/stringify.d.ts +31 -0
  247. package/node_modules/smol-toml/dist/stringify.js +167 -0
  248. package/node_modules/smol-toml/dist/struct.d.ts +32 -0
  249. package/node_modules/smol-toml/dist/struct.js +184 -0
  250. package/node_modules/smol-toml/dist/util.d.ts +42 -0
  251. package/node_modules/smol-toml/dist/util.js +111 -0
  252. package/node_modules/smol-toml/package.json +54 -0
  253. package/offline/bin/claude-trace +6 -0
  254. package/offline/bin/claude-wrapper +13 -0
  255. package/offline/bin/install-agent +14 -0
  256. package/offline/bin/validate-trace +6 -0
  257. package/offline/bin/verify-bundle +7 -0
  258. package/package.json +103 -0
@@ -0,0 +1,47 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ /// <reference types="node" />
5
+ import * as net from 'net';
6
+ import * as tls from 'tls';
7
+ import * as http from 'http';
8
+ import { Agent, AgentConnectOpts } from 'agent-base';
9
+ import { URL } from 'url';
10
+ import type { OutgoingHttpHeaders } from 'http';
11
+ type Protocol<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;
12
+ type ConnectOptsMap = {
13
+ http: Omit<net.TcpNetConnectOpts, 'host' | 'port'>;
14
+ https: Omit<tls.ConnectionOptions, 'host' | 'port'>;
15
+ };
16
+ type ConnectOpts<T> = {
17
+ [P in keyof ConnectOptsMap]: Protocol<T> extends P ? ConnectOptsMap[P] : never;
18
+ }[keyof ConnectOptsMap];
19
+ export type HttpsProxyAgentOptions<T> = ConnectOpts<T> & http.AgentOptions & {
20
+ headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
21
+ };
22
+ /**
23
+ * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
24
+ * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
25
+ *
26
+ * Outgoing HTTP requests are first tunneled through the proxy server using the
27
+ * `CONNECT` HTTP request method to establish a connection to the proxy server,
28
+ * and then the proxy server connects to the destination target and issues the
29
+ * HTTP request from the proxy server.
30
+ *
31
+ * `https:` requests have their socket connection upgraded to TLS once
32
+ * the connection to the proxy server has been established.
33
+ */
34
+ export declare class HttpsProxyAgent<Uri extends string> extends Agent {
35
+ static protocols: readonly ["http", "https"];
36
+ readonly proxy: URL;
37
+ proxyHeaders: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
38
+ connectOpts: net.TcpNetConnectOpts & tls.ConnectionOptions;
39
+ constructor(proxy: Uri | URL, opts?: HttpsProxyAgentOptions<Uri>);
40
+ /**
41
+ * Called when the node-core HTTP client library is creating a
42
+ * new HTTP request.
43
+ */
44
+ connect(req: http.ClientRequest, opts: AgentConnectOpts): Promise<net.Socket>;
45
+ }
46
+ export {};
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAuBhD,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,MAAM,QAAQ,IAAI,MAAM,CAAC,EAAE,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE/E,KAAK,cAAc,GAAG;IACrB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACnD,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CACpD,CAAC;AAEF,KAAK,WAAW,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,GAC/C,cAAc,CAAC,CAAC,CAAC,GACjB,KAAK;CACR,CAAC,MAAM,cAAc,CAAC,CAAC;AAExB,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GACrD,IAAI,CAAC,YAAY,GAAG;IACnB,OAAO,CAAC,EAAE,mBAAmB,GAAG,CAAC,MAAM,mBAAmB,CAAC,CAAC;CAC5D,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,qBAAa,eAAe,CAAC,GAAG,SAAS,MAAM,CAAE,SAAQ,KAAK;IAC7D,MAAM,CAAC,SAAS,6BAA8B;IAE9C,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;IACpB,YAAY,EAAE,mBAAmB,GAAG,CAAC,MAAM,mBAAmB,CAAC,CAAC;IAChE,WAAW,EAAE,GAAG,CAAC,iBAAiB,GAAG,GAAG,CAAC,iBAAiB,CAAC;gBAE/C,KAAK,EAAE,GAAG,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,sBAAsB,CAAC,GAAG,CAAC;IA0BhE;;;OAGG;IACG,OAAO,CACZ,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,IAAI,EAAE,gBAAgB,GACpB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;CAwGtB"}
@@ -0,0 +1,180 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.HttpsProxyAgent = void 0;
30
+ const net = __importStar(require("net"));
31
+ const tls = __importStar(require("tls"));
32
+ const assert_1 = __importDefault(require("assert"));
33
+ const debug_1 = __importDefault(require("debug"));
34
+ const agent_base_1 = require("agent-base");
35
+ const url_1 = require("url");
36
+ const parse_proxy_response_1 = require("./parse-proxy-response");
37
+ const debug = (0, debug_1.default)('https-proxy-agent');
38
+ const setServernameFromNonIpHost = (options) => {
39
+ if (options.servername === undefined &&
40
+ options.host &&
41
+ !net.isIP(options.host)) {
42
+ return {
43
+ ...options,
44
+ servername: options.host,
45
+ };
46
+ }
47
+ return options;
48
+ };
49
+ /**
50
+ * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
51
+ * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
52
+ *
53
+ * Outgoing HTTP requests are first tunneled through the proxy server using the
54
+ * `CONNECT` HTTP request method to establish a connection to the proxy server,
55
+ * and then the proxy server connects to the destination target and issues the
56
+ * HTTP request from the proxy server.
57
+ *
58
+ * `https:` requests have their socket connection upgraded to TLS once
59
+ * the connection to the proxy server has been established.
60
+ */
61
+ class HttpsProxyAgent extends agent_base_1.Agent {
62
+ constructor(proxy, opts) {
63
+ super(opts);
64
+ this.options = { path: undefined };
65
+ this.proxy = typeof proxy === 'string' ? new url_1.URL(proxy) : proxy;
66
+ this.proxyHeaders = opts?.headers ?? {};
67
+ debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);
68
+ // Trim off the brackets from IPv6 addresses
69
+ const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, '');
70
+ const port = this.proxy.port
71
+ ? parseInt(this.proxy.port, 10)
72
+ : this.proxy.protocol === 'https:'
73
+ ? 443
74
+ : 80;
75
+ this.connectOpts = {
76
+ // Attempt to negotiate http/1.1 for proxy servers that support http/2
77
+ ALPNProtocols: ['http/1.1'],
78
+ ...(opts ? omit(opts, 'headers') : null),
79
+ host,
80
+ port,
81
+ };
82
+ }
83
+ /**
84
+ * Called when the node-core HTTP client library is creating a
85
+ * new HTTP request.
86
+ */
87
+ async connect(req, opts) {
88
+ const { proxy } = this;
89
+ if (!opts.host) {
90
+ throw new TypeError('No "host" provided');
91
+ }
92
+ // Create a socket connection to the proxy server.
93
+ let socket;
94
+ if (proxy.protocol === 'https:') {
95
+ debug('Creating `tls.Socket`: %o', this.connectOpts);
96
+ socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
97
+ }
98
+ else {
99
+ debug('Creating `net.Socket`: %o', this.connectOpts);
100
+ socket = net.connect(this.connectOpts);
101
+ }
102
+ const headers = typeof this.proxyHeaders === 'function'
103
+ ? this.proxyHeaders()
104
+ : { ...this.proxyHeaders };
105
+ const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
106
+ let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r\n`;
107
+ // Inject the `Proxy-Authorization` header if necessary.
108
+ if (proxy.username || proxy.password) {
109
+ const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
110
+ headers['Proxy-Authorization'] = `Basic ${Buffer.from(auth).toString('base64')}`;
111
+ }
112
+ headers.Host = `${host}:${opts.port}`;
113
+ if (!headers['Proxy-Connection']) {
114
+ headers['Proxy-Connection'] = this.keepAlive
115
+ ? 'Keep-Alive'
116
+ : 'close';
117
+ }
118
+ for (const name of Object.keys(headers)) {
119
+ payload += `${name}: ${headers[name]}\r\n`;
120
+ }
121
+ const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
122
+ socket.write(`${payload}\r\n`);
123
+ const { connect, buffered } = await proxyResponsePromise;
124
+ req.emit('proxyConnect', connect);
125
+ this.emit('proxyConnect', connect, req);
126
+ if (connect.statusCode === 200) {
127
+ req.once('socket', resume);
128
+ if (opts.secureEndpoint) {
129
+ // The proxy is connecting to a TLS server, so upgrade
130
+ // this socket connection to a TLS connection.
131
+ debug('Upgrading socket connection to TLS');
132
+ return tls.connect({
133
+ ...omit(setServernameFromNonIpHost(opts), 'host', 'path', 'port'),
134
+ socket,
135
+ });
136
+ }
137
+ return socket;
138
+ }
139
+ // Some other status code that's not 200... need to re-play the HTTP
140
+ // header "data" events onto the socket once the HTTP machinery is
141
+ // attached so that the node core `http` can parse and handle the
142
+ // error status code.
143
+ // Close the original socket, and a new "fake" socket is returned
144
+ // instead, so that the proxy doesn't get the HTTP request
145
+ // written to it (which may contain `Authorization` headers or other
146
+ // sensitive data).
147
+ //
148
+ // See: https://hackerone.com/reports/541502
149
+ socket.destroy();
150
+ const fakeSocket = new net.Socket({ writable: false });
151
+ fakeSocket.readable = true;
152
+ // Need to wait for the "socket" event to re-play the "data" events.
153
+ req.once('socket', (s) => {
154
+ debug('Replaying proxy buffer for failed request');
155
+ (0, assert_1.default)(s.listenerCount('data') > 0);
156
+ // Replay the "buffered" Buffer onto the fake `socket`, since at
157
+ // this point the HTTP module machinery has been hooked up for
158
+ // the user.
159
+ s.push(buffered);
160
+ s.push(null);
161
+ });
162
+ return fakeSocket;
163
+ }
164
+ }
165
+ HttpsProxyAgent.protocols = ['http', 'https'];
166
+ exports.HttpsProxyAgent = HttpsProxyAgent;
167
+ function resume(socket) {
168
+ socket.resume();
169
+ }
170
+ function omit(obj, ...keys) {
171
+ const ret = {};
172
+ let key;
173
+ for (key in obj) {
174
+ if (!keys.includes(key)) {
175
+ ret[key] = obj[key];
176
+ }
177
+ }
178
+ return ret;
179
+ }
180
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,yCAA2B;AAE3B,oDAA4B;AAC5B,kDAAgC;AAChC,2CAAqD;AACrD,6BAA0B;AAC1B,iEAA4D;AAG5D,MAAM,KAAK,GAAG,IAAA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B,KAAK,GAAG,IAAI,GAAG,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { IncomingHttpHeaders } from 'http';
5
+ import { Readable } from 'stream';
6
+ export interface ConnectResponse {
7
+ statusCode: number;
8
+ statusText: string;
9
+ headers: IncomingHttpHeaders;
10
+ }
11
+ export declare function parseProxyResponse(socket: Readable): Promise<{
12
+ connect: ConnectResponse;
13
+ buffered: Buffer;
14
+ }>;
15
+ //# sourceMappingURL=parse-proxy-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-proxy-response.d.ts","sourceRoot":"","sources":["../src/parse-proxy-response.ts"],"names":[],"mappings":";;;AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAIlC,MAAM,WAAW,eAAe;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,mBAAmB,CAAC;CAC7B;AAED,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,QAAQ,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAyGzD"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parseProxyResponse = void 0;
7
+ const debug_1 = __importDefault(require("debug"));
8
+ const debug = (0, debug_1.default)('https-proxy-agent:parse-proxy-response');
9
+ function parseProxyResponse(socket) {
10
+ return new Promise((resolve, reject) => {
11
+ // we need to buffer any HTTP traffic that happens with the proxy before we get
12
+ // the CONNECT response, so that if the response is anything other than an "200"
13
+ // response code, then we can re-play the "data" events on the socket once the
14
+ // HTTP parser is hooked up...
15
+ let buffersLength = 0;
16
+ const buffers = [];
17
+ function read() {
18
+ const b = socket.read();
19
+ if (b)
20
+ ondata(b);
21
+ else
22
+ socket.once('readable', read);
23
+ }
24
+ function cleanup() {
25
+ socket.removeListener('end', onend);
26
+ socket.removeListener('error', onerror);
27
+ socket.removeListener('readable', read);
28
+ }
29
+ function onend() {
30
+ cleanup();
31
+ debug('onend');
32
+ reject(new Error('Proxy connection ended before receiving CONNECT response'));
33
+ }
34
+ function onerror(err) {
35
+ cleanup();
36
+ debug('onerror %o', err);
37
+ reject(err);
38
+ }
39
+ function ondata(b) {
40
+ buffers.push(b);
41
+ buffersLength += b.length;
42
+ const buffered = Buffer.concat(buffers, buffersLength);
43
+ const endOfHeaders = buffered.indexOf('\r\n\r\n');
44
+ if (endOfHeaders === -1) {
45
+ // keep buffering
46
+ debug('have not received end of HTTP headers yet...');
47
+ read();
48
+ return;
49
+ }
50
+ const headerParts = buffered
51
+ .slice(0, endOfHeaders)
52
+ .toString('ascii')
53
+ .split('\r\n');
54
+ const firstLine = headerParts.shift();
55
+ if (!firstLine) {
56
+ socket.destroy();
57
+ return reject(new Error('No header received from proxy CONNECT response'));
58
+ }
59
+ const firstLineParts = firstLine.split(' ');
60
+ const statusCode = +firstLineParts[1];
61
+ const statusText = firstLineParts.slice(2).join(' ');
62
+ const headers = {};
63
+ for (const header of headerParts) {
64
+ if (!header)
65
+ continue;
66
+ const firstColon = header.indexOf(':');
67
+ if (firstColon === -1) {
68
+ socket.destroy();
69
+ return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
70
+ }
71
+ const key = header.slice(0, firstColon).toLowerCase();
72
+ const value = header.slice(firstColon + 1).trimStart();
73
+ const current = headers[key];
74
+ if (typeof current === 'string') {
75
+ headers[key] = [current, value];
76
+ }
77
+ else if (Array.isArray(current)) {
78
+ current.push(value);
79
+ }
80
+ else {
81
+ headers[key] = value;
82
+ }
83
+ }
84
+ debug('got proxy server response: %o %o', firstLine, headers);
85
+ cleanup();
86
+ resolve({
87
+ connect: {
88
+ statusCode,
89
+ statusText,
90
+ headers,
91
+ },
92
+ buffered,
93
+ });
94
+ }
95
+ socket.on('error', onerror);
96
+ socket.on('end', onend);
97
+ read();
98
+ });
99
+ }
100
+ exports.parseProxyResponse = parseProxyResponse;
101
+ //# sourceMappingURL=parse-proxy-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-proxy-response.js","sourceRoot":"","sources":["../src/parse-proxy-response.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAgC;AAIhC,MAAM,KAAK,GAAG,IAAA,eAAW,EAAC,wCAAwC,CAAC,CAAC;AAQpE,SAAgB,kBAAkB,CACjC,MAAgB;IAEhB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,+EAA+E;QAC/E,gFAAgF;QAChF,8EAA8E;QAC9E,8BAA8B;QAC9B,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,SAAS,IAAI;YACZ,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC;gBAAE,MAAM,CAAC,CAAC,CAAC,CAAC;;gBACZ,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;QAED,SAAS,OAAO;YACf,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACpC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC;QAED,S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EAAE,KAAK,CAAC,CAAC;QAExB,IAAI,EAAE,CAAC;IACR,CAAC,CAAC,CAAC;AACJ,CAAC;AA3GD,gDA2GC"}
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "https-proxy-agent",
3
+ "version": "7.0.6",
4
+ "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/TooTallNate/proxy-agents.git",
13
+ "directory": "packages/https-proxy-agent"
14
+ },
15
+ "keywords": [
16
+ "https",
17
+ "proxy",
18
+ "endpoint",
19
+ "agent"
20
+ ],
21
+ "author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
22
+ "license": "MIT",
23
+ "dependencies": {
24
+ "agent-base": "^7.1.2",
25
+ "debug": "4"
26
+ },
27
+ "devDependencies": {
28
+ "@types/async-retry": "^1.4.5",
29
+ "@types/debug": "4",
30
+ "@types/jest": "^29.5.1",
31
+ "@types/node": "^14.18.45",
32
+ "async-listen": "^3.0.0",
33
+ "async-retry": "^1.3.3",
34
+ "jest": "^29.5.0",
35
+ "ts-jest": "^29.1.0",
36
+ "typescript": "^5.0.4",
37
+ "proxy": "2.2.0",
38
+ "tsconfig": "0.0.0"
39
+ },
40
+ "engines": {
41
+ "node": ">= 14"
42
+ },
43
+ "scripts": {
44
+ "build": "tsc",
45
+ "test": "jest --env node --verbose --bail test/test.ts",
46
+ "test-e2e": "jest --env node --verbose --bail test/e2e.test.ts",
47
+ "lint": "eslint --ext .ts",
48
+ "pack": "node ../../scripts/pack.mjs"
49
+ }
50
+ }
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Helpers.
3
+ */
4
+
5
+ var s = 1000;
6
+ var m = s * 60;
7
+ var h = m * 60;
8
+ var d = h * 24;
9
+ var w = d * 7;
10
+ var y = d * 365.25;
11
+
12
+ /**
13
+ * Parse or format the given `val`.
14
+ *
15
+ * Options:
16
+ *
17
+ * - `long` verbose formatting [false]
18
+ *
19
+ * @param {String|Number} val
20
+ * @param {Object} [options]
21
+ * @throws {Error} throw an error if val is not a non-empty string or a number
22
+ * @return {String|Number}
23
+ * @api public
24
+ */
25
+
26
+ module.exports = function (val, options) {
27
+ options = options || {};
28
+ var type = typeof val;
29
+ if (type === 'string' && val.length > 0) {
30
+ return parse(val);
31
+ } else if (type === 'number' && isFinite(val)) {
32
+ return options.long ? fmtLong(val) : fmtShort(val);
33
+ }
34
+ throw new Error(
35
+ 'val is not a non-empty string or a valid number. val=' +
36
+ JSON.stringify(val)
37
+ );
38
+ };
39
+
40
+ /**
41
+ * Parse the given `str` and return milliseconds.
42
+ *
43
+ * @param {String} str
44
+ * @return {Number}
45
+ * @api private
46
+ */
47
+
48
+ function parse(str) {
49
+ str = String(str);
50
+ if (str.length > 100) {
51
+ return;
52
+ }
53
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
54
+ str
55
+ );
56
+ if (!match) {
57
+ return;
58
+ }
59
+ var n = parseFloat(match[1]);
60
+ var type = (match[2] || 'ms').toLowerCase();
61
+ switch (type) {
62
+ case 'years':
63
+ case 'year':
64
+ case 'yrs':
65
+ case 'yr':
66
+ case 'y':
67
+ return n * y;
68
+ case 'weeks':
69
+ case 'week':
70
+ case 'w':
71
+ return n * w;
72
+ case 'days':
73
+ case 'day':
74
+ case 'd':
75
+ return n * d;
76
+ case 'hours':
77
+ case 'hour':
78
+ case 'hrs':
79
+ case 'hr':
80
+ case 'h':
81
+ return n * h;
82
+ case 'minutes':
83
+ case 'minute':
84
+ case 'mins':
85
+ case 'min':
86
+ case 'm':
87
+ return n * m;
88
+ case 'seconds':
89
+ case 'second':
90
+ case 'secs':
91
+ case 'sec':
92
+ case 's':
93
+ return n * s;
94
+ case 'milliseconds':
95
+ case 'millisecond':
96
+ case 'msecs':
97
+ case 'msec':
98
+ case 'ms':
99
+ return n;
100
+ default:
101
+ return undefined;
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Short format for `ms`.
107
+ *
108
+ * @param {Number} ms
109
+ * @return {String}
110
+ * @api private
111
+ */
112
+
113
+ function fmtShort(ms) {
114
+ var msAbs = Math.abs(ms);
115
+ if (msAbs >= d) {
116
+ return Math.round(ms / d) + 'd';
117
+ }
118
+ if (msAbs >= h) {
119
+ return Math.round(ms / h) + 'h';
120
+ }
121
+ if (msAbs >= m) {
122
+ return Math.round(ms / m) + 'm';
123
+ }
124
+ if (msAbs >= s) {
125
+ return Math.round(ms / s) + 's';
126
+ }
127
+ return ms + 'ms';
128
+ }
129
+
130
+ /**
131
+ * Long format for `ms`.
132
+ *
133
+ * @param {Number} ms
134
+ * @return {String}
135
+ * @api private
136
+ */
137
+
138
+ function fmtLong(ms) {
139
+ var msAbs = Math.abs(ms);
140
+ if (msAbs >= d) {
141
+ return plural(ms, msAbs, d, 'day');
142
+ }
143
+ if (msAbs >= h) {
144
+ return plural(ms, msAbs, h, 'hour');
145
+ }
146
+ if (msAbs >= m) {
147
+ return plural(ms, msAbs, m, 'minute');
148
+ }
149
+ if (msAbs >= s) {
150
+ return plural(ms, msAbs, s, 'second');
151
+ }
152
+ return ms + ' ms';
153
+ }
154
+
155
+ /**
156
+ * Pluralization helper.
157
+ */
158
+
159
+ function plural(ms, msAbs, n, name) {
160
+ var isPlural = msAbs >= n * 1.5;
161
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
162
+ }
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Vercel, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "ms",
3
+ "version": "2.1.3",
4
+ "description": "Tiny millisecond conversion utility",
5
+ "repository": "vercel/ms",
6
+ "main": "./index",
7
+ "files": [
8
+ "index.js"
9
+ ],
10
+ "scripts": {
11
+ "precommit": "lint-staged",
12
+ "lint": "eslint lib/* bin/*",
13
+ "test": "mocha tests.js"
14
+ },
15
+ "eslintConfig": {
16
+ "extends": "eslint:recommended",
17
+ "env": {
18
+ "node": true,
19
+ "es6": true
20
+ }
21
+ },
22
+ "lint-staged": {
23
+ "*.js": [
24
+ "npm run lint",
25
+ "prettier --single-quote --write",
26
+ "git add"
27
+ ]
28
+ },
29
+ "license": "MIT",
30
+ "devDependencies": {
31
+ "eslint": "4.18.2",
32
+ "expect.js": "0.3.1",
33
+ "husky": "0.14.3",
34
+ "lint-staged": "5.0.0",
35
+ "mocha": "4.0.1",
36
+ "prettier": "2.0.5"
37
+ }
38
+ }