recker 1.0.15-next.0e216c0 → 1.0.15-next.0eabd39

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 (108) hide show
  1. package/README.md +10 -1
  2. package/dist/ai/providers/anthropic.d.ts.map +1 -1
  3. package/dist/ai/providers/anthropic.js +4 -1
  4. package/dist/ai/providers/base.d.ts.map +1 -1
  5. package/dist/ai/providers/base.js +7 -2
  6. package/dist/ai/rate-limiter.d.ts.map +1 -1
  7. package/dist/ai/rate-limiter.js +4 -1
  8. package/dist/bench/generator.d.ts.map +1 -1
  9. package/dist/bench/generator.js +7 -3
  10. package/dist/bench/stats.d.ts.map +1 -1
  11. package/dist/bench/stats.js +43 -10
  12. package/dist/cache/memory-storage.d.ts.map +1 -1
  13. package/dist/cache/memory-storage.js +3 -2
  14. package/dist/cli/handler.js +14 -14
  15. package/dist/cli/index.js +582 -49
  16. package/dist/cli/presets.js +5 -5
  17. package/dist/cli/tui/ai-chat.js +10 -10
  18. package/dist/cli/tui/load-dashboard.d.ts.map +1 -1
  19. package/dist/cli/tui/load-dashboard.js +96 -55
  20. package/dist/cli/tui/scroll-buffer.d.ts +1 -1
  21. package/dist/cli/tui/scroll-buffer.d.ts.map +1 -1
  22. package/dist/cli/tui/scroll-buffer.js +2 -2
  23. package/dist/cli/tui/shell.d.ts +3 -0
  24. package/dist/cli/tui/shell.d.ts.map +1 -1
  25. package/dist/cli/tui/shell.js +202 -14
  26. package/dist/cli/tui/websocket.js +17 -17
  27. package/dist/core/client.d.ts.map +1 -1
  28. package/dist/core/client.js +18 -26
  29. package/dist/core/errors.d.ts +109 -1
  30. package/dist/core/errors.d.ts.map +1 -1
  31. package/dist/core/errors.js +214 -1
  32. package/dist/core/request-promise.d.ts.map +1 -1
  33. package/dist/core/request-promise.js +5 -6
  34. package/dist/core/response.d.ts.map +1 -1
  35. package/dist/core/response.js +5 -6
  36. package/dist/dns/propagation.d.ts +3 -1
  37. package/dist/dns/propagation.d.ts.map +1 -1
  38. package/dist/dns/propagation.js +99 -59
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +1 -0
  42. package/dist/mcp/client.d.ts.map +1 -1
  43. package/dist/mcp/client.js +10 -11
  44. package/dist/mcp/embeddings-loader.d.ts.map +1 -1
  45. package/dist/mcp/embeddings-loader.js +12 -2
  46. package/dist/mcp/geoip-loader.d.ts +11 -0
  47. package/dist/mcp/geoip-loader.d.ts.map +1 -0
  48. package/dist/mcp/geoip-loader.js +107 -0
  49. package/dist/mcp/ip-intel.d.ts +28 -0
  50. package/dist/mcp/ip-intel.d.ts.map +1 -0
  51. package/dist/mcp/ip-intel.js +209 -0
  52. package/dist/mcp/search/hybrid-search.d.ts.map +1 -1
  53. package/dist/mcp/search/hybrid-search.js +5 -1
  54. package/dist/mcp/search/math.d.ts.map +1 -1
  55. package/dist/mcp/search/math.js +5 -1
  56. package/dist/mcp/server.d.ts +4 -0
  57. package/dist/mcp/server.d.ts.map +1 -1
  58. package/dist/mcp/server.js +114 -1
  59. package/dist/plugins/compression.js +4 -2
  60. package/dist/plugins/har-player.d.ts.map +1 -1
  61. package/dist/plugins/har-player.js +8 -11
  62. package/dist/plugins/odata.d.ts.map +1 -1
  63. package/dist/plugins/odata.js +5 -2
  64. package/dist/protocols/ftp.d.ts.map +1 -1
  65. package/dist/protocols/ftp.js +69 -16
  66. package/dist/protocols/sftp.d.ts.map +1 -1
  67. package/dist/protocols/sftp.js +13 -3
  68. package/dist/protocols/telnet.d.ts.map +1 -1
  69. package/dist/protocols/telnet.js +25 -6
  70. package/dist/transport/base-udp.d.ts.map +1 -1
  71. package/dist/transport/base-udp.js +7 -4
  72. package/dist/transport/udp-response.d.ts.map +1 -1
  73. package/dist/transport/udp-response.js +10 -3
  74. package/dist/transport/udp.d.ts.map +1 -1
  75. package/dist/transport/udp.js +5 -1
  76. package/dist/transport/undici.d.ts.map +1 -1
  77. package/dist/transport/undici.js +75 -63
  78. package/dist/utils/agent-manager.d.ts +1 -0
  79. package/dist/utils/agent-manager.d.ts.map +1 -1
  80. package/dist/utils/agent-manager.js +11 -0
  81. package/dist/utils/client-pool.d.ts.map +1 -1
  82. package/dist/utils/client-pool.js +4 -1
  83. package/dist/utils/dns-toolkit.d.ts +88 -1
  84. package/dist/utils/dns-toolkit.d.ts.map +1 -1
  85. package/dist/utils/dns-toolkit.js +704 -6
  86. package/dist/utils/doh.d.ts.map +1 -1
  87. package/dist/utils/doh.js +13 -16
  88. package/dist/utils/download.d.ts.map +1 -1
  89. package/dist/utils/download.js +10 -11
  90. package/dist/utils/rdap.d.ts +9 -0
  91. package/dist/utils/rdap.d.ts.map +1 -1
  92. package/dist/utils/rdap.js +78 -9
  93. package/dist/utils/security-grader.d.ts +47 -0
  94. package/dist/utils/security-grader.d.ts.map +1 -0
  95. package/dist/utils/security-grader.js +637 -0
  96. package/dist/utils/sparkline.d.ts +18 -0
  97. package/dist/utils/sparkline.d.ts.map +1 -0
  98. package/dist/utils/sparkline.js +55 -0
  99. package/dist/utils/sse.d.ts.map +1 -1
  100. package/dist/utils/sse.js +5 -6
  101. package/dist/utils/system-metrics.d.ts +26 -0
  102. package/dist/utils/system-metrics.d.ts.map +1 -0
  103. package/dist/utils/system-metrics.js +81 -0
  104. package/dist/webrtc/index.d.ts.map +1 -1
  105. package/dist/webrtc/index.js +21 -7
  106. package/dist/websocket/client.d.ts.map +1 -1
  107. package/dist/websocket/client.js +13 -16
  108. package/package.json +3 -2
@@ -38,7 +38,8 @@ export class TimeoutError extends ReckerError {
38
38
  socket: 'Socket assignment timed out (connection pool exhausted)',
39
39
  send: 'Request body upload timed out',
40
40
  response: 'Waiting for response timed out (TTFB)',
41
- request: 'Request timed out (total time exceeded)'
41
+ request: 'Request timed out (total time exceeded)',
42
+ 'webrtc-connect': 'WebRTC peer connection timed out'
42
43
  };
43
44
  let message = phaseMessages[phase];
44
45
  if (timeout !== undefined) {
@@ -93,3 +94,215 @@ export class MaxSizeExceededError extends ReckerError {
93
94
  function isRetryableStatus(status) {
94
95
  return [408, 425, 429, 500, 502, 503, 504].includes(status);
95
96
  }
97
+ export class AbortError extends ReckerError {
98
+ reason;
99
+ constructor(reason, request) {
100
+ super(reason || 'Request was aborted', request, undefined, [
101
+ 'Check if the abort was intentional (user-triggered or timeout).',
102
+ 'Increase timeout if the request needs more time to complete.',
103
+ 'Ensure AbortController is not being triggered prematurely.'
104
+ ], true);
105
+ this.name = 'AbortError';
106
+ this.reason = reason;
107
+ }
108
+ }
109
+ export class ConnectionError extends ReckerError {
110
+ host;
111
+ port;
112
+ code;
113
+ constructor(message, options) {
114
+ super(message, options?.request, undefined, [
115
+ 'Verify the host and port are correct and the service is running.',
116
+ 'Check network connectivity and firewall rules.',
117
+ 'Ensure the service is accepting connections on the specified port.'
118
+ ], options?.retriable ?? true);
119
+ this.name = 'ConnectionError';
120
+ this.host = options?.host;
121
+ this.port = options?.port;
122
+ this.code = options?.code;
123
+ }
124
+ }
125
+ export class AuthenticationError extends ReckerError {
126
+ authType;
127
+ constructor(message, options) {
128
+ super(message, options?.request, undefined, [
129
+ 'Verify credentials (username/password, API key, or certificate).',
130
+ 'Check if the account is active and has proper permissions.',
131
+ 'Ensure the authentication method matches what the server expects.'
132
+ ], false);
133
+ this.name = 'AuthenticationError';
134
+ this.authType = options?.authType;
135
+ }
136
+ }
137
+ export class ProtocolError extends ReckerError {
138
+ protocol;
139
+ code;
140
+ phase;
141
+ constructor(message, options) {
142
+ const protocolSuggestions = {
143
+ ftp: [
144
+ 'Ensure the FTP server is running and accessible.',
145
+ 'Check file/directory permissions on the server.',
146
+ 'Verify the path exists and is correct.'
147
+ ],
148
+ sftp: [
149
+ 'Verify SSH credentials and key permissions.',
150
+ 'Check that the SFTP subsystem is enabled on the server.',
151
+ 'Ensure the target path exists and is accessible.'
152
+ ],
153
+ telnet: [
154
+ 'Verify the Telnet service is running on the target host.',
155
+ 'Check login credentials and terminal settings.',
156
+ 'Ensure the expected prompts match the server output.'
157
+ ],
158
+ udp: [
159
+ 'UDP is connectionless - verify the target is listening.',
160
+ 'Check firewall rules for UDP traffic.',
161
+ 'Ensure the message format matches what the server expects.'
162
+ ],
163
+ webrtc: [
164
+ 'Verify the signaling server is reachable.',
165
+ 'Check ICE server configuration (STUN/TURN).',
166
+ 'Ensure both peers have compatible codecs and capabilities.'
167
+ ],
168
+ dns: [
169
+ 'Verify the DNS server is reachable.',
170
+ 'Check if the domain exists and has the requested record type.',
171
+ 'Try an alternative DNS resolver.'
172
+ ],
173
+ tls: [
174
+ 'Verify the certificate is valid and not expired.',
175
+ 'Check that the hostname matches the certificate.',
176
+ 'Ensure TLS version and cipher suites are compatible.'
177
+ ]
178
+ };
179
+ const suggestions = protocolSuggestions[options.protocol.toLowerCase()] || [
180
+ 'Check the protocol-specific documentation.',
181
+ 'Verify the server supports the requested operation.',
182
+ 'Review the error code for specific guidance.'
183
+ ];
184
+ super(message, options.request, undefined, suggestions, options.retriable ?? false);
185
+ this.name = 'ProtocolError';
186
+ this.protocol = options.protocol;
187
+ this.code = options.code;
188
+ this.phase = options.phase;
189
+ }
190
+ }
191
+ export class NotFoundError extends ReckerError {
192
+ resource;
193
+ constructor(message, options) {
194
+ super(message, options?.request, undefined, [
195
+ 'Verify the resource path or identifier is correct.',
196
+ 'Check if the resource was deleted or moved.',
197
+ 'Ensure you have permission to access this resource.'
198
+ ], false);
199
+ this.name = 'NotFoundError';
200
+ this.resource = options?.resource;
201
+ }
202
+ }
203
+ export class StateError extends ReckerError {
204
+ expectedState;
205
+ actualState;
206
+ constructor(message, options) {
207
+ super(message, options?.request, undefined, [
208
+ 'Ensure the required setup/initialization step was performed.',
209
+ 'Check that operations are called in the correct order.',
210
+ 'Verify the connection or resource is still valid.'
211
+ ], false);
212
+ this.name = 'StateError';
213
+ this.expectedState = options?.expectedState;
214
+ this.actualState = options?.actualState;
215
+ }
216
+ }
217
+ export class ValidationError extends ReckerError {
218
+ field;
219
+ value;
220
+ constructor(message, options) {
221
+ super(message, options?.request, undefined, [
222
+ 'Check the input format and constraints.',
223
+ 'Refer to the API documentation for valid values.',
224
+ 'Ensure required fields are provided.'
225
+ ], false);
226
+ this.name = 'ValidationError';
227
+ this.field = options?.field;
228
+ this.value = options?.value;
229
+ }
230
+ }
231
+ export class ConfigurationError extends ReckerError {
232
+ configKey;
233
+ constructor(message, options) {
234
+ super(message, options?.request, undefined, [
235
+ 'Check the configuration file or environment variables.',
236
+ 'Ensure all required configuration keys are set.',
237
+ 'Verify the configuration values are in the correct format.'
238
+ ], false);
239
+ this.name = 'ConfigurationError';
240
+ this.configKey = options?.configKey;
241
+ }
242
+ }
243
+ export class UnsupportedError extends ReckerError {
244
+ feature;
245
+ constructor(message, options) {
246
+ super(message, options?.request, undefined, [
247
+ 'Check if this feature is supported in the current context.',
248
+ 'Refer to the documentation for supported operations.',
249
+ 'Consider using an alternative approach.'
250
+ ], false);
251
+ this.name = 'UnsupportedError';
252
+ this.feature = options?.feature;
253
+ }
254
+ }
255
+ export class ParseError extends ReckerError {
256
+ format;
257
+ position;
258
+ constructor(message, options) {
259
+ super(message, options?.request, undefined, [
260
+ 'Verify the input is in the expected format.',
261
+ 'Check for malformed or corrupted data.',
262
+ 'Ensure the encoding is correct (UTF-8, etc.).'
263
+ ], false);
264
+ this.name = 'ParseError';
265
+ this.format = options?.format;
266
+ this.position = options?.position;
267
+ }
268
+ }
269
+ export class QueueCancelledError extends ReckerError {
270
+ queueName;
271
+ constructor(message, options) {
272
+ super(message || 'Queue operation was cancelled', options?.request, undefined, [
273
+ 'This is typically expected during shutdown.',
274
+ 'Check if the queue was manually cleared.',
275
+ 'Retry the operation if the queue is still active.'
276
+ ], true);
277
+ this.name = 'QueueCancelledError';
278
+ this.queueName = options?.queueName;
279
+ }
280
+ }
281
+ export class StreamError extends ReckerError {
282
+ streamType;
283
+ constructor(message, options) {
284
+ super(message, options?.request, undefined, [
285
+ 'Check if the stream was prematurely closed.',
286
+ 'Verify the data source is still available.',
287
+ 'Ensure proper error handling for stream events.'
288
+ ], options?.retriable ?? false);
289
+ this.name = 'StreamError';
290
+ this.streamType = options?.streamType;
291
+ }
292
+ }
293
+ export class DownloadError extends ReckerError {
294
+ url;
295
+ statusCode;
296
+ constructor(message, options) {
297
+ super(message, options?.request, undefined, [
298
+ 'Verify the URL is correct and accessible.',
299
+ 'Check network connectivity.',
300
+ options?.statusCode
301
+ ? `HTTP ${options.statusCode} - check server response.`
302
+ : 'Retry the download if the error is transient.'
303
+ ], options?.retriable ?? true);
304
+ this.name = 'DownloadError';
305
+ this.url = options?.url;
306
+ this.statusCode = options?.statusCode;
307
+ }
308
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"request-promise.d.ts","sourceRoot":"","sources":["../../src/core/request-promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAOrC,qBAAa,cAAc,CAAC,CAAC,GAAG,OAAO,CAAE,YAAW,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC5E,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,eAAe,CAAC,CAAkB;gBAE9B,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,eAAe;IAKlF,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;IAED,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,KAAK,EACjD,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,EACrF,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC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zB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAKvB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAK5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrB,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IAKlD,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBlC,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAK1C,IAAI,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,GAAG,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC;IAKtD,GAAG,IAAI,cAAc,CAAC,QAAQ,CAAC;IAK/B,QAAQ,IAAI,cAAc,CAAC,aAAa,CAAC;IAKzC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,UAAU,CAAC;CAI5D"}
@@ -2,7 +2,7 @@ import { createWriteStream } from 'node:fs';
2
2
  import { pipeline } from 'node:stream/promises';
3
3
  import { Readable } from 'node:stream';
4
4
  import { tryFn } from '../utils/try-fn.js';
5
- import { ReckerError } from './errors.js';
5
+ import { StreamError } from './errors.js';
6
6
  export class RequestPromise {
7
7
  promise;
8
8
  abortController;
@@ -51,11 +51,10 @@ export class RequestPromise {
51
51
  const response = await this.promise;
52
52
  const body = response.read();
53
53
  if (!body) {
54
- throw new ReckerError('Response has no body to write', undefined, response, [
55
- 'Ensure the request returned a body (avoid HEAD/204).',
56
- 'Check if the request was aborted before the body streamed.',
57
- 'Verify upstream is not sending an empty response.'
58
- ]);
54
+ throw new StreamError('Response has no body to write', {
55
+ streamType: 'response',
56
+ retriable: true,
57
+ });
59
58
  }
60
59
  const nodeStream = Readable.fromWeb(body);
61
60
  const fileStream = createWriteStream(path);
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","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ED,IAAI,EAAE,YAEL;IAED,IAAI,GAAG,WAEN;IAMD,IAAI,KAAK,IAAI,SAAS,CAErB;IAMD,IAAI,SAAS,IAAI,aAAa,CAE7B;IAiBD,KAAK,IAAI,gBAAgB,GAAG,IAAI;IAOhC,IAAI,UAAU,IAAI,UAAU,CAE3B;IAEK,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;IAIzB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAIvB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAK5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,IAAI,IAAI,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI;IAqBzC,YAAY,IAAI,QAAQ,GAAG,IAAI;IAmBzB,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB7D,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC;IAO1B,GAAG,IAAI,cAAc,CAAC,QAAQ,CAAC;IAgBxB,QAAQ,IAAI,cAAc,CAAC,aAAa,CAAC;IA2EzC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,UAAU,CAAC;CAe5D"}
@@ -3,7 +3,7 @@ import { cleanHtml } from '../utils/html-cleaner.js';
3
3
  import { webToNodeStream } from '../utils/streaming.js';
4
4
  import { parseHeaders } from '../utils/header-parser.js';
5
5
  import { parseLinkHeader } from '../utils/link-header.js';
6
- import { ReckerError } from './errors.js';
6
+ import { StreamError } from './errors.js';
7
7
  export class HttpResponse {
8
8
  timings;
9
9
  connection;
@@ -74,11 +74,10 @@ export class HttpResponse {
74
74
  async pipe(destination) {
75
75
  const nodeStream = this.toNodeStream();
76
76
  if (!nodeStream) {
77
- throw new ReckerError('Response has no body to pipe', undefined, this, [
78
- 'Ensure the request method returns a body (e.g., not HEAD).',
79
- 'Check the upstream response status and headers.',
80
- 'Verify the request was not aborted before receiving a body.'
81
- ]);
77
+ throw new StreamError('Response has no body to pipe', {
78
+ streamType: 'response',
79
+ retriable: true,
80
+ });
82
81
  }
83
82
  return new Promise((resolve, reject) => {
84
83
  nodeStream.pipe(destination);
@@ -13,7 +13,9 @@ export interface PropagationResult {
13
13
  latency: number;
14
14
  error?: string;
15
15
  location?: string;
16
+ minTTL?: number;
16
17
  }
17
- export declare function checkPropagation(domain: string, type?: string): Promise<PropagationResult[]>;
18
+ export declare function getTypeName(typeId: number): string;
19
+ export declare function checkPropagation(domainInput: string, type?: string): Promise<PropagationResult[]>;
18
20
  export declare function formatPropagationReport(results: PropagationResult[], domain: string, type: string): string;
19
21
  //# sourceMappingURL=propagation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"propagation.d.ts","sourceRoot":"","sources":["../../src/dns/propagation.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA8BD,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAyEvG;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAqD1G"}
1
+ {"version":3,"file":"propagation.d.ts","sourceRoot":"","sources":["../../src/dns/propagation.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAgDD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA6D5G;AAyCD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA2D1G"}
@@ -1,10 +1,9 @@
1
- import { request } from 'undici';
1
+ import { Client } from '../core/client.js';
2
2
  import pc from '../utils/colors.js';
3
3
  const PROVIDERS = [
4
- { id: 'google', name: 'Google DNS', url: 'https://dns.google/resolve' },
5
- { id: 'cloudflare', name: 'Cloudflare', url: 'https://cloudflare-dns.com/dns-query' },
6
- { id: 'quad9', name: 'Quad9', url: 'https://dns.quad9.net:5053/dns-query' },
7
- { id: 'alidns', name: 'AliDNS (China)', url: 'https://dns.alidns.com/resolve' },
4
+ { id: 'google', name: 'Google DNS', url: 'https://dns.google/resolve', location: 'Global' },
5
+ { id: 'cloudflare', name: 'Cloudflare', url: 'https://cloudflare-dns.com/dns-query', location: 'Global' },
6
+ { id: 'nextdns', name: 'NextDNS', url: 'https://dns.nextdns.io/dns-query', location: 'Global' },
8
7
  ];
9
8
  const TYPE_MAP = {
10
9
  'A': '1',
@@ -22,79 +21,116 @@ const TYPE_ID_MAP = Object.entries(TYPE_MAP).reduce((acc, [k, v]) => {
22
21
  acc[Number(v)] = k;
23
22
  return acc;
24
23
  }, {});
25
- export async function checkPropagation(domain, type = 'A') {
24
+ const DNS_STATUS_MAP = {
25
+ 0: 'NoError',
26
+ 1: 'FormErr',
27
+ 2: 'ServFail',
28
+ 3: 'NXDomain',
29
+ 4: 'NotImp',
30
+ 5: 'Refused',
31
+ 6: 'YXDomain',
32
+ 7: 'YXRRSet',
33
+ 8: 'NXRRSet',
34
+ 9: 'NotAuth',
35
+ 10: 'NotZone'
36
+ };
37
+ export function getTypeName(typeId) {
38
+ return TYPE_ID_MAP[typeId] || `TYPE${typeId}`;
39
+ }
40
+ export async function checkPropagation(domainInput, type = 'A') {
41
+ const domain = domainInput.replace(/^https?:\/\//, '').split('/')[0].split('?')[0];
26
42
  const typeId = TYPE_MAP[type.toUpperCase()] || type;
43
+ const client = new Client({
44
+ baseUrl: 'http://localhost',
45
+ http2: true,
46
+ timeout: 5000,
47
+ });
27
48
  const queries = PROVIDERS.map(async (provider) => {
28
49
  const start = performance.now();
29
50
  try {
30
51
  const url = new URL(provider.url);
31
52
  url.searchParams.set('name', domain);
32
53
  url.searchParams.set('type', typeId);
33
- const { body, statusCode } = await request(url, {
34
- method: 'GET',
54
+ const json = await client.get(url.toString(), {
35
55
  headers: { 'Accept': 'application/dns-json' }
36
- });
37
- if (statusCode !== 200) {
38
- throw new Error(`HTTP ${statusCode}`);
39
- }
40
- const json = await body.json();
56
+ }).json();
41
57
  const duration = performance.now() - start;
42
- if (json.Status !== 0) {
43
- const statusMap = {
44
- 1: 'FormErr', 2: 'ServFail', 3: 'NXDomain', 4: 'NotImp', 5: 'Refused'
45
- };
46
- const errorName = statusMap[json.Status] || `Code ${json.Status}`;
47
- return {
48
- id: provider.id,
49
- provider: provider.name,
50
- status: 'error',
51
- records: [],
52
- rawRecords: [],
53
- latency: duration,
54
- error: errorName
55
- };
56
- }
57
- const answers = (json.Answer || []);
58
- const records = answers.map(r => r.data);
59
- return {
60
- id: provider.id,
61
- provider: provider.name,
62
- status: 'ok',
63
- records,
64
- rawRecords: answers,
65
- latency: duration
66
- };
58
+ return processJsonResponse(json, provider, duration);
67
59
  }
68
60
  catch (err) {
61
+ const duration = performance.now() - start;
62
+ let errorMessage;
63
+ if (err.name === 'TimeoutError' || err.name === 'AbortError' || err.code === 'UND_ERR_ABORTED') {
64
+ errorMessage = `Timeout (>${client.defaultTimeout || 5000}ms)`;
65
+ }
66
+ else if (err.name === 'HttpError') {
67
+ errorMessage = `HTTP ${err.status} ${err.statusText}`;
68
+ }
69
+ else if (err.name === 'NetworkError') {
70
+ errorMessage = `Network error: ${err.code || err.message}`;
71
+ }
72
+ else if (err.name === 'ParseError') {
73
+ errorMessage = `Parse error: ${err.message}`;
74
+ }
75
+ else {
76
+ errorMessage = err.message || 'Unknown error';
77
+ }
69
78
  return {
70
79
  id: provider.id,
71
80
  provider: provider.name,
72
81
  status: 'error',
73
82
  records: [],
74
83
  rawRecords: [],
75
- latency: performance.now() - start,
76
- error: err.message
84
+ latency: duration,
85
+ error: errorMessage,
86
+ location: provider.location
77
87
  };
78
88
  }
79
89
  });
80
90
  return Promise.all(queries);
81
91
  }
92
+ function processJsonResponse(json, provider, duration) {
93
+ if (json.Status !== 0) {
94
+ const errorName = DNS_STATUS_MAP[json.Status] || `Code ${json.Status}`;
95
+ return {
96
+ id: provider.id,
97
+ provider: provider.name,
98
+ status: 'error',
99
+ records: [],
100
+ rawRecords: [],
101
+ latency: duration,
102
+ error: errorName,
103
+ location: provider.location
104
+ };
105
+ }
106
+ const answers = (json.Answer || []);
107
+ const records = answers.map(r => r.data);
108
+ const minTTL = answers.length ? Math.min(...answers.map(r => r.TTL)) : undefined;
109
+ return {
110
+ id: provider.id,
111
+ provider: provider.name,
112
+ status: 'ok',
113
+ records,
114
+ rawRecords: answers,
115
+ latency: duration,
116
+ location: provider.location,
117
+ minTTL
118
+ };
119
+ }
82
120
  export function formatPropagationReport(results, domain, type) {
83
121
  let output = '';
84
- output += `
85
- ${pc.bold(pc.cyan('🌍 Global DNS Propagation Check'))}
86
- `;
87
- output += `${pc.gray('Domain:')} ${pc.white(domain)} ${pc.gray('Type:')} ${pc.white(type.toUpperCase())}
88
-
89
- `;
122
+ const displayDomain = domain.replace(/^https?:\/\//, '').split('/')[0];
123
+ output += `\n${pc.bold(pc.cyan('🌍 Global DNS Propagation Check'))}\n`;
124
+ output += `${pc.gray('Domain:')} ${pc.white(displayDomain)} ${pc.gray('Type:')} ${pc.white(type.toUpperCase())}\n\n`;
90
125
  const consensus = {};
91
126
  results.forEach(res => {
92
127
  const key = res.status === 'ok' ? res.records.sort().join(', ') : `Error: ${res.error}`;
93
128
  consensus[key] = (consensus[key] || 0) + 1;
94
129
  const statusIcon = res.status === 'ok' ? pc.green('✔') : pc.red('✖');
95
130
  const latencyColor = res.latency < 50 ? pc.green : res.latency < 200 ? pc.yellow : pc.red;
96
- const latencyText = latencyColor(`${Math.round(res.latency)}ms`.padStart(5));
97
- const providerName = pc.bold(res.provider.padEnd(15));
131
+ const latencyText = latencyColor(`${Math.round(res.latency)}ms`.padStart(6));
132
+ const providerName = pc.bold(res.provider.padEnd(12));
133
+ const ttlText = res.minTTL !== undefined ? pc.gray(`[TTL ${res.minTTL}s]`) : '';
98
134
  let recordsText = '';
99
135
  if (res.status === 'ok') {
100
136
  if (res.records.length === 0) {
@@ -102,28 +138,32 @@ ${pc.bold(pc.cyan('🌍 Global DNS Propagation Check'))}
102
138
  }
103
139
  else {
104
140
  recordsText = res.records.join(', ');
105
- if (recordsText.length > 60)
106
- recordsText = recordsText.substring(0, 57) + '...';
141
+ if (recordsText.length > 50)
142
+ recordsText = recordsText.substring(0, 47) + '...';
107
143
  }
108
144
  }
109
145
  else {
110
146
  recordsText = pc.red(res.error || 'Unknown Error');
111
147
  }
112
- output += ` ${statusIcon} ${providerName} ${latencyText} ${recordsText}
113
- `;
148
+ output += ` ${statusIcon} ${providerName} ${latencyText} ${recordsText} ${ttlText}\n`;
114
149
  });
115
150
  output += '\n';
151
+ const okResults = results.filter(r => r.status === 'ok');
152
+ const errorResults = results.filter(r => r.status === 'error');
116
153
  const distinctAnswers = Object.keys(consensus);
117
- if (distinctAnswers.length === 1) {
118
- if (distinctAnswers[0].startsWith('Error')) {
119
- output += pc.red('❌ All providers returned error.\n');
154
+ if (errorResults.length === results.length) {
155
+ output += pc.red('❌ All providers returned errors.\n');
156
+ }
157
+ else if (okResults.length === results.length && distinctAnswers.length === 1) {
158
+ output += pc.green('✅ All providers agree. Propagation is complete.\n');
159
+ }
160
+ else if (distinctAnswers.length > 1) {
161
+ if (errorResults.length > 0) {
162
+ output += pc.yellow(`⚠ ${okResults.length}/${results.length} providers responded. Some errors occurred.\n`);
120
163
  }
121
164
  else {
122
- output += pc.green(' All providers returned the same records. Propagation is complete.\n');
165
+ output += pc.yellow('⚠ Inconsistent results (propagation in progress or split-horizon DNS).\n');
123
166
  }
124
167
  }
125
- else if (distinctAnswers.length > 1) {
126
- output += pc.yellow('⚠ Inconsistent results detected (Propagation in progress or Split-Horizon DNS).\n');
127
- }
128
168
  return output;
129
169
  }
package/dist/index.d.ts CHANGED
@@ -58,6 +58,7 @@ export * from './constants/http-status.js';
58
58
  export * from './utils/env-proxy.js';
59
59
  export * from './utils/charset.js';
60
60
  export * from './utils/client-pool.js';
61
+ export * from './utils/security-grader.js';
61
62
  export * as presets from './presets/index.js';
62
63
  export * as testing from './testing/index.js';
63
64
  export * as protocols from './protocols/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B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AAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAGlD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAOpD,OAAO,EACL,GAAG,EACH,IAAI,EACJ,GAAG,EACH,KAAK,EACL,GAAG,EACH,GAAG,IAAI,MAAM,EACb,IAAI,EACJ,OAAO,EACP,KAAK,EACL,cAAc,EACd,GAAG,EACH,WAAW,EACX,EAAE,EACF,MAAM,GACP,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -58,6 +58,7 @@ export * from './constants/http-status.js';
58
58
  export * from './utils/env-proxy.js';
59
59
  export * from './utils/charset.js';
60
60
  export * from './utils/client-pool.js';
61
+ export * from './utils/security-grader.js';
61
62
  export * as presets from './presets/index.js';
62
63
  export * as testing from './testing/index.js';
63
64
  export * as protocols from './protocols/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,OAAO,KAAK,EAGV,aAAa,EACb,OAAO,EAEP,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAYjB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC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AW,IAAI,OAAO;YAIR,OAAO;YA2CP,UAAU;IAkBxB,OAAO,CAAC,cAAc;CAgCvB;AAYD,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAEpE"}
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { createClient } from '../core/client.js';
3
- import { ReckerError } from '../core/errors.js';
3
+ import { StateError, ProtocolError } from '../core/errors.js';
4
4
  import { consoleLogger } from '../types/logger.js';
5
5
  export class MCPClient extends EventEmitter {
6
6
  client;
@@ -128,11 +128,10 @@ export class MCPClient extends EventEmitter {
128
128
  }
129
129
  async request(method, params) {
130
130
  if (!this.initialized && method !== 'initialize') {
131
- throw new ReckerError('MCP client not initialized. Call connect() first.', undefined, undefined, [
132
- 'Call connect() before invoking MCP methods.',
133
- 'Check for initialization errors in serverInfo.',
134
- 'Ensure the MCP server URL and credentials are correct.'
135
- ]);
131
+ throw new StateError('MCP client not initialized. Call connect() first.', {
132
+ expectedState: 'connected',
133
+ actualState: 'disconnected',
134
+ });
136
135
  }
137
136
  const request = {
138
137
  jsonrpc: '2.0',
@@ -146,11 +145,11 @@ export class MCPClient extends EventEmitter {
146
145
  .json();
147
146
  this.emit('response', response);
148
147
  if (response.error) {
149
- const error = new ReckerError(response.error.message, undefined, undefined, [
150
- 'Inspect MCP server logs for the reported error.',
151
- 'Validate request params against the tool schema.',
152
- 'Retry if the error is transient.'
153
- ]);
148
+ const error = new ProtocolError(response.error.message, {
149
+ protocol: 'mcp',
150
+ code: response.error.code,
151
+ retriable: false,
152
+ });
154
153
  error.code = response.error.code;
155
154
  error.data = response.error.data;
156
155
  throw error;
@@ -1 +1 @@
1
- {"version":3,"file":"embeddings-loader.d.ts","sourceRoot":"","sources":["../../src/mcp/embeddings-loader.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA+BxD,iBAAS,iBAAiB,IAAI,MAAM,CAKnC;AAyBD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