@j0hanz/fetch-url-mcp 1.12.6 → 1.12.8

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 (146) hide show
  1. package/dist/http/auth.d.ts +2 -2
  2. package/dist/http/auth.d.ts.map +1 -1
  3. package/dist/http/auth.js +15 -16
  4. package/dist/http/index.d.ts +6 -0
  5. package/dist/http/index.d.ts.map +1 -0
  6. package/dist/http/index.js +5 -0
  7. package/dist/http/native.d.ts +73 -0
  8. package/dist/http/native.d.ts.map +1 -1
  9. package/dist/http/native.js +585 -62
  10. package/dist/http/rate-limit.d.ts +1 -1
  11. package/dist/http/rate-limit.d.ts.map +1 -1
  12. package/dist/http/rate-limit.js +5 -6
  13. package/dist/index.d.ts +17 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +69 -8
  16. package/dist/lib/config.js +2 -2
  17. package/dist/lib/core.d.ts +56 -4
  18. package/dist/lib/core.d.ts.map +1 -1
  19. package/dist/lib/core.js +162 -11
  20. package/dist/lib/error/classes.d.ts +19 -0
  21. package/dist/lib/error/classes.d.ts.map +1 -0
  22. package/dist/lib/error/classes.js +107 -0
  23. package/dist/lib/error/classify.d.ts +4 -0
  24. package/dist/lib/error/classify.d.ts.map +1 -0
  25. package/dist/lib/error/classify.js +154 -0
  26. package/dist/lib/error/codes.d.ts +23 -0
  27. package/dist/lib/error/codes.d.ts.map +1 -0
  28. package/dist/lib/error/codes.js +22 -0
  29. package/dist/lib/error/index.d.ts +6 -0
  30. package/dist/lib/error/index.d.ts.map +1 -0
  31. package/dist/lib/error/index.js +5 -0
  32. package/dist/lib/{error-messages.d.ts → error/messages.d.ts} +2 -2
  33. package/dist/lib/error/messages.d.ts.map +1 -0
  34. package/dist/lib/{error-messages.js → error/messages.js} +13 -13
  35. package/dist/lib/{tool-errors.d.ts → error/payload.d.ts} +7 -13
  36. package/dist/lib/error/payload.d.ts.map +1 -0
  37. package/dist/lib/error/payload.js +108 -0
  38. package/dist/lib/mcp-interop.d.ts +1 -0
  39. package/dist/lib/mcp-interop.d.ts.map +1 -1
  40. package/dist/lib/mcp-interop.js +17 -9
  41. package/dist/lib/net/http.d.ts.map +1 -0
  42. package/dist/lib/{http.js → net/http.js} +11 -14
  43. package/dist/lib/net/index.d.ts +4 -0
  44. package/dist/lib/net/index.d.ts.map +1 -0
  45. package/dist/lib/net/index.js +3 -0
  46. package/dist/lib/{fetch-pipeline.d.ts → net/pipeline.d.ts} +3 -3
  47. package/dist/lib/net/pipeline.d.ts.map +1 -0
  48. package/dist/lib/{fetch-pipeline.js → net/pipeline.js} +7 -9
  49. package/dist/lib/{url.d.ts → net/url.d.ts} +2 -2
  50. package/dist/lib/net/url.d.ts.map +1 -0
  51. package/dist/lib/{url.js → net/url.js} +6 -8
  52. package/dist/lib/utils.d.ts +3 -18
  53. package/dist/lib/utils.d.ts.map +1 -1
  54. package/dist/lib/utils.js +33 -105
  55. package/dist/resources/index.d.ts.map +1 -1
  56. package/dist/resources/index.js +6 -3
  57. package/dist/schemas.d.ts +1 -1
  58. package/dist/server.d.ts.map +1 -1
  59. package/dist/server.js +12 -14
  60. package/dist/tasks/index.d.ts +2 -0
  61. package/dist/tasks/index.d.ts.map +1 -0
  62. package/dist/tasks/index.js +1 -0
  63. package/dist/tasks/manager.d.ts +123 -1
  64. package/dist/tasks/manager.d.ts.map +1 -1
  65. package/dist/tasks/manager.js +753 -18
  66. package/dist/tools/{fetch-url.d.ts → index.d.ts} +4 -5
  67. package/dist/tools/index.d.ts.map +1 -0
  68. package/dist/tools/{fetch-url.js → index.js} +14 -31
  69. package/dist/transform/index.d.ts +279 -0
  70. package/dist/transform/index.d.ts.map +1 -0
  71. package/dist/transform/index.js +5234 -0
  72. package/package.json +2 -2
  73. package/dist/cli.d.ts +0 -19
  74. package/dist/cli.d.ts.map +0 -1
  75. package/dist/cli.js +0 -65
  76. package/dist/http/health.d.ts +0 -8
  77. package/dist/http/health.d.ts.map +0 -1
  78. package/dist/http/health.js +0 -152
  79. package/dist/http/helpers.d.ts +0 -68
  80. package/dist/http/helpers.d.ts.map +0 -1
  81. package/dist/http/helpers.js +0 -404
  82. package/dist/lib/error-codes.d.ts +0 -11
  83. package/dist/lib/error-codes.d.ts.map +0 -1
  84. package/dist/lib/error-codes.js +0 -15
  85. package/dist/lib/error-messages.d.ts.map +0 -1
  86. package/dist/lib/fetch-pipeline.d.ts.map +0 -1
  87. package/dist/lib/http.d.ts.map +0 -1
  88. package/dist/lib/logger-names.d.ts +0 -14
  89. package/dist/lib/logger-names.d.ts.map +0 -1
  90. package/dist/lib/logger-names.js +0 -13
  91. package/dist/lib/session.d.ts +0 -44
  92. package/dist/lib/session.d.ts.map +0 -1
  93. package/dist/lib/session.js +0 -137
  94. package/dist/lib/tool-errors.d.ts.map +0 -1
  95. package/dist/lib/tool-errors.js +0 -252
  96. package/dist/lib/url.d.ts.map +0 -1
  97. package/dist/lib/zod.d.ts +0 -3
  98. package/dist/lib/zod.d.ts.map +0 -1
  99. package/dist/lib/zod.js +0 -27
  100. package/dist/tasks/call-contract.d.ts +0 -25
  101. package/dist/tasks/call-contract.d.ts.map +0 -1
  102. package/dist/tasks/call-contract.js +0 -59
  103. package/dist/tasks/execution.d.ts +0 -16
  104. package/dist/tasks/execution.d.ts.map +0 -1
  105. package/dist/tasks/execution.js +0 -241
  106. package/dist/tasks/handlers.d.ts +0 -11
  107. package/dist/tasks/handlers.d.ts.map +0 -1
  108. package/dist/tasks/handlers.js +0 -157
  109. package/dist/tasks/owner.d.ts +0 -43
  110. package/dist/tasks/owner.d.ts.map +0 -1
  111. package/dist/tasks/owner.js +0 -144
  112. package/dist/tasks/registry.d.ts +0 -20
  113. package/dist/tasks/registry.d.ts.map +0 -1
  114. package/dist/tasks/registry.js +0 -40
  115. package/dist/tasks/waiters.d.ts +0 -27
  116. package/dist/tasks/waiters.d.ts.map +0 -1
  117. package/dist/tasks/waiters.js +0 -114
  118. package/dist/tools/fetch-url.d.ts.map +0 -1
  119. package/dist/transform/dom-prep.d.ts +0 -16
  120. package/dist/transform/dom-prep.d.ts.map +0 -1
  121. package/dist/transform/dom-prep.js +0 -1287
  122. package/dist/transform/html-translators.d.ts +0 -5
  123. package/dist/transform/html-translators.d.ts.map +0 -1
  124. package/dist/transform/html-translators.js +0 -697
  125. package/dist/transform/markdown-cleanup.d.ts +0 -10
  126. package/dist/transform/markdown-cleanup.d.ts.map +0 -1
  127. package/dist/transform/markdown-cleanup.js +0 -542
  128. package/dist/transform/metadata.d.ts +0 -18
  129. package/dist/transform/metadata.d.ts.map +0 -1
  130. package/dist/transform/metadata.js +0 -462
  131. package/dist/transform/next-flight.d.ts +0 -2
  132. package/dist/transform/next-flight.d.ts.map +0 -1
  133. package/dist/transform/next-flight.js +0 -374
  134. package/dist/transform/shared.d.ts +0 -8
  135. package/dist/transform/shared.d.ts.map +0 -1
  136. package/dist/transform/shared.js +0 -137
  137. package/dist/transform/transform.d.ts +0 -38
  138. package/dist/transform/transform.d.ts.map +0 -1
  139. package/dist/transform/transform.js +0 -1041
  140. package/dist/transform/types.d.ts +0 -124
  141. package/dist/transform/types.d.ts.map +0 -1
  142. package/dist/transform/types.js +0 -5
  143. package/dist/transform/worker-pool.d.ts +0 -76
  144. package/dist/transform/worker-pool.d.ts.map +0 -1
  145. package/dist/transform/worker-pool.js +0 -725
  146. /package/dist/lib/{http.d.ts → net/http.d.ts} +0 -0
