stitchkit 0.123.7 → 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.
Files changed (104) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/dist/entrypoints/agent-runtime/coding-tools.js +1 -1
  3. package/dist/entrypoints/agent-runtime/realtime.js +3 -3
  4. package/dist/entrypoints/agent-runtime/sandbox.js +1 -1
  5. package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
  6. package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
  7. package/dist/entrypoints/agent-runtime/testing.js +3 -3
  8. package/dist/entrypoints/agent-runtime.js +3 -3
  9. package/dist/entrypoints/application/diagnostic-journal.js +3 -5
  10. package/dist/entrypoints/application/directory-inbox.js +9 -11
  11. package/dist/entrypoints/application.js +3 -3
  12. package/dist/entrypoints/cli/publish.js +6 -6
  13. package/dist/entrypoints/cli.js +7 -4
  14. package/dist/entrypoints/files.js +5 -5
  15. package/dist/entrypoints/index.js +3 -3
  16. package/dist/entrypoints/server.js +6 -6
  17. package/dist/entrypoints/telegram.js +2 -2
  18. package/dist/entrypoints/tools/connections.d.ts +2 -2
  19. package/dist/entrypoints/tools/connections.d.ts.map +1 -1
  20. package/dist/entrypoints/tools/connections.js +121 -29
  21. package/dist/entrypoints/tools/contract.d.ts +1 -1
  22. package/dist/entrypoints/tools/contract.d.ts.map +1 -1
  23. package/dist/entrypoints/tools/contract.js +3 -1
  24. package/dist/entrypoints/tools/mcp.d.ts +1 -1
  25. package/dist/entrypoints/tools/mcp.d.ts.map +1 -1
  26. package/dist/entrypoints/tools/mcp.js +8 -6
  27. package/dist/entrypoints/tools/toolkit.js +3 -3
  28. package/dist/entrypoints/tools.d.ts +1 -1
  29. package/dist/entrypoints/tools.d.ts.map +1 -1
  30. package/dist/entrypoints/tools.js +25 -30
  31. package/dist/{index-jswst0h3.js → index-03qrr49d.js} +49 -4
  32. package/dist/{index-8yky60kq.js → index-1szhrfsf.js} +5 -7
  33. package/dist/{index-mqttte96.js → index-3ymcmpa9.js} +3 -5
  34. package/dist/{index-v8xm2s9v.js → index-7177dxjn.js} +1 -1
  35. package/dist/{index-2x2ch0bt.js → index-782qtc24.js} +1 -1
  36. package/dist/{index-j8rda9n6.js → index-8pwwd6rp.js} +3 -3
  37. package/dist/{index-m616f0yz.js → index-8x0q6yfb.js} +134 -7
  38. package/dist/{index-1a741dpf.js → index-e1x6vze4.js} +10 -4
  39. package/dist/{index-ezwvsqx9.js → index-fvd6pvw3.js} +1 -1
  40. package/dist/{index-bknzva6n.js → index-gy9x38a2.js} +4 -3
  41. package/dist/{index-w0wy05gr.js → index-jkjh7zw4.js} +50 -40
  42. package/dist/{index-ac6vvm30.js → index-jp2qd9jb.js} +1 -1
  43. package/dist/index-mm89hd8v.js +39 -0
  44. package/dist/{index-jc5xgkpk.js → index-qsm899qp.js} +1 -1
  45. package/dist/index-wqzw3qg9.js +91 -0
  46. package/dist/{index-364k2zwa.js → index-wt6rw7rf.js} +5 -7
  47. package/dist/{index-tt3ej8r3.js → index-x0769xt9.js} +217 -24
  48. package/dist/internal/deadline.d.ts +30 -0
  49. package/dist/internal/deadline.d.ts.map +1 -1
  50. package/dist/internal/pinned-http.d.ts +1 -1
  51. package/dist/internal/pinned-http.d.ts.map +1 -1
  52. package/dist/internal/secure-fetch.d.ts +8 -0
  53. package/dist/internal/secure-fetch.d.ts.map +1 -1
  54. package/dist/tools/cli/inline-files.d.ts +5 -5
  55. package/dist/tools/cli/inline-files.d.ts.map +1 -1
  56. package/dist/tools/cli/resumable-download.d.ts +18 -0
  57. package/dist/tools/cli/resumable-download.d.ts.map +1 -0
  58. package/dist/tools/cli/update.d.ts +18 -0
  59. package/dist/tools/cli/update.d.ts.map +1 -1
  60. package/dist/tools/connections/catalog-cache.d.ts +9 -0
  61. package/dist/tools/connections/catalog-cache.d.ts.map +1 -0
  62. package/dist/tools/connections/errors.d.ts +10 -1
  63. package/dist/tools/connections/errors.d.ts.map +1 -1
  64. package/dist/tools/connections/limits.d.ts +16 -4
  65. package/dist/tools/connections/limits.d.ts.map +1 -1
  66. package/dist/tools/connections/mcp-client.d.ts +10 -2
  67. package/dist/tools/connections/mcp-client.d.ts.map +1 -1
  68. package/dist/tools/connections/mcp.d.ts.map +1 -1
  69. package/dist/tools/connections/operation-limits.d.ts +12 -1
  70. package/dist/tools/connections/operation-limits.d.ts.map +1 -1
  71. package/dist/tools/connections/sse-session.d.ts +2 -2
  72. package/dist/tools/connections/sse-session.d.ts.map +1 -1
  73. package/dist/tools/connections/types.d.ts +38 -2
  74. package/dist/tools/connections/types.d.ts.map +1 -1
  75. package/dist/tools/mcp/catalog-stamp.d.ts +47 -0
  76. package/dist/tools/mcp/catalog-stamp.d.ts.map +1 -0
  77. package/dist/tools/mcp/catalog.d.ts +1 -30
  78. package/dist/tools/mcp/catalog.d.ts.map +1 -1
  79. package/dist/tools/mcp/handler.d.ts.map +1 -1
  80. package/dist/tools/mcp/mount.d.ts +6 -1
  81. package/dist/tools/mcp/mount.d.ts.map +1 -1
  82. package/dist/tools/mcp/register.d.ts +1 -1
  83. package/dist/tools/mcp/register.d.ts.map +1 -1
  84. package/dist/tools/mcp/runtime-tools.d.ts +1 -1
  85. package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
  86. package/dist/tools/transfer/view-file-contract.d.ts +17 -6
  87. package/dist/tools/transfer/view-file-contract.d.ts.map +1 -1
  88. package/dist/tools/transfer/view-file.d.ts +1 -1
  89. package/dist/tools/transfer/view-file.d.ts.map +1 -1
  90. package/llms/cli.2.txt +60 -6
  91. package/llms/cli.txt +3 -2
  92. package/llms/stitchkit.txt +3 -3
  93. package/llms/tools-connections.txt +5 -3
  94. package/llms/tools-mcp.txt +5 -2
  95. package/llms/tools.2.txt +10 -4
  96. package/llms/tools.3.txt +2 -1
  97. package/llms/tools.txt +10 -3
  98. package/llms/{upgrading-0.106.0-0.123.0.txt → upgrading-0.106.0-0.124.0.txt} +39 -3
  99. package/llms/upgrading.txt +1 -1
  100. package/llms-full.txt +134 -24
  101. package/llms.txt +5 -5
  102. package/package.json +1 -1
  103. package/dist/index-9tqbxv5p.js +0 -44
  104. package/dist/index-b56nnscm.js +0 -132
