stitchkit 0.100.1 → 0.100.3

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 (233) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/README.md +2 -1
  3. package/dist/application/process-lifecycle-transitions.d.ts +13 -2
  4. package/dist/application/process-lifecycle-transitions.d.ts.map +1 -1
  5. package/dist/application/process-lifecycle.d.ts +2 -1
  6. package/dist/application/process-lifecycle.d.ts.map +1 -1
  7. package/dist/entrypoints/agent-runtime/browser.js +119 -119
  8. package/dist/entrypoints/agent-runtime/coding-tools.js +15 -20
  9. package/dist/entrypoints/agent-runtime/harness.js +55 -63
  10. package/dist/entrypoints/agent-runtime/openrouter.js +6 -6
  11. package/dist/entrypoints/agent-runtime/sandbox.js +20 -25
  12. package/dist/entrypoints/agent-runtime/sqlite/bun.js +11 -13
  13. package/dist/entrypoints/agent-runtime/sqlite/node.js +11 -13
  14. package/dist/entrypoints/agent-runtime/testing.js +32 -34
  15. package/dist/entrypoints/agent-runtime.js +395 -402
  16. package/dist/entrypoints/application/diagnostic-journal.js +26 -27
  17. package/dist/entrypoints/application/directory-inbox.js +16 -17
  18. package/dist/entrypoints/application/grammy.js +13 -13
  19. package/dist/entrypoints/application/opentelemetry.js +13 -13
  20. package/dist/entrypoints/application/schemas.js +24 -24
  21. package/dist/entrypoints/application.d.ts +1 -1
  22. package/dist/entrypoints/application.d.ts.map +1 -1
  23. package/dist/entrypoints/application.js +218 -214
  24. package/dist/entrypoints/bin/upgrade-cli.js +2 -2
  25. package/dist/entrypoints/cli.js +81 -84
  26. package/dist/entrypoints/contract.js +54 -57
  27. package/dist/entrypoints/declaration.js +22 -22
  28. package/dist/entrypoints/files.js +18 -21
  29. package/dist/entrypoints/geo.js +7 -8
  30. package/dist/entrypoints/google.js +2 -2
  31. package/dist/entrypoints/index.js +150 -154
  32. package/dist/entrypoints/live.js +45 -47
  33. package/dist/entrypoints/node.js +68 -74
  34. package/dist/entrypoints/oauth.js +6 -6
  35. package/dist/entrypoints/observability.d.ts +1 -0
  36. package/dist/entrypoints/observability.d.ts.map +1 -1
  37. package/dist/entrypoints/observability.js +115 -87
  38. package/dist/entrypoints/primitives.js +35 -35
  39. package/dist/entrypoints/react/keyboard.d.ts +4 -0
  40. package/dist/entrypoints/react/keyboard.d.ts.map +1 -0
  41. package/dist/entrypoints/react/keyboard.js +397 -0
  42. package/dist/entrypoints/react.js +10 -10
  43. package/dist/entrypoints/release.js +7 -7
  44. package/dist/entrypoints/remote.js +15 -17
  45. package/dist/entrypoints/server.js +198 -200
  46. package/dist/entrypoints/telegram/html.d.ts +5 -0
  47. package/dist/entrypoints/telegram/html.d.ts.map +1 -0
  48. package/dist/entrypoints/telegram/html.js +26 -0
  49. package/dist/entrypoints/telegram/screens.d.ts +14 -0
  50. package/dist/entrypoints/telegram/screens.d.ts.map +1 -0
  51. package/dist/entrypoints/telegram/screens.js +2028 -0
  52. package/dist/entrypoints/telegram.d.ts +5 -1
  53. package/dist/entrypoints/telegram.d.ts.map +1 -1
  54. package/dist/entrypoints/telegram.js +548 -156
  55. package/dist/entrypoints/testing.js +75 -79
  56. package/dist/entrypoints/tools/connections.js +30 -32
  57. package/dist/entrypoints/tools/contract.js +18 -20
  58. package/dist/entrypoints/tools/invoker.js +12 -17
  59. package/dist/entrypoints/tools.js +223 -229
  60. package/dist/entrypoints/tracking/server.js +6 -6
  61. package/dist/entrypoints/tracking.js +40 -42
  62. package/dist/entrypoints/voice.js +3 -3
  63. package/dist/{index-eaysmdtq.js → index-0ndk4555.js} +56 -56
  64. package/dist/{index-2bxbyab0.js → index-1bx1xv1k.js} +1 -1
  65. package/dist/{index-p5r7qpdd.js → index-1eeqpadm.js} +4 -4
  66. package/dist/{index-hadmp193.js → index-3ct7hhq6.js} +210 -210
  67. package/dist/{index-e01r054k.js → index-45tdvqa3.js} +26 -26
  68. package/dist/{index-dce5wxcq.js → index-4s0fep5q.js} +8 -8
  69. package/dist/index-50ejfz75.js +9 -0
  70. package/dist/{index-m9zn6cpq.js → index-5107q189.js} +12 -12
  71. package/dist/{index-sbdmyz75.js → index-5cc6r990.js} +3 -3
  72. package/dist/index-6k1svmjh.js +141 -0
  73. package/dist/{index-c6bxbsnc.js → index-7kxw1awn.js} +2 -2
  74. package/dist/{index-0r0fbk7z.js → index-7z9ym7t8.js} +28 -28
  75. package/dist/{index-p7hgdyhb.js → index-814xpr6d.js} +2 -2
  76. package/dist/{index-gtj3zc53.js → index-8kzct1d6.js} +99 -99
  77. package/dist/{index-1zbbzgfh.js → index-9pw0a51a.js} +4 -4
  78. package/dist/{index-79z7m7dt.js → index-a9pd417t.js} +35 -35
  79. package/dist/{index-ham5sz8m.js → index-aaj97r4y.js} +45 -45
  80. package/dist/{index-s812ycat.js → index-aan6hqb9.js} +3 -3
  81. package/dist/{index-10x2hbx0.js → index-adhgd4pe.js} +44 -44
  82. package/dist/{index-2gxzjvyr.js → index-afjvjyck.js} +23 -23
  83. package/dist/{index-qmy6zq75.js → index-ahvsksw5.js} +16 -16
  84. package/dist/{index-hr4tzbwq.js → index-ap3gqe56.js} +3 -3
  85. package/dist/{index-znfs20ss.js → index-b2bz0kdm.js} +16 -16
  86. package/dist/{index-r066jx76.js → index-c6aagrbd.js} +148 -120
  87. package/dist/{index-k30h66yd.js → index-ck71tbcf.js} +9 -9
  88. package/dist/{index-eqqvgdb3.js → index-ct75c3at.js} +2 -2
  89. package/dist/{index-gw8bmyaj.js → index-djjhhgjk.js} +41 -41
  90. package/dist/{index-8qt2m66q.js → index-dvwj1f43.js} +43 -43
  91. package/dist/{index-fhwqwxe0.js → index-ej331hah.js} +1 -1
  92. package/dist/{index-9t3dffv2.js → index-ewbaywk5.js} +5 -5
  93. package/dist/{index-7p1f0vp2.js → index-fyphpknh.js} +25 -25
  94. package/dist/{index-83bdg97s.js → index-g149e9pk.js} +1 -1
  95. package/dist/{index-ngfhvfpd.js → index-g6a3na27.js} +4 -4
  96. package/dist/{index-qwhynv6x.js → index-h124epcf.js} +20 -20
  97. package/dist/{index-h6eeys1v.js → index-h97tqqp1.js} +9 -9
  98. package/dist/{index-zcgf3gqf.js → index-hby4qhax.js} +10 -10
  99. package/dist/{index-5jrd0yng.js → index-j8aw2c0e.js} +4 -4
  100. package/dist/{index-d8m8zpd8.js → index-jzczzcsb.js} +14 -14
  101. package/dist/index-kqnd6a85.js +26 -0
  102. package/dist/{index-35mh5bhj.js → index-kw1ws0cs.js} +12 -12
  103. package/dist/{index-yw4fzmdz.js → index-kzz6rq0w.js} +28 -17
  104. package/dist/{index-4gcnakhx.js → index-m38ej7e5.js} +2 -2
  105. package/dist/{index-ndddxtyx.js → index-m79yr938.js} +19 -19
  106. package/dist/{index-5p2m7we1.js → index-m9fndta6.js} +11 -11
  107. package/dist/index-mnkk1ffz.js +150 -0
  108. package/dist/index-n15jny5b.js +4 -0
  109. package/dist/{index-2vtcmrj9.js → index-n53mswt3.js} +20 -20
  110. package/dist/{index-bt14acb5.js → index-n5yqxd3d.js} +21 -21
  111. package/dist/{index-bm5rx7n6.js → index-n9tyz8z3.js} +12 -12
  112. package/dist/index-nmaqxdx7.js +463 -0
  113. package/dist/{index-mqv3b5rh.js → index-nx6eazt0.js} +30 -30
  114. package/dist/{index-3z73fh2c.js → index-q0th8q0z.js} +9 -9
  115. package/dist/{index-v260df89.js → index-qjeggp8w.js} +20 -20
  116. package/dist/{index-zfrhfn82.js → index-r1z0rd9c.js} +20 -20
  117. package/dist/{index-wqgjfstn.js → index-r5c4fedv.js} +3 -3
  118. package/dist/{index-cyktc4bp.js → index-r5hsgkz5.js} +118 -118
  119. package/dist/{index-0b1ess5e.js → index-r7a7r7ha.js} +1 -1
  120. package/dist/{index-1j8pm5t0.js → index-rfkh44ss.js} +15 -15
  121. package/dist/index-rz3z13e9.js +47 -0
  122. package/dist/{index-k6gpggb9.js → index-s80awwsw.js} +35 -35
  123. package/dist/{index-vqr7f7v8.js → index-ssmd41kh.js} +124 -124
  124. package/dist/{index-ensd0r74.js → index-v14qqmys.js} +41 -41
  125. package/dist/{index-paz6sgdp.js → index-v4a2fjtk.js} +36 -36
  126. package/dist/{index-d9pk3td4.js → index-w0eqdhyd.js} +14 -14
  127. package/dist/{index-5qn1kx34.js → index-w575evhq.js} +29 -29
  128. package/dist/{index-3gye9wzb.js → index-w5s3xftz.js} +26 -26
  129. package/dist/{index-tm88avnj.js → index-wykebpn9.js} +3 -3
  130. package/dist/{index-sh3s86na.js → index-xkhk5d6g.js} +17 -17
  131. package/dist/{index-6k1937bx.js → index-xqhede6x.js} +4 -4
  132. package/dist/{index-f4fx2tza.js → index-zs4ms3th.js} +181 -181
  133. package/dist/{index-k5hsfc3j.js → index-zsvzhjtk.js} +1 -1
  134. package/dist/observability/bounded-logger.d.ts +2 -0
  135. package/dist/observability/bounded-logger.d.ts.map +1 -1
  136. package/dist/observability/sanitize.d.ts +6 -0
  137. package/dist/observability/sanitize.d.ts.map +1 -1
  138. package/dist/observability/secret-values.d.ts +25 -0
  139. package/dist/observability/secret-values.d.ts.map +1 -0
  140. package/dist/react/keyboard/hooks.d.ts +71 -0
  141. package/dist/react/keyboard/hooks.d.ts.map +1 -0
  142. package/dist/react/keyboard/layers.d.ts +98 -0
  143. package/dist/react/keyboard/layers.d.ts.map +1 -0
  144. package/dist/react/keyboard/zone.d.ts +139 -0
  145. package/dist/react/keyboard/zone.d.ts.map +1 -0
  146. package/dist/telegram/crypto.d.ts +16 -0
  147. package/dist/telegram/crypto.d.ts.map +1 -0
  148. package/dist/telegram/html/check.d.ts +26 -0
  149. package/dist/telegram/html/check.d.ts.map +1 -0
  150. package/dist/telegram/html/nodes.d.ts +70 -0
  151. package/dist/telegram/html/nodes.d.ts.map +1 -0
  152. package/dist/telegram/html/parse.d.ts +35 -0
  153. package/dist/telegram/html/parse.d.ts.map +1 -0
  154. package/dist/telegram/html/render.d.ts +39 -0
  155. package/dist/telegram/html/render.d.ts.map +1 -0
  156. package/dist/telegram/init-data.d.ts.map +1 -1
  157. package/dist/telegram/operator-channel.d.ts +36 -3
  158. package/dist/telegram/operator-channel.d.ts.map +1 -1
  159. package/dist/telegram/screens/callback-codec.d.ts +34 -0
  160. package/dist/telegram/screens/callback-codec.d.ts.map +1 -0
  161. package/dist/telegram/screens/dispatch.d.ts +22 -0
  162. package/dist/telegram/screens/dispatch.d.ts.map +1 -0
  163. package/dist/telegram/screens/display.d.ts +70 -0
  164. package/dist/telegram/screens/display.d.ts.map +1 -0
  165. package/dist/telegram/screens/execute.d.ts +57 -0
  166. package/dist/telegram/screens/execute.d.ts.map +1 -0
  167. package/dist/telegram/screens/html.d.ts +36 -0
  168. package/dist/telegram/screens/html.d.ts.map +1 -0
  169. package/dist/telegram/screens/outcome.d.ts +74 -0
  170. package/dist/telegram/screens/outcome.d.ts.map +1 -0
  171. package/dist/telegram/screens/path.d.ts +29 -0
  172. package/dist/telegram/screens/path.d.ts.map +1 -0
  173. package/dist/telegram/screens/reconcile.d.ts +67 -0
  174. package/dist/telegram/screens/reconcile.d.ts.map +1 -0
  175. package/dist/telegram/screens/registry.d.ts +23 -0
  176. package/dist/telegram/screens/registry.d.ts.map +1 -0
  177. package/dist/telegram/screens/render.d.ts +70 -0
  178. package/dist/telegram/screens/render.d.ts.map +1 -0
  179. package/dist/telegram/screens/runtime.d.ts +133 -0
  180. package/dist/telegram/screens/runtime.d.ts.map +1 -0
  181. package/dist/telegram/screens/screen-types.d.ts +130 -0
  182. package/dist/telegram/screens/screen-types.d.ts.map +1 -0
  183. package/dist/telegram/screens/screen.d.ts +138 -0
  184. package/dist/telegram/screens/screen.d.ts.map +1 -0
  185. package/dist/telegram/screens/state.d.ts +115 -0
  186. package/dist/telegram/screens/state.d.ts.map +1 -0
  187. package/dist/telegram/screens/telegram-screens.d.ts +18 -0
  188. package/dist/telegram/screens/telegram-screens.d.ts.map +1 -0
  189. package/dist/telegram/screens/test-chat-telegram.d.ts +47 -0
  190. package/dist/telegram/screens/test-chat-telegram.d.ts.map +1 -0
  191. package/dist/telegram/screens/test-chat.d.ts +66 -0
  192. package/dist/telegram/screens/test-chat.d.ts.map +1 -0
  193. package/dist/telegram/screens/view.d.ts +89 -0
  194. package/dist/telegram/screens/view.d.ts.map +1 -0
  195. package/dist/telegram/send-failure.d.ts +19 -0
  196. package/dist/telegram/send-failure.d.ts.map +1 -1
  197. package/dist/telegram/update-intake.d.ts +78 -0
  198. package/dist/telegram/update-intake.d.ts.map +1 -0
  199. package/dist/telegram/update-store-sqlite.d.ts +26 -0
  200. package/dist/telegram/update-store-sqlite.d.ts.map +1 -0
  201. package/dist/telegram/update-store.d.ts +67 -0
  202. package/dist/telegram/update-store.d.ts.map +1 -0
  203. package/dist/telegram/webhook.d.ts +105 -0
  204. package/dist/telegram/webhook.d.ts.map +1 -0
  205. package/dist/tools/cli/args-fields.d.ts +8 -0
  206. package/dist/tools/cli/args-fields.d.ts.map +1 -1
  207. package/dist/tools/cli/args-route.d.ts.map +1 -1
  208. package/dist/tools/cli/args.d.ts.map +1 -1
  209. package/dist/tools/cli/help.d.ts.map +1 -1
  210. package/llms/application.2.txt +26 -1
  211. package/llms/application.txt +18 -27
  212. package/llms/cli.txt +8 -2
  213. package/llms/observability.txt +2 -1
  214. package/llms/react-keyboard.txt +193 -0
  215. package/llms/stitchkit.txt +7 -1
  216. package/llms/telegram-html.txt +35 -0
  217. package/llms/telegram-screens.txt +365 -0
  218. package/llms/telegram.txt +160 -4
  219. package/llms-full.txt +755 -11
  220. package/llms.txt +11 -6
  221. package/package.json +17 -2
  222. package/dist/index-2k4yrqkc.js +0 -9
  223. package/dist/index-crykmqkr.js +0 -26
  224. package/dist/index-y64k3s0h.js +0 -150
  225. package/dist/index-y91ry9h2.js +0 -4
  226. /package/dist/{index-hffjpmq9.js → index-9jfdm5tg.js} +0 -0
  227. /package/dist/{index-zjjyynm3.js → index-d4pa2bgs.js} +0 -0
  228. /package/dist/{index-rxfy4cq7.js → index-dwfv9a85.js} +0 -0
  229. /package/dist/{index-5jm36zv1.js → index-gfk7nrht.js} +0 -0
  230. /package/dist/{index-b9aefrqd.js → index-n1dqr7gf.js} +0 -0
  231. /package/dist/{index-q3pyb9n0.js → index-sykb5ag7.js} +0 -0
  232. /package/dist/{index-48ffdxgk.js → index-xhzq2qvj.js} +0 -0
  233. /package/dist/{index-kzfs85xp.js → index-zsarb5xp.js} +0 -0
