stitchkit 0.124.0 → 0.124.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.
- package/CHANGELOG.md +48 -0
- package/dist/entrypoints/agent-runtime/coding-tools.js +1 -1
- package/dist/entrypoints/agent-runtime/realtime.js +3 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +1 -1
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
- package/dist/entrypoints/agent-runtime/testing.js +3 -3
- package/dist/entrypoints/agent-runtime.js +3 -3
- package/dist/entrypoints/application/diagnostic-journal.js +3 -5
- package/dist/entrypoints/application/directory-inbox.js +9 -11
- package/dist/entrypoints/application.js +3 -3
- package/dist/entrypoints/cli/publish.js +6 -6
- package/dist/entrypoints/cli.js +6 -3
- package/dist/entrypoints/files.js +5 -5
- package/dist/entrypoints/index.js +3 -3
- package/dist/entrypoints/server.js +6 -6
- package/dist/entrypoints/telegram.js +2 -2
- package/dist/entrypoints/tools/connections.d.ts +2 -2
- package/dist/entrypoints/tools/connections.d.ts.map +1 -1
- package/dist/entrypoints/tools/connections.js +121 -29
- package/dist/entrypoints/tools/mcp.d.ts +1 -1
- package/dist/entrypoints/tools/mcp.d.ts.map +1 -1
- package/dist/entrypoints/tools/mcp.js +8 -6
- package/dist/entrypoints/tools/toolkit.js +2 -2
- package/dist/entrypoints/tools.js +2 -2
- package/dist/{index-jswst0h3.js → index-03qrr49d.js} +49 -4
- package/dist/{index-8yky60kq.js → index-1szhrfsf.js} +5 -7
- package/dist/{index-mqttte96.js → index-3ymcmpa9.js} +3 -5
- package/dist/{index-v8xm2s9v.js → index-7177dxjn.js} +1 -1
- package/dist/{index-2x2ch0bt.js → index-782qtc24.js} +1 -1
- package/dist/{index-j8rda9n6.js → index-8pwwd6rp.js} +3 -3
- package/dist/{index-m616f0yz.js → index-8x0q6yfb.js} +134 -7
- package/dist/{index-q89kd1xc.js → index-e1x6vze4.js} +1 -1
- package/dist/{index-ezwvsqx9.js → index-fvd6pvw3.js} +1 -1
- package/dist/{index-w0wy05gr.js → index-jkjh7zw4.js} +50 -40
- package/dist/{index-ac6vvm30.js → index-jp2qd9jb.js} +1 -1
- package/dist/index-mm89hd8v.js +39 -0
- package/dist/{index-jc5xgkpk.js → index-qsm899qp.js} +1 -1
- package/dist/index-wqzw3qg9.js +91 -0
- package/dist/{index-364k2zwa.js → index-wt6rw7rf.js} +5 -7
- package/dist/{index-tt3ej8r3.js → index-x0769xt9.js} +217 -24
- package/dist/internal/deadline.d.ts +30 -0
- package/dist/internal/deadline.d.ts.map +1 -1
- package/dist/internal/pinned-http.d.ts +1 -1
- package/dist/internal/pinned-http.d.ts.map +1 -1
- package/dist/internal/secure-fetch.d.ts +8 -0
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/tools/cli/resumable-download.d.ts +18 -0
- package/dist/tools/cli/resumable-download.d.ts.map +1 -0
- package/dist/tools/cli/update.d.ts +18 -0
- package/dist/tools/cli/update.d.ts.map +1 -1
- package/dist/tools/connections/catalog-cache.d.ts +9 -0
- package/dist/tools/connections/catalog-cache.d.ts.map +1 -0
- package/dist/tools/connections/errors.d.ts +10 -1
- package/dist/tools/connections/errors.d.ts.map +1 -1
- package/dist/tools/connections/limits.d.ts +16 -4
- package/dist/tools/connections/limits.d.ts.map +1 -1
- package/dist/tools/connections/mcp-client.d.ts +10 -2
- package/dist/tools/connections/mcp-client.d.ts.map +1 -1
- package/dist/tools/connections/mcp.d.ts.map +1 -1
- package/dist/tools/connections/operation-limits.d.ts +12 -1
- package/dist/tools/connections/operation-limits.d.ts.map +1 -1
- package/dist/tools/connections/sse-session.d.ts +2 -2
- package/dist/tools/connections/sse-session.d.ts.map +1 -1
- package/dist/tools/connections/types.d.ts +38 -2
- package/dist/tools/connections/types.d.ts.map +1 -1
- package/dist/tools/mcp/catalog-stamp.d.ts +47 -0
- package/dist/tools/mcp/catalog-stamp.d.ts.map +1 -0
- package/dist/tools/mcp/catalog.d.ts +1 -30
- package/dist/tools/mcp/catalog.d.ts.map +1 -1
- package/dist/tools/mcp/handler.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +6 -1
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts +1 -1
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/llms/cli.2.txt +60 -6
- package/llms/tools-connections.txt +5 -3
- package/llms/tools-mcp.txt +5 -2
- package/llms/tools.txt +10 -3
- package/llms-full.txt +80 -14
- package/llms.txt +4 -4
- package/package.json +1 -1
- package/dist/index-9tqbxv5p.js +0 -44
- package/dist/index-b56nnscm.js +0 -132
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
ExclusiveLockError2,
|
|
3
|
+
withExclusiveLock2
|
|
4
|
+
} from "./index-fvd6pvw3.js";
|
|
4
5
|
import {
|
|
5
6
|
writeFileAtomicSync2
|
|
6
|
-
} from "./index-
|
|
7
|
+
} from "./index-jp2qd9jb.js";
|
|
7
8
|
import {
|
|
8
9
|
fetchGuarded,
|
|
9
10
|
PrivateAddressRefusal,
|
|
10
11
|
readCapped
|
|
11
|
-
} from "./index-
|
|
12
|
+
} from "./index-03qrr49d.js";
|
|
12
13
|
import {
|
|
13
14
|
raceAbort
|
|
14
15
|
} from "./index-b0kddvzw.js";
|
|
16
|
+
import {
|
|
17
|
+
withSignalDeadline
|
|
18
|
+
} from "./index-wqzw3qg9.js";
|
|
15
19
|
import {
|
|
16
20
|
assertPositiveSafeInteger
|
|
17
21
|
} from "./index-0s4xebbg.js";
|
|
@@ -139,8 +143,8 @@ function assertCliPublishable2(previous, next) {
|
|
|
139
143
|
|
|
140
144
|
// src/tools/cli/update.ts
|
|
141
145
|
import { createHash as createHash2, randomBytes } from "node:crypto";
|
|
142
|
-
import { existsSync, readFileSync, statSync, unlinkSync } from "node:fs";
|
|
143
|
-
import { basename, dirname, extname, join } from "node:path";
|
|
146
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, statSync as statSync2, unlinkSync } from "node:fs";
|
|
147
|
+
import { basename, dirname as dirname2, extname, join } from "node:path";
|
|
144
148
|
|
|
145
149
|
// src/tools/cli/publication-assets.ts
|
|
146
150
|
import { createHash } from "node:crypto";
|
|
@@ -251,10 +255,198 @@ async function decodeCliAsset(transferred, asset, maxBytes, signal) {
|
|
|
251
255
|
return { bytes, sha256 };
|
|
252
256
|
}
|
|
253
257
|
|
|
258
|
+
// src/tools/cli/resumable-download.ts
|
|
259
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, statSync } from "node:fs";
|
|
260
|
+
import { open } from "node:fs/promises";
|
|
261
|
+
import { dirname } from "node:path";
|
|
262
|
+
import { z as z3 } from "zod";
|
|
263
|
+
var PartialRecordSchema = z3.object({
|
|
264
|
+
url: z3.string(),
|
|
265
|
+
sha256: z3.string(),
|
|
266
|
+
validator: z3.string().optional()
|
|
267
|
+
});
|
|
268
|
+
async function downloadCliAsset(config, decode) {
|
|
269
|
+
const { partialPath } = config;
|
|
270
|
+
if (partialPath === undefined)
|
|
271
|
+
return decode(await downloadInMemory(config));
|
|
272
|
+
mkdirSync(dirname(partialPath), { recursive: true, mode: 448 });
|
|
273
|
+
try {
|
|
274
|
+
return await withExclusiveLock2(`${partialPath}.lock`, async () => {
|
|
275
|
+
const first = await downloadToPart(config, partialPath, true);
|
|
276
|
+
try {
|
|
277
|
+
return await decodeAndForget(first, partialPath, decode);
|
|
278
|
+
} catch (error) {
|
|
279
|
+
if (!first.continued)
|
|
280
|
+
throw error;
|
|
281
|
+
return decodeAndForget(await downloadToPart(config, partialPath, false), partialPath, decode);
|
|
282
|
+
}
|
|
283
|
+
}, { timeoutMs: 0, label: "CLI update download" });
|
|
284
|
+
} catch (error) {
|
|
285
|
+
if (error instanceof ExclusiveLockError2 && error.code === "LOCK_TIMEOUT") {
|
|
286
|
+
throw new Error(`[stitchkit] update: another update is already downloading into ${partialPath}`, { cause: error });
|
|
287
|
+
}
|
|
288
|
+
throw error;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
async function decodeAndForget(transfer, partialPath, decode) {
|
|
292
|
+
try {
|
|
293
|
+
return await decode(transfer.bytes);
|
|
294
|
+
} finally {
|
|
295
|
+
forgetPart(partialPath);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
async function downloadInMemory(config) {
|
|
299
|
+
const response = await fetchGuarded(config.url, config.allowPrivateHosts, fetchOptions(config));
|
|
300
|
+
if (!response.ok) {
|
|
301
|
+
throw new Error(`[stitchkit] update download responded ${response.status}`);
|
|
302
|
+
}
|
|
303
|
+
const transferred = await readCapped(response, config.maxBytes);
|
|
304
|
+
if (!transferred)
|
|
305
|
+
throw new Error("[stitchkit] update download exceeded the size ceiling");
|
|
306
|
+
return transferred;
|
|
307
|
+
}
|
|
308
|
+
function fetchOptions(config, headers) {
|
|
309
|
+
return {
|
|
310
|
+
timeoutMs: config.timeoutMs,
|
|
311
|
+
bodyTimeoutMs: config.timeoutMs,
|
|
312
|
+
...config.idleTimeoutMs !== undefined && { idleTimeoutMs: config.idleTimeoutMs },
|
|
313
|
+
...headers && { headers }
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
function recordPath(partialPath) {
|
|
317
|
+
return `${partialPath}.json`;
|
|
318
|
+
}
|
|
319
|
+
function forgetPart(partialPath) {
|
|
320
|
+
rmSync(partialPath, { force: true });
|
|
321
|
+
rmSync(recordPath(partialPath), { force: true });
|
|
322
|
+
}
|
|
323
|
+
function keptLength(config, partialPath) {
|
|
324
|
+
if (!existsSync(partialPath) || !existsSync(recordPath(partialPath))) {
|
|
325
|
+
forgetPart(partialPath);
|
|
326
|
+
return { offset: 0 };
|
|
327
|
+
}
|
|
328
|
+
let record;
|
|
329
|
+
try {
|
|
330
|
+
const parsed = PartialRecordSchema.safeParse(JSON.parse(readFileSync(recordPath(partialPath), "utf8")));
|
|
331
|
+
if (parsed.success)
|
|
332
|
+
record = parsed.data;
|
|
333
|
+
} catch {
|
|
334
|
+
record = undefined;
|
|
335
|
+
}
|
|
336
|
+
if (!record || record.url !== config.url.href || record.sha256 !== config.sha256) {
|
|
337
|
+
forgetPart(partialPath);
|
|
338
|
+
return { offset: 0 };
|
|
339
|
+
}
|
|
340
|
+
const offset = statSync(partialPath).size;
|
|
341
|
+
if (offset > config.maxBytes) {
|
|
342
|
+
forgetPart(partialPath);
|
|
343
|
+
return { offset: 0 };
|
|
344
|
+
}
|
|
345
|
+
return { offset, record };
|
|
346
|
+
}
|
|
347
|
+
function readContentRange(value) {
|
|
348
|
+
if (value === null)
|
|
349
|
+
return null;
|
|
350
|
+
const match = /^bytes\s+(?:(\d+)-\d+|\*)\/(\d+|\*)$/i.exec(value.trim());
|
|
351
|
+
if (!match)
|
|
352
|
+
return null;
|
|
353
|
+
return {
|
|
354
|
+
...match[1] !== undefined && { start: Number(match[1]) },
|
|
355
|
+
...match[2] !== "*" && match[2] !== undefined && { total: Number(match[2]) }
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function validatorOf(response) {
|
|
359
|
+
const etag = response.headers.get("etag");
|
|
360
|
+
if (etag && !etag.startsWith("W/"))
|
|
361
|
+
return etag;
|
|
362
|
+
return response.headers.get("last-modified") ?? undefined;
|
|
363
|
+
}
|
|
364
|
+
async function downloadToPart(config, partialPath, resume) {
|
|
365
|
+
if (!resume)
|
|
366
|
+
forgetPart(partialPath);
|
|
367
|
+
const kept = resume ? keptLength(config, partialPath) : { offset: 0 };
|
|
368
|
+
const headers = {};
|
|
369
|
+
if (kept.offset > 0) {
|
|
370
|
+
headers.range = `bytes=${kept.offset}-`;
|
|
371
|
+
if (kept.record?.validator)
|
|
372
|
+
headers["if-range"] = kept.record.validator;
|
|
373
|
+
}
|
|
374
|
+
const response = await fetchGuarded(config.url, config.allowPrivateHosts, fetchOptions(config, headers));
|
|
375
|
+
if (kept.offset > 0 && response.status === 416) {
|
|
376
|
+
await response.body?.cancel().catch(() => {
|
|
377
|
+
return;
|
|
378
|
+
});
|
|
379
|
+
if (readContentRange(response.headers.get("content-range"))?.total === kept.offset) {
|
|
380
|
+
return { bytes: readFileSync(partialPath), continued: true };
|
|
381
|
+
}
|
|
382
|
+
return downloadToPart(config, partialPath, false);
|
|
383
|
+
}
|
|
384
|
+
if (!response.ok) {
|
|
385
|
+
await response.body?.cancel().catch(() => {
|
|
386
|
+
return;
|
|
387
|
+
});
|
|
388
|
+
throw new Error(`[stitchkit] update download responded ${response.status}`);
|
|
389
|
+
}
|
|
390
|
+
let offset = 0;
|
|
391
|
+
if (kept.offset > 0 && response.status === 206) {
|
|
392
|
+
if (readContentRange(response.headers.get("content-range"))?.start !== kept.offset) {
|
|
393
|
+
await response.body?.cancel().catch(() => {
|
|
394
|
+
return;
|
|
395
|
+
});
|
|
396
|
+
return downloadToPart(config, partialPath, false);
|
|
397
|
+
}
|
|
398
|
+
offset = kept.offset;
|
|
399
|
+
} else if (response.status === 206) {
|
|
400
|
+
await response.body?.cancel().catch(() => {
|
|
401
|
+
return;
|
|
402
|
+
});
|
|
403
|
+
throw new Error("[stitchkit] update download answered a range nobody asked for");
|
|
404
|
+
}
|
|
405
|
+
const validator = offset > 0 ? kept.record?.validator : validatorOf(response);
|
|
406
|
+
if (offset === 0)
|
|
407
|
+
rmSync(partialPath, { force: true });
|
|
408
|
+
writeFileAtomicSync2(recordPath(partialPath), JSON.stringify({
|
|
409
|
+
url: config.url.href,
|
|
410
|
+
sha256: config.sha256,
|
|
411
|
+
...validator !== undefined && { validator }
|
|
412
|
+
}), { mode: 384 });
|
|
413
|
+
await appendBody(response, partialPath, offset, config.maxBytes);
|
|
414
|
+
return { bytes: readFileSync(partialPath), continued: offset > 0 };
|
|
415
|
+
}
|
|
416
|
+
async function appendBody(response, partialPath, offset, maxBytes) {
|
|
417
|
+
const out = await open(partialPath, offset > 0 ? "a" : "w", 384);
|
|
418
|
+
let total = offset;
|
|
419
|
+
try {
|
|
420
|
+
if (response.body) {
|
|
421
|
+
for await (const chunk of response.body) {
|
|
422
|
+
if (total + chunk.byteLength > maxBytes)
|
|
423
|
+
throw new SizeCeilingError;
|
|
424
|
+
await out.write(chunk);
|
|
425
|
+
total += chunk.byteLength;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
} catch (error) {
|
|
429
|
+
await out.close().catch(() => {
|
|
430
|
+
return;
|
|
431
|
+
});
|
|
432
|
+
if (error instanceof SizeCeilingError) {
|
|
433
|
+
forgetPart(partialPath);
|
|
434
|
+
throw new Error("[stitchkit] update download exceeded the size ceiling");
|
|
435
|
+
}
|
|
436
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
437
|
+
throw new Error(`[stitchkit] update download stopped after ${total} bytes (${reason}); ` + `they are kept in ${partialPath} and the next update continues from there`, { cause: error });
|
|
438
|
+
}
|
|
439
|
+
await out.close();
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
class SizeCeilingError extends Error {
|
|
443
|
+
}
|
|
444
|
+
|
|
254
445
|
// src/tools/cli/update.ts
|
|
255
446
|
var DEFAULT_CHECK_TIMEOUT_MS = 2000;
|
|
256
447
|
var DEFAULT_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
257
|
-
var DEFAULT_DOWNLOAD_TIMEOUT_MS =
|
|
448
|
+
var DEFAULT_DOWNLOAD_TIMEOUT_MS = 30 * 60 * 1000;
|
|
449
|
+
var DEFAULT_DOWNLOAD_IDLE_TIMEOUT_MS = 30000;
|
|
258
450
|
var DEFAULT_VERIFY_TIMEOUT_MS = 30000;
|
|
259
451
|
var MANIFEST_MAX_BYTES = 256 * 1024;
|
|
260
452
|
var DEFAULT_MAX_ASSET_BYTES = 256 * 1024 * 1024;
|
|
@@ -379,17 +571,18 @@ async function applyCliUpdate2(config) {
|
|
|
379
571
|
throw new Error("[stitchkit] update: the asset is not one the signed manifest names");
|
|
380
572
|
}
|
|
381
573
|
}
|
|
382
|
-
const
|
|
574
|
+
const maxBytes = config.maxBytes ?? DEFAULT_MAX_ASSET_BYTES;
|
|
575
|
+
const { bytes, sha256 } = await downloadCliAsset({
|
|
576
|
+
url: new URL(config.asset.url),
|
|
577
|
+
sha256: config.asset.sha256,
|
|
578
|
+
allowPrivateHosts: config.allowPrivateHosts ?? false,
|
|
579
|
+
maxBytes,
|
|
383
580
|
timeoutMs: config.timeoutMs ?? DEFAULT_DOWNLOAD_TIMEOUT_MS,
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
const transferred = await readCapped(response, config.maxBytes ?? DEFAULT_MAX_ASSET_BYTES);
|
|
390
|
-
if (!transferred)
|
|
391
|
-
throw new Error("[stitchkit] update download exceeded the size ceiling");
|
|
392
|
-
const { bytes, sha256 } = await decodeCliAsset(transferred, config.asset, config.maxBytes ?? DEFAULT_MAX_ASSET_BYTES);
|
|
581
|
+
...(config.idleTimeoutMs !== undefined || config.timeoutMs === undefined) && {
|
|
582
|
+
idleTimeoutMs: config.idleTimeoutMs ?? DEFAULT_DOWNLOAD_IDLE_TIMEOUT_MS
|
|
583
|
+
},
|
|
584
|
+
...config.partialPath !== undefined && { partialPath: config.partialPath }
|
|
585
|
+
}, (transferred) => decodeCliAsset(transferred, config.asset, maxBytes));
|
|
393
586
|
if (config.verify)
|
|
394
587
|
await verifyCandidate(target, bytes, config.verify, config.verifyTimeoutMs);
|
|
395
588
|
const backup = config.backupPath ? keepReplacedBinary(target, config.backupPath) : undefined;
|
|
@@ -405,7 +598,7 @@ async function verifyCandidate(target, bytes, verify, timeoutMs = DEFAULT_VERIFY
|
|
|
405
598
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
406
599
|
throw new RangeError("[stitchkit] update: verifyTimeoutMs must be a positive number");
|
|
407
600
|
}
|
|
408
|
-
const candidate = join(
|
|
601
|
+
const candidate = join(dirname2(target), `.${basename(target)}.candidate-${randomBytes(8).toString("hex")}${extname(target)}`);
|
|
409
602
|
writeFileAtomicSync2(candidate, bytes, { mode: 493 });
|
|
410
603
|
const controller = new AbortController;
|
|
411
604
|
let timer;
|
|
@@ -434,23 +627,23 @@ async function verifyCandidate(target, bytes, verify, timeoutMs = DEFAULT_VERIFY
|
|
|
434
627
|
}
|
|
435
628
|
}
|
|
436
629
|
function keepReplacedBinary(target, backupPath) {
|
|
437
|
-
if (!
|
|
630
|
+
if (!existsSync2(target))
|
|
438
631
|
return;
|
|
439
|
-
const previous =
|
|
440
|
-
writeFileAtomicSync2(backupPath, previous, { mode:
|
|
632
|
+
const previous = readFileSync2(target);
|
|
633
|
+
writeFileAtomicSync2(backupPath, previous, { mode: statSync2(target).mode & 511 });
|
|
441
634
|
return { path: backupPath, sha256: createHash2("sha256").update(previous).digest("hex") };
|
|
442
635
|
}
|
|
443
636
|
function rollbackCliUpdate2(config) {
|
|
444
637
|
const target = config.targetPath ?? process.execPath;
|
|
445
|
-
if (!
|
|
638
|
+
if (!existsSync2(config.backupPath)) {
|
|
446
639
|
throw new Error(`[stitchkit] rollback: no backup at ${config.backupPath}`);
|
|
447
640
|
}
|
|
448
|
-
const bytes =
|
|
641
|
+
const bytes = readFileSync2(config.backupPath);
|
|
449
642
|
const sha256 = createHash2("sha256").update(bytes).digest("hex");
|
|
450
643
|
if (sha256 !== config.expectedSha256) {
|
|
451
644
|
throw new Error(`[stitchkit] rollback: backup digest ${sha256} does not match the expected ${config.expectedSha256} — refusing to restore it`);
|
|
452
645
|
}
|
|
453
|
-
writeFileAtomicSync2(target, bytes, { mode:
|
|
646
|
+
writeFileAtomicSync2(target, bytes, { mode: statSync2(config.backupPath).mode & 511 });
|
|
454
647
|
return { path: target, bytes: bytes.length, sha256 };
|
|
455
648
|
}
|
|
456
649
|
|
|
@@ -24,4 +24,34 @@ export declare function withDeadline(value: unknown, timeoutMs: number): Promise
|
|
|
24
24
|
* (referenced) timer, so a pending wait keeps the process alive until its deadline.
|
|
25
25
|
*/
|
|
26
26
|
export declare function withSignalDeadline<T>(timeoutMs: number, caller: AbortSignal | undefined, makeReason: () => unknown, body: (signal: AbortSignal) => Promise<T>): Promise<T>;
|
|
27
|
+
/** The signal and progress hook a body runs under in {@link withIdleDeadline}. */
|
|
28
|
+
export interface IdleDeadline {
|
|
29
|
+
/** Aborts with the parent's reason, or with `makeReason()` when no progress arrives in time. */
|
|
30
|
+
readonly signal: AbortSignal;
|
|
31
|
+
/** Report progress: the quiet period starts again. Does nothing once the body settled. */
|
|
32
|
+
touch(): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Run `body` under a deadline that restarts on every `touch()` — "nothing arrived for
|
|
36
|
+
* `idleMs`" rather than "the whole exchange took too long", so a slow transfer that keeps
|
|
37
|
+
* delivering is never cut off while a silent one still ends.
|
|
38
|
+
*
|
|
39
|
+
* With `idleMs` undefined there is no idle timer and `signal` is the parent's own. The timer is
|
|
40
|
+
* cleared on every outcome, and a `touch()` that arrives after the body settled — a read still
|
|
41
|
+
* finishing behind a released await — re-arms nothing, so no timer outlives the call.
|
|
42
|
+
*/
|
|
43
|
+
export declare function withIdleDeadline<T>(idleMs: number | undefined, parent: AbortSignal, makeReason: () => unknown, body: (idle: IdleDeadline) => Promise<T>): Promise<T>;
|
|
44
|
+
/** A quiet-period timer: `touch()` restarts it, `stop()` ends it for good. */
|
|
45
|
+
export interface IdleTimer {
|
|
46
|
+
touch(): void;
|
|
47
|
+
stop(): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Call `onIdle` once `idleMs` pass without a `touch()`. After `stop()` — or after it fired —
|
|
51
|
+
* nothing re-arms it, so a late `touch()` from a read still draining cannot leave a timer
|
|
52
|
+
* behind. The one timer behind {@link withIdleDeadline} and the guarded fetch's idle bound.
|
|
53
|
+
*/
|
|
54
|
+
export declare function startIdleTimer(idleMs: number, onIdle: () => void, options?: {
|
|
55
|
+
unref?: boolean;
|
|
56
|
+
}): IdleTimer;
|
|
27
57
|
//# sourceMappingURL=deadline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deadline.d.ts","sourceRoot":"","sources":["../../src/internal/deadline.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC,CAiBjE;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,UAAU,EAAE,MAAM,OAAO,EACzB,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,CAAC,CAaZ"}
|
|
1
|
+
{"version":3,"file":"deadline.d.ts","sourceRoot":"","sources":["../../src/internal/deadline.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC,CAiBjE;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,UAAU,EAAE,MAAM,OAAO,EACzB,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,CAAC,CAaZ;AAED,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,gGAAgG;IAChG,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,0FAA0F;IAC1F,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,MAAM,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC,GACvC,OAAO,CAAC,CAAC,CAAC,CAcZ;AAED,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IACxB,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,IAAI,EAClB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,SAAS,CAwBX"}
|
|
@@ -12,7 +12,7 @@ import type { IncomingMessage } from 'node:http';
|
|
|
12
12
|
export type PinnedTransport = (url: URL, resolved: {
|
|
13
13
|
address: string;
|
|
14
14
|
family: 4 | 6;
|
|
15
|
-
}, signal: AbortSignal | undefined) => Promise<Response>;
|
|
15
|
+
}, signal: AbortSignal | undefined, headers?: Record<string, string>) => Promise<Response>;
|
|
16
16
|
/**
|
|
17
17
|
* One hop over a socket opened to `resolved.address`: the `Host` header keeps
|
|
18
18
|
* the URL's host and, for TLS, the certificate is verified against it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pinned-http.d.ts","sourceRoot":"","sources":["../../src/internal/pinned-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAIjD,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GAAG,CAC5B,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,EAC5C,MAAM,EAAE,WAAW,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"pinned-http.d.ts","sourceRoot":"","sources":["../../src/internal/pinned-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAIjD,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GAAG,CAC5B,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,EAC5C,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC7B,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,EAC5C,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACnC,OAAO,CAAC,QAAQ,CAAC,CAiCnB;AAED,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,QAAQ,CA6ClE"}
|
|
@@ -43,6 +43,14 @@ export interface GuardedFetchOptions {
|
|
|
43
43
|
* body must still end. Default 120 seconds.
|
|
44
44
|
*/
|
|
45
45
|
bodyTimeoutMs?: number;
|
|
46
|
+
/**
|
|
47
|
+
* End the fetch when nothing arrives for this long — no headers yet, or no body chunk since
|
|
48
|
+
* the last one. A slow download that keeps delivering is never cut off by it; `bodyTimeoutMs`
|
|
49
|
+
* still bounds the whole body. Unset: no idle bound.
|
|
50
|
+
*/
|
|
51
|
+
idleTimeoutMs?: number;
|
|
52
|
+
/** Request headers (`Range`, `If-Range`), sent on every hop to the starting URL's origin and dropped on a redirect to another. */
|
|
53
|
+
headers?: Record<string, string>;
|
|
46
54
|
/** Optional caller cancellation, combined with both deadlines. */
|
|
47
55
|
signal?: AbortSignal;
|
|
48
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secure-fetch.d.ts","sourceRoot":"","sources":["../../src/internal/secure-fetch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secure-fetch.d.ts","sourceRoot":"","sources":["../../src/internal/secure-fetch.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAmDrD,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CA8D/C;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnF;AAED;;;;;;GAMG;AACH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,GAAG,EAAE,IAAI,CAAA;CAAE,KACnB,OAAO,CAAC,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC;AAQzD,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kIAAkI;IAClI,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,kEAAkE;IAClE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,gBAAgB,CAAC;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,GAAG,EACV,YAAY,EAAE,OAAO,EACrB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,QAAQ,CAAC,CAyEnB;AAwED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6DAA6D;IAC7D,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,GAAG,CAAC;CACV;AAED;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,2BAA2B;CACzC;AA+CD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,sBAAsB,CAAC,CA2CjC;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAGnF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface CliAssetDownload {
|
|
2
|
+
url: URL;
|
|
3
|
+
/** The build's digest from the manifest — what makes a kept part this build's part. */
|
|
4
|
+
sha256: string;
|
|
5
|
+
allowPrivateHosts: boolean;
|
|
6
|
+
/** Ceiling on transferred bytes, a continued part included. */
|
|
7
|
+
maxBytes: number;
|
|
8
|
+
timeoutMs: number;
|
|
9
|
+
idleTimeoutMs?: number;
|
|
10
|
+
/** Keep the transfer here between attempts; without it nothing survives a failure. */
|
|
11
|
+
partialPath?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Download the asset and hand it to `decode`, which throws when the bytes are not the build.
|
|
15
|
+
* Returns what `decode` returns.
|
|
16
|
+
*/
|
|
17
|
+
export declare function downloadCliAsset<T>(config: CliAssetDownload, decode: (bytes: Uint8Array) => Promise<T>): Promise<T>;
|
|
18
|
+
//# sourceMappingURL=resumable-download.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resumable-download.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/resumable-download.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,GAAG,CAAC;IACT,uFAAuF;IACvF,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgBD;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,CAAC,CAgCZ"}
|
|
@@ -52,7 +52,25 @@ export interface CliUpdateApplyConfig {
|
|
|
52
52
|
asset: CliBuildAsset;
|
|
53
53
|
/** The file to replace; defaults to the running executable. */
|
|
54
54
|
targetPath?: string;
|
|
55
|
+
/**
|
|
56
|
+
* How long the download may take, in milliseconds — bounding the response headers and,
|
|
57
|
+
* separately, the body. Default 1 800 000 (30 minutes).
|
|
58
|
+
*/
|
|
55
59
|
timeoutMs?: number;
|
|
60
|
+
/**
|
|
61
|
+
* End the download when nothing arrives for this many milliseconds — no response yet, or no
|
|
62
|
+
* chunk since the last one. Default 30 000 when `timeoutMs` is not set either; with a
|
|
63
|
+
* declared `timeoutMs` there is none unless set.
|
|
64
|
+
*/
|
|
65
|
+
idleTimeoutMs?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Keep the transfer in this file between attempts, so an interrupted download continues from
|
|
68
|
+
* where it stopped (`Range` with `If-Range`) instead of starting over. A record of what the part
|
|
69
|
+
* holds is kept at `<partialPath>.json`, and `<partialPath>.lock` refuses a second download into
|
|
70
|
+
* the same part. Put it in the application's state directory; both files are removed once the
|
|
71
|
+
* download is decoded, whether it was the build or not. Unset: nothing survives a failure.
|
|
72
|
+
*/
|
|
73
|
+
partialPath?: string;
|
|
56
74
|
maxBytes?: number;
|
|
57
75
|
allowPrivateHosts?: boolean;
|
|
58
76
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/update.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAErB,KAAK,cAAc,EAGpB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/update.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAErB,KAAK,cAAc,EAGpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAGlB,MAAM,aAAa,CAAC;AAYrB,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,s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
|
2
|
+
import type { McpConnectionCatalogStore } from './types.js';
|
|
3
|
+
/** The `tools/list` result: the stored one when it is the served catalog, else a fresh one. */
|
|
4
|
+
export declare function listMcpCatalog(params: {
|
|
5
|
+
store: McpConnectionCatalogStore | undefined;
|
|
6
|
+
served: McpCatalogStamp | undefined;
|
|
7
|
+
list: () => Promise<unknown>;
|
|
8
|
+
}): Promise<unknown>;
|
|
9
|
+
//# sourceMappingURL=catalog-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-cache.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/catalog-cache.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,eAAe,EAAuB,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,EAA6B,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAkDpF,+FAA+F;AAC/F,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAC3C,KAAK,EAAE,yBAAyB,GAAG,SAAS,CAAC;IAC7C,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9B,GAAG,OAAO,CAAC,OAAO,CAAC,CAmBnB"}
|
|
@@ -52,9 +52,17 @@ export declare class ConnectionBudgetExceededError extends Error implements Tool
|
|
|
52
52
|
constructor(limit: number, actual: number, unit?: string);
|
|
53
53
|
[TOOL_ERROR_PROJECTION](): AppError;
|
|
54
54
|
}
|
|
55
|
+
/** Which deadline ended an operation: the whole exchange's, or the quiet period's. */
|
|
56
|
+
export type ConnectionDeadline = 'total' | 'idle';
|
|
57
|
+
/** Diagnostics of a timeout: the operation, and which of its deadlines fired. */
|
|
58
|
+
export interface ConnectionTimeoutContext extends ConnectionFailureContext {
|
|
59
|
+
/** Defaults to `'total'`. */
|
|
60
|
+
deadline?: ConnectionDeadline;
|
|
61
|
+
}
|
|
55
62
|
/**
|
|
56
63
|
* One logical operation exceeded its deadline. The original error remains
|
|
57
64
|
* available to in-process observers while tools receive its safe projection.
|
|
65
|
+
* `timeoutMs` is the limit that fired — `idleTimeoutMs` when `deadline` is `'idle'`.
|
|
58
66
|
*/
|
|
59
67
|
export declare class ConnectionTimeoutError extends Error implements ToolErrorProjection {
|
|
60
68
|
readonly connectionName: string;
|
|
@@ -62,7 +70,8 @@ export declare class ConnectionTimeoutError extends Error implements ToolErrorPr
|
|
|
62
70
|
readonly operation: ConnectionOperation;
|
|
63
71
|
readonly phase: ConnectionPhase;
|
|
64
72
|
readonly observedReadBytes: number;
|
|
65
|
-
|
|
73
|
+
readonly deadline: ConnectionDeadline;
|
|
74
|
+
constructor(connectionName: string, timeoutMs: number, context?: ConnectionTimeoutContext);
|
|
66
75
|
[TOOL_ERROR_PROJECTION](): AppError;
|
|
67
76
|
}
|
|
68
77
|
/** A raw response body or legacy response frame exceeded its byte ceiling. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0C,MAAM,uBAAuB,CAAC;AACzF,OAAO,EACL,qBAAqB,EACrB,KAAK,mBAAmB,EACzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEpE,qFAAqF;AACrF,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;GAYG;AAEH,4EAA4E;AAC5E,qBAAa,oCACX,SAAQ,KACR,YAAW,mBAAmB;IAE9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CA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CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAEnC,YACE,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,wBAA6B,EASvC;IAED,CAAC,qBAAqB,CAAC,IAAI,QAAQ,CAgBlC;CACF"}
|
|
@@ -2,16 +2,28 @@ import type { ConnectionReadContext } from './operation-limits.js';
|
|
|
2
2
|
/** Shared defaults for both connection kinds; phase overrides inherit these. */
|
|
3
3
|
export declare const DEFAULT_CONNECTION_TIMEOUT_MS = 30000;
|
|
4
4
|
export declare const DEFAULT_MAX_RESPONSE_BYTES: number;
|
|
5
|
+
/**
|
|
6
|
+
* MCP discovery's own defaults when nothing names a deadline: a catalog of a few hundred tools
|
|
7
|
+
* is hundreds of kilobytes, which a slow link delivers in minutes, so the bound that ends a dead
|
|
8
|
+
* discovery is silence, not length.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_DISCOVERY_TIMEOUT_MS = 300000;
|
|
11
|
+
export declare const DEFAULT_DISCOVERY_IDLE_TIMEOUT_MS = 30000;
|
|
5
12
|
export declare function connectionTimeoutMs(value: number | undefined): number;
|
|
13
|
+
export declare function connectionIdleTimeoutMs(value: number | undefined): number | undefined;
|
|
14
|
+
/** Count bytes read for an operation; every chunk is progress for its idle deadline. */
|
|
15
|
+
export declare function recordConnectionRead(context: ConnectionReadContext, bytes: number): void;
|
|
6
16
|
export declare function connectionMaxResponseBytes(value: number | undefined): number;
|
|
7
17
|
/** Abort races also cover injected streams or promises that do not observe fetch's signal. */
|
|
8
18
|
export declare function awaitConnection<T>(pending: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
|
|
9
19
|
/**
|
|
10
|
-
* One deadline spans negotiation, response waiting and all body reads
|
|
20
|
+
* One deadline spans negotiation, response waiting and all body reads; an optional idle
|
|
21
|
+
* deadline inside it ends the operation when nothing arrives for `idleTimeoutMs` — response
|
|
22
|
+
* headers and every body chunk restart it.
|
|
11
23
|
*
|
|
12
|
-
* `body` receives a copy of `context` that carries the deadline signal
|
|
13
|
-
* own context object is never changed and a context reused across operations
|
|
14
|
-
* stale signal. The copy is the one whose read counters a timeout reports.
|
|
24
|
+
* `body` receives a copy of `context` that carries the deadline signal and the progress hook,
|
|
25
|
+
* so the caller's own context object is never changed and a context reused across operations
|
|
26
|
+
* never holds a stale signal. The copy is the one whose read counters a timeout reports.
|
|
15
27
|
*/
|
|
16
28
|
export declare function withConnectionDeadline<T>(connectionName: string, context: ConnectionReadContext, callerSignal: AbortSignal | undefined, body: (scoped: ConnectionReadContext) => Promise<T>): Promise<T>;
|
|
17
29
|
/** Count raw bytes; Content-Length is deliberately not a trust boundary. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/limits.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,gFAAgF;AAChF,eAAO,MAAM,6BAA6B,QAAS,CAAC;AACpD,eAAO,MAAM,0BAA0B,QAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/limits.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,gFAAgF;AAChF,eAAO,MAAM,6BAA6B,QAAS,CAAC;AACpD,eAAO,MAAM,0BAA0B,QAAc,CAAC;AACtD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,SAAU,CAAC;AACpD,eAAO,MAAM,iCAAiC,QAAS,CAAC;AAExD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAMrE;AAED,wBAAgB,uBAAuB,CAA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stamp.js';
|
|
1
2
|
import type { McpConnectionLimits } from './types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Minimal MCP client over the raw wire, on the global `fetch` — no peer SDK.
|
|
@@ -16,8 +17,9 @@ export interface McpHttpClientOptions {
|
|
|
16
17
|
transport: McpTransportConfig;
|
|
17
18
|
/** The host fence built from the connection URL and its `allowHosts`. */
|
|
18
19
|
allowedHosts: ReadonlySet<string>;
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
/** The connection's shared bounds as declared; phase defaults apply where they are unset. */
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
maxResponseBytes?: number;
|
|
21
23
|
limits?: McpConnectionLimits;
|
|
22
24
|
}
|
|
23
25
|
export declare class McpHttpClient {
|
|
@@ -31,8 +33,14 @@ export declare class McpHttpClient {
|
|
|
31
33
|
private initialized;
|
|
32
34
|
private initialInitializePending;
|
|
33
35
|
private sse;
|
|
36
|
+
private served;
|
|
34
37
|
private readonly limits;
|
|
35
38
|
constructor(connectionName: string, instanceId: string, options: McpHttpClientOptions);
|
|
39
|
+
/**
|
|
40
|
+
* The catalog stamp the server sent with its `initialize` answer, or `undefined` when it sent
|
|
41
|
+
* none — a server that does not stamp, or the legacy SSE transport.
|
|
42
|
+
*/
|
|
43
|
+
servedCatalog(): McpCatalogStamp | undefined;
|
|
36
44
|
/** Forget the session so the next call starts a fresh handshake. */
|
|
37
45
|
teardown(): void;
|
|
38
46
|
initialize(token: string | undefined, signal?: AbortSignal): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/mcp-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/mcp-client.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,sBAAsB,CAAC;AAoB9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM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E,MAAM,GAAG,SAAS,EACzB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,OAAO,CAAC,CAElB;YAEa,QAAQ;YA4BR,iBAAiB;IA4E/B,OAAO,CAAC,OAAO;YAYD,OAAO;YAiBP,UAAU;CAUzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/mcp.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAIhF,OAAO,EACL,KAAK,0BAA0B,EAIhC,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,SAAS,CAAC;AAUlE,gEAAgE;AAChE,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,mBAAmB,EAC/B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,0BAA0B,GACpC,OAAO,CAAC,qBAAqB,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/tools/connections/mcp.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAIhF,OAAO,EACL,KAAK,0BAA0B,EAIhC,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,SAAS,CAAC;AAUlE,gEAAgE;AAChE,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,mBAAmB,EAC/B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,0BAA0B,GACpC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CA+ElC"}
|
|
@@ -2,18 +2,29 @@ import type { ConnectionOperation, ConnectionPhase, McpConnectionLimits } from '
|
|
|
2
2
|
export interface ResolvedConnectionLimits {
|
|
3
3
|
timeoutMs: number;
|
|
4
4
|
maxResponseBytes: number;
|
|
5
|
+
/** Absent: no idle deadline, only `timeoutMs` ends the operation. */
|
|
6
|
+
idleTimeoutMs?: number;
|
|
5
7
|
}
|
|
6
8
|
export interface ConnectionReadContext extends ResolvedConnectionLimits {
|
|
7
9
|
operation: ConnectionOperation;
|
|
8
10
|
phase: ConnectionPhase;
|
|
9
11
|
observedReadBytes: number;
|
|
10
12
|
signal?: AbortSignal;
|
|
13
|
+
/** Progress for the idle deadline; set by `withConnectionDeadline`. */
|
|
14
|
+
touch?: () => void;
|
|
11
15
|
}
|
|
12
16
|
export interface McpPhaseLimits {
|
|
13
17
|
discovery: ResolvedConnectionLimits;
|
|
14
18
|
call: ResolvedConnectionLimits;
|
|
15
19
|
}
|
|
16
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Resolve and validate once at the connection boundary, including unused phases.
|
|
22
|
+
*
|
|
23
|
+
* A phase field wins, then the connection's shared field, then the phase default. Discovery
|
|
24
|
+
* with no declared `timeoutMs` defaults to a long total deadline and a 30-second idle one — a
|
|
25
|
+
* large catalog on a slow link keeps arriving — while a call keeps the shared 30 seconds and no
|
|
26
|
+
* idle deadline, because a tool may legitimately compute in silence before it answers.
|
|
27
|
+
*/
|
|
17
28
|
export declare function resolveMcpLimits(config: {
|
|
18
29
|
timeoutMs?: number;
|
|
19
30
|
maxResponseBytes?: number;
|