@@ -1,9 +1,7 @@
1
- import { transformBufferToMarkdown } from '../transform/transform.js';
2
- import {} from '../transform/types.js';
3
- import { config, logDebug } from './core.js';
1
+ import { transformBufferToMarkdown, } from '../../transform/index.js';
2
+ import { config, logDebug, Loggers } from '../core.js';
3
+ import { withSignal } from '../utils.js';
4
4
  import { fetchNormalizedUrlBuffer, normalizeUrl, transformToRawUrl, } from './http.js';
5
- import { LOG_FETCH } from './logger-names.js';
6
- import { withSignal } from './utils.js';
7
5
  export { withSignal };
8
6
  const TRUNCATION_MARKER = '...[truncated]';
9
7
  function getOpenCodeFence(content) {
@@ -117,16 +115,16 @@ export async function executeFetchPipeline(options) {
117
115
  if (resolvedUrl.transformed) {
118
116
  logDebug('Using transformed raw content URL', {
119
117
  original: resolvedUrl.originalUrl,
120
- }, LOG_FETCH);
118
+ }, Loggers.LOG_FETCH);
121
119
  }
122
120
  options.onStage?.('fetch_remote');
123
- logDebug('Fetching URL', { url: resolvedUrl.normalizedUrl }, LOG_FETCH);
121
+ logDebug('Fetching URL', { url: resolvedUrl.normalizedUrl }, Loggers.LOG_FETCH);
124
122
  const { buffer, encoding, truncated, finalUrl } = await fetchNormalizedUrlBuffer(resolvedUrl.normalizedUrl, withSignal(options.signal));