@@ -1,26 +1,26 @@
1
1
  import {
2
- inputIsQuery
3
- } from "./index-48ffdxgk.js";
4
- import {
5
- ContractStreamFrameSchema,
6
- DEFAULT_CONTRACT_STREAM_FRAME_BYTES
7
- } from "./index-wqgjfstn.js";
8
- import {
9
- ApiError,
10
2
  RequestCancellationError,
11
3
  createRequestCancellation,
12
- parseApiErrorBody,
4
+ responseTraceId,
5
+ ApiError2,
13
6
  refuseLocally,
14
- responseTraceId
15
- } from "./index-v260df89.js";
7
+ parseApiErrorBody
8
+ } from "./index-qjeggp8w.js";
16
9
  import {
17
10
  parseTrailingWildcard
18
- } from "./index-4gcnakhx.js";
11
+ } from "./index-m38ej7e5.js";
12
+ import {
13
+ DEFAULT_CONTRACT_STREAM_FRAME_BYTES2,
14
+ ContractStreamFrameSchema2
15
+ } from "./index-r5c4fedv.js";
16
+ import {
17
+ inputIsQuery
18
+ } from "./index-xhzq2qvj.js";
19
19
  import {
20
+ typedEntries,
20
21
  isRecord,
21
- mapObject,
22
- typedEntries
23
- } from "./index-hffjpmq9.js";
22
+ mapObject
23
+ } from "./index-9jfdm5tg.js";
24
24
 
