stitchkit 0.68.0 → 0.68.2

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 (180) hide show
  1. package/dist/agent-runtime/admission-lanes.d.ts +1 -1
  2. package/dist/agent-runtime/compaction.d.ts +2 -2
  3. package/dist/agent-runtime/events.d.ts +1 -1
  4. package/dist/agent-runtime/history.d.ts +1 -1
  5. package/dist/agent-runtime/history.d.ts.map +1 -1
  6. package/dist/agent-runtime/injection.d.ts +1 -1
  7. package/dist/agent-runtime/managed-tools.d.ts +3 -3
  8. package/dist/agent-runtime/models.d.ts +1 -1
  9. package/dist/agent-runtime/observability.d.ts +1 -1
  10. package/dist/agent-runtime/prompt.d.ts +1 -1
  11. package/dist/agent-runtime/prompt.d.ts.map +1 -1
  12. package/dist/agent-runtime/protocol.d.ts +19 -1
  13. package/dist/agent-runtime/protocol.d.ts.map +1 -1
  14. package/dist/agent-runtime/run-execution.d.ts +5 -5
  15. package/dist/agent-runtime/run-execution.d.ts.map +1 -1
  16. package/dist/agent-runtime/runtime-internals.d.ts +1 -1
  17. package/dist/agent-runtime/runtime-result.d.ts +1 -1
  18. package/dist/agent-runtime/runtime.d.ts +14 -12
  19. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  20. package/dist/agent-runtime/store-driver.d.ts +2 -2
  21. package/dist/agent-runtime/store.d.ts +2 -2
  22. package/dist/agent-runtime/terminal-commit.d.ts +2 -2
  23. package/dist/agent-runtime/terminal-status.d.ts +1 -1
  24. package/dist/agent-runtime-openrouter.d.ts +1 -1
  25. package/dist/agent-runtime.d.ts +15 -15
  26. package/dist/agent-runtime.d.ts.map +1 -1
  27. package/dist/agent-runtime.js +87 -26
  28. package/dist/application/admission.d.ts +1 -1
  29. package/dist/application/events.d.ts +2 -2
  30. package/dist/application/grammy.d.ts +2 -2
  31. package/dist/application/graph.d.ts +1 -1
  32. package/dist/application/health.d.ts +1 -1
  33. package/dist/application/kernel.d.ts +3 -3
  34. package/dist/application/opentelemetry.d.ts +3 -3
  35. package/dist/application/resource.d.ts +1 -1
  36. package/dist/application/schedule.d.ts +1 -1
  37. package/dist/application/server-resource.d.ts +7 -9
  38. package/dist/application/server-resource.d.ts.map +1 -1
  39. package/dist/application-grammy.d.ts +1 -1
  40. package/dist/application-opentelemetry.d.ts +1 -1
  41. package/dist/application.d.ts +11 -11
  42. package/dist/application.js +7 -7
  43. package/dist/browser/client-multipart.d.ts +1 -1
  44. package/dist/browser/client-url.d.ts +2 -2
  45. package/dist/browser/client.d.ts +4 -4
  46. package/dist/browser/client.d.ts.map +1 -1
  47. package/dist/browser/contract-stream.d.ts +1 -1
  48. package/dist/browser/http.d.ts +7 -7
  49. package/dist/browser/http.d.ts.map +1 -1
  50. package/dist/browser/socket-io.d.ts +12 -31
  51. package/dist/browser/socket-io.d.ts.map +1 -1
  52. package/dist/browser/stream.d.ts +2 -2
  53. package/dist/cli.d.ts +6 -6
  54. package/dist/cli.js +4 -3
  55. package/dist/contract/errors-factory.d.ts +1 -1
  56. package/dist/contract/factory.d.ts +1 -1
  57. package/dist/contract/index.d.ts +7 -7
  58. package/dist/files/boundary.d.ts +1 -1
  59. package/dist/files.d.ts +2 -2
  60. package/dist/{index-zd4v31v2.js → index-2ve29dzn.js} +3 -3
  61. package/dist/{index-nymn7wbg.js → index-3vq6we8m.js} +29 -17
  62. package/dist/index-7etq650s.js +75 -0
  63. package/dist/{index-7pn02bgv.js → index-cszjsxy5.js} +22 -83
  64. package/dist/index-g2j2m6vv.js +63 -0
  65. package/dist/index.d.ts +10 -10
  66. package/dist/index.js +4 -4
  67. package/dist/internal/errors.d.ts +1 -1
  68. package/dist/internal/observability-sink.d.ts +1 -1
  69. package/dist/node.d.ts +11 -11
  70. package/dist/node.d.ts.map +1 -1
  71. package/dist/node.js +2 -2
  72. package/dist/observability/audit.d.ts +5 -5
  73. package/dist/observability/context.d.ts +2 -2
  74. package/dist/observability/event.d.ts +2 -2
  75. package/dist/observability/index.d.ts +6 -6
  76. package/dist/react/entity-cache.d.ts +26 -1
  77. package/dist/react/entity-cache.d.ts.map +1 -1
  78. package/dist/react.d.ts +3 -3
  79. package/dist/react.d.ts.map +1 -1
  80. package/dist/react.js +136 -38
  81. package/dist/realtime/contract.d.ts +1 -1
  82. package/dist/realtime/index.d.ts +4 -4
  83. package/dist/realtime/rejection.d.ts +1 -1
  84. package/dist/realtime/request.d.ts +1 -1
  85. package/dist/realtime/socket.d.ts +2 -2
  86. package/dist/remote.d.ts +1 -1
  87. package/dist/remote.js +1 -1
  88. package/dist/server/bun.d.ts +3 -3
  89. package/dist/server/context-contribution.d.ts +1 -1
  90. package/dist/server/context.d.ts +4 -4
  91. package/dist/server/contract-stream.d.ts +2 -2
  92. package/dist/server/create.d.ts +1 -1
  93. package/dist/server/error-hook.d.ts +3 -3
  94. package/dist/server/file.d.ts +1 -1
  95. package/dist/server/implement.d.ts +2 -2
  96. package/dist/server/index.d.ts +31 -31
  97. package/dist/server/index.d.ts.map +1 -1
  98. package/dist/server/index.js +9 -9
  99. package/dist/server/lifecycle.d.ts +1 -1
  100. package/dist/server/logging.d.ts +1 -1
  101. package/dist/server/middleware/auth.d.ts +2 -2
  102. package/dist/server/multipart.d.ts +2 -2
  103. package/dist/server/node.d.ts +2 -2
  104. package/dist/server/openapi.d.ts +1 -1
  105. package/dist/server/process-signal-common.d.ts +1 -1
  106. package/dist/server/process-signals.d.ts +1 -1
  107. package/dist/server/realtime.d.ts +4 -4
  108. package/dist/server/response-metadata.d.ts +1 -1
  109. package/dist/server/router.d.ts +1 -1
  110. package/dist/server/shutdown.d.ts +1 -1
  111. package/dist/server/socket-io-node.d.ts +3 -3
  112. package/dist/server/socket-io.d.ts +6 -6
  113. package/dist/server/streaming-route.d.ts +2 -2
  114. package/dist/server/types.d.ts +6 -6
  115. package/dist/server/unix-client-body.d.ts +1 -1
  116. package/dist/server/unix-client-body.d.ts.map +1 -1
  117. package/dist/server/unix-client-bun.d.ts +1 -1
  118. package/dist/server/unix-client-bun.d.ts.map +1 -1
  119. package/dist/server/unix-client.d.ts +16 -5
  120. package/dist/server/unix-client.d.ts.map +1 -1
  121. package/dist/testing/agent-store-conformance.d.ts +1 -1
  122. package/dist/testing/managed-resource-conformance-contract.d.ts +1 -1
  123. package/dist/testing/managed-resource-conformance-driver.d.ts +2 -2
  124. package/dist/testing/managed-resource-conformance-scenarios.d.ts +2 -2
  125. package/dist/testing/managed-resource-conformance.d.ts +2 -2
  126. package/dist/testing/surface-conformance.d.ts +3 -3
  127. package/dist/testing/surface-manifest.d.ts +5 -5
  128. package/dist/testing.d.ts +8 -8
  129. package/dist/testing.js +1 -1
  130. package/dist/tool-invoker.d.ts +9 -0
  131. package/dist/tool-invoker.d.ts.map +1 -0
  132. package/dist/tool-invoker.js +16 -0
  133. package/dist/tools/agent.d.ts +4 -4
  134. package/dist/tools/async-operation.d.ts +3 -3
  135. package/dist/tools/cli-command.d.ts +3 -3
  136. package/dist/tools/cli-format.d.ts +1 -1
  137. package/dist/tools/cli-policy.d.ts +1 -1
  138. package/dist/tools/cli-wait.d.ts +1 -1
  139. package/dist/tools/cli.d.ts +7 -7
  140. package/dist/tools/define-download-tool.d.ts +4 -4
  141. package/dist/tools/define-upload-tool.d.ts +3 -3
  142. package/dist/tools/define-view-file-tool.d.ts +3 -3
  143. package/dist/tools/define-wait-tool.d.ts +2 -2
  144. package/dist/tools/download-core.d.ts +2 -2
  145. package/dist/tools/execute.d.ts +2 -2
  146. package/dist/tools/flatten-join.d.ts +1 -1
  147. package/dist/tools/internal/surface-projector.d.ts +3 -3
  148. package/dist/tools/invoker.d.ts +4 -4
  149. package/dist/tools/lifecycle.d.ts +1 -1
  150. package/dist/tools/list-names.d.ts +2 -2
  151. package/dist/tools/managed-file-error.d.ts +1 -1
  152. package/dist/tools/manifest.d.ts +3 -3
  153. package/dist/tools/mcp-handler.d.ts +4 -4
  154. package/dist/tools/mcp-prepare.d.ts +8 -8
  155. package/dist/tools/mcp-round-policy.d.ts +1 -1
  156. package/dist/tools/mcp-round.d.ts +3 -3
  157. package/dist/tools/mcp-stdio-signals.d.ts +2 -2
  158. package/dist/tools/mcp-stdio.d.ts +3 -3
  159. package/dist/tools/mcp.d.ts +7 -7
  160. package/dist/tools/mount-download.d.ts +1 -1
  161. package/dist/tools/mount-upload.d.ts +1 -1
  162. package/dist/tools/mount.d.ts +5 -5
  163. package/dist/tools/native-definition.d.ts +2 -2
  164. package/dist/tools/native-mcp.d.ts +3 -3
  165. package/dist/tools/oauth-metadata.d.ts +1 -1
  166. package/dist/tools/oauth-provider.d.ts +1 -1
  167. package/dist/tools/presentation.d.ts +1 -1
  168. package/dist/tools/remote.d.ts +3 -3
  169. package/dist/tools/runtime-tool.d.ts +2 -2
  170. package/dist/tools/surface.d.ts +5 -5
  171. package/dist/tools/tool-logger.d.ts +1 -1
  172. package/dist/tools/toolkit.d.ts +7 -7
  173. package/dist/tools/transports.d.ts +2 -2
  174. package/dist/tools/upload-core.d.ts +1 -1
  175. package/dist/tools/view-file.d.ts +1 -1
  176. package/dist/tools.d.ts +42 -42
  177. package/dist/tools.js +18 -61
  178. package/llms-full.txt +196 -20
  179. package/package.json +8 -4
  180. package/dist/{index-avjd67h6.js → index-cz32amcb.js} +3 -3