@@ -13,8 +13,10 @@ import {
13
13
  markRemoteSchemaVerdict
14
14
  } from "../../index-dsa676h8.js";
15
15
  import {
16
- withSignalDeadline
17
- } from "../../index-9tqbxv5p.js";
16
+ MCP_CATALOG_HEADER,
17
+ readMcpCatalogStamp2,
18
+ readMcpCatalogHeader
19
+ } from "../../index-mm89hd8v.js";
18
20
  import {
19
21
  defineRuntimeTool2
20
22
  } from "../../index-6k47xdtt.js";
@@ -24,6 +26,11 @@ import {
24
26
  import {
25
27
  raceAbort
26
28
  } from "../../index-b0kddvzw.js";
29
+ import {
30
+ withDeadline,
31
+ withSignalDeadline,
32
+ withIdleDeadline
33
+ } from "../../index-wqzw3qg9.js";
27
34
  import {
28
35
  safeJsonParse
29
36
  } from "../../index-zsarb5xp.js";
@@ -161,11 +168,14 @@ class ConnectionTimeoutError extends Error {
161
168
  operation;
162
169
  phase;
163
170
  observedReadBytes;
171
+ deadline;
164
172
  constructor(connectionName, timeoutMs, context = {}) {
165
- super(`Connection "${connectionName}" timed out after ${timeoutMs} ms`);
173
+ const deadline = context.deadline ?? "total";
174
+ super(deadline === "idle" ? `Connection "${connectionName}" received nothing for ${timeoutMs} ms` : `Connection "${connectionName}" timed out after ${timeoutMs} ms`);
166
175
  this.name = "ConnectionTimeoutError";
167
176
  this.connectionName = connectionName;
168
177
  this.timeoutMs = timeoutMs;
178
+ this.deadline = deadline;
169
179
  this.operation = context.operation ?? "request";
170
180
  this.phase = context.phase ?? "call";
171
181
  this.observedReadBytes = context.observedReadBytes ?? 0;
@@ -178,6 +188,7 @@ class ConnectionTimeoutError extends Error {
178
188
  details: {
179
189
  message,
180
190
  reason: "deadline-exceeded",
191
+ deadline: this.deadline,
181
192
  operation: this.operation,
182
193
  phase: this.phase,
183
194
  timeoutMs: this.timeoutMs,
@@ -226,6 +237,8 @@ class ConnectionResponseTooLargeError extends Error {
226
237
  // src/tools/connections/limits.ts
227
238
  var DEFAULT_CONNECTION_TIMEOUT_MS = 30000;
228
239
  var DEFAULT_MAX_RESPONSE_BYTES = 1024 * 1024;
240
+ var DEFAULT_DISCOVERY_TIMEOUT_MS = 300000;
241
+ var DEFAULT_DISCOVERY_IDLE_TIMEOUT_MS = 30000;
229
242
  function connectionTimeoutMs(value) {
230
243
  if (value === undefined)
231
244
  return DEFAULT_CONNECTION_TIMEOUT_MS;
@@ -234,6 +247,18 @@ function connectionTimeoutMs(value) {
234
247
  }
235
248
  return value;
236
249
  }
250
+ function connectionIdleTimeoutMs(value) {
251
+ if (value === undefined)
252
+ return;
253
+ if (!Number.isSafeInteger(value) || value <= 0 || value > MAX_TIMER_MS) {
254
+ throw new RangeError("Connection idleTimeoutMs must be a positive integer within timer range");
255
+ }
256
+ return value;
257
+ }
258
+ function recordConnectionRead(context, bytes) {
259
+ context.observedReadBytes += bytes;
260
+ context.touch?.();
261
+ }
237
262
  function connectionMaxResponseBytes(value) {
238
263
  if (value === undefined)
239
264
  return DEFAULT_MAX_RESPONSE_BYTES;
@@ -245,11 +270,15 @@ function awaitConnection(pending, signal) {
245
270
  }
246
271
  function withConnectionDeadline(connectionName, context, callerSignal, body) {
247
272
  const timeoutMs = connectionTimeoutMs(context.timeoutMs);
273
+ const idleTimeoutMs = connectionIdleTimeoutMs(context.idleTimeoutMs);
248
274
  let scoped = context;
249
- return withSignalDeadline(timeoutMs, callerSignal, () => new ConnectionTimeoutError(connectionName, timeoutMs, scoped), (signal) => {
250
- scoped = { ...context, signal };
251
- return raceAbort(body(scoped), signal);
252
- });
275
+ return withSignalDeadline(timeoutMs, callerSignal, () => new ConnectionTimeoutError(connectionName, timeoutMs, scoped), (signal) => withIdleDeadline(idleTimeoutMs, signal, () => new ConnectionTimeoutError(connectionName, idleTimeoutMs ?? timeoutMs, {
276
+ ...scoped,
277
+ deadline: "idle"
278
+ }), (idle) => {
279
+ scoped = { ...context, signal: idle.signal, touch: idle.touch };
280
+ return raceAbort(body(scoped), idle.signal);
281
+ }));
253
282
  }
254
283
  async function readBoundedText(response, maxBytes, connectionName, context) {
255
284
  const result = await readBoundedChunks(response.body, {
@@ -257,7 +286,7 @@ async function readBoundedText(response, maxBytes, connectionName, context) {
257
286
  ...context?.signal && { signal: context.signal },
258
287
  onChunk: (chunk) => {
259
288
  if (context)
260
- context.observedReadBytes += chunk.byteLength;
289
+ recordConnectionRead(context, chunk.byteLength);
261
290
  }
262
291
  });
263
292
  if (result.kind === "over-limit") {
@@ -285,15 +314,17 @@ async function readConnectionErrorText(response, connectionName, context) {
285
314
 
286
315
  // src/tools/connections/operation-limits.ts
287
316
  function resolveMcpLimits(config) {
288
- const shared = {
289
- timeoutMs: connectionTimeoutMs(config.timeoutMs),
290
- maxResponseBytes: connectionMaxResponseBytes(config.maxResponseBytes)
291
- };
317
+ const sharedTimeoutMs = config.timeoutMs === undefined ? undefined : connectionTimeoutMs(config.timeoutMs);
318
+ const sharedMaxResponseBytes = connectionMaxResponseBytes(config.maxResponseBytes);
292
319
  const resolve = (phase) => {
293
320
  const override = config.limits?.[phase];
321
+ const discovery = phase === "discovery";
322
+ const declaredTimeout = override?.timeoutMs !== undefined || sharedTimeoutMs !== undefined;
323
+ const idleTimeoutMs = connectionIdleTimeoutMs(override?.idleTimeoutMs ?? (discovery && !declaredTimeout ? DEFAULT_DISCOVERY_IDLE_TIMEOUT_MS : undefined));
294
324
  return {
295
- timeoutMs: connectionTimeoutMs(override?.timeoutMs === undefined ? shared.timeoutMs : override.timeoutMs),
296
- maxResponseBytes: connectionMaxResponseBytes(override?.maxResponseBytes === undefined ? shared.maxResponseBytes : override.maxResponseBytes)
325
+ timeoutMs: connectionTimeoutMs(override?.timeoutMs ?? sharedTimeoutMs ?? (discovery ? DEFAULT_DISCOVERY_TIMEOUT_MS : undefined)),
326
+ maxResponseBytes: connectionMaxResponseBytes(override?.maxResponseBytes === undefined ? sharedMaxResponseBytes : override.maxResponseBytes),
327
+ ...idleTimeoutMs !== undefined && { idleTimeoutMs }
297
328
  };
298
329
  };
299
330
  return { discovery: resolve("discovery"), call: resolve("call") };
@@ -363,7 +394,52 @@ function connectionInstanceId(name, url, instanceKey) {
363
394
  }
364
395
 
365
396
  // src/tools/connections/mcp.ts
366
- import { z as z2 } from "zod";
397
+ import { z as z3 } from "zod";
398
+
399
+ // src/tools/connections/catalog-cache.ts
400
+ import { z } from "zod";
401
+ var StoredEntrySchema = z.object({
402
+ stamp: z.object({ digest: z.string().min(1), tools: z.int().nonnegative() }),
403
+ result: z.unknown()
404
+ });
405
+ function sameStamp(left, right) {
406
+ return left !== null && left.digest === right.digest && left.tools === right.tools;
407
+ }
408
+ function listedUnder(result, stamp) {
409
+ if (!isRecord(result) || !Array.isArray(result.tools))
410
+ return false;
411
+ if (result.tools.length !== stamp.tools)
412
+ return false;
413
+ return result.tools.every((tool) => isRecord(tool) && sameStamp(readMcpCatalogStamp2(tool._meta), stamp));
414
+ }
415
+ var STORE_TIMEOUT_MS = 1e4;
416
+ async function loadEntry(store) {
417
+ try {
418
+ const loaded = await withDeadline(Promise.resolve(store.load()), STORE_TIMEOUT_MS);
419
+ if (!loaded.settled)
420
+ return;
421
+ const parsed = StoredEntrySchema.safeParse(loaded.value);
422
+ return parsed.success ? parsed.data : undefined;
423
+ } catch {
424
+ return;
425
+ }
426
+ }
427
+ async function listMcpCatalog(params) {
428
+ const { store, served } = params;
429
+ if (!store || !served)
430
+ return params.list();
431
+ const stored = await loadEntry(store);
432
+ if (stored && sameStamp(stored.stamp, served) && listedUnder(stored.result, served)) {
433
+ return stored.result;
434
+ }
435
+ const result = await params.list();
436
+ if (listedUnder(result, served)) {
437
+ try {
438
+ await withDeadline(Promise.resolve(store.store({ stamp: { ...served }, result })), STORE_TIMEOUT_MS);
439
+ } catch {}
440
+ }
441
+ return result;
442
+ }
367
443
 
368
444
  // src/tools/connections/http.ts
369
445
  async function fetchConnection(target, init, allowedHosts, connectionName) {
@@ -415,7 +491,7 @@ async function* readSseFrames(response, maxBytes, connectionName, options = {})
415
491
  if (options.onChunk)
416
492
  options.onChunk(value.byteLength);
417
493
  else if (options.context)
418
- options.context.observedReadBytes += value.byteLength;
494
+ recordConnectionRead(options.context, value.byteLength);
419
495
  if (options.totalLimit && bytes > (context()?.maxResponseBytes ?? maxBytes)) {
420
496
  throw tooLarge(bytes);
421
497
  }
@@ -552,6 +628,7 @@ class SseSession {
552
628
  body: JSON.stringify(message),
553
629
  signal
554
630
  }, this.options.allowedHosts, this.connectionName);
631
+ context.touch?.();
555
632
  await this.assertStatus(post, context);
556
633
  await readBoundedText(post, context.maxResponseBytes, this.connectionName, context);
557
634
  return message.id === undefined ? undefined : await awaitConnection(response.promise, signal);
@@ -586,7 +663,7 @@ class SseSession {
586
663
  observeChunk(bytes) {
587
664
  const active = this.endpointReady ? this.active : new Set([this.endpointContext]);
588
665
  for (const context of active) {
589
- context.observedReadBytes += bytes;
666
+ recordConnectionRead(context, bytes);
590
667
  const total = (this.streamBytes.get(context) ?? 0) + bytes;
591
668
  this.streamBytes.set(context, total);
592
669
  if (total > context.maxResponseBytes) {
@@ -602,7 +679,7 @@ class SseSession {
602
679
  signal: this.controller.signal
603
680
  }, this.options.allowedHosts, this.connectionName);
604
681
  await this.assertStatus(response, this.endpointContext);
605
- for await (const frame of readSseFrames(response, this.options.maxResponseBytes, this.connectionName, {
682
+ for await (const frame of readSseFrames(response, connectionMaxResponseBytes(this.options.maxResponseBytes), this.connectionName, {
606
683
  signal: this.controller.signal,
607
684
  currentContext: () => this.currentContext(),
608
685
  onChunk: (bytes) => this.observeChunk(bytes)
@@ -649,6 +726,7 @@ class McpHttpClient {
649
726
  initialized = false;
650
727
  initialInitializePending = true;
651
728
  sse;
729
+ served;
652
730
  limits;
653
731
  constructor(connectionName, instanceId, options) {
654
732
  this.connectionName = connectionName;
@@ -656,8 +734,12 @@ class McpHttpClient {
656
734
  this.options = options;
657
735
  this.limits = resolveMcpLimits(options);
658
736
  }
737
+ servedCatalog() {
738
+ return this.served;
739
+ }
659
740
  teardown() {
660
741
  this.initialized = false;
742
+ this.served = undefined;
661
743
  this.initialInitializePending = true;
662
744
  this.sessionId = undefined;
663
745
  this.sse?.close();
@@ -719,6 +801,7 @@ class McpHttpClient {
719
801
  body: JSON.stringify(message),
720
802
  signal: context.signal
721
803
  }, this.options.allowedHosts, this.connectionName);
804
+ context.touch?.();
722
805
  if (response.status === 401) {
723
806
  response.body?.cancel().catch(() => {
724
807
  return;
@@ -731,6 +814,9 @@ class McpHttpClient {
731
814
  const session = response.headers.get("mcp-session-id");
732
815
  if (session)
733
816
  this.sessionId = session;
817
+ if (message.method === "initialize") {
818
+ this.served = readMcpCatalogHeader(response.headers.get(MCP_CATALOG_HEADER)) ?? undefined;
819
+ }
734
820
  if (message.id === undefined) {
735
821
  await readBoundedText(response, context.maxResponseBytes, this.connectionName, context);
736
822
  return;
@@ -833,7 +919,7 @@ function mcpToolFailure(toolName, result) {
833
919
  }
834
920
 
835
921
  // src/tools/connections/runtime.ts
836
- import { z } from "zod";
922
+ import { z as z2 } from "zod";
837
923
  async function withConnectionToken(params, body) {
838
924
  const token = await params.provider?.(params.context);
839
925
  try {
@@ -847,14 +933,14 @@ async function withConnectionToken(params, body) {
847
933
  }
848
934
  function zodObjectFromJsonSchema(schema) {
849
935
  if (!schema || Object.keys(schema).length === 0)
850
- return z.looseObject({});
851
- const parsed = z.fromJSONSchema(reconcileDialect(schema));
852
- if (parsed instanceof z.ZodObject) {
936
+ return z2.looseObject({});
937
+ const parsed = z2.fromJSONSchema(reconcileDialect(schema));
938
+ if (parsed instanceof z2.ZodObject) {
853
939
  markJsonSchemaObjectGuards(parsed);
854
940
  markRemoteSchemaVerdict(parsed);
855
941
  return parsed;
856
942
  }
857
- return z.looseObject({});
943
+ return z2.looseObject({});
858
944
  }
859
945
  function reconcileDialect(schema) {
860
946
  return declaresDraft07(schema.$schema) ? schema : withDraft2020Keywords(schema);
@@ -903,14 +989,20 @@ async function mountMcpConnection(connection, instanceId, onSkipped) {
903
989
  const createClient = () => new McpHttpClient(connection.name, instanceId, {
904
990
  transport: connection.transport,
905
991
  allowedHosts,
906
- timeoutMs: connectionTimeoutMs(connection.timeoutMs),
907
- maxResponseBytes: connectionMaxResponseBytes(connection.maxResponseBytes),
992
+ ...connection.timeoutMs !== undefined && { timeoutMs: connection.timeoutMs },
993
+ ...connection.maxResponseBytes !== undefined && {
994
+ maxResponseBytes: connection.maxResponseBytes
995
+ },
908
996
  ...connection.limits && { limits: connection.limits }
909
997
  });
910
998
  const discovery = createClient();
911
999
  const listed = await withConnectionToken({ instanceId, provider: connection.token, client: discovery }, async (token) => {
912
1000
  await discovery.initialize(token);
913
- return discovery.request("tools/list", {}, token);
1001
+ return listMcpCatalog({
1002
+ store: connection.catalog,
1003
+ served: discovery.servedCatalog(),
1004
+ list: () => discovery.request("tools/list", {}, token)
1005
+ });
914
1006
  }).finally(() => discovery.teardown());
915
1007
  const discovered = readDiscoveredTools(listed, connection.name);
916
1008
  const filtered = filterMcpTools(discovered, connection.tools);
@@ -925,7 +1017,7 @@ async function mountMcpConnection(connection, instanceId, onSkipped) {
925
1017
  ...tool.annotations && { annotations: tool.annotations },
926
1018
  ...connection.transports && { transports: connection.transports },
927
1019
  input,
928
- output: z2.unknown(),
1020
+ output: z3.unknown(),
929
1021
  handler: (context) => {
930
1022
  const client = createClient();
931
1023
  return withConnectionToken({ instanceId, provider: connection.token, client, context }, async (token) => {
@@ -966,7 +1058,7 @@ function filterMcpTools(tools, filter) {
966
1058
  }
967
1059
 
968
1060
  // src/tools/connections/openapi.ts
969
- import { z as z3 } from "zod";
1061
+ import { z as z4 } from "zod";
970
1062
 
971
1063
  // src/tools/connections/openapi-document.ts
972
1064
  function resolveOpenApiDocument(document) {
@@ -1062,7 +1154,7 @@ async function mountOpenApiConnection(connection, instanceId, onSkipped) {
1062
1154
  },
1063
1155
  ...connection.transports && { transports: connection.transports },
1064
1156
  input,
1065
- output: z3.unknown(),
1157
+ output: z4.unknown(),
1066
1158
  handler: (context) => withConnectionToken({ instanceId, provider: connection.token, context }, async (token) => {
1067
1159
  const args = isRecord(context.input) ? context.input : {};
1068
1160
  const url = buildOperationUrl(baseUrl, entry, args);
@@ -25,5 +25,5 @@
25
25
  */
26
26
  export { type AsyncOperationCancelResult, AsyncOperationCancelResultSchema, type AsyncOperationCapability, type AsyncOperationSnapshotSchema, type AsyncOperationSnapshotSchemaWithProgress, createAsyncOperationSnapshotSchema, } from '../../tools/operations/async-operation-contract.js';
27
27
  export { coerceJsonArgs } from '../../tools/schema/coerce.js';
28
- export { type McpAnnotations, McpAnnotationsSchema, type McpMediaContent, McpMediaContentSchema, ViewFileErrorSchema, ViewFileInputSchema, type ViewFileOutput, ViewFileOutputSchema, } from '../../tools/transfer/view-file-contract.js';
28
+ export { MCP_FILE_NAME_META_KEY, type McpAnnotations, McpAnnotationsSchema, type McpMediaContent, McpMediaContentSchema, ViewFileErrorSchema, ViewFileInputSchema, type ViewFileOutput, ViewFileOutputSchema, } from '../../tools/transfer/view-file-contract.js';
29
29
  //# sourceMappingURL=contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/tools/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,EAChC,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,wCAAwC,EAC7C,kCAAkC,GACnC,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,eAAe,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,yCAAyC,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/tools/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,EAChC,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,wCAAwC,EAC7C,kCAAkC,GACnC,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,sBAAsB,EACtB,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,eAAe,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,yCAAyC,CAAC"}
@@ -4,17 +4,19 @@ import {
4
4
  } from "../../index-81t0bf0f.js";
5
5
  import {
6
6
  McpAnnotationsSchema2,
7
+ MCP_FILE_NAME_META_KEY2,
7
8
  McpMediaContentSchema2,
8
9
  ViewFileErrorSchema2,
9
10
  ViewFileOutputSchema2,
10
11
  ViewFileInputSchema2
11
- } from "../../index-bknzva6n.js";
12
+ } from "../../index-gy9x38a2.js";
12
13
  import {
13
14
  coerceJsonArgs2
14
15
  } from "../../index-t8jz0e20.js";
15
16
  import"../../index-dsa676h8.js";
16
17
  export {
17
18
  AsyncOperationCancelResultSchema2 as AsyncOperationCancelResultSchema,
19
+ MCP_FILE_NAME_META_KEY2 as MCP_FILE_NAME_META_KEY,
18
20
  McpAnnotationsSchema2 as McpAnnotationsSchema,
19
21
  McpMediaContentSchema2 as McpMediaContentSchema,
20
22
  ViewFileErrorSchema2 as ViewFileErrorSchema,
@@ -1,7 +1,7 @@
1
1
  export type { McpServer } from '@modelcontextprotocol/server';
2
2
  export type { ToolSurfaceProjection } from '../../tools/internal/surface-projector.js';
3
3
  export { EXT_APPS_BUNDLE_PLACEHOLDER, inlineMcpAppBundle, type McpAppCsp, type McpAppResourceMeta, type McpResourceDef, RESOURCE_MIME_TYPE, } from '../../tools/mcp/app.js';
4
- export { MCP_CATALOG_META_KEY, type McpCatalogStamp, mcpCatalogMeta, readMcpCatalogStamp, } from '../../tools/mcp/catalog.js';
4
+ export { MCP_CATALOG_META_KEY, type McpCatalogStamp, mcpCatalogMeta, readMcpCatalogStamp, } from '../../tools/mcp/catalog-stamp.js';
5
5
  export { createMcpHandler, createMcpHttpRoute, type McpHandlerConfig, type McpHttpConfig, type McpHttpHandler, type McpHttpSecurityConfig, type McpLegacyPolicy, } from '../../tools/mcp/handler.js';
6
6
  export { buildMcpServer, type DirectMcpSurfaceConfig, type FiniteMcpSurfaceConfig, type McpMountConfig, type McpServerBuildConfig, type McpServerSharedConfig, mountMcp, mountMcpResource, validateMcpSchemas, } from '../../tools/mcp/mount.js';
7
7
  export type { IncompatibleSchemaPolicy, McpSchemaValidationConfig, McpSurfaceDefinition, McpSurfaceRegistry, ValidateMcpSchemasConfig, } from '../../tools/mcp/prepare.js';
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/tools/mcp.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,KAAK,eAAe,EACpB,cAAc,EACd,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,GAChC,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,qBAAqB,EACrB,+BAA+B,EAC/B,kCAAkC,GACnC,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EACV,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/tools/mcp.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,KAAK,eAAe,EACpB,cAAc,EACd,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,GAChC,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,qBAAqB,EACrB,+BAA+B,EAC/B,kCAAkC,GACnC,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EACV,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC"}
@@ -1,19 +1,16 @@
1
- import"../../index-ct75c3at.js";
2
- import"../../index-332d0m9g.js";
3
1
  import"../../index-ndjzbt2v.js";
4
2
  import"../../index-dsa676h8.js";
5
3
  import"../../index-t8jz0e20.js";
4
+ import"../../index-ct75c3at.js";
6
5
  import"../../index-tynna0n4.js";
7
6
  import"../../index-s512scra.js";
8
7
  import"../../index-yt1gg11x.js";
9
8
  import"../../index-qc7tq0za.js";
9
+ import"../../index-332d0m9g.js";
10
10
  import {
11
11
  RESOURCE_MIME_TYPE2,
12
12
  EXT_APPS_BUNDLE_PLACEHOLDER2,
13
13
  inlineMcpAppBundle2,
14
- MCP_CATALOG_META_KEY2,
15
- mcpCatalogMeta2,
16
- readMcpCatalogStamp2,
17
14
  validateMcpSchemas2,
18
15
  mountMcp2,
19
16
  buildMcpServer2,
@@ -21,13 +18,18 @@ import {
21
18
  createMcpHandler2,
22
19
  createMcpHttpRoute2,
23
20
  createStdioMcpServer2
24
- } from "../../index-w0wy05gr.js";
21
+ } from "../../index-jkjh7zw4.js";
25
22
  import {
26
23
  DEFAULT_PROCESS_SIGNALS,
27
24
  defaultSignalSource,
28
25
  reportSignalError,
29
26
  guardSignalCallback
30
27
  } from "../../index-3prvb42w.js";
28
+ import {
29
+ MCP_CATALOG_META_KEY2,
30
+ mcpCatalogMeta2,
31
+ readMcpCatalogStamp2
32
+ } from "../../index-mm89hd8v.js";
31
33
  import"../../index-993vtv1w.js";
32
34
  import"../../index-6k47xdtt.js";
33
35
  // src/tools/mcp/stdio-signals.ts
@@ -11,17 +11,17 @@ import {
11
11
  } from "../../index-yebkpytc.js";
12
12
  import {
13
13
  createCli2
14
- } from "../../index-1a741dpf.js";
14
+ } from "../../index-e1x6vze4.js";
15
15
  import"../../index-332d0m9g.js";
16
16
  import"../../index-sqc6ezrb.js";
17
- import"../../index-bknzva6n.js";
17
+ import"../../index-gy9x38a2.js";
18
18
  import"../../index-0v9xb8pz.js";
19
19
  import {
20
20
  mountMcp2,
21
21
  buildMcpServer2,
22
22
  createMcpHandler2,
23
23
  createStdioMcpServer2
24
- } from "../../index-w0wy05gr.js";
24
+ } from "../../index-jkjh7zw4.js";
25
25
  import"../../index-fa53vygr.js";
26
26
  import"../../index-ww3gss55.js";
27
27
  import"../../index-993vtv1w.js";
@@ -38,7 +38,7 @@ export { type DefineUploadToolConfig, defineUploadTool, UploadToolInputSchema, }
38
38
  export { type DefineViewFileToolConfig, defineViewFileTool, } from '../tools/transfer/define-view-file-tool.js';
39
39
  export { type DownloadToolConfig, mountDownload } from '../tools/transfer/mount-download.js';
40
40
  export { mountUpload, type UploadToolConfig } from '../tools/transfer/mount-upload.js';
41
- export { mountViewFile, resolveMedia, type ViewFileOptions, } from '../tools/transfer/view-file.js';
41
+ export { MCP_FILE_NAME_META_KEY, mountViewFile, resolveMedia, type ViewFileOptions, } from '../tools/transfer/view-file.js';
42
42
  export { summarizeTransports, type TransportCounts, type TransportSummary, } from '../tools/transports.js';
43
43
  export * from './tools/contract.js';
44
44
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/entrypoints/tools.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,yBAAyB,EACzB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,qBAAqB,EACrB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,iCAAiC,GAClC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,kBAAkB,EAClB,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;A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ACb,YAAY,EACZ,KAAK,eAAe,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
@@ -45,11 +45,12 @@ import {
45
45
  } from "../index-xqhede6x.js";
46
46
  import {
47
47
  McpAnnotationsSchema2,
48
+ MCP_FILE_NAME_META_KEY2,
48
49
  McpMediaContentSchema2,
49
50
  ViewFileErrorSchema2,
50
51
  ViewFileOutputSchema2,
51
52
  ViewFileInputSchema2
52
- } from "../index-bknzva6n.js";
53
+ } from "../index-gy9x38a2.js";
53
54
  import {
54
55
  signJwt2,
55
56
  verifyPkce2
@@ -99,12 +100,12 @@ import {
99
100
  } from "../index-6k47xdtt.js";
100
101
  import {
101
102
  ManagedFileError2
102
- } from "../index-364k2zwa.js";
103
+ } from "../index-wt6rw7rf.js";
103
104
  import {
104
105
  fetchGuarded,
105
106
  fetchPinnedDocument,
106
107
  readCapped
107
- } from "../index-jswst0h3.js";
108
+ } from "../index-03qrr49d.js";
108
109
  import {
109
110
  readBoundedChunks,
110
111
  concatChunks
@@ -1625,6 +1626,13 @@ function isHttpUrl(pathOrUrl) {
1625
1626
  function sourceName(pathOrUrl, mimeType) {
1626
1627
  return isHttpUrl(pathOrUrl) ? downloadFileName(pathOrUrl, mimeType) : basename2(pathOrUrl);
1627
1628
  }
1629
+ function inlineBlockType(mimeType) {
1630
+ if (mimeType.startsWith("image/"))
1631
+ return "image";
1632
+ if (mimeType.startsWith("audio/"))
1633
+ return "audio";
1634
+ return;
1635
+ }
1628
1636
  async function fetchSource(pathOrUrl, options, maxBytes) {
1629
1637
  const extension = extname2(pathOrUrl);
1630
1638
  const extMime = EXT_MIME[extension.toLowerCase()];
@@ -1714,38 +1722,24 @@ async function resolveMediaWithinBudget(pathOrUrl, options, maxBytes) {
1714
1722
  }
1715
1723
  const { buffer, mimeType } = result;
1716
1724
  const sizeKb = (buffer.length / 1024).toFixed(0);
1717
- if (mimeType.startsWith("image/")) {
1725
+ const type = inlineBlockType(mimeType);
1726
+ if (type === undefined) {
1718
1727
  return {
1719
- content: [
1720
- {
1721
- type: "image",
1722
- data: buffer.toString("base64"),
1723
- mimeType,
1724
- name: sourceName(pathOrUrl, mimeType),
1725
- annotations: { audience: ["user", "assistant"], priority: 0.9 }
1726
- },
1727
- { type: "text", text: `[image] ${mimeType}, ${sizeKb}KB` }
1728
- ],
1729
- bytes: buffer.length
1730
- };
1731
- }
1732
- if (mimeType.startsWith("audio/")) {
1733
- return {
1734
- content: [
1735
- {
1736
- type: "audio",
1737
- data: buffer.toString("base64"),
1738
- mimeType,
1739
- name: sourceName(pathOrUrl, mimeType),
1740
- annotations: { audience: ["user", "assistant"], priority: 0.9 }
1741
- },
1742
- { type: "text", text: `[audio] ${mimeType}, ${sizeKb}KB` }
1743
- ],
1728
+ content: [{ type: "text", text: `[${mimeType}] ${sizeKb}KB — ${pathOrUrl}` }],
1744
1729
  bytes: buffer.length
1745
1730
  };
1746
1731
  }
1747
1732
  return {
1748
- content: [{ type: "text", text: `[${mimeType}] ${sizeKb}KB — ${pathOrUrl}` }],
1733
+ content: [
1734
+ {
1735
+ type,
1736
+ data: buffer.toString("base64"),
1737
+ mimeType,
1738
+ annotations: { audience: ["user", "assistant"], priority: 0.9 },
1739
+ _meta: { [MCP_FILE_NAME_META_KEY2]: sourceName(pathOrUrl, mimeType) }
1740
+ },
1741
+ { type: "text", text: `[${type}] ${mimeType}, ${sizeKb}KB` }
1742
+ ],
1749
1743
  bytes: buffer.length
1750
1744
  };
1751
1745
  }
@@ -1950,6 +1944,7 @@ export {
1950
1944
  AgentToolError2 as AgentToolError,
1951
1945
  AsyncOperationCancelResultSchema2 as AsyncOperationCancelResultSchema,
1952
1946
  EffectUnresolvedError2 as EffectUnresolvedError,
1947
+ MCP_FILE_NAME_META_KEY2 as MCP_FILE_NAME_META_KEY,
1953
1948
  McpAnnotationsSchema2 as McpAnnotationsSchema,
1954
1949
  McpMediaContentSchema2 as McpMediaContentSchema,
1955
1950
  PORTABLE_JSON_SCHEMA_FORMATS2 as PORTABLE_JSON_SCHEMA_FORMATS,