25
25
  // src/internal/bounded-lines.ts
26
26
  var DEFAULT_STREAM_LINE_BYTES = 1024 * 1024;
@@ -89,7 +89,7 @@ function parseFailure(raw, error, onParseError) {
89
89
  throw failure;
90
90
  onParseError(raw, failure);
91
91
  }
92
- async function* parseNDJSON(response, options) {
92
+ async function* parseNDJSON2(response, options) {
93
93
  try {
94
94
  for await (const rawLine of readBoundedUtf8Lines(response, options?.maxLineBytes ?? DEFAULT_STREAM_LINE_BYTES, options?.finalLine === "require-newline")) {
95
95
  const line = (rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine).trim();
@@ -105,7 +105,7 @@ async function* parseNDJSON(response, options) {
105
105
  parseFailure("", error, options?.onParseError);
106
106
  }
107
107
  }
108
- async function* parseSSE(response, options) {
108
+ async function* parseSSE2(response, options) {
109
109
  try {
110
110
  for await (const rawLine of readBoundedUtf8Lines(response, options?.maxLineBytes ?? DEFAULT_STREAM_LINE_BYTES)) {
111
111
  const line = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
@@ -343,10 +343,10 @@ function joinClientBaseUrl(baseUrl, relativeUrl) {
343
343
  // src/browser/contract-stream.ts
344
344
  function sourceFor(response, descriptor) {
345
345
  const options = {
346
- maxLineBytes: descriptor.maxFrameBytes ?? DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
346
+ maxLineBytes: descriptor.maxFrameBytes ?? DEFAULT_CONTRACT_STREAM_FRAME_BYTES2,
347
347
  finalLine: descriptor.finalLine
348
348
  };
349
- return descriptor.format === "sse" ? parseSSE(response, options) : parseNDJSON(response, options);
349
+ return descriptor.format === "sse" ? parseSSE2(response, options) : parseNDJSON2(response, options);
350
350
  }
351
351
  async function* readContractStream(response, descriptor, abort) {
352
352
  let ended = false;
@@ -359,17 +359,17 @@ async function* readContractStream(response, descriptor, abort) {
359
359
  break;
360
360
  let candidate = next.value;
361
361
  if (descriptor.framing !== "item") {
362
- const parsedFrame = ContractStreamFrameSchema.safeParse(candidate);
362
+ const parsedFrame = ContractStreamFrameSchema2.safeParse(candidate);
363
363
  if (!parsedFrame.success) {
364
- throw new ApiError("STREAM_PROTOCOL_ERROR", 0, undefined, "Stream frame did not match the protocol envelope");
364
+ throw new ApiError2("STREAM_PROTOCOL_ERROR", 0, undefined, "Stream frame did not match the protocol envelope");
365
365
  }
366
366
  const frame = parsedFrame.data;
367
367
  if (frame.type === "error") {
368
- throw new ApiError(frame.error.code, 0, frame.error.details, frame.error.message, frame.error.hint);
368
+ throw new ApiError2(frame.error.code, 0, frame.error.details, frame.error.message, frame.error.hint);
369
369
  }
370
370
  if (frame.type === "end") {
371
371
  if (!terminalSeen) {
372
- throw new ApiError("STREAM_TERMINAL_MISSING", 0, undefined, "Stream completed before its declared terminal item");
372
+ throw new ApiError2("STREAM_TERMINAL_MISSING", 0, undefined, "Stream completed before its declared terminal item");
373
373
  }
374
374
  ended = true;
375
375
  return;
@@ -378,7 +378,7 @@ async function* readContractStream(response, descriptor, abort) {
378
378
  }
379
379
  const parsedItem = descriptor.item.safeParse(candidate);
380
380
  if (!parsedItem.success) {
381
- throw new ApiError("STREAM_ITEM_INVALID", 0, undefined, "Stream item did not match its contract");
381
+ throw new ApiError2("STREAM_ITEM_INVALID", 0, undefined, "Stream item did not match its contract");
382
382
  }
383
383
  const item = parsedItem.data;
384
384
  const terminal = descriptor.terminal?.safeParse(item).success ?? false;
@@ -396,10 +396,10 @@ async function* readContractStream(response, descriptor, abort) {
396
396
  if (descriptor.framing === "item") {
397
397
  if (terminalSeen)
398
398
  return;
399
- throw new ApiError("STREAM_TERMINAL_MISSING", 0, undefined, "Stream completed before its declared terminal item");
399
+ throw new ApiError2("STREAM_TERMINAL_MISSING", 0, undefined, "Stream completed before its declared terminal item");
400
400
  }
401
401
  if (!ended) {
402
- throw new ApiError("STREAM_TRUNCATED", 0, undefined, "Stream ended without its protocol terminal frame");
402
+ throw new ApiError2("STREAM_TRUNCATED", 0, undefined, "Stream ended without its protocol terminal frame");
403
403
  }
404
404
  } finally {
405
405
  abort();
@@ -567,12 +567,12 @@ function createFetchExecutor(endpoint, prefix, config, contractConfig) {
567
567
  });
568
568
  } catch (error) {
569
569
  if (error instanceof RequestCancellationError) {
570
- throw new ApiError(error.cause === "caller" ? "REQUEST_ABORTED" : "REQUEST_TIMEOUT", 0, undefined, error.message);
570
+ throw new ApiError2(error.cause === "caller" ? "REQUEST_ABORTED" : "REQUEST_TIMEOUT", 0, undefined, error.message);
571
571
  }
572
- if (ApiError.is(error))
572
+ if (ApiError2.is(error))
573
573
  throw error;
574
574
  const message = error instanceof Error ? error.message : undefined;
575
- throw new ApiError("UNKNOWN_ERROR", 0, message ? { message } : undefined, message, undefined, undefined, { cause: error });
575
+ throw new ApiError2("UNKNOWN_ERROR", 0, message ? { message } : undefined, message, undefined, undefined, { cause: error });
576
576
  }
577
577
  };
578
578
  }
@@ -581,13 +581,13 @@ async function throwForErrorResponse(res, config, fallbackBody) {
581
581
  config.onError?.(res.status, body);
582
582
  const parsed = parseApiErrorBody(body);
583
583
  if (parsed) {
584
- throw new ApiError(parsed.code, res.status, parsed.details, parsed.message, parsed.hint, responseTraceId(res));
584
+ throw new ApiError2(parsed.code, res.status, parsed.details, parsed.message, parsed.hint, responseTraceId(res));
585
585
  }
586
- throw new ApiError("HTTP_ERROR", res.status, { body }, undefined, undefined, responseTraceId(res));
586
+ throw new ApiError2("HTTP_ERROR", res.status, { body }, undefined, undefined, responseTraceId(res));
587
587
  }
588
588
 
589
589
  // src/browser/client.ts
590
- function contractEndpointMatchers(contract, endpointNames, contractConfig) {
590
+ function contractEndpointMatchers2(contract, endpointNames, contractConfig) {
591
591
  const selected = endpointNames ? new Set(endpointNames) : null;
592
592
  const matchers = [];
593
593
  for (const [key, endpoint] of typedEntries(contract.endpoints)) {
@@ -606,7 +606,7 @@ function contractEndpointMatchers(contract, endpointNames, contractConfig) {
606
606
  }
607
607
  return matchers;
608
608
  }
609
- function createClient(contract, configOrClient, contractConfig) {
609
+ function createClient2(contract, configOrClient, contractConfig) {
610
610
  const client = {};
611
611
  const makeExecutor = isHttpAdapter(configOrClient) ? (endpoint) => createHttpExecutor(endpoint, contract.meta.prefix, configOrClient, contractConfig) : (endpoint) => createFetchExecutor(endpoint, contract.meta.prefix, configOrClient, contractConfig);
612
612
  for (const [key, endpoint] of typedEntries(contract.endpoints)) {
@@ -616,8 +616,8 @@ function createClient(contract, configOrClient, contractConfig) {
616
616
  }
617
617
  return client;
618
618
  }
619
- function createClients(contracts, configOrClient, contractConfig) {
620
- return mapObject(contracts, (_key, contract) => createClient(contract, configOrClient, contractConfig));
619
+ function createClients2(contracts, configOrClient, contractConfig) {
620
+ return mapObject(contracts, (_key, contract) => createClient2(contract, configOrClient, contractConfig));
621
621
  }
622
622
  function buildScopedRegistry(contracts, scopeConfigs, surfaceName, build) {
623
623
  const registry = {};
@@ -644,8 +644,8 @@ function buildScopedRegistry(contracts, scopeConfigs, surfaceName, build) {
644
644
  }
645
645
  return registry;
646
646
  }
647
- function createScopedClients(contracts, configOrClient, scopeConfigs) {
648
- return buildScopedRegistry(contracts, scopeConfigs, "client", (contract, config) => createClient(contract, configOrClient, config));
647
+ function createScopedClients2(contracts, configOrClient, scopeConfigs) {
648
+ return buildScopedRegistry(contracts, scopeConfigs, "client", (contract, config) => createClient2(contract, configOrClient, config));
649
649
  }
650
650
  function isHttpAdapter(value) {
651
651
  return typeof value === "object" && "get" in value && typeof value.get === "function";
@@ -656,8 +656,8 @@ function setClientMethod(target, key, method) {
656
656
  function createEndpointMethod(endpoint, execute, contractConfig) {
657
657
  const hasScopedArguments = (contractConfig?.stripPrefixKeys?.length ?? 0) > 0;
658
658
  if (endpointHasArguments(endpoint) || hasScopedArguments) {
659
- const method2 = (requestArgs) => settle(execute, readClientRequestArgs(requestArgs), undefined);
660
- return Object.assign(method2, {
659
+ const method = (requestArgs) => settle(execute, readClientRequestArgs(requestArgs), undefined);
660
+ return Object.assign(method, {
661
661
  withOptions: (...args) => {
662
662
  refuseExtraWithOptionsArguments(endpoint, args.length, 2);
663
663
  return settle(execute, readClientRequestArgs(args[0]), readClientRequestOptions(args[1]));
@@ -708,7 +708,7 @@ function readClientRequestOptions(value) {
708
708
  function isAbortSignal(value) {
709
709
  return typeof value === "object" && value !== null && "aborted" in value && typeof value.aborted === "boolean" && "addEventListener" in value && typeof value.addEventListener === "function" && "removeEventListener" in value && typeof value.removeEventListener === "function";
710
710
  }
711
- function createUrlBuilder(contract, source, contractConfig) {
711
+ function createUrlBuilder2(contract, source, contractConfig) {
712
712
  const builder = {};
713
713
  for (const [key, endpoint] of typedEntries(contract.endpoints)) {
714
714
  if (endpoint.expose && !endpoint.expose.includes("HTTP"))
@@ -724,11 +724,11 @@ function createUrlBuilder(contract, source, contractConfig) {
724
724
  }
725
725
  return builder;
726
726
  }
727
- function createUrlBuilders(contracts, source, contractConfig) {
728
- return mapObject(contracts, (_key, contract) => createUrlBuilder(contract, source, contractConfig));
727
+ function createUrlBuilders2(contracts, source, contractConfig) {
728
+ return mapObject(contracts, (_key, contract) => createUrlBuilder2(contract, source, contractConfig));
729
729
  }
730
- function createScopedUrlBuilders(contracts, source, scopeConfigs) {
731
- return buildScopedRegistry(contracts, scopeConfigs, "URL builder", (contract, config) => createUrlBuilder(contract, source, config));
730
+ function createScopedUrlBuilders2(contracts, source, scopeConfigs) {
731
+ return buildScopedRegistry(contracts, scopeConfigs, "URL builder", (contract, config) => createUrlBuilder2(contract, source, config));
732
732
  }
733
733
 
734
- export { parseNDJSON, parseSSE, contractEndpointMatchers, createClient, createClients, createScopedClients, createUrlBuilder, createUrlBuilders, createScopedUrlBuilders };
734
+ export { parseNDJSON2, parseSSE2, contractEndpointMatchers2, createClient2, createClients2, createScopedClients2, createUrlBuilder2, createUrlBuilders2, createScopedUrlBuilders2 };
@@ -18,7 +18,7 @@ function stagingPath(target) {
18
18
  function bytesOf(data) {
19
19
  return typeof data === "string" ? new TextEncoder().encode(data) : data;
20
20
  }
21
- async function writeFileAtomic(target, data, options = {}) {
21
+ async function writeFileAtomic2(target, data, options = {}) {
22
22
  const mode = options.mode ?? DEFAULT_MODE;
23
23
  const staged = stagingPath(target);
24
24
  const handle = await open(staged, "wx", mode);
@@ -38,7 +38,7 @@ async function writeFileAtomic(target, data, options = {}) {
38
38
  throw error;
39
39
  }
40
40
  }
41
- function writeFileAtomicSync(target, data, options = {}) {
41
+ function writeFileAtomicSync2(target, data, options = {}) {
42
42
  const mode = options.mode ?? DEFAULT_MODE;
43
43
  const bytes = bytesOf(data);
44
44
  const staged = stagingPath(target);
@@ -62,4 +62,4 @@ function writeFileAtomicSync(target, data, options = {}) {
62
62
  }
63
63
  }
64
64
 
65
- export { writeFileAtomic, writeFileAtomicSync };
65
+ export { writeFileAtomic2, writeFileAtomicSync2 };
@@ -1,26 +1,26 @@
1
1
  import {
2
- AgentAdmissionReceiptSchema,
3
- AgentHistoryMutationSchema,
4
- AgentRuntimeHeadSchema,
5
- AgentSeedReceiptSchema,
6
- AgentStoredRunSchema,
7
- createAgentRuntimeStore,
8
- isActiveRunState,
9
- replaceMessage
10
- } from "./index-vqr7f7v8.js";
2
+ AgentStoreEventEnvelopeSchema2,
3
+ AgentStoreEventPageSchema2,
4
+ AgentRecoverablePageSchema2
5
+ } from "./index-r5hsgkz5.js";
11
6
  import {
12
- AgentRecoverablePageSchema,
13
- AgentStoreEventEnvelopeSchema,
14
- AgentStoreEventPageSchema
15
- } from "./index-cyktc4bp.js";
7
+ AgentRecordIdSchema2,
8
+ AgentMessageSchema2
9
+ } from "./index-8kzct1d6.js";
16
10
  import {
17
- AgentMessageSchema,
18
- AgentRecordIdSchema
19
- } from "./index-gtj3zc53.js";
11
+ AgentRuntimeHeadSchema2,
12
+ AgentStoredRunSchema2,
13
+ AgentAdmissionReceiptSchema2,
14
+ AgentSeedReceiptSchema2,
15
+ AgentHistoryMutationSchema2,
16
+ isActiveRunState,
17
+ replaceMessage,
18
+ createAgentRuntimeStore2
19
+ } from "./index-ssmd41kh.js";
20
20
 
21
21
  // src/agent-runtime/store-memory.ts
22
22
  import { z } from "zod";
23
- var RecoverableCursorSchema = z.tuple([AgentRecordIdSchema, AgentRecordIdSchema]);
23
+ var RecoverableCursorSchema = z.tuple([AgentRecordIdSchema2, AgentRecordIdSchema2]);
24
24
  function recoverableCursor(input) {
25
25
  return JSON.stringify([input.conversationId, input.run.id]);
26
26
  }
@@ -30,7 +30,7 @@ function parseRecoverableCursor(cursor) {
30
30
  function cloneHeadMap(source) {
31
31
  return new Map([...source].map(([key, value]) => [
32
32
  key,
33
- AgentRuntimeHeadSchema.parse(structuredClone(value))
33
+ AgentRuntimeHeadSchema2.parse(structuredClone(value))
34
34
  ]));
35
35
  }
36
36
  function cloneNestedMap(source, clone) {
@@ -42,7 +42,7 @@ function cloneNestedMap(source, clone) {
42
42
  function cloneHistoryMap(source) {
43
43
  return new Map([...source].map(([key, value]) => [
44
44
  key,
45
- value.map((message) => AgentMessageSchema.parse(structuredClone(message)))
45
+ value.map((message) => AgentMessageSchema2.parse(structuredClone(message)))
46
46
  ]));
47
47
  }
48
48
  var memoryConversations = {
@@ -62,7 +62,7 @@ var memoryConversations = {
62
62
  var memoryHead = {
63
63
  async load(transaction, conversationId) {
64
64
  const head = transaction.heads.get(conversationId);
65
- return head ? AgentRuntimeHeadSchema.parse(structuredClone(head)) : undefined;
65
+ return head ? AgentRuntimeHeadSchema2.parse(structuredClone(head)) : undefined;
66
66
  },
67
67
  async compareAndSwap(transaction, input) {
68
68
  const current = transaction.heads.get(input.conversationId);
@@ -70,31 +70,31 @@ var memoryHead = {
70
70
  if (actualVersion !== input.expectedVersion) {
71
71
  return { outcome: "conflict", actualVersion };
72
72
  }
73
- transaction.heads.set(input.conversationId, AgentRuntimeHeadSchema.parse(structuredClone(input.next)));
73
+ transaction.heads.set(input.conversationId, AgentRuntimeHeadSchema2.parse(structuredClone(input.next)));
74
74
  return { outcome: "applied" };
75
75
  }
76
76
  };
77
77
  var memoryRuns = {
78
78
  async load(transaction, input) {
79
79
  const record = transaction.runs.get(input.conversationId)?.get(input.runId);
80
- return record ? AgentStoredRunSchema.parse(structuredClone(record)) : undefined;
80
+ return record ? AgentStoredRunSchema2.parse(structuredClone(record)) : undefined;
81
81
  },
82
82
  async loadByAssistantMessageId(transaction, input) {
83
83
  const record = [...transaction.runs.get(input.conversationId)?.values() ?? []].find((candidate) => candidate.run.assistantMessageId === input.assistantMessageId);
84
- return record ? AgentStoredRunSchema.parse(structuredClone(record)) : undefined;
84
+ return record ? AgentStoredRunSchema2.parse(structuredClone(record)) : undefined;
85
85
  },
86
86
  async loadMany(transaction, input) {
87
87
  const records = transaction.runs.get(input.conversationId);
88
88
  return input.runIds.flatMap((runId) => {
89
89
  const record = records?.get(runId);
90
- return record ? [AgentStoredRunSchema.parse(structuredClone(record))] : [];
90
+ return record ? [AgentStoredRunSchema2.parse(structuredClone(record))] : [];
91
91
  });
92
92
  },
93
93
  async listActive(transaction, conversationId) {
94
- return [...transaction.runs.get(conversationId)?.values() ?? []].filter((record) => isActiveRunState(record.run.state)).map((record) => AgentStoredRunSchema.parse(structuredClone(record)));
94
+ return [...transaction.runs.get(conversationId)?.values() ?? []].filter((record) => isActiveRunState(record.run.state)).map((record) => AgentStoredRunSchema2.parse(structuredClone(record)));
95
95
  },
96
96
  async save(transaction, rawRecord) {
97
- const record = AgentStoredRunSchema.parse(structuredClone(rawRecord));
97
+ const record = AgentStoredRunSchema2.parse(structuredClone(rawRecord));
98
98
  const conversationRuns = transaction.runs.get(record.run.conversationId) ?? new Map;
99
99
  const collision = [...conversationRuns.values()].find((candidate) => candidate.run.id !== record.run.id && candidate.run.assistantMessageId === record.run.assistantMessageId);
100
100
  if (collision)
@@ -106,16 +106,16 @@ var memoryRuns = {
106
106
  var memoryAdmissions = {
107
107
  async load(transaction, input) {
108
108
  const receipt = transaction.admissions.get(input.conversationId)?.get(input.idempotencyKey);
109
- return receipt ? AgentAdmissionReceiptSchema.parse(structuredClone(receipt)) : undefined;
109
+ return receipt ? AgentAdmissionReceiptSchema2.parse(structuredClone(receipt)) : undefined;
110
110
  },
111
111
  async loadByInputMessageId(transaction, input) {
112
112
  const receipt = [
113
113
  ...transaction.admissions.get(input.conversationId)?.values() ?? []
114
114
  ].find((candidate) => candidate.input.id === input.inputMessageId);
115
- return receipt ? AgentAdmissionReceiptSchema.parse(structuredClone(receipt)) : undefined;
115
+ return receipt ? AgentAdmissionReceiptSchema2.parse(structuredClone(receipt)) : undefined;
116
116
  },
117
117
  async create(transaction, rawReceipt) {
118
- const receipt = AgentAdmissionReceiptSchema.parse(structuredClone(rawReceipt));
118
+ const receipt = AgentAdmissionReceiptSchema2.parse(structuredClone(rawReceipt));
119
119
  const conversationAdmissions = transaction.admissions.get(receipt.conversationId) ?? new Map;
120
120
  if (conversationAdmissions.has(receipt.idempotencyKey) || [...conversationAdmissions.values()].some((candidate) => candidate.input.id === receipt.input.id)) {
121
121
  throw new TypeError("Admission identity is already reserved");
@@ -127,10 +127,10 @@ var memoryAdmissions = {
127
127
  var memorySeeds = {
128
128
  async load(transaction, input) {
129
129
  const receipt = transaction.seeds.get(input.conversationId)?.get(input.seedKey);
130
- return receipt ? AgentSeedReceiptSchema.parse(structuredClone(receipt)) : undefined;
130
+ return receipt ? AgentSeedReceiptSchema2.parse(structuredClone(receipt)) : undefined;
131
131
  },
132
132
  async create(transaction, rawReceipt) {
133
- const receipt = AgentSeedReceiptSchema.parse(structuredClone(rawReceipt));
133
+ const receipt = AgentSeedReceiptSchema2.parse(structuredClone(rawReceipt));
134
134
  const conversationSeeds = transaction.seeds.get(receipt.conversationId) ?? new Map;
135
135
  if (conversationSeeds.has(receipt.seedKey)) {
136
136
  throw new TypeError("Conversation seed identity is already reserved");
@@ -141,13 +141,13 @@ var memorySeeds = {
141
141
  };
142
142
  var memoryHistory = {
143
143
  async load(transaction, conversationId) {
144
- return (transaction.histories.get(conversationId) ?? []).map((message) => AgentMessageSchema.parse(structuredClone(message)));
144
+ return (transaction.histories.get(conversationId) ?? []).map((message) => AgentMessageSchema2.parse(structuredClone(message)));
145
145
  },
146
146
  async hasMessage(transaction, input) {
147
147
  return (transaction.histories.get(input.conversationId) ?? []).some((message) => message.id === input.messageId);
148
148
  },
149
149
  async apply(transaction, rawMutation) {
150
- const mutation = AgentHistoryMutationSchema.parse(rawMutation);
150
+ const mutation = AgentHistoryMutationSchema2.parse(rawMutation);
151
151
  const conversationId = mutation.type === "admit" ? mutation.input.conversationId : mutation.type === "upsert-assistant" ? mutation.message.conversationId : mutation.type === "seed" ? mutation.message.conversationId : mutation.summary.conversationId;
152
152
  const current = transaction.histories.get(conversationId) ?? [];
153
153
  if (mutation.type === "admit") {
@@ -184,7 +184,7 @@ var memoryHistory = {
184
184
  var memoryEvents = {
185
185
  async append(transaction, draft) {
186
186
  const current = transaction.events.get(draft.conversationId) ?? [];
187
- const event = AgentStoreEventEnvelopeSchema.parse({
187
+ const event = AgentStoreEventEnvelopeSchema2.parse({
188
188
  ...draft,
189
189
  seq: (current.at(-1)?.seq ?? 0) + 1
190
190
  });
@@ -198,7 +198,7 @@ var memoryEvents = {
198
198
  const selected = (transaction.events.get(input.conversationId) ?? []).filter((event) => (input.fromSeq === undefined || event.seq >= input.fromSeq) && (input.toSeq === undefined || event.seq <= input.toSeq));
199
199
  const items = selected.slice(0, input.limit);
200
200
  const last = items.at(-1);
201
- return AgentStoreEventPageSchema.parse({
201
+ return AgentStoreEventPageSchema2.parse({
202
202
  items,
203
203
  ...selected.length > items.length && last ? { nextSeq: last.seq + 1 } : {}
204
204
  });
@@ -212,17 +212,17 @@ function scanMemoryRecoverable(runs, input) {
212
212
  const cursorTuple = input.cursor ? parseRecoverableCursor(input.cursor) : undefined;
213
213
  const start = cursorTuple ? descriptors.findIndex((item) => item.conversationId.localeCompare(cursorTuple[0]) > 0 || item.conversationId === cursorTuple[0] && item.run.id.localeCompare(cursorTuple[1]) > 0) : 0;
214
214
  if (start === -1) {
215
- return AgentRecoverablePageSchema.parse({ items: [] });
215
+ return AgentRecoverablePageSchema2.parse({ items: [] });
216
216
  }
217
217
  const items = descriptors.slice(start, start + input.limit);
218
218
  const last = items.at(-1);
219
219
  const hasMore = start + items.length < descriptors.length;
220
- return AgentRecoverablePageSchema.parse({
220
+ return AgentRecoverablePageSchema2.parse({
221
221
  items,
222
222
  ...hasMore && last && { nextCursor: recoverableCursor(last) }
223
223
  });
224
224
  }
225
- function createMemoryAgentRuntimeStore() {
225
+ function createMemoryAgentRuntimeStore2() {
226
226
  let purged = new Set;
227
227
  let heads = new Map;
228
228
  let runs = new Map;
@@ -244,13 +244,13 @@ function createMemoryAgentRuntimeStore() {
244
244
  const transaction = {
245
245
  purged: new Set(purged),
246
246
  heads: cloneHeadMap(heads),
247
- runs: cloneNestedMap(runs, (record) => AgentStoredRunSchema.parse(structuredClone(record))),
248
- admissions: cloneNestedMap(admissions, (receipt) => AgentAdmissionReceiptSchema.parse(structuredClone(receipt))),
249
- seeds: cloneNestedMap(seeds, (receipt) => AgentSeedReceiptSchema.parse(structuredClone(receipt))),
247
+ runs: cloneNestedMap(runs, (record) => AgentStoredRunSchema2.parse(structuredClone(record))),
248
+ admissions: cloneNestedMap(admissions, (receipt) => AgentAdmissionReceiptSchema2.parse(structuredClone(receipt))),
249
+ seeds: cloneNestedMap(seeds, (receipt) => AgentSeedReceiptSchema2.parse(structuredClone(receipt))),
250
250
  histories: cloneHistoryMap(histories),
251
251
  events: new Map([...events].map(([conversationId, stored]) => [
252
252
  conversationId,
253
- stored.map((event) => AgentStoreEventEnvelopeSchema.parse(structuredClone(event)))
253
+ stored.map((event) => AgentStoreEventEnvelopeSchema2.parse(structuredClone(event)))
254
254
  ]))
255
255
  };
256
256
  try {
@@ -278,7 +278,7 @@ function createMemoryAgentRuntimeStore() {
278
278
  return scanMemoryRecoverable(runs, input);
279
279
  }
280
280
  };
281
- return createAgentRuntimeStore(driver);
281
+ return createAgentRuntimeStore2(driver);
282
282
  }
283
283
 
284
- export { createMemoryAgentRuntimeStore };
284
+ export { createMemoryAgentRuntimeStore2 };
@@ -1,17 +1,17 @@
1
1
  import {
2
- contractMethodFields
3
- } from "./index-2bxbyab0.js";
2
+ AppError2
3
+ } from "./index-n53mswt3.js";
4
4
  import {
5
- AppError
6
- } from "./index-2vtcmrj9.js";
5
+ contractMethodFields
6
+ } from "./index-1bx1xv1k.js";
7
7
  import {
8
- callRuntimeHandler,
9
- typedEntries
10
- } from "./index-hffjpmq9.js";
8
+ typedEntries,
9
+ callRuntimeHandler
10
+ } from "./index-9jfdm5tg.js";
11
11
 
12
12
  // src/server/middleware/cors.ts
13
- var DEFAULT_CORS_ALLOW_HEADERS = "Content-Type, Authorization, X-Trace-Id, traceparent, tracestate";
14
- var DEFAULT_CORS_EXPOSE_HEADERS = "Content-Disposition, Content-Length, Content-Range, Accept-Ranges, ETag, Last-Modified, X-Request-Id, X-Build-Id";
13
+ var DEFAULT_CORS_ALLOW_HEADERS2 = "Content-Type, Authorization, X-Trace-Id, traceparent, tracestate";
14
+ var DEFAULT_CORS_EXPOSE_HEADERS2 = "Content-Disposition, Content-Length, Content-Range, Accept-Ranges, ETag, Last-Modified, X-Request-Id, X-Build-Id";
15
15
  function assertCorsConfig(config) {
16
16
  if (config.credentials && (config.origin === undefined || config.origin === "*")) {
17
17
  throw new Error("[stitchkit] cors: `credentials: true` cannot be combined with a wildcard origin. " + "Set `origin` to an explicit string or list.");
@@ -46,13 +46,13 @@ function isOriginAllowed(config, requestOrigin) {
46
46
  const allowed = Array.isArray(config.origin) ? config.origin : [config.origin];
47
47
  return allowed.some((origin) => origin.toLowerCase() === lower);
48
48
  }
49
- function corsHeaders(config, requestOrigin) {
49
+ function corsHeaders2(config, requestOrigin) {
50
50
  const allowOrigin = resolveOrigin(config, requestOrigin);
51
51
  const headers = {
52
52
  "Access-Control-Allow-Methods": config.methods ?? "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS",
53
- "Access-Control-Allow-Headers": config.headers ?? DEFAULT_CORS_ALLOW_HEADERS
53
+ "Access-Control-Allow-Headers": config.headers ?? DEFAULT_CORS_ALLOW_HEADERS2
54
54
  };
55
- const expose = Array.isArray(config.exposeHeaders) ? config.exposeHeaders.join(", ") : config.exposeHeaders ?? DEFAULT_CORS_EXPOSE_HEADERS;
55
+ const expose = Array.isArray(config.exposeHeaders) ? config.exposeHeaders.join(", ") : config.exposeHeaders ?? DEFAULT_CORS_EXPOSE_HEADERS2;
56
56
  if (expose !== "") {
57
57
  headers["Access-Control-Expose-Headers"] = expose;
58
58
  }
@@ -67,16 +67,16 @@ function corsHeaders(config, requestOrigin) {
67
67
  }
68
68
  return headers;
69
69
  }
70
- function corsPreflightResponse(config, req) {
70
+ function corsPreflightResponse2(config, req) {
71
71
  return new Response(null, {
72
72
  status: 204,
73
- headers: corsHeaders(config, req.headers.get("origin"))
73
+ headers: corsHeaders2(config, req.headers.get("origin"))
74
74
  });
75
75
  }
76
76
  function requestCorsHeaders(cors, req) {
77
77
  if (!cors)
78
78
  return {};
79
- return corsHeaders(cors, req.headers.get("origin"));
79
+ return corsHeaders2(cors, req.headers.get("origin"));
80
80
  }
81
81
  function applyCors(res, cors, req) {
82
82
  const extra = requestCorsHeaders(cors, req);
@@ -116,7 +116,7 @@ function setCorsHeader(headers, key, value) {
116
116
  function isStreamingImplementation(value) {
117
117
  return typeof value === "object" && value !== null && "kind" in value && value.kind === "stitchkit.multipart.stream";
118
118
  }
119
- function defineMultipartStream(endpoint, config) {
119
+ function defineMultipartStream2(endpoint, config) {
120
120
  return buildMultipartStream(endpoint, config.files, config.handler);
121
121
  }
122
122
  function buildMultipartStream(endpoint, files, handler) {
@@ -137,7 +137,7 @@ function buildMultipartStream(endpoint, files, handler) {
137
137
  }
138
138
  };
139
139
  }
140
- function createMultipartStream() {
140
+ function createMultipartStream2() {
141
141
  return (endpoint, config) => buildMultipartStream(endpoint, config.files, config.handler);
142
142
  }
143
143
  function isStreamingEndpoint(endpoint) {
@@ -171,7 +171,7 @@ function contractOnlyService(contract) {
171
171
  }
172
172
  function stubHandler(label) {
173
173
  return () => {
174
- throw new AppError("NOT_IMPLEMENTED", `[stitchkit] ${label} is declared by its contract and has no handler`, 501);
174
+ throw new AppError2("NOT_IMPLEMENTED", `[stitchkit] ${label} is declared by its contract and has no handler`, 501);
175
175
  };
176
176
  }
177
177
  function bindContract(contract, handlers, options) {
@@ -211,13 +211,13 @@ function bindContract(contract, handlers, options) {
211
211
  methods
212
212
  };
213
213
  }
214
- function implement(contract, handlers, options) {
214
+ function implement2(contract, handlers, options) {
215
215
  return bindContract(contract, handlers, options);
216
216
  }
217
- function createImplement() {
218
- return (contract, handlers, options) => implement(contract, handlers, options);
217
+ function createImplement2() {
218
+ return (contract, handlers, options) => implement2(contract, handlers, options);
219
219
  }
220
- function createScopedImplement() {
220
+ function createScopedImplement2() {
221
221
  const implementScoped = (contract, handlers, options) => bindContract(contract, handlers, options);
222
222
  const stream = (scope, endpoint, config) => {
223
223
  if (endpoint.scope !== undefined && endpoint.scope !== scope) {
@@ -263,4 +263,4 @@ function mediaTypeEssence(contentType) {
263
263
  return (contentType ?? "").split(";", 1)[0]?.trim().toLowerCase() ?? "";
264
264
  }
265
265
 
266
- export { DEFAULT_CORS_ALLOW_HEADERS, DEFAULT_CORS_EXPOSE_HEADERS, assertCorsConfig, isOriginAllowed, corsHeaders, corsPreflightResponse, requestCorsHeaders, applyCors, defineMultipartStream, createMultipartStream, contractOnlyService, bindContract, implement, createImplement, createScopedImplement, DEFAULT_PROCESS_SIGNALS, defaultSignalSource, reportSignalError, guardSignalCallback, mediaTypeEssence };
266
+ export { DEFAULT_CORS_ALLOW_HEADERS2, DEFAULT_CORS_EXPOSE_HEADERS2, assertCorsConfig, isOriginAllowed, corsHeaders2, corsPreflightResponse2, requestCorsHeaders, applyCors, defineMultipartStream2, createMultipartStream2, contractOnlyService, bindContract, implement2, createImplement2, createScopedImplement2, DEFAULT_PROCESS_SIGNALS, defaultSignalSource, reportSignalError, guardSignalCallback, mediaTypeEssence };
@@ -1,45 +1,45 @@
1
1
  import {
2
- AppError,
3
- STITCH_ERROR_STATUS
4
- } from "./index-2vtcmrj9.js";
2
+ AppError2,
3
+ STITCH_ERROR_STATUS2
4
+ } from "./index-n53mswt3.js";
5
5
 
6
6
  // src/agent-runtime/sandbox.ts
7
7
  import { z } from "zod";
8
- var AgentSandboxRestrictionSchema = z.enum([
8
+ var AgentSandboxRestrictionSchema2 = z.enum([
9
9
  "network-denied",
10
10
  "write-contained",
11
11
  "secrets-hidden",
12
12
  "process-contained"
13
13
  ]);
14
- var AgentSandboxGradeSchema = z.discriminatedUnion("grade", [
15
- z.object({ grade: z.literal("full"), restrictions: z.array(AgentSandboxRestrictionSchema) }).strict(),
14
+ var AgentSandboxGradeSchema2 = z.discriminatedUnion("grade", [
15
+ z.object({ grade: z.literal("full"), restrictions: z.array(AgentSandboxRestrictionSchema2) }).strict(),
16
16
  z.object({
17
17
  grade: z.literal("partial"),
18
- restrictions: z.array(AgentSandboxRestrictionSchema),
19
- gaps: z.array(AgentSandboxRestrictionSchema)
18
+ restrictions: z.array(AgentSandboxRestrictionSchema2),
19
+ gaps: z.array(AgentSandboxRestrictionSchema2)
20
20
  }).strict(),
21
21
  z.object({ grade: z.literal("unavailable"), reason: z.string().min(1) }).strict()
22
22
  ]);
23
23
  var probes = new WeakMap;
24
- function probeAgentProcessSandbox(sandbox, options = {}) {
24
+ function probeAgentProcessSandbox2(sandbox, options = {}) {
25
25
  if (options.refresh)
26
26
  probes.delete(sandbox);
27
27
  const present = probes.get(sandbox);
28
28
  if (present)
29
29
  return present;
30
- const pending = Promise.resolve(sandbox.probe()).then((grade) => AgentSandboxGradeSchema.parse(grade));
30
+ const pending = Promise.resolve(sandbox.probe()).then((grade) => AgentSandboxGradeSchema2.parse(grade));
31
31
  probes.set(sandbox, pending);
32
32
  return pending;
33
33
  }
34
- function missingSandboxRestrictions(grade, required) {
34
+ function missingSandboxRestrictions2(grade, required) {
35
35
  if (grade.grade === "unavailable")
36
36
  return required;
37
37
  const present = new Set(grade.restrictions);
38
38
  return required.filter((restriction) => !present.has(restriction));
39
39
  }
40
- async function recordAgentSandboxProbe(input) {
41
- const grade = await probeAgentProcessSandbox(input.sandbox);
42
- const missing = missingSandboxRestrictions(grade, input.required);
40
+ async function recordAgentSandboxProbe2(input) {
41
+ const grade = await probeAgentProcessSandbox2(input.sandbox);
42
+ const missing = missingSandboxRestrictions2(grade, input.required);
43
43
  await input.store.appendEvent({
44
44
  conversationId: input.conversationId,
45
45
  kind: "sandbox/probed",
@@ -54,7 +54,7 @@ async function recordAgentSandboxProbe(input) {
54
54
 
55
55
  // src/agent-runtime/coding-tool-refusals.ts
56
56
  function codingRefusal(code, message, options = {}) {
57
- throw new AppError(code, message, STITCH_ERROR_STATUS[code], { message, ...options.details }, options.hint);
57
+ throw new AppError2(code, message, STITCH_ERROR_STATUS2[code], { message, ...options.details }, options.hint);
58
58
  }
59
59
  function codingPathRefusal(code, message, path, options = {}) {
60
60
  codingRefusal(code, message, {
@@ -98,4 +98,4 @@ function refuseUnknownSpillReference(reference) {
98
98
  });
99
99
  }
100
100
 
101
- export { AgentSandboxRestrictionSchema, AgentSandboxGradeSchema, probeAgentProcessSandbox, missingSandboxRestrictions, recordAgentSandboxProbe, codingRefusal, codingPathRefusal, refuseMissingCodingPath, refuseUnknownSpillReference };
101
+ export { AgentSandboxRestrictionSchema2, AgentSandboxGradeSchema2, probeAgentProcessSandbox2, missingSandboxRestrictions2, recordAgentSandboxProbe2, codingRefusal, codingPathRefusal, refuseMissingCodingPath, refuseUnknownSpillReference };