125
123
  if (finalUrl && finalUrl !== resolvedUrl.normalizedUrl) {
126
124
  logDebug('Fetch redirected', {
127
125
  fromUrl: resolvedUrl.normalizedUrl,
128
126
  toUrl: finalUrl,
129
- }, LOG_FETCH);
127
+ }, Loggers.LOG_FETCH);
130
128
  }
131
129
  options.onStage?.('response_ready');
132
130
  options.onStage?.('transform_start');
@@ -178,7 +176,7 @@ export async function performSharedFetch(options, deps = {}) {
178
176
  url: pipeline.finalUrl ?? pipeline.url,
179
177
  contentSize: inlineResult.contentSize,
180
178
  maxInlineChars: config.constants.maxInlineContentChars,
181
- }, LOG_FETCH);
179
+ }, Loggers.LOG_FETCH);
182
180
  }
183
181
  return { pipeline, inlineResult };
184
182
  }
@@ -1,5 +1,5 @@
1
1
  import { BlockList, isIP } from 'node:net';
2
- import { config } from './core.js';
2
+ import { config } from '../core.js';
3
3
  export declare class SafeDnsResolver {
4
4
  private readonly ipBlocker;
5
5
  private readonly security;
@@ -48,7 +48,7 @@ export interface Logger {
48
48
  warn(message: string, data?: Record<string, unknown>): void;
49
49
  error(message: string, data?: Record<string, unknown>): void;
50
50
  }
51
- export declare const VALIDATION_ERROR_CODE = "VALIDATION_ERROR";
51
+ export declare const VALIDATION_ERROR_CODE: "VALIDATION_ERROR";
52
52
  export declare const BLOCKED_HOST_SUFFIXES: readonly string[];
53
53
  type SecurityConfig = typeof config.security;
54
54
  type BlockReason = 'cloud-metadata' | 'blocked-host' | 'blocked-ip' | 'blocked-suffix';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/lib/net/url.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAiB,MAAM,UAAU,CAAC;AAG1D,OAAO,EAAE,MAAM,EAAqB,MAAM,YAAY,CAAC;AAuDvD,qBAAa,eAAe;IAOxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IARtC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAG3B;gBAGgB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,cAAc,EACxB,mBAAmB,EAAE,SAAS,MAAM,EAAE;IAGzD,OAAO,CAAC,eAAe;IAWjB,kBAAkB,CACtB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,CAAC;IAmDlB,OAAO,CAAC,iBAAiB;YAIX,oBAAoB;YAwBpB,YAAY;CAqC3B;AACD,KAAK,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAMhF,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,eAAe,GAC3B,iBAAiB,CAKnB;AACD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAc1D;AAWD,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAyChC,wBAAgB,sBAAsB,IAAI,SAAS,CAMlD;AASD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,GACZ;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAA;CAAE,G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O,EAAE,IAAI,EAAE,CAAC;AAEhB,wBAAgB,SAAS,CACvB,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAC/C,MAAM,CAER;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS9D"}
@@ -1,11 +1,9 @@
1
1
  import dns from 'node:dns';
2
2
  import { BlockList, isIP, SocketAddress } from 'node:net';
3
3
  import { domainToASCII } from 'node:url';
4
- import { config, logDebug } from './core.js';
5
- import { VALIDATION_ERROR } from './error-codes.js';
6
- import { blockedCnameError, blockedHostError, blockedIpError, dnsNoResultsError, dnsTimeoutError, invalidAddressFamilyError, invalidHostnameError, invalidUrlError, } from './error-messages.js';
7
- import { LOG_FETCH } from './logger-names.js';
8
- import { CodedError, composeAbortSignal, isError, isSystemError, } from './utils.js';
4
+ import { config, logDebug, Loggers } from '../core.js';
5
+ import { blockedCnameError, blockedHostError, blockedIpError, CodedError, dnsNoResultsError, dnsTimeoutError, invalidAddressFamilyError, invalidHostnameError, invalidUrlError, isError, isSystemError, SystemErrors, } from '../error/index.js';
6
+ import { composeAbortSignal } from '../utils.js';
9
7
  const DNS_LOOKUP_TIMEOUT_MS = 5000;
10
8
  const CNAME_LOOKUP_MAX_DEPTH = 5;
11
9
  async function withTimeout(promise, timeoutMs, onTimeout, signal, onAbort) {
@@ -129,7 +127,7 @@ export class SafeDnsResolver {
129
127
  logDebug('DNS CNAME lookup failed; continuing with address lookup', {
130
128
  hostname,
131
129
  ...(isSystemError(error) ? { code: error.code } : {}),
132
- }, LOG_FETCH);
130
+ }, Loggers.LOG_FETCH);
133
131
  return [];
134
132
  }
135
133
  }
@@ -441,9 +439,9 @@ export class RawUrlTransformer {
441
439
  });
442
440
  }
443
441
  }
444
- export const VALIDATION_ERROR_CODE = VALIDATION_ERROR;
442
+ export const VALIDATION_ERROR_CODE = SystemErrors.VALIDATION_ERROR;
445
443
  function createValidationError(message) {
446
- const error = new CodedError(message, VALIDATION_ERROR);
444
+ const error = new CodedError(message, SystemErrors.VALIDATION_ERROR);
447
445
  return error;
448
446
  }
449
447
  export const BLOCKED_HOST_SUFFIXES = ['.local', '.internal'];
@@ -1,24 +1,8 @@
1
+ import { z } from 'zod';
1
2
  export declare function composeAbortSignal(signal?: AbortSignal, timeoutMs?: number): AbortSignal | undefined;