@@ -8,9 +8,6 @@ import {
8
8
  guardSignalCallback,
9
9
  reportSignalError
10
10
  } from "./index-pr0qsmjy.js";
11
- import {
12
- ShutdownOptionsSchema
13
- } from "./index-dk6e56g0.js";
14
11
  import {
15
12
  extractIp,
16
13
  getClientInfo,
@@ -22,6 +19,9 @@ import {
22
19
  setRequestEndpoint,
23
20
  setRequestError
24
21
  } from "./index-69m2278y.js";
22
+ import {
23
+ ShutdownOptionsSchema
24
+ } from "./index-dk6e56g0.js";
25
25
  import {
26
26
  DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
27
27
  errorCode,
@@ -2466,7 +2466,7 @@ async function readBoundedRequestBody(request, maxBytes) {
2466
2466
  }
2467
2467
  return result;
2468
2468
  }
2469
- function boundedIncomingBody(response, maxBytes, onDone) {
2469
+ function incomingResponseBody(response, maxBytes, onDone) {
2470
2470
  let finished = false;
2471
2471
  let received = 0;
2472
2472
  const finish = () => {
@@ -2481,8 +2481,9 @@ function boundedIncomingBody(response, maxBytes, onDone) {
2481
2481
  response.on("data", (chunk) => {
2482
2482
  if (finished)
2483
2483
  return;
2484
- received += chunk.byteLength;
2485
- if (received > maxBytes) {
2484
+ if (maxBytes !== undefined)
2485
+ received += chunk.byteLength;
2486
+ if (maxBytes !== undefined && received > maxBytes) {
2486
2487
  controller.error(new UnixClientTransportError("UNIX_RESPONSE_TOO_LARGE", `Unix response body exceeds the ${maxBytes} byte limit`, "response-received"));
2487
2488
  response.destroy();
2488
2489
  finish();
@@ -2661,8 +2662,9 @@ function bunUnixRequest(options) {
2661
2662
  return value;
2662
2663
  };
2663
2664
  const enqueue = (value) => {
2664
- received += value.byteLength;
2665
- if (received > options.maxResponseBytes) {
2665
+ if (options.maxResponseBytes !== undefined)
2666
+ received += value.byteLength;
2667
+ if (options.maxResponseBytes !== undefined && received > options.maxResponseBytes) {
2666
2668
  fail(new UnixClientTransportError("UNIX_RESPONSE_TOO_LARGE", `Unix response body exceeds the ${options.maxResponseBytes} byte limit`, "response-received"));
2667
2669
  return;
2668
2670
  }
@@ -2759,14 +2761,13 @@ function bunUnixRequest(options) {
2759
2761
  return;
2760
2762
  }
2761
2763
  const bytes = Math.min(chunkRemaining, wire.byteLength, MAX_BODY_CHUNK_BYTES);
2762
- enqueue(takeWire(bytes));
2763
- if (settled)
2764
- return;
2764
+ const value = takeWire(bytes);
2765
2765
  chunkRemaining -= bytes;
2766
2766
  if (chunkRemaining === 0) {
2767
2767
  chunkRemaining = undefined;
2768
2768
  expectChunkCrlf = true;
2769
2769
  }
2770
+ enqueue(value);
2770
2771
  return;
2771
2772
  }
2772
2773
  };
@@ -2816,7 +2817,7 @@ function bunUnixRequest(options) {
2816
2817
  }
2817
2818
  return;
2818
2819
  }
2819
- if (headerEnd > options.maxHeaderBytes) {
2820
+ if (headerEnd + 4 > options.maxHeaderBytes) {
2820
2821
  fail(new UnixClientTransportError("UNIX_HEADERS_TOO_LARGE", `Unix response headers exceed the ${options.maxHeaderBytes} byte limit`, "response-received"));
2821
2822
  return;
2822
2823
  }
@@ -2852,7 +2853,7 @@ function bunUnixRequest(options) {
2852
2853
  fail(transportFailure(error));
2853
2854
  return;
2854
2855
  }
2855
- if (remainingLength !== undefined && remainingLength > options.maxResponseBytes) {
2856
+ if (options.maxResponseBytes !== undefined && remainingLength !== undefined && remainingLength > options.maxResponseBytes) {
2856
2857
  fail(new UnixClientTransportError("UNIX_RESPONSE_TOO_LARGE", `Unix response body exceeds the ${options.maxResponseBytes} byte limit`, "response-received"));
2857
2858
  return;
2858
2859
  }
@@ -2988,6 +2989,9 @@ function responseHeaders2(response) {
2988
2989
  }
2989
2990
  return headers;
2990
2991
  }
2992
+ function isNodeHeaderOverflow(error) {
2993
+ return typeof error === "object" && error !== null && Reflect.get(error, "code") === "HPE_HEADER_OVERFLOW";
2994
+ }
2991
2995
  function redirectedRequest(request, location, status, body) {
2992
2996
  const url = new URL(location, request.url);
2993
2997
  const changesToGet = status === 303 || (status === 301 || status === 302) && request.method === "POST";
@@ -3009,7 +3013,10 @@ function createUnixClientTransport(config) {
3009
3013
  throw new TypeError("socketPath must be an absolute Unix socket path");
3010
3014
  }
3011
3015
  const maxRequestBytes = positiveInteger(config.maxRequestBytes, DEFAULT_MAX_BODY_BYTES, "maxRequestBytes");
3012
- const maxResponseBytes = positiveInteger(config.maxResponseBytes, DEFAULT_MAX_BODY_BYTES, "maxResponseBytes");
3016
+ if (config.responseBodyMode === "streaming" && config.maxResponseBytes !== undefined) {
3017
+ throw new TypeError("maxResponseBytes cannot be combined with responseBodyMode streaming");
3018
+ }
3019
+ const maxResponseBytes = config.responseBodyMode === "streaming" ? undefined : positiveInteger(config.maxResponseBytes, DEFAULT_MAX_BODY_BYTES, "maxResponseBytes");
3013
3020
  const headersTimeoutMs = positiveInteger(config.headersTimeoutMs, DEFAULT_HEADERS_TIMEOUT_MS, "headersTimeoutMs");
3014
3021
  const maxConnections = positiveInteger(config.maxConnections, DEFAULT_MAX_CONNECTIONS, "maxConnections");
3015
3022
  const maxHeaderBytes = positiveInteger(config.maxHeaderBytes, DEFAULT_MAX_HEADER_BYTES2, "maxHeaderBytes");
@@ -3083,7 +3090,8 @@ function createUnixClientTransport(config) {
3083
3090
  method: request.method,
3084
3091
  headers,
3085
3092
  agent,
3086
- signal: request.signal
3093
+ signal: request.signal,
3094
+ maxHeaderSize: maxHeaderBytes
3087
3095
  }, resolveOnce);
3088
3096
  let connected = false;
3089
3097
  let requestStartBytes = 0;
@@ -3106,6 +3114,10 @@ function createUnixClientTransport(config) {
3106
3114
  timer.unref();
3107
3115
  outgoing.once("response", () => clearTimeout(timer));
3108
3116
  outgoing.once("error", (error) => {
3117
+ if (isNodeHeaderOverflow(error)) {
3118
+ rejectOnce(new UnixClientTransportError("UNIX_HEADERS_TOO_LARGE", `Unix response headers exceed the ${maxHeaderBytes} byte limit`, "response-received", { cause: error }));
3119
+ return;
3120
+ }
3109
3121
  const dispatched = connected && (outgoing.socket?.bytesWritten ?? requestStartBytes) > requestStartBytes;
3110
3122
  rejectOnce(new UnixClientTransportError(dispatched ? "UNIX_DELIVERY_UNCERTAIN" : "UNIX_CONNECT_FAILED", dispatched ? "Unix request transport failed after dispatch may have begun" : "Unix socket connection failed before request dispatch", dispatched ? "possibly-dispatched" : "not-dispatched", { cause: error }));
3111
3123
  });
@@ -3120,7 +3132,7 @@ function createUnixClientTransport(config) {
3120
3132
  const status = incoming.statusCode ?? 0;
3121
3133
  const responseHeadersValue = responseHeaders2(incoming);
3122
3134
  const declaredResponseBytes = responseHeadersValue.get("content-length");
3123
- if (declaredResponseBytes !== null && /^\d+$/.test(declaredResponseBytes) && Number(declaredResponseBytes) > maxResponseBytes) {
3135
+ if (declaredResponseBytes !== null && /^\d+$/.test(declaredResponseBytes) && maxResponseBytes !== undefined && Number(declaredResponseBytes) > maxResponseBytes) {
3124
3136
  incoming.destroy();
3125
3137
  releaseResponse();
3126
3138
  throw new UnixClientTransportError("UNIX_RESPONSE_TOO_LARGE", `Unix response body exceeds the ${maxResponseBytes} byte limit`, "response-received");
@@ -3148,7 +3160,7 @@ function createUnixClientTransport(config) {
3148
3160
  headers: responseHeadersValue
3149
3161
  });
3150
3162
  }
3151
- return new Response(boundedIncomingBody(incoming, maxResponseBytes, releaseResponse), {
3163
+ return new Response(incomingResponseBody(incoming, maxResponseBytes, releaseResponse), {
3152
3164
  status,
3153
3165
  statusText: incoming.statusMessage,
3154
3166
  headers: responseHeadersValue
@@ -0,0 +1,75 @@
1
+ import {
2
+ executeToolMethod
3
+ } from "./index-cz32amcb.js";
4
+ import {
5
+ assertToolExtensionCompatible,
6
+ projectToolSurface
7
+ } from "./index-vkk06pv1.js";
8
+ import {
9
+ mergeSchemas,
10
+ rebuildObject
11
+ } from "./index-6djpbnda.js";
12
+
13
+ // src/tools/mount.ts
14
+ import { z } from "zod";
15
+ function applyExtend(base, extra) {
16
+ if (base instanceof z.ZodObject) {
17
+ assertToolExtensionCompatible(base, extra);
18
+ return rebuildObject(base, { ...extra, ...base.shape });
19
+ }
20
+ return z.intersection(z.object(extra), base);
21
+ }
22
+ function contractToolMountable(projected, extend) {
23
+ const method = projected.source;
24
+ const baseArgumentSchema = mergeSchemas(method.paramsSchema, method.inputSchema);
25
+ const argumentSchema = projected.shouldExtend && extend ? applyExtend(baseArgumentSchema, extend.schema) : baseArgumentSchema;
26
+ return {
27
+ method,
28
+ name: projected.name,
29
+ argumentSchema,
30
+ presentationSchema: projected.presentationSchema,
31
+ shouldExtend: projected.shouldExtend
32
+ };
33
+ }
34
+ function collectTools(service, transport, config = {}) {
35
+ const { extend, flattenUnionInput = false, assertNames = true } = config;
36
+ const tools = [];
37
+ for (const projected of projectToolSurface({ services: [service] }, transport === "HTTP" ? "AGENT" : transport, {
38
+ extend,
39
+ flattenUnionInput,
40
+ assertNames,
41
+ assertUniqueNames: false
42
+ })) {
43
+ if (projected.kind !== "contract")
44
+ continue;
45
+ tools.push(contractToolMountable(projected, extend));
46
+ }
47
+ return tools;
48
+ }
49
+ function createToolRunner(config) {
50
+ const extension = config.extend ? {
51
+ schema: z.object(config.extend.schema),
52
+ resolve: config.extend.resolve
53
+ } : undefined;
54
+ return async function runOneToolCall(tool, rawArgs, context) {
55
+ return executeToolMethod(tool.method, tool.name, rawArgs, { ...config.context, ...context, source: config.source }, config.hooks, config.lifecycle, config.coerceJsonArgs ?? true, config.onOutputStrip ? (paths) => config.onOutputStrip?.(tool.name, paths) : undefined, tool.shouldExtend ? extension : undefined);
56
+ };
57
+ }
58
+ function formatToolError(result, toolName, errorHint) {
59
+ const err = { error: result.code };
60
+ if (result.details)
61
+ err.details = result.details;
62
+ const hints = [];
63
+ if (result.hint)
64
+ hints.push(result.hint);
65
+ if (errorHint && toolName) {
66
+ const global = errorHint(toolName, result.code);
67
+ if (global)
68
+ hints.push(global);
69
+ }
70
+ if (hints.length > 0)
71
+ err._hint = hints.join(" ");
72
+ return err;
73
+ }
74
+
75
+ export { contractToolMountable, collectTools, createToolRunner, formatToolError };
@@ -1,22 +1,23 @@
1
+ import {
2
+ contractToolMountable,
3
+ createToolRunner,
4
+ formatToolError
5
+ } from "./index-7etq650s.js";
1
6
  import {
2
7
  coerceJsonArgs,
3
- executeToolMethod,
4
8
  toolResultFromError
5
- } from "./index-avjd67h6.js";
9
+ } from "./index-cz32amcb.js";
6
10
  import {
7
11
  isWithinDir
8
12
  } from "./index-sbdmyz75.js";
9
13
  import {
10
- assertToolExtensionCompatible,
11
14
  assertUniqueToolName,
12
15
  buildToolPresentationSchema,
13
16
  projectRuntimeTool,
14
17
  projectToolSurface
15
18
  } from "./index-vkk06pv1.js";
16
19
  import {
17
- mergeSchemas,
18
- objectShapeKeys,
19
- rebuildObject
20
+ objectShapeKeys
20
21
  } from "./index-6djpbnda.js";
21
22
  import {
22
23
  jsonSchemaFields
@@ -31,68 +32,6 @@ import {
31
32
  isRecord
32
33
  } from "./index-smpbdg6k.js";
33
34
 
34
- // src/tools/mount.ts
35
- import { z } from "zod";
36
- function applyExtend(base, extra) {
37
- if (base instanceof z.ZodObject) {
38
- assertToolExtensionCompatible(base, extra);
39
- return rebuildObject(base, { ...extra, ...base.shape });
40
- }
41
- return z.intersection(z.object(extra), base);
42
- }
43
- function contractToolMountable(projected, extend) {
44
- const method = projected.source;
45
- const baseArgumentSchema = mergeSchemas(method.paramsSchema, method.inputSchema);
46
- const argumentSchema = projected.shouldExtend && extend ? applyExtend(baseArgumentSchema, extend.schema) : baseArgumentSchema;
47
- return {
48
- method,
49
- name: projected.name,
50
- argumentSchema,
51
- presentationSchema: projected.presentationSchema,
52
- shouldExtend: projected.shouldExtend
53
- };
54
- }
55
- function collectTools(service, transport, config = {}) {
56
- const { extend, flattenUnionInput = false, assertNames = true } = config;
57
- const tools = [];
58
- for (const projected of projectToolSurface({ services: [service] }, transport === "HTTP" ? "AGENT" : transport, {
59
- extend,
60
- flattenUnionInput,
61
- assertNames,
62
- assertUniqueNames: false
63
- })) {
64
- if (projected.kind !== "contract")
65
- continue;
66
- tools.push(contractToolMountable(projected, extend));
67
- }
68
- return tools;
69
- }
70
- function createToolRunner(config) {
71
- const extension = config.extend ? {
72
- schema: z.object(config.extend.schema),
73
- resolve: config.extend.resolve
74
- } : undefined;
75
- return async function runOneToolCall(tool, rawArgs, context) {
76
- return executeToolMethod(tool.method, tool.name, rawArgs, { ...config.context, ...context, source: config.source }, config.hooks, config.lifecycle, config.coerceJsonArgs ?? true, config.onOutputStrip ? (paths) => config.onOutputStrip?.(tool.name, paths) : undefined, tool.shouldExtend ? extension : undefined);
77
- };
78
- }
79
- function formatToolError(result, toolName, errorHint) {
80
- const err = { error: result.code };
81
- if (result.details)
82
- err.details = result.details;
83
- const hints = [];
84
- if (result.hint)
85
- hints.push(result.hint);
86
- if (errorHint && toolName) {
87
- const global = errorHint(toolName, result.code);
88
- if (global)
89
- hints.push(global);
90
- }
91
- if (hints.length > 0)
92
- err._hint = hints.join(" ");
93
- return err;
94
- }
95
-
96
35
  // src/tools/runtime-tool.ts
97
36
  function defineRuntimeTool(definition) {
98
37
  if (definition.transports?.length === 0) {
@@ -175,7 +114,7 @@ function runtimeToolMountable(definition, assertName = true) {
175
114
  }
176
115
 
177
116
  // src/tools/cli-args.ts
178
- import { z as z2 } from "zod";
117
+ import { z } from "zod";
179
118
  var NUMERIC_VALUE = /^-(\d+\.?\d*|\.\d+)$/;
180
119
  var BOOL_OPTIONS = new Set(["json", "wait", "quiet", "dry-run", "help"]);
181
120
  var VALUE_OPTIONS = new Set(["wait-timeout", "output-dir"]);
@@ -284,27 +223,27 @@ class CliArgumentError extends Error {
284
223
  name = "CliArgumentError";
285
224
  }
286
225
  function unwrap(field) {
287
- if (field instanceof z2.ZodOptional || field instanceof z2.ZodNullable || field instanceof z2.ZodDefault) {
226
+ if (field instanceof z.ZodOptional || field instanceof z.ZodNullable || field instanceof z.ZodDefault) {
288
227
  return unwrap(field.unwrap());
289
228
  }
290
229
  return field;
291
230
  }
292
231
  function classify(field) {
293
- if (field instanceof z2.ZodBoolean)
232
+ if (field instanceof z.ZodBoolean)
294
233
  return "boolean";
295
- if (field instanceof z2.ZodNumber)
234
+ if (field instanceof z.ZodNumber)
296
235
  return "number";
297
- if (field instanceof z2.ZodBigInt)
236
+ if (field instanceof z.ZodBigInt)
298
237
  return "bigint";
299
- if (field instanceof z2.ZodDate)
238
+ if (field instanceof z.ZodDate)
300
239
  return "date";
301
- if (field instanceof z2.ZodEnum)
240
+ if (field instanceof z.ZodEnum)
302
241
  return "enum";
303
- if (field instanceof z2.ZodArray)
242
+ if (field instanceof z.ZodArray)
304
243
  return "array";
305
- if (field instanceof z2.ZodObject)
244
+ if (field instanceof z.ZodObject)
306
245
  return "object";
307
- if (field instanceof z2.ZodString || field instanceof z2.ZodLiteral)
246
+ if (field instanceof z.ZodString || field instanceof z.ZodLiteral)
308
247
  return "string";
309
248
  return "other";
310
249
  }
@@ -324,11 +263,11 @@ function mergeField(fields, name, info) {
324
263
  }
325
264
  function collectSchemaFields(schema, fields) {
326
265
  const base = unwrap(schema);
327
- if (base instanceof z2.ZodObject) {
266
+ if (base instanceof z.ZodObject) {
328
267
  for (const [name, raw] of Object.entries(base.shape)) {
329
268
  const fieldBase = unwrap(raw);
330
269
  const kind = classify(fieldBase);
331
- if (kind === "array" && fieldBase instanceof z2.ZodArray) {
270
+ if (kind === "array" && fieldBase instanceof z.ZodArray) {
332
271
  mergeField(fields, name, { kind, elementKind: classify(unwrap(fieldBase.element)) });
333
272
  } else {
334
273
  mergeField(fields, name, { kind });
@@ -336,12 +275,12 @@ function collectSchemaFields(schema, fields) {
336
275
  }
337
276
  return;
338
277
  }
339
- if (base instanceof z2.ZodUnion) {
278
+ if (base instanceof z.ZodUnion) {
340
279
  for (const option of base.def.options)
341
280
  collectSchemaFields(option, fields);
342
281
  return;
343
282
  }
344
- if (base instanceof z2.ZodIntersection) {
283
+ if (base instanceof z.ZodIntersection) {
345
284
  collectSchemaFields(base.def.left, fields);
346
285
  collectSchemaFields(base.def.right, fields);
347
286
  return;
@@ -1735,4 +1674,4 @@ async function createCli(config) {
1735
1674
  return exit(downloadsOk ? exitCode : 1);
1736
1675
  }
1737
1676
 
1738
- export { collectTools, createToolRunner, formatToolError, defineRuntimeTool, createRuntimeToolFactory, collectToolSurface, WaitTimeoutError, runWaitOperation, fetchGuarded, fetchPinnedDocument, readCapped, parseCliArgs, defineCliCommand, DEFAULT_EXIT_CODES, emitResult, pollUntilDone, createCli };
1677
+ export { defineRuntimeTool, createRuntimeToolFactory, collectToolSurface, WaitTimeoutError, runWaitOperation, fetchGuarded, fetchPinnedDocument, readCapped, parseCliArgs, defineCliCommand, DEFAULT_EXIT_CODES, emitResult, pollUntilDone, createCli };
@@ -0,0 +1,63 @@
1
+ import {
2
+ collectTools,
3
+ createToolRunner
4
+ } from "./index-7etq650s.js";
5
+ import {
6
+ toolErrorFromResult
7
+ } from "./index-cz32amcb.js";
8
+ import {
9
+ assertUniqueToolName
10
+ } from "./index-vkk06pv1.js";
11
+ import {
12
+ AppError
13
+ } from "./index-0w9abg87.js";
14
+
15
+ // src/tools/invoker.ts
16
+ function createToolInvoker(services, config) {
17
+ const serviceList = Array.isArray(services) ? services : [services];
18
+ const tools = new Map;
19
+ for (const service of serviceList) {
20
+ for (const tool of collectTools(service, config.transport, {
21
+ extend: config.extend,
22
+ flattenUnionInput: config.flattenUnionInput
23
+ })) {
24
+ assertUniqueToolName(tool.name, tools.has(tool.name), "in-process tool name");
25
+ tools.set(tool.name, tool);
26
+ }
27
+ }
28
+ const names = Object.freeze([...tools.keys()].sort());
29
+ const operation = (name) => {
30
+ const tool = tools.get(name);
31
+ if (tool)
32
+ return tool;
33
+ throw new AppError("NOT_FOUND", `Unknown tool: ${name}`, 404, {
34
+ available: names
35
+ });
36
+ };
37
+ const run = (name, args, options = {}) => {
38
+ const runTool = createToolRunner({
39
+ source: options.source ?? "internal",
40
+ context: options.context,
41
+ hooks: options.hooks,
42
+ lifecycle: options.lifecycle,
43
+ extend: config.extend,
44
+ coerceJsonArgs: config.coerceJsonArgs,
45
+ onOutputStrip: options.onOutputStrip
46
+ });
47
+ return runTool(operation(name), args);
48
+ };
49
+ return Object.freeze({
50
+ names,
51
+ invoke(name, args, options) {
52
+ return run(name, args, options);
53
+ },
54
+ async invokeOrThrow(name, args, options) {
55
+ const result = await run(name, args, options);
56
+ if (!result.ok)
57
+ throw toolErrorFromResult(result);
58
+ return result.data;
59
+ }
60
+ });
61
+ }
62
+
63
+ export { createToolInvoker };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { type ClientConfig, type ClientContract, type ClientFetch, type ClientRegistryValue, type ContractClientConfig, contractEndpointMatchers, createClient, createClients, createScopedClients, createScopedUrlBuilders, createUrlBuilder, createUrlBuilders, type PathPrefixArgs, type RegistryScope, type ScopeClientConfigs, type ScopedClientRegistry, type ScopedUrlBuilderRegistry, type UrlBuilderConfig, } from './browser/client';
2
- export { ApiError, type ApiEvent, type ApiEventListener, type ConfiguredHttpClient, createHttpClient, type HeaderProvider, type HttpClient, type HttpClientConfig, type RequestOptions, type UnauthorizedMatcher, } from './browser/http';
3
- export type { BindRealtimeClientOptions, BoundRealtimeClient, RealtimeClient, RealtimeClientOptions, RealtimeClientTransport, SocketEventMap, SocketIOClient, SocketIOClientConfig, SocketIOClientPeerLoaders, } from './browser/socket-io';
4
- export { bindRealtimeClient, createRealtimeClient, createSocketIOClient, } from './browser/socket-io';
5
- export { type ParseNDJSONOptions, type ParseSSEOptions, parseNDJSON, parseSSE, } from './browser/stream';
6
- export * from './contract';
7
- export type { StitchLogger } from './logger';
8
- export { childSpan, createTraceContext, formatTraceparent, parseTraceparent, type TraceContext, } from './observability/trace';
9
- export * from './realtime';
10
- export { createRetainedTopics, type RetainedTopics } from './retained';
1
+ export { type ClientConfig, type ClientContract, type ClientFetch, type ClientRegistryValue, type ContractClientConfig, contractEndpointMatchers, createClient, createClients, createScopedClients, createScopedUrlBuilders, createUrlBuilder, createUrlBuilders, type PathPrefixArgs, type RegistryScope, type ScopeClientConfigs, type ScopedClientRegistry, type ScopedUrlBuilderRegistry, type UrlBuilderConfig, } from './browser/client.js';
2
+ export { ApiError, type ApiEvent, type ApiEventListener, type ConfiguredHttpClient, createHttpClient, type HeaderProvider, type HttpClient, type HttpClientConfig, type RequestOptions, type UnauthorizedMatcher, } from './browser/http.js';
3
+ export type { BindRealtimeClientOptions, BoundRealtimeClient, RealtimeClient, RealtimeClientOptions, RealtimeClientTransport, SocketEventMap, SocketIOClient, SocketIOClientConfig, SocketIOClientPeerLoaders, } from './browser/socket-io.js';
4
+ export { bindRealtimeClient, createRealtimeClient, createSocketIOClient, } from './browser/socket-io.js';
5
+ export { type ParseNDJSONOptions, type ParseSSEOptions, parseNDJSON, parseSSE, } from './browser/stream.js';
6
+ export * from './contract/index.js';
7
+ export type { StitchLogger } from './logger.js';
8
+ export { childSpan, createTraceContext, formatTraceparent, parseTraceparent, type TraceContext, } from './observability/trace.js';
9
+ export * from './realtime/index.js';
10
+ export { createRetainedTopics, type RetainedTopics } from './retained.js';
11
11
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -464,8 +464,8 @@ class ApiError extends Error {
464
464
  details;
465
465
  hint;
466
466
  traceId;
467
- constructor(code, status = 0, details, message, hint, traceId) {
468
- super(message ?? `API Error: ${code}`);
467
+ constructor(code, status = 0, details, message, hint, traceId, options) {
468
+ super(message ?? `API Error: ${code}`, options);
469
469
  this.code = code;
470
470
  this.status = status;
471
471
  this.details = details;
@@ -1004,7 +1004,7 @@ function createFetchExecutor(endpoint, prefix, config, contractConfig) {
1004
1004
  if (ApiError.is(error))
1005
1005
  throw error;
1006
1006
  const message = error instanceof Error ? error.message : undefined;
1007
- throw new ApiError("UNKNOWN_ERROR", 0, message ? { message } : undefined, message);
1007
+ throw new ApiError("UNKNOWN_ERROR", 0, message ? { message } : undefined, message, undefined, undefined, { cause: error });
1008
1008
  }
1009
1009
  };
1010
1010
  }
@@ -1446,7 +1446,7 @@ var SOCKET_IO_CLIENT = "socket.io-client";
1446
1446
  var ioLoader = null;
1447
1447
  function loadIo() {
1448
1448
  if (!ioLoader) {
1449
- ioLoader = import(SOCKET_IO_CLIENT).then((mod) => mod.io, (cause) => {
1449
+ ioLoader = import(/* webpackIgnore: true */ SOCKET_IO_CLIENT).then((mod) => mod.io, (cause) => {
1450
1450
  ioLoader = null;
1451
1451
  throw new Error("stitchkit: createSocketIOClient needs the \"socket.io-client\" peer — install it (e.g. `bun add socket.io-client`). Shipping one self-contained artifact instead? Pass `peers: { client: () => import('socket.io-client') }` so your bundler puts it inside.", { cause });
1452
1452
  });
@@ -1,5 +1,5 @@
1
1
  import { type ZodType, z } from 'zod';
2
- import { AppError } from '../contract';
2
+ import { AppError } from '../contract/index.js';
3
3
  export declare function formatZodError(error: z.ZodError): string;
4
4
  /** One field-level validation issue — the structured sibling of `formatZodError`. */
5
5
  export interface ZodIssueSummary {
@@ -1,4 +1,4 @@
1
- import { type ObservabilitySinkStatus } from '../observability/status';
1
+ import { type ObservabilitySinkStatus } from '../observability/status.js';
2
2
  export type BoundedSinkDropReason = 'capacity' | 'closed';
3
3
  export interface BoundedSinkError<EVENT> {
4
4
  error: unknown;
package/dist/node.d.ts CHANGED
@@ -4,15 +4,15 @@
4
4
  * srvx-backed `serveNode`, `implement`, the error helpers and (lazily-loaded,
5
5
  * Node-safe) `createSocketIOServer`.
6
6
  */
7
- export { AppError, appError, badRequest, conflict, forbidden, notFound, rateLimited, unauthorized, } from './contract';
8
- export { createHandler } from './server/create';
9
- export { createImplement, createImplementRegistry, createMultipartStream, createScopedImplement, createScopedImplementRegistry, type ExactRegistryHandlers, type ExactScopedRegistryHandlers, type ImplementationRegistry, implement, implementRegistry, type KeyedServices, type MultipartStreamConfig, type RegistryHandlers, type ScopedImplementationRegistry, type ScopedRegistryHandlers, type StreamScope, } from './server/implement';
10
- export type { LogFormat } from './server/logger';
11
- export { type NodeRuntimeServer, type NodeServerConfig, type NodeServerHandle, type NodeSocketLifecycle, serveNode, } from './server/node';
12
- export { bindProcessSignals, type ProcessSignalName, type ProcessSignalsBinding, type ProcessSignalsErrorPhase, type ProcessSignalsOptions, type ShutdownTarget, type SignalSource, } from './server/process-signals';
13
- export { bindRealtimeServer, type RealtimeServer, type RealtimeServerConnection, type RealtimeServerHandle, } from './server/realtime';
14
- export { type ManagedServerHandle, type ShutdownOptions, ShutdownOptionsSchema, type ShutdownResult, ShutdownResultSchema, type ShutdownState, ShutdownStateSchema, type ShutdownStatus, ShutdownStatusSchema, } from './server/shutdown';
15
- export { createNodeSocketIOServer as createSocketIOServer, type NodeSocketIOServerHandle as SocketIOServerHandle, type SocketIOHandshakeConfig, type SocketIOPeerLoaders, type SocketIORequestPolicy, type SocketIOServerConfig, } from './server/socket-io-node';
16
- export type { EffectiveScope, FetchComposition, FetchHandler, HandlerConfig, LoggingConfig, LogOutcome, RawRoute, RawRouteContext, ScopeContexts, ScopedHandlers, ServiceDef, } from './server/types';
17
- export { createUnixClientTransport, type UnixClientDeliveryState, type UnixClientTransport, type UnixClientTransportConfig, UnixClientTransportError, type UnixClientTransportErrorCode, } from './server/unix-client';
7
+ export { AppError, appError, badRequest, conflict, forbidden, notFound, rateLimited, unauthorized, } from './contract/index.js';
8
+ export { createHandler } from './server/create.js';
9
+ export { createImplement, createImplementRegistry, createMultipartStream, createScopedImplement, createScopedImplementRegistry, type ExactRegistryHandlers, type ExactScopedRegistryHandlers, type ImplementationRegistry, implement, implementRegistry, type KeyedServices, type MultipartStreamConfig, type RegistryHandlers, type ScopedImplementationRegistry, type ScopedRegistryHandlers, type StreamScope, } from './server/implement.js';
10
+ export type { LogFormat } from './server/logger.js';
11
+ export { type NodeRuntimeServer, type NodeServerConfig, type NodeServerHandle, type NodeSocketLifecycle, serveNode, } from './server/node.js';
12
+ export { bindProcessSignals, type ProcessSignalName, type ProcessSignalsBinding, type ProcessSignalsErrorPhase, type ProcessSignalsOptions, type ShutdownTarget, type SignalSource, } from './server/process-signals.js';
13
+ export { bindRealtimeServer, type RealtimeServer, type RealtimeServerConnection, type RealtimeServerHandle, } from './server/realtime.js';
14
+ export { type ManagedServerHandle, type ShutdownOptions, ShutdownOptionsSchema, type ShutdownResult, ShutdownResultSchema, type ShutdownState, ShutdownStateSchema, type ShutdownStatus, ShutdownStatusSchema, } from './server/shutdown.js';
15
+ export { createNodeSocketIOServer as createSocketIOServer, type NodeSocketIOServerHandle as SocketIOServerHandle, type SocketIOHandshakeConfig, type SocketIOPeerLoaders, type SocketIORequestPolicy, type SocketIOServerConfig, } from './server/socket-io-node.js';
16
+ export type { EffectiveScope, FetchComposition, FetchHandler, HandlerConfig, LoggingConfig, LogOutcome, RawRoute, RawRouteContext, ScopeContexts, ScopedHandlers, ServiceDef, } from './server/types.js';
17
+ export { createUnixClientTransport, type UnixClientDeliveryState, type UnixClientTransport, type UnixClientTransportConfig, UnixClientTransportError, type UnixClientTransportErrorCode, type UnixResponseBodyMode, } from './server/unix-client.js';
18
18
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,SAAS,EACT,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,YAAY,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,aAAa,EAClB,mBAAmB,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,IAAI,oBAAoB,EAChD,KAAK,wBAAwB,IAAI,oBAAoB,EACrD,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,QAAQ,EACR,eAAe,EACf,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,wBAAwB,EACxB,KAAK,4BAA4B,GAClC,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,SAAS,EACT,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,YAAY,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,aAAa,EAClB,mBAAmB,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,IAAI,oBAAoB,EAChD,KAAK,wBAAwB,IAAI,oBAAoB,EACrD,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,QAAQ,EACR,eAAe,EACf,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,wBAAwB,EACxB,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC"}
package/dist/node.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  createHandler,
6
6
  createSocketIOServer,
7
7
  createUnixClientTransport
8
- } from "./index-nymn7wbg.js";
8
+ } from "./index-3vq6we8m.js";
9
9
  import {
10
10
  createImplement,
11
11
  createImplementRegistry,
@@ -15,6 +15,7 @@ import {
15
15
  implement,
16
16
  implementRegistry
17
17
  } from "./index-pr0qsmjy.js";
18
+ import"./index-69m2278y.js";
18
19
  import"./index-557by2db.js";
19
20
  import {
20
21
  ShutdownOptionsSchema,
@@ -23,7 +24,6 @@ import {
23
24
  ShutdownStatusSchema,
24
25
  createServerLifecycle
25
26
  } from "./index-dk6e56g0.js";
26
- import"./index-69m2278y.js";
27
27
  import"./index-9ky9hhg3.js";
28
28
  import"./index-smpbdg6k.js";
29
29
  import {
@@ -1,8 +1,8 @@
1
- import type { ToolCallHooks } from '../tools/execute';
2
- import { type RequestContext } from './context';
3
- import type { RequestEvent } from './event';
4
- import { type SanitizeOptions } from './sanitize';
5
- import { type ObservabilityDrainReport, type ObservabilityStatus } from './status';
1
+ import type { ToolCallHooks } from '../tools/execute.js';
2
+ import { type RequestContext } from './context.js';
3
+ import type { RequestEvent } from './event.js';
4
+ import { type SanitizeOptions } from './sanitize.js';
5
+ import { type ObservabilityDrainReport, type ObservabilityStatus } from './status.js';
6
6
  /** One isolated RequestEvent sink and its sanitisation policy. */
7
7
  export interface RequestEventSinkConfig {
8
8
  /**
@@ -1,5 +1,5 @@
1
- import type { TransportSource } from '../contract';
2
- import { type TraceContext } from './trace';
1
+ import type { TransportSource } from '../contract/index.js';
2
+ import { type TraceContext } from './trace.js';
3
3
  /** Everything known about the request in flight. */
4
4
  export interface RequestContext {
5
5
  /** W3C trace ids for this request. */
@@ -1,5 +1,5 @@
1
- import type { HttpMethod, McpCallContext, TransportSource } from '../contract';
2
- import type { JsonValue } from './sanitize';
1
+ import type { HttpMethod, McpCallContext, TransportSource } from '../contract/index.js';
2
+ import type { JsonValue } from './sanitize.js';
3
3
  /**
4
4
  * A normalised audit event — one shape for a completed call on any surface
5
5
  * (an HTTP request, an MCP tool call, an agent tool call). `createObservability`
@@ -6,10 +6,10 @@
6
6
  * framework-owned HTTP completion plus canonical tool hooks into independent
7
7
  * sinks.
8
8
  */
9
- export { createObservability, type HttpRequestCompletion, type HttpRequestObserver, type Observability, type ObservabilityConfig, type RequestEventSinkConfig, type RequestObservabilityConfig, type SinkDrop, type SinkDropReason, type SinkError, } from './audit';
10
- export { getRequestContext, getTraceId, getUserId, type RequestContext, runWithRequestContext, setRequestDimensions, setRequestEndpoint, setRequestError, setRequestUser, type WrapRequestContextOptions, wrapInRequestContext, } from './context';
11
- export type { RequestEvent } from './event';
12
- export { type JsonValue, measureSize, redact, type SanitizeOptions, type SizeMeasure, sanitizePayload, truncatePreview, } from './sanitize';
13
- export { type ObservabilityDrainReport, ObservabilityDrainReportSchema, type ObservabilitySinkStatus, ObservabilitySinkStatusSchema, type ObservabilityStatus, ObservabilityStatusSchema, } from './status';
14
- export { childSpan, createTraceContext, formatTraceparent, parseTraceparent, resolvePropagationContext, resolveTraceContext, type TraceContext, } from './trace';
9
+ export { createObservability, type HttpRequestCompletion, type HttpRequestObserver, type Observability, type ObservabilityConfig, type RequestEventSinkConfig, type RequestObservabilityConfig, type SinkDrop, type SinkDropReason, type SinkError, } from './audit.js';
10
+ export { getRequestContext, getTraceId, getUserId, type RequestContext, runWithRequestContext, setRequestDimensions, setRequestEndpoint, setRequestError, setRequestUser, type WrapRequestContextOptions, wrapInRequestContext, } from './context.js';
11
+ export type { RequestEvent } from './event.js';
12
+ export { type JsonValue, measureSize, redact, type SanitizeOptions, type SizeMeasure, sanitizePayload, truncatePreview, } from './sanitize.js';
13
+ export { type ObservabilityDrainReport, ObservabilityDrainReportSchema, type ObservabilitySinkStatus, ObservabilitySinkStatusSchema, type ObservabilityStatus, ObservabilityStatusSchema, } from './status.js';
14
+ export { childSpan, createTraceContext, formatTraceparent, parseTraceparent, resolvePropagationContext, resolveTraceContext, type TraceContext, } from './trace.js';
15
15
  //# sourceMappingURL=index.d.ts.map