2
3
  export declare function parseUrlOrNull(input: string, base?: string): URL | null;
3
- export declare function throwIfAborted(signal: AbortSignal | undefined, url: string, stage: string): void;
4
- export declare function createAbortError(url: string, stage: string): FetchError;
5
4
  export declare function timingSafeEqualUtf8(a: string, b: string): boolean;
6
5
  export declare function hmacSha256Hex(key: string | Uint8Array, input: string | Uint8Array): string;
7
- export declare class FetchError extends Error {
8
- readonly url: string;
9
- readonly statusCode: number;
10
- readonly code: string;
11
- readonly details: Readonly<Record<string, unknown>>;
12
- constructor(message: string, url: string, httpStatus?: number, details?: Record<string, unknown>, options?: ErrorOptions);
13
- }
14
- export declare function getErrorMessage(error: unknown): string;
15
- export declare function toError(error: unknown): Error;
16
- export declare function isAbortError(error: unknown): boolean;
17
- export declare class CodedError extends Error {
18
- readonly code: string;
19
- constructor(message: string, code: string, options?: ErrorOptions);
20
- }
21
- export declare function isSystemError(error: unknown): error is NodeJS.ErrnoException;
22
6
  interface TunableHttpServer {
23
7
  headersTimeout?: number;
24
8
  requestTimeout?: number;
@@ -45,7 +29,7 @@ interface IntervalLoopOptions<T> {
45
29
  export declare function createUnrefTimeout<T>(timeoutMs: number, value: T): CancellableTimeout<T>;
46
30
  export declare function startAbortableIntervalLoop<T>(intervalMs: number, value: T, options: IntervalLoopOptions<T>): void;
47
31
  export declare function isObject(value: unknown): value is Record<PropertyKey, unknown>;
48
- export declare function isError(value: unknown): value is Error;
32
+ export declare function compactContext<T extends object>(obj: T): Partial<T>;
49
33
  interface HtmlNode {
50
34
  readonly tagName?: string | undefined;
51
35
  readonly nodeName?: string | undefined;
@@ -96,5 +80,6 @@ export interface IconInfo {
96
80
  export declare function buildOptionalIcons(iconInfo?: IconInfo): {
97
81
  icons: IconInfo[];
98
82
  } | Record<string, never>;
83
+ export declare function formatZodError(error: z.ZodError): string;
99
84
  export {};
100
85
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAeA,wBAAgB,kBAAkB,CAChC,MAAM,CAAC,EAAE,WAAW,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,WAAW,GAAG,SAAS,CAOzB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAEvE;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,IAAI,CAYN;AACD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAMvE;AACD,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAKjE;AACD,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,GAAG,UAAU,EACxB,KAAK,EAAE,MAAM,GAAG,UAAU,GACzB,MAAM,CAER;AAED,qBAAa,UAAW,SAAQ,KAAK;IAOjC,QAAQ,CAAC,GAAG,EAAE,MAAM;IANtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;gBAGlD,OAAO,EAAE,MAAM,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afeEqual } from 'node:crypto';
3
3
  import { setInterval as setIntervalPromise, setTimeout as setTimeoutPromise, } from 'node:timers/promises';
4
- import { inspect } from 'node:util';
5
- import { config, logDebug, logWarn } from './core.js';
6
- import { FETCH_ERROR } from './error-codes.js';
7
- import { LOG_HTTP } from './logger-names.js';
4
+ import { z } from 'zod';
5
+ import { config, logDebug, Loggers, logWarn } from './core.js';
6
+ import { isAbortError } from './error/index.js';
8
7
  const textEncoder = new TextEncoder();
9
- const UNKNOWN_ERROR_MESSAGE = 'Unknown error';
10
8
  export function composeAbortSignal(signal, timeoutMs) {
11
9
  const timeoutSignal = timeoutMs && timeoutMs > 0 ? AbortSignal.timeout(timeoutMs) : undefined;
12
10
  if (signal && timeoutSignal) {
@@ -17,25 +15,6 @@ export function composeAbortSignal(signal, timeoutMs) {
17
15
  export function parseUrlOrNull(input, base) {
18
16
  return URL.parse(input, base);
19
17
  }
20
- export function throwIfAborted(signal, url, stage) {
21
- if (!signal?.aborted)
22
- return;
23
- if (signal.reason instanceof Error && signal.reason.name === 'TimeoutError') {
24
- const error = new FetchError('Request timeout', url, 504, {
25
- reason: 'timeout',
26
- stage,
27
- });
28
- throw error;
29
- }
30
- throw createAbortError(url, stage);
31
- }
32
- export function createAbortError(url, stage) {
33
- const error = new FetchError('Request was canceled', url, 499, {
34
- reason: 'aborted',
35
- stage,
36
- });
37
- return error;
38
- }
39
18
  export function timingSafeEqualUtf8(a, b) {
40
19
  const aBuf = textEncoder.encode(a);
41
20
  const bBuf = textEncoder.encode(b);
@@ -46,77 +25,6 @@ export function timingSafeEqualUtf8(a, b) {
46
25
  export function hmacSha256Hex(key, input) {
47
26
  return createHmac('sha256', key).update(input).digest('hex');
48
27
  }
49
- const DEFAULT_HTTP_STATUS = 502;
50
- export class FetchError extends Error {
51
- url;
52
- statusCode;
53
- code;
54
- details;
55
- constructor(message, url, httpStatus, details = {}, options) {
56
- super(message, options);
57
- this.url = url;
58
- this.name = 'FetchError';
59
- this.statusCode = httpStatus ?? DEFAULT_HTTP_STATUS;
60
- this.details = Object.freeze({ url, httpStatus, ...details });
61
- const explicitCode = this.details['code'];
62
- if (typeof explicitCode === 'string') {
63
- this.code = explicitCode;
64
- }
65
- else if (httpStatus) {
66
- this.code = `HTTP_${httpStatus}`;
67
- }
68
- else {
69
- this.code = FETCH_ERROR;
70
- }
71
- }
72
- }
73
- export function getErrorMessage(error) {
74
- if (isError(error))
75
- return error.message;
76
- if (typeof error === 'string' && error.length > 0)
77
- return error;
78
- if (isObject(error) &&
79
- typeof error['message'] === 'string' &&
80
- error['message'].length > 0) {
81
- return error['message'];
82
- }
83
- if (error === null || error === undefined)
84
- return UNKNOWN_ERROR_MESSAGE;
85
- try {
86
- return inspect(error, {
87
- depth: 2,
88
- maxStringLength: 200,
89
- breakLength: Infinity,
90
- compact: true,
91
- colors: false,
92
- });
93
- }
94
- catch {
95
- return UNKNOWN_ERROR_MESSAGE;
96
- }
97
- }
98
- export function toError(error) {
99
- return isError(error) ? error : new Error(getErrorMessage(error));
100
- }
101
- export function isAbortError(error) {
102
- return isError(error) && error.name === 'AbortError';
103
- }
104
- export class CodedError extends Error {
105
- code;
106
- constructor(message, code, options) {
107
- super(message, options);
108
- this.code = code;
109
- this.name = 'CodedError';
110
- }
111
- }
112
- export function isSystemError(error) {
113
- if (!isError(error))
114
- return false;
115
- if (!('code' in error))
116
- return false;
117
- const { code } = error;
118
- return typeof code === 'string';
119
- }
120
28
  const DROP_LOG_INTERVAL_MS = 10_000;
121
29
  export function applyHttpServerTuning(server) {
122
30
  const { headersTimeoutMs, requestTimeoutMs, keepAliveTimeoutMs, keepAliveTimeoutBufferMs, maxHeadersCount, maxConnections, } = config.server.http;
@@ -145,7 +53,7 @@ export function applyHttpServerTuning(server) {
145
53
  maxConnections,
146
54
  dropped: droppedSinceLastLog,
147
55
  data,
148
- }, LOG_HTTP);
56
+ }, Loggers.LOG_HTTP);
149
57
  lastLoggedAt = now;
150
58
  droppedSinceLastLog = 0;
151
59
  };
@@ -156,7 +64,7 @@ export function applyHttpServerTuning(server) {
156
64
  export function drainConnectionsOnShutdown(server) {
157
65
  if (typeof server.closeIdleConnections === 'function') {
158
66
  server.closeIdleConnections();
159
- logDebug('Closed idle HTTP connections during shutdown', undefined, LOG_HTTP);
67
+ logDebug('Closed idle HTTP connections during shutdown', undefined, Loggers.LOG_HTTP);
160
68
  }
161
69
  }
162
70
  function createAbortSafeTimeoutPromise(timeoutMs, value, signal) {
@@ -204,14 +112,8 @@ export function startAbortableIntervalLoop(intervalMs, value, options) {
204
112
  export function isObject(value) {
205
113
  return typeof value === 'object' && value !== null && !Array.isArray(value);
206
114
  }
207
- export function isError(value) {
208
- const maybeIsError = Error.isError;
209
- if (typeof maybeIsError === 'function') {
210
- const result = maybeIsError(value);
211
- if (typeof result === 'boolean')
212
- return result;
213
- }
214
- return value instanceof Error;
115
+ export function compactContext(obj) {
116
+ return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined));
215
117
  }
216
118
  export function isHtmlNode(value) {
217
119
  return (isObject(value) &&
@@ -337,3 +239,29 @@ export function buildOptionalIcons(iconInfo) {
337
239
  ],
338
240
  };
339
241
  }
242
+ function formatPathSegment(segment) {
243
+ if (typeof segment === 'number')
244
+ return `[${segment}]`;
245
+ if (typeof segment === 'string')
246
+ return segment;
247
+ return segment.description ?? '<symbol>';
248
+ }
249
+ function formatIssuePath(path) {
250
+ return path.reduce((acc, segment) => {
251
+ const isNum = typeof segment === 'number';
252
+ const formatted = formatPathSegment(segment);
253
+ return acc ? `${acc}${isNum ? '' : '.'}${formatted}` : formatted;
254
+ }, '');
255
+ }
256
+ export function formatZodError(error) {
257
+ const parts = error.issues.map((issue) => {
258
+ const path = formatIssuePath(issue.path);
259
+ return path ? `${path}: ${issue.message}` : issue.message;
260
+ });
261
+ const uniqueParts = [
262
+ ...new Set(parts.filter((val) => val.trim().length > 0)),
263
+ ];
264
+ if (uniqueParts.length > 0)
265
+ return uniqueParts.join('; ');
266
+ return z.prettifyError(error).replace(/\s+/g, ' ').trim() || 'Invalid input';
267
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQzE,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIpE,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,QAAQ,GAClB,IAAI,CAwBN;AAED,eAAO,MAAM,WAAW,iEAKd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,wBAAgB,cAAc,CAC5B,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,SAAS,GACf,MAAM,GAAG,SAAS,CAIpB;AAED,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAKR;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAgChD;AAiBD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,QAAQ,GAClB,IAAI,CA2BN"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASzE,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIpE,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,QAAQ,GAClB,IAAI,CAwBN;AAED,eAAO,MAAM,WAAW,iEAKd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,wBAAgB,cAAc,CAC5B,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,SAAS,GACf,MAAM,GAAG,SAAS,CAIpB;AAED,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAKR;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAmChD;AAiBD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,QAAQ,GAClB,IAAI,CA2BN"}
@@ -2,7 +2,7 @@ import { completable } from '@modelcontextprotocol/sdk/server/completable.js';
2
2
  import { z } from 'zod';
3
3
  import { config } from '../lib/core.js';
4
4
  import { buildOptionalIcons } from '../lib/utils.js';
5
- import { FETCH_URL_TOOL_NAME } from '../tools/fetch-url.js';
5
+ import { FETCH_URL_TOOL_NAME } from '../tools/index.js';
6
6
  export function registerInstructionResource(server, instructions, iconInfo) {
7
7
  server.registerResource('fetch-url-mcp-instructions', 'internal://instructions', {
8
8
  title: 'Server Instructions',
@@ -70,8 +70,11 @@ export function buildServerInstructions() {
70
70
  # Errors
71
71
  - VALIDATION_ERROR: invalid/blocked URL. Do not retry.
72
72
  - FETCH_ERROR: network failure. Retry once with backoff.
73
- - HTTP_xxx: upstream error. Retry only for 5xx.
74
- - ABORTED: cancelled. Retry if needed.
73
+ - UPSTREAM_HTTP_ERROR: upstream HTTP error. Retry only for 5xx.
74
+ - UPSTREAM_RATE_LIMITED: upstream returned 429. Back off and retry.
75
+ - UPSTREAM_TIMEOUT: upstream request timed out. Retry with backoff.
76
+ - UPSTREAM_ABORTED: request was cancelled. Retry if needed.
77
+ - MCP_ERROR: internal protocol error. Do not retry.
75
78
  - queue_full: worker pool busy. Wait and retry, or use task mode.`;
76
79
  }
77
80
  function buildTopicSchema() {
package/dist/schemas.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { ExtractedMetadata } from './transform/types.js';
2
+ import type { ExtractedMetadata } from './transform/index.js';
3
3
  export declare const extractedMetadataSchema: z.ZodType<ExtractedMetadata>;
4
4
  export declare function normalizeExtractedMetadata(value: unknown): ExtractedMetadata | undefined;
5
5
  export declare function normalizePageTitle(value: unknown): string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgHpE,wBAAsB,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAE1D;AAkDD,wBAAsB,6BAA6B,IAAI,OAAO,CAAC,SAAS,CAAC,CAExE;AAgHD,wBAAsB,gBAAgB,IAAI,OAAO,CAAC;IAChD,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC,CASD"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgHpE,wBAAsB,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAE1D;AAkDD,wBAAsB,6BAA6B,IAAI,OAAO,CAAC,SAAS,CAAC,CAExE;AAwHD,wBAAsB,gBAAgB,IAAI,OAAO,CAAC;IAChD,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC,CASD"}
package/dist/server.js CHANGED
@@ -1,17 +1,15 @@
1
- import * as fs from 'node:fs/promises';
2
- import process from 'node:process';
3
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
2
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
3
  import { SetLevelRequestSchema } from '@modelcontextprotocol/sdk/types.js';
6
- import { config } from './lib/core.js';
7
- import { getSessionId, logError, logInfo, logNotice, setLogLevel, setMcpServer, } from './lib/core.js';
8
- import { LOG_SERVER } from './lib/logger-names.js';
4
+ import * as fs from 'node:fs/promises';
5
+ import process from 'node:process';
6
+ import { config, getSessionId, logError, Loggers, logInfo, logNotice, setLogLevel, setMcpServer, } from './lib/core.js';
7
+ import { toError } from './lib/error/index.js';
9
8
  import { setTaskToolCallCapability } from './lib/mcp-interop.js';
10
- import { toError } from './lib/utils.js';
11
9
  import { buildServerInstructions, registerGetHelpPrompt, registerInstructionResource, } from './resources/index.js';
12
- import { abortAllTaskExecutions, registerTaskHandlers, } from './tasks/handlers.js';
13
- import { registerTools as registerFetchUrlTool } from './tools/fetch-url.js';
14
- import { shutdownTransformWorkerPool } from './transform/transform.js';
10
+ import { abortAllTaskExecutions, registerTaskHandlers } from './tasks/index.js';
11
+ import { registerTools as registerFetchUrlTool } from './tools/index.js';
12
+ import { shutdownTransformWorkerPool } from './transform/index.js';
15
13
  /* -------------------------------------------------------------------------------------------------
16
14
  * Icons + server info
17
15
  * ------------------------------------------------------------------------------------------------- */
@@ -121,7 +119,7 @@ function registerLoggingSetLevelHandler(server) {
121
119
  }
122
120
  function attachServerErrorHandler(server) {
123
121
  server.server.onerror = (error) => {
124
- logError('MCP server error', toError(error), LOG_SERVER);
122
+ logError('MCP server error', toError(error), Loggers.LOG_SERVER);
125
123
  };
126
124
  }
127
125
  async function shutdownServer(server, signal) {
@@ -136,7 +134,7 @@ async function shutdownServer(server, signal) {
136
134
  ]);
137
135
  for (const result of results) {
138
136
  if (result.status === 'rejected') {
139
- logError('Shutdown step failed', toError(result.reason), LOG_SERVER);
137
+ logError('Shutdown step failed', toError(result.reason), Loggers.LOG_SERVER);
140
138
  }
141
139
  }
142
140
  }
@@ -149,7 +147,7 @@ function createShutdownHandler(server) {
149
147
  logInfo('Shutdown already in progress; ignoring signal', {
150
148
  signal,
151
149
  initialSignal,
152
- }, LOG_SERVER);
150
+ }, Loggers.LOG_SERVER);
153
151
  return shutdownPromise ?? Promise.resolve();
154
152
  }
155
153
  shuttingDown = true;
@@ -158,7 +156,7 @@ function createShutdownHandler(server) {
158
156
  .then(() => shutdownServer(server, signal))
159
157
  .catch((err) => {
160
158
  const error = toError(err);
161
- logError('Error during shutdown', error, LOG_SERVER);
159
+ logError('Error during shutdown', error, Loggers.LOG_SERVER);
162
160
  process.exitCode = 1;
163
161
  })
164
162
  .finally(() => {
@@ -178,7 +176,7 @@ function registerSignalHandlers(handler) {
178
176
  async function connectStdioServer(server, transport) {
179
177
  try {
180
178
  await server.connect(transport);
181
- logInfo('Fetch URL MCP server running on stdio', undefined, LOG_SERVER);
179
+ logInfo('Fetch URL MCP server running on stdio', undefined, Loggers.LOG_SERVER);
182
180
  }
183
181
  catch (error) {
184
182
  const err = toError(error);
@@ -0,0 +1,2 @@
1
+ export * from './manager.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './manager.js';
@@ -1,3 +1,46 @@
1
+ import { type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { type ServerResult } from '@modelcontextprotocol/sdk/types.js';
3
+ import { z } from 'zod';
4
+ import { type ProgressNotification, type ToolHandlerExtra } from '../lib/mcp-interop.js';
5
+ export declare const extendedCallToolRequestSchema: z.ZodObject<{
6
+ method: z.ZodLiteral<"tools/call">;
7
+ params: z.ZodObject<{
8
+ name: z.ZodString;
9
+ arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
+ task: z.ZodOptional<z.ZodObject<{
11
+ ttl: z.ZodOptional<z.ZodNumber>;
12
+ }, z.core.$strict>>;
13
+ _meta: z.ZodOptional<z.ZodObject<{
14
+ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
15
+ 'io.modelcontextprotocol/related-task': z.ZodOptional<z.ZodObject<{
16
+ taskId: z.ZodString;
17
+ }, z.core.$strict>>;
18
+ }, z.core.$loose>>;
19
+ }, z.core.$strict>;
20
+ }, z.core.$loose>;
21
+ export type ExtendedCallToolRequest = z.infer<typeof extendedCallToolRequestSchema>;
22
+ export type ToolCallRequestMeta = ExtendedCallToolRequest['params']['_meta'];
23
+ export declare function parseExtendedCallToolRequest(request: unknown): ExtendedCallToolRequest;
24
+ export declare function sanitizeToolCallMeta(meta?: ToolCallRequestMeta): ToolCallRequestMeta | undefined;
25
+ export declare function buildRelatedTaskMeta(taskId: string, meta?: ToolCallRequestMeta): Record<string, unknown>;
26
+ export declare function withRelatedTaskMeta(result: ServerResult, taskId: string): ServerResult;
27
+ export declare function abortTaskExecution(taskId: string): void;
28
+ export declare function cancelTasksForOwner(ownerKey: string, statusMessage?: string): number;
29
+ export declare function abortAllTaskExecutions(): void;
30
+ type TaskSummary = CreateTaskResult['task'];
31
+ type TaskLifecycleProjection = Pick<TaskState, 'taskId' | 'status' | 'statusMessage' | 'progress' | 'total' | 'createdAt' | 'lastUpdatedAt' | 'ttl' | 'pollInterval'>;
32
+ export declare function toTaskSummary(task: TaskLifecycleProjection): TaskSummary;
33
+ export declare function emitTaskStatusNotification(server: McpServer, task: TaskState): void;
34
+ export declare function throwTaskNotFound(): never;
35
+ export declare function handleToolCallRequest(server: McpServer, request: ExtendedCallToolRequest, context: ToolCallContext): Promise<ServerResult>;
36
+ interface TaskHandlerRegistrationOptions {
37
+ requireInterception?: boolean;
38
+ }
39
+ interface TaskHandlerRegistrationResult {
40
+ interceptedToolsCall: boolean;
41
+ taskCapableToolsRegistered: boolean;
42
+ }
43
+ export declare function registerTaskHandlers(server: McpServer, options?: TaskHandlerRegistrationOptions): TaskHandlerRegistrationResult;
1
44
  export type TaskStatus = 'working' | 'input_required' | 'completed' | 'failed' | 'cancelled';
2
45
  export interface TaskError {
3
46
  code: number;
@@ -68,10 +111,89 @@ declare class TaskManager {
68
111
  waitForTerminalTask(taskId: string, ownerKey: string, signal?: AbortSignal): Promise<TaskState | undefined>;
69
112
  shrinkTtlAfterDelivery(taskId: string): void;
70
113
  }
71
- export declare const taskManager: TaskManager;
72
114
  export declare function encodeTaskCursor(anchorTaskId: string): string;
73
115
  export declare function decodeTaskCursor(cursor: string): {
74
116
  anchorTaskId: string;
75
117
  } | null;
118
+ interface HandlerExtra {
119
+ sessionId?: string;
120
+ authInfo?: {
121
+ clientId?: string;
122
+ token?: string;
123
+ };
124
+ signal?: AbortSignal;
125
+ requestId?: string | number;
126
+ sendNotification?: (notification: ProgressNotification) => Promise<void>;
127
+ requestInfo?: unknown;
128
+ }
129
+ export interface ToolExecutionContext {
130
+ ownerKey: string;
131
+ sessionId?: string;
132
+ signal?: AbortSignal;
133
+ requestId?: string | number;
134
+ sendNotification?: (notification: ProgressNotification) => Promise<void>;
135
+ requestMeta?: ToolCallRequestMeta;
136
+ }
137
+ export type ToolCallContext = ToolExecutionContext;
138
+ interface AuthIdentity {
139
+ clientId?: string;
140
+ token?: string;
141
+ }
142
+ /** Strip keys whose value is `undefined`, returning an object with only the
143
+ * present keys. Return type correctly omits the `undefined` union so the result
144
+ * is compatible with `exactOptionalPropertyTypes`. */
145
+ type Compacted<T extends object> = {
146
+ [K in keyof T as Exclude<T[K], undefined> extends never ? never : K]?: Exclude<T[K], undefined>;
147
+ };
148
+ export declare function compact<T extends object>(obj: T): Compacted<T>;
149
+ export declare function parseHandlerExtra(extra: unknown): HandlerExtra | undefined;
150
+ export declare function buildAuthenticatedOwnerKey(authInfo?: AuthIdentity): string | undefined;
151
+ export declare function resolveTaskOwnerKey(extra?: HandlerExtra): string;
152
+ export declare function resolveToolCallContext(extra?: HandlerExtra, requestMeta?: ToolCallRequestMeta): ToolCallContext;
153
+ export declare function buildToolHandlerExtra(context: ToolExecutionContext, requestMeta?: ToolCallRequestMeta): ToolHandlerExtra;
154
+ export declare function withRequestContextIfMissing<TParams, TResult, TExtra = unknown>(handler: (params: TParams, extra?: TExtra) => Promise<TResult>): (params: TParams, extra?: TExtra) => Promise<TResult>;
155
+ export declare function isServerResult(value: unknown): value is ServerResult;
156
+ export type TaskCapableToolSupport = 'required' | 'optional' | 'forbidden';
157
+ export interface TaskCapableToolDescriptor<TArgs = unknown> {
158
+ name: string;
159
+ parseArguments: (args: unknown) => TArgs;
160
+ execute: (args: TArgs, extra?: ToolHandlerExtra) => Promise<ServerResult>;
161
+ getCompletionStatusMessage?: (result: ServerResult) => string | undefined;
162
+ taskSupport?: TaskCapableToolSupport;
163
+ immediateResponse?: string;
164
+ }
165
+ export declare function registerTaskCapableTool<TArgs>(server: McpServer, descriptor: TaskCapableToolDescriptor<TArgs>): void;
166
+ export declare function unregisterTaskCapableTool(server: McpServer, name: string): void;
167
+ export declare function getTaskCapableTool(server: McpServer, name: string): TaskCapableToolDescriptor | undefined;
168
+ export declare function getTaskCapableToolSupport(server: McpServer, name: string): TaskCapableToolSupport | undefined;
169
+ export declare function hasTaskCapableTool(server: McpServer, name: string): boolean;
170
+ export declare function hasRegisteredTaskCapableTools(server: McpServer): boolean;
171
+ export declare function setTaskCapableToolSupport(server: McpServer, name: string, support: TaskCapableToolSupport): void;
172
+ interface WaitableTask {
173
+ taskId: string;
174
+ ownerKey: string;
175
+ status: string;
176
+ ttl: number;
177
+ _createdAtMs: number;
178
+ }
179
+ type TaskWaiter<TTask extends WaitableTask> = (task: TTask) => void;
180
+ export declare class TaskWaiterRegistry<TTask extends WaitableTask> {
181
+ private readonly isTerminalStatus;
182
+ private waiters;
183
+ constructor(isTerminalStatus: (status: TTask['status']) => boolean);
184
+ add(taskId: string, waiter: TaskWaiter<TTask>): void;
185
+ remove(taskId: string, waiter: TaskWaiter<TTask> | null): void;
186
+ notify(task: TTask): void;
187
+ }
188
+ export declare function waitForTerminalTask<TTask extends WaitableTask>(options: {
189
+ taskId: string;
190
+ ownerKey: string;
191
+ signal?: AbortSignal;
192
+ lookupTask: (taskId: string, ownerKey: string) => TTask | undefined;
193
+ removeTask: (taskId: string) => void;
194
+ registry: TaskWaiterRegistry<TTask>;
195
+ isTerminalStatus: (status: TTask['status']) => boolean;
196
+ }): Promise<TTask | undefined>;
197
+ export declare const taskManager: TaskManager;
76
198
  export {};
77
199
  //# sourceMappingURL=manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/tasks/manager.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,gBAAgB,GAChB,WAAW,GACX,QAAQ,GACR,WAAW,CAAC;AAEhB,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAMD,UAAU,iBAAiB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,UAAU